@marimo-team/islands 0.25.3-dev463 → 0.25.3-dev465
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-LEY4eR-u.js → ErrorBoundary-Bitt9N44.js} +1 -1
- package/dist/{chat-ui-Ow2U38zW.js → chat-ui-BJSYaekC.js} +3 -3
- package/dist/{code-visibility-B6vd-MS9.js → code-visibility-CK8BfIsO.js} +3 -3
- package/dist/{common-CmFmwC3k.js → common-C-TqeXix.js} +4 -4
- package/dist/{data-grid-overlay-editor-DLAyzP8s.js → data-grid-overlay-editor-CilodNKx.js} +1 -1
- package/dist/{error-entries-DEV4YOvI.js → error-entries-CNH4hNt-.js} +272 -261
- package/dist/{feedback-button-ln7KZEYq.js → feedback-button-B_nA4iPT.js} +3 -3
- package/dist/{glide-data-editor-DwVqbx2W.js → glide-data-editor-BQ0Ykfzt.js} +3 -3
- package/dist/{globals-DqKjaSau.js → globals-BkrP88Os.js} +1 -1
- package/dist/{html-to-image-BdgBPfgg.js → html-to-image-BBX2UucV.js} +1 -1
- package/dist/main.js +4556 -4544
- package/dist/{number-overlay-editor-D9vaIlf5.js → number-overlay-editor-C9lu04cw.js} +1 -1
- package/dist/{process-output-C_EHwiTn.js → process-output-DatAq1xF.js} +2 -2
- package/dist/{reveal-component-BrnL8w_N.js → reveal-component-BvH2Wxyh.js} +2 -2
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +6 -6
- package/src/components/dependency-graph/minimap-content.tsx +1 -1
- package/src/components/editor/cell/__tests__/useRunCells.test.tsx +1 -1
- package/src/components/editor/notebook-cell.tsx +6 -6
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +3 -3
- 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/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__/input.test.ts +1 -1
- package/src/core/executions/__tests__/interrupt.test.ts +3 -7
- package/src/core/executions/__tests__/output.test.ts +26 -5
- package/src/core/executions/__tests__/run.test.ts +35 -24
- package/src/core/executions/__tests__/select.test.ts +4 -4
- package/src/core/executions/atoms.ts +15 -6
- package/src/core/executions/output.ts +16 -4
- package/src/core/notebook/replica/__tests__/executions.test.ts +57 -3
- package/src/core/notebook/replica/__tests__/results.test.ts +2 -2
- package/src/core/notebook/replica/__tests__/runtime.test.ts +9 -10
- package/src/core/notebook/replica/resources/executions.ts +27 -0
- package/src/core/notebook/replica/resources/runtime.ts +1 -1
- package/src/core/runtime/__tests__/adapter.test.ts +1 -1
- package/src/core/runtime/adapter.ts +1 -1
- package/src/core/session/useNotebookSession.tsx +1 -1
- package/src/core/wasm/__tests__/bridge.test.ts +4 -6
|
@@ -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,31 +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
|
-
input: (e, { data: t }) =>
|
|
516
|
+
"console.removed": (e, { data: t }) => st(e, t.id),
|
|
517
|
+
input: (e, { data: t }) => ot(e, {
|
|
509
518
|
...t.input,
|
|
510
519
|
kind: "input",
|
|
511
520
|
time: t.time
|
|
512
521
|
}),
|
|
513
|
-
variable: (e, { data: t }) =>
|
|
514
|
-
"variable.removed": (e, { data: t }) =>
|
|
522
|
+
variable: (e, { data: t }) => ct(e, t.variable),
|
|
523
|
+
"variable.removed": (e, { data: t }) => lt(e, t.id)
|
|
515
524
|
}
|
|
516
|
-
},
|
|
525
|
+
}, mt = {
|
|
517
526
|
sourceChanged: !1,
|
|
518
527
|
inputsChanged: !1
|
|
519
528
|
};
|
|
520
|
-
function
|
|
529
|
+
function ht(e) {
|
|
521
530
|
let t = /* @__PURE__ */ new Map();
|
|
522
531
|
for (let n of e.executions.values()) for (let e of n.variables.values()) {
|
|
523
532
|
let n = t.get(e.name);
|
|
@@ -525,8 +534,8 @@ function mt(e) {
|
|
|
525
534
|
}
|
|
526
535
|
return t;
|
|
527
536
|
}
|
|
528
|
-
function
|
|
529
|
-
let t =
|
|
537
|
+
function gt(e) {
|
|
538
|
+
let t = ht(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
|
|
530
539
|
function i(e, n) {
|
|
531
540
|
let i = new Set(n).add(e.id);
|
|
532
541
|
for (let [n, a] of Object.entries($e(e))) {
|
|
@@ -563,54 +572,54 @@ function ht(e) {
|
|
|
563
572
|
}
|
|
564
573
|
return (t) => {
|
|
565
574
|
let n = e.results.get(t)?.record;
|
|
566
|
-
return n == null ?
|
|
575
|
+
return n == null ? mt : o(n, /* @__PURE__ */ new Set());
|
|
567
576
|
};
|
|
568
577
|
}
|
|
569
578
|
//#endregion
|
|
570
579
|
//#region src/core/executions/output.ts
|
|
571
|
-
var
|
|
580
|
+
var _t = /* @__PURE__ */ new Map(), vt = "application/vnd.marimo+error";
|
|
572
581
|
function P(e) {
|
|
573
582
|
return e;
|
|
574
583
|
}
|
|
575
|
-
function
|
|
584
|
+
function yt(e) {
|
|
576
585
|
return e.map(({ cell_id: e, message: t }) => ({
|
|
577
586
|
cell_id: P(e),
|
|
578
587
|
message: t
|
|
579
588
|
}));
|
|
580
589
|
}
|
|
581
|
-
function
|
|
590
|
+
function bt(e) {
|
|
582
591
|
return e === null ? 0 : Date.parse(e) / 1e3;
|
|
583
592
|
}
|
|
584
|
-
function
|
|
585
|
-
return
|
|
593
|
+
function xt(e) {
|
|
594
|
+
return bt(j(e) ?? A(e));
|
|
586
595
|
}
|
|
587
|
-
function
|
|
596
|
+
function St(e, t) {
|
|
588
597
|
return {
|
|
589
598
|
channel: "output",
|
|
590
599
|
mimetype: t.mimetype,
|
|
591
600
|
data: t.data,
|
|
592
|
-
timestamp:
|
|
601
|
+
timestamp: xt(e)
|
|
593
602
|
};
|
|
594
603
|
}
|
|
595
604
|
function F(e, t) {
|
|
596
605
|
return {
|
|
597
606
|
channel: "marimo-error",
|
|
598
|
-
mimetype:
|
|
607
|
+
mimetype: vt,
|
|
599
608
|
data: t,
|
|
600
|
-
timestamp:
|
|
609
|
+
timestamp: xt(e)
|
|
601
610
|
};
|
|
602
611
|
}
|
|
603
|
-
function
|
|
612
|
+
function Ct(e) {
|
|
604
613
|
let t = e.related.at(0);
|
|
605
614
|
return t === void 0 ? null : P(t.cell_id);
|
|
606
615
|
}
|
|
607
|
-
function
|
|
616
|
+
function wt(e) {
|
|
608
617
|
switch (e.kind) {
|
|
609
618
|
case "exception": return {
|
|
610
619
|
type: "exception",
|
|
611
620
|
exception_type: e.name ?? "Exception",
|
|
612
621
|
msg: e.message,
|
|
613
|
-
raising_cell:
|
|
622
|
+
raising_cell: Ct(e),
|
|
614
623
|
traceback: e.traceback?.data ?? null
|
|
615
624
|
};
|
|
616
625
|
case "invalid-syntax": return {
|
|
@@ -623,16 +632,15 @@ function Ct(e) {
|
|
|
623
632
|
msg: e.message,
|
|
624
633
|
error_type: e.name
|
|
625
634
|
};
|
|
626
|
-
case "interrupted": return { type: "interruption" };
|
|
627
635
|
default: return {
|
|
628
636
|
type: "diagnostic",
|
|
629
637
|
kind: e.kind,
|
|
630
638
|
msg: e.message,
|
|
631
|
-
related:
|
|
639
|
+
related: yt(e.related)
|
|
632
640
|
};
|
|
633
641
|
}
|
|
634
642
|
}
|
|
635
|
-
function
|
|
643
|
+
function Tt(e, t) {
|
|
636
644
|
let n = t.related[0];
|
|
637
645
|
if (n !== void 0 && t.reason === "upstream-stopped") return F(e, [{
|
|
638
646
|
type: "ancestor-stopped",
|
|
@@ -652,54 +660,54 @@ function wt(e, t) {
|
|
|
652
660
|
type: "diagnostic",
|
|
653
661
|
kind: t.reason,
|
|
654
662
|
msg: t.message,
|
|
655
|
-
related:
|
|
663
|
+
related: yt(t.related)
|
|
656
664
|
}]);
|
|
657
665
|
}
|
|
658
|
-
function
|
|
666
|
+
function Et(e, t = _t) {
|
|
659
667
|
let n = e.cell_id === null ? void 0 : t.get(e.cell_id);
|
|
660
668
|
return n !== void 0 && n.code !== null && n.code_fingerprint === e.code_fingerprint ? n.code : void 0;
|
|
661
669
|
}
|
|
662
|
-
function
|
|
663
|
-
let n =
|
|
670
|
+
function Dt(e, t = _t) {
|
|
671
|
+
let n = Ot(e), r = Et(e.record, t);
|
|
664
672
|
return n === null || r === void 0 ? n : {
|
|
665
673
|
...n,
|
|
666
674
|
code: r
|
|
667
675
|
};
|
|
668
676
|
}
|
|
669
|
-
function
|
|
677
|
+
function Ot(e) {
|
|
670
678
|
let { record: t } = e, n = k(e);
|
|
671
679
|
if (n === null) return null;
|
|
672
680
|
switch (n.kind) {
|
|
673
|
-
case "output": return n.media === null ? null :
|
|
674
|
-
case "
|
|
675
|
-
case "
|
|
676
|
-
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);
|
|
677
685
|
}
|
|
678
686
|
}
|
|
679
|
-
function
|
|
687
|
+
function kt(e, t) {
|
|
680
688
|
let n = e.executions.latest.get(t), r = n === void 0 ? void 0 : e.executions.executions.get(n);
|
|
681
689
|
if (r !== void 0 && k(r) !== null && r.record.state.status !== "completed") return r;
|
|
682
690
|
let i = e.results.get(t) ?? null;
|
|
683
691
|
return r?.record.state.status === "running" && i !== null && k(i)?.kind === "skipped" ? null : i;
|
|
684
692
|
}
|
|
685
|
-
function
|
|
693
|
+
function At(e, t) {
|
|
686
694
|
return e?.execution === t.record.id && e.version === t.outputVersion;
|
|
687
695
|
}
|
|
688
|
-
function
|
|
689
|
-
let n =
|
|
690
|
-
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);
|
|
691
699
|
}
|
|
692
|
-
function
|
|
700
|
+
function Mt(e) {
|
|
693
701
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set([...e.results.keys(), ...e.executions.latest.keys()]);
|
|
694
702
|
for (let r of n) {
|
|
695
|
-
let n =
|
|
703
|
+
let n = jt(e, r);
|
|
696
704
|
n !== null && t.set(P(r), n);
|
|
697
705
|
}
|
|
698
706
|
return t;
|
|
699
707
|
}
|
|
700
708
|
//#endregion
|
|
701
709
|
//#region src/utils/time.ts
|
|
702
|
-
var
|
|
710
|
+
var Nt = class e {
|
|
703
711
|
ms;
|
|
704
712
|
static fromMilliseconds(t) {
|
|
705
713
|
return t == null ? null : new e(t);
|
|
@@ -728,69 +736,69 @@ var Mt = class e {
|
|
|
728
736
|
};
|
|
729
737
|
//#endregion
|
|
730
738
|
//#region src/core/executions/select.ts
|
|
731
|
-
function
|
|
739
|
+
function Pt(e) {
|
|
732
740
|
return e.state.status === "completed" ? e.state.outcome.kind : null;
|
|
733
741
|
}
|
|
734
|
-
function
|
|
735
|
-
return e === null ? null :
|
|
742
|
+
function Ft(e) {
|
|
743
|
+
return e === null ? null : Nt.parse(e).toMilliseconds();
|
|
736
744
|
}
|
|
737
|
-
function
|
|
745
|
+
function It(e, t) {
|
|
738
746
|
let n = e.latest.get(t);
|
|
739
747
|
return n === void 0 ? null : e.executions.get(n) ?? null;
|
|
740
748
|
}
|
|
741
|
-
function
|
|
749
|
+
function Lt(e, t) {
|
|
742
750
|
let n = e.cells.get(t);
|
|
743
751
|
return n !== void 0 && !n.config.disabled && !e.blocked.has(t);
|
|
744
752
|
}
|
|
745
|
-
function
|
|
746
|
-
if (!
|
|
753
|
+
function Rt(e, t) {
|
|
754
|
+
if (!Lt(e, t)) return !1;
|
|
747
755
|
if (e.requested.has(t)) return !0;
|
|
748
|
-
let n =
|
|
756
|
+
let n = It(e.executions, t)?.record.run_id ?? e.results.get(t)?.record.run_id;
|
|
749
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;
|
|
750
758
|
return !1;
|
|
751
759
|
}
|
|
752
|
-
function
|
|
753
|
-
let n =
|
|
754
|
-
n !== null && n.record.state.status !== "completed" ? (i = n.record.state.status, s =
|
|
755
|
-
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;
|
|
756
764
|
return {
|
|
757
765
|
status: i,
|
|
758
766
|
blocked: e.blocked.has(t),
|
|
759
|
-
outcome: c && r !== null ?
|
|
767
|
+
outcome: c && r !== null ? Pt(r) : null,
|
|
760
768
|
live: r === null || e.runtimeId === null || r.runtime_id === e.runtimeId,
|
|
761
769
|
startedAt: s,
|
|
762
770
|
duration: l
|
|
763
771
|
};
|
|
764
772
|
}
|
|
765
|
-
function zt(e) {
|
|
766
|
-
return [...e.executions.values()].filter((e) => e.record.state.status !== "completed");
|
|
767
|
-
}
|
|
768
773
|
function Bt(e) {
|
|
769
|
-
return
|
|
774
|
+
return [...e.executions.values()].filter((e) => e.record.state.status !== "completed");
|
|
770
775
|
}
|
|
771
776
|
function Vt(e) {
|
|
772
|
-
|
|
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);
|
|
773
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);
|
|
774
782
|
let i = 0;
|
|
775
|
-
for (let t of r) !n.has(t) &&
|
|
783
|
+
for (let t of r) !n.has(t) && Rt(e, t) && (i += 1);
|
|
776
784
|
return t.length + i;
|
|
777
785
|
}
|
|
778
786
|
//#endregion
|
|
779
787
|
//#region src/core/executions/atoms.ts
|
|
780
|
-
var
|
|
788
|
+
var Ut = {
|
|
781
789
|
runs: /* @__PURE__ */ new Map(),
|
|
782
790
|
executions: /* @__PURE__ */ new Map(),
|
|
783
791
|
latest: /* @__PURE__ */ new Map(),
|
|
784
792
|
results: /* @__PURE__ */ new Map(),
|
|
785
793
|
scratch: null
|
|
786
|
-
},
|
|
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);
|
|
787
795
|
function Xt(e, t) {
|
|
788
796
|
return t !== null && e.replica === t.replica && e.id === t.id && e.generation === t.generation;
|
|
789
797
|
}
|
|
790
798
|
function Zt(e, t, n) {
|
|
791
799
|
return e !== null && Xt(e.notebook, t) ? e.value : n;
|
|
792
800
|
}
|
|
793
|
-
var
|
|
801
|
+
var R = x((e) => {
|
|
794
802
|
let t = e(h), n = t === null ? null : e(t.notebookAtom);
|
|
795
803
|
return t === null || n === null ? null : {
|
|
796
804
|
replica: t,
|
|
@@ -799,33 +807,33 @@ var L = x((e) => {
|
|
|
799
807
|
};
|
|
800
808
|
});
|
|
801
809
|
function Qt(e, t) {
|
|
802
|
-
return Xt(t.notebook, e.get(
|
|
810
|
+
return Xt(t.notebook, e.get(R));
|
|
803
811
|
}
|
|
804
812
|
var $t = x((e) => {
|
|
805
|
-
let t = Zt(e(
|
|
813
|
+
let t = Zt(e(L), e(R), Gt);
|
|
806
814
|
return t.size === 0 ? Kt : new Set([...t].flatMap((e) => e.cells));
|
|
807
|
-
}),
|
|
815
|
+
}), z = x((e) => {
|
|
808
816
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
809
817
|
return {
|
|
810
|
-
executions: t === null ?
|
|
811
|
-
results: t === null ?
|
|
812
|
-
cells: n?.cells ??
|
|
818
|
+
executions: t === null ? Ut : e(t.executionsAtom),
|
|
819
|
+
results: t === null ? Wt : e(t.resultsAtom),
|
|
820
|
+
cells: n?.cells ?? I,
|
|
813
821
|
requested: e($t),
|
|
814
|
-
blocked: Zt(e(Yt), e(
|
|
822
|
+
blocked: Zt(e(Yt), e(R), qt),
|
|
815
823
|
runtimeId: t === null ? null : e(t.runtimeAtom)?.id ?? null
|
|
816
824
|
};
|
|
817
825
|
}), en = x((e) => {
|
|
818
826
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
819
827
|
return t === null || n === null ? {
|
|
820
|
-
cells:
|
|
821
|
-
executions:
|
|
822
|
-
results:
|
|
828
|
+
cells: I,
|
|
829
|
+
executions: Ut,
|
|
830
|
+
results: Wt
|
|
823
831
|
} : {
|
|
824
832
|
cells: n.cells,
|
|
825
833
|
executions: e(t.executionsAtom),
|
|
826
834
|
results: e(t.resultsAtom)
|
|
827
835
|
};
|
|
828
|
-
}), tn = x((e) =>
|
|
836
|
+
}), tn = x((e) => gt(e(en))), nn = x(null), rn = x((e) => {
|
|
829
837
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
830
838
|
return t === null || n === null ? null : {
|
|
831
839
|
replica: t,
|
|
@@ -835,19 +843,19 @@ var $t = x((e) => {
|
|
|
835
843
|
}), an = x((e) => {
|
|
836
844
|
let t = e(h);
|
|
837
845
|
return {
|
|
838
|
-
executions: t === null ?
|
|
839
|
-
results: t === null ?
|
|
846
|
+
executions: t === null ? Ut : e(t.executionsAtom),
|
|
847
|
+
results: t === null ? Wt : e(t.resultsAtom),
|
|
840
848
|
cleared: Zt(e(nn), e(rn), Jt),
|
|
841
|
-
cells: t === null ?
|
|
849
|
+
cells: t === null ? I : e(t.documentAtom)?.cells ?? I
|
|
842
850
|
};
|
|
843
|
-
}), 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)))));
|
|
844
852
|
function cn(e) {
|
|
845
|
-
|
|
853
|
+
B.remove(e), sn.remove(e);
|
|
846
854
|
}
|
|
847
855
|
function ln(e, t) {
|
|
848
856
|
let n = e.get(an), r = new Map(n.cleared);
|
|
849
857
|
for (let e of t) {
|
|
850
|
-
let t =
|
|
858
|
+
let t = kt(n, e);
|
|
851
859
|
t != null && k(t) !== null && r.set(e, {
|
|
852
860
|
execution: t.record.id,
|
|
853
861
|
version: t.outputVersion
|
|
@@ -861,9 +869,9 @@ function ln(e, t) {
|
|
|
861
869
|
}
|
|
862
870
|
var un = x((e) => {
|
|
863
871
|
let t = e(h);
|
|
864
|
-
return t === null ? null : e(t.runtimeAtom)?.status ?? null;
|
|
872
|
+
return t === null ? null : e(t.runtimeAtom)?.state.status ?? null;
|
|
865
873
|
});
|
|
866
|
-
x((e) =>
|
|
874
|
+
x((e) => Vt(e(z).executions)), x((e) => Ht(e(z)));
|
|
867
875
|
var dn = x((e) => {
|
|
868
876
|
let t = e(h);
|
|
869
877
|
if (t === null) return { refused: "No notebook is connected" };
|
|
@@ -871,9 +879,12 @@ var dn = x((e) => {
|
|
|
871
879
|
if (e(t.notebookAtom) === null) return "waiting";
|
|
872
880
|
let n = e(t.runtimeAtom);
|
|
873
881
|
if (n === null) return { refused: "The notebook has no runtime" };
|
|
874
|
-
switch (n.status) {
|
|
875
|
-
case "
|
|
876
|
-
case "
|
|
882
|
+
switch (n.state.status) {
|
|
883
|
+
case "ready": return "running";
|
|
884
|
+
case "ended": {
|
|
885
|
+
let { outcome: e } = n.state;
|
|
886
|
+
return { refused: e.kind === "failed" ? e.message ?? "The runtime failed" : "The notebook has no runtime" };
|
|
887
|
+
}
|
|
877
888
|
default: return "waiting";
|
|
878
889
|
}
|
|
879
890
|
});
|
|
@@ -888,39 +899,39 @@ function fn(e) {
|
|
|
888
899
|
});
|
|
889
900
|
}
|
|
890
901
|
function pn(e, t) {
|
|
891
|
-
let n = e.get(
|
|
902
|
+
let n = e.get(R);
|
|
892
903
|
if (n === null) return null;
|
|
893
904
|
let r = {
|
|
894
905
|
notebook: n,
|
|
895
906
|
cells: [...t]
|
|
896
|
-
}, i = Zt(e.get(
|
|
897
|
-
return e.set(
|
|
907
|
+
}, i = Zt(e.get(L), n, Gt);
|
|
908
|
+
return e.set(L, {
|
|
898
909
|
notebook: n,
|
|
899
910
|
value: new Set(i).add(r)
|
|
900
911
|
}), r;
|
|
901
912
|
}
|
|
902
913
|
function mn(e, t) {
|
|
903
|
-
let n = e.get(
|
|
914
|
+
let n = e.get(L);
|
|
904
915
|
if (n === null || !n.value.has(t)) return;
|
|
905
916
|
let r = new Set(n.value);
|
|
906
|
-
r.delete(t), e.set(
|
|
917
|
+
r.delete(t), e.set(L, {
|
|
907
918
|
notebook: n.notebook,
|
|
908
919
|
value: r
|
|
909
920
|
});
|
|
910
921
|
}
|
|
911
922
|
function hn(e, t, n) {
|
|
912
|
-
let r = x((e) => Xt(t.notebook, e(
|
|
923
|
+
let r = x((e) => Xt(t.notebook, e(R)) && !e(t.notebook.replica.executionsAtom).runs.has(n.id)), i = e.sub(r, a);
|
|
913
924
|
function a() {
|
|
914
925
|
e.get(r) || (i(), mn(e, t));
|
|
915
926
|
}
|
|
916
927
|
a();
|
|
917
928
|
}
|
|
918
929
|
function gn(e, t, n) {
|
|
919
|
-
let r = e.get(
|
|
930
|
+
let r = e.get(z).blocked;
|
|
920
931
|
if (r.has(t) === n) return;
|
|
921
932
|
let i = new Set(r);
|
|
922
933
|
n ? i.add(t) : i.delete(t);
|
|
923
|
-
let a = e.get(
|
|
934
|
+
let a = e.get(R);
|
|
924
935
|
a !== null && e.set(Yt, {
|
|
925
936
|
notebook: a,
|
|
926
937
|
value: i
|
|
@@ -1031,7 +1042,7 @@ function On(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
|
1031
1042
|
}
|
|
1032
1043
|
//#endregion
|
|
1033
1044
|
//#region src/core/dom/ui-element-constants.ts
|
|
1034
|
-
var kn = "object-id", An = "random-id", jn = "abcdefghijklmnopqrstuvwxyz", Mn = jn + jn.toUpperCase(), Nn = /* @__PURE__ */ new Set(),
|
|
1045
|
+
var kn = "object-id", An = "random-id", jn = "abcdefghijklmnopqrstuvwxyz", Mn = jn + jn.toUpperCase(), Nn = /* @__PURE__ */ new Set(), V = "__scratch__", Pn = "setup", Fn = { create() {
|
|
1035
1046
|
let e = 0, t;
|
|
1036
1047
|
do {
|
|
1037
1048
|
let n = "";
|
|
@@ -1040,7 +1051,7 @@ var kn = "object-id", An = "random-id", jn = "abcdefghijklmnopqrstuvwxyz", Mn =
|
|
|
1040
1051
|
} while (Nn.has(t) && e < 100);
|
|
1041
1052
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
1042
1053
|
return Nn.add(t), t;
|
|
1043
|
-
} },
|
|
1054
|
+
} }, H = {
|
|
1044
1055
|
create(e) {
|
|
1045
1056
|
return C(e != null, "cellId is required"), `cell-${e}`;
|
|
1046
1057
|
},
|
|
@@ -1053,7 +1064,7 @@ var kn = "object-id", An = "random-id", jn = "abcdefghijklmnopqrstuvwxyz", Mn =
|
|
|
1053
1064
|
findElementThroughShadowDOMs(e) {
|
|
1054
1065
|
let t = e;
|
|
1055
1066
|
for (; t;) {
|
|
1056
|
-
let e =
|
|
1067
|
+
let e = H.findElement(t);
|
|
1057
1068
|
if (e) return e;
|
|
1058
1069
|
let n = t.getRootNode();
|
|
1059
1070
|
if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
|
|
@@ -1062,8 +1073,8 @@ var kn = "object-id", An = "random-id", jn = "abcdefghijklmnopqrstuvwxyz", Mn =
|
|
|
1062
1073
|
}
|
|
1063
1074
|
};
|
|
1064
1075
|
function In(e) {
|
|
1065
|
-
let t = null, n =
|
|
1066
|
-
return n && (t =
|
|
1076
|
+
let t = null, n = H.findElementThroughShadowDOMs(e);
|
|
1077
|
+
return n && (t = H.parse(n.id)), t;
|
|
1067
1078
|
}
|
|
1068
1079
|
var Ln = {
|
|
1069
1080
|
parse(e) {
|
|
@@ -1325,7 +1336,7 @@ function Gn(e) {
|
|
|
1325
1336
|
}
|
|
1326
1337
|
return t;
|
|
1327
1338
|
}
|
|
1328
|
-
var
|
|
1339
|
+
var U = class e {
|
|
1329
1340
|
mimetype;
|
|
1330
1341
|
channel;
|
|
1331
1342
|
timestamp;
|
|
@@ -1395,7 +1406,7 @@ function Jn(e) {
|
|
|
1395
1406
|
if (i === n + 1) Yn(t, r);
|
|
1396
1407
|
else {
|
|
1397
1408
|
let a = e.slice(n, i).map((e) => ($n(e), e.data));
|
|
1398
|
-
t.push(
|
|
1409
|
+
t.push(U.create({
|
|
1399
1410
|
...r,
|
|
1400
1411
|
data: a.join("")
|
|
1401
1412
|
}));
|
|
@@ -1415,10 +1426,10 @@ function Xn(e, t) {
|
|
|
1415
1426
|
return n && r && i;
|
|
1416
1427
|
}
|
|
1417
1428
|
function Zn(e) {
|
|
1418
|
-
return e instanceof
|
|
1429
|
+
return e instanceof U ? e : e.mimetype === "text/plain" && e.channel !== "stdin" && typeof e.data == "string" ? U.create(e) : e;
|
|
1419
1430
|
}
|
|
1420
1431
|
function Qn(e, t) {
|
|
1421
|
-
return e instanceof
|
|
1432
|
+
return e instanceof U ? e.appendData(t.data) : U.create(e).appendData(t.data);
|
|
1422
1433
|
}
|
|
1423
1434
|
function $n(e) {
|
|
1424
1435
|
C(typeof e.data == "string", "expected string output");
|
|
@@ -1427,7 +1438,7 @@ function er(e, t) {
|
|
|
1427
1438
|
let n = 0, r;
|
|
1428
1439
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
1429
1440
|
let t = e[r];
|
|
1430
|
-
t.mimetype === "text/plain" ? (C(typeof t.data == "string", "expected string"), n += t instanceof
|
|
1441
|
+
t.mimetype === "text/plain" ? (C(typeof t.data == "string", "expected string"), n += t instanceof U ? t.lineCount : t.data.split("\n").length) : n++;
|
|
1431
1442
|
}
|
|
1432
1443
|
if (n < t) return e;
|
|
1433
1444
|
let i = r + 1, a = [{
|
|
@@ -1439,7 +1450,7 @@ function er(e, t) {
|
|
|
1439
1450
|
if (o?.channel === "stdin" && o.response === void 0) return [...a, ...e.slice(i)];
|
|
1440
1451
|
if (o?.mimetype === "text/plain") {
|
|
1441
1452
|
C(typeof o.data == "string", "expected string");
|
|
1442
|
-
let r = n - t, s = o instanceof
|
|
1453
|
+
let r = n - t, s = o instanceof U ? o.dropFirstLines(r) : {
|
|
1443
1454
|
...o,
|
|
1444
1455
|
data: o.data.split("\n").slice(r).join("\n")
|
|
1445
1456
|
};
|
|
@@ -1460,10 +1471,10 @@ function tr(e, t) {
|
|
|
1460
1471
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1461
1472
|
var nr = function(e, t) {
|
|
1462
1473
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1463
|
-
},
|
|
1474
|
+
}, W;
|
|
1464
1475
|
(function(e) {
|
|
1465
1476
|
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";
|
|
1466
|
-
})(
|
|
1477
|
+
})(W ||= {});
|
|
1467
1478
|
var rr = class {
|
|
1468
1479
|
constructor() {
|
|
1469
1480
|
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 = {
|
|
@@ -1696,57 +1707,57 @@ var rr = class {
|
|
|
1696
1707
|
}
|
|
1697
1708
|
get_next_packet() {
|
|
1698
1709
|
var e = {
|
|
1699
|
-
kind:
|
|
1710
|
+
kind: W.EOS,
|
|
1700
1711
|
text: "",
|
|
1701
1712
|
url: ""
|
|
1702
1713
|
}, t = this._buffer.length;
|
|
1703
1714
|
if (t == 0) return e;
|
|
1704
1715
|
var n = this._buffer.indexOf("\x1B");
|
|
1705
|
-
if (n == -1) return e.kind =
|
|
1706
|
-
if (n > 0) return e.kind =
|
|
1716
|
+
if (n == -1) return e.kind = W.Text, e.text = this._buffer, this._buffer = "", e;
|
|
1717
|
+
if (n > 0) return e.kind = W.Text, e.text = this._buffer.slice(0, n), this._buffer = this._buffer.slice(n), e;
|
|
1707
1718
|
if (n == 0) {
|
|
1708
|
-
if (t < 3) return e.kind =
|
|
1719
|
+
if (t < 3) return e.kind = W.Incomplete, e;
|
|
1709
1720
|
var r = this._buffer.charAt(1);
|
|
1710
|
-
if (r != "[" && r != "]" && r != "(") return e.kind =
|
|
1721
|
+
if (r != "[" && r != "]" && r != "(") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1711
1722
|
if (r == "[") {
|
|
1712
1723
|
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 "]));
|
|
1713
1724
|
let t = this._buffer.match(this._csi_regex);
|
|
1714
|
-
if (t === null) return e.kind =
|
|
1715
|
-
if (t[4]) return e.kind =
|
|
1716
|
-
e.kind = t[1] != "" || t[3] != "m" ?
|
|
1725
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1726
|
+
if (t[4]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1727
|
+
e.kind = t[1] != "" || t[3] != "m" ? W.Unknown : W.SGR, e.text = t[2];
|
|
1717
1728
|
var i = t[0].length;
|
|
1718
1729
|
return this._buffer = this._buffer.slice(i), e;
|
|
1719
1730
|
}
|
|
1720
1731
|
if (r == "]") {
|
|
1721
|
-
if (t < 4) return e.kind =
|
|
1722
|
-
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind =
|
|
1732
|
+
if (t < 4) return e.kind = W.Incomplete, e;
|
|
1733
|
+
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;
|
|
1723
1734
|
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;
|
|
1724
1735
|
{
|
|
1725
1736
|
let t = this._osc_st.exec(this._buffer);
|
|
1726
|
-
if (t === null) return e.kind =
|
|
1727
|
-
if (t[3]) return e.kind =
|
|
1737
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1738
|
+
if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1728
1739
|
}
|
|
1729
1740
|
{
|
|
1730
1741
|
let t = this._osc_st.exec(this._buffer);
|
|
1731
|
-
if (t === null) return e.kind =
|
|
1732
|
-
if (t[3]) return e.kind =
|
|
1742
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1743
|
+
if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1733
1744
|
}
|
|
1734
1745
|
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 "]));
|
|
1735
1746
|
let n = this._buffer.match(this._osc_regex);
|
|
1736
|
-
if (n === null) return e.kind =
|
|
1737
|
-
e.kind =
|
|
1747
|
+
if (n === null) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1748
|
+
e.kind = W.OSCURL, e.url = n[1], e.text = n[2];
|
|
1738
1749
|
var i = n[0].length;
|
|
1739
1750
|
return this._buffer = this._buffer.slice(i), e;
|
|
1740
1751
|
}
|
|
1741
|
-
if (r == "(") return e.kind =
|
|
1752
|
+
if (r == "(") return e.kind = W.Unknown, this._buffer = this._buffer.slice(3), e;
|
|
1742
1753
|
}
|
|
1743
1754
|
}
|
|
1744
1755
|
ansi_to_html(e) {
|
|
1745
1756
|
this.append_buffer(e);
|
|
1746
1757
|
for (var t = [];;) {
|
|
1747
1758
|
var n = this.get_next_packet();
|
|
1748
|
-
if (n.kind ==
|
|
1749
|
-
n.kind !=
|
|
1759
|
+
if (n.kind == W.EOS || n.kind == W.Incomplete) break;
|
|
1760
|
+
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)));
|
|
1750
1761
|
}
|
|
1751
1762
|
return t.join("");
|
|
1752
1763
|
}
|
|
@@ -1825,7 +1836,7 @@ function ar(e, ...t) {
|
|
|
1825
1836
|
return new RegExp(n, "g");
|
|
1826
1837
|
}
|
|
1827
1838
|
var or, sr, cr, lr = new rr();
|
|
1828
|
-
function
|
|
1839
|
+
function G(e) {
|
|
1829
1840
|
try {
|
|
1830
1841
|
let t = document.createElement("div");
|
|
1831
1842
|
return t.innerHTML = e, (t.textContent || t.innerText || "").split("\n").map((e) => e.trimEnd()).join("\n");
|
|
@@ -1836,7 +1847,7 @@ function W(e) {
|
|
|
1836
1847
|
function ur(e) {
|
|
1837
1848
|
if (!e) return "";
|
|
1838
1849
|
try {
|
|
1839
|
-
return
|
|
1850
|
+
return G(lr.ansi_to_html(e));
|
|
1840
1851
|
} catch (n) {
|
|
1841
1852
|
return t.error("Error converting ANSI to plain text:", n), e;
|
|
1842
1853
|
}
|
|
@@ -1860,7 +1871,7 @@ function mr(e) {
|
|
|
1860
1871
|
case "stdout":
|
|
1861
1872
|
case "stderr":
|
|
1862
1873
|
case "marimo-error": {
|
|
1863
|
-
let a = d.asString(r.data), o = i ?
|
|
1874
|
+
let a = d.asString(r.data), o = i ? G(a) : a;
|
|
1864
1875
|
t.push({
|
|
1865
1876
|
timestamp: r.timestamp || Date.now(),
|
|
1866
1877
|
level: n ? "stderr" : "stdout",
|
|
@@ -2055,7 +2066,7 @@ function Or(e, t) {
|
|
|
2055
2066
|
}
|
|
2056
2067
|
};
|
|
2057
2068
|
}
|
|
2058
|
-
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole :
|
|
2069
|
+
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole : rt(r).flatMap((e) => u(e) ?? []);
|
|
2059
2070
|
if (d?.length) {
|
|
2060
2071
|
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;
|
|
2061
2072
|
p = [...p, ...d.map((e, t) => ({
|
|
@@ -2227,13 +2238,13 @@ async function Xr() {
|
|
|
2227
2238
|
}
|
|
2228
2239
|
//#endregion
|
|
2229
2240
|
//#region src/core/cells/editor.ts
|
|
2230
|
-
var
|
|
2241
|
+
var K = x(/* @__PURE__ */ new Set());
|
|
2231
2242
|
function Zr(e, t, n) {
|
|
2232
2243
|
return !!e && !t.has(n);
|
|
2233
2244
|
}
|
|
2234
2245
|
x(null, (e, t, { cellId: n }) => {
|
|
2235
|
-
t(
|
|
2236
|
-
}), x(null, (e, t, { cellId: n }) => e(
|
|
2246
|
+
t(K, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
2247
|
+
}), x(null, (e, t, { cellId: n }) => e(K).has(n) ? (t(K, (e) => {
|
|
2237
2248
|
let t = new Set(e);
|
|
2238
2249
|
return t.delete(n), t;
|
|
2239
2250
|
}), !0) : !1);
|
|
@@ -2247,7 +2258,7 @@ x(null, (e, t, { cellId: n }) => {
|
|
|
2247
2258
|
//#endregion
|
|
2248
2259
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
2249
2260
|
function $r(e, n) {
|
|
2250
|
-
let r = document.getElementById(
|
|
2261
|
+
let r = document.getElementById(H.create(e));
|
|
2251
2262
|
r ? ti(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
2252
2263
|
}
|
|
2253
2264
|
function ei() {
|
|
@@ -2298,11 +2309,11 @@ function si(e) {
|
|
|
2298
2309
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
2299
2310
|
}
|
|
2300
2311
|
function ci(e, t, n) {
|
|
2301
|
-
return e.status === "idle" ? fi(e) && n.code.trim() ? "not-run" : t.sourceChanged ? "source" : e.outcome === "
|
|
2312
|
+
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;
|
|
2302
2313
|
}
|
|
2303
2314
|
function* li(e, t, n) {
|
|
2304
2315
|
for (let r of e.cellIds) {
|
|
2305
|
-
let i =
|
|
2316
|
+
let i = zt(t, r), a = n(r), o = ci(i, a, e.cellData[r]);
|
|
2306
2317
|
o === null ? a.sourceChanged && di(t.executions, r) && (yield [r, "source"]) : yield [r, o];
|
|
2307
2318
|
}
|
|
2308
2319
|
}
|
|
@@ -2564,7 +2575,7 @@ var zi = class {
|
|
|
2564
2575
|
dispose() {
|
|
2565
2576
|
this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
|
|
2566
2577
|
}
|
|
2567
|
-
},
|
|
2578
|
+
}, q = {
|
|
2568
2579
|
VariableName: "VariableName",
|
|
2569
2580
|
FunctionDefinition: "FunctionDefinition",
|
|
2570
2581
|
ClassDefinition: "ClassDefinition",
|
|
@@ -2589,21 +2600,21 @@ var zi = class {
|
|
|
2589
2600
|
Comment: "Comment",
|
|
2590
2601
|
String: "String",
|
|
2591
2602
|
FormatString: "FormatString"
|
|
2592
|
-
},
|
|
2603
|
+
}, J = {
|
|
2593
2604
|
For: "for",
|
|
2594
2605
|
In: "in",
|
|
2595
2606
|
As: "as",
|
|
2596
2607
|
Import: "import"
|
|
2597
2608
|
}, Hi = /* @__PURE__ */ new Set([
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2609
|
+
q.FunctionDefinition,
|
|
2610
|
+
q.LambdaExpression,
|
|
2611
|
+
q.ArrayComprehensionExpression,
|
|
2612
|
+
q.SetComprehensionExpression,
|
|
2613
|
+
q.DictionaryComprehensionExpression,
|
|
2614
|
+
q.ComprehensionExpression,
|
|
2615
|
+
q.ClassDefinition
|
|
2605
2616
|
]);
|
|
2606
|
-
|
|
2617
|
+
q.Comment, q.String, q.FormatString;
|
|
2607
2618
|
//#endregion
|
|
2608
2619
|
//#region src/core/codemirror/utils.ts
|
|
2609
2620
|
function Ui(e) {
|
|
@@ -2624,7 +2635,7 @@ function Wi(e) {
|
|
|
2624
2635
|
}
|
|
2625
2636
|
//#endregion
|
|
2626
2637
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2627
|
-
var Gi = /* @__PURE__ */ new Set([
|
|
2638
|
+
var Gi = /* @__PURE__ */ new Set([q.ClassDefinition]);
|
|
2628
2639
|
function Ki(e, t) {
|
|
2629
2640
|
requestAnimationFrame(() => {
|
|
2630
2641
|
e.focus(), e.dispatch({
|
|
@@ -2640,13 +2651,13 @@ function qi(e, t) {
|
|
|
2640
2651
|
let n = me(e), r = null;
|
|
2641
2652
|
return n.iterate({ enter: (n) => {
|
|
2642
2653
|
if (r !== null) return !1;
|
|
2643
|
-
if (n.name ===
|
|
2644
|
-
if (n.name ===
|
|
2654
|
+
if (n.name === q.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
2655
|
+
if (n.name === q.Comment || n.name === q.String) return !1;
|
|
2645
2656
|
} }), r;
|
|
2646
2657
|
}
|
|
2647
2658
|
function Ji(e, t) {
|
|
2648
2659
|
let n = [], r = e.resolveInner(t, 0);
|
|
2649
|
-
for (; r;) Hi.has(r.name) && (n.some((e) => e.type ===
|
|
2660
|
+
for (; r;) Hi.has(r.name) && (n.some((e) => e.type === q.FunctionDefinition || e.type === q.LambdaExpression) && r.name === q.ClassDefinition || n.push({
|
|
2650
2661
|
id: r.from,
|
|
2651
2662
|
type: r.name
|
|
2652
2663
|
})), r = r.parent;
|
|
@@ -2655,7 +2666,7 @@ function Ji(e, t) {
|
|
|
2655
2666
|
type: "global"
|
|
2656
2667
|
}), n;
|
|
2657
2668
|
}
|
|
2658
|
-
function
|
|
2669
|
+
function Y(e, t, n) {
|
|
2659
2670
|
e.push({
|
|
2660
2671
|
scopeId: t,
|
|
2661
2672
|
from: n
|
|
@@ -2669,11 +2680,11 @@ function Yi(e, t) {
|
|
|
2669
2680
|
function Xi(e, t) {
|
|
2670
2681
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2671
2682
|
switch (e.name) {
|
|
2672
|
-
case
|
|
2673
|
-
n.doc.sliceString(e.from, e.to) === r &&
|
|
2683
|
+
case q.VariableName:
|
|
2684
|
+
n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2674
2685
|
break;
|
|
2675
|
-
case
|
|
2676
|
-
case
|
|
2686
|
+
case q.TupleExpression:
|
|
2687
|
+
case q.ArrayExpression: {
|
|
2677
2688
|
let n = e.node.cursor();
|
|
2678
2689
|
n.firstChild();
|
|
2679
2690
|
do
|
|
@@ -2687,11 +2698,11 @@ function Zi(e, t) {
|
|
|
2687
2698
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2688
2699
|
o.firstChild();
|
|
2689
2700
|
do {
|
|
2690
|
-
if (o.name !==
|
|
2701
|
+
if (o.name !== q.ParamList) continue;
|
|
2691
2702
|
let e = o.node.cursor();
|
|
2692
2703
|
e.firstChild();
|
|
2693
2704
|
do
|
|
2694
|
-
e.name ===
|
|
2705
|
+
e.name === q.VariableName && n.doc.sliceString(e.from, e.to) === r && Y(a, i, e.from);
|
|
2695
2706
|
while (e.nextSibling());
|
|
2696
2707
|
} while (o.nextSibling());
|
|
2697
2708
|
}
|
|
@@ -2700,25 +2711,25 @@ function Qi(e, t) {
|
|
|
2700
2711
|
n.firstChild();
|
|
2701
2712
|
let r = !1;
|
|
2702
2713
|
do
|
|
2703
|
-
if (n.name ===
|
|
2704
|
-
else if (r && n.name ===
|
|
2714
|
+
if (n.name === J.For) r = !0;
|
|
2715
|
+
else if (r && n.name === J.In) break;
|
|
2705
2716
|
else r && Xi(n, t);
|
|
2706
2717
|
while (n.nextSibling());
|
|
2707
2718
|
}
|
|
2708
2719
|
function $i(e, t) {
|
|
2709
2720
|
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;
|
|
2710
2721
|
switch (s) {
|
|
2711
|
-
case
|
|
2712
|
-
case
|
|
2722
|
+
case q.FunctionDefinition:
|
|
2723
|
+
case q.ClassDefinition: {
|
|
2713
2724
|
let t = e.cursor();
|
|
2714
2725
|
t.firstChild();
|
|
2715
2726
|
do
|
|
2716
|
-
if (t.name ===
|
|
2717
|
-
|
|
2727
|
+
if (t.name === q.VariableName && n.doc.sliceString(t.from, t.to) === r) {
|
|
2728
|
+
Y(a, i[i.length - 1] ?? -1, t.from);
|
|
2718
2729
|
break;
|
|
2719
2730
|
}
|
|
2720
2731
|
while (t.nextSibling());
|
|
2721
|
-
s ===
|
|
2732
|
+
s === q.FunctionDefinition && Zi(e, {
|
|
2722
2733
|
state: n,
|
|
2723
2734
|
variableName: r,
|
|
2724
2735
|
scopeId: c,
|
|
@@ -2726,7 +2737,7 @@ function $i(e, t) {
|
|
|
2726
2737
|
});
|
|
2727
2738
|
break;
|
|
2728
2739
|
}
|
|
2729
|
-
case
|
|
2740
|
+
case q.LambdaExpression:
|
|
2730
2741
|
Zi(e, {
|
|
2731
2742
|
state: n,
|
|
2732
2743
|
variableName: r,
|
|
@@ -2734,11 +2745,11 @@ function $i(e, t) {
|
|
|
2734
2745
|
declarations: a
|
|
2735
2746
|
});
|
|
2736
2747
|
break;
|
|
2737
|
-
case
|
|
2738
|
-
case
|
|
2739
|
-
case
|
|
2740
|
-
case
|
|
2741
|
-
case
|
|
2748
|
+
case q.ArrayComprehensionExpression:
|
|
2749
|
+
case q.DictionaryComprehensionExpression:
|
|
2750
|
+
case q.SetComprehensionExpression:
|
|
2751
|
+
case q.ComprehensionExpression:
|
|
2752
|
+
case q.ForStatement:
|
|
2742
2753
|
Qi(e, {
|
|
2743
2754
|
state: n,
|
|
2744
2755
|
variableName: r,
|
|
@@ -2746,11 +2757,11 @@ function $i(e, t) {
|
|
|
2746
2757
|
declarations: a
|
|
2747
2758
|
});
|
|
2748
2759
|
break;
|
|
2749
|
-
case
|
|
2760
|
+
case q.AssignStatement: {
|
|
2750
2761
|
let t = [], i = e.cursor();
|
|
2751
2762
|
i.firstChild();
|
|
2752
2763
|
do
|
|
2753
|
-
i.name ===
|
|
2764
|
+
i.name === q.AssignOp && t.push(i.from);
|
|
2754
2765
|
while (i.nextSibling());
|
|
2755
2766
|
let o = t[t.length - 1];
|
|
2756
2767
|
if (o === void 0) break;
|
|
@@ -2766,14 +2777,14 @@ function $i(e, t) {
|
|
|
2766
2777
|
while (s.nextSibling());
|
|
2767
2778
|
break;
|
|
2768
2779
|
}
|
|
2769
|
-
case
|
|
2780
|
+
case q.ImportStatement: {
|
|
2770
2781
|
let t = e.cursor();
|
|
2771
2782
|
t.firstChild();
|
|
2772
2783
|
let i = !1, o = null, s = () => {
|
|
2773
|
-
o?.matches &&
|
|
2784
|
+
o?.matches && Y(a, u, o.from), o = null;
|
|
2774
2785
|
};
|
|
2775
2786
|
do
|
|
2776
|
-
t.name ===
|
|
2787
|
+
t.name === J.Import ? i = !0 : i && (t.name === J.As ? o = null : t.name === q.VariableName ? (s(), o = {
|
|
2777
2788
|
from: t.from,
|
|
2778
2789
|
matches: n.doc.sliceString(t.from, t.to) === r
|
|
2779
2790
|
}) : t.name === "," && s());
|
|
@@ -2781,13 +2792,13 @@ function $i(e, t) {
|
|
|
2781
2792
|
s();
|
|
2782
2793
|
break;
|
|
2783
2794
|
}
|
|
2784
|
-
case
|
|
2785
|
-
case
|
|
2795
|
+
case q.TryStatement:
|
|
2796
|
+
case q.WithStatement: {
|
|
2786
2797
|
let t = e.cursor();
|
|
2787
2798
|
t.firstChild();
|
|
2788
2799
|
let i = !1;
|
|
2789
2800
|
do
|
|
2790
|
-
t.name ===
|
|
2801
|
+
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);
|
|
2791
2802
|
while (t.nextSibling());
|
|
2792
2803
|
break;
|
|
2793
2804
|
}
|
|
@@ -2825,21 +2836,21 @@ function na(e, t) {
|
|
|
2825
2836
|
}
|
|
2826
2837
|
//#endregion
|
|
2827
2838
|
//#region src/core/network/connection.ts
|
|
2828
|
-
var
|
|
2839
|
+
var X = x({ state: O.NOT_STARTED });
|
|
2829
2840
|
p(null, (e, t) => t === null ? null : {
|
|
2830
2841
|
phase: t.phase,
|
|
2831
2842
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2832
2843
|
});
|
|
2833
2844
|
function ra() {
|
|
2834
|
-
return se(
|
|
2845
|
+
return se(X, (e) => e.state === O.OPEN);
|
|
2835
2846
|
}
|
|
2836
2847
|
function ia() {
|
|
2837
2848
|
return _e() ? ra() : Promise.resolve();
|
|
2838
2849
|
}
|
|
2839
|
-
x((e) => e(
|
|
2840
|
-
let t = e(
|
|
2850
|
+
x((e) => e(X).state === O.CONNECTING), x((e) => e(X).state === O.OPEN), x((e) => {
|
|
2851
|
+
let t = e(X);
|
|
2841
2852
|
return t.state === O.OPEN || t.state === O.NOT_STARTED;
|
|
2842
|
-
}), x((e) => e(
|
|
2853
|
+
}), x((e) => e(X).state === O.CLOSED);
|
|
2843
2854
|
//#endregion
|
|
2844
2855
|
//#region src/components/ui/checkbox.tsx
|
|
2845
2856
|
var aa = w.forwardRef((e, t) => {
|
|
@@ -2867,7 +2878,7 @@ aa.displayName = Pe.displayName;
|
|
|
2867
2878
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
2868
2879
|
function oa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2869
2880
|
if (!n) return;
|
|
2870
|
-
let o = document.getElementById(
|
|
2881
|
+
let o = document.getElementById(H.create(e));
|
|
2871
2882
|
if (!o) t.warn("scrollCellIntoView: element not found");
|
|
2872
2883
|
else if (ei()) ti(o);
|
|
2873
2884
|
else {
|
|
@@ -2915,7 +2926,7 @@ function ca() {
|
|
|
2915
2926
|
});
|
|
2916
2927
|
}
|
|
2917
2928
|
function la(e) {
|
|
2918
|
-
let t = document.getElementById(
|
|
2929
|
+
let t = document.getElementById(H.create(e));
|
|
2919
2930
|
return t?.scrollIntoView({
|
|
2920
2931
|
behavior: "smooth",
|
|
2921
2932
|
block: "center"
|
|
@@ -2933,18 +2944,18 @@ function ua(e) {
|
|
|
2933
2944
|
return {
|
|
2934
2945
|
...e,
|
|
2935
2946
|
cellData: {
|
|
2936
|
-
[
|
|
2937
|
-
id:
|
|
2947
|
+
[V]: Sr({
|
|
2948
|
+
id: V,
|
|
2938
2949
|
config: t
|
|
2939
2950
|
}),
|
|
2940
2951
|
...e.cellData
|
|
2941
2952
|
},
|
|
2942
2953
|
cellRuntime: {
|
|
2943
|
-
[
|
|
2954
|
+
[V]: wr(),
|
|
2944
2955
|
...e.cellRuntime
|
|
2945
2956
|
},
|
|
2946
2957
|
cellHandles: {
|
|
2947
|
-
[
|
|
2958
|
+
[V]: (0, w.createRef)(),
|
|
2948
2959
|
...e.cellHandles
|
|
2949
2960
|
}
|
|
2950
2961
|
};
|
|
@@ -2960,8 +2971,8 @@ function da() {
|
|
|
2960
2971
|
cellLogs: []
|
|
2961
2972
|
});
|
|
2962
2973
|
}
|
|
2963
|
-
var { reducer: fa, createActions: pa, useActions: ma, valueAtom:
|
|
2964
|
-
setCellReusability: (e, t) =>
|
|
2974
|
+
var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = fe(da, {
|
|
2975
|
+
setCellReusability: (e, t) => Q({
|
|
2965
2976
|
state: e,
|
|
2966
2977
|
cellId: t.cell_id,
|
|
2967
2978
|
cellReducer: (e) => ({
|
|
@@ -2969,7 +2980,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
2969
2980
|
serialization: t.serialization
|
|
2970
2981
|
})
|
|
2971
2982
|
}),
|
|
2972
|
-
startCellConsole: (e, { cellId: t }) =>
|
|
2983
|
+
startCellConsole: (e, { cellId: t }) => Q({
|
|
2973
2984
|
state: e,
|
|
2974
2985
|
cellId: t,
|
|
2975
2986
|
cellReducer: (e) => ({
|
|
@@ -2981,7 +2992,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
2981
2992
|
})
|
|
2982
2993
|
}),
|
|
2983
2994
|
showCommandOutput: (e, t) => {
|
|
2984
|
-
let { cell_id: n, entries: r, replace: i } = t, a =
|
|
2995
|
+
let { cell_id: n, entries: r, replace: i } = t, a = Q({
|
|
2985
2996
|
state: e,
|
|
2986
2997
|
cellId: n,
|
|
2987
2998
|
cellReducer: (e) => ({
|
|
@@ -2999,7 +3010,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
2999
3010
|
},
|
|
3000
3011
|
hideConsoleInputs: (e, { cellId: t, executionId: n, inputIds: r }) => {
|
|
3001
3012
|
let i = new Set(r);
|
|
3002
|
-
return
|
|
3013
|
+
return Q({
|
|
3003
3014
|
state: e,
|
|
3004
3015
|
cellId: t,
|
|
3005
3016
|
cellReducer: (e) => ({
|
|
@@ -3036,12 +3047,12 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
3036
3047
|
}),
|
|
3037
3048
|
reconcileDocument: (e, t) => {
|
|
3038
3049
|
let n = Jr(e, t);
|
|
3039
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
3050
|
+
for (let t of e.cellIds) t in n.cellData || Aa(t);
|
|
3040
3051
|
return n;
|
|
3041
3052
|
},
|
|
3042
3053
|
setStdinResponse: (e, t) => {
|
|
3043
3054
|
let { cellId: n, response: r, inputId: i } = t;
|
|
3044
|
-
return
|
|
3055
|
+
return Q({
|
|
3045
3056
|
state: e,
|
|
3046
3057
|
cellId: n,
|
|
3047
3058
|
cellReducer: (e) => ({
|
|
@@ -3052,7 +3063,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
3052
3063
|
},
|
|
3053
3064
|
resetCellRuntimes: (e, t) => {
|
|
3054
3065
|
let n = be(), r = { ...e.cellRuntime };
|
|
3055
|
-
for (let i of [...e.cellIds,
|
|
3066
|
+
for (let i of [...e.cellIds, V]) {
|
|
3056
3067
|
let a = e.cellRuntime[i];
|
|
3057
3068
|
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a : wr({
|
|
3058
3069
|
clearedConsole: t ? a?.clearedConsole : void 0,
|
|
@@ -3071,7 +3082,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
3071
3082
|
return oa({
|
|
3072
3083
|
cellId: n,
|
|
3073
3084
|
cell: e.cellHandles[n],
|
|
3074
|
-
isCodeHidden: Zr(e.cellData[n]?.config.hide_code, y.get(
|
|
3085
|
+
isCodeHidden: Zr(e.cellData[n]?.config.hide_code, y.get(K), n),
|
|
3075
3086
|
codeFocus: void 0,
|
|
3076
3087
|
variableName: void 0
|
|
3077
3088
|
}), {
|
|
@@ -3085,7 +3096,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
3085
3096
|
...e,
|
|
3086
3097
|
cellLogs: []
|
|
3087
3098
|
}),
|
|
3088
|
-
clearCellConsole: (e, t) =>
|
|
3099
|
+
clearCellConsole: (e, t) => Q({
|
|
3089
3100
|
state: e,
|
|
3090
3101
|
cellId: t.cellId,
|
|
3091
3102
|
cellReducer: (e) => {
|
|
@@ -3101,7 +3112,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: X } = fe(da, {
|
|
|
3101
3112
|
}
|
|
3102
3113
|
})
|
|
3103
3114
|
});
|
|
3104
|
-
function
|
|
3115
|
+
function Q({ state: e, cellId: n, cellReducer: r }) {
|
|
3105
3116
|
return n in e.cellRuntime ? {
|
|
3106
3117
|
...e,
|
|
3107
3118
|
cellRuntime: {
|
|
@@ -3111,15 +3122,15 @@ function Z({ state: e, cellId: n, cellReducer: r }) {
|
|
|
3111
3122
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
3112
3123
|
}
|
|
3113
3124
|
var ha = pa((e) => {
|
|
3114
|
-
y.set(
|
|
3115
|
-
}).addLogs,
|
|
3116
|
-
x((e) => e(
|
|
3117
|
-
var ga = x((e) => ui(e(
|
|
3125
|
+
y.set(Z, (t) => fa(t, e));
|
|
3126
|
+
}).addLogs, $ = x((e) => e(Z).cellIds);
|
|
3127
|
+
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)));
|
|
3128
|
+
var ga = x((e) => ui(e(Z), e(z), e(tn)));
|
|
3118
3129
|
x((e) => e(ga) !== null);
|
|
3119
3130
|
var _a = x((e) => {
|
|
3120
|
-
let { cellIds: t, cellData: n } = e(
|
|
3131
|
+
let { cellIds: t, cellData: n } = e(Z);
|
|
3121
3132
|
return t.map((t) => {
|
|
3122
|
-
let r = e(
|
|
3133
|
+
let r = e(B(t)), { name: i } = n[t];
|
|
3123
3134
|
if (r !== null && Dn(r.mimetype)) {
|
|
3124
3135
|
C(Array.isArray(r.data), "Expected array data");
|
|
3125
3136
|
let e = r.data.filter((e) => !e.type.includes("ancestor"));
|
|
@@ -3136,52 +3147,52 @@ var _a = x((e) => {
|
|
|
3136
3147
|
}).filter(Boolean);
|
|
3137
3148
|
}), va = ce(x((e) => {
|
|
3138
3149
|
let t = {};
|
|
3139
|
-
for (let n of e(
|
|
3150
|
+
for (let n of e($)) {
|
|
3140
3151
|
let r = e(sn(n));
|
|
3141
3152
|
r !== null && r.items.length > 0 && (t[n] = r);
|
|
3142
3153
|
}
|
|
3143
3154
|
return t;
|
|
3144
|
-
})), ya = x((e) => Je(e(
|
|
3155
|
+
})), ya = x((e) => Je(e($).map((t) => e(sn(t)))));
|
|
3145
3156
|
x((e) => e(_a).length);
|
|
3146
3157
|
var ba = ce(x((e) => {
|
|
3147
|
-
let { cellIds: t, cellData: n } = e(
|
|
3158
|
+
let { cellIds: t, cellData: n } = e(Z);
|
|
3148
3159
|
return ue.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
3149
3160
|
}));
|
|
3150
|
-
x((e) => e(
|
|
3151
|
-
var xa = () => v(
|
|
3152
|
-
let { cellIds: e, cellData: t } = y.get(
|
|
3161
|
+
x((e) => e(Z).scrollKey);
|
|
3162
|
+
var xa = () => v($), Sa = () => v(ba), Ca = () => y.get(Z), wa = () => y.get(Z).cellIds, Ta = () => {
|
|
3163
|
+
let { cellIds: e, cellData: t } = y.get(Z);
|
|
3153
3164
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
3154
3165
|
};
|
|
3155
|
-
ee(_(
|
|
3156
|
-
var Ea = S((e) => x((t) => t(
|
|
3166
|
+
ee(_(Z, (e) => e.cellIds.map((t) => e.cellData[t]))), x((e) => e(Z).cellIds.length > 0);
|
|
3167
|
+
var Ea = S((e) => x((t) => t(Z).cellData[e])), Da = wr(), Oa = S((e) => {
|
|
3157
3168
|
let t = x((t) => {
|
|
3158
3169
|
let n = Dr(t, e), r = t(m)?.cells;
|
|
3159
3170
|
return {
|
|
3160
|
-
local: t(
|
|
3171
|
+
local: t(Z).cellRuntime[e] ?? Da,
|
|
3161
3172
|
execution: n,
|
|
3162
|
-
code: n &&
|
|
3173
|
+
code: n && Et(n.record, r)
|
|
3163
3174
|
};
|
|
3164
3175
|
}), n = _(t, Or);
|
|
3165
3176
|
return x((e) => e(n).rendered);
|
|
3166
|
-
}),
|
|
3167
|
-
function
|
|
3168
|
-
Ea.remove(e),
|
|
3177
|
+
}), ka = S((e) => x((t) => t(Z).cellHandles[e]));
|
|
3178
|
+
function Aa(e) {
|
|
3179
|
+
Ea.remove(e), Oa.remove(e), ka.remove(e), cn(e);
|
|
3169
3180
|
}
|
|
3170
|
-
var
|
|
3171
|
-
let { cellHandles: t } = y.get(
|
|
3181
|
+
var ja = (e) => {
|
|
3182
|
+
let { cellHandles: t } = y.get(Z);
|
|
3172
3183
|
return t[e].current?.editorView;
|
|
3173
|
-
},
|
|
3174
|
-
x((e) => e(
|
|
3184
|
+
}, Ma = (e) => (wn.promote(e), ja(e));
|
|
3185
|
+
x((e) => e($).map((t) => ({
|
|
3175
3186
|
...e(Ea(t)),
|
|
3176
|
-
...e(
|
|
3177
|
-
output: e(
|
|
3187
|
+
...e(Oa(t)),
|
|
3188
|
+
output: e(B(t))
|
|
3178
3189
|
})));
|
|
3179
|
-
function
|
|
3190
|
+
function Na() {
|
|
3180
3191
|
return ma();
|
|
3181
3192
|
}
|
|
3182
3193
|
//#endregion
|
|
3183
3194
|
//#region src/core/errors/error-entries.ts
|
|
3184
|
-
function
|
|
3195
|
+
function Pa(e) {
|
|
3185
3196
|
if (Tn(e.mimetype)) {
|
|
3186
3197
|
if (!Array.isArray(e.data)) return null;
|
|
3187
3198
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
@@ -3192,23 +3203,23 @@ function Na(e) {
|
|
|
3192
3203
|
tracebackHtml: e.data
|
|
3193
3204
|
} : null;
|
|
3194
3205
|
}
|
|
3195
|
-
function
|
|
3206
|
+
function Fa(e) {
|
|
3196
3207
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
3197
3208
|
}
|
|
3198
|
-
function
|
|
3209
|
+
function Ia(e) {
|
|
3199
3210
|
let t = e?.find((e) => En(e.mimetype));
|
|
3200
3211
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
3201
3212
|
}
|
|
3202
|
-
function
|
|
3213
|
+
function La(e, t) {
|
|
3203
3214
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
3204
|
-
if (!
|
|
3215
|
+
if (!Fa(e.errorData)) return Ia(t);
|
|
3205
3216
|
}
|
|
3206
|
-
function
|
|
3207
|
-
let { cellIds: t, cellData: n } = e.get(
|
|
3217
|
+
function Ra(e) {
|
|
3218
|
+
let { cellIds: t, cellData: n } = e.get(Z), r = [];
|
|
3208
3219
|
for (let [i, a] of t.entries()) {
|
|
3209
|
-
let t = e.get(
|
|
3220
|
+
let t = e.get(B(a));
|
|
3210
3221
|
if (t === null || !Dn(t.mimetype)) continue;
|
|
3211
|
-
let o =
|
|
3222
|
+
let o = Pa(t);
|
|
3212
3223
|
if (!o) continue;
|
|
3213
3224
|
let s = br(n[a].name, i), c = t.code ?? n[a].code;
|
|
3214
3225
|
r.push({
|
|
@@ -3216,21 +3227,21 @@ function La(e) {
|
|
|
3216
3227
|
cellName: s,
|
|
3217
3228
|
cellCode: c,
|
|
3218
3229
|
errorData: o.errorData,
|
|
3219
|
-
tracebackHtml:
|
|
3230
|
+
tracebackHtml: La(o, e.get(Oa(a)).consoleOutputs)
|
|
3220
3231
|
});
|
|
3221
3232
|
}
|
|
3222
3233
|
return r;
|
|
3223
3234
|
}
|
|
3224
|
-
function Ra(e) {
|
|
3225
|
-
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");
|
|
3226
|
-
}
|
|
3227
3235
|
function za(e) {
|
|
3228
|
-
|
|
3229
|
-
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${W(e.traceback)}`), t;
|
|
3236
|
+
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
3237
|
}
|
|
3231
3238
|
function Ba(e) {
|
|
3239
|
+
let t = za(e);
|
|
3240
|
+
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${G(e.traceback)}`), t;
|
|
3241
|
+
}
|
|
3242
|
+
function Va(e) {
|
|
3232
3243
|
let t = [e.cellName];
|
|
3233
|
-
return e.tracebackHtml && t.push(
|
|
3244
|
+
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");
|
|
3234
3245
|
}
|
|
3235
3246
|
//#endregion
|
|
3236
|
-
export { Zr as $, Qe as $t, ia as A,
|
|
3247
|
+
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 };
|