@datalayer/agent-runtimes 1.5.21 → 1.5.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-embed/chunks/{AgentDetails-C7tCazwB.js → AgentDetails-Xvq2IvHg.js} +1 -1
- package/dist-embed/chunks/{AgentDetailsDialog-Cwps4GeH.js → AgentDetailsDialog-DmtKB_5z.js} +1 -1
- package/dist-embed/chunks/{AgentInspector-Gk7jbg8t.js → AgentInspector-EiBHJgc9.js} +1 -1
- package/dist-embed/chunks/{AgentInspectorDialog-BSSDOFrT.js → AgentInspectorDialog-3fbLXnLP.js} +1 -1
- package/dist-embed/chunks/{CellSidebarExtension-p2BAkwis.js → CellSidebarExtension-CDnzN9Cb.js} +8 -8
- package/dist-embed/chunks/ChatView-BjZ993Ch.js +32 -0
- package/dist-embed/chunks/{ContextPie-bd_YOjzP.js → ContextPie-DdsXl5s7.js} +1 -1
- package/dist-embed/chunks/{DeckComponent-4gxuEH4A.js → DeckComponent-Cb4_dZpN.js} +2 -2
- package/dist-embed/chunks/{DocumentView-BZSYqTh_.js → DocumentView-Caxb2xz-.js} +1 -1
- package/dist-embed/chunks/{EphemeralDocument-Cevnk5OF.js → EphemeralDocument-DIHjR5l8.js} +1 -1
- package/dist-embed/chunks/{EphemeralNotebook-JvALIbK2.js → EphemeralNotebook-1Rwa3anx.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawComponent-CbghNk-F.js → ExcalidrawComponent-vJQwgcUt.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawModal-BOVvWzYQ.js → ExcalidrawModal-BDgjdSz2.js} +1 -1
- package/dist-embed/chunks/{JupyterLexicalExtension-CRccZ2h7.js → JupyterLexicalExtension-_7FM5Om8.js} +28 -28
- package/dist-embed/chunks/{KernelVariables-ompObBEM.js → KernelVariables-CKIqy599.js} +1 -1
- package/dist-embed/chunks/{LexicalToolRegistry-BlBEZPP4.js → LexicalToolRegistry-8wJyLumb.js} +1 -1
- package/dist-embed/chunks/{NotebookToolSurfaces-DP8sWqVy.js → NotebookToolSurfaces-YAM1bvZS.js} +1 -1
- package/dist-embed/chunks/{NotebookView-DC6BDVEp.js → NotebookView-C8RCvsR1.js} +1 -1
- package/dist-embed/chunks/{Output-C4hBhZ5k.js → Output-BWClePP-.js} +1 -1
- package/dist-embed/chunks/{SandboxDetailsDialog-CX8wvCLJ.js → SandboxDetailsDialog-CDSxIC0-.js} +1 -1
- package/dist-embed/chunks/{SchemaForm-BuhXDyz6.js → SchemaForm-CO_2yGg2.js} +1 -1
- package/dist-embed/chunks/{WidgetVariableView-C2X5Ehcg.js → WidgetVariableView--osoOLv8.js} +1 -1
- package/dist-embed/chunks/{YouTubePlugin-CjgOnMCz.js → YouTubePlugin-BB7Z7INn.js} +1 -1
- package/dist-embed/chunks/{abnfDiagram-VCTEODGH-kzVu7pzT.js → abnfDiagram-VCTEODGH-faK2fyHC.js} +1 -1
- package/dist-embed/chunks/{ar-SA-G6X2FPQ2-ArgZTGSp.js → ar-SA-G6X2FPQ2-D6Ko4I2x.js} +1 -1
- package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-DVZUrWEx.js → architectureDiagram-5GKGNRK7-DBMLRsbO.js} +1 -1
- package/dist-embed/chunks/{az-AZ-76LH7QW2-DQgz6n32.js → az-AZ-76LH7QW2-B3UhxnSz.js} +1 -1
- package/dist-embed/chunks/{bg-BG-XCXSNQG7-Cx0dPt6-.js → bg-BG-XCXSNQG7-BS-QRZjB.js} +1 -1
- package/dist-embed/chunks/{blockDiagram-868be97b-DEQh5CUO.js → blockDiagram-868be97b-BXBoGds2.js} +1 -1
- package/dist-embed/chunks/{blockDiagram-I7D4REHJ-C6gbEBfg.js → blockDiagram-I7D4REHJ-BNkBA3Vb.js} +1 -1
- package/dist-embed/chunks/{bn-BD-2XOGV67Q-BkekmuYO.js → bn-BD-2XOGV67Q-DNg0uIV0.js} +1 -1
- package/dist-embed/chunks/{c4Diagram-3f4bdde3-CUcRctJE.js → c4Diagram-3f4bdde3-4OdTwU_t.js} +1 -1
- package/dist-embed/chunks/{c4Diagram-7LVT6UL2-DSQiEaxC.js → c4Diagram-7LVT6UL2-BGpBMrvl.js} +1 -1
- package/dist-embed/chunks/{ca-ES-6MX7JW3Y-Yr14RtMP.js → ca-ES-6MX7JW3Y-Bn4yHfTY.js} +1 -1
- package/dist-embed/chunks/{celltoolbartracker-Bx9x9aeh.js → celltoolbartracker-DcYHi8Du.js} +1 -1
- package/dist-embed/chunks/{chunk-2Q5K7J3B-DbzMjK_L.js → chunk-2Q5K7J3B-P4f8Cifn.js} +1 -1
- package/dist-embed/chunks/{chunk-5VM5RSS4-rEZEdbpi.js → chunk-5VM5RSS4-BVaSZr_4.js} +1 -1
- package/dist-embed/chunks/{chunk-F27PBJKO-BH7lDumP.js → chunk-F27PBJKO-C-90E7AT.js} +1 -1
- package/dist-embed/chunks/{chunk-IMKFNOWR-BA-vmq_V.js → chunk-IMKFNOWR--OZX7QCt.js} +1 -1
- package/dist-embed/chunks/{chunk-JWPE2WC7-BfRI4eJ2.js → chunk-JWPE2WC7-OHowekj4.js} +1 -1
- package/dist-embed/chunks/{chunk-POPQ4Y6H-B7pT6rUf.js → chunk-POPQ4Y6H-BgLsR3l7.js} +1 -1
- package/dist-embed/chunks/{chunk-SVP7TREG-BxpYXJab.js → chunk-SVP7TREG-kM9Erqyf.js} +1 -1
- package/dist-embed/chunks/{chunk-TICWLB2K-LCiyX33a.js → chunk-TICWLB2K-pVdCft0o.js} +1 -1
- package/dist-embed/chunks/{chunk-XXDRQBXY-islJGiCO.js → chunk-XXDRQBXY-BSfKSQ7y.js} +1 -1
- package/dist-embed/chunks/{classDiagram-ZZMXUADV-C7-Ca_nP.js → classDiagram-ZZMXUADV-Dq0Eb9fh.js} +1 -1
- package/dist-embed/chunks/{classDiagram-f62afe4f-BaJUb6H9.js → classDiagram-f62afe4f-C8j4XsQw.js} +1 -1
- package/dist-embed/chunks/{classDiagram-v2-604399ef-s6LKeK41.js → classDiagram-v2-604399ef-BVT78aGU.js} +1 -1
- package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-C7-Ca_nP.js → classDiagram-v2-VYDZK3BY-Dq0Eb9fh.js} +1 -1
- package/dist-embed/chunks/{code-block-IT6T5CEO-BieLU8ls.js → code-block-IT6T5CEO-Dbm1cj5T.js} +1 -1
- package/dist-embed/chunks/{component-p2xkjXeh.js → component-CsXw-w1P.js} +1 -1
- package/dist-embed/chunks/{cose-bilkent-JH36ORCC-BkezndW_.js → cose-bilkent-JH36ORCC-DEGpy0W8.js} +1 -1
- package/dist-embed/chunks/{createText-aed3d8b3-Dw8k7JC8.js → createText-aed3d8b3-BukHQ1P8.js} +1 -1
- package/dist-embed/chunks/{cs-CZ-2BRQDIVT-DYR-S6bD.js → cs-CZ-2BRQDIVT-DUGnyonZ.js} +1 -1
- package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-DqoI6t3s.js → cynefinDiagram-5FMLGOSQ-CnZ3wqXe.js} +1 -1
- package/dist-embed/chunks/{da-DK-5WZEPLOC-DhaHIgKI.js → da-DK-5WZEPLOC-Is8nybqO.js} +1 -1
- package/dist-embed/chunks/{dagre-GXQ25YYZ-pcAHu_bK.js → dagre-GXQ25YYZ-Dbp_O7kO.js} +1 -1
- package/dist-embed/chunks/{de-DE-XR44H4JA-CJpRH2Fy.js → de-DE-XR44H4JA-D54sMa4L.js} +1 -1
- package/dist-embed/chunks/{diagram-S7CK7UJ4-W17wgXHY.js → diagram-S7CK7UJ4-DHPFd83P.js} +1 -1
- package/dist-embed/chunks/{diagram-UQ7AKVKN-mH7QBO8y.js → diagram-UQ7AKVKN-BqXFRP10.js} +1 -1
- package/dist-embed/chunks/{diagram-VSXAHHWV-CFHqpDaB.js → diagram-VSXAHHWV-DO0toZBQ.js} +1 -1
- package/dist-embed/chunks/{diagram-VX7I27RA-DQ6XlKLw.js → diagram-VX7I27RA-Diuc1eIf.js} +1 -1
- package/dist-embed/chunks/{diagram-Z3DM3KII-Cenqf76m.js → diagram-Z3DM3KII-DtauJWd2.js} +1 -1
- package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-Cqmnghct.js → ebnfDiagram-PWID7BFC-SU3uN2_2.js} +1 -1
- package/dist-embed/chunks/{edges-b2856ca0-ChO7JKaP.js → edges-b2856ca0-DbD0XDJS.js} +1 -1
- package/dist-embed/chunks/{el-GR-BZB4AONW-DPGB1p8K.js → el-GR-BZB4AONW-CvM3SWat.js} +1 -1
- package/dist-embed/chunks/{erDiagram-5d81789a-jzhAXdZi.js → erDiagram-5d81789a-C-Tzt4MD.js} +1 -1
- package/dist-embed/chunks/{erDiagram-RLTQ6QDP-hAbP0vV0.js → erDiagram-RLTQ6QDP-C_c-qnRZ.js} +1 -1
- package/dist-embed/chunks/{es-ES-U4NZUMDT-CLztgM3g.js → es-ES-U4NZUMDT-BZDRRuRf.js} +1 -1
- package/dist-embed/chunks/{eu-ES-A7QVB2H4--ffZf65_.js → eu-ES-A7QVB2H4-DAmknI9y.js} +1 -1
- package/dist-embed/chunks/{fa-IR-HGAKTJCU-Cwwej6FC.js → fa-IR-HGAKTJCU-CQhKri4O.js} +1 -1
- package/dist-embed/chunks/{fi-FI-Z5N7JZ37-Tw-dUSxy.js → fi-FI-Z5N7JZ37-DzEDoP64.js} +1 -1
- package/dist-embed/chunks/{flowDb-185abca5-DDUaXZ_Q.js → flowDb-185abca5-Di4aD0Mg.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-1629c991-DpvDtFPK.js → flowDiagram-1629c991-fImernS2.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-HODETNUW-DENY4Bvt.js → flowDiagram-HODETNUW-DzoskzA4.js} +1 -1
- package/dist-embed/chunks/{flowDiagram-v2-1d953310-TxFSXMN7.js → flowDiagram-v2-1d953310-P1qDfDo-.js} +1 -1
- package/dist-embed/chunks/{flowchart-elk-definition-6df44142-BGFxwidp.js → flowchart-elk-definition-6df44142-CXebTCvX.js} +1 -1
- package/dist-embed/chunks/{fr-FR-RHASNOE6-CT1NyjSV.js → fr-FR-RHASNOE6-DiSkyvEB.js} +1 -1
- package/dist-embed/chunks/{ganttDiagram-3b0b3873-DJqKtGUz.js → ganttDiagram-3b0b3873-Bupos8HO.js} +1 -1
- package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-Ddh9hVkO.js → ganttDiagram-EL5Y4UJY-e3WDalFj.js} +1 -1
- package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-B3BVHs36.js → gitGraphDiagram-WWUBYQGX-Ck49f0H9.js} +1 -1
- package/dist-embed/chunks/{gitGraphDiagram-f01e8bc2-vOvP_sU8.js → gitGraphDiagram-f01e8bc2-DM8FMetI.js} +1 -1
- package/dist-embed/chunks/{gl-ES-HMX3MZ6V-BKTaXj_2.js → gl-ES-HMX3MZ6V-3AJMzY-I.js} +1 -1
- package/dist-embed/chunks/{he-IL-6SHJWFNN-BJ5SwTG5.js → he-IL-6SHJWFNN-Cuh5an4X.js} +1 -1
- package/dist-embed/chunks/{hi-IN-IWLTKZ5I-D5ZQxogx.js → hi-IN-IWLTKZ5I-BbeuFB83.js} +1 -1
- package/dist-embed/chunks/{hu-HU-A5ZG7DT2-CoAAAzpy.js → hu-HU-A5ZG7DT2-C1OMfhob.js} +1 -1
- package/dist-embed/chunks/{id-ID-SAP4L64H-DFWbGjYj.js → id-ID-SAP4L64H-BzKILJTZ.js} +1 -1
- package/dist-embed/chunks/{index-9bae90f3-YA-Pbv-C.js → index-9bae90f3-l9tb84fw.js} +1 -1
- package/dist-embed/chunks/{index-CIDdX0nc.js → index-BFdE0KFI.js} +1 -1
- package/dist-embed/chunks/{index-Db1qHC1a.js → index-BMandbJB.js} +1 -1
- package/dist-embed/chunks/{index-BTeNnRc_.js → index-BO6VQLH6.js} +4 -4
- package/dist-embed/chunks/{index-1MXuxaax.js → index-BTnG8qrO.js} +1 -1
- package/dist-embed/chunks/{index-BVzIb3Wy.js → index-BktUM85c.js} +1 -1
- package/dist-embed/chunks/{index-BuyZwxeT.js → index-CAd5YQQl.js} +1 -1
- package/dist-embed/chunks/{index-DMf0f7ny.js → index-CFP9psRB.js} +2 -2
- package/dist-embed/chunks/{index-DPzPvDBn.js → index-CKFrz1es.js} +1 -1
- package/dist-embed/chunks/{index-DTCcg1ap.js → index-CM7xo08K.js} +1 -1
- package/dist-embed/chunks/{index-8Jy3Vws8.js → index-CPpm1tqJ.js} +6 -6
- package/dist-embed/chunks/{index-B0MhQWhs.js → index-CRZ1qthh.js} +1 -1
- package/dist-embed/chunks/{index-FbZJIbu_.js → index-CWwj0zW9.js} +1 -1
- package/dist-embed/chunks/{index-CCA_V9Td.js → index-Cu0bp_EI.js} +1 -1
- package/dist-embed/chunks/{index-BfMo5nXi.js → index-CyQgE_Es.js} +2 -2
- package/dist-embed/chunks/{index-BzQxauhZ.js → index-D4QM3qbA.js} +1 -1
- package/dist-embed/chunks/{index-D62kZnWZ.js → index-D64QvG43.js} +5 -5
- package/dist-embed/chunks/{index-JhvHCMRQ.js → index-DEjLPUAD.js} +1 -1
- package/dist-embed/chunks/{index-CkOZcvYl.js → index-DLimRfHQ.js} +1 -1
- package/dist-embed/chunks/{index-B0omKuYl.js → index-DN-cizG6.js} +1 -1
- package/dist-embed/chunks/{index-C7os26P7.js → index-DSN70XMH.js} +2 -2
- package/dist-embed/chunks/{index-CxIZHPCc.js → index-DY8mjz1l.js} +1 -1
- package/dist-embed/chunks/{index-BgWf1G8H.js → index-Dobs-OKl.js} +1 -1
- package/dist-embed/chunks/index-DyVR0igi.js +34 -0
- package/dist-embed/chunks/{index-6feFd5AZ.js → index-PqsSImlj.js} +1 -1
- package/dist-embed/chunks/{index-BNFZYAJT.js → index-SbFvdBPQ.js} +1 -1
- package/dist-embed/chunks/{index-B9vBhR-p.js → index-dYwQAVs_.js} +1 -1
- package/dist-embed/chunks/{index-DTbF6Y7O.js → index-f418CYn7.js} +1 -1
- package/dist-embed/chunks/{index-BL4KuFQP.js → index-f9WZsG2n.js} +1 -1
- package/dist-embed/chunks/{index-DSgHh0-i.js → index-noRoZrq5.js} +1 -1
- package/dist-embed/chunks/{index-B8y71UkT.js → index-wk9vl2uW.js} +1 -1
- package/dist-embed/chunks/{index-Dw1P-H6s.js → index-x45cMPwN.js} +1 -1
- package/dist-embed/chunks/{index.esm-B6P80s3J.js → index.esm-p0OnSU9h.js} +1 -1
- package/dist-embed/chunks/{infoDiagram-27XIBGKW-CZPNcDbH.js → infoDiagram-27XIBGKW-BjyM865y.js} +1 -1
- package/dist-embed/chunks/{infoDiagram-a29d40f1-Di_kmyTC.js → infoDiagram-a29d40f1-DXYFLipl.js} +1 -1
- package/dist-embed/chunks/{isEqual-D0eOPSLC.js → isEqual-Cwjr2skl.js} +1 -1
- package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-DD5TaPvH.js → ishikawaDiagram-5VMMS53U-Bb5g5HNe.js} +1 -1
- package/dist-embed/chunks/{it-IT-JPQ66NNP-C7p9bCWQ.js → it-IT-JPQ66NNP-DuG05fUR.js} +1 -1
- package/dist-embed/chunks/{ja-JP-DBVTYXUO-DupAM7Cv.js → ja-JP-DBVTYXUO-DeDfL3Bk.js} +1 -1
- package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-1NqbTyL4.js → journeyDiagram-3NMN7TZE-96VNFopN.js} +1 -1
- package/dist-embed/chunks/{journeyDiagram-95396277-xr9Xk_mL.js → journeyDiagram-95396277-CQ_kN2gp.js} +1 -1
- package/dist-embed/chunks/{kaa-6HZHGXH3-DrthOcPY.js → kaa-6HZHGXH3-BRKFVG6s.js} +1 -1
- package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-C4hr0kbU.js → kab-KAB-ZGHBKWFO-Uqakmhz5.js} +1 -1
- package/dist-embed/chunks/{kanban-definition-UXKFOSKX-DlSwjr3b.js → kanban-definition-UXKFOSKX-BPsXEKm4.js} +1 -1
- package/dist-embed/chunks/{kk-KZ-P5N5QNE5-CrjDkh9r.js → kk-KZ-P5N5QNE5-DWMXMIAK.js} +1 -1
- package/dist-embed/chunks/{km-KH-HSX4SM5Z-JHWf7VZ6.js → km-KH-HSX4SM5Z-BXNl9QnV.js} +1 -1
- package/dist-embed/chunks/{ko-KR-MTYHY66A-CJ4JxKMG.js → ko-KR-MTYHY66A-BZgIqTuN.js} +1 -1
- package/dist-embed/chunks/{ku-TR-6OUDTVRD-YSlLPag_.js → ku-TR-6OUDTVRD-CQNa5i5U.js} +1 -1
- package/dist-embed/chunks/{layout-5FOjTADt.js → layout-Dq0J6INj.js} +1 -1
- package/dist-embed/chunks/{lexicalHooks-eqXJbnX9.js → lexicalHooks-Pqoe8h_O.js} +1 -1
- package/dist-embed/chunks/{lt-LT-XHIRWOB4-2v6r2YYq.js → lt-LT-XHIRWOB4-BQW2k7iv.js} +1 -1
- package/dist-embed/chunks/{lv-LV-5QDEKY6T-DVGd68q4.js → lv-LV-5QDEKY6T-B0HRRCC4.js} +1 -1
- package/dist-embed/chunks/{mermaid.core-BU1Nkb56.js → mermaid.core-B9dEBs01.js} +4 -4
- package/dist-embed/chunks/{mermaid.core-DY5DKOtx.js → mermaid.core-pflA3DMC.js} +2 -2
- package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-sSfUfKt8.js → mindmap-definition-YA3MSWOX-DwLQYAqQ.js} +1 -1
- package/dist-embed/chunks/{mindmap-definition-e4c1d938-btrk6STt.js → mindmap-definition-e4c1d938-CDWIPlcb.js} +1 -1
- package/dist-embed/chunks/{mr-IN-CRQNXWMA-D1q8zjMr.js → mr-IN-CRQNXWMA-DXR6sWSH.js} +1 -1
- package/dist-embed/chunks/{my-MM-5M5IBNSE-CCWuEpIN.js → my-MM-5M5IBNSE-BZ5_9oCm.js} +1 -1
- package/dist-embed/chunks/{nb-NO-T6EIAALU-eJ92wx2h.js → nb-NO-T6EIAALU-CBtv36wZ.js} +1 -1
- package/dist-embed/chunks/{nl-NL-IS3SIHDZ-DmkMgsvp.js → nl-NL-IS3SIHDZ-CcqE3cY8.js} +1 -1
- package/dist-embed/chunks/{nn-NO-6E72VCQL-CWYEaXBn.js → nn-NO-6E72VCQL-Cl9wPgpU.js} +1 -1
- package/dist-embed/chunks/{oc-FR-POXYY2M6-CayriaEZ.js → oc-FR-POXYY2M6-CQEkV2p1.js} +1 -1
- package/dist-embed/chunks/{pa-IN-N4M65BXN-CydiKcR8.js → pa-IN-N4M65BXN-CaE6yG0U.js} +1 -1
- package/dist-embed/chunks/{pegDiagram-XKGWAZYB--dcG-x2B.js → pegDiagram-XKGWAZYB-Cwo6HzRh.js} +1 -1
- package/dist-embed/chunks/{percentages-BXMCSKIN-fzYCDL7m.js → percentages-BXMCSKIN-Bk5xifLL.js} +3 -3
- package/dist-embed/chunks/{pieDiagram-E7YTZNPT-D-uncTun.js → pieDiagram-E7YTZNPT-BvBHesgq.js} +1 -1
- package/dist-embed/chunks/{pieDiagram-c941bede-BoVaJIdw.js → pieDiagram-c941bede-Bsn1Bxk5.js} +1 -1
- package/dist-embed/chunks/{pl-PL-T2D74RX3-DhiK4YSC.js → pl-PL-T2D74RX3-M1pQcF2j.js} +1 -1
- package/dist-embed/chunks/{pt-BR-5N22H2LF-CwSVxIqs.js → pt-BR-5N22H2LF-BFDHu72z.js} +1 -1
- package/dist-embed/chunks/{pt-PT-UZXXM6DQ-BnxquNJT.js → pt-PT-UZXXM6DQ-DFcZY1Gz.js} +1 -1
- package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-ClE_bWPS.js → quadrantDiagram-AXDQQJYC-AaQ_WgXa.js} +1 -1
- package/dist-embed/chunks/{quadrantDiagram-cf8b8fe0-V_e2KgDu.js → quadrantDiagram-cf8b8fe0-BhaNj-gz.js} +1 -1
- package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-CkhmY0tS.js → railroadDiagram-O6MQD6OU-BlWFu3pn.js} +1 -1
- package/dist-embed/chunks/{renderer-BwlsmtXF.js → renderer-Dy4lZ1KZ.js} +1 -1
- package/dist-embed/chunks/{requirementDiagram-53bda41b-BZw7Ipej.js → requirementDiagram-53bda41b-C2WctYyl.js} +1 -1
- package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-BXwXUXrr.js → requirementDiagram-BXWQKSXE-BpWNFdrw.js} +1 -1
- package/dist-embed/chunks/{ro-RO-JPDTUUEW-D3G2f_fQ.js → ro-RO-JPDTUUEW-BGm_Xwik.js} +1 -1
- package/dist-embed/chunks/{ru-RU-B4JR7IUQ-SnVfNwaW.js → ru-RU-B4JR7IUQ-BsrZ_x8p.js} +1 -1
- package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-0B_Kvjm2.js → sankeyDiagram-P5KCCOFB-DnT5kYW5.js} +1 -1
- package/dist-embed/chunks/{sankeyDiagram-c3ef121a-e1QLivkZ.js → sankeyDiagram-c3ef121a-3FD4GIJS.js} +1 -1
- package/dist-embed/chunks/{sequenceDiagram-82a5b84f-N-16oABv.js → sequenceDiagram-82a5b84f-CZQmoHAd.js} +1 -1
- package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-CtbkJYCv.js → sequenceDiagram-WJ2MYXX4-0HHgJN0L.js} +1 -1
- package/dist-embed/chunks/{sessions-C9DBCyZI.js → sessions-BRALW9Yv.js} +1 -1
- package/dist-embed/chunks/{si-LK-N5RQ5JYF-Da7Bfexz.js → si-LK-N5RQ5JYF-BfaYS44g.js} +1 -1
- package/dist-embed/chunks/{sizeCapture-INFHLROL-B3xt8UaI.js → sizeCapture-INFHLROL-CIF2j9e_.js} +1 -1
- package/dist-embed/chunks/{sk-SK-C5VTKIMK-BB-Ks1b-.js → sk-SK-C5VTKIMK-D-K9yMTN.js} +1 -1
- package/dist-embed/chunks/{sl-SI-NN7IZMDC-DF3fUKHX.js → sl-SI-NN7IZMDC-B48XvZUw.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-43e79a5f-BJcJNr41.js → stateDiagram-43e79a5f-CMlUXY1x.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-D77RDMKH-LjWP-fRB.js → stateDiagram-D77RDMKH-CkICPC-C.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-v2-2041ed4f-DTEruWg2.js → stateDiagram-v2-2041ed4f-BcO6vvJA.js} +1 -1
- package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-_xCQcvgo.js → stateDiagram-v2-MP3YSRHH-BFlXwfgz.js} +1 -1
- package/dist-embed/chunks/{styles-455b33cd-OIhmfs6N.js → styles-455b33cd-BfyZJvzN.js} +1 -1
- package/dist-embed/chunks/{styles-f932cba9-CwLjreIv.js → styles-f932cba9-k2wfF-9Q.js} +1 -1
- package/dist-embed/chunks/{styles-fcc2142b-DP74dQpR.js → styles-fcc2142b-z3csTkbW.js} +1 -1
- package/dist-embed/chunks/{subset-shared.chunk-Cf9zgTA9.js → subset-shared.chunk-DzA7mJjZ.js} +1 -1
- package/dist-embed/chunks/{subset-worker.chunk-WYW3AHku.js → subset-worker.chunk-CsTEdHAt.js} +1 -1
- package/dist-embed/chunks/{sv-SE-XGPEYMSR-CeR-pJHy.js → sv-SE-XGPEYMSR-DfhLO_Vt.js} +1 -1
- package/dist-embed/chunks/{svgDrawCommon-148a3cd9-CgE5QJIv.js → svgDrawCommon-148a3cd9-NqUFgQ9x.js} +1 -1
- package/dist-embed/chunks/{swimlanes-42K2YHIH-CZyflHYJ.js → swimlanes-42K2YHIH-B6pxWv6a.js} +1 -1
- package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-Bmr6N4fj.js → swimlanesDiagram-VR7AAH4N-B9ThT6OH.js} +1 -1
- package/dist-embed/chunks/{ta-IN-2NMHFXQM-lmsodGuU.js → ta-IN-2NMHFXQM-EZA_oxSt.js} +1 -1
- package/dist-embed/chunks/{th-TH-HPSO5L25-DQCWr96I.js → th-TH-HPSO5L25-G9vy_zQH.js} +1 -1
- package/dist-embed/chunks/{timeline-definition-24CTP7MA-DqY5EM6p.js → timeline-definition-24CTP7MA-DVcslyxd.js} +1 -1
- package/dist-embed/chunks/{timeline-definition-7545f45a-B8wMEyZY.js → timeline-definition-7545f45a-IhzNtIcW.js} +1 -1
- package/dist-embed/chunks/{tr-TR-DEFEU3FU-CqnvlGZW.js → tr-TR-DEFEU3FU-DBj_G5CD.js} +1 -1
- package/dist-embed/chunks/{uk-UA-QMV73CPH-DdWFjbHe.js → uk-UA-QMV73CPH-DN7lMu5H.js} +1 -1
- package/dist-embed/chunks/{vennDiagram-4TSXK5OY-63-O_xI8.js → vennDiagram-4TSXK5OY-KKysbuVs.js} +1 -1
- package/dist-embed/chunks/{vi-VN-M7AON7JQ-CydTT0Fi.js → vi-VN-M7AON7JQ-LoT02qgd.js} +1 -1
- package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-C9vLUvHf.js → wardleyDiagram-VM6X3IG4-CTed9ps7.js} +1 -1
- package/dist-embed/chunks/{xychartDiagram-3f383b91-BfoQg8n9.js → xychartDiagram-3f383b91-CsxcWMT8.js} +1 -1
- package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-BZr3T3n_.js → xychartDiagram-S5SC5T6Z-Kpqryflz.js} +1 -1
- package/dist-embed/chunks/{zh-CN-LNUGB5OW-DEn1TFfK.js → zh-CN-LNUGB5OW-CjexwOqT.js} +1 -1
- package/dist-embed/chunks/{zh-HK-E62DVLB3-DJQRmOHH.js → zh-HK-E62DVLB3-B0ys_HV6.js} +1 -1
- package/dist-embed/chunks/{zh-TW-RAJ6MFWO-B7s9vmSf.js → zh-TW-RAJ6MFWO-tQJWLJuU.js} +1 -1
- package/dist-embed/datalayer-app-main.js +19 -19
- package/lib/apps/apps/records.d.ts +0 -29
- package/lib/apps/apps/records.js +11 -34
- package/lib/apps/apps/threads.d.ts +2 -21
- package/lib/apps/apps/threads.js +0 -75
- package/lib/apps/embed/embedSession.d.ts +0 -8
- package/lib/apps/embed/embedSession.js +1 -38
- package/lib/apps/embed/visitorApp.d.ts +22 -3
- package/lib/apps/embed/visitorApp.js +42 -4
- package/lib/apps/plugins/chat/ChatView.js +2 -1
- package/lib/chat/base/ChatBase.js +1 -1
- package/lib/chat/base/fullContextMessages.js +1 -1
- package/lib/hooks/useAgUi.js +1 -1
- package/lib/hooks/useToolApprovals.d.ts +1 -1
- package/lib/hooks/useToolApprovals.js +1 -1
- package/lib/{protocols → portable}/agUiRefusal.d.ts +1 -1
- package/lib/{protocols → portable}/agUiRefusal.js +1 -1
- package/lib/portable/agui.d.ts +72 -0
- package/lib/portable/agui.js +174 -0
- package/lib/portable/conversation.d.ts +124 -0
- package/lib/portable/conversation.js +357 -0
- package/lib/portable/index.d.ts +11 -6
- package/lib/portable/index.js +14 -11
- package/lib/portable/records.d.ts +27 -0
- package/lib/portable/records.js +46 -0
- package/lib/portable/sessions.d.ts +92 -0
- package/lib/portable/sessions.js +134 -0
- package/lib/portable/thread.d.ts +41 -0
- package/lib/portable/thread.js +102 -0
- package/lib/protocols/AGUIAdapter.d.ts +0 -2
- package/lib/protocols/AGUIAdapter.js +39 -74
- package/package.json +1 -1
- package/dist-embed/chunks/ChatView-fHb_i4kH.js +0 -32
- package/dist-embed/chunks/index-DpJpQnPn.js +0 -34
- /package/lib/{utils → portable}/approvals.d.ts +0 -0
- /package/lib/{utils → portable}/approvals.js +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{o as ue,t as rt,T as at,p as de,b as Ve,f as Ue,I as dt,j as ct,a as qe,d as ut,C as Ee,g as Ne}from"./index-DMf0f7ny.js";import{r as H,h9 as ht,c4 as pt,v as A,ag as Z,c1 as ne,ak as O,gM as gt,dH as bt,gD as mt,ha as Ct,an as $e,dN as vt,h2 as ft,dL as _t,cv as Q,c8 as yt,hb as _,cI as De,cD as Je,cJ as ze,gb as Ge,gc as Ye,dK as xe,am as xt,ci as Xe,ch as ve,c2 as we,hc as wt,hd as kt,h4 as St,b$ as ke,l as Y,aW as At,gE as Mt,J as Tt,ah as pe,gR as G,he,af as ie,hf as Ce,dE as Oe,hg as Bt,hh as Et,cV as je,cT as Re,hi as le,cX as Ie,hj as Pe,cU as Nt,hk as Ot,hl as jt,ac as Qe,hm as Rt,hn as It,dJ as Pt,ai as F,du as ge,ho as fe,cx as Lt,dC as Wt,c$ as Ht,hp as Ft,hq as se,hr as Ze,d7 as Kt,b_ as Vt,aj as Ut,cy as qt,ca as $t,gP as Dt,hs as Jt,cN as zt,cQ as Gt,ht as Yt,hu as Xt,hv as Qt,da as Zt,db as eo,cS as to,aV as oo,ee as no}from"../datalayer-app-main.js";import{b as io,I as et}from"./token-BRjncM66.js";import{ToolbarItems as lo}from"./index-CkOZcvYl.js";import{I as so}from"./index-Dv_XGY6Q.js";import{I as Se}from"./tokens-BHMD_ju9.js";import{a as tt,I,b as ot,c as ro}from"./tokens-CydTkiyv.js";import{I as ao,a as nt}from"./tokens-BvmYCqiu.js";import{I as co}from"./tokens-CBD7cd6p.js";import{f as it,e as uo,c as ho,I as po,b as go}from"./index-BfMo5nXi.js";import{I as lt}from"./tokens-D1_9ZFxB.js";import{I as be}from"./tokens-BHLmeqjP.js";import{a as Ae}from"./tokens-_fLcuFXz.js";import{I as bo}from"./tokens-CENaHAHm.js";import{I as mo}from"./index-C7os26P7.js";import{I as Co}from"./tokens-DXLxGbDM.js";import{W as vo,u as Le,V as fo,I as _o,a as yo,b as xo,c as wo}from"./document-Dluvp7zl.js";import{b as ko,c as So,d as Ao}from"./CellSidebarExtension-p2BAkwis.js";import{T as Mo,a as To}from"./model-BziAhKNp.js";import{C as We}from"./celltoolbartracker-Bx9x9aeh.js";import"./hoverbox-CStlKQWE.js";import"./Output-C4hBhZ5k.js";import"./index-DpJpQnPn.js";import"./color-CG7_7V2-.js";import"./isEqual-D0eOPSLC.js";import"./defaultLocale-5voVPcsN.js";import"./index-DbMBnR4l.js";import"./KebabHorizontalIcon-CXDXtkuL.js";import"./PaintbrushIcon-CLU8RilX.js";import"./index-BJhxZF_K.js";import"./RestartIcon-Ca6_HoK0.js";import"./NotebookSkeleton-CI7ovjNW.js";import"./Avatar-9MpXENSs.js";import"./renderer-BwlsmtXF.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DuKx0yk0.js";/* empty css */import"./index-Dro44tIm.js";/* empty css *//* empty css */import"./index-DsG9xhMj.js";/* empty css */import"./index-CNU-WVhQ.js";import"./index--OLIX362.js";import"./index-DYGslHkf.js";import"./index-BSRVX3UN.js";import"./index-BH2OX5l8.js";import"./index-C3vDfO5_.js";import"./index-Ko8lxXFd.js";import"./index-CB9u17_J.js";import"./index-BUVtc_FV.js";import"./ArrowLeftIcon-Y3PTljcl.js";import"./SkubbleIcon-tlg17jBG.js";import"./usePrimerThemeBridge-CoHussa9.js";import"./index-BgWf1G8H.js";import"./KernelVariables-ompObBEM.js";import"./index-BvgsWH_d.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-rtMQZWHQ.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-CGQDY041.js";import"./sessions-C9DBCyZI.js";import"./tokens-DTIgYcNS.js";import"./drivecontents-CxwZz_5W.js";import"./kernel-BI-BLP-K.js";const Bo="jp-DefaultStyle",Eo="jp-HTMLSelect";class No extends H.Component{render(){const{className:e,defaultStyle:i=!0,disabled:a,elementRef:s,iconProps:l,icon:p=ht,options:n=[],...c}=this.props,d=pt(Eo,{[Bo]:i},e),g=b=>{b.stopPropagation()},m=n.map(b=>{const f=typeof b=="object"?b:{value:b};return H.createElement("option",{...f,key:f.value},f.label||f.value)});return H.createElement("div",{className:d},H.createElement("select",{onFocus:g,disabled:a,ref:s,...c,multiple:!1},m,c.children),H.createElement(p.react,{tag:"span",stylesheet:"select",right:"4px",top:"4px",...l}))}}function Oo(r){const i=a=>{const s=Math.max(a*3.6,.1),l=s*Math.PI/180,p=Math.sin(l)*104,n=Math.cos(l)*-104;return"M 0 0 v -104 A 104 104 1 "+(s<180?1:0)+" 0 "+p.toFixed(4)+" "+n.toFixed(4)+" z"};return A.createElement("div",{className:"jp-Statusbar-ProgressCircle",role:"progressbar","aria-label":r.label||"Unlabelled progress circle","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r.progress,onClick:r.onClick},A.createElement("svg",{viewBox:"0 0 250 250"},A.createElement("circle",{cx:"125",cy:"125",r:"104",stroke:"var(--jp-inverse-layout-color3)",strokeWidth:"20",fill:"none"}),A.createElement("path",{className:"jp-Statusbar-ProgressCirclePath",transform:"translate(125,125) scale(.9)",d:i(r.progress),fill:"var(--jp-inverse-layout-color3)"})))}const jo="jp-JSONEditor",ce="jp-mod-error",Ro="jp-JSONEditor-host",Io="jp-JSONEditor-header";class Po extends Z{constructor(e){super(),this._dataDirty=!1,this._inputDirty=!1,this._source=null,this._originalValue=ne.emptyObject,this._changeGuard=!1,this.translator=e.translator||O,this._trans=this.translator.load("jupyterlab"),this.addClass(jo),this.headerNode=document.createElement("div"),this.headerNode.className=Io,this.revertButtonNode=gt.element({tag:"span",title:this._trans.__("Revert changes to data")}),this.commitButtonNode=bt.element({tag:"span",title:this._trans.__("Commit changes to data"),marginLeft:"8px"}),this.editorHostNode=document.createElement("div"),this.editorHostNode.className=Ro,this.headerNode.appendChild(this.revertButtonNode),this.headerNode.appendChild(this.commitButtonNode),this.node.appendChild(this.headerNode),this.node.appendChild(this.editorHostNode);const i=new mt.Model({mimeType:"application/json"});i.sharedModel.changed.connect(this._onModelChanged,this),this.model=i,this.editor=e.editorFactory({host:this.editorHostNode,model:i,config:{readOnly:!0}})}get source(){return this._source}set source(e){this._source!==e&&(this._source&&this._source.changed.disconnect(this._onSourceChanged,this),this._source=e,this.editor.setOption("readOnly",e===null),e&&e.changed.connect(this._onSourceChanged,this),this._setValue())}get isDirty(){return this._dataDirty||this._inputDirty}dispose(){var e;this.isDisposed||((e=this.source)===null||e===void 0||e.dispose(),this.model.dispose(),this.editor.dispose(),super.dispose())}handleEvent(e){switch(e.type){case"blur":this._evtBlur(e);break;case"click":this._evtClick(e);break}}onAfterAttach(e){const i=this.editorHostNode;i.addEventListener("blur",this,!0),i.addEventListener("click",this,!0),this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.headerNode.addEventListener("click",this)}onBeforeDetach(e){const i=this.editorHostNode;i.removeEventListener("blur",this,!0),i.removeEventListener("click",this,!0),this.headerNode.removeEventListener("click",this)}_onSourceChanged(e,i){if(!this._changeGuard){if(this._inputDirty||this.editor.hasFocus()){this._dataDirty=!0;return}this._setValue()}}_onModelChanged(e,i){if(i.sourceChange){let a=!0;try{const s=JSON.parse(this.editor.model.sharedModel.getSource());this.removeClass(ce),this._inputDirty=!this._changeGuard&&!ne.deepEqual(s,this._originalValue)}catch{this.addClass(ce),this._inputDirty=!0,a=!1}this.revertButtonNode.hidden=!this._inputDirty,this.commitButtonNode.hidden=!a||!this._inputDirty}}_evtBlur(e){!this._inputDirty&&this._dataDirty&&this._setValue()}_evtClick(e){const i=e.target;this.revertButtonNode.contains(i)?this._setValue():this.commitButtonNode.contains(i)?!this.commitButtonNode.hidden&&!this.hasClass(ce)&&(this._changeGuard=!0,this._mergeContent(),this._changeGuard=!1,this._setValue()):this.editorHostNode.contains(i)&&this.editor.focus()}_mergeContent(){const e=this.editor.model,i=this._originalValue,a=JSON.parse(e.sharedModel.getSource()),s=this.source;if(s){for(const l in a)ne.deepEqual(a[l],i[l]||null)||s.set(l,a[l]);for(const l in i)l in a||s.delete(l)}}_setValue(){this._dataDirty=!1,this._inputDirty=!1,this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.removeClass(ce);const e=this.editor.model,i=this._source?this._source.toJSON():{};if(this._changeGuard=!0,i===void 0)e.sharedModel.setSource(this._trans.__("No data!")),this._originalValue=ne.emptyObject;else{const a=JSON.stringify(i,null,4);e.sharedModel.setSource(a),this._originalValue=i,a.length>1&&a[0]==="{"&&this.editor.setCursorPosition({line:0,column:1})}this._changeGuard=!1,this.commitButtonNode.hidden=!0,this.revertButtonNode.hidden=!0}}const Lo="jp-Notebook-toolbarCellType",Wo="jp-Notebook-toolbarCellTypeDropdown";var _e;(function(r){function e(g,m){const b=(m||O).load("jupyterlab");function f(){if(g.context.model.readOnly)return Xe({title:b.__("Cannot Save"),body:b.__("Document is read-only"),buttons:[ve.okButton()]});g.context.save().then(()=>{if(!g.isDisposed)return g.context.createCheckpoint()})}return Ct($e.create(H.createElement(vt,{signal:g.context.fileChanged},()=>H.createElement(ft,{icon:_t,onClick:f,tooltip:b.__("Save the notebook contents and create checkpoint"),enabled:!!(g&&g.context&&g.context.contentsModel&&g.context.contentsModel.writable)}))))}r.createSaveButton=e;function i(g,m){const b=(m||O).load("jupyterlab");return new Q({icon:yt,onClick:()=>{_.insertBelow(g.content)},tooltip:b.__("Insert a cell below")})}r.createInsertButton=i;function a(g,m,b){const f=(m||O).load("jupyterlab");return new Q({icon:De,onClick:async()=>{b?.get("useSystemClipboardForCells").composite?await _.cutToSystemClipboard(g.content):_.cut(g.content)},tooltip:f.__("Cut the selected cells")})}r.createCutButton=a;function s(g,m,b){const f=(m||O).load("jupyterlab");return new Q({icon:Je,onClick:async()=>{b?.get("useSystemClipboardForCells").composite?await _.copyToSystemClipboard(g.content):_.copy(g.content)},tooltip:f.__("Copy the selected cells")})}r.createCopyButton=s;function l(g,m,b){const f=(m||O).load("jupyterlab");return new Q({icon:ze,onClick:async()=>{b?.get("useSystemClipboardForCells").composite?await _.pasteFromSystemClipboard(g.content):_.paste(g.content)},tooltip:f.__("Paste cells from the clipboard")})}r.createPasteButton=l;function p(g,m,b){const f=(b??O).load("jupyterlab");return new Q({icon:Ge,onClick:()=>{_.runAndAdvance(g.content,g.sessionContext,m,b)},tooltip:f.__("Run the selected cells and advance")})}r.createRunButton=p;function n(g,m,b){const f=(b??O).load("jupyterlab");return new Q({icon:Ye,onClick:()=>{const x=m??new xe({translator:b});x.restart(g.sessionContext).then(o=>(o&&_.runAll(g.content,g.sessionContext,x,b),o))},tooltip:f.__("Restart the kernel, then re-run the whole notebook")})}r.createRestartRunAllButton=n;function c(g,m){return new Ho(g.content,m)}r.createCellTypeItem=c;function d(g,m,b,f){return[{name:"save",widget:e(g,b)},{name:"insert",widget:i(g,b)},{name:"cut",widget:a(g,b,f)},{name:"copy",widget:s(g,b,f)},{name:"paste",widget:l(g,b,f)},{name:"run",widget:p(g,m,b)},{name:"interrupt",widget:ue.createInterruptButton(g.sessionContext,b)},{name:"restart",widget:ue.createRestartButton(g.sessionContext,m,b)},{name:"restart-and-run",widget:n(g,m,b)},{name:"cellType",widget:c(g,b)},{name:"spacer",widget:xt.createSpacerItem()},{name:"kernelName",widget:ue.createKernelNameItem(g.sessionContext,m,b)}]}r.getDefaultItems=d})(_e||(_e={}));class Ho extends $e{constructor(e,i){super(),this.handleChange=a=>{a.target.value!=="-"&&(_.changeCellType(this._notebook,a.target.value),this._notebook.activate())},this.handleKeyDown=a=>{a.key==="Enter"&&this._notebook.activate()},this._trans=(i||O).load("jupyterlab"),this.addClass(Lo),this._notebook=e,e.model&&this.update(),e.activeCellChanged.connect(this.update,this),e.selectionChanged.connect(this.update,this)}render(){let e="-";this._notebook.activeCell&&(e=this._notebook.activeCell.model.type);for(const i of this._notebook.widgets)if(this._notebook.isSelectedOrActive(i)&&i.model.type!==e){e="-";break}return H.createElement(No,{className:Wo,onChange:this.handleChange,onKeyDown:this.handleKeyDown,value:e,"aria-label":this._trans.__("Cell type"),title:this._trans.__("Select the cell type")},H.createElement("option",{value:"-"},"-"),H.createElement("option",{value:"code"},this._trans.__("Code")),H.createElement("option",{value:"markdown"},this._trans.__("Markdown")),H.createElement("option",{value:"raw"},this._trans.__("Raw")))}}function He(r){var e;const i=r.translator||O,a=rt(i),s=i.load("jupyterlab"),l=(e=r.displayOption.showJumpToCell)!==null&&e!==void 0?e:!1,p=r.state,n=r.displayOption.showOnToolBar,c=r.displayOption.showProgress,d=n?"down":"up",g=A.createElement("div",null),[m,b]=A.useState(!1);if(A.useEffect(()=>{if(m)return;const j=()=>{b(!0)};return _.executionScheduled.connect(j),()=>{_.executionScheduled.disconnect(j)}},[l,m]),!p)return g;const f=p.kernelStatus,x={alignSelf:"normal",height:"24px"},o=p.totalTime,t=p.scheduledCellNumber||0,u=p.scheduledCell.size||0,C=t-u;let w=100*C/t,B=c?"":"hidden";!c&&w<100&&(w=0);const M=j=>A.createElement(Oo,{progress:j,width:16,height:24,label:s.__("Kernel status")}),K=j=>s.__("Kernel status: %1",j),V=()=>{const j=r.notebook;_.selectLastRunCell(j),j.activeCell&&j.scrollToCell(j.activeCell)},R=(j,$,P)=>A.createElement("div",{className:"jp-Notebook-ExecutionIndicator",title:c?"":K(a[j]),"data-status":j},$,A.createElement("div",{className:`jp-Notebook-ExecutionIndicator-tooltip ${d} ${B}`},A.createElement("span",null," ",K(a[j])," "),P,l&&m&&A.createElement(St,{className:"jp-Notebook-ExecutionIndicator-jumpButton",onClick:V,title:s.__("Jump to current or last executed cell")},s.__("Jump to cell"))));if(p.kernelStatus==="connecting"||p.kernelStatus==="disconnected"||p.kernelStatus==="unknown")return R(f,A.createElement(wt.react,{...x}),[]);if(p.kernelStatus==="starting"||p.kernelStatus==="terminating"||p.kernelStatus==="restarting"||p.kernelStatus==="initializing")return R(f,A.createElement(kt.react,{...x}),[]);if(p.executionStatus==="busy")return R("busy",M(w),[A.createElement("span",{key:0},s.__("Executed %1/%2 cells",C,t)),A.createElement("span",{key:1},s._n("Elapsed time: %1 second","Elapsed time: %1 seconds",o))]);{const j=p.kernelStatus==="busy"?0:100,$=p.kernelStatus==="busy"||o===0?[]:[A.createElement("span",{key:0},s._n("Executed %1 cell","Executed %1 cells",t)),A.createElement("span",{key:1},s._n("Elapsed time: %1 second","Elapsed time: %1 seconds",o))];return R(p.kernelStatus,M(j),$)}}class X extends we{constructor(e,i=!0){super(new X.Model),this.translator=e||O,this.addClass("jp-mod-highlighted")}render(){if(this.model===null||!this.model.renderFlag)return A.createElement("div",null);{const e=this.model.currentNotebook;return e?A.createElement(He,{displayOption:this.model.displayOption,state:this.model.executionState(e),translator:this.translator,notebook:e}):A.createElement(He,{displayOption:this.model.displayOption,state:void 0,translator:this.translator,notebook:void 0})}}}(function(r){class e extends ke{constructor(){super(),this._notebookExecutionProgress=new WeakMap,this._displayOption={showOnToolBar:!0,showProgress:!0,showJumpToCell:!1},this._renderFlag=!0}attachNotebook(l){var p,n,c,d;if(l&&l.content&&l.context){const g=l.content,m=l.context;if(this._currentNotebook=g,!this._notebookExecutionProgress.has(g)){this._notebookExecutionProgress.set(g,{executionStatus:"idle",kernelStatus:"idle",totalTime:0,interval:0,timeout:0,scheduledCell:new Set,scheduledCellNumber:0,needReset:!0});const b=this._notebookExecutionProgress.get(g),f=u=>{b&&(b.kernelStatus=u.kernelDisplayStatus),this.stateChanged.emit(void 0)};m.statusChanged.connect(f,this);const x=u=>{b&&(b.kernelStatus=u.kernelDisplayStatus),this.stateChanged.emit(void 0)};m.connectionStatusChanged.connect(x,this),m.disposed.connect(u=>{u.connectionStatusChanged.disconnect(x,this),u.statusChanged.disconnect(f,this)});const o=(u,C)=>{const w=C.msg,B=w.header.msg_id;if(w.header.msg_type==="execute_request")this._cellScheduledCallback(g,B);else if(Y.KernelMessage.isStatusMsg(w)&&w.content.execution_state==="idle"){const M=w.parent_header.msg_id;this._cellExecutedCallback(g,M)}else Y.KernelMessage.isStatusMsg(w)&&w.content.execution_state==="restarting"?this._restartHandler(g):w.header.msg_type==="execute_input"&&this._startTimer(g)};(n=(p=m.session)===null||p===void 0?void 0:p.kernel)===null||n===void 0||n.anyMessage.connect(o),(d=(c=m.session)===null||c===void 0?void 0:c.kernel)===null||d===void 0||d.disposed.connect(u=>u.anyMessage.disconnect(o));const t=(u,C)=>{b&&(this._resetTime(b),this.stateChanged.emit(void 0),C.newValue&&C.newValue.anyMessage.connect(o))};m.kernelChanged.connect(t),m.disposed.connect(u=>u.kernelChanged.disconnect(t))}}}get currentNotebook(){return this._currentNotebook}get displayOption(){return this._displayOption}set displayOption(l){this._displayOption=l}executionState(l){return this._notebookExecutionProgress.get(l)}_scheduleSwitchToIdle(l){window.setTimeout(()=>{l.executionStatus="idle",clearInterval(l.interval),this.stateChanged.emit(void 0)},150),l.timeout=window.setTimeout(()=>{l.needReset=!0},1e3)}_cellExecutedCallback(l,p){const n=this._notebookExecutionProgress.get(l);n&&n.scheduledCell.has(p)&&(n.scheduledCell.delete(p),n.scheduledCell.size===0&&this._scheduleSwitchToIdle(n))}_restartHandler(l){const p=this._notebookExecutionProgress.get(l);p&&(p.scheduledCell.clear(),this._scheduleSwitchToIdle(p))}_startTimer(l){const p=this._notebookExecutionProgress.get(l);p&&(p.scheduledCell.size>0?p.executionStatus!=="busy"&&(p.executionStatus="busy",clearTimeout(p.timeout),this.stateChanged.emit(void 0),p.interval=window.setInterval(()=>{this._tick(p)},1e3)):this._resetTime(p))}_cellScheduledCallback(l,p){const n=this._notebookExecutionProgress.get(l);n&&!n.scheduledCell.has(p)&&(n.needReset&&this._resetTime(n),n.scheduledCell.add(p),n.scheduledCellNumber+=1)}_tick(l){l.totalTime+=1,this.stateChanged.emit(void 0)}_resetTime(l){l.totalTime=0,l.scheduledCellNumber=0,l.executionStatus="idle",l.scheduledCell=new Set,clearTimeout(l.timeout),clearInterval(l.interval),l.needReset=!1}get renderFlag(){return this._renderFlag}updateRenderOption(l){this.displayOption.showOnToolBar&&(l.showOnToolBar?this._renderFlag=!0:this._renderFlag=!1),this.displayOption.showProgress=l.showProgress,this.displayOption.showJumpToCell=l.showJumpToCell,this.stateChanged.emit(void 0)}}r.Model=e;function i(s,l,p){const n=new r(l);return n.model.displayOption={showOnToolBar:!0,showProgress:!0,showJumpToCell:!1},n.model.attachNotebook({content:s.content,context:s.sessionContext}),p&&p.then(c=>{const d=g=>{const m=a(g);m.showJumpToCell&&(g.get("recordTiming").composite||g.set("recordTiming",!0).catch(f=>{console.error("Failed to auto-enable recordTiming:",f.message)})),n.model.updateRenderOption(m)};c.changed.connect(d),d(c),n.disposed.connect(()=>{c.changed.disconnect(d)})}).catch(c=>{console.error(c.message)}),n}r.createExecutionIndicatorItem=i;function a(s){let l=!0,p=!0,n=!1;const c=s.get("kernelStatus").composite;return c&&(l=!c.showOnStatusBar,p=c.showProgress,n=c.showJumpToRecentExecutionButton),{showOnToolBar:l,showProgress:p,showJumpToCell:n}}r.getSettingValue=a})(X||(X={}));function Fo(r){const e=(r.translator||O).load("jupyterlab");return H.createElement(at,{source:e.__("Mode: %1",r.modeNames[r.notebookMode])})}class re extends we{constructor(e){super(new re.Model),this.translator=e||O,this._trans=this.translator.load("jupyterlab"),this._modeNames={command:this._trans.__("Command"),edit:this._trans.__("Edit")}}render(){return this.model?(this.node.title=this._trans.__("Notebook is in %1 mode",this._modeNames[this.model.notebookMode]),H.createElement(Fo,{notebookMode:this.model.notebookMode,translator:this.translator,modeNames:this._modeNames})):null}}(function(r){class e extends ke{constructor(){super(...arguments),this._onChanged=a=>{const s=this._notebookMode;this._notebook?this._notebookMode=a.mode:this._notebookMode="command",this._triggerChange(s,this._notebookMode)},this._notebookMode="command",this._notebook=null}get notebookMode(){return this._notebookMode}set notebook(a){const s=this._notebook;s!==null&&(s.stateChanged.disconnect(this._onChanged,this),s.activeCellChanged.disconnect(this._onChanged,this),s.modelContentChanged.disconnect(this._onChanged,this));const l=this._notebookMode;this._notebook=a,this._notebook===null?this._notebookMode="command":(this._notebookMode=this._notebook.mode,this._notebook.stateChanged.connect(this._onChanged,this),this._notebook.activeCellChanged.connect(this._onChanged,this),this._notebook.modelContentChanged.connect(this._onChanged,this)),this._triggerChange(l,this._notebookMode)}_triggerChange(a,s){a!==s&&this.stateChanged.emit(void 0)}}r.Model=e})(re||(re={}));class Ko extends vo{constructor(e,i){super(e,i),this.editorWidget=e,this.options=i,this._type="code",this._readyDelegate=new At,this._editorToCell=new Map,this.editor=e.content,this._cellToEditor=new WeakMap,this.isReady=this.isReady.bind(this),Promise.all([this.widget.context.sessionContext.ready,this.connectionManager.ready]).then(async()=>{await this.initOnceReady(),this._readyDelegate.resolve()}).catch(console.error)}get documentPath(){return this.widget.context.path}get mimeType(){var e;let i,a=this.language_info();return!a||!a.mimetype?i=this.widget.content.codeMimetype:i=a.mimetype,Array.isArray(i)?(e=i[0])!==null&&e!==void 0?e:Mt.defaultMimeType:i}get languageFileExtension(){let e=this.language_info();if(!(!e||!e.file_extension))return e.file_extension.replace(".","")}get wrapperElement(){return this.widget.node}get editors(){if(this.isDisposed)return[];let e=this.widget.content;return this._editorToCell.clear(),e.isDisposed?[]:e.widgets.map(i=>({ceEditor:this._getCellEditor(i),type:i.model.type,value:i.model.sharedModel.getSource()}))}get activeEditor(){return this.editor.activeCell?this._getCellEditor(this.editor.activeCell):void 0}get ready(){return this._readyDelegate.promise}getEditorIndexAt(e){let i=this._getCellAt(e);return this.widget.content.widgets.findIndex(s=>i===s)}getEditorIndex(e){let i=this._editorToCell.get(e);return this.editor.widgets.findIndex(a=>i===a)}getEditorWrapper(e){return this._editorToCell.get(e).node}async onKernelChanged(e,i){if(i.newValue)try{const a=this._languageInfo;await Le(this.isReady,-1),await this._updateLanguageInfo();const s=this._languageInfo;a?.name!=s.name||a?.mimetype!=s?.mimetype||a?.file_extension!=s?.file_extension?(console.log(`Changed to ${this._languageInfo.name} kernel, reconnecting`),this.reloadConnection()):console.log("Keeping old LSP connection as the new kernel uses the same language")}catch(a){console.warn(a),this.reloadConnection()}}dispose(){this.isDisposed||(this.widget.context.sessionContext.kernelChanged.disconnect(this.onKernelChanged,this),this.widget.content.activeCellChanged.disconnect(this._activeCellChanged,this),super.dispose(),this._editorToCell.clear(),Tt.clearData(this))}isReady(){var e;return!this.widget.isDisposed&&this.widget.context.isReady&&this.widget.content.isVisible&&this.widget.content.widgets.length>0&&((e=this.widget.context.sessionContext.session)===null||e===void 0?void 0:e.kernel)!=null}async handleCellChange(e,i){let a=[],s=[];const l=this._type;if(i.type==="set"){let p=[],n=[];if(i.newValues.length===i.oldValues.length){for(let c=0;c<i.newValues.length;c++)i.oldValues[c].type===l&&i.newValues[c].type!==l?p.push(i.newValues[c]):i.oldValues[c].type!==l&&i.newValues[c].type===l&&n.push(i.newValues[c]);a=n,s=p}}else i.type=="add"&&(a=i.newValues.filter(p=>p.type===l));(s.length||a.length||i.type==="set"||i.type==="move"||i.type==="remove"||i.type==="clear")&&await this.updateDocuments();for(let p of a){let n=this.widget.content.widgets.find(c=>c.model.id===p.id);if(!n){console.warn(`Widget for added cell with ID: ${p.id} not found!`);continue}this._getCellEditor(n)}}createVirtualDocument(){return new fo({language:this.language,foreignCodeExtractors:this.options.foreignCodeExtractorsManager,path:this.documentPath,fileExtension:this.languageFileExtension,standalone:!1,hasLspSupportedFile:!1})}language_info(){return this._languageInfo}async initOnceReady(){await Le(this.isReady.bind(this),-1),await this._updateLanguageInfo(),this.initVirtual(),this.connectDocument(this.virtualDocument,!1).catch(console.warn),this.widget.context.sessionContext.kernelChanged.connect(this.onKernelChanged,this),this.widget.content.activeCellChanged.connect(this._activeCellChanged,this),this._connectModelSignals(this.widget),this.editor.modelChanged.connect(e=>{console.warn("Model changed, connecting cell change handler; this is not something we were expecting"),this._connectModelSignals(e)})}_connectModelSignals(e){e.model===null?console.warn(`Model is missing for notebook ${e}, cannot connect cell changed signal!`):e.model.cells.changed.connect(this.handleCellChange,this)}async _updateLanguageInfo(){var e,i,a,s;const l=(s=await((a=(i=(e=this.widget.context.sessionContext)===null||e===void 0?void 0:e.session)===null||i===void 0?void 0:i.kernel)===null||a===void 0?void 0:a.info))===null||s===void 0?void 0:s.language_info;if(l)this._languageInfo=l;else throw new Error("Language info update failed (no session, kernel, or info available)")}_activeCellChanged(e,i){!i||i.model.type!==this._type||this._activeEditorChanged.emit({editor:this._getCellEditor(i)})}_getCellAt(e){let i=this.virtualDocument.getEditorAtVirtualLine(e);return this._editorToCell.get(i)}_getCellEditor(e){if(!this._cellToEditor.has(e)){const i=Object.freeze({getEditor:()=>e.editor,ready:async()=>(await e.ready,e.editor),reveal:async()=>(await this.editor.scrollToCell(e),e.editor)});this._cellToEditor.set(e,i),this._editorToCell.set(i,e),e.disposed.connect(()=>{this._cellToEditor.delete(e),this._editorToCell.delete(i),this._editorRemoved.emit({editor:i})}),this._editorAdded.emit({editor:i})}return this._cellToEditor.get(e)}}class Vo extends Z{constructor(){super(),this._items=[],this.layout=new pe,this.addClass("jp-RankedPanel")}addWidget(e,i){const a={widget:e,rank:i},s=ie.upperBound(this._items,a,ye.itemCmp);ie.insert(this._items,s,a),this.layout.insertWidget(s,e)}onChildRemoved(e){const i=ie.findFirstIndex(this._items,a=>a.widget===e.child);i!==-1&&ie.removeAt(this._items,i)}}class q extends Z{constructor(e){super(),this.addClass("jp-NotebookTools"),this.translator=e.translator||O,this._tools=[],this.layout=new pe,this._tracker=e.tracker,this._tracker.currentChanged.connect(this._onActiveNotebookPanelChanged,this),this._tracker.activeCellChanged.connect(this._onActiveCellChanged,this),this._tracker.selectionChanged.connect(this._onSelectionChanged,this),this._onActiveNotebookPanelChanged(),this._onActiveCellChanged(),this._onSelectionChanged()}get activeCell(){return this._tracker.activeCell}get selectedCells(){const e=this._tracker.currentWidget;if(!e)return[];const i=e.content;return i.widgets.filter(a=>i.isSelectedOrActive(a))}get activeNotebookPanel(){return this._tracker.currentWidget}addItem(e){var i;const a=e.tool,s=(i=e.rank)!==null&&i!==void 0?i:100;let l;const p=this._tools.find(n=>n.section===e.section);if(p)l=p.panel;else throw new Error(`The section ${e.section} does not exist`);a.addClass("jp-NotebookTools-tool"),l.addWidget(a,s),a.notebookTools=this,G.sendMessage(a,q.ActiveNotebookPanelMessage),G.sendMessage(a,q.ActiveCellMessage)}addSection(e){var i;const a=e.sectionName,s=e.label||e.sectionName,l=e.tool;let p=(i=e.rank)!==null&&i!==void 0?i:null;const n=new Vo;if(n.title.label=s,l&&n.addWidget(l,0),this._tools.push({section:a,panel:n,rank:p}),p!=null)this.layout.insertWidget(p,new de({widget:n}));else{let c=null;const d=this.layout;for(let g=0;g<d.widgets.length;g++){let m=d.widgets[g];if(m instanceof de&&m.widget.id==="advancedToolsSection"){c=g;break}}c!==null?this.layout.insertWidget(c,new de({widget:n})):this.layout.addWidget(new de({widget:n}))}}_onActiveNotebookPanelChanged(){this._prevActiveNotebookModel&&!this._prevActiveNotebookModel.isDisposed&&this._prevActiveNotebookModel.metadataChanged.disconnect(this._onActiveNotebookPanelMetadataChanged,this);const e=this.activeNotebookPanel&&this.activeNotebookPanel.content?this.activeNotebookPanel.content.model:null;this._prevActiveNotebookModel=e,e&&e.metadataChanged.connect(this._onActiveNotebookPanelMetadataChanged,this);for(const i of this._toolChildren())G.sendMessage(i,q.ActiveNotebookPanelMessage)}_onActiveCellChanged(){this._prevActiveCell&&!this._prevActiveCell.isDisposed&&this._prevActiveCell.metadataChanged.disconnect(this._onActiveCellMetadataChanged,this);const e=this.activeCell?this.activeCell.model:null;this._prevActiveCell=e,e&&e.metadataChanged.connect(this._onActiveCellMetadataChanged,this);for(const i of this._toolChildren())G.sendMessage(i,q.ActiveCellMessage)}_onSelectionChanged(){for(const e of this._toolChildren())G.sendMessage(e,q.SelectionMessage)}_onActiveNotebookPanelMetadataChanged(e,i){const a=new he.ChangeMessage("activenotebookpanel-metadata-changed",{oldValue:void 0,newValue:void 0,...i});for(const s of this._toolChildren())G.sendMessage(s,a)}_onActiveCellMetadataChanged(e,i){const a=new he.ChangeMessage("activecell-metadata-changed",{newValue:void 0,oldValue:void 0,...i});for(const s of this._toolChildren())G.sendMessage(s,a)}*_toolChildren(){for(let e of this._tools)yield*e.panel.children()}}(function(r){r.ActiveNotebookPanelMessage=new Ce("activenotebookpanel-changed"),r.ActiveCellMessage=new Ce("activecell-changed"),r.SelectionMessage=new Ce("selection-changed");class e extends Z{dispose(){super.dispose(),this.notebookTools&&(this.notebookTools=null)}processMessage(s){switch(super.processMessage(s),s.type){case"activenotebookpanel-changed":this.onActiveNotebookPanelChanged(s);break;case"activecell-changed":this.onActiveCellChanged(s);break;case"selection-changed":this.onSelectionChanged(s);break;case"activecell-metadata-changed":this.onActiveCellMetadataChanged(s);break;case"activenotebookpanel-metadata-changed":this.onActiveNotebookPanelMetadataChanged(s);break}}onActiveNotebookPanelChanged(s){}onActiveCellChanged(s){}onSelectionChanged(s){}onActiveCellMetadataChanged(s){}onActiveNotebookPanelMetadataChanged(s){}}r.Tool=e;class i extends e{constructor(s){super();const{editorFactory:l}=s;this.addClass("jp-MetadataEditorTool");const p=this.layout=new pe;this._editorFactory=l,this._editorLabel=s.label||"Edit Metadata",this.createEditor();const n=new Z({node:document.createElement("label")});n.node.textContent=s.label||"Edit Metadata",p.addWidget(n),p.addWidget(this.editor)}get editor(){return this._editor}onActiveNotebookPanelChanged(s){this.editor.dispose(),this.notebookTools.activeNotebookPanel&&this.createEditor()}createEditor(){this._editor=new Po({editorFactory:this._editorFactory}),this.editor.title.label=this._editorLabel,this.layout.addWidget(this.editor)}}r.MetadataEditorTool=i})(q||(q={}));var ye;(function(r){function e(i,a){return i.rank-a.rank}r.itemCmp=e})(ye||(ye={}));const Uo=6;var W;(function(r){r[r.Idle=-1]="Idle",r[r.Error=-.5]="Error",r[r.Scheduled=0]="Scheduled",r[r.Running=1]="Running"})(W||(W={}));class qo extends To{constructor(e,i,a,s){super(e,s),this.parser=i,this.sanitizer=a,this.configMetadataMap={numberHeaders:["toc-autonumbering","toc/number_sections"],numberingH1:["!toc/skip_h1_title"],baseNumbering:["toc/base_numbering"]},this._runningCells=new Array,this._errorCells=new Array,this._cellToHeadingIndex=new WeakMap,e.context.ready.then(()=>{this.setConfiguration({})}),this.widget.context.model.metadataChanged.connect(this.onMetadataChanged,this),this.widget.content.activeCellChanged.connect(this.onActiveCellChanged,this),_.executionScheduled.connect(this.onExecutionScheduled,this),_.executed.connect(this.onExecuted,this),_.outputCleared.connect(this.onOutputCleared,this),this.headingsChanged.connect(this.onHeadingsChanged,this)}get documentType(){return"notebook"}get isAlwaysActive(){return!0}get supportedOptions(){return["baseNumbering","maximalDepth","numberingH1","numberHeaders","includeOutput","syncCollapseState"]}getCellHeadings(e){const i=new Array;let a=this._cellToHeadingIndex.get(e);if(a!==void 0){const s=this.headings[a];for(i.push(s);this.headings[a-1]&&this.headings[a-1].cellRef===s.cellRef;)a--,i.unshift(this.headings[a])}return i}dispose(){var e,i,a;this.isDisposed||(this.headingsChanged.disconnect(this.onHeadingsChanged,this),(i=(e=this.widget.context)===null||e===void 0?void 0:e.model)===null||i===void 0||i.metadataChanged.disconnect(this.onMetadataChanged,this),(a=this.widget.content)===null||a===void 0||a.activeCellChanged.disconnect(this.onActiveCellChanged,this),_.executionScheduled.disconnect(this.onExecutionScheduled,this),_.executed.disconnect(this.onExecuted,this),_.outputCleared.disconnect(this.onOutputCleared,this),this._runningCells.length=0,this._errorCells.length=0,super.dispose())}setConfiguration(e){const i=this.loadConfigurationFromMetadata();super.setConfiguration({...this.configuration,...i,...e})}toggleCollapse(e){super.toggleCollapse(e),this.updateRunningStatus(this.headings)}async getHeadings(){const e=this.widget.content.widgets,i=new Set(e),a=[],s=new Array,l=new WeakMap;for(let p=0;p<e.length;p++){const n=e[p];switch(n.model.type){case"code":{!this.configuration.syncCollapseState&&this.configuration.includeOutput&&a.push(...Ie(await n.getHeadings(),this.configuration,s).map(d=>({...d,cellRef:n,collapsed:!1,isRunning:W.Idle})));break}case"markdown":{const d=Ie(await n.getHeadings(),this.configuration,s).map((g,m)=>({...g,cellRef:n,collapsed:!1,isRunning:W.Idle}));if(this.configuration.syncCollapseState&&n.headingCollapsed){const g=Math.min(...d.map(b=>b.level)),m=d.find(b=>b.level===g);m.collapsed=n.headingCollapsed}a.push(...d);break}}a.length>0&&l.set(n,a.length-1)}return this._cellToHeadingIndex=l,this._runningCells=this._runningCells.filter(p=>i.has(p)),this._errorCells=this._errorCells.filter(p=>i.has(p)),this.updateRunningStatus(a),Promise.resolve(a)}isHeadingEqual(e,i){return super.isHeadingEqual(e,i)&&e.cellRef===i.cellRef&&e.isRunning===i.isRunning}loadConfigurationFromMetadata(){const e=this.widget.content.model,i={};if(e)for(const a in this.configMetadataMap){const s=this.configMetadataMap[a];for(const l of s){let p=l;const n=p[0]==="!";n&&(p=p.slice(1));const c=p.split("/");let d=e.getMetadata(c[0]);for(let g=1;g<c.length;g++)d=(d??{})[c[g]];d!==void 0&&(typeof d=="boolean"&&n&&(d=!d),i[a]=d)}}return i}onActiveCellChanged(e,i){const a=this.getCellHeadings(i)[0];this.setActiveHeading(a??null,!1)}onHeadingsChanged(){this.widget.content.activeCell&&this.onActiveCellChanged(this.widget.content,this.widget.content.activeCell)}onExecuted(e,i){this._runningCells.forEach((a,s)=>{var l;if(a===i.cell){this._runningCells.splice(s,1);const p=this._cellToHeadingIndex.get(a);if(p!==void 0){const n=this.headings[p];if(i.success||((l=i.error)===null||l===void 0?void 0:l.errorName)===void 0){n.isRunning=W.Idle;return}n.isRunning=W.Error,this._errorCells.includes(a)||this._errorCells.push(a)}}}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onExecutionScheduled(e,i){this._runningCells.includes(i.cell)||this._runningCells.push(i.cell),this._errorCells.forEach((a,s)=>{a===i.cell&&this._errorCells.splice(s,1)}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onOutputCleared(e,i){this._errorCells.forEach((a,s)=>{if(a===i.cell){this._errorCells.splice(s,1);const l=this._cellToHeadingIndex.get(a);if(l!==void 0){const p=this.headings[l];p.isRunning=W.Idle}}}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onMetadataChanged(){this.setConfiguration({})}updateRunningStatus(e){e.forEach(s=>{s.isRunning=W.Idle}),this._runningCells.forEach((s,l)=>{const p=this._cellToHeadingIndex.get(s);if(p!==void 0){const n=e[p];n.isRunning!==W.Running&&(n.isRunning=l>0?W.Scheduled:W.Running)}}),this._errorCells.forEach((s,l)=>{const p=this._cellToHeadingIndex.get(s);if(p!==void 0){const n=e[p];n.isRunning===W.Idle&&(n.isRunning=W.Error)}});let i=0;for(;i<e.length;){const s=e[i];if(i++,s.collapsed){const l=Math.max(s.isRunning,a(e,s.level));s.dataset={...s.dataset,"data-running":l.toString()}}else s.dataset={...s.dataset,"data-running":s.isRunning.toString()}}function a(s,l){let p=W.Idle;for(;i<s.length;){const n=s[i];if(n.dataset={...n.dataset,"data-running":n.isRunning.toString()},n.level>l)i++,p=Math.max(n.isRunning,p),n.collapsed&&(p=Math.max(p,a(s,n.level)),n.dataset={...n.dataset,"data-running":p.toString()});else break}return p}}}class $o extends Mo{constructor(e,i,a,s){super(e),this.parser=i,this.sanitizer=a,this.commands=s,this._scrollToTop=!0}get scrollToTop(){return this._scrollToTop}set scrollToTop(e){this._scrollToTop=e}_createNew(e,i){const a=new qo(e,this.parser,this.sanitizer,i);let s=new WeakMap;const l=(m,b)=>{if(b){const f=async u=>{if(!u.inViewport)return;const C=s.get(b);if(C)if(this.scrollToTop)C.scrollIntoView({block:"start"}),e.content.outerNode.scrollTop-=Uo;else{const w=e.content.node.getBoundingClientRect(),B=C.getBoundingClientRect();(B.top>w.bottom||B.bottom<w.top)&&C.scrollIntoView({block:"center"})}else console.debug("scrolling to heading: using fallback strategy"),await e.content.scrollToItem(e.content.activeCellIndex,this.scrollToTop?"start":void 0,0)},x=b.cellRef,t=e.content.widgets.indexOf(x);x.model.type=="markdown"&&e.content.mode!="command"&&(e.content.mode="command"),e.content.activeCellIndex=t,x.inViewport?f(x).catch(u=>{console.error(`Fail to scroll to cell to display the required heading (${u}).`)}):e.content.scrollToItem(t,this.scrollToTop?"start":void 0).then(()=>p(x)).then(()=>f(x)).catch(u=>{console.error(`Fail to scroll to cell to display the required heading (${u}).`)})}},p=m=>Promise.all(a.getCellHeadings(m).map(async b=>{var f,x,o;const t=await Do(b,this.parser,this.sanitizer),u=(f=this.sanitizer.allowNamedProperties)!==null&&f!==void 0&&f?"id":"data-jupyter-id",C=t?`h${b.level}[${u}="${CSS.escape(t)}"]`:`h${b.level}`;b.outputIndex!==void 0?s.set(b,je(b.cellRef.outputArea.widgets[b.outputIndex].node,C,(x=b.prefix)!==null&&x!==void 0?x:"")):s.set(b,je(b.cellRef.node,C,(o=b.prefix)!==null&&o!==void 0?o:""))})).then(()=>{}),n=m=>{if(this.parser)return Re(e.content.node),s=new WeakMap,Promise.all(e.content.widgets.map(b=>p(b)))},c=(m,b)=>{var f,x,o,t;if(a.configuration.syncCollapseState)if(b!==null){const u=b.cellRef;u.headingCollapsed!==((f=b.collapsed)!==null&&f!==void 0?f:!1)&&(u.headingCollapsed=(x=b.collapsed)!==null&&x!==void 0?x:!1)}else{const u=(t=(o=a.headings[0])===null||o===void 0?void 0:o.collapsed)!==null&&t!==void 0?t:!1;e.content.widgets.forEach(C=>{C instanceof le&&C.headingInfo.level>=0&&(C.headingCollapsed=u)})}},d=(m,b)=>{if(a.configuration.syncCollapseState){const f=a.getCellHeadings(b)[0];f&&a.toggleCollapse({heading:f,collapsed:b.headingCollapsed})}},g=(m,b)=>{var f;b.inViewport?(f=p(b))===null||f===void 0||f.catch(console.warn):Re(b.node)};return e.context.ready.then(()=>{var m;(m=n())===null||m===void 0||m.catch(console.warn),a.activeHeadingChanged.connect(l),a.headingsChanged.connect(n),a.collapseChanged.connect(c),e.content.cellCollapsed.connect(d),e.content.cellInViewportChanged.connect(g),e.disposed.connect(()=>{a.activeHeadingChanged.disconnect(l),a.headingsChanged.disconnect(n),a.collapseChanged.disconnect(c),e.content.cellCollapsed.disconnect(d),e.content.cellInViewportChanged.disconnect(g)})}),a}getToolbarItems(e){return this.commands?[{name:"select-last-modified-back",widget:new Oe({commands:this.commands,id:"notebook:select-last-modified-cell",args:{toolbar:!0},icon:Bt,label:""})},{name:"select-last-modified-forward",widget:new Oe({commands:this.commands,id:"notebook:select-next-modified-cell",args:{toolbar:!0},icon:Et,label:""})}]:[]}}async function Do(r,e,i){let a=null;return r.type===Pe.HeadingType.Markdown?a=await Nt(e,r.raw,r.level,i):r.type===Pe.HeadingType.HTML&&(a=r.id),a}const Jo="jp-StatusItem-trust";function zo(r,e){e=e||O;const i=e.load("jupyterlab");return r.trustedCells===r.totalCells?i.__("Notebook trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells):r.activeCellTrusted?i.__("Active cell trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells):i.__("Notebook not trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells)}function Go(r){return r.allCellsTrusted?A.createElement(Ot.react,{top:"2px",stylesheet:"statusBar"}):A.createElement(jt.react,{top:"2px",stylesheet:"statusBar"})}class ae extends we{constructor(e){super(new ae.Model),this.translator=e||O,this.node.classList.add(Jo)}render(){if(!this.model)return null;const e=zo(this.model,this.translator);return e!==this.node.title&&(this.node.title=e),A.createElement(Go,{allCellsTrusted:this.model.trustedCells===this.model.totalCells,activeCellTrusted:this.model.activeCellTrusted,totalCells:this.model.totalCells,trustedCells:this.model.trustedCells})}}(function(r){class e extends ke{constructor(){super(...arguments),this._trustedCells=0,this._totalCells=0,this._activeCellTrusted=!1,this._notebook=null}get trustedCells(){return this._trustedCells}get totalCells(){return this._totalCells}get activeCellTrusted(){return this._activeCellTrusted}get notebook(){return this._notebook}set notebook(a){const s=this._notebook;s!==null&&(s.activeCellChanged.disconnect(this._onActiveCellChanged,this),s.modelContentChanged.disconnect(this._onModelChanged,this));const l=this._getAllState();if(this._notebook=a,this._notebook===null)this._trustedCells=0,this._totalCells=0,this._activeCellTrusted=!1;else{this._notebook.activeCellChanged.connect(this._onActiveCellChanged,this),this._notebook.modelContentChanged.connect(this._onModelChanged,this),this._notebook.activeCell?this._activeCellTrusted=this._notebook.activeCell.model.trusted:this._activeCellTrusted=!1;const{total:p,trusted:n}=this._deriveCellTrustState(this._notebook.model);this._totalCells=p,this._trustedCells=n}this._triggerChange(l,this._getAllState())}_onModelChanged(a){const s=this._getAllState(),{total:l,trusted:p}=this._deriveCellTrustState(a.model);this._totalCells=l,this._trustedCells=p,this._triggerChange(s,this._getAllState())}_onActiveCellChanged(a,s){const l=this._getAllState();s?this._activeCellTrusted=s.model.trusted:this._activeCellTrusted=!1,this._triggerChange(l,this._getAllState())}_deriveCellTrustState(a){if(a===null)return{total:0,trusted:0};let s=0,l=0;for(const p of a.cells)p.type==="code"&&(s++,p.trusted&&l++);return{total:s,trusted:l}}_getAllState(){return[this._trustedCells,this._totalCells,this.activeCellTrusted]}_triggerChange(a,s){(a[0]!==s[0]||a[1]!==s[1]||a[2]!==s[2])&&this.stateChanged.emit(void 0)}}r.Model=e})(ae||(ae={}));const Yo=new Qe("@jupyterlab/metadataform:IMetadataFormProvider","A service to register new metadata editor widgets."),Xo={id:"@jupyterlab/notebook-extension:cell-executor",description:"Provides the notebook cell executor.",autoStart:!0,provides:tt,activate:()=>Object.freeze({runCell:Rt})},Qo=new Qe("@jupyterlab/logconsole:ILoggerRegistry","A service providing a logger infrastructure."),Zo={activate:en,id:"@jupyterlab/notebook-extension:log-output",description:"Adds cell outputs log to the application logger.",requires:[I],optional:[Qo],autoStart:!0};function en(r,e,i){if(!i)return;function a(s){function l(p,n,c){if(Y.KernelMessage.isDisplayDataMsg(p)||Y.KernelMessage.isStreamMsg(p)||Y.KernelMessage.isErrorMsg(p)||Y.KernelMessage.isExecuteResultMsg(p)){const d=i.getLogger(s.context.path);d.rendermime=s.content.rendermime;const g={...p.content,output_type:p.header.msg_type};let m=n;(Y.KernelMessage.isErrorMsg(p)||Y.KernelMessage.isStreamMsg(p)&&p.content.name==="stderr")&&(m=c),d.log({type:"output",data:g,level:m})}}s.context.sessionContext.iopubMessage.connect((p,n)=>l(n,"info","info")),s.context.sessionContext.unhandledMessage.connect((p,n)=>l(n,"warning","error"))}e.forEach(s=>a(s)),e.widgetAdded.connect((s,l)=>a(l))}const tn="jp-ActiveCellTool",on="jp-ActiveCellTool-Content",nn="jp-ActiveCellTool-CellContent";class ln extends q.Tool{constructor(e){super();const{languages:i}=e;this._tracker=e.tracker,this.addClass(tn),this.layout=new pe,this._inputPrompt=new It,this.layout.addWidget(this._inputPrompt);const a=document.createElement("div");a.classList.add(on);const s=a.appendChild(document.createElement("div")),l=s.appendChild(document.createElement("pre"));s.className=nn,this._editorEl=l,this.layout.addWidget(new Z({node:a}));const p=async()=>{var n,c;this._editorEl.innerHTML="",((n=this._cellModel)===null||n===void 0?void 0:n.type)==="code"?(this._inputPrompt.executionCount=`${(c=this._cellModel.executionCount)!==null&&c!==void 0?c:""}`,this._inputPrompt.show()):(this._inputPrompt.executionCount=null,this._inputPrompt.hide()),this._cellModel&&await i.highlight(this._cellModel.sharedModel.getSource().split(`
|
|
2
|
-
`)[0],i.findByMIME(this._cellModel.mimeType),this._editorEl)};this._refreshDebouncer=new Pt(p,150)}render(e){var i,a;const s=this._tracker.activeCell;return s&&(this._cellModel=s?.model||null),((i=this._cellModel)===null||i===void 0?void 0:i.sharedModel).changed.connect(this.refresh,this),(a=this._cellModel)===null||a===void 0||a.mimeTypeChanged.connect(this.refresh,this),this.refresh().then(()=>{}).catch(()=>{}),A.createElement("div",{ref:l=>l?.appendChild(this.node)})}async refresh(){await this._refreshDebouncer.invoke()}}const sn="jp-CellMetadataEditor",rn="jp-NotebookMetadataEditor";class an extends q.MetadataEditorTool{constructor(e){super(e),this._tracker=e.tracker,this.editor.editorHostNode.addEventListener("blur",this.editor,!0),this.editor.editorHostNode.addEventListener("click",this.editor,!0),this.editor.headerNode.addEventListener("click",this.editor)}_onSourceChanged(){var e,i,a;const s=(e=this._tracker.activeCell)===null||e===void 0?void 0:e.model.sharedModel;if(s&&this.editor.source){const l=Object.keys((i=s.metadata)!==null&&i!==void 0?i:{}),p=(a=this.editor.source.toJSON())!==null&&a!==void 0?a:{};s.transact(()=>{l.forEach(n=>s.deleteMetadata(n)),s.setMetadata(p)})}}render(e){var i;const a=this._tracker.activeCell;return this.editor.source=a?new he({values:a.model.metadata}):null,(i=this.editor.source)===null||i===void 0||i.changed.connect(this._onSourceChanged,this),A.createElement("div",{className:sn},A.createElement("div",{ref:s=>s?.appendChild(this.node)}))}}class dn extends q.MetadataEditorTool{constructor(e){super(e),this._tracker=e.tracker,this.editor.editorHostNode.addEventListener("blur",this.editor,!0),this.editor.editorHostNode.addEventListener("click",this.editor,!0),this.editor.headerNode.addEventListener("click",this.editor)}_onSourceChanged(){var e,i;this.editor.source&&((i=(e=this._tracker.currentWidget)===null||e===void 0?void 0:e.model)===null||i===void 0||i.sharedModel.setMetadata(this.editor.source.toJSON()))}render(e){var i,a;const s=this._tracker.currentWidget;return this.editor.source=s?new he({values:(i=s.model)===null||i===void 0?void 0:i.metadata}):null,(a=this.editor.source)===null||a===void 0||a.changed.connect(this._onSourceChanged,this),A.createElement("div",{className:rn},A.createElement("div",{ref:l=>l?.appendChild(this.node)}))}}var h;(function(r){r.createNew="notebook:create-new",r.interrupt="notebook:interrupt-kernel",r.restart="notebook:restart-kernel",r.restartClear="notebook:restart-clear-output",r.restartAndRunToSelected="notebook:restart-and-run-to-selected",r.restartRunAll="notebook:restart-run-all",r.reconnectToKernel="notebook:reconnect-to-kernel",r.changeKernel="notebook:change-kernel",r.getKernel="notebook:get-kernel",r.createConsole="notebook:create-console",r.createSubshellConsole="notebook:create-subshell-console",r.createOutputView="notebook:create-output-view",r.clearAllOutputs="notebook:clear-all-cell-outputs",r.shutdown="notebook:shutdown-kernel",r.closeAndShutdown="notebook:close-and-shutdown",r.trust="notebook:trust",r.exportToFormat="notebook:export-to-format",r.run="notebook:run-cell",r.runAndAdvance="notebook:run-cell-and-select-next",r.runAndInsert="notebook:run-cell-and-insert-below",r.runInConsole="notebook:run-in-console",r.runAll="notebook:run-all-cells",r.runAllAbove="notebook:run-all-above",r.runAllBelow="notebook:run-all-below",r.renderAllMarkdown="notebook:render-all-markdown",r.toCode="notebook:change-cell-to-code",r.toMarkdown="notebook:change-cell-to-markdown",r.toRaw="notebook:change-cell-to-raw",r.cut="notebook:cut-cell",r.copy="notebook:copy-cell",r.pasteAbove="notebook:paste-cell-above",r.pasteBelow="notebook:paste-cell-below",r.duplicateBelow="notebook:duplicate-below",r.pasteAndReplace="notebook:paste-and-replace-cell",r.moveUp="notebook:move-cell-up",r.moveDown="notebook:move-cell-down",r.clearOutputs="notebook:clear-cell-output",r.deleteCell="notebook:delete-cell",r.insertAbove="notebook:insert-cell-above",r.insertBelow="notebook:insert-cell-below",r.selectAbove="notebook:move-cursor-up",r.selectBelow="notebook:move-cursor-down",r.selectHeadingAboveOrCollapse="notebook:move-cursor-heading-above-or-collapse",r.selectHeadingBelowOrExpand="notebook:move-cursor-heading-below-or-expand",r.insertHeadingAbove="notebook:insert-heading-above",r.insertHeadingBelow="notebook:insert-heading-below",r.extendAbove="notebook:extend-marked-cells-above",r.extendTop="notebook:extend-marked-cells-top",r.extendBelow="notebook:extend-marked-cells-below",r.extendBottom="notebook:extend-marked-cells-bottom",r.selectAll="notebook:select-all",r.deselectAll="notebook:deselect-all",r.editMode="notebook:enter-edit-mode",r.merge="notebook:merge-cells",r.mergeAbove="notebook:merge-cell-above",r.mergeBelow="notebook:merge-cell-below",r.split="notebook:split-cell-at-cursor",r.commandMode="notebook:enter-command-mode",r.toggleAllLines="notebook:toggle-all-cell-line-numbers",r.undoCellAction="notebook:undo-cell-action",r.redoCellAction="notebook:redo-cell-action",r.redo="notebook:redo",r.undo="notebook:undo",r.markdown1="notebook:change-cell-to-heading-1",r.markdown2="notebook:change-cell-to-heading-2",r.markdown3="notebook:change-cell-to-heading-3",r.markdown4="notebook:change-cell-to-heading-4",r.markdown5="notebook:change-cell-to-heading-5",r.markdown6="notebook:change-cell-to-heading-6",r.hideCode="notebook:hide-cell-code",r.showCode="notebook:show-cell-code",r.hideAllCode="notebook:hide-all-cell-code",r.showAllCode="notebook:show-all-cell-code",r.hideOutput="notebook:hide-cell-outputs",r.showOutput="notebook:show-cell-outputs",r.toggleOutput="notebook:toggle-cell-outputs",r.hideAllOutputs="notebook:hide-all-cell-outputs",r.showAllOutputs="notebook:show-all-cell-outputs",r.toggleRenderSideBySideCurrentNotebook="notebook:toggle-render-side-by-side-current",r.setSideBySideRatio="notebook:set-side-by-side-ratio",r.enableOutputScrolling="notebook:enable-output-scrolling",r.disableOutputScrolling="notebook:disable-output-scrolling",r.selectLastRunCell="notebook:select-last-run-cell",r.replaceSelection="notebook:replace-selection",r.autoClosingBrackets="notebook:toggle-autoclosing-brackets",r.toggleCollapseCmd="notebook:toggle-heading-collapse",r.collapseAllCmd="notebook:collapse-all-headings",r.expandAllCmd="notebook:expand-all-headings",r.copyToClipboard="notebook:copy-to-clipboard",r.invokeCompleter="completer:invoke-notebook",r.selectCompleter="completer:select-notebook",r.tocRunCells="toc:run-cells",r.accessPreviousHistory="notebook:access-previous-history-entry",r.accessNextHistory="notebook:access-next-history-entry",r.virtualScrollbar="notebook:toggle-virtual-scrollbar"})(h||(h={}));const D="Notebook",cn=["notebook","python","custom"],un="@jupyterlab/notebook-extension:panel",Fe="jp-NotebookExtension-sideBySideMargins",ee={id:"@jupyterlab/notebook-extension:tracker",description:"Provides the notebook widget tracker.",provides:I,requires:[ot,io,tt],optional:[Ve,ao,co,it,lt,uo,be,Ue,F,Ae,nt],activate:Ln,autoStart:!0},hn={id:"@jupyterlab/notebook-extension:factory",description:"Provides the notebook cell factory.",provides:fe.IContentFactory,requires:[ge],autoStart:!0,activate:(r,e)=>{const i=e.factoryService.newInlineEditor;return new fe.ContentFactory({editorFactory:i})}},pn={activate:On,provides:ro,id:"@jupyterlab/notebook-extension:tools",description:"Provides the notebook tools.",autoStart:!0,requires:[I,ge,et,Lt.IStateDB,F],optional:[so]},gn={id:"@jupyterlab/notebook-extension:mode-status",description:"Adds a notebook mode status widget.",autoStart:!0,requires:[I,F],optional:[Se],activate:(r,e,i,a)=>{if(!a)return;const{shell:s}=r,l=new re(i);e.currentChanged.connect(()=>{const p=e.currentWidget;l.model.notebook=p&&p.content}),a.registerStatusItem("@jupyterlab/notebook-extension:mode-status",{priority:1,item:l,align:"right",rank:4,isActive:()=>!!s.currentWidget&&!!e.currentWidget&&s.currentWidget===e.currentWidget})}},bn={id:"@jupyterlab/notebook-extension:execution-indicator",description:"Adds a notebook execution status widget.",autoStart:!0,requires:[I,ho,F],optional:[Se,be],activate:(r,e,i,a,s,l)=>{let p,n,c;const d=g=>{var m,b;let{showOnToolBar:f,showProgress:x,showJumpToCell:o}=g;if(f)c&&(i.currentChanged.disconnect(n),c.dispose());else{if(!s)return;p?.model||(p=new X(a),n=(t,u)=>{const{newValue:C}=u;if(C&&e.has(C)){const w=C;p.model.attachNotebook({content:w.content,context:w.sessionContext})}},c=s.registerStatusItem("@jupyterlab/notebook-extension:execution-indicator",{item:p,align:"left",rank:3,isActive:()=>{const t=i.currentWidget;return!!t&&e.has(t)}}),p.model.attachNotebook({content:(m=e.currentWidget)===null||m===void 0?void 0:m.content,context:(b=e.currentWidget)===null||b===void 0?void 0:b.sessionContext}),i.currentChanged.connect(n),p.disposed.connect(()=>{i.currentChanged.disconnect(n)})),p.model.displayOption={showOnToolBar:f,showProgress:x,showJumpToCell:o}}};if(l){const g=l.load(ee.id);Promise.all([g,r.restored]).then(([m])=>{d(X.getSettingValue(m)),m.changed.connect(b=>d(X.getSettingValue(b)))}).catch(m=>{console.error(m.message)})}}},mn={id:"@jupyterlab/notebook-extension:export",description:"Adds the export notebook commands.",autoStart:!0,requires:[F,I],optional:[lt,Ve],activate:(r,e,i,a,s)=>{var l;const p=e.load("jupyterlab"),{commands:n,shell:c}=r,d=r.serviceManager,g=()=>L.isEnabled(c,i);n.addCommand(h.exportToFormat,{label:x=>{if(x.label===void 0)return p.__("Save and Export Notebook to the given `format`.");const o=x.label;return x.isPalette?p.__("Save and Export Notebook: %1",o):o},execute:async x=>{var o,t;const u=v(i,c,x);if(!u)return;const{context:C}=u,w={format:x.format,path:u.context.path,exporterOptions:{download:!0}};return C.model.dirty&&!C.model.readOnly&&await C.save(),(t=(o=d.nbconvert).exportAs)===null||t===void 0?void 0:t.call(o,w)},isEnabled:g,describedBy:{args:{type:"object",properties:{format:{type:"string",description:p.__("The export format (e.g., pdf, html, latex)")},label:{type:"string",description:p.__("The label to display for this format")},isPalette:{type:"boolean",description:p.__("Whether the command is called from the command palette")}},required:["format"]}}});let m;a&&(m=(l=a.fileMenu.items.find(x=>{var o;return x.type==="submenu"&&((o=x.submenu)===null||o===void 0?void 0:o.id)==="jp-mainmenu-file-notebookexport"}))===null||l===void 0?void 0:l.submenu);let b=!1;const f=async()=>{if(b)return;i.widgetAdded.disconnect(f),b=!0;const x=await d.nbconvert.getExportFormats(!1);if(!x)return;const o=L.getFormatLabels(e);Object.keys(x).forEach(function(u){const C=p.__(u[0].toUpperCase()+u.substr(1)),w=o[u]?o[u]:C;let B={format:u,label:w,isPalette:!1};if(cn.indexOf(u)===-1&&(m&&m.addItem({command:h.exportToFormat,args:B}),s)){B={format:u,label:w,isPalette:!0};const M=p.__("Notebook Operations");s.addItem({command:h.exportToFormat,category:M,args:B})}})};i.widgetAdded.connect(f)}},Cn={id:"@jupyterlab/notebook-extension:trust-status",description:"Adds the notebook trusted status widget.",autoStart:!0,requires:[I,F],optional:[Se],activate:(r,e,i,a)=>{if(!a)return;const{shell:s}=r,l=new ae(i);e.currentChanged.connect(()=>{const p=e.currentWidget;l.model.notebook=p&&p.content}),a.registerStatusItem("@jupyterlab/notebook-extension:trust-status",{item:l,align:"right",rank:3,isActive:()=>!!s.currentWidget&&!!e.currentWidget&&s.currentWidget===e.currentWidget})}},vn={id:"@jupyterlab/notebook-extension:widget-factory",description:"Provides the notebook widget factory.",provides:ot,requires:[fe.IContentFactory,ge,po,dt],optional:[be,Ue,F],activate:jn,autoStart:!0},fn={id:"@jupyterlab/notebook-extension:cloned-outputs",description:"Adds the clone output feature.",requires:[bo,I,F],optional:[it],activate:Rn,autoStart:!0},_n={id:"@jupyterlab/notebook-extension:code-console",description:"Adds the notebook code consoles features.",requires:[I,F],activate:In,autoStart:!0},yn={id:"@jupyterlab/notebook-extension:copy-output",description:"Adds the copy cell outputs feature.",activate:Pn,requires:[F,I],autoStart:!0},xn={id:"@jupyterlab/notebook-extension:kernel-status",description:"Adds the notebook kernel status.",activate:(r,e,i)=>{const a=s=>{let l=null;return s&&e.has(s)?s.sessionContext:l};i.addSessionProvider(a)},requires:[I,ct],autoStart:!0},wn={id:"@jupyterlab/notebook-extension:cursor-position",description:"Adds the notebook cursor position status.",activate:(r,e,i)=>{let a=null;const s=async l=>{let p=null;if(l!==a){if(a?.content.activeCellChanged.disconnect(i.update),a=null,l&&e.has(l)){l.content.activeCellChanged.connect(i.update);const n=l.content.activeCell;p=null,n&&(await n.ready,p=n.editor),a=l}}else if(l){const n=l.content.activeCell;p=null,n&&(await n.ready,p=n.editor)}return p};i.addEditorProvider(s)},requires:[I,Wt],autoStart:!0},kn={id:"@jupyterlab/notebook-extension:completer",description:"Adds the code completion capability to notebooks.",requires:[I],optional:[mo,F,qe],activate:Wn,autoStart:!0},Sn={id:"@jupyterlab/notebook-extension:search",description:"Adds search capability to notebooks.",requires:[Co],autoStart:!0,activate:(r,e)=>{e.add("jp-notebookSearchProvider",Jt)}},An={id:"@jupyterlab/notebook-extension:toc",description:"Adds table of content capability to the notebooks",requires:[I,Ht,qe],optional:[go,be],autoStart:!0,activate:(r,e,i,a,s,l)=>{const p=new $o(e,s,a);i.add(p),l&&Promise.all([r.restored,l.load(ee.id)]).then(([n,c])=>{const d=()=>{var g;p.scrollToTop=(g=c.composite.scrollHeadingToTop)!==null&&g!==void 0?g:!0};d(),c.changed.connect(d)}).catch(n=>{console.error("Failed to load notebook table of content settings.",n)})}},Mn={id:"@jupyterlab/notebook-extension:language-server",description:"Adds language server capability to the notebooks.",requires:[I,_o,yo,xo,wo],activate:Hn,autoStart:!0},Tn={id:"@jupyterlab/notebook-extension:update-raw-mimetype",description:"Adds metadata form editor for raw cell mimetype.",autoStart:!0,requires:[I,Yo,F],activate:(r,e,i,a)=>{const s=a.load("jupyterlab");let l=!1;async function p(){if(l||!i.get("commonToolsSection"))return;const n=i.get("commonToolsSection").getProperties("/raw_mimetype");if(!n)return;e.widgetAdded.disconnect(p),l=!0;const d=await r.serviceManager.nbconvert.getExportFormats(!1);if(!d)return;const g=Object.keys(d),m=L.getFormatLabels(a);g.forEach(function(b){var f;if(!(((f=n.oneOf)===null||f===void 0?void 0:f.filter(o=>o.const===b).length)>0)){const o=s.__(b[0].toUpperCase()+b.substr(1)),t=m[b]?m[b]:o,u=d[b].output_mimetype;n.oneOf.push({const:u,title:t})}}),i.get("commonToolsSection").setProperties("/raw_mimetype",n)}e.widgetAdded.connect(p)}},Bn={id:"@jupyterlab/notebook-extension:metadata-editor",description:"Adds metadata form for full metadata editor.",autoStart:!0,requires:[I,ge,Ae],optional:[F],activate:(r,e,i,a,s)=>{const l=c=>i.factoryService.newInlineEditor(c),p={fieldRenderer:c=>new an({editorFactory:l,tracker:e,label:"Cell metadata",translator:s}).render(c)};a.addRenderer("@jupyterlab/notebook-extension:metadata-editor.cell-metadata",p);const n={fieldRenderer:c=>new dn({editorFactory:l,tracker:e,label:"Notebook metadata",translator:s}).render(c)};a.addRenderer("@jupyterlab/notebook-extension:metadata-editor.notebook-metadata",n)}},En={id:"@jupyterlab/notebook-extension:active-cell-tool",description:"Adds active cell field in the metadata editor tab.",autoStart:!0,requires:[I,Ae,et],activate:(r,e,i,a)=>{const s={fieldRenderer:l=>new ln({tracker:e,languages:a}).render(l)};i.addRenderer("@jupyterlab/notebook-extension:active-cell-tool.renderer",s)}},Nn={id:"@jupyterlab/notebook-extension:open-with-no-kernel",description:'Adds the "Notebook (no kernel)" option to the Open With menu.',requires:[nt],optional:[F],autoStart:!0,activate:(r,e,i)=>{const{tracker:a}=e,s=(i??O).load("jupyterlab"),l=[];function p(n){var c,d;l.forEach(f=>f.dispose()),l.length=0;const g=(d=(c=n.menu.items.find(f=>{var x;return f.type==="submenu"&&((x=f.submenu)===null||x===void 0?void 0:x.id)==="jp-contextmenu-open-with"}))===null||c===void 0?void 0:c.submenu)!==null&&d!==void 0?d:null;if(!g)return;(a.currentWidget?Array.from(a.currentWidget.selectedItems()):[]).some(f=>f.type==="notebook")&&l.push(g.addItem({command:"filebrowser:open",args:{label:s.__("Notebook (no kernel)"),factory:D,kernelPreference:{shouldStart:!1}}}))}r.contextMenu.opened.connect(p)}},el=[Xo,hn,ee,bn,mn,pn,gn,Cn,vn,Zo,fn,_n,yn,xn,wn,kn,Sn,An,Mn,Tn,Bn,En,Nn];function On(r,e,i,a,s,l,p){const n=l.load("jupyterlab"),c="notebook-tools",d=new q({tracker:e,translator:l}),g=(m,b)=>{switch(b.type){case"activate-request":s.save(c,{open:!0});break;case"after-hide":case"close-request":s.remove(c);break}return!0};return d.title.icon=Kt,d.title.caption=n.__("Notebook Tools"),d.id=c,G.installMessageHook(d,g),p&&e.widgetAdded.connect((m,b)=>{p.register(b).render(d)}),d}function jn(r,e,i,a,s,l,p,n){const c=n??O,d=p??new xe({translator:c}),g=Vt.PageConfig.getOption("notebookStartsKernel"),m=g===""||g.toLowerCase()==="true",{commands:b}=r;let f;s.addFactory(D,"save",t=>lo.createSaveButton(b,t.context.fileChanged)),s.addFactory(D,"cellType",t=>_e.createCellTypeItem(t,c)),s.addFactory(D,"kernelName",t=>ue.createKernelNameItem(t.sessionContext,d,c)),s.addFactory(D,"executionProgress",t=>{const u=l?.load(ee.id),C=X.createExecutionIndicatorItem(t,c,u);return u?.then(w=>{t.disposed.connect(()=>{w.dispose()})}),C}),l&&(f=Ut(s,l,D,un,c));const x=c.load("jupyterlab"),o=new Ao({name:D,label:x.__("Notebook"),fileTypes:["notebook"],modelName:"notebook",defaultFor:["notebook"],preferKernel:m,canStartKernel:!0,rendermime:a,contentFactory:e,editorConfig:se.defaultEditorConfig,notebookConfig:se.defaultNotebookConfig,mimeTypeService:i.mimeTypeService,toolbarFactory:f,translator:c});return r.docRegistry.addWidgetFactory(o),o}function Rn(r,e,i,a,s){const l=a.load("jupyterlab"),p=new qt({namespace:"cloned-outputs"});s&&s.restore(p,{command:h.createOutputView,args:g=>({path:g.content.path,index:g.content.index}),name:g=>`${g.content.path}:${g.content.index}`,when:i.restored});const{commands:n,shell:c}=r,d=()=>L.isEnabledAndSingleSelected(c,i);n.addCommand(h.createOutputView,{label:l.__("Create New View for Cell Output"),execute:async g=>{var m;let b,f;const x=g.path;let o=g.index;if(x&&o!==void 0&&o!==null){if(f=e.findWidget(x,D),!f)return}else{if(f=i.currentWidget,!f)return;b=f.content.activeCell,o=f.content.activeCellIndex}const t=new L.ClonedOutputArea({notebook:f,cell:b,index:o,translator:a}),u=new $t({content:t});f.context.addSibling(u,{ref:f.id,mode:"split-bottom",type:"Cloned Output"});const C=()=>{p.save(u)};f.context.pathChanged.connect(C),(m=f.context.model)===null||m===void 0||m.cells.changed.connect(C),p.add(u),f.content.disposed.connect(()=>{var w;f.context.pathChanged.disconnect(C),(w=f.context.model)===null||w===void 0||w.cells.changed.disconnect(C),u.dispose()})},isEnabled:d,describedBy:{args:{type:"object",properties:{path:{type:"string",description:l.__("The path to the notebook containing the cell")},index:{type:"number",description:l.__("The index of the cell to create an output view for")}}}}})}function In(r,e,i){const a=i.load("jupyterlab"),{commands:s,shell:l}=r,p=()=>L.isEnabled(l,e);s.addCommand(h.createConsole,{label:a.__("New Console for Notebook"),execute:n=>{const c=e.currentWidget;if(c)return L.createConsole(s,c,n.activate)},isEnabled:p,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:a.__("Whether to activate the console after creation")}}}}}),s.addCommand(h.createSubshellConsole,{label:a.__("New Subshell Console for Notebook"),execute:n=>{const c=e.currentWidget;if(c)return L.createConsole(s,c,n.activate,!0)},isEnabled:p,isVisible:()=>{var n,c,d;const g=(c=(n=e.currentWidget)===null||n===void 0?void 0:n.context.sessionContext.session)===null||c===void 0?void 0:c.kernel;return(d=g?.supportsSubshells)!==null&&d!==void 0?d:!1},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:a.__("Whether to activate the console after creation")}}}}}),s.addCommand(h.runInConsole,{label:a.__("Run Selected Text or Current Line in Console"),execute:async n=>{var c,d;const g=e.currentWidget;if(!g)return;const{context:m,content:b}=g,f=b.activeCell,x=f?.model.metadata,o=m.path;if(!f||f.model.type!=="code")return;let t;const u=f.editor;if(!u)return;const C=u.getSelection(),{start:w,end:B}=C;if(w.column!==B.column||w.line!==B.line){const K=u.getOffsetAt(C.start),V=u.getOffsetAt(C.end);t=u.model.sharedModel.getSource().substring(K,V)}else{const K=u.getCursorPosition(),V=u.model.sharedModel.getSource().split(`
|
|
1
|
+
import{o as ue,t as rt,T as at,p as de,b as Ve,f as Ue,I as dt,j as ct,a as qe,d as ut,C as Ee,g as Ne}from"./index-CFP9psRB.js";import{r as H,ha as ht,c4 as pt,v as A,ag as Z,c1 as ne,ak as O,gN as gt,dH as bt,gE as mt,hb as Ct,an as $e,dN as vt,h3 as ft,dL as _t,cv as Q,c8 as yt,hc as _,cI as Je,cD as De,cJ as ze,gc as Ge,gd as Ye,dK as xe,am as xt,ci as Xe,ch as ve,c2 as we,hd as wt,he as kt,h5 as St,b$ as ke,l as Y,aW as At,gF as Mt,J as Tt,ah as pe,gS as G,hf as he,af as ie,hg as Ce,dE as Oe,hh as Bt,hi as Et,cV as je,cT as Re,hj as le,cX as Ie,hk as Pe,cU as Nt,hl as Ot,hm as jt,ac as Qe,hn as Rt,ho as It,dJ as Pt,ai as F,du as ge,hp as fe,cx as Lt,dC as Wt,c$ as Ht,hq as Ft,hr as se,hs as Ze,d7 as Kt,b_ as Vt,aj as Ut,cy as qt,ca as $t,gQ as Jt,ht as Dt,cN as zt,cQ as Gt,hu as Yt,hv as Xt,hw as Qt,da as Zt,db as eo,cS as to,aV as oo,ee as no}from"../datalayer-app-main.js";import{b as io,I as et}from"./token-BRjncM66.js";import{ToolbarItems as lo}from"./index-DLimRfHQ.js";import{I as so}from"./index-Dv_XGY6Q.js";import{I as Se}from"./tokens-BHMD_ju9.js";import{a as tt,I,b as ot,c as ro}from"./tokens-CydTkiyv.js";import{I as ao,a as nt}from"./tokens-BvmYCqiu.js";import{I as co}from"./tokens-CBD7cd6p.js";import{f as it,e as uo,c as ho,I as po,b as go}from"./index-CyQgE_Es.js";import{I as lt}from"./tokens-D1_9ZFxB.js";import{I as be}from"./tokens-BHLmeqjP.js";import{a as Ae}from"./tokens-_fLcuFXz.js";import{I as bo}from"./tokens-CENaHAHm.js";import{I as mo}from"./index-DSN70XMH.js";import{I as Co}from"./tokens-DXLxGbDM.js";import{W as vo,u as Le,V as fo,I as _o,a as yo,b as xo,c as wo}from"./document-Dluvp7zl.js";import{b as ko,c as So,d as Ao}from"./CellSidebarExtension-CDnzN9Cb.js";import{T as Mo,a as To}from"./model-BziAhKNp.js";import{C as We}from"./celltoolbartracker-DcYHi8Du.js";import"./hoverbox-CStlKQWE.js";import"./Output-BWClePP-.js";import"./index-DyVR0igi.js";import"./color-CG7_7V2-.js";import"./isEqual-Cwjr2skl.js";import"./defaultLocale-5voVPcsN.js";import"./index-DbMBnR4l.js";import"./KebabHorizontalIcon-CXDXtkuL.js";import"./PaintbrushIcon-CLU8RilX.js";import"./index-BJhxZF_K.js";import"./RestartIcon-Ca6_HoK0.js";import"./NotebookSkeleton-CI7ovjNW.js";import"./Avatar-9MpXENSs.js";import"./renderer-Dy4lZ1KZ.js";import"./SquareIcon-e3ygcjpv.js";import"./SortAscIcon-CVKVWIWQ.js";import"./url-DuKx0yk0.js";/* empty css */import"./index-Dro44tIm.js";/* empty css *//* empty css */import"./index-DsG9xhMj.js";/* empty css */import"./index-CNU-WVhQ.js";import"./index--OLIX362.js";import"./index-DYGslHkf.js";import"./index-BSRVX3UN.js";import"./index-BH2OX5l8.js";import"./index-C3vDfO5_.js";import"./index-Ko8lxXFd.js";import"./index-CB9u17_J.js";import"./index-BUVtc_FV.js";import"./ArrowLeftIcon-Y3PTljcl.js";import"./SkubbleIcon-tlg17jBG.js";import"./usePrimerThemeBridge-CoHussa9.js";import"./index-Dobs-OKl.js";import"./KernelVariables-CKIqy599.js";import"./index-BvgsWH_d.js";import"./SortDescIcon-CS4EzHeS.js";import"./NotebookToolbar-rtMQZWHQ.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-CGQDY041.js";import"./sessions-BRALW9Yv.js";import"./tokens-DTIgYcNS.js";import"./drivecontents-CxwZz_5W.js";import"./kernel-BI-BLP-K.js";const Bo="jp-DefaultStyle",Eo="jp-HTMLSelect";class No extends H.Component{render(){const{className:e,defaultStyle:i=!0,disabled:a,elementRef:s,iconProps:l,icon:p=ht,options:n=[],...c}=this.props,d=pt(Eo,{[Bo]:i},e),g=b=>{b.stopPropagation()},m=n.map(b=>{const f=typeof b=="object"?b:{value:b};return H.createElement("option",{...f,key:f.value},f.label||f.value)});return H.createElement("div",{className:d},H.createElement("select",{onFocus:g,disabled:a,ref:s,...c,multiple:!1},m,c.children),H.createElement(p.react,{tag:"span",stylesheet:"select",right:"4px",top:"4px",...l}))}}function Oo(r){const i=a=>{const s=Math.max(a*3.6,.1),l=s*Math.PI/180,p=Math.sin(l)*104,n=Math.cos(l)*-104;return"M 0 0 v -104 A 104 104 1 "+(s<180?1:0)+" 0 "+p.toFixed(4)+" "+n.toFixed(4)+" z"};return A.createElement("div",{className:"jp-Statusbar-ProgressCircle",role:"progressbar","aria-label":r.label||"Unlabelled progress circle","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r.progress,onClick:r.onClick},A.createElement("svg",{viewBox:"0 0 250 250"},A.createElement("circle",{cx:"125",cy:"125",r:"104",stroke:"var(--jp-inverse-layout-color3)",strokeWidth:"20",fill:"none"}),A.createElement("path",{className:"jp-Statusbar-ProgressCirclePath",transform:"translate(125,125) scale(.9)",d:i(r.progress),fill:"var(--jp-inverse-layout-color3)"})))}const jo="jp-JSONEditor",ce="jp-mod-error",Ro="jp-JSONEditor-host",Io="jp-JSONEditor-header";class Po extends Z{constructor(e){super(),this._dataDirty=!1,this._inputDirty=!1,this._source=null,this._originalValue=ne.emptyObject,this._changeGuard=!1,this.translator=e.translator||O,this._trans=this.translator.load("jupyterlab"),this.addClass(jo),this.headerNode=document.createElement("div"),this.headerNode.className=Io,this.revertButtonNode=gt.element({tag:"span",title:this._trans.__("Revert changes to data")}),this.commitButtonNode=bt.element({tag:"span",title:this._trans.__("Commit changes to data"),marginLeft:"8px"}),this.editorHostNode=document.createElement("div"),this.editorHostNode.className=Ro,this.headerNode.appendChild(this.revertButtonNode),this.headerNode.appendChild(this.commitButtonNode),this.node.appendChild(this.headerNode),this.node.appendChild(this.editorHostNode);const i=new mt.Model({mimeType:"application/json"});i.sharedModel.changed.connect(this._onModelChanged,this),this.model=i,this.editor=e.editorFactory({host:this.editorHostNode,model:i,config:{readOnly:!0}})}get source(){return this._source}set source(e){this._source!==e&&(this._source&&this._source.changed.disconnect(this._onSourceChanged,this),this._source=e,this.editor.setOption("readOnly",e===null),e&&e.changed.connect(this._onSourceChanged,this),this._setValue())}get isDirty(){return this._dataDirty||this._inputDirty}dispose(){var e;this.isDisposed||((e=this.source)===null||e===void 0||e.dispose(),this.model.dispose(),this.editor.dispose(),super.dispose())}handleEvent(e){switch(e.type){case"blur":this._evtBlur(e);break;case"click":this._evtClick(e);break}}onAfterAttach(e){const i=this.editorHostNode;i.addEventListener("blur",this,!0),i.addEventListener("click",this,!0),this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.headerNode.addEventListener("click",this)}onBeforeDetach(e){const i=this.editorHostNode;i.removeEventListener("blur",this,!0),i.removeEventListener("click",this,!0),this.headerNode.removeEventListener("click",this)}_onSourceChanged(e,i){if(!this._changeGuard){if(this._inputDirty||this.editor.hasFocus()){this._dataDirty=!0;return}this._setValue()}}_onModelChanged(e,i){if(i.sourceChange){let a=!0;try{const s=JSON.parse(this.editor.model.sharedModel.getSource());this.removeClass(ce),this._inputDirty=!this._changeGuard&&!ne.deepEqual(s,this._originalValue)}catch{this.addClass(ce),this._inputDirty=!0,a=!1}this.revertButtonNode.hidden=!this._inputDirty,this.commitButtonNode.hidden=!a||!this._inputDirty}}_evtBlur(e){!this._inputDirty&&this._dataDirty&&this._setValue()}_evtClick(e){const i=e.target;this.revertButtonNode.contains(i)?this._setValue():this.commitButtonNode.contains(i)?!this.commitButtonNode.hidden&&!this.hasClass(ce)&&(this._changeGuard=!0,this._mergeContent(),this._changeGuard=!1,this._setValue()):this.editorHostNode.contains(i)&&this.editor.focus()}_mergeContent(){const e=this.editor.model,i=this._originalValue,a=JSON.parse(e.sharedModel.getSource()),s=this.source;if(s){for(const l in a)ne.deepEqual(a[l],i[l]||null)||s.set(l,a[l]);for(const l in i)l in a||s.delete(l)}}_setValue(){this._dataDirty=!1,this._inputDirty=!1,this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.removeClass(ce);const e=this.editor.model,i=this._source?this._source.toJSON():{};if(this._changeGuard=!0,i===void 0)e.sharedModel.setSource(this._trans.__("No data!")),this._originalValue=ne.emptyObject;else{const a=JSON.stringify(i,null,4);e.sharedModel.setSource(a),this._originalValue=i,a.length>1&&a[0]==="{"&&this.editor.setCursorPosition({line:0,column:1})}this._changeGuard=!1,this.commitButtonNode.hidden=!0,this.revertButtonNode.hidden=!0}}const Lo="jp-Notebook-toolbarCellType",Wo="jp-Notebook-toolbarCellTypeDropdown";var _e;(function(r){function e(g,m){const b=(m||O).load("jupyterlab");function f(){if(g.context.model.readOnly)return Xe({title:b.__("Cannot Save"),body:b.__("Document is read-only"),buttons:[ve.okButton()]});g.context.save().then(()=>{if(!g.isDisposed)return g.context.createCheckpoint()})}return Ct($e.create(H.createElement(vt,{signal:g.context.fileChanged},()=>H.createElement(ft,{icon:_t,onClick:f,tooltip:b.__("Save the notebook contents and create checkpoint"),enabled:!!(g&&g.context&&g.context.contentsModel&&g.context.contentsModel.writable)}))))}r.createSaveButton=e;function i(g,m){const b=(m||O).load("jupyterlab");return new Q({icon:yt,onClick:()=>{_.insertBelow(g.content)},tooltip:b.__("Insert a cell below")})}r.createInsertButton=i;function a(g,m,b){const f=(m||O).load("jupyterlab");return new Q({icon:Je,onClick:async()=>{b?.get("useSystemClipboardForCells").composite?await _.cutToSystemClipboard(g.content):_.cut(g.content)},tooltip:f.__("Cut the selected cells")})}r.createCutButton=a;function s(g,m,b){const f=(m||O).load("jupyterlab");return new Q({icon:De,onClick:async()=>{b?.get("useSystemClipboardForCells").composite?await _.copyToSystemClipboard(g.content):_.copy(g.content)},tooltip:f.__("Copy the selected cells")})}r.createCopyButton=s;function l(g,m,b){const f=(m||O).load("jupyterlab");return new Q({icon:ze,onClick:async()=>{b?.get("useSystemClipboardForCells").composite?await _.pasteFromSystemClipboard(g.content):_.paste(g.content)},tooltip:f.__("Paste cells from the clipboard")})}r.createPasteButton=l;function p(g,m,b){const f=(b??O).load("jupyterlab");return new Q({icon:Ge,onClick:()=>{_.runAndAdvance(g.content,g.sessionContext,m,b)},tooltip:f.__("Run the selected cells and advance")})}r.createRunButton=p;function n(g,m,b){const f=(b??O).load("jupyterlab");return new Q({icon:Ye,onClick:()=>{const x=m??new xe({translator:b});x.restart(g.sessionContext).then(o=>(o&&_.runAll(g.content,g.sessionContext,x,b),o))},tooltip:f.__("Restart the kernel, then re-run the whole notebook")})}r.createRestartRunAllButton=n;function c(g,m){return new Ho(g.content,m)}r.createCellTypeItem=c;function d(g,m,b,f){return[{name:"save",widget:e(g,b)},{name:"insert",widget:i(g,b)},{name:"cut",widget:a(g,b,f)},{name:"copy",widget:s(g,b,f)},{name:"paste",widget:l(g,b,f)},{name:"run",widget:p(g,m,b)},{name:"interrupt",widget:ue.createInterruptButton(g.sessionContext,b)},{name:"restart",widget:ue.createRestartButton(g.sessionContext,m,b)},{name:"restart-and-run",widget:n(g,m,b)},{name:"cellType",widget:c(g,b)},{name:"spacer",widget:xt.createSpacerItem()},{name:"kernelName",widget:ue.createKernelNameItem(g.sessionContext,m,b)}]}r.getDefaultItems=d})(_e||(_e={}));class Ho extends $e{constructor(e,i){super(),this.handleChange=a=>{a.target.value!=="-"&&(_.changeCellType(this._notebook,a.target.value),this._notebook.activate())},this.handleKeyDown=a=>{a.key==="Enter"&&this._notebook.activate()},this._trans=(i||O).load("jupyterlab"),this.addClass(Lo),this._notebook=e,e.model&&this.update(),e.activeCellChanged.connect(this.update,this),e.selectionChanged.connect(this.update,this)}render(){let e="-";this._notebook.activeCell&&(e=this._notebook.activeCell.model.type);for(const i of this._notebook.widgets)if(this._notebook.isSelectedOrActive(i)&&i.model.type!==e){e="-";break}return H.createElement(No,{className:Wo,onChange:this.handleChange,onKeyDown:this.handleKeyDown,value:e,"aria-label":this._trans.__("Cell type"),title:this._trans.__("Select the cell type")},H.createElement("option",{value:"-"},"-"),H.createElement("option",{value:"code"},this._trans.__("Code")),H.createElement("option",{value:"markdown"},this._trans.__("Markdown")),H.createElement("option",{value:"raw"},this._trans.__("Raw")))}}function He(r){var e;const i=r.translator||O,a=rt(i),s=i.load("jupyterlab"),l=(e=r.displayOption.showJumpToCell)!==null&&e!==void 0?e:!1,p=r.state,n=r.displayOption.showOnToolBar,c=r.displayOption.showProgress,d=n?"down":"up",g=A.createElement("div",null),[m,b]=A.useState(!1);if(A.useEffect(()=>{if(m)return;const j=()=>{b(!0)};return _.executionScheduled.connect(j),()=>{_.executionScheduled.disconnect(j)}},[l,m]),!p)return g;const f=p.kernelStatus,x={alignSelf:"normal",height:"24px"},o=p.totalTime,t=p.scheduledCellNumber||0,u=p.scheduledCell.size||0,C=t-u;let w=100*C/t,B=c?"":"hidden";!c&&w<100&&(w=0);const M=j=>A.createElement(Oo,{progress:j,width:16,height:24,label:s.__("Kernel status")}),K=j=>s.__("Kernel status: %1",j),V=()=>{const j=r.notebook;_.selectLastRunCell(j),j.activeCell&&j.scrollToCell(j.activeCell)},R=(j,$,P)=>A.createElement("div",{className:"jp-Notebook-ExecutionIndicator",title:c?"":K(a[j]),"data-status":j},$,A.createElement("div",{className:`jp-Notebook-ExecutionIndicator-tooltip ${d} ${B}`},A.createElement("span",null," ",K(a[j])," "),P,l&&m&&A.createElement(St,{className:"jp-Notebook-ExecutionIndicator-jumpButton",onClick:V,title:s.__("Jump to current or last executed cell")},s.__("Jump to cell"))));if(p.kernelStatus==="connecting"||p.kernelStatus==="disconnected"||p.kernelStatus==="unknown")return R(f,A.createElement(wt.react,{...x}),[]);if(p.kernelStatus==="starting"||p.kernelStatus==="terminating"||p.kernelStatus==="restarting"||p.kernelStatus==="initializing")return R(f,A.createElement(kt.react,{...x}),[]);if(p.executionStatus==="busy")return R("busy",M(w),[A.createElement("span",{key:0},s.__("Executed %1/%2 cells",C,t)),A.createElement("span",{key:1},s._n("Elapsed time: %1 second","Elapsed time: %1 seconds",o))]);{const j=p.kernelStatus==="busy"?0:100,$=p.kernelStatus==="busy"||o===0?[]:[A.createElement("span",{key:0},s._n("Executed %1 cell","Executed %1 cells",t)),A.createElement("span",{key:1},s._n("Elapsed time: %1 second","Elapsed time: %1 seconds",o))];return R(p.kernelStatus,M(j),$)}}class X extends we{constructor(e,i=!0){super(new X.Model),this.translator=e||O,this.addClass("jp-mod-highlighted")}render(){if(this.model===null||!this.model.renderFlag)return A.createElement("div",null);{const e=this.model.currentNotebook;return e?A.createElement(He,{displayOption:this.model.displayOption,state:this.model.executionState(e),translator:this.translator,notebook:e}):A.createElement(He,{displayOption:this.model.displayOption,state:void 0,translator:this.translator,notebook:void 0})}}}(function(r){class e extends ke{constructor(){super(),this._notebookExecutionProgress=new WeakMap,this._displayOption={showOnToolBar:!0,showProgress:!0,showJumpToCell:!1},this._renderFlag=!0}attachNotebook(l){var p,n,c,d;if(l&&l.content&&l.context){const g=l.content,m=l.context;if(this._currentNotebook=g,!this._notebookExecutionProgress.has(g)){this._notebookExecutionProgress.set(g,{executionStatus:"idle",kernelStatus:"idle",totalTime:0,interval:0,timeout:0,scheduledCell:new Set,scheduledCellNumber:0,needReset:!0});const b=this._notebookExecutionProgress.get(g),f=u=>{b&&(b.kernelStatus=u.kernelDisplayStatus),this.stateChanged.emit(void 0)};m.statusChanged.connect(f,this);const x=u=>{b&&(b.kernelStatus=u.kernelDisplayStatus),this.stateChanged.emit(void 0)};m.connectionStatusChanged.connect(x,this),m.disposed.connect(u=>{u.connectionStatusChanged.disconnect(x,this),u.statusChanged.disconnect(f,this)});const o=(u,C)=>{const w=C.msg,B=w.header.msg_id;if(w.header.msg_type==="execute_request")this._cellScheduledCallback(g,B);else if(Y.KernelMessage.isStatusMsg(w)&&w.content.execution_state==="idle"){const M=w.parent_header.msg_id;this._cellExecutedCallback(g,M)}else Y.KernelMessage.isStatusMsg(w)&&w.content.execution_state==="restarting"?this._restartHandler(g):w.header.msg_type==="execute_input"&&this._startTimer(g)};(n=(p=m.session)===null||p===void 0?void 0:p.kernel)===null||n===void 0||n.anyMessage.connect(o),(d=(c=m.session)===null||c===void 0?void 0:c.kernel)===null||d===void 0||d.disposed.connect(u=>u.anyMessage.disconnect(o));const t=(u,C)=>{b&&(this._resetTime(b),this.stateChanged.emit(void 0),C.newValue&&C.newValue.anyMessage.connect(o))};m.kernelChanged.connect(t),m.disposed.connect(u=>u.kernelChanged.disconnect(t))}}}get currentNotebook(){return this._currentNotebook}get displayOption(){return this._displayOption}set displayOption(l){this._displayOption=l}executionState(l){return this._notebookExecutionProgress.get(l)}_scheduleSwitchToIdle(l){window.setTimeout(()=>{l.executionStatus="idle",clearInterval(l.interval),this.stateChanged.emit(void 0)},150),l.timeout=window.setTimeout(()=>{l.needReset=!0},1e3)}_cellExecutedCallback(l,p){const n=this._notebookExecutionProgress.get(l);n&&n.scheduledCell.has(p)&&(n.scheduledCell.delete(p),n.scheduledCell.size===0&&this._scheduleSwitchToIdle(n))}_restartHandler(l){const p=this._notebookExecutionProgress.get(l);p&&(p.scheduledCell.clear(),this._scheduleSwitchToIdle(p))}_startTimer(l){const p=this._notebookExecutionProgress.get(l);p&&(p.scheduledCell.size>0?p.executionStatus!=="busy"&&(p.executionStatus="busy",clearTimeout(p.timeout),this.stateChanged.emit(void 0),p.interval=window.setInterval(()=>{this._tick(p)},1e3)):this._resetTime(p))}_cellScheduledCallback(l,p){const n=this._notebookExecutionProgress.get(l);n&&!n.scheduledCell.has(p)&&(n.needReset&&this._resetTime(n),n.scheduledCell.add(p),n.scheduledCellNumber+=1)}_tick(l){l.totalTime+=1,this.stateChanged.emit(void 0)}_resetTime(l){l.totalTime=0,l.scheduledCellNumber=0,l.executionStatus="idle",l.scheduledCell=new Set,clearTimeout(l.timeout),clearInterval(l.interval),l.needReset=!1}get renderFlag(){return this._renderFlag}updateRenderOption(l){this.displayOption.showOnToolBar&&(l.showOnToolBar?this._renderFlag=!0:this._renderFlag=!1),this.displayOption.showProgress=l.showProgress,this.displayOption.showJumpToCell=l.showJumpToCell,this.stateChanged.emit(void 0)}}r.Model=e;function i(s,l,p){const n=new r(l);return n.model.displayOption={showOnToolBar:!0,showProgress:!0,showJumpToCell:!1},n.model.attachNotebook({content:s.content,context:s.sessionContext}),p&&p.then(c=>{const d=g=>{const m=a(g);m.showJumpToCell&&(g.get("recordTiming").composite||g.set("recordTiming",!0).catch(f=>{console.error("Failed to auto-enable recordTiming:",f.message)})),n.model.updateRenderOption(m)};c.changed.connect(d),d(c),n.disposed.connect(()=>{c.changed.disconnect(d)})}).catch(c=>{console.error(c.message)}),n}r.createExecutionIndicatorItem=i;function a(s){let l=!0,p=!0,n=!1;const c=s.get("kernelStatus").composite;return c&&(l=!c.showOnStatusBar,p=c.showProgress,n=c.showJumpToRecentExecutionButton),{showOnToolBar:l,showProgress:p,showJumpToCell:n}}r.getSettingValue=a})(X||(X={}));function Fo(r){const e=(r.translator||O).load("jupyterlab");return H.createElement(at,{source:e.__("Mode: %1",r.modeNames[r.notebookMode])})}class re extends we{constructor(e){super(new re.Model),this.translator=e||O,this._trans=this.translator.load("jupyterlab"),this._modeNames={command:this._trans.__("Command"),edit:this._trans.__("Edit")}}render(){return this.model?(this.node.title=this._trans.__("Notebook is in %1 mode",this._modeNames[this.model.notebookMode]),H.createElement(Fo,{notebookMode:this.model.notebookMode,translator:this.translator,modeNames:this._modeNames})):null}}(function(r){class e extends ke{constructor(){super(...arguments),this._onChanged=a=>{const s=this._notebookMode;this._notebook?this._notebookMode=a.mode:this._notebookMode="command",this._triggerChange(s,this._notebookMode)},this._notebookMode="command",this._notebook=null}get notebookMode(){return this._notebookMode}set notebook(a){const s=this._notebook;s!==null&&(s.stateChanged.disconnect(this._onChanged,this),s.activeCellChanged.disconnect(this._onChanged,this),s.modelContentChanged.disconnect(this._onChanged,this));const l=this._notebookMode;this._notebook=a,this._notebook===null?this._notebookMode="command":(this._notebookMode=this._notebook.mode,this._notebook.stateChanged.connect(this._onChanged,this),this._notebook.activeCellChanged.connect(this._onChanged,this),this._notebook.modelContentChanged.connect(this._onChanged,this)),this._triggerChange(l,this._notebookMode)}_triggerChange(a,s){a!==s&&this.stateChanged.emit(void 0)}}r.Model=e})(re||(re={}));class Ko extends vo{constructor(e,i){super(e,i),this.editorWidget=e,this.options=i,this._type="code",this._readyDelegate=new At,this._editorToCell=new Map,this.editor=e.content,this._cellToEditor=new WeakMap,this.isReady=this.isReady.bind(this),Promise.all([this.widget.context.sessionContext.ready,this.connectionManager.ready]).then(async()=>{await this.initOnceReady(),this._readyDelegate.resolve()}).catch(console.error)}get documentPath(){return this.widget.context.path}get mimeType(){var e;let i,a=this.language_info();return!a||!a.mimetype?i=this.widget.content.codeMimetype:i=a.mimetype,Array.isArray(i)?(e=i[0])!==null&&e!==void 0?e:Mt.defaultMimeType:i}get languageFileExtension(){let e=this.language_info();if(!(!e||!e.file_extension))return e.file_extension.replace(".","")}get wrapperElement(){return this.widget.node}get editors(){if(this.isDisposed)return[];let e=this.widget.content;return this._editorToCell.clear(),e.isDisposed?[]:e.widgets.map(i=>({ceEditor:this._getCellEditor(i),type:i.model.type,value:i.model.sharedModel.getSource()}))}get activeEditor(){return this.editor.activeCell?this._getCellEditor(this.editor.activeCell):void 0}get ready(){return this._readyDelegate.promise}getEditorIndexAt(e){let i=this._getCellAt(e);return this.widget.content.widgets.findIndex(s=>i===s)}getEditorIndex(e){let i=this._editorToCell.get(e);return this.editor.widgets.findIndex(a=>i===a)}getEditorWrapper(e){return this._editorToCell.get(e).node}async onKernelChanged(e,i){if(i.newValue)try{const a=this._languageInfo;await Le(this.isReady,-1),await this._updateLanguageInfo();const s=this._languageInfo;a?.name!=s.name||a?.mimetype!=s?.mimetype||a?.file_extension!=s?.file_extension?(console.log(`Changed to ${this._languageInfo.name} kernel, reconnecting`),this.reloadConnection()):console.log("Keeping old LSP connection as the new kernel uses the same language")}catch(a){console.warn(a),this.reloadConnection()}}dispose(){this.isDisposed||(this.widget.context.sessionContext.kernelChanged.disconnect(this.onKernelChanged,this),this.widget.content.activeCellChanged.disconnect(this._activeCellChanged,this),super.dispose(),this._editorToCell.clear(),Tt.clearData(this))}isReady(){var e;return!this.widget.isDisposed&&this.widget.context.isReady&&this.widget.content.isVisible&&this.widget.content.widgets.length>0&&((e=this.widget.context.sessionContext.session)===null||e===void 0?void 0:e.kernel)!=null}async handleCellChange(e,i){let a=[],s=[];const l=this._type;if(i.type==="set"){let p=[],n=[];if(i.newValues.length===i.oldValues.length){for(let c=0;c<i.newValues.length;c++)i.oldValues[c].type===l&&i.newValues[c].type!==l?p.push(i.newValues[c]):i.oldValues[c].type!==l&&i.newValues[c].type===l&&n.push(i.newValues[c]);a=n,s=p}}else i.type=="add"&&(a=i.newValues.filter(p=>p.type===l));(s.length||a.length||i.type==="set"||i.type==="move"||i.type==="remove"||i.type==="clear")&&await this.updateDocuments();for(let p of a){let n=this.widget.content.widgets.find(c=>c.model.id===p.id);if(!n){console.warn(`Widget for added cell with ID: ${p.id} not found!`);continue}this._getCellEditor(n)}}createVirtualDocument(){return new fo({language:this.language,foreignCodeExtractors:this.options.foreignCodeExtractorsManager,path:this.documentPath,fileExtension:this.languageFileExtension,standalone:!1,hasLspSupportedFile:!1})}language_info(){return this._languageInfo}async initOnceReady(){await Le(this.isReady.bind(this),-1),await this._updateLanguageInfo(),this.initVirtual(),this.connectDocument(this.virtualDocument,!1).catch(console.warn),this.widget.context.sessionContext.kernelChanged.connect(this.onKernelChanged,this),this.widget.content.activeCellChanged.connect(this._activeCellChanged,this),this._connectModelSignals(this.widget),this.editor.modelChanged.connect(e=>{console.warn("Model changed, connecting cell change handler; this is not something we were expecting"),this._connectModelSignals(e)})}_connectModelSignals(e){e.model===null?console.warn(`Model is missing for notebook ${e}, cannot connect cell changed signal!`):e.model.cells.changed.connect(this.handleCellChange,this)}async _updateLanguageInfo(){var e,i,a,s;const l=(s=await((a=(i=(e=this.widget.context.sessionContext)===null||e===void 0?void 0:e.session)===null||i===void 0?void 0:i.kernel)===null||a===void 0?void 0:a.info))===null||s===void 0?void 0:s.language_info;if(l)this._languageInfo=l;else throw new Error("Language info update failed (no session, kernel, or info available)")}_activeCellChanged(e,i){!i||i.model.type!==this._type||this._activeEditorChanged.emit({editor:this._getCellEditor(i)})}_getCellAt(e){let i=this.virtualDocument.getEditorAtVirtualLine(e);return this._editorToCell.get(i)}_getCellEditor(e){if(!this._cellToEditor.has(e)){const i=Object.freeze({getEditor:()=>e.editor,ready:async()=>(await e.ready,e.editor),reveal:async()=>(await this.editor.scrollToCell(e),e.editor)});this._cellToEditor.set(e,i),this._editorToCell.set(i,e),e.disposed.connect(()=>{this._cellToEditor.delete(e),this._editorToCell.delete(i),this._editorRemoved.emit({editor:i})}),this._editorAdded.emit({editor:i})}return this._cellToEditor.get(e)}}class Vo extends Z{constructor(){super(),this._items=[],this.layout=new pe,this.addClass("jp-RankedPanel")}addWidget(e,i){const a={widget:e,rank:i},s=ie.upperBound(this._items,a,ye.itemCmp);ie.insert(this._items,s,a),this.layout.insertWidget(s,e)}onChildRemoved(e){const i=ie.findFirstIndex(this._items,a=>a.widget===e.child);i!==-1&&ie.removeAt(this._items,i)}}class q extends Z{constructor(e){super(),this.addClass("jp-NotebookTools"),this.translator=e.translator||O,this._tools=[],this.layout=new pe,this._tracker=e.tracker,this._tracker.currentChanged.connect(this._onActiveNotebookPanelChanged,this),this._tracker.activeCellChanged.connect(this._onActiveCellChanged,this),this._tracker.selectionChanged.connect(this._onSelectionChanged,this),this._onActiveNotebookPanelChanged(),this._onActiveCellChanged(),this._onSelectionChanged()}get activeCell(){return this._tracker.activeCell}get selectedCells(){const e=this._tracker.currentWidget;if(!e)return[];const i=e.content;return i.widgets.filter(a=>i.isSelectedOrActive(a))}get activeNotebookPanel(){return this._tracker.currentWidget}addItem(e){var i;const a=e.tool,s=(i=e.rank)!==null&&i!==void 0?i:100;let l;const p=this._tools.find(n=>n.section===e.section);if(p)l=p.panel;else throw new Error(`The section ${e.section} does not exist`);a.addClass("jp-NotebookTools-tool"),l.addWidget(a,s),a.notebookTools=this,G.sendMessage(a,q.ActiveNotebookPanelMessage),G.sendMessage(a,q.ActiveCellMessage)}addSection(e){var i;const a=e.sectionName,s=e.label||e.sectionName,l=e.tool;let p=(i=e.rank)!==null&&i!==void 0?i:null;const n=new Vo;if(n.title.label=s,l&&n.addWidget(l,0),this._tools.push({section:a,panel:n,rank:p}),p!=null)this.layout.insertWidget(p,new de({widget:n}));else{let c=null;const d=this.layout;for(let g=0;g<d.widgets.length;g++){let m=d.widgets[g];if(m instanceof de&&m.widget.id==="advancedToolsSection"){c=g;break}}c!==null?this.layout.insertWidget(c,new de({widget:n})):this.layout.addWidget(new de({widget:n}))}}_onActiveNotebookPanelChanged(){this._prevActiveNotebookModel&&!this._prevActiveNotebookModel.isDisposed&&this._prevActiveNotebookModel.metadataChanged.disconnect(this._onActiveNotebookPanelMetadataChanged,this);const e=this.activeNotebookPanel&&this.activeNotebookPanel.content?this.activeNotebookPanel.content.model:null;this._prevActiveNotebookModel=e,e&&e.metadataChanged.connect(this._onActiveNotebookPanelMetadataChanged,this);for(const i of this._toolChildren())G.sendMessage(i,q.ActiveNotebookPanelMessage)}_onActiveCellChanged(){this._prevActiveCell&&!this._prevActiveCell.isDisposed&&this._prevActiveCell.metadataChanged.disconnect(this._onActiveCellMetadataChanged,this);const e=this.activeCell?this.activeCell.model:null;this._prevActiveCell=e,e&&e.metadataChanged.connect(this._onActiveCellMetadataChanged,this);for(const i of this._toolChildren())G.sendMessage(i,q.ActiveCellMessage)}_onSelectionChanged(){for(const e of this._toolChildren())G.sendMessage(e,q.SelectionMessage)}_onActiveNotebookPanelMetadataChanged(e,i){const a=new he.ChangeMessage("activenotebookpanel-metadata-changed",{oldValue:void 0,newValue:void 0,...i});for(const s of this._toolChildren())G.sendMessage(s,a)}_onActiveCellMetadataChanged(e,i){const a=new he.ChangeMessage("activecell-metadata-changed",{newValue:void 0,oldValue:void 0,...i});for(const s of this._toolChildren())G.sendMessage(s,a)}*_toolChildren(){for(let e of this._tools)yield*e.panel.children()}}(function(r){r.ActiveNotebookPanelMessage=new Ce("activenotebookpanel-changed"),r.ActiveCellMessage=new Ce("activecell-changed"),r.SelectionMessage=new Ce("selection-changed");class e extends Z{dispose(){super.dispose(),this.notebookTools&&(this.notebookTools=null)}processMessage(s){switch(super.processMessage(s),s.type){case"activenotebookpanel-changed":this.onActiveNotebookPanelChanged(s);break;case"activecell-changed":this.onActiveCellChanged(s);break;case"selection-changed":this.onSelectionChanged(s);break;case"activecell-metadata-changed":this.onActiveCellMetadataChanged(s);break;case"activenotebookpanel-metadata-changed":this.onActiveNotebookPanelMetadataChanged(s);break}}onActiveNotebookPanelChanged(s){}onActiveCellChanged(s){}onSelectionChanged(s){}onActiveCellMetadataChanged(s){}onActiveNotebookPanelMetadataChanged(s){}}r.Tool=e;class i extends e{constructor(s){super();const{editorFactory:l}=s;this.addClass("jp-MetadataEditorTool");const p=this.layout=new pe;this._editorFactory=l,this._editorLabel=s.label||"Edit Metadata",this.createEditor();const n=new Z({node:document.createElement("label")});n.node.textContent=s.label||"Edit Metadata",p.addWidget(n),p.addWidget(this.editor)}get editor(){return this._editor}onActiveNotebookPanelChanged(s){this.editor.dispose(),this.notebookTools.activeNotebookPanel&&this.createEditor()}createEditor(){this._editor=new Po({editorFactory:this._editorFactory}),this.editor.title.label=this._editorLabel,this.layout.addWidget(this.editor)}}r.MetadataEditorTool=i})(q||(q={}));var ye;(function(r){function e(i,a){return i.rank-a.rank}r.itemCmp=e})(ye||(ye={}));const Uo=6;var W;(function(r){r[r.Idle=-1]="Idle",r[r.Error=-.5]="Error",r[r.Scheduled=0]="Scheduled",r[r.Running=1]="Running"})(W||(W={}));class qo extends To{constructor(e,i,a,s){super(e,s),this.parser=i,this.sanitizer=a,this.configMetadataMap={numberHeaders:["toc-autonumbering","toc/number_sections"],numberingH1:["!toc/skip_h1_title"],baseNumbering:["toc/base_numbering"]},this._runningCells=new Array,this._errorCells=new Array,this._cellToHeadingIndex=new WeakMap,e.context.ready.then(()=>{this.setConfiguration({})}),this.widget.context.model.metadataChanged.connect(this.onMetadataChanged,this),this.widget.content.activeCellChanged.connect(this.onActiveCellChanged,this),_.executionScheduled.connect(this.onExecutionScheduled,this),_.executed.connect(this.onExecuted,this),_.outputCleared.connect(this.onOutputCleared,this),this.headingsChanged.connect(this.onHeadingsChanged,this)}get documentType(){return"notebook"}get isAlwaysActive(){return!0}get supportedOptions(){return["baseNumbering","maximalDepth","numberingH1","numberHeaders","includeOutput","syncCollapseState"]}getCellHeadings(e){const i=new Array;let a=this._cellToHeadingIndex.get(e);if(a!==void 0){const s=this.headings[a];for(i.push(s);this.headings[a-1]&&this.headings[a-1].cellRef===s.cellRef;)a--,i.unshift(this.headings[a])}return i}dispose(){var e,i,a;this.isDisposed||(this.headingsChanged.disconnect(this.onHeadingsChanged,this),(i=(e=this.widget.context)===null||e===void 0?void 0:e.model)===null||i===void 0||i.metadataChanged.disconnect(this.onMetadataChanged,this),(a=this.widget.content)===null||a===void 0||a.activeCellChanged.disconnect(this.onActiveCellChanged,this),_.executionScheduled.disconnect(this.onExecutionScheduled,this),_.executed.disconnect(this.onExecuted,this),_.outputCleared.disconnect(this.onOutputCleared,this),this._runningCells.length=0,this._errorCells.length=0,super.dispose())}setConfiguration(e){const i=this.loadConfigurationFromMetadata();super.setConfiguration({...this.configuration,...i,...e})}toggleCollapse(e){super.toggleCollapse(e),this.updateRunningStatus(this.headings)}async getHeadings(){const e=this.widget.content.widgets,i=new Set(e),a=[],s=new Array,l=new WeakMap;for(let p=0;p<e.length;p++){const n=e[p];switch(n.model.type){case"code":{!this.configuration.syncCollapseState&&this.configuration.includeOutput&&a.push(...Ie(await n.getHeadings(),this.configuration,s).map(d=>({...d,cellRef:n,collapsed:!1,isRunning:W.Idle})));break}case"markdown":{const d=Ie(await n.getHeadings(),this.configuration,s).map((g,m)=>({...g,cellRef:n,collapsed:!1,isRunning:W.Idle}));if(this.configuration.syncCollapseState&&n.headingCollapsed){const g=Math.min(...d.map(b=>b.level)),m=d.find(b=>b.level===g);m.collapsed=n.headingCollapsed}a.push(...d);break}}a.length>0&&l.set(n,a.length-1)}return this._cellToHeadingIndex=l,this._runningCells=this._runningCells.filter(p=>i.has(p)),this._errorCells=this._errorCells.filter(p=>i.has(p)),this.updateRunningStatus(a),Promise.resolve(a)}isHeadingEqual(e,i){return super.isHeadingEqual(e,i)&&e.cellRef===i.cellRef&&e.isRunning===i.isRunning}loadConfigurationFromMetadata(){const e=this.widget.content.model,i={};if(e)for(const a in this.configMetadataMap){const s=this.configMetadataMap[a];for(const l of s){let p=l;const n=p[0]==="!";n&&(p=p.slice(1));const c=p.split("/");let d=e.getMetadata(c[0]);for(let g=1;g<c.length;g++)d=(d??{})[c[g]];d!==void 0&&(typeof d=="boolean"&&n&&(d=!d),i[a]=d)}}return i}onActiveCellChanged(e,i){const a=this.getCellHeadings(i)[0];this.setActiveHeading(a??null,!1)}onHeadingsChanged(){this.widget.content.activeCell&&this.onActiveCellChanged(this.widget.content,this.widget.content.activeCell)}onExecuted(e,i){this._runningCells.forEach((a,s)=>{var l;if(a===i.cell){this._runningCells.splice(s,1);const p=this._cellToHeadingIndex.get(a);if(p!==void 0){const n=this.headings[p];if(i.success||((l=i.error)===null||l===void 0?void 0:l.errorName)===void 0){n.isRunning=W.Idle;return}n.isRunning=W.Error,this._errorCells.includes(a)||this._errorCells.push(a)}}}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onExecutionScheduled(e,i){this._runningCells.includes(i.cell)||this._runningCells.push(i.cell),this._errorCells.forEach((a,s)=>{a===i.cell&&this._errorCells.splice(s,1)}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onOutputCleared(e,i){this._errorCells.forEach((a,s)=>{if(a===i.cell){this._errorCells.splice(s,1);const l=this._cellToHeadingIndex.get(a);if(l!==void 0){const p=this.headings[l];p.isRunning=W.Idle}}}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onMetadataChanged(){this.setConfiguration({})}updateRunningStatus(e){e.forEach(s=>{s.isRunning=W.Idle}),this._runningCells.forEach((s,l)=>{const p=this._cellToHeadingIndex.get(s);if(p!==void 0){const n=e[p];n.isRunning!==W.Running&&(n.isRunning=l>0?W.Scheduled:W.Running)}}),this._errorCells.forEach((s,l)=>{const p=this._cellToHeadingIndex.get(s);if(p!==void 0){const n=e[p];n.isRunning===W.Idle&&(n.isRunning=W.Error)}});let i=0;for(;i<e.length;){const s=e[i];if(i++,s.collapsed){const l=Math.max(s.isRunning,a(e,s.level));s.dataset={...s.dataset,"data-running":l.toString()}}else s.dataset={...s.dataset,"data-running":s.isRunning.toString()}}function a(s,l){let p=W.Idle;for(;i<s.length;){const n=s[i];if(n.dataset={...n.dataset,"data-running":n.isRunning.toString()},n.level>l)i++,p=Math.max(n.isRunning,p),n.collapsed&&(p=Math.max(p,a(s,n.level)),n.dataset={...n.dataset,"data-running":p.toString()});else break}return p}}}class $o extends Mo{constructor(e,i,a,s){super(e),this.parser=i,this.sanitizer=a,this.commands=s,this._scrollToTop=!0}get scrollToTop(){return this._scrollToTop}set scrollToTop(e){this._scrollToTop=e}_createNew(e,i){const a=new qo(e,this.parser,this.sanitizer,i);let s=new WeakMap;const l=(m,b)=>{if(b){const f=async u=>{if(!u.inViewport)return;const C=s.get(b);if(C)if(this.scrollToTop)C.scrollIntoView({block:"start"}),e.content.outerNode.scrollTop-=Uo;else{const w=e.content.node.getBoundingClientRect(),B=C.getBoundingClientRect();(B.top>w.bottom||B.bottom<w.top)&&C.scrollIntoView({block:"center"})}else console.debug("scrolling to heading: using fallback strategy"),await e.content.scrollToItem(e.content.activeCellIndex,this.scrollToTop?"start":void 0,0)},x=b.cellRef,t=e.content.widgets.indexOf(x);x.model.type=="markdown"&&e.content.mode!="command"&&(e.content.mode="command"),e.content.activeCellIndex=t,x.inViewport?f(x).catch(u=>{console.error(`Fail to scroll to cell to display the required heading (${u}).`)}):e.content.scrollToItem(t,this.scrollToTop?"start":void 0).then(()=>p(x)).then(()=>f(x)).catch(u=>{console.error(`Fail to scroll to cell to display the required heading (${u}).`)})}},p=m=>Promise.all(a.getCellHeadings(m).map(async b=>{var f,x,o;const t=await Jo(b,this.parser,this.sanitizer),u=(f=this.sanitizer.allowNamedProperties)!==null&&f!==void 0&&f?"id":"data-jupyter-id",C=t?`h${b.level}[${u}="${CSS.escape(t)}"]`:`h${b.level}`;b.outputIndex!==void 0?s.set(b,je(b.cellRef.outputArea.widgets[b.outputIndex].node,C,(x=b.prefix)!==null&&x!==void 0?x:"")):s.set(b,je(b.cellRef.node,C,(o=b.prefix)!==null&&o!==void 0?o:""))})).then(()=>{}),n=m=>{if(this.parser)return Re(e.content.node),s=new WeakMap,Promise.all(e.content.widgets.map(b=>p(b)))},c=(m,b)=>{var f,x,o,t;if(a.configuration.syncCollapseState)if(b!==null){const u=b.cellRef;u.headingCollapsed!==((f=b.collapsed)!==null&&f!==void 0?f:!1)&&(u.headingCollapsed=(x=b.collapsed)!==null&&x!==void 0?x:!1)}else{const u=(t=(o=a.headings[0])===null||o===void 0?void 0:o.collapsed)!==null&&t!==void 0?t:!1;e.content.widgets.forEach(C=>{C instanceof le&&C.headingInfo.level>=0&&(C.headingCollapsed=u)})}},d=(m,b)=>{if(a.configuration.syncCollapseState){const f=a.getCellHeadings(b)[0];f&&a.toggleCollapse({heading:f,collapsed:b.headingCollapsed})}},g=(m,b)=>{var f;b.inViewport?(f=p(b))===null||f===void 0||f.catch(console.warn):Re(b.node)};return e.context.ready.then(()=>{var m;(m=n())===null||m===void 0||m.catch(console.warn),a.activeHeadingChanged.connect(l),a.headingsChanged.connect(n),a.collapseChanged.connect(c),e.content.cellCollapsed.connect(d),e.content.cellInViewportChanged.connect(g),e.disposed.connect(()=>{a.activeHeadingChanged.disconnect(l),a.headingsChanged.disconnect(n),a.collapseChanged.disconnect(c),e.content.cellCollapsed.disconnect(d),e.content.cellInViewportChanged.disconnect(g)})}),a}getToolbarItems(e){return this.commands?[{name:"select-last-modified-back",widget:new Oe({commands:this.commands,id:"notebook:select-last-modified-cell",args:{toolbar:!0},icon:Bt,label:""})},{name:"select-last-modified-forward",widget:new Oe({commands:this.commands,id:"notebook:select-next-modified-cell",args:{toolbar:!0},icon:Et,label:""})}]:[]}}async function Jo(r,e,i){let a=null;return r.type===Pe.HeadingType.Markdown?a=await Nt(e,r.raw,r.level,i):r.type===Pe.HeadingType.HTML&&(a=r.id),a}const Do="jp-StatusItem-trust";function zo(r,e){e=e||O;const i=e.load("jupyterlab");return r.trustedCells===r.totalCells?i.__("Notebook trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells):r.activeCellTrusted?i.__("Active cell trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells):i.__("Notebook not trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells)}function Go(r){return r.allCellsTrusted?A.createElement(Ot.react,{top:"2px",stylesheet:"statusBar"}):A.createElement(jt.react,{top:"2px",stylesheet:"statusBar"})}class ae extends we{constructor(e){super(new ae.Model),this.translator=e||O,this.node.classList.add(Do)}render(){if(!this.model)return null;const e=zo(this.model,this.translator);return e!==this.node.title&&(this.node.title=e),A.createElement(Go,{allCellsTrusted:this.model.trustedCells===this.model.totalCells,activeCellTrusted:this.model.activeCellTrusted,totalCells:this.model.totalCells,trustedCells:this.model.trustedCells})}}(function(r){class e extends ke{constructor(){super(...arguments),this._trustedCells=0,this._totalCells=0,this._activeCellTrusted=!1,this._notebook=null}get trustedCells(){return this._trustedCells}get totalCells(){return this._totalCells}get activeCellTrusted(){return this._activeCellTrusted}get notebook(){return this._notebook}set notebook(a){const s=this._notebook;s!==null&&(s.activeCellChanged.disconnect(this._onActiveCellChanged,this),s.modelContentChanged.disconnect(this._onModelChanged,this));const l=this._getAllState();if(this._notebook=a,this._notebook===null)this._trustedCells=0,this._totalCells=0,this._activeCellTrusted=!1;else{this._notebook.activeCellChanged.connect(this._onActiveCellChanged,this),this._notebook.modelContentChanged.connect(this._onModelChanged,this),this._notebook.activeCell?this._activeCellTrusted=this._notebook.activeCell.model.trusted:this._activeCellTrusted=!1;const{total:p,trusted:n}=this._deriveCellTrustState(this._notebook.model);this._totalCells=p,this._trustedCells=n}this._triggerChange(l,this._getAllState())}_onModelChanged(a){const s=this._getAllState(),{total:l,trusted:p}=this._deriveCellTrustState(a.model);this._totalCells=l,this._trustedCells=p,this._triggerChange(s,this._getAllState())}_onActiveCellChanged(a,s){const l=this._getAllState();s?this._activeCellTrusted=s.model.trusted:this._activeCellTrusted=!1,this._triggerChange(l,this._getAllState())}_deriveCellTrustState(a){if(a===null)return{total:0,trusted:0};let s=0,l=0;for(const p of a.cells)p.type==="code"&&(s++,p.trusted&&l++);return{total:s,trusted:l}}_getAllState(){return[this._trustedCells,this._totalCells,this.activeCellTrusted]}_triggerChange(a,s){(a[0]!==s[0]||a[1]!==s[1]||a[2]!==s[2])&&this.stateChanged.emit(void 0)}}r.Model=e})(ae||(ae={}));const Yo=new Qe("@jupyterlab/metadataform:IMetadataFormProvider","A service to register new metadata editor widgets."),Xo={id:"@jupyterlab/notebook-extension:cell-executor",description:"Provides the notebook cell executor.",autoStart:!0,provides:tt,activate:()=>Object.freeze({runCell:Rt})},Qo=new Qe("@jupyterlab/logconsole:ILoggerRegistry","A service providing a logger infrastructure."),Zo={activate:en,id:"@jupyterlab/notebook-extension:log-output",description:"Adds cell outputs log to the application logger.",requires:[I],optional:[Qo],autoStart:!0};function en(r,e,i){if(!i)return;function a(s){function l(p,n,c){if(Y.KernelMessage.isDisplayDataMsg(p)||Y.KernelMessage.isStreamMsg(p)||Y.KernelMessage.isErrorMsg(p)||Y.KernelMessage.isExecuteResultMsg(p)){const d=i.getLogger(s.context.path);d.rendermime=s.content.rendermime;const g={...p.content,output_type:p.header.msg_type};let m=n;(Y.KernelMessage.isErrorMsg(p)||Y.KernelMessage.isStreamMsg(p)&&p.content.name==="stderr")&&(m=c),d.log({type:"output",data:g,level:m})}}s.context.sessionContext.iopubMessage.connect((p,n)=>l(n,"info","info")),s.context.sessionContext.unhandledMessage.connect((p,n)=>l(n,"warning","error"))}e.forEach(s=>a(s)),e.widgetAdded.connect((s,l)=>a(l))}const tn="jp-ActiveCellTool",on="jp-ActiveCellTool-Content",nn="jp-ActiveCellTool-CellContent";class ln extends q.Tool{constructor(e){super();const{languages:i}=e;this._tracker=e.tracker,this.addClass(tn),this.layout=new pe,this._inputPrompt=new It,this.layout.addWidget(this._inputPrompt);const a=document.createElement("div");a.classList.add(on);const s=a.appendChild(document.createElement("div")),l=s.appendChild(document.createElement("pre"));s.className=nn,this._editorEl=l,this.layout.addWidget(new Z({node:a}));const p=async()=>{var n,c;this._editorEl.innerHTML="",((n=this._cellModel)===null||n===void 0?void 0:n.type)==="code"?(this._inputPrompt.executionCount=`${(c=this._cellModel.executionCount)!==null&&c!==void 0?c:""}`,this._inputPrompt.show()):(this._inputPrompt.executionCount=null,this._inputPrompt.hide()),this._cellModel&&await i.highlight(this._cellModel.sharedModel.getSource().split(`
|
|
2
|
+
`)[0],i.findByMIME(this._cellModel.mimeType),this._editorEl)};this._refreshDebouncer=new Pt(p,150)}render(e){var i,a;const s=this._tracker.activeCell;return s&&(this._cellModel=s?.model||null),((i=this._cellModel)===null||i===void 0?void 0:i.sharedModel).changed.connect(this.refresh,this),(a=this._cellModel)===null||a===void 0||a.mimeTypeChanged.connect(this.refresh,this),this.refresh().then(()=>{}).catch(()=>{}),A.createElement("div",{ref:l=>l?.appendChild(this.node)})}async refresh(){await this._refreshDebouncer.invoke()}}const sn="jp-CellMetadataEditor",rn="jp-NotebookMetadataEditor";class an extends q.MetadataEditorTool{constructor(e){super(e),this._tracker=e.tracker,this.editor.editorHostNode.addEventListener("blur",this.editor,!0),this.editor.editorHostNode.addEventListener("click",this.editor,!0),this.editor.headerNode.addEventListener("click",this.editor)}_onSourceChanged(){var e,i,a;const s=(e=this._tracker.activeCell)===null||e===void 0?void 0:e.model.sharedModel;if(s&&this.editor.source){const l=Object.keys((i=s.metadata)!==null&&i!==void 0?i:{}),p=(a=this.editor.source.toJSON())!==null&&a!==void 0?a:{};s.transact(()=>{l.forEach(n=>s.deleteMetadata(n)),s.setMetadata(p)})}}render(e){var i;const a=this._tracker.activeCell;return this.editor.source=a?new he({values:a.model.metadata}):null,(i=this.editor.source)===null||i===void 0||i.changed.connect(this._onSourceChanged,this),A.createElement("div",{className:sn},A.createElement("div",{ref:s=>s?.appendChild(this.node)}))}}class dn extends q.MetadataEditorTool{constructor(e){super(e),this._tracker=e.tracker,this.editor.editorHostNode.addEventListener("blur",this.editor,!0),this.editor.editorHostNode.addEventListener("click",this.editor,!0),this.editor.headerNode.addEventListener("click",this.editor)}_onSourceChanged(){var e,i;this.editor.source&&((i=(e=this._tracker.currentWidget)===null||e===void 0?void 0:e.model)===null||i===void 0||i.sharedModel.setMetadata(this.editor.source.toJSON()))}render(e){var i,a;const s=this._tracker.currentWidget;return this.editor.source=s?new he({values:(i=s.model)===null||i===void 0?void 0:i.metadata}):null,(a=this.editor.source)===null||a===void 0||a.changed.connect(this._onSourceChanged,this),A.createElement("div",{className:rn},A.createElement("div",{ref:l=>l?.appendChild(this.node)}))}}var h;(function(r){r.createNew="notebook:create-new",r.interrupt="notebook:interrupt-kernel",r.restart="notebook:restart-kernel",r.restartClear="notebook:restart-clear-output",r.restartAndRunToSelected="notebook:restart-and-run-to-selected",r.restartRunAll="notebook:restart-run-all",r.reconnectToKernel="notebook:reconnect-to-kernel",r.changeKernel="notebook:change-kernel",r.getKernel="notebook:get-kernel",r.createConsole="notebook:create-console",r.createSubshellConsole="notebook:create-subshell-console",r.createOutputView="notebook:create-output-view",r.clearAllOutputs="notebook:clear-all-cell-outputs",r.shutdown="notebook:shutdown-kernel",r.closeAndShutdown="notebook:close-and-shutdown",r.trust="notebook:trust",r.exportToFormat="notebook:export-to-format",r.run="notebook:run-cell",r.runAndAdvance="notebook:run-cell-and-select-next",r.runAndInsert="notebook:run-cell-and-insert-below",r.runInConsole="notebook:run-in-console",r.runAll="notebook:run-all-cells",r.runAllAbove="notebook:run-all-above",r.runAllBelow="notebook:run-all-below",r.renderAllMarkdown="notebook:render-all-markdown",r.toCode="notebook:change-cell-to-code",r.toMarkdown="notebook:change-cell-to-markdown",r.toRaw="notebook:change-cell-to-raw",r.cut="notebook:cut-cell",r.copy="notebook:copy-cell",r.pasteAbove="notebook:paste-cell-above",r.pasteBelow="notebook:paste-cell-below",r.duplicateBelow="notebook:duplicate-below",r.pasteAndReplace="notebook:paste-and-replace-cell",r.moveUp="notebook:move-cell-up",r.moveDown="notebook:move-cell-down",r.clearOutputs="notebook:clear-cell-output",r.deleteCell="notebook:delete-cell",r.insertAbove="notebook:insert-cell-above",r.insertBelow="notebook:insert-cell-below",r.selectAbove="notebook:move-cursor-up",r.selectBelow="notebook:move-cursor-down",r.selectHeadingAboveOrCollapse="notebook:move-cursor-heading-above-or-collapse",r.selectHeadingBelowOrExpand="notebook:move-cursor-heading-below-or-expand",r.insertHeadingAbove="notebook:insert-heading-above",r.insertHeadingBelow="notebook:insert-heading-below",r.extendAbove="notebook:extend-marked-cells-above",r.extendTop="notebook:extend-marked-cells-top",r.extendBelow="notebook:extend-marked-cells-below",r.extendBottom="notebook:extend-marked-cells-bottom",r.selectAll="notebook:select-all",r.deselectAll="notebook:deselect-all",r.editMode="notebook:enter-edit-mode",r.merge="notebook:merge-cells",r.mergeAbove="notebook:merge-cell-above",r.mergeBelow="notebook:merge-cell-below",r.split="notebook:split-cell-at-cursor",r.commandMode="notebook:enter-command-mode",r.toggleAllLines="notebook:toggle-all-cell-line-numbers",r.undoCellAction="notebook:undo-cell-action",r.redoCellAction="notebook:redo-cell-action",r.redo="notebook:redo",r.undo="notebook:undo",r.markdown1="notebook:change-cell-to-heading-1",r.markdown2="notebook:change-cell-to-heading-2",r.markdown3="notebook:change-cell-to-heading-3",r.markdown4="notebook:change-cell-to-heading-4",r.markdown5="notebook:change-cell-to-heading-5",r.markdown6="notebook:change-cell-to-heading-6",r.hideCode="notebook:hide-cell-code",r.showCode="notebook:show-cell-code",r.hideAllCode="notebook:hide-all-cell-code",r.showAllCode="notebook:show-all-cell-code",r.hideOutput="notebook:hide-cell-outputs",r.showOutput="notebook:show-cell-outputs",r.toggleOutput="notebook:toggle-cell-outputs",r.hideAllOutputs="notebook:hide-all-cell-outputs",r.showAllOutputs="notebook:show-all-cell-outputs",r.toggleRenderSideBySideCurrentNotebook="notebook:toggle-render-side-by-side-current",r.setSideBySideRatio="notebook:set-side-by-side-ratio",r.enableOutputScrolling="notebook:enable-output-scrolling",r.disableOutputScrolling="notebook:disable-output-scrolling",r.selectLastRunCell="notebook:select-last-run-cell",r.replaceSelection="notebook:replace-selection",r.autoClosingBrackets="notebook:toggle-autoclosing-brackets",r.toggleCollapseCmd="notebook:toggle-heading-collapse",r.collapseAllCmd="notebook:collapse-all-headings",r.expandAllCmd="notebook:expand-all-headings",r.copyToClipboard="notebook:copy-to-clipboard",r.invokeCompleter="completer:invoke-notebook",r.selectCompleter="completer:select-notebook",r.tocRunCells="toc:run-cells",r.accessPreviousHistory="notebook:access-previous-history-entry",r.accessNextHistory="notebook:access-next-history-entry",r.virtualScrollbar="notebook:toggle-virtual-scrollbar"})(h||(h={}));const J="Notebook",cn=["notebook","python","custom"],un="@jupyterlab/notebook-extension:panel",Fe="jp-NotebookExtension-sideBySideMargins",ee={id:"@jupyterlab/notebook-extension:tracker",description:"Provides the notebook widget tracker.",provides:I,requires:[ot,io,tt],optional:[Ve,ao,co,it,lt,uo,be,Ue,F,Ae,nt],activate:Ln,autoStart:!0},hn={id:"@jupyterlab/notebook-extension:factory",description:"Provides the notebook cell factory.",provides:fe.IContentFactory,requires:[ge],autoStart:!0,activate:(r,e)=>{const i=e.factoryService.newInlineEditor;return new fe.ContentFactory({editorFactory:i})}},pn={activate:On,provides:ro,id:"@jupyterlab/notebook-extension:tools",description:"Provides the notebook tools.",autoStart:!0,requires:[I,ge,et,Lt.IStateDB,F],optional:[so]},gn={id:"@jupyterlab/notebook-extension:mode-status",description:"Adds a notebook mode status widget.",autoStart:!0,requires:[I,F],optional:[Se],activate:(r,e,i,a)=>{if(!a)return;const{shell:s}=r,l=new re(i);e.currentChanged.connect(()=>{const p=e.currentWidget;l.model.notebook=p&&p.content}),a.registerStatusItem("@jupyterlab/notebook-extension:mode-status",{priority:1,item:l,align:"right",rank:4,isActive:()=>!!s.currentWidget&&!!e.currentWidget&&s.currentWidget===e.currentWidget})}},bn={id:"@jupyterlab/notebook-extension:execution-indicator",description:"Adds a notebook execution status widget.",autoStart:!0,requires:[I,ho,F],optional:[Se,be],activate:(r,e,i,a,s,l)=>{let p,n,c;const d=g=>{var m,b;let{showOnToolBar:f,showProgress:x,showJumpToCell:o}=g;if(f)c&&(i.currentChanged.disconnect(n),c.dispose());else{if(!s)return;p?.model||(p=new X(a),n=(t,u)=>{const{newValue:C}=u;if(C&&e.has(C)){const w=C;p.model.attachNotebook({content:w.content,context:w.sessionContext})}},c=s.registerStatusItem("@jupyterlab/notebook-extension:execution-indicator",{item:p,align:"left",rank:3,isActive:()=>{const t=i.currentWidget;return!!t&&e.has(t)}}),p.model.attachNotebook({content:(m=e.currentWidget)===null||m===void 0?void 0:m.content,context:(b=e.currentWidget)===null||b===void 0?void 0:b.sessionContext}),i.currentChanged.connect(n),p.disposed.connect(()=>{i.currentChanged.disconnect(n)})),p.model.displayOption={showOnToolBar:f,showProgress:x,showJumpToCell:o}}};if(l){const g=l.load(ee.id);Promise.all([g,r.restored]).then(([m])=>{d(X.getSettingValue(m)),m.changed.connect(b=>d(X.getSettingValue(b)))}).catch(m=>{console.error(m.message)})}}},mn={id:"@jupyterlab/notebook-extension:export",description:"Adds the export notebook commands.",autoStart:!0,requires:[F,I],optional:[lt,Ve],activate:(r,e,i,a,s)=>{var l;const p=e.load("jupyterlab"),{commands:n,shell:c}=r,d=r.serviceManager,g=()=>L.isEnabled(c,i);n.addCommand(h.exportToFormat,{label:x=>{if(x.label===void 0)return p.__("Save and Export Notebook to the given `format`.");const o=x.label;return x.isPalette?p.__("Save and Export Notebook: %1",o):o},execute:async x=>{var o,t;const u=v(i,c,x);if(!u)return;const{context:C}=u,w={format:x.format,path:u.context.path,exporterOptions:{download:!0}};return C.model.dirty&&!C.model.readOnly&&await C.save(),(t=(o=d.nbconvert).exportAs)===null||t===void 0?void 0:t.call(o,w)},isEnabled:g,describedBy:{args:{type:"object",properties:{format:{type:"string",description:p.__("The export format (e.g., pdf, html, latex)")},label:{type:"string",description:p.__("The label to display for this format")},isPalette:{type:"boolean",description:p.__("Whether the command is called from the command palette")}},required:["format"]}}});let m;a&&(m=(l=a.fileMenu.items.find(x=>{var o;return x.type==="submenu"&&((o=x.submenu)===null||o===void 0?void 0:o.id)==="jp-mainmenu-file-notebookexport"}))===null||l===void 0?void 0:l.submenu);let b=!1;const f=async()=>{if(b)return;i.widgetAdded.disconnect(f),b=!0;const x=await d.nbconvert.getExportFormats(!1);if(!x)return;const o=L.getFormatLabels(e);Object.keys(x).forEach(function(u){const C=p.__(u[0].toUpperCase()+u.substr(1)),w=o[u]?o[u]:C;let B={format:u,label:w,isPalette:!1};if(cn.indexOf(u)===-1&&(m&&m.addItem({command:h.exportToFormat,args:B}),s)){B={format:u,label:w,isPalette:!0};const M=p.__("Notebook Operations");s.addItem({command:h.exportToFormat,category:M,args:B})}})};i.widgetAdded.connect(f)}},Cn={id:"@jupyterlab/notebook-extension:trust-status",description:"Adds the notebook trusted status widget.",autoStart:!0,requires:[I,F],optional:[Se],activate:(r,e,i,a)=>{if(!a)return;const{shell:s}=r,l=new ae(i);e.currentChanged.connect(()=>{const p=e.currentWidget;l.model.notebook=p&&p.content}),a.registerStatusItem("@jupyterlab/notebook-extension:trust-status",{item:l,align:"right",rank:3,isActive:()=>!!s.currentWidget&&!!e.currentWidget&&s.currentWidget===e.currentWidget})}},vn={id:"@jupyterlab/notebook-extension:widget-factory",description:"Provides the notebook widget factory.",provides:ot,requires:[fe.IContentFactory,ge,po,dt],optional:[be,Ue,F],activate:jn,autoStart:!0},fn={id:"@jupyterlab/notebook-extension:cloned-outputs",description:"Adds the clone output feature.",requires:[bo,I,F],optional:[it],activate:Rn,autoStart:!0},_n={id:"@jupyterlab/notebook-extension:code-console",description:"Adds the notebook code consoles features.",requires:[I,F],activate:In,autoStart:!0},yn={id:"@jupyterlab/notebook-extension:copy-output",description:"Adds the copy cell outputs feature.",activate:Pn,requires:[F,I],autoStart:!0},xn={id:"@jupyterlab/notebook-extension:kernel-status",description:"Adds the notebook kernel status.",activate:(r,e,i)=>{const a=s=>{let l=null;return s&&e.has(s)?s.sessionContext:l};i.addSessionProvider(a)},requires:[I,ct],autoStart:!0},wn={id:"@jupyterlab/notebook-extension:cursor-position",description:"Adds the notebook cursor position status.",activate:(r,e,i)=>{let a=null;const s=async l=>{let p=null;if(l!==a){if(a?.content.activeCellChanged.disconnect(i.update),a=null,l&&e.has(l)){l.content.activeCellChanged.connect(i.update);const n=l.content.activeCell;p=null,n&&(await n.ready,p=n.editor),a=l}}else if(l){const n=l.content.activeCell;p=null,n&&(await n.ready,p=n.editor)}return p};i.addEditorProvider(s)},requires:[I,Wt],autoStart:!0},kn={id:"@jupyterlab/notebook-extension:completer",description:"Adds the code completion capability to notebooks.",requires:[I],optional:[mo,F,qe],activate:Wn,autoStart:!0},Sn={id:"@jupyterlab/notebook-extension:search",description:"Adds search capability to notebooks.",requires:[Co],autoStart:!0,activate:(r,e)=>{e.add("jp-notebookSearchProvider",Dt)}},An={id:"@jupyterlab/notebook-extension:toc",description:"Adds table of content capability to the notebooks",requires:[I,Ht,qe],optional:[go,be],autoStart:!0,activate:(r,e,i,a,s,l)=>{const p=new $o(e,s,a);i.add(p),l&&Promise.all([r.restored,l.load(ee.id)]).then(([n,c])=>{const d=()=>{var g;p.scrollToTop=(g=c.composite.scrollHeadingToTop)!==null&&g!==void 0?g:!0};d(),c.changed.connect(d)}).catch(n=>{console.error("Failed to load notebook table of content settings.",n)})}},Mn={id:"@jupyterlab/notebook-extension:language-server",description:"Adds language server capability to the notebooks.",requires:[I,_o,yo,xo,wo],activate:Hn,autoStart:!0},Tn={id:"@jupyterlab/notebook-extension:update-raw-mimetype",description:"Adds metadata form editor for raw cell mimetype.",autoStart:!0,requires:[I,Yo,F],activate:(r,e,i,a)=>{const s=a.load("jupyterlab");let l=!1;async function p(){if(l||!i.get("commonToolsSection"))return;const n=i.get("commonToolsSection").getProperties("/raw_mimetype");if(!n)return;e.widgetAdded.disconnect(p),l=!0;const d=await r.serviceManager.nbconvert.getExportFormats(!1);if(!d)return;const g=Object.keys(d),m=L.getFormatLabels(a);g.forEach(function(b){var f;if(!(((f=n.oneOf)===null||f===void 0?void 0:f.filter(o=>o.const===b).length)>0)){const o=s.__(b[0].toUpperCase()+b.substr(1)),t=m[b]?m[b]:o,u=d[b].output_mimetype;n.oneOf.push({const:u,title:t})}}),i.get("commonToolsSection").setProperties("/raw_mimetype",n)}e.widgetAdded.connect(p)}},Bn={id:"@jupyterlab/notebook-extension:metadata-editor",description:"Adds metadata form for full metadata editor.",autoStart:!0,requires:[I,ge,Ae],optional:[F],activate:(r,e,i,a,s)=>{const l=c=>i.factoryService.newInlineEditor(c),p={fieldRenderer:c=>new an({editorFactory:l,tracker:e,label:"Cell metadata",translator:s}).render(c)};a.addRenderer("@jupyterlab/notebook-extension:metadata-editor.cell-metadata",p);const n={fieldRenderer:c=>new dn({editorFactory:l,tracker:e,label:"Notebook metadata",translator:s}).render(c)};a.addRenderer("@jupyterlab/notebook-extension:metadata-editor.notebook-metadata",n)}},En={id:"@jupyterlab/notebook-extension:active-cell-tool",description:"Adds active cell field in the metadata editor tab.",autoStart:!0,requires:[I,Ae,et],activate:(r,e,i,a)=>{const s={fieldRenderer:l=>new ln({tracker:e,languages:a}).render(l)};i.addRenderer("@jupyterlab/notebook-extension:active-cell-tool.renderer",s)}},Nn={id:"@jupyterlab/notebook-extension:open-with-no-kernel",description:'Adds the "Notebook (no kernel)" option to the Open With menu.',requires:[nt],optional:[F],autoStart:!0,activate:(r,e,i)=>{const{tracker:a}=e,s=(i??O).load("jupyterlab"),l=[];function p(n){var c,d;l.forEach(f=>f.dispose()),l.length=0;const g=(d=(c=n.menu.items.find(f=>{var x;return f.type==="submenu"&&((x=f.submenu)===null||x===void 0?void 0:x.id)==="jp-contextmenu-open-with"}))===null||c===void 0?void 0:c.submenu)!==null&&d!==void 0?d:null;if(!g)return;(a.currentWidget?Array.from(a.currentWidget.selectedItems()):[]).some(f=>f.type==="notebook")&&l.push(g.addItem({command:"filebrowser:open",args:{label:s.__("Notebook (no kernel)"),factory:J,kernelPreference:{shouldStart:!1}}}))}r.contextMenu.opened.connect(p)}},el=[Xo,hn,ee,bn,mn,pn,gn,Cn,vn,Zo,fn,_n,yn,xn,wn,kn,Sn,An,Mn,Tn,Bn,En,Nn];function On(r,e,i,a,s,l,p){const n=l.load("jupyterlab"),c="notebook-tools",d=new q({tracker:e,translator:l}),g=(m,b)=>{switch(b.type){case"activate-request":s.save(c,{open:!0});break;case"after-hide":case"close-request":s.remove(c);break}return!0};return d.title.icon=Kt,d.title.caption=n.__("Notebook Tools"),d.id=c,G.installMessageHook(d,g),p&&e.widgetAdded.connect((m,b)=>{p.register(b).render(d)}),d}function jn(r,e,i,a,s,l,p,n){const c=n??O,d=p??new xe({translator:c}),g=Vt.PageConfig.getOption("notebookStartsKernel"),m=g===""||g.toLowerCase()==="true",{commands:b}=r;let f;s.addFactory(J,"save",t=>lo.createSaveButton(b,t.context.fileChanged)),s.addFactory(J,"cellType",t=>_e.createCellTypeItem(t,c)),s.addFactory(J,"kernelName",t=>ue.createKernelNameItem(t.sessionContext,d,c)),s.addFactory(J,"executionProgress",t=>{const u=l?.load(ee.id),C=X.createExecutionIndicatorItem(t,c,u);return u?.then(w=>{t.disposed.connect(()=>{w.dispose()})}),C}),l&&(f=Ut(s,l,J,un,c));const x=c.load("jupyterlab"),o=new Ao({name:J,label:x.__("Notebook"),fileTypes:["notebook"],modelName:"notebook",defaultFor:["notebook"],preferKernel:m,canStartKernel:!0,rendermime:a,contentFactory:e,editorConfig:se.defaultEditorConfig,notebookConfig:se.defaultNotebookConfig,mimeTypeService:i.mimeTypeService,toolbarFactory:f,translator:c});return r.docRegistry.addWidgetFactory(o),o}function Rn(r,e,i,a,s){const l=a.load("jupyterlab"),p=new qt({namespace:"cloned-outputs"});s&&s.restore(p,{command:h.createOutputView,args:g=>({path:g.content.path,index:g.content.index}),name:g=>`${g.content.path}:${g.content.index}`,when:i.restored});const{commands:n,shell:c}=r,d=()=>L.isEnabledAndSingleSelected(c,i);n.addCommand(h.createOutputView,{label:l.__("Create New View for Cell Output"),execute:async g=>{var m;let b,f;const x=g.path;let o=g.index;if(x&&o!==void 0&&o!==null){if(f=e.findWidget(x,J),!f)return}else{if(f=i.currentWidget,!f)return;b=f.content.activeCell,o=f.content.activeCellIndex}const t=new L.ClonedOutputArea({notebook:f,cell:b,index:o,translator:a}),u=new $t({content:t});f.context.addSibling(u,{ref:f.id,mode:"split-bottom",type:"Cloned Output"});const C=()=>{p.save(u)};f.context.pathChanged.connect(C),(m=f.context.model)===null||m===void 0||m.cells.changed.connect(C),p.add(u),f.content.disposed.connect(()=>{var w;f.context.pathChanged.disconnect(C),(w=f.context.model)===null||w===void 0||w.cells.changed.disconnect(C),u.dispose()})},isEnabled:d,describedBy:{args:{type:"object",properties:{path:{type:"string",description:l.__("The path to the notebook containing the cell")},index:{type:"number",description:l.__("The index of the cell to create an output view for")}}}}})}function In(r,e,i){const a=i.load("jupyterlab"),{commands:s,shell:l}=r,p=()=>L.isEnabled(l,e);s.addCommand(h.createConsole,{label:a.__("New Console for Notebook"),execute:n=>{const c=e.currentWidget;if(c)return L.createConsole(s,c,n.activate)},isEnabled:p,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:a.__("Whether to activate the console after creation")}}}}}),s.addCommand(h.createSubshellConsole,{label:a.__("New Subshell Console for Notebook"),execute:n=>{const c=e.currentWidget;if(c)return L.createConsole(s,c,n.activate,!0)},isEnabled:p,isVisible:()=>{var n,c,d;const g=(c=(n=e.currentWidget)===null||n===void 0?void 0:n.context.sessionContext.session)===null||c===void 0?void 0:c.kernel;return(d=g?.supportsSubshells)!==null&&d!==void 0?d:!1},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:a.__("Whether to activate the console after creation")}}}}}),s.addCommand(h.runInConsole,{label:a.__("Run Selected Text or Current Line in Console"),execute:async n=>{var c,d;const g=e.currentWidget;if(!g)return;const{context:m,content:b}=g,f=b.activeCell,x=f?.model.metadata,o=m.path;if(!f||f.model.type!=="code")return;let t;const u=f.editor;if(!u)return;const C=u.getSelection(),{start:w,end:B}=C;if(w.column!==B.column||w.line!==B.line){const K=u.getOffsetAt(C.start),V=u.getOffsetAt(C.end);t=u.model.sharedModel.getSource().substring(K,V)}else{const K=u.getCursorPosition(),V=u.model.sharedModel.getSource().split(`
|
|
3
3
|
`);let R=C.start.line;for(;R<u.lineCount&&!V[R].replace(/\s/g,"").length;)R+=1;let j=R>0,$=0,P=$+1;for(;;){t=V.slice($,P).join(`
|
|
4
4
|
`);const te=await((d=(c=g.context.sessionContext.session)===null||c===void 0?void 0:c.kernel)===null||d===void 0?void 0:d.requestIsComplete({code:t+`
|
|
5
5
|
|
|
6
|
-
`}));if(te?.content.status==="complete")if(R<P){for(;P<u.lineCount&&!V[P].replace(/\s/g,"").length;)P+=1;u.setCursorPosition({line:P,column:K.column});break}else $=P,P=$+1;else if(P<u.lineCount)P+=1;else if(j)$=R,P=R+1,j=!1;else{for(t=V[R];R+1<u.lineCount&&!V[R+1].replace(/\s/g,"").length;)R+=1;u.setCursorPosition({line:R+1,column:K.column});break}}}t&&(await s.execute("console:open",{activate:!1,insertMode:"split-bottom",path:o}),await s.execute("console:inject",{activate:!1,code:t,path:o,metadata:x}))},isEnabled:p,describedBy:{args:{type:"object",properties:{}}}})}function Pn(r,e,i){const a=e.load("jupyterlab");function s(l){const p=window.getSelection();if(p==null)return;const n=[];for(let d=0;d<p.rangeCount;++d)n[d]=p.getRangeAt(d).cloneRange();const c=document.createRange();c.selectNodeContents(l),p.removeAllRanges(),p.addRange(c),document.execCommand("copy"),p.removeAllRanges(),n.forEach(d=>p.addRange(d))}r.commands.addCommand(h.copyToClipboard,{label:a.__("Copy Output to Clipboard"),execute:l=>{var p;const n=(p=i.currentWidget)===null||p===void 0?void 0:p.content.activeCell;if(n==null)return;const c=n.outputArea.outputTracker.currentWidget;if(c==null)return;const d=c.node.getElementsByClassName("jp-OutputArea-output");if(d.length>0){const g=d[0];s(g)}},describedBy:{args:{type:"object",properties:{}}}}),r.contextMenu.addItem({command:h.copyToClipboard,selector:".jp-Notebook .jp-OutputArea-child",rank:0})}function Ln(r,e,i,a,s,l,p,n,c,d,g,m,b,f,x){Ft(a);const o=b??O,t=m??new xe({translator:o}),u=o.load("jupyterlab"),C=r.serviceManager,{commands:w,shell:B}=r,M=new ko({namespace:"notebook"});function K(y,k){k.hash&&M.currentWidget&&M.currentWidget.setFragment(k.hash)}d?.routed.connect(K);const V=()=>L.isEnabled(B,M),R=y=>document.documentElement.style.setProperty("--jp-side-by-side-output-size",`${y}fr`);if((g?g.load(ee.id):Promise.reject(new Error(`No setting registry for ${ee.id}`))).then(y=>{Te(y),y.changed.connect(()=>{Te(y),w.notifyCommandChanged(h.virtualScrollbar)});const k=(E,S)=>{const{newValue:U,oldValue:oe}=S,z=U.autoStartDefault;typeof z=="boolean"&&z!==oe.autoStartDefault&&z!==y.get("autoStartDefaultKernel").composite&&y.set("autoStartDefaultKernel",z).catch(Be=>{console.error(`Failed to set ${y.id}.autoStartDefaultKernel`)})},T=new WeakSet,N=E=>{const S=E.context.sessionContext;!S.isDisposed&&!T.has(S)&&(T.add(S),S.kernelPreferenceChanged.connect(k),S.disposed.connect(()=>{S.kernelPreferenceChanged.disconnect(k)}))};M.forEach(N),M.widgetAdded.connect((E,S)=>{N(S)}),w.addCommand(h.autoClosingBrackets,{execute:E=>{var S;const U=y.get("codeCellConfig").composite,oe=y.get("markdownCellConfig").composite,z=y.get("rawCellConfig").composite,Be=U.autoClosingBrackets||oe.autoClosingBrackets||z.autoClosingBrackets,me=!!((S=E.force)!==null&&S!==void 0?S:!Be);[U.autoClosingBrackets,oe.autoClosingBrackets,z.autoClosingBrackets]=[me,me,me],y.set("codeCellConfig",U),y.set("markdownCellConfig",oe),y.set("rawCellConfig",z)},label:u.__("Auto Close Brackets for All Notebook Cell Types"),isToggled:()=>["codeCellConfig","markdownCellConfig","rawCellConfig"].some(E=>{var S;return((S=y.get(E).composite.autoClosingBrackets)!==null&&S!==void 0?S:i.baseConfiguration.autoClosingBrackets)===!0}),describedBy:{args:{type:"object",properties:{force:{type:"boolean",description:u.__("Force toggling the auto closing brackets setting")}}}}}),w.addCommand(h.setSideBySideRatio,{label:u.__("Set side-by-side ratio"),execute:E=>{ut.getNumber({title:u.__("Width of the output in side-by-side mode"),value:y.get("sideBySideOutputRatio").composite}).then(S=>{R(S.value),S.value&&y.set("sideBySideOutputRatio",S.value)}).catch(console.error)},describedBy:{args:{type:"object",properties:{}}}}),Ke(r,M,o,t,y,V)}).catch(y=>{console.warn(y.message),Me({editorConfig:e.editorConfig,notebookConfig:e.notebookConfig,kernelShutdown:e.shutdownOnClose,autoStartDefault:e.autoStartDefault}),Ke(r,M,o,t,null,V)}),f){const y=f.getRenderer("@jupyterlab/codemirror-extension:plugin.defaultConfig");y&&(f.addRenderer("@jupyterlab/notebook-extension:tracker.codeCellConfig",y),f.addRenderer("@jupyterlab/notebook-extension:tracker.markdownCellConfig",y),f.addRenderer("@jupyterlab/notebook-extension:tracker.rawCellConfig",y))}n&&n.restore(M,{command:"docmanager:open",args:y=>({path:y.context.path,factory:
|
|
6
|
+
`}));if(te?.content.status==="complete")if(R<P){for(;P<u.lineCount&&!V[P].replace(/\s/g,"").length;)P+=1;u.setCursorPosition({line:P,column:K.column});break}else $=P,P=$+1;else if(P<u.lineCount)P+=1;else if(j)$=R,P=R+1,j=!1;else{for(t=V[R];R+1<u.lineCount&&!V[R+1].replace(/\s/g,"").length;)R+=1;u.setCursorPosition({line:R+1,column:K.column});break}}}t&&(await s.execute("console:open",{activate:!1,insertMode:"split-bottom",path:o}),await s.execute("console:inject",{activate:!1,code:t,path:o,metadata:x}))},isEnabled:p,describedBy:{args:{type:"object",properties:{}}}})}function Pn(r,e,i){const a=e.load("jupyterlab");function s(l){const p=window.getSelection();if(p==null)return;const n=[];for(let d=0;d<p.rangeCount;++d)n[d]=p.getRangeAt(d).cloneRange();const c=document.createRange();c.selectNodeContents(l),p.removeAllRanges(),p.addRange(c),document.execCommand("copy"),p.removeAllRanges(),n.forEach(d=>p.addRange(d))}r.commands.addCommand(h.copyToClipboard,{label:a.__("Copy Output to Clipboard"),execute:l=>{var p;const n=(p=i.currentWidget)===null||p===void 0?void 0:p.content.activeCell;if(n==null)return;const c=n.outputArea.outputTracker.currentWidget;if(c==null)return;const d=c.node.getElementsByClassName("jp-OutputArea-output");if(d.length>0){const g=d[0];s(g)}},describedBy:{args:{type:"object",properties:{}}}}),r.contextMenu.addItem({command:h.copyToClipboard,selector:".jp-Notebook .jp-OutputArea-child",rank:0})}function Ln(r,e,i,a,s,l,p,n,c,d,g,m,b,f,x){Ft(a);const o=b??O,t=m??new xe({translator:o}),u=o.load("jupyterlab"),C=r.serviceManager,{commands:w,shell:B}=r,M=new ko({namespace:"notebook"});function K(y,k){k.hash&&M.currentWidget&&M.currentWidget.setFragment(k.hash)}d?.routed.connect(K);const V=()=>L.isEnabled(B,M),R=y=>document.documentElement.style.setProperty("--jp-side-by-side-output-size",`${y}fr`);if((g?g.load(ee.id):Promise.reject(new Error(`No setting registry for ${ee.id}`))).then(y=>{Te(y),y.changed.connect(()=>{Te(y),w.notifyCommandChanged(h.virtualScrollbar)});const k=(E,S)=>{const{newValue:U,oldValue:oe}=S,z=U.autoStartDefault;typeof z=="boolean"&&z!==oe.autoStartDefault&&z!==y.get("autoStartDefaultKernel").composite&&y.set("autoStartDefaultKernel",z).catch(Be=>{console.error(`Failed to set ${y.id}.autoStartDefaultKernel`)})},T=new WeakSet,N=E=>{const S=E.context.sessionContext;!S.isDisposed&&!T.has(S)&&(T.add(S),S.kernelPreferenceChanged.connect(k),S.disposed.connect(()=>{S.kernelPreferenceChanged.disconnect(k)}))};M.forEach(N),M.widgetAdded.connect((E,S)=>{N(S)}),w.addCommand(h.autoClosingBrackets,{execute:E=>{var S;const U=y.get("codeCellConfig").composite,oe=y.get("markdownCellConfig").composite,z=y.get("rawCellConfig").composite,Be=U.autoClosingBrackets||oe.autoClosingBrackets||z.autoClosingBrackets,me=!!((S=E.force)!==null&&S!==void 0?S:!Be);[U.autoClosingBrackets,oe.autoClosingBrackets,z.autoClosingBrackets]=[me,me,me],y.set("codeCellConfig",U),y.set("markdownCellConfig",oe),y.set("rawCellConfig",z)},label:u.__("Auto Close Brackets for All Notebook Cell Types"),isToggled:()=>["codeCellConfig","markdownCellConfig","rawCellConfig"].some(E=>{var S;return((S=y.get(E).composite.autoClosingBrackets)!==null&&S!==void 0?S:i.baseConfiguration.autoClosingBrackets)===!0}),describedBy:{args:{type:"object",properties:{force:{type:"boolean",description:u.__("Force toggling the auto closing brackets setting")}}}}}),w.addCommand(h.setSideBySideRatio,{label:u.__("Set side-by-side ratio"),execute:E=>{ut.getNumber({title:u.__("Width of the output in side-by-side mode"),value:y.get("sideBySideOutputRatio").composite}).then(S=>{R(S.value),S.value&&y.set("sideBySideOutputRatio",S.value)}).catch(console.error)},describedBy:{args:{type:"object",properties:{}}}}),Ke(r,M,o,t,y,V)}).catch(y=>{console.warn(y.message),Me({editorConfig:e.editorConfig,notebookConfig:e.notebookConfig,kernelShutdown:e.shutdownOnClose,autoStartDefault:e.autoStartDefault}),Ke(r,M,o,t,null,V)}),f){const y=f.getRenderer("@jupyterlab/codemirror-extension:plugin.defaultConfig");y&&(f.addRenderer("@jupyterlab/notebook-extension:tracker.codeCellConfig",y),f.addRenderer("@jupyterlab/notebook-extension:tracker.markdownCellConfig",y),f.addRenderer("@jupyterlab/notebook-extension:tracker.rawCellConfig",y))}n&&n.restore(M,{command:"docmanager:open",args:y=>({path:y.context.path,factory:J}),name:y=>y.context.path,when:C.ready});const $=r.docRegistry,P=new So({disableDocumentWideUndoRedo:e.notebookConfig.disableDocumentWideUndoRedo,collaborative:!0});$.addModelFactory(P),s&&Fn(s,o);let te=0;const D=r.docRegistry.getFileType("notebook");e.widgetCreated.connect((y,k)=>{var T,N,E;k.id=k.id||`notebook-${++te}`,k.content.node.setAttribute("data-trust-command",h.trust),k.title.icon=D?.icon,k.title.iconClass=(T=D?.iconClass)!==null&&T!==void 0?T:"",k.title.iconLabel=(N=D?.iconLabel)!==null&&N!==void 0?N:"",k.content.scrollbar=(E=e.notebookConfig.showMinimap)!==null&&E!==void 0?E:!1,k.context.pathChanged.connect(()=>{M.save(k)}),M.add(k)});function Me(y){M.forEach(k=>{var T;k.setConfig(y),k.content.scrollbar=(T=y.notebookConfig.showMinimap)!==null&&T!==void 0?T:!1})}function Te(y){const k={...se.defaultEditorConfig.code,...y.get("codeCellConfig").composite},T={...se.defaultEditorConfig.markdown,...y.get("markdownCellConfig").composite},N={...se.defaultEditorConfig.raw,...y.get("rawCellConfig").composite};e.editorConfig={code:k,markdown:T,raw:N},e.notebookConfig={enableKernelInitNotification:y.get("enableKernelInitNotification").composite,autoRenderMarkdownCells:y.get("autoRenderMarkdownCells").composite,showHiddenCellsButton:y.get("showHiddenCellsButton").composite,scrollPastEnd:y.get("scrollPastEnd").composite,defaultCell:y.get("defaultCell").composite,recordTiming:y.get("recordTiming").composite,overscanCount:y.get("overscanCount").composite,showInputPlaceholder:y.get("showInputPlaceholder").composite,inputHistoryScope:y.get("inputHistoryScope").composite,maxNumberOutputs:y.get("maxNumberOutputs").composite,showEditorForReadOnlyMarkdown:y.get("showEditorForReadOnlyMarkdown").composite,disableDocumentWideUndoRedo:!y.get("documentWideUndoRedo").composite,renderingLayout:y.get("renderingLayout").composite,sideBySideLeftMarginOverride:y.get("sideBySideLeftMarginOverride").composite,sideBySideRightMarginOverride:y.get("sideBySideRightMarginOverride").composite,sideBySideOutputRatio:y.get("sideBySideOutputRatio").composite,windowingMode:y.get("windowingMode").composite,accessKernelHistory:y.get("accessKernelHistory").composite,showMinimap:y.get("showMinimap").composite},R(e.notebookConfig.sideBySideOutputRatio);const E=`.jp-mod-sideBySide.jp-Notebook .jp-Notebook-cell {
|
|
7
7
|
margin-left: ${e.notebookConfig.sideBySideLeftMarginOverride} !important;
|
|
8
8
|
margin-right: ${e.notebookConfig.sideBySideRightMarginOverride} !important;
|
|
9
|
-
}`,S=document.getElementById(Fe);if(S)S.textContent=E;else{const U=document.createElement("style");U.id=Fe,U.textContent=E,document.head.appendChild(U)}e.autoStartDefault=y.get("autoStartDefaultKernel").composite,e.shutdownOnClose=y.get("kernelShutdown").composite,P.disableDocumentWideUndoRedo=!y.get("documentWideUndoRedo").composite,Me({editorConfig:e.editorConfig,notebookConfig:e.notebookConfig,kernelShutdown:e.shutdownOnClose,autoStartDefault:e.autoStartDefault})}c&&Kn(c,V);const st=async(y,k,T)=>{const N=await w.execute("docmanager:new-untitled",{path:y,type:"notebook"});if(N!==void 0){const E=await w.execute("docmanager:open",{path:N.path,factory:D,kernel:{id:k,name:T}});return E.isUntitled=!0,E}};return w.addCommand(h.createNew,{label:y=>{var k,T,N;const E=y.kernelName||"";return y.isLauncher&&y.kernelName&&C.kernelspecs?(N=(T=(k=C.kernelspecs.specs)===null||k===void 0?void 0:k.kernelspecs[E])===null||T===void 0?void 0:T.display_name)!==null&&N!==void 0?N:"":y.isPalette||y.isContextMenu?u.__("New Notebook"):u.__("Notebook")},caption:u.__("Create a new notebook"),icon:y=>y.isPalette?void 0:Ze,execute:y=>{var k,T;const N=(k=x?.tracker.currentWidget)!==null&&k!==void 0?k:l,E=y.cwd||((T=N?.model.path)!==null&&T!==void 0?T:""),S=y.kernelId||"",U=y.kernelName||"";return st(E,S,U)},describedBy:{args:{type:"object",properties:{cwd:{type:"string",description:u.__("Current working directory for the new notebook")},kernelId:{type:"string",description:u.__("Kernel ID to use for the new notebook")},kernelName:{type:"string",description:u.__("Kernel name to use for the new notebook")},isLauncher:{type:"boolean",description:u.__("Whether the command is executed from launcher")},isPalette:{type:"boolean",description:u.__("Whether the command is executed from palette")},isContextMenu:{type:"boolean",description:u.__("Whether the command is executed from context menu")}}}}}),p&&C.ready.then(()=>{let y=null;const k=()=>{y&&(y.dispose(),y=null);const T=C.kernelspecs.specs;if(T){y=new to;for(const N in T.kernelspecs){const E=N===T.default?0:1/0,S=T.kernelspecs[N],U=S.resources["logo-svg"]||S.resources["logo-64x64"];y.add(p.add({command:h.createNew,args:{isLauncher:!0,kernelName:N},category:u.__("Notebook"),rank:E,kernelIconUrl:U,metadata:{kernel:ne.deepCopy(S.metadata||{})}}))}}};k(),C.kernelspecs.specsChanged.connect(k)}),M}function Wn(r,e,i,a,s){if(!i)return;const l=(a??O).load("jupyterlab"),p=s??new Dt;r.commands.addCommand(h.invokeCompleter,{label:l.__("Display the completion helper."),execute:c=>{var d;const g=e.currentWidget;g&&((d=g.content.activeCell)===null||d===void 0?void 0:d.model.type)==="code"&&i.invoke(g.id)},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:l.__("Whether to activate the widget")}}}}}),r.commands.addCommand(h.selectCompleter,{label:l.__("Select the completion suggestion."),execute:()=>{const c=e.currentWidget&&e.currentWidget.id;if(c)return i.select(c)},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:l.__("Whether to activate the widget")}}}}}),r.commands.addKeyBinding({command:h.selectCompleter,keys:["Enter"],selector:".jp-Notebook .jp-mod-completer-active"});const n=async(c,d)=>{var g,m;const b={editor:(m=(g=d.content.activeCell)===null||g===void 0?void 0:g.editor)!==null&&m!==void 0?m:null,session:d.sessionContext.session,widget:d,sanitizer:p};await i.updateCompleter(b),d.content.activeCellChanged.connect((f,x)=>{x?.ready.then(()=>{const o={editor:x.editor,session:d.sessionContext.session,widget:d,sanitizer:p};return i.updateCompleter(o)}).catch(console.error)}),d.sessionContext.sessionChanged.connect(()=>{var f;(f=d.content.activeCell)===null||f===void 0||f.ready.then(()=>{var x,o;const t={editor:(o=(x=d.content.activeCell)===null||x===void 0?void 0:x.editor)!==null&&o!==void 0?o:null,session:d.sessionContext.session,widget:d};return i.updateCompleter(t)}).catch(console.error)})};e.widgetAdded.connect(n),i.activeProvidersChanged.connect(()=>{e.forEach(c=>{n(void 0,c).catch(d=>console.error(d))})})}function Hn(r,e,i,a,s,l){e.widgetAdded.connect(async(p,n)=>{const c=new Ko(n,{connectionManager:i,featureManager:a,foreignCodeExtractorsManager:s});l.add(c)})}function v(r,e,i){var a,s;let l=null;return i[We.WIDGET_ID_ARG]?l=(a=r.find(n=>n.id===i[We.WIDGET_ID_ARG]))!==null&&a!==void 0?a:null:i[Ne.WIDGET]?l=(s=r.find(n=>n.id===i[Ne.WIDGET]))!==null&&s!==void 0?s:null:l=r.currentWidget,i.activate!==!1&&l&&e.activateById(l.id),l}function Ke(r,e,i,a,s,l){var p;const n=i.load("jupyterlab"),{commands:c,shell:d}=r,g=()=>L.isEnabledAndSingleSelected(d,e),m=o=>{var t,u;for(const C of o.widgets)C instanceof le&&C.headingCollapsed&&C.getHeadings().then(()=>{C.isDisposed||!C.headingCollapsed||_.setHeadingCollapse(C,!0,o)}).catch(w=>{console.warn("Failed to resolve headings: ",w)}),C.model.id===((u=(t=o.activeCell)===null||t===void 0?void 0:t.model)===null||u===void 0?void 0:u.id)&&_.expandParent(C,o)},b=()=>L.isEnabledAndHeadingSelected(d,e);e.currentChanged.connect((o,t)=>{var u,C;!((C=(u=t?.content)===null||u===void 0?void 0:u.model)===null||C===void 0)&&C.cells&&(t.content.model.cells.changed.connect((w,B)=>{m(t.content)}),t.content.activeCellChanged.connect((w,B)=>{_.expandParent(B,w)}))}),e.selectionChanged.connect(()=>{c.notifyCommandChanged(h.duplicateBelow),c.notifyCommandChanged(h.deleteCell),c.notifyCommandChanged(h.copy),c.notifyCommandChanged(h.cut),c.notifyCommandChanged(h.pasteBelow),c.notifyCommandChanged(h.pasteAbove),c.notifyCommandChanged(h.pasteAndReplace),c.notifyCommandChanged(h.moveUp),c.notifyCommandChanged(h.moveDown),c.notifyCommandChanged(h.run),c.notifyCommandChanged(h.runAll),c.notifyCommandChanged(h.runAndAdvance),c.notifyCommandChanged(h.runAndInsert)}),e.activeCellChanged.connect(()=>{c.notifyCommandChanged(h.moveUp),c.notifyCommandChanged(h.moveDown)}),c.addCommand(h.runAndAdvance,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Run Selected Cell","Run Selected Cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Run this cell and advance","Run these %1 cells and advance",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);if(t){const{context:u,content:C}=t;return _.runAndAdvance(C,u.sessionContext,a,i)}},isEnabled:o=>o.toolbar?!0:l(),icon:o=>o.toolbar?Ge:void 0,describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.run,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Run Selected Cell and Do not Advance","Run Selected Cells and Do not Advance",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);if(t){const{context:u,content:C}=t;return _.run(C,u.sessionContext,a,i)}},isEnabled:l,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.runAndInsert,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Run Selected Cell and Insert Below","Run Selected Cells and Insert Below",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);if(t){const{context:u,content:C}=t;return _.runAndInsert(C,u.sessionContext,a,i)}},isEnabled:l,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.runAll,{label:n.__("Run All Cells"),caption:n.__("Run all cells"),execute:o=>{const t=v(e,d,o);if(t){const{context:u,content:C}=t;return _.runAll(C,u.sessionContext,a,i)}},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.runAllAbove,{label:n.__("Run All Above Selected Cell"),execute:o=>{const t=v(e,d,o);if(t){const{context:u,content:C}=t;return _.runAllAbove(C,u.sessionContext,a,i)}},isEnabled:()=>g()&&e.currentWidget.content.activeCellIndex!==0,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.runAllBelow,{label:n.__("Run Selected Cell and All Below"),execute:o=>{const t=v(e,d,o);if(t){const{context:u,content:C}=t;return _.runAllBelow(C,u.sessionContext,a,i)}},isEnabled:()=>g()&&(e.currentWidget.content.widgets.length===1||e.currentWidget.content.activeCellIndex!==e.currentWidget.content.widgets.length-1),describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.renderAllMarkdown,{label:n.__("Render All Markdown Cells"),execute:o=>{const t=v(e,d,o);if(t){const{content:u}=t;return _.renderAllMarkdown(u)}},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.restart,{label:n.__("Restart Kernel…"),caption:n.__("Restart the kernel"),execute:o=>{const t=v(e,d,o);if(t)return a.restart(t.sessionContext)},isEnabled:o=>o.toolbar?!0:l(),icon:o=>o.toolbar?zt:void 0,describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"}}}}}),c.addCommand(h.shutdown,{label:n.__("Shut Down Kernel"),execute:o=>{const t=v(e,d,o);if(t)return t.context.sessionContext.shutdown()},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.closeAndShutdown,{label:n.__("Close and Shut Down Notebook…"),execute:o=>{const t=v(e,d,o);if(!t)return;const u=t.title.label;return Xe({title:n.__("Shut down the notebook?"),body:n.__('Are you sure you want to close "%1"?',u),buttons:[ve.cancelButton(),ve.warnButton()]}).then(C=>{if(C.button.accept)return c.execute(h.shutdown,{activate:!1}).then(()=>{t.dispose()})})},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.trust,{label:()=>n.__("Trust Notebook"),execute:async o=>{var t;const u=o[Ee.TRUST_BOUNDARY_ID_ARG],C=typeof u=="string"?(t=e.find(w=>w.content.node.id===u))!==null&&t!==void 0?t:null:v(e,d,o);if(C&&!C.isDisposed){const{context:w,content:B}=C,M=await _.trust(B);return M.trusted&&await w.save(),M}return{trusted:!1}},isEnabled:l,describedBy:{args:{type:"object",properties:{[Ee.TRUST_BOUNDARY_ID_ARG]:{type:"string",description:n.__("The notebook trust boundary ID")}}}}}),c.addCommand(h.restartClear,{label:n.__("Restart Kernel and Clear Outputs of All Cells…"),caption:n.__("Restart the kernel and clear all outputs of all cells"),execute:async()=>{await c.execute(h.restart,{activate:!1})&&await c.execute(h.clearAllOutputs)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.restartAndRunToSelected,{label:n.__("Restart Kernel and Run up to Selected Cell…"),execute:async o=>{const t=v(e,d,{activate:!1,...o});if(!t)return;const{context:u,content:C}=t,w=C.widgets.slice(0,C.activeCellIndex+1);if(await a.restart(t.sessionContext))return _.runCells(C,w,u.sessionContext,a,i)},isEnabled:g,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.restartRunAll,{label:n.__("Restart Kernel and Run All Cells…"),caption:n.__("Restart the kernel and run all cells"),execute:async o=>{const t=v(e,d,{activate:!1,...o});if(!t)return;const{context:u,content:C}=t,w=C.widgets;if(await a.restart(t.sessionContext))return _.runCells(C,w,u.sessionContext,a,i)},isEnabled:o=>o.toolbar?!0:l(),icon:o=>o.toolbar?Ye:void 0,describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.clearAllOutputs,{label:n.__("Clear Outputs of All Cells"),caption:n.__("Clear all outputs of all cells"),execute:o=>{const t=v(e,d,o);if(t)return _.clearAllOutputs(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.clearOutputs,{label:n.__("Clear Cell Output"),caption:n.__("Clear outputs for the selected cells"),execute:o=>{const t=v(e,d,o);if(t)return _.clearOutputs(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.interrupt,{label:n.__("Interrupt Kernel"),caption:n.__("Interrupt the kernel"),execute:o=>{var t;const u=v(e,d,o);if(!u)return;const C=(t=u.context.sessionContext.session)===null||t===void 0?void 0:t.kernel;if(C)return C.interrupt()},isEnabled:o=>o.toolbar?!0:l(),icon:o=>o.toolbar?Gt:void 0,describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"}}}}}),c.addCommand(h.toCode,{label:n.__("Change to Code Cell Type"),execute:o=>{const t=v(e,d,o);if(t)return _.changeCellType(t.content,"code",i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.toMarkdown,{label:n.__("Change to Markdown Cell Type"),execute:o=>{const t=v(e,d,o);if(t)return _.changeCellType(t.content,"markdown",i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.toRaw,{label:n.__("Change to Raw Cell Type"),execute:o=>{const t=v(e,d,o);if(t)return _.changeCellType(t.content,"raw",i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.cut,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Cut Cell","Cut Cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Cut this cell","Cut these %1 cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:async o=>{const t=v(e,d,o);if(t)return s?.get("useSystemClipboardForCells").composite?await _.cutToSystemClipboard(t.content):_.cut(t.content)},icon:o=>o.toolbar?De:void 0,isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.copy,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Copy Cell","Copy Cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Copy this cell","Copy these %1 cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:async o=>{const t=v(e,d,o);if(t)return s?.get("useSystemClipboardForCells").composite?await _.copyToSystemClipboard(t.content):_.copy(t.content)},icon:o=>o.toolbar?Je:void 0,isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.pasteBelow,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Paste Cell Below","Paste Cells Below",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Paste this cell from the clipboard","Paste these %1 cells from the clipboard",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:async o=>{const t=v(e,d,o);if(t)return s?.get("useSystemClipboardForCells").composite?await _.pasteFromSystemClipboard(t.content,"below"):_.paste(t.content,"below")},icon:o=>o.toolbar?ze:void 0,isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.pasteAbove,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Paste Cell Above","Paste Cells Above",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Paste this cell from the clipboard","Paste these %1 cells from the clipboard",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:async o=>{const t=v(e,d,o);if(t)return s?.get("useSystemClipboardForCells").composite?await _.pasteFromSystemClipboard(t.content,"above"):_.paste(t.content,"above")},isEnabled:l,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.duplicateBelow,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Duplicate Cell Below","Duplicate Cells Below",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Create a duplicate of this cell below","Create duplicates of %1 cells below",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);t&&_.duplicate(t.content,"belowSelected")},icon:o=>o.toolbar?Yt:void 0,isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.pasteAndReplace,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Paste Cell and Replace","Paste Cells and Replace",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:async o=>{const t=v(e,d,o);if(t)return s?.get("useSystemClipboardForCells").composite?await _.pasteFromSystemClipboard(t.content,"replace"):_.paste(t.content,"replace")},isEnabled:l,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.deleteCell,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Delete Cell","Delete Cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Delete this cell","Delete these %1 cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);if(t)return _.deleteCells(t.content)},isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.split,{label:n.__("Split Cell"),execute:o=>{const t=v(e,d,o);if(t)return _.splitCell(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.merge,{label:n.__("Merge Selected Cells"),execute:o=>{var t;const u=v(e,d,o);if(u){const C=(t=s?.get("addExtraLineOnCellMerge").composite)!==null&&t!==void 0?t:!0;return _.mergeCells(u.content,!1,C)}},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.mergeAbove,{label:n.__("Merge Cell Above"),execute:o=>{var t;const u=v(e,d,o);if(u){const C=(t=s?.get("addExtraLineOnCellMerge").composite)!==null&&t!==void 0?t:!0;return _.mergeCells(u.content,!0,C)}},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.mergeBelow,{label:n.__("Merge Cell Below"),execute:o=>{var t;const u=v(e,d,o);if(u){const C=(t=s?.get("addExtraLineOnCellMerge").composite)!==null&&t!==void 0?t:!0;return _.mergeCells(u.content,!1,C)}},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.insertAbove,{label:n.__("Insert Cell Above"),caption:n.__("Insert a cell above"),execute:o=>{const t=v(e,d,o);if(t)return _.insertAbove(t.content)},icon:o=>o.toolbar?Xt:void 0,isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"}}}}}),c.addCommand(h.insertBelow,{label:n.__("Insert Cell Below"),caption:n.__("Insert a cell below"),execute:o=>{const t=v(e,d,o);if(t)return _.insertBelow(t.content)},icon:o=>o.toolbar?Qt:void 0,isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"}}}}}),c.addCommand(h.selectAbove,{label:n.__("Select Cell Above"),execute:o=>{const t=v(e,d,o);if(t)return _.selectAbove(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.selectBelow,{label:n.__("Select Cell Below"),execute:o=>{const t=v(e,d,o);if(t)return _.selectBelow(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.insertHeadingAbove,{label:n.__("Insert Heading Above Current Heading"),execute:o=>{const t=v(e,d,o);if(t)return _.insertSameLevelHeadingAbove(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.insertHeadingBelow,{label:n.__("Insert Heading Below Current Heading"),execute:o=>{const t=v(e,d,o);if(t)return _.insertSameLevelHeadingBelow(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.selectHeadingAboveOrCollapse,{label:n.__("Select Heading Above or Collapse Heading"),execute:o=>{const t=v(e,d,o);if(t)return _.selectHeadingAboveOrCollapseHeading(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.selectHeadingBelowOrExpand,{label:n.__("Select Heading Below or Expand Heading"),execute:o=>{const t=v(e,d,o);if(t)return _.selectHeadingBelowOrExpandHeading(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.extendAbove,{label:n.__("Extend Selection Above"),execute:o=>{const t=v(e,d,o);if(t)return _.extendSelectionAbove(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.extendTop,{label:n.__("Extend Selection to Top"),execute:o=>{const t=v(e,d,o);if(t)return _.extendSelectionAbove(t.content,!0)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.extendBelow,{label:n.__("Extend Selection Below"),execute:o=>{const t=v(e,d,o);if(t)return _.extendSelectionBelow(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.extendBottom,{label:n.__("Extend Selection to Bottom"),execute:o=>{const t=v(e,d,o);if(t)return _.extendSelectionBelow(t.content,!0)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.selectAll,{label:n.__("Select All Cells"),execute:o=>{const t=v(e,d,o);if(t)return _.selectAll(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.deselectAll,{label:n.__("Deselect All Cells"),execute:o=>{const t=v(e,d,o);if(t)return _.deselectAll(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.moveUp,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Move Cell Up","Move Cells Up",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Move this cell up","Move these %1 cells up",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);t&&(_.moveUp(t.content),L.raiseSilentNotification(n.__("Notebook cell shifted up successfully"),t.node))},isEnabled:o=>{const t=v(e,d,{...o,activate:!1});return t?t.content.activeCellIndex>=1:!1},icon:o=>o.toolbar?Zt:void 0,describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.moveDown,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Move Cell Down","Move Cells Down",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Move this cell down","Move these %1 cells down",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);t&&(_.moveDown(t.content),L.raiseSilentNotification(n.__("Notebook cell shifted down successfully"),t.node))},isEnabled:o=>{const t=v(e,d,{...o,activate:!1});if(!t||!t.content.model)return!1;const u=t.content.model.cells.length;return t.content.activeCellIndex<u-1},icon:o=>o.toolbar?eo:void 0,describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.toggleAllLines,{label:n.__("Show Line Numbers"),execute:o=>{const t=v(e,d,o);if(t)return _.toggleAllLineNumbers(t.content)},isEnabled:l,isToggled:o=>{const t=v(e,d,{...o,activate:!1});if(t){const u=t.content.editorConfig;return!!(u.code.lineNumbers&&u.markdown.lineNumbers&&u.raw.lineNumbers)}else return!1},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.commandMode,{label:n.__("Enter Command Mode"),execute:o=>{const t=v(e,d,o);t&&(t.content.mode="command")},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.editMode,{label:n.__("Enter Edit Mode"),execute:o=>{const t=v(e,d,o);t&&(t.content.mode="edit")},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.undoCellAction,{label:n.__("Undo Cell Operation"),execute:o=>{const t=v(e,d,o);if(t)return _.undo(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.redoCellAction,{label:n.__("Redo Cell Operation"),execute:o=>{const t=v(e,d,o);if(t)return _.redo(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.redo,{label:n.__("Redo"),execute:o=>{var t;const u=v(e,d,o);if(u){const C=u.content.activeCell;if(C)return C.inputHidden=!1,(t=C.editor)===null||t===void 0?void 0:t.redo()}},describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.undo,{label:n.__("Undo"),execute:o=>{var t;const u=v(e,d,o);if(u){const C=u.content.activeCell;if(C)return C.inputHidden=!1,(t=C.editor)===null||t===void 0?void 0:t.undo()}},describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.changeKernel,{label:n.__("Change Kernel…"),execute:o=>{const t=v(e,d,o);if(t)return a.selectKernel(t.context.sessionContext)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.getKernel,{label:n.__("Get Kernel"),execute:o=>{var t;const u=v(e,d,{activate:!1,...o});if(u)return(t=u.sessionContext.session)===null||t===void 0?void 0:t.kernel},isEnabled:l,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.reconnectToKernel,{label:n.__("Reconnect to Kernel"),execute:o=>{var t;const u=v(e,d,o);if(!u)return;const C=(t=u.context.sessionContext.session)===null||t===void 0?void 0:t.kernel;if(C)return C.reconnect()},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.markdown1,{label:n.__("Change to Heading 1"),execute:o=>{const t=v(e,d,o);if(t)return _.setMarkdownHeader(t.content,1,i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.markdown2,{label:n.__("Change to Heading 2"),execute:o=>{const t=v(e,d,o);if(t)return _.setMarkdownHeader(t.content,2,i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.markdown3,{label:n.__("Change to Heading 3"),execute:o=>{const t=v(e,d,o);if(t)return _.setMarkdownHeader(t.content,3,i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.markdown4,{label:n.__("Change to Heading 4"),execute:o=>{const t=v(e,d,o);if(t)return _.setMarkdownHeader(t.content,4,i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.markdown5,{label:n.__("Change to Heading 5"),execute:o=>{const t=v(e,d,o);if(t)return _.setMarkdownHeader(t.content,5,i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.markdown6,{label:n.__("Change to Heading 6"),execute:o=>{const t=v(e,d,o);if(t)return _.setMarkdownHeader(t.content,6,i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.hideCode,{label:n.__("Collapse Selected Code"),execute:o=>{const t=v(e,d,o);if(t)return _.hideCode(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.showCode,{label:n.__("Expand Selected Code"),execute:o=>{const t=v(e,d,o);if(t)return _.showCode(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.hideAllCode,{label:n.__("Collapse All Code"),execute:o=>{const t=v(e,d,o);if(t)return _.hideAllCode(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.showAllCode,{label:n.__("Expand All Code"),execute:o=>{const t=v(e,d,o);if(t)return _.showAllCode(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.hideOutput,{label:n.__("Collapse Selected Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.hideOutput(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.showOutput,{label:n.__("Expand Selected Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.showOutput(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.toggleOutput,{label:n.__("Toggle Visibility of Selected Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.toggleOutput(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.hideAllOutputs,{label:n.__("Collapse All Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.hideAllOutputs(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.toggleRenderSideBySideCurrentNotebook,{label:n.__("Render Side-by-Side"),execute:o=>{const t=v(e,d,o);if(t)return t.content.renderingLayout==="side-by-side"?_.renderDefault(t.content):_.renderSideBySide(t.content)},isEnabled:l,isToggled:o=>{const t=v(e,d,{...o,activate:!1});return t?t.content.renderingLayout==="side-by-side":!1},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.showAllOutputs,{label:n.__("Expand All Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.showAllOutputs(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.enableOutputScrolling,{label:n.__("Enable Scrolling for Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.enableOutputScrolling(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.disableOutputScrolling,{label:n.__("Disable Scrolling for Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.disableOutputScrolling(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.selectLastRunCell,{label:n.__("Select current running or last run cell"),execute:o=>{const t=v(e,d,o);if(t)return _.selectLastRunCell(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.replaceSelection,{label:n.__("Replace Selection in Notebook Cell"),execute:o=>{const t=v(e,d,o),u=o.text||"";if(t)return _.replaceSelection(t.content,u)},isEnabled:l,describedBy:{args:{type:"object",properties:{text:{type:"string",description:n.__("Text to replace the selection with")}}}}}),c.addCommand(h.toggleCollapseCmd,{label:n.__("Toggle Collapse Notebook Heading"),execute:o=>{const t=v(e,d,o);if(t)return _.toggleCurrentHeadingCollapse(t.content)},isEnabled:b,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.collapseAllCmd,{label:n.__("Collapse All Headings"),execute:o=>{const t=v(e,d,o);if(t)return _.collapseAllHeadings(t.content)},describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.expandAllCmd,{label:n.__("Expand All Headings"),execute:o=>{const t=v(e,d,o);if(t)return _.expandAllHeadings(t.content)},describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.tocRunCells,{label:n.__("Select and Run Cell(s) for this Heading"),execute:o=>{const t=v(e,d,{activate:!1,...o});if(t===null)return;const u=t.content.activeCell;let C=t.content.activeCellIndex;if(u instanceof le){const w=t.content.widgets,B=u.headingInfo.level;for(let M=t.content.activeCellIndex+1;M<w.length;M++){const K=w[M];if(K instanceof le&&K.headingInfo.level>=0&&K.headingInfo.level<=B)break;C=M}}t.content.extendContiguousSelectionTo(C),_.run(t.content,t.sessionContext,a,i)},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.accessPreviousHistory,{label:n.__("Access Previous Kernel History Entry"),execute:async o=>{const t=v(e,d,o);if(t)return await _.accessPreviousHistory(t.content)},describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.accessNextHistory,{label:n.__("Access Next Kernel History Entry"),execute:async o=>{const t=v(e,d,o);if(t)return await _.accessNextHistory(t.content)},describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.virtualScrollbar,{label:n.__("Show Minimap"),caption:n.__("Show Minimap"),execute:o=>{const t=v(e,d,o);t&&(t.content.scrollbar=!t.content.scrollbar)},isEnabled:()=>!!e.currentWidget,isToggled:()=>{var o;const t=e.currentWidget;return(o=t?.content.scrollbar)!==null&&o!==void 0?o:!1},describedBy:{args:{type:"object",properties:{}}}});const f=[h.createNew,h.createOutputView],x=()=>{Object.values(h).filter(o=>!f.includes(o)&&r.commands.hasCommand(o)).forEach(o=>r.commands.notifyCommandChanged(o))};e.currentChanged.connect(x),(p=d.currentChanged)===null||p===void 0||p.connect(x)}function Fn(r,e){const i=e.load("jupyterlab");let a=i.__("Notebook Operations");[h.interrupt,h.restart,h.restartClear,h.restartRunAll,h.runAll,h.renderAllMarkdown,h.runAllAbove,h.runAllBelow,h.restartAndRunToSelected,h.selectAll,h.deselectAll,h.clearAllOutputs,h.toggleAllLines,h.editMode,h.commandMode,h.changeKernel,h.reconnectToKernel,h.createConsole,h.createSubshellConsole,h.closeAndShutdown,h.trust,h.toggleCollapseCmd,h.collapseAllCmd,h.expandAllCmd,h.accessPreviousHistory,h.accessNextHistory,h.virtualScrollbar].forEach(s=>{r.addItem({command:s,category:a})}),r.addItem({command:h.createNew,category:a,args:{isPalette:!0}}),a=i.__("Notebook Cell Operations"),[h.run,h.runAndAdvance,h.runAndInsert,h.runInConsole,h.clearOutputs,h.toCode,h.toMarkdown,h.toRaw,h.cut,h.copy,h.pasteBelow,h.pasteAbove,h.pasteAndReplace,h.deleteCell,h.split,h.merge,h.mergeAbove,h.mergeBelow,h.insertAbove,h.insertBelow,h.selectAbove,h.selectBelow,h.selectHeadingAboveOrCollapse,h.selectHeadingBelowOrExpand,h.insertHeadingAbove,h.insertHeadingBelow,h.extendAbove,h.extendTop,h.extendBelow,h.extendBottom,h.moveDown,h.moveUp,h.undoCellAction,h.redoCellAction,h.markdown1,h.markdown2,h.markdown3,h.markdown4,h.markdown5,h.markdown6,h.hideCode,h.showCode,h.hideAllCode,h.showAllCode,h.hideOutput,h.showOutput,h.toggleOutput,h.hideAllOutputs,h.showAllOutputs,h.toggleRenderSideBySideCurrentNotebook,h.setSideBySideRatio,h.enableOutputScrolling,h.disableOutputScrolling].forEach(s=>{r.addItem({command:s,category:a})})}function Kn(r,e){r.editMenu.undoers.redo.add({id:h.redo,isEnabled:e}),r.editMenu.undoers.undo.add({id:h.undo,isEnabled:e}),r.editMenu.clearers.clearAll.add({id:h.clearAllOutputs,isEnabled:e}),r.editMenu.clearers.clearCurrent.add({id:h.clearOutputs,isEnabled:e}),r.fileMenu.consoleCreators.add({id:h.createConsole,isEnabled:e}),r.fileMenu.closeAndCleaners.add({id:h.closeAndShutdown,isEnabled:e}),r.kernelMenu.kernelUsers.changeKernel.add({id:h.changeKernel,isEnabled:e}),r.kernelMenu.kernelUsers.clearWidget.add({id:h.clearAllOutputs,isEnabled:e}),r.kernelMenu.kernelUsers.interruptKernel.add({id:h.interrupt,isEnabled:e}),r.kernelMenu.kernelUsers.reconnectToKernel.add({id:h.reconnectToKernel,isEnabled:e}),r.kernelMenu.kernelUsers.restartKernel.add({id:h.restart,isEnabled:e}),r.kernelMenu.kernelUsers.shutdownKernel.add({id:h.shutdown,isEnabled:e}),r.viewMenu.editorViewers.toggleLineNumbers.add({id:h.toggleAllLines,isEnabled:e}),r.viewMenu.editorViewers.toggleMinimap.add({id:h.virtualScrollbar,isEnabled:()=>!0}),r.runMenu.codeRunners.restart.add({id:h.restart,isEnabled:e}),r.runMenu.codeRunners.run.add({id:h.runAndAdvance,isEnabled:e}),r.runMenu.codeRunners.runAll.add({id:h.runAll,isEnabled:e}),r.helpMenu.getKernel.add({id:h.getKernel,isEnabled:e})}var L;(function(r){function e(c,d,g,m){const b={path:d.context.path,preferredLanguage:d.context.model.defaultKernelLanguage,activate:g,subshell:m,ref:d.id,insertMode:"split-bottom",type:"Linked Console"};return c.execute("console:create",b)}r.createConsole=e;function i(c,d){return d.currentWidget!==null&&d.currentWidget===c.currentWidget}r.isEnabled=i;function a(c,d){if(!r.isEnabled(c,d))return!1;const{content:g}=d.currentWidget,m=g.activeCellIndex;for(let b=0;b<g.widgets.length;++b)if(g.isSelected(g.widgets[b])&&b!==m)return!1;return!0}r.isEnabledAndSingleSelected=a;function s(c,d){if(!r.isEnabled(c,d))return!1;const{content:g}=d.currentWidget,m=g.activeCellIndex;if(!(g.activeCell instanceof le))return!1;for(let b=0;b<g.widgets.length;++b)if(g.isSelected(g.widgets[b])&&b!==m)return!1;return!0}r.isEnabledAndHeadingSelected=s;function l(c){c=c||O;const d=c.load("jupyterlab");return{html:d.__("HTML"),latex:d.__("LaTeX"),markdown:d.__("Markdown"),pdf:d.__("PDF"),rst:d.__("ReStructured Text"),script:d.__("Executable Script"),slides:d.__("Reveal.js Slides")}}r.getFormatLabels=l;function p(c,d){const g=`sr-message-container-${d.id}`,m=document.getElementById(g)||document.createElement("div");m.getAttribute("id")!==g&&(m.classList.add("sr-only"),m.setAttribute("id",g),m.setAttribute("role","alert"),m.hidden=!0,d.appendChild(m)),m.innerText=c}r.raiseSilentNotification=p;class n extends oo{constructor(d){super(),this._cell=null;const g=(d.translator||O).load("jupyterlab");this._notebook=d.notebook,this._index=d.index!==void 0?d.index:-1,this._cell=d.cell||null,this.id=`LinkedOutputView-${no.uuid4()}`,this.title.label="Output View",this.title.icon=Ze,this.title.caption=this._notebook.title.label?g.__("For Notebook: %1",this._notebook.title.label):g.__("For Notebook:"),this.addClass("jp-LinkedOutputView"),this._notebook.context.ready.then(()=>{if(this._cell||(this._cell=this._notebook.content.widgets[this._index]),!this._cell||this._cell.model.type!=="code"){this.dispose();return}const m=this._cell.cloneOutputArea();this.addWidget(m)})}get index(){return this._cell?ie.findFirstIndex(this._notebook.content.widgets,d=>d===this._cell):this._index}get path(){return this._notebook.context.path}}r.ClonedOutputArea=n})(L||(L={}));export{gn as commandEditItem,el as default,bn as executionIndicator,mn as exportPlugin,Cn as notebookTrustItem};
|
|
9
|
+
}`,S=document.getElementById(Fe);if(S)S.textContent=E;else{const U=document.createElement("style");U.id=Fe,U.textContent=E,document.head.appendChild(U)}e.autoStartDefault=y.get("autoStartDefaultKernel").composite,e.shutdownOnClose=y.get("kernelShutdown").composite,P.disableDocumentWideUndoRedo=!y.get("documentWideUndoRedo").composite,Me({editorConfig:e.editorConfig,notebookConfig:e.notebookConfig,kernelShutdown:e.shutdownOnClose,autoStartDefault:e.autoStartDefault})}c&&Kn(c,V);const st=async(y,k,T)=>{const N=await w.execute("docmanager:new-untitled",{path:y,type:"notebook"});if(N!==void 0){const E=await w.execute("docmanager:open",{path:N.path,factory:J,kernel:{id:k,name:T}});return E.isUntitled=!0,E}};return w.addCommand(h.createNew,{label:y=>{var k,T,N;const E=y.kernelName||"";return y.isLauncher&&y.kernelName&&C.kernelspecs?(N=(T=(k=C.kernelspecs.specs)===null||k===void 0?void 0:k.kernelspecs[E])===null||T===void 0?void 0:T.display_name)!==null&&N!==void 0?N:"":y.isPalette||y.isContextMenu?u.__("New Notebook"):u.__("Notebook")},caption:u.__("Create a new notebook"),icon:y=>y.isPalette?void 0:Ze,execute:y=>{var k,T;const N=(k=x?.tracker.currentWidget)!==null&&k!==void 0?k:l,E=y.cwd||((T=N?.model.path)!==null&&T!==void 0?T:""),S=y.kernelId||"",U=y.kernelName||"";return st(E,S,U)},describedBy:{args:{type:"object",properties:{cwd:{type:"string",description:u.__("Current working directory for the new notebook")},kernelId:{type:"string",description:u.__("Kernel ID to use for the new notebook")},kernelName:{type:"string",description:u.__("Kernel name to use for the new notebook")},isLauncher:{type:"boolean",description:u.__("Whether the command is executed from launcher")},isPalette:{type:"boolean",description:u.__("Whether the command is executed from palette")},isContextMenu:{type:"boolean",description:u.__("Whether the command is executed from context menu")}}}}}),p&&C.ready.then(()=>{let y=null;const k=()=>{y&&(y.dispose(),y=null);const T=C.kernelspecs.specs;if(T){y=new to;for(const N in T.kernelspecs){const E=N===T.default?0:1/0,S=T.kernelspecs[N],U=S.resources["logo-svg"]||S.resources["logo-64x64"];y.add(p.add({command:h.createNew,args:{isLauncher:!0,kernelName:N},category:u.__("Notebook"),rank:E,kernelIconUrl:U,metadata:{kernel:ne.deepCopy(S.metadata||{})}}))}}};k(),C.kernelspecs.specsChanged.connect(k)}),M}function Wn(r,e,i,a,s){if(!i)return;const l=(a??O).load("jupyterlab"),p=s??new Jt;r.commands.addCommand(h.invokeCompleter,{label:l.__("Display the completion helper."),execute:c=>{var d;const g=e.currentWidget;g&&((d=g.content.activeCell)===null||d===void 0?void 0:d.model.type)==="code"&&i.invoke(g.id)},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:l.__("Whether to activate the widget")}}}}}),r.commands.addCommand(h.selectCompleter,{label:l.__("Select the completion suggestion."),execute:()=>{const c=e.currentWidget&&e.currentWidget.id;if(c)return i.select(c)},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:l.__("Whether to activate the widget")}}}}}),r.commands.addKeyBinding({command:h.selectCompleter,keys:["Enter"],selector:".jp-Notebook .jp-mod-completer-active"});const n=async(c,d)=>{var g,m;const b={editor:(m=(g=d.content.activeCell)===null||g===void 0?void 0:g.editor)!==null&&m!==void 0?m:null,session:d.sessionContext.session,widget:d,sanitizer:p};await i.updateCompleter(b),d.content.activeCellChanged.connect((f,x)=>{x?.ready.then(()=>{const o={editor:x.editor,session:d.sessionContext.session,widget:d,sanitizer:p};return i.updateCompleter(o)}).catch(console.error)}),d.sessionContext.sessionChanged.connect(()=>{var f;(f=d.content.activeCell)===null||f===void 0||f.ready.then(()=>{var x,o;const t={editor:(o=(x=d.content.activeCell)===null||x===void 0?void 0:x.editor)!==null&&o!==void 0?o:null,session:d.sessionContext.session,widget:d};return i.updateCompleter(t)}).catch(console.error)})};e.widgetAdded.connect(n),i.activeProvidersChanged.connect(()=>{e.forEach(c=>{n(void 0,c).catch(d=>console.error(d))})})}function Hn(r,e,i,a,s,l){e.widgetAdded.connect(async(p,n)=>{const c=new Ko(n,{connectionManager:i,featureManager:a,foreignCodeExtractorsManager:s});l.add(c)})}function v(r,e,i){var a,s;let l=null;return i[We.WIDGET_ID_ARG]?l=(a=r.find(n=>n.id===i[We.WIDGET_ID_ARG]))!==null&&a!==void 0?a:null:i[Ne.WIDGET]?l=(s=r.find(n=>n.id===i[Ne.WIDGET]))!==null&&s!==void 0?s:null:l=r.currentWidget,i.activate!==!1&&l&&e.activateById(l.id),l}function Ke(r,e,i,a,s,l){var p;const n=i.load("jupyterlab"),{commands:c,shell:d}=r,g=()=>L.isEnabledAndSingleSelected(d,e),m=o=>{var t,u;for(const C of o.widgets)C instanceof le&&C.headingCollapsed&&C.getHeadings().then(()=>{C.isDisposed||!C.headingCollapsed||_.setHeadingCollapse(C,!0,o)}).catch(w=>{console.warn("Failed to resolve headings: ",w)}),C.model.id===((u=(t=o.activeCell)===null||t===void 0?void 0:t.model)===null||u===void 0?void 0:u.id)&&_.expandParent(C,o)},b=()=>L.isEnabledAndHeadingSelected(d,e);e.currentChanged.connect((o,t)=>{var u,C;!((C=(u=t?.content)===null||u===void 0?void 0:u.model)===null||C===void 0)&&C.cells&&(t.content.model.cells.changed.connect((w,B)=>{m(t.content)}),t.content.activeCellChanged.connect((w,B)=>{_.expandParent(B,w)}))}),e.selectionChanged.connect(()=>{c.notifyCommandChanged(h.duplicateBelow),c.notifyCommandChanged(h.deleteCell),c.notifyCommandChanged(h.copy),c.notifyCommandChanged(h.cut),c.notifyCommandChanged(h.pasteBelow),c.notifyCommandChanged(h.pasteAbove),c.notifyCommandChanged(h.pasteAndReplace),c.notifyCommandChanged(h.moveUp),c.notifyCommandChanged(h.moveDown),c.notifyCommandChanged(h.run),c.notifyCommandChanged(h.runAll),c.notifyCommandChanged(h.runAndAdvance),c.notifyCommandChanged(h.runAndInsert)}),e.activeCellChanged.connect(()=>{c.notifyCommandChanged(h.moveUp),c.notifyCommandChanged(h.moveDown)}),c.addCommand(h.runAndAdvance,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Run Selected Cell","Run Selected Cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Run this cell and advance","Run these %1 cells and advance",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);if(t){const{context:u,content:C}=t;return _.runAndAdvance(C,u.sessionContext,a,i)}},isEnabled:o=>o.toolbar?!0:l(),icon:o=>o.toolbar?Ge:void 0,describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.run,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Run Selected Cell and Do not Advance","Run Selected Cells and Do not Advance",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);if(t){const{context:u,content:C}=t;return _.run(C,u.sessionContext,a,i)}},isEnabled:l,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.runAndInsert,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Run Selected Cell and Insert Below","Run Selected Cells and Insert Below",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);if(t){const{context:u,content:C}=t;return _.runAndInsert(C,u.sessionContext,a,i)}},isEnabled:l,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.runAll,{label:n.__("Run All Cells"),caption:n.__("Run all cells"),execute:o=>{const t=v(e,d,o);if(t){const{context:u,content:C}=t;return _.runAll(C,u.sessionContext,a,i)}},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.runAllAbove,{label:n.__("Run All Above Selected Cell"),execute:o=>{const t=v(e,d,o);if(t){const{context:u,content:C}=t;return _.runAllAbove(C,u.sessionContext,a,i)}},isEnabled:()=>g()&&e.currentWidget.content.activeCellIndex!==0,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.runAllBelow,{label:n.__("Run Selected Cell and All Below"),execute:o=>{const t=v(e,d,o);if(t){const{context:u,content:C}=t;return _.runAllBelow(C,u.sessionContext,a,i)}},isEnabled:()=>g()&&(e.currentWidget.content.widgets.length===1||e.currentWidget.content.activeCellIndex!==e.currentWidget.content.widgets.length-1),describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.renderAllMarkdown,{label:n.__("Render All Markdown Cells"),execute:o=>{const t=v(e,d,o);if(t){const{content:u}=t;return _.renderAllMarkdown(u)}},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.restart,{label:n.__("Restart Kernel…"),caption:n.__("Restart the kernel"),execute:o=>{const t=v(e,d,o);if(t)return a.restart(t.sessionContext)},isEnabled:o=>o.toolbar?!0:l(),icon:o=>o.toolbar?zt:void 0,describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"}}}}}),c.addCommand(h.shutdown,{label:n.__("Shut Down Kernel"),execute:o=>{const t=v(e,d,o);if(t)return t.context.sessionContext.shutdown()},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.closeAndShutdown,{label:n.__("Close and Shut Down Notebook…"),execute:o=>{const t=v(e,d,o);if(!t)return;const u=t.title.label;return Xe({title:n.__("Shut down the notebook?"),body:n.__('Are you sure you want to close "%1"?',u),buttons:[ve.cancelButton(),ve.warnButton()]}).then(C=>{if(C.button.accept)return c.execute(h.shutdown,{activate:!1}).then(()=>{t.dispose()})})},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.trust,{label:()=>n.__("Trust Notebook"),execute:async o=>{var t;const u=o[Ee.TRUST_BOUNDARY_ID_ARG],C=typeof u=="string"?(t=e.find(w=>w.content.node.id===u))!==null&&t!==void 0?t:null:v(e,d,o);if(C&&!C.isDisposed){const{context:w,content:B}=C,M=await _.trust(B);return M.trusted&&await w.save(),M}return{trusted:!1}},isEnabled:l,describedBy:{args:{type:"object",properties:{[Ee.TRUST_BOUNDARY_ID_ARG]:{type:"string",description:n.__("The notebook trust boundary ID")}}}}}),c.addCommand(h.restartClear,{label:n.__("Restart Kernel and Clear Outputs of All Cells…"),caption:n.__("Restart the kernel and clear all outputs of all cells"),execute:async()=>{await c.execute(h.restart,{activate:!1})&&await c.execute(h.clearAllOutputs)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.restartAndRunToSelected,{label:n.__("Restart Kernel and Run up to Selected Cell…"),execute:async o=>{const t=v(e,d,{activate:!1,...o});if(!t)return;const{context:u,content:C}=t,w=C.widgets.slice(0,C.activeCellIndex+1);if(await a.restart(t.sessionContext))return _.runCells(C,w,u.sessionContext,a,i)},isEnabled:g,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.restartRunAll,{label:n.__("Restart Kernel and Run All Cells…"),caption:n.__("Restart the kernel and run all cells"),execute:async o=>{const t=v(e,d,{activate:!1,...o});if(!t)return;const{context:u,content:C}=t,w=C.widgets;if(await a.restart(t.sessionContext))return _.runCells(C,w,u.sessionContext,a,i)},isEnabled:o=>o.toolbar?!0:l(),icon:o=>o.toolbar?Ye:void 0,describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.clearAllOutputs,{label:n.__("Clear Outputs of All Cells"),caption:n.__("Clear all outputs of all cells"),execute:o=>{const t=v(e,d,o);if(t)return _.clearAllOutputs(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.clearOutputs,{label:n.__("Clear Cell Output"),caption:n.__("Clear outputs for the selected cells"),execute:o=>{const t=v(e,d,o);if(t)return _.clearOutputs(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.interrupt,{label:n.__("Interrupt Kernel"),caption:n.__("Interrupt the kernel"),execute:o=>{var t;const u=v(e,d,o);if(!u)return;const C=(t=u.context.sessionContext.session)===null||t===void 0?void 0:t.kernel;if(C)return C.interrupt()},isEnabled:o=>o.toolbar?!0:l(),icon:o=>o.toolbar?Gt:void 0,describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"}}}}}),c.addCommand(h.toCode,{label:n.__("Change to Code Cell Type"),execute:o=>{const t=v(e,d,o);if(t)return _.changeCellType(t.content,"code",i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.toMarkdown,{label:n.__("Change to Markdown Cell Type"),execute:o=>{const t=v(e,d,o);if(t)return _.changeCellType(t.content,"markdown",i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.toRaw,{label:n.__("Change to Raw Cell Type"),execute:o=>{const t=v(e,d,o);if(t)return _.changeCellType(t.content,"raw",i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.cut,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Cut Cell","Cut Cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Cut this cell","Cut these %1 cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:async o=>{const t=v(e,d,o);if(t)return s?.get("useSystemClipboardForCells").composite?await _.cutToSystemClipboard(t.content):_.cut(t.content)},icon:o=>o.toolbar?Je:void 0,isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.copy,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Copy Cell","Copy Cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Copy this cell","Copy these %1 cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:async o=>{const t=v(e,d,o);if(t)return s?.get("useSystemClipboardForCells").composite?await _.copyToSystemClipboard(t.content):_.copy(t.content)},icon:o=>o.toolbar?De:void 0,isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.pasteBelow,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Paste Cell Below","Paste Cells Below",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Paste this cell from the clipboard","Paste these %1 cells from the clipboard",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:async o=>{const t=v(e,d,o);if(t)return s?.get("useSystemClipboardForCells").composite?await _.pasteFromSystemClipboard(t.content,"below"):_.paste(t.content,"below")},icon:o=>o.toolbar?ze:void 0,isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.pasteAbove,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Paste Cell Above","Paste Cells Above",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Paste this cell from the clipboard","Paste these %1 cells from the clipboard",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:async o=>{const t=v(e,d,o);if(t)return s?.get("useSystemClipboardForCells").composite?await _.pasteFromSystemClipboard(t.content,"above"):_.paste(t.content,"above")},isEnabled:l,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.duplicateBelow,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Duplicate Cell Below","Duplicate Cells Below",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Create a duplicate of this cell below","Create duplicates of %1 cells below",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);t&&_.duplicate(t.content,"belowSelected")},icon:o=>o.toolbar?Yt:void 0,isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.pasteAndReplace,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Paste Cell and Replace","Paste Cells and Replace",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:async o=>{const t=v(e,d,o);if(t)return s?.get("useSystemClipboardForCells").composite?await _.pasteFromSystemClipboard(t.content,"replace"):_.paste(t.content,"replace")},isEnabled:l,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.deleteCell,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Delete Cell","Delete Cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Delete this cell","Delete these %1 cells",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);if(t)return _.deleteCells(t.content)},isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.split,{label:n.__("Split Cell"),execute:o=>{const t=v(e,d,o);if(t)return _.splitCell(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.merge,{label:n.__("Merge Selected Cells"),execute:o=>{var t;const u=v(e,d,o);if(u){const C=(t=s?.get("addExtraLineOnCellMerge").composite)!==null&&t!==void 0?t:!0;return _.mergeCells(u.content,!1,C)}},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.mergeAbove,{label:n.__("Merge Cell Above"),execute:o=>{var t;const u=v(e,d,o);if(u){const C=(t=s?.get("addExtraLineOnCellMerge").composite)!==null&&t!==void 0?t:!0;return _.mergeCells(u.content,!0,C)}},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.mergeBelow,{label:n.__("Merge Cell Below"),execute:o=>{var t;const u=v(e,d,o);if(u){const C=(t=s?.get("addExtraLineOnCellMerge").composite)!==null&&t!==void 0?t:!0;return _.mergeCells(u.content,!1,C)}},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.insertAbove,{label:n.__("Insert Cell Above"),caption:n.__("Insert a cell above"),execute:o=>{const t=v(e,d,o);if(t)return _.insertAbove(t.content)},icon:o=>o.toolbar?Xt:void 0,isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"}}}}}),c.addCommand(h.insertBelow,{label:n.__("Insert Cell Below"),caption:n.__("Insert a cell below"),execute:o=>{const t=v(e,d,o);if(t)return _.insertBelow(t.content)},icon:o=>o.toolbar?Qt:void 0,isEnabled:o=>o.toolbar?!0:l(),describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"}}}}}),c.addCommand(h.selectAbove,{label:n.__("Select Cell Above"),execute:o=>{const t=v(e,d,o);if(t)return _.selectAbove(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.selectBelow,{label:n.__("Select Cell Below"),execute:o=>{const t=v(e,d,o);if(t)return _.selectBelow(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.insertHeadingAbove,{label:n.__("Insert Heading Above Current Heading"),execute:o=>{const t=v(e,d,o);if(t)return _.insertSameLevelHeadingAbove(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.insertHeadingBelow,{label:n.__("Insert Heading Below Current Heading"),execute:o=>{const t=v(e,d,o);if(t)return _.insertSameLevelHeadingBelow(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.selectHeadingAboveOrCollapse,{label:n.__("Select Heading Above or Collapse Heading"),execute:o=>{const t=v(e,d,o);if(t)return _.selectHeadingAboveOrCollapseHeading(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.selectHeadingBelowOrExpand,{label:n.__("Select Heading Below or Expand Heading"),execute:o=>{const t=v(e,d,o);if(t)return _.selectHeadingBelowOrExpandHeading(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.extendAbove,{label:n.__("Extend Selection Above"),execute:o=>{const t=v(e,d,o);if(t)return _.extendSelectionAbove(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.extendTop,{label:n.__("Extend Selection to Top"),execute:o=>{const t=v(e,d,o);if(t)return _.extendSelectionAbove(t.content,!0)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.extendBelow,{label:n.__("Extend Selection Below"),execute:o=>{const t=v(e,d,o);if(t)return _.extendSelectionBelow(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.extendBottom,{label:n.__("Extend Selection to Bottom"),execute:o=>{const t=v(e,d,o);if(t)return _.extendSelectionBelow(t.content,!0)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.selectAll,{label:n.__("Select All Cells"),execute:o=>{const t=v(e,d,o);if(t)return _.selectAll(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.deselectAll,{label:n.__("Deselect All Cells"),execute:o=>{const t=v(e,d,o);if(t)return _.deselectAll(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.moveUp,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Move Cell Up","Move Cells Up",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Move this cell up","Move these %1 cells up",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);t&&(_.moveUp(t.content),L.raiseSilentNotification(n.__("Notebook cell shifted up successfully"),t.node))},isEnabled:o=>{const t=v(e,d,{...o,activate:!1});return t?t.content.activeCellIndex>=1:!1},icon:o=>o.toolbar?Zt:void 0,describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.moveDown,{label:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Move Cell Down","Move Cells Down",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},caption:o=>{var t;const u=v(e,d,{...o,activate:!1});return n._n("Move this cell down","Move these %1 cells down",(t=u?.content.selectedCells.length)!==null&&t!==void 0?t:1)},execute:o=>{const t=v(e,d,o);t&&(_.moveDown(t.content),L.raiseSilentNotification(n.__("Notebook cell shifted down successfully"),t.node))},isEnabled:o=>{const t=v(e,d,{...o,activate:!1});if(!t||!t.content.model)return!1;const u=t.content.model.cells.length;return t.content.activeCellIndex<u-1},icon:o=>o.toolbar?eo:void 0,describedBy:{args:{type:"object",properties:{toolbar:{type:"boolean",description:"Whether the command is being executed from the toolbar"},activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.toggleAllLines,{label:n.__("Show Line Numbers"),execute:o=>{const t=v(e,d,o);if(t)return _.toggleAllLineNumbers(t.content)},isEnabled:l,isToggled:o=>{const t=v(e,d,{...o,activate:!1});if(t){const u=t.content.editorConfig;return!!(u.code.lineNumbers&&u.markdown.lineNumbers&&u.raw.lineNumbers)}else return!1},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.commandMode,{label:n.__("Enter Command Mode"),execute:o=>{const t=v(e,d,o);t&&(t.content.mode="command")},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.editMode,{label:n.__("Enter Edit Mode"),execute:o=>{const t=v(e,d,o);t&&(t.content.mode="edit")},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.undoCellAction,{label:n.__("Undo Cell Operation"),execute:o=>{const t=v(e,d,o);if(t)return _.undo(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.redoCellAction,{label:n.__("Redo Cell Operation"),execute:o=>{const t=v(e,d,o);if(t)return _.redo(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.redo,{label:n.__("Redo"),execute:o=>{var t;const u=v(e,d,o);if(u){const C=u.content.activeCell;if(C)return C.inputHidden=!1,(t=C.editor)===null||t===void 0?void 0:t.redo()}},describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.undo,{label:n.__("Undo"),execute:o=>{var t;const u=v(e,d,o);if(u){const C=u.content.activeCell;if(C)return C.inputHidden=!1,(t=C.editor)===null||t===void 0?void 0:t.undo()}},describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.changeKernel,{label:n.__("Change Kernel…"),execute:o=>{const t=v(e,d,o);if(t)return a.selectKernel(t.context.sessionContext)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.getKernel,{label:n.__("Get Kernel"),execute:o=>{var t;const u=v(e,d,{activate:!1,...o});if(u)return(t=u.sessionContext.session)===null||t===void 0?void 0:t.kernel},isEnabled:l,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.reconnectToKernel,{label:n.__("Reconnect to Kernel"),execute:o=>{var t;const u=v(e,d,o);if(!u)return;const C=(t=u.context.sessionContext.session)===null||t===void 0?void 0:t.kernel;if(C)return C.reconnect()},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.markdown1,{label:n.__("Change to Heading 1"),execute:o=>{const t=v(e,d,o);if(t)return _.setMarkdownHeader(t.content,1,i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.markdown2,{label:n.__("Change to Heading 2"),execute:o=>{const t=v(e,d,o);if(t)return _.setMarkdownHeader(t.content,2,i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.markdown3,{label:n.__("Change to Heading 3"),execute:o=>{const t=v(e,d,o);if(t)return _.setMarkdownHeader(t.content,3,i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.markdown4,{label:n.__("Change to Heading 4"),execute:o=>{const t=v(e,d,o);if(t)return _.setMarkdownHeader(t.content,4,i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.markdown5,{label:n.__("Change to Heading 5"),execute:o=>{const t=v(e,d,o);if(t)return _.setMarkdownHeader(t.content,5,i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.markdown6,{label:n.__("Change to Heading 6"),execute:o=>{const t=v(e,d,o);if(t)return _.setMarkdownHeader(t.content,6,i)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.hideCode,{label:n.__("Collapse Selected Code"),execute:o=>{const t=v(e,d,o);if(t)return _.hideCode(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.showCode,{label:n.__("Expand Selected Code"),execute:o=>{const t=v(e,d,o);if(t)return _.showCode(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.hideAllCode,{label:n.__("Collapse All Code"),execute:o=>{const t=v(e,d,o);if(t)return _.hideAllCode(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.showAllCode,{label:n.__("Expand All Code"),execute:o=>{const t=v(e,d,o);if(t)return _.showAllCode(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.hideOutput,{label:n.__("Collapse Selected Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.hideOutput(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.showOutput,{label:n.__("Expand Selected Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.showOutput(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.toggleOutput,{label:n.__("Toggle Visibility of Selected Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.toggleOutput(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.hideAllOutputs,{label:n.__("Collapse All Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.hideAllOutputs(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.toggleRenderSideBySideCurrentNotebook,{label:n.__("Render Side-by-Side"),execute:o=>{const t=v(e,d,o);if(t)return t.content.renderingLayout==="side-by-side"?_.renderDefault(t.content):_.renderSideBySide(t.content)},isEnabled:l,isToggled:o=>{const t=v(e,d,{...o,activate:!1});return t?t.content.renderingLayout==="side-by-side":!1},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.showAllOutputs,{label:n.__("Expand All Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.showAllOutputs(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.enableOutputScrolling,{label:n.__("Enable Scrolling for Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.enableOutputScrolling(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.disableOutputScrolling,{label:n.__("Disable Scrolling for Outputs"),execute:o=>{const t=v(e,d,o);if(t)return _.disableOutputScrolling(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.selectLastRunCell,{label:n.__("Select current running or last run cell"),execute:o=>{const t=v(e,d,o);if(t)return _.selectLastRunCell(t.content)},isEnabled:l,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.replaceSelection,{label:n.__("Replace Selection in Notebook Cell"),execute:o=>{const t=v(e,d,o),u=o.text||"";if(t)return _.replaceSelection(t.content,u)},isEnabled:l,describedBy:{args:{type:"object",properties:{text:{type:"string",description:n.__("Text to replace the selection with")}}}}}),c.addCommand(h.toggleCollapseCmd,{label:n.__("Toggle Collapse Notebook Heading"),execute:o=>{const t=v(e,d,o);if(t)return _.toggleCurrentHeadingCollapse(t.content)},isEnabled:b,describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.collapseAllCmd,{label:n.__("Collapse All Headings"),execute:o=>{const t=v(e,d,o);if(t)return _.collapseAllHeadings(t.content)},describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.expandAllCmd,{label:n.__("Expand All Headings"),execute:o=>{const t=v(e,d,o);if(t)return _.expandAllHeadings(t.content)},describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.tocRunCells,{label:n.__("Select and Run Cell(s) for this Heading"),execute:o=>{const t=v(e,d,{activate:!1,...o});if(t===null)return;const u=t.content.activeCell;let C=t.content.activeCellIndex;if(u instanceof le){const w=t.content.widgets,B=u.headingInfo.level;for(let M=t.content.activeCellIndex+1;M<w.length;M++){const K=w[M];if(K instanceof le&&K.headingInfo.level>=0&&K.headingInfo.level<=B)break;C=M}}t.content.extendContiguousSelectionTo(C),_.run(t.content,t.sessionContext,a,i)},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:n.__("Whether to activate the notebook after execution")}}}}}),c.addCommand(h.accessPreviousHistory,{label:n.__("Access Previous Kernel History Entry"),execute:async o=>{const t=v(e,d,o);if(t)return await _.accessPreviousHistory(t.content)},describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.accessNextHistory,{label:n.__("Access Next Kernel History Entry"),execute:async o=>{const t=v(e,d,o);if(t)return await _.accessNextHistory(t.content)},describedBy:{args:{type:"object",properties:{}}}}),c.addCommand(h.virtualScrollbar,{label:n.__("Show Minimap"),caption:n.__("Show Minimap"),execute:o=>{const t=v(e,d,o);t&&(t.content.scrollbar=!t.content.scrollbar)},isEnabled:()=>!!e.currentWidget,isToggled:()=>{var o;const t=e.currentWidget;return(o=t?.content.scrollbar)!==null&&o!==void 0?o:!1},describedBy:{args:{type:"object",properties:{}}}});const f=[h.createNew,h.createOutputView],x=()=>{Object.values(h).filter(o=>!f.includes(o)&&r.commands.hasCommand(o)).forEach(o=>r.commands.notifyCommandChanged(o))};e.currentChanged.connect(x),(p=d.currentChanged)===null||p===void 0||p.connect(x)}function Fn(r,e){const i=e.load("jupyterlab");let a=i.__("Notebook Operations");[h.interrupt,h.restart,h.restartClear,h.restartRunAll,h.runAll,h.renderAllMarkdown,h.runAllAbove,h.runAllBelow,h.restartAndRunToSelected,h.selectAll,h.deselectAll,h.clearAllOutputs,h.toggleAllLines,h.editMode,h.commandMode,h.changeKernel,h.reconnectToKernel,h.createConsole,h.createSubshellConsole,h.closeAndShutdown,h.trust,h.toggleCollapseCmd,h.collapseAllCmd,h.expandAllCmd,h.accessPreviousHistory,h.accessNextHistory,h.virtualScrollbar].forEach(s=>{r.addItem({command:s,category:a})}),r.addItem({command:h.createNew,category:a,args:{isPalette:!0}}),a=i.__("Notebook Cell Operations"),[h.run,h.runAndAdvance,h.runAndInsert,h.runInConsole,h.clearOutputs,h.toCode,h.toMarkdown,h.toRaw,h.cut,h.copy,h.pasteBelow,h.pasteAbove,h.pasteAndReplace,h.deleteCell,h.split,h.merge,h.mergeAbove,h.mergeBelow,h.insertAbove,h.insertBelow,h.selectAbove,h.selectBelow,h.selectHeadingAboveOrCollapse,h.selectHeadingBelowOrExpand,h.insertHeadingAbove,h.insertHeadingBelow,h.extendAbove,h.extendTop,h.extendBelow,h.extendBottom,h.moveDown,h.moveUp,h.undoCellAction,h.redoCellAction,h.markdown1,h.markdown2,h.markdown3,h.markdown4,h.markdown5,h.markdown6,h.hideCode,h.showCode,h.hideAllCode,h.showAllCode,h.hideOutput,h.showOutput,h.toggleOutput,h.hideAllOutputs,h.showAllOutputs,h.toggleRenderSideBySideCurrentNotebook,h.setSideBySideRatio,h.enableOutputScrolling,h.disableOutputScrolling].forEach(s=>{r.addItem({command:s,category:a})})}function Kn(r,e){r.editMenu.undoers.redo.add({id:h.redo,isEnabled:e}),r.editMenu.undoers.undo.add({id:h.undo,isEnabled:e}),r.editMenu.clearers.clearAll.add({id:h.clearAllOutputs,isEnabled:e}),r.editMenu.clearers.clearCurrent.add({id:h.clearOutputs,isEnabled:e}),r.fileMenu.consoleCreators.add({id:h.createConsole,isEnabled:e}),r.fileMenu.closeAndCleaners.add({id:h.closeAndShutdown,isEnabled:e}),r.kernelMenu.kernelUsers.changeKernel.add({id:h.changeKernel,isEnabled:e}),r.kernelMenu.kernelUsers.clearWidget.add({id:h.clearAllOutputs,isEnabled:e}),r.kernelMenu.kernelUsers.interruptKernel.add({id:h.interrupt,isEnabled:e}),r.kernelMenu.kernelUsers.reconnectToKernel.add({id:h.reconnectToKernel,isEnabled:e}),r.kernelMenu.kernelUsers.restartKernel.add({id:h.restart,isEnabled:e}),r.kernelMenu.kernelUsers.shutdownKernel.add({id:h.shutdown,isEnabled:e}),r.viewMenu.editorViewers.toggleLineNumbers.add({id:h.toggleAllLines,isEnabled:e}),r.viewMenu.editorViewers.toggleMinimap.add({id:h.virtualScrollbar,isEnabled:()=>!0}),r.runMenu.codeRunners.restart.add({id:h.restart,isEnabled:e}),r.runMenu.codeRunners.run.add({id:h.runAndAdvance,isEnabled:e}),r.runMenu.codeRunners.runAll.add({id:h.runAll,isEnabled:e}),r.helpMenu.getKernel.add({id:h.getKernel,isEnabled:e})}var L;(function(r){function e(c,d,g,m){const b={path:d.context.path,preferredLanguage:d.context.model.defaultKernelLanguage,activate:g,subshell:m,ref:d.id,insertMode:"split-bottom",type:"Linked Console"};return c.execute("console:create",b)}r.createConsole=e;function i(c,d){return d.currentWidget!==null&&d.currentWidget===c.currentWidget}r.isEnabled=i;function a(c,d){if(!r.isEnabled(c,d))return!1;const{content:g}=d.currentWidget,m=g.activeCellIndex;for(let b=0;b<g.widgets.length;++b)if(g.isSelected(g.widgets[b])&&b!==m)return!1;return!0}r.isEnabledAndSingleSelected=a;function s(c,d){if(!r.isEnabled(c,d))return!1;const{content:g}=d.currentWidget,m=g.activeCellIndex;if(!(g.activeCell instanceof le))return!1;for(let b=0;b<g.widgets.length;++b)if(g.isSelected(g.widgets[b])&&b!==m)return!1;return!0}r.isEnabledAndHeadingSelected=s;function l(c){c=c||O;const d=c.load("jupyterlab");return{html:d.__("HTML"),latex:d.__("LaTeX"),markdown:d.__("Markdown"),pdf:d.__("PDF"),rst:d.__("ReStructured Text"),script:d.__("Executable Script"),slides:d.__("Reveal.js Slides")}}r.getFormatLabels=l;function p(c,d){const g=`sr-message-container-${d.id}`,m=document.getElementById(g)||document.createElement("div");m.getAttribute("id")!==g&&(m.classList.add("sr-only"),m.setAttribute("id",g),m.setAttribute("role","alert"),m.hidden=!0,d.appendChild(m)),m.innerText=c}r.raiseSilentNotification=p;class n extends oo{constructor(d){super(),this._cell=null;const g=(d.translator||O).load("jupyterlab");this._notebook=d.notebook,this._index=d.index!==void 0?d.index:-1,this._cell=d.cell||null,this.id=`LinkedOutputView-${no.uuid4()}`,this.title.label="Output View",this.title.icon=Ze,this.title.caption=this._notebook.title.label?g.__("For Notebook: %1",this._notebook.title.label):g.__("For Notebook:"),this.addClass("jp-LinkedOutputView"),this._notebook.context.ready.then(()=>{if(this._cell||(this._cell=this._notebook.content.widgets[this._index]),!this._cell||this._cell.model.type!=="code"){this.dispose();return}const m=this._cell.cloneOutputArea();this.addWidget(m)})}get index(){return this._cell?ie.findFirstIndex(this._notebook.content.widgets,d=>d===this._cell):this._index}get path(){return this._notebook.context.path}}r.ClonedOutputArea=n})(L||(L={}));export{gn as commandEditItem,el as default,bn as executionIndicator,mn as exportPlugin,Cn as notebookTrustItem};
|