@marimo-team/islands 0.26.1-dev105 → 0.26.1-dev112
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-pNKOBKXw.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-C9NZA-bk.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-B9s3Hl8z.js} +18 -18
- package/dist/{common-DWnR77Qk.js → common-Bn3jx0X6.js} +170 -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-mxwwRaQy.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-1DC4BiYB.js} +661 -656
- package/dist/{export-context-CkgZeARR.js → export-context-B1jdxzHF.js} +21 -21
- package/dist/{feedback-button-BMGqp8Ff.js → feedback-button-BrzbnRTT.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-Cnsv3NcI.js} +11 -11
- package/dist/{glide-utils-CD8BaFTm.js → glide-utils-BRcuSTCx.js} +2 -2
- package/dist/{globals-_bXqC0R8.js → globals-BGqfFPx8.js} +3 -3
- package/dist/{html-to-image-Cst4BlIm.js → html-to-image-CsvAOgd3.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-DuSCOMTK.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-CtfJ_Gbp.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-DzmiQyN9.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/style.css +1 -1
- 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 +344 -2
- package/src/components/editor/ai/__tests__/completion-utils.test.ts +12 -20
- package/src/components/editor/ai/ai-completion-editor.tsx +391 -289
- package/src/components/editor/ai/completion-utils.ts +9 -7
- package/src/components/editor/cell/CellDeleteShoulder.tsx +82 -0
- package/src/components/editor/cell/DeleteButton.tsx +11 -2
- package/src/components/editor/cell/__tests__/CellDeleteShoulder.test.tsx +181 -0
- package/src/components/editor/cell/code/cell-editor.tsx +15 -25
- package/src/components/editor/chrome/panels/__tests__/logs-panel.test.tsx +26 -2
- package/src/components/editor/chrome/panels/logs-panel.tsx +27 -11
- 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 +250 -274
- package/src/core/ai/state.ts +6 -0
- package/src/core/cells/__tests__/cells.test.ts +34 -20
- 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/cell-log-chunks.ts +31 -0
- package/src/core/cells/cells.ts +31 -20
- 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/lsp/__tests__/log-messages.test.ts +1 -1
- package/src/core/codemirror/lsp/__tests__/transports.test.ts +1 -1
- 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/__tests__/bridge.test.ts +2 -5
- package/src/core/islands/components/output-wrapper.tsx +7 -2
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +10 -1
- package/src/css/common.css +11 -0
- package/src/hooks/useFinePointer.ts +30 -0
- package/src/plugins/layout/OutlinePlugin.tsx +5 -17
- package/src/stories/log-viewer.stories.tsx +48 -44
|
@@ -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(za);
|
|
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,56 @@ 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
|
});
|
|
2434
|
+
function _i(e, t) {
|
|
2435
|
+
if (t.length === 0) return e;
|
|
2436
|
+
let n = [...e], r = n.at(-1), i = 0;
|
|
2437
|
+
if (r && r.length < 128) {
|
|
2438
|
+
let e = [...r];
|
|
2439
|
+
for (; i < t.length && e.length < 128;) e.push(t[i]), i++;
|
|
2440
|
+
n[n.length - 1] = e;
|
|
2441
|
+
}
|
|
2442
|
+
for (; i < t.length; i += 128) n.push(t.slice(i, i + 128));
|
|
2443
|
+
return n;
|
|
2444
|
+
}
|
|
2443
2445
|
//#endregion
|
|
2444
2446
|
//#region src/utils/timeout.ts
|
|
2445
|
-
function
|
|
2446
|
-
let { retries: r, delay: i, initialDelay: a = 0 } =
|
|
2447
|
+
function vi(e, t) {
|
|
2448
|
+
let { retries: r, delay: i, initialDelay: a = 0 } = t, o = 0, s = () => {
|
|
2447
2449
|
if (o < r) {
|
|
2448
2450
|
try {
|
|
2449
2451
|
if (e()) return;
|
|
2450
2452
|
} catch (e) {
|
|
2451
|
-
|
|
2453
|
+
n.error(`Error executing function on attempt ${o + 1}, retrying`, { error: e });
|
|
2452
2454
|
}
|
|
2453
2455
|
o++, setTimeout(s, i);
|
|
2454
2456
|
}
|
|
@@ -2457,40 +2459,40 @@ function gi(e, n) {
|
|
|
2457
2459
|
}
|
|
2458
2460
|
//#endregion
|
|
2459
2461
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
2460
|
-
function
|
|
2461
|
-
|
|
2462
|
+
function yi(e) {
|
|
2463
|
+
vi(() => (e.focus(), e.hasFocus), {
|
|
2462
2464
|
retries: 5,
|
|
2463
2465
|
delay: 20
|
|
2464
2466
|
});
|
|
2465
2467
|
}
|
|
2466
|
-
function
|
|
2468
|
+
function bi(e, t) {
|
|
2467
2469
|
let r = document.getElementById(V.create(e));
|
|
2468
|
-
r ?
|
|
2470
|
+
r ? Si(r, t) : n.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
2469
2471
|
}
|
|
2470
|
-
function
|
|
2472
|
+
function xi() {
|
|
2471
2473
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
2472
2474
|
}
|
|
2473
|
-
function
|
|
2475
|
+
function Si(e, t) {
|
|
2474
2476
|
try {
|
|
2475
|
-
e.focus(
|
|
2477
|
+
e.focus(t);
|
|
2476
2478
|
} catch {
|
|
2477
|
-
|
|
2479
|
+
n.warn("[CellFocusManager] element may not be focusable", e);
|
|
2478
2480
|
}
|
|
2479
2481
|
}
|
|
2480
2482
|
//#endregion
|
|
2481
2483
|
//#region src/core/network/requests.ts
|
|
2482
|
-
var
|
|
2483
|
-
function
|
|
2484
|
-
let e =
|
|
2485
|
-
return
|
|
2484
|
+
var Ci = S(null);
|
|
2485
|
+
function wi() {
|
|
2486
|
+
let e = b(Ci);
|
|
2487
|
+
return T(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
2486
2488
|
}
|
|
2487
|
-
function
|
|
2488
|
-
let e =
|
|
2489
|
-
return
|
|
2489
|
+
function Ti() {
|
|
2490
|
+
let e = C.get(Ci);
|
|
2491
|
+
return T(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
2490
2492
|
}
|
|
2491
2493
|
//#endregion
|
|
2492
2494
|
//#region src/utils/storage/storage.ts
|
|
2493
|
-
var
|
|
2495
|
+
var Ei = class {
|
|
2494
2496
|
store = /* @__PURE__ */ new Map();
|
|
2495
2497
|
get length() {
|
|
2496
2498
|
return this.store.size;
|
|
@@ -2511,16 +2513,16 @@ var wi = class {
|
|
|
2511
2513
|
this.store.set(e, t);
|
|
2512
2514
|
}
|
|
2513
2515
|
};
|
|
2514
|
-
function
|
|
2516
|
+
function Di() {
|
|
2515
2517
|
let { hasLocalStorage: e, hasSessionStorage: t } = Se();
|
|
2516
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
2518
|
+
return e ? window.localStorage : t ? window.sessionStorage : new Ei();
|
|
2517
2519
|
}
|
|
2518
|
-
var
|
|
2519
|
-
function
|
|
2520
|
-
return
|
|
2520
|
+
var Oi = Di(), ki = /(https?:\/\/[^\s"<>`{}|\\^]+)/, Ai = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, ji = /^data:image\//i, Mi = ["avatars.githubusercontent.com"];
|
|
2521
|
+
function Ni(e) {
|
|
2522
|
+
return ji.test(e) ? [{
|
|
2521
2523
|
type: "image",
|
|
2522
2524
|
url: e
|
|
2523
|
-
}] : e.split(
|
|
2525
|
+
}] : e.split(ki).filter((e) => e !== "").map((e) => ki.test(e) ? Ai.test(e) || ji.test(e) || Mi.some((t) => e.includes(t)) ? {
|
|
2524
2526
|
type: "image",
|
|
2525
2527
|
url: e
|
|
2526
2528
|
} : {
|
|
@@ -2533,48 +2535,48 @@ function ji(e) {
|
|
|
2533
2535
|
}
|
|
2534
2536
|
//#endregion
|
|
2535
2537
|
//#region src/utils/json/json-parser.ts
|
|
2536
|
-
var
|
|
2538
|
+
var Pi = new RegExp(ki.source, "g");
|
|
2537
2539
|
BigInt.prototype.toJSON = function() {
|
|
2538
2540
|
return JSON.rawJSON(this.toString());
|
|
2539
2541
|
};
|
|
2540
|
-
function
|
|
2542
|
+
function Fi(e) {
|
|
2541
2543
|
try {
|
|
2542
|
-
return JSON.parse(e, (e, t) =>
|
|
2544
|
+
return JSON.parse(e, (e, t) => zi(t));
|
|
2543
2545
|
} catch {}
|
|
2544
2546
|
if (e == null || e === "") return {};
|
|
2545
2547
|
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 :
|
|
2548
|
+
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 : zi(t) : zi(t));
|
|
2547
2549
|
} catch {
|
|
2548
2550
|
return {};
|
|
2549
2551
|
}
|
|
2550
2552
|
}
|
|
2551
|
-
function
|
|
2553
|
+
function Ii(e) {
|
|
2552
2554
|
if (e.length === 0) return "";
|
|
2553
2555
|
let t = Object.keys(e[0]);
|
|
2554
2556
|
return [
|
|
2555
2557
|
`| ${t.join(" | ")} |`,
|
|
2556
2558
|
`|${t.map(() => "---").join("|")}|`,
|
|
2557
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
2559
|
+
...e.map((e) => `| ${t.map((t) => Li(e[t])).join(" | ")} |`)
|
|
2558
2560
|
].join("\n");
|
|
2559
2561
|
}
|
|
2560
|
-
function
|
|
2562
|
+
function Li(e) {
|
|
2561
2563
|
if (e == null) return "";
|
|
2562
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
2564
|
+
if (Array.isArray(e) || typeof e == "object") return Ri(JSON.stringify(e));
|
|
2563
2565
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
2564
2566
|
t = t.replaceAll(n, (e) => {
|
|
2565
2567
|
let t = `__MDLINK_${i++}__`;
|
|
2566
2568
|
return r.set(t, e), t;
|
|
2567
|
-
}), t = t.replaceAll(
|
|
2569
|
+
}), t = t.replaceAll(Pi, "[$1]($1)");
|
|
2568
2570
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
2569
|
-
return
|
|
2571
|
+
return Ri(t);
|
|
2570
2572
|
}
|
|
2571
|
-
function
|
|
2573
|
+
function Ri(e) {
|
|
2572
2574
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
2573
2575
|
}
|
|
2574
|
-
function
|
|
2576
|
+
function zi(e) {
|
|
2575
2577
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
2576
2578
|
}
|
|
2577
|
-
var
|
|
2579
|
+
var Bi = new class {
|
|
2578
2580
|
getFilename() {
|
|
2579
2581
|
return this.getSearchParam("filename");
|
|
2580
2582
|
}
|
|
@@ -2601,20 +2603,20 @@ var Ri = new class {
|
|
|
2601
2603
|
}();
|
|
2602
2604
|
//#endregion
|
|
2603
2605
|
//#region src/core/dom/htmlUtils.ts
|
|
2604
|
-
function
|
|
2605
|
-
return
|
|
2606
|
+
function Vi(e) {
|
|
2607
|
+
return Fi(e ?? "");
|
|
2606
2608
|
}
|
|
2607
|
-
function
|
|
2608
|
-
return le.mapValues(e.dataset, (e) => typeof e == "string" ?
|
|
2609
|
+
function Hi(e) {
|
|
2610
|
+
return le.mapValues(e.dataset, (e) => typeof e == "string" ? Vi(e) : e);
|
|
2609
2611
|
}
|
|
2610
|
-
function
|
|
2611
|
-
let n = e.parentElement ?
|
|
2612
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
2612
|
+
function Ui(e, t) {
|
|
2613
|
+
let n = e.parentElement ? er.parse(e.parentElement) : void 0;
|
|
2614
|
+
return n && t.has(n) ? t.lookupValue(n) : Vi(e.dataset.initialValue);
|
|
2613
2615
|
}
|
|
2614
|
-
function
|
|
2615
|
-
if (
|
|
2616
|
+
function Wi() {
|
|
2617
|
+
if (ae()) return document.title || null;
|
|
2616
2618
|
if (be()) {
|
|
2617
|
-
let e =
|
|
2619
|
+
let e = Bi.getFilename();
|
|
2618
2620
|
if (e) return e;
|
|
2619
2621
|
}
|
|
2620
2622
|
let e = document.querySelector("marimo-filename");
|
|
@@ -2624,16 +2626,16 @@ function Hi() {
|
|
|
2624
2626
|
}
|
|
2625
2627
|
//#endregion
|
|
2626
2628
|
//#region src/core/saving/file-state.ts
|
|
2627
|
-
var
|
|
2628
|
-
|
|
2629
|
-
var
|
|
2630
|
-
|
|
2629
|
+
var K = S(Wi());
|
|
2630
|
+
S(null);
|
|
2631
|
+
var Gi = S(null);
|
|
2632
|
+
S(void 0);
|
|
2631
2633
|
//#endregion
|
|
2632
2634
|
//#region src/utils/storage/typed.ts
|
|
2633
|
-
var
|
|
2635
|
+
var Ki = class {
|
|
2634
2636
|
defaultValue;
|
|
2635
2637
|
storage;
|
|
2636
|
-
constructor(e, t =
|
|
2638
|
+
constructor(e, t = Oi) {
|
|
2637
2639
|
this.defaultValue = e, this.storage = t;
|
|
2638
2640
|
}
|
|
2639
2641
|
get(e) {
|
|
@@ -2650,21 +2652,21 @@ var Gi = class {
|
|
|
2650
2652
|
remove(e) {
|
|
2651
2653
|
this.storage.removeItem(e);
|
|
2652
2654
|
}
|
|
2653
|
-
},
|
|
2655
|
+
}, qi = class {
|
|
2654
2656
|
schema;
|
|
2655
2657
|
getDefaultValue;
|
|
2656
2658
|
storage;
|
|
2657
|
-
constructor(e, t, n =
|
|
2659
|
+
constructor(e, t, n = Oi) {
|
|
2658
2660
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
2659
2661
|
}
|
|
2660
2662
|
get(e) {
|
|
2661
2663
|
try {
|
|
2662
|
-
let
|
|
2663
|
-
if (
|
|
2664
|
-
let r = this.schema.safeParse(JSON.parse(
|
|
2665
|
-
return r.success ? r.data : (
|
|
2664
|
+
let t = this.storage.getItem(e);
|
|
2665
|
+
if (t == null) return this.getDefaultValue();
|
|
2666
|
+
let r = this.schema.safeParse(JSON.parse(t));
|
|
2667
|
+
return r.success ? r.data : (n.warn("Error parsing zod local storage", r.error), this.getDefaultValue());
|
|
2666
2668
|
} catch (e) {
|
|
2667
|
-
return
|
|
2669
|
+
return n.warn("Error getting zod local storage", e), this.getDefaultValue();
|
|
2668
2670
|
}
|
|
2669
2671
|
}
|
|
2670
2672
|
set(e, t) {
|
|
@@ -2673,15 +2675,15 @@ var Gi = class {
|
|
|
2673
2675
|
remove(e) {
|
|
2674
2676
|
this.storage.removeItem(e);
|
|
2675
2677
|
}
|
|
2676
|
-
},
|
|
2678
|
+
}, Ji = class extends qi {
|
|
2677
2679
|
filename;
|
|
2678
2680
|
unsubscribeFromFilename;
|
|
2679
2681
|
constructor(e, t, n) {
|
|
2680
|
-
let r =
|
|
2682
|
+
let r = C.get(K);
|
|
2681
2683
|
super(t, n), this.filename = r;
|
|
2682
2684
|
try {
|
|
2683
|
-
this.unsubscribeFromFilename =
|
|
2684
|
-
let t =
|
|
2685
|
+
this.unsubscribeFromFilename = C.sub(K, () => {
|
|
2686
|
+
let t = C.get(K);
|
|
2685
2687
|
this.handleFilenameChange(e, t);
|
|
2686
2688
|
});
|
|
2687
2689
|
} catch {
|
|
@@ -2709,7 +2711,7 @@ var Gi = class {
|
|
|
2709
2711
|
dispose() {
|
|
2710
2712
|
this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
|
|
2711
2713
|
}
|
|
2712
|
-
},
|
|
2714
|
+
}, q = {
|
|
2713
2715
|
VariableName: "VariableName",
|
|
2714
2716
|
FunctionDefinition: "FunctionDefinition",
|
|
2715
2717
|
ClassDefinition: "ClassDefinition",
|
|
@@ -2734,30 +2736,30 @@ var Gi = class {
|
|
|
2734
2736
|
Comment: "Comment",
|
|
2735
2737
|
String: "String",
|
|
2736
2738
|
FormatString: "FormatString"
|
|
2737
|
-
},
|
|
2739
|
+
}, J = {
|
|
2738
2740
|
For: "for",
|
|
2739
2741
|
In: "in",
|
|
2740
2742
|
As: "as",
|
|
2741
2743
|
Import: "import"
|
|
2742
|
-
},
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2744
|
+
}, Yi = /* @__PURE__ */ new Set([
|
|
2745
|
+
q.FunctionDefinition,
|
|
2746
|
+
q.LambdaExpression,
|
|
2747
|
+
q.ArrayComprehensionExpression,
|
|
2748
|
+
q.SetComprehensionExpression,
|
|
2749
|
+
q.DictionaryComprehensionExpression,
|
|
2750
|
+
q.ComprehensionExpression,
|
|
2751
|
+
q.ClassDefinition
|
|
2750
2752
|
]);
|
|
2751
|
-
|
|
2753
|
+
q.Comment, q.String, q.FormatString;
|
|
2752
2754
|
//#endregion
|
|
2753
2755
|
//#region src/core/codemirror/utils.ts
|
|
2754
|
-
function
|
|
2756
|
+
function Xi(e) {
|
|
2755
2757
|
e && e.dispatch({ selection: {
|
|
2756
2758
|
anchor: e.state.doc.length,
|
|
2757
2759
|
head: e.state.doc.length
|
|
2758
2760
|
} });
|
|
2759
2761
|
}
|
|
2760
|
-
function
|
|
2762
|
+
function Zi(e) {
|
|
2761
2763
|
requestAnimationFrame(() => {
|
|
2762
2764
|
e.dom.closest(".marimo-cell")?.scrollIntoView({
|
|
2763
2765
|
behavior: "instant",
|
|
@@ -2768,8 +2770,8 @@ function Xi(e) {
|
|
|
2768
2770
|
}
|
|
2769
2771
|
//#endregion
|
|
2770
2772
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2771
|
-
var
|
|
2772
|
-
function
|
|
2773
|
+
var Qi = /* @__PURE__ */ new Set([q.ClassDefinition]);
|
|
2774
|
+
function $i(e, t) {
|
|
2773
2775
|
requestAnimationFrame(() => {
|
|
2774
2776
|
e.focus(), e.dispatch({
|
|
2775
2777
|
selection: {
|
|
@@ -2778,19 +2780,19 @@ function Qi(e, t) {
|
|
|
2778
2780
|
},
|
|
2779
2781
|
effects: pe.scrollIntoView(t, { y: "center" })
|
|
2780
2782
|
});
|
|
2781
|
-
}),
|
|
2783
|
+
}), Zi(e);
|
|
2782
2784
|
}
|
|
2783
|
-
function
|
|
2785
|
+
function ea(e, t) {
|
|
2784
2786
|
let n = me(e), r = null;
|
|
2785
2787
|
return n.iterate({ enter: (n) => {
|
|
2786
2788
|
if (r !== null) return !1;
|
|
2787
|
-
if (n.name ===
|
|
2788
|
-
if (n.name ===
|
|
2789
|
+
if (n.name === q.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
2790
|
+
if (n.name === q.Comment || n.name === q.String) return !1;
|
|
2789
2791
|
} }), r;
|
|
2790
2792
|
}
|
|
2791
|
-
function
|
|
2793
|
+
function ta(e, t) {
|
|
2792
2794
|
let n = [], r = e.resolveInner(t, 0);
|
|
2793
|
-
for (; r;)
|
|
2795
|
+
for (; r;) Yi.has(r.name) && (n.some((e) => e.type === q.FunctionDefinition || e.type === q.LambdaExpression) && r.name === q.ClassDefinition || n.push({
|
|
2794
2796
|
id: r.from,
|
|
2795
2797
|
type: r.name
|
|
2796
2798
|
})), r = r.parent;
|
|
@@ -2799,70 +2801,70 @@ function ea(e, t) {
|
|
|
2799
2801
|
type: "global"
|
|
2800
2802
|
}), n;
|
|
2801
2803
|
}
|
|
2802
|
-
function
|
|
2804
|
+
function Y(e, t, n) {
|
|
2803
2805
|
e.push({
|
|
2804
2806
|
scopeId: t,
|
|
2805
2807
|
from: n
|
|
2806
2808
|
});
|
|
2807
2809
|
}
|
|
2808
|
-
function
|
|
2810
|
+
function na(e, t) {
|
|
2809
2811
|
if (e.firstChild()) do
|
|
2810
2812
|
t(e.node);
|
|
2811
2813
|
while (e.nextSibling());
|
|
2812
2814
|
}
|
|
2813
|
-
function
|
|
2815
|
+
function ra(e, t) {
|
|
2814
2816
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2815
2817
|
switch (e.name) {
|
|
2816
|
-
case
|
|
2817
|
-
n.doc.sliceString(e.from, e.to) === r &&
|
|
2818
|
+
case q.VariableName:
|
|
2819
|
+
n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2818
2820
|
break;
|
|
2819
|
-
case
|
|
2820
|
-
case
|
|
2821
|
+
case q.TupleExpression:
|
|
2822
|
+
case q.ArrayExpression: {
|
|
2821
2823
|
let n = e.node.cursor();
|
|
2822
2824
|
n.firstChild();
|
|
2823
2825
|
do
|
|
2824
|
-
|
|
2826
|
+
ra(n, t);
|
|
2825
2827
|
while (n.nextSibling());
|
|
2826
2828
|
break;
|
|
2827
2829
|
}
|
|
2828
2830
|
}
|
|
2829
2831
|
}
|
|
2830
|
-
function
|
|
2832
|
+
function ia(e, t) {
|
|
2831
2833
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2832
2834
|
o.firstChild();
|
|
2833
2835
|
do {
|
|
2834
|
-
if (o.name !==
|
|
2836
|
+
if (o.name !== q.ParamList) continue;
|
|
2835
2837
|
let e = o.node.cursor();
|
|
2836
2838
|
e.firstChild();
|
|
2837
2839
|
do
|
|
2838
|
-
e.name ===
|
|
2840
|
+
e.name === q.VariableName && n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2839
2841
|
while (e.nextSibling());
|
|
2840
2842
|
} while (o.nextSibling());
|
|
2841
2843
|
}
|
|
2842
|
-
function
|
|
2844
|
+
function aa(e, t) {
|
|
2843
2845
|
let n = e.cursor();
|
|
2844
2846
|
n.firstChild();
|
|
2845
2847
|
let r = !1;
|
|
2846
2848
|
do
|
|
2847
|
-
if (n.name ===
|
|
2848
|
-
else if (r && n.name ===
|
|
2849
|
-
else r &&
|
|
2849
|
+
if (n.name === J.For) r = !0;
|
|
2850
|
+
else if (r && n.name === J.In) break;
|
|
2851
|
+
else r && ra(n, t);
|
|
2850
2852
|
while (n.nextSibling());
|
|
2851
2853
|
}
|
|
2852
|
-
function
|
|
2853
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2854
|
+
function oa(e, t) {
|
|
2855
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Yi.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2854
2856
|
switch (s) {
|
|
2855
|
-
case
|
|
2856
|
-
case
|
|
2857
|
+
case q.FunctionDefinition:
|
|
2858
|
+
case q.ClassDefinition: {
|
|
2857
2859
|
let t = e.cursor();
|
|
2858
2860
|
t.firstChild();
|
|
2859
2861
|
do
|
|
2860
|
-
if (t.name ===
|
|
2861
|
-
|
|
2862
|
+
if (t.name === q.VariableName && n.doc.sliceString(t.from, t.to) === r) {
|
|
2863
|
+
Y(a, i[i.length - 1] ?? -1, t.from);
|
|
2862
2864
|
break;
|
|
2863
2865
|
}
|
|
2864
2866
|
while (t.nextSibling());
|
|
2865
|
-
s ===
|
|
2867
|
+
s === q.FunctionDefinition && ia(e, {
|
|
2866
2868
|
state: n,
|
|
2867
2869
|
variableName: r,
|
|
2868
2870
|
scopeId: c,
|
|
@@ -2870,38 +2872,38 @@ function aa(e, t) {
|
|
|
2870
2872
|
});
|
|
2871
2873
|
break;
|
|
2872
2874
|
}
|
|
2873
|
-
case
|
|
2874
|
-
|
|
2875
|
+
case q.LambdaExpression:
|
|
2876
|
+
ia(e, {
|
|
2875
2877
|
state: n,
|
|
2876
2878
|
variableName: r,
|
|
2877
2879
|
scopeId: c,
|
|
2878
2880
|
declarations: a
|
|
2879
2881
|
});
|
|
2880
2882
|
break;
|
|
2881
|
-
case
|
|
2882
|
-
case
|
|
2883
|
-
case
|
|
2884
|
-
case
|
|
2885
|
-
case
|
|
2886
|
-
|
|
2883
|
+
case q.ArrayComprehensionExpression:
|
|
2884
|
+
case q.DictionaryComprehensionExpression:
|
|
2885
|
+
case q.SetComprehensionExpression:
|
|
2886
|
+
case q.ComprehensionExpression:
|
|
2887
|
+
case q.ForStatement:
|
|
2888
|
+
aa(e, {
|
|
2887
2889
|
state: n,
|
|
2888
2890
|
variableName: r,
|
|
2889
2891
|
scopeId: u,
|
|
2890
2892
|
declarations: a
|
|
2891
2893
|
});
|
|
2892
2894
|
break;
|
|
2893
|
-
case
|
|
2895
|
+
case q.AssignStatement: {
|
|
2894
2896
|
let t = [], i = e.cursor();
|
|
2895
2897
|
i.firstChild();
|
|
2896
2898
|
do
|
|
2897
|
-
i.name ===
|
|
2899
|
+
i.name === q.AssignOp && t.push(i.from);
|
|
2898
2900
|
while (i.nextSibling());
|
|
2899
2901
|
let o = t[t.length - 1];
|
|
2900
2902
|
if (o === void 0) break;
|
|
2901
2903
|
let s = e.cursor();
|
|
2902
2904
|
s.firstChild();
|
|
2903
2905
|
do
|
|
2904
|
-
s.from < o &&
|
|
2906
|
+
s.from < o && ra(s, {
|
|
2905
2907
|
state: n,
|
|
2906
2908
|
variableName: r,
|
|
2907
2909
|
scopeId: u,
|
|
@@ -2910,14 +2912,14 @@ function aa(e, t) {
|
|
|
2910
2912
|
while (s.nextSibling());
|
|
2911
2913
|
break;
|
|
2912
2914
|
}
|
|
2913
|
-
case
|
|
2915
|
+
case q.ImportStatement: {
|
|
2914
2916
|
let t = e.cursor();
|
|
2915
2917
|
t.firstChild();
|
|
2916
2918
|
let i = !1, o = null, s = () => {
|
|
2917
|
-
o?.matches &&
|
|
2919
|
+
o?.matches && Y(a, u, o.from), o = null;
|
|
2918
2920
|
};
|
|
2919
2921
|
do
|
|
2920
|
-
t.name ===
|
|
2922
|
+
t.name === J.Import ? i = !0 : i && (t.name === J.As ? o = null : t.name === q.VariableName ? (s(), o = {
|
|
2921
2923
|
from: t.from,
|
|
2922
2924
|
matches: n.doc.sliceString(t.from, t.to) === r
|
|
2923
2925
|
}) : t.name === "," && s());
|
|
@@ -2925,19 +2927,19 @@ function aa(e, t) {
|
|
|
2925
2927
|
s();
|
|
2926
2928
|
break;
|
|
2927
2929
|
}
|
|
2928
|
-
case
|
|
2929
|
-
case
|
|
2930
|
+
case q.TryStatement:
|
|
2931
|
+
case q.WithStatement: {
|
|
2930
2932
|
let t = e.cursor();
|
|
2931
2933
|
t.firstChild();
|
|
2932
2934
|
let i = !1;
|
|
2933
2935
|
do
|
|
2934
|
-
t.name ===
|
|
2936
|
+
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
2937
|
while (t.nextSibling());
|
|
2936
2938
|
break;
|
|
2937
2939
|
}
|
|
2938
2940
|
}
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
+
na(o, (e) => {
|
|
2942
|
+
oa(e, {
|
|
2941
2943
|
state: n,
|
|
2942
2944
|
variableName: r,
|
|
2943
2945
|
scopeStack: l,
|
|
@@ -2945,86 +2947,86 @@ function aa(e, t) {
|
|
|
2945
2947
|
});
|
|
2946
2948
|
});
|
|
2947
2949
|
}
|
|
2948
|
-
function
|
|
2950
|
+
function sa(e, t, n) {
|
|
2949
2951
|
let r = me(e), i = [];
|
|
2950
|
-
|
|
2952
|
+
oa(r, {
|
|
2951
2953
|
state: e,
|
|
2952
2954
|
variableName: t,
|
|
2953
2955
|
scopeStack: [],
|
|
2954
2956
|
declarations: i
|
|
2955
2957
|
});
|
|
2956
2958
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2957
|
-
for (let e of
|
|
2958
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2959
|
+
for (let e of ta(r, a)) {
|
|
2960
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !Qi.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2959
2961
|
if (t) return t.from;
|
|
2960
2962
|
}
|
|
2961
2963
|
return null;
|
|
2962
2964
|
}
|
|
2963
|
-
function
|
|
2964
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2965
|
-
return i !== null && (
|
|
2965
|
+
function ca(e, t, n) {
|
|
2966
|
+
let { state: r } = e, i = n === void 0 ? ea(r, t) : sa(r, t, n);
|
|
2967
|
+
return i !== null && ($i(e, i), !0);
|
|
2966
2968
|
}
|
|
2967
|
-
function
|
|
2968
|
-
return
|
|
2969
|
+
function la(e, t) {
|
|
2970
|
+
return $i(e, e.state.doc.line(t).from), !0;
|
|
2969
2971
|
}
|
|
2970
2972
|
//#endregion
|
|
2971
2973
|
//#region src/core/network/connection.ts
|
|
2972
|
-
var
|
|
2973
|
-
|
|
2974
|
+
var X = S({ state: A.NOT_STARTED });
|
|
2975
|
+
v(null, (e, t) => t === null ? null : {
|
|
2974
2976
|
phase: t.phase,
|
|
2975
2977
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2976
2978
|
});
|
|
2977
|
-
function la() {
|
|
2978
|
-
return x(Y, (e) => e.state === k.OPEN);
|
|
2979
|
-
}
|
|
2980
2979
|
function ua() {
|
|
2981
|
-
return
|
|
2980
|
+
return ne(X, (e) => e.state === A.OPEN);
|
|
2982
2981
|
}
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2982
|
+
function da() {
|
|
2983
|
+
return _e() ? ua() : Promise.resolve();
|
|
2984
|
+
}
|
|
2985
|
+
S((e) => e(X).state === A.CONNECTING), S((e) => e(X).state === A.OPEN), S((e) => {
|
|
2986
|
+
let t = e(X);
|
|
2987
|
+
return t.state === A.OPEN || t.state === A.NOT_STARTED;
|
|
2988
|
+
}), S((e) => e(X).state === A.CLOSED);
|
|
2987
2989
|
//#endregion
|
|
2988
2990
|
//#region src/components/ui/checkbox.tsx
|
|
2989
|
-
var
|
|
2990
|
-
let
|
|
2991
|
-
|
|
2991
|
+
var fa = E.forwardRef((e, t) => {
|
|
2992
|
+
let n = (0, Nn.c)(13), i, a;
|
|
2993
|
+
n[0] === e ? (i = n[1], a = n[2]) : ({className: i, ...a} = e, n[0] = e, n[1] = i, n[2] = a);
|
|
2992
2994
|
let o;
|
|
2993
|
-
|
|
2995
|
+
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
2996
|
let s;
|
|
2995
|
-
|
|
2997
|
+
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
2998
|
let c;
|
|
2997
|
-
|
|
2999
|
+
n[6] === a.checked ? c = n[7] : (c = /* @__PURE__ */ (0, D.jsx)(Ie, {
|
|
2998
3000
|
className: s,
|
|
2999
|
-
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0,
|
|
3000
|
-
}),
|
|
3001
|
-
let
|
|
3002
|
-
return
|
|
3001
|
+
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, D.jsx)(we, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, D.jsx)(u, { className: "h-4 w-4" })
|
|
3002
|
+
}), n[6] = a.checked, n[7] = c);
|
|
3003
|
+
let l;
|
|
3004
|
+
return n[8] !== a || n[9] !== t || n[10] !== o || n[11] !== c ? (l = /* @__PURE__ */ (0, D.jsx)(Pe, {
|
|
3003
3005
|
ref: t,
|
|
3004
3006
|
className: o,
|
|
3005
3007
|
...a,
|
|
3006
3008
|
children: c
|
|
3007
|
-
}),
|
|
3009
|
+
}), n[8] = a, n[9] = t, n[10] = o, n[11] = c, n[12] = l) : l = n[12], l;
|
|
3008
3010
|
});
|
|
3009
|
-
|
|
3011
|
+
fa.displayName = Pe.displayName;
|
|
3010
3012
|
//#endregion
|
|
3011
3013
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
3012
|
-
function
|
|
3013
|
-
if (!
|
|
3014
|
+
function pa({ cellId: e, cell: t, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
3015
|
+
if (!t) return;
|
|
3014
3016
|
let o = document.getElementById(V.create(e));
|
|
3015
|
-
if (!o)
|
|
3016
|
-
else if (
|
|
3017
|
+
if (!o) n.warn("scrollCellIntoView: element not found");
|
|
3018
|
+
else if (xi()) Si(o);
|
|
3017
3019
|
else {
|
|
3018
|
-
if (r)
|
|
3020
|
+
if (r) Si(o);
|
|
3019
3021
|
else {
|
|
3020
|
-
|
|
3021
|
-
let r =
|
|
3022
|
+
Vn.promote(e);
|
|
3023
|
+
let r = t.current?.editorView;
|
|
3022
3024
|
if (!r) {
|
|
3023
|
-
|
|
3025
|
+
n.warn("scrollCellIntoView: editor not found", e);
|
|
3024
3026
|
return;
|
|
3025
3027
|
}
|
|
3026
3028
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
3027
|
-
if (
|
|
3029
|
+
if (yi(r), i === "top") r.dispatch({ selection: {
|
|
3028
3030
|
anchor: 0,
|
|
3029
3031
|
head: 0
|
|
3030
3032
|
} });
|
|
@@ -3034,7 +3036,7 @@ function fa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
3034
3036
|
anchor: e.from,
|
|
3035
3037
|
head: e.from
|
|
3036
3038
|
} });
|
|
3037
|
-
} else a &&
|
|
3039
|
+
} else a && ca(r, a);
|
|
3038
3040
|
}
|
|
3039
3041
|
o.scrollIntoView({
|
|
3040
3042
|
behavior: "smooth",
|
|
@@ -3042,20 +3044,20 @@ function fa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
3042
3044
|
});
|
|
3043
3045
|
}
|
|
3044
3046
|
}
|
|
3045
|
-
function
|
|
3047
|
+
function ma() {
|
|
3046
3048
|
let e = document.getElementById("App");
|
|
3047
3049
|
e?.scrollTo({
|
|
3048
3050
|
top: e.scrollHeight,
|
|
3049
3051
|
behavior: "smooth"
|
|
3050
3052
|
});
|
|
3051
3053
|
}
|
|
3052
|
-
function
|
|
3054
|
+
function ha() {
|
|
3053
3055
|
document.getElementById("App")?.scrollTo({
|
|
3054
3056
|
top: 0,
|
|
3055
3057
|
behavior: "smooth"
|
|
3056
3058
|
});
|
|
3057
3059
|
}
|
|
3058
|
-
function
|
|
3060
|
+
function ga(e) {
|
|
3059
3061
|
let t = document.getElementById(V.create(e));
|
|
3060
3062
|
return t?.scrollIntoView({
|
|
3061
3063
|
behavior: "smooth",
|
|
@@ -3064,64 +3066,64 @@ function ha(e) {
|
|
|
3064
3066
|
}
|
|
3065
3067
|
//#endregion
|
|
3066
3068
|
//#region src/core/cells/utils.ts
|
|
3067
|
-
function
|
|
3069
|
+
function _a(e) {
|
|
3068
3070
|
return e.cellIds.map((t) => e.cellData[t]);
|
|
3069
3071
|
}
|
|
3070
|
-
function
|
|
3072
|
+
function va(e) {
|
|
3071
3073
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
3072
3074
|
for (let e of t) n[e].config.disabled && r.push(e);
|
|
3073
3075
|
return r;
|
|
3074
3076
|
}
|
|
3075
|
-
function
|
|
3077
|
+
function ya(e) {
|
|
3076
3078
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
3077
3079
|
for (let e of t) n[e].config.disabled || r.push(e);
|
|
3078
3080
|
return r;
|
|
3079
3081
|
}
|
|
3080
|
-
function
|
|
3082
|
+
function ba(e) {
|
|
3081
3083
|
return e.history.length > 0;
|
|
3082
3084
|
}
|
|
3083
|
-
function
|
|
3085
|
+
function xa(e) {
|
|
3084
3086
|
let t = e.history[e.history.length - 1];
|
|
3085
3087
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
3086
3088
|
}
|
|
3087
|
-
function
|
|
3088
|
-
return e.status === "idle" ?
|
|
3089
|
+
function Sa(e, t, n) {
|
|
3090
|
+
return e.status === "idle" ? Ea(e) && n.code.trim() ? "not-run" : t.sourceChanged ? "source" : e.outcome === "cancelled" ? "interrupted" : t.inputsChanged && !n.config.disabled && !e.blocked ? "inputs" : null : null;
|
|
3089
3091
|
}
|
|
3090
|
-
function*
|
|
3092
|
+
function* Ca(e, t, n) {
|
|
3091
3093
|
for (let r of e.cellIds) {
|
|
3092
|
-
let i = Jt(t, r), a = n(r), o =
|
|
3093
|
-
o === null ? a.sourceChanged &&
|
|
3094
|
+
let i = Jt(t, r), a = n(r), o = Sa(i, a, e.cellData[r]);
|
|
3095
|
+
o === null ? a.sourceChanged && Ta(t.executions, r) && (yield [r, "source"]) : yield [r, o];
|
|
3094
3096
|
}
|
|
3095
3097
|
}
|
|
3096
|
-
function
|
|
3098
|
+
function wa(e, t, n) {
|
|
3097
3099
|
let r = null;
|
|
3098
|
-
for (let [, i] of
|
|
3100
|
+
for (let [, i] of Ca(e, t, n)) {
|
|
3099
3101
|
if (i !== "inputs") return i;
|
|
3100
3102
|
r = i;
|
|
3101
3103
|
}
|
|
3102
3104
|
return r;
|
|
3103
3105
|
}
|
|
3104
|
-
function
|
|
3106
|
+
function Ta(e, t) {
|
|
3105
3107
|
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
3106
3108
|
return r !== void 0 && r.state.status !== "completed";
|
|
3107
3109
|
}
|
|
3108
|
-
function
|
|
3110
|
+
function Ea({ status: e, outcome: t, live: n }) {
|
|
3109
3111
|
return (t === null || !n) && e !== "queued" && e !== "running";
|
|
3110
3112
|
}
|
|
3111
|
-
function
|
|
3113
|
+
function Da({ errored: e, stopped: t }) {
|
|
3112
3114
|
return {
|
|
3113
3115
|
published: !0,
|
|
3114
3116
|
"has-error": e,
|
|
3115
3117
|
stopped: t
|
|
3116
3118
|
};
|
|
3117
3119
|
}
|
|
3118
|
-
function
|
|
3119
|
-
let a =
|
|
3120
|
+
function Oa({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
3121
|
+
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
3122
|
return (e || t || n || a) && !o;
|
|
3121
3123
|
}
|
|
3122
3124
|
//#endregion
|
|
3123
3125
|
//#region src/core/cells/cells.ts
|
|
3124
|
-
function
|
|
3126
|
+
function ka(e) {
|
|
3125
3127
|
let t = {
|
|
3126
3128
|
column: 0,
|
|
3127
3129
|
hide_code: !1,
|
|
@@ -3131,24 +3133,24 @@ function Oa(e) {
|
|
|
3131
3133
|
return {
|
|
3132
3134
|
...e,
|
|
3133
3135
|
cellData: {
|
|
3134
|
-
[B]:
|
|
3136
|
+
[B]: zr({
|
|
3135
3137
|
id: B,
|
|
3136
3138
|
config: t
|
|
3137
3139
|
}),
|
|
3138
3140
|
...e.cellData
|
|
3139
3141
|
},
|
|
3140
3142
|
cellRuntime: {
|
|
3141
|
-
[B]:
|
|
3143
|
+
[B]: Vr(),
|
|
3142
3144
|
...e.cellRuntime
|
|
3143
3145
|
},
|
|
3144
3146
|
cellHandles: {
|
|
3145
|
-
[B]: (0,
|
|
3147
|
+
[B]: (0, E.createRef)(),
|
|
3146
3148
|
...e.cellHandles
|
|
3147
3149
|
}
|
|
3148
3150
|
};
|
|
3149
3151
|
}
|
|
3150
|
-
function
|
|
3151
|
-
return
|
|
3152
|
+
function Aa() {
|
|
3153
|
+
return ka({
|
|
3152
3154
|
cellIds: [],
|
|
3153
3155
|
cellData: {},
|
|
3154
3156
|
cellRuntime: {},
|
|
@@ -3158,8 +3160,8 @@ function ka() {
|
|
|
3158
3160
|
cellLogs: []
|
|
3159
3161
|
});
|
|
3160
3162
|
}
|
|
3161
|
-
var { reducer:
|
|
3162
|
-
startCellConsole: (e, { cellId: t }) =>
|
|
3163
|
+
var { reducer: ja, createActions: Ma, getActionsForStore: Na, useActions: Pa, valueAtom: Z } = fe(Aa, {
|
|
3164
|
+
startCellConsole: (e, { cellId: t }) => Q({
|
|
3163
3165
|
state: e,
|
|
3164
3166
|
cellId: t,
|
|
3165
3167
|
cellReducer: (e) => ({
|
|
@@ -3171,25 +3173,25 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3171
3173
|
})
|
|
3172
3174
|
}),
|
|
3173
3175
|
showCommandOutput: (e, t) => {
|
|
3174
|
-
let { cell_id: n, entries: r, replace: i } = t, a =
|
|
3176
|
+
let { cell_id: n, entries: r, replace: i } = t, a = Q({
|
|
3175
3177
|
state: e,
|
|
3176
3178
|
cellId: n,
|
|
3177
3179
|
cellReducer: (e) => ({
|
|
3178
3180
|
...e,
|
|
3179
|
-
commandConsole:
|
|
3181
|
+
commandConsole: Gn(e.commandConsole, t, e.clearedCommandIds?.[t.op])
|
|
3180
3182
|
})
|
|
3181
3183
|
});
|
|
3182
3184
|
return i || t.op === "pdb-output" ? a : {
|
|
3183
3185
|
...a,
|
|
3184
|
-
cellLogs:
|
|
3186
|
+
cellLogs: _i(a.cellLogs, jr({
|
|
3185
3187
|
cell_id: n,
|
|
3186
3188
|
console: r
|
|
3187
|
-
})
|
|
3189
|
+
}))
|
|
3188
3190
|
};
|
|
3189
3191
|
},
|
|
3190
3192
|
hideConsoleInputs: (e, { cellId: t, executionId: n, inputIds: r }) => {
|
|
3191
3193
|
let i = new Set(r);
|
|
3192
|
-
return
|
|
3194
|
+
return Q({
|
|
3193
3195
|
state: e,
|
|
3194
3196
|
cellId: t,
|
|
3195
3197
|
cellReducer: (e) => ({
|
|
@@ -3207,7 +3209,7 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3207
3209
|
let n = t[e];
|
|
3208
3210
|
n.commandConsole?.entries.some((e) => e.source === "pdb-output") && (t[e] = {
|
|
3209
3211
|
...n,
|
|
3210
|
-
commandConsole:
|
|
3212
|
+
commandConsole: Gn(n.commandConsole, {
|
|
3211
3213
|
op: "pdb-output",
|
|
3212
3214
|
cell_id: e,
|
|
3213
3215
|
entries: [],
|
|
@@ -3220,18 +3222,18 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3220
3222
|
cellRuntime: t
|
|
3221
3223
|
};
|
|
3222
3224
|
},
|
|
3223
|
-
addLogs: (e, t) =>
|
|
3225
|
+
addLogs: (e, t) => t.logs.length === 0 ? e : {
|
|
3224
3226
|
...e,
|
|
3225
|
-
cellLogs:
|
|
3226
|
-
}
|
|
3227
|
+
cellLogs: _i(e.cellLogs, t.logs)
|
|
3228
|
+
},
|
|
3227
3229
|
reconcileDocument: (e, t) => {
|
|
3228
|
-
let n =
|
|
3229
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
3230
|
+
let n = fi(e, t);
|
|
3231
|
+
for (let t of e.cellIds) t in n.cellData || Za(t);
|
|
3230
3232
|
return n;
|
|
3231
3233
|
},
|
|
3232
3234
|
setStdinResponse: (e, t) => {
|
|
3233
3235
|
let { cellId: n, response: r, inputId: i } = t;
|
|
3234
|
-
return
|
|
3236
|
+
return Q({
|
|
3235
3237
|
state: e,
|
|
3236
3238
|
cellId: n,
|
|
3237
3239
|
cellReducer: (e) => ({
|
|
@@ -3244,7 +3246,7 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3244
3246
|
let n = be(), r = { ...e.cellRuntime };
|
|
3245
3247
|
for (let i of [...e.cellIds, B]) {
|
|
3246
3248
|
let a = e.cellRuntime[i];
|
|
3247
|
-
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a :
|
|
3249
|
+
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a : Vr({
|
|
3248
3250
|
clearedConsole: t ? a?.clearedConsole : void 0,
|
|
3249
3251
|
clearedCommandIds: t ? a?.clearedCommandIds : void 0
|
|
3250
3252
|
});
|
|
@@ -3258,10 +3260,10 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3258
3260
|
let t = e.scrollKey;
|
|
3259
3261
|
if (t === null) return e;
|
|
3260
3262
|
let n = t;
|
|
3261
|
-
return
|
|
3263
|
+
return pa({
|
|
3262
3264
|
cellId: n,
|
|
3263
3265
|
cell: e.cellHandles[n],
|
|
3264
|
-
isCodeHidden:
|
|
3266
|
+
isCodeHidden: hi(e.cellData[n]?.config.hide_code, C.get(G), n),
|
|
3265
3267
|
codeFocus: void 0,
|
|
3266
3268
|
variableName: void 0
|
|
3267
3269
|
}), {
|
|
@@ -3269,13 +3271,13 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3269
3271
|
scrollKey: null
|
|
3270
3272
|
};
|
|
3271
3273
|
},
|
|
3272
|
-
foldAll: (e) => (
|
|
3273
|
-
unfoldAll: (e) => (
|
|
3274
|
+
foldAll: (e) => (In(Object.keys(e.cellHandles).map((e) => $a(e))), e),
|
|
3275
|
+
unfoldAll: (e) => (Ln(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
3274
3276
|
clearLogs: (e) => ({
|
|
3275
3277
|
...e,
|
|
3276
3278
|
cellLogs: []
|
|
3277
3279
|
}),
|
|
3278
|
-
clearCellConsole: (e, t) =>
|
|
3280
|
+
clearCellConsole: (e, t) => Q({
|
|
3279
3281
|
state: e,
|
|
3280
3282
|
cellId: t.cellId,
|
|
3281
3283
|
cellReducer: (e) => {
|
|
@@ -3291,27 +3293,27 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3291
3293
|
}
|
|
3292
3294
|
})
|
|
3293
3295
|
});
|
|
3294
|
-
function
|
|
3295
|
-
return
|
|
3296
|
+
function Q({ state: e, cellId: t, cellReducer: r }) {
|
|
3297
|
+
return t in e.cellRuntime ? {
|
|
3296
3298
|
...e,
|
|
3297
3299
|
cellRuntime: {
|
|
3298
3300
|
...e.cellRuntime,
|
|
3299
|
-
[
|
|
3301
|
+
[t]: r(e.cellRuntime[t])
|
|
3300
3302
|
}
|
|
3301
|
-
} : (
|
|
3302
|
-
}
|
|
3303
|
-
var
|
|
3304
|
-
|
|
3305
|
-
}).addLogs,
|
|
3306
|
-
|
|
3307
|
-
var
|
|
3308
|
-
|
|
3309
|
-
var
|
|
3310
|
-
let { cellIds: t, cellData: n } = e(
|
|
3303
|
+
} : (n.warn(`Cell ${t} not found in state`), e);
|
|
3304
|
+
}
|
|
3305
|
+
var Fa = Ma((e) => {
|
|
3306
|
+
C.set(Z, (t) => ja(t, e));
|
|
3307
|
+
}).addLogs, $ = S((e) => e(Z).cellIds);
|
|
3308
|
+
S((e) => e($).length === 1), S((e) => va(e(Z)).length > 0), S((e) => ya(e(Z)).length > 0), S((e) => ba(e(Z))), S((e) => xa(e(Z)));
|
|
3309
|
+
var Ia = S((e) => wa(e(Z), e(mn), e(_n)));
|
|
3310
|
+
S((e) => e(Ia) !== null);
|
|
3311
|
+
var La = S((e) => {
|
|
3312
|
+
let { cellIds: t, cellData: n } = e(Z);
|
|
3311
3313
|
return t.map((t) => {
|
|
3312
3314
|
let r = e(z(t)), { name: i } = n[t];
|
|
3313
|
-
if (r !== null &&
|
|
3314
|
-
|
|
3315
|
+
if (r !== null && Wn(r.mimetype)) {
|
|
3316
|
+
T(Array.isArray(r.data), "Expected array data");
|
|
3315
3317
|
let e = r.data.filter((e) => !e.type.includes("ancestor"));
|
|
3316
3318
|
if (e.length > 0) return {
|
|
3317
3319
|
output: {
|
|
@@ -3324,100 +3326,103 @@ var Ia = _((e) => {
|
|
|
3324
3326
|
}
|
|
3325
3327
|
return null;
|
|
3326
3328
|
}).filter(Boolean);
|
|
3327
|
-
}),
|
|
3328
|
-
let t =
|
|
3329
|
-
for (let n of e(
|
|
3330
|
-
let r = e(
|
|
3331
|
-
r
|
|
3329
|
+
}), Ra = w(S((e) => {
|
|
3330
|
+
let t = [];
|
|
3331
|
+
for (let n of e($)) {
|
|
3332
|
+
let r = e(wn(n));
|
|
3333
|
+
r && r.items.length > 0 && t.push([n, r]);
|
|
3332
3334
|
}
|
|
3333
3335
|
return t;
|
|
3334
|
-
})),
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3336
|
+
}), t.identity, y), za = w(Ra, (e) => Object.fromEntries(e), y), Ba = w(Ra, (e) => ({ items: e.flatMap(([e, t]) => t.items.map((t) => ({
|
|
3337
|
+
...t,
|
|
3338
|
+
cellId: e
|
|
3339
|
+
}))) }));
|
|
3340
|
+
S((e) => e(La).length);
|
|
3341
|
+
var Va = te(S((e) => {
|
|
3342
|
+
let { cellIds: t, cellData: n } = e(Z);
|
|
3338
3343
|
return le.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
3339
3344
|
}));
|
|
3340
|
-
|
|
3341
|
-
var
|
|
3342
|
-
let { cellIds: e, cellData: t } =
|
|
3345
|
+
S((e) => e(Z).scrollKey);
|
|
3346
|
+
var Ha = () => b($), Ua = () => b(Va), Wa = () => C.get(Z), Ga = () => C.get(Z).cellIds, Ka = () => {
|
|
3347
|
+
let { cellIds: e, cellData: t } = C.get(Z);
|
|
3343
3348
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
3344
3349
|
};
|
|
3345
|
-
|
|
3346
|
-
var
|
|
3347
|
-
let t =
|
|
3348
|
-
let r = e(t), i = e(
|
|
3350
|
+
h(w(Z, (e) => e.cellIds.map((t) => e.cellData[t]))), S((e) => e(Z).cellIds.length > 0);
|
|
3351
|
+
var qa = _((e) => S((t) => t(Z).cellData[e])), Ja = Vr(), Ya = _((e) => {
|
|
3352
|
+
let t = S((t) => Wr(t, e, t(m))), n = S((t) => t(Z).cellRuntime[e] ?? Ja), r = S((e) => {
|
|
3353
|
+
let r = e(t), i = e(m), a = i && e(i.shownDocumentAtom)?.cells;
|
|
3349
3354
|
return {
|
|
3350
3355
|
local: e(n),
|
|
3351
3356
|
execution: r,
|
|
3352
3357
|
code: r && kt(r.record, a ?? void 0)
|
|
3353
3358
|
};
|
|
3354
|
-
}), i =
|
|
3355
|
-
return
|
|
3356
|
-
}),
|
|
3357
|
-
function
|
|
3358
|
-
|
|
3359
|
-
}
|
|
3360
|
-
var
|
|
3361
|
-
let { cellHandles: t } =
|
|
3359
|
+
}), i = w(r, Gr);
|
|
3360
|
+
return S((e) => e(i).rendered);
|
|
3361
|
+
}), Xa = _((e) => S((t) => t(Z).cellHandles[e]));
|
|
3362
|
+
function Za(e) {
|
|
3363
|
+
qa.remove(e), Ya.remove(e), Xa.remove(e), Tn(e);
|
|
3364
|
+
}
|
|
3365
|
+
var Qa = (e) => {
|
|
3366
|
+
let { cellHandles: t } = C.get(Z);
|
|
3362
3367
|
return t[e]?.current?.editorView ?? void 0;
|
|
3363
|
-
},
|
|
3364
|
-
|
|
3365
|
-
...e(
|
|
3366
|
-
...e(
|
|
3368
|
+
}, $a = (e) => (Vn.promote(e), Qa(e));
|
|
3369
|
+
S((e) => e($).map((t) => ({
|
|
3370
|
+
...e(qa(t)),
|
|
3371
|
+
...e(Ya(t)),
|
|
3367
3372
|
output: e(z(t))
|
|
3368
3373
|
})));
|
|
3369
3374
|
//#endregion
|
|
3370
3375
|
//#region src/core/errors/error-entries.ts
|
|
3371
|
-
function
|
|
3372
|
-
if (
|
|
3376
|
+
function eo(e) {
|
|
3377
|
+
if (Hn(e.mimetype)) {
|
|
3373
3378
|
if (!Array.isArray(e.data)) return null;
|
|
3374
3379
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
3375
3380
|
return t.length === 0 ? null : { errorData: t };
|
|
3376
3381
|
}
|
|
3377
|
-
return
|
|
3382
|
+
return Un(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
3378
3383
|
errorData: [],
|
|
3379
3384
|
tracebackHtml: e.data
|
|
3380
3385
|
} : null;
|
|
3381
3386
|
}
|
|
3382
|
-
function
|
|
3387
|
+
function to(e) {
|
|
3383
3388
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
3384
3389
|
}
|
|
3385
|
-
function
|
|
3386
|
-
let t = e?.find((e) =>
|
|
3390
|
+
function no(e) {
|
|
3391
|
+
let t = e?.find((e) => Un(e.mimetype));
|
|
3387
3392
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
3388
3393
|
}
|
|
3389
|
-
function
|
|
3394
|
+
function ro(e, t) {
|
|
3390
3395
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
3391
|
-
if (!
|
|
3396
|
+
if (!to(e.errorData)) return no(t);
|
|
3392
3397
|
}
|
|
3393
|
-
function
|
|
3394
|
-
let { cellIds: t, cellData: n } = e.get(
|
|
3398
|
+
function io(e) {
|
|
3399
|
+
let { cellIds: t, cellData: n } = e.get(Z), r = [];
|
|
3395
3400
|
for (let [i, a] of t.entries()) {
|
|
3396
3401
|
let t = e.get(z(a));
|
|
3397
|
-
if (t === null || !
|
|
3398
|
-
let o =
|
|
3402
|
+
if (t === null || !Wn(t.mimetype)) continue;
|
|
3403
|
+
let o = eo(t);
|
|
3399
3404
|
if (!o) continue;
|
|
3400
|
-
let s =
|
|
3405
|
+
let s = Lr(n[a].name, i), c = t.code ?? n[a].code;
|
|
3401
3406
|
r.push({
|
|
3402
3407
|
cellId: a,
|
|
3403
3408
|
cellName: s,
|
|
3404
3409
|
cellCode: c,
|
|
3405
3410
|
errorData: o.errorData,
|
|
3406
|
-
tracebackHtml:
|
|
3411
|
+
tracebackHtml: ro(o, e.get(Ya(a)).consoleOutputs)
|
|
3407
3412
|
});
|
|
3408
3413
|
}
|
|
3409
3414
|
return r;
|
|
3410
3415
|
}
|
|
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" : (
|
|
3416
|
+
function ao(e) {
|
|
3417
|
+
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
3418
|
}
|
|
3414
|
-
function
|
|
3415
|
-
let t =
|
|
3419
|
+
function oo(e) {
|
|
3420
|
+
let t = ao(e);
|
|
3416
3421
|
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${W(e.traceback)}`), t;
|
|
3417
3422
|
}
|
|
3418
|
-
function
|
|
3423
|
+
function so(e) {
|
|
3419
3424
|
let t = [e.cellName];
|
|
3420
|
-
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(
|
|
3425
|
+
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(oo).join("\n\n")), t.join("\n\n");
|
|
3421
3426
|
}
|
|
3422
3427
|
//#endregion
|
|
3423
|
-
export {
|
|
3428
|
+
export { hi as $, mt as $t, fa as A, V as At, Gi as B, pn as Bt, _a as C, jr as Ct, ma as D, rr as Dt, pa as E, br as Et, Xi as F, Kn as Ft, Ii as G, En as Gt, Hi as H, wn as Ht, Ji as I, qn as It, Ti as J, Dn as Jt, Ni as K, dn as Kt, Ki as L, Pn as Lt, ua as M, Zn as Mt, da as N, er as Nt, ga as O, Qn as Ot, la as P, $n as Pt, yi as Q, ht as Qt, qi as R, Mn as Rt, Ea as S, Fr as St, Oa as T, W as Tt, Ui as U, z as Ut, Vi as V, Cn as Vt, Fi as W, R as Wt, wi as X, jn as Xt, Ci as Y, kn as Yt, bi as Z, Jt as Zt, Ba as _, Wr as _t, Fa as a, He as an, Yr as at, Ha as b, Ir as bt, Ya as c, oi as ct, Na as d, li as dt, Qe as en, gi as et, Ka as f, ri as ft, Z as g, Kr as gt, Aa as h, ii as ht, io as i, Xe as in, Jr as it, X as j, B as jt, ha as k, tr as kt, Ma as l, ci as lt, Wa as m, ai as mt, so as n, Ue as nn, mi as nt, qa as o, we as on, si as ot, Ga as p, Zr as pt, Oi as q, An as qt, oo as r, qe as rn, pi as rt, $ as s, Ce as sn, Xr as st, ao as t, A as tn, G as tt, $a as u, ui as ut, ja as v, Ur as vt, Da as w, Dr as wt, Ua as x, Rr as xt, Za as y, Lr as yt, K as z, Sn as zt };
|