@marimo-team/islands 0.26.1-dev105 → 0.26.1-dev108
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/{ConnectedDataExplorerComponent-C6dY5fiI.js → ConnectedDataExplorerComponent-DQaiOY7w.js} +15 -15
- package/dist/{ErrorBoundary-Bn664FZa.js → ErrorBoundary-BW4TciqU.js} +19 -19
- package/dist/{abnfDiagram-VCTEODGH-Ba0MYVW8.js → abnfDiagram-VCTEODGH-Df80tEYq.js} +2 -2
- package/dist/{any-language-editor-BNe8do3C.js → any-language-editor-BW-gNmbk.js} +2 -2
- package/dist/{architectureDiagram-5GKGNRK7-7MqAehef.js → architectureDiagram-5GKGNRK7-DNNMvKkY.js} +1 -1
- package/dist/{assertNever-5vhHGKOK.js → assertNever-B9_7z-dW.js} +13 -13
- package/dist/{chat-ui-zGgiq5zN.js → chat-ui-Be9X-W22.js} +49 -49
- package/dist/{check-DUIc04aK.js → check-BqF09bSG.js} +1 -1
- package/dist/{chunk-IMKFNOWR-CAWA0HGB.js → chunk-IMKFNOWR-pXqnQ_fj.js} +1 -1
- package/dist/{chunk-SHT3W25Y-BIwVQjG5.js → chunk-SHT3W25Y-BWrxB3I2.js} +1 -1
- package/dist/{chunk-SVP7TREG-Cux251TB.js → chunk-SVP7TREG-CPdQP8_U.js} +1 -1
- package/dist/{chunk-TICWLB2K-DJVQ6khO.js → chunk-TICWLB2K-C5MYCwBz.js} +1 -1
- package/dist/{circle-question-mark-evCnVIut.js → circle-question-mark-YmLYXyvS.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-Cwve77ev.js → classDiagram-ZZMXUADV-Ba0SRm01.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-BAeHKXmD.js → classDiagram-v2-VYDZK3BY-DSSzL_Dk.js} +2 -2
- package/dist/{code-visibility-CMgSFUs7.js → code-visibility-BKmktPMd.js} +18 -18
- package/dist/{common-DWnR77Qk.js → common-CSJAjJGa.js} +168 -168
- package/dist/{copy-icon-CmNLxT5_.js → copy-icon-zP4__HPI.js} +2 -2
- package/dist/{createReducer-m7yAXmDu.js → createReducer-CArOwUaJ.js} +1 -1
- package/dist/{cynefinDiagram-5FMLGOSQ-t4eEkPJh.js → cynefinDiagram-5FMLGOSQ-BOtNvA04.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-IuZuI28B.js → dagre-GXQ25YYZ-FpCEOTxX.js} +1 -1
- package/dist/{data-grid-overlay-editor-zS1h3iMI.js → data-grid-overlay-editor-DTibdR4H.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-D8R5Q_ok.js → diagram-S7CK7UJ4-Cm1HaBuu.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-BGuMPsr-.js → diagram-UQ7AKVKN-D1lA7Ggu.js} +1 -1
- package/dist/{diagram-VX7I27RA-BkTtpO8P.js → diagram-VX7I27RA-BX3e-Rue.js} +1 -1
- package/dist/{diagram-Z3DM3KII-C0__Mxfm.js → diagram-Z3DM3KII-Dgoj7bPf.js} +1 -1
- package/dist/{dialog-BvjfalZ9.js → dialog-DfKgafXJ.js} +30 -30
- package/dist/{dropdown-menu-D0DeN-aL.js → dropdown-menu-Dge_SmqE.js} +168 -168
- package/dist/{ebnfDiagram-PWID7BFC-CSESPZoz.js → ebnfDiagram-PWID7BFC-B0xWiXrz.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-DsDTtabH.js → erDiagram-RLTQ6QDP-Cm-GO31-.js} +1 -1
- package/dist/{error-banner-CXLjTW24.js → error-banner-CfYrJaIb.js} +91 -91
- package/dist/{error-entries-DVclFjaE.js → error-entries-23Z_1oDM.js} +584 -590
- package/dist/{export-context-CkgZeARR.js → export-context-B1jdxzHF.js} +21 -21
- package/dist/{feedback-button-BMGqp8Ff.js → feedback-button-CPu5SV3b.js} +72 -72
- package/dist/{flowDiagram-HODETNUW-qxDPYbfV.js → flowDiagram-HODETNUW-CH6xMlW_.js} +2 -2
- package/dist/{formats-CcQrzFo8.js → formats-Y52bg800.js} +1 -1
- package/dist/{glide-data-editor-Bra6h4KB.js → glide-data-editor-CC9_NDNi.js} +11 -11
- package/dist/{glide-utils-CD8BaFTm.js → glide-utils-BRcuSTCx.js} +2 -2
- package/dist/{globals-_bXqC0R8.js → globals-BFlYTNoR.js} +3 -3
- package/dist/{html-to-image-Cst4BlIm.js → html-to-image-Cw7o1IbE.js} +5073 -5076
- package/dist/{infoDiagram-27XIBGKW-B5hq8RM_.js → infoDiagram-27XIBGKW-DbUO63CX.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-DkHc_9ET.js → ishikawaDiagram-5VMMS53U-CfQrrELH.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-CqkTFXmU.js → kanban-definition-UXKFOSKX-C5SJcu1W.js} +1 -1
- package/dist/{loader-CGrYn73j.js → loader-C9-qRO3m.js} +2 -2
- package/dist/main.js +6696 -6602
- package/dist/{mermaid-pmVHDUQA.js → mermaid-C2alqcd8.js} +34 -34
- package/dist/{mindmap-definition-YA3MSWOX-D6cNa__z.js → mindmap-definition-YA3MSWOX-ByVHE0Ax.js} +1 -1
- package/dist/{number-overlay-editor-XLUhOVa7.js → number-overlay-editor-qDcRKPE0.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-CmWJX_s1.js → pegDiagram-XKGWAZYB-DF5FBKZi.js} +2 -2
- package/dist/{pencil-CxMgOe04.js → pencil-D7jyZPnP.js} +1 -1
- package/dist/{pieDiagram-E7YTZNPT-CAQAxHah.js → pieDiagram-E7YTZNPT-B5n9nBQN.js} +1 -1
- package/dist/{process-output-DizFa5IE.js → process-output-DdBM0lmd.js} +4 -4
- package/dist/{railroadDiagram-O6MQD6OU-jlSsiQg3.js → railroadDiagram-O6MQD6OU-r5t7OYNE.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-DkDjfPhn.js → requirementDiagram-BXWQKSXE-D4QtEyZQ.js} +1 -1
- package/dist/{reveal-component-llpC324_.js → reveal-component-BE1xhtNc.js} +1008 -1008
- package/dist/{select-CEnB18uc.js → select-Buk3aXi1.js} +341 -341
- package/dist/{sequenceDiagram-WJ2MYXX4-DLywsGCW.js → sequenceDiagram-WJ2MYXX4-CK3Atn-z.js} +1 -1
- package/dist/{spec-Dz-Avv1m.js → spec-BEp9O9dy.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-DUmlKwYU.js → stateDiagram-D77RDMKH-C1SxRI8V.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-D646KiXs.js → stateDiagram-v2-MP3YSRHH-DK5X6bsr.js} +2 -2
- package/dist/{static-state-iw0PrHK4.js → static-state-D-aT9dOr.js} +9 -9
- package/dist/{swimlanes-42K2YHIH-L7B1GphF.js → swimlanes-42K2YHIH-DdH5TZdu.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-DEu2wxtC.js → swimlanesDiagram-VR7AAH4N-CWBIvzgR.js} +2 -2
- package/dist/{timeline-definition-24CTP7MA-DDPyx1yG.js → timeline-definition-24CTP7MA-DE7-o2zU.js} +1 -1
- package/dist/{toast-BTjH6fIf.js → toast-b3k4YxaT.js} +54 -54
- package/dist/{tooltip-DyLdBIM4.js → tooltip-D-9pDheN.js} +62 -62
- package/dist/{use-restore-focus-DJ_-uSn_.js → use-restore-focus-CCfk-ey2.js} +1 -1
- package/dist/{useDateFormatter-HpKD0jEC.js → useDateFormatter-DH0uFwfL.js} +2 -2
- package/dist/{useDeepCompareMemoize-CHx-NxMl.js → useDeepCompareMemoize-Dn-ZJVTd.js} +1 -1
- package/dist/{useLifecycle-tPpAt-OE.js → useLifecycle-yjK7JsRL.js} +1 -1
- package/dist/{vega-component-BzNDFvQf.js → vega-component-BIq0qzhQ.js} +8 -8
- package/dist/{vennDiagram-4TSXK5OY-CRwWeb7g.js → vennDiagram-4TSXK5OY-D7yfNz0d.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-DVlG9eoq.js → wardleyDiagram-VM6X3IG4-m5Jcz26Z.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-CM32AISp.js → xychartDiagram-S5SC5T6Z-CA3zV3RW.js} +1 -1
- package/package.json +1 -1
- package/src/__mocks__/intersection-observer.ts +13 -12
- package/src/components/editor/Output.tsx +1 -1
- package/src/components/editor/__tests__/cell-renders.test.tsx +17 -1
- package/src/components/editor/chrome/panels/outline/__tests__/outline-keyboard.test.tsx +517 -68
- package/src/components/editor/chrome/panels/outline/__tests__/useActiveOutline.test.ts +17 -5
- package/src/components/editor/chrome/panels/outline/floating-outline.tsx +29 -59
- package/src/components/editor/chrome/panels/outline/useActiveOutline.tsx +333 -133
- package/src/components/editor/chrome/panels/outline-panel.tsx +5 -19
- package/src/components/editor/notebook-cell.tsx +263 -267
- package/src/core/cells/__tests__/layout.test.ts +1 -1
- package/src/core/cells/__tests__/notebook-outline.test.ts +31 -3
- package/src/core/cells/cells.ts +21 -14
- package/src/core/cells/outline.ts +8 -8
- package/src/core/codemirror/language/extension.ts +6 -3
- package/src/core/codemirror/language/panel/panel.test.tsx +144 -0
- package/src/core/codemirror/language/panel/panel.tsx +9 -6
- package/src/core/codemirror/react-dom/createPanel.tsx +15 -15
- package/src/core/dom/__tests__/outline.test.ts +29 -170
- package/src/core/dom/outline.ts +21 -61
- package/src/core/executions/atoms.ts +12 -4
- package/src/core/islands/components/output-wrapper.tsx +7 -2
- package/src/plugins/layout/OutlinePlugin.tsx +5 -17
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
5
|
-
import { i as
|
|
6
|
-
import { f as
|
|
7
|
-
import { t as
|
|
8
|
-
import { n as
|
|
9
|
-
import { t as
|
|
10
|
-
import { At as
|
|
11
|
-
import { n as ce } from "./toast-
|
|
2
|
+
import { _ as t, g as n, h as r, p as i } from "./button-Z2R2272J.js";
|
|
3
|
+
import { t as a } from "./react-Bgs_wQh3.js";
|
|
4
|
+
import { t as o } from "./compiler-runtime-C5KHtL5D.js";
|
|
5
|
+
import { i as s } from "./copy-icon-zP4__HPI.js";
|
|
6
|
+
import { f as c, h as l } from "./tooltip-D-9pDheN.js";
|
|
7
|
+
import { t as u } from "./check-BqF09bSG.js";
|
|
8
|
+
import { n as d, r as f } from "./assertNever-B9_7z-dW.js";
|
|
9
|
+
import { t as p } from "./jsx-runtime-D8btoEHk.js";
|
|
10
|
+
import { At as m, Bt as h, Cn as ee, Ct as te, Dt as g, Et as ne, Ft as _, It as v, Sn as re, Vt as y, Wt as b, bn as ie, jt as x, p as ae, qt as S, vn as oe, wt as C, yn as se, zt as w } from "./use-restore-focus-CCfk-ey2.js";
|
|
11
|
+
import { n as ce } from "./toast-b3k4YxaT.js";
|
|
12
12
|
import { t as le } from "./objects-DCmMvZtn.js";
|
|
13
|
-
import { t as
|
|
13
|
+
import { t as T } from "./invariant-DLmrl-hA.js";
|
|
14
14
|
import { t as ue } from "./purify.es-DmnrIjg4.js";
|
|
15
15
|
import { r as de } from "./arrays-DoQ-AILx.js";
|
|
16
|
-
import { t as fe } from "./createReducer-
|
|
16
|
+
import { t as fe } from "./createReducer-CArOwUaJ.js";
|
|
17
17
|
import { H as pe, N as me, P as he, _ as ge } from "./dist-BIaGGUbU.js";
|
|
18
|
-
import { a as _e, i as ve, l as ye, u as be } from "./static-state-
|
|
18
|
+
import { a as _e, i as ve, l as ye, u as be } from "./static-state-D-aT9dOr.js";
|
|
19
19
|
import { t as xe } from "./toDate-BZg-byuO.js";
|
|
20
20
|
import { t as Se } from "./capabilities-ba3Dyv8n.js";
|
|
21
|
-
var Ce =
|
|
21
|
+
var Ce = l("external-link", [
|
|
22
22
|
["path", {
|
|
23
23
|
d: "M15 3h6v6",
|
|
24
24
|
key: "1q9fwt"
|
|
@@ -31,20 +31,20 @@ var Ce = c("external-link", [
|
|
|
31
31
|
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
|
|
32
32
|
key: "a6xqqp"
|
|
33
33
|
}]
|
|
34
|
-
]), we =
|
|
34
|
+
]), we = l("minus", [["path", {
|
|
35
35
|
d: "M5 12h14",
|
|
36
36
|
key: "1ays0h"
|
|
37
|
-
}]]),
|
|
37
|
+
}]]), E = /* @__PURE__ */ e(a(), 1), D = p(), Te = Object.defineProperty, O = (e, t) => Te(e, "name", {
|
|
38
38
|
value: t,
|
|
39
39
|
configurable: !0
|
|
40
|
-
}), Ee = "Checkbox", [De, Oe] =
|
|
40
|
+
}), Ee = "Checkbox", [De, Oe] = re(Ee), [ke, Ae] = De(Ee);
|
|
41
41
|
function je(e) {
|
|
42
|
-
let { __scopeCheckbox: t, checked: n, children: r, defaultChecked: i, disabled: a, form: o, name: s, onCheckedChange: c, required: l, value: u = "on", internal_do_not_use_render: d } = e, [f, p] =
|
|
42
|
+
let { __scopeCheckbox: t, checked: n, children: r, defaultChecked: i, disabled: a, form: o, name: s, onCheckedChange: c, required: l, value: u = "on", internal_do_not_use_render: d } = e, [f, p] = se({
|
|
43
43
|
prop: n,
|
|
44
44
|
defaultProp: i ?? !1,
|
|
45
45
|
onChange: c,
|
|
46
46
|
caller: Ee
|
|
47
|
-
}), [m, h] =
|
|
47
|
+
}), [m, h] = E.useState(null), [ee, te] = E.useState(null), [g, ne] = E.useState(null), _ = !m || !!o || !!m.closest("form"), v = {
|
|
48
48
|
checked: f,
|
|
49
49
|
disabled: a,
|
|
50
50
|
setChecked: p,
|
|
@@ -53,54 +53,54 @@ function je(e) {
|
|
|
53
53
|
name: s,
|
|
54
54
|
form: o,
|
|
55
55
|
value: u,
|
|
56
|
-
userClick:
|
|
57
|
-
onUserClick:
|
|
56
|
+
userClick: g,
|
|
57
|
+
onUserClick: ne,
|
|
58
58
|
required: l,
|
|
59
|
-
defaultChecked: !
|
|
60
|
-
isFormControl:
|
|
61
|
-
bubbleInput:
|
|
62
|
-
setBubbleInput:
|
|
59
|
+
defaultChecked: !k(i) && i,
|
|
60
|
+
isFormControl: _,
|
|
61
|
+
bubbleInput: ee,
|
|
62
|
+
setBubbleInput: te
|
|
63
63
|
};
|
|
64
|
-
return /* @__PURE__ */ (0,
|
|
64
|
+
return /* @__PURE__ */ (0, D.jsx)(ke, {
|
|
65
65
|
scope: t,
|
|
66
|
-
...
|
|
67
|
-
children: ze(d) ? d(
|
|
66
|
+
...v,
|
|
67
|
+
children: ze(d) ? d(v) : r
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
var Me = "CheckboxTrigger", Ne = /* @__PURE__ */
|
|
72
|
-
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = Ae(Me, e),
|
|
73
|
-
return
|
|
70
|
+
O(je, "CheckboxProvider");
|
|
71
|
+
var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...r }, a) {
|
|
72
|
+
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = Ae(Me, e), te = i(a, d), g = E.useRef(l);
|
|
73
|
+
return E.useEffect(() => {
|
|
74
74
|
let e = o?.form;
|
|
75
75
|
if (e) {
|
|
76
|
-
let t = /* @__PURE__ */
|
|
76
|
+
let t = /* @__PURE__ */ O(() => f(g.current), "reset");
|
|
77
77
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
78
78
|
}
|
|
79
|
-
}, [o, f]), /* @__PURE__ */ (0,
|
|
79
|
+
}, [o, f]), /* @__PURE__ */ (0, D.jsx)(ee.button, {
|
|
80
80
|
type: "button",
|
|
81
81
|
role: "checkbox",
|
|
82
|
-
"aria-checked":
|
|
82
|
+
"aria-checked": k(l) ? "mixed" : l,
|
|
83
83
|
"aria-required": u,
|
|
84
84
|
"data-state": Be(l),
|
|
85
85
|
"data-disabled": c ? "" : void 0,
|
|
86
86
|
disabled: c,
|
|
87
87
|
value: s,
|
|
88
|
-
...
|
|
89
|
-
ref:
|
|
90
|
-
onKeyDown:
|
|
88
|
+
...r,
|
|
89
|
+
ref: te,
|
|
90
|
+
onKeyDown: ie(t, (e) => {
|
|
91
91
|
e.key === "Enter" && e.preventDefault();
|
|
92
92
|
}),
|
|
93
|
-
onClick:
|
|
93
|
+
onClick: ie(n, (e) => {
|
|
94
94
|
let t = e.isPropagationStopped();
|
|
95
95
|
p({
|
|
96
|
-
requestedChecked:
|
|
96
|
+
requestedChecked: k(l) ? !0 : !l,
|
|
97
97
|
hasConsumerStoppedPropagation: t
|
|
98
|
-
}), f((e) =>
|
|
98
|
+
}), f((e) => k(e) ? !0 : !e), h && m && (t || e.stopPropagation());
|
|
99
99
|
})
|
|
100
100
|
});
|
|
101
|
-
}, "CheckboxTrigger")), Pe = /* @__PURE__ */
|
|
101
|
+
}, "CheckboxTrigger")), Pe = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function(e, t) {
|
|
102
102
|
let { __scopeCheckbox: n, name: r, checked: i, defaultChecked: a, required: o, disabled: s, value: c, onCheckedChange: l, form: u, ...d } = e;
|
|
103
|
-
return /* @__PURE__ */ (0,
|
|
103
|
+
return /* @__PURE__ */ (0, D.jsx)(je, {
|
|
104
104
|
__scopeCheckbox: n,
|
|
105
105
|
checked: i,
|
|
106
106
|
defaultChecked: a,
|
|
@@ -110,17 +110,17 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
110
110
|
name: r,
|
|
111
111
|
form: u,
|
|
112
112
|
value: c,
|
|
113
|
-
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0,
|
|
113
|
+
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, D.jsxs)(D.Fragment, { children: [/* @__PURE__ */ (0, D.jsx)(Ne, {
|
|
114
114
|
...d,
|
|
115
115
|
ref: t,
|
|
116
116
|
__scopeCheckbox: n
|
|
117
|
-
}), e && /* @__PURE__ */ (0,
|
|
117
|
+
}), e && /* @__PURE__ */ (0, D.jsx)(Re, { __scopeCheckbox: n })] })
|
|
118
118
|
});
|
|
119
|
-
}, "Checkbox")), Fe = "CheckboxIndicator", Ie = /* @__PURE__ */
|
|
119
|
+
}, "Checkbox")), Fe = "CheckboxIndicator", Ie = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function(e, t) {
|
|
120
120
|
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = Ae(Fe, n);
|
|
121
|
-
return /* @__PURE__ */ (0,
|
|
122
|
-
present: r ||
|
|
123
|
-
children: /* @__PURE__ */ (0,
|
|
121
|
+
return /* @__PURE__ */ (0, D.jsx)(oe, {
|
|
122
|
+
present: r || k(a.checked) || a.checked === !0,
|
|
123
|
+
children: /* @__PURE__ */ (0, D.jsx)(ee.span, {
|
|
124
124
|
"data-state": Be(a.checked),
|
|
125
125
|
"data-disabled": a.disabled ? "" : void 0,
|
|
126
126
|
...i,
|
|
@@ -131,33 +131,33 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
131
131
|
}
|
|
132
132
|
})
|
|
133
133
|
});
|
|
134
|
-
}, "CheckboxIndicator")), Le = "CheckboxBubbleInput", Re = /* @__PURE__ */
|
|
135
|
-
let { control: a, userClick: o, checked:
|
|
136
|
-
|
|
134
|
+
}, "CheckboxIndicator")), Le = "CheckboxBubbleInput", Re = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function({ __scopeCheckbox: e, onClick: t, ...n }, r) {
|
|
135
|
+
let { control: a, userClick: o, checked: s, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: te } = Ae(Le, e), g = i(r, te), ne = c(a), _ = E.useRef(!1), v = E.useRef(s), re = E.useRef(o), y = E.useRef(null);
|
|
136
|
+
E.useEffect(() => {
|
|
137
137
|
let e = h;
|
|
138
138
|
if (!e) return;
|
|
139
139
|
let t = window.HTMLInputElement.prototype, n = Object.getOwnPropertyDescriptor(t, "checked").set;
|
|
140
140
|
if (!n) return;
|
|
141
|
-
let r =
|
|
142
|
-
|
|
143
|
-
let i = o !== null && o !==
|
|
144
|
-
if (
|
|
141
|
+
let r = v.current !== s;
|
|
142
|
+
v.current = s;
|
|
143
|
+
let i = o !== null && o !== re.current;
|
|
144
|
+
if (re.current = o, i) y.current = r ? null : o, r && (e.indeterminate = k(s), n.call(e, !k(s) && s)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
|
|
145
145
|
else if (r) {
|
|
146
|
-
let t =
|
|
147
|
-
|
|
148
|
-
let r = t?.requestedChecked ===
|
|
149
|
-
|
|
146
|
+
let t = y.current;
|
|
147
|
+
y.current = null;
|
|
148
|
+
let r = t?.requestedChecked === s;
|
|
149
|
+
_.current = !0, e.indeterminate = k(s), n.call(e, !k(s) && s), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), _.current = !1;
|
|
150
150
|
}
|
|
151
151
|
}, [
|
|
152
152
|
h,
|
|
153
|
-
|
|
153
|
+
s,
|
|
154
154
|
o
|
|
155
155
|
]);
|
|
156
|
-
let
|
|
157
|
-
return /* @__PURE__ */ (0,
|
|
156
|
+
let b = E.useRef(!k(s) && s);
|
|
157
|
+
return /* @__PURE__ */ (0, D.jsx)(ee.input, {
|
|
158
158
|
type: "checkbox",
|
|
159
159
|
"aria-hidden": !0,
|
|
160
|
-
defaultChecked: l ??
|
|
160
|
+
defaultChecked: l ?? b.current,
|
|
161
161
|
required: u,
|
|
162
162
|
disabled: d,
|
|
163
163
|
name: f,
|
|
@@ -165,13 +165,13 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
165
165
|
form: m,
|
|
166
166
|
...n,
|
|
167
167
|
tabIndex: -1,
|
|
168
|
-
ref:
|
|
169
|
-
onClick:
|
|
170
|
-
|
|
168
|
+
ref: g,
|
|
169
|
+
onClick: ie(t, (e) => {
|
|
170
|
+
_.current && e.stopPropagation();
|
|
171
171
|
}),
|
|
172
172
|
style: {
|
|
173
173
|
...n.style,
|
|
174
|
-
...
|
|
174
|
+
...ne,
|
|
175
175
|
position: "absolute",
|
|
176
176
|
pointerEvents: "none",
|
|
177
177
|
opacity: 0,
|
|
@@ -183,15 +183,15 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
183
183
|
function ze(e) {
|
|
184
184
|
return typeof e == "function";
|
|
185
185
|
}
|
|
186
|
-
|
|
187
|
-
function
|
|
186
|
+
O(ze, "isFunction");
|
|
187
|
+
function k(e) {
|
|
188
188
|
return e === "indeterminate";
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
O(k, "isIndeterminate");
|
|
191
191
|
function Be(e) {
|
|
192
|
-
return
|
|
192
|
+
return k(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
O(Be, "getState");
|
|
195
195
|
//#endregion
|
|
196
196
|
//#region src/plugins/core/sanitize-html.ts
|
|
197
197
|
var Ve = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix|zotero):|[^a-z]|[-a-z+.]+(?:[^-a-z+.:]|$))/i;
|
|
@@ -224,68 +224,53 @@ function He(e) {
|
|
|
224
224
|
}
|
|
225
225
|
//#endregion
|
|
226
226
|
//#region src/core/dom/outline.ts
|
|
227
|
-
var Ue = [
|
|
228
|
-
"
|
|
229
|
-
"
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
|
|
233
|
-
|
|
227
|
+
var Ue = /* @__PURE__ */ new Set([
|
|
228
|
+
"h1",
|
|
229
|
+
"h2",
|
|
230
|
+
"h3",
|
|
231
|
+
"h4",
|
|
232
|
+
"h5",
|
|
233
|
+
"h6"
|
|
234
|
+
]), We = [...Ue].join(", "), Ge = ":not(:is(marimo-carousel, marimo-tabs, marimo-accordion, marimo-sidebar) *)", Ke = `:is(${We})${Ge}`, qe = `:is(${We}, [id])${Ge}`;
|
|
235
|
+
function Je(e) {
|
|
234
236
|
if (typeof DOMParser > "u") return null;
|
|
235
|
-
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
236
|
-
for (let e of
|
|
237
|
+
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(Ke);
|
|
238
|
+
for (let e of n) {
|
|
237
239
|
let n = e.textContent;
|
|
238
|
-
if (
|
|
240
|
+
if (!n) continue;
|
|
239
241
|
let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
|
|
240
242
|
name: n,
|
|
241
|
-
level: r
|
|
242
|
-
by: qe(e)
|
|
243
|
+
level: r
|
|
243
244
|
};
|
|
244
|
-
i !== n && (a.html = He(i)), t.push(a);
|
|
245
|
+
e.id && (a.id = e.id), i !== n && (a.html = He(i)), t.push(a);
|
|
245
246
|
}
|
|
246
247
|
return { items: t };
|
|
247
248
|
}
|
|
248
|
-
function Ke(e) {
|
|
249
|
-
if (!e.includes("\"")) return `"${e}"`;
|
|
250
|
-
if (!e.includes("'")) return `'${e}'`;
|
|
251
|
-
let t = e.split("\""), n = [];
|
|
252
|
-
for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
|
|
253
|
-
return `concat(${n.join(", ")})`;
|
|
254
|
-
}
|
|
255
|
-
function qe(e) {
|
|
256
|
-
let t = e.id;
|
|
257
|
-
if (t) return { id: t };
|
|
258
|
-
let n = e.textContent ?? "";
|
|
259
|
-
return { path: `//${e.tagName}[contains(., ${Ke(n)})]` };
|
|
260
|
-
}
|
|
261
|
-
function Je(e) {
|
|
262
|
-
return { items: e.filter(Boolean).flatMap((e) => e.items) };
|
|
263
|
-
}
|
|
264
249
|
function Ye(e) {
|
|
265
250
|
if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
|
|
266
251
|
try {
|
|
267
|
-
return
|
|
252
|
+
return T(typeof e.data == "string", "expected string"), Je(e.data);
|
|
268
253
|
} catch {
|
|
269
|
-
return
|
|
254
|
+
return n.error("Failed to parse outline"), null;
|
|
270
255
|
}
|
|
271
256
|
}
|
|
272
257
|
function Xe(e) {
|
|
273
258
|
return e != null && e.items.some((e) => e.level <= 3);
|
|
274
259
|
}
|
|
275
|
-
function Ze(e,
|
|
276
|
-
let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i =
|
|
277
|
-
if (i == null || i.items.length === 0) return
|
|
260
|
+
function Ze(e, t) {
|
|
261
|
+
let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = t[e];
|
|
262
|
+
if (i == null || i.items.length === 0) return n.warn("Failed to find a starting outline"), null;
|
|
278
263
|
let a = r(i), o = e + 1;
|
|
279
|
-
for (; o <
|
|
280
|
-
let
|
|
281
|
-
if (
|
|
264
|
+
for (; o < t.length;) {
|
|
265
|
+
let n = t[o];
|
|
266
|
+
if (n && r(n) <= a) return [e, o - 1];
|
|
282
267
|
o++;
|
|
283
268
|
}
|
|
284
|
-
return [e,
|
|
269
|
+
return [e, t.length - 1];
|
|
285
270
|
}
|
|
286
271
|
//#endregion
|
|
287
272
|
//#region src/core/notebook/replica/connection.ts
|
|
288
|
-
var
|
|
273
|
+
var A = {
|
|
289
274
|
NOT_STARTED: "NOT_STARTED",
|
|
290
275
|
CONNECTING: "CONNECTING",
|
|
291
276
|
OPEN: "OPEN",
|
|
@@ -296,7 +281,7 @@ var k = {
|
|
|
296
281
|
};
|
|
297
282
|
//#endregion
|
|
298
283
|
//#region src/core/notebook/replica/execution-state.ts
|
|
299
|
-
function
|
|
284
|
+
function j(e) {
|
|
300
285
|
let { state: t } = e.record;
|
|
301
286
|
return t.status === "completed" && t.outcome.kind !== "succeeded" ? t.outcome : e.output === null ? t.status === "completed" ? {
|
|
302
287
|
kind: "output",
|
|
@@ -306,10 +291,10 @@ function A(e) {
|
|
|
306
291
|
media: e.output.media
|
|
307
292
|
};
|
|
308
293
|
}
|
|
309
|
-
function
|
|
294
|
+
function M(e) {
|
|
310
295
|
return e.state.status === "queued" ? null : e.state.started_at;
|
|
311
296
|
}
|
|
312
|
-
function
|
|
297
|
+
function N(e) {
|
|
313
298
|
return e.state.status === "completed" ? e.state.completed_at : null;
|
|
314
299
|
}
|
|
315
300
|
function $e(e) {
|
|
@@ -327,8 +312,8 @@ function et(e, t) {
|
|
|
327
312
|
}
|
|
328
313
|
function tt(e, t) {
|
|
329
314
|
let { record: n, output: r, outputVersion: i } = t;
|
|
330
|
-
if (n.cell_id !== null ||
|
|
331
|
-
let a = (e) => Date.parse(
|
|
315
|
+
if (n.cell_id !== null || j(t) === null) return e;
|
|
316
|
+
let a = (e) => Date.parse(N(e) ?? M(e) ?? "1970-01-01T00:00:00Z");
|
|
332
317
|
return e !== null && a(e.record) > a(n) ? e : {
|
|
333
318
|
record: n,
|
|
334
319
|
output: r,
|
|
@@ -348,17 +333,17 @@ function nt(e) {
|
|
|
348
333
|
function rt(e) {
|
|
349
334
|
return [...e.items.values()].toSorted((e, t) => e.seq - t.seq);
|
|
350
335
|
}
|
|
351
|
-
function
|
|
336
|
+
function P(e, t) {
|
|
352
337
|
if (!e.has(t)) return e;
|
|
353
338
|
let n = new Map(e);
|
|
354
339
|
return n.delete(t), n;
|
|
355
340
|
}
|
|
356
341
|
function it(e, t) {
|
|
357
|
-
let n = e.scratchConsole, { id: r, cell_id: i } = t.record, a =
|
|
342
|
+
let n = e.scratchConsole, { id: r, cell_id: i } = t.record, a = M(t.record);
|
|
358
343
|
if (i !== null || a === null) return n;
|
|
359
344
|
if (!n || n.record.id === r) return t;
|
|
360
345
|
let o = e.executions.get(r);
|
|
361
|
-
return o &&
|
|
346
|
+
return o && M(o.record) !== null ? n : Date.parse(a) >= Date.parse(M(n.record) ?? "") ? t : n;
|
|
362
347
|
}
|
|
363
348
|
function at(e, t) {
|
|
364
349
|
let { id: n } = t.record;
|
|
@@ -372,18 +357,18 @@ function ot(e, t) {
|
|
|
372
357
|
let n = e.executions.get(t);
|
|
373
358
|
if (n === void 0) return e.pendingItems?.has(t) ? {
|
|
374
359
|
...e,
|
|
375
|
-
pendingItems:
|
|
360
|
+
pendingItems: P(e.pendingItems, t)
|
|
376
361
|
} : e;
|
|
377
|
-
let r = n.record.cell_id, i = r !== null && e.latest.get(r) === t, a =
|
|
362
|
+
let r = n.record.cell_id, i = r !== null && e.latest.get(r) === t, a = P(e.executions, t), o = e.latest;
|
|
378
363
|
if (i) {
|
|
379
364
|
let t = e.results.get(r);
|
|
380
|
-
o = t && a.has(t.record.id) ? new Map(o).set(r, t.record.id) :
|
|
365
|
+
o = t && a.has(t.record.id) ? new Map(o).set(r, t.record.id) : P(o, r);
|
|
381
366
|
}
|
|
382
367
|
return {
|
|
383
368
|
...e,
|
|
384
369
|
executions: a,
|
|
385
370
|
latest: o,
|
|
386
|
-
variables: i ?
|
|
371
|
+
variables: i ? P(e.variables, r) : e.variables,
|
|
387
372
|
scratchConsole: e.scratchConsole?.record.id === t ? void 0 : e.scratchConsole
|
|
388
373
|
};
|
|
389
374
|
}
|
|
@@ -410,7 +395,7 @@ function ct(e, t) {
|
|
|
410
395
|
for (let n of e.executions.values()) if (n.items.has(t)) return at(e, {
|
|
411
396
|
...n,
|
|
412
397
|
append: void 0,
|
|
413
|
-
items:
|
|
398
|
+
items: P(n.items, t)
|
|
414
399
|
});
|
|
415
400
|
return dt(e, t);
|
|
416
401
|
}
|
|
@@ -426,7 +411,7 @@ function lt(e, t, n) {
|
|
|
426
411
|
function ut(e, t) {
|
|
427
412
|
for (let [n, r] of e.variables) if (r.has(t)) {
|
|
428
413
|
let i = new Map(e.variables);
|
|
429
|
-
return r.size === 1 ? i.delete(n) : i.set(n,
|
|
414
|
+
return r.size === 1 ? i.delete(n) : i.set(n, P(r, t)), {
|
|
430
415
|
...e,
|
|
431
416
|
variables: i
|
|
432
417
|
};
|
|
@@ -444,7 +429,7 @@ function dt(e, t) {
|
|
|
444
429
|
return e;
|
|
445
430
|
}
|
|
446
431
|
function ft(e, t) {
|
|
447
|
-
return JSON.stringify(
|
|
432
|
+
return JSON.stringify(j(e)) === JSON.stringify(j(t));
|
|
448
433
|
}
|
|
449
434
|
function pt(e, t) {
|
|
450
435
|
return {
|
|
@@ -453,7 +438,7 @@ function pt(e, t) {
|
|
|
453
438
|
scratch: tt(e.scratch, t)
|
|
454
439
|
};
|
|
455
440
|
}
|
|
456
|
-
function
|
|
441
|
+
function F(e, t, n) {
|
|
457
442
|
let r = t.execution_id, i = e.executions.get(r);
|
|
458
443
|
if (i === void 0) {
|
|
459
444
|
if (n === "live") return e;
|
|
@@ -522,7 +507,7 @@ var ht = {
|
|
|
522
507
|
},
|
|
523
508
|
"cell.removed": (e, { data: t }) => ({
|
|
524
509
|
...e,
|
|
525
|
-
results:
|
|
510
|
+
results: P(e.results, t.id)
|
|
526
511
|
}),
|
|
527
512
|
run: (e, { data: t }) => ({
|
|
528
513
|
...e,
|
|
@@ -531,7 +516,7 @@ var ht = {
|
|
|
531
516
|
}),
|
|
532
517
|
"run.removed": (e, { data: t }) => e.runs.has(t.id) ? {
|
|
533
518
|
...e,
|
|
534
|
-
runs:
|
|
519
|
+
runs: P(e.runs, t.id)
|
|
535
520
|
} : e,
|
|
536
521
|
execution: (e, { data: { execution: t } }, { phase: n }) => {
|
|
537
522
|
let r = e.executions.get(t.id), i = {
|
|
@@ -547,9 +532,9 @@ var ht = {
|
|
|
547
532
|
if (o && e.pendingItems) {
|
|
548
533
|
c = {
|
|
549
534
|
...c,
|
|
550
|
-
pendingItems:
|
|
535
|
+
pendingItems: P(e.pendingItems, t.id)
|
|
551
536
|
};
|
|
552
|
-
for (let e of o) "kind" in e || (c =
|
|
537
|
+
for (let e of o) "kind" in e || (c = F(c, e, n));
|
|
553
538
|
}
|
|
554
539
|
let l = t.cell_id;
|
|
555
540
|
if (l === null || r !== void 0) return c;
|
|
@@ -560,19 +545,19 @@ var ht = {
|
|
|
560
545
|
};
|
|
561
546
|
},
|
|
562
547
|
"execution.removed": (e, { data: t }) => ot(e, t.id),
|
|
563
|
-
output: (e, { data: t }, { phase: n }) =>
|
|
564
|
-
console: (e, { data: t }, { phase: n }) =>
|
|
548
|
+
output: (e, { data: t }, { phase: n }) => F(e, t.output, n),
|
|
549
|
+
console: (e, { data: t }, { phase: n }) => F(e, {
|
|
565
550
|
...t.console,
|
|
566
551
|
kind: "console",
|
|
567
552
|
time: t.time
|
|
568
553
|
}, n),
|
|
569
554
|
"console.removed": (e, { data: t }) => ct(e, t.id),
|
|
570
|
-
input: (e, { data: t }, { phase: n }) =>
|
|
555
|
+
input: (e, { data: t }, { phase: n }) => F(e, {
|
|
571
556
|
...t.input,
|
|
572
557
|
kind: "input",
|
|
573
558
|
time: t.time
|
|
574
559
|
}, n),
|
|
575
|
-
variable: (e, { data: t }, { phase: n }) =>
|
|
560
|
+
variable: (e, { data: t }, { phase: n }) => F(e, t.variable, n),
|
|
576
561
|
"variable.removed": (e, { data: t }) => ut(e, t.id),
|
|
577
562
|
ready: (e) => e.pendingItems ? {
|
|
578
563
|
...e,
|
|
@@ -583,8 +568,8 @@ var ht = {
|
|
|
583
568
|
//#endregion
|
|
584
569
|
//#region src/core/state/atom-with-selected-inputs.ts
|
|
585
570
|
function gt(e, t, n) {
|
|
586
|
-
let r =
|
|
587
|
-
return
|
|
571
|
+
let r = w(e, t, de);
|
|
572
|
+
return S((e) => n(e(r)));
|
|
588
573
|
}
|
|
589
574
|
//#endregion
|
|
590
575
|
//#region src/core/executions/freshness.ts
|
|
@@ -611,7 +596,7 @@ function yt(e) {
|
|
|
611
596
|
let n = r(t.execution_id);
|
|
612
597
|
if (n === void 0) return !1;
|
|
613
598
|
if (n.runtime_id === e.runtime_id) return !0;
|
|
614
|
-
let i =
|
|
599
|
+
let i = N(n) ?? M(n), a = N(e);
|
|
615
600
|
return i !== null && a !== null && Date.parse(i) > Date.parse(a);
|
|
616
601
|
})) return !0;
|
|
617
602
|
continue;
|
|
@@ -654,7 +639,7 @@ function Ct(e) {
|
|
|
654
639
|
return e === null ? 0 : Date.parse(e) / 1e3;
|
|
655
640
|
}
|
|
656
641
|
function wt(e) {
|
|
657
|
-
return Ct(
|
|
642
|
+
return Ct(N(e) ?? M(e));
|
|
658
643
|
}
|
|
659
644
|
function Tt(e, t) {
|
|
660
645
|
return {
|
|
@@ -664,7 +649,7 @@ function Tt(e, t) {
|
|
|
664
649
|
timestamp: wt(e)
|
|
665
650
|
};
|
|
666
651
|
}
|
|
667
|
-
function
|
|
652
|
+
function I(e, t) {
|
|
668
653
|
return {
|
|
669
654
|
channel: "marimo-error",
|
|
670
655
|
mimetype: xt,
|
|
@@ -704,21 +689,21 @@ function Dt(e) {
|
|
|
704
689
|
}
|
|
705
690
|
function Ot(e, t) {
|
|
706
691
|
let n = t.related[0];
|
|
707
|
-
if (n !== void 0 && t.reason === "upstream-stopped") return
|
|
692
|
+
if (n !== void 0 && t.reason === "upstream-stopped") return I(e, [{
|
|
708
693
|
type: "ancestor-stopped",
|
|
709
694
|
msg: t.message,
|
|
710
695
|
raising_cell: n.cell_id
|
|
711
696
|
}]);
|
|
712
697
|
if (n !== void 0 && t.reason === "upstream-failed") {
|
|
713
698
|
let r = t.related.slice(1).find((t) => t.cell_id !== e.cell_id);
|
|
714
|
-
return
|
|
699
|
+
return I(e, [{
|
|
715
700
|
type: "ancestor-prevented",
|
|
716
701
|
msg: t.message,
|
|
717
702
|
raising_cell: n.cell_id,
|
|
718
703
|
blamed_cell: r === void 0 ? null : r.cell_id
|
|
719
704
|
}]);
|
|
720
705
|
}
|
|
721
|
-
return
|
|
706
|
+
return I(e, [{
|
|
722
707
|
type: "diagnostic",
|
|
723
708
|
kind: t.reason,
|
|
724
709
|
msg: t.message,
|
|
@@ -740,12 +725,12 @@ function jt(e, t, n) {
|
|
|
740
725
|
};
|
|
741
726
|
}
|
|
742
727
|
function Mt(e) {
|
|
743
|
-
let { record: t } = e, n =
|
|
728
|
+
let { record: t } = e, n = j(e);
|
|
744
729
|
if (n === null) return null;
|
|
745
730
|
switch (n.kind) {
|
|
746
731
|
case "output": return n.media === null ? null : Tt(t, n.media);
|
|
747
|
-
case "failed": return
|
|
748
|
-
case "cancelled": return
|
|
732
|
+
case "failed": return I(t, [Dt(n.error)]);
|
|
733
|
+
case "cancelled": return I(t, [{ type: "interruption" }]);
|
|
749
734
|
case "skipped": return Ot(t, n);
|
|
750
735
|
}
|
|
751
736
|
}
|
|
@@ -754,7 +739,7 @@ function Nt(e, t) {
|
|
|
754
739
|
return Pt(n === void 0 ? void 0 : e.executions.executions.get(n), e.results.get(t) ?? null);
|
|
755
740
|
}
|
|
756
741
|
function Pt(e, t) {
|
|
757
|
-
return e !== void 0 &&
|
|
742
|
+
return e !== void 0 && j(e) !== null && e.record.state.status !== "completed" ? e : e?.record.state.status === "running" && t !== null && j(t)?.kind === "skipped" ? null : t;
|
|
758
743
|
}
|
|
759
744
|
function Ft(e, t) {
|
|
760
745
|
return e?.execution === t.record.id && e.version === t.outputVersion;
|
|
@@ -810,7 +795,7 @@ var zt = /* @__PURE__ */ new WeakMap();
|
|
|
810
795
|
function Bt(e) {
|
|
811
796
|
let t = zt.get(e);
|
|
812
797
|
if (t) return t;
|
|
813
|
-
let n =
|
|
798
|
+
let n = M(e), r = N(e), i = n === null ? null : Lt.parse(n), a = {
|
|
814
799
|
startedAt: i,
|
|
815
800
|
duration: i === null || r === null ? null : Lt.parse(r).since(i)
|
|
816
801
|
};
|
|
@@ -908,16 +893,16 @@ var $t = {
|
|
|
908
893
|
latest: /* @__PURE__ */ new Map(),
|
|
909
894
|
results: /* @__PURE__ */ new Map(),
|
|
910
895
|
scratch: null
|
|
911
|
-
}, en = /* @__PURE__ */ new Map(),
|
|
912
|
-
function
|
|
896
|
+
}, en = /* @__PURE__ */ new Map(), tn = /* @__PURE__ */ new Map(), nn = /* @__PURE__ */ new Set(), rn = /* @__PURE__ */ new Set(), an = /* @__PURE__ */ new Set(), on = /* @__PURE__ */ new Map(), L = S(null);
|
|
897
|
+
function sn(e, t) {
|
|
913
898
|
return t !== null && e.replica === t.replica && e.id === t.id && e.generation === t.generation;
|
|
914
899
|
}
|
|
915
|
-
function
|
|
916
|
-
return e !== null &&
|
|
900
|
+
function cn(e, t, n) {
|
|
901
|
+
return e !== null && sn(e.notebook, t) ? e.value : n;
|
|
917
902
|
}
|
|
918
|
-
function
|
|
919
|
-
return
|
|
920
|
-
let n = t(
|
|
903
|
+
function ln(e) {
|
|
904
|
+
return S((t) => {
|
|
905
|
+
let n = t(x), r = t(e);
|
|
921
906
|
if (n === null || r === null) return null;
|
|
922
907
|
let i = t(r.notebookAtom);
|
|
923
908
|
return i === null ? null : {
|
|
@@ -927,39 +912,39 @@ function cn(e) {
|
|
|
927
912
|
};
|
|
928
913
|
});
|
|
929
914
|
}
|
|
930
|
-
var
|
|
931
|
-
function
|
|
932
|
-
return
|
|
915
|
+
var un = ln(x);
|
|
916
|
+
function dn(e, t) {
|
|
917
|
+
return sn(t.notebook, e.get(un));
|
|
933
918
|
}
|
|
934
|
-
function
|
|
935
|
-
let t =
|
|
936
|
-
let n =
|
|
937
|
-
return n.size === 0 ?
|
|
938
|
-
}), r =
|
|
939
|
-
let n = t(e), r = n && t(n.analysisAtom), i = r ? Ht(r.analysis, r.document.cells.values()) :
|
|
919
|
+
function fn(e) {
|
|
920
|
+
let t = ln(e), n = S((e) => {
|
|
921
|
+
let n = cn(e(L), e(t), nn);
|
|
922
|
+
return n.size === 0 ? rn : new Set([...n].flatMap((e) => e.cells));
|
|
923
|
+
}), r = S((t) => {
|
|
924
|
+
let n = t(e), r = n && t(n.analysisAtom), i = r ? Ht(r.analysis, r.document.cells.values()) : an;
|
|
940
925
|
return {
|
|
941
926
|
shownBlocked: i,
|
|
942
|
-
blocked: r?.freshness === "current" ? i :
|
|
927
|
+
blocked: r?.freshness === "current" ? i : an
|
|
943
928
|
};
|
|
944
929
|
});
|
|
945
|
-
return
|
|
930
|
+
return S((t) => {
|
|
946
931
|
let i = t(e), a = i === null ? null : t(i.shownDocumentAtom);
|
|
947
932
|
return {
|
|
948
933
|
executions: i === null ? $t : t(i.executionsAtom),
|
|
949
934
|
results: i === null ? en : t(i.resultsAtom),
|
|
950
|
-
cells: a?.cells ??
|
|
935
|
+
cells: a?.cells ?? tn,
|
|
951
936
|
requested: t(n),
|
|
952
937
|
...t(r),
|
|
953
938
|
runtimeId: i === null ? null : t(i.runtimeAtom)?.id ?? null
|
|
954
939
|
};
|
|
955
940
|
});
|
|
956
941
|
}
|
|
957
|
-
var
|
|
958
|
-
function
|
|
959
|
-
let t =
|
|
942
|
+
var pn = fn(x), mn = fn(m);
|
|
943
|
+
function hn(e) {
|
|
944
|
+
let t = w(S((t) => {
|
|
960
945
|
let n = t(e), r = n === null ? null : t(n.shownDocumentAtom);
|
|
961
946
|
return n === null || r === null ? {
|
|
962
|
-
cells:
|
|
947
|
+
cells: tn,
|
|
963
948
|
executions: $t,
|
|
964
949
|
results: en
|
|
965
950
|
} : {
|
|
@@ -967,47 +952,47 @@ function mn(e) {
|
|
|
967
952
|
executions: t(n.executionsAtom),
|
|
968
953
|
results: t(n.resultsAtom)
|
|
969
954
|
};
|
|
970
|
-
}), (e) => e, (e, t) => e.cells === t.cells && e.executions.variables === t.executions.variables && e.executions.latest === t.executions.latest &&
|
|
971
|
-
return
|
|
955
|
+
}), (e) => e, (e, t) => e.cells === t.cells && e.executions.variables === t.executions.variables && e.executions.latest === t.executions.latest && gn(e.executions.executions, t.executions.executions) && gn(e.results, t.results));
|
|
956
|
+
return S((e) => yt(e(t)));
|
|
972
957
|
}
|
|
973
|
-
function
|
|
958
|
+
function gn(e, t) {
|
|
974
959
|
if (e === t) return !0;
|
|
975
960
|
if (e.size !== t.size) return !1;
|
|
976
961
|
for (let [n, r] of e) if (!t.has(n) || r?.record !== t.get(n)?.record) return !1;
|
|
977
962
|
return !0;
|
|
978
963
|
}
|
|
979
|
-
|
|
980
|
-
var
|
|
981
|
-
let t = e(
|
|
964
|
+
hn(x);
|
|
965
|
+
var _n = hn(m), vn = S(null), yn = S((e) => {
|
|
966
|
+
let t = e(x), n = e(m), r = n === null ? null : e(n.shownDocumentAtom);
|
|
982
967
|
return t === null || n === null || r === null ? null : {
|
|
983
968
|
replica: t,
|
|
984
969
|
id: r.revision.notebook_id,
|
|
985
970
|
generation: e(n.generationAtom)
|
|
986
971
|
};
|
|
987
|
-
}), R =
|
|
988
|
-
let t = e(
|
|
972
|
+
}), R = S((e) => {
|
|
973
|
+
let t = e(m);
|
|
989
974
|
return {
|
|
990
975
|
executions: t === null ? $t : e(t.executionsAtom),
|
|
991
976
|
results: t === null ? en : e(t.resultsAtom),
|
|
992
|
-
cleared:
|
|
993
|
-
cells: t === null ?
|
|
977
|
+
cleared: cn(e(vn), e(yn), on),
|
|
978
|
+
cells: t === null ? tn : e(t.documentAtom)?.cells ?? tn
|
|
994
979
|
};
|
|
995
|
-
}),
|
|
996
|
-
|
|
980
|
+
}), bn = w(R, (e) => [.../* @__PURE__ */ new Set([...e.results.keys(), ...e.executions.latest.keys()])], de);
|
|
981
|
+
S((e) => {
|
|
997
982
|
let t = /* @__PURE__ */ new Map();
|
|
998
|
-
for (let n of e(
|
|
983
|
+
for (let n of e(bn)) {
|
|
999
984
|
let r = e(z(n));
|
|
1000
985
|
r !== null && t.set(n, r);
|
|
1001
986
|
}
|
|
1002
987
|
return t;
|
|
1003
988
|
});
|
|
1004
|
-
function
|
|
989
|
+
function xn(e, t) {
|
|
1005
990
|
let n = e.latest.get(t);
|
|
1006
991
|
return n === void 0 ? void 0 : e.executions.get(n);
|
|
1007
992
|
}
|
|
1008
|
-
var
|
|
1009
|
-
let t = gt(
|
|
1010
|
-
|
|
993
|
+
var Sn = _((e) => {
|
|
994
|
+
let t = gt(mn, (t) => [
|
|
995
|
+
xn(t.executions, e)?.record,
|
|
1011
996
|
t.results.get(e)?.record,
|
|
1012
997
|
t.cells.get(e),
|
|
1013
998
|
t.requested.has(e),
|
|
@@ -1023,10 +1008,10 @@ var xn = v((e) => {
|
|
|
1023
1008
|
runtimeId: s,
|
|
1024
1009
|
queued: r !== void 0 && !r.config.disabled && !a && (i || qt(c, e, t?.run_id ?? n?.run_id))
|
|
1025
1010
|
}));
|
|
1026
|
-
return
|
|
1027
|
-
}), z =
|
|
1011
|
+
return w(t, (e) => e, y);
|
|
1012
|
+
}), z = _((e) => {
|
|
1028
1013
|
let t = gt(R, (t) => {
|
|
1029
|
-
let n =
|
|
1014
|
+
let n = xn(t.executions, e);
|
|
1030
1015
|
return [
|
|
1031
1016
|
n?.record,
|
|
1032
1017
|
n?.output,
|
|
@@ -1040,40 +1025,46 @@ var xn = v((e) => {
|
|
|
1040
1025
|
output: t ?? null,
|
|
1041
1026
|
outputVersion: n ?? 0
|
|
1042
1027
|
} : void 0, r ?? null), a, i));
|
|
1043
|
-
return
|
|
1028
|
+
return w(t, (e) => e, y);
|
|
1044
1029
|
});
|
|
1045
|
-
|
|
1030
|
+
w(gt(R, ({ executions: e }) => [e.scratch, e.scratchFailure], ([e, t]) => It({
|
|
1046
1031
|
scratch: e,
|
|
1047
1032
|
scratchFailure: t
|
|
1048
|
-
})), (e) => e,
|
|
1049
|
-
var
|
|
1050
|
-
|
|
1051
|
-
|
|
1033
|
+
})), (e) => e, y);
|
|
1034
|
+
var Cn = _((e) => w(_n, (t) => t(e), (e, t) => e.sourceChanged === t.sourceChanged && e.inputsChanged === t.inputsChanged)), wn = _((e) => {
|
|
1035
|
+
let n = gt(z(e), (e) => [e?.mimetype, e?.data], ([e, t]) => e == null || t == null ? null : Ye({
|
|
1036
|
+
mimetype: e,
|
|
1037
|
+
data: t
|
|
1038
|
+
}));
|
|
1039
|
+
return w(n, t.identity, y);
|
|
1040
|
+
});
|
|
1041
|
+
function Tn(e) {
|
|
1042
|
+
z.remove(e), Sn.remove(e), Cn.remove(e), wn.remove(e);
|
|
1052
1043
|
}
|
|
1053
|
-
function
|
|
1044
|
+
function En(e, t) {
|
|
1054
1045
|
let n = e.get(R), r = new Map(n.cleared);
|
|
1055
1046
|
for (let e of t) {
|
|
1056
1047
|
let t = Nt(n, e);
|
|
1057
|
-
t != null &&
|
|
1048
|
+
t != null && j(t) !== null && r.set(e, {
|
|
1058
1049
|
execution: t.record.id,
|
|
1059
1050
|
version: t.outputVersion
|
|
1060
1051
|
});
|
|
1061
1052
|
}
|
|
1062
|
-
let i = e.get(
|
|
1063
|
-
e.set(
|
|
1053
|
+
let i = e.get(yn);
|
|
1054
|
+
e.set(vn, i === null ? null : {
|
|
1064
1055
|
notebook: i,
|
|
1065
1056
|
value: r
|
|
1066
1057
|
});
|
|
1067
1058
|
}
|
|
1068
|
-
var
|
|
1069
|
-
let t = e(
|
|
1059
|
+
var Dn = S((e) => {
|
|
1060
|
+
let t = e(x);
|
|
1070
1061
|
return t === null ? null : e(t.runtimeAtom)?.state.status ?? null;
|
|
1071
1062
|
});
|
|
1072
|
-
|
|
1073
|
-
var
|
|
1074
|
-
let t = e(
|
|
1063
|
+
S((e) => Zt(e(pn).executions)), S((e) => Qt(e(pn)));
|
|
1064
|
+
var On = S((e) => {
|
|
1065
|
+
let t = e(x);
|
|
1075
1066
|
if (t === null) return { refused: "No notebook is connected" };
|
|
1076
|
-
if (e(t.connectionAtom).state ===
|
|
1067
|
+
if (e(t.connectionAtom).state === A.CLOSED) return { refused: "The notebook is disconnected" };
|
|
1077
1068
|
if (e(t.notebookAtom) === null) return "waiting";
|
|
1078
1069
|
let n = e(t.runtimeAtom);
|
|
1079
1070
|
if (n === null) return { refused: "The notebook has no runtime" };
|
|
@@ -1086,29 +1077,29 @@ var Dn = _((e) => {
|
|
|
1086
1077
|
default: return "waiting";
|
|
1087
1078
|
}
|
|
1088
1079
|
});
|
|
1089
|
-
function
|
|
1080
|
+
function kn(e) {
|
|
1090
1081
|
return new Promise((t, n) => {
|
|
1091
|
-
let r = e.sub(
|
|
1082
|
+
let r = e.sub(On, i);
|
|
1092
1083
|
function i() {
|
|
1093
|
-
let i = e.get(
|
|
1084
|
+
let i = e.get(On);
|
|
1094
1085
|
i !== "waiting" && (r(), i === "running" ? t() : n(Error(i.refused)));
|
|
1095
1086
|
}
|
|
1096
1087
|
i();
|
|
1097
1088
|
});
|
|
1098
1089
|
}
|
|
1099
|
-
function
|
|
1100
|
-
let n = e.get(
|
|
1090
|
+
function An(e, t) {
|
|
1091
|
+
let n = e.get(un);
|
|
1101
1092
|
if (n === null) return null;
|
|
1102
1093
|
let r = {
|
|
1103
1094
|
notebook: n,
|
|
1104
1095
|
cells: [...t]
|
|
1105
|
-
}, i =
|
|
1096
|
+
}, i = cn(e.get(L), n, nn);
|
|
1106
1097
|
return e.set(L, {
|
|
1107
1098
|
notebook: n,
|
|
1108
1099
|
value: new Set(i).add(r)
|
|
1109
1100
|
}), r;
|
|
1110
1101
|
}
|
|
1111
|
-
function
|
|
1102
|
+
function jn(e, t) {
|
|
1112
1103
|
let n = e.get(L);
|
|
1113
1104
|
if (n === null || !n.value.has(t)) return;
|
|
1114
1105
|
let r = new Set(n.value);
|
|
@@ -1117,35 +1108,35 @@ function An(e, t) {
|
|
|
1117
1108
|
value: r
|
|
1118
1109
|
});
|
|
1119
1110
|
}
|
|
1120
|
-
function
|
|
1121
|
-
let r =
|
|
1111
|
+
function Mn(e, t, n) {
|
|
1112
|
+
let r = S((e) => sn(t.notebook, e(un)) && !e(t.notebook.replica.executionsAtom).runs.has(n.id)), i = e.sub(r, a);
|
|
1122
1113
|
function a() {
|
|
1123
|
-
e.get(r) || (i(),
|
|
1114
|
+
e.get(r) || (i(), jn(e, t));
|
|
1124
1115
|
}
|
|
1125
1116
|
a();
|
|
1126
1117
|
}
|
|
1127
1118
|
//#endregion
|
|
1128
1119
|
//#region src/core/state/create-keyed-atom-hook.ts
|
|
1129
|
-
var
|
|
1130
|
-
function
|
|
1120
|
+
var Nn = o();
|
|
1121
|
+
function Pn(e) {
|
|
1131
1122
|
return function(t) {
|
|
1132
|
-
let n = (0,
|
|
1133
|
-
return
|
|
1123
|
+
let n = (0, E.useMemo)(() => e(t), [t]);
|
|
1124
|
+
return b(n);
|
|
1134
1125
|
};
|
|
1135
1126
|
}
|
|
1136
1127
|
//#endregion
|
|
1137
1128
|
//#region src/core/codemirror/editing/commands.ts
|
|
1138
|
-
function
|
|
1129
|
+
function Fn(e) {
|
|
1139
1130
|
return (t) => {
|
|
1140
1131
|
let n = !1;
|
|
1141
1132
|
for (let r of t) r && (n = e(r) || n);
|
|
1142
1133
|
return n;
|
|
1143
1134
|
};
|
|
1144
1135
|
}
|
|
1145
|
-
var
|
|
1136
|
+
var In = Fn(ge), Ln = Fn(he);
|
|
1146
1137
|
//#endregion
|
|
1147
1138
|
//#region src/utils/schedule-task.ts
|
|
1148
|
-
function
|
|
1139
|
+
function Rn() {
|
|
1149
1140
|
let e = globalThis.scheduler;
|
|
1150
1141
|
if (typeof e?.postTask == "function") return (t) => {
|
|
1151
1142
|
e.postTask(t, { priority: "user-visible" }).catch((e) => {
|
|
@@ -1166,10 +1157,10 @@ function Ln() {
|
|
|
1166
1157
|
setTimeout(e, 0);
|
|
1167
1158
|
};
|
|
1168
1159
|
}
|
|
1169
|
-
var
|
|
1160
|
+
var zn = Rn();
|
|
1170
1161
|
//#endregion
|
|
1171
1162
|
//#region src/core/codemirror/editor-mount-scheduler.ts
|
|
1172
|
-
function
|
|
1163
|
+
function Bn(e = zn) {
|
|
1173
1164
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
1174
1165
|
function i() {
|
|
1175
1166
|
r || n.size === 0 || (r = !0, e(s));
|
|
@@ -1206,21 +1197,21 @@ function zn(e = Rn) {
|
|
|
1206
1197
|
}
|
|
1207
1198
|
};
|
|
1208
1199
|
}
|
|
1209
|
-
var
|
|
1200
|
+
var Vn = Bn();
|
|
1210
1201
|
//#endregion
|
|
1211
1202
|
//#region src/core/mime.ts
|
|
1212
|
-
function
|
|
1203
|
+
function Hn(e) {
|
|
1213
1204
|
return e === "application/vnd.marimo+error";
|
|
1214
1205
|
}
|
|
1215
|
-
function
|
|
1206
|
+
function Un(e) {
|
|
1216
1207
|
return e === "application/vnd.marimo+traceback";
|
|
1217
1208
|
}
|
|
1218
|
-
function
|
|
1219
|
-
return
|
|
1209
|
+
function Wn(e) {
|
|
1210
|
+
return Hn(e) || Un(e);
|
|
1220
1211
|
}
|
|
1221
1212
|
//#endregion
|
|
1222
1213
|
//#region src/core/cells/command-console.ts
|
|
1223
|
-
function
|
|
1214
|
+
function Gn(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
1224
1215
|
if (t === "callback-output" && !r && n.length === 0) return { entries: [] };
|
|
1225
1216
|
let o = r || n.length === 0, s = e?.entries ?? [], c = r && a !== void 0 ? n.findIndex((e) => e.command_id === a) : -1, l = n.slice(c + 1).map((e, n) => ({
|
|
1226
1217
|
...e,
|
|
@@ -1231,18 +1222,18 @@ function Wn(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
|
1231
1222
|
}
|
|
1232
1223
|
//#endregion
|
|
1233
1224
|
//#region src/core/dom/ui-element-constants.ts
|
|
1234
|
-
var
|
|
1225
|
+
var Kn = "object-id", qn = "random-id", Jn = "abcdefghijklmnopqrstuvwxyz", Yn = Jn + Jn.toUpperCase(), Xn = /* @__PURE__ */ new Set(), B = "__scratch__", Zn = "setup", Qn = { create() {
|
|
1235
1226
|
let e = 0, t;
|
|
1236
1227
|
do {
|
|
1237
1228
|
let n = "";
|
|
1238
|
-
for (let e = 0; e < 4; e++) n +=
|
|
1229
|
+
for (let e = 0; e < 4; e++) n += Yn[Math.floor(Math.random() * 52)];
|
|
1239
1230
|
t = n, e++;
|
|
1240
|
-
} while (
|
|
1231
|
+
} while (Xn.has(t) && e < 100);
|
|
1241
1232
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
1242
|
-
return
|
|
1233
|
+
return Xn.add(t), t;
|
|
1243
1234
|
} }, V = {
|
|
1244
1235
|
create(e) {
|
|
1245
|
-
return
|
|
1236
|
+
return T(e != null, "cellId is required"), `cell-${e}`;
|
|
1246
1237
|
},
|
|
1247
1238
|
parse(e) {
|
|
1248
1239
|
return e.slice(5);
|
|
@@ -1261,21 +1252,21 @@ var Gn = "object-id", Kn = "random-id", qn = "abcdefghijklmnopqrstuvwxyz", Jn =
|
|
|
1261
1252
|
return null;
|
|
1262
1253
|
}
|
|
1263
1254
|
};
|
|
1264
|
-
function
|
|
1255
|
+
function $n(e) {
|
|
1265
1256
|
let t = null, n = V.findElementThroughShadowDOMs(e);
|
|
1266
1257
|
return n && (t = V.parse(n.id)), t;
|
|
1267
1258
|
}
|
|
1268
|
-
var
|
|
1259
|
+
var er = {
|
|
1269
1260
|
parse(e) {
|
|
1270
|
-
return e.getAttribute(
|
|
1261
|
+
return e.getAttribute(Kn);
|
|
1271
1262
|
},
|
|
1272
1263
|
parseOrThrow(e) {
|
|
1273
|
-
let t =
|
|
1274
|
-
return
|
|
1264
|
+
let t = er.parse(e);
|
|
1265
|
+
return T(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
1275
1266
|
}
|
|
1276
|
-
},
|
|
1267
|
+
}, tr = { create(e) {
|
|
1277
1268
|
return `output-${e}`;
|
|
1278
|
-
} },
|
|
1269
|
+
} }, nr = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, rr = class e {
|
|
1279
1270
|
static get INSTANCE() {
|
|
1280
1271
|
let t = "_marimo_private_VirtualFileTracker";
|
|
1281
1272
|
return window[t] || (window[t] = new e()), window[t];
|
|
@@ -1297,7 +1288,7 @@ var $n = {
|
|
|
1297
1288
|
switch (t.mimetype) {
|
|
1298
1289
|
case "application/json":
|
|
1299
1290
|
case "text/html": {
|
|
1300
|
-
let r = n.get(e), i =
|
|
1291
|
+
let r = n.get(e), i = ir(t.data);
|
|
1301
1292
|
r?.forEach((e) => i.add(e)), n.set(e, i);
|
|
1302
1293
|
return;
|
|
1303
1294
|
}
|
|
@@ -1313,15 +1304,15 @@ var $n = {
|
|
|
1313
1304
|
this.virtualFiles.delete(e), this.callbackFiles.delete(e);
|
|
1314
1305
|
}
|
|
1315
1306
|
};
|
|
1316
|
-
function
|
|
1307
|
+
function ir(e) {
|
|
1317
1308
|
if (!e) return /* @__PURE__ */ new Set();
|
|
1318
|
-
let t = /* @__PURE__ */ new Set(), n = (typeof e == "string" ? e : JSON.stringify(e)).match(
|
|
1309
|
+
let t = /* @__PURE__ */ new Set(), n = (typeof e == "string" ? e : JSON.stringify(e)).match(nr);
|
|
1319
1310
|
if (n) for (let e of n) t.add(e);
|
|
1320
1311
|
return t;
|
|
1321
1312
|
}
|
|
1322
1313
|
//#endregion
|
|
1323
1314
|
//#region src/components/editor/output/ansi-reduce.ts
|
|
1324
|
-
var
|
|
1315
|
+
var ar = class e {
|
|
1325
1316
|
lines = [""];
|
|
1326
1317
|
cursor = {
|
|
1327
1318
|
row: 0,
|
|
@@ -1423,7 +1414,7 @@ var ir = class e {
|
|
|
1423
1414
|
render() {
|
|
1424
1415
|
return this.lines.join("\n");
|
|
1425
1416
|
}
|
|
1426
|
-
},
|
|
1417
|
+
}, or = class {
|
|
1427
1418
|
ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
|
|
1428
1419
|
parse(e) {
|
|
1429
1420
|
let t = [], n = 0;
|
|
@@ -1442,13 +1433,13 @@ var ir = class e {
|
|
|
1442
1433
|
value: e.slice(n)
|
|
1443
1434
|
}), t;
|
|
1444
1435
|
}
|
|
1445
|
-
},
|
|
1446
|
-
parser = new
|
|
1436
|
+
}, sr = class e {
|
|
1437
|
+
parser = new or();
|
|
1447
1438
|
buffer;
|
|
1448
1439
|
incompleteEscape = "";
|
|
1449
1440
|
static INCOMPLETE_ESCAPE = new RegExp(String.raw`\u001B(?:\[[0-9;]*|\()?$`, "u");
|
|
1450
1441
|
constructor(e = 0) {
|
|
1451
|
-
this.buffer = new
|
|
1442
|
+
this.buffer = new ar(e);
|
|
1452
1443
|
}
|
|
1453
1444
|
copy(t = 0) {
|
|
1454
1445
|
let n = new e();
|
|
@@ -1472,7 +1463,7 @@ var ir = class e {
|
|
|
1472
1463
|
for (let e of r) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
|
|
1473
1464
|
}
|
|
1474
1465
|
reset() {
|
|
1475
|
-
this.buffer = new
|
|
1466
|
+
this.buffer = new ar(), this.incompleteEscape = "";
|
|
1476
1467
|
}
|
|
1477
1468
|
render() {
|
|
1478
1469
|
return this.buffer.render();
|
|
@@ -1516,7 +1507,7 @@ var ir = class e {
|
|
|
1516
1507
|
return n;
|
|
1517
1508
|
}
|
|
1518
1509
|
};
|
|
1519
|
-
function
|
|
1510
|
+
function cr(e) {
|
|
1520
1511
|
let t = 1;
|
|
1521
1512
|
for (let n = 0; n < e.length; n++) {
|
|
1522
1513
|
let r = e.charCodeAt(n);
|
|
@@ -1547,14 +1538,14 @@ var H = class e {
|
|
|
1547
1538
|
}
|
|
1548
1539
|
appendData(t) {
|
|
1549
1540
|
if (!this.terminal) {
|
|
1550
|
-
let n =
|
|
1541
|
+
let n = cr(t);
|
|
1551
1542
|
if (n !== void 0) return new e(this, {
|
|
1552
1543
|
data: this.data + t,
|
|
1553
1544
|
lineCount: this.lineCount + n - 1,
|
|
1554
1545
|
firstPlainRow: this.firstPlainRow
|
|
1555
1546
|
});
|
|
1556
1547
|
}
|
|
1557
|
-
let n = this.terminal?.copy() ?? new
|
|
1548
|
+
let n = this.terminal?.copy() ?? new sr(this.firstPlainRow);
|
|
1558
1549
|
this.terminal || n.append(this.data), n.append(t);
|
|
1559
1550
|
let r = n.render();
|
|
1560
1551
|
return new e(this, {
|
|
@@ -1582,19 +1573,19 @@ var H = class e {
|
|
|
1582
1573
|
...this.code === void 0 ? {} : { code: this.code }
|
|
1583
1574
|
};
|
|
1584
1575
|
}
|
|
1585
|
-
},
|
|
1586
|
-
function
|
|
1576
|
+
}, lr = 5e3;
|
|
1577
|
+
function ur(e, t = lr) {
|
|
1587
1578
|
let n = e.slice(0, -1), r = e.at(-1);
|
|
1588
|
-
return r &&
|
|
1579
|
+
return r && fr(n, r), _r(n, t);
|
|
1589
1580
|
}
|
|
1590
|
-
function
|
|
1581
|
+
function dr(e) {
|
|
1591
1582
|
let t = [];
|
|
1592
1583
|
for (let n = 0; n < e.length;) {
|
|
1593
1584
|
let r = e[n], i = n + 1;
|
|
1594
|
-
for (; i < e.length &&
|
|
1595
|
-
if (i === n + 1)
|
|
1585
|
+
for (; i < e.length && pr(r, e[i]);) i++;
|
|
1586
|
+
if (i === n + 1) fr(t, r);
|
|
1596
1587
|
else {
|
|
1597
|
-
let a = e.slice(n, i).map((e) => (
|
|
1588
|
+
let a = e.slice(n, i).map((e) => (gr(e), e.data));
|
|
1598
1589
|
t.push(H.create({
|
|
1599
1590
|
...r,
|
|
1600
1591
|
data: a.join("")
|
|
@@ -1602,32 +1593,32 @@ function ur(e) {
|
|
|
1602
1593
|
}
|
|
1603
1594
|
n = i;
|
|
1604
1595
|
}
|
|
1605
|
-
return
|
|
1596
|
+
return _r(t, lr);
|
|
1606
1597
|
}
|
|
1607
|
-
function
|
|
1598
|
+
function fr(e, t) {
|
|
1608
1599
|
let n = e.at(-1);
|
|
1609
|
-
n &&
|
|
1600
|
+
n && pr(n, t) ? (gr(n), gr(t), e[e.length - 1] = hr(n, t)) : e.push(mr(t));
|
|
1610
1601
|
}
|
|
1611
|
-
function
|
|
1602
|
+
function pr(e, t) {
|
|
1612
1603
|
let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
|
|
1613
1604
|
if (!n) return !1;
|
|
1614
1605
|
let r = e.channel === t.channel, i = e.channel !== "stdin";
|
|
1615
1606
|
return n && r && i;
|
|
1616
1607
|
}
|
|
1617
|
-
function
|
|
1608
|
+
function mr(e) {
|
|
1618
1609
|
return e instanceof H ? e : e.mimetype === "text/plain" && e.channel !== "stdin" && typeof e.data == "string" ? H.create(e) : e;
|
|
1619
1610
|
}
|
|
1620
|
-
function
|
|
1611
|
+
function hr(e, t) {
|
|
1621
1612
|
return e instanceof H ? e.appendData(t.data) : H.create(e).appendData(t.data);
|
|
1622
1613
|
}
|
|
1623
|
-
function
|
|
1624
|
-
|
|
1614
|
+
function gr(e) {
|
|
1615
|
+
T(typeof e.data == "string", "expected string output");
|
|
1625
1616
|
}
|
|
1626
|
-
function
|
|
1617
|
+
function _r(e, t) {
|
|
1627
1618
|
let n = 0, r;
|
|
1628
1619
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
1629
1620
|
let t = e[r];
|
|
1630
|
-
t.mimetype === "text/plain" ? (
|
|
1621
|
+
t.mimetype === "text/plain" ? (T(typeof t.data == "string", "expected string"), n += t instanceof H ? t.lineCount : t.data.split("\n").length) : n++;
|
|
1631
1622
|
}
|
|
1632
1623
|
if (n < t) return e;
|
|
1633
1624
|
let i = r + 1, a = [{
|
|
@@ -1638,7 +1629,7 @@ function gr(e, t) {
|
|
|
1638
1629
|
}, ...e.slice(0, i).filter((e) => e.channel === "stdin" && e.response === void 0)], o = e[i];
|
|
1639
1630
|
if (o?.channel === "stdin" && o.response === void 0) return [...a, ...e.slice(i)];
|
|
1640
1631
|
if (o?.mimetype === "text/plain") {
|
|
1641
|
-
|
|
1632
|
+
T(typeof o.data == "string", "expected string");
|
|
1642
1633
|
let r = n - t, s = o instanceof H ? o.dropFirstLines(r) : {
|
|
1643
1634
|
...o,
|
|
1644
1635
|
data: o.data.split("\n").slice(r).join("\n")
|
|
@@ -1653,18 +1644,18 @@ function gr(e, t) {
|
|
|
1653
1644
|
}
|
|
1654
1645
|
//#endregion
|
|
1655
1646
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1656
|
-
function
|
|
1647
|
+
function vr(e, t) {
|
|
1657
1648
|
return xe(e * 1e3, t?.in);
|
|
1658
1649
|
}
|
|
1659
1650
|
//#endregion
|
|
1660
1651
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1661
|
-
var
|
|
1652
|
+
var yr = function(e, t) {
|
|
1662
1653
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1663
1654
|
}, U;
|
|
1664
1655
|
(function(e) {
|
|
1665
1656
|
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";
|
|
1666
1657
|
})(U ||= {});
|
|
1667
|
-
var
|
|
1658
|
+
var br = class {
|
|
1668
1659
|
constructor() {
|
|
1669
1660
|
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 = {
|
|
1670
1661
|
http: 1,
|
|
@@ -1909,7 +1900,7 @@ var yr = class {
|
|
|
1909
1900
|
var r = this._buffer.charAt(1);
|
|
1910
1901
|
if (r != "[" && r != "]" && r != "(") return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1911
1902
|
if (r == "[") {
|
|
1912
|
-
this._csi_regex ||=
|
|
1903
|
+
this._csi_regex ||= xr(Cr ||= yr(["\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 "]));
|
|
1913
1904
|
let t = this._buffer.match(this._csi_regex);
|
|
1914
1905
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
1915
1906
|
if (t[4]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
@@ -1920,7 +1911,7 @@ var yr = class {
|
|
|
1920
1911
|
if (r == "]") {
|
|
1921
1912
|
if (t < 4) return e.kind = U.Incomplete, e;
|
|
1922
1913
|
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;
|
|
1923
|
-
this._osc_st ||=
|
|
1914
|
+
this._osc_st ||= Sr(wr ||= yr(["\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;
|
|
1924
1915
|
{
|
|
1925
1916
|
let t = this._osc_st.exec(this._buffer);
|
|
1926
1917
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
@@ -1931,7 +1922,7 @@ var yr = class {
|
|
|
1931
1922
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
1932
1923
|
if (t[3]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1933
1924
|
}
|
|
1934
|
-
this._osc_regex ||=
|
|
1925
|
+
this._osc_regex ||= xr(Tr ||= yr(["\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 "]));
|
|
1935
1926
|
let n = this._buffer.match(this._osc_regex);
|
|
1936
1927
|
if (n === null) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1937
1928
|
e.kind = U.OSCURL, e.url = n[1], e.text = n[2];
|
|
@@ -2016,41 +2007,41 @@ var yr = class {
|
|
|
2016
2007
|
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>`;
|
|
2017
2008
|
}
|
|
2018
2009
|
};
|
|
2019
|
-
function
|
|
2010
|
+
function xr(e, ...t) {
|
|
2020
2011
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
2021
2012
|
return new RegExp(n);
|
|
2022
2013
|
}
|
|
2023
|
-
function
|
|
2014
|
+
function Sr(e, ...t) {
|
|
2024
2015
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
2025
2016
|
return new RegExp(n, "g");
|
|
2026
2017
|
}
|
|
2027
|
-
var
|
|
2018
|
+
var Cr, wr, Tr, Er = new br();
|
|
2028
2019
|
function W(e) {
|
|
2029
2020
|
try {
|
|
2030
2021
|
let t = document.createElement("div");
|
|
2031
2022
|
return t.innerHTML = e, (t.textContent || t.innerText || "").split("\n").map((e) => e.trimEnd()).join("\n");
|
|
2032
|
-
} catch (
|
|
2033
|
-
return
|
|
2023
|
+
} catch (t) {
|
|
2024
|
+
return n.error("Error parsing HTML content:", t), e;
|
|
2034
2025
|
}
|
|
2035
2026
|
}
|
|
2036
|
-
function
|
|
2027
|
+
function Dr(e) {
|
|
2037
2028
|
if (!e) return "";
|
|
2038
2029
|
try {
|
|
2039
|
-
return W(
|
|
2040
|
-
} catch (
|
|
2041
|
-
return
|
|
2030
|
+
return W(Er.ansi_to_html(e));
|
|
2031
|
+
} catch (t) {
|
|
2032
|
+
return n.error("Error converting ANSI to plain text:", t), e;
|
|
2042
2033
|
}
|
|
2043
2034
|
}
|
|
2044
2035
|
//#endregion
|
|
2045
2036
|
//#region src/core/errors/traceback-atom.ts
|
|
2046
|
-
var
|
|
2037
|
+
var Or = S(null);
|
|
2047
2038
|
//#endregion
|
|
2048
2039
|
//#region src/core/cells/logs.ts
|
|
2049
|
-
function
|
|
2040
|
+
function kr(e) {
|
|
2050
2041
|
return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
|
|
2051
2042
|
}
|
|
2052
|
-
var
|
|
2053
|
-
function
|
|
2043
|
+
var Ar = !1;
|
|
2044
|
+
function jr(e) {
|
|
2054
2045
|
let t = [], n = [e.console].filter(Boolean).flat();
|
|
2055
2046
|
for (let r of n) {
|
|
2056
2047
|
let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
|
|
@@ -2060,7 +2051,7 @@ function Ar(e) {
|
|
|
2060
2051
|
case "stdout":
|
|
2061
2052
|
case "stderr":
|
|
2062
2053
|
case "marimo-error": {
|
|
2063
|
-
let a =
|
|
2054
|
+
let a = f.asString(r.data), o = i ? W(a) : a;
|
|
2064
2055
|
t.push({
|
|
2065
2056
|
timestamp: r.timestamp || Date.now(),
|
|
2066
2057
|
level: n ? "stderr" : "stdout",
|
|
@@ -2075,9 +2066,9 @@ function Ar(e) {
|
|
|
2075
2066
|
}
|
|
2076
2067
|
}
|
|
2077
2068
|
}
|
|
2078
|
-
if (t.forEach(
|
|
2069
|
+
if (t.forEach(Mr.log), n.length === 0 && Wn(e.output?.mimetype) && Array.isArray(e.output.data)) {
|
|
2079
2070
|
e.output.data.forEach((t) => {
|
|
2080
|
-
|
|
2071
|
+
Mr.log({
|
|
2081
2072
|
level: "stderr",
|
|
2082
2073
|
source: {
|
|
2083
2074
|
type: "cell",
|
|
@@ -2087,18 +2078,18 @@ function Ar(e) {
|
|
|
2087
2078
|
message: JSON.stringify(t)
|
|
2088
2079
|
});
|
|
2089
2080
|
});
|
|
2090
|
-
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n =
|
|
2091
|
-
if (t.length > 0 && !
|
|
2092
|
-
|
|
2081
|
+
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = C.get(ve) === "read";
|
|
2082
|
+
if (t.length > 0 && !Ar && n) {
|
|
2083
|
+
Ar = !0;
|
|
2093
2084
|
let e = t.find((e) => e.traceback);
|
|
2094
|
-
|
|
2085
|
+
s(e ? {
|
|
2095
2086
|
title: "An internal error occurred",
|
|
2096
2087
|
description: e.msg || "Click 'View' to see traceback",
|
|
2097
2088
|
variant: "danger",
|
|
2098
|
-
action:
|
|
2089
|
+
action: E.createElement(ce, {
|
|
2099
2090
|
altText: "View traceback",
|
|
2100
2091
|
onClick: () => {
|
|
2101
|
-
|
|
2092
|
+
C.set(Or, {
|
|
2102
2093
|
traceback: e.traceback,
|
|
2103
2094
|
errorMessage: e.msg || "An internal error occurred"
|
|
2104
2095
|
});
|
|
@@ -2113,13 +2104,13 @@ function Ar(e) {
|
|
|
2113
2104
|
}
|
|
2114
2105
|
return t;
|
|
2115
2106
|
}
|
|
2116
|
-
var
|
|
2107
|
+
var Mr = { log: (e) => {
|
|
2117
2108
|
let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
|
|
2118
|
-
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${
|
|
2109
|
+
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${Nr(e.timestamp)}]`, `(${kr(e.source)}) ${e.message}`);
|
|
2119
2110
|
} };
|
|
2120
|
-
function
|
|
2111
|
+
function Nr(e) {
|
|
2121
2112
|
try {
|
|
2122
|
-
return
|
|
2113
|
+
return vr(e).toLocaleTimeString(void 0, {
|
|
2123
2114
|
hour12: !0,
|
|
2124
2115
|
hour: "numeric",
|
|
2125
2116
|
minute: "numeric",
|
|
@@ -2129,26 +2120,26 @@ function Mr(e) {
|
|
|
2129
2120
|
return "";
|
|
2130
2121
|
}
|
|
2131
2122
|
}
|
|
2132
|
-
var
|
|
2133
|
-
function
|
|
2123
|
+
var Pr = /* @__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("."));
|
|
2124
|
+
function Fr(e, t = !0) {
|
|
2134
2125
|
return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
|
|
2135
2126
|
}
|
|
2136
|
-
function
|
|
2137
|
-
let n = new Set(t), r = e, i = (e) => !n.has(e) && !
|
|
2127
|
+
function Ir(e, t) {
|
|
2128
|
+
let n = new Set(t), r = e, i = (e) => !n.has(e) && !Pr.has(e);
|
|
2138
2129
|
if (i(e)) return e;
|
|
2139
2130
|
let a = 1;
|
|
2140
2131
|
for (; !i(r);) r = `${e}_${a}`, a++;
|
|
2141
2132
|
return r;
|
|
2142
2133
|
}
|
|
2143
|
-
function
|
|
2144
|
-
return
|
|
2134
|
+
function Lr(e, t) {
|
|
2135
|
+
return Rr(e) ? `cell-${t}` : e;
|
|
2145
2136
|
}
|
|
2146
|
-
function
|
|
2137
|
+
function Rr(e) {
|
|
2147
2138
|
return !e || e === "_" || e === "__";
|
|
2148
2139
|
}
|
|
2149
2140
|
//#endregion
|
|
2150
2141
|
//#region src/core/cells/types.ts
|
|
2151
|
-
function
|
|
2142
|
+
function zr({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
2152
2143
|
return {
|
|
2153
2144
|
id: e,
|
|
2154
2145
|
config: r || {
|
|
@@ -2161,7 +2152,7 @@ function Rr({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
|
2161
2152
|
code: n
|
|
2162
2153
|
};
|
|
2163
2154
|
}
|
|
2164
|
-
function
|
|
2155
|
+
function Br(e) {
|
|
2165
2156
|
return {
|
|
2166
2157
|
hide_code: !1,
|
|
2167
2158
|
disabled: !1,
|
|
@@ -2170,7 +2161,7 @@ function zr(e) {
|
|
|
2170
2161
|
...e
|
|
2171
2162
|
};
|
|
2172
2163
|
}
|
|
2173
|
-
function
|
|
2164
|
+
function Vr(e) {
|
|
2174
2165
|
return {
|
|
2175
2166
|
embeddedConsole: [],
|
|
2176
2167
|
...e
|
|
@@ -2178,7 +2169,7 @@ function Br(e) {
|
|
|
2178
2169
|
}
|
|
2179
2170
|
//#endregion
|
|
2180
2171
|
//#region src/core/cells/execution-console.ts
|
|
2181
|
-
function
|
|
2172
|
+
function Hr(e, t, n) {
|
|
2182
2173
|
let r = e.time === void 0 ? t : Date.parse(e.time) / 1e3, i = e.seq + 1;
|
|
2183
2174
|
switch (e.kind) {
|
|
2184
2175
|
case "console":
|
|
@@ -2209,46 +2200,46 @@ function Vr(e, t, n) {
|
|
|
2209
2200
|
};
|
|
2210
2201
|
}
|
|
2211
2202
|
}
|
|
2212
|
-
function
|
|
2203
|
+
function Ur(e, t) {
|
|
2213
2204
|
return {
|
|
2214
2205
|
onOutput(e, t) {
|
|
2215
|
-
|
|
2206
|
+
rr.INSTANCE.trackOutput(e, t);
|
|
2216
2207
|
},
|
|
2217
2208
|
onExecution(n, r) {
|
|
2218
2209
|
r && (n.state.status === "running" && e.startCellConsole({ cellId: n.cell_id ?? "__scratch__" }), t?.(n));
|
|
2219
2210
|
},
|
|
2220
2211
|
onItem(t, n, r) {
|
|
2221
|
-
let i = t.cell_id ?? "__scratch__", a =
|
|
2222
|
-
o.channel === "media" &&
|
|
2212
|
+
let i = t.cell_id ?? "__scratch__", a = M(t), o = Hr(n, a ? Date.parse(a) / 1e3 : 0);
|
|
2213
|
+
o.channel === "media" && rr.INSTANCE.track({
|
|
2223
2214
|
cell_id: i,
|
|
2224
2215
|
output: o
|
|
2225
|
-
}), r && (o.channel === "stdout" || o.channel === "stderr") && e.addLogs({ logs:
|
|
2216
|
+
}), r && (o.channel === "stdout" || o.channel === "stderr") && e.addLogs({ logs: jr({
|
|
2226
2217
|
cell_id: i,
|
|
2227
2218
|
console: o
|
|
2228
2219
|
}) });
|
|
2229
2220
|
}
|
|
2230
2221
|
};
|
|
2231
2222
|
}
|
|
2232
|
-
function
|
|
2223
|
+
function Wr(e, t, n = e(x)) {
|
|
2233
2224
|
if (!n) return;
|
|
2234
2225
|
let r = e(n.executionsAtom);
|
|
2235
2226
|
if (t === "__scratch__") return r.scratchConsole;
|
|
2236
2227
|
let i = r.latest.get(t);
|
|
2237
2228
|
return i === void 0 ? void 0 : r.executions.get(i);
|
|
2238
2229
|
}
|
|
2239
|
-
function
|
|
2230
|
+
function Gr(e, t) {
|
|
2240
2231
|
let { local: n, execution: r, code: i } = e;
|
|
2241
2232
|
if (t && t.local === n && t.code === i && t.execution?.items === r?.items) return t;
|
|
2242
|
-
let a = r?.record, o = n.clearedConsole, s = n.clearedConsoleInputs, c = a &&
|
|
2233
|
+
let a = r?.record, o = n.clearedConsole, s = n.clearedConsoleInputs, c = a && M(a), l = c ? Date.parse(c) / 1e3 : 0, u = (e) => {
|
|
2243
2234
|
if (o && o.executionId === a?.id && e.seq <= o.seq && !(e.kind === "input" && o.prompts.has(e.id)) || e.kind === "input" && s?.executionId === e.execution_id && s.ids.has(e.id)) return;
|
|
2244
|
-
let t =
|
|
2235
|
+
let t = Hr(e, l, i);
|
|
2245
2236
|
return e.kind === "input" && !e.password && n.answers?.has(e.id) && (t.response = n.answers.get(e.id)), t;
|
|
2246
2237
|
}, d = n.commandConsole?.entries, f = r?.append;
|
|
2247
2238
|
if (t && t.local === n && t.code === i && t.execution && f && f.before.deref() === t.execution.items && (!d?.length || d.every((e) => e.afterSeq !== void 0 && e.afterSeq < f.item.seq))) {
|
|
2248
2239
|
let n = u(f.item), r = t.rendered.consoleOutputs;
|
|
2249
2240
|
return {
|
|
2250
2241
|
...e,
|
|
2251
|
-
rendered: { consoleOutputs: n ?
|
|
2242
|
+
rendered: { consoleOutputs: n ? ur([...r, n]) : r }
|
|
2252
2243
|
};
|
|
2253
2244
|
}
|
|
2254
2245
|
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole : rt(r).flatMap((e) => u(e) ?? []);
|
|
@@ -2261,12 +2252,12 @@ function Wr(e, t) {
|
|
|
2261
2252
|
}
|
|
2262
2253
|
return {
|
|
2263
2254
|
...e,
|
|
2264
|
-
rendered: { consoleOutputs:
|
|
2255
|
+
rendered: { consoleOutputs: dr(p) }
|
|
2265
2256
|
};
|
|
2266
2257
|
}
|
|
2267
2258
|
//#endregion
|
|
2268
2259
|
//#region src/core/cells/columns.ts
|
|
2269
|
-
function
|
|
2260
|
+
function Kr(e) {
|
|
2270
2261
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
2271
2262
|
for (let r of e.order) {
|
|
2272
2263
|
let i = e.cells.get(r)?.config.column;
|
|
@@ -2274,9 +2265,9 @@ function Gr(e) {
|
|
|
2274
2265
|
}
|
|
2275
2266
|
return t;
|
|
2276
2267
|
}
|
|
2277
|
-
function
|
|
2268
|
+
function qr(e) {
|
|
2278
2269
|
let t = [[]];
|
|
2279
|
-
for (let [n, r] of
|
|
2270
|
+
for (let [n, r] of Kr(e)) {
|
|
2280
2271
|
for (; t.length <= r;) t.push([]);
|
|
2281
2272
|
t[r].push(n);
|
|
2282
2273
|
}
|
|
@@ -2284,21 +2275,21 @@ function Kr(e) {
|
|
|
2284
2275
|
}
|
|
2285
2276
|
//#endregion
|
|
2286
2277
|
//#region src/core/cells/layout.ts
|
|
2287
|
-
var
|
|
2288
|
-
function
|
|
2289
|
-
return `column-${
|
|
2278
|
+
var Jr = S(/* @__PURE__ */ new Set()), Yr = S([]), Xr = S([]);
|
|
2279
|
+
function Zr() {
|
|
2280
|
+
return `column-${Qn.create()}`;
|
|
2290
2281
|
}
|
|
2291
|
-
var
|
|
2292
|
-
let r =
|
|
2282
|
+
var Qr = S(null, (e, t, n) => {
|
|
2283
|
+
let r = qr(n).length, i = e(Yr);
|
|
2293
2284
|
if (i.length === r) return;
|
|
2294
|
-
let a = e(
|
|
2295
|
-
for (; o.length < r;) o.push(
|
|
2296
|
-
t(
|
|
2297
|
-
}),
|
|
2285
|
+
let a = e(Xr), o = [...i, ...a].slice(0, r);
|
|
2286
|
+
for (; o.length < r;) o.push(Zr());
|
|
2287
|
+
t(Yr, o), t(Xr, a.slice(Math.max(0, r - i.length)));
|
|
2288
|
+
}), $r = w(S((e) => {
|
|
2298
2289
|
let t = e(g);
|
|
2299
2290
|
return t === null ? null : e(t.documentAtom);
|
|
2300
|
-
}), (e) => e === null ? [[]] :
|
|
2301
|
-
let t = e(
|
|
2291
|
+
}), (e) => e === null ? [[]] : qr(e), y), ei = S((e) => {
|
|
2292
|
+
let t = e($r), n = e(Yr), r = e(Xr);
|
|
2302
2293
|
return [...t.map((e, t) => ({
|
|
2303
2294
|
id: n[t] ?? `column-${t}`,
|
|
2304
2295
|
ids: e
|
|
@@ -2307,7 +2298,7 @@ var Zr = _(null, (e, t, n) => {
|
|
|
2307
2298
|
ids: []
|
|
2308
2299
|
}))];
|
|
2309
2300
|
});
|
|
2310
|
-
function
|
|
2301
|
+
function ti(e, t, n) {
|
|
2311
2302
|
let r = /* @__PURE__ */ new Map();
|
|
2312
2303
|
return e.forEach((i, a) => {
|
|
2313
2304
|
let o = t[a];
|
|
@@ -2316,9 +2307,9 @@ function ei(e, t, n) {
|
|
|
2316
2307
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
2317
2308
|
}), r;
|
|
2318
2309
|
}
|
|
2319
|
-
function
|
|
2310
|
+
function ni(e, t, n) {
|
|
2320
2311
|
return { columns: e.map(({ id: e, ids: r }) => {
|
|
2321
|
-
let i =
|
|
2312
|
+
let i = ti(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
2322
2313
|
return {
|
|
2323
2314
|
id: e,
|
|
2324
2315
|
ids: r,
|
|
@@ -2327,36 +2318,36 @@ function ti(e, t, n) {
|
|
|
2327
2318
|
};
|
|
2328
2319
|
}) };
|
|
2329
2320
|
}
|
|
2330
|
-
var
|
|
2331
|
-
let t = e(
|
|
2332
|
-
return
|
|
2333
|
-
}),
|
|
2334
|
-
function
|
|
2321
|
+
var ri = S((e) => {
|
|
2322
|
+
let t = e(Ra);
|
|
2323
|
+
return ni(e(ei), (e) => t[e] ?? null, e(Jr));
|
|
2324
|
+
}), ii = () => b(ri), ai = S((e) => e(ri).columns.length);
|
|
2325
|
+
function oi(e, t) {
|
|
2335
2326
|
return e.columns.find((e) => e.id === t);
|
|
2336
2327
|
}
|
|
2337
|
-
function
|
|
2328
|
+
function si(e, t) {
|
|
2338
2329
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2339
2330
|
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
2340
2331
|
return n;
|
|
2341
2332
|
}
|
|
2342
|
-
function
|
|
2333
|
+
function ci(e, t) {
|
|
2343
2334
|
for (let n of e.columns) {
|
|
2344
2335
|
let e = n.folds.get(t);
|
|
2345
2336
|
if (e !== void 0) return e;
|
|
2346
2337
|
}
|
|
2347
2338
|
}
|
|
2348
|
-
function
|
|
2339
|
+
function li(e, t) {
|
|
2349
2340
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2350
2341
|
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
2351
2342
|
}
|
|
2352
|
-
function
|
|
2353
|
-
let n =
|
|
2354
|
-
return
|
|
2343
|
+
function ui(e, t) {
|
|
2344
|
+
let n = li(e, t);
|
|
2345
|
+
return ci(e, t) === void 0 ? n : [...n, t];
|
|
2355
2346
|
}
|
|
2356
2347
|
//#endregion
|
|
2357
2348
|
//#region src/core/cells/document.ts
|
|
2358
|
-
function
|
|
2359
|
-
let n = t.code ?? e.code, r =
|
|
2349
|
+
function di(e, t) {
|
|
2350
|
+
let n = t.code ?? e.code, r = y(e.config, t.config) ? e.config : Br(t.config);
|
|
2360
2351
|
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
2361
2352
|
...e,
|
|
2362
2353
|
name: t.name,
|
|
@@ -2368,30 +2359,30 @@ function ui(e, t) {
|
|
|
2368
2359
|
config: r
|
|
2369
2360
|
};
|
|
2370
2361
|
}
|
|
2371
|
-
function
|
|
2372
|
-
let n =
|
|
2362
|
+
function fi(e, t) {
|
|
2363
|
+
let n = y(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
2373
2364
|
for (let o of n) {
|
|
2374
2365
|
let n = t.cells.get(o), s = e.cellData[o];
|
|
2375
2366
|
if (n === void 0) continue;
|
|
2376
2367
|
if (s === void 0) {
|
|
2377
2368
|
r = {
|
|
2378
2369
|
...r,
|
|
2379
|
-
[o]:
|
|
2370
|
+
[o]: zr({
|
|
2380
2371
|
id: o,
|
|
2381
2372
|
code: n.code ?? "",
|
|
2382
2373
|
name: n.name,
|
|
2383
|
-
config:
|
|
2374
|
+
config: Br(n.config)
|
|
2384
2375
|
})
|
|
2385
2376
|
}, i = {
|
|
2386
2377
|
...i,
|
|
2387
|
-
[o]: i[o] ??
|
|
2378
|
+
[o]: i[o] ?? Vr()
|
|
2388
2379
|
}, a = {
|
|
2389
2380
|
...a,
|
|
2390
|
-
[o]: (0,
|
|
2381
|
+
[o]: (0, E.createRef)()
|
|
2391
2382
|
};
|
|
2392
2383
|
continue;
|
|
2393
2384
|
}
|
|
2394
|
-
let c =
|
|
2385
|
+
let c = di(s, n);
|
|
2395
2386
|
c !== s && (r = {
|
|
2396
2387
|
...r,
|
|
2397
2388
|
[o]: c
|
|
@@ -2410,45 +2401,45 @@ function di(e, t) {
|
|
|
2410
2401
|
cellHandles: a
|
|
2411
2402
|
};
|
|
2412
2403
|
}
|
|
2413
|
-
function
|
|
2404
|
+
function pi({ store: e, model: t, reconcile: n, signal: r }) {
|
|
2414
2405
|
let i = () => {
|
|
2415
2406
|
let r = e.get(t.documentAtom);
|
|
2416
|
-
r !== null && (n(r), e.set(
|
|
2407
|
+
r !== null && (n(r), e.set(Qr, r));
|
|
2417
2408
|
}, a = e.sub(t.documentAtom, i);
|
|
2418
2409
|
r.addEventListener("abort", a, { once: !0 }), i();
|
|
2419
2410
|
}
|
|
2420
|
-
async function
|
|
2421
|
-
let e =
|
|
2422
|
-
e !== null &&
|
|
2411
|
+
async function mi() {
|
|
2412
|
+
let e = C.get(g);
|
|
2413
|
+
e !== null && C.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
2423
2414
|
}
|
|
2424
2415
|
//#endregion
|
|
2425
2416
|
//#region src/core/cells/editor.ts
|
|
2426
|
-
var G =
|
|
2427
|
-
function
|
|
2417
|
+
var G = S(/* @__PURE__ */ new Set());
|
|
2418
|
+
function hi(e, t, n) {
|
|
2428
2419
|
return !!e && !t.has(n);
|
|
2429
2420
|
}
|
|
2430
|
-
|
|
2421
|
+
S(null, (e, t, { cellId: n }) => {
|
|
2431
2422
|
t(G, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
2432
|
-
}),
|
|
2423
|
+
}), S(null, (e, t, { cellId: n }) => e(G).has(n) ? (t(G, (e) => {
|
|
2433
2424
|
let t = new Set(e);
|
|
2434
2425
|
return t.delete(n), t;
|
|
2435
2426
|
}), !0) : !1);
|
|
2436
|
-
var
|
|
2437
|
-
|
|
2438
|
-
t(
|
|
2427
|
+
var gi = S(/* @__PURE__ */ new Map());
|
|
2428
|
+
S(null, (e, t, { cellId: n }) => {
|
|
2429
|
+
t(gi, (e) => {
|
|
2439
2430
|
let t = new Map(e);
|
|
2440
2431
|
return t.delete(n), t;
|
|
2441
2432
|
});
|
|
2442
2433
|
});
|
|
2443
2434
|
//#endregion
|
|
2444
2435
|
//#region src/utils/timeout.ts
|
|
2445
|
-
function
|
|
2446
|
-
let { retries: r, delay: i, initialDelay: a = 0 } =
|
|
2436
|
+
function _i(e, t) {
|
|
2437
|
+
let { retries: r, delay: i, initialDelay: a = 0 } = t, o = 0, s = () => {
|
|
2447
2438
|
if (o < r) {
|
|
2448
2439
|
try {
|
|
2449
2440
|
if (e()) return;
|
|
2450
2441
|
} catch (e) {
|
|
2451
|
-
|
|
2442
|
+
n.error(`Error executing function on attempt ${o + 1}, retrying`, { error: e });
|
|
2452
2443
|
}
|
|
2453
2444
|
o++, setTimeout(s, i);
|
|
2454
2445
|
}
|
|
@@ -2457,40 +2448,40 @@ function gi(e, n) {
|
|
|
2457
2448
|
}
|
|
2458
2449
|
//#endregion
|
|
2459
2450
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
2460
|
-
function
|
|
2461
|
-
|
|
2451
|
+
function vi(e) {
|
|
2452
|
+
_i(() => (e.focus(), e.hasFocus), {
|
|
2462
2453
|
retries: 5,
|
|
2463
2454
|
delay: 20
|
|
2464
2455
|
});
|
|
2465
2456
|
}
|
|
2466
|
-
function
|
|
2457
|
+
function yi(e, t) {
|
|
2467
2458
|
let r = document.getElementById(V.create(e));
|
|
2468
|
-
r ?
|
|
2459
|
+
r ? xi(r, t) : n.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
2469
2460
|
}
|
|
2470
|
-
function
|
|
2461
|
+
function bi() {
|
|
2471
2462
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
2472
2463
|
}
|
|
2473
|
-
function
|
|
2464
|
+
function xi(e, t) {
|
|
2474
2465
|
try {
|
|
2475
|
-
e.focus(
|
|
2466
|
+
e.focus(t);
|
|
2476
2467
|
} catch {
|
|
2477
|
-
|
|
2468
|
+
n.warn("[CellFocusManager] element may not be focusable", e);
|
|
2478
2469
|
}
|
|
2479
2470
|
}
|
|
2480
2471
|
//#endregion
|
|
2481
2472
|
//#region src/core/network/requests.ts
|
|
2482
|
-
var
|
|
2483
|
-
function Si() {
|
|
2484
|
-
let e = S(xi);
|
|
2485
|
-
return w(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
2486
|
-
}
|
|
2473
|
+
var Si = S(null);
|
|
2487
2474
|
function Ci() {
|
|
2488
|
-
let e =
|
|
2489
|
-
return
|
|
2475
|
+
let e = b(Si);
|
|
2476
|
+
return T(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
2477
|
+
}
|
|
2478
|
+
function wi() {
|
|
2479
|
+
let e = C.get(Si);
|
|
2480
|
+
return T(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
2490
2481
|
}
|
|
2491
2482
|
//#endregion
|
|
2492
2483
|
//#region src/utils/storage/storage.ts
|
|
2493
|
-
var
|
|
2484
|
+
var Ti = class {
|
|
2494
2485
|
store = /* @__PURE__ */ new Map();
|
|
2495
2486
|
get length() {
|
|
2496
2487
|
return this.store.size;
|
|
@@ -2511,16 +2502,16 @@ var wi = class {
|
|
|
2511
2502
|
this.store.set(e, t);
|
|
2512
2503
|
}
|
|
2513
2504
|
};
|
|
2514
|
-
function
|
|
2505
|
+
function Ei() {
|
|
2515
2506
|
let { hasLocalStorage: e, hasSessionStorage: t } = Se();
|
|
2516
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
2507
|
+
return e ? window.localStorage : t ? window.sessionStorage : new Ti();
|
|
2517
2508
|
}
|
|
2518
|
-
var
|
|
2519
|
-
function
|
|
2520
|
-
return
|
|
2509
|
+
var Di = Ei(), Oi = /(https?:\/\/[^\s"<>`{}|\\^]+)/, ki = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Ai = /^data:image\//i, ji = ["avatars.githubusercontent.com"];
|
|
2510
|
+
function Mi(e) {
|
|
2511
|
+
return Ai.test(e) ? [{
|
|
2521
2512
|
type: "image",
|
|
2522
2513
|
url: e
|
|
2523
|
-
}] : e.split(
|
|
2514
|
+
}] : e.split(Oi).filter((e) => e !== "").map((e) => Oi.test(e) ? ki.test(e) || Ai.test(e) || ji.some((t) => e.includes(t)) ? {
|
|
2524
2515
|
type: "image",
|
|
2525
2516
|
url: e
|
|
2526
2517
|
} : {
|
|
@@ -2533,48 +2524,48 @@ function ji(e) {
|
|
|
2533
2524
|
}
|
|
2534
2525
|
//#endregion
|
|
2535
2526
|
//#region src/utils/json/json-parser.ts
|
|
2536
|
-
var
|
|
2527
|
+
var Ni = new RegExp(Oi.source, "g");
|
|
2537
2528
|
BigInt.prototype.toJSON = function() {
|
|
2538
2529
|
return JSON.rawJSON(this.toString());
|
|
2539
2530
|
};
|
|
2540
|
-
function
|
|
2531
|
+
function Pi(e) {
|
|
2541
2532
|
try {
|
|
2542
|
-
return JSON.parse(e, (e, t) =>
|
|
2533
|
+
return JSON.parse(e, (e, t) => Ri(t));
|
|
2543
2534
|
} catch {}
|
|
2544
2535
|
if (e == null || e === "") return {};
|
|
2545
2536
|
try {
|
|
2546
|
-
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 :
|
|
2537
|
+
return e ??= "", e = e.replaceAll(/(?<=\s|^|\[|,|:)(NaN|-Infinity|Infinity)(?=(?:[^"'\\]*(\\.|'([^'\\]*\\.)*[^'\\]*'|"([^"\\]*\\.)*[^"\\]*"))*[^"']*$)/g, "\"◐$1◐\""), JSON.parse(e, (e, t) => typeof t == "string" ? t === "◐NaN◐" ? NaN : t === "◐Infinity◐" ? Infinity : t === "◐-Infinity◐" ? -Infinity : Ri(t) : Ri(t));
|
|
2547
2538
|
} catch {
|
|
2548
2539
|
return {};
|
|
2549
2540
|
}
|
|
2550
2541
|
}
|
|
2551
|
-
function
|
|
2542
|
+
function Fi(e) {
|
|
2552
2543
|
if (e.length === 0) return "";
|
|
2553
2544
|
let t = Object.keys(e[0]);
|
|
2554
2545
|
return [
|
|
2555
2546
|
`| ${t.join(" | ")} |`,
|
|
2556
2547
|
`|${t.map(() => "---").join("|")}|`,
|
|
2557
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
2548
|
+
...e.map((e) => `| ${t.map((t) => Ii(e[t])).join(" | ")} |`)
|
|
2558
2549
|
].join("\n");
|
|
2559
2550
|
}
|
|
2560
|
-
function
|
|
2551
|
+
function Ii(e) {
|
|
2561
2552
|
if (e == null) return "";
|
|
2562
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
2553
|
+
if (Array.isArray(e) || typeof e == "object") return Li(JSON.stringify(e));
|
|
2563
2554
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
2564
2555
|
t = t.replaceAll(n, (e) => {
|
|
2565
2556
|
let t = `__MDLINK_${i++}__`;
|
|
2566
2557
|
return r.set(t, e), t;
|
|
2567
|
-
}), t = t.replaceAll(
|
|
2558
|
+
}), t = t.replaceAll(Ni, "[$1]($1)");
|
|
2568
2559
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
2569
|
-
return
|
|
2560
|
+
return Li(t);
|
|
2570
2561
|
}
|
|
2571
|
-
function
|
|
2562
|
+
function Li(e) {
|
|
2572
2563
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
2573
2564
|
}
|
|
2574
|
-
function
|
|
2565
|
+
function Ri(e) {
|
|
2575
2566
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
2576
2567
|
}
|
|
2577
|
-
var
|
|
2568
|
+
var zi = new class {
|
|
2578
2569
|
getFilename() {
|
|
2579
2570
|
return this.getSearchParam("filename");
|
|
2580
2571
|
}
|
|
@@ -2601,20 +2592,20 @@ var Ri = new class {
|
|
|
2601
2592
|
}();
|
|
2602
2593
|
//#endregion
|
|
2603
2594
|
//#region src/core/dom/htmlUtils.ts
|
|
2604
|
-
function zi(e) {
|
|
2605
|
-
return Ni(e ?? "");
|
|
2606
|
-
}
|
|
2607
2595
|
function Bi(e) {
|
|
2608
|
-
return
|
|
2596
|
+
return Pi(e ?? "");
|
|
2597
|
+
}
|
|
2598
|
+
function Vi(e) {
|
|
2599
|
+
return le.mapValues(e.dataset, (e) => typeof e == "string" ? Bi(e) : e);
|
|
2609
2600
|
}
|
|
2610
|
-
function
|
|
2611
|
-
let n = e.parentElement ?
|
|
2612
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
2601
|
+
function Hi(e, t) {
|
|
2602
|
+
let n = e.parentElement ? er.parse(e.parentElement) : void 0;
|
|
2603
|
+
return n && t.has(n) ? t.lookupValue(n) : Bi(e.dataset.initialValue);
|
|
2613
2604
|
}
|
|
2614
|
-
function
|
|
2615
|
-
if (
|
|
2605
|
+
function Ui() {
|
|
2606
|
+
if (ae()) return document.title || null;
|
|
2616
2607
|
if (be()) {
|
|
2617
|
-
let e =
|
|
2608
|
+
let e = zi.getFilename();
|
|
2618
2609
|
if (e) return e;
|
|
2619
2610
|
}
|
|
2620
2611
|
let e = document.querySelector("marimo-filename");
|
|
@@ -2624,16 +2615,16 @@ function Hi() {
|
|
|
2624
2615
|
}
|
|
2625
2616
|
//#endregion
|
|
2626
2617
|
//#region src/core/saving/file-state.ts
|
|
2627
|
-
var
|
|
2628
|
-
|
|
2629
|
-
var Wi =
|
|
2630
|
-
|
|
2618
|
+
var K = S(Ui());
|
|
2619
|
+
S(null);
|
|
2620
|
+
var Wi = S(null);
|
|
2621
|
+
S(void 0);
|
|
2631
2622
|
//#endregion
|
|
2632
2623
|
//#region src/utils/storage/typed.ts
|
|
2633
2624
|
var Gi = class {
|
|
2634
2625
|
defaultValue;
|
|
2635
2626
|
storage;
|
|
2636
|
-
constructor(e, t =
|
|
2627
|
+
constructor(e, t = Di) {
|
|
2637
2628
|
this.defaultValue = e, this.storage = t;
|
|
2638
2629
|
}
|
|
2639
2630
|
get(e) {
|
|
@@ -2654,17 +2645,17 @@ var Gi = class {
|
|
|
2654
2645
|
schema;
|
|
2655
2646
|
getDefaultValue;
|
|
2656
2647
|
storage;
|
|
2657
|
-
constructor(e, t, n =
|
|
2648
|
+
constructor(e, t, n = Di) {
|
|
2658
2649
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
2659
2650
|
}
|
|
2660
2651
|
get(e) {
|
|
2661
2652
|
try {
|
|
2662
|
-
let
|
|
2663
|
-
if (
|
|
2664
|
-
let r = this.schema.safeParse(JSON.parse(
|
|
2665
|
-
return r.success ? r.data : (
|
|
2653
|
+
let t = this.storage.getItem(e);
|
|
2654
|
+
if (t == null) return this.getDefaultValue();
|
|
2655
|
+
let r = this.schema.safeParse(JSON.parse(t));
|
|
2656
|
+
return r.success ? r.data : (n.warn("Error parsing zod local storage", r.error), this.getDefaultValue());
|
|
2666
2657
|
} catch (e) {
|
|
2667
|
-
return
|
|
2658
|
+
return n.warn("Error getting zod local storage", e), this.getDefaultValue();
|
|
2668
2659
|
}
|
|
2669
2660
|
}
|
|
2670
2661
|
set(e, t) {
|
|
@@ -2677,11 +2668,11 @@ var Gi = class {
|
|
|
2677
2668
|
filename;
|
|
2678
2669
|
unsubscribeFromFilename;
|
|
2679
2670
|
constructor(e, t, n) {
|
|
2680
|
-
let r =
|
|
2671
|
+
let r = C.get(K);
|
|
2681
2672
|
super(t, n), this.filename = r;
|
|
2682
2673
|
try {
|
|
2683
|
-
this.unsubscribeFromFilename =
|
|
2684
|
-
let t =
|
|
2674
|
+
this.unsubscribeFromFilename = C.sub(K, () => {
|
|
2675
|
+
let t = C.get(K);
|
|
2685
2676
|
this.handleFilenameChange(e, t);
|
|
2686
2677
|
});
|
|
2687
2678
|
} catch {
|
|
@@ -2709,7 +2700,7 @@ var Gi = class {
|
|
|
2709
2700
|
dispose() {
|
|
2710
2701
|
this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
|
|
2711
2702
|
}
|
|
2712
|
-
},
|
|
2703
|
+
}, q = {
|
|
2713
2704
|
VariableName: "VariableName",
|
|
2714
2705
|
FunctionDefinition: "FunctionDefinition",
|
|
2715
2706
|
ClassDefinition: "ClassDefinition",
|
|
@@ -2734,21 +2725,21 @@ var Gi = class {
|
|
|
2734
2725
|
Comment: "Comment",
|
|
2735
2726
|
String: "String",
|
|
2736
2727
|
FormatString: "FormatString"
|
|
2737
|
-
},
|
|
2728
|
+
}, J = {
|
|
2738
2729
|
For: "for",
|
|
2739
2730
|
In: "in",
|
|
2740
2731
|
As: "as",
|
|
2741
2732
|
Import: "import"
|
|
2742
2733
|
}, Ji = /* @__PURE__ */ new Set([
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2734
|
+
q.FunctionDefinition,
|
|
2735
|
+
q.LambdaExpression,
|
|
2736
|
+
q.ArrayComprehensionExpression,
|
|
2737
|
+
q.SetComprehensionExpression,
|
|
2738
|
+
q.DictionaryComprehensionExpression,
|
|
2739
|
+
q.ComprehensionExpression,
|
|
2740
|
+
q.ClassDefinition
|
|
2750
2741
|
]);
|
|
2751
|
-
|
|
2742
|
+
q.Comment, q.String, q.FormatString;
|
|
2752
2743
|
//#endregion
|
|
2753
2744
|
//#region src/core/codemirror/utils.ts
|
|
2754
2745
|
function Yi(e) {
|
|
@@ -2768,7 +2759,7 @@ function Xi(e) {
|
|
|
2768
2759
|
}
|
|
2769
2760
|
//#endregion
|
|
2770
2761
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2771
|
-
var Zi = /* @__PURE__ */ new Set([
|
|
2762
|
+
var Zi = /* @__PURE__ */ new Set([q.ClassDefinition]);
|
|
2772
2763
|
function Qi(e, t) {
|
|
2773
2764
|
requestAnimationFrame(() => {
|
|
2774
2765
|
e.focus(), e.dispatch({
|
|
@@ -2784,13 +2775,13 @@ function $i(e, t) {
|
|
|
2784
2775
|
let n = me(e), r = null;
|
|
2785
2776
|
return n.iterate({ enter: (n) => {
|
|
2786
2777
|
if (r !== null) return !1;
|
|
2787
|
-
if (n.name ===
|
|
2788
|
-
if (n.name ===
|
|
2778
|
+
if (n.name === q.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
2779
|
+
if (n.name === q.Comment || n.name === q.String) return !1;
|
|
2789
2780
|
} }), r;
|
|
2790
2781
|
}
|
|
2791
2782
|
function ea(e, t) {
|
|
2792
2783
|
let n = [], r = e.resolveInner(t, 0);
|
|
2793
|
-
for (; r;) Ji.has(r.name) && (n.some((e) => e.type ===
|
|
2784
|
+
for (; r;) Ji.has(r.name) && (n.some((e) => e.type === q.FunctionDefinition || e.type === q.LambdaExpression) && r.name === q.ClassDefinition || n.push({
|
|
2794
2785
|
id: r.from,
|
|
2795
2786
|
type: r.name
|
|
2796
2787
|
})), r = r.parent;
|
|
@@ -2799,7 +2790,7 @@ function ea(e, t) {
|
|
|
2799
2790
|
type: "global"
|
|
2800
2791
|
}), n;
|
|
2801
2792
|
}
|
|
2802
|
-
function
|
|
2793
|
+
function Y(e, t, n) {
|
|
2803
2794
|
e.push({
|
|
2804
2795
|
scopeId: t,
|
|
2805
2796
|
from: n
|
|
@@ -2813,11 +2804,11 @@ function ta(e, t) {
|
|
|
2813
2804
|
function na(e, t) {
|
|
2814
2805
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2815
2806
|
switch (e.name) {
|
|
2816
|
-
case
|
|
2817
|
-
n.doc.sliceString(e.from, e.to) === r &&
|
|
2807
|
+
case q.VariableName:
|
|
2808
|
+
n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2818
2809
|
break;
|
|
2819
|
-
case
|
|
2820
|
-
case
|
|
2810
|
+
case q.TupleExpression:
|
|
2811
|
+
case q.ArrayExpression: {
|
|
2821
2812
|
let n = e.node.cursor();
|
|
2822
2813
|
n.firstChild();
|
|
2823
2814
|
do
|
|
@@ -2831,11 +2822,11 @@ function ra(e, t) {
|
|
|
2831
2822
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2832
2823
|
o.firstChild();
|
|
2833
2824
|
do {
|
|
2834
|
-
if (o.name !==
|
|
2825
|
+
if (o.name !== q.ParamList) continue;
|
|
2835
2826
|
let e = o.node.cursor();
|
|
2836
2827
|
e.firstChild();
|
|
2837
2828
|
do
|
|
2838
|
-
e.name ===
|
|
2829
|
+
e.name === q.VariableName && n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2839
2830
|
while (e.nextSibling());
|
|
2840
2831
|
} while (o.nextSibling());
|
|
2841
2832
|
}
|
|
@@ -2844,25 +2835,25 @@ function ia(e, t) {
|
|
|
2844
2835
|
n.firstChild();
|
|
2845
2836
|
let r = !1;
|
|
2846
2837
|
do
|
|
2847
|
-
if (n.name ===
|
|
2848
|
-
else if (r && n.name ===
|
|
2838
|
+
if (n.name === J.For) r = !0;
|
|
2839
|
+
else if (r && n.name === J.In) break;
|
|
2849
2840
|
else r && na(n, t);
|
|
2850
2841
|
while (n.nextSibling());
|
|
2851
2842
|
}
|
|
2852
2843
|
function aa(e, t) {
|
|
2853
2844
|
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Ji.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2854
2845
|
switch (s) {
|
|
2855
|
-
case
|
|
2856
|
-
case
|
|
2846
|
+
case q.FunctionDefinition:
|
|
2847
|
+
case q.ClassDefinition: {
|
|
2857
2848
|
let t = e.cursor();
|
|
2858
2849
|
t.firstChild();
|
|
2859
2850
|
do
|
|
2860
|
-
if (t.name ===
|
|
2861
|
-
|
|
2851
|
+
if (t.name === q.VariableName && n.doc.sliceString(t.from, t.to) === r) {
|
|
2852
|
+
Y(a, i[i.length - 1] ?? -1, t.from);
|
|
2862
2853
|
break;
|
|
2863
2854
|
}
|
|
2864
2855
|
while (t.nextSibling());
|
|
2865
|
-
s ===
|
|
2856
|
+
s === q.FunctionDefinition && ra(e, {
|
|
2866
2857
|
state: n,
|
|
2867
2858
|
variableName: r,
|
|
2868
2859
|
scopeId: c,
|
|
@@ -2870,7 +2861,7 @@ function aa(e, t) {
|
|
|
2870
2861
|
});
|
|
2871
2862
|
break;
|
|
2872
2863
|
}
|
|
2873
|
-
case
|
|
2864
|
+
case q.LambdaExpression:
|
|
2874
2865
|
ra(e, {
|
|
2875
2866
|
state: n,
|
|
2876
2867
|
variableName: r,
|
|
@@ -2878,11 +2869,11 @@ function aa(e, t) {
|
|
|
2878
2869
|
declarations: a
|
|
2879
2870
|
});
|
|
2880
2871
|
break;
|
|
2881
|
-
case
|
|
2882
|
-
case
|
|
2883
|
-
case
|
|
2884
|
-
case
|
|
2885
|
-
case
|
|
2872
|
+
case q.ArrayComprehensionExpression:
|
|
2873
|
+
case q.DictionaryComprehensionExpression:
|
|
2874
|
+
case q.SetComprehensionExpression:
|
|
2875
|
+
case q.ComprehensionExpression:
|
|
2876
|
+
case q.ForStatement:
|
|
2886
2877
|
ia(e, {
|
|
2887
2878
|
state: n,
|
|
2888
2879
|
variableName: r,
|
|
@@ -2890,11 +2881,11 @@ function aa(e, t) {
|
|
|
2890
2881
|
declarations: a
|
|
2891
2882
|
});
|
|
2892
2883
|
break;
|
|
2893
|
-
case
|
|
2884
|
+
case q.AssignStatement: {
|
|
2894
2885
|
let t = [], i = e.cursor();
|
|
2895
2886
|
i.firstChild();
|
|
2896
2887
|
do
|
|
2897
|
-
i.name ===
|
|
2888
|
+
i.name === q.AssignOp && t.push(i.from);
|
|
2898
2889
|
while (i.nextSibling());
|
|
2899
2890
|
let o = t[t.length - 1];
|
|
2900
2891
|
if (o === void 0) break;
|
|
@@ -2910,14 +2901,14 @@ function aa(e, t) {
|
|
|
2910
2901
|
while (s.nextSibling());
|
|
2911
2902
|
break;
|
|
2912
2903
|
}
|
|
2913
|
-
case
|
|
2904
|
+
case q.ImportStatement: {
|
|
2914
2905
|
let t = e.cursor();
|
|
2915
2906
|
t.firstChild();
|
|
2916
2907
|
let i = !1, o = null, s = () => {
|
|
2917
|
-
o?.matches &&
|
|
2908
|
+
o?.matches && Y(a, u, o.from), o = null;
|
|
2918
2909
|
};
|
|
2919
2910
|
do
|
|
2920
|
-
t.name ===
|
|
2911
|
+
t.name === J.Import ? i = !0 : i && (t.name === J.As ? o = null : t.name === q.VariableName ? (s(), o = {
|
|
2921
2912
|
from: t.from,
|
|
2922
2913
|
matches: n.doc.sliceString(t.from, t.to) === r
|
|
2923
2914
|
}) : t.name === "," && s());
|
|
@@ -2925,13 +2916,13 @@ function aa(e, t) {
|
|
|
2925
2916
|
s();
|
|
2926
2917
|
break;
|
|
2927
2918
|
}
|
|
2928
|
-
case
|
|
2929
|
-
case
|
|
2919
|
+
case q.TryStatement:
|
|
2920
|
+
case q.WithStatement: {
|
|
2930
2921
|
let t = e.cursor();
|
|
2931
2922
|
t.firstChild();
|
|
2932
2923
|
let i = !1;
|
|
2933
2924
|
do
|
|
2934
|
-
t.name ===
|
|
2925
|
+
t.name === J.As ? i = !0 : i && t.name === q.VariableName && n.doc.sliceString(t.from, t.to) === r && (Y(a, u, t.from), i = !1);
|
|
2935
2926
|
while (t.nextSibling());
|
|
2936
2927
|
break;
|
|
2937
2928
|
}
|
|
@@ -2969,62 +2960,62 @@ function ca(e, t) {
|
|
|
2969
2960
|
}
|
|
2970
2961
|
//#endregion
|
|
2971
2962
|
//#region src/core/network/connection.ts
|
|
2972
|
-
var
|
|
2973
|
-
|
|
2963
|
+
var X = S({ state: A.NOT_STARTED });
|
|
2964
|
+
v(null, (e, t) => t === null ? null : {
|
|
2974
2965
|
phase: t.phase,
|
|
2975
2966
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2976
2967
|
});
|
|
2977
2968
|
function la() {
|
|
2978
|
-
return
|
|
2969
|
+
return ne(X, (e) => e.state === A.OPEN);
|
|
2979
2970
|
}
|
|
2980
2971
|
function ua() {
|
|
2981
2972
|
return _e() ? la() : Promise.resolve();
|
|
2982
2973
|
}
|
|
2983
|
-
|
|
2984
|
-
let t = e(
|
|
2985
|
-
return t.state ===
|
|
2986
|
-
}),
|
|
2974
|
+
S((e) => e(X).state === A.CONNECTING), S((e) => e(X).state === A.OPEN), S((e) => {
|
|
2975
|
+
let t = e(X);
|
|
2976
|
+
return t.state === A.OPEN || t.state === A.NOT_STARTED;
|
|
2977
|
+
}), S((e) => e(X).state === A.CLOSED);
|
|
2987
2978
|
//#endregion
|
|
2988
2979
|
//#region src/components/ui/checkbox.tsx
|
|
2989
|
-
var da =
|
|
2990
|
-
let
|
|
2991
|
-
|
|
2980
|
+
var da = E.forwardRef((e, t) => {
|
|
2981
|
+
let n = (0, Nn.c)(13), i, a;
|
|
2982
|
+
n[0] === e ? (i = n[1], a = n[2]) : ({className: i, ...a} = e, n[0] = e, n[1] = i, n[2] = a);
|
|
2992
2983
|
let o;
|
|
2993
|
-
|
|
2984
|
+
n[3] === i ? o = n[4] : (o = r("flex items-center justify-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground", i), n[3] = i, n[4] = o);
|
|
2994
2985
|
let s;
|
|
2995
|
-
|
|
2986
|
+
n[5] === Symbol.for("react.memo_cache_sentinel") ? (s = r("flex items-center justify-center text-current max-h-[14px] overflow-hidden"), n[5] = s) : s = n[5];
|
|
2996
2987
|
let c;
|
|
2997
|
-
|
|
2988
|
+
n[6] === a.checked ? c = n[7] : (c = /* @__PURE__ */ (0, D.jsx)(Ie, {
|
|
2998
2989
|
className: s,
|
|
2999
|
-
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0,
|
|
3000
|
-
}),
|
|
3001
|
-
let
|
|
3002
|
-
return
|
|
2990
|
+
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, D.jsx)(we, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, D.jsx)(u, { className: "h-4 w-4" })
|
|
2991
|
+
}), n[6] = a.checked, n[7] = c);
|
|
2992
|
+
let l;
|
|
2993
|
+
return n[8] !== a || n[9] !== t || n[10] !== o || n[11] !== c ? (l = /* @__PURE__ */ (0, D.jsx)(Pe, {
|
|
3003
2994
|
ref: t,
|
|
3004
2995
|
className: o,
|
|
3005
2996
|
...a,
|
|
3006
2997
|
children: c
|
|
3007
|
-
}),
|
|
2998
|
+
}), n[8] = a, n[9] = t, n[10] = o, n[11] = c, n[12] = l) : l = n[12], l;
|
|
3008
2999
|
});
|
|
3009
3000
|
da.displayName = Pe.displayName;
|
|
3010
3001
|
//#endregion
|
|
3011
3002
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
3012
|
-
function fa({ cellId: e, cell:
|
|
3013
|
-
if (!
|
|
3003
|
+
function fa({ cellId: e, cell: t, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
3004
|
+
if (!t) return;
|
|
3014
3005
|
let o = document.getElementById(V.create(e));
|
|
3015
|
-
if (!o)
|
|
3016
|
-
else if (
|
|
3006
|
+
if (!o) n.warn("scrollCellIntoView: element not found");
|
|
3007
|
+
else if (bi()) xi(o);
|
|
3017
3008
|
else {
|
|
3018
|
-
if (r)
|
|
3009
|
+
if (r) xi(o);
|
|
3019
3010
|
else {
|
|
3020
|
-
|
|
3021
|
-
let r =
|
|
3011
|
+
Vn.promote(e);
|
|
3012
|
+
let r = t.current?.editorView;
|
|
3022
3013
|
if (!r) {
|
|
3023
|
-
|
|
3014
|
+
n.warn("scrollCellIntoView: editor not found", e);
|
|
3024
3015
|
return;
|
|
3025
3016
|
}
|
|
3026
3017
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
3027
|
-
if (
|
|
3018
|
+
if (vi(r), i === "top") r.dispatch({ selection: {
|
|
3028
3019
|
anchor: 0,
|
|
3029
3020
|
head: 0
|
|
3030
3021
|
} });
|
|
@@ -3116,7 +3107,7 @@ function Ea({ errored: e, stopped: t }) {
|
|
|
3116
3107
|
};
|
|
3117
3108
|
}
|
|
3118
3109
|
function Da({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
3119
|
-
let a =
|
|
3110
|
+
let a = Wn(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
3120
3111
|
return (e || t || n || a) && !o;
|
|
3121
3112
|
}
|
|
3122
3113
|
//#endregion
|
|
@@ -3131,18 +3122,18 @@ function Oa(e) {
|
|
|
3131
3122
|
return {
|
|
3132
3123
|
...e,
|
|
3133
3124
|
cellData: {
|
|
3134
|
-
[B]:
|
|
3125
|
+
[B]: zr({
|
|
3135
3126
|
id: B,
|
|
3136
3127
|
config: t
|
|
3137
3128
|
}),
|
|
3138
3129
|
...e.cellData
|
|
3139
3130
|
},
|
|
3140
3131
|
cellRuntime: {
|
|
3141
|
-
[B]:
|
|
3132
|
+
[B]: Vr(),
|
|
3142
3133
|
...e.cellRuntime
|
|
3143
3134
|
},
|
|
3144
3135
|
cellHandles: {
|
|
3145
|
-
[B]: (0,
|
|
3136
|
+
[B]: (0, E.createRef)(),
|
|
3146
3137
|
...e.cellHandles
|
|
3147
3138
|
}
|
|
3148
3139
|
};
|
|
@@ -3158,8 +3149,8 @@ function ka() {
|
|
|
3158
3149
|
cellLogs: []
|
|
3159
3150
|
});
|
|
3160
3151
|
}
|
|
3161
|
-
var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, valueAtom:
|
|
3162
|
-
startCellConsole: (e, { cellId: t }) =>
|
|
3152
|
+
var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, valueAtom: Z } = fe(ka, {
|
|
3153
|
+
startCellConsole: (e, { cellId: t }) => Q({
|
|
3163
3154
|
state: e,
|
|
3164
3155
|
cellId: t,
|
|
3165
3156
|
cellReducer: (e) => ({
|
|
@@ -3171,17 +3162,17 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3171
3162
|
})
|
|
3172
3163
|
}),
|
|
3173
3164
|
showCommandOutput: (e, t) => {
|
|
3174
|
-
let { cell_id: n, entries: r, replace: i } = t, a =
|
|
3165
|
+
let { cell_id: n, entries: r, replace: i } = t, a = Q({
|
|
3175
3166
|
state: e,
|
|
3176
3167
|
cellId: n,
|
|
3177
3168
|
cellReducer: (e) => ({
|
|
3178
3169
|
...e,
|
|
3179
|
-
commandConsole:
|
|
3170
|
+
commandConsole: Gn(e.commandConsole, t, e.clearedCommandIds?.[t.op])
|
|
3180
3171
|
})
|
|
3181
3172
|
});
|
|
3182
3173
|
return i || t.op === "pdb-output" ? a : {
|
|
3183
3174
|
...a,
|
|
3184
|
-
cellLogs: [...a.cellLogs, ...
|
|
3175
|
+
cellLogs: [...a.cellLogs, ...jr({
|
|
3185
3176
|
cell_id: n,
|
|
3186
3177
|
console: r
|
|
3187
3178
|
})]
|
|
@@ -3189,7 +3180,7 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3189
3180
|
},
|
|
3190
3181
|
hideConsoleInputs: (e, { cellId: t, executionId: n, inputIds: r }) => {
|
|
3191
3182
|
let i = new Set(r);
|
|
3192
|
-
return
|
|
3183
|
+
return Q({
|
|
3193
3184
|
state: e,
|
|
3194
3185
|
cellId: t,
|
|
3195
3186
|
cellReducer: (e) => ({
|
|
@@ -3207,7 +3198,7 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3207
3198
|
let n = t[e];
|
|
3208
3199
|
n.commandConsole?.entries.some((e) => e.source === "pdb-output") && (t[e] = {
|
|
3209
3200
|
...n,
|
|
3210
|
-
commandConsole:
|
|
3201
|
+
commandConsole: Gn(n.commandConsole, {
|
|
3211
3202
|
op: "pdb-output",
|
|
3212
3203
|
cell_id: e,
|
|
3213
3204
|
entries: [],
|
|
@@ -3225,13 +3216,13 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3225
3216
|
cellLogs: [...e.cellLogs, ...t.logs]
|
|
3226
3217
|
}),
|
|
3227
3218
|
reconcileDocument: (e, t) => {
|
|
3228
|
-
let n =
|
|
3229
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
3219
|
+
let n = fi(e, t);
|
|
3220
|
+
for (let t of e.cellIds) t in n.cellData || Xa(t);
|
|
3230
3221
|
return n;
|
|
3231
3222
|
},
|
|
3232
3223
|
setStdinResponse: (e, t) => {
|
|
3233
3224
|
let { cellId: n, response: r, inputId: i } = t;
|
|
3234
|
-
return
|
|
3225
|
+
return Q({
|
|
3235
3226
|
state: e,
|
|
3236
3227
|
cellId: n,
|
|
3237
3228
|
cellReducer: (e) => ({
|
|
@@ -3244,7 +3235,7 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3244
3235
|
let n = be(), r = { ...e.cellRuntime };
|
|
3245
3236
|
for (let i of [...e.cellIds, B]) {
|
|
3246
3237
|
let a = e.cellRuntime[i];
|
|
3247
|
-
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a :
|
|
3238
|
+
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a : Vr({
|
|
3248
3239
|
clearedConsole: t ? a?.clearedConsole : void 0,
|
|
3249
3240
|
clearedCommandIds: t ? a?.clearedCommandIds : void 0
|
|
3250
3241
|
});
|
|
@@ -3261,7 +3252,7 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3261
3252
|
return fa({
|
|
3262
3253
|
cellId: n,
|
|
3263
3254
|
cell: e.cellHandles[n],
|
|
3264
|
-
isCodeHidden:
|
|
3255
|
+
isCodeHidden: hi(e.cellData[n]?.config.hide_code, C.get(G), n),
|
|
3265
3256
|
codeFocus: void 0,
|
|
3266
3257
|
variableName: void 0
|
|
3267
3258
|
}), {
|
|
@@ -3269,13 +3260,13 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3269
3260
|
scrollKey: null
|
|
3270
3261
|
};
|
|
3271
3262
|
},
|
|
3272
|
-
foldAll: (e) => (
|
|
3273
|
-
unfoldAll: (e) => (
|
|
3263
|
+
foldAll: (e) => (In(Object.keys(e.cellHandles).map((e) => Qa(e))), e),
|
|
3264
|
+
unfoldAll: (e) => (Ln(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
3274
3265
|
clearLogs: (e) => ({
|
|
3275
3266
|
...e,
|
|
3276
3267
|
cellLogs: []
|
|
3277
3268
|
}),
|
|
3278
|
-
clearCellConsole: (e, t) =>
|
|
3269
|
+
clearCellConsole: (e, t) => Q({
|
|
3279
3270
|
state: e,
|
|
3280
3271
|
cellId: t.cellId,
|
|
3281
3272
|
cellReducer: (e) => {
|
|
@@ -3291,27 +3282,27 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3291
3282
|
}
|
|
3292
3283
|
})
|
|
3293
3284
|
});
|
|
3294
|
-
function
|
|
3295
|
-
return
|
|
3285
|
+
function Q({ state: e, cellId: t, cellReducer: r }) {
|
|
3286
|
+
return t in e.cellRuntime ? {
|
|
3296
3287
|
...e,
|
|
3297
3288
|
cellRuntime: {
|
|
3298
3289
|
...e.cellRuntime,
|
|
3299
|
-
[
|
|
3290
|
+
[t]: r(e.cellRuntime[t])
|
|
3300
3291
|
}
|
|
3301
|
-
} : (
|
|
3292
|
+
} : (n.warn(`Cell ${t} not found in state`), e);
|
|
3302
3293
|
}
|
|
3303
3294
|
var Pa = ja((e) => {
|
|
3304
|
-
|
|
3305
|
-
}).addLogs,
|
|
3306
|
-
|
|
3307
|
-
var Fa =
|
|
3308
|
-
|
|
3309
|
-
var Ia =
|
|
3310
|
-
let { cellIds: t, cellData: n } = e(
|
|
3295
|
+
C.set(Z, (t) => Aa(t, e));
|
|
3296
|
+
}).addLogs, $ = S((e) => e(Z).cellIds);
|
|
3297
|
+
S((e) => e($).length === 1), S((e) => _a(e(Z)).length > 0), S((e) => va(e(Z)).length > 0), S((e) => ya(e(Z))), S((e) => ba(e(Z)));
|
|
3298
|
+
var Fa = S((e) => Ca(e(Z), e(mn), e(_n)));
|
|
3299
|
+
S((e) => e(Fa) !== null);
|
|
3300
|
+
var Ia = S((e) => {
|
|
3301
|
+
let { cellIds: t, cellData: n } = e(Z);
|
|
3311
3302
|
return t.map((t) => {
|
|
3312
3303
|
let r = e(z(t)), { name: i } = n[t];
|
|
3313
|
-
if (r !== null &&
|
|
3314
|
-
|
|
3304
|
+
if (r !== null && Wn(r.mimetype)) {
|
|
3305
|
+
T(Array.isArray(r.data), "Expected array data");
|
|
3315
3306
|
let e = r.data.filter((e) => !e.type.includes("ancestor"));
|
|
3316
3307
|
if (e.length > 0) return {
|
|
3317
3308
|
output: {
|
|
@@ -3324,100 +3315,103 @@ var Ia = _((e) => {
|
|
|
3324
3315
|
}
|
|
3325
3316
|
return null;
|
|
3326
3317
|
}).filter(Boolean);
|
|
3327
|
-
}), La =
|
|
3328
|
-
let t =
|
|
3329
|
-
for (let n of e(
|
|
3330
|
-
let r = e(
|
|
3331
|
-
r
|
|
3318
|
+
}), La = w(S((e) => {
|
|
3319
|
+
let t = [];
|
|
3320
|
+
for (let n of e($)) {
|
|
3321
|
+
let r = e(wn(n));
|
|
3322
|
+
r && r.items.length > 0 && t.push([n, r]);
|
|
3332
3323
|
}
|
|
3333
3324
|
return t;
|
|
3334
|
-
})), Ra =
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3325
|
+
}), t.identity, y), Ra = w(La, (e) => Object.fromEntries(e), y), za = w(La, (e) => ({ items: e.flatMap(([e, t]) => t.items.map((t) => ({
|
|
3326
|
+
...t,
|
|
3327
|
+
cellId: e
|
|
3328
|
+
}))) }));
|
|
3329
|
+
S((e) => e(Ia).length);
|
|
3330
|
+
var Ba = te(S((e) => {
|
|
3331
|
+
let { cellIds: t, cellData: n } = e(Z);
|
|
3338
3332
|
return le.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
3339
3333
|
}));
|
|
3340
|
-
|
|
3341
|
-
var
|
|
3342
|
-
let { cellIds: e, cellData: t } =
|
|
3334
|
+
S((e) => e(Z).scrollKey);
|
|
3335
|
+
var Va = () => b($), Ha = () => b(Ba), Ua = () => C.get(Z), Wa = () => C.get(Z).cellIds, Ga = () => {
|
|
3336
|
+
let { cellIds: e, cellData: t } = C.get(Z);
|
|
3343
3337
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
3344
3338
|
};
|
|
3345
|
-
|
|
3346
|
-
var
|
|
3347
|
-
let t =
|
|
3348
|
-
let r = e(t), i = e(
|
|
3339
|
+
h(w(Z, (e) => e.cellIds.map((t) => e.cellData[t]))), S((e) => e(Z).cellIds.length > 0);
|
|
3340
|
+
var Ka = _((e) => S((t) => t(Z).cellData[e])), qa = Vr(), Ja = _((e) => {
|
|
3341
|
+
let t = S((t) => Wr(t, e, t(m))), n = S((t) => t(Z).cellRuntime[e] ?? qa), r = S((e) => {
|
|
3342
|
+
let r = e(t), i = e(m), a = i && e(i.shownDocumentAtom)?.cells;
|
|
3349
3343
|
return {
|
|
3350
3344
|
local: e(n),
|
|
3351
3345
|
execution: r,
|
|
3352
3346
|
code: r && kt(r.record, a ?? void 0)
|
|
3353
3347
|
};
|
|
3354
|
-
}), i =
|
|
3355
|
-
return
|
|
3356
|
-
}),
|
|
3357
|
-
function
|
|
3358
|
-
|
|
3359
|
-
}
|
|
3360
|
-
var
|
|
3361
|
-
let { cellHandles: t } =
|
|
3348
|
+
}), i = w(r, Gr);
|
|
3349
|
+
return S((e) => e(i).rendered);
|
|
3350
|
+
}), Ya = _((e) => S((t) => t(Z).cellHandles[e]));
|
|
3351
|
+
function Xa(e) {
|
|
3352
|
+
Ka.remove(e), Ja.remove(e), Ya.remove(e), Tn(e);
|
|
3353
|
+
}
|
|
3354
|
+
var Za = (e) => {
|
|
3355
|
+
let { cellHandles: t } = C.get(Z);
|
|
3362
3356
|
return t[e]?.current?.editorView ?? void 0;
|
|
3363
|
-
},
|
|
3364
|
-
|
|
3365
|
-
...e(
|
|
3366
|
-
...e(
|
|
3357
|
+
}, Qa = (e) => (Vn.promote(e), Za(e));
|
|
3358
|
+
S((e) => e($).map((t) => ({
|
|
3359
|
+
...e(Ka(t)),
|
|
3360
|
+
...e(Ja(t)),
|
|
3367
3361
|
output: e(z(t))
|
|
3368
3362
|
})));
|
|
3369
3363
|
//#endregion
|
|
3370
3364
|
//#region src/core/errors/error-entries.ts
|
|
3371
|
-
function
|
|
3372
|
-
if (
|
|
3365
|
+
function $a(e) {
|
|
3366
|
+
if (Hn(e.mimetype)) {
|
|
3373
3367
|
if (!Array.isArray(e.data)) return null;
|
|
3374
3368
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
3375
3369
|
return t.length === 0 ? null : { errorData: t };
|
|
3376
3370
|
}
|
|
3377
|
-
return
|
|
3371
|
+
return Un(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
3378
3372
|
errorData: [],
|
|
3379
3373
|
tracebackHtml: e.data
|
|
3380
3374
|
} : null;
|
|
3381
3375
|
}
|
|
3382
|
-
function
|
|
3376
|
+
function eo(e) {
|
|
3383
3377
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
3384
3378
|
}
|
|
3385
|
-
function
|
|
3386
|
-
let t = e?.find((e) =>
|
|
3379
|
+
function to(e) {
|
|
3380
|
+
let t = e?.find((e) => Un(e.mimetype));
|
|
3387
3381
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
3388
3382
|
}
|
|
3389
|
-
function
|
|
3383
|
+
function no(e, t) {
|
|
3390
3384
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
3391
|
-
if (!
|
|
3385
|
+
if (!eo(e.errorData)) return to(t);
|
|
3392
3386
|
}
|
|
3393
|
-
function
|
|
3394
|
-
let { cellIds: t, cellData: n } = e.get(
|
|
3387
|
+
function ro(e) {
|
|
3388
|
+
let { cellIds: t, cellData: n } = e.get(Z), r = [];
|
|
3395
3389
|
for (let [i, a] of t.entries()) {
|
|
3396
3390
|
let t = e.get(z(a));
|
|
3397
|
-
if (t === null || !
|
|
3398
|
-
let o =
|
|
3391
|
+
if (t === null || !Wn(t.mimetype)) continue;
|
|
3392
|
+
let o = $a(t);
|
|
3399
3393
|
if (!o) continue;
|
|
3400
|
-
let s =
|
|
3394
|
+
let s = Lr(n[a].name, i), c = t.code ?? n[a].code;
|
|
3401
3395
|
r.push({
|
|
3402
3396
|
cellId: a,
|
|
3403
3397
|
cellName: s,
|
|
3404
3398
|
cellCode: c,
|
|
3405
3399
|
errorData: o.errorData,
|
|
3406
|
-
tracebackHtml:
|
|
3400
|
+
tracebackHtml: no(o, e.get(Ja(a)).consoleOutputs)
|
|
3407
3401
|
});
|
|
3408
3402
|
}
|
|
3409
3403
|
return r;
|
|
3410
3404
|
}
|
|
3411
|
-
function
|
|
3412
|
-
return e.type === "diagnostic" ? e.msg : e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "lazy-import" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (
|
|
3405
|
+
function io(e) {
|
|
3406
|
+
return e.type === "diagnostic" ? e.msg : e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "lazy-import" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (d(e), "Unknown error");
|
|
3413
3407
|
}
|
|
3414
|
-
function
|
|
3415
|
-
let t =
|
|
3408
|
+
function ao(e) {
|
|
3409
|
+
let t = io(e);
|
|
3416
3410
|
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${W(e.traceback)}`), t;
|
|
3417
3411
|
}
|
|
3418
|
-
function
|
|
3412
|
+
function oo(e) {
|
|
3419
3413
|
let t = [e.cellName];
|
|
3420
|
-
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(
|
|
3414
|
+
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(ao).join("\n\n")), t.join("\n\n");
|
|
3421
3415
|
}
|
|
3422
3416
|
//#endregion
|
|
3423
|
-
export {
|
|
3417
|
+
export { hi as $, mt as $t, da as A, V as At, Wi as B, pn as Bt, ga as C, jr as Ct, pa as D, rr as Dt, fa as E, br as Et, Yi as F, Kn as Ft, Fi as G, En as Gt, Vi as H, wn as Ht, qi as I, qn as It, wi as J, Dn as Jt, Mi as K, dn as Kt, Gi as L, Pn as Lt, la as M, Zn as Mt, ua as N, er as Nt, ha as O, Qn as Ot, ca as P, $n as Pt, vi as Q, ht as Qt, Ki as R, Mn as Rt, Ta as S, Fr as St, Da as T, W as Tt, Hi as U, z as Ut, Bi as V, Cn as Vt, Pi as W, R as Wt, Ci as X, jn as Xt, Si as Y, kn as Yt, yi as Z, Jt as Zt, za as _, Wr as _t, Pa as a, He as an, Yr as at, Va as b, Ir as bt, Ja as c, oi as ct, Ma as d, li as dt, Qe as en, gi as et, Ga as f, ri as ft, Z as g, Kr as gt, ka as h, ii as ht, ro as i, Xe as in, Jr as it, X as j, B as jt, ma as k, tr as kt, ja as l, ci as lt, Ua as m, ai as mt, oo as n, Ue as nn, mi as nt, Ka as o, we as on, si as ot, Wa as p, Zr as pt, Di as q, An as qt, ao as r, qe as rn, pi as rt, $ as s, Ce as sn, Xr as st, io as t, A as tn, G as tt, Qa as u, ui as ut, Aa as v, Ur as vt, Ea as w, Dr as wt, Ha as x, Rr as xt, Xa as y, Lr as yt, K as z, Sn as zt };
|