@marimo-team/islands 0.25.3-dev462 → 0.25.3-dev464
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ErrorBoundary-BnH_3-iX.js → ErrorBoundary-BUp3s8bW.js} +1 -1
- package/dist/assets/__vite-browser-external-DoIBUY2I.js +1 -0
- package/dist/assets/{worker-D70Lo75A.js → worker-DFvnFhLF.js} +2 -2
- package/dist/{chat-ui-Ci-OmyBN.js → chat-ui-DFoH-uxc.js} +3 -3
- package/dist/{code-visibility-9cVyvQDR.js → code-visibility-JyOG3ytM.js} +2 -2
- package/dist/{common-BFNJT3tG.js → common-DsPeHITU.js} +4 -4
- package/dist/{data-grid-overlay-editor-CQpih6Vr.js → data-grid-overlay-editor-D6RpA9b2.js} +1 -1
- package/dist/{error-entries-DMWlemUn.js → error-entries-C9OKfJKe.js} +283 -279
- package/dist/{feedback-button-D_xvjRAC.js → feedback-button-w5jJOd6o.js} +3 -3
- package/dist/{glide-data-editor-ttA3lt4w.js → glide-data-editor-lWcwB0Si.js} +3 -3
- package/dist/{globals-DgHMWwtp.js → globals-BFICoaLo.js} +1 -1
- package/dist/{html-to-image-CDlYnllr.js → html-to-image-BiWLL4Tu.js} +1 -1
- package/dist/main.js +163 -176
- package/dist/{number-overlay-editor-VuSNPGWk.js → number-overlay-editor-BDYmg8YM.js} +1 -1
- package/dist/{process-output-89n_C_pU.js → process-output-ClyiXL-f.js} +2 -2
- package/dist/{reveal-component-D63GuWKz.js → reveal-component-B63xZtLQ.js} +2 -2
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +2 -2
- package/src/__mocks__/notebook.ts +6 -3
- package/src/components/dependency-graph/minimap-content.tsx +1 -1
- package/src/components/editor/notebook-cell.tsx +6 -6
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +2 -2
- package/src/components/slides/slide-cell-view.tsx +2 -2
- package/src/core/ai/context/providers/__tests__/error.test.ts +0 -4
- package/src/core/cells/__tests__/cell.test.ts +8 -8
- package/src/core/cells/__tests__/runs.test.ts +1 -1
- package/src/core/cells/__tests__/session.test.ts +2 -2
- package/src/core/cells/__tests__/utils.test.ts +2 -2
- package/src/core/cells/cell.ts +2 -2
- package/src/core/cells/execution-console.ts +18 -13
- package/src/core/cells/runs.ts +10 -2
- package/src/core/cells/session.ts +1 -1
- package/src/core/cells/utils.ts +2 -2
- package/src/core/executions/__tests__/atoms.test.ts +1 -1
- package/src/core/executions/__tests__/interrupt.test.ts +1 -1
- package/src/core/executions/__tests__/output.test.ts +26 -5
- package/src/core/executions/__tests__/select.test.ts +4 -4
- package/src/core/executions/output.ts +16 -4
- package/src/core/islands/__tests__/bridge.test.ts +8 -1
- package/src/core/islands/bridge.ts +7 -3
- package/src/core/notebook/replica/__tests__/executions.test.ts +65 -10
- package/src/core/notebook/replica/__tests__/replica.test.ts +3 -1
- package/src/core/notebook/replica/__tests__/results.test.ts +2 -2
- package/src/core/notebook/replica/replica.ts +2 -8
- package/src/core/notebook/replica/resources/executions.ts +28 -6
- package/src/core/session/__tests__/backend.test.ts +1 -1
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +8 -11
- package/src/core/session/useNotebookSession.tsx +1 -1
- package/src/stories/layout/vertical/one-column.stories.tsx +1 -2
- package/dist/assets/__vite-browser-external-DxDOnHRB.js +0 -1
|
@@ -336,6 +336,14 @@ function tt(e, t) {
|
|
|
336
336
|
//#endregion
|
|
337
337
|
//#region src/core/notebook/replica/resources/executions.ts
|
|
338
338
|
function nt(e) {
|
|
339
|
+
let { state: t } = e;
|
|
340
|
+
return t.status === "completed" && t.outcome.kind === "failed" && t.outcome.message !== null ? {
|
|
341
|
+
runId: e.id,
|
|
342
|
+
message: t.outcome.message,
|
|
343
|
+
completedAt: t.completed_at
|
|
344
|
+
} : void 0;
|
|
345
|
+
}
|
|
346
|
+
function rt(e) {
|
|
339
347
|
return [...e.items.values()].toSorted((e, t) => e.seq - t.seq);
|
|
340
348
|
}
|
|
341
349
|
function M(e, t) {
|
|
@@ -343,7 +351,7 @@ function M(e, t) {
|
|
|
343
351
|
let n = new Map(e);
|
|
344
352
|
return n.delete(t), n;
|
|
345
353
|
}
|
|
346
|
-
function
|
|
354
|
+
function it(e, t) {
|
|
347
355
|
let n = e.scratchConsole, { id: r, cell_id: i } = t.record, a = A(t.record);
|
|
348
356
|
if (i !== null || a === null) return n;
|
|
349
357
|
if (!n || n.record.id === r) return t;
|
|
@@ -355,11 +363,11 @@ function N(e, t) {
|
|
|
355
363
|
return {
|
|
356
364
|
...e,
|
|
357
365
|
executions: new Map(e.executions).set(n, t),
|
|
358
|
-
scratchConsole:
|
|
366
|
+
scratchConsole: it(e, t),
|
|
359
367
|
latest: r === null || e.latest.get(r) === n ? e.latest : new Map(e.latest).set(r, n)
|
|
360
368
|
};
|
|
361
369
|
}
|
|
362
|
-
function
|
|
370
|
+
function at(e, t) {
|
|
363
371
|
let n = e.executions.get(t);
|
|
364
372
|
if (n === void 0) return e;
|
|
365
373
|
let r = n.record.cell_id;
|
|
@@ -370,7 +378,7 @@ function it(e, t) {
|
|
|
370
378
|
latest: r !== null && e.latest.get(r) === t ? M(e.latest, r) : e.latest
|
|
371
379
|
};
|
|
372
380
|
}
|
|
373
|
-
function
|
|
381
|
+
function ot(e, t) {
|
|
374
382
|
let n = e.executions.get(t.execution_id);
|
|
375
383
|
if (n === void 0) return e;
|
|
376
384
|
let r = n.items.get(t.id);
|
|
@@ -387,7 +395,7 @@ function at(e, t) {
|
|
|
387
395
|
items: new Map(n.items).set(t.id, t)
|
|
388
396
|
});
|
|
389
397
|
}
|
|
390
|
-
function
|
|
398
|
+
function st(e, t) {
|
|
391
399
|
for (let n of e.executions.values()) if (n.items.has(t)) return N(e, {
|
|
392
400
|
...n,
|
|
393
401
|
append: void 0,
|
|
@@ -395,37 +403,37 @@ function ot(e, t) {
|
|
|
395
403
|
});
|
|
396
404
|
return e;
|
|
397
405
|
}
|
|
398
|
-
function
|
|
406
|
+
function ct(e, t) {
|
|
399
407
|
let n = e.executions.get(t.execution_id);
|
|
400
408
|
return n === void 0 ? e : N(e, {
|
|
401
409
|
...n,
|
|
402
410
|
variables: new Map(n.variables).set(t.id, t)
|
|
403
411
|
});
|
|
404
412
|
}
|
|
405
|
-
function
|
|
413
|
+
function lt(e, t) {
|
|
406
414
|
for (let n of e.executions.values()) if (n.variables.has(t)) return N(e, {
|
|
407
415
|
...n,
|
|
408
416
|
variables: M(n.variables, t)
|
|
409
417
|
});
|
|
410
418
|
return e;
|
|
411
419
|
}
|
|
412
|
-
function
|
|
420
|
+
function ut(e, t) {
|
|
413
421
|
return JSON.stringify(k(e)) === JSON.stringify(k(t));
|
|
414
422
|
}
|
|
415
|
-
function
|
|
423
|
+
function dt(e, t) {
|
|
416
424
|
return {
|
|
417
425
|
...N(e, t),
|
|
418
426
|
results: et(e.results, t),
|
|
419
427
|
scratch: tt(e.scratch, t)
|
|
420
428
|
};
|
|
421
429
|
}
|
|
422
|
-
function
|
|
430
|
+
function ft(e, t, n) {
|
|
423
431
|
let r = new Map(e.executions);
|
|
424
432
|
for (let [e, n] of r) {
|
|
425
433
|
let i = n.record.cell_id === null ? t.scratch : t.results.get(n.record.cell_id), a = t.executions.get(e) ?? (i?.record.id === e ? i : void 0);
|
|
426
434
|
a !== void 0 && r.set(e, {
|
|
427
435
|
...n,
|
|
428
|
-
outputVersion: a.outputVersion + +!
|
|
436
|
+
outputVersion: a.outputVersion + +!ut(a, n)
|
|
429
437
|
});
|
|
430
438
|
}
|
|
431
439
|
let i = new Map(e.results);
|
|
@@ -446,7 +454,7 @@ function dt(e, t, n) {
|
|
|
446
454
|
scratch: a == null ? t.scratch : tt(t.scratch, a)
|
|
447
455
|
};
|
|
448
456
|
}
|
|
449
|
-
var
|
|
457
|
+
var pt = {
|
|
450
458
|
initial: {
|
|
451
459
|
runs: /* @__PURE__ */ new Map(),
|
|
452
460
|
executions: /* @__PURE__ */ new Map(),
|
|
@@ -465,7 +473,8 @@ var ft = {
|
|
|
465
473
|
}),
|
|
466
474
|
run: (e, { data: t }) => ({
|
|
467
475
|
...e,
|
|
468
|
-
runs: new Map(e.runs).set(t.run.id, t.run)
|
|
476
|
+
runs: new Map(e.runs).set(t.run.id, t.run),
|
|
477
|
+
scratchFailure: t.run.origin.kind === "code" ? nt(t.run) : e.scratchFailure
|
|
469
478
|
}),
|
|
470
479
|
"run.removed": (e, { data: t }) => e.runs.has(t.id) ? {
|
|
471
480
|
...e,
|
|
@@ -476,16 +485,16 @@ var ft = {
|
|
|
476
485
|
record: t,
|
|
477
486
|
output: n?.output ?? null
|
|
478
487
|
};
|
|
479
|
-
return
|
|
488
|
+
return dt(e, {
|
|
480
489
|
...r,
|
|
481
|
-
outputVersion: n === void 0 ? 0 : n.outputVersion + +!
|
|
490
|
+
outputVersion: n === void 0 ? 0 : n.outputVersion + +!ut(n, r),
|
|
482
491
|
append: n?.append,
|
|
483
492
|
lastSeq: n?.lastSeq,
|
|
484
493
|
items: n?.items ?? /* @__PURE__ */ new Map(),
|
|
485
494
|
variables: n?.variables ?? /* @__PURE__ */ new Map()
|
|
486
495
|
});
|
|
487
496
|
},
|
|
488
|
-
"execution.removed": (e, { data: t }) =>
|
|
497
|
+
"execution.removed": (e, { data: t }) => at(e, t.id),
|
|
489
498
|
output: (e, { data: { output: t } }) => {
|
|
490
499
|
let n = e.executions.get(t.execution_id);
|
|
491
500
|
if (n === void 0) return e;
|
|
@@ -493,37 +502,31 @@ var ft = {
|
|
|
493
502
|
...n,
|
|
494
503
|
output: t
|
|
495
504
|
};
|
|
496
|
-
return
|
|
505
|
+
return dt(e, {
|
|
497
506
|
...r,
|
|
498
|
-
outputVersion: n.outputVersion + +!
|
|
507
|
+
outputVersion: n.outputVersion + +!ut(n, r)
|
|
499
508
|
});
|
|
500
509
|
},
|
|
501
510
|
"output.removed": (e) => e,
|
|
502
|
-
console: (e, { data: t }) =>
|
|
511
|
+
console: (e, { data: t }) => ot(e, {
|
|
503
512
|
...t.console,
|
|
504
513
|
kind: "console",
|
|
505
514
|
time: t.time
|
|
506
515
|
}),
|
|
507
|
-
"console.removed": (e, { data: t }) =>
|
|
508
|
-
|
|
509
|
-
...t.display,
|
|
510
|
-
kind: "display",
|
|
511
|
-
time: t.time
|
|
512
|
-
}),
|
|
513
|
-
"display.removed": (e, { data: t }) => ot(e, t.id),
|
|
514
|
-
input: (e, { data: t }) => at(e, {
|
|
516
|
+
"console.removed": (e, { data: t }) => st(e, t.id),
|
|
517
|
+
input: (e, { data: t }) => ot(e, {
|
|
515
518
|
...t.input,
|
|
516
519
|
kind: "input",
|
|
517
520
|
time: t.time
|
|
518
521
|
}),
|
|
519
|
-
variable: (e, { data: t }) =>
|
|
520
|
-
"variable.removed": (e, { data: t }) =>
|
|
522
|
+
variable: (e, { data: t }) => ct(e, t.variable),
|
|
523
|
+
"variable.removed": (e, { data: t }) => lt(e, t.id)
|
|
521
524
|
}
|
|
522
|
-
},
|
|
525
|
+
}, mt = {
|
|
523
526
|
sourceChanged: !1,
|
|
524
527
|
inputsChanged: !1
|
|
525
528
|
};
|
|
526
|
-
function
|
|
529
|
+
function ht(e) {
|
|
527
530
|
let t = /* @__PURE__ */ new Map();
|
|
528
531
|
for (let n of e.executions.values()) for (let e of n.variables.values()) {
|
|
529
532
|
let n = t.get(e.name);
|
|
@@ -531,8 +534,8 @@ function mt(e) {
|
|
|
531
534
|
}
|
|
532
535
|
return t;
|
|
533
536
|
}
|
|
534
|
-
function
|
|
535
|
-
let t =
|
|
537
|
+
function gt(e) {
|
|
538
|
+
let t = ht(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
|
|
536
539
|
function i(e, n) {
|
|
537
540
|
let i = new Set(n).add(e.id);
|
|
538
541
|
for (let [n, a] of Object.entries($e(e))) {
|
|
@@ -569,54 +572,54 @@ function ht(e) {
|
|
|
569
572
|
}
|
|
570
573
|
return (t) => {
|
|
571
574
|
let n = e.results.get(t)?.record;
|
|
572
|
-
return n == null ?
|
|
575
|
+
return n == null ? mt : o(n, /* @__PURE__ */ new Set());
|
|
573
576
|
};
|
|
574
577
|
}
|
|
575
578
|
//#endregion
|
|
576
579
|
//#region src/core/executions/output.ts
|
|
577
|
-
var
|
|
580
|
+
var _t = /* @__PURE__ */ new Map(), vt = "application/vnd.marimo+error";
|
|
578
581
|
function P(e) {
|
|
579
582
|
return e;
|
|
580
583
|
}
|
|
581
|
-
function
|
|
584
|
+
function yt(e) {
|
|
582
585
|
return e.map(({ cell_id: e, message: t }) => ({
|
|
583
586
|
cell_id: P(e),
|
|
584
587
|
message: t
|
|
585
588
|
}));
|
|
586
589
|
}
|
|
587
|
-
function
|
|
590
|
+
function bt(e) {
|
|
588
591
|
return e === null ? 0 : Date.parse(e) / 1e3;
|
|
589
592
|
}
|
|
590
|
-
function
|
|
591
|
-
return
|
|
593
|
+
function xt(e) {
|
|
594
|
+
return bt(j(e) ?? A(e));
|
|
592
595
|
}
|
|
593
|
-
function
|
|
596
|
+
function St(e, t) {
|
|
594
597
|
return {
|
|
595
598
|
channel: "output",
|
|
596
599
|
mimetype: t.mimetype,
|
|
597
600
|
data: t.data,
|
|
598
|
-
timestamp:
|
|
601
|
+
timestamp: xt(e)
|
|
599
602
|
};
|
|
600
603
|
}
|
|
601
604
|
function F(e, t) {
|
|
602
605
|
return {
|
|
603
606
|
channel: "marimo-error",
|
|
604
|
-
mimetype:
|
|
607
|
+
mimetype: vt,
|
|
605
608
|
data: t,
|
|
606
|
-
timestamp:
|
|
609
|
+
timestamp: xt(e)
|
|
607
610
|
};
|
|
608
611
|
}
|
|
609
|
-
function
|
|
612
|
+
function Ct(e) {
|
|
610
613
|
let t = e.related.at(0);
|
|
611
614
|
return t === void 0 ? null : P(t.cell_id);
|
|
612
615
|
}
|
|
613
|
-
function
|
|
616
|
+
function wt(e) {
|
|
614
617
|
switch (e.kind) {
|
|
615
618
|
case "exception": return {
|
|
616
619
|
type: "exception",
|
|
617
620
|
exception_type: e.name ?? "Exception",
|
|
618
621
|
msg: e.message,
|
|
619
|
-
raising_cell:
|
|
622
|
+
raising_cell: Ct(e),
|
|
620
623
|
traceback: e.traceback?.data ?? null
|
|
621
624
|
};
|
|
622
625
|
case "invalid-syntax": return {
|
|
@@ -629,16 +632,15 @@ function Ct(e) {
|
|
|
629
632
|
msg: e.message,
|
|
630
633
|
error_type: e.name
|
|
631
634
|
};
|
|
632
|
-
case "interrupted": return { type: "interruption" };
|
|
633
635
|
default: return {
|
|
634
636
|
type: "diagnostic",
|
|
635
637
|
kind: e.kind,
|
|
636
638
|
msg: e.message,
|
|
637
|
-
related:
|
|
639
|
+
related: yt(e.related)
|
|
638
640
|
};
|
|
639
641
|
}
|
|
640
642
|
}
|
|
641
|
-
function
|
|
643
|
+
function Tt(e, t) {
|
|
642
644
|
let n = t.related[0];
|
|
643
645
|
if (n !== void 0 && t.reason === "upstream-stopped") return F(e, [{
|
|
644
646
|
type: "ancestor-stopped",
|
|
@@ -658,54 +660,54 @@ function wt(e, t) {
|
|
|
658
660
|
type: "diagnostic",
|
|
659
661
|
kind: t.reason,
|
|
660
662
|
msg: t.message,
|
|
661
|
-
related:
|
|
663
|
+
related: yt(t.related)
|
|
662
664
|
}]);
|
|
663
665
|
}
|
|
664
|
-
function
|
|
666
|
+
function Et(e, t = _t) {
|
|
665
667
|
let n = e.cell_id === null ? void 0 : t.get(e.cell_id);
|
|
666
668
|
return n !== void 0 && n.code !== null && n.code_fingerprint === e.code_fingerprint ? n.code : void 0;
|
|
667
669
|
}
|
|
668
|
-
function
|
|
669
|
-
let n =
|
|
670
|
+
function Dt(e, t = _t) {
|
|
671
|
+
let n = Ot(e), r = Et(e.record, t);
|
|
670
672
|
return n === null || r === void 0 ? n : {
|
|
671
673
|
...n,
|
|
672
674
|
code: r
|
|
673
675
|
};
|
|
674
676
|
}
|
|
675
|
-
function
|
|
677
|
+
function Ot(e) {
|
|
676
678
|
let { record: t } = e, n = k(e);
|
|
677
679
|
if (n === null) return null;
|
|
678
680
|
switch (n.kind) {
|
|
679
|
-
case "output": return n.media === null ? null :
|
|
680
|
-
case "
|
|
681
|
-
case "
|
|
682
|
-
case "skipped": return
|
|
681
|
+
case "output": return n.media === null ? null : St(t, n.media);
|
|
682
|
+
case "failed": return F(t, [wt(n.error)]);
|
|
683
|
+
case "cancelled": return F(t, [{ type: "interruption" }]);
|
|
684
|
+
case "skipped": return Tt(t, n);
|
|
683
685
|
}
|
|
684
686
|
}
|
|
685
|
-
function
|
|
687
|
+
function kt(e, t) {
|
|
686
688
|
let n = e.executions.latest.get(t), r = n === void 0 ? void 0 : e.executions.executions.get(n);
|
|
687
689
|
if (r !== void 0 && k(r) !== null && r.record.state.status !== "completed") return r;
|
|
688
690
|
let i = e.results.get(t) ?? null;
|
|
689
691
|
return r?.record.state.status === "running" && i !== null && k(i)?.kind === "skipped" ? null : i;
|
|
690
692
|
}
|
|
691
|
-
function
|
|
693
|
+
function At(e, t) {
|
|
692
694
|
return e?.execution === t.record.id && e.version === t.outputVersion;
|
|
693
695
|
}
|
|
694
|
-
function
|
|
695
|
-
let n =
|
|
696
|
-
return n === null ||
|
|
696
|
+
function jt(e, t) {
|
|
697
|
+
let n = kt(e, t);
|
|
698
|
+
return n === null || At(e.cleared.get(t), n) ? null : Dt(n, e.cells);
|
|
697
699
|
}
|
|
698
|
-
function
|
|
700
|
+
function Mt(e) {
|
|
699
701
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set([...e.results.keys(), ...e.executions.latest.keys()]);
|
|
700
702
|
for (let r of n) {
|
|
701
|
-
let n =
|
|
703
|
+
let n = jt(e, r);
|
|
702
704
|
n !== null && t.set(P(r), n);
|
|
703
705
|
}
|
|
704
706
|
return t;
|
|
705
707
|
}
|
|
706
708
|
//#endregion
|
|
707
709
|
//#region src/utils/time.ts
|
|
708
|
-
var
|
|
710
|
+
var Nt = class e {
|
|
709
711
|
ms;
|
|
710
712
|
static fromMilliseconds(t) {
|
|
711
713
|
return t == null ? null : new e(t);
|
|
@@ -734,69 +736,69 @@ var Mt = class e {
|
|
|
734
736
|
};
|
|
735
737
|
//#endregion
|
|
736
738
|
//#region src/core/executions/select.ts
|
|
737
|
-
function
|
|
739
|
+
function Pt(e) {
|
|
738
740
|
return e.state.status === "completed" ? e.state.outcome.kind : null;
|
|
739
741
|
}
|
|
740
|
-
function
|
|
741
|
-
return e === null ? null :
|
|
742
|
+
function Ft(e) {
|
|
743
|
+
return e === null ? null : Nt.parse(e).toMilliseconds();
|
|
742
744
|
}
|
|
743
|
-
function
|
|
745
|
+
function It(e, t) {
|
|
744
746
|
let n = e.latest.get(t);
|
|
745
747
|
return n === void 0 ? null : e.executions.get(n) ?? null;
|
|
746
748
|
}
|
|
747
|
-
function
|
|
749
|
+
function Lt(e, t) {
|
|
748
750
|
let n = e.cells.get(t);
|
|
749
751
|
return n !== void 0 && !n.config.disabled && !e.blocked.has(t);
|
|
750
752
|
}
|
|
751
|
-
function
|
|
752
|
-
if (!
|
|
753
|
+
function Rt(e, t) {
|
|
754
|
+
if (!Lt(e, t)) return !1;
|
|
753
755
|
if (e.requested.has(t)) return !0;
|
|
754
|
-
let n =
|
|
756
|
+
let n = It(e.executions, t)?.record.run_id ?? e.results.get(t)?.record.run_id;
|
|
755
757
|
for (let r of e.executions.runs.values()) if (r.state.status !== "completed" && r.id !== n && r.origin.kind === "cells" && r.origin.cell_ids.includes(t)) return !0;
|
|
756
758
|
return !1;
|
|
757
759
|
}
|
|
758
|
-
function
|
|
759
|
-
let n =
|
|
760
|
-
n !== null && n.record.state.status !== "completed" ? (i = n.record.state.status, s =
|
|
761
|
-
let c = i === "idle", l = c && a !== null && o !== null ?
|
|
760
|
+
function zt(e, t) {
|
|
761
|
+
let n = It(e.executions, t), r = e.results.get(t)?.record ?? null, i = "idle", a = r === null ? null : A(r), o = r === null ? null : j(r), s = Ft(a);
|
|
762
|
+
n !== null && n.record.state.status !== "completed" ? (i = n.record.state.status, s = Ft(A(n.record)) ?? s) : Rt(e, t) && (i = "queued");
|
|
763
|
+
let c = i === "idle", l = c && a !== null && o !== null ? Nt.parse(o).since(Nt.parse(a)) : null;
|
|
762
764
|
return {
|
|
763
765
|
status: i,
|
|
764
766
|
blocked: e.blocked.has(t),
|
|
765
|
-
outcome: c && r !== null ?
|
|
767
|
+
outcome: c && r !== null ? Pt(r) : null,
|
|
766
768
|
live: r === null || e.runtimeId === null || r.runtime_id === e.runtimeId,
|
|
767
769
|
startedAt: s,
|
|
768
770
|
duration: l
|
|
769
771
|
};
|
|
770
772
|
}
|
|
771
|
-
function zt(e) {
|
|
772
|
-
return [...e.executions.values()].filter((e) => e.record.state.status !== "completed");
|
|
773
|
-
}
|
|
774
773
|
function Bt(e) {
|
|
775
|
-
return
|
|
774
|
+
return [...e.executions.values()].filter((e) => e.record.state.status !== "completed");
|
|
776
775
|
}
|
|
777
776
|
function Vt(e) {
|
|
778
|
-
|
|
777
|
+
return Bt(e).some((e) => e.record.state.status === "running");
|
|
778
|
+
}
|
|
779
|
+
function Ht(e) {
|
|
780
|
+
let t = Bt(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = new Set(e.requested);
|
|
779
781
|
for (let t of e.executions.runs.values()) if (t.state.status !== "completed" && t.origin.kind === "cells") for (let e of t.origin.cell_ids) r.add(e);
|
|
780
782
|
let i = 0;
|
|
781
|
-
for (let t of r) !n.has(t) &&
|
|
783
|
+
for (let t of r) !n.has(t) && Rt(e, t) && (i += 1);
|
|
782
784
|
return t.length + i;
|
|
783
785
|
}
|
|
784
786
|
//#endregion
|
|
785
787
|
//#region src/core/executions/atoms.ts
|
|
786
|
-
var
|
|
788
|
+
var Ut = {
|
|
787
789
|
runs: /* @__PURE__ */ new Map(),
|
|
788
790
|
executions: /* @__PURE__ */ new Map(),
|
|
789
791
|
latest: /* @__PURE__ */ new Map(),
|
|
790
792
|
results: /* @__PURE__ */ new Map(),
|
|
791
793
|
scratch: null
|
|
792
|
-
},
|
|
794
|
+
}, Wt = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map(), Gt = /* @__PURE__ */ new Set(), Kt = /* @__PURE__ */ new Set(), qt = /* @__PURE__ */ new Set(), Jt = /* @__PURE__ */ new Map(), L = x(null), Yt = x(null);
|
|
793
795
|
function Xt(e, t) {
|
|
794
796
|
return t !== null && e.replica === t.replica && e.id === t.id && e.generation === t.generation;
|
|
795
797
|
}
|
|
796
798
|
function Zt(e, t, n) {
|
|
797
799
|
return e !== null && Xt(e.notebook, t) ? e.value : n;
|
|
798
800
|
}
|
|
799
|
-
var
|
|
801
|
+
var R = x((e) => {
|
|
800
802
|
let t = e(h), n = t === null ? null : e(t.notebookAtom);
|
|
801
803
|
return t === null || n === null ? null : {
|
|
802
804
|
replica: t,
|
|
@@ -805,33 +807,33 @@ var L = x((e) => {
|
|
|
805
807
|
};
|
|
806
808
|
});
|
|
807
809
|
function Qt(e, t) {
|
|
808
|
-
return Xt(t.notebook, e.get(
|
|
810
|
+
return Xt(t.notebook, e.get(R));
|
|
809
811
|
}
|
|
810
812
|
var $t = x((e) => {
|
|
811
|
-
let t = Zt(e(
|
|
813
|
+
let t = Zt(e(L), e(R), Gt);
|
|
812
814
|
return t.size === 0 ? Kt : new Set([...t].flatMap((e) => e.cells));
|
|
813
|
-
}),
|
|
815
|
+
}), z = x((e) => {
|
|
814
816
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
815
817
|
return {
|
|
816
|
-
executions: t === null ?
|
|
817
|
-
results: t === null ?
|
|
818
|
-
cells: n?.cells ??
|
|
818
|
+
executions: t === null ? Ut : e(t.executionsAtom),
|
|
819
|
+
results: t === null ? Wt : e(t.resultsAtom),
|
|
820
|
+
cells: n?.cells ?? I,
|
|
819
821
|
requested: e($t),
|
|
820
|
-
blocked: Zt(e(Yt), e(
|
|
822
|
+
blocked: Zt(e(Yt), e(R), qt),
|
|
821
823
|
runtimeId: t === null ? null : e(t.runtimeAtom)?.id ?? null
|
|
822
824
|
};
|
|
823
825
|
}), en = x((e) => {
|
|
824
826
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
825
827
|
return t === null || n === null ? {
|
|
826
|
-
cells:
|
|
827
|
-
executions:
|
|
828
|
-
results:
|
|
828
|
+
cells: I,
|
|
829
|
+
executions: Ut,
|
|
830
|
+
results: Wt
|
|
829
831
|
} : {
|
|
830
832
|
cells: n.cells,
|
|
831
833
|
executions: e(t.executionsAtom),
|
|
832
834
|
results: e(t.resultsAtom)
|
|
833
835
|
};
|
|
834
|
-
}), tn = x((e) =>
|
|
836
|
+
}), tn = x((e) => gt(e(en))), nn = x(null), rn = x((e) => {
|
|
835
837
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
836
838
|
return t === null || n === null ? null : {
|
|
837
839
|
replica: t,
|
|
@@ -841,19 +843,19 @@ var $t = x((e) => {
|
|
|
841
843
|
}), an = x((e) => {
|
|
842
844
|
let t = e(h);
|
|
843
845
|
return {
|
|
844
|
-
executions: t === null ?
|
|
845
|
-
results: t === null ?
|
|
846
|
+
executions: t === null ? Ut : e(t.executionsAtom),
|
|
847
|
+
results: t === null ? Wt : e(t.resultsAtom),
|
|
846
848
|
cleared: Zt(e(nn), e(rn), Jt),
|
|
847
|
-
cells: t === null ?
|
|
849
|
+
cells: t === null ? I : e(t.documentAtom)?.cells ?? I
|
|
848
850
|
};
|
|
849
|
-
}), on = x((e) =>
|
|
851
|
+
}), on = x((e) => Mt(e(an))), B = S((e) => _(on, (t) => t.get(e) ?? null, g)), sn = S((e) => x((t) => Ye(t(B(e)))));
|
|
850
852
|
function cn(e) {
|
|
851
|
-
|
|
853
|
+
B.remove(e), sn.remove(e);
|
|
852
854
|
}
|
|
853
855
|
function ln(e, t) {
|
|
854
856
|
let n = e.get(an), r = new Map(n.cleared);
|
|
855
857
|
for (let e of t) {
|
|
856
|
-
let t =
|
|
858
|
+
let t = kt(n, e);
|
|
857
859
|
t != null && k(t) !== null && r.set(e, {
|
|
858
860
|
execution: t.record.id,
|
|
859
861
|
version: t.outputVersion
|
|
@@ -869,7 +871,7 @@ var un = x((e) => {
|
|
|
869
871
|
let t = e(h);
|
|
870
872
|
return t === null ? null : e(t.runtimeAtom)?.status ?? null;
|
|
871
873
|
});
|
|
872
|
-
x((e) =>
|
|
874
|
+
x((e) => Vt(e(z).executions)), x((e) => Ht(e(z)));
|
|
873
875
|
var dn = x((e) => {
|
|
874
876
|
let t = e(h);
|
|
875
877
|
if (t === null) return { refused: "No notebook is connected" };
|
|
@@ -894,39 +896,39 @@ function fn(e) {
|
|
|
894
896
|
});
|
|
895
897
|
}
|
|
896
898
|
function pn(e, t) {
|
|
897
|
-
let n = e.get(
|
|
899
|
+
let n = e.get(R);
|
|
898
900
|
if (n === null) return null;
|
|
899
901
|
let r = {
|
|
900
902
|
notebook: n,
|
|
901
903
|
cells: [...t]
|
|
902
|
-
}, i = Zt(e.get(
|
|
903
|
-
return e.set(
|
|
904
|
+
}, i = Zt(e.get(L), n, Gt);
|
|
905
|
+
return e.set(L, {
|
|
904
906
|
notebook: n,
|
|
905
907
|
value: new Set(i).add(r)
|
|
906
908
|
}), r;
|
|
907
909
|
}
|
|
908
910
|
function mn(e, t) {
|
|
909
|
-
let n = e.get(
|
|
911
|
+
let n = e.get(L);
|
|
910
912
|
if (n === null || !n.value.has(t)) return;
|
|
911
913
|
let r = new Set(n.value);
|
|
912
|
-
r.delete(t), e.set(
|
|
914
|
+
r.delete(t), e.set(L, {
|
|
913
915
|
notebook: n.notebook,
|
|
914
916
|
value: r
|
|
915
917
|
});
|
|
916
918
|
}
|
|
917
919
|
function hn(e, t, n) {
|
|
918
|
-
let r = x((e) => Xt(t.notebook, e(
|
|
920
|
+
let r = x((e) => Xt(t.notebook, e(R)) && !e(t.notebook.replica.executionsAtom).runs.has(n.id)), i = e.sub(r, a);
|
|
919
921
|
function a() {
|
|
920
922
|
e.get(r) || (i(), mn(e, t));
|
|
921
923
|
}
|
|
922
924
|
a();
|
|
923
925
|
}
|
|
924
926
|
function gn(e, t, n) {
|
|
925
|
-
let r = e.get(
|
|
927
|
+
let r = e.get(z).blocked;
|
|
926
928
|
if (r.has(t) === n) return;
|
|
927
929
|
let i = new Set(r);
|
|
928
930
|
n ? i.add(t) : i.delete(t);
|
|
929
|
-
let a = e.get(
|
|
931
|
+
let a = e.get(R);
|
|
930
932
|
a !== null && e.set(Yt, {
|
|
931
933
|
notebook: a,
|
|
932
934
|
value: i
|
|
@@ -1037,7 +1039,7 @@ function On(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
|
1037
1039
|
}
|
|
1038
1040
|
//#endregion
|
|
1039
1041
|
//#region src/core/dom/ui-element-constants.ts
|
|
1040
|
-
var kn = "object-id", An = "random-id", jn = "abcdefghijklmnopqrstuvwxyz", Mn = jn + jn.toUpperCase(), Nn = /* @__PURE__ */ new Set(),
|
|
1042
|
+
var kn = "object-id", An = "random-id", jn = "abcdefghijklmnopqrstuvwxyz", Mn = jn + jn.toUpperCase(), Nn = /* @__PURE__ */ new Set(), V = "__scratch__", Pn = "setup", Fn = { create() {
|
|
1041
1043
|
let e = 0, t;
|
|
1042
1044
|
do {
|
|
1043
1045
|
let n = "";
|
|
@@ -1046,7 +1048,7 @@ var kn = "object-id", An = "random-id", jn = "abcdefghijklmnopqrstuvwxyz", Mn =
|
|
|
1046
1048
|
} while (Nn.has(t) && e < 100);
|
|
1047
1049
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
1048
1050
|
return Nn.add(t), t;
|
|
1049
|
-
} },
|
|
1051
|
+
} }, H = {
|
|
1050
1052
|
create(e) {
|
|
1051
1053
|
return C(e != null, "cellId is required"), `cell-${e}`;
|
|
1052
1054
|
},
|
|
@@ -1059,7 +1061,7 @@ var kn = "object-id", An = "random-id", jn = "abcdefghijklmnopqrstuvwxyz", Mn =
|
|
|
1059
1061
|
findElementThroughShadowDOMs(e) {
|
|
1060
1062
|
let t = e;
|
|
1061
1063
|
for (; t;) {
|
|
1062
|
-
let e =
|
|
1064
|
+
let e = H.findElement(t);
|
|
1063
1065
|
if (e) return e;
|
|
1064
1066
|
let n = t.getRootNode();
|
|
1065
1067
|
if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
|
|
@@ -1068,8 +1070,8 @@ var kn = "object-id", An = "random-id", jn = "abcdefghijklmnopqrstuvwxyz", Mn =
|
|
|
1068
1070
|
}
|
|
1069
1071
|
};
|
|
1070
1072
|
function In(e) {
|
|
1071
|
-
let t = null, n =
|
|
1072
|
-
return n && (t =
|
|
1073
|
+
let t = null, n = H.findElementThroughShadowDOMs(e);
|
|
1074
|
+
return n && (t = H.parse(n.id)), t;
|
|
1073
1075
|
}
|
|
1074
1076
|
var Ln = {
|
|
1075
1077
|
parse(e) {
|
|
@@ -1331,7 +1333,7 @@ function Gn(e) {
|
|
|
1331
1333
|
}
|
|
1332
1334
|
return t;
|
|
1333
1335
|
}
|
|
1334
|
-
var
|
|
1336
|
+
var U = class e {
|
|
1335
1337
|
mimetype;
|
|
1336
1338
|
channel;
|
|
1337
1339
|
timestamp;
|
|
@@ -1401,7 +1403,7 @@ function Jn(e) {
|
|
|
1401
1403
|
if (i === n + 1) Yn(t, r);
|
|
1402
1404
|
else {
|
|
1403
1405
|
let a = e.slice(n, i).map((e) => ($n(e), e.data));
|
|
1404
|
-
t.push(
|
|
1406
|
+
t.push(U.create({
|
|
1405
1407
|
...r,
|
|
1406
1408
|
data: a.join("")
|
|
1407
1409
|
}));
|
|
@@ -1421,10 +1423,10 @@ function Xn(e, t) {
|
|
|
1421
1423
|
return n && r && i;
|
|
1422
1424
|
}
|
|
1423
1425
|
function Zn(e) {
|
|
1424
|
-
return e instanceof
|
|
1426
|
+
return e instanceof U ? e : e.mimetype === "text/plain" && e.channel !== "stdin" && typeof e.data == "string" ? U.create(e) : e;
|
|
1425
1427
|
}
|
|
1426
1428
|
function Qn(e, t) {
|
|
1427
|
-
return e instanceof
|
|
1429
|
+
return e instanceof U ? e.appendData(t.data) : U.create(e).appendData(t.data);
|
|
1428
1430
|
}
|
|
1429
1431
|
function $n(e) {
|
|
1430
1432
|
C(typeof e.data == "string", "expected string output");
|
|
@@ -1433,7 +1435,7 @@ function er(e, t) {
|
|
|
1433
1435
|
let n = 0, r;
|
|
1434
1436
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
1435
1437
|
let t = e[r];
|
|
1436
|
-
t.mimetype === "text/plain" ? (C(typeof t.data == "string", "expected string"), n += t instanceof
|
|
1438
|
+
t.mimetype === "text/plain" ? (C(typeof t.data == "string", "expected string"), n += t instanceof U ? t.lineCount : t.data.split("\n").length) : n++;
|
|
1437
1439
|
}
|
|
1438
1440
|
if (n < t) return e;
|
|
1439
1441
|
let i = r + 1, a = [{
|
|
@@ -1445,7 +1447,7 @@ function er(e, t) {
|
|
|
1445
1447
|
if (o?.channel === "stdin" && o.response === void 0) return [...a, ...e.slice(i)];
|
|
1446
1448
|
if (o?.mimetype === "text/plain") {
|
|
1447
1449
|
C(typeof o.data == "string", "expected string");
|
|
1448
|
-
let r = n - t, s = o instanceof
|
|
1450
|
+
let r = n - t, s = o instanceof U ? o.dropFirstLines(r) : {
|
|
1449
1451
|
...o,
|
|
1450
1452
|
data: o.data.split("\n").slice(r).join("\n")
|
|
1451
1453
|
};
|
|
@@ -1466,10 +1468,10 @@ function tr(e, t) {
|
|
|
1466
1468
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1467
1469
|
var nr = function(e, t) {
|
|
1468
1470
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1469
|
-
},
|
|
1471
|
+
}, W;
|
|
1470
1472
|
(function(e) {
|
|
1471
1473
|
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";
|
|
1472
|
-
})(
|
|
1474
|
+
})(W ||= {});
|
|
1473
1475
|
var rr = class {
|
|
1474
1476
|
constructor() {
|
|
1475
1477
|
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 = {
|
|
@@ -1702,57 +1704,57 @@ var rr = class {
|
|
|
1702
1704
|
}
|
|
1703
1705
|
get_next_packet() {
|
|
1704
1706
|
var e = {
|
|
1705
|
-
kind:
|
|
1707
|
+
kind: W.EOS,
|
|
1706
1708
|
text: "",
|
|
1707
1709
|
url: ""
|
|
1708
1710
|
}, t = this._buffer.length;
|
|
1709
1711
|
if (t == 0) return e;
|
|
1710
1712
|
var n = this._buffer.indexOf("\x1B");
|
|
1711
|
-
if (n == -1) return e.kind =
|
|
1712
|
-
if (n > 0) return e.kind =
|
|
1713
|
+
if (n == -1) return e.kind = W.Text, e.text = this._buffer, this._buffer = "", e;
|
|
1714
|
+
if (n > 0) return e.kind = W.Text, e.text = this._buffer.slice(0, n), this._buffer = this._buffer.slice(n), e;
|
|
1713
1715
|
if (n == 0) {
|
|
1714
|
-
if (t < 3) return e.kind =
|
|
1716
|
+
if (t < 3) return e.kind = W.Incomplete, e;
|
|
1715
1717
|
var r = this._buffer.charAt(1);
|
|
1716
|
-
if (r != "[" && r != "]" && r != "(") return e.kind =
|
|
1718
|
+
if (r != "[" && r != "]" && r != "(") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1717
1719
|
if (r == "[") {
|
|
1718
1720
|
this._csi_regex ||= ir(or ||= nr(["\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 "]));
|
|
1719
1721
|
let t = this._buffer.match(this._csi_regex);
|
|
1720
|
-
if (t === null) return e.kind =
|
|
1721
|
-
if (t[4]) return e.kind =
|
|
1722
|
-
e.kind = t[1] != "" || t[3] != "m" ?
|
|
1722
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1723
|
+
if (t[4]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1724
|
+
e.kind = t[1] != "" || t[3] != "m" ? W.Unknown : W.SGR, e.text = t[2];
|
|
1723
1725
|
var i = t[0].length;
|
|
1724
1726
|
return this._buffer = this._buffer.slice(i), e;
|
|
1725
1727
|
}
|
|
1726
1728
|
if (r == "]") {
|
|
1727
|
-
if (t < 4) return e.kind =
|
|
1728
|
-
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind =
|
|
1729
|
+
if (t < 4) return e.kind = W.Incomplete, e;
|
|
1730
|
+
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1729
1731
|
this._osc_st ||= ar(sr ||= nr(["\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;
|
|
1730
1732
|
{
|
|
1731
1733
|
let t = this._osc_st.exec(this._buffer);
|
|
1732
|
-
if (t === null) return e.kind =
|
|
1733
|
-
if (t[3]) return e.kind =
|
|
1734
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1735
|
+
if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1734
1736
|
}
|
|
1735
1737
|
{
|
|
1736
1738
|
let t = this._osc_st.exec(this._buffer);
|
|
1737
|
-
if (t === null) return e.kind =
|
|
1738
|
-
if (t[3]) return e.kind =
|
|
1739
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1740
|
+
if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1739
1741
|
}
|
|
1740
1742
|
this._osc_regex ||= ir(cr ||= nr(["\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 "]));
|
|
1741
1743
|
let n = this._buffer.match(this._osc_regex);
|
|
1742
|
-
if (n === null) return e.kind =
|
|
1743
|
-
e.kind =
|
|
1744
|
+
if (n === null) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1745
|
+
e.kind = W.OSCURL, e.url = n[1], e.text = n[2];
|
|
1744
1746
|
var i = n[0].length;
|
|
1745
1747
|
return this._buffer = this._buffer.slice(i), e;
|
|
1746
1748
|
}
|
|
1747
|
-
if (r == "(") return e.kind =
|
|
1749
|
+
if (r == "(") return e.kind = W.Unknown, this._buffer = this._buffer.slice(3), e;
|
|
1748
1750
|
}
|
|
1749
1751
|
}
|
|
1750
1752
|
ansi_to_html(e) {
|
|
1751
1753
|
this.append_buffer(e);
|
|
1752
1754
|
for (var t = [];;) {
|
|
1753
1755
|
var n = this.get_next_packet();
|
|
1754
|
-
if (n.kind ==
|
|
1755
|
-
n.kind !=
|
|
1756
|
+
if (n.kind == W.EOS || n.kind == W.Incomplete) break;
|
|
1757
|
+
n.kind != W.ESC && n.kind != W.Unknown && (n.kind == W.Text ? t.push(this.transform_to_html(this.with_state(n))) : n.kind == W.SGR ? this.process_ansi(n) : n.kind == W.OSCURL && t.push(this.process_hyperlink(n)));
|
|
1756
1758
|
}
|
|
1757
1759
|
return t.join("");
|
|
1758
1760
|
}
|
|
@@ -1831,7 +1833,7 @@ function ar(e, ...t) {
|
|
|
1831
1833
|
return new RegExp(n, "g");
|
|
1832
1834
|
}
|
|
1833
1835
|
var or, sr, cr, lr = new rr();
|
|
1834
|
-
function
|
|
1836
|
+
function G(e) {
|
|
1835
1837
|
try {
|
|
1836
1838
|
let t = document.createElement("div");
|
|
1837
1839
|
return t.innerHTML = e, (t.textContent || t.innerText || "").split("\n").map((e) => e.trimEnd()).join("\n");
|
|
@@ -1842,7 +1844,7 @@ function W(e) {
|
|
|
1842
1844
|
function ur(e) {
|
|
1843
1845
|
if (!e) return "";
|
|
1844
1846
|
try {
|
|
1845
|
-
return
|
|
1847
|
+
return G(lr.ansi_to_html(e));
|
|
1846
1848
|
} catch (n) {
|
|
1847
1849
|
return t.error("Error converting ANSI to plain text:", n), e;
|
|
1848
1850
|
}
|
|
@@ -1866,7 +1868,7 @@ function mr(e) {
|
|
|
1866
1868
|
case "stdout":
|
|
1867
1869
|
case "stderr":
|
|
1868
1870
|
case "marimo-error": {
|
|
1869
|
-
let a = d.asString(r.data), o = i ?
|
|
1871
|
+
let a = d.asString(r.data), o = i ? G(a) : a;
|
|
1870
1872
|
t.push({
|
|
1871
1873
|
timestamp: r.timestamp || Date.now(),
|
|
1872
1874
|
level: n ? "stderr" : "stdout",
|
|
@@ -1987,21 +1989,23 @@ function wr(e) {
|
|
|
1987
1989
|
function Tr(e, t, n) {
|
|
1988
1990
|
let r = e.time === void 0 ? t : Date.parse(e.time) / 1e3, i = e.seq + 1;
|
|
1989
1991
|
switch (e.kind) {
|
|
1990
|
-
case "console":
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
1992
|
+
case "console":
|
|
1993
|
+
if (e.content.kind === "text") return {
|
|
1994
|
+
id: i,
|
|
1995
|
+
channel: e.content.stream,
|
|
1996
|
+
data: e.content.text,
|
|
1997
|
+
mimetype: "text/plain",
|
|
1998
|
+
timestamp: r
|
|
1999
|
+
};
|
|
2000
|
+
let { media: t } = e.content;
|
|
2001
|
+
return {
|
|
2002
|
+
id: i,
|
|
2003
|
+
channel: t.mimetype === "application/vnd.marimo+traceback" ? "stderr" : "media",
|
|
2004
|
+
mimetype: t.mimetype,
|
|
2005
|
+
data: t.data,
|
|
2006
|
+
code: t.mimetype === "application/vnd.marimo+traceback" ? n : void 0,
|
|
2007
|
+
timestamp: r
|
|
2008
|
+
};
|
|
2005
2009
|
case "input": return {
|
|
2006
2010
|
id: i,
|
|
2007
2011
|
channel: "stdin",
|
|
@@ -2026,7 +2030,7 @@ function Er(e, t) {
|
|
|
2026
2030
|
o.channel === "media" && Bn.INSTANCE.track({
|
|
2027
2031
|
cell_id: i,
|
|
2028
2032
|
output: o
|
|
2029
|
-
}), r && (
|
|
2033
|
+
}), r && (o.channel === "stdout" || o.channel === "stderr") && e.addLogs({ logs: mr({
|
|
2030
2034
|
cell_id: i,
|
|
2031
2035
|
console: o
|
|
2032
2036
|
}) });
|
|
@@ -2059,7 +2063,7 @@ function Or(e, t) {
|
|
|
2059
2063
|
}
|
|
2060
2064
|
};
|
|
2061
2065
|
}
|
|
2062
|
-
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole :
|
|
2066
|
+
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole : rt(r).flatMap((e) => u(e) ?? []);
|
|
2063
2067
|
if (d?.length) {
|
|
2064
2068
|
let e = d.every((e) => e.afterSeq !== void 0) && p.every((e) => e.id !== void 0), t = (e) => e.afterSeq === void 0 ? e.id ?? 0 : e.afterSeq + 1.5;
|
|
2065
2069
|
p = [...p, ...d.map((e, t) => ({
|
|
@@ -2231,13 +2235,13 @@ async function Xr() {
|
|
|
2231
2235
|
}
|
|
2232
2236
|
//#endregion
|
|
2233
2237
|
//#region src/core/cells/editor.ts
|
|
2234
|
-
var
|
|
2238
|
+
var K = x(/* @__PURE__ */ new Set());
|
|
2235
2239
|
function Zr(e, t, n) {
|
|
2236
2240
|
return !!e && !t.has(n);
|
|
2237
2241
|
}
|
|
2238
2242
|
x(null, (e, t, { cellId: n }) => {
|
|
2239
|
-
t(
|
|
2240
|
-
}), x(null, (e, t, { cellId: n }) => e(
|
|
2243
|
+
t(K, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
2244
|
+
}), x(null, (e, t, { cellId: n }) => e(K).has(n) ? (t(K, (e) => {
|
|
2241
2245
|
let t = new Set(e);
|
|
2242
2246
|
return t.delete(n), t;
|
|
2243
2247
|
}), !0) : !1);
|
|
@@ -2251,7 +2255,7 @@ x(null, (e, t, { cellId: n }) => {
|
|
|
2251
2255
|
//#endregion
|
|
2252
2256
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
2253
2257
|
function $r(e, n) {
|
|
2254
|
-
let r = document.getElementById(
|
|
2258
|
+
let r = document.getElementById(H.create(e));
|
|
2255
2259
|
r ? ti(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
2256
2260
|
}
|
|
2257
2261
|
function ei() {
|
|
@@ -2302,11 +2306,11 @@ function si(e) {
|
|
|
2302
2306
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
2303
2307
|
}
|
|
2304
2308
|
function ci(e, t, n) {
|
|
2305
|
-
return e.status === "idle" ? fi(e) && n.code.trim() ? "not-run" : t.sourceChanged ? "source" : e.outcome === "
|
|
2309
|
+
return e.status === "idle" ? fi(e) && n.code.trim() ? "not-run" : t.sourceChanged ? "source" : e.outcome === "cancelled" ? "interrupted" : t.inputsChanged && !n.config.disabled && !e.blocked ? "inputs" : null : null;
|
|
2306
2310
|
}
|
|
2307
2311
|
function* li(e, t, n) {
|
|
2308
2312
|
for (let r of e.cellIds) {
|
|
2309
|
-
let i =
|
|
2313
|
+
let i = zt(t, r), a = n(r), o = ci(i, a, e.cellData[r]);
|
|
2310
2314
|
o === null ? a.sourceChanged && di(t.executions, r) && (yield [r, "source"]) : yield [r, o];
|
|
2311
2315
|
}
|
|
2312
2316
|
}
|
|
@@ -2568,7 +2572,7 @@ var zi = class {
|
|
|
2568
2572
|
dispose() {
|
|
2569
2573
|
this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
|
|
2570
2574
|
}
|
|
2571
|
-
},
|
|
2575
|
+
}, q = {
|
|
2572
2576
|
VariableName: "VariableName",
|
|
2573
2577
|
FunctionDefinition: "FunctionDefinition",
|
|
2574
2578
|
ClassDefinition: "ClassDefinition",
|
|
@@ -2593,21 +2597,21 @@ var zi = class {
|
|
|
2593
2597
|
Comment: "Comment",
|
|
2594
2598
|
String: "String",
|
|
2595
2599
|
FormatString: "FormatString"
|
|
2596
|
-
},
|
|
2600
|
+
}, J = {
|
|
2597
2601
|
For: "for",
|
|
2598
2602
|
In: "in",
|
|
2599
2603
|
As: "as",
|
|
2600
2604
|
Import: "import"
|
|
2601
2605
|
}, Hi = /* @__PURE__ */ new Set([
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2606
|
+
q.FunctionDefinition,
|
|
2607
|
+
q.LambdaExpression,
|
|
2608
|
+
q.ArrayComprehensionExpression,
|
|
2609
|
+
q.SetComprehensionExpression,
|
|
2610
|
+
q.DictionaryComprehensionExpression,
|
|
2611
|
+
q.ComprehensionExpression,
|
|
2612
|
+
q.ClassDefinition
|
|
2609
2613
|
]);
|
|
2610
|
-
|
|
2614
|
+
q.Comment, q.String, q.FormatString;
|
|
2611
2615
|
//#endregion
|
|
2612
2616
|
//#region src/core/codemirror/utils.ts
|
|
2613
2617
|
function Ui(e) {
|
|
@@ -2628,7 +2632,7 @@ function Wi(e) {
|
|
|
2628
2632
|
}
|
|
2629
2633
|
//#endregion
|
|
2630
2634
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2631
|
-
var Gi = /* @__PURE__ */ new Set([
|
|
2635
|
+
var Gi = /* @__PURE__ */ new Set([q.ClassDefinition]);
|
|
2632
2636
|
function Ki(e, t) {
|
|
2633
2637
|
requestAnimationFrame(() => {
|
|
2634
2638
|
e.focus(), e.dispatch({
|
|
@@ -2644,13 +2648,13 @@ function qi(e, t) {
|
|
|
2644
2648
|
let n = me(e), r = null;
|
|
2645
2649
|
return n.iterate({ enter: (n) => {
|
|
2646
2650
|
if (r !== null) return !1;
|
|
2647
|
-
if (n.name ===
|
|
2648
|
-
if (n.name ===
|
|
2651
|
+
if (n.name === q.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
2652
|
+
if (n.name === q.Comment || n.name === q.String) return !1;
|
|
2649
2653
|
} }), r;
|
|
2650
2654
|
}
|
|
2651
2655
|
function Ji(e, t) {
|
|
2652
2656
|
let n = [], r = e.resolveInner(t, 0);
|
|
2653
|
-
for (; r;) Hi.has(r.name) && (n.some((e) => e.type ===
|
|
2657
|
+
for (; r;) Hi.has(r.name) && (n.some((e) => e.type === q.FunctionDefinition || e.type === q.LambdaExpression) && r.name === q.ClassDefinition || n.push({
|
|
2654
2658
|
id: r.from,
|
|
2655
2659
|
type: r.name
|
|
2656
2660
|
})), r = r.parent;
|
|
@@ -2659,7 +2663,7 @@ function Ji(e, t) {
|
|
|
2659
2663
|
type: "global"
|
|
2660
2664
|
}), n;
|
|
2661
2665
|
}
|
|
2662
|
-
function
|
|
2666
|
+
function Y(e, t, n) {
|
|
2663
2667
|
e.push({
|
|
2664
2668
|
scopeId: t,
|
|
2665
2669
|
from: n
|
|
@@ -2673,11 +2677,11 @@ function Yi(e, t) {
|
|
|
2673
2677
|
function Xi(e, t) {
|
|
2674
2678
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2675
2679
|
switch (e.name) {
|
|
2676
|
-
case
|
|
2677
|
-
n.doc.sliceString(e.from, e.to) === r &&
|
|
2680
|
+
case q.VariableName:
|
|
2681
|
+
n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2678
2682
|
break;
|
|
2679
|
-
case
|
|
2680
|
-
case
|
|
2683
|
+
case q.TupleExpression:
|
|
2684
|
+
case q.ArrayExpression: {
|
|
2681
2685
|
let n = e.node.cursor();
|
|
2682
2686
|
n.firstChild();
|
|
2683
2687
|
do
|
|
@@ -2691,11 +2695,11 @@ function Zi(e, t) {
|
|
|
2691
2695
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2692
2696
|
o.firstChild();
|
|
2693
2697
|
do {
|
|
2694
|
-
if (o.name !==
|
|
2698
|
+
if (o.name !== q.ParamList) continue;
|
|
2695
2699
|
let e = o.node.cursor();
|
|
2696
2700
|
e.firstChild();
|
|
2697
2701
|
do
|
|
2698
|
-
e.name ===
|
|
2702
|
+
e.name === q.VariableName && n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2699
2703
|
while (e.nextSibling());
|
|
2700
2704
|
} while (o.nextSibling());
|
|
2701
2705
|
}
|
|
@@ -2704,25 +2708,25 @@ function Qi(e, t) {
|
|
|
2704
2708
|
n.firstChild();
|
|
2705
2709
|
let r = !1;
|
|
2706
2710
|
do
|
|
2707
|
-
if (n.name ===
|
|
2708
|
-
else if (r && n.name ===
|
|
2711
|
+
if (n.name === J.For) r = !0;
|
|
2712
|
+
else if (r && n.name === J.In) break;
|
|
2709
2713
|
else r && Xi(n, t);
|
|
2710
2714
|
while (n.nextSibling());
|
|
2711
2715
|
}
|
|
2712
2716
|
function $i(e, t) {
|
|
2713
2717
|
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Hi.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2714
2718
|
switch (s) {
|
|
2715
|
-
case
|
|
2716
|
-
case
|
|
2719
|
+
case q.FunctionDefinition:
|
|
2720
|
+
case q.ClassDefinition: {
|
|
2717
2721
|
let t = e.cursor();
|
|
2718
2722
|
t.firstChild();
|
|
2719
2723
|
do
|
|
2720
|
-
if (t.name ===
|
|
2721
|
-
|
|
2724
|
+
if (t.name === q.VariableName && n.doc.sliceString(t.from, t.to) === r) {
|
|
2725
|
+
Y(a, i[i.length - 1] ?? -1, t.from);
|
|
2722
2726
|
break;
|
|
2723
2727
|
}
|
|
2724
2728
|
while (t.nextSibling());
|
|
2725
|
-
s ===
|
|
2729
|
+
s === q.FunctionDefinition && Zi(e, {
|
|
2726
2730
|
state: n,
|
|
2727
2731
|
variableName: r,
|
|
2728
2732
|
scopeId: c,
|
|
@@ -2730,7 +2734,7 @@ function $i(e, t) {
|
|
|
2730
2734
|
});
|
|
2731
2735
|
break;
|
|
2732
2736
|
}
|
|
2733
|
-
case
|
|
2737
|
+
case q.LambdaExpression:
|
|
2734
2738
|
Zi(e, {
|
|
2735
2739
|
state: n,
|
|
2736
2740
|
variableName: r,
|
|
@@ -2738,11 +2742,11 @@ function $i(e, t) {
|
|
|
2738
2742
|
declarations: a
|
|
2739
2743
|
});
|
|
2740
2744
|
break;
|
|
2741
|
-
case
|
|
2742
|
-
case
|
|
2743
|
-
case
|
|
2744
|
-
case
|
|
2745
|
-
case
|
|
2745
|
+
case q.ArrayComprehensionExpression:
|
|
2746
|
+
case q.DictionaryComprehensionExpression:
|
|
2747
|
+
case q.SetComprehensionExpression:
|
|
2748
|
+
case q.ComprehensionExpression:
|
|
2749
|
+
case q.ForStatement:
|
|
2746
2750
|
Qi(e, {
|
|
2747
2751
|
state: n,
|
|
2748
2752
|
variableName: r,
|
|
@@ -2750,11 +2754,11 @@ function $i(e, t) {
|
|
|
2750
2754
|
declarations: a
|
|
2751
2755
|
});
|
|
2752
2756
|
break;
|
|
2753
|
-
case
|
|
2757
|
+
case q.AssignStatement: {
|
|
2754
2758
|
let t = [], i = e.cursor();
|
|
2755
2759
|
i.firstChild();
|
|
2756
2760
|
do
|
|
2757
|
-
i.name ===
|
|
2761
|
+
i.name === q.AssignOp && t.push(i.from);
|
|
2758
2762
|
while (i.nextSibling());
|
|
2759
2763
|
let o = t[t.length - 1];
|
|
2760
2764
|
if (o === void 0) break;
|
|
@@ -2770,14 +2774,14 @@ function $i(e, t) {
|
|
|
2770
2774
|
while (s.nextSibling());
|
|
2771
2775
|
break;
|
|
2772
2776
|
}
|
|
2773
|
-
case
|
|
2777
|
+
case q.ImportStatement: {
|
|
2774
2778
|
let t = e.cursor();
|
|
2775
2779
|
t.firstChild();
|
|
2776
2780
|
let i = !1, o = null, s = () => {
|
|
2777
|
-
o?.matches &&
|
|
2781
|
+
o?.matches && Y(a, u, o.from), o = null;
|
|
2778
2782
|
};
|
|
2779
2783
|
do
|
|
2780
|
-
t.name ===
|
|
2784
|
+
t.name === J.Import ? i = !0 : i && (t.name === J.As ? o = null : t.name === q.VariableName ? (s(), o = {
|
|
2781
2785
|
from: t.from,
|
|
2782
2786
|
matches: n.doc.sliceString(t.from, t.to) === r
|
|
2783
2787
|
}) : t.name === "," && s());
|
|
@@ -2785,13 +2789,13 @@ function $i(e, t) {
|
|
|
2785
2789
|
s();
|
|
2786
2790
|
break;
|
|
2787
2791
|
}
|
|
2788
|
-
case
|
|
2789
|
-
case
|
|
2792
|
+
case q.TryStatement:
|
|
2793
|
+
case q.WithStatement: {
|
|
2790
2794
|
let t = e.cursor();
|
|
2791
2795
|
t.firstChild();
|
|
2792
2796
|
let i = !1;
|
|
2793
2797
|
do
|
|
2794
|
-
t.name ===
|
|
2798
|
+
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);
|
|
2795
2799
|
while (t.nextSibling());
|
|
2796
2800
|
break;
|
|
2797
2801
|
}
|
|
@@ -2829,21 +2833,21 @@ function na(e, t) {
|
|
|
2829
2833
|
}
|
|
2830
2834
|
//#endregion
|
|
2831
2835
|
//#region src/core/network/connection.ts
|
|
2832
|
-
var
|
|
2836
|
+
var X = x({ state: O.NOT_STARTED });
|
|
2833
2837
|
p(null, (e, t) => t === null ? null : {
|
|
2834
2838
|
phase: t.phase,
|
|
2835
2839
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2836
2840
|
});
|
|
2837
2841
|
function ra() {
|
|
2838
|
-
return se(
|
|
2842
|
+
return se(X, (e) => e.state === O.OPEN);
|
|
2839
2843
|
}
|
|
2840
2844
|
function ia() {
|
|
2841
2845
|
return _e() ? ra() : Promise.resolve();
|
|
2842
2846
|
}
|
|
2843
|
-
x((e) => e(
|
|
2844
|
-
let t = e(
|
|
2847
|
+
x((e) => e(X).state === O.CONNECTING), x((e) => e(X).state === O.OPEN), x((e) => {
|
|
2848
|
+
let t = e(X);
|
|
2845
2849
|
return t.state === O.OPEN || t.state === O.NOT_STARTED;
|
|
2846
|
-
}), x((e) => e(
|
|
2850
|
+
}), x((e) => e(X).state === O.CLOSED);
|
|
2847
2851
|
//#endregion
|
|
2848
2852
|
//#region src/components/ui/checkbox.tsx
|
|
2849
2853
|
var aa = w.forwardRef((e, t) => {
|
|
@@ -2871,7 +2875,7 @@ aa.displayName = Pe.displayName;
|
|
|
2871
2875
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
2872
2876
|
function oa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2873
2877
|
if (!n) return;
|
|
2874
|
-
let o = document.getElementById(
|
|
2878
|
+
let o = document.getElementById(H.create(e));
|
|
2875
2879
|
if (!o) t.warn("scrollCellIntoView: element not found");
|
|
2876
2880
|
else if (ei()) ti(o);
|
|
2877
2881
|
else {
|
|
@@ -2919,7 +2923,7 @@ function ca() {
|
|
|
2919
2923
|
});
|
|
2920
2924
|
}
|
|
2921
2925
|
function la(e) {
|
|
2922
|
-
let t = document.getElementById(
|
|
2926
|
+
let t = document.getElementById(H.create(e));
|
|
2923
2927
|
return t?.scrollIntoView({
|
|
2924
2928
|
behavior: "smooth",
|
|
2925
2929
|
block: "center"
|
|
@@ -2937,18 +2941,18 @@ function ua(e) {
|
|
|
2937
2941
|
return {
|
|
2938
2942
|
...e,
|
|
2939
2943
|
cellData: {
|
|
2940
|
-
[
|
|
2941
|
-
id:
|
|
2944
|
+
[V]: Sr({
|
|
2945
|
+
id: V,
|
|
2942
2946
|
config: t
|
|
2943
2947
|
}),
|
|
2944
2948
|
...e.cellData
|
|
2945
2949
|
},
|
|
2946
2950
|
cellRuntime: {
|
|
2947
|
-
[
|
|
2951
|
+
[V]: wr(),
|
|
2948
2952
|
...e.cellRuntime
|
|
2949
2953
|
},
|
|
2950
2954
|
cellHandles: {
|
|
2951
|
-
[
|
|
2955
|
+
[V]: (0, w.createRef)(),
|
|
2952
2956
|
...e.cellHandles
|
|
2953
2957
|
}
|
|
2954
2958
|
};
|
|
@@ -2964,8 +2968,8 @@ function da() {
|
|
|
2964
2968
|
cellLogs: []
|
|
2965
2969
|
});
|
|
2966
2970
|
}
|
|
2967
|
-
var { reducer: fa, createActions: pa, useActions: ma, valueAtom:
|
|
2968
|
-
setCellReusability: (e, t) =>
|
|
2971
|
+
var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = fe(da, {
|
|
2972
|
+
setCellReusability: (e, t) => Q({
|
|
2969
2973
|
state: e,
|
|
2970
2974
|
cellId: t.cell_id,
|
|
2971
2975
|
cellReducer: (e) => ({
|
|
@@ -2973,7 +2977,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
2973
2977
|
serialization: t.serialization
|
|
2974
2978
|
})
|
|
2975
2979
|
}),
|
|
2976
|
-
startCellConsole: (e, { cellId: t }) =>
|
|
2980
|
+
startCellConsole: (e, { cellId: t }) => Q({
|
|
2977
2981
|
state: e,
|
|
2978
2982
|
cellId: t,
|
|
2979
2983
|
cellReducer: (e) => ({
|
|
@@ -2985,7 +2989,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
2985
2989
|
})
|
|
2986
2990
|
}),
|
|
2987
2991
|
showCommandOutput: (e, t) => {
|
|
2988
|
-
let { cell_id: n, entries: r, replace: i } = t, a =
|
|
2992
|
+
let { cell_id: n, entries: r, replace: i } = t, a = Q({
|
|
2989
2993
|
state: e,
|
|
2990
2994
|
cellId: n,
|
|
2991
2995
|
cellReducer: (e) => ({
|
|
@@ -3003,7 +3007,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
3003
3007
|
},
|
|
3004
3008
|
hideConsoleInputs: (e, { cellId: t, executionId: n, inputIds: r }) => {
|
|
3005
3009
|
let i = new Set(r);
|
|
3006
|
-
return
|
|
3010
|
+
return Q({
|
|
3007
3011
|
state: e,
|
|
3008
3012
|
cellId: t,
|
|
3009
3013
|
cellReducer: (e) => ({
|
|
@@ -3040,12 +3044,12 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
3040
3044
|
}),
|
|
3041
3045
|
reconcileDocument: (e, t) => {
|
|
3042
3046
|
let n = Jr(e, t);
|
|
3043
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
3047
|
+
for (let t of e.cellIds) t in n.cellData || Aa(t);
|
|
3044
3048
|
return n;
|
|
3045
3049
|
},
|
|
3046
3050
|
setStdinResponse: (e, t) => {
|
|
3047
3051
|
let { cellId: n, response: r, inputId: i } = t;
|
|
3048
|
-
return
|
|
3052
|
+
return Q({
|
|
3049
3053
|
state: e,
|
|
3050
3054
|
cellId: n,
|
|
3051
3055
|
cellReducer: (e) => ({
|
|
@@ -3056,7 +3060,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
3056
3060
|
},
|
|
3057
3061
|
resetCellRuntimes: (e, t) => {
|
|
3058
3062
|
let n = be(), r = { ...e.cellRuntime };
|
|
3059
|
-
for (let i of [...e.cellIds,
|
|
3063
|
+
for (let i of [...e.cellIds, V]) {
|
|
3060
3064
|
let a = e.cellRuntime[i];
|
|
3061
3065
|
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a : wr({
|
|
3062
3066
|
clearedConsole: t ? a?.clearedConsole : void 0,
|
|
@@ -3075,7 +3079,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
3075
3079
|
return oa({
|
|
3076
3080
|
cellId: n,
|
|
3077
3081
|
cell: e.cellHandles[n],
|
|
3078
|
-
isCodeHidden: Zr(e.cellData[n]?.config.hide_code, y.get(
|
|
3082
|
+
isCodeHidden: Zr(e.cellData[n]?.config.hide_code, y.get(K), n),
|
|
3079
3083
|
codeFocus: void 0,
|
|
3080
3084
|
variableName: void 0
|
|
3081
3085
|
}), {
|
|
@@ -3089,7 +3093,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
3089
3093
|
...e,
|
|
3090
3094
|
cellLogs: []
|
|
3091
3095
|
}),
|
|
3092
|
-
clearCellConsole: (e, t) =>
|
|
3096
|
+
clearCellConsole: (e, t) => Q({
|
|
3093
3097
|
state: e,
|
|
3094
3098
|
cellId: t.cellId,
|
|
3095
3099
|
cellReducer: (e) => {
|
|
@@ -3105,7 +3109,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
3105
3109
|
}
|
|
3106
3110
|
})
|
|
3107
3111
|
});
|
|
3108
|
-
function
|
|
3112
|
+
function Q({ state: e, cellId: n, cellReducer: r }) {
|
|
3109
3113
|
return n in e.cellRuntime ? {
|
|
3110
3114
|
...e,
|
|
3111
3115
|
cellRuntime: {
|
|
@@ -3115,15 +3119,15 @@ function Z({ state: e, cellId: n, cellReducer: r }) {
|
|
|
3115
3119
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
3116
3120
|
}
|
|
3117
3121
|
var ha = pa((e) => {
|
|
3118
|
-
y.set(
|
|
3119
|
-
}).addLogs,
|
|
3120
|
-
x((e) => e(
|
|
3121
|
-
var ga = x((e) => ui(e(
|
|
3122
|
+
y.set(Z, (t) => fa(t, e));
|
|
3123
|
+
}).addLogs, $ = x((e) => e(Z).cellIds);
|
|
3124
|
+
x((e) => e($).length === 1), x((e) => ii(e(Z)).length > 0), x((e) => ai(e(Z)).length > 0), x((e) => oi(e(Z))), x((e) => si(e(Z)));
|
|
3125
|
+
var ga = x((e) => ui(e(Z), e(z), e(tn)));
|
|
3122
3126
|
x((e) => e(ga) !== null);
|
|
3123
3127
|
var _a = x((e) => {
|
|
3124
|
-
let { cellIds: t, cellData: n } = e(
|
|
3128
|
+
let { cellIds: t, cellData: n } = e(Z);
|
|
3125
3129
|
return t.map((t) => {
|
|
3126
|
-
let r = e(
|
|
3130
|
+
let r = e(B(t)), { name: i } = n[t];
|
|
3127
3131
|
if (r !== null && Dn(r.mimetype)) {
|
|
3128
3132
|
C(Array.isArray(r.data), "Expected array data");
|
|
3129
3133
|
let e = r.data.filter((e) => !e.type.includes("ancestor"));
|
|
@@ -3140,52 +3144,52 @@ var _a = x((e) => {
|
|
|
3140
3144
|
}).filter(Boolean);
|
|
3141
3145
|
}), va = ce(x((e) => {
|
|
3142
3146
|
let t = {};
|
|
3143
|
-
for (let n of e(
|
|
3147
|
+
for (let n of e($)) {
|
|
3144
3148
|
let r = e(sn(n));
|
|
3145
3149
|
r !== null && r.items.length > 0 && (t[n] = r);
|
|
3146
3150
|
}
|
|
3147
3151
|
return t;
|
|
3148
|
-
})), ya = x((e) => Je(e(
|
|
3152
|
+
})), ya = x((e) => Je(e($).map((t) => e(sn(t)))));
|
|
3149
3153
|
x((e) => e(_a).length);
|
|
3150
3154
|
var ba = ce(x((e) => {
|
|
3151
|
-
let { cellIds: t, cellData: n } = e(
|
|
3155
|
+
let { cellIds: t, cellData: n } = e(Z);
|
|
3152
3156
|
return ue.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
3153
3157
|
}));
|
|
3154
|
-
x((e) => e(
|
|
3155
|
-
var xa = () => v(
|
|
3156
|
-
let { cellIds: e, cellData: t } = y.get(
|
|
3158
|
+
x((e) => e(Z).scrollKey);
|
|
3159
|
+
var xa = () => v($), Sa = () => v(ba), Ca = () => y.get(Z), wa = () => y.get(Z).cellIds, Ta = () => {
|
|
3160
|
+
let { cellIds: e, cellData: t } = y.get(Z);
|
|
3157
3161
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
3158
3162
|
};
|
|
3159
|
-
ee(_(
|
|
3160
|
-
var Ea = S((e) => x((t) => t(
|
|
3163
|
+
ee(_(Z, (e) => e.cellIds.map((t) => e.cellData[t]))), x((e) => e(Z).cellIds.length > 0);
|
|
3164
|
+
var Ea = S((e) => x((t) => t(Z).cellData[e])), Da = wr(), Oa = S((e) => {
|
|
3161
3165
|
let t = x((t) => {
|
|
3162
3166
|
let n = Dr(t, e), r = t(m)?.cells;
|
|
3163
3167
|
return {
|
|
3164
|
-
local: t(
|
|
3168
|
+
local: t(Z).cellRuntime[e] ?? Da,
|
|
3165
3169
|
execution: n,
|
|
3166
|
-
code: n &&
|
|
3170
|
+
code: n && Et(n.record, r)
|
|
3167
3171
|
};
|
|
3168
3172
|
}), n = _(t, Or);
|
|
3169
3173
|
return x((e) => e(n).rendered);
|
|
3170
|
-
}),
|
|
3171
|
-
function
|
|
3172
|
-
Ea.remove(e),
|
|
3174
|
+
}), ka = S((e) => x((t) => t(Z).cellHandles[e]));
|
|
3175
|
+
function Aa(e) {
|
|
3176
|
+
Ea.remove(e), Oa.remove(e), ka.remove(e), cn(e);
|
|
3173
3177
|
}
|
|
3174
|
-
var
|
|
3175
|
-
let { cellHandles: t } = y.get(
|
|
3178
|
+
var ja = (e) => {
|
|
3179
|
+
let { cellHandles: t } = y.get(Z);
|
|
3176
3180
|
return t[e].current?.editorView;
|
|
3177
|
-
},
|
|
3178
|
-
x((e) => e(
|
|
3181
|
+
}, Ma = (e) => (wn.promote(e), ja(e));
|
|
3182
|
+
x((e) => e($).map((t) => ({
|
|
3179
3183
|
...e(Ea(t)),
|
|
3180
|
-
...e(
|
|
3181
|
-
output: e(
|
|
3184
|
+
...e(Oa(t)),
|
|
3185
|
+
output: e(B(t))
|
|
3182
3186
|
})));
|
|
3183
|
-
function
|
|
3187
|
+
function Na() {
|
|
3184
3188
|
return ma();
|
|
3185
3189
|
}
|
|
3186
3190
|
//#endregion
|
|
3187
3191
|
//#region src/core/errors/error-entries.ts
|
|
3188
|
-
function
|
|
3192
|
+
function Pa(e) {
|
|
3189
3193
|
if (Tn(e.mimetype)) {
|
|
3190
3194
|
if (!Array.isArray(e.data)) return null;
|
|
3191
3195
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
@@ -3196,23 +3200,23 @@ function Na(e) {
|
|
|
3196
3200
|
tracebackHtml: e.data
|
|
3197
3201
|
} : null;
|
|
3198
3202
|
}
|
|
3199
|
-
function
|
|
3203
|
+
function Fa(e) {
|
|
3200
3204
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
3201
3205
|
}
|
|
3202
|
-
function
|
|
3206
|
+
function Ia(e) {
|
|
3203
3207
|
let t = e?.find((e) => En(e.mimetype));
|
|
3204
3208
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
3205
3209
|
}
|
|
3206
|
-
function
|
|
3210
|
+
function La(e, t) {
|
|
3207
3211
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
3208
|
-
if (!
|
|
3212
|
+
if (!Fa(e.errorData)) return Ia(t);
|
|
3209
3213
|
}
|
|
3210
|
-
function
|
|
3211
|
-
let { cellIds: t, cellData: n } = e.get(
|
|
3214
|
+
function Ra(e) {
|
|
3215
|
+
let { cellIds: t, cellData: n } = e.get(Z), r = [];
|
|
3212
3216
|
for (let [i, a] of t.entries()) {
|
|
3213
|
-
let t = e.get(
|
|
3217
|
+
let t = e.get(B(a));
|
|
3214
3218
|
if (t === null || !Dn(t.mimetype)) continue;
|
|
3215
|
-
let o =
|
|
3219
|
+
let o = Pa(t);
|
|
3216
3220
|
if (!o) continue;
|
|
3217
3221
|
let s = br(n[a].name, i), c = t.code ?? n[a].code;
|
|
3218
3222
|
r.push({
|
|
@@ -3220,21 +3224,21 @@ function La(e) {
|
|
|
3220
3224
|
cellName: s,
|
|
3221
3225
|
cellCode: c,
|
|
3222
3226
|
errorData: o.errorData,
|
|
3223
|
-
tracebackHtml:
|
|
3227
|
+
tracebackHtml: La(o, e.get(Oa(a)).consoleOutputs)
|
|
3224
3228
|
});
|
|
3225
3229
|
}
|
|
3226
3230
|
return r;
|
|
3227
3231
|
}
|
|
3228
|
-
function Ra(e) {
|
|
3229
|
-
return e.type === "diagnostic" ? e.msg : e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "lazy-import" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (u(e), "Unknown error");
|
|
3230
|
-
}
|
|
3231
3232
|
function za(e) {
|
|
3232
|
-
|
|
3233
|
-
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${W(e.traceback)}`), t;
|
|
3233
|
+
return e.type === "diagnostic" ? e.msg : e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "lazy-import" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (u(e), "Unknown error");
|
|
3234
3234
|
}
|
|
3235
3235
|
function Ba(e) {
|
|
3236
|
+
let t = za(e);
|
|
3237
|
+
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${G(e.traceback)}`), t;
|
|
3238
|
+
}
|
|
3239
|
+
function Va(e) {
|
|
3236
3240
|
let t = [e.cellName];
|
|
3237
|
-
return e.tracebackHtml && t.push(
|
|
3241
|
+
return e.tracebackHtml && t.push(G(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(Ba).join("\n\n")), t.join("\n\n");
|
|
3238
3242
|
}
|
|
3239
3243
|
//#endregion
|
|
3240
|
-
export { Zr as $, Qe as $t, ia as A,
|
|
3244
|
+
export { Zr as $, Qe as $t, ia as A, H as At, Fi as B, sn as Bt, oa as C, mr as Ct, aa as D, Bn as Dt, ca as E, rr as Et, Bi as F, kn as Ft, _i as G, pn as Gt, Oi as H, an as Ht, Li as I, An as It, fi as J, fn as Jt, hi as K, un as Kt, Ri as L, hn as Lt, Ui as M, Pn as Mt, Vi as N, Ln as Nt, X as O, Fn as Ot, zi as P, In as Pt, $r as Q, ft as Qt, Ni as R, z as Rt, Na as S, vr as St, la as T, G as Tt, Ti as U, ln as Ut, Di as V, B as Vt, bi as W, Qt as Wt, pi as X, zt as Xt, ri as Y, mn as Yt, mi as Z, pt as Zt, ya as _, Dr as _t, ha as a, Ce as an, Mr as at, xa as b, yr as bt, Oa as c, Hr as ct, ja as d, Gr as dt, O as en, Qr as et, Ta as f, zr as ft, Z as g, kr as gt, da as h, Br as ht, Ra as i, we as in, jr as it, na as j, V as jt, ra as k, Rn as kt, pa as l, Wr as lt, Ca as m, Vr as mt, Va as n, qe as nn, Xr as nt, Ea as o, Ur as ot, wa as p, Pr as pt, gi as q, gn as qt, Ba as r, He as rn, Yr as rt, $ as s, Nr as st, za as t, Xe as tn, K as tt, Ma as u, Kr as ut, fa as v, Er as vt, sa as w, ur as wt, Sa as x, xr as xt, Aa as y, br as yt, Pi as z, tn as zt };
|