notebook 7.3.0a0__py3-none-any.whl → 7.3.0b0__py3-none-any.whl
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.
Potentially problematic release.
This version of notebook might be problematic. Click here for more details.
- notebook/_version.py +1 -1
- notebook/app.py +10 -2
- notebook/static/113.bundle.js +1 -1
- notebook/static/1198.bundle.js +1 -1
- notebook/static/131.bundle.js +1 -1
- notebook/static/134.bundle.js +1 -1
- notebook/static/1408.bundle.js +1 -1
- notebook/static/1496.bundle.js +1 -1
- notebook/static/1584.bundle.js +1 -1
- notebook/static/1647.bundle.js +1 -1
- notebook/static/1650.bundle.js +1 -1
- notebook/static/1684.bundle.js +1 -1
- notebook/static/170.bundle.js +1 -1
- notebook/static/1809.bundle.js +1 -1
- notebook/static/1827.bundle.js +1 -1
- notebook/static/1828.bundle.js +1 -1
- notebook/static/1833.bundle.js +1 -1
- notebook/static/1958.bundle.js +1 -1
- notebook/static/1962.bundle.js +1 -1
- notebook/static/2007.bundle.js +1 -1
- notebook/static/2065.bundle.js +1 -1
- notebook/static/2088.bundle.js +1 -1
- notebook/static/2089.bundle.js +1 -1
- notebook/static/2122.bundle.js +1 -1
- notebook/static/2167.bundle.js +1 -1
- notebook/static/2184.bundle.js +1 -1
- notebook/static/2311.bundle.js +1 -1
- notebook/static/2401.bundle.js +1 -1
- notebook/static/2424.bundle.js +377 -0
- notebook/static/2479.bundle.js +1 -1
- notebook/static/2489.bundle.js +1 -1
- notebook/static/2607.bundle.js +1 -1
- notebook/static/2615.bundle.js +1 -1
- notebook/static/2636.bundle.js +1 -1
- notebook/static/2756.bundle.js +1 -1
- notebook/static/2813.bundle.js +1 -1
- notebook/static/2866.bundle.js +1 -1
- notebook/static/2924.bundle.js +1 -1
- notebook/static/2944.bundle.js +1 -1
- notebook/static/2955.bundle.js +1 -0
- notebook/static/3129.bundle.js +1 -1
- notebook/static/3146.bundle.js +1 -1
- notebook/static/3187.bundle.js +1 -1
- notebook/static/3213.bundle.js +1 -1
- notebook/static/3301.bundle.js +1 -1
- notebook/static/3325.bundle.js +1 -1
- notebook/static/3340.bundle.js +1 -1
- notebook/static/3360.bundle.js +1 -1
- notebook/static/{1261.bundle.js → 3463.bundle.js} +1 -1
- notebook/static/3466.bundle.js +1 -1
- notebook/static/35.bundle.js +1 -1
- notebook/static/3512.bundle.js +1 -1
- notebook/static/3676.bundle.js +1 -1
- notebook/static/3680.bundle.js +1 -1
- notebook/static/374.bundle.js +1 -1
- notebook/static/3768.bundle.js +1 -1
- notebook/static/377.bundle.js +1 -1
- notebook/static/3863.bundle.js +1 -1
- notebook/static/3881.bundle.js +1 -1
- notebook/static/4042.bundle.js +1 -1
- notebook/static/4058.bundle.js +1 -1
- notebook/static/409.bundle.js +1 -1
- notebook/static/4212.bundle.js +1 -1
- notebook/static/4242.bundle.js +79 -0
- notebook/static/4271.bundle.js +1 -1
- notebook/static/4291.bundle.js +1 -1
- notebook/static/4382.bundle.js +1 -1
- notebook/static/4526.bundle.js +1 -1
- notebook/static/4588.bundle.js +1 -1
- notebook/static/4630.bundle.js +1 -1
- notebook/static/4645.bundle.js +1 -1
- notebook/static/4811.bundle.js +1 -1
- notebook/static/4837.bundle.js +1 -1
- notebook/static/5099.bundle.js +1 -1
- notebook/static/5135.bundle.js +1 -1
- notebook/static/5166.bundle.js +1 -1
- notebook/static/5234.bundle.js +1 -1
- notebook/static/5254.bundle.js +1 -1
- notebook/static/5261.bundle.js +1 -1
- notebook/static/5263.bundle.js +1 -0
- notebook/static/5313.bundle.js +1 -1
- notebook/static/5325.bundle.js +1 -1
- notebook/static/5346.bundle.js +1 -1
- notebook/static/5426.bundle.js +1 -1
- notebook/static/5430.bundle.js +653 -0
- notebook/static/545.bundle.js +1 -1
- notebook/static/5451.bundle.js +1 -1
- notebook/static/5573.bundle.js +1 -1
- notebook/static/5601.bundle.js +1 -1
- notebook/static/5649.bundle.js +3 -3
- notebook/static/5733.bundle.js +1 -1
- notebook/static/5828.bundle.js +1 -1
- notebook/static/5850.bundle.js +1 -1
- notebook/static/5912.bundle.js +1 -1
- notebook/static/5921.bundle.js +1 -1
- notebook/static/6017.bundle.js +1 -1
- notebook/static/6061.bundle.js +1 -1
- notebook/static/6139.bundle.js +1 -1
- notebook/static/62.bundle.js +1 -1
- notebook/static/6271.bundle.js +1 -1
- notebook/static/6345.bundle.js +1 -1
- notebook/static/6604.bundle.js +1 -1
- notebook/static/6621.bundle.js +1 -1
- notebook/static/6627.bundle.js +1 -1
- notebook/static/6648.bundle.js +1 -0
- notebook/static/6731.bundle.js +1 -1
- notebook/static/6748.bundle.js +1 -1
- notebook/static/677.bundle.js +1 -1
- notebook/static/6815.bundle.js +1 -1
- notebook/static/6853.bundle.js +1 -1
- notebook/static/6893.bundle.js +1 -1
- notebook/static/690.bundle.js +1 -1
- notebook/static/6962.bundle.js +1 -1
- notebook/static/6999.bundle.js +1 -1
- notebook/static/7226.bundle.js +1 -1
- notebook/static/7252.bundle.js +1 -1
- notebook/static/7302.bundle.js +1 -1
- notebook/static/7386.bundle.js +1 -1
- notebook/static/7391.bundle.js +1 -1
- notebook/static/7450.bundle.js +1 -1
- notebook/static/7543.bundle.js +1 -1
- notebook/static/755.bundle.js +1 -1
- notebook/static/7603.bundle.js +1 -1
- notebook/static/7639.bundle.js +1 -1
- notebook/static/7655.bundle.js +1 -1
- notebook/static/{4427.bundle.js → 7674.bundle.js} +1 -1
- notebook/static/7684.bundle.js +1 -1
- notebook/static/7812.bundle.js +1 -1
- notebook/static/7819.bundle.js +1 -1
- notebook/static/7821.bundle.js +1 -1
- notebook/static/7854.bundle.js +1 -1
- notebook/static/7866.bundle.js +1 -0
- notebook/static/7900.bundle.js +1 -1
- notebook/static/7906.bundle.js +1 -1
- notebook/static/7995.bundle.js +1 -1
- notebook/static/8010.bundle.js +1 -1
- notebook/static/8032.bundle.js +1 -1
- notebook/static/8471.bundle.js +1 -1
- notebook/static/8579.bundle.js +1 -1
- notebook/static/8633.bundle.js +1 -1
- notebook/static/8635.bundle.js +41 -0
- notebook/static/8771.bundle.js +1 -1
- notebook/static/8781.bundle.js +1 -1
- notebook/static/8875.bundle.js +1 -1
- notebook/static/8907.bundle.js +1 -1
- notebook/static/8928.bundle.js +1 -1
- notebook/static/8929.bundle.js +1 -1
- notebook/static/893.bundle.js +1 -1
- notebook/static/901.bundle.js +1 -1
- notebook/static/9068.bundle.js +1 -1
- notebook/static/911.bundle.js +1 -1
- notebook/static/9136.bundle.js +1 -1
- notebook/static/9151.bundle.js +1 -1
- notebook/static/9161.bundle.js +1 -1
- notebook/static/9268.bundle.js +1 -1
- notebook/static/9335.bundle.js +1 -1
- notebook/static/9341.bundle.js +1 -1
- notebook/static/9380.bundle.js +1 -1
- notebook/static/9605.bundle.js +1 -1
- notebook/static/9638.bundle.js +1 -1
- notebook/static/9672.bundle.js +352 -0
- notebook/static/9680.bundle.js +1 -1
- notebook/static/9685.bundle.js +1 -1
- notebook/static/9752.bundle.js +1 -1
- notebook/static/9799.bundle.js +1 -0
- notebook/static/9821.bundle.js +1 -1
- notebook/static/9852.bundle.js +1 -1
- notebook/static/bundle.js +1 -1
- notebook/static/third-party-licenses.json +127 -133
- notebook/templates/consoles.html +1 -1
- notebook/templates/edit.html +1 -1
- notebook/templates/error.html +1 -1
- notebook/templates/notebooks.html +1 -1
- notebook/templates/terminals.html +1 -1
- notebook/templates/tree.html +1 -1
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/package.json.orig +17 -17
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/documentsearch-extension/package.json.orig +5 -5
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/package.json.orig +6 -6
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/package.json.orig +11 -11
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/package.json.orig +18 -18
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/widget.json +0 -1
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/package.json +13 -13
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/package.json.orig +12 -12
- notebook-7.3.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.6d49b092e49dc147dc54.js → notebook-7.3.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.67f8b11d2af855286118.js +1 -1
- notebook-7.3.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/646.57a345a80ce9f0e64830.js → notebook-7.3.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/907.767373e59d0c0e33ef12.js +1 -1
- notebook-7.3.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.7bcc163b9139ecb2b25b.js → notebook-7.3.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.50419fa0a72e54064396.js +1 -1
- notebook-7.3.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.fd0956ebf15f666a19f8.js +1 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/third-party-licenses.json +2 -2
- {notebook-7.3.0a0.dist-info → notebook-7.3.0b0.dist-info}/METADATA +2 -2
- {notebook-7.3.0a0.dist-info → notebook-7.3.0b0.dist-info}/RECORD +213 -222
- {notebook-7.3.0a0.dist-info → notebook-7.3.0b0.dist-info}/WHEEL +1 -1
- notebook/static/1226.bundle.js +0 -1
- notebook/static/1750.bundle.js +0 -1
- notebook/static/1884.bundle.js +0 -386
- notebook/static/4045.bundle.js +0 -1
- notebook/static/4434.bundle.js +0 -1
- notebook/static/5018.bundle.js +0 -1
- notebook/static/5712.bundle.js +0 -1
- notebook/static/6164.bundle.js +0 -1
- notebook/static/6318.bundle.js +0 -1
- notebook/static/6619.bundle.js +0 -1
- notebook/static/6898.bundle.js +0 -1
- notebook/static/7506.bundle.js +0 -703
- notebook/static/7579.bundle.js +0 -1
- notebook/static/8054.bundle.js +0 -1
- notebook/static/8647.bundle.js +0 -1
- notebook/static/8723.bundle.js +0 -1
- notebook/static/9092.bundle.js +0 -1
- notebook/static/9734.bundle.js +0 -1
- notebook/static/9906.bundle.js +0 -1
- notebook-7.3.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.9381fdb35e72f41d8af1.js +0 -1
- /notebook/static/{7506.bundle.js.LICENSE.txt → 4242.bundle.js.LICENSE.txt} +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/etc/jupyter/jupyter_server_config.d/notebook.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/applications/jupyter-notebook.desktop +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/icons/hicolor/scalable/apps/notebook.svg +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/menus.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/pages.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/shell.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/title.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/top.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/zen.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/open.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/checkpoints.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/edit-notebook-metadata.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/kernel-logo.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/scroll-output.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/interface-switcher.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/launch-tree.json +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/93.eae3497dd223d842d198.js +0 -0
- {notebook-7.3.0a0.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/style.js +0 -0
- {notebook-7.3.0a0.dist-info → notebook-7.3.0b0.dist-info}/entry_points.txt +0 -0
- {notebook-7.3.0a0.dist-info → notebook-7.3.0b0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[2424],{63956:(e,t,n)=>{n.d(t,{k:()=>j});var s=n(68866),o=n(80189),i=n(25269),a=n(58545),r=n(41681);const l=e=>"function"==typeof e,d=()=>null;function c(e){return void 0===e?d:l(e)?e:()=>e}function h(e,t,n){const s=l(e)?e:()=>e,o=c(t),i=c(n);return(e,t)=>s(e,t)?o(e,t):i(e,t)}var p=n(62564),g=n(17832),u=n(52865),m=n(12634),f=n(27002),b=n(21601),x=n(58201),v=n(61424),$=n(98242),y=n(30550),k=n(87206),C=n(13370);class w{constructor(e,t){this.cache=new WeakMap,this.ltr=e,this.rtl=t}bind(e){this.attach(e)}unbind(e){const t=this.cache.get(e);t&&k.o7.unsubscribe(t)}attach(e){const t=this.cache.get(e)||new F(this.ltr,this.rtl,e),n=k.o7.getValueFor(e);k.o7.subscribe(t),t.attach(n),this.cache.set(e,t)}}class F{constructor(e,t,n){this.ltr=e,this.rtl=t,this.source=n,this.attached=null}handleChange({target:e,token:t}){this.attach(t.getValueFor(e))}attach(e){this.attached!==this[e]&&(null!==this.attached&&this.source.$fastController.removeStyles(this.attached),this.attached=this[e],null!==this.attached&&this.source.$fastController.addStyles(this.attached))}}const I=m.j`(((${k.nf} + ${k.hV}) * 0.5 + 2) * ${k._5})`,T=m.i`
|
|
2
|
+
.expand-collapse-glyph {
|
|
3
|
+
transform: rotate(0deg);
|
|
4
|
+
}
|
|
5
|
+
:host(.nested) .expand-collapse-button {
|
|
6
|
+
left: var(
|
|
7
|
+
--expand-collapse-button-nested-width,
|
|
8
|
+
calc(
|
|
9
|
+
(
|
|
10
|
+
${I} +
|
|
11
|
+
((${k.nf} + ${k.hV}) * 1.25)
|
|
12
|
+
) * -1px
|
|
13
|
+
)
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
:host([selected])::after {
|
|
17
|
+
left: calc(${k.vx} * 1px);
|
|
18
|
+
}
|
|
19
|
+
:host([expanded]) > .positioning-region .expand-collapse-glyph {
|
|
20
|
+
transform: rotate(90deg);
|
|
21
|
+
}
|
|
22
|
+
`,E=m.i`
|
|
23
|
+
.expand-collapse-glyph {
|
|
24
|
+
transform: rotate(180deg);
|
|
25
|
+
}
|
|
26
|
+
:host(.nested) .expand-collapse-button {
|
|
27
|
+
right: var(
|
|
28
|
+
--expand-collapse-button-nested-width,
|
|
29
|
+
calc(
|
|
30
|
+
(
|
|
31
|
+
${I} +
|
|
32
|
+
((${k.nf} + ${k.hV}) * 1.25)
|
|
33
|
+
) * -1px
|
|
34
|
+
)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
:host([selected])::after {
|
|
38
|
+
right: calc(${k.vx} * 1px);
|
|
39
|
+
}
|
|
40
|
+
:host([expanded]) > .positioning-region .expand-collapse-glyph {
|
|
41
|
+
transform: rotate(90deg);
|
|
42
|
+
}
|
|
43
|
+
`,L=f.DesignToken.create("tree-item-expand-collapse-hover").withDefault((e=>{const t=k.DF.getValueFor(e);return t.evaluate(e,t.evaluate(e).hover).hover})),O=f.DesignToken.create("tree-item-expand-collapse-selected-hover").withDefault((e=>{const t=k.At.getValueFor(e);return k.DF.getValueFor(e).evaluate(e,t.evaluate(e).rest).hover}));class S extends o.k{}const H=S.compose({baseName:"tree-item",baseClass:o.k,template:(e,t)=>i.d`
|
|
44
|
+
<template
|
|
45
|
+
role="treeitem"
|
|
46
|
+
slot="${e=>e.isNestedItem()?"item":void 0}"
|
|
47
|
+
tabindex="-1"
|
|
48
|
+
class="${e=>e.expanded?"expanded":""} ${e=>e.selected?"selected":""} ${e=>e.nested?"nested":""}
|
|
49
|
+
${e=>e.disabled?"disabled":""}"
|
|
50
|
+
aria-expanded="${e=>e.childItems&&e.childItemLength()>0?e.expanded:void 0}"
|
|
51
|
+
aria-selected="${e=>e.selected}"
|
|
52
|
+
aria-disabled="${e=>e.disabled}"
|
|
53
|
+
@focusin="${(e,t)=>e.handleFocus(t.event)}"
|
|
54
|
+
@focusout="${(e,t)=>e.handleBlur(t.event)}"
|
|
55
|
+
${(0,a.p)({property:"childItems",filter:(0,r.R)()})}
|
|
56
|
+
>
|
|
57
|
+
<div class="positioning-region" part="positioning-region">
|
|
58
|
+
<div class="content-region" part="content-region">
|
|
59
|
+
${h((e=>e.childItems&&e.childItemLength()>0),i.d`
|
|
60
|
+
<div
|
|
61
|
+
aria-hidden="true"
|
|
62
|
+
class="expand-collapse-button"
|
|
63
|
+
part="expand-collapse-button"
|
|
64
|
+
@click="${(e,t)=>e.handleExpandCollapseButtonClick(t.event)}"
|
|
65
|
+
${(0,p.i)("expandCollapseButton")}
|
|
66
|
+
>
|
|
67
|
+
<slot name="expand-collapse-glyph">
|
|
68
|
+
${t.expandCollapseGlyph||""}
|
|
69
|
+
</slot>
|
|
70
|
+
</div>
|
|
71
|
+
`)}
|
|
72
|
+
${(0,u.m9)(e,t)}
|
|
73
|
+
<slot></slot>
|
|
74
|
+
${(0,u.LC)(e,t)}
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
${h((e=>e.childItems&&e.childItemLength()>0&&(e.expanded||e.renderCollapsedChildren)),i.d`
|
|
78
|
+
<div role="group" class="items" part="items">
|
|
79
|
+
<slot name="item" ${(0,g.Q)("items")}></slot>
|
|
80
|
+
</div>
|
|
81
|
+
`)}
|
|
82
|
+
</template>
|
|
83
|
+
`,styles:(e,t)=>m.i`
|
|
84
|
+
/**
|
|
85
|
+
* This animation exists because when tree item children are conditionally loaded
|
|
86
|
+
* there is a visual bug where the DOM exists but styles have not yet been applied (essentially FOUC).
|
|
87
|
+
* This subtle animation provides a ever so slight timing adjustment for loading that solves the issue.
|
|
88
|
+
*/
|
|
89
|
+
@keyframes treeItemLoading {
|
|
90
|
+
0% {
|
|
91
|
+
opacity: 0;
|
|
92
|
+
}
|
|
93
|
+
100% {
|
|
94
|
+
opacity: 1;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
${(0,b.j)("block")} :host {
|
|
99
|
+
contain: content;
|
|
100
|
+
position: relative;
|
|
101
|
+
outline: none;
|
|
102
|
+
color: ${k.hY};
|
|
103
|
+
background: ${k.jq};
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
font-family: ${k.SV};
|
|
106
|
+
--tree-item-nested-width: 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
:host(:focus) > .positioning-region {
|
|
110
|
+
outline: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
:host(:focus) .content-region {
|
|
114
|
+
outline: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
:host(:${x.b}) .positioning-region {
|
|
118
|
+
border-color: ${k.D8};
|
|
119
|
+
box-shadow: 0 0 0 calc((${k.vx} - ${k.H}) * 1px)
|
|
120
|
+
${k.D8} inset;
|
|
121
|
+
color: ${k.hY};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.positioning-region {
|
|
125
|
+
display: flex;
|
|
126
|
+
position: relative;
|
|
127
|
+
box-sizing: border-box;
|
|
128
|
+
background: ${k.jq};
|
|
129
|
+
border: transparent calc(${k.H} * 1px) solid;
|
|
130
|
+
border-radius: calc(${k.UW} * 1px);
|
|
131
|
+
height: calc((${C.i} + 1) * 1px);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.positioning-region::before {
|
|
135
|
+
content: '';
|
|
136
|
+
display: block;
|
|
137
|
+
width: var(--tree-item-nested-width);
|
|
138
|
+
flex-shrink: 0;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
:host(:not([disabled])) .positioning-region:hover {
|
|
142
|
+
background: ${k.Qp};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:host(:not([disabled])) .positioning-region:active {
|
|
146
|
+
background: ${k.sG};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.content-region {
|
|
150
|
+
display: inline-flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
white-space: nowrap;
|
|
153
|
+
width: 100%;
|
|
154
|
+
min-width: 0;
|
|
155
|
+
height: calc(${C.i} * 1px);
|
|
156
|
+
margin-inline-start: calc(${k._5} * 2px + 8px);
|
|
157
|
+
font-size: ${k.cS};
|
|
158
|
+
line-height: ${k.RU};
|
|
159
|
+
font-weight: 400;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.items {
|
|
163
|
+
/* TODO: adaptive typography https://github.com/microsoft/fast/issues/2432 */
|
|
164
|
+
font-size: calc(1em + (${k._5} + 16) * 1px);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.expand-collapse-button {
|
|
168
|
+
background: none;
|
|
169
|
+
border: none;
|
|
170
|
+
outline: none;
|
|
171
|
+
/* TODO: adaptive typography https://github.com/microsoft/fast/issues/2432 */
|
|
172
|
+
width: calc(${I} * 1px);
|
|
173
|
+
height: calc(${I} * 1px);
|
|
174
|
+
padding: 0;
|
|
175
|
+
display: flex;
|
|
176
|
+
justify-content: center;
|
|
177
|
+
align-items: center;
|
|
178
|
+
cursor: pointer;
|
|
179
|
+
margin-left: 6px;
|
|
180
|
+
margin-right: 6px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.expand-collapse-glyph {
|
|
184
|
+
/* TODO: adaptive typography https://github.com/microsoft/fast/issues/2432 */
|
|
185
|
+
width: calc((16 + ${k.hV}) * 1px);
|
|
186
|
+
height: calc((16 + ${k.hV}) * 1px);
|
|
187
|
+
transition: transform 0.1s linear;
|
|
188
|
+
|
|
189
|
+
pointer-events: none;
|
|
190
|
+
fill: currentcolor;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.start,
|
|
194
|
+
.end {
|
|
195
|
+
display: flex;
|
|
196
|
+
fill: currentcolor;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
::slotted(svg) {
|
|
200
|
+
/* TODO: adaptive typography https://github.com/microsoft/fast/issues/2432 */
|
|
201
|
+
width: 16px;
|
|
202
|
+
height: 16px;
|
|
203
|
+
|
|
204
|
+
/* Something like that would do if the typography is adaptive
|
|
205
|
+
font-size: inherit;
|
|
206
|
+
width: ${k.Pw};
|
|
207
|
+
height: ${k.Pw};
|
|
208
|
+
*/
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.start {
|
|
212
|
+
/* TODO: horizontalSpacing https://github.com/microsoft/fast/issues/2766 */
|
|
213
|
+
margin-inline-end: calc(${k._5} * 2px + 2px);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.end {
|
|
217
|
+
/* TODO: horizontalSpacing https://github.com/microsoft/fast/issues/2766 */
|
|
218
|
+
margin-inline-start: calc(${k._5} * 2px + 2px);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
:host([expanded]) > .items {
|
|
222
|
+
animation: treeItemLoading ease-in 10ms;
|
|
223
|
+
animation-iteration-count: 1;
|
|
224
|
+
animation-fill-mode: forwards;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
:host([disabled]) .content-region {
|
|
228
|
+
opacity: ${k.VF};
|
|
229
|
+
cursor: ${v.H};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
:host(.nested) .content-region {
|
|
233
|
+
position: relative;
|
|
234
|
+
/* Add left margin to collapse button size */
|
|
235
|
+
margin-inline-start: calc(
|
|
236
|
+
(
|
|
237
|
+
${I} +
|
|
238
|
+
((${k.nf} + ${k.hV}) * 1.25)
|
|
239
|
+
) * 1px
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
:host(.nested) .expand-collapse-button {
|
|
244
|
+
position: absolute;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
:host(.nested:not([disabled])) .expand-collapse-button:hover {
|
|
248
|
+
background: ${L};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
:host([selected]) .positioning-region {
|
|
252
|
+
background: ${k.wF};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
:host([selected]:not([disabled])) .positioning-region:hover {
|
|
256
|
+
background: ${k.Xi};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
:host([selected]:not([disabled])) .positioning-region:active {
|
|
260
|
+
background: ${k.Gy};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
:host([selected]:not([disabled])) .expand-collapse-button:hover {
|
|
264
|
+
background: ${O};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
:host([selected])::after {
|
|
268
|
+
/* The background needs to be calculated based on the selected background state
|
|
269
|
+
for this control. We currently have no way of changing that, so setting to
|
|
270
|
+
accent-foreground-rest for the time being */
|
|
271
|
+
background: ${k.go};
|
|
272
|
+
border-radius: calc(${k.UW} * 1px);
|
|
273
|
+
content: '';
|
|
274
|
+
display: block;
|
|
275
|
+
position: absolute;
|
|
276
|
+
top: calc((${C.i} / 4) * 1px);
|
|
277
|
+
width: 3px;
|
|
278
|
+
height: calc((${C.i} / 2) * 1px);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
::slotted(${e.tagFor(o.k)}) {
|
|
282
|
+
--tree-item-nested-width: 1em;
|
|
283
|
+
--expand-collapse-button-nested-width: calc(
|
|
284
|
+
(
|
|
285
|
+
${I} +
|
|
286
|
+
((${k.nf} + ${k.hV}) * 1.25)
|
|
287
|
+
) * -1px
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
`.withBehaviors(new w(T,E),(0,$.vF)(m.i`
|
|
291
|
+
:host {
|
|
292
|
+
forced-color-adjust: none;
|
|
293
|
+
border-color: transparent;
|
|
294
|
+
background: ${y.H.Field};
|
|
295
|
+
color: ${y.H.FieldText};
|
|
296
|
+
}
|
|
297
|
+
:host .content-region .expand-collapse-glyph {
|
|
298
|
+
fill: ${y.H.FieldText};
|
|
299
|
+
}
|
|
300
|
+
:host .positioning-region:hover,
|
|
301
|
+
:host([selected]) .positioning-region {
|
|
302
|
+
background: ${y.H.Highlight};
|
|
303
|
+
}
|
|
304
|
+
:host .positioning-region:hover .content-region,
|
|
305
|
+
:host([selected]) .positioning-region .content-region {
|
|
306
|
+
color: ${y.H.HighlightText};
|
|
307
|
+
}
|
|
308
|
+
:host .positioning-region:hover .content-region .expand-collapse-glyph,
|
|
309
|
+
:host .positioning-region:hover .content-region .start,
|
|
310
|
+
:host .positioning-region:hover .content-region .end,
|
|
311
|
+
:host([selected]) .content-region .expand-collapse-glyph,
|
|
312
|
+
:host([selected]) .content-region .start,
|
|
313
|
+
:host([selected]) .content-region .end {
|
|
314
|
+
fill: ${y.H.HighlightText};
|
|
315
|
+
}
|
|
316
|
+
:host([selected])::after {
|
|
317
|
+
background: ${y.H.Field};
|
|
318
|
+
}
|
|
319
|
+
:host(:${x.b}) .positioning-region {
|
|
320
|
+
border-color: ${y.H.FieldText};
|
|
321
|
+
box-shadow: 0 0 0 2px inset ${y.H.Field};
|
|
322
|
+
color: ${y.H.FieldText};
|
|
323
|
+
}
|
|
324
|
+
:host([disabled]) .content-region,
|
|
325
|
+
:host([disabled]) .positioning-region:hover .content-region {
|
|
326
|
+
opacity: 1;
|
|
327
|
+
color: ${y.H.GrayText};
|
|
328
|
+
}
|
|
329
|
+
:host([disabled]) .content-region .expand-collapse-glyph,
|
|
330
|
+
:host([disabled]) .content-region .start,
|
|
331
|
+
:host([disabled]) .content-region .end,
|
|
332
|
+
:host([disabled])
|
|
333
|
+
.positioning-region:hover
|
|
334
|
+
.content-region
|
|
335
|
+
.expand-collapse-glyph,
|
|
336
|
+
:host([disabled]) .positioning-region:hover .content-region .start,
|
|
337
|
+
:host([disabled]) .positioning-region:hover .content-region .end {
|
|
338
|
+
fill: ${y.H.GrayText};
|
|
339
|
+
}
|
|
340
|
+
:host([disabled]) .positioning-region:hover {
|
|
341
|
+
background: ${y.H.Field};
|
|
342
|
+
}
|
|
343
|
+
.expand-collapse-glyph,
|
|
344
|
+
.start,
|
|
345
|
+
.end {
|
|
346
|
+
fill: ${y.H.FieldText};
|
|
347
|
+
}
|
|
348
|
+
:host(.nested) .expand-collapse-button:hover {
|
|
349
|
+
background: ${y.H.Field};
|
|
350
|
+
}
|
|
351
|
+
:host(.nested) .expand-collapse-button:hover .expand-collapse-glyph {
|
|
352
|
+
fill: ${y.H.FieldText};
|
|
353
|
+
}
|
|
354
|
+
`)),expandCollapseGlyph:'\n <svg\n viewBox="0 0 16 16"\n xmlns="http://www.w3.org/2000/svg"\n class="expand-collapse-glyph"\n >\n <path\n d="M5.00001 12.3263C5.00124 12.5147 5.05566 12.699 5.15699 12.8578C5.25831 13.0167 5.40243 13.1437 5.57273 13.2242C5.74304 13.3047 5.9326 13.3354 6.11959 13.3128C6.30659 13.2902 6.4834 13.2152 6.62967 13.0965L10.8988 8.83532C11.0739 8.69473 11.2153 8.51658 11.3124 8.31402C11.4096 8.11146 11.46 7.88966 11.46 7.66499C11.46 7.44033 11.4096 7.21853 11.3124 7.01597C11.2153 6.81341 11.0739 6.63526 10.8988 6.49467L6.62967 2.22347C6.48274 2.10422 6.30501 2.02912 6.11712 2.00691C5.92923 1.9847 5.73889 2.01628 5.56823 2.09799C5.39757 2.17969 5.25358 2.30817 5.153 2.46849C5.05241 2.62882 4.99936 2.8144 5.00001 3.00369V12.3263Z"\n />\n </svg>\n '});var N=n(78156),V=n.n(N),D=n(4444);(0,s.W)().register(H());const j=(0,N.forwardRef)(((e,t)=>{const n=(0,N.useRef)(null),{className:s,expanded:o,selected:i,disabled:a,...r}=e;(0,D.O)(n,"expanded-change",e.onExpand),(0,D.O)(n,"selected-change",e.onSelect),(0,D.h)(n,"expanded",e.expanded),(0,D.h)(n,"selected",e.selected),(0,D.h)(n,"disabled",e.disabled),(0,N.useImperativeHandle)(t,(()=>n.current),[n.current]);let l=s??"";return n.current?.nested&&(l+=" nested"),V().createElement("jp-tree-item",{ref:n,...r,class:l.trim(),exportparts:e.exportparts,for:e.htmlFor,part:e.part,tabindex:e.tabIndex,style:{...e.style}},e.children)}))},55947:(e,t,n)=>{n.d(t,{L:()=>k});var s=n(68866),o=n(95185),i=n(91211),a=n(98332),r=n(92221),l=n(27081),d=n(99415),c=n(80189),h=n(50755);class p extends h.I{constructor(){super(...arguments),this.currentFocused=null,this.handleFocus=e=>{if(!(this.slottedTreeItems.length<1))return e.target===this?(null===this.currentFocused&&(this.currentFocused=this.getValidFocusableItem()),void(null!==this.currentFocused&&c.k.focusItem(this.currentFocused))):void(this.contains(e.target)&&(this.setAttribute("tabindex","-1"),this.currentFocused=e.target))},this.handleBlur=e=>{e.target instanceof HTMLElement&&(null===e.relatedTarget||!this.contains(e.relatedTarget))&&this.setAttribute("tabindex","0")},this.handleKeyDown=e=>{if(e.defaultPrevented)return;if(this.slottedTreeItems.length<1)return!0;const t=this.getVisibleNodes();switch(e.key){case l.tU:return void(t.length&&c.k.focusItem(t[0]));case l.Kh:return void(t.length&&c.k.focusItem(t[t.length-1]));case l.BE:if(e.target&&this.isFocusableElement(e.target)){const t=e.target;t instanceof c.k&&t.childItemLength()>0&&t.expanded?t.expanded=!1:t instanceof c.k&&t.parentElement instanceof c.k&&c.k.focusItem(t.parentElement)}return!1;case l.mr:if(e.target&&this.isFocusableElement(e.target)){const t=e.target;t instanceof c.k&&t.childItemLength()>0&&!t.expanded?t.expanded=!0:t instanceof c.k&&t.childItemLength()>0&&this.focusNextNode(1,e.target)}return;case l.iF:return void(e.target&&this.isFocusableElement(e.target)&&this.focusNextNode(1,e.target));case l.SB:return void(e.target&&this.isFocusableElement(e.target)&&this.focusNextNode(-1,e.target));case l.kL:return void this.handleClick(e)}return!0},this.handleSelectedChange=e=>{if(e.defaultPrevented)return;if(!(e.target instanceof Element&&(0,c.t)(e.target)))return!0;const t=e.target;t.selected?(this.currentSelected&&this.currentSelected!==t&&(this.currentSelected.selected=!1),this.currentSelected=t):t.selected||this.currentSelected!==t||(this.currentSelected=null)},this.setItems=()=>{const e=this.treeView.querySelector("[aria-selected='true']");this.currentSelected=e,null!==this.currentFocused&&this.contains(this.currentFocused)||(this.currentFocused=this.getValidFocusableItem()),this.nested=this.checkForNestedItems(),this.getVisibleNodes().forEach((e=>{(0,c.t)(e)&&(e.nested=this.nested)}))},this.isFocusableElement=e=>(0,c.t)(e),this.isSelectedElement=e=>e.selected}slottedTreeItemsChanged(){this.$fastController.isConnected&&this.setItems()}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),i.SO.queueUpdate((()=>{this.setItems()}))}handleClick(e){if(e.defaultPrevented)return;if(!(e.target instanceof Element&&(0,c.t)(e.target)))return!0;const t=e.target;t.disabled||(t.selected=!t.selected)}focusNextNode(e,t){const n=this.getVisibleNodes();if(!n)return;const s=n[n.indexOf(t)+e];(0,d.Re)(s)&&c.k.focusItem(s)}getValidFocusableItem(){const e=this.getVisibleNodes();let t=e.findIndex(this.isSelectedElement);return-1===t&&(t=e.findIndex(this.isFocusableElement)),-1!==t?e[t]:null}checkForNestedItems(){return this.slottedTreeItems.some((e=>(0,c.t)(e)&&e.querySelector("[role='treeitem']")))}getVisibleNodes(){return(0,d.UM)(this,"[role='treeitem']")||[]}}(0,o.gn)([(0,a.Lj)({attribute:"render-collapsed-nodes"})],p.prototype,"renderCollapsedNodes",void 0),(0,o.gn)([r.LO],p.prototype,"currentSelected",void 0),(0,o.gn)([r.LO],p.prototype,"slottedTreeItems",void 0);var g=n(25269),u=n(62564),m=n(17832),f=n(12634),b=n(21601);const x=class extends p{handleClick(e){if(e.defaultPrevented)return;if(!(e.target instanceof Element))return!0;let t=e.target;for(;t&&!(0,c.t)(t);)t=t.parentElement,t===this&&(t=null);t&&!t.disabled&&(t.selected=!0)}}.compose({baseName:"tree-view",baseClass:p,template:(e,t)=>g.d`
|
|
355
|
+
<template
|
|
356
|
+
role="tree"
|
|
357
|
+
${(0,u.i)("treeView")}
|
|
358
|
+
@keydown="${(e,t)=>e.handleKeyDown(t.event)}"
|
|
359
|
+
@focusin="${(e,t)=>e.handleFocus(t.event)}"
|
|
360
|
+
@focusout="${(e,t)=>e.handleBlur(t.event)}"
|
|
361
|
+
@click="${(e,t)=>e.handleClick(t.event)}"
|
|
362
|
+
@selected-change="${(e,t)=>e.handleSelectedChange(t.event)}"
|
|
363
|
+
>
|
|
364
|
+
<slot ${(0,m.Q)("slottedTreeItems")}></slot>
|
|
365
|
+
</template>
|
|
366
|
+
`,styles:(e,t)=>f.i`
|
|
367
|
+
${(0,b.j)("flex")} :host {
|
|
368
|
+
flex-direction: column;
|
|
369
|
+
align-items: stretch;
|
|
370
|
+
min-width: fit-content;
|
|
371
|
+
font-size: 0;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
:host:focus-visible {
|
|
375
|
+
outline: none;
|
|
376
|
+
}
|
|
377
|
+
`});var v=n(78156),$=n.n(v),y=n(4444);(0,s.W)().register(x());const k=(0,v.forwardRef)(((e,t)=>{const n=(0,v.useRef)(null),{className:s,renderCollapsedNodes:o,currentSelected:i,...a}=e;return(0,v.useLayoutEffect)((()=>{n.current?.setItems()}),[n.current]),(0,y.h)(n,"currentSelected",e.currentSelected),(0,v.useImperativeHandle)(t,(()=>n.current),[n.current]),$().createElement("jp-tree-view",{ref:n,...a,class:e.className,exportparts:e.exportparts,for:e.htmlFor,part:e.part,tabindex:e.tabIndex,"render-collapsed-nodes":e.renderCollapsedNodes?"":void 0,style:{...e.style}},e.children)}))},80189:(e,t,n)=>{n.d(t,{k:()=>h,t:()=>c});var s=n(95185),o=n(98332),i=n(92221),a=n(99415),r=n(52865),l=n(89155),d=n(50755);function c(e){return(0,a.Re)(e)&&"treeitem"===e.getAttribute("role")}class h extends d.I{constructor(){super(...arguments),this.expanded=!1,this.focusable=!1,this.isNestedItem=()=>c(this.parentElement),this.handleExpandCollapseButtonClick=e=>{this.disabled||e.defaultPrevented||(this.expanded=!this.expanded)},this.handleFocus=e=>{this.setAttribute("tabindex","0")},this.handleBlur=e=>{this.setAttribute("tabindex","-1")}}expandedChanged(){this.$fastController.isConnected&&this.$emit("expanded-change",this)}selectedChanged(){this.$fastController.isConnected&&this.$emit("selected-change",this)}itemsChanged(e,t){this.$fastController.isConnected&&this.items.forEach((e=>{c(e)&&(e.nested=!0)}))}static focusItem(e){e.focusable=!0,e.focus()}childItemLength(){const e=this.childItems.filter((e=>c(e)));return e?e.length:0}}(0,s.gn)([(0,o.Lj)({mode:"boolean"})],h.prototype,"expanded",void 0),(0,s.gn)([(0,o.Lj)({mode:"boolean"})],h.prototype,"selected",void 0),(0,s.gn)([(0,o.Lj)({mode:"boolean"})],h.prototype,"disabled",void 0),(0,s.gn)([i.LO],h.prototype,"focusable",void 0),(0,s.gn)([i.LO],h.prototype,"childItems",void 0),(0,s.gn)([i.LO],h.prototype,"items",void 0),(0,s.gn)([i.LO],h.prototype,"nested",void 0),(0,s.gn)([i.LO],h.prototype,"renderCollapsedChildren",void 0),(0,l.e)(h,r.hW)}}]);
|
notebook/static/2479.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[2479],{72479:(e,t,s)=>{s.r(t),s.d(t,{AttachmentsCell:()=>ge,AttachmentsCellModel:()=>I,Cell:()=>ue,CellDragUtils:()=>l,CellFooter:()=>v,CellHeader:()=>_,CellModel:()=>A,CellSearchProvider:()=>B,CodeCell:()=>pe,CodeCellLayout:()=>ce,CodeCellModel:()=>k,Collapser:()=>p,InputArea:()=>w,InputCollapser:()=>g,InputPlaceholder:()=>W,InputPrompt:()=>f,MarkdownCell:()=>me,MarkdownCellModel:()=>j,OutputCollapser:()=>m,OutputPlaceholder:()=>L,Placeholder:()=>F,RawCell:()=>Ce,RawCellModel:()=>D,SELECTED_HIGHLIGHT_CLASS:()=>z,createCellSearchProvider:()=>J,isCodeCellModel:()=>E,isMarkdownCellModel:()=>H,isRawCellModel:()=>b});var i=s(24475);const n="jp-dragImage",o="jp-dragImage-singlePrompt",r="jp-dragImage-content",a="jp-dragImage-prompt",d="jp-dragImage-multipleBack";var l;!function(e){e.findCell=function(e,t,s){let i=-1;for(;e&&e.parentElement;){if(s(e)){let s=-1;for(const n of t)if(n.node===e){i=++s;break}break}e=e.parentElement}return i},e.detectTargetArea=function(e,t){var s,i;let n;return n=e?(null===(s=e.editorWidget)||void 0===s?void 0:s.node.contains(t))?"input":(null===(i=e.promptNode)||void 0===i?void 0:i.contains(t))?"prompt":"cell":"unknown",n},e.shouldStartDrag=function(e,t,s,i){const n=Math.abs(s-e),o=Math.abs(i-t);return n>=5||o>=5},e.createCellDragImage=function(e,t){const s=t.length;let l;if("code"===e.model.type){const t=e.model.executionCount;l=" ",t&&(l=t.toString())}else l="";const h=e.model.sharedModel.getSource().split("\n")[0].slice(0,26);return s>1?""!==l?i.VirtualDOM.realize(i.h.div(i.h.div({className:n},i.h.span({className:a},"["+l+"]:"),i.h.span({className:r},h)),i.h.div({className:d},""))):i.VirtualDOM.realize(i.h.div(i.h.div({className:n},i.h.span({className:a}),i.h.span({className:r},h)),i.h.div({className:d},""))):""!==l?i.VirtualDOM.realize(i.h.div(i.h.div({className:`${n} ${o}`},i.h.span({className:a},"["+l+"]:"),i.h.span({className:r},h)))):i.VirtualDOM.realize(i.h.div(i.h.div({className:`${n} ${o}`},i.h.span({className:a}),i.h.span({className:r},h))))}}(l||(l={}));var h=s(95291),u=s(18395),c=s(78156);class p extends h.ReactWidget{constructor(){super(),this.addClass("jp-Collapser")}get collapsed(){return!1}render(){return c.createElement("div",{className:"jp-Collapser-child",onClick:e=>this.handleClick(e)})}}class g extends p{constructor(){super(),this.addClass("jp-InputCollapser")}get collapsed(){var e;const t=null===(e=this.parent)||void 0===e?void 0:e.parent;return!!t&&t.inputHidden}handleClick(e){var t;const s=null===(t=this.parent)||void 0===t?void 0:t.parent;s&&(s.inputHidden=!s.inputHidden),this.update()}}class m extends p{constructor(){super(),this.addClass("jp-OutputCollapser")}get collapsed(){var e;const t=null===(e=this.parent)||void 0===e?void 0:e.parent;return!!t&&t.outputHidden}handleClick(e){var t,s;const i=null===(t=this.parent)||void 0===t?void 0:t.parent;if(i&&(i.outputHidden=!i.outputHidden,i.outputHidden)){let e=null===(s=i.parent)||void 0===s?void 0:s.node;e&&u.ElementExt.scrollIntoViewIfNeeded(e,i.node)}this.update()}}var C=s(63485);class _ extends C.Widget{constructor(){super(),this.addClass("jp-CellHeader")}}class v extends C.Widget{constructor(){super(),this.addClass("jp-CellFooter")}}var y=s(63242);class w extends C.Widget{constructor(e){super(),this.addClass("jp-InputArea");const{contentFactory:t,editorOptions:s,model:i}=e;this.model=i,this.contentFactory=t;const n=this._prompt=t.createInputPrompt();n.addClass("jp-InputArea-prompt");const o=this._editor=new y.CodeEditorWrapper({factory:t.editorFactory,model:i,editorOptions:s});o.addClass("jp-InputArea-editor");const r=this.layout=new C.PanelLayout;r.addWidget(n),r.addWidget(o)}get editorWidget(){return this._editor}get editor(){return this._editor.editor}get promptNode(){return this._prompt.node}get renderedInput(){return this._rendered}renderInput(e){const t=this.layout;this._rendered&&(this._rendered.parent=null),this._editor.hide(),this._rendered=e,t.addWidget(e)}showEditor(){this._rendered&&(this._rendered.parent=null),this._editor.show()}setPrompt(e){this._prompt.executionCount=e}dispose(){this.isDisposed||(this._prompt=null,this._editor=null,this._rendered=null,super.dispose())}}!function(e){e.ContentFactory=class{constructor(e){this._editor=e.editorFactory}get editorFactory(){return this._editor}createInputPrompt(){return new f}}}(w||(w={}));class f extends C.Widget{constructor(){super(),this._executionCount=null,this.addClass("jp-InputPrompt")}get executionCount(){return this._executionCount}set executionCount(e){this._executionCount=e,this.node.textContent=null===e?" ":`[${e||" "}]:`}}var x=s(81997),M=s(99122),O=s(1761),P=s(57508);const S=(0,P.createMutex)();function E(e){return"code"===e.type}function H(e){return"markdown"===e.type}function b(e){return"raw"===e.type}class A extends y.CodeEditor.Model{constructor(e={}){const{cell_type:t,sharedModel:s,...i}=e;super({sharedModel:null!=s?s:(0,P.createStandaloneCell)({cell_type:null!=t?t:"raw",id:e.id}),...i}),this.contentChanged=new x.Signal(this),this.stateChanged=new x.Signal(this),this._metadataChanged=new x.Signal(this),this._trusted=!1,this.standaloneModel=void 0===e.sharedModel,this.trusted=!!this.getMetadata("trusted")||!!e.trusted,this.sharedModel.changed.connect(this.onGenericChange,this),this.sharedModel.metadataChanged.connect(this._onMetadataChanged,this)}get metadataChanged(){return this._metadataChanged}get id(){return this.sharedModel.getId()}get metadata(){return this.sharedModel.metadata}get trusted(){return this._trusted}set trusted(e){const t=this.trusted;t!==e&&(this._trusted=e,this.onTrustedChanged(this,{newValue:e,oldValue:t}))}dispose(){this.isDisposed||(this.sharedModel.changed.disconnect(this.onGenericChange,this),this.sharedModel.metadataChanged.disconnect(this._onMetadataChanged,this),super.dispose())}onTrustedChanged(e,t){}deleteMetadata(e){return this.sharedModel.deleteMetadata(e)}getMetadata(e){return this.sharedModel.getMetadata(e)}setMetadata(e,t){void 0===t?this.sharedModel.deleteMetadata(e):this.sharedModel.setMetadata(e,t)}toJSON(){return this.sharedModel.toJSON()}onGenericChange(){this.contentChanged.emit(void 0)}_onMetadataChanged(e,t){this._metadataChanged.emit(t)}}class I extends A{constructor(e){var t;super(e);const s=null!==(t=e.contentFactory)&&void 0!==t?t:I.defaultContentFactory,i=this.sharedModel.getAttachments();this._attachments=s.createAttachmentsModel({values:i}),this._attachments.stateChanged.connect(this.onGenericChange,this),this._attachments.changed.connect(this._onAttachmentsChange,this),this.sharedModel.changed.connect(this._onSharedModelChanged,this)}get attachments(){return this._attachments}dispose(){this.isDisposed||(this._attachments.stateChanged.disconnect(this.onGenericChange,this),this._attachments.changed.disconnect(this._onAttachmentsChange,this),this._attachments.dispose(),this.sharedModel.changed.disconnect(this._onSharedModelChanged,this),super.dispose())}toJSON(){return super.toJSON()}_onAttachmentsChange(e,t){const s=this.sharedModel;S((()=>s.setAttachments(e.toJSON())))}_onSharedModelChanged(e,t){if(t.attachmentsChange){const e=this.sharedModel;S((()=>{var t;return this._attachments.fromJSON(null!==(t=e.getAttachments())&&void 0!==t?t:{})}))}}}!function(e){class t{createAttachmentsModel(e){return new M.AttachmentsModel(e)}}e.ContentFactory=t,e.defaultContentFactory=new t}(I||(I={}));class D extends I{constructor(e={}){super({cell_type:"raw",...e})}get type(){return"raw"}toJSON(){return super.toJSON()}}class j extends I{constructor(e={}){super({cell_type:"markdown",...e}),this.mimeType="text/x-ipythongfm"}get type(){return"markdown"}toJSON(){return super.toJSON()}}class k extends A{constructor(e={}){var t;super({cell_type:"code",...e}),this._executedCode="",this._isDirty=!1;const s=null!==(t=null==e?void 0:e.contentFactory)&&void 0!==t?t:k.defaultContentFactory,i=this.trusted,n=this.sharedModel.getOutputs();this._outputs=s.createOutputArea({trusted:i,values:n}),this.sharedModel.changed.connect(this._onSharedModelChanged,this),this._outputs.changed.connect(this.onGenericChange,this),this._outputs.changed.connect(this.onOutputsChange,this)}get type(){return"code"}get executionCount(){return this.sharedModel.execution_count||null}set executionCount(e){this.sharedModel.execution_count=e||null}get isDirty(){return this._isDirty}set isDirty(e){this._setDirty(e)}get outputs(){return this._outputs}clearExecution(){this.outputs.clear(),this.executionCount=null,this._setDirty(!1),this.sharedModel.deleteMetadata("execution"),this.trusted=!0}dispose(){this.isDisposed||(this.sharedModel.changed.disconnect(this._onSharedModelChanged,this),this._outputs.changed.disconnect(this.onGenericChange,this),this._outputs.changed.disconnect(this.onOutputsChange,this),this._outputs.dispose(),this._outputs=null,super.dispose())}onTrustedChanged(e,t){const s=t.newValue;if(this._outputs&&(this._outputs.trusted=s),s){const e=this.sharedModel,t=e.getMetadata();t.trusted=!0,e.setMetadata(t)}this.stateChanged.emit({name:"trusted",oldValue:t.oldValue,newValue:s})}toJSON(){return super.toJSON()}onOutputsChange(e,t){const s=this.sharedModel;S((()=>{switch(t.type){case"add":{const e=t.newValues.map((e=>e.toJSON()));s.updateOutputs(t.newIndex,t.newIndex,e);break}case"set":{const e=t.newValues.map((e=>e.toJSON()));s.updateOutputs(t.oldIndex,t.oldIndex+e.length,e);break}case"remove":s.updateOutputs(t.oldIndex,t.oldValues.length);break;default:throw new Error(`Invalid event type: ${t.type}`)}}))}_onSharedModelChanged(e,t){t.outputsChange&&S((()=>{this.outputs.clear(),e.getOutputs().forEach((e=>this._outputs.add(e)))})),t.executionCountChange&&(!t.executionCountChange.newValue||!this.isDirty&&t.executionCountChange.oldValue||this._setDirty(!1),this.stateChanged.emit({name:"executionCount",oldValue:t.executionCountChange.oldValue,newValue:t.executionCountChange.newValue})),t.sourceChange&&null!==this.executionCount&&this._setDirty(this._executedCode!==this.sharedModel.getSource().trim())}_setDirty(e){e||(this._executedCode=this.sharedModel.getSource().trim()),e!==this._isDirty&&(this._isDirty=e,this.stateChanged.emit({name:"isDirty",oldValue:!e,newValue:e}))}}!function(e){class t{createOutputArea(e){return new O.OutputAreaModel(e)}}e.ContentFactory=t,e.defaultContentFactory=new t}(k||(k={}));var N=s(70858);class F extends C.Widget{constructor(e){var t,s,i;const n=document.createElement("div");super({node:n});const o=(null!==(t=e.translator)&&void 0!==t?t:N.nullTranslator).load("jupyterlab"),r=document.createElement("div");r.className=null!==(s=e.promptClass)&&void 0!==s?s:"",n.insertAdjacentHTML("afterbegin",r.outerHTML),this._cell=document.createElement("div"),this._cell.classList.add("jp-Placeholder-content"),this._cell.title=o.__("Click to expand");const a=this._cell.appendChild(document.createElement("div"));a.classList.add("jp-Placeholder-contentContainer"),this._textContent=a.appendChild(document.createElement("span")),this._textContent.className="jp-PlaceholderText",this._textContent.innerText=null!==(i=e.text)&&void 0!==i?i:"",n.appendChild(this._cell),h.ellipsesIcon.element({container:a.appendChild(document.createElement("span")),className:"jp-MoreHorizIcon",elementPosition:"center",height:"auto",width:"32px"}),this.addClass("jp-Placeholder"),this._callback=e.callback}set text(e){this._textContent.innerText=e}get text(){return this._textContent.innerText}onAfterAttach(e){super.onAfterAttach(e),this.node.addEventListener("click",this._callback)}onBeforeDetach(e){this.node.removeEventListener("click",this._callback),super.onBeforeDetach(e)}}class W extends F{constructor(e){super({...e,promptClass:"jp-Placeholder-prompt jp-InputPrompt"}),this.addClass("jp-InputPlaceholder")}}class L extends F{constructor(e){super({...e,promptClass:"jp-Placeholder-prompt jp-OutputPrompt"}),this.addClass("jp-OutputPlaceholder")}}var T=s(44033),R=s(65848),V=s(54509);const z="jp-mod-selected";class B extends T.EditorSearchProvider{constructor(e){super(),this.cell=e,this.cell.inViewport||this.cell.editor||(0,R.signalToPromise)(e.inViewportChanged).then((([,e])=>{e&&this.cmHandler.setEditor(this.editor)}))}get editor(){return this.cell.editor}get model(){return this.cell.model}}class U extends B{constructor(e){super(e),this.currentProviderIndex=-1,this.outputsProvider=[];const t=this.cell.outputArea;this._onOutputsChanged(t,t.widgets.length).catch((e=>{console.error("Failed to initialize search on cell outputs.",e)})),t.outputLengthChanged.connect(this._onOutputsChanged,this),t.disposed.connect((()=>{t.outputLengthChanged.disconnect(this._onOutputsChanged)}),this)}get matchesCount(){return this.isActive?super.matchesCount+this.outputsProvider.reduce(((e,t)=>{var s;return e+(null!==(s=t.matchesCount)&&void 0!==s?s:0)}),0):0}async clearHighlight(){await super.clearHighlight(),await Promise.all(this.outputsProvider.map((e=>e.clearHighlight())))}dispose(){this.isDisposed||(super.dispose(),this.outputsProvider.map((e=>{e.dispose()})),this.outputsProvider.length=0)}async highlightNext(e,t){var s;const i=null!==(s=null==t?void 0:t.from)&&void 0!==s?s:"";if(!(0===this.matchesCount||"previous-match"===i&&null!==this.currentIndex&&this.currentIndex+1>=this.cmHandler.matches.length)&&this.isActive){if(-1===this.currentProviderIndex){const s=await super.highlightNext(e,t);if(s)return this.currentIndex=this.cmHandler.currentIndex,s;this.currentProviderIndex=0}for(;this.currentProviderIndex<this.outputsProvider.length;){const e=this.outputsProvider[this.currentProviderIndex],t=await e.highlightNext(!1);if(t)return this.currentIndex=super.matchesCount+this.outputsProvider.slice(0,this.currentProviderIndex).reduce(((e,t)=>{var s;return e+(null!==(s=t.matchesCount)&&void 0!==s?s:0)}),0)+e.currentMatchIndex,t;this.currentProviderIndex+=1}return this.currentProviderIndex=-1,void(this.currentIndex=null)}this.currentIndex=null}async highlightPrevious(){if(0!==this.matchesCount&&this.isActive){for(null===this.currentIndex&&(this.currentProviderIndex=this.outputsProvider.length-1);this.currentProviderIndex>=0;){const e=this.outputsProvider[this.currentProviderIndex],t=await e.highlightPrevious(!1);if(t)return this.currentIndex=super.matchesCount+this.outputsProvider.slice(0,this.currentProviderIndex).reduce(((e,t)=>{var s;return e+(null!==(s=t.matchesCount)&&void 0!==s?s:0)}),0)+e.currentMatchIndex,t;this.currentProviderIndex-=1}const e=await super.highlightPrevious();return e?(this.currentIndex=this.cmHandler.currentIndex,e):void(this.currentIndex=null)}this.currentIndex=null}async startQuery(e,t){await super.startQuery(e,t),!1!==(null==t?void 0:t.output)&&this.isActive&&await Promise.all(this.outputsProvider.map((t=>t.startQuery(e))))}async endQuery(){var e;await super.endQuery(),!1!==(null===(e=this.filters)||void 0===e?void 0:e.output)&&this.isActive&&await Promise.all(this.outputsProvider.map((e=>e.endQuery())))}async _onOutputsChanged(e,t){var s;this.outputsProvider.forEach((e=>{e.dispose()})),this.outputsProvider.length=0,this.currentProviderIndex=-1,this.outputsProvider=this.cell.outputArea.widgets.map((e=>new V.GenericSearchProvider(e))),this.isActive&&this.query&&!1!==(null===(s=this.filters)||void 0===s?void 0:s.output)&&await Promise.all([this.outputsProvider.map((e=>{e.startQuery(this.query)}))]),this._stateChanged.emit()}}class $ extends B{constructor(e){super(e),this._unrenderedByHighlight=!1,this.renderedProvider=new V.GenericSearchProvider(e.renderer)}async clearHighlight(){await super.clearHighlight(),await this.renderedProvider.clearHighlight()}dispose(){this.isDisposed||(super.dispose(),this.renderedProvider.dispose())}async endQuery(){await super.endQuery(),await this.renderedProvider.endQuery()}async highlightNext(e=!0,t){let s;if(!this.isActive)return s;const i=this.cell;if(i.rendered&&this.matchesCount>0){this._unrenderedByHighlight=!0;const e=(0,R.signalToPromise)(i.renderedChanged);i.rendered=!1,await e}return s=await super.highlightNext(e,t),s}async highlightPrevious(){let e;const t=this.cell;if(t.rendered&&this.matchesCount>0){this._unrenderedByHighlight=!0;const e=(0,R.signalToPromise)(t.renderedChanged);t.rendered=!1,await e}return e=await super.highlightPrevious(),e}async startQuery(e,t){await super.startQuery(e,t);const s=this.cell;s.rendered&&this.onRenderedChanged(s,s.rendered),s.renderedChanged.connect(this.onRenderedChanged,this)}async replaceAllMatches(e){const t=await super.replaceAllMatches(e);return this.cell.rendered&&this.cell.update(),t}onRenderedChanged(e,t){var s;this._unrenderedByHighlight||(this.currentIndex=null),this._unrenderedByHighlight=!1,this.isActive&&(t?this.renderedProvider.startQuery(this.query):(null===(s=e.editor)||void 0===s||s.setCursorPosition({column:0,line:0}),this.renderedProvider.endQuery()))}}function J(e){if(e.isPlaceholder())return new B(e);switch(e.model.type){case"code":return new U(e);case"markdown":return new $(e);default:return new B(e)}}var Q=s(97205),q=s(72703),G=s(62514),X=s(85996),Y=s(20998),K=s(33625),Z=s(49503),ee=s(97934);const te="jp-mod-resizedCell";class se extends C.Widget{constructor(e){super(),this.targetNode=e,this._isActive=!1,this._isDragging=!1,this.sizeChanged=new x.Signal(this),this.addClass("jp-CellResizeHandle"),this._resizer=new ee.Throttler((e=>this._resize(e)),50)}dispose(){this._resizer.dispose(),super.dispose()}handleEvent(e){var t,s;switch(e.type){case"dblclick":null===(t=this.targetNode.parentNode)||void 0===t||t.childNodes.forEach((e=>{e.classList.remove(te)})),document.documentElement.style.setProperty("--jp-side-by-side-output-size","1fr"),this._isActive=!1;break;case"mousedown":this._isDragging=!0,this._isActive||(null===(s=this.targetNode.parentNode)||void 0===s||s.childNodes.forEach((e=>{e.classList.add(te)})),this._isActive=!0),window.addEventListener("mousemove",this),window.addEventListener("mouseup",this);break;case"mousemove":this._isActive&&this._isDragging&&this._resizer.invoke(e);break;case"mouseup":this._isDragging=!1,window.removeEventListener("mousemove",this),window.removeEventListener("mouseup",this)}}onAfterAttach(e){this.node.addEventListener("dblclick",this),this.node.addEventListener("mousedown",this),super.onAfterAttach(e)}onBeforeDetach(e){this.node.removeEventListener("dblclick",this),this.node.removeEventListener("mousedown",this),super.onBeforeDetach(e)}_resize(e){const{width:t,x:s}=this.targetNode.getBoundingClientRect(),i=t/(e.clientX-s)-1;if(0<i){const e=Math.max(Math.min(Math.abs(i),50),.05);document.documentElement.style.setProperty("--jp-side-by-side-output-size",`${e}fr`),this.sizeChanged.emit(e)}}}const ie="jp-Cell-outputWrapper",ne="jp-mod-dirty",oe="jp-MarkdownHeadingCollapsed",re="jp-collapseHeadingButton",ae="jp-showHiddenCellsButton",de="jp-mod-rendered",le="jp-mod-noOutputs",he="application/x-jupyter-icontentsrich";class ue extends C.Widget{constructor(e){var t,s,i,n;super(),this.prompt="",this._displayChanged=new x.Signal(this),this._scrollRequested=new x.Signal(this),this._scrollHandlerExtension=Q.EditorView.scrollHandler.of(((e,t,s)=>{const i=null!==this._inViewport&&!this._inViewport;return this._scrollRequested.emit({defaultPrevented:i,scrollWithinCell:()=>{e.dispatch({effects:Q.EditorView.scrollIntoView(t,s)})}}),i})),this._editorConfig={},this._editorExtensions=[],this._inputHidden=!1,this._inViewportChanged=new x.Signal(this),this._readOnly=!1,this._ready=new Y.PromiseDelegate,this._resizeDebouncer=new ee.Debouncer((()=>{this._displayChanged.emit()}),0),this._syncCollapse=!1,this._syncEditable=!1,this.addClass("jp-Cell");const o=this._model=e.model;this.contentFactory=e.contentFactory,this.layout=null!==(t=e.layout)&&void 0!==t?t:new C.PanelLayout,this.translator=null!==(s=e.translator)&&void 0!==s?s:N.nullTranslator,this._editorConfig={searchWithCM:!1,...e.editorConfig},this._editorExtensions=null!==(i=e.editorExtensions)&&void 0!==i?i:[],this._editorExtensions.push(this._scrollHandlerExtension),this._placeholder=!0,this._inViewport=null,this.placeholder=null===(n=e.placeholder)||void 0===n||n,o.metadataChanged.connect(this.onMetadataChanged,this)}initializeState(){return this.loadCollapseState(),this.loadEditableState(),this}get displayChanged(){return this._displayChanged}get inViewport(){var e;return null!==(e=this._inViewport)&&void 0!==e&&e}set inViewport(e){this._inViewport!==e&&(this._inViewport=e,this._inViewportChanged.emit(this._inViewport))}get inViewportChanged(){return this._inViewportChanged}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder!==e&&!1===e&&(this.initializeDOM(),this._placeholder=e,this._ready.resolve())}get promptNode(){return this.placeholder?null:this._inputHidden?this._inputPlaceholder.node.firstElementChild:this._input.promptNode}get editorWidget(){var e,t;return null!==(t=null===(e=this._input)||void 0===e?void 0:e.editorWidget)&&void 0!==t?t:null}get editor(){var e,t;return null!==(t=null===(e=this._input)||void 0===e?void 0:e.editor)&&void 0!==t?t:null}get editorConfig(){return this._editorConfig}get headings(){return new Array}get model(){return this._model}get inputArea(){return this._input}get readOnly(){return this._readOnly}set readOnly(e){e!==this._readOnly&&(this._readOnly=e,this.syncEditable&&this.saveEditableState(),this.update())}isPlaceholder(){return this.placeholder}saveEditableState(){const{sharedModel:e}=this.model,t=e.getMetadata("editable");this.readOnly&&!1===t||!this.readOnly&&void 0===t||(this.readOnly?e.setMetadata("editable",!1):e.deleteMetadata("editable"))}loadEditableState(){this.readOnly=!1===this.model.sharedModel.getMetadata("editable")}get ready(){return this._ready.promise}setPrompt(e){var t;this.prompt=e,null===(t=this._input)||void 0===t||t.setPrompt(e)}get inputHidden(){return this._inputHidden}set inputHidden(e){var t;if(this._inputHidden!==e){if(!this.placeholder){const s=this._inputWrapper.layout;e?(this._input.parent=null,this._inputPlaceholder&&(this._inputPlaceholder.text=null===(t=this.model.sharedModel.getSource().split("\n"))||void 0===t?void 0:t[0]),s.addWidget(this._inputPlaceholder)):(this._inputPlaceholder.parent=null,s.addWidget(this._input))}this._inputHidden=e,this.syncCollapse&&this.saveCollapseState(),this.handleInputHidden(e)}}saveCollapseState(){const e={...this.model.getMetadata("jupyter")};this.inputHidden&&!0===e.source_hidden||!this.inputHidden&&void 0===e.source_hidden||(this.inputHidden?e.source_hidden=!0:delete e.source_hidden,0===Object.keys(e).length?this.model.deleteMetadata("jupyter"):this.model.setMetadata("jupyter",e))}loadCollapseState(){var e;const t=null!==(e=this.model.getMetadata("jupyter"))&&void 0!==e?e:{};this.inputHidden=!!t.source_hidden}handleInputHidden(e){}get syncCollapse(){return this._syncCollapse}set syncCollapse(e){this._syncCollapse!==e&&(this._syncCollapse=e,e&&this.loadCollapseState())}get syncEditable(){return this._syncEditable}set syncEditable(e){this._syncEditable!==e&&(this._syncEditable=e,e&&this.loadEditableState())}clone(){return new(0,this.constructor)({model:this.model,contentFactory:this.contentFactory,placeholder:!1,translator:this.translator})}dispose(){this.isDisposed||(this._resizeDebouncer.dispose(),this._input=null,this._model=null,this._inputWrapper=null,this._inputPlaceholder=null,super.dispose())}updateEditorConfig(e){this._editorConfig={...this._editorConfig,...e},this.editor&&this.editor.setOptions(this._editorConfig)}get scrollRequested(){return this._scrollRequested}initializeDOM(){if(!this.placeholder)return;const e=this.contentFactory,t=this._model,s=e.createCellHeader();s.addClass("jp-Cell-header"),this.layout.addWidget(s);const i=this._inputWrapper=new C.Panel;i.addClass("jp-Cell-inputWrapper");const n=new g;n.addClass("jp-Cell-inputCollapser");const o=this._input=new w({model:t,contentFactory:e,editorOptions:this.getEditorOptions()});o.addClass("jp-Cell-inputArea"),i.addWidget(n),i.addWidget(o),this.layout.addWidget(i),this._inputPlaceholder=new W({callback:()=>{this.inputHidden=!this.inputHidden},text:o.model.sharedModel.getSource().split("\n")[0],translator:this.translator}),o.model.contentChanged.connect(((e,t)=>{var s;this._inputPlaceholder&&this.inputHidden&&(this._inputPlaceholder.text=null===(s=e.sharedModel.getSource().split("\n"))||void 0===s?void 0:s[0])})),this.inputHidden&&(o.parent=null,i.layout.addWidget(this._inputPlaceholder));const r=this.contentFactory.createCellFooter();r.addClass("jp-Cell-footer"),this.layout.addWidget(r)}getEditorOptions(){return{config:this.editorConfig,extensions:this._editorExtensions}}onBeforeAttach(e){this.placeholder&&(this.placeholder=!1)}onAfterAttach(e){this.update()}onActivateRequest(e){var t;null===(t=this.editor)||void 0===t||t.focus()}onResize(e){this._resizeDebouncer.invoke()}onUpdateRequest(e){var t,s;this._model&&(null===(t=this.editor)||void 0===t?void 0:t.getOption("readOnly"))!==this._readOnly&&(null===(s=this.editor)||void 0===s||s.setOption("readOnly",this._readOnly))}onContentChanged(){var e;this.inputHidden&&this._inputPlaceholder&&(this._inputPlaceholder.text=null===(e=this.model.sharedModel.getSource().split("\n"))||void 0===e?void 0:e[0])}onMetadataChanged(e,t){switch(t.key){case"jupyter":this.syncCollapse&&this.loadCollapseState();break;case"editable":this.syncEditable&&this.loadEditableState()}}}!function(e){let t;!function(e){e[e.HTML=0]="HTML",e[e.Markdown=1]="Markdown"}(t=e.HeadingType||(e.HeadingType={})),e.ContentFactory=class{constructor(e){this._editorFactory=e.editorFactory}get editorFactory(){return this._editorFactory}createCellHeader(){return new _}createCellFooter(){return new v}createInputPrompt(){return new f}createOutputPrompt(){return new O.OutputPrompt}createStdin(e){return new O.Stdin(e)}}}(ue||(ue={}));class ce extends C.PanelLayout{onBeforeAttach(e){let t=!0;const s=this.parent.node.firstElementChild;for(const i of this)s&&(i.node===s?t=!1:(Z.MessageLoop.sendMessage(i,e),t?this.parent.node.insertBefore(i.node,s):this.parent.node.appendChild(i.node),this.parent.isHidden||i.setFlag(C.Widget.Flag.IsVisible),Z.MessageLoop.sendMessage(i,C.Widget.Msg.AfterAttach)))}onAfterDetach(e){for(const t of this)!t.hasClass(ie)&&t.node.isConnected&&(Z.MessageLoop.sendMessage(t,C.Widget.Msg.BeforeDetach),this.parent.node.removeChild(t.node),Z.MessageLoop.sendMessage(t,e))}}class pe extends ue{constructor(e){var t;super({layout:new ce,...e,placeholder:!0}),this._detectCaretMovementInOuput=e=>{const t=null!==this._inViewport&&!this._inViewport,s=e.target;if(!(s&&s instanceof HTMLElement))return;this._lastTarget&&(this._lastTarget.removeEventListener("selectionchange",this._lastOnCaretMovedHandler),document.removeEventListener("selectionchange",this._lastOnCaretMovedHandler));const i=()=>{this._scrollRequested.emit({scrollWithinCell:({scroller:e})=>{u.ElementExt.scrollIntoViewIfNeeded(e,s)},defaultPrevented:t})};this._lastTarget=s,this._lastOnCaretMovedHandler=i,s.addEventListener("selectionchange",i,{once:!0}),document.addEventListener("selectionchange",i,{once:!0}),setTimeout((()=>{s.removeEventListener("selectionchange",i),document.removeEventListener("selectionchange",i)}),250)},this._headingsCache=null,this._outputHidden=!1,this._outputWrapper=null,this._outputPlaceholder=null,this._syncScrolled=!1,this._lastTarget=null,this._lastOutputHeight="",this.addClass("jp-CodeCell");const s=this.translator.load("jupyterlab"),i=this._rendermime=e.rendermime,n=this.contentFactory,o=this.model;this.maxNumberOutputs=e.maxNumberOutputs;const r=0===o.outputs.length?s.__("Code Cell Content"):s.__("Code Cell Content with Output");this.node.setAttribute("aria-label",r);const a=this._output=new O.OutputArea({model:this.model.outputs,rendermime:i,contentFactory:n,maxNumberOutputs:this.maxNumberOutputs,translator:this.translator,promptOverlay:!0,inputHistoryScope:e.inputHistoryScope});a.node.addEventListener("keydown",this._detectCaretMovementInOuput),a.addClass("jp-Cell-outputArea"),a.toggleScrolling.connect((()=>{this.outputsScrolled=!this.outputsScrolled})),a.initialize.connect((()=>{this.updatePromptOverlayIcon()})),this.placeholder=null===(t=e.placeholder)||void 0===t||t,o.outputs.changed.connect(this.onOutputChanged,this),o.outputs.stateChanged.connect(this.onOutputChanged,this),o.stateChanged.connect(this.onStateChanged,this)}initializeDOM(){if(!this.placeholder)return;super.initializeDOM(),this.setPrompt(this.prompt);const e=this._outputWrapper=new C.Panel;e.addClass(ie);const t=new m;t.addClass("jp-Cell-outputCollapser"),e.addWidget(t),0===this.model.outputs.length&&this.addClass(le),this._output.outputLengthChanged.connect(this._outputLengthHandler,this),e.addWidget(this._output);const s=this.layout,i=new se(this.node);i.sizeChanged.connect(this._sizeChangedHandler,this),s.insertWidget(s.widgets.length-1,i),s.insertWidget(s.widgets.length-1,e),this.model.isDirty&&this.addClass(ne),this._outputPlaceholder=new L({callback:()=>{this.outputHidden=!this.outputHidden},text:this.getOutputPlaceholderText(),translator:this.translator});const n=e.layout;this.outputHidden&&(n.removeWidget(this._output),n.addWidget(this._outputPlaceholder),this.inputHidden&&!e.isHidden&&this._outputWrapper.hide());const o=this.translator.load("jupyterlab"),r=0===this.model.outputs.length?o.__("Code Cell Content"):o.__("Code Cell Content with Output");this.node.setAttribute("aria-label",r)}getOutputPlaceholderText(){var e;const t=this.model.outputs.get(0);if(!(null==t?void 0:t.data))return;const s=["text/html","image/svg+xml","application/pdf","text/markdown","text/plain","application/vnd.jupyter.stderr","application/vnd.jupyter.stdout","text"].find((e=>{const s=t.data[e];return"string"==(Array.isArray(s)?typeof s[0]:typeof s)})),i=t.data[null!=s?s:""];return void 0!==i?null===(e=Array.isArray(i)?i:null==i?void 0:i.split("\n"))||void 0===e?void 0:e.find((e=>""!==e)):void 0}initializeState(){return super.initializeState(),this.loadScrolledState(),this.setPrompt(`${this.model.executionCount||""}`),this}get headings(){if(!this._headingsCache){const e=[],t=this.model.outputs;for(let s=0;s<t.length;s++){const i=t.get(s);let n=null,o=null;Object.keys(i.data).forEach((e=>{!o&&X.TableOfContentsUtils.Markdown.isMarkdown(e)?o=e:!n&&X.TableOfContentsUtils.isHTML(e)&&(n=e)})),n?e.push(...X.TableOfContentsUtils.getHTMLHeadings(this._rendermime.sanitizer.sanitize(i.data[n])).map((e=>({...e,outputIndex:s,type:ue.HeadingType.HTML})))):o&&e.push(...X.TableOfContentsUtils.Markdown.getHeadings(i.data[o]).map((e=>({...e,outputIndex:s,type:ue.HeadingType.Markdown}))))}this._headingsCache=e}return[...this._headingsCache]}get outputArea(){return this._output}get outputHidden(){return this._outputHidden}set outputHidden(e){var t;if(this._outputHidden!==e){if(!this.placeholder){const s=this._outputWrapper.layout;e?(s.removeWidget(this._output),s.addWidget(this._outputPlaceholder),this.inputHidden&&!this._outputWrapper.isHidden&&this._outputWrapper.hide(),this._outputPlaceholder&&(this._outputPlaceholder.text=null!==(t=this.getOutputPlaceholderText())&&void 0!==t?t:"")):(this._outputWrapper.isHidden&&this._outputWrapper.show(),s.removeWidget(this._outputPlaceholder),s.addWidget(this._output))}this._outputHidden=e,this.syncCollapse&&this.saveCollapseState()}}saveCollapseState(){this.model.sharedModel.transact((()=>{super.saveCollapseState();const e=this.model.getMetadata("collapsed");this.outputHidden&&!0===e||!this.outputHidden&&void 0===e||(this.outputHidden?this.model.setMetadata("collapsed",!0):this.model.deleteMetadata("collapsed"))}),!1)}loadCollapseState(){super.loadCollapseState(),this.outputHidden=!!this.model.getMetadata("collapsed")}get outputsScrolled(){return this._outputsScrolled}set outputsScrolled(e){this.toggleClass("jp-mod-outputsScrolled",e),this._outputsScrolled=e,this.syncScrolled&&this.saveScrolledState(),this.updatePromptOverlayIcon()}updatePromptOverlayIcon(){var e;const t=q.DOMUtils.findElement(this.node,"jp-OutputArea-promptOverlay");if(!t)return;if(t.clientHeight<=24)return void(null===(e=t.firstChild)||void 0===e||e.remove());let s;this._outputsScrolled?(h.expandIcon.element({container:t}),s="Expand Output"):(h.collapseIcon.element({container:t}),s="Collapse Output");const i=this.translator.load("jupyterlab");t.title=i.__(s)}saveScrolledState(){const e=this.model.getMetadata("scrolled");this.outputsScrolled&&!0===e||!this.outputsScrolled&&void 0===e||(this.outputsScrolled?this.model.setMetadata("scrolled",!0):(this.outputArea.node.style.height="",this.model.deleteMetadata("scrolled")))}loadScrolledState(){"auto"===this.model.getMetadata("scrolled")?this.outputsScrolled=!1:this.outputsScrolled=!!this.model.getMetadata("scrolled")}get syncScrolled(){return this._syncScrolled}set syncScrolled(e){this._syncScrolled!==e&&(this._syncScrolled=e,e&&this.loadScrolledState())}handleInputHidden(e){this.placeholder||(!e&&this._outputWrapper.isHidden?this._outputWrapper.show():e&&!this._outputWrapper.isHidden&&this._outputHidden&&this._outputWrapper.hide())}clone(){return new(0,this.constructor)({model:this.model,contentFactory:this.contentFactory,rendermime:this._rendermime,placeholder:!1,translator:this.translator})}cloneOutputArea(){return new O.SimplifiedOutputArea({model:this.model.outputs,contentFactory:this.contentFactory,rendermime:this._rendermime})}dispose(){this.isDisposed||(this._output.outputLengthChanged.disconnect(this._outputLengthHandler,this),this._output.node.removeEventListener("keydown",this._detectCaretMovementInOuput),this._rendermime=null,this._output=null,this._outputWrapper=null,this._outputPlaceholder=null,super.dispose())}onStateChanged(e,t){switch(t.name){case"executionCount":this.setPrompt(`${e.executionCount||""}`);break;case"isDirty":e.isDirty?this.addClass(ne):this.removeClass(ne)}}onOutputChanged(){var e;this._headingsCache=null,this._outputPlaceholder&&this.outputHidden&&(this._outputPlaceholder.text=null!==(e=this.getOutputPlaceholderText())&&void 0!==e?e:""),this.updatePromptOverlayIcon();const t=this.outputArea.node.style.height;0===this.model.outputs.length&&""!==t?(this._lastOutputHeight=t,this.outputArea.node.style.height=""):this.model.outputs.length>0&&""===t&&(this.outputArea.node.style.height=this._lastOutputHeight)}onMetadataChanged(e,t){switch(t.key){case"scrolled":this.syncScrolled&&this.loadScrolledState();break;case"collapsed":this.syncCollapse&&this.loadCollapseState()}super.onMetadataChanged(e,t)}_outputLengthHandler(e,t){const s=0===t;this.toggleClass(le,s);const i=this.translator.load("jupyterlab"),n=s?i.__("Code Cell Content"):i.__("Code Cell Content with Output");this.node.setAttribute("aria-label",n)}_sizeChangedHandler(e){this._displayChanged.emit()}}!function(e){e.execute=async function(e,t,s){var i;const n=e.model,o=n.sharedModel.getSource();if(!o.trim()||!(null===(i=t.session)||void 0===i?void 0:i.kernel))return void n.sharedModel.transact((()=>{n.clearExecution()}),!1);const r={cellId:n.sharedModel.getId()};s={...n.metadata,...s,...r};const{recordTiming:a}=s;let d;n.sharedModel.transact((()=>{n.clearExecution(),e.outputHidden=!1}),!1),e.setPrompt("*"),n.trusted=!0;try{const i=O.OutputArea.execute(o,e.outputArea,t,s);if(a){const t=e=>{let t;switch(e.header.msg_type){case"status":t=`status.${e.content.execution_state}`;break;case"execute_input":t="execute_input";break;default:return!0}const s=e.header.date||(new Date).toISOString(),i=Object.assign({},n.getMetadata("execution"));return i[`iopub.${t}`]=s,n.setMetadata("execution",i),!0};e.outputArea.future.registerMessageHook(t)}else n.deleteMetadata("execution");d=e.outputArea.future;const r=await i;if(n.executionCount=r.content.execution_count,a){const e=Object.assign({},n.getMetadata("execution")),t=r.metadata.started;t&&(e["shell.execute_reply.started"]=t);const s=r.header.date;e["shell.execute_reply"]=s||(new Date).toISOString(),n.setMetadata("execution",e)}return r}catch(t){if(d&&!e.isDisposed&&e.outputArea.future===d&&(e.setPrompt(""),a&&d.isDisposed)){const e=Object.assign({},n.getMetadata("execution"));e.execution_failed=(new Date).toISOString(),n.setMetadata("execution",e)}throw t}}}(pe||(pe={}));class ge extends ue{handleEvent(e){switch(e.type){case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e)}}getEditorOptions(){var e,t;const s=null!==(e=super.getEditorOptions())&&void 0!==e?e:{};return s.extensions=[...null!==(t=s.extensions)&&void 0!==t?t:[],Q.EditorView.domEventHandlers({dragenter:e=>{e.preventDefault()},dragover:e=>{e.preventDefault()},drop:e=>{this._evtNativeDrop(e)},paste:e=>{this._evtPaste(e)}})],s}onAfterAttach(e){super.onAfterAttach(e);const t=this.node;t.addEventListener("lm-dragover",this),t.addEventListener("lm-drop",this)}onBeforeDetach(e){const t=this.node;t.removeEventListener("lm-dragover",this),t.removeEventListener("lm-drop",this),super.onBeforeDetach(e)}_evtDragOver(e){(0,K.some)(G.imageRendererFactory.mimeTypes,(t=>!!e.mimeData.hasData(he)&&e.mimeData.getData(he).model.mimetype===t))&&(e.preventDefault(),e.stopPropagation(),e.dropAction=e.proposedAction)}_evtPaste(e){if(e.clipboardData){const t=e.clipboardData.items;for(let s=0;s<t.length;s++){if("text/plain"===t[s].type){if(s<t.length-1&&"file"===t[s+1].kind)continue;t[s].getAsString((e=>{var t,s;null===(s=(t=this.editor).replaceSelection)||void 0===s||s.call(t,e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"))}))}this._attachFiles(e.clipboardData.items)}}e.preventDefault()}_evtNativeDrop(e){e.dataTransfer&&this._attachFiles(e.dataTransfer.items),e.preventDefault()}_evtDrop(e){const t=e.mimeData.types().filter((t=>{if(t===he){const t=e.mimeData.getData(he);return-1!==G.imageRendererFactory.mimeTypes.indexOf(t.model.mimetype)}return-1!==G.imageRendererFactory.mimeTypes.indexOf(t)}));if(0!==t.length)if(e.preventDefault(),e.stopPropagation(),"none"!==e.proposedAction){e.dropAction="copy";for(const s of t)if(s===he){const{model:t,withContent:s}=e.mimeData.getData(he);if("file"===t.type){const e=this._generateURI(t.name);this.updateCellSourceWithAttachment(t.name,e),s().then((t=>{this.model.attachments.set(e,{[t.mimetype]:t.content})}))}}else{const t=this._generateURI();this.model.attachments.set(t,{[s]:e.mimeData.getData(s)}),this.updateCellSourceWithAttachment(t,t)}}else e.dropAction="none"}_attachFiles(e){for(let t=0;t<e.length;t++){const s=e[t];if("file"===s.kind){const e=s.getAsFile();e&&this._attachFile(e)}}}_attachFile(e){const t=new FileReader;t.onload=s=>{const{href:i,protocol:n}=R.URLExt.parse(t.result);if("data:"!==n)return;const o=/([\w+\/\+]+)?(?:;(charset=[\w\d-]*|base64))?,(.*)/.exec(i);if(!o||4!==o.length)return;const r=o[1],a={[r]:o[3]},d=this._generateURI(e.name);r.startsWith("image/")&&(this.model.attachments.set(d,a),this.updateCellSourceWithAttachment(e.name,d))},t.onerror=t=>{console.error(`Failed to attach ${e.name}`+t)},t.readAsDataURL(e)}_generateURI(e=""){const t=e.lastIndexOf(".");return-1!==t?Y.UUID.uuid4().concat(e.substring(t)):Y.UUID.uuid4()}}class me extends ge{constructor(e){var t,s,i,n;super({...e,placeholder:!0}),this._headingsCache=null,this._headingCollapsedChanged=new x.Signal(this),this._prevText="",this._rendered=!0,this._renderedChanged=new x.Signal(this),this._showEditorForReadOnlyMarkdown=!0,this.addClass("jp-MarkdownCell"),this.model.contentChanged.connect(this.onContentChanged,this);const o=this.translator.load("jupyterlab");this.node.setAttribute("aria-label",o.__("Markdown Cell Content")),this._rendermime=e.rendermime.clone({resolver:new M.AttachmentsResolver({parent:null!==(t=e.rendermime.resolver)&&void 0!==t?t:void 0,model:this.model.attachments})}),this._renderer=this._rendermime.createRenderer("text/markdown"),this._renderer.addClass("jp-MarkdownOutput"),this._headingCollapsed=null!==(s=this.model.getMetadata(oe))&&void 0!==s&&s,this._showEditorForReadOnlyMarkdown=null!==(i=e.showEditorForReadOnlyMarkdown)&&void 0!==i?i:me.defaultShowEditorForReadOnlyMarkdown,this.placeholder=null===(n=e.placeholder)||void 0===n||n,this._monitor=new R.ActivityMonitor({signal:this.model.contentChanged,timeout:1e3}),this.ready.then((()=>{this.isDisposed||this._monitor.activityStopped.connect((()=>{this._rendered&&this.update()}),this)})).catch((e=>{console.error("Failed to be ready",e)}))}get headingInfo(){const e=this.headings;if(e.length>0){const{text:t,level:s}=e.reduce(((e,t)=>e.level<=t.level?e:t),e[0]);return{text:t,level:s}}return{text:"",level:-1}}get headings(){if(!this._headingsCache){const e=X.TableOfContentsUtils.Markdown.getHeadings(this.model.sharedModel.getSource());this._headingsCache=e.map((e=>({...e,type:ue.HeadingType.Markdown})))}return[...this._headingsCache]}get headingCollapsed(){return this._headingCollapsed}set headingCollapsed(e){var t;if(this._headingCollapsed!==e){this._headingCollapsed=e,e?this.model.setMetadata(oe,e):"undefined"!==this.model.getMetadata(oe)&&this.model.deleteMetadata(oe);const s=null===(t=this.inputArea)||void 0===t?void 0:t.promptNode.getElementsByClassName(re)[0];s&&(e?s.classList.add("jp-mod-collapsed"):s.classList.remove("jp-mod-collapsed")),this.renderCollapseButtons(this._renderer),this._headingCollapsedChanged.emit(this._headingCollapsed)}}get numberChildNodes(){return this._numberChildNodes}set numberChildNodes(e){this._numberChildNodes=e,this.renderCollapseButtons(this._renderer)}get headingCollapsedChanged(){return this._headingCollapsedChanged}get rendered(){return this._rendered}set rendered(e){this.readOnly&&!1===this._showEditorForReadOnlyMarkdown&&(e=!0),e!==this._rendered&&(this._rendered=e,this._handleRendered().then((()=>{this._displayChanged.emit(),this._renderedChanged.emit(this._rendered)})).catch((e=>{console.error("Failed to render",e)})))}get renderedChanged(){return this._renderedChanged}get showEditorForReadOnly(){return this._showEditorForReadOnlyMarkdown}set showEditorForReadOnly(e){this._showEditorForReadOnlyMarkdown=e,!1===e&&(this.rendered=!0)}get renderer(){return this._renderer}dispose(){this.isDisposed||(this._monitor.dispose(),super.dispose())}initializeDOM(){this.placeholder&&(super.initializeDOM(),this.renderCollapseButtons(this._renderer),this._handleRendered().catch((e=>{console.error("Failed to render",e)})))}maybeCreateCollapseButton(){var e;const{level:t}=this.headingInfo;if(t>0&&0==(null===(e=this.inputArea)||void 0===e?void 0:e.promptNode.getElementsByClassName(re).length)){let e=this.inputArea.promptNode.appendChild(document.createElement("button"));e.className=`jp-Button ${re}`,e.setAttribute("data-heading-level",t.toString()),this._headingCollapsed?e.classList.add("jp-mod-collapsed"):e.classList.remove("jp-mod-collapsed"),e.onclick=e=>{this.headingCollapsed=!this.headingCollapsed}}}maybeCreateOrUpdateExpandButton(){const e=this.node.getElementsByClassName(ae);let t=this.translator.load("jupyterlab")._n("%1 cell hidden","%1 cells hidden",this._numberChildNodes);if(this.headingCollapsed&&this._numberChildNodes>0&&0==e.length){const e=document.createElement("button");e.className=`jp-mod-minimal jp-Button ${ae}`,h.addIcon.render(e);const s=document.createElement("div");s.textContent=t,e.appendChild(s),e.onclick=()=>{this.headingCollapsed=!1},this.node.appendChild(e)}if(this.headingCollapsed&&this._numberChildNodes>0&&1==e.length&&(e[0].childNodes[1].textContent=t),!(this.headingCollapsed&&this._numberChildNodes>0))for(const t of e)this.node.removeChild(t)}onContentChanged(){super.onContentChanged(),this._headingsCache=null}renderCollapseButtons(e){this.node.classList.toggle(oe,this._headingCollapsed),this.maybeCreateCollapseButton(),this.maybeCreateOrUpdateExpandButton()}renderInput(e){this.addClass(de),this.placeholder||this.isDisposed||(this.renderCollapseButtons(e),this.inputArea.renderInput(e))}showEditor(){if(this.removeClass(de),!this.placeholder&&!this.isDisposed){this.inputArea.showEditor();let e=(this.model.sharedModel.getSource().match(/^#+/g)||[""])[0].length;e>0&&this.inputArea.editor.setCursorPosition({column:e+1,line:0},{scroll:!1})}}onUpdateRequest(e){this._handleRendered().catch((e=>{console.error("Failed to render",e)})),super.onUpdateRequest(e)}updateCellSourceWithAttachment(e,t){var s,i;const n=``;null===(i=null===(s=this.editor)||void 0===s?void 0:s.replaceSelection)||void 0===i||i.call(s,n)}async _handleRendered(){this._rendered?(await this._updateRenderedInput(),this._rendered&&this.renderInput(this._renderer)):this.showEditor()}_updateRenderedInput(){if(this.placeholder)return Promise.resolve();const e=this.model,t=e&&e.sharedModel.getSource()||"Type Markdown and LaTeX: $ α^2 $";if(t!==this._prevText){const e=new G.MimeModel({data:{"text/markdown":t}});return this._prevText=t,this._renderer.renderModel(e)}return Promise.resolve()}clone(){return new(0,this.constructor)({model:this.model,contentFactory:this.contentFactory,rendermime:this._rendermime,placeholder:!1,translator:this.translator})}}!function(e){e.defaultShowEditorForReadOnlyMarkdown=!0}(me||(me={}));class Ce extends ue{constructor(e){super(e),this.addClass("jp-RawCell");const t=this.translator.load("jupyterlab");this.node.setAttribute("aria-label",t.__("Raw Cell Content"))}clone(){return new(0,this.constructor)({model:this.model,contentFactory:this.contentFactory,placeholder:!1,translator:this.translator})}}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[2479],{72479:(e,t,s)=>{s.r(t),s.d(t,{AttachmentsCell:()=>ge,AttachmentsCellModel:()=>I,Cell:()=>ue,CellDragUtils:()=>l,CellFooter:()=>v,CellHeader:()=>_,CellModel:()=>A,CellSearchProvider:()=>B,CodeCell:()=>pe,CodeCellLayout:()=>ce,CodeCellModel:()=>j,Collapser:()=>p,InputArea:()=>w,InputCollapser:()=>g,InputPlaceholder:()=>W,InputPrompt:()=>x,MarkdownCell:()=>me,MarkdownCellModel:()=>k,OutputCollapser:()=>m,OutputPlaceholder:()=>L,Placeholder:()=>F,RawCell:()=>Ce,RawCellModel:()=>D,SELECTED_HIGHLIGHT_CLASS:()=>z,createCellSearchProvider:()=>$,isCodeCellModel:()=>E,isMarkdownCellModel:()=>b,isRawCellModel:()=>H});var i=s(47087);const n="jp-dragImage",r="jp-dragImage-singlePrompt",o="jp-dragImage-content",a="jp-dragImage-prompt",d="jp-dragImage-multipleBack";var l;!function(e){e.findCell=function(e,t,s){let i=-1;for(;e&&e.parentElement;){if(s(e)){let s=-1;for(const n of t)if(n.node===e){i=++s;break}break}e=e.parentElement}return i},e.detectTargetArea=function(e,t){var s,i;let n;return n=e?(null===(s=e.editorWidget)||void 0===s?void 0:s.node.contains(t))?"input":(null===(i=e.promptNode)||void 0===i?void 0:i.contains(t))?"prompt":"cell":"unknown",n},e.shouldStartDrag=function(e,t,s,i){const n=Math.abs(s-e),r=Math.abs(i-t);return n>=5||r>=5},e.createCellDragImage=function(e,t){const s=t.length;let l;if("code"===e.model.type){const t=e.model.executionCount;l=" ",t&&(l=t.toString())}else l="";const h=e.model.sharedModel.getSource().split("\n")[0].slice(0,26);return s>1?""!==l?i.VirtualDOM.realize(i.h.div(i.h.div({className:n},i.h.span({className:a},"["+l+"]:"),i.h.span({className:o},h)),i.h.div({className:d},""))):i.VirtualDOM.realize(i.h.div(i.h.div({className:n},i.h.span({className:a}),i.h.span({className:o},h)),i.h.div({className:d},""))):""!==l?i.VirtualDOM.realize(i.h.div(i.h.div({className:`${n} ${r}`},i.h.span({className:a},"["+l+"]:"),i.h.span({className:o},h)))):i.VirtualDOM.realize(i.h.div(i.h.div({className:`${n} ${r}`},i.h.span({className:a}),i.h.span({className:o},h))))}}(l||(l={}));var h=s(76878),u=s(47392),c=s(78156);class p extends h.ReactWidget{constructor(){super(),this.addClass("jp-Collapser")}get collapsed(){return!1}render(){return c.createElement("div",{className:"jp-Collapser-child",onClick:e=>this.handleClick(e)})}}class g extends p{constructor(){super(),this.addClass("jp-InputCollapser")}get collapsed(){var e;const t=null===(e=this.parent)||void 0===e?void 0:e.parent;return!!t&&t.inputHidden}handleClick(e){var t;const s=null===(t=this.parent)||void 0===t?void 0:t.parent;s&&(s.inputHidden=!s.inputHidden),this.update()}}class m extends p{constructor(){super(),this.addClass("jp-OutputCollapser")}get collapsed(){var e;const t=null===(e=this.parent)||void 0===e?void 0:e.parent;return!!t&&t.outputHidden}handleClick(e){var t,s;const i=null===(t=this.parent)||void 0===t?void 0:t.parent;if(i&&(i.outputHidden=!i.outputHidden,i.outputHidden)){let e=null===(s=i.parent)||void 0===s?void 0:s.node;e&&u.ElementExt.scrollIntoViewIfNeeded(e,i.node)}this.update()}}var C=s(2260);class _ extends C.Widget{constructor(){super(),this.addClass("jp-CellHeader")}}class v extends C.Widget{constructor(){super(),this.addClass("jp-CellFooter")}}var y=s(983);class w extends C.Widget{constructor(e){super(),this.addClass("jp-InputArea");const{contentFactory:t,editorOptions:s,model:i}=e;this.model=i,this.contentFactory=t;const n=this._prompt=t.createInputPrompt();n.addClass("jp-InputArea-prompt");const r=this._editor=new y.CodeEditorWrapper({factory:t.editorFactory,model:i,editorOptions:s});r.addClass("jp-InputArea-editor");const o=this.layout=new C.PanelLayout;o.addWidget(n),o.addWidget(r)}get editorWidget(){return this._editor}get editor(){return this._editor.editor}get promptNode(){return this._prompt.node}get renderedInput(){return this._rendered}renderInput(e){const t=this.layout;this._rendered&&(this._rendered.parent=null),this._editor.hide(),this._rendered=e,t.addWidget(e)}showEditor(){this._rendered&&(this._rendered.parent=null),this._editor.show()}setPrompt(e){this._prompt.executionCount=e}dispose(){this.isDisposed||(this._prompt=null,this._editor=null,this._rendered=null,super.dispose())}}!function(e){e.ContentFactory=class{constructor(e){this._editor=e.editorFactory}get editorFactory(){return this._editor}createInputPrompt(){return new x}}}(w||(w={}));class x extends C.Widget{constructor(){super(),this._executionCount=null,this.addClass("jp-InputPrompt")}get executionCount(){return this._executionCount}set executionCount(e){this._executionCount=e,this.node.textContent=null===e?" ":`[${e||" "}]:`}}var f=s(2159),M=s(17820),O=s(82416),S=s(42763);const P=(0,S.createMutex)();function E(e){return"code"===e.type}function b(e){return"markdown"===e.type}function H(e){return"raw"===e.type}class A extends y.CodeEditor.Model{constructor(e={}){const{cell_type:t,sharedModel:s,...i}=e;super({sharedModel:null!=s?s:(0,S.createStandaloneCell)({cell_type:null!=t?t:"raw",id:e.id}),...i}),this.contentChanged=new f.Signal(this),this.stateChanged=new f.Signal(this),this._metadataChanged=new f.Signal(this),this._trusted=!1,this.standaloneModel=void 0===e.sharedModel,this.trusted=!!this.getMetadata("trusted")||!!e.trusted,this.sharedModel.changed.connect(this.onGenericChange,this),this.sharedModel.metadataChanged.connect(this._onMetadataChanged,this)}get metadataChanged(){return this._metadataChanged}get id(){return this.sharedModel.getId()}get metadata(){return this.sharedModel.metadata}get trusted(){return this._trusted}set trusted(e){const t=this.trusted;t!==e&&(this._trusted=e,this.onTrustedChanged(this,{newValue:e,oldValue:t}))}dispose(){this.isDisposed||(this.sharedModel.changed.disconnect(this.onGenericChange,this),this.sharedModel.metadataChanged.disconnect(this._onMetadataChanged,this),super.dispose())}onTrustedChanged(e,t){}deleteMetadata(e){return this.sharedModel.deleteMetadata(e)}getMetadata(e){return this.sharedModel.getMetadata(e)}setMetadata(e,t){void 0===t?this.sharedModel.deleteMetadata(e):this.sharedModel.setMetadata(e,t)}toJSON(){return this.sharedModel.toJSON()}onGenericChange(){this.contentChanged.emit(void 0)}_onMetadataChanged(e,t){this._metadataChanged.emit(t)}}class I extends A{constructor(e){var t;super(e);const s=null!==(t=e.contentFactory)&&void 0!==t?t:I.defaultContentFactory,i=this.sharedModel.getAttachments();this._attachments=s.createAttachmentsModel({values:i}),this._attachments.stateChanged.connect(this.onGenericChange,this),this._attachments.changed.connect(this._onAttachmentsChange,this),this.sharedModel.changed.connect(this._onSharedModelChanged,this)}get attachments(){return this._attachments}dispose(){this.isDisposed||(this._attachments.stateChanged.disconnect(this.onGenericChange,this),this._attachments.changed.disconnect(this._onAttachmentsChange,this),this._attachments.dispose(),this.sharedModel.changed.disconnect(this._onSharedModelChanged,this),super.dispose())}toJSON(){return super.toJSON()}_onAttachmentsChange(e,t){const s=this.sharedModel;P((()=>s.setAttachments(e.toJSON())))}_onSharedModelChanged(e,t){if(t.attachmentsChange){const e=this.sharedModel;P((()=>{var t;return this._attachments.fromJSON(null!==(t=e.getAttachments())&&void 0!==t?t:{})}))}}}!function(e){class t{createAttachmentsModel(e){return new M.AttachmentsModel(e)}}e.ContentFactory=t,e.defaultContentFactory=new t}(I||(I={}));class D extends I{constructor(e={}){super({cell_type:"raw",...e})}get type(){return"raw"}toJSON(){return super.toJSON()}}class k extends I{constructor(e={}){super({cell_type:"markdown",...e}),this.mimeType="text/x-ipythongfm"}get type(){return"markdown"}toJSON(){return super.toJSON()}}class j extends A{constructor(e={}){var t;super({cell_type:"code",...e}),this._executedCode="",this._isDirty=!1;const s=null!==(t=null==e?void 0:e.contentFactory)&&void 0!==t?t:j.defaultContentFactory,i=this.trusted,n=this.sharedModel.getOutputs();this._outputs=s.createOutputArea({trusted:i,values:n}),this.sharedModel.changed.connect(this._onSharedModelChanged,this),this._outputs.changed.connect(this.onGenericChange,this),this._outputs.changed.connect(this.onOutputsChange,this)}get type(){return"code"}get executionCount(){return this.sharedModel.execution_count||null}set executionCount(e){this.sharedModel.execution_count=e||null}get executionState(){return this.sharedModel.executionState}set executionState(e){this.sharedModel.executionState=e}get isDirty(){return this._isDirty}set isDirty(e){this._setDirty(e)}get outputs(){return this._outputs}clearExecution(){this.outputs.clear(),this.executionCount=null,this.executionState="idle",this._setDirty(!1),this.sharedModel.deleteMetadata("execution"),this.trusted=!0}dispose(){this.isDisposed||(this.sharedModel.changed.disconnect(this._onSharedModelChanged,this),this._outputs.changed.disconnect(this.onGenericChange,this),this._outputs.changed.disconnect(this.onOutputsChange,this),this._outputs.dispose(),this._outputs=null,super.dispose())}onTrustedChanged(e,t){const s=t.newValue;if(this._outputs&&(this._outputs.trusted=s),s){const e=this.sharedModel,t=e.getMetadata();t.trusted=!0,e.setMetadata(t)}this.stateChanged.emit({name:"trusted",oldValue:t.oldValue,newValue:s})}toJSON(){return super.toJSON()}onOutputsChange(e,t){const s=this.sharedModel;P((()=>{switch(t.type){case"add":{for(const e of t.newValues)"stream"===e.type&&e.streamText.changed.connect(((e,s)=>{if(void 0!==s.options&&s.options.silent)return;const i=this.sharedModel;"remove"===s.type?i.removeStreamOutput(t.newIndex,s.start,"silent-change"):i.appendStreamOutput(t.newIndex,s.value,"silent-change")}),this);const e=t.newValues.map((e=>e.toJSON()));s.updateOutputs(t.newIndex,t.newIndex,e,"silent-change");break}case"set":{const e=t.newValues.map((e=>e.toJSON()));s.updateOutputs(t.oldIndex,t.oldIndex+e.length,e,"silent-change");break}case"remove":s.updateOutputs(t.oldIndex,t.oldValues.length,[],"silent-change");break;default:throw new Error(`Invalid event type: ${t.type}`)}}))}_onSharedModelChanged(e,t){t.streamOutputChange&&P((()=>{for(const e of t.streamOutputChange)"delete"in e&&this._outputs.removeStreamOutput(e.delete),"insert"in e&&this._outputs.appendStreamOutput(e.insert.toString())})),t.outputsChange&&P((()=>{let e=0;for(const s of t.outputsChange){if("retain"in s&&(e+=s.retain),"delete"in s)for(let t=0;t<s.delete;t++)this._outputs.remove(e);if("insert"in s)for(const e of s.insert)this._outputs.add("toJSON"in e?e.toJSON():e)}})),t.executionCountChange&&(!t.executionCountChange.newValue||!this.isDirty&&t.executionCountChange.oldValue||this._setDirty(!1),this.stateChanged.emit({name:"executionCount",oldValue:t.executionCountChange.oldValue,newValue:t.executionCountChange.newValue})),t.executionStateChange&&this.stateChanged.emit({name:"executionState",oldValue:t.executionStateChange.oldValue,newValue:t.executionStateChange.newValue}),t.sourceChange&&null!==this.executionCount&&this._setDirty(this._executedCode!==this.sharedModel.getSource().trim())}_setDirty(e){e||(this._executedCode=this.sharedModel.getSource().trim()),e!==this._isDirty&&(this._isDirty=e,this.stateChanged.emit({name:"isDirty",oldValue:!e,newValue:e}))}}!function(e){class t{createOutputArea(e){return new O.OutputAreaModel(e)}}e.ContentFactory=t,e.defaultContentFactory=new t}(j||(j={}));var N=s(93050);class F extends C.Widget{constructor(e){var t,s,i;const n=document.createElement("div");super({node:n});const r=(null!==(t=e.translator)&&void 0!==t?t:N.nullTranslator).load("jupyterlab"),o=document.createElement("div");o.className=null!==(s=e.promptClass)&&void 0!==s?s:"",n.insertAdjacentHTML("afterbegin",o.outerHTML),this._cell=document.createElement("div"),this._cell.classList.add("jp-Placeholder-content"),this._cell.title=r.__("Click to expand");const a=this._cell.appendChild(document.createElement("div"));a.classList.add("jp-Placeholder-contentContainer"),this._textContent=a.appendChild(document.createElement("span")),this._textContent.className="jp-PlaceholderText",this._textContent.innerText=null!==(i=e.text)&&void 0!==i?i:"",n.appendChild(this._cell),h.ellipsesIcon.element({container:a.appendChild(document.createElement("span")),className:"jp-MoreHorizIcon",elementPosition:"center",height:"auto",width:"32px"}),this.addClass("jp-Placeholder"),this._callback=e.callback}set text(e){this._textContent.innerText=e}get text(){return this._textContent.innerText}onAfterAttach(e){super.onAfterAttach(e),this.node.addEventListener("click",this._callback)}onBeforeDetach(e){this.node.removeEventListener("click",this._callback),super.onBeforeDetach(e)}}class W extends F{constructor(e){super({...e,promptClass:"jp-Placeholder-prompt jp-InputPrompt"}),this.addClass("jp-InputPlaceholder")}}class L extends F{constructor(e){super({...e,promptClass:"jp-Placeholder-prompt jp-OutputPrompt"}),this.addClass("jp-OutputPlaceholder")}}var T=s(3984),R=s(20754),V=s(95514);const z="jp-mod-selected";class B extends T.EditorSearchProvider{constructor(e){super(),this.cell=e,this.cell.inViewport||this.cell.editor||(0,R.signalToPromise)(e.inViewportChanged).then((([,e])=>{e&&this.cmHandler.setEditor(this.editor)}))}get editor(){return this.cell.editor}get model(){return this.cell.model}}class U extends B{constructor(e){super(e),this.currentProviderIndex=-1,this.outputsProvider=[];const t=this.cell.outputArea;this._onOutputsChanged(t,t.widgets.length).catch((e=>{console.error("Failed to initialize search on cell outputs.",e)})),t.outputLengthChanged.connect(this._onOutputsChanged,this),t.disposed.connect((()=>{t.outputLengthChanged.disconnect(this._onOutputsChanged)}),this)}get matchesCount(){return this.isActive?super.matchesCount+this.outputsProvider.reduce(((e,t)=>{var s;return e+(null!==(s=t.matchesCount)&&void 0!==s?s:0)}),0):0}async clearHighlight(){await super.clearHighlight(),await Promise.all(this.outputsProvider.map((e=>e.clearHighlight())))}dispose(){this.isDisposed||(super.dispose(),this.outputsProvider.map((e=>{e.dispose()})),this.outputsProvider.length=0)}async highlightNext(e,t){var s;const i=null!==(s=null==t?void 0:t.from)&&void 0!==s?s:"";if(!(0===this.matchesCount||"previous-match"===i&&null!==this.currentIndex&&this.currentIndex+1>=this.cmHandler.matches.length)&&this.isActive){if(-1===this.currentProviderIndex){const s=await super.highlightNext(e,t);if(s)return this.currentIndex=this.cmHandler.currentIndex,s;this.currentProviderIndex=0}for(;this.currentProviderIndex<this.outputsProvider.length;){const e=this.outputsProvider[this.currentProviderIndex],t=await e.highlightNext(!1);if(t)return this.currentIndex=super.matchesCount+this.outputsProvider.slice(0,this.currentProviderIndex).reduce(((e,t)=>{var s;return e+(null!==(s=t.matchesCount)&&void 0!==s?s:0)}),0)+e.currentMatchIndex,t;this.currentProviderIndex+=1}return this.currentProviderIndex=-1,void(this.currentIndex=null)}this.currentIndex=null}async highlightPrevious(){if(0!==this.matchesCount&&this.isActive){for(null===this.currentIndex&&(this.currentProviderIndex=this.outputsProvider.length-1);this.currentProviderIndex>=0;){const e=this.outputsProvider[this.currentProviderIndex],t=await e.highlightPrevious(!1);if(t)return this.currentIndex=super.matchesCount+this.outputsProvider.slice(0,this.currentProviderIndex).reduce(((e,t)=>{var s;return e+(null!==(s=t.matchesCount)&&void 0!==s?s:0)}),0)+e.currentMatchIndex,t;this.currentProviderIndex-=1}const e=await super.highlightPrevious();return e?(this.currentIndex=this.cmHandler.currentIndex,e):void(this.currentIndex=null)}this.currentIndex=null}async startQuery(e,t){await super.startQuery(e,t),!1!==(null==t?void 0:t.output)&&this.isActive&&await Promise.all(this.outputsProvider.map((t=>t.startQuery(e))))}async endQuery(){var e;await super.endQuery(),!1!==(null===(e=this.filters)||void 0===e?void 0:e.output)&&this.isActive&&await Promise.all(this.outputsProvider.map((e=>e.endQuery())))}async replaceAllMatches(e){return!1===this.model.getMetadata("editable")?Promise.resolve(!1):await super.replaceAllMatches(e)}async replaceCurrentMatch(e,t,s){return!1===this.model.getMetadata("editable")?Promise.resolve(!1):await super.replaceCurrentMatch(e,t,s)}async _onOutputsChanged(e,t){var s;this.outputsProvider.forEach((e=>{e.dispose()})),this.outputsProvider.length=0,this.currentProviderIndex=-1,this.outputsProvider=this.cell.outputArea.widgets.map((e=>new V.GenericSearchProvider(e))),this.isActive&&this.query&&!1!==(null===(s=this.filters)||void 0===s?void 0:s.output)&&await Promise.all([this.outputsProvider.map((e=>{e.startQuery(this.query)}))]),this._stateChanged.emit()}}class J extends B{constructor(e){super(e),this._unrenderedByHighlight=!1,this.renderedProvider=new V.GenericSearchProvider(e.renderer)}async clearHighlight(){await super.clearHighlight(),await this.renderedProvider.clearHighlight()}dispose(){this.isDisposed||(super.dispose(),this.renderedProvider.dispose())}async endQuery(){await super.endQuery(),await this.renderedProvider.endQuery()}async highlightNext(e=!0,t){let s;if(!this.isActive)return s;const i=this.cell;if(i.rendered&&this.matchesCount>0){this._unrenderedByHighlight=!0;const e=(0,R.signalToPromise)(i.renderedChanged);i.rendered=!1,await e}return s=await super.highlightNext(e,t),s}async highlightPrevious(){let e;const t=this.cell;if(t.rendered&&this.matchesCount>0){this._unrenderedByHighlight=!0;const e=(0,R.signalToPromise)(t.renderedChanged);t.rendered=!1,await e}return e=await super.highlightPrevious(),e}async startQuery(e,t){await super.startQuery(e,t);const s=this.cell;s.rendered&&this.onRenderedChanged(s,s.rendered),s.renderedChanged.connect(this.onRenderedChanged,this)}async replaceAllMatches(e){if(!1===this.model.getMetadata("editable"))return Promise.resolve(!1);const t=await super.replaceAllMatches(e);return this.cell.rendered&&this.cell.update(),t}async replaceCurrentMatch(e,t,s){return!1===this.model.getMetadata("editable")?Promise.resolve(!1):await super.replaceCurrentMatch(e,t,s)}onRenderedChanged(e,t){var s;this._unrenderedByHighlight||(this.currentIndex=null),this._unrenderedByHighlight=!1,this.isActive&&(t?this.renderedProvider.startQuery(this.query):(null===(s=e.editor)||void 0===s||s.setCursorPosition({column:0,line:0}),this.renderedProvider.endQuery()))}}function $(e){if(e.isPlaceholder())return new B(e);switch(e.model.type){case"code":return new U(e);case"markdown":return new J(e);default:return new B(e)}}var Q=s(63720),q=s(53876),G=s(58194),X=s(10035),Y=s(21961),K=s(14931),Z=s(62633),ee=s(32406);const te="jp-mod-resizedCell";class se extends C.Widget{constructor(e){super(),this.targetNode=e,this._isActive=!1,this._isDragging=!1,this.sizeChanged=new f.Signal(this),this.addClass("jp-CellResizeHandle"),this._resizer=new ee.Throttler((e=>this._resize(e)),50)}dispose(){this._resizer.dispose(),super.dispose()}handleEvent(e){var t,s;switch(e.type){case"dblclick":null===(t=this.targetNode.parentNode)||void 0===t||t.childNodes.forEach((e=>{e.classList.remove(te)})),document.documentElement.style.setProperty("--jp-side-by-side-output-size","1fr"),this._isActive=!1;break;case"mousedown":this._isDragging=!0,this._isActive||(null===(s=this.targetNode.parentNode)||void 0===s||s.childNodes.forEach((e=>{e.classList.add(te)})),this._isActive=!0),window.addEventListener("mousemove",this),window.addEventListener("mouseup",this);break;case"mousemove":this._isActive&&this._isDragging&&this._resizer.invoke(e);break;case"mouseup":this._isDragging=!1,window.removeEventListener("mousemove",this),window.removeEventListener("mouseup",this)}}onAfterAttach(e){this.node.addEventListener("dblclick",this),this.node.addEventListener("mousedown",this),super.onAfterAttach(e)}onBeforeDetach(e){this.node.removeEventListener("dblclick",this),this.node.removeEventListener("mousedown",this),super.onBeforeDetach(e)}_resize(e){const{width:t,x:s}=this.targetNode.getBoundingClientRect(),i=t/(e.clientX-s)-1;if(0<i){const e=Math.max(Math.min(Math.abs(i),50),.05);document.documentElement.style.setProperty("--jp-side-by-side-output-size",`${e}fr`),this.sizeChanged.emit(e)}}}const ie="jp-Cell-outputWrapper",ne="jp-mod-dirty",re="jp-MarkdownHeadingCollapsed",oe="jp-collapseHeadingButton",ae="jp-showHiddenCellsButton",de="jp-mod-rendered",le="jp-mod-noOutputs",he="application/x-jupyter-icontentsrich";class ue extends C.Widget{constructor(e){var t,s,i,n;super(),this.prompt="",this._displayChanged=new f.Signal(this),this._scrollRequested=new f.Signal(this),this._scrollHandlerExtension=Q.EditorView.scrollHandler.of(((e,t,s)=>{const i=null!==this._inViewport&&!this._inViewport;return this._scrollRequested.emit({defaultPrevented:i,scrollWithinCell:()=>{e.dispatch({effects:Q.EditorView.scrollIntoView(t,s)})}}),i})),this._editorConfig={},this._editorExtensions=[],this._inputHidden=!1,this._inViewportChanged=new f.Signal(this),this._readOnly=!1,this._ready=new Y.PromiseDelegate,this._resizeDebouncer=new ee.Debouncer((()=>{this._displayChanged.emit()}),0),this._syncCollapse=!1,this._syncEditable=!1,this.addClass("jp-Cell");const r=this._model=e.model;this.contentFactory=e.contentFactory,this.layout=null!==(t=e.layout)&&void 0!==t?t:new C.PanelLayout,this.translator=null!==(s=e.translator)&&void 0!==s?s:N.nullTranslator,this._editorConfig={searchWithCM:!1,...e.editorConfig},this._editorExtensions=null!==(i=e.editorExtensions)&&void 0!==i?i:[],this._editorExtensions.push(this._scrollHandlerExtension),this._placeholder=!0,this._inViewport=null,this.placeholder=null===(n=e.placeholder)||void 0===n||n,r.metadataChanged.connect(this.onMetadataChanged,this)}initializeState(){return this.loadCollapseState(),this.loadEditableState(),this}get displayChanged(){return this._displayChanged}get inViewport(){var e;return null!==(e=this._inViewport)&&void 0!==e&&e}set inViewport(e){this._inViewport!==e&&(this._inViewport=e,this._inViewportChanged.emit(this._inViewport))}get inViewportChanged(){return this._inViewportChanged}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder!==e&&!1===e&&(this.initializeDOM(),this._placeholder=e,this._ready.resolve())}get promptNode(){return this.placeholder?null:this._inputHidden?this._inputPlaceholder.node.firstElementChild:this._input.promptNode}get editorWidget(){var e,t;return null!==(t=null===(e=this._input)||void 0===e?void 0:e.editorWidget)&&void 0!==t?t:null}get editor(){var e,t;return null!==(t=null===(e=this._input)||void 0===e?void 0:e.editor)&&void 0!==t?t:null}get editorConfig(){return this._editorConfig}get headings(){return new Array}get model(){return this._model}get inputArea(){return this._input}get readOnly(){return this._readOnly}set readOnly(e){e!==this._readOnly&&(this._readOnly=e,this.syncEditable&&this.saveEditableState(),this.update())}isPlaceholder(){return this.placeholder}saveEditableState(){const{sharedModel:e}=this.model,t=e.getMetadata("editable");this.readOnly&&!1===t||!this.readOnly&&void 0===t||(this.readOnly?e.setMetadata("editable",!1):e.deleteMetadata("editable"))}loadEditableState(){this.readOnly=!1===this.model.sharedModel.getMetadata("editable")}get ready(){return this._ready.promise}setPrompt(e){return this._setPrompt(e)}_setPrompt(e){var t;this.prompt=e,null===(t=this._input)||void 0===t||t.setPrompt(e)}get inputHidden(){return this._inputHidden}set inputHidden(e){var t;if(this._inputHidden!==e){if(!this.placeholder){const s=this._inputWrapper.layout;e?(this._input.parent=null,this._inputPlaceholder&&(this._inputPlaceholder.text=null===(t=this.model.sharedModel.getSource().split("\n"))||void 0===t?void 0:t[0]),s.addWidget(this._inputPlaceholder)):(this._inputPlaceholder.parent=null,s.addWidget(this._input))}this._inputHidden=e,this.syncCollapse&&this.saveCollapseState(),this.handleInputHidden(e)}}saveCollapseState(){const e={...this.model.getMetadata("jupyter")};this.inputHidden&&!0===e.source_hidden||!this.inputHidden&&void 0===e.source_hidden||(this.inputHidden?e.source_hidden=!0:delete e.source_hidden,0===Object.keys(e).length?this.model.deleteMetadata("jupyter"):this.model.setMetadata("jupyter",e))}loadCollapseState(){var e;const t=null!==(e=this.model.getMetadata("jupyter"))&&void 0!==e?e:{};this.inputHidden=!!t.source_hidden}handleInputHidden(e){}get syncCollapse(){return this._syncCollapse}set syncCollapse(e){this._syncCollapse!==e&&(this._syncCollapse=e,e&&this.loadCollapseState())}get syncEditable(){return this._syncEditable}set syncEditable(e){this._syncEditable!==e&&(this._syncEditable=e,e&&this.loadEditableState())}clone(){return new(0,this.constructor)({model:this.model,contentFactory:this.contentFactory,placeholder:!1,translator:this.translator})}dispose(){this.isDisposed||(this._resizeDebouncer.dispose(),this._input=null,this._model=null,this._inputWrapper=null,this._inputPlaceholder=null,super.dispose())}updateEditorConfig(e){this._editorConfig={...this._editorConfig,...e},this.editor&&this.editor.setOptions(this._editorConfig)}get scrollRequested(){return this._scrollRequested}initializeDOM(){if(!this.placeholder)return;const e=this.contentFactory,t=this._model,s=e.createCellHeader();s.addClass("jp-Cell-header"),this.layout.addWidget(s);const i=this._inputWrapper=new C.Panel;i.addClass("jp-Cell-inputWrapper");const n=new g;n.addClass("jp-Cell-inputCollapser");const r=this._input=new w({model:t,contentFactory:e,editorOptions:this.getEditorOptions()});r.addClass("jp-Cell-inputArea"),i.addWidget(n),i.addWidget(r),this.layout.addWidget(i),this._inputPlaceholder=new W({callback:()=>{this.inputHidden=!this.inputHidden},text:r.model.sharedModel.getSource().split("\n")[0],translator:this.translator}),r.model.contentChanged.connect(((e,t)=>{var s;this._inputPlaceholder&&this.inputHidden&&(this._inputPlaceholder.text=null===(s=e.sharedModel.getSource().split("\n"))||void 0===s?void 0:s[0])})),this.inputHidden&&(r.parent=null,i.layout.addWidget(this._inputPlaceholder));const o=this.contentFactory.createCellFooter();o.addClass("jp-Cell-footer"),this.layout.addWidget(o)}getEditorOptions(){return{config:this.editorConfig,extensions:this._editorExtensions}}onBeforeAttach(e){this.placeholder&&(this.placeholder=!1)}onAfterAttach(e){this.update()}onActivateRequest(e){var t;null===(t=this.editor)||void 0===t||t.focus()}onResize(e){this._resizeDebouncer.invoke()}onUpdateRequest(e){var t,s;this._model&&(null===(t=this.editor)||void 0===t?void 0:t.getOption("readOnly"))!==this._readOnly&&(null===(s=this.editor)||void 0===s||s.setOption("readOnly",this._readOnly))}onContentChanged(){var e;this.inputHidden&&this._inputPlaceholder&&(this._inputPlaceholder.text=null===(e=this.model.sharedModel.getSource().split("\n"))||void 0===e?void 0:e[0])}onMetadataChanged(e,t){switch(t.key){case"jupyter":this.syncCollapse&&this.loadCollapseState();break;case"editable":this.syncEditable&&this.loadEditableState()}}}!function(e){let t;!function(e){e[e.HTML=0]="HTML",e[e.Markdown=1]="Markdown"}(t=e.HeadingType||(e.HeadingType={})),e.ContentFactory=class{constructor(e){this._editorFactory=e.editorFactory}get editorFactory(){return this._editorFactory}createCellHeader(){return new _}createCellFooter(){return new v}createInputPrompt(){return new x}createOutputPrompt(){return new O.OutputPrompt}createStdin(e){return new O.Stdin(e)}}}(ue||(ue={}));class ce extends C.PanelLayout{onBeforeAttach(e){let t=!0;const s=this.parent.node.firstElementChild;for(const i of this)s&&(i.node===s?t=!1:(Z.MessageLoop.sendMessage(i,e),t?this.parent.node.insertBefore(i.node,s):this.parent.node.appendChild(i.node),this.parent.isHidden||i.setFlag(C.Widget.Flag.IsVisible),Z.MessageLoop.sendMessage(i,C.Widget.Msg.AfterAttach)))}onAfterDetach(e){for(const t of this)!t.hasClass(ie)&&t.node.isConnected&&(Z.MessageLoop.sendMessage(t,C.Widget.Msg.BeforeDetach),this.parent.node.removeChild(t.node),Z.MessageLoop.sendMessage(t,e))}}class pe extends ue{constructor(e){var t;super({layout:new ce,...e,placeholder:!0}),this._detectCaretMovementInOuput=e=>{const t=null!==this._inViewport&&!this._inViewport,s=e.target;if(!(s&&s instanceof HTMLElement))return;this._lastTarget&&(this._lastTarget.removeEventListener("selectionchange",this._lastOnCaretMovedHandler),document.removeEventListener("selectionchange",this._lastOnCaretMovedHandler));const i=()=>{this._scrollRequested.emit({scrollWithinCell:({scroller:e})=>{u.ElementExt.scrollIntoViewIfNeeded(e,s)},defaultPrevented:t})};this._lastTarget=s,this._lastOnCaretMovedHandler=i,s.addEventListener("selectionchange",i,{once:!0}),document.addEventListener("selectionchange",i,{once:!0}),setTimeout((()=>{s.removeEventListener("selectionchange",i),document.removeEventListener("selectionchange",i)}),250)},this._headingsCache=null,this._outputHidden=!1,this._outputWrapper=null,this._outputPlaceholder=null,this._syncScrolled=!1,this._lastTarget=null,this._lastOutputHeight="",this.addClass("jp-CodeCell");const s=this.translator.load("jupyterlab"),i=this._rendermime=e.rendermime,n=this.contentFactory,r=this.model;this.maxNumberOutputs=e.maxNumberOutputs;const o=0===r.outputs.length?s.__("Code Cell Content"):s.__("Code Cell Content with Output");this.node.setAttribute("aria-label",o);const a=this._output=new O.OutputArea({model:this.model.outputs,rendermime:i,contentFactory:n,maxNumberOutputs:this.maxNumberOutputs,translator:this.translator,promptOverlay:!0,inputHistoryScope:e.inputHistoryScope});a.node.addEventListener("keydown",this._detectCaretMovementInOuput),a.addClass("jp-Cell-outputArea"),a.toggleScrolling.connect((()=>{this.outputsScrolled=!this.outputsScrolled})),a.initialize.connect((()=>{this.updatePromptOverlayIcon()})),this.placeholder=null===(t=e.placeholder)||void 0===t||t,r.outputs.changed.connect(this.onOutputChanged,this),r.outputs.stateChanged.connect(this.onOutputChanged,this),r.stateChanged.connect(this.onStateChanged,this)}initializeDOM(){if(!this.placeholder)return;super.initializeDOM(),this._updatePrompt();const e=this._outputWrapper=new C.Panel;e.addClass(ie);const t=new m;t.addClass("jp-Cell-outputCollapser"),e.addWidget(t),0===this.model.outputs.length&&this.addClass(le),this._output.outputLengthChanged.connect(this._outputLengthHandler,this),e.addWidget(this._output);const s=this.layout,i=new se(this.node);i.sizeChanged.connect(this._sizeChangedHandler,this),s.insertWidget(s.widgets.length-1,i),s.insertWidget(s.widgets.length-1,e),this.model.isDirty&&this.addClass(ne),this._outputPlaceholder=new L({callback:()=>{this.outputHidden=!this.outputHidden},text:this.getOutputPlaceholderText(),translator:this.translator});const n=e.layout;this.outputHidden&&(n.removeWidget(this._output),n.addWidget(this._outputPlaceholder),this.inputHidden&&!e.isHidden&&this._outputWrapper.hide());const r=this.translator.load("jupyterlab"),o=0===this.model.outputs.length?r.__("Code Cell Content"):r.__("Code Cell Content with Output");this.node.setAttribute("aria-label",o)}getOutputPlaceholderText(){var e;const t=this.model.outputs.get(0);if(!(null==t?void 0:t.data))return;const s=["text/html","image/svg+xml","application/pdf","text/markdown","text/plain","application/vnd.jupyter.stderr","application/vnd.jupyter.stdout","text"].find((e=>{const s=t.data[e];return"string"==(Array.isArray(s)?typeof s[0]:typeof s)})),i=t.data[null!=s?s:""];return void 0!==i?null===(e=Array.isArray(i)?i:null==i?void 0:i.split("\n"))||void 0===e?void 0:e.find((e=>""!==e)):void 0}initializeState(){return super.initializeState(),this.loadScrolledState(),this._updatePrompt(),this}get headings(){if(!this._headingsCache){const e=[],t=this.model.outputs;for(let s=0;s<t.length;s++){const i=t.get(s);let n=null,r=null;Object.keys(i.data).forEach((e=>{!r&&X.TableOfContentsUtils.Markdown.isMarkdown(e)?r=e:!n&&X.TableOfContentsUtils.isHTML(e)&&(n=e)})),n?e.push(...X.TableOfContentsUtils.getHTMLHeadings(this._rendermime.sanitizer.sanitize(i.data[n])).map((e=>({...e,outputIndex:s,type:ue.HeadingType.HTML})))):r&&e.push(...X.TableOfContentsUtils.Markdown.getHeadings(i.data[r]).map((e=>({...e,outputIndex:s,type:ue.HeadingType.Markdown}))))}this._headingsCache=e}return[...this._headingsCache]}get outputArea(){return this._output}get outputHidden(){return this._outputHidden}set outputHidden(e){var t;if(this._outputHidden!==e){if(!this.placeholder){const s=this._outputWrapper.layout;e?(s.removeWidget(this._output),s.addWidget(this._outputPlaceholder),this.inputHidden&&!this._outputWrapper.isHidden&&this._outputWrapper.hide(),this._outputPlaceholder&&(this._outputPlaceholder.text=null!==(t=this.getOutputPlaceholderText())&&void 0!==t?t:"")):(this._outputWrapper.isHidden&&this._outputWrapper.show(),s.removeWidget(this._outputPlaceholder),s.addWidget(this._output))}this._outputHidden=e,this.syncCollapse&&this.saveCollapseState()}}saveCollapseState(){this.model.sharedModel.transact((()=>{super.saveCollapseState();const e=this.model.getMetadata("collapsed");this.outputHidden&&!0===e||!this.outputHidden&&void 0===e||(this.outputHidden?this.model.setMetadata("collapsed",!0):this.model.deleteMetadata("collapsed"))}),!1,"silent-change")}loadCollapseState(){super.loadCollapseState(),this.outputHidden=!!this.model.getMetadata("collapsed")}get outputsScrolled(){return this._outputsScrolled}set outputsScrolled(e){this.toggleClass("jp-mod-outputsScrolled",e),this._outputsScrolled=e,this.syncScrolled&&this.saveScrolledState(),this.updatePromptOverlayIcon()}updatePromptOverlayIcon(){var e;const t=q.DOMUtils.findElement(this.node,"jp-OutputArea-promptOverlay");if(!t)return;if(t.clientHeight<=24)return void(null===(e=t.firstChild)||void 0===e||e.remove());let s;this._outputsScrolled?(h.expandIcon.element({container:t}),s="Expand Output"):(h.collapseIcon.element({container:t}),s="Collapse Output");const i=this.translator.load("jupyterlab");t.title=i.__(s)}saveScrolledState(){const e=this.model.getMetadata("scrolled");this.outputsScrolled&&!0===e||!this.outputsScrolled&&void 0===e||(this.outputsScrolled?this.model.setMetadata("scrolled",!0):(this.outputArea.node.style.height="",this.model.deleteMetadata("scrolled")))}loadScrolledState(){"auto"===this.model.getMetadata("scrolled")?this.outputsScrolled=!1:this.outputsScrolled=!!this.model.getMetadata("scrolled")}get syncScrolled(){return this._syncScrolled}set syncScrolled(e){this._syncScrolled!==e&&(this._syncScrolled=e,e&&this.loadScrolledState())}handleInputHidden(e){this.placeholder||(!e&&this._outputWrapper.isHidden?this._outputWrapper.show():e&&!this._outputWrapper.isHidden&&this._outputHidden&&this._outputWrapper.hide())}clone(){return new(0,this.constructor)({model:this.model,contentFactory:this.contentFactory,rendermime:this._rendermime,placeholder:!1,translator:this.translator})}cloneOutputArea(){return new O.SimplifiedOutputArea({model:this.model.outputs,contentFactory:this.contentFactory,rendermime:this._rendermime})}dispose(){this.isDisposed||(this._output.outputLengthChanged.disconnect(this._outputLengthHandler,this),this._output.node.removeEventListener("keydown",this._detectCaretMovementInOuput),this._rendermime=null,this._output=null,this._outputWrapper=null,this._outputPlaceholder=null,super.dispose())}onStateChanged(e,t){switch(t.name){case"executionCount":this.model.executionState="idle",this._updatePrompt();break;case"executionState":this._updatePrompt();break;case"isDirty":e.isDirty?this.addClass(ne):this.removeClass(ne)}}onOutputChanged(){var e;this._headingsCache=null,this._outputPlaceholder&&this.outputHidden&&(this._outputPlaceholder.text=null!==(e=this.getOutputPlaceholderText())&&void 0!==e?e:""),this.updatePromptOverlayIcon();const t=this.outputArea.node.style.height;0===this.model.outputs.length&&""!==t?(this._lastOutputHeight=t,this.outputArea.node.style.height=""):this.model.outputs.length>0&&""===t&&(this.outputArea.node.style.height=this._lastOutputHeight)}onMetadataChanged(e,t){switch(t.key){case"scrolled":this.syncScrolled&&this.loadScrolledState();break;case"collapsed":this.syncCollapse&&this.loadCollapseState()}super.onMetadataChanged(e,t)}_updatePrompt(){let e;e="running"==this.model.executionState?"*":`${this.model.executionCount||""}`,this._setPrompt(e)}_outputLengthHandler(e,t){const s=0===t;this.toggleClass(le,s);const i=this.translator.load("jupyterlab"),n=s?i.__("Code Cell Content"):i.__("Code Cell Content with Output");this.node.setAttribute("aria-label",n)}_sizeChangedHandler(e){this._displayChanged.emit()}}!function(e){e.execute=async function(e,t,s){var i;const n=e.model,r=n.sharedModel.getSource();if(!r.trim()||!(null===(i=t.session)||void 0===i?void 0:i.kernel))return void n.sharedModel.transact((()=>{n.clearExecution()}),!1,"silent-change");const o={cellId:n.sharedModel.getId()};s={...n.metadata,...s,...o};const{recordTiming:a}=s;let d;n.sharedModel.transact((()=>{n.clearExecution(),e.outputHidden=!1}),!1,"silent-change"),n.executionState="running",n.trusted=!0;try{const i=O.OutputArea.execute(r,e.outputArea,t,s);if(a){const t=e=>{let t;switch(e.header.msg_type){case"status":t=`status.${e.content.execution_state}`;break;case"execute_input":t="execute_input";break;default:return!0}const s=e.header.date||(new Date).toISOString(),i=Object.assign({},n.getMetadata("execution"));return i[`iopub.${t}`]=s,n.setMetadata("execution",i),!0};e.outputArea.future.registerMessageHook(t)}else n.deleteMetadata("execution");d=e.outputArea.future;const o=await i;if(n.executionCount=o.content.execution_count,a){const e=Object.assign({},n.getMetadata("execution")),t=o.metadata.started;t&&(e["shell.execute_reply.started"]=t);const s=o.header.date;e["shell.execute_reply"]=s||(new Date).toISOString(),n.setMetadata("execution",e)}return o}catch(t){if(d&&!e.isDisposed&&e.outputArea.future===d&&(e.model.executionState="idle",a&&d.isDisposed)){const e=Object.assign({},n.getMetadata("execution"));e.execution_failed=(new Date).toISOString(),n.setMetadata("execution",e)}throw t}}}(pe||(pe={}));class ge extends ue{handleEvent(e){switch(e.type){case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e)}}getEditorOptions(){var e,t;const s=null!==(e=super.getEditorOptions())&&void 0!==e?e:{};return s.extensions=[...null!==(t=s.extensions)&&void 0!==t?t:[],Q.EditorView.domEventHandlers({dragenter:e=>{e.preventDefault()},dragover:e=>{e.preventDefault()},drop:e=>{this._evtNativeDrop(e)},paste:e=>{this._evtPaste(e)}})],s}onAfterAttach(e){super.onAfterAttach(e);const t=this.node;t.addEventListener("lm-dragover",this),t.addEventListener("lm-drop",this)}onBeforeDetach(e){const t=this.node;t.removeEventListener("lm-dragover",this),t.removeEventListener("lm-drop",this),super.onBeforeDetach(e)}_evtDragOver(e){(0,K.some)(G.imageRendererFactory.mimeTypes,(t=>!!e.mimeData.hasData(he)&&e.mimeData.getData(he).model.mimetype===t))&&(e.preventDefault(),e.stopPropagation(),e.dropAction=e.proposedAction)}_evtPaste(e){if(e.clipboardData){const t=e.clipboardData.items;for(let s=0;s<t.length;s++){if("text/plain"===t[s].type){if(s<t.length-1&&"file"===t[s+1].kind)continue;t[s].getAsString((e=>{var t,s;null===(s=(t=this.editor).replaceSelection)||void 0===s||s.call(t,e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"))}))}this._attachFiles(e.clipboardData.items)}}e.preventDefault()}_evtNativeDrop(e){e.dataTransfer&&this._attachFiles(e.dataTransfer.items),e.preventDefault()}_evtDrop(e){const t=e.mimeData.types().filter((t=>{if(t===he){const t=e.mimeData.getData(he);return-1!==G.imageRendererFactory.mimeTypes.indexOf(t.model.mimetype)}return-1!==G.imageRendererFactory.mimeTypes.indexOf(t)}));if(0!==t.length)if(e.preventDefault(),e.stopPropagation(),"none"!==e.proposedAction){e.dropAction="copy";for(const s of t)if(s===he){const{model:t,withContent:s}=e.mimeData.getData(he);if("file"===t.type){const e=this._generateURI(t.name);this.updateCellSourceWithAttachment(t.name,e),s().then((t=>{this.model.attachments.set(e,{[t.mimetype]:t.content})}))}}else{const t=this._generateURI();this.model.attachments.set(t,{[s]:e.mimeData.getData(s)}),this.updateCellSourceWithAttachment(t,t)}}else e.dropAction="none"}_attachFiles(e){for(let t=0;t<e.length;t++){const s=e[t];if("file"===s.kind){const e=s.getAsFile();e&&this._attachFile(e)}}}_attachFile(e){const t=new FileReader;t.onload=s=>{const{href:i,protocol:n}=R.URLExt.parse(t.result);if("data:"!==n)return;const r=/([\w+\/\+]+)?(?:;(charset=[\w\d-]*|base64))?,(.*)/.exec(i);if(!r||4!==r.length)return;const o=r[1],a={[o]:r[3]},d=this._generateURI(e.name);o.startsWith("image/")&&(this.model.attachments.set(d,a),this.updateCellSourceWithAttachment(e.name,d))},t.onerror=t=>{console.error(`Failed to attach ${e.name}`+t)},t.readAsDataURL(e)}_generateURI(e=""){const t=e.lastIndexOf(".");return-1!==t?Y.UUID.uuid4().concat(e.substring(t)):Y.UUID.uuid4()}}class me extends ge{constructor(e){var t,s,i,n;super({...e,placeholder:!0}),this._headingsCache=null,this._headingCollapsedChanged=new f.Signal(this),this._prevText="",this._rendered=!0,this._renderedChanged=new f.Signal(this),this._showEditorForReadOnlyMarkdown=!0,this.addClass("jp-MarkdownCell"),this.model.contentChanged.connect(this.onContentChanged,this);const r=this.translator.load("jupyterlab");this.node.setAttribute("aria-label",r.__("Markdown Cell Content")),this._rendermime=e.rendermime.clone({resolver:new M.AttachmentsResolver({parent:null!==(t=e.rendermime.resolver)&&void 0!==t?t:void 0,model:this.model.attachments})}),this._renderer=this._rendermime.createRenderer("text/markdown"),this._renderer.addClass("jp-MarkdownOutput"),this._headingCollapsed=null!==(s=this.model.getMetadata(re))&&void 0!==s&&s,this._showEditorForReadOnlyMarkdown=null!==(i=e.showEditorForReadOnlyMarkdown)&&void 0!==i?i:me.defaultShowEditorForReadOnlyMarkdown,this.placeholder=null===(n=e.placeholder)||void 0===n||n,this._monitor=new R.ActivityMonitor({signal:this.model.contentChanged,timeout:1e3}),this.ready.then((()=>{this.isDisposed||this._monitor.activityStopped.connect((()=>{this._rendered&&this.update()}),this)})).catch((e=>{console.error("Failed to be ready",e)}))}get headingInfo(){const e=this.headings;if(e.length>0){const{text:t,level:s}=e.reduce(((e,t)=>e.level<=t.level?e:t),e[0]);return{text:t,level:s}}return{text:"",level:-1}}get headings(){if(!this._headingsCache){const e=X.TableOfContentsUtils.Markdown.getHeadings(this.model.sharedModel.getSource());this._headingsCache=e.map((e=>({...e,type:ue.HeadingType.Markdown})))}return[...this._headingsCache]}get headingCollapsed(){return this._headingCollapsed}set headingCollapsed(e){var t;if(this._headingCollapsed!==e){this._headingCollapsed=e,e?this.model.setMetadata(re,e):"undefined"!==this.model.getMetadata(re)&&this.model.deleteMetadata(re);const s=null===(t=this.inputArea)||void 0===t?void 0:t.promptNode.getElementsByClassName(oe)[0];s&&(e?s.classList.add("jp-mod-collapsed"):s.classList.remove("jp-mod-collapsed")),this.renderCollapseButtons(this._renderer),this._headingCollapsedChanged.emit(this._headingCollapsed)}}get numberChildNodes(){return this._numberChildNodes}set numberChildNodes(e){this._numberChildNodes=e,this.renderCollapseButtons(this._renderer)}get headingCollapsedChanged(){return this._headingCollapsedChanged}get rendered(){return this._rendered}set rendered(e){this.readOnly&&!1===this._showEditorForReadOnlyMarkdown&&(e=!0),e!==this._rendered&&(this._rendered=e,this._handleRendered().then((()=>{this._displayChanged.emit(),this._renderedChanged.emit(this._rendered)})).catch((e=>{console.error("Failed to render",e)})))}get renderedChanged(){return this._renderedChanged}get showEditorForReadOnly(){return this._showEditorForReadOnlyMarkdown}set showEditorForReadOnly(e){this._showEditorForReadOnlyMarkdown=e,!1===e&&(this.rendered=!0)}get renderer(){return this._renderer}dispose(){this.isDisposed||(this._monitor.dispose(),super.dispose())}initializeDOM(){this.placeholder&&(super.initializeDOM(),this.renderCollapseButtons(this._renderer),this._handleRendered().catch((e=>{console.error("Failed to render",e)})))}maybeCreateCollapseButton(){var e;const{level:t}=this.headingInfo;if(t>0&&0==(null===(e=this.inputArea)||void 0===e?void 0:e.promptNode.getElementsByClassName(oe).length)){let e=this.inputArea.promptNode.appendChild(document.createElement("button"));e.className=`jp-Button ${oe}`,e.setAttribute("data-heading-level",t.toString()),this._headingCollapsed?e.classList.add("jp-mod-collapsed"):e.classList.remove("jp-mod-collapsed"),e.onclick=e=>{this.headingCollapsed=!this.headingCollapsed}}}maybeCreateOrUpdateExpandButton(){const e=this.node.getElementsByClassName(ae);let t=this.translator.load("jupyterlab")._n("%1 cell hidden","%1 cells hidden",this._numberChildNodes);if(this.headingCollapsed&&this._numberChildNodes>0&&0==e.length){const e=document.createElement("button");e.className=`jp-mod-minimal jp-Button ${ae}`,h.addIcon.render(e);const s=document.createElement("div");s.textContent=t,e.appendChild(s),e.onclick=()=>{this.headingCollapsed=!1},this.node.appendChild(e)}if(this.headingCollapsed&&this._numberChildNodes>0&&1==e.length&&(e[0].childNodes[1].textContent=t),!(this.headingCollapsed&&this._numberChildNodes>0))for(const t of e)this.node.removeChild(t)}onContentChanged(){super.onContentChanged(),this._headingsCache=null}renderCollapseButtons(e){this.node.classList.toggle(re,this._headingCollapsed),this.maybeCreateCollapseButton(),this.maybeCreateOrUpdateExpandButton()}renderInput(e){this.addClass(de),this.placeholder||this.isDisposed||(this.renderCollapseButtons(e),this.inputArea.renderInput(e))}showEditor(){if(this.removeClass(de),!this.placeholder&&!this.isDisposed){this.inputArea.showEditor();let e=(this.model.sharedModel.getSource().match(/^#+/g)||[""])[0].length;e>0&&this.inputArea.editor.setCursorPosition({column:e+1,line:0},{scroll:!1})}}onUpdateRequest(e){this._handleRendered().catch((e=>{console.error("Failed to render",e)})),super.onUpdateRequest(e)}updateCellSourceWithAttachment(e,t){var s,i;const n=``;null===(i=null===(s=this.editor)||void 0===s?void 0:s.replaceSelection)||void 0===i||i.call(s,n)}async _handleRendered(){this._rendered?(await this._updateRenderedInput(),this._rendered&&this.renderInput(this._renderer)):this.showEditor()}_updateRenderedInput(){if(this.placeholder)return Promise.resolve();const e=this.model,t=e&&e.sharedModel.getSource()||"Type Markdown and LaTeX: $ α^2 $";if(t!==this._prevText){const e=new G.MimeModel({data:{"text/markdown":t}});return this._prevText=t,this._renderer.renderModel(e)}return Promise.resolve()}clone(){return new(0,this.constructor)({model:this.model,contentFactory:this.contentFactory,rendermime:this._rendermime,placeholder:!1,translator:this.translator})}}!function(e){e.defaultShowEditorForReadOnlyMarkdown=!0}(me||(me={}));class Ce extends ue{constructor(e){super(e),this.addClass("jp-RawCell");const t=this.translator.load("jupyterlab");this.node.setAttribute("aria-label",t.__("Raw Cell Content"))}clone(){return new(0,this.constructor)({model:this.model,contentFactory:this.contentFactory,placeholder:!1,translator:this.translator})}}}}]);
|