@datalayer/agent-runtimes 1.6.39 → 1.6.40
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-Ba3DRn2p.js → AgentDetails-DC7O2VWb.js} +1 -1
- package/dist-embed/chunks/{AgentDetailsDialog-CXN0RO_L.js → AgentDetailsDialog-BTJCl-o-.js} +1 -1
- package/dist-embed/chunks/{AgentInspector-C66D0b0W.js → AgentInspector-BXqYY8g-.js} +1 -1
- package/dist-embed/chunks/{AgentInspectorDialog-DeK96QG1.js → AgentInspectorDialog-dRHZ1p73.js} +1 -1
- package/dist-embed/chunks/Avatar-Cv5OpUWu.js +1 -0
- package/dist-embed/chunks/{CellSidebarExtension-D7aXShZc.js → CellSidebarExtension-DXPIz0Km.js} +7 -7
- package/dist-embed/chunks/{ChatView-2N7PbcDs.js → ChatView-CRitAB2i.js} +4 -4
- package/dist-embed/chunks/{CollapsiblePlugin-y8sx_FL8.js → CollapsiblePlugin-BPlfrDQU.js} +1 -1
- package/dist-embed/chunks/DatalayerAgentBridge-D01Ek4NE.js +1 -0
- package/dist-embed/chunks/{DeckComponent-BnyeYRQq.js → DeckComponent-jvb83Q__.js} +1 -1
- package/dist-embed/chunks/{DocumentView-DT4DcdJI.js → DocumentView-BrdFnTVh.js} +3 -3
- package/dist-embed/chunks/{EphemeralDocument-CGISw1N3.js → EphemeralDocument-CkPQKyfy.js} +1 -1
- package/dist-embed/chunks/{EphemeralNotebook-Dyx-25uN.js → EphemeralNotebook-CiQIC3MG.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawComponent-Bl3R2Mic.js → ExcalidrawComponent-D6Cr_b0Z.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawModal-DSL5jBhG.js → ExcalidrawModal-Bso7oDbl.js} +1 -1
- package/dist-embed/chunks/{JupyterLexicalExtension-C55KdpCk.js → JupyterLexicalExtension-DuD7IV6j.js} +6 -6
- package/dist-embed/chunks/{KernelVariables-D3DSQaD3.js → KernelVariables-CXQagESp.js} +2 -2
- package/dist-embed/chunks/{NotebookSkeleton-BkzTMhIX.js → NotebookSkeleton-CvO9WylK.js} +1 -1
- package/dist-embed/chunks/{NotebookToolSurfaces-Bvj9nwA9.js → NotebookToolSurfaces-B9fkzQNR.js} +1 -1
- package/dist-embed/chunks/{NotebookToolbar-BMjQTGrr.js → NotebookToolbar-D36duUxK.js} +1 -1
- package/dist-embed/chunks/{NotebookView-DRPnBAI2.js → NotebookView-BrdHwtKH.js} +1 -1
- package/dist-embed/chunks/{Output-D-7eUege.js → Output-D9cwH5rg.js} +1 -1
- package/dist-embed/chunks/{SandboxDetailsDialog-qJBg2naH.js → SandboxDetailsDialog-BYgLjg3W.js} +1 -1
- package/dist-embed/chunks/{SchemaForm-D6BAKaNe.js → SchemaForm-B3qMIWMy.js} +1 -1
- package/dist-embed/chunks/{SheetTabs-BLaEhX0D.js → SheetTabs-BR72mzuo.js} +2 -2
- package/dist-embed/chunks/{SpreadsheetPreviewView-CaFQASZ4.js → SpreadsheetPreviewView-RA8ASTBV.js} +1 -1
- package/dist-embed/chunks/{SpreadsheetView-DesdGLpm.js → SpreadsheetView-BfScdA-X.js} +1 -1
- package/dist-embed/chunks/{Toolbar-BncUh2ly.js → Toolbar-BAjGB6b-.js} +1 -1
- package/dist-embed/chunks/{WidgetVariableView-B4faSdWW.js → WidgetVariableView-7lvDcxCg.js} +1 -1
- package/dist-embed/chunks/{YouTubePlugin-BPUrB3sh.js → YouTubePlugin-BbjCzaT_.js} +1 -1
- package/dist-embed/chunks/{ar-SA-G6X2FPQ2-Dq_tRQtR.js → ar-SA-G6X2FPQ2-D4M2b5Lr.js} +1 -1
- package/dist-embed/chunks/{az-AZ-76LH7QW2-DQAoJi9C.js → az-AZ-76LH7QW2-Rn7oINhz.js} +1 -1
- package/dist-embed/chunks/{bg-BG-XCXSNQG7-CfZUFj2_.js → bg-BG-XCXSNQG7-xztohKe7.js} +1 -1
- package/dist-embed/chunks/{bn-BD-2XOGV67Q-DiqZdhkT.js → bn-BD-2XOGV67Q-C7Ssg1_2.js} +1 -1
- package/dist-embed/chunks/{ca-ES-6MX7JW3Y-B6c2PcO9.js → ca-ES-6MX7JW3Y-Cr0zd8Z6.js} +1 -1
- package/dist-embed/chunks/{celltoolbartracker-BHSFiiuz.js → celltoolbartracker-D1C_kGQL.js} +1 -1
- package/dist-embed/chunks/{component-BUTWfiVL.js → component-CmnuUtgX.js} +3 -3
- package/dist-embed/chunks/{cs-CZ-2BRQDIVT-ha7l75va.js → cs-CZ-2BRQDIVT-G9tBUkZh.js} +1 -1
- package/dist-embed/chunks/{da-DK-5WZEPLOC-C3b8_hbR.js → da-DK-5WZEPLOC-91_vyLpq.js} +1 -1
- package/dist-embed/chunks/{de-DE-XR44H4JA-CxWFSn3l.js → de-DE-XR44H4JA-Bb9tvIZa.js} +1 -1
- package/dist-embed/chunks/{dist-BF0YFIb6.js → dist-B5YvY_O1.js} +2 -2
- package/dist-embed/chunks/{dist-DsEDq9qF.js → dist-BBqWTRLi.js} +1 -1
- package/dist-embed/chunks/{dist-DRRbvr4-.js → dist-BC_2VyAM.js} +1 -1
- package/dist-embed/chunks/{dist-B_TGJsfl.js → dist-BhfyuH1D.js} +1 -1
- package/dist-embed/chunks/{dist-Cfvz7CF7.js → dist-BlIg6ytm.js} +1 -1
- package/dist-embed/chunks/{dist-COiURBxL.js → dist-Ct-bkqXx.js} +4 -4
- package/dist-embed/chunks/{dist-tosaS6vh.js → dist-CtFgtNKe.js} +1 -1
- package/dist-embed/chunks/{dist-B1tXS8Wo.js → dist-DLyNQ3Jj.js} +1 -1
- package/dist-embed/chunks/{document-CqNE0DPx.js → document-Dp0KpIjg.js} +1 -1
- package/dist-embed/chunks/{drivecontents-D1HzL7Fi.js → drivecontents-BsC6Y2Vl.js} +1 -1
- package/dist-embed/chunks/{el-GR-BZB4AONW-iSsL6em8.js → el-GR-BZB4AONW-B5kc3JC5.js} +1 -1
- package/dist-embed/chunks/{es-ES-U4NZUMDT-BEbh9GGw.js → es-ES-U4NZUMDT-CpFB18Kf.js} +1 -1
- package/dist-embed/chunks/{esm-RWOqF6ly.js → esm-BqqxV5QL.js} +1 -1
- package/dist-embed/chunks/{eu-ES-A7QVB2H4-C7o7R9hc.js → eu-ES-A7QVB2H4-CqCALK0Q.js} +1 -1
- package/dist-embed/chunks/{fa-IR-HGAKTJCU-DQNpeHKi.js → fa-IR-HGAKTJCU-BzSY8fri.js} +1 -1
- package/dist-embed/chunks/{fi-FI-Z5N7JZ37-D083iC1R.js → fi-FI-Z5N7JZ37-DPRPVT_v.js} +1 -1
- package/dist-embed/chunks/{fr-FR-RHASNOE6-CUvaq7hG.js → fr-FR-RHASNOE6-Cr4lVSvD.js} +1 -1
- package/dist-embed/chunks/{gl-ES-HMX3MZ6V-DU31KRvC.js → gl-ES-HMX3MZ6V-CZUw7dN0.js} +1 -1
- package/dist-embed/chunks/{he-IL-6SHJWFNN-bMtU7JNY.js → he-IL-6SHJWFNN-DaU5Odek.js} +1 -1
- package/dist-embed/chunks/{hi-IN-IWLTKZ5I-Pma0rKxO.js → hi-IN-IWLTKZ5I-BZ84Rooc.js} +1 -1
- package/dist-embed/chunks/{htmlselect-CqXICb9e.js → htmlselect-5N6NdDqL.js} +1 -1
- package/dist-embed/chunks/{hu-HU-A5ZG7DT2-Dof3afSc.js → hu-HU-A5ZG7DT2-SZiCSe0B.js} +1 -1
- package/dist-embed/chunks/{id-ID-SAP4L64H-ZwqZHBDj.js → id-ID-SAP4L64H-DrRa3vVi.js} +1 -1
- package/dist-embed/chunks/{index-9EhrHHj7.js → index-B6-uQd5L.js} +3 -3
- package/dist-embed/chunks/{index-9wJFadG-.js → index-CEeyR3FZ.js} +1 -1
- package/dist-embed/chunks/{index-CqP3xLL5.js → index-CKWSKbHe.js} +1 -1
- package/dist-embed/chunks/{index-BbcMy3Al.js → index-DpN8KK6c.js} +1 -1
- package/dist-embed/chunks/{index--S8WFITA.js → index-JmqWOkdt.js} +1 -1
- package/dist-embed/chunks/{index-CMhceBby.js → index-PKH5uAl-.js} +1 -1
- package/dist-embed/chunks/{index-C7UsrKrP.js → index-hhftmReh.js} +1 -1
- package/dist-embed/chunks/{index-6zxBQeM_.js → index-qhxI1VzX.js} +2 -2
- package/dist-embed/chunks/{index.esm-xgVG4GIx.js → index.esm-Bvtnemp7.js} +1 -1
- package/dist-embed/chunks/{it-IT-JPQ66NNP-C-uM6NhO.js → it-IT-JPQ66NNP-_TEhDIcF.js} +1 -1
- package/dist-embed/chunks/{ja-JP-DBVTYXUO-qzihtLnX.js → ja-JP-DBVTYXUO-IJaTVgTb.js} +1 -1
- package/dist-embed/chunks/{kaa-6HZHGXH3-Amx_Jfx0.js → kaa-6HZHGXH3-CTksAiLJ.js} +1 -1
- package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-BPZfDYRT.js → kab-KAB-ZGHBKWFO-DbA7aOfU.js} +1 -1
- package/dist-embed/chunks/{kk-KZ-P5N5QNE5-B83bJ3Yw.js → kk-KZ-P5N5QNE5-Bdzg30AB.js} +1 -1
- package/dist-embed/chunks/{km-KH-HSX4SM5Z-BvPDwBVw.js → km-KH-HSX4SM5Z-Bwn2NP1-.js} +1 -1
- package/dist-embed/chunks/{ko-KR-MTYHY66A-jpQ_OpzG.js → ko-KR-MTYHY66A-KUaxlo0q.js} +1 -1
- package/dist-embed/chunks/{ku-TR-6OUDTVRD-RsfwTm7i.js → ku-TR-6OUDTVRD-DRegsFXo.js} +1 -1
- package/dist-embed/chunks/{lib-CFx15o08.js → lib--J3JPp2K.js} +1 -1
- package/dist-embed/chunks/{lib-D6X8UF4a.js → lib-9S57siQD.js} +1 -1
- package/dist-embed/chunks/{lib-CoK70EWs.js → lib-BpltV-0Y.js} +1 -1
- package/dist-embed/chunks/{lib-DGhrI5Uw.js → lib-C2mgrsS1.js} +1 -1
- package/dist-embed/chunks/{lib-XSPvEMl2.js → lib-C46CpvHb.js} +1 -1
- package/dist-embed/chunks/{lib-D0Q8IWel.js → lib-CHID83aM.js} +1 -1
- package/dist-embed/chunks/{lib-Pqxz_81N.js → lib-COJY2oKd.js} +25 -25
- package/dist-embed/chunks/{lib-p7v7zGkv.js → lib-CQeoQJWp.js} +1 -1
- package/dist-embed/chunks/{lib-CdtiDxdA.js → lib-CjBEbEzm.js} +1 -1
- package/dist-embed/chunks/{lib-BBnVlTAj.js → lib-Cpc8Fspj.js} +1 -1
- package/dist-embed/chunks/{lib-CsiCQ8oM.js → lib-D7CvuX1J.js} +1 -1
- package/dist-embed/chunks/{lib-7ge2Kma3.js → lib-DOnguzJf.js} +1 -1
- package/dist-embed/chunks/{lib-UYAFV0Oh.js → lib-Dh9o1esj.js} +1 -1
- package/dist-embed/chunks/{lib-DdeRC7g0.js → lib-DrEcjKb5.js} +1 -1
- package/dist-embed/chunks/{lib-Dj12Ge-1.js → lib-PbTUB5SW.js} +1 -1
- package/dist-embed/chunks/{lib-DMy40SOL.js → lib-QmOij8gS.js} +1 -1
- package/dist-embed/chunks/{lib-C7Y61LM1.js → lib-csBGF1d0.js} +1 -1
- package/dist-embed/chunks/{lib-DTyx2eLX.js → lib-op0DTswa.js} +1 -1
- package/dist-embed/chunks/{lib-CkcilPdy.js → lib-ox3VOLDA.js} +1 -1
- package/dist-embed/chunks/{lib-Bi95m_cb.js → lib-rn9DpcHi.js} +1 -1
- package/dist-embed/chunks/{lt-LT-XHIRWOB4-qZ_KjUTQ.js → lt-LT-XHIRWOB4-c6CdaS7u.js} +1 -1
- package/dist-embed/chunks/{lv-LV-5QDEKY6T-BOKJbljG.js → lv-LV-5QDEKY6T-D9RognOk.js} +1 -1
- package/dist-embed/chunks/{model-C2VRzh1c.js → model-DbDJZyri.js} +1 -1
- package/dist-embed/chunks/{mr-IN-CRQNXWMA-xba6p6AI.js → mr-IN-CRQNXWMA-ht3P_mrN.js} +1 -1
- package/dist-embed/chunks/{my-MM-5M5IBNSE-B_H0GaRX.js → my-MM-5M5IBNSE-CsIkhWRp.js} +1 -1
- package/dist-embed/chunks/{nb-NO-T6EIAALU-Ddg4NpHf.js → nb-NO-T6EIAALU-DJw7Uvbx.js} +1 -1
- package/dist-embed/chunks/{nl-NL-IS3SIHDZ-DS_Sofox.js → nl-NL-IS3SIHDZ-Dcrp-zwB.js} +1 -1
- package/dist-embed/chunks/{nn-NO-6E72VCQL-CYSB6TTi.js → nn-NO-6E72VCQL-DaBAIbM9.js} +1 -1
- package/dist-embed/chunks/{oc-FR-POXYY2M6-QrIn4XvF.js → oc-FR-POXYY2M6-DSdMEDCa.js} +1 -1
- package/dist-embed/chunks/{pa-IN-N4M65BXN-BbacRfk_.js → pa-IN-N4M65BXN-BMyPito1.js} +1 -1
- package/dist-embed/chunks/{percentages-BXMCSKIN-TyKhSuec.js → percentages-BXMCSKIN-pswfKMt2.js} +3 -3
- package/dist-embed/chunks/{pl-PL-T2D74RX3-Cn2ehrU4.js → pl-PL-T2D74RX3-CFk8rHgP.js} +1 -1
- package/dist-embed/chunks/{plugin-CPCdQWpK.js → plugin-BpyrQiv7.js} +1 -1
- package/dist-embed/chunks/{plugin-D7Giq2rW.js → plugin-NcgdmcAO.js} +1 -1
- package/dist-embed/chunks/{plugin-AdqytlNC.js → plugin-omHCT1Jk.js} +1 -1
- package/dist-embed/chunks/{pt-BR-5N22H2LF-CpNtiBPh.js → pt-BR-5N22H2LF-BYlDcalT.js} +1 -1
- package/dist-embed/chunks/{pt-PT-UZXXM6DQ-CcDR3Igq.js → pt-PT-UZXXM6DQ-xXdoFOOb.js} +1 -1
- package/dist-embed/chunks/{pyodide-kernel-CN7B4QLg.js → pyodide-kernel-bjLdubpe.js} +1 -1
- package/dist-embed/chunks/{pyodide-kernel-extension-CKE5jq9F.js → pyodide-kernel-extension-CshyO6Mm.js} +1 -1
- package/dist-embed/chunks/{renderer-8__rsP1H.js → renderer-We9CyR7b.js} +1 -1
- package/dist-embed/chunks/{ro-RO-JPDTUUEW-CANXxss1.js → ro-RO-JPDTUUEW-e-URCww-.js} +1 -1
- package/dist-embed/chunks/{ru-RU-B4JR7IUQ-B_NkKbWo.js → ru-RU-B4JR7IUQ-CrXBOpZl.js} +1 -1
- package/dist-embed/chunks/{server-extension-BvlUJPbJ.js → server-extension-D9R-wwz5.js} +1 -1
- package/dist-embed/chunks/{sessions-CgjtuOSm.js → sessions-DdXtI_C1.js} +1 -1
- package/dist-embed/chunks/{si-LK-N5RQ5JYF-Da_Bg8Mv.js → si-LK-N5RQ5JYF-DmJK04-A.js} +1 -1
- package/dist-embed/chunks/{sk-SK-C5VTKIMK-BKs6l_DT.js → sk-SK-C5VTKIMK-BDHycW1Q.js} +1 -1
- package/dist-embed/chunks/{sl-SI-NN7IZMDC-C4TvSXZU.js → sl-SI-NN7IZMDC-Bv9ZQTNb.js} +1 -1
- package/dist-embed/chunks/{subset-shared.chunk-BZGTZU2h.js → subset-shared.chunk-B0WCMaCa.js} +1 -1
- package/dist-embed/chunks/{subset-worker.chunk-CNJFtQV7.js → subset-worker.chunk-i0SNRqXr.js} +1 -1
- package/dist-embed/chunks/{sv-SE-XGPEYMSR-DdKzikID.js → sv-SE-XGPEYMSR-_HPzcZFc.js} +1 -1
- package/dist-embed/chunks/{ta-IN-2NMHFXQM-CDzGLNXS.js → ta-IN-2NMHFXQM-Ccvi-lqm.js} +1 -1
- package/dist-embed/chunks/{th-TH-HPSO5L25-X4BJ7awj.js → th-TH-HPSO5L25-DvAg4Mv1.js} +1 -1
- package/dist-embed/chunks/{tokens-CBhRbpQP.js → tokens-CTXFWLvM.js} +1 -1
- package/dist-embed/chunks/{tr-TR-DEFEU3FU-CN69_6_H.js → tr-TR-DEFEU3FU-DJsjfrja.js} +1 -1
- package/dist-embed/chunks/{uk-UA-QMV73CPH-KjB2cySI.js → uk-UA-QMV73CPH-3fvexlQA.js} +1 -1
- package/dist-embed/chunks/{usePrimerThemeBridge-DyX4EYyN.js → usePrimerThemeBridge-NsTRGuo7.js} +1 -1
- package/dist-embed/chunks/{vi-VN-M7AON7JQ-BqVSbGWG.js → vi-VN-M7AON7JQ-BoQ3ayAr.js} +1 -1
- package/dist-embed/chunks/{zh-CN-LNUGB5OW-oRPI4tbl.js → zh-CN-LNUGB5OW-Dzh0Ni_q.js} +1 -1
- package/dist-embed/chunks/{zh-HK-E62DVLB3-BUlz3y0i.js → zh-HK-E62DVLB3-_1FpSc_d.js} +1 -1
- package/dist-embed/chunks/{zh-TW-RAJ6MFWO-NxjUwhr3.js → zh-TW-RAJ6MFWO-CU-R8eF0.js} +1 -1
- package/dist-embed/datalayer-app-main.js +18 -18
- package/lib/apps/apps/AppRenderer.d.ts +6 -0
- package/lib/apps/apps/AppRenderer.js +3 -0
- package/lib/apps/plugins/agents/appLaunch.js +12 -0
- package/lib/hooks/useAgentRuntimes.d.ts +1 -1
- package/lib/hooks/useAgentRuntimes.js +2 -0
- package/lib/runtimes/actions.js +6 -0
- package/lib/runtimes/apis.d.ts +8 -0
- package/lib/specs/agents/agents.js +1 -1
- package/lib/types/agents-lifecycle.d.ts +7 -0
- package/lib/types/agentspecs.d.ts +9 -4
- package/lib/types/agentspecs.js +7 -1
- package/package.json +1 -1
- package/dist-embed/chunks/Avatar-MNx1kN3F.js +0 -1
- package/dist-embed/chunks/DatalayerAgentBridge-BuGt8vDu.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aA as Ve,gi as Ue,dZ as Ke,fO as $e,aw as ye,bg as qe,gj as ee,gk as He,
|
|
1
|
+
import{aA as Ve,gi as Ue,dZ as Ke,fO as $e,aw as ye,bg as qe,gj as ee,gk as He,cq as Ie,gl as De,ci as Ee,ax as Qe,aD as Q,J as ue,ce as Ne,gm as Xe,gn as Ge,dY as Ye,dX as Je,_ as Ze,go as et,gp as tt,gq as ot,cd as q,dO as Te,cj as nt,dN as Me,gr as it,gs as rt,dK as at,dE as he,dG as dt,dL as st,gt as lt,dv as fe,cr as We,aC as ne,et as Le,e0 as ct,eB as ut,aG as pt,eJ as gt,dB as Se,gu as mt}from"../datalayer-app-main.js";import{I as Pe,b as Be,a as ht}from"./token-d9po19EN.js";import{T as Ae,I as ft,b as yt,g as vt,a as _t}from"./index-JmqWOkdt.js";import{I as je}from"./tokens-Dyd4wiX6.js";import{p as bt,c as Ct,f as wt,b as xt,q as Tt,M as Mt}from"./index-B6-uQd5L.js";import{s as Fe}from"./hover-B3uFmZ-0.js";import{I as ve}from"./tokens-DY_UrMLq.js";import{I as St}from"./tokens-DbNnxPrX.js";import{I as kt}from"./tokens-D1WVYIDT.js";import{I as It}from"./tokens-B7nNzQEE.js";import{a as Et}from"./tokens-BYcJtuKD.js";import{I as Nt}from"./index-qhxI1VzX.js";import{W as Wt,V as Lt,I as Pt,a as Bt,b as At,c as jt}from"./document-Dp0KpIjg.js";import{I as Ft}from"./tokens-BcAeNU3z.js";import{g as ke}from"./kernelfilestypes-D2B-sFfi.js";import{T as Ot,a as _e}from"./model-DbDJZyri.js";import"./hoverbox-CStlKQWE.js";import"./Output-D9cwH5rg.js";import"./index-CEeyR3FZ.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-BYxXubsX.js";import"./d3-color-Jd8hXty2.js";import"./dist-BrUAt6vF.js";import"./KebabHorizontalIcon-D6AY8pIS.js";import"./PaintbrushIcon-CFBHU-3l.js";import"./index-CKWSKbHe.js";import"./RestartIcon-DvpOf5Mf.js";import"./CellSidebarExtension-DXPIz0Km.js";import"./NotebookSkeleton-CvO9WylK.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-We9CyR7b.js";import"./SquareIcon-Dy3l3VdH.js";import"./FileDirectoryOpenFillIcon-jGhuRcP3.js";import"./url-C6fJII94.js";/* empty css *//* empty css */import"./style-DdAxk_bj.js";/* empty css */import"./style-Cj1gzCjo.js";/* empty css */import"./style-rkw8dR9f.js";import"./style-GHJFdtIz.js";import"./style-ZSIOeMoX.js";import"./style-iVfD6mFL.js";import"./style-DA-Ya7rp.js";import"./style-D3tvWcFO.js";import"./style-BOqStzF9.js";import"./style-ADLQJ-E9.js";import"./style-DgglluaK.js";import"./ArrowLeftIcon-sX3iNMG1.js";import"./SkubbleIcon-CAaVh_BE.js";import"./usePrimerThemeBridge-NsTRGuo7.js";import"./index-DpN8KK6c.js";import"./KernelVariables-CXQagESp.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-D36duUxK.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-BAjGB6b-.js";import"./sessions-DdXtI_C1.js";import"./tokens-CTXFWLvM.js";import"./drivecontents-BsC6Y2Vl.js";import"./kernel-BmfZmtIo.js";class be extends Ve{constructor(o){var d;super(),this.model=o.model;const u=new Ue({factory:o.factory,model:this.model,editorOptions:{...o.editorOptions,config:{...(d=o.editorOptions)===null||d===void 0?void 0:d.config,readOnly:!0}}});this.editor=u.editor,(this.layout=new Ke).addWidget(u)}static createCodeViewer(o){const{content:d,mimeType:u,...m}=o,h=new $e.Model({mimeType:u});h.sharedModel.setSource(d);const f=new be({...m,model:h});return f.disposed.connect(()=>{h.dispose()}),f}get content(){return this.model.sharedModel.getSource()}get mimeType(){return this.model.mimeType}}const zt=new ye("@jupyterlab/console:IConsoleTracker",`A widget tracker for code consoles.
|
|
2
2
|
Use this if you want to be able to iterate over and interact with code consoles
|
|
3
3
|
created by the application.`);class Rt extends Wt{constructor(o,d){const{docRegistry:u,...m}=d;super(o,m),this._readyDelegate=new qe,this.editor=o.content,this._docRegistry=u,this._virtualEditor=Object.freeze({getEditor:()=>this.editor.editor,ready:()=>Promise.resolve(this.editor.editor),reveal:()=>Promise.resolve(this.editor.editor)}),Promise.all([this.editor.context.ready,this.connectionManager.ready]).then(async()=>{await this.initOnceReady(),this._readyDelegate.resolve(),this._editorAdded.emit({editor:this._virtualEditor})}).catch(console.error)}get ready(){return this._readyDelegate.promise}get documentPath(){return this.widget.context.path}get mimeType(){var o;const d=this.editor.model.mimeType,u=Array.isArray(d)?(o=d[0])!==null&&o!==void 0?o:ee.defaultMimeType:d,m=this.editor.context.contentsModel;return u!=ee.defaultMimeType?u:m?this._docRegistry.getFileTypeForModel(m).mimeTypes[0]:u}get languageFileExtension(){let o=this.documentPath.split(".");return o[o.length-1]}get ceEditor(){return this.editor.editor}get activeEditor(){return this._virtualEditor}get wrapperElement(){return this.widget.node}get path(){return this.widget.context.path}get editors(){var o,d;return[{ceEditor:this._virtualEditor,type:"code",value:(d=(o=this.editor)===null||o===void 0?void 0:o.model.sharedModel.getSource())!==null&&d!==void 0?d:""}]}dispose(){this.isDisposed||(this._editorRemoved.emit({editor:this._virtualEditor}),this.editor.model.mimeTypeChanged.disconnect(this.reloadConnection),super.dispose())}createVirtualDocument(){return new Lt({language:this.language,foreignCodeExtractors:this.options.foreignCodeExtractorsManager,path:this.documentPath,fileExtension:this.languageFileExtension,standalone:!0,hasLspSupportedFile:!0})}getEditorIndexAt(o){return 0}getEditorIndex(o){return 0}getEditorWrapper(o){return this.wrapperElement}async initOnceReady(){this.initVirtual(),await this.connectDocument(this.virtualDocument,!1),this.editor.model.mimeTypeChanged.connect(this.reloadConnection,this)}}class Ce extends He{constructor(o){super(),this.widget=o,this._searchActive=!1}get isReadOnly(){return this.editor.getOption("readOnly")}get replaceOptionsSupport(){return{preserveCase:!0}}get editor(){return this.widget.content.editor}get model(){return this.widget.content.model}async startQuery(o,d){this._searchActive=!0,await super.startQuery(o,d),await this.highlightNext(!0,{from:"selection-start",scroll:!1,select:!1})}async endQuery(){this._searchActive=!1,await super.endQuery()}async onSharedModelChanged(o,d){if(this._searchActive)return super.onSharedModelChanged(o,d)}static createNew(o,d){return new Ce(o)}static isApplicable(o){return o instanceof Ie&&o.content instanceof bt&&o.content.editor instanceof De}getInitialQuery(){const o=this.editor;return o.state.sliceDoc(o.state.selection.main.from,o.state.selection.main.to)}}function Vt(r){return ue.createElement(Ae,{role:"button","aria-haspopup":!0,tabIndex:0,source:r.language,onClick:r.handleClick,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&r.handleClick()}})}class te extends Ee{constructor(o){var d;super(new te.Model(o.languages)),this._handleClick=()=>{const m=new Qe({commands:this._commands}),h="fileeditor:change-language";this._popup&&this._popup.dispose(),this.model.languages.getLanguages().sort((f,y)=>{var w,M;const x=(w=f.displayName)!==null&&w!==void 0?w:f.name,I=(M=y.displayName)!==null&&M!==void 0?M:y.name;return x.localeCompare(I)}).forEach(f=>{var y;if(f.name.toLowerCase().indexOf("brainf")===0)return;const w={name:f.name,displayName:(y=f.displayName)!==null&&y!==void 0?y:f.name};m.addItem({command:h,args:w})}),this._popup=Fe({body:m,anchor:this,align:"left"})},this._popup=null,this._commands=o.commands,this.translator=(d=o.translator)!==null&&d!==void 0?d:Q;const u=this.translator.load("jupyterlab");this.addClass("jp-mod-highlighted"),this.title.caption=u.__("Change text editor syntax highlighting")}render(){return this.model?ue.createElement(Vt,{language:this.model.language,handleClick:this._handleClick}):null}}(function(r){class o extends Ne{constructor(u){super(),this.languages=u,this._onMIMETypeChange=(m,h)=>{var f;const y=this._language,w=this.languages.findByMIME(h.newValue);this._language=(f=w?.name)!==null&&f!==void 0?f:ee.defaultMimeType,this._triggerChange(y,this._language)},this._language="",this._editor=null}get language(){return this._language}get editor(){return this._editor}set editor(u){var m;const h=this._editor;h!==null&&h.model.mimeTypeChanged.disconnect(this._onMIMETypeChange);const f=this._language;if(this._editor=u,this._editor===null)this._language="";else{const y=this.languages.findByMIME(this._editor.model.mimeType);this._language=(m=y?.name)!==null&&m!==void 0?m:ee.defaultMimeType,this._editor.model.mimeTypeChanged.connect(this._onMIMETypeChange)}this._triggerChange(f,this._language)}_triggerChange(u,m){u!==m&&this.stateChanged.emit(void 0)}}r.Model=o})(te||(te={}));function Ut(r){const d=(r.translator||Q).load("jupyterlab"),u=typeof r.tabSpace=="number"?d.__("Spaces"):d.__("Tab Indent");return ue.createElement(Ae,{role:"button","aria-haspopup":!0,tabIndex:0,onClick:r.handleClick,onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&r.handleClick()},source:typeof r.tabSpace=="number"?`${u}: ${r.tabSpace}`:u,title:d.__("Change the indentation…")})}class oe extends Ee{constructor(o){super(new oe.Model),this._popup=null,this._menu=o.menu,this.translator=o.translator||Q,this.addClass("jp-mod-highlighted")}render(){var o;if(!((o=this.model)===null||o===void 0)&&o.indentUnit){const d=this.model.indentUnit==="Tab"?null:parseInt(this.model.indentUnit,10);return ue.createElement(Ut,{tabSpace:d,handleClick:()=>this._handleClick(),translator:this.translator})}else return null}_handleClick(){const o=this._menu;this._popup&&this._popup.dispose(),o.aboutToClose.connect(this._menuClosed,this),this._popup=Fe({body:o,anchor:this,align:"right"}),o.update()}_menuClosed(){this.removeClass("jp-mod-clicked")}}(function(r){class o extends Ne{get indentUnit(){return this._indentUnit}set indentUnit(u){u!==this._indentUnit&&(this._indentUnit=u,this.stateChanged.emit())}}r.Model=o})(oe||(oe={}));class we extends Ot{createNew(o,d){const u=super.createNew(o,d),m=(h,f)=>{f&&o.content.editor.setCursorPosition({line:f.line,column:0})};return u.activeHeadingChanged.connect(m),o.disposed.connect(()=>{u.activeHeadingChanged.disconnect(m)}),u}}const Kt={part:1,chapter:1,section:1,subsection:2,subsubsection:3,paragraph:4,subparagraph:5},$t=/^\s*\\(section|subsection|subsubsection)\{(.+)\}/;class qt extends _e{get documentType(){return"latex"}get supportedOptions(){return["maximalDepth","numberHeaders"]}getHeadings(){if(!this.isActive)return Promise.resolve(null);const o=this.widget.content.model.sharedModel.getSource().split(`
|
|
4
4
|
`),d=new Array;let u=d.length;const m=new Array;for(let h=0;h<o.length;h++){const f=o[h].match($t);if(f){const y=Kt[f[1]];if(y<=this.configuration.maximalDepth){const w=Xe(y,u,d,{...this.configuration,baseNumbering:1,numberingH1:!0});u=y,m.push({text:f[2],prefix:w,level:y,line:h})}}}return Promise.resolve(m)}}class Ht extends we{isApplicable(o){var d,u;if(super.isApplicable(o)){let h=(u=(d=o.content)===null||d===void 0?void 0:d.model)===null||u===void 0?void 0:u.mimeType;return h&&(h==="text/x-latex"||h==="text/x-stex")}return!1}_createNew(o,d){return new qt(o,d)}}class Dt extends _e{constructor(o,d,u=null){super(o,d),this.widget=o,this.parser=u}get documentType(){return"markdown"}async getHeadings(){if(!this.isActive)return Promise.resolve(null);const o=this.widget.content.model.sharedModel.getSource();return Ye(await Je(o,this.parser),{...this.configuration,numberHeaders:!1})}}class Qt extends we{constructor(o,d=null){super(o),this.parser=d}isApplicable(o){var d,u;if(super.isApplicable(o)){let h=(u=(d=o.content)===null||d===void 0?void 0:d.model)===null||u===void 0?void 0:u.mimeType;return h&&Ge(h)}return!1}_createNew(o,d){return new Dt(o,d,this.parser)}}let Z;try{Z=new RegExp("^\\s*(class |def |async def |from |import )","d")}catch{Z=new RegExp("^\\s*(class |def |async def |from |import )")}class Xt extends _e{get documentType(){return"python"}async getHeadings(){if(!this.isActive)return Promise.resolve(null);const o=this.widget.content.model.sharedModel.getSource().split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{T as De,q as he,t as ht,r as ce,b as $e,g as Je,I as pt,k as gt,a as ze,f as Ge,C as Re,h as Ie}from"./index--S8WFITA.js";import{J as M,aA as ee,cn as ie,aD as R,gr as mt,eG as Ct,fO as bt,cp as me,aJ as Te,ee as ft,cr as vt,ef as _t,cl as Ce,iq as yt,r as J,eM as xt,ii as wt,eK as kt,dz as Z,cv as St,ir as v,dK as Ye,dG as Xe,dL as Qe,fM as Ze,fN as et,eJ as Be,aI as At,aE as tt,aF as ke,is as Mt,it as Tt,ik as Bt,k as Y,bg as Et,gj as Nt,a9 as Ot,aB as be,gw as G,iu as ge,az as le,iv as xe,iw as Q,eD as Pe,ix as jt,iy as Rt,dU as we,dW as It,dY as Le,iz as We,dV as Pt,iA as Lt,iB as Wt,aw as ot,iC as Ht,iD as Ft,eI as Kt,iE as Vt,aC as F,et as fe,iF as Se,du as Ut,eB as qt,e0 as Dt,iG as $t,iH as se,iI as nt,ck as pe,dw as Jt,aG as zt,dB as Gt,cx as Yt,gu as Xt,iJ as Qt,dP as Zt,dS as eo,iK as to,dE as oo,iL as no,iM as io,ea as lo,eb as so,dv as ro,bf as ao,fh as co}from"../datalayer-app-main.js";import{b as uo,I as it}from"./token-d9po19EN.js";import{ToolbarItems as ho}from"./lib-Dj12Ge-1.js";import{I as po}from"./index-CMhceBby.js";import{I as ve}from"./tokens-Dyd4wiX6.js";import{a as lt,I as L,b as st,c as go}from"./tokens-DiDi0Nkm.js";import{I as mo,a as rt}from"./tokens-DbNnxPrX.js";import{I as Co}from"./tokens-D1WVYIDT.js";import{f as at,e as bo,c as fo,I as vo,b as _o}from"./index-9EhrHHj7.js";import{I as dt}from"./tokens-B7nNzQEE.js";import{I as _e}from"./tokens-DY_UrMLq.js";import{a as Ee}from"./tokens-BYcJtuKD.js";import{I as yo}from"./tokens-Nkg3e_k9.js";import{I as xo}from"./index-6zxBQeM_.js";import{I as wo}from"./tokens-BcAeNU3z.js";import{W as ko,u as He,V as So,I as Ao,a as Mo,b as To,c as Bo}from"./document-CqNE0DPx.js";import{s as Eo}from"./hover-B3uFmZ-0.js";import{b as No,c as Oo,d as jo}from"./CellSidebarExtension-D7aXShZc.js";import{H as Ro}from"./htmlselect-CqXICb9e.js";import{T as Io,a as Po}from"./model-C2VRzh1c.js";import{C as Fe}from"./celltoolbartracker-BHSFiiuz.js";import"./hoverbox-CStlKQWE.js";import"./Output-D-7eUege.js";import"./index-9wJFadG-.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-BYxXubsX.js";import"./d3-color-Jd8hXty2.js";import"./dist-BrUAt6vF.js";import"./KebabHorizontalIcon-D6AY8pIS.js";import"./PaintbrushIcon-CFBHU-3l.js";import"./index-CqP3xLL5.js";import"./RestartIcon-DvpOf5Mf.js";import"./NotebookSkeleton-BkzTMhIX.js";import"./Avatar-MNx1kN3F.js";import"./renderer-8__rsP1H.js";import"./SquareIcon-Dy3l3VdH.js";import"./FileDirectoryOpenFillIcon-jGhuRcP3.js";import"./url-C6fJII94.js";/* empty css *//* empty css */import"./style-DdAxk_bj.js";/* empty css */import"./style-Cj1gzCjo.js";/* empty css */import"./style-rkw8dR9f.js";import"./style-GHJFdtIz.js";import"./style-ZSIOeMoX.js";import"./style-iVfD6mFL.js";import"./style-DA-Ya7rp.js";import"./style-D3tvWcFO.js";import"./style-BOqStzF9.js";import"./style-ADLQJ-E9.js";import"./style-DgglluaK.js";import"./ArrowLeftIcon-sX3iNMG1.js";import"./SkubbleIcon-CAaVh_BE.js";import"./usePrimerThemeBridge-DyX4EYyN.js";import"./index-BbcMy3Al.js";import"./KernelVariables-D3DSQaD3.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-BMjQTGrr.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-BncUh2ly.js";import"./sessions-CgjtuOSm.js";import"./tokens-CBhRbpQP.js";import"./drivecontents-D1HzL7Fi.js";import"./kernel-BmfZmtIo.js";function Lo(r){const n=s=>{const a=Math.max(s*3.6,.1),l=a*Math.PI/180,p=Math.sin(l)*104,i=Math.cos(l)*-104;return"M 0 0 v -104 A 104 104 1 "+(a<180?1:0)+" 0 "+p.toFixed(4)+" "+i.toFixed(4)+" z"};return M.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},M.createElement("svg",{viewBox:"0 0 250 250"},M.createElement("circle",{cx:"125",cy:"125",r:"104",stroke:"var(--jp-inverse-layout-color3)",strokeWidth:"20",fill:"none"}),M.createElement("path",{className:"jp-Statusbar-ProgressCirclePath",transform:"translate(125,125) scale(.9)",d:n(r.progress),fill:"var(--jp-inverse-layout-color3)"})))}const Wo="jp-JSONEditor",ue="jp-mod-error",Ho="jp-JSONEditor-host",Fo="jp-JSONEditor-header";class Ko extends ee{constructor(e){super(),this._dataDirty=!1,this._inputDirty=!1,this._source=null,this._originalValue=ie.emptyObject,this._changeGuard=!1,this.translator=e.translator||R,this._trans=this.translator.load("jupyterlab"),this.addClass(Wo),this.headerNode=document.createElement("div"),this.headerNode.className=Fo,this.revertButtonNode=mt.element({tag:"span",title:this._trans.__("Revert changes to data")}),this.commitButtonNode=Ct.element({tag:"span",title:this._trans.__("Commit changes to data"),marginLeft:"8px"}),this.editorHostNode=document.createElement("div"),this.editorHostNode.className=Ho,this.headerNode.appendChild(this.revertButtonNode),this.headerNode.appendChild(this.commitButtonNode),this.node.appendChild(this.headerNode),this.node.appendChild(this.editorHostNode);const n=new bt.Model({mimeType:"application/json"});n.sharedModel.changed.connect(this._onModelChanged,this),this.model=n,this.editor=e.editorFactory({host:this.editorHostNode,model:n,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 n=this.editorHostNode;n.addEventListener("blur",this,!0),n.addEventListener("click",this,!0),this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.headerNode.addEventListener("click",this)}onBeforeDetach(e){const n=this.editorHostNode;n.removeEventListener("blur",this,!0),n.removeEventListener("click",this,!0),this.headerNode.removeEventListener("click",this)}_onSourceChanged(e,n){if(!this._changeGuard){if(this._inputDirty||this.editor.hasFocus()){this._dataDirty=!0;return}this._setValue()}}_onModelChanged(e,n){if(n.sourceChange){let s=!0;try{const a=JSON.parse(this.editor.model.sharedModel.getSource());this.removeClass(ue),this._inputDirty=!this._changeGuard&&!ie.deepEqual(a,this._originalValue)}catch{this.addClass(ue),this._inputDirty=!0,s=!1}this.revertButtonNode.hidden=!this._inputDirty,this.commitButtonNode.hidden=!s||!this._inputDirty}}_evtBlur(e){!this._inputDirty&&this._dataDirty&&this._setValue()}_evtClick(e){const n=e.target;this.revertButtonNode.contains(n)?this._setValue():this.commitButtonNode.contains(n)?!this.commitButtonNode.hidden&&!this.hasClass(ue)&&(this._changeGuard=!0,this._mergeContent(),this._changeGuard=!1,this._setValue()):this.editorHostNode.contains(n)&&this.editor.focus()}_mergeContent(){const e=this.editor.model,n=this._originalValue,s=JSON.parse(e.sharedModel.getSource()),a=this.source;if(a){for(const l in s)ie.deepEqual(s[l],n[l]||null)||a.set(l,s[l]);for(const l in n)l in s||a.delete(l)}}_setValue(){this._dataDirty=!1,this._inputDirty=!1,this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.removeClass(ue);const e=this.editor.model,n=this._source?this._source.toJSON():{};if(this._changeGuard=!0,n===void 0)e.sharedModel.setSource(this._trans.__("No data!")),this._originalValue=ie.emptyObject;else{const s=JSON.stringify(n,null,4);e.sharedModel.setSource(s),this._originalValue=n,s.length>1&&s[0]==="{"&&this.editor.setCursorPosition({line:0,column:1})}this._changeGuard=!1,this.commitButtonNode.hidden=!0,this.revertButtonNode.hidden=!0}}class Vo extends M.Component{constructor(e){super(e),this._handleChange=s=>{this.setState({value:s.currentTarget.value})},this._handleSubmit=s=>{var a,l;s.preventDefault();const p=parseInt((l=(a=this._textInput)===null||a===void 0?void 0:a.value)!==null&&l!==void 0?l:"",10);return!isNaN(p)&&isFinite(p)&&1<=p&&p<=this.props.maxCell&&this.props.handleSubmit(p),!1},this._handleFocus=()=>{this.setState({hasFocus:!0})},this._handleBlur=()=>{this.setState({hasFocus:!1})},this._textInput=null;const n=e.translator||R;this._trans=n.load("jupyterlab"),this.state={value:"",hasFocus:!1,textInputId:ft.createDomID()+"-cell-number-input"}}componentDidMount(){var e;(e=this._textInput)===null||e===void 0||e.focus()}render(){return M.createElement("div",{className:"jp-lineFormSearch"},M.createElement("form",{name:"cellNumberForm",onSubmit:this._handleSubmit,noValidate:!0},M.createElement("div",{className:vt("jp-lineFormWrapper","lm-lineForm-wrapper",this.state.hasFocus?"jp-lineFormWrapperFocusWithin":void 0)},M.createElement("input",{type:"number",id:this.state.textInputId,className:"jp-lineFormInput",min:1,max:this.props.maxCell,onChange:this._handleChange,onFocus:this._handleFocus,onBlur:this._handleBlur,value:this.state.value,ref:e=>{this._textInput=e}}),M.createElement("div",{className:"jp-baseLineForm jp-lineFormButtonContainer"},M.createElement(_t.react,{className:"jp-baseLineForm jp-lineFormButtonIcon",elementPosition:"center"}),M.createElement("input",{type:"submit",className:"jp-baseLineForm jp-lineFormButton",value:""}))),M.createElement("label",{className:"jp-lineFormCaption",htmlFor:this.state.textInputId},this._trans.__("Go to cell number between 1 and %1",this.props.maxCell))))}}function Uo(r){const n=(r.translator||R).load("jupyterlab"),s=r.selectionStart>0&&r.selectionStart!==r.selectionEnd?n.__("%1:%2/%3",r.selectionStart,r.selectionEnd,r.totalCells):n.__("Cell %1/%2",r.activeCell,r.totalCells),a=l=>{(l.key==="Enter"||l.key==="Spacebar"||l.key===" ")&&(l.preventDefault(),l.stopPropagation(),r.handleClick())};return M.createElement(De,{role:"button","aria-haspopup":!0,onClick:r.handleClick,source:s,title:n.__("Go to cell…"),tabIndex:0,onKeyDown:a})}class re extends me{constructor(e={}){super(new re.Model),this._popup=null,this.addClass("jp-mod-highlighted"),this._translator=e.translator||R}render(){return this.model===null?null:M.createElement(Uo,{activeCell:this.model.activeCell,selectionStart:this.model.selectionStart,selectionEnd:this.model.selectionEnd,totalCells:this.model.totalCells,translator:this._translator,handleClick:()=>this._handleClick()})}_handleClick(){if(this.model.totalCells<1)return;this._popup&&this._popup.dispose();const e=Te.create(M.createElement(Vo,{handleSubmit:n=>this._handleSubmit(n),maxCell:this.model.totalCells,translator:this._translator}));this._popup=Eo({body:e,anchor:this,align:"right"})}_handleSubmit(e){var n;const s=this.model.notebook;if(!s)return;const a=e-1;s.activeCellIndex=a,s.deselectAll(),s.scrollToItem(a).catch(l=>{console.error("Go to cell",l)}),(n=this._popup)===null||n===void 0||n.dispose(),s.activate()}}(function(r){class e extends Ce{constructor(){super(...arguments),this._activeCell=0,this._selectionStart=0,this._selectionEnd=0,this._totalCells=0,this._notebook=null}get notebook(){return this._notebook}set notebook(s){const a=this._notebook;a&&(a.activeCellChanged.disconnect(this._onChanged,this),a.modelContentChanged.disconnect(this._onChanged,this),a.selectionChanged.disconnect(this._onChanged,this));const l=this._getAllState();this._notebook=s,this._notebook?(this._notebook.activeCellChanged.connect(this._onChanged,this),this._notebook.modelContentChanged.connect(this._onChanged,this),this._notebook.selectionChanged.connect(this._onChanged,this),this._updateStateFromNotebook(this._notebook)):(this._activeCell=0,this._selectionStart=0,this._selectionEnd=0,this._totalCells=0),this._triggerChange(l,this._getAllState())}get activeCell(){return this._activeCell}get selectionStart(){return this._selectionStart}get selectionEnd(){return this._selectionEnd}get totalCells(){return this._totalCells}_onChanged(s){const a=this._getAllState();this._updateStateFromNotebook(s),this._triggerChange(a,this._getAllState())}_updateStateFromNotebook(s){const a=s.activeCellIndex;this._activeCell=a>=0?a+1:0,this._totalCells=s.widgets.length;let l=this._activeCell,p=this._activeCell,i=!1;s.widgets.forEach((u,d)=>{if(!s.isSelectedOrActive(u))return;const g=d+1;if(!i){l=g,p=g,i=!0;return}p=g}),this._selectionStart=i?l:0,this._selectionEnd=i?p:0}_getAllState(){return{activeCell:this._activeCell,selectionStart:this._selectionStart,selectionEnd:this._selectionEnd,totalCells:this._totalCells}}_triggerChange(s,a){(s.activeCell!==a.activeCell||s.selectionStart!==a.selectionStart||s.selectionEnd!==a.selectionEnd||s.totalCells!==a.totalCells)&&this.stateChanged.emit(void 0)}}r.Model=e})(re||(re={}));const qo="jp-Notebook-toolbarCellType",Do="jp-Notebook-toolbarCellTypeDropdown";var Ae;(function(r){function e(g,b){const f=(b||R).load("jupyterlab");function _(){if(g.context.model.readOnly)return tt({title:f.__("Cannot Save"),body:f.__("Document is read-only"),buttons:[ke.okButton()]});g.context.save().then(()=>{if(!g.isDisposed)return g.context.createCheckpoint()})}return yt(Te.create(J.createElement(xt,{signal:g.context.fileChanged},()=>J.createElement(wt,{icon:kt,onClick:_,tooltip:f.__("Save the notebook contents and create checkpoint"),enabled:!!(g&&g.context&&g.context.contentsModel&&g.context.contentsModel.writable)}))))}r.createSaveButton=e;function n(g,b){const f=(b||R).load("jupyterlab");return new Z({icon:St,onClick:()=>{v.insertBelow(g.content)},tooltip:f.__("Insert a cell below")})}r.createInsertButton=n;function s(g,b,f){const _=(b||R).load("jupyterlab");return new Z({icon:Ye,onClick:async()=>{f?.get("useSystemClipboardForCells").composite?await v.cutToSystemClipboard(g.content):v.cut(g.content)},tooltip:_.__("Cut the selected cells")})}r.createCutButton=s;function a(g,b,f){const _=(b||R).load("jupyterlab");return new Z({icon:Xe,onClick:async()=>{f?.get("useSystemClipboardForCells").composite?await v.copyToSystemClipboard(g.content):v.copy(g.content)},tooltip:_.__("Copy the selected cells")})}r.createCopyButton=a;function l(g,b,f){const _=(b||R).load("jupyterlab");return new Z({icon:Qe,onClick:async()=>{f?.get("useSystemClipboardForCells").composite?await v.pasteFromSystemClipboard(g.content):v.paste(g.content)},tooltip:_.__("Paste cells from the clipboard")})}r.createPasteButton=l;function p(g,b,f){const _=(f??R).load("jupyterlab");return new Z({icon:Ze,onClick:()=>{v.runAndAdvance(g.content,g.sessionContext,b,f)},tooltip:_.__("Run the selected cells and advance")})}r.createRunButton=p;function i(g,b,f){const _=(f??R).load("jupyterlab");return new Z({icon:et,onClick:()=>{const y=b??new Be({translator:f});y.restart(g.sessionContext).then(w=>(w&&v.runAll(g.content,g.sessionContext,y,f),w))},tooltip:_.__("Restart the kernel, then re-run the whole notebook")})}r.createRestartRunAllButton=i;function u(g,b){return new $o(g.content,b)}r.createCellTypeItem=u;function d(g,b,f,_){return[{name:"save",widget:e(g,f)},{name:"insert",widget:n(g,f)},{name:"cut",widget:s(g,f,_)},{name:"copy",widget:a(g,f,_)},{name:"paste",widget:l(g,f,_)},{name:"run",widget:p(g,b,f)},{name:"interrupt",widget:he.createInterruptButton(g.sessionContext,f)},{name:"restart",widget:he.createRestartButton(g.sessionContext,b,f)},{name:"restart-and-run",widget:i(g,b,f)},{name:"cellType",widget:u(g,f)},{name:"spacer",widget:At.createSpacerItem()},{name:"kernelName",widget:he.createKernelNameItem(g.sessionContext,b,f)}]}r.getDefaultItems=d})(Ae||(Ae={}));class $o extends Te{constructor(e,n){super(),this.handleChange=s=>{s.target.value!=="-"&&(v.changeCellType(this._notebook,s.target.value),this._notebook.activate())},this.handleKeyDown=s=>{s.key==="Enter"&&this._notebook.activate()},this._trans=(n||R).load("jupyterlab"),this.addClass(qo),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 n of this._notebook.widgets)if(this._notebook.isSelectedOrActive(n)&&n.model.type!==e){e="-";break}return J.createElement(Ro,{className:Do,onChange:this.handleChange,onKeyDown:this.handleKeyDown,value:e,"aria-label":this._trans.__("Cell type"),title:this._trans.__("Select the cell type")},J.createElement("option",{value:"-"},"-"),J.createElement("option",{value:"code"},this._trans.__("Code")),J.createElement("option",{value:"markdown"},this._trans.__("Markdown")),J.createElement("option",{value:"raw"},this._trans.__("Raw")))}}function Ke(r){var e;const n=r.translator||R,s=ht(n),a=n.load("jupyterlab"),l=(e=r.displayOption.showJumpToCell)!==null&&e!==void 0?e:!1,p=r.state,i=r.displayOption.showOnToolBar,u=r.displayOption.showProgress,d=i?"down":"up",g=M.createElement("div",null),[b,f]=M.useState(!1);if(M.useEffect(()=>{if(b)return;const j=()=>{f(!0)};return v.executionScheduled.connect(j),()=>{v.executionScheduled.disconnect(j)}},[l,b]),!p)return g;const _=p.kernelStatus,y={alignSelf:"normal",height:"24px"},w=p.totalTime,S=p.scheduledCellNumber||0,o=p.scheduledCell.size||0,t=S-o;let h=100*t/S,C=u?"":"hidden";!u&&h<100&&(h=0);const k=j=>M.createElement(Lo,{progress:j,width:16,height:24,label:a.__("Kernel status")}),A=j=>a.__("Kernel status: %1",j),B=()=>{const j=r.notebook;v.selectLastRunCell(j),j.activeCell&&j.scrollToCell(j.activeCell)},E=(j,K,W)=>M.createElement("div",{className:"jp-Notebook-ExecutionIndicator",title:u?"":A(s[j]),"data-status":j},K,M.createElement("div",{className:`jp-Notebook-ExecutionIndicator-tooltip ${d} ${C}`},M.createElement("span",null," ",A(s[j])," "),W,l&&b&&M.createElement(Bt,{className:"jp-Notebook-ExecutionIndicator-jumpButton",onClick:B,title:a.__("Jump to current or last executed cell")},a.__("Jump to cell"))));if(p.kernelStatus==="connecting"||p.kernelStatus==="disconnected"||p.kernelStatus==="unknown")return E(_,M.createElement(Mt.react,{...y}),[]);if(p.kernelStatus==="starting"||p.kernelStatus==="terminating"||p.kernelStatus==="restarting"||p.kernelStatus==="initializing")return E(_,M.createElement(Tt.react,{...y}),[]);if(p.executionStatus==="busy")return E("busy",k(h),[M.createElement("span",{key:0},a.__("Executed %1/%2 cells",t,S)),M.createElement("span",{key:1},a._n("Elapsed time: %1 second","Elapsed time: %1 seconds",w))]);{const j=p.kernelStatus==="busy"?0:100,K=p.kernelStatus==="busy"||w===0?[]:[M.createElement("span",{key:0},a._n("Executed %1 cell","Executed %1 cells",S)),M.createElement("span",{key:1},a._n("Elapsed time: %1 second","Elapsed time: %1 seconds",w))];return E(p.kernelStatus,k(j),K)}}class X extends me{constructor(e,n=!0){super(new X.Model),this.translator=e||R,this.addClass("jp-mod-highlighted")}dispose(){var e;this.isDisposed||((e=this.model)===null||e===void 0||e.dispose(),super.dispose())}render(){if(this.model===null||!this.model.renderFlag)return M.createElement("div",null);{const e=this.model.currentNotebook;return e?M.createElement(Ke,{displayOption:this.model.displayOption,state:this.model.executionState(e),translator:this.translator,notebook:e}):M.createElement(Ke,{displayOption:this.model.displayOption,state:void 0,translator:this.translator,notebook:void 0})}}}(function(r){class e extends Ce{constructor(){super(),this._notebookExecutionProgress=new WeakMap,this._displayOption={showOnToolBar:!0,showProgress:!0,showJumpToCell:!1},this._renderFlag=!0}attachNotebook(l){var p,i,u,d;if(l&&l.content&&l.context){const g=l.content,b=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 f=this._notebookExecutionProgress.get(g),_=o=>{f&&(f.kernelStatus=o.kernelDisplayStatus),this.stateChanged.emit(void 0)};b.statusChanged.connect(_,this);const y=o=>{f&&(f.kernelStatus=o.kernelDisplayStatus),this.stateChanged.emit(void 0)};b.connectionStatusChanged.connect(y,this),b.disposed.connect(o=>{o.connectionStatusChanged.disconnect(y,this),o.statusChanged.disconnect(_,this)},this);const w=(o,t)=>{const h=t.msg,C=h.header.msg_id;if(h.header.msg_type==="execute_request")this._cellScheduledCallback(g,C);else if(Y.KernelMessage.isStatusMsg(h)&&h.content.execution_state==="idle"){const k=h.parent_header.msg_id;this._cellExecutedCallback(g,k)}else Y.KernelMessage.isStatusMsg(h)&&h.content.execution_state==="restarting"?this._restartHandler(g):h.header.msg_type==="execute_input"&&this._startTimer(g)};(i=(p=b.session)===null||p===void 0?void 0:p.kernel)===null||i===void 0||i.anyMessage.connect(w,this),(d=(u=b.session)===null||u===void 0?void 0:u.kernel)===null||d===void 0||d.disposed.connect(o=>o.anyMessage.disconnect(w,this),this);const S=(o,t)=>{f&&(this._resetTime(f),this.stateChanged.emit(void 0),t.newValue&&t.newValue.anyMessage.connect(w,this))};b.kernelChanged.connect(S,this),b.disposed.connect(o=>o.kernelChanged.disconnect(S,this),this)}}}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 i=this._notebookExecutionProgress.get(l);i&&i.scheduledCell.has(p)&&(i.scheduledCell.delete(p),i.scheduledCell.size===0&&this._scheduleSwitchToIdle(i))}_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 i=this._notebookExecutionProgress.get(l);i&&!i.scheduledCell.has(p)&&(i.needReset&&this._resetTime(i),i.scheduledCell.add(p),i.scheduledCellNumber+=1)}_tick(l){if(this.isDisposed){clearInterval(l.interval),clearTimeout(l.timeout);return}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 n(a,l,p){const i=new r(l);return i.model.displayOption={showOnToolBar:!0,showProgress:!0,showJumpToCell:!1},i.model.attachNotebook({content:a.content,context:a.sessionContext}),p&&p.then(u=>{const d=g=>{const b=s(g);b.showJumpToCell&&(g.get("recordTiming").composite||g.set("recordTiming",!0).catch(_=>{console.error("Failed to auto-enable recordTiming:",_.message)})),i.model.updateRenderOption(b)};u.changed.connect(d),d(u),i.disposed.connect(()=>{u.changed.disconnect(d)})}).catch(u=>{console.error(u.message)}),i}r.createExecutionIndicatorItem=n;function s(a){let l=!0,p=!0,i=!1;const u=a.get("kernelStatus").composite;return u&&(l=!u.showOnStatusBar,p=u.showProgress,i=u.showJumpToRecentExecutionButton),{showOnToolBar:l,showProgress:p,showJumpToCell:i}}r.getSettingValue=s})(X||(X={}));function Jo(r){const e=(r.translator||R).load("jupyterlab");return J.createElement(De,{source:e.__("Mode: %1",r.modeNames[r.notebookMode])})}class ae extends me{constructor(e){super(new ae.Model),this.translator=e||R,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]),J.createElement(Jo,{notebookMode:this.model.notebookMode,translator:this.translator,modeNames:this._modeNames})):null}}(function(r){class e extends Ce{constructor(){super(...arguments),this._onChanged=s=>{const a=this._notebookMode;this._notebook?this._notebookMode=s.mode:this._notebookMode="command",this._triggerChange(a,this._notebookMode)},this._notebookMode="command",this._notebook=null}get notebookMode(){return this._notebookMode}set notebook(s){const a=this._notebook;a!==null&&(a.stateChanged.disconnect(this._onChanged,this),a.activeCellChanged.disconnect(this._onChanged,this),a.modelContentChanged.disconnect(this._onChanged,this));const l=this._notebookMode;this._notebook=s,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(s,a){s!==a&&this.stateChanged.emit(void 0)}}r.Model=e})(ae||(ae={}));class zo extends ko{constructor(e,n){super(e,n),this.editorWidget=e,this.options=n,this._type="code",this._readyDelegate=new Et,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 n,s=this.language_info();return!s||!s.mimetype?n=this.widget.content.codeMimetype:n=s.mimetype,Array.isArray(n)?(e=n[0])!==null&&e!==void 0?e:Nt.defaultMimeType:n}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(n=>({ceEditor:this._getCellEditor(n),type:n.model.type,value:n.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 n=this._getCellAt(e);return this.widget.content.widgets.findIndex(a=>n===a)}getEditorIndex(e){let n=this._editorToCell.get(e);return this.editor.widgets.findIndex(s=>n===s)}getEditorWrapper(e){return this._editorToCell.get(e).node}async onKernelChanged(e,n){if(n.newValue)try{const s=this._languageInfo;await He(this.isReady,-1),await this._updateLanguageInfo();const a=this._languageInfo;s?.name!=a.name||s?.mimetype!=a?.mimetype||s?.file_extension!=a?.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(s){console.warn(s),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(),Ot.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,n){let s=[],a=[];const l=this._type;if(n.type==="set"){let p=[],i=[];if(n.newValues.length===n.oldValues.length){for(let u=0;u<n.newValues.length;u++)n.oldValues[u].type===l&&n.newValues[u].type!==l?p.push(n.newValues[u]):n.oldValues[u].type!==l&&n.newValues[u].type===l&&i.push(n.newValues[u]);s=i,a=p}}else n.type=="add"&&(s=n.newValues.filter(p=>p.type===l));(a.length||s.length||n.type==="set"||n.type==="move"||n.type==="remove"||n.type==="clear")&&await this.updateDocuments();for(let p of s){let i=this.widget.content.widgets.find(u=>u.model.id===p.id);if(!i){console.warn(`Widget for added cell with ID: ${p.id} not found!`);continue}this._getCellEditor(i)}}createVirtualDocument(){return new So({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 He(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,n,s,a;const l=(a=await((s=(n=(e=this.widget.context.sessionContext)===null||e===void 0?void 0:e.session)===null||n===void 0?void 0:n.kernel)===null||s===void 0?void 0:s.info))===null||a===void 0?void 0:a.language_info;if(l)this._languageInfo=l;else throw new Error("Language info update failed (no session, kernel, or info available)")}_activeCellChanged(e,n){!n||n.model.type!==this._type||this._activeEditorChanged.emit({editor:this._getCellEditor(n)})}_getCellAt(e){let n=this.virtualDocument.getEditorAtVirtualLine(e);return this._editorToCell.get(n)}_getCellEditor(e){if(!this._cellToEditor.has(e)){const n=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,n),this._editorToCell.set(n,e),e.disposed.connect(()=>{this._cellToEditor.delete(e),this._editorToCell.delete(n),this._editorRemoved.emit({editor:n})}),this._editorAdded.emit({editor:n})}return this._cellToEditor.get(e)}}class Go extends ee{constructor(){super(),this._items=[],this.layout=new be,this.addClass("jp-RankedPanel")}addWidget(e,n){const s={widget:e,rank:n},a=le.upperBound(this._items,s,Me.itemCmp);le.insert(this._items,a,s),this.layout.insertWidget(a,e)}onChildRemoved(e){const n=le.findFirstIndex(this._items,s=>s.widget===e.child);n!==-1&&le.removeAt(this._items,n)}}class q extends ee{constructor(e){super(),this.addClass("jp-NotebookTools"),this.translator=e.translator||R,this._tools=[],this.layout=new be,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 n=e.content;return n.widgets.filter(s=>n.isSelectedOrActive(s))}get activeNotebookPanel(){return this._tracker.currentWidget}addItem(e){var n;const s=e.tool,a=(n=e.rank)!==null&&n!==void 0?n:100;let l;const p=this._tools.find(i=>i.section===e.section);if(p)l=p.panel;else throw new Error(`The section ${e.section} does not exist`);s.addClass("jp-NotebookTools-tool"),l.addWidget(s,a),s.notebookTools=this,G.sendMessage(s,q.ActiveNotebookPanelMessage),G.sendMessage(s,q.ActiveCellMessage)}addSection(e){var n;const s=e.sectionName,a=e.label||e.sectionName,l=e.tool;let p=(n=e.rank)!==null&&n!==void 0?n:null;const i=new Go;if(i.title.label=a,l&&i.addWidget(l,0),this._tools.push({section:s,panel:i,rank:p}),p!=null)this.layout.insertWidget(p,new ce({widget:i}));else{let u=null;const d=this.layout;for(let g=0;g<d.widgets.length;g++){let b=d.widgets[g];if(b instanceof ce&&b.widget.id==="advancedToolsSection"){u=g;break}}u!==null?this.layout.insertWidget(u,new ce({widget:i})):this.layout.addWidget(new ce({widget:i}))}}_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 n of this._toolChildren())G.sendMessage(n,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 n of this._toolChildren())G.sendMessage(n,q.ActiveCellMessage)}_onSelectionChanged(){for(const e of this._toolChildren())G.sendMessage(e,q.SelectionMessage)}_onActiveNotebookPanelMetadataChanged(e,n){const s=new ge.ChangeMessage("activenotebookpanel-metadata-changed",{oldValue:void 0,newValue:void 0,...n});for(const a of this._toolChildren())G.sendMessage(a,s)}_onActiveCellMetadataChanged(e,n){const s=new ge.ChangeMessage("activecell-metadata-changed",{newValue:void 0,oldValue:void 0,...n});for(const a of this._toolChildren())G.sendMessage(a,s)}*_toolChildren(){for(let e of this._tools)yield*e.panel.children()}}(function(r){r.ActiveNotebookPanelMessage=new xe("activenotebookpanel-changed"),r.ActiveCellMessage=new xe("activecell-changed"),r.SelectionMessage=new xe("selection-changed");class e extends ee{dispose(){super.dispose(),this.notebookTools&&(this.notebookTools=null)}processMessage(a){switch(super.processMessage(a),a.type){case"activenotebookpanel-changed":this.onActiveNotebookPanelChanged(a);break;case"activecell-changed":this.onActiveCellChanged(a);break;case"selection-changed":this.onSelectionChanged(a);break;case"activecell-metadata-changed":this.onActiveCellMetadataChanged(a);break;case"activenotebookpanel-metadata-changed":this.onActiveNotebookPanelMetadataChanged(a);break}}onActiveNotebookPanelChanged(a){}onActiveCellChanged(a){}onSelectionChanged(a){}onActiveCellMetadataChanged(a){}onActiveNotebookPanelMetadataChanged(a){}}r.Tool=e;class n extends e{constructor(a){super();const{editorFactory:l}=a;this.addClass("jp-MetadataEditorTool");const p=this.layout=new be;this._editorFactory=l,this._editorLabel=a.label||"Edit Metadata",this.createEditor();const i=new ee({node:document.createElement("label")});i.node.textContent=a.label||"Edit Metadata",p.addWidget(i),p.addWidget(this.editor)}get editor(){return this._editor}onActiveNotebookPanelChanged(a){this.editor.dispose(),this.notebookTools.activeNotebookPanel&&this.createEditor()}createEditor(){this._editor=new Ko({editorFactory:this._editorFactory}),this.editor.title.label=this._editorLabel,this.layout.addWidget(this.editor)}}r.MetadataEditorTool=n})(q||(q={}));var Me;(function(r){function e(n,s){return n.rank-s.rank}r.itemCmp=e})(Me||(Me={}));const Yo=6;var V;(function(r){r[r.Idle=-1]="Idle",r[r.Error=-.5]="Error",r[r.Scheduled=0]="Scheduled",r[r.Running=1]="Running"})(V||(V={}));class Xo extends Po{constructor(e,n,s,a){super(e,a),this.parser=n,this.sanitizer=s,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),v.executionScheduled.connect(this.onExecutionScheduled,this),v.executed.connect(this.onExecuted,this),v.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 n=new Array;let s=this._cellToHeadingIndex.get(e);if(s!==void 0){const a=this.headings[s];for(n.push(a);this.headings[s-1]&&this.headings[s-1].cellRef===a.cellRef;)s--,n.unshift(this.headings[s])}return n}dispose(){var e,n,s;this.isDisposed||(this.headingsChanged.disconnect(this.onHeadingsChanged,this),(n=(e=this.widget.context)===null||e===void 0?void 0:e.model)===null||n===void 0||n.metadataChanged.disconnect(this.onMetadataChanged,this),(s=this.widget.content)===null||s===void 0||s.activeCellChanged.disconnect(this.onActiveCellChanged,this),v.executionScheduled.disconnect(this.onExecutionScheduled,this),v.executed.disconnect(this.onExecuted,this),v.outputCleared.disconnect(this.onOutputCleared,this),this._runningCells.length=0,this._errorCells.length=0,super.dispose())}setConfiguration(e){const n=this.loadConfigurationFromMetadata();super.setConfiguration({...this.configuration,...n,...e})}toggleCollapse(e){super.toggleCollapse(e),this.updateRunningStatus(this.headings)}async getHeadings(){const e=this.widget.content.widgets,n=new Set(e),s=[],a=new Array,l=new WeakMap;for(let p=0;p<e.length;p++){const i=e[p];switch(i.model.type){case"code":{!this.configuration.syncCollapseState&&this.configuration.includeOutput&&s.push(...Le(await i.getHeadings(),this.configuration,a).map(d=>({...d,cellRef:i,collapsed:!1,isRunning:V.Idle})));break}case"markdown":{const d=Le(await i.getHeadings(),this.configuration,a).map((g,b)=>({...g,cellRef:i,collapsed:!1,isRunning:V.Idle}));if(this.configuration.syncCollapseState&&i.headingCollapsed){const g=Math.min(...d.map(f=>f.level)),b=d.find(f=>f.level===g);b.collapsed=i.headingCollapsed}s.push(...d);break}}s.length>0&&l.set(i,s.length-1)}return this._cellToHeadingIndex=l,this._runningCells=this._runningCells.filter(p=>n.has(p)),this._errorCells=this._errorCells.filter(p=>n.has(p)),this.updateRunningStatus(s),Promise.resolve(s)}isHeadingEqual(e,n){return super.isHeadingEqual(e,n)&&e.cellRef===n.cellRef&&e.isRunning===n.isRunning}loadConfigurationFromMetadata(){const e=this.widget.content.model,n={};if(e)for(const s in this.configMetadataMap){const a=this.configMetadataMap[s];for(const l of a){let p=l;const i=p[0]==="!";i&&(p=p.slice(1));const u=p.split("/");let d=e.getMetadata(u[0]);for(let g=1;g<u.length;g++)d=(d??{})[u[g]];d!==void 0&&(typeof d=="boolean"&&i&&(d=!d),n[s]=d)}}return n}onActiveCellChanged(e,n){const s=this.getCellHeadings(n)[0];this.setActiveHeading(s??null,!1)}onHeadingsChanged(){this.widget.content.activeCell&&this.onActiveCellChanged(this.widget.content,this.widget.content.activeCell)}onExecuted(e,n){this._runningCells.forEach((s,a)=>{var l;if(s===n.cell){this._runningCells.splice(a,1);const p=this._cellToHeadingIndex.get(s);if(p!==void 0){const i=this.headings[p];if(n.success||((l=n.error)===null||l===void 0?void 0:l.errorName)===void 0){i.isRunning=V.Idle;return}i.isRunning=V.Error,this._errorCells.includes(s)||this._errorCells.push(s)}}}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onExecutionScheduled(e,n){this._runningCells.includes(n.cell)||this._runningCells.push(n.cell),this._errorCells.forEach((s,a)=>{s===n.cell&&this._errorCells.splice(a,1)}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onOutputCleared(e,n){this._errorCells.forEach((s,a)=>{if(s===n.cell){this._errorCells.splice(a,1);const l=this._cellToHeadingIndex.get(s);if(l!==void 0){const p=this.headings[l];p.isRunning=V.Idle}}}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onMetadataChanged(){this.setConfiguration({})}updateRunningStatus(e){e.forEach(a=>{a.isRunning=V.Idle}),this._runningCells.forEach((a,l)=>{const p=this._cellToHeadingIndex.get(a);if(p!==void 0){const i=e[p];i.isRunning!==V.Running&&(i.isRunning=l>0?V.Scheduled:V.Running)}}),this._errorCells.forEach((a,l)=>{const p=this._cellToHeadingIndex.get(a);if(p!==void 0){const i=e[p];i.isRunning===V.Idle&&(i.isRunning=V.Error)}});let n=0;for(;n<e.length;){const a=e[n];if(n++,a.collapsed){const l=Math.max(a.isRunning,s(e,a.level));a.dataset={...a.dataset,"data-running":l.toString()}}else a.dataset={...a.dataset,"data-running":a.isRunning.toString()}}function s(a,l){let p=V.Idle;for(;n<a.length;){const i=a[n];if(i.dataset={...i.dataset,"data-running":i.isRunning.toString()},i.level>l)n++,p=Math.max(i.isRunning,p),i.collapsed&&(p=Math.max(p,s(a,i.level)),i.dataset={...i.dataset,"data-running":p.toString()});else break}return p}}}class Qo extends Io{constructor(e,n,s,a){super(e),this.parser=n,this.sanitizer=s,this.commands=a,this._scrollToTop=!0}get scrollToTop(){return this._scrollToTop}set scrollToTop(e){this._scrollToTop=e}_createNew(e,n){const s=new Xo(e,this.parser,this.sanitizer,n);let a=new WeakMap;const l=(_,y)=>{if(y){const w=async h=>{if(!h.inViewport)return;let C=a.get(y);if((!C||!y.cellRef.node.contains(C))&&(await i(h),C=a.get(y)),C)if(this.scrollToTop)C.scrollIntoView({block:"start"}),e.content.outerNode.scrollTop-=Yo;else{const k=e.content.node.getBoundingClientRect(),A=C.getBoundingClientRect();(A.top>k.bottom||A.bottom<k.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)},S=y.cellRef,t=e.content.widgets.indexOf(S);S.model.type=="markdown"&&e.content.mode!="command"&&(e.content.mode="command"),e.content.activeCellIndex=t,S.inViewport?w(S).catch(h=>{console.error(`Fail to scroll to cell to display the required heading (${h}).`)}):e.content.scrollToItem(t,this.scrollToTop?"start":void 0).then(()=>i(S)).then(()=>w(S)).catch(h=>{console.error(`Fail to scroll to cell to display the required heading (${h}).`)})}},p=_=>s.getCellHeadings(_).filter(y=>y.cellRef===_),i=async _=>{var y;const w=p(_),S=(y=this.sanitizer.allowNamedProperties)!==null&&y!==void 0&&y?"id":"data-jupyter-id",o=await Promise.all(w.map(async h=>{const C=await Zo(h,this.parser,this.sanitizer);return C?`h${h.level}[${S}="${CSS.escape(C)}"]`:`h${h.level}`})),t=p(_);t.length!==w.length||t.some((h,C)=>h!==w[C])||(we(_.node),w.forEach((h,C)=>{var k,A;const B=h.outputIndex===void 0?h.cellRef.node:(k=h.cellRef.outputArea.widgets[h.outputIndex])===null||k===void 0?void 0:k.node;a.set(h,B?It(B,o[C],(A=h.prefix)!==null&&A!==void 0?A:""):null)}))},u=_=>{if(this.parser){we(e.content.node),a=new WeakMap;for(const y of e.content.widgets)y instanceof Q&&y.renderedChanged.connect(f);return Promise.all(e.content.widgets.map(y=>i(y)))}},d=(_,y)=>{var w,S,o,t;if(s.configuration.syncCollapseState)if(y!==null){const h=y.cellRef;h.headingCollapsed!==((w=y.collapsed)!==null&&w!==void 0?w:!1)&&(h.headingCollapsed=(S=y.collapsed)!==null&&S!==void 0?S:!1)}else{const h=(t=(o=s.headings[0])===null||o===void 0?void 0:o.collapsed)!==null&&t!==void 0?t:!1;e.content.widgets.forEach(C=>{C instanceof Q&&C.headingInfo.level>=0&&(C.headingCollapsed=h)})}},g=(_,y)=>{if(s.configuration.syncCollapseState){const w=s.getCellHeadings(y)[0];w&&s.toggleCollapse({heading:w,collapsed:y.headingCollapsed})}},b=(_,y)=>{var w;y.inViewport?(w=i(y))===null||w===void 0||w.catch(console.warn):we(y.node)},f=(_,y)=>{y&&i(_).catch(console.warn)};return e.context.ready.then(()=>{var _;(_=u())===null||_===void 0||_.catch(console.warn),s.activeHeadingChanged.connect(l),s.headingsChanged.connect(u),s.collapseChanged.connect(d),e.content.cellCollapsed.connect(g),e.content.cellInViewportChanged.connect(b),e.disposed.connect(()=>{s.activeHeadingChanged.disconnect(l),s.headingsChanged.disconnect(u),s.collapseChanged.disconnect(d),e.content.cellCollapsed.disconnect(g),e.content.cellInViewportChanged.disconnect(b);for(const y of e.content.widgets)y instanceof Q&&y.renderedChanged.disconnect(f)})}),s}getToolbarItems(e){return this.commands?[{name:"select-last-modified-back",widget:new Pe({commands:this.commands,id:"notebook:select-last-modified-cell",args:{toolbar:!0},icon:jt,label:""})},{name:"select-last-modified-forward",widget:new Pe({commands:this.commands,id:"notebook:select-next-modified-cell",args:{toolbar:!0},icon:Rt,label:""})}]:[]}}async function Zo(r,e,n){let s=null;return r.type===We.HeadingType.Markdown?s=await Pt(e,r.raw,r.level,n):r.type===We.HeadingType.HTML&&(s=r.id),s}const en="jp-StatusItem-trust";function tn(r,e){e=e||R;const n=e.load("jupyterlab");return r.trustedCells===r.totalCells?n.__("Notebook trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells):r.activeCellTrusted?n.__("Active cell trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells):n.__("Notebook not trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells)}function on(r){return r.allCellsTrusted?M.createElement(Lt.react,{top:"2px",stylesheet:"statusBar"}):M.createElement(Wt.react,{top:"2px",stylesheet:"statusBar"})}class de extends me{constructor(e){super(new de.Model),this.translator=e||R,this.node.classList.add(en)}render(){if(!this.model)return null;const e=tn(this.model,this.translator);return e!==this.node.title&&(this.node.title=e),M.createElement(on,{allCellsTrusted:this.model.trustedCells===this.model.totalCells,activeCellTrusted:this.model.activeCellTrusted,totalCells:this.model.totalCells,trustedCells:this.model.trustedCells})}}(function(r){class e extends Ce{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(s){const a=this._notebook;a!==null&&(a.activeCellChanged.disconnect(this._onActiveCellChanged,this),a.modelContentChanged.disconnect(this._onModelChanged,this));const l=this._getAllState();if(this._notebook=s,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:i}=this._deriveCellTrustState(this._notebook.model);this._totalCells=p,this._trustedCells=i}this._triggerChange(l,this._getAllState())}_onModelChanged(s){const a=this._getAllState(),{total:l,trusted:p}=this._deriveCellTrustState(s.model);this._totalCells=l,this._trustedCells=p,this._triggerChange(a,this._getAllState())}_onActiveCellChanged(s,a){const l=this._getAllState();a?this._activeCellTrusted=a.model.trusted:this._activeCellTrusted=!1,this._triggerChange(l,this._getAllState())}_deriveCellTrustState(s){if(s===null)return{total:0,trusted:0};let a=0,l=0;for(const p of s.cells)p.type==="code"&&(a++,p.trusted&&l++);return{total:a,trusted:l}}_getAllState(){return[this._trustedCells,this._totalCells,this.activeCellTrusted]}_triggerChange(s,a){(s[0]!==a[0]||s[1]!==a[1]||s[2]!==a[2])&&this.stateChanged.emit(void 0)}}r.Model=e})(de||(de={}));const nn=new ot("@jupyterlab/metadataform:IMetadataFormProvider","A service to register new metadata editor widgets."),ln={id:"@jupyterlab/notebook-extension:cell-executor",description:"Provides the notebook cell executor.",autoStart:!0,provides:lt,activate:()=>Object.freeze({runCell:Ht})},sn=new ot("@jupyterlab/logconsole:ILoggerRegistry","A service providing a logger infrastructure."),rn={activate:an,id:"@jupyterlab/notebook-extension:log-output",description:"Adds cell outputs log to the application logger.",requires:[L],optional:[sn],autoStart:!0};function an(r,e,n){if(!n)return;function s(a){function l(p,i,u){if(Y.KernelMessage.isDisplayDataMsg(p)||Y.KernelMessage.isStreamMsg(p)||Y.KernelMessage.isErrorMsg(p)||Y.KernelMessage.isExecuteResultMsg(p)){const d=n.getLogger(a.context.path);d.rendermime=a.content.rendermime;const g={...p.content,output_type:p.header.msg_type};let b=i;(Y.KernelMessage.isErrorMsg(p)||Y.KernelMessage.isStreamMsg(p)&&p.content.name==="stderr")&&(b=u),d.log({type:"output",data:g,level:b})}}a.context.sessionContext.iopubMessage.connect((p,i)=>l(i,"info","info"),a),a.context.sessionContext.unhandledMessage.connect((p,i)=>l(i,"warning","error"),a)}e.forEach(a=>s(a)),e.widgetAdded.connect((a,l)=>s(l))}const dn="jp-ActiveCellTool",cn="jp-ActiveCellTool-Content",un="jp-ActiveCellTool-CellContent";class hn extends q.Tool{constructor(e){super(),this._cellModel=null,this._updateId=0,this._pendingUpdate=!1,this._promptOutdated=!1,this._tracker=e.tracker,this._languages=e.languages,this.addClass(dn),this.layout=new be,this._inputPrompt=new Ft,this.layout.addWidget(this._inputPrompt);const n=document.createElement("div");n.classList.add(cn);const s=n.appendChild(document.createElement("div")),a=s.appendChild(document.createElement("pre"));s.className=un,this._editorEl=a,this.layout.addWidget(new ee({node:n})),this._previewDebouncer=new Kt(()=>this._update(),150),this._tracker.activeCellChanged.connect(this._onActiveCellChanged,this),this._tracker.currentChanged.connect(this._onActiveCellChanged,this),this._onActiveCellChanged()}dispose(){this.isDisposed||(this._tracker.activeCellChanged.disconnect(this._onActiveCellChanged,this),this._tracker.currentChanged.disconnect(this._onActiveCellChanged,this),this._disconnectCellModel(),this._previewDebouncer.dispose(),super.dispose())}render(e){return M.createElement("div",{ref:n=>{!n||this.node.parentElement===n||(n.appendChild(this.node),this._pendingUpdate&&this._update().catch(console.warn))}})}_onActiveCellChanged(){var e,n;const s=(n=(e=this._tracker.activeCell)===null||e===void 0?void 0:e.model)!==null&&n!==void 0?n:null;s!==this._cellModel&&(this._disconnectCellModel(),this._cellModel=s,s&&(s.sharedModel.changed.connect(this._onCellContentChanged,this),s.mimeTypeChanged.connect(this._onCellContentChanged,this)),this._promptOutdated=!0,this._update().catch(console.warn))}_onCellContentChanged(){if(!this.node.isConnected){this._pendingUpdate=!0,this._promptOutdated=!0;return}this._promptOutdated||this._updatePrompt(),this._previewDebouncer.invoke().catch(console.warn)}_disconnectCellModel(){const e=this._cellModel;e&&(e.sharedModel.changed.disconnect(this._onCellContentChanged,this),e.mimeTypeChanged.disconnect(this._onCellContentChanged,this),this._cellModel=null)}_updatePrompt(){var e;const n=this._cellModel;n&&Vt(n)?(this._inputPrompt.executionCount=`${(e=n.executionCount)!==null&&e!==void 0?e:""}`,this._inputPrompt.show()):(this._inputPrompt.executionCount=null,this._inputPrompt.hide())}async _update(){if(!this.node.isConnected){this._pendingUpdate=!0;return}this._pendingUpdate=!1;const e=this._cellModel,n=++this._updateId;if(!e){this._promptOutdated=!1,this._updatePrompt(),this._editorEl.replaceChildren();return}const s=e.sharedModel.getSource(),a=s.indexOf(`
|
|
1
|
+
import{T as De,q as he,t as ht,r as ce,b as $e,g as Je,I as pt,k as gt,a as ze,f as Ge,C as Re,h as Ie}from"./index-JmqWOkdt.js";import{J as M,aA as ee,cg as ie,aD as R,gr as mt,eG as Ct,fO as bt,ci as me,aJ as Te,ee as ft,ck as vt,ef as _t,ce as Ce,iq as yt,r as J,eM as xt,ii as wt,eK as kt,dz as Z,co as St,ir as v,dK as Ye,dG as Xe,dL as Qe,fM as Ze,fN as et,eJ as Be,aI as At,aE as tt,aF as ke,is as Mt,it as Tt,ik as Bt,k as Y,bg as Et,gj as Nt,a9 as Ot,aB as be,gw as G,iu as ge,az as le,iv as xe,iw as Q,eD as Pe,ix as jt,iy as Rt,dU as we,dW as It,dY as Le,iz as We,dV as Pt,iA as Lt,iB as Wt,aw as ot,iC as Ht,iD as Ft,eI as Kt,iE as Vt,aC as F,et as fe,iF as Se,du as Ut,eB as qt,e0 as Dt,iG as $t,iH as se,iI as nt,cd as pe,dw as Jt,aG as zt,dB as Gt,cq as Yt,gu as Xt,iJ as Qt,dP as Zt,dS as eo,iK as to,dE as oo,iL as no,iM as io,ea as lo,eb as so,dv as ro,bf as ao,fh as co}from"../datalayer-app-main.js";import{b as uo,I as it}from"./token-d9po19EN.js";import{ToolbarItems as ho}from"./lib-PbTUB5SW.js";import{I as po}from"./index-PKH5uAl-.js";import{I as ve}from"./tokens-Dyd4wiX6.js";import{a as lt,I as L,b as st,c as go}from"./tokens-DiDi0Nkm.js";import{I as mo,a as rt}from"./tokens-DbNnxPrX.js";import{I as Co}from"./tokens-D1WVYIDT.js";import{f as at,e as bo,c as fo,I as vo,b as _o}from"./index-B6-uQd5L.js";import{I as dt}from"./tokens-B7nNzQEE.js";import{I as _e}from"./tokens-DY_UrMLq.js";import{a as Ee}from"./tokens-BYcJtuKD.js";import{I as yo}from"./tokens-Nkg3e_k9.js";import{I as xo}from"./index-qhxI1VzX.js";import{I as wo}from"./tokens-BcAeNU3z.js";import{W as ko,u as He,V as So,I as Ao,a as Mo,b as To,c as Bo}from"./document-Dp0KpIjg.js";import{s as Eo}from"./hover-B3uFmZ-0.js";import{b as No,c as Oo,d as jo}from"./CellSidebarExtension-DXPIz0Km.js";import{H as Ro}from"./htmlselect-5N6NdDqL.js";import{T as Io,a as Po}from"./model-DbDJZyri.js";import{C as Fe}from"./celltoolbartracker-D1C_kGQL.js";import"./hoverbox-CStlKQWE.js";import"./Output-D9cwH5rg.js";import"./index-CEeyR3FZ.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-BYxXubsX.js";import"./d3-color-Jd8hXty2.js";import"./dist-BrUAt6vF.js";import"./KebabHorizontalIcon-D6AY8pIS.js";import"./PaintbrushIcon-CFBHU-3l.js";import"./index-CKWSKbHe.js";import"./RestartIcon-DvpOf5Mf.js";import"./NotebookSkeleton-CvO9WylK.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-We9CyR7b.js";import"./SquareIcon-Dy3l3VdH.js";import"./FileDirectoryOpenFillIcon-jGhuRcP3.js";import"./url-C6fJII94.js";/* empty css *//* empty css */import"./style-DdAxk_bj.js";/* empty css */import"./style-Cj1gzCjo.js";/* empty css */import"./style-rkw8dR9f.js";import"./style-GHJFdtIz.js";import"./style-ZSIOeMoX.js";import"./style-iVfD6mFL.js";import"./style-DA-Ya7rp.js";import"./style-D3tvWcFO.js";import"./style-BOqStzF9.js";import"./style-ADLQJ-E9.js";import"./style-DgglluaK.js";import"./ArrowLeftIcon-sX3iNMG1.js";import"./SkubbleIcon-CAaVh_BE.js";import"./usePrimerThemeBridge-NsTRGuo7.js";import"./index-DpN8KK6c.js";import"./KernelVariables-CXQagESp.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-D36duUxK.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-BAjGB6b-.js";import"./sessions-DdXtI_C1.js";import"./tokens-CTXFWLvM.js";import"./drivecontents-BsC6Y2Vl.js";import"./kernel-BmfZmtIo.js";function Lo(r){const n=s=>{const a=Math.max(s*3.6,.1),l=a*Math.PI/180,p=Math.sin(l)*104,i=Math.cos(l)*-104;return"M 0 0 v -104 A 104 104 1 "+(a<180?1:0)+" 0 "+p.toFixed(4)+" "+i.toFixed(4)+" z"};return M.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},M.createElement("svg",{viewBox:"0 0 250 250"},M.createElement("circle",{cx:"125",cy:"125",r:"104",stroke:"var(--jp-inverse-layout-color3)",strokeWidth:"20",fill:"none"}),M.createElement("path",{className:"jp-Statusbar-ProgressCirclePath",transform:"translate(125,125) scale(.9)",d:n(r.progress),fill:"var(--jp-inverse-layout-color3)"})))}const Wo="jp-JSONEditor",ue="jp-mod-error",Ho="jp-JSONEditor-host",Fo="jp-JSONEditor-header";class Ko extends ee{constructor(e){super(),this._dataDirty=!1,this._inputDirty=!1,this._source=null,this._originalValue=ie.emptyObject,this._changeGuard=!1,this.translator=e.translator||R,this._trans=this.translator.load("jupyterlab"),this.addClass(Wo),this.headerNode=document.createElement("div"),this.headerNode.className=Fo,this.revertButtonNode=mt.element({tag:"span",title:this._trans.__("Revert changes to data")}),this.commitButtonNode=Ct.element({tag:"span",title:this._trans.__("Commit changes to data"),marginLeft:"8px"}),this.editorHostNode=document.createElement("div"),this.editorHostNode.className=Ho,this.headerNode.appendChild(this.revertButtonNode),this.headerNode.appendChild(this.commitButtonNode),this.node.appendChild(this.headerNode),this.node.appendChild(this.editorHostNode);const n=new bt.Model({mimeType:"application/json"});n.sharedModel.changed.connect(this._onModelChanged,this),this.model=n,this.editor=e.editorFactory({host:this.editorHostNode,model:n,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 n=this.editorHostNode;n.addEventListener("blur",this,!0),n.addEventListener("click",this,!0),this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.headerNode.addEventListener("click",this)}onBeforeDetach(e){const n=this.editorHostNode;n.removeEventListener("blur",this,!0),n.removeEventListener("click",this,!0),this.headerNode.removeEventListener("click",this)}_onSourceChanged(e,n){if(!this._changeGuard){if(this._inputDirty||this.editor.hasFocus()){this._dataDirty=!0;return}this._setValue()}}_onModelChanged(e,n){if(n.sourceChange){let s=!0;try{const a=JSON.parse(this.editor.model.sharedModel.getSource());this.removeClass(ue),this._inputDirty=!this._changeGuard&&!ie.deepEqual(a,this._originalValue)}catch{this.addClass(ue),this._inputDirty=!0,s=!1}this.revertButtonNode.hidden=!this._inputDirty,this.commitButtonNode.hidden=!s||!this._inputDirty}}_evtBlur(e){!this._inputDirty&&this._dataDirty&&this._setValue()}_evtClick(e){const n=e.target;this.revertButtonNode.contains(n)?this._setValue():this.commitButtonNode.contains(n)?!this.commitButtonNode.hidden&&!this.hasClass(ue)&&(this._changeGuard=!0,this._mergeContent(),this._changeGuard=!1,this._setValue()):this.editorHostNode.contains(n)&&this.editor.focus()}_mergeContent(){const e=this.editor.model,n=this._originalValue,s=JSON.parse(e.sharedModel.getSource()),a=this.source;if(a){for(const l in s)ie.deepEqual(s[l],n[l]||null)||a.set(l,s[l]);for(const l in n)l in s||a.delete(l)}}_setValue(){this._dataDirty=!1,this._inputDirty=!1,this.revertButtonNode.hidden=!0,this.commitButtonNode.hidden=!0,this.removeClass(ue);const e=this.editor.model,n=this._source?this._source.toJSON():{};if(this._changeGuard=!0,n===void 0)e.sharedModel.setSource(this._trans.__("No data!")),this._originalValue=ie.emptyObject;else{const s=JSON.stringify(n,null,4);e.sharedModel.setSource(s),this._originalValue=n,s.length>1&&s[0]==="{"&&this.editor.setCursorPosition({line:0,column:1})}this._changeGuard=!1,this.commitButtonNode.hidden=!0,this.revertButtonNode.hidden=!0}}class Vo extends M.Component{constructor(e){super(e),this._handleChange=s=>{this.setState({value:s.currentTarget.value})},this._handleSubmit=s=>{var a,l;s.preventDefault();const p=parseInt((l=(a=this._textInput)===null||a===void 0?void 0:a.value)!==null&&l!==void 0?l:"",10);return!isNaN(p)&&isFinite(p)&&1<=p&&p<=this.props.maxCell&&this.props.handleSubmit(p),!1},this._handleFocus=()=>{this.setState({hasFocus:!0})},this._handleBlur=()=>{this.setState({hasFocus:!1})},this._textInput=null;const n=e.translator||R;this._trans=n.load("jupyterlab"),this.state={value:"",hasFocus:!1,textInputId:ft.createDomID()+"-cell-number-input"}}componentDidMount(){var e;(e=this._textInput)===null||e===void 0||e.focus()}render(){return M.createElement("div",{className:"jp-lineFormSearch"},M.createElement("form",{name:"cellNumberForm",onSubmit:this._handleSubmit,noValidate:!0},M.createElement("div",{className:vt("jp-lineFormWrapper","lm-lineForm-wrapper",this.state.hasFocus?"jp-lineFormWrapperFocusWithin":void 0)},M.createElement("input",{type:"number",id:this.state.textInputId,className:"jp-lineFormInput",min:1,max:this.props.maxCell,onChange:this._handleChange,onFocus:this._handleFocus,onBlur:this._handleBlur,value:this.state.value,ref:e=>{this._textInput=e}}),M.createElement("div",{className:"jp-baseLineForm jp-lineFormButtonContainer"},M.createElement(_t.react,{className:"jp-baseLineForm jp-lineFormButtonIcon",elementPosition:"center"}),M.createElement("input",{type:"submit",className:"jp-baseLineForm jp-lineFormButton",value:""}))),M.createElement("label",{className:"jp-lineFormCaption",htmlFor:this.state.textInputId},this._trans.__("Go to cell number between 1 and %1",this.props.maxCell))))}}function Uo(r){const n=(r.translator||R).load("jupyterlab"),s=r.selectionStart>0&&r.selectionStart!==r.selectionEnd?n.__("%1:%2/%3",r.selectionStart,r.selectionEnd,r.totalCells):n.__("Cell %1/%2",r.activeCell,r.totalCells),a=l=>{(l.key==="Enter"||l.key==="Spacebar"||l.key===" ")&&(l.preventDefault(),l.stopPropagation(),r.handleClick())};return M.createElement(De,{role:"button","aria-haspopup":!0,onClick:r.handleClick,source:s,title:n.__("Go to cell…"),tabIndex:0,onKeyDown:a})}class re extends me{constructor(e={}){super(new re.Model),this._popup=null,this.addClass("jp-mod-highlighted"),this._translator=e.translator||R}render(){return this.model===null?null:M.createElement(Uo,{activeCell:this.model.activeCell,selectionStart:this.model.selectionStart,selectionEnd:this.model.selectionEnd,totalCells:this.model.totalCells,translator:this._translator,handleClick:()=>this._handleClick()})}_handleClick(){if(this.model.totalCells<1)return;this._popup&&this._popup.dispose();const e=Te.create(M.createElement(Vo,{handleSubmit:n=>this._handleSubmit(n),maxCell:this.model.totalCells,translator:this._translator}));this._popup=Eo({body:e,anchor:this,align:"right"})}_handleSubmit(e){var n;const s=this.model.notebook;if(!s)return;const a=e-1;s.activeCellIndex=a,s.deselectAll(),s.scrollToItem(a).catch(l=>{console.error("Go to cell",l)}),(n=this._popup)===null||n===void 0||n.dispose(),s.activate()}}(function(r){class e extends Ce{constructor(){super(...arguments),this._activeCell=0,this._selectionStart=0,this._selectionEnd=0,this._totalCells=0,this._notebook=null}get notebook(){return this._notebook}set notebook(s){const a=this._notebook;a&&(a.activeCellChanged.disconnect(this._onChanged,this),a.modelContentChanged.disconnect(this._onChanged,this),a.selectionChanged.disconnect(this._onChanged,this));const l=this._getAllState();this._notebook=s,this._notebook?(this._notebook.activeCellChanged.connect(this._onChanged,this),this._notebook.modelContentChanged.connect(this._onChanged,this),this._notebook.selectionChanged.connect(this._onChanged,this),this._updateStateFromNotebook(this._notebook)):(this._activeCell=0,this._selectionStart=0,this._selectionEnd=0,this._totalCells=0),this._triggerChange(l,this._getAllState())}get activeCell(){return this._activeCell}get selectionStart(){return this._selectionStart}get selectionEnd(){return this._selectionEnd}get totalCells(){return this._totalCells}_onChanged(s){const a=this._getAllState();this._updateStateFromNotebook(s),this._triggerChange(a,this._getAllState())}_updateStateFromNotebook(s){const a=s.activeCellIndex;this._activeCell=a>=0?a+1:0,this._totalCells=s.widgets.length;let l=this._activeCell,p=this._activeCell,i=!1;s.widgets.forEach((u,d)=>{if(!s.isSelectedOrActive(u))return;const g=d+1;if(!i){l=g,p=g,i=!0;return}p=g}),this._selectionStart=i?l:0,this._selectionEnd=i?p:0}_getAllState(){return{activeCell:this._activeCell,selectionStart:this._selectionStart,selectionEnd:this._selectionEnd,totalCells:this._totalCells}}_triggerChange(s,a){(s.activeCell!==a.activeCell||s.selectionStart!==a.selectionStart||s.selectionEnd!==a.selectionEnd||s.totalCells!==a.totalCells)&&this.stateChanged.emit(void 0)}}r.Model=e})(re||(re={}));const qo="jp-Notebook-toolbarCellType",Do="jp-Notebook-toolbarCellTypeDropdown";var Ae;(function(r){function e(g,b){const f=(b||R).load("jupyterlab");function _(){if(g.context.model.readOnly)return tt({title:f.__("Cannot Save"),body:f.__("Document is read-only"),buttons:[ke.okButton()]});g.context.save().then(()=>{if(!g.isDisposed)return g.context.createCheckpoint()})}return yt(Te.create(J.createElement(xt,{signal:g.context.fileChanged},()=>J.createElement(wt,{icon:kt,onClick:_,tooltip:f.__("Save the notebook contents and create checkpoint"),enabled:!!(g&&g.context&&g.context.contentsModel&&g.context.contentsModel.writable)}))))}r.createSaveButton=e;function n(g,b){const f=(b||R).load("jupyterlab");return new Z({icon:St,onClick:()=>{v.insertBelow(g.content)},tooltip:f.__("Insert a cell below")})}r.createInsertButton=n;function s(g,b,f){const _=(b||R).load("jupyterlab");return new Z({icon:Ye,onClick:async()=>{f?.get("useSystemClipboardForCells").composite?await v.cutToSystemClipboard(g.content):v.cut(g.content)},tooltip:_.__("Cut the selected cells")})}r.createCutButton=s;function a(g,b,f){const _=(b||R).load("jupyterlab");return new Z({icon:Xe,onClick:async()=>{f?.get("useSystemClipboardForCells").composite?await v.copyToSystemClipboard(g.content):v.copy(g.content)},tooltip:_.__("Copy the selected cells")})}r.createCopyButton=a;function l(g,b,f){const _=(b||R).load("jupyterlab");return new Z({icon:Qe,onClick:async()=>{f?.get("useSystemClipboardForCells").composite?await v.pasteFromSystemClipboard(g.content):v.paste(g.content)},tooltip:_.__("Paste cells from the clipboard")})}r.createPasteButton=l;function p(g,b,f){const _=(f??R).load("jupyterlab");return new Z({icon:Ze,onClick:()=>{v.runAndAdvance(g.content,g.sessionContext,b,f)},tooltip:_.__("Run the selected cells and advance")})}r.createRunButton=p;function i(g,b,f){const _=(f??R).load("jupyterlab");return new Z({icon:et,onClick:()=>{const y=b??new Be({translator:f});y.restart(g.sessionContext).then(w=>(w&&v.runAll(g.content,g.sessionContext,y,f),w))},tooltip:_.__("Restart the kernel, then re-run the whole notebook")})}r.createRestartRunAllButton=i;function u(g,b){return new $o(g.content,b)}r.createCellTypeItem=u;function d(g,b,f,_){return[{name:"save",widget:e(g,f)},{name:"insert",widget:n(g,f)},{name:"cut",widget:s(g,f,_)},{name:"copy",widget:a(g,f,_)},{name:"paste",widget:l(g,f,_)},{name:"run",widget:p(g,b,f)},{name:"interrupt",widget:he.createInterruptButton(g.sessionContext,f)},{name:"restart",widget:he.createRestartButton(g.sessionContext,b,f)},{name:"restart-and-run",widget:i(g,b,f)},{name:"cellType",widget:u(g,f)},{name:"spacer",widget:At.createSpacerItem()},{name:"kernelName",widget:he.createKernelNameItem(g.sessionContext,b,f)}]}r.getDefaultItems=d})(Ae||(Ae={}));class $o extends Te{constructor(e,n){super(),this.handleChange=s=>{s.target.value!=="-"&&(v.changeCellType(this._notebook,s.target.value),this._notebook.activate())},this.handleKeyDown=s=>{s.key==="Enter"&&this._notebook.activate()},this._trans=(n||R).load("jupyterlab"),this.addClass(qo),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 n of this._notebook.widgets)if(this._notebook.isSelectedOrActive(n)&&n.model.type!==e){e="-";break}return J.createElement(Ro,{className:Do,onChange:this.handleChange,onKeyDown:this.handleKeyDown,value:e,"aria-label":this._trans.__("Cell type"),title:this._trans.__("Select the cell type")},J.createElement("option",{value:"-"},"-"),J.createElement("option",{value:"code"},this._trans.__("Code")),J.createElement("option",{value:"markdown"},this._trans.__("Markdown")),J.createElement("option",{value:"raw"},this._trans.__("Raw")))}}function Ke(r){var e;const n=r.translator||R,s=ht(n),a=n.load("jupyterlab"),l=(e=r.displayOption.showJumpToCell)!==null&&e!==void 0?e:!1,p=r.state,i=r.displayOption.showOnToolBar,u=r.displayOption.showProgress,d=i?"down":"up",g=M.createElement("div",null),[b,f]=M.useState(!1);if(M.useEffect(()=>{if(b)return;const j=()=>{f(!0)};return v.executionScheduled.connect(j),()=>{v.executionScheduled.disconnect(j)}},[l,b]),!p)return g;const _=p.kernelStatus,y={alignSelf:"normal",height:"24px"},w=p.totalTime,S=p.scheduledCellNumber||0,o=p.scheduledCell.size||0,t=S-o;let h=100*t/S,C=u?"":"hidden";!u&&h<100&&(h=0);const k=j=>M.createElement(Lo,{progress:j,width:16,height:24,label:a.__("Kernel status")}),A=j=>a.__("Kernel status: %1",j),B=()=>{const j=r.notebook;v.selectLastRunCell(j),j.activeCell&&j.scrollToCell(j.activeCell)},E=(j,K,W)=>M.createElement("div",{className:"jp-Notebook-ExecutionIndicator",title:u?"":A(s[j]),"data-status":j},K,M.createElement("div",{className:`jp-Notebook-ExecutionIndicator-tooltip ${d} ${C}`},M.createElement("span",null," ",A(s[j])," "),W,l&&b&&M.createElement(Bt,{className:"jp-Notebook-ExecutionIndicator-jumpButton",onClick:B,title:a.__("Jump to current or last executed cell")},a.__("Jump to cell"))));if(p.kernelStatus==="connecting"||p.kernelStatus==="disconnected"||p.kernelStatus==="unknown")return E(_,M.createElement(Mt.react,{...y}),[]);if(p.kernelStatus==="starting"||p.kernelStatus==="terminating"||p.kernelStatus==="restarting"||p.kernelStatus==="initializing")return E(_,M.createElement(Tt.react,{...y}),[]);if(p.executionStatus==="busy")return E("busy",k(h),[M.createElement("span",{key:0},a.__("Executed %1/%2 cells",t,S)),M.createElement("span",{key:1},a._n("Elapsed time: %1 second","Elapsed time: %1 seconds",w))]);{const j=p.kernelStatus==="busy"?0:100,K=p.kernelStatus==="busy"||w===0?[]:[M.createElement("span",{key:0},a._n("Executed %1 cell","Executed %1 cells",S)),M.createElement("span",{key:1},a._n("Elapsed time: %1 second","Elapsed time: %1 seconds",w))];return E(p.kernelStatus,k(j),K)}}class X extends me{constructor(e,n=!0){super(new X.Model),this.translator=e||R,this.addClass("jp-mod-highlighted")}dispose(){var e;this.isDisposed||((e=this.model)===null||e===void 0||e.dispose(),super.dispose())}render(){if(this.model===null||!this.model.renderFlag)return M.createElement("div",null);{const e=this.model.currentNotebook;return e?M.createElement(Ke,{displayOption:this.model.displayOption,state:this.model.executionState(e),translator:this.translator,notebook:e}):M.createElement(Ke,{displayOption:this.model.displayOption,state:void 0,translator:this.translator,notebook:void 0})}}}(function(r){class e extends Ce{constructor(){super(),this._notebookExecutionProgress=new WeakMap,this._displayOption={showOnToolBar:!0,showProgress:!0,showJumpToCell:!1},this._renderFlag=!0}attachNotebook(l){var p,i,u,d;if(l&&l.content&&l.context){const g=l.content,b=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 f=this._notebookExecutionProgress.get(g),_=o=>{f&&(f.kernelStatus=o.kernelDisplayStatus),this.stateChanged.emit(void 0)};b.statusChanged.connect(_,this);const y=o=>{f&&(f.kernelStatus=o.kernelDisplayStatus),this.stateChanged.emit(void 0)};b.connectionStatusChanged.connect(y,this),b.disposed.connect(o=>{o.connectionStatusChanged.disconnect(y,this),o.statusChanged.disconnect(_,this)},this);const w=(o,t)=>{const h=t.msg,C=h.header.msg_id;if(h.header.msg_type==="execute_request")this._cellScheduledCallback(g,C);else if(Y.KernelMessage.isStatusMsg(h)&&h.content.execution_state==="idle"){const k=h.parent_header.msg_id;this._cellExecutedCallback(g,k)}else Y.KernelMessage.isStatusMsg(h)&&h.content.execution_state==="restarting"?this._restartHandler(g):h.header.msg_type==="execute_input"&&this._startTimer(g)};(i=(p=b.session)===null||p===void 0?void 0:p.kernel)===null||i===void 0||i.anyMessage.connect(w,this),(d=(u=b.session)===null||u===void 0?void 0:u.kernel)===null||d===void 0||d.disposed.connect(o=>o.anyMessage.disconnect(w,this),this);const S=(o,t)=>{f&&(this._resetTime(f),this.stateChanged.emit(void 0),t.newValue&&t.newValue.anyMessage.connect(w,this))};b.kernelChanged.connect(S,this),b.disposed.connect(o=>o.kernelChanged.disconnect(S,this),this)}}}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 i=this._notebookExecutionProgress.get(l);i&&i.scheduledCell.has(p)&&(i.scheduledCell.delete(p),i.scheduledCell.size===0&&this._scheduleSwitchToIdle(i))}_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 i=this._notebookExecutionProgress.get(l);i&&!i.scheduledCell.has(p)&&(i.needReset&&this._resetTime(i),i.scheduledCell.add(p),i.scheduledCellNumber+=1)}_tick(l){if(this.isDisposed){clearInterval(l.interval),clearTimeout(l.timeout);return}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 n(a,l,p){const i=new r(l);return i.model.displayOption={showOnToolBar:!0,showProgress:!0,showJumpToCell:!1},i.model.attachNotebook({content:a.content,context:a.sessionContext}),p&&p.then(u=>{const d=g=>{const b=s(g);b.showJumpToCell&&(g.get("recordTiming").composite||g.set("recordTiming",!0).catch(_=>{console.error("Failed to auto-enable recordTiming:",_.message)})),i.model.updateRenderOption(b)};u.changed.connect(d),d(u),i.disposed.connect(()=>{u.changed.disconnect(d)})}).catch(u=>{console.error(u.message)}),i}r.createExecutionIndicatorItem=n;function s(a){let l=!0,p=!0,i=!1;const u=a.get("kernelStatus").composite;return u&&(l=!u.showOnStatusBar,p=u.showProgress,i=u.showJumpToRecentExecutionButton),{showOnToolBar:l,showProgress:p,showJumpToCell:i}}r.getSettingValue=s})(X||(X={}));function Jo(r){const e=(r.translator||R).load("jupyterlab");return J.createElement(De,{source:e.__("Mode: %1",r.modeNames[r.notebookMode])})}class ae extends me{constructor(e){super(new ae.Model),this.translator=e||R,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]),J.createElement(Jo,{notebookMode:this.model.notebookMode,translator:this.translator,modeNames:this._modeNames})):null}}(function(r){class e extends Ce{constructor(){super(...arguments),this._onChanged=s=>{const a=this._notebookMode;this._notebook?this._notebookMode=s.mode:this._notebookMode="command",this._triggerChange(a,this._notebookMode)},this._notebookMode="command",this._notebook=null}get notebookMode(){return this._notebookMode}set notebook(s){const a=this._notebook;a!==null&&(a.stateChanged.disconnect(this._onChanged,this),a.activeCellChanged.disconnect(this._onChanged,this),a.modelContentChanged.disconnect(this._onChanged,this));const l=this._notebookMode;this._notebook=s,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(s,a){s!==a&&this.stateChanged.emit(void 0)}}r.Model=e})(ae||(ae={}));class zo extends ko{constructor(e,n){super(e,n),this.editorWidget=e,this.options=n,this._type="code",this._readyDelegate=new Et,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 n,s=this.language_info();return!s||!s.mimetype?n=this.widget.content.codeMimetype:n=s.mimetype,Array.isArray(n)?(e=n[0])!==null&&e!==void 0?e:Nt.defaultMimeType:n}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(n=>({ceEditor:this._getCellEditor(n),type:n.model.type,value:n.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 n=this._getCellAt(e);return this.widget.content.widgets.findIndex(a=>n===a)}getEditorIndex(e){let n=this._editorToCell.get(e);return this.editor.widgets.findIndex(s=>n===s)}getEditorWrapper(e){return this._editorToCell.get(e).node}async onKernelChanged(e,n){if(n.newValue)try{const s=this._languageInfo;await He(this.isReady,-1),await this._updateLanguageInfo();const a=this._languageInfo;s?.name!=a.name||s?.mimetype!=a?.mimetype||s?.file_extension!=a?.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(s){console.warn(s),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(),Ot.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,n){let s=[],a=[];const l=this._type;if(n.type==="set"){let p=[],i=[];if(n.newValues.length===n.oldValues.length){for(let u=0;u<n.newValues.length;u++)n.oldValues[u].type===l&&n.newValues[u].type!==l?p.push(n.newValues[u]):n.oldValues[u].type!==l&&n.newValues[u].type===l&&i.push(n.newValues[u]);s=i,a=p}}else n.type=="add"&&(s=n.newValues.filter(p=>p.type===l));(a.length||s.length||n.type==="set"||n.type==="move"||n.type==="remove"||n.type==="clear")&&await this.updateDocuments();for(let p of s){let i=this.widget.content.widgets.find(u=>u.model.id===p.id);if(!i){console.warn(`Widget for added cell with ID: ${p.id} not found!`);continue}this._getCellEditor(i)}}createVirtualDocument(){return new So({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 He(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,n,s,a;const l=(a=await((s=(n=(e=this.widget.context.sessionContext)===null||e===void 0?void 0:e.session)===null||n===void 0?void 0:n.kernel)===null||s===void 0?void 0:s.info))===null||a===void 0?void 0:a.language_info;if(l)this._languageInfo=l;else throw new Error("Language info update failed (no session, kernel, or info available)")}_activeCellChanged(e,n){!n||n.model.type!==this._type||this._activeEditorChanged.emit({editor:this._getCellEditor(n)})}_getCellAt(e){let n=this.virtualDocument.getEditorAtVirtualLine(e);return this._editorToCell.get(n)}_getCellEditor(e){if(!this._cellToEditor.has(e)){const n=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,n),this._editorToCell.set(n,e),e.disposed.connect(()=>{this._cellToEditor.delete(e),this._editorToCell.delete(n),this._editorRemoved.emit({editor:n})}),this._editorAdded.emit({editor:n})}return this._cellToEditor.get(e)}}class Go extends ee{constructor(){super(),this._items=[],this.layout=new be,this.addClass("jp-RankedPanel")}addWidget(e,n){const s={widget:e,rank:n},a=le.upperBound(this._items,s,Me.itemCmp);le.insert(this._items,a,s),this.layout.insertWidget(a,e)}onChildRemoved(e){const n=le.findFirstIndex(this._items,s=>s.widget===e.child);n!==-1&&le.removeAt(this._items,n)}}class q extends ee{constructor(e){super(),this.addClass("jp-NotebookTools"),this.translator=e.translator||R,this._tools=[],this.layout=new be,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 n=e.content;return n.widgets.filter(s=>n.isSelectedOrActive(s))}get activeNotebookPanel(){return this._tracker.currentWidget}addItem(e){var n;const s=e.tool,a=(n=e.rank)!==null&&n!==void 0?n:100;let l;const p=this._tools.find(i=>i.section===e.section);if(p)l=p.panel;else throw new Error(`The section ${e.section} does not exist`);s.addClass("jp-NotebookTools-tool"),l.addWidget(s,a),s.notebookTools=this,G.sendMessage(s,q.ActiveNotebookPanelMessage),G.sendMessage(s,q.ActiveCellMessage)}addSection(e){var n;const s=e.sectionName,a=e.label||e.sectionName,l=e.tool;let p=(n=e.rank)!==null&&n!==void 0?n:null;const i=new Go;if(i.title.label=a,l&&i.addWidget(l,0),this._tools.push({section:s,panel:i,rank:p}),p!=null)this.layout.insertWidget(p,new ce({widget:i}));else{let u=null;const d=this.layout;for(let g=0;g<d.widgets.length;g++){let b=d.widgets[g];if(b instanceof ce&&b.widget.id==="advancedToolsSection"){u=g;break}}u!==null?this.layout.insertWidget(u,new ce({widget:i})):this.layout.addWidget(new ce({widget:i}))}}_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 n of this._toolChildren())G.sendMessage(n,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 n of this._toolChildren())G.sendMessage(n,q.ActiveCellMessage)}_onSelectionChanged(){for(const e of this._toolChildren())G.sendMessage(e,q.SelectionMessage)}_onActiveNotebookPanelMetadataChanged(e,n){const s=new ge.ChangeMessage("activenotebookpanel-metadata-changed",{oldValue:void 0,newValue:void 0,...n});for(const a of this._toolChildren())G.sendMessage(a,s)}_onActiveCellMetadataChanged(e,n){const s=new ge.ChangeMessage("activecell-metadata-changed",{newValue:void 0,oldValue:void 0,...n});for(const a of this._toolChildren())G.sendMessage(a,s)}*_toolChildren(){for(let e of this._tools)yield*e.panel.children()}}(function(r){r.ActiveNotebookPanelMessage=new xe("activenotebookpanel-changed"),r.ActiveCellMessage=new xe("activecell-changed"),r.SelectionMessage=new xe("selection-changed");class e extends ee{dispose(){super.dispose(),this.notebookTools&&(this.notebookTools=null)}processMessage(a){switch(super.processMessage(a),a.type){case"activenotebookpanel-changed":this.onActiveNotebookPanelChanged(a);break;case"activecell-changed":this.onActiveCellChanged(a);break;case"selection-changed":this.onSelectionChanged(a);break;case"activecell-metadata-changed":this.onActiveCellMetadataChanged(a);break;case"activenotebookpanel-metadata-changed":this.onActiveNotebookPanelMetadataChanged(a);break}}onActiveNotebookPanelChanged(a){}onActiveCellChanged(a){}onSelectionChanged(a){}onActiveCellMetadataChanged(a){}onActiveNotebookPanelMetadataChanged(a){}}r.Tool=e;class n extends e{constructor(a){super();const{editorFactory:l}=a;this.addClass("jp-MetadataEditorTool");const p=this.layout=new be;this._editorFactory=l,this._editorLabel=a.label||"Edit Metadata",this.createEditor();const i=new ee({node:document.createElement("label")});i.node.textContent=a.label||"Edit Metadata",p.addWidget(i),p.addWidget(this.editor)}get editor(){return this._editor}onActiveNotebookPanelChanged(a){this.editor.dispose(),this.notebookTools.activeNotebookPanel&&this.createEditor()}createEditor(){this._editor=new Ko({editorFactory:this._editorFactory}),this.editor.title.label=this._editorLabel,this.layout.addWidget(this.editor)}}r.MetadataEditorTool=n})(q||(q={}));var Me;(function(r){function e(n,s){return n.rank-s.rank}r.itemCmp=e})(Me||(Me={}));const Yo=6;var V;(function(r){r[r.Idle=-1]="Idle",r[r.Error=-.5]="Error",r[r.Scheduled=0]="Scheduled",r[r.Running=1]="Running"})(V||(V={}));class Xo extends Po{constructor(e,n,s,a){super(e,a),this.parser=n,this.sanitizer=s,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),v.executionScheduled.connect(this.onExecutionScheduled,this),v.executed.connect(this.onExecuted,this),v.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 n=new Array;let s=this._cellToHeadingIndex.get(e);if(s!==void 0){const a=this.headings[s];for(n.push(a);this.headings[s-1]&&this.headings[s-1].cellRef===a.cellRef;)s--,n.unshift(this.headings[s])}return n}dispose(){var e,n,s;this.isDisposed||(this.headingsChanged.disconnect(this.onHeadingsChanged,this),(n=(e=this.widget.context)===null||e===void 0?void 0:e.model)===null||n===void 0||n.metadataChanged.disconnect(this.onMetadataChanged,this),(s=this.widget.content)===null||s===void 0||s.activeCellChanged.disconnect(this.onActiveCellChanged,this),v.executionScheduled.disconnect(this.onExecutionScheduled,this),v.executed.disconnect(this.onExecuted,this),v.outputCleared.disconnect(this.onOutputCleared,this),this._runningCells.length=0,this._errorCells.length=0,super.dispose())}setConfiguration(e){const n=this.loadConfigurationFromMetadata();super.setConfiguration({...this.configuration,...n,...e})}toggleCollapse(e){super.toggleCollapse(e),this.updateRunningStatus(this.headings)}async getHeadings(){const e=this.widget.content.widgets,n=new Set(e),s=[],a=new Array,l=new WeakMap;for(let p=0;p<e.length;p++){const i=e[p];switch(i.model.type){case"code":{!this.configuration.syncCollapseState&&this.configuration.includeOutput&&s.push(...Le(await i.getHeadings(),this.configuration,a).map(d=>({...d,cellRef:i,collapsed:!1,isRunning:V.Idle})));break}case"markdown":{const d=Le(await i.getHeadings(),this.configuration,a).map((g,b)=>({...g,cellRef:i,collapsed:!1,isRunning:V.Idle}));if(this.configuration.syncCollapseState&&i.headingCollapsed){const g=Math.min(...d.map(f=>f.level)),b=d.find(f=>f.level===g);b.collapsed=i.headingCollapsed}s.push(...d);break}}s.length>0&&l.set(i,s.length-1)}return this._cellToHeadingIndex=l,this._runningCells=this._runningCells.filter(p=>n.has(p)),this._errorCells=this._errorCells.filter(p=>n.has(p)),this.updateRunningStatus(s),Promise.resolve(s)}isHeadingEqual(e,n){return super.isHeadingEqual(e,n)&&e.cellRef===n.cellRef&&e.isRunning===n.isRunning}loadConfigurationFromMetadata(){const e=this.widget.content.model,n={};if(e)for(const s in this.configMetadataMap){const a=this.configMetadataMap[s];for(const l of a){let p=l;const i=p[0]==="!";i&&(p=p.slice(1));const u=p.split("/");let d=e.getMetadata(u[0]);for(let g=1;g<u.length;g++)d=(d??{})[u[g]];d!==void 0&&(typeof d=="boolean"&&i&&(d=!d),n[s]=d)}}return n}onActiveCellChanged(e,n){const s=this.getCellHeadings(n)[0];this.setActiveHeading(s??null,!1)}onHeadingsChanged(){this.widget.content.activeCell&&this.onActiveCellChanged(this.widget.content,this.widget.content.activeCell)}onExecuted(e,n){this._runningCells.forEach((s,a)=>{var l;if(s===n.cell){this._runningCells.splice(a,1);const p=this._cellToHeadingIndex.get(s);if(p!==void 0){const i=this.headings[p];if(n.success||((l=n.error)===null||l===void 0?void 0:l.errorName)===void 0){i.isRunning=V.Idle;return}i.isRunning=V.Error,this._errorCells.includes(s)||this._errorCells.push(s)}}}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onExecutionScheduled(e,n){this._runningCells.includes(n.cell)||this._runningCells.push(n.cell),this._errorCells.forEach((s,a)=>{s===n.cell&&this._errorCells.splice(a,1)}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onOutputCleared(e,n){this._errorCells.forEach((s,a)=>{if(s===n.cell){this._errorCells.splice(a,1);const l=this._cellToHeadingIndex.get(s);if(l!==void 0){const p=this.headings[l];p.isRunning=V.Idle}}}),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onMetadataChanged(){this.setConfiguration({})}updateRunningStatus(e){e.forEach(a=>{a.isRunning=V.Idle}),this._runningCells.forEach((a,l)=>{const p=this._cellToHeadingIndex.get(a);if(p!==void 0){const i=e[p];i.isRunning!==V.Running&&(i.isRunning=l>0?V.Scheduled:V.Running)}}),this._errorCells.forEach((a,l)=>{const p=this._cellToHeadingIndex.get(a);if(p!==void 0){const i=e[p];i.isRunning===V.Idle&&(i.isRunning=V.Error)}});let n=0;for(;n<e.length;){const a=e[n];if(n++,a.collapsed){const l=Math.max(a.isRunning,s(e,a.level));a.dataset={...a.dataset,"data-running":l.toString()}}else a.dataset={...a.dataset,"data-running":a.isRunning.toString()}}function s(a,l){let p=V.Idle;for(;n<a.length;){const i=a[n];if(i.dataset={...i.dataset,"data-running":i.isRunning.toString()},i.level>l)n++,p=Math.max(i.isRunning,p),i.collapsed&&(p=Math.max(p,s(a,i.level)),i.dataset={...i.dataset,"data-running":p.toString()});else break}return p}}}class Qo extends Io{constructor(e,n,s,a){super(e),this.parser=n,this.sanitizer=s,this.commands=a,this._scrollToTop=!0}get scrollToTop(){return this._scrollToTop}set scrollToTop(e){this._scrollToTop=e}_createNew(e,n){const s=new Xo(e,this.parser,this.sanitizer,n);let a=new WeakMap;const l=(_,y)=>{if(y){const w=async h=>{if(!h.inViewport)return;let C=a.get(y);if((!C||!y.cellRef.node.contains(C))&&(await i(h),C=a.get(y)),C)if(this.scrollToTop)C.scrollIntoView({block:"start"}),e.content.outerNode.scrollTop-=Yo;else{const k=e.content.node.getBoundingClientRect(),A=C.getBoundingClientRect();(A.top>k.bottom||A.bottom<k.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)},S=y.cellRef,t=e.content.widgets.indexOf(S);S.model.type=="markdown"&&e.content.mode!="command"&&(e.content.mode="command"),e.content.activeCellIndex=t,S.inViewport?w(S).catch(h=>{console.error(`Fail to scroll to cell to display the required heading (${h}).`)}):e.content.scrollToItem(t,this.scrollToTop?"start":void 0).then(()=>i(S)).then(()=>w(S)).catch(h=>{console.error(`Fail to scroll to cell to display the required heading (${h}).`)})}},p=_=>s.getCellHeadings(_).filter(y=>y.cellRef===_),i=async _=>{var y;const w=p(_),S=(y=this.sanitizer.allowNamedProperties)!==null&&y!==void 0&&y?"id":"data-jupyter-id",o=await Promise.all(w.map(async h=>{const C=await Zo(h,this.parser,this.sanitizer);return C?`h${h.level}[${S}="${CSS.escape(C)}"]`:`h${h.level}`})),t=p(_);t.length!==w.length||t.some((h,C)=>h!==w[C])||(we(_.node),w.forEach((h,C)=>{var k,A;const B=h.outputIndex===void 0?h.cellRef.node:(k=h.cellRef.outputArea.widgets[h.outputIndex])===null||k===void 0?void 0:k.node;a.set(h,B?It(B,o[C],(A=h.prefix)!==null&&A!==void 0?A:""):null)}))},u=_=>{if(this.parser){we(e.content.node),a=new WeakMap;for(const y of e.content.widgets)y instanceof Q&&y.renderedChanged.connect(f);return Promise.all(e.content.widgets.map(y=>i(y)))}},d=(_,y)=>{var w,S,o,t;if(s.configuration.syncCollapseState)if(y!==null){const h=y.cellRef;h.headingCollapsed!==((w=y.collapsed)!==null&&w!==void 0?w:!1)&&(h.headingCollapsed=(S=y.collapsed)!==null&&S!==void 0?S:!1)}else{const h=(t=(o=s.headings[0])===null||o===void 0?void 0:o.collapsed)!==null&&t!==void 0?t:!1;e.content.widgets.forEach(C=>{C instanceof Q&&C.headingInfo.level>=0&&(C.headingCollapsed=h)})}},g=(_,y)=>{if(s.configuration.syncCollapseState){const w=s.getCellHeadings(y)[0];w&&s.toggleCollapse({heading:w,collapsed:y.headingCollapsed})}},b=(_,y)=>{var w;y.inViewport?(w=i(y))===null||w===void 0||w.catch(console.warn):we(y.node)},f=(_,y)=>{y&&i(_).catch(console.warn)};return e.context.ready.then(()=>{var _;(_=u())===null||_===void 0||_.catch(console.warn),s.activeHeadingChanged.connect(l),s.headingsChanged.connect(u),s.collapseChanged.connect(d),e.content.cellCollapsed.connect(g),e.content.cellInViewportChanged.connect(b),e.disposed.connect(()=>{s.activeHeadingChanged.disconnect(l),s.headingsChanged.disconnect(u),s.collapseChanged.disconnect(d),e.content.cellCollapsed.disconnect(g),e.content.cellInViewportChanged.disconnect(b);for(const y of e.content.widgets)y instanceof Q&&y.renderedChanged.disconnect(f)})}),s}getToolbarItems(e){return this.commands?[{name:"select-last-modified-back",widget:new Pe({commands:this.commands,id:"notebook:select-last-modified-cell",args:{toolbar:!0},icon:jt,label:""})},{name:"select-last-modified-forward",widget:new Pe({commands:this.commands,id:"notebook:select-next-modified-cell",args:{toolbar:!0},icon:Rt,label:""})}]:[]}}async function Zo(r,e,n){let s=null;return r.type===We.HeadingType.Markdown?s=await Pt(e,r.raw,r.level,n):r.type===We.HeadingType.HTML&&(s=r.id),s}const en="jp-StatusItem-trust";function tn(r,e){e=e||R;const n=e.load("jupyterlab");return r.trustedCells===r.totalCells?n.__("Notebook trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells):r.activeCellTrusted?n.__("Active cell trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells):n.__("Notebook not trusted: %1 of %2 code cells trusted.",r.trustedCells,r.totalCells)}function on(r){return r.allCellsTrusted?M.createElement(Lt.react,{top:"2px",stylesheet:"statusBar"}):M.createElement(Wt.react,{top:"2px",stylesheet:"statusBar"})}class de extends me{constructor(e){super(new de.Model),this.translator=e||R,this.node.classList.add(en)}render(){if(!this.model)return null;const e=tn(this.model,this.translator);return e!==this.node.title&&(this.node.title=e),M.createElement(on,{allCellsTrusted:this.model.trustedCells===this.model.totalCells,activeCellTrusted:this.model.activeCellTrusted,totalCells:this.model.totalCells,trustedCells:this.model.trustedCells})}}(function(r){class e extends Ce{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(s){const a=this._notebook;a!==null&&(a.activeCellChanged.disconnect(this._onActiveCellChanged,this),a.modelContentChanged.disconnect(this._onModelChanged,this));const l=this._getAllState();if(this._notebook=s,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:i}=this._deriveCellTrustState(this._notebook.model);this._totalCells=p,this._trustedCells=i}this._triggerChange(l,this._getAllState())}_onModelChanged(s){const a=this._getAllState(),{total:l,trusted:p}=this._deriveCellTrustState(s.model);this._totalCells=l,this._trustedCells=p,this._triggerChange(a,this._getAllState())}_onActiveCellChanged(s,a){const l=this._getAllState();a?this._activeCellTrusted=a.model.trusted:this._activeCellTrusted=!1,this._triggerChange(l,this._getAllState())}_deriveCellTrustState(s){if(s===null)return{total:0,trusted:0};let a=0,l=0;for(const p of s.cells)p.type==="code"&&(a++,p.trusted&&l++);return{total:a,trusted:l}}_getAllState(){return[this._trustedCells,this._totalCells,this.activeCellTrusted]}_triggerChange(s,a){(s[0]!==a[0]||s[1]!==a[1]||s[2]!==a[2])&&this.stateChanged.emit(void 0)}}r.Model=e})(de||(de={}));const nn=new ot("@jupyterlab/metadataform:IMetadataFormProvider","A service to register new metadata editor widgets."),ln={id:"@jupyterlab/notebook-extension:cell-executor",description:"Provides the notebook cell executor.",autoStart:!0,provides:lt,activate:()=>Object.freeze({runCell:Ht})},sn=new ot("@jupyterlab/logconsole:ILoggerRegistry","A service providing a logger infrastructure."),rn={activate:an,id:"@jupyterlab/notebook-extension:log-output",description:"Adds cell outputs log to the application logger.",requires:[L],optional:[sn],autoStart:!0};function an(r,e,n){if(!n)return;function s(a){function l(p,i,u){if(Y.KernelMessage.isDisplayDataMsg(p)||Y.KernelMessage.isStreamMsg(p)||Y.KernelMessage.isErrorMsg(p)||Y.KernelMessage.isExecuteResultMsg(p)){const d=n.getLogger(a.context.path);d.rendermime=a.content.rendermime;const g={...p.content,output_type:p.header.msg_type};let b=i;(Y.KernelMessage.isErrorMsg(p)||Y.KernelMessage.isStreamMsg(p)&&p.content.name==="stderr")&&(b=u),d.log({type:"output",data:g,level:b})}}a.context.sessionContext.iopubMessage.connect((p,i)=>l(i,"info","info"),a),a.context.sessionContext.unhandledMessage.connect((p,i)=>l(i,"warning","error"),a)}e.forEach(a=>s(a)),e.widgetAdded.connect((a,l)=>s(l))}const dn="jp-ActiveCellTool",cn="jp-ActiveCellTool-Content",un="jp-ActiveCellTool-CellContent";class hn extends q.Tool{constructor(e){super(),this._cellModel=null,this._updateId=0,this._pendingUpdate=!1,this._promptOutdated=!1,this._tracker=e.tracker,this._languages=e.languages,this.addClass(dn),this.layout=new be,this._inputPrompt=new Ft,this.layout.addWidget(this._inputPrompt);const n=document.createElement("div");n.classList.add(cn);const s=n.appendChild(document.createElement("div")),a=s.appendChild(document.createElement("pre"));s.className=un,this._editorEl=a,this.layout.addWidget(new ee({node:n})),this._previewDebouncer=new Kt(()=>this._update(),150),this._tracker.activeCellChanged.connect(this._onActiveCellChanged,this),this._tracker.currentChanged.connect(this._onActiveCellChanged,this),this._onActiveCellChanged()}dispose(){this.isDisposed||(this._tracker.activeCellChanged.disconnect(this._onActiveCellChanged,this),this._tracker.currentChanged.disconnect(this._onActiveCellChanged,this),this._disconnectCellModel(),this._previewDebouncer.dispose(),super.dispose())}render(e){return M.createElement("div",{ref:n=>{!n||this.node.parentElement===n||(n.appendChild(this.node),this._pendingUpdate&&this._update().catch(console.warn))}})}_onActiveCellChanged(){var e,n;const s=(n=(e=this._tracker.activeCell)===null||e===void 0?void 0:e.model)!==null&&n!==void 0?n:null;s!==this._cellModel&&(this._disconnectCellModel(),this._cellModel=s,s&&(s.sharedModel.changed.connect(this._onCellContentChanged,this),s.mimeTypeChanged.connect(this._onCellContentChanged,this)),this._promptOutdated=!0,this._update().catch(console.warn))}_onCellContentChanged(){if(!this.node.isConnected){this._pendingUpdate=!0,this._promptOutdated=!0;return}this._promptOutdated||this._updatePrompt(),this._previewDebouncer.invoke().catch(console.warn)}_disconnectCellModel(){const e=this._cellModel;e&&(e.sharedModel.changed.disconnect(this._onCellContentChanged,this),e.mimeTypeChanged.disconnect(this._onCellContentChanged,this),this._cellModel=null)}_updatePrompt(){var e;const n=this._cellModel;n&&Vt(n)?(this._inputPrompt.executionCount=`${(e=n.executionCount)!==null&&e!==void 0?e:""}`,this._inputPrompt.show()):(this._inputPrompt.executionCount=null,this._inputPrompt.hide())}async _update(){if(!this.node.isConnected){this._pendingUpdate=!0;return}this._pendingUpdate=!1;const e=this._cellModel,n=++this._updateId;if(!e){this._promptOutdated=!1,this._updatePrompt(),this._editorEl.replaceChildren();return}const s=e.sharedModel.getSource(),a=s.indexOf(`
|
|
2
2
|
`),l=a===-1?s:s.slice(0,a),p=document.createElement("pre");try{await this._languages.highlight(l,this._languages.findByMIME(e.mimeType),p)}catch(u){console.warn(u),p.replaceChildren(document.createTextNode(l))}if(n!==this._updateId)return;this._promptOutdated&&(this._updatePrompt(),this._promptOutdated=!1);const i=document.createDocumentFragment();for(;p.firstChild;)i.appendChild(p.firstChild);this._editorEl.replaceChildren(i)}}const pn="jp-CellMetadataEditor",gn="jp-NotebookMetadataEditor";class mn 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,n,s;const a=(e=this._tracker.activeCell)===null||e===void 0?void 0:e.model.sharedModel;if(a&&this.editor.source){const l=Object.keys((n=a.metadata)!==null&&n!==void 0?n:{}),p=(s=this.editor.source.toJSON())!==null&&s!==void 0?s:{};a.transact(()=>{l.forEach(i=>a.deleteMetadata(i)),a.setMetadata(p)})}}render(e){var n;const s=this._tracker.activeCell,a=this.editor.source;return this.editor.source=s?new ge({values:s.model.metadata}):null,a?.dispose(),(n=this.editor.source)===null||n===void 0||n.changed.connect(this._onSourceChanged,this),M.createElement("div",{className:pn},M.createElement("div",{ref:l=>l?.appendChild(this.node)}))}}class Cn 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,n;this.editor.source&&((n=(e=this._tracker.currentWidget)===null||e===void 0?void 0:e.model)===null||n===void 0||n.sharedModel.setMetadata(this.editor.source.toJSON()))}render(e){var n,s;const a=this._tracker.currentWidget,l=this.editor.source;return this.editor.source=a?new ge({values:(n=a.model)===null||n===void 0?void 0:n.metadata}):null,l?.dispose(),(s=this.editor.source)===null||s===void 0||s.changed.connect(this._onSourceChanged,this),M.createElement("div",{className:gn},M.createElement("div",{ref:p=>p?.appendChild(this.node)}))}}var c;(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.toggleOutputScrolling="notebook:toggle-output-scrolling",r.selectLastRunCell="notebook:select-last-run-cell",r.selectLastModifiedCell="notebook:select-last-modified-cell",r.selectNextModifiedCell="notebook:select-next-modified-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",r.copySelectedtext="notebook:copy-selected-text",r.pasteText="notebook:paste-text",r.cutSelectedtext="notebook:cut-selected-text"})(c||(c={}));const D="Notebook",bn=["notebook","python","custom"],fn="@jupyterlab/notebook-extension:panel",Ve="jp-NotebookExtension-sideBySideMargins",te={id:"@jupyterlab/notebook-extension:tracker",description:"Provides the notebook widget tracker.",provides:L,requires:[st,uo,lt],optional:[$e,mo,Co,at,dt,bo,_e,Je,F,Ee,rt],activate:qn,autoStart:!0},vn={id:"@jupyterlab/notebook-extension:factory",description:"Provides the notebook and cell factory.",provides:Se.IContentFactory,requires:[fe],autoStart:!0,activate:(r,e)=>{const n=e.factoryService.newInlineEditor;return new Se.ContentFactory({editorFactory:n})}},_n={activate:Hn,provides:go,id:"@jupyterlab/notebook-extension:tools",description:"Provides the notebook tools.",autoStart:!0,requires:[L,fe,it,Ut.IStateDB,F],optional:[po]},yn={id:"@jupyterlab/notebook-extension:mode-status",description:"Adds a notebook mode status widget.",autoStart:!0,requires:[L,F],optional:[ve],activate:(r,e,n,s)=>{if(!s)return;const{shell:a}=r,l=new ae(n);e.currentChanged.connect(()=>{const p=e.currentWidget;l.model.notebook=p&&p.content}),s.registerStatusItem("@jupyterlab/notebook-extension:mode-status",{priority:1,item:l,align:"right",rank:4,isActive:()=>!!a.currentWidget&&!!e.currentWidget&&a.currentWidget===e.currentWidget})}},ct={id:"@jupyterlab/notebook-extension:cell-counter-status",description:"Adds a notebook cell counter status widget.",autoStart:!0,requires:[L,F],optional:[ve],activate:(r,e,n,s)=>{if(!s)return;const{shell:a}=r,l=new re({translator:n}),p=()=>{const i=e.currentWidget;l.model.notebook=i&&i.content};e.currentChanged.connect(p),p(),s.registerStatusItem(ct.id,{priority:1,item:l,align:"right",rank:2.5,isActive:()=>!!a.currentWidget&&!!e.currentWidget&&a.currentWidget===e.currentWidget})}},xn={id:"@jupyterlab/notebook-extension:execution-indicator",description:"Adds a notebook execution status widget.",autoStart:!0,requires:[L,fo,F],optional:[ve,_e],activate:(r,e,n,s,a,l)=>{let p,i,u;const d=g=>{var b,f;let{showOnToolBar:_,showProgress:y,showJumpToCell:w}=g;if(_)u&&(n.currentChanged.disconnect(i),u.dispose());else{if(!a)return;p?.model||(p=new X(s),i=(S,o)=>{const{newValue:t}=o;if(t&&e.has(t)){const h=t;p.model.attachNotebook({content:h.content,context:h.sessionContext})}},u=a.registerStatusItem("@jupyterlab/notebook-extension:execution-indicator",{item:p,align:"left",rank:3,isActive:()=>{const S=n.currentWidget;return!!S&&e.has(S)}}),p.model.attachNotebook({content:(b=e.currentWidget)===null||b===void 0?void 0:b.content,context:(f=e.currentWidget)===null||f===void 0?void 0:f.sessionContext}),n.currentChanged.connect(i),p.disposed.connect(()=>{n.currentChanged.disconnect(i)})),p.model.displayOption={showOnToolBar:_,showProgress:y,showJumpToCell:w}}};if(l){const g=l.load(te.id);Promise.all([g,r.restored]).then(([b])=>{d(X.getSettingValue(b)),b.changed.connect(f=>d(X.getSettingValue(f)))}).catch(b=>{console.error(b.message)})}}},wn={id:"@jupyterlab/notebook-extension:export",description:"Adds the export notebook commands.",autoStart:!0,requires:[F,L],optional:[dt,$e],activate:(r,e,n,s,a)=>{var l;const p=e.load("jupyterlab"),{commands:i,shell:u}=r,d=r.serviceManager,g=()=>H.isEnabled(u,n);i.addCommand(c.exportToFormat,{label:y=>{if(y.label===void 0)return p.__("Save and Export Notebook to the given `format`.");const w=y.label;return y.isPalette?p.__("Save and Export Notebook: %1",w):w},execute:async y=>{var w,S,o;const t=m(n,u,y);if(!t)return;const{context:h}=t,C=pe.PageConfig.getNotebookVersion(),k=pe.compareVersions(C,[4,0,0])<0&&pe.compareVersions(C,[2,18,0])>=0;let A=!1;if(y.format==="html"&&k){const E=await Ge.getBoolean({title:p.__("Export as HTML"),label:p.__("Sanitize HTML output"),value:!0});if(!E.button.accept)return;A=(w=E.value)!==null&&w!==void 0?w:!1}const B={format:y.format,path:t.context.path,exporterOptions:{download:!0,sanitizeHtml:A}};return h.model.dirty&&!h.model.readOnly&&await h.save(),(o=(S=d.nbconvert).exportAs)===null||o===void 0?void 0:o.call(S,B)},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 b;s&&(b=(l=s.fileMenu.items.find(y=>{var w;return y.type==="submenu"&&((w=y.submenu)===null||w===void 0?void 0:w.id)==="jp-mainmenu-file-notebookexport"}))===null||l===void 0?void 0:l.submenu);let f=!1;const _=async()=>{if(f)return;n.widgetAdded.disconnect(_),f=!0;const y=await d.nbconvert.getExportFormats(!1);if(!y)return;const w=H.getFormatLabels(e);Object.keys(y).forEach(function(o){const t=o[0].toLocaleUpperCase()+o.slice(1),h=p.__(t),C=w[o]?w[o]:h;let k={format:o,label:C,isPalette:!1};if(bn.indexOf(o)===-1&&(b&&b.addItem({command:c.exportToFormat,args:k}),a)){k={format:o,label:C,isPalette:!0};const A=p.__("Notebook Operations");a.addItem({command:c.exportToFormat,category:A,args:k})}})};n.widgetAdded.connect(_)}},kn={id:"@jupyterlab/notebook-extension:trust-status",description:"Adds the notebook trusted status widget.",autoStart:!0,requires:[L,F],optional:[ve],activate:(r,e,n,s)=>{if(!s)return;const{shell:a}=r,l=new de(n);e.currentChanged.connect(()=>{const p=e.currentWidget;l.model.notebook=p&&p.content}),s.registerStatusItem("@jupyterlab/notebook-extension:trust-status",{item:l,align:"right",rank:3,isActive:()=>!!a.currentWidget&&!!e.currentWidget&&a.currentWidget===e.currentWidget})}},Sn={id:"@jupyterlab/notebook-extension:widget-factory",description:"Provides the notebook widget factory.",provides:st,requires:[Se.IContentFactory,fe,vo,pt],optional:[_e,Je,F],activate:Fn,autoStart:!0},An={id:"@jupyterlab/notebook-extension:cloned-outputs",description:"Adds the clone output feature.",requires:[yo,L,F],optional:[at],activate:Kn,autoStart:!0},Mn={id:"@jupyterlab/notebook-extension:code-console",description:"Adds the notebook code consoles features.",requires:[L,F],activate:Vn,autoStart:!0},Tn={id:"@jupyterlab/notebook-extension:copy-output",description:"Adds the copy cell outputs feature.",activate:Un,requires:[F,L],autoStart:!0},Bn={id:"@jupyterlab/notebook-extension:kernel-status",description:"Adds the notebook kernel status.",activate:(r,e,n)=>{const s=a=>{let l=null;return a&&e.has(a)?a.sessionContext:l};n.addSessionProvider(s)},requires:[L,gt],autoStart:!0},En={id:"@jupyterlab/notebook-extension:cursor-position",description:"Adds the notebook cursor position status.",activate:(r,e,n)=>{let s=null;const a=async l=>{let p=null;if(l!==s){if(s?.content.activeCellChanged.disconnect(n.update),s=null,l&&e.has(l)){l.content.activeCellChanged.connect(n.update);const i=l.content.activeCell;p=null,i&&(await i.ready,p=i.editor),s=l}}else if(l){const i=l.content.activeCell;p=null,i&&(await i.ready,p=i.editor)}return p};n.addEditorProvider(a)},requires:[L,qt],autoStart:!0},Nn={id:"@jupyterlab/notebook-extension:completer",description:"Adds the code completion capability to notebooks.",requires:[L],optional:[xo,F,ze],activate:Dn,autoStart:!0},On={id:"@jupyterlab/notebook-extension:search",description:"Adds search capability to notebooks.",requires:[wo],autoStart:!0,activate:(r,e)=>{e.add("jp-notebookSearchProvider",Qt)}},jn={id:"@jupyterlab/notebook-extension:toc",description:"Adds table of content capability to the notebooks",requires:[L,Dt,ze],optional:[_o,_e],autoStart:!0,activate:(r,e,n,s,a,l)=>{const p=new Qo(e,a,s,r.commands);n.add(p),l&&Promise.all([r.restored,l.load(te.id)]).then(([i,u])=>{const d=()=>{var g;p.scrollToTop=(g=u.composite.scrollHeadingToTop)!==null&&g!==void 0?g:!0};d(),u.changed.connect(d)}).catch(i=>{console.error("Failed to load notebook table of content settings.",i)})}},Rn={id:"@jupyterlab/notebook-extension:language-server",description:"Adds language server capability to the notebooks.",requires:[L,Ao,Mo,To,Bo],activate:$n,autoStart:!0},In={id:"@jupyterlab/notebook-extension:update-raw-mimetype",description:"Adds metadata form editor for raw cell mimetype.",autoStart:!0,requires:[L,nn,F],activate:(r,e,n,s)=>{const a=s.load("jupyterlab");let l=!1;async function p(){if(l||!n.get("commonToolsSection"))return;const i=n.get("commonToolsSection").getProperties("/raw_mimetype");if(!i)return;e.widgetAdded.disconnect(p),l=!0;const d=await r.serviceManager.nbconvert.getExportFormats(!1);if(!d)return;const g=Object.keys(d),b=H.getFormatLabels(s);g.forEach(function(f){var _;if(!(((_=i.oneOf)===null||_===void 0?void 0:_.filter(w=>w.const===f).length)>0)){const w=f[0].toLocaleUpperCase()+f.slice(1),S=a.__(w),o=b[f]?b[f]:S,t=d[f].output_mimetype;i.oneOf.push({const:t,title:o})}}),n.get("commonToolsSection").setProperties("/raw_mimetype",i)}e.widgetAdded.connect(p)}},Pn={id:"@jupyterlab/notebook-extension:metadata-editor",description:"Adds metadata form for full metadata editor.",autoStart:!0,requires:[L,fe,Ee],optional:[F],activate:(r,e,n,s,a)=>{const l=g=>n.factoryService.newInlineEditor(g),p=new mn({editorFactory:l,tracker:e,label:"Cell metadata",translator:a}),i={fieldRenderer:g=>p.render(g)};s.addRenderer("@jupyterlab/notebook-extension:metadata-editor.cell-metadata",i);const u=new Cn({editorFactory:l,tracker:e,label:"Notebook metadata",translator:a}),d={fieldRenderer:g=>u.render(g)};s.addRenderer("@jupyterlab/notebook-extension:metadata-editor.notebook-metadata",d)}},Ln={id:"@jupyterlab/notebook-extension:active-cell-tool",description:"Adds active cell field in the metadata editor tab.",autoStart:!0,requires:[L,Ee,it],activate:(r,e,n,s)=>{const a=new hn({tracker:e,languages:s}),l={fieldRenderer:p=>a.render(p)};n.addRenderer("@jupyterlab/notebook-extension:active-cell-tool.renderer",l)}},Wn={id:"@jupyterlab/notebook-extension:open-with-no-kernel",description:'Adds the "Notebook (no kernel)" option to the Open With menu.',requires:[rt],optional:[F],autoStart:!0,activate:(r,e,n)=>{const{tracker:s}=e,a=(n??R).load("jupyterlab"),l=[];function p(i){var u,d;l.forEach(_=>_.dispose()),l.length=0;const g=(d=(u=i.menu.items.find(_=>{var y;return _.type==="submenu"&&((y=_.submenu)===null||y===void 0?void 0:y.id)==="jp-contextmenu-open-with"}))===null||u===void 0?void 0:u.submenu)!==null&&d!==void 0?d:null;if(!g)return;(s.currentWidget?Array.from(s.currentWidget.selectedItems()):[]).some(_=>_.type==="notebook")&&l.push(g.addItem({command:"filebrowser:open",args:{label:a.__("Notebook (no kernel)"),factory:D,kernelPreference:{shouldStart:!1,shouldReuse:!1}}}))}r.contextMenu.opened.connect(p)}},cl=[ln,vn,te,xn,wn,_n,ct,yn,kn,Sn,rn,An,Mn,Tn,Bn,En,Nn,On,jn,Rn,In,Pn,Ln,Wn];function Hn(r,e,n,s,a,l,p){const i=l.load("jupyterlab"),u="notebook-tools",d=new q({tracker:e,translator:l}),g=(b,f)=>{switch(f.type){case"activate-request":a.save(u,{open:!0});break;case"after-hide":case"close-request":a.remove(u);break}return!0};return d.title.icon=Jt,d.title.dataset={...d.title.dataset,jpTabLabel:i.__("Notebook Tools")},d.title.caption=i.__("Notebook Tools"),d.id=u,G.installMessageHook(d,g),p&&e.widgetAdded.connect((b,f)=>{p.register(f).render(d)}),d}function Fn(r,e,n,s,a,l,p,i){const u=i??R,d=p??new Be({translator:u}),g=pe.PageConfig.getOption("notebookStartsKernel"),b=g===""||g.toLowerCase()==="true",{commands:f}=r;let _;a.addFactory(D,"save",S=>ho.createSaveButton(f,S.context.fileChanged)),a.addFactory(D,"cellType",S=>Ae.createCellTypeItem(S,u)),a.addFactory(D,"kernelName",S=>he.createKernelNameItem(S.sessionContext,d,u)),a.addFactory(D,"executionProgress",S=>{const o=l?.load(te.id),t=X.createExecutionIndicatorItem(S,u,o);return o?.then(h=>{S.disposed.connect(()=>{h.dispose()})}),t}),l&&(_=zt(a,l,D,fn,u));const y=u.load("jupyterlab"),w=new jo({name:D,label:y.__("Notebook"),fileTypes:["notebook"],modelName:"notebook",defaultFor:["notebook"],preferKernel:b,canStartKernel:!0,rendermime:s,contentFactory:e,editorConfig:se.defaultEditorConfig,notebookConfig:se.defaultNotebookConfig,mimeTypeService:n.mimeTypeService,toolbarFactory:_,translator:u});return r.docRegistry.addWidgetFactory(w),w}function Kn(r,e,n,s,a){const l=s.load("jupyterlab"),p=new Gt({namespace:"cloned-outputs"});a&&a.restore(p,{command:c.createOutputView,args:g=>({path:g.content.path,index:g.content.index}),name:g=>`${g.content.path}:${g.content.index}`,when:n.restored});const{commands:i,shell:u}=r,d=()=>H.isEnabledAndSingleSelected(u,n);i.addCommand(c.createOutputView,{label:l.__("Create New View for Cell Output"),execute:async g=>{var b;let f,_;const y=g.path;let w=g.index;if(y&&w!==void 0&&w!==null){if(_=e.findWidget(y,D),!_)return}else{if(_=n.currentWidget,!_)return;f=_.content.activeCell,w=_.content.activeCellIndex}const S=new H.ClonedOutputArea({notebook:_,cell:f,index:w,translator:s}),o=new Yt({content:S});_.context.addSibling(o,{ref:_.id,mode:"split-bottom",type:"Cloned Output"});const t=()=>{p.save(o)};_.context.pathChanged.connect(t),(b=_.context.model)===null||b===void 0||b.cells.changed.connect(t),p.add(o),_.content.disposed.connect(()=>{var h;_.context.pathChanged.disconnect(t),(h=_.context.model)===null||h===void 0||h.cells.changed.disconnect(t),o.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 Vn(r,e,n){const s=n.load("jupyterlab"),{commands:a,shell:l}=r,p=()=>H.isEnabled(l,e);a.addCommand(c.createConsole,{label:s.__("New Console for Notebook"),execute:i=>{const u=e.currentWidget;if(u)return H.createConsole(a,u,i.activate)},isEnabled:p,describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:s.__("Whether to activate the console after creation")}}}}}),a.addCommand(c.createSubshellConsole,{label:s.__("New Subshell Console for Notebook"),execute:i=>{const u=e.currentWidget;if(u)return H.createConsole(a,u,i.activate,!0)},isEnabled:p,isVisible:()=>{var i,u,d;const g=(u=(i=e.currentWidget)===null||i===void 0?void 0:i.context.sessionContext.session)===null||u===void 0?void 0:u.kernel;return(d=g?.supportsSubshells)!==null&&d!==void 0?d:!1},describedBy:{args:{type:"object",properties:{activate:{type:"boolean",description:s.__("Whether to activate the console after creation")}}}}}),a.addCommand(c.runInConsole,{label:s.__("Run Selected Text or Current Line in Console"),execute:async i=>{var u,d;const g=e.currentWidget;if(!g)return;const{context:b,content:f}=g,_=f.activeCell,y=_?.model.metadata,w=b.path;if(!_||_.model.type!=="code")return;let S;const o=_.editor;if(!o)return;const t=o.getSelection(),{start:h,end:C}=t;if(h.column!==C.column||h.line!==C.line){const A=o.getOffsetAt(t.start),B=o.getOffsetAt(t.end);S=o.model.sharedModel.getSource().substring(A,B)}else{const A=o.getCursorPosition(),B=o.model.sharedModel.getSource().split(`
|
|
3
3
|
`);let E=t.start.line;for(;E<o.lineCount&&!B[E].replace(/\s/g,"").length;)E+=1;let j=E>0,K=0,W=K+1;for(;;){S=B.slice(K,W).join(`
|
|
4
4
|
`);const oe=await((d=(u=g.context.sessionContext.session)===null||u===void 0?void 0:u.kernel)===null||d===void 0?void 0:d.requestIsComplete({code:S+`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as I,J as i,aD as F,ea as ae,eb as le,ec as Y,ed as se,cv as ce,cp as de,aJ as me,ee as ue,cr as pe,ef as fe,cl as he,aC as w,eg as ge,eh as Q,ei as be,ej as ve,ek as M,el as $,em as W,en as V,eo as ye,ep as _e,eq as Ee,er as Ce,bT as je,es as Fe,bU as Se,et as xe,eu as q,_ as D,ev as ke,ew as Ie,af as Te,ex as we,ey as U,ez as O,eA as Ne,eB as Ae}from"../datalayer-app-main.js";import{T as Me,b as Le}from"./index--S8WFITA.js";import{I as Be}from"./tokens-Dyd4wiX6.js";import{I as Pe}from"./tokens-DiDi0Nkm.js";import{C as De,a as Oe}from"./index-6zxBQeM_.js";import{I as X,a as Z,b as R}from"./token-d9po19EN.js";import{F as Re,c as Ge,A as $e,g as J,v as We}from"./index-DBu0kmO8.js";import{I as Ve}from"./tokens-DY_UrMLq.js";import{a as qe}from"./tokens-BYcJtuKD.js";import{c as Ue}from"./index-9EhrHHj7.js";import{s as Je}from"./hover-B3uFmZ-0.js";import"./hoverbox-CStlKQWE.js";import"./_baseRest-BmxuuM4H.js";import"./isSymbol-BLtK9CV6.js";import"./forEach-hknrtmxV.js";import"./uniqueId-BVuTZY3F.js";import"./toNumber-B1wj8-wx.js";import"./_baseClone-ByJL1tkX.js";import"./merge-B_wcPK4Y.js";import"./isEqual-BYxXubsX.js";import"./Output-D-7eUege.js";import"./index-9wJFadG-.js";import"./dayjs.min-u3zuoSR8.js";import"./d3-color-Jd8hXty2.js";import"./dist-BrUAt6vF.js";import"./KebabHorizontalIcon-D6AY8pIS.js";import"./PaintbrushIcon-CFBHU-3l.js";import"./index-CqP3xLL5.js";import"./RestartIcon-DvpOf5Mf.js";import"./CellSidebarExtension-D7aXShZc.js";import"./NotebookSkeleton-BkzTMhIX.js";import"./Avatar-MNx1kN3F.js";import"./renderer-8__rsP1H.js";import"./SquareIcon-Dy3l3VdH.js";import"./FileDirectoryOpenFillIcon-jGhuRcP3.js";import"./url-C6fJII94.js";/* empty css *//* empty css */import"./style-DdAxk_bj.js";/* empty css */import"./style-Cj1gzCjo.js";/* empty css */import"./style-rkw8dR9f.js";import"./style-GHJFdtIz.js";import"./style-ZSIOeMoX.js";import"./style-iVfD6mFL.js";import"./style-DA-Ya7rp.js";import"./style-D3tvWcFO.js";import"./style-BOqStzF9.js";import"./style-ADLQJ-E9.js";import"./style-DgglluaK.js";import"./ArrowLeftIcon-sX3iNMG1.js";import"./SkubbleIcon-CAaVh_BE.js";import"./usePrimerThemeBridge-DyX4EYyN.js";import"./index-BbcMy3Al.js";import"./KernelVariables-D3DSQaD3.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-BMjQTGrr.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-BncUh2ly.js";import"./sessions-CgjtuOSm.js";import"./tokens-CBhRbpQP.js";import"./drivecontents-D1HzL7Fi.js";import"./kernel-BmfZmtIo.js";const ze={submitButtonOptions:{norender:!0}},z=t=>{var e;const r=((e=t.translator)!==null&&e!==void 0?e:F).load("jupyterlab");let a;const n=()=>t.direction==="up"?!t.item.hasMoveUp:!t.item.hasMoveDown,u=t.direction==="up"?t.item.index-1:t.item.index+1;if(t.buttonStyle==="icons"){const m={tag:"span",elementPosition:"center"};return a=t.direction==="up"?i.createElement(ae.react,{...m}):i.createElement(le.react,{...m}),i.createElement(Y,{className:"jp-ArrayOperationsButton",onClick:t.item.onReorderClick(t.item.index,u),disabled:n(),appearance:"stealth",title:r.__("Move item %1",t.direction)},a)}else return i.createElement("button",{className:"jp-mod-styled jp-mod-reject jp-ArrayOperationsButton",onClick:t.item.onReorderClick(t.item.index,u),disabled:n()},t.direction==="up"?r.__("Move up"):r.__("Move down"))},He=t=>{var e;const r=((e=t.translator)!==null&&e!==void 0?e:F).load("jupyterlab");let a;return t.buttonStyle==="icons"?(a=i.createElement(se.react,{tag:"span",elementPosition:"center"}),i.createElement(Y,{className:"jp-mod-styled jp-mod-warn jp-ArrayOperationsButton",onClick:t.item.onDropIndexClick(t.item.index),appearance:"stealth",title:r.__("Remove item")},a)):i.createElement("button",{className:"jp-mod-styled jp-mod-warn jp-ArrayOperationsButton",onClick:t.item.onDropIndexClick(t.item.index)},r.__("Remove"))},ee=t=>{var e;const r=((e=t.translator)!==null&&e!==void 0?e:F).load("jupyterlab");let a;return t.buttonStyle==="icons"?a=i.createElement(ce.react,{tag:"span",elementSize:"xlarge",elementPosition:"center"}):a=r.__("Add"),i.createElement("button",{className:"jp-mod-styled jp-mod-accept jp-ArrayOperationsButton",onClick:t.onAddClick,title:r.__("Add item")},a)};function G(t){const{component:e,name:r,buttonStyle:a,compact:n,showModifiedFromDefault:u,translator:m}=t,s=n??!1,p=a??(s?"icons":"text"),h=f=>e({...f,buttonStyle:p,compact:s,showModifiedFromDefault:u??!0,translator:m??F});return r&&(h.displayName=r),h}function te(t,e){const r=J("TitleFieldTemplate",t,e),a=J("DescriptionFieldTemplate",t,e);return{TitleField:r,DescriptionField:a}}const Ke=t=>G({...t,name:"JupyterLabArrayTemplate",component:e=>{var r;const{schema:a,registry:n,uiSchema:u,required:m}=e,s={schema:a,registry:n,uiSchema:u,required:m},{TitleField:p,DescriptionField:h}=te(n,u);return i.createElement("div",{className:e.className},e.compact?i.createElement("div",{className:"jp-FormGroup-compactTitle"},i.createElement("div",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem",id:`${e.idSchema.$id}__title`},e.title||""),i.createElement("div",{className:"jp-FormGroup-description",id:`${e.idSchema.$id}-description`},e.schema.description||"")):i.createElement(i.Fragment,null,e.title&&i.createElement(p,{...s,title:e.title,id:`${e.idSchema.$id}-title`}),i.createElement(h,{...s,id:`${e.idSchema.$id}-description`,description:(r=e.schema.description)!==null&&r!==void 0?r:""})),e.items.map(f=>i.createElement("div",{key:f.key,className:f.className},f.children,i.createElement("div",{className:"jp-ArrayOperations"},i.createElement(z,{buttonStyle:e.buttonStyle,translator:e.translator,item:f,direction:"up"}),i.createElement(z,{buttonStyle:e.buttonStyle,translator:e.translator,item:f,direction:"down"}),i.createElement(He,{buttonStyle:e.buttonStyle,translator:e.translator,item:f})))),e.canAdd&&i.createElement(ee,{onAddClick:e.onAddClick,buttonStyle:e.buttonStyle,translator:e.translator}))}}),Ye=t=>G({...t,name:"JupyterLabObjectTemplate",component:e=>{var r;const{schema:a,registry:n,uiSchema:u,required:m}=e,s={schema:a,registry:n,uiSchema:u,required:m},{TitleField:p,DescriptionField:h}=te(n,u);return i.createElement("fieldset",{id:e.idSchema.$id},e.compact?i.createElement("div",{className:"jp-FormGroup-compactTitle"},i.createElement("div",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem",id:`${e.idSchema.$id}__title`},e.title||""),i.createElement("div",{className:"jp-FormGroup-description",id:`${e.idSchema.$id}__description`},e.schema.description||"")):i.createElement(i.Fragment,null,(e.title||(e.uiSchema||I.emptyObject)["ui:title"])&&i.createElement(p,{...s,id:`${e.idSchema.$id}__title`,title:e.title||`${(e.uiSchema||I.emptyObject)["ui:title"]}`||""}),i.createElement(h,{...s,id:`${e.idSchema.$id}__description`,description:(r=e.schema.description)!==null&&r!==void 0?r:""})),e.properties.map(f=>f.content),Ge(e.schema,e.uiSchema,e.formData)&&i.createElement(ee,{onAddClick:e.onAddClick(e.schema),buttonStyle:e.buttonStyle,translator:e.translator}))}}),Qe=t=>G({...t,name:"JupyterLabFieldTemplate",component:e=>{var r;const a=((r=e.translator)!==null&&r!==void 0?r:F).load("jupyterlab");let n=!1,u;const{formData:m,schema:s,label:p,displayLabel:h,id:f,formContext:o,errors:l,rawErrors:d,children:c,onKeyChange:g,onDropPropertyClick:_}=e,{defaultFormData:y}=o,C=f.split("_");C.shift();const E=C.join("."),v=E==="",j=E===(e.uiSchema||I.emptyObject)["ui:field"];e.showModifiedFromDefault&&(u=C.reduce((x,P)=>x?.[P],y),n=!v&&m!==void 0&&u!==void 0&&!s.properties&&s.type!=="array"&&!I.deepEqual(m,u));const S=!v&&s.type!="object"&&f!="jp-SettingsEditor-@jupyterlab/shortcuts-extension:shortcuts_shortcuts",N=s.hasOwnProperty($e),B=!(s.type==="object"||s.type==="array");return i.createElement("div",{className:`form-group ${h||s.type==="boolean"?"small-field":""}`},!j&&(d?.length?i.createElement("div",{className:"jp-modifiedIndicator jp-errorIndicator"}):n&&i.createElement("div",{className:"jp-modifiedIndicator"})),i.createElement("div",{className:`jp-FormGroup-content ${e.compact?"jp-FormGroup-contentCompact":"jp-FormGroup-contentNormal"}`},B&&h&&!v&&p&&!N?e.compact?i.createElement("div",{className:"jp-FormGroup-compactTitle"},i.createElement("div",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem"},p),B&&s.description&&S&&i.createElement("div",{className:"jp-FormGroup-description"},s.description)):i.createElement("h3",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem"},p):i.createElement(i.Fragment,null),N&&i.createElement("input",{className:"jp-FormGroup-contentItem jp-mod-styled",type:"text",onBlur:x=>g(x.target.value),defaultValue:p}),i.createElement("div",{className:`${v?"jp-root":s.type==="object"?"jp-objectFieldWrapper":s.type==="array"?"jp-arrayFieldWrapper":"jp-inputFieldWrapper jp-FormGroup-contentItem"}`},c),N&&i.createElement("button",{className:"jp-FormGroup-contentItem jp-mod-styled jp-mod-warn jp-FormGroup-removeButton",onClick:_(p)},a.__("Remove")),!e.compact&&s.description&&S&&i.createElement("div",{className:"jp-FormGroup-description"},s.description),n&&u!==void 0&&s.type!=="object"&&i.createElement("div",{className:"jp-FormGroup-default"},a.__("Default: %1",u!==null?u.toLocaleString():"null")),i.createElement("div",{className:"validationErrors"},l)))}});function Xe(t){const{buttonStyle:e,compact:r,showModifiedFromDefault:a,translator:n,formContext:u,...m}=t,s={...m.uiSchema||I.emptyObject};s["ui:options"]={...ze,...s["ui:options"]},m.uiSchema=s;const{FieldTemplate:p,ArrayFieldTemplate:h,ObjectFieldTemplate:f}=t.templates||I.emptyObject,o={buttonStyle:e,compact:r,showModifiedFromDefault:a,translator:n},l=i.useMemo(()=>p??Qe(o),[p,e,r,a,n]),d=i.useMemo(()=>h??Ke(o),[h,e,r,a,n]),c=i.useMemo(()=>f??Ye(o),[f,e,r,a,n]),g={FieldTemplate:l,ArrayFieldTemplate:d,ObjectFieldTemplate:c};return i.createElement(Re,{templates:g,formContext:u,...m})}class Ze extends i.Component{constructor(e){super(e),this._handleChange=r=>{this.setState({value:r.currentTarget.value})},this._handleSubmit=r=>{r.preventDefault();const a=parseInt(this._textInput.value,10);return!isNaN(a)&&isFinite(a)&&1<=a&&a<=this.props.maxLine&&this.props.handleSubmit(a),!1},this._handleFocus=()=>{this.setState({hasFocus:!0})},this._handleBlur=()=>{this.setState({hasFocus:!1})},this._textInput=null,this.translator=e.translator||F,this._trans=this.translator.load("jupyterlab"),this.state={value:"",hasFocus:!1,textInputId:ue.createDomID()+"-line-number-input"}}componentDidMount(){this._textInput.focus()}render(){return i.createElement("div",{className:"jp-lineFormSearch"},i.createElement("form",{name:"lineColumnForm",onSubmit:this._handleSubmit,noValidate:!0},i.createElement("div",{className:pe("jp-lineFormWrapper","lm-lineForm-wrapper",this.state.hasFocus?"jp-lineFormWrapperFocusWithin":void 0)},i.createElement("input",{type:"text",id:this.state.textInputId,className:"jp-lineFormInput",onChange:this._handleChange,onFocus:this._handleFocus,onBlur:this._handleBlur,value:this.state.value,ref:e=>{this._textInput=e}}),i.createElement("div",{className:"jp-baseLineForm jp-lineFormButtonContainer"},i.createElement(fe.react,{className:"jp-baseLineForm jp-lineFormButtonIcon",elementPosition:"center"}),i.createElement("input",{type:"submit",className:"jp-baseLineForm jp-lineFormButton",value:""}))),i.createElement("label",{className:"jp-lineFormCaption",htmlFor:this.state.textInputId},this._trans.__("Go to line number between 1 and %1",this.props.maxLine))))}}function et(t){const r=(t.translator||F).load("jupyterlab"),a=n=>{if(n.key==="Enter"||n.key==="Spacebar"||n.key===" ")n.preventDefault(),n.stopPropagation(),t.handleClick();else return};return i.createElement(Me,{role:"button","aria-haspopup":!0,onClick:t.handleClick,source:r.__("Ln %1, Col %2",t.line,t.column),title:r.__("Go to line number…"),tabIndex:0,onKeyDown:a})}class L extends de{constructor(e){super(new L.Model),this._popup=null,this.addClass("jp-mod-highlighted"),this.translator=e||F}render(){return this.model===null?null:i.createElement(et,{line:this.model.line,column:this.model.column,translator:this.translator,handleClick:()=>this._handleClick()})}_handleClick(){this._popup&&this._popup.dispose();const e=me.create(i.createElement(Ze,{handleSubmit:r=>this._handleSubmit(r),currentLine:this.model.line,maxLine:this.model.editor.lineCount,translator:this.translator}));this._popup=Je({body:e,anchor:this,align:"right"})}_handleSubmit(e){this.model.editor.setCursorPosition({line:e-1,column:0}),this._popup.dispose(),this.model.editor.focus()}}(function(t){class e extends he{constructor(){super(...arguments),this._onSelectionChanged=()=>{const a=this._getAllState(),n=this.editor.getCursorPosition();this._line=n.line+1,this._column=n.column+1,this._triggerChange(a,this._getAllState())},this._line=1,this._column=1,this._editor=null}get editor(){return this._editor}set editor(a){var n;const u=this._editor;!((n=u?.model)===null||n===void 0)&&n.selections&&u.model.selections.changed.disconnect(this._onSelectionChanged);const m=this._getAllState();if(this._editor=a,!this._editor)this._column=1,this._line=1;else{this._editor.model.selections.changed.connect(this._onSelectionChanged);const s=this._editor.getCursorPosition();this._column=s.column+1,this._line=s.line+1}this._triggerChange(m,this._getAllState())}get line(){return this._line}get column(){return this._column}_getAllState(){return[this._line,this._column]}_triggerChange(a,n){(a[0]!==n[0]||a[1]!==n[1])&&this.stateChanged.emit(void 0)}}t.Model=e})(L||(L={}));var b;(function(t){t.deleteLine="codemirror:delete-line",t.toggleBlockComment="codemirror:toggle-block-comment",t.toggleComment="codemirror:toggle-comment",t.selectNextOccurrence="codemirror:select-next-occurrence",t.toggleTabFocusMode="codemirror:toggle-tab-focus-mode",t.toggleBold="codemirror:markdown-toggle-bold",t.foldCurrent="codemirror:fold-current",t.unfoldCurrent="codemirror:unfold-current",t.foldSubregions="codemirror:fold-subregions",t.unfoldSubregions="codemirror:unfold-subregions",t.foldAll="codemirror:fold-all",t.unfoldAll="codemirror:unfold-all"})(b||(b={}));function tt(t){return Fe(t)||Q(t)}const H=".cm-content",ot={id:"@jupyterlab/codemirror-extension:commands",description:"Registers commands acting on selected/active CodeMirror editor.",autoStart:!0,requires:[Pe],optional:[w,Le],activate:(t,e,r,a)=>{r=r??F;const n=r.load("jupyterlab"),u=o=>o.classList.contains(H),m=()=>{var o,l;const d=(o=t.contextMenuHitTest(u))!==null&&o!==void 0?o:(l=document.activeElement)===null||l===void 0?void 0:l.closest(H);if(d)return je.findFromDOM(d)},s=()=>!!m(),p=o=>{const{state:l}=o,{main:d}=l.selection;if(d.empty)return!1;const{from:c,to:g,anchor:_,head:y}=d,C=_>y,E=l.doc,v=E.sliceString(c,g),j=c>=2&&E.sliceString(c-2,c)==="**",S=E.sliceString(g,g+2)==="**",N=v.startsWith("**"),B=v.endsWith("**"),x=(k,T)=>{const A=C?T:k,re=C?k:T;return Se.single(A,re)};if(j&&S){const k=c-2,T=g+2,A=g-c;return o.dispatch({changes:{from:k,to:T,insert:v},selection:x(k,k+A)}),!0}if(N&&B&&v.length>=4){const k=v.slice(2,-2),T=c,A=c+k.length;return o.dispatch({changes:{from:c,to:g,insert:k},selection:x(T,A)}),!0}const P=`**${v}**`,ne=c+2,ie=g+2;return o.dispatch({changes:{from:c,to:g,insert:P},selection:x(ne,ie)}),!0},h=()=>{var o,l;const d=t.shell.currentWidget,c=(o=e.currentWidget)===null||o===void 0?void 0:o.content;if(e.currentWidget!==null&&e.currentWidget===d&&c&&c.activeCell)return{type:"notebook",widget:d,notebook:c,isEnabled:!0};const g=d;return g&&g.content&&typeof((l=g.content.editor)===null||l===void 0?void 0:l.focus)=="function"?{type:"fileEditor",widget:g,isEnabled:!0}:{type:"none",widget:null,isEnabled:!1}},f=()=>h().isEnabled;if(t.commands.addCommand(b.deleteLine,{label:n.__("Delete the current line"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const o=m();o&&ge(o)},isEnabled:s}),t.commands.addCommand(b.toggleBlockComment,{label:n.__("Toggle Block Comment"),caption:n.__("Toggles block comments; falls back to regular comment toggle when block comment syntax is unavailable"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const o=m();o&&tt(o)},isEnabled:s}),t.commands.addCommand(b.toggleComment,{label:n.__("Toggle Comment"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const o=m();o&&Q(o)},isEnabled:s}),t.commands.addCommand(b.toggleTabFocusMode,{label:n.__("Toggle Tab Focus Mode"),caption:n.__("Toggles behavior of Tab key between inserting indentation and moving to next focusable element"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const o=m();o&&be(o)},isEnabled:s}),t.commands.addCommand(b.selectNextOccurrence,{label:n.__("Select Next Occurrence"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const o=m();o&&ve(o)},isEnabled:s}),t.commands.addCommand(b.toggleBold,{label:n.__("Toggle Bold"),caption:n.__("Toggle bold formatting by wrapping/unwrapping selected text with **"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const o=m();o&&p(o)},isEnabled:s}),t.commands.addCommand(b.foldCurrent,{label:n.__("Fold Current Region"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{var o;const l=h();l.type==="notebook"?(l.notebook.mode="edit",l.notebook.activeCell&&((o=l.notebook.activeCell.editor)===null||o===void 0||o.focus())):l.type==="fileEditor"&&l.widget.content.editor.focus();const d=m();if(!d)return;const{state:c}=d,g=c.selection.main.head,_=c.doc.lineAt(g);M(c,_.from,_.to)&&$(d)},isEnabled:f}),t.commands.addCommand(b.unfoldCurrent,{label:n.__("Unfold Current Region"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{var o;const l=h();l.type==="notebook"?(l.notebook.mode="edit",l.notebook.activeCell&&((o=l.notebook.activeCell.editor)===null||o===void 0||o.focus())):l.type==="fileEditor"&&l.widget.content.editor.focus();const d=m();if(!d)return;const{state:c}=d,g=c.selection.main.head,_=c.doc.lineAt(g);M(c,_.from,_.to)&&W(d)},isEnabled:f}),t.commands.addCommand(b.foldSubregions,{label:n.__("Fold All Subregions"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{var o;const l=h();l.type==="notebook"?(l.notebook.mode="edit",l.notebook.activeCell&&((o=l.notebook.activeCell.editor)===null||o===void 0||o.focus())):l.type==="fileEditor"&&l.widget.content.editor.focus();const d=m();if(d)try{const{state:c}=d,g=c.selection.main.head,_=c.doc.lineAt(g),y=M(c,_.from,_.to);let C=!1;try{C=c.field(V,!1)!==void 0}catch{C=!1}if(C||($(d),W(d)),!y)return;const E=[];let v=y.from+1;for(;v<y.to;){const j=c.doc.lineAt(v),S=M(c,j.from,j.to);S&&S.from>y.from&&S.to<=y.to?(E.push(ye.of(S)),v=S.to):v=j.to+1}E.length>0&&d.dispatch({effects:E})}catch{}},isEnabled:f}),t.commands.addCommand(b.unfoldSubregions,{label:n.__("Unfold All Subregions"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{var o;const l=h();l.type==="notebook"?(l.notebook.mode="edit",l.notebook.activeCell&&((o=l.notebook.activeCell.editor)===null||o===void 0||o.focus())):l.type==="fileEditor"&&l.widget.content.editor.focus();const d=m();if(d)try{const{state:c}=d,g=c.selection.main.head,_=c.doc.lineAt(g),y=M(c,_.from,_.to);if(!y)return;const C=c.field(V,!1);if(!C)return;const E=[];C.between(y.from+1,y.to,(v,j)=>{v>y.from&&j<=y.to&&E.push(_e.of({from:v,to:j}))}),E.length>0&&d.dispatch({effects:E})}catch{}},isEnabled:f}),t.commands.addCommand(b.foldAll,{label:n.__("Fold All Regions"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{var o;const l=h();l.type==="notebook"?(l.notebook.mode="edit",l.notebook.activeCell&&((o=l.notebook.activeCell.editor)===null||o===void 0||o.focus())):l.type==="fileEditor"&&l.widget.content.editor.focus();const d=m();if(d)try{Ee(d)}catch{}},isEnabled:f}),t.commands.addCommand(b.unfoldAll,{label:n.__("Unfold All Regions"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{var o;const l=h();l.type==="notebook"?(l.notebook.mode="edit",l.notebook.activeCell&&((o=l.notebook.activeCell.editor)===null||o===void 0||o.focus())):l.type==="fileEditor"&&l.widget.content.editor.focus();const d=m();if(d)try{Ce(d)}catch{}},isEnabled:f}),a){const o=n.__("File Operations");[b.foldCurrent,b.unfoldCurrent,b.foldSubregions,b.unfoldSubregions,b.foldAll,b.unfoldAll].forEach(l=>{a.addItem({command:l,category:o})})}}},K="@jupyterlab/codemirror-extension:plugin",nt={id:"@jupyterlab/codemirror-extension:languages",description:"Provides the CodeMirror languages registry.",provides:X,optional:[w],activate:(t,e)=>{const r=new q;for(const a of q.getDefaultLanguages(e,n=>r.findBest(n)))r.addLanguage(a);return r.addLanguage({name:"ipythongfm",mime:"text/x-ipythongfm",load:async()=>{const[a,n,u]=await Promise.all([D(()=>import("./dist-COiURBxL.js"),[],import.meta.url),D(()=>import("./dist-BrUAt6vF.js"),[],import.meta.url),D(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url)]),m=a.markdown({base:a.markdownLanguage,codeLanguages:s=>r.findBest(s),extensions:[ke(Ie.define(u.stexMath).parser)]});return new Te(m.language,[m.support,we(n.pythonLanguage)])}}),r}},it={id:"@jupyterlab/codemirror-extension:themes",description:"Provides the CodeMirror theme registry",provides:Z,optional:[w],activate:(t,e)=>{const r=new U;for(const a of U.getDefaultThemes(e))r.addTheme(a);return r}},rt={id:"@jupyterlab/codemirror-extension:extensions",description:"Provides the CodeMirror extension factory registry.",provides:R,requires:[Z],optional:[w,Ve,qe],activate:(t,e,r,a,n)=>{const u=new O;for(const m of O.getDefaultExtensions({themes:e,translator:r}))u.addExtension(m);if(a){const m=s=>{var p;u.baseConfiguration=(p=s.get("defaultConfig").composite)!==null&&p!==void 0?p:{}};Promise.all([a.load(K),t.restored]).then(([s])=>{m(s),s.changed.connect(m)}),n?.addRenderer(`${K}.defaultConfig`,{fieldRenderer:s=>{let p;const h=i.useMemo(()=>u.settingsSchema,[]);s.name in s.formContext.defaultFormData?p=s.formContext.defaultFormData[s.name]:p={};for(const[f,o]of Object.entries(u.defaultConfiguration))typeof h[f]<"u"&&!(f in p)&&(p[f]=o);return i.createElement("div",{className:"jp-FormGroup-contentNormal"},i.createElement("h3",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem"},s.schema.title),s.schema.description&&i.createElement("div",{className:"jp-FormGroup-description"},s.schema.description),i.createElement(Xe,{schema:{title:s.schema.title,description:s.schema.description,type:"object",properties:h,additionalProperties:!1},validator:We,formData:{...p,...s.formData},formContext:{defaultFormData:p},liveValidate:!0,onChange:f=>{var o;const l={};for(const[d,c]of Object.entries((o=f.formData)!==null&&o!==void 0?o:{})){const g=p[d];(g===void 0||!I.deepEqual(c,g))&&(l[d]=c)}s.onChange(l)},tagName:"div",translator:r??F,buttonStyle:"icons"}))}})}return u}},at={id:"@jupyterlab/codemirror-extension:binding",description:"Register the CodeMirror extension factory binding the editor and the shared model.",autoStart:!0,requires:[R],activate:(t,e)=>{e.addExtension({name:"shared-model-binding",factory:r=>{var a;const n=r.model.sharedModel;return O.createImmutableExtension(Ne({ytext:n.ysource,undoManager:(a=n.undoManager)!==null&&a!==void 0?a:void 0}))}})}},lt={id:"@jupyterlab/codemirror-extension:services",description:"Provides the service to instantiate CodeMirror editors.",provides:xe,requires:[X,R],optional:[w],activate:(t,e,r,a)=>({factoryService:new De({extensions:r,languages:e,translator:a??F}),mimeTypeService:new Oe(e)})},oe={id:"@jupyterlab/codemirror-extension:line-col-status",description:"Provides the code editor cursor position model.",autoStart:!0,requires:[w],optional:[Ue,Be],provides:Ae,activate:(t,e,r,a)=>{const n=new L(e),u=new Set;a&&a.registerStatusItem(oe.id,{priority:1,item:n,align:"right",rank:2,isActive:()=>!!n.model.editor});const m=h=>{u.add(h),t.shell.currentWidget&&p(t.shell,{newValue:t.shell.currentWidget})},s=()=>{p(t.shell,{oldValue:t.shell.currentWidget,newValue:t.shell.currentWidget})};function p(h,f){Promise.all([...u].map(o=>o(f.newValue))).then(o=>{var l;n.model.editor=(l=o.filter(d=>d!==null)[0])!==null&&l!==void 0?l:null}).catch(o=>{console.error("Get editors",o)})}return r&&r.currentChanged.connect(p),{addEditorProvider:m,update:s}}},Eo=[ot,nt,it,at,rt,lt,oe];export{Eo as default,oe as lineColItem};
|
|
1
|
+
import{cg as I,J as i,aD as F,ea as ae,eb as le,ec as Y,ed as se,co as ce,ci as de,aJ as me,ee as ue,ck as pe,ef as fe,ce as he,aC as T,eg as ge,eh as Q,ei as be,ej as ve,ek as M,el as $,em as W,en as V,eo as ye,ep as _e,eq as Ee,er as Ce,bM as je,es as Fe,bN as Se,et as xe,eu as q,_ as D,ev as ke,ew as Ie,af as we,ex as Te,ey as U,ez as O,eA as Ne,eB as Ae}from"../datalayer-app-main.js";import{T as Me,b as Le}from"./index-JmqWOkdt.js";import{I as Be}from"./tokens-Dyd4wiX6.js";import{I as Pe}from"./tokens-DiDi0Nkm.js";import{C as De,a as Oe}from"./index-qhxI1VzX.js";import{I as X,a as Z,b as R}from"./token-d9po19EN.js";import{F as Re,c as Ge,A as $e,g as J,v as We}from"./index-DBu0kmO8.js";import{I as Ve}from"./tokens-DY_UrMLq.js";import{a as qe}from"./tokens-BYcJtuKD.js";import{c as Ue}from"./index-B6-uQd5L.js";import{s as Je}from"./hover-B3uFmZ-0.js";import"./hoverbox-CStlKQWE.js";import"./_baseRest-BmxuuM4H.js";import"./isSymbol-BLtK9CV6.js";import"./forEach-hknrtmxV.js";import"./uniqueId-BVuTZY3F.js";import"./toNumber-B1wj8-wx.js";import"./_baseClone-ByJL1tkX.js";import"./merge-B_wcPK4Y.js";import"./isEqual-BYxXubsX.js";import"./Output-D9cwH5rg.js";import"./index-CEeyR3FZ.js";import"./dayjs.min-u3zuoSR8.js";import"./d3-color-Jd8hXty2.js";import"./dist-BrUAt6vF.js";import"./KebabHorizontalIcon-D6AY8pIS.js";import"./PaintbrushIcon-CFBHU-3l.js";import"./index-CKWSKbHe.js";import"./RestartIcon-DvpOf5Mf.js";import"./CellSidebarExtension-DXPIz0Km.js";import"./NotebookSkeleton-CvO9WylK.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-We9CyR7b.js";import"./SquareIcon-Dy3l3VdH.js";import"./FileDirectoryOpenFillIcon-jGhuRcP3.js";import"./url-C6fJII94.js";/* empty css *//* empty css */import"./style-DdAxk_bj.js";/* empty css */import"./style-Cj1gzCjo.js";/* empty css */import"./style-rkw8dR9f.js";import"./style-GHJFdtIz.js";import"./style-ZSIOeMoX.js";import"./style-iVfD6mFL.js";import"./style-DA-Ya7rp.js";import"./style-D3tvWcFO.js";import"./style-BOqStzF9.js";import"./style-ADLQJ-E9.js";import"./style-DgglluaK.js";import"./ArrowLeftIcon-sX3iNMG1.js";import"./SkubbleIcon-CAaVh_BE.js";import"./usePrimerThemeBridge-NsTRGuo7.js";import"./index-DpN8KK6c.js";import"./KernelVariables-CXQagESp.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-D36duUxK.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-BAjGB6b-.js";import"./sessions-DdXtI_C1.js";import"./tokens-CTXFWLvM.js";import"./drivecontents-BsC6Y2Vl.js";import"./kernel-BmfZmtIo.js";const ze={submitButtonOptions:{norender:!0}},z=t=>{var e;const r=((e=t.translator)!==null&&e!==void 0?e:F).load("jupyterlab");let a;const n=()=>t.direction==="up"?!t.item.hasMoveUp:!t.item.hasMoveDown,u=t.direction==="up"?t.item.index-1:t.item.index+1;if(t.buttonStyle==="icons"){const m={tag:"span",elementPosition:"center"};return a=t.direction==="up"?i.createElement(ae.react,{...m}):i.createElement(le.react,{...m}),i.createElement(Y,{className:"jp-ArrayOperationsButton",onClick:t.item.onReorderClick(t.item.index,u),disabled:n(),appearance:"stealth",title:r.__("Move item %1",t.direction)},a)}else return i.createElement("button",{className:"jp-mod-styled jp-mod-reject jp-ArrayOperationsButton",onClick:t.item.onReorderClick(t.item.index,u),disabled:n()},t.direction==="up"?r.__("Move up"):r.__("Move down"))},He=t=>{var e;const r=((e=t.translator)!==null&&e!==void 0?e:F).load("jupyterlab");let a;return t.buttonStyle==="icons"?(a=i.createElement(se.react,{tag:"span",elementPosition:"center"}),i.createElement(Y,{className:"jp-mod-styled jp-mod-warn jp-ArrayOperationsButton",onClick:t.item.onDropIndexClick(t.item.index),appearance:"stealth",title:r.__("Remove item")},a)):i.createElement("button",{className:"jp-mod-styled jp-mod-warn jp-ArrayOperationsButton",onClick:t.item.onDropIndexClick(t.item.index)},r.__("Remove"))},ee=t=>{var e;const r=((e=t.translator)!==null&&e!==void 0?e:F).load("jupyterlab");let a;return t.buttonStyle==="icons"?a=i.createElement(ce.react,{tag:"span",elementSize:"xlarge",elementPosition:"center"}):a=r.__("Add"),i.createElement("button",{className:"jp-mod-styled jp-mod-accept jp-ArrayOperationsButton",onClick:t.onAddClick,title:r.__("Add item")},a)};function G(t){const{component:e,name:r,buttonStyle:a,compact:n,showModifiedFromDefault:u,translator:m}=t,s=n??!1,p=a??(s?"icons":"text"),h=f=>e({...f,buttonStyle:p,compact:s,showModifiedFromDefault:u??!0,translator:m??F});return r&&(h.displayName=r),h}function te(t,e){const r=J("TitleFieldTemplate",t,e),a=J("DescriptionFieldTemplate",t,e);return{TitleField:r,DescriptionField:a}}const Ke=t=>G({...t,name:"JupyterLabArrayTemplate",component:e=>{var r;const{schema:a,registry:n,uiSchema:u,required:m}=e,s={schema:a,registry:n,uiSchema:u,required:m},{TitleField:p,DescriptionField:h}=te(n,u);return i.createElement("div",{className:e.className},e.compact?i.createElement("div",{className:"jp-FormGroup-compactTitle"},i.createElement("div",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem",id:`${e.idSchema.$id}__title`},e.title||""),i.createElement("div",{className:"jp-FormGroup-description",id:`${e.idSchema.$id}-description`},e.schema.description||"")):i.createElement(i.Fragment,null,e.title&&i.createElement(p,{...s,title:e.title,id:`${e.idSchema.$id}-title`}),i.createElement(h,{...s,id:`${e.idSchema.$id}-description`,description:(r=e.schema.description)!==null&&r!==void 0?r:""})),e.items.map(f=>i.createElement("div",{key:f.key,className:f.className},f.children,i.createElement("div",{className:"jp-ArrayOperations"},i.createElement(z,{buttonStyle:e.buttonStyle,translator:e.translator,item:f,direction:"up"}),i.createElement(z,{buttonStyle:e.buttonStyle,translator:e.translator,item:f,direction:"down"}),i.createElement(He,{buttonStyle:e.buttonStyle,translator:e.translator,item:f})))),e.canAdd&&i.createElement(ee,{onAddClick:e.onAddClick,buttonStyle:e.buttonStyle,translator:e.translator}))}}),Ye=t=>G({...t,name:"JupyterLabObjectTemplate",component:e=>{var r;const{schema:a,registry:n,uiSchema:u,required:m}=e,s={schema:a,registry:n,uiSchema:u,required:m},{TitleField:p,DescriptionField:h}=te(n,u);return i.createElement("fieldset",{id:e.idSchema.$id},e.compact?i.createElement("div",{className:"jp-FormGroup-compactTitle"},i.createElement("div",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem",id:`${e.idSchema.$id}__title`},e.title||""),i.createElement("div",{className:"jp-FormGroup-description",id:`${e.idSchema.$id}__description`},e.schema.description||"")):i.createElement(i.Fragment,null,(e.title||(e.uiSchema||I.emptyObject)["ui:title"])&&i.createElement(p,{...s,id:`${e.idSchema.$id}__title`,title:e.title||`${(e.uiSchema||I.emptyObject)["ui:title"]}`||""}),i.createElement(h,{...s,id:`${e.idSchema.$id}__description`,description:(r=e.schema.description)!==null&&r!==void 0?r:""})),e.properties.map(f=>f.content),Ge(e.schema,e.uiSchema,e.formData)&&i.createElement(ee,{onAddClick:e.onAddClick(e.schema),buttonStyle:e.buttonStyle,translator:e.translator}))}}),Qe=t=>G({...t,name:"JupyterLabFieldTemplate",component:e=>{var r;const a=((r=e.translator)!==null&&r!==void 0?r:F).load("jupyterlab");let n=!1,u;const{formData:m,schema:s,label:p,displayLabel:h,id:f,formContext:o,errors:l,rawErrors:d,children:c,onKeyChange:g,onDropPropertyClick:_}=e,{defaultFormData:y}=o,C=f.split("_");C.shift();const E=C.join("."),v=E==="",j=E===(e.uiSchema||I.emptyObject)["ui:field"];e.showModifiedFromDefault&&(u=C.reduce((x,P)=>x?.[P],y),n=!v&&m!==void 0&&u!==void 0&&!s.properties&&s.type!=="array"&&!I.deepEqual(m,u));const S=!v&&s.type!="object"&&f!="jp-SettingsEditor-@jupyterlab/shortcuts-extension:shortcuts_shortcuts",N=s.hasOwnProperty($e),B=!(s.type==="object"||s.type==="array");return i.createElement("div",{className:`form-group ${h||s.type==="boolean"?"small-field":""}`},!j&&(d?.length?i.createElement("div",{className:"jp-modifiedIndicator jp-errorIndicator"}):n&&i.createElement("div",{className:"jp-modifiedIndicator"})),i.createElement("div",{className:`jp-FormGroup-content ${e.compact?"jp-FormGroup-contentCompact":"jp-FormGroup-contentNormal"}`},B&&h&&!v&&p&&!N?e.compact?i.createElement("div",{className:"jp-FormGroup-compactTitle"},i.createElement("div",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem"},p),B&&s.description&&S&&i.createElement("div",{className:"jp-FormGroup-description"},s.description)):i.createElement("h3",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem"},p):i.createElement(i.Fragment,null),N&&i.createElement("input",{className:"jp-FormGroup-contentItem jp-mod-styled",type:"text",onBlur:x=>g(x.target.value),defaultValue:p}),i.createElement("div",{className:`${v?"jp-root":s.type==="object"?"jp-objectFieldWrapper":s.type==="array"?"jp-arrayFieldWrapper":"jp-inputFieldWrapper jp-FormGroup-contentItem"}`},c),N&&i.createElement("button",{className:"jp-FormGroup-contentItem jp-mod-styled jp-mod-warn jp-FormGroup-removeButton",onClick:_(p)},a.__("Remove")),!e.compact&&s.description&&S&&i.createElement("div",{className:"jp-FormGroup-description"},s.description),n&&u!==void 0&&s.type!=="object"&&i.createElement("div",{className:"jp-FormGroup-default"},a.__("Default: %1",u!==null?u.toLocaleString():"null")),i.createElement("div",{className:"validationErrors"},l)))}});function Xe(t){const{buttonStyle:e,compact:r,showModifiedFromDefault:a,translator:n,formContext:u,...m}=t,s={...m.uiSchema||I.emptyObject};s["ui:options"]={...ze,...s["ui:options"]},m.uiSchema=s;const{FieldTemplate:p,ArrayFieldTemplate:h,ObjectFieldTemplate:f}=t.templates||I.emptyObject,o={buttonStyle:e,compact:r,showModifiedFromDefault:a,translator:n},l=i.useMemo(()=>p??Qe(o),[p,e,r,a,n]),d=i.useMemo(()=>h??Ke(o),[h,e,r,a,n]),c=i.useMemo(()=>f??Ye(o),[f,e,r,a,n]),g={FieldTemplate:l,ArrayFieldTemplate:d,ObjectFieldTemplate:c};return i.createElement(Re,{templates:g,formContext:u,...m})}class Ze extends i.Component{constructor(e){super(e),this._handleChange=r=>{this.setState({value:r.currentTarget.value})},this._handleSubmit=r=>{r.preventDefault();const a=parseInt(this._textInput.value,10);return!isNaN(a)&&isFinite(a)&&1<=a&&a<=this.props.maxLine&&this.props.handleSubmit(a),!1},this._handleFocus=()=>{this.setState({hasFocus:!0})},this._handleBlur=()=>{this.setState({hasFocus:!1})},this._textInput=null,this.translator=e.translator||F,this._trans=this.translator.load("jupyterlab"),this.state={value:"",hasFocus:!1,textInputId:ue.createDomID()+"-line-number-input"}}componentDidMount(){this._textInput.focus()}render(){return i.createElement("div",{className:"jp-lineFormSearch"},i.createElement("form",{name:"lineColumnForm",onSubmit:this._handleSubmit,noValidate:!0},i.createElement("div",{className:pe("jp-lineFormWrapper","lm-lineForm-wrapper",this.state.hasFocus?"jp-lineFormWrapperFocusWithin":void 0)},i.createElement("input",{type:"text",id:this.state.textInputId,className:"jp-lineFormInput",onChange:this._handleChange,onFocus:this._handleFocus,onBlur:this._handleBlur,value:this.state.value,ref:e=>{this._textInput=e}}),i.createElement("div",{className:"jp-baseLineForm jp-lineFormButtonContainer"},i.createElement(fe.react,{className:"jp-baseLineForm jp-lineFormButtonIcon",elementPosition:"center"}),i.createElement("input",{type:"submit",className:"jp-baseLineForm jp-lineFormButton",value:""}))),i.createElement("label",{className:"jp-lineFormCaption",htmlFor:this.state.textInputId},this._trans.__("Go to line number between 1 and %1",this.props.maxLine))))}}function et(t){const r=(t.translator||F).load("jupyterlab"),a=n=>{if(n.key==="Enter"||n.key==="Spacebar"||n.key===" ")n.preventDefault(),n.stopPropagation(),t.handleClick();else return};return i.createElement(Me,{role:"button","aria-haspopup":!0,onClick:t.handleClick,source:r.__("Ln %1, Col %2",t.line,t.column),title:r.__("Go to line number…"),tabIndex:0,onKeyDown:a})}class L extends de{constructor(e){super(new L.Model),this._popup=null,this.addClass("jp-mod-highlighted"),this.translator=e||F}render(){return this.model===null?null:i.createElement(et,{line:this.model.line,column:this.model.column,translator:this.translator,handleClick:()=>this._handleClick()})}_handleClick(){this._popup&&this._popup.dispose();const e=me.create(i.createElement(Ze,{handleSubmit:r=>this._handleSubmit(r),currentLine:this.model.line,maxLine:this.model.editor.lineCount,translator:this.translator}));this._popup=Je({body:e,anchor:this,align:"right"})}_handleSubmit(e){this.model.editor.setCursorPosition({line:e-1,column:0}),this._popup.dispose(),this.model.editor.focus()}}(function(t){class e extends he{constructor(){super(...arguments),this._onSelectionChanged=()=>{const a=this._getAllState(),n=this.editor.getCursorPosition();this._line=n.line+1,this._column=n.column+1,this._triggerChange(a,this._getAllState())},this._line=1,this._column=1,this._editor=null}get editor(){return this._editor}set editor(a){var n;const u=this._editor;!((n=u?.model)===null||n===void 0)&&n.selections&&u.model.selections.changed.disconnect(this._onSelectionChanged);const m=this._getAllState();if(this._editor=a,!this._editor)this._column=1,this._line=1;else{this._editor.model.selections.changed.connect(this._onSelectionChanged);const s=this._editor.getCursorPosition();this._column=s.column+1,this._line=s.line+1}this._triggerChange(m,this._getAllState())}get line(){return this._line}get column(){return this._column}_getAllState(){return[this._line,this._column]}_triggerChange(a,n){(a[0]!==n[0]||a[1]!==n[1])&&this.stateChanged.emit(void 0)}}t.Model=e})(L||(L={}));var b;(function(t){t.deleteLine="codemirror:delete-line",t.toggleBlockComment="codemirror:toggle-block-comment",t.toggleComment="codemirror:toggle-comment",t.selectNextOccurrence="codemirror:select-next-occurrence",t.toggleTabFocusMode="codemirror:toggle-tab-focus-mode",t.toggleBold="codemirror:markdown-toggle-bold",t.foldCurrent="codemirror:fold-current",t.unfoldCurrent="codemirror:unfold-current",t.foldSubregions="codemirror:fold-subregions",t.unfoldSubregions="codemirror:unfold-subregions",t.foldAll="codemirror:fold-all",t.unfoldAll="codemirror:unfold-all"})(b||(b={}));function tt(t){return Fe(t)||Q(t)}const H=".cm-content",ot={id:"@jupyterlab/codemirror-extension:commands",description:"Registers commands acting on selected/active CodeMirror editor.",autoStart:!0,requires:[Pe],optional:[T,Le],activate:(t,e,r,a)=>{r=r??F;const n=r.load("jupyterlab"),u=o=>o.classList.contains(H),m=()=>{var o,l;const d=(o=t.contextMenuHitTest(u))!==null&&o!==void 0?o:(l=document.activeElement)===null||l===void 0?void 0:l.closest(H);if(d)return je.findFromDOM(d)},s=()=>!!m(),p=o=>{const{state:l}=o,{main:d}=l.selection;if(d.empty)return!1;const{from:c,to:g,anchor:_,head:y}=d,C=_>y,E=l.doc,v=E.sliceString(c,g),j=c>=2&&E.sliceString(c-2,c)==="**",S=E.sliceString(g,g+2)==="**",N=v.startsWith("**"),B=v.endsWith("**"),x=(k,w)=>{const A=C?w:k,re=C?k:w;return Se.single(A,re)};if(j&&S){const k=c-2,w=g+2,A=g-c;return o.dispatch({changes:{from:k,to:w,insert:v},selection:x(k,k+A)}),!0}if(N&&B&&v.length>=4){const k=v.slice(2,-2),w=c,A=c+k.length;return o.dispatch({changes:{from:c,to:g,insert:k},selection:x(w,A)}),!0}const P=`**${v}**`,ne=c+2,ie=g+2;return o.dispatch({changes:{from:c,to:g,insert:P},selection:x(ne,ie)}),!0},h=()=>{var o,l;const d=t.shell.currentWidget,c=(o=e.currentWidget)===null||o===void 0?void 0:o.content;if(e.currentWidget!==null&&e.currentWidget===d&&c&&c.activeCell)return{type:"notebook",widget:d,notebook:c,isEnabled:!0};const g=d;return g&&g.content&&typeof((l=g.content.editor)===null||l===void 0?void 0:l.focus)=="function"?{type:"fileEditor",widget:g,isEnabled:!0}:{type:"none",widget:null,isEnabled:!1}},f=()=>h().isEnabled;if(t.commands.addCommand(b.deleteLine,{label:n.__("Delete the current line"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const o=m();o&&ge(o)},isEnabled:s}),t.commands.addCommand(b.toggleBlockComment,{label:n.__("Toggle Block Comment"),caption:n.__("Toggles block comments; falls back to regular comment toggle when block comment syntax is unavailable"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const o=m();o&&tt(o)},isEnabled:s}),t.commands.addCommand(b.toggleComment,{label:n.__("Toggle Comment"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const o=m();o&&Q(o)},isEnabled:s}),t.commands.addCommand(b.toggleTabFocusMode,{label:n.__("Toggle Tab Focus Mode"),caption:n.__("Toggles behavior of Tab key between inserting indentation and moving to next focusable element"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const o=m();o&&be(o)},isEnabled:s}),t.commands.addCommand(b.selectNextOccurrence,{label:n.__("Select Next Occurrence"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const o=m();o&&ve(o)},isEnabled:s}),t.commands.addCommand(b.toggleBold,{label:n.__("Toggle Bold"),caption:n.__("Toggle bold formatting by wrapping/unwrapping selected text with **"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const o=m();o&&p(o)},isEnabled:s}),t.commands.addCommand(b.foldCurrent,{label:n.__("Fold Current Region"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{var o;const l=h();l.type==="notebook"?(l.notebook.mode="edit",l.notebook.activeCell&&((o=l.notebook.activeCell.editor)===null||o===void 0||o.focus())):l.type==="fileEditor"&&l.widget.content.editor.focus();const d=m();if(!d)return;const{state:c}=d,g=c.selection.main.head,_=c.doc.lineAt(g);M(c,_.from,_.to)&&$(d)},isEnabled:f}),t.commands.addCommand(b.unfoldCurrent,{label:n.__("Unfold Current Region"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{var o;const l=h();l.type==="notebook"?(l.notebook.mode="edit",l.notebook.activeCell&&((o=l.notebook.activeCell.editor)===null||o===void 0||o.focus())):l.type==="fileEditor"&&l.widget.content.editor.focus();const d=m();if(!d)return;const{state:c}=d,g=c.selection.main.head,_=c.doc.lineAt(g);M(c,_.from,_.to)&&W(d)},isEnabled:f}),t.commands.addCommand(b.foldSubregions,{label:n.__("Fold All Subregions"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{var o;const l=h();l.type==="notebook"?(l.notebook.mode="edit",l.notebook.activeCell&&((o=l.notebook.activeCell.editor)===null||o===void 0||o.focus())):l.type==="fileEditor"&&l.widget.content.editor.focus();const d=m();if(d)try{const{state:c}=d,g=c.selection.main.head,_=c.doc.lineAt(g),y=M(c,_.from,_.to);let C=!1;try{C=c.field(V,!1)!==void 0}catch{C=!1}if(C||($(d),W(d)),!y)return;const E=[];let v=y.from+1;for(;v<y.to;){const j=c.doc.lineAt(v),S=M(c,j.from,j.to);S&&S.from>y.from&&S.to<=y.to?(E.push(ye.of(S)),v=S.to):v=j.to+1}E.length>0&&d.dispatch({effects:E})}catch{}},isEnabled:f}),t.commands.addCommand(b.unfoldSubregions,{label:n.__("Unfold All Subregions"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{var o;const l=h();l.type==="notebook"?(l.notebook.mode="edit",l.notebook.activeCell&&((o=l.notebook.activeCell.editor)===null||o===void 0||o.focus())):l.type==="fileEditor"&&l.widget.content.editor.focus();const d=m();if(d)try{const{state:c}=d,g=c.selection.main.head,_=c.doc.lineAt(g),y=M(c,_.from,_.to);if(!y)return;const C=c.field(V,!1);if(!C)return;const E=[];C.between(y.from+1,y.to,(v,j)=>{v>y.from&&j<=y.to&&E.push(_e.of({from:v,to:j}))}),E.length>0&&d.dispatch({effects:E})}catch{}},isEnabled:f}),t.commands.addCommand(b.foldAll,{label:n.__("Fold All Regions"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{var o;const l=h();l.type==="notebook"?(l.notebook.mode="edit",l.notebook.activeCell&&((o=l.notebook.activeCell.editor)===null||o===void 0||o.focus())):l.type==="fileEditor"&&l.widget.content.editor.focus();const d=m();if(d)try{Ee(d)}catch{}},isEnabled:f}),t.commands.addCommand(b.unfoldAll,{label:n.__("Unfold All Regions"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{var o;const l=h();l.type==="notebook"?(l.notebook.mode="edit",l.notebook.activeCell&&((o=l.notebook.activeCell.editor)===null||o===void 0||o.focus())):l.type==="fileEditor"&&l.widget.content.editor.focus();const d=m();if(d)try{Ce(d)}catch{}},isEnabled:f}),a){const o=n.__("File Operations");[b.foldCurrent,b.unfoldCurrent,b.foldSubregions,b.unfoldSubregions,b.foldAll,b.unfoldAll].forEach(l=>{a.addItem({command:l,category:o})})}}},K="@jupyterlab/codemirror-extension:plugin",nt={id:"@jupyterlab/codemirror-extension:languages",description:"Provides the CodeMirror languages registry.",provides:X,optional:[T],activate:(t,e)=>{const r=new q;for(const a of q.getDefaultLanguages(e,n=>r.findBest(n)))r.addLanguage(a);return r.addLanguage({name:"ipythongfm",mime:"text/x-ipythongfm",load:async()=>{const[a,n,u]=await Promise.all([D(()=>import("./dist-Ct-bkqXx.js"),[],import.meta.url),D(()=>import("./dist-BrUAt6vF.js"),[],import.meta.url),D(()=>import("./stex-C3f8Ysf7.js"),[],import.meta.url)]),m=a.markdown({base:a.markdownLanguage,codeLanguages:s=>r.findBest(s),extensions:[ke(Ie.define(u.stexMath).parser)]});return new we(m.language,[m.support,Te(n.pythonLanguage)])}}),r}},it={id:"@jupyterlab/codemirror-extension:themes",description:"Provides the CodeMirror theme registry",provides:Z,optional:[T],activate:(t,e)=>{const r=new U;for(const a of U.getDefaultThemes(e))r.addTheme(a);return r}},rt={id:"@jupyterlab/codemirror-extension:extensions",description:"Provides the CodeMirror extension factory registry.",provides:R,requires:[Z],optional:[T,Ve,qe],activate:(t,e,r,a,n)=>{const u=new O;for(const m of O.getDefaultExtensions({themes:e,translator:r}))u.addExtension(m);if(a){const m=s=>{var p;u.baseConfiguration=(p=s.get("defaultConfig").composite)!==null&&p!==void 0?p:{}};Promise.all([a.load(K),t.restored]).then(([s])=>{m(s),s.changed.connect(m)}),n?.addRenderer(`${K}.defaultConfig`,{fieldRenderer:s=>{let p;const h=i.useMemo(()=>u.settingsSchema,[]);s.name in s.formContext.defaultFormData?p=s.formContext.defaultFormData[s.name]:p={};for(const[f,o]of Object.entries(u.defaultConfiguration))typeof h[f]<"u"&&!(f in p)&&(p[f]=o);return i.createElement("div",{className:"jp-FormGroup-contentNormal"},i.createElement("h3",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem"},s.schema.title),s.schema.description&&i.createElement("div",{className:"jp-FormGroup-description"},s.schema.description),i.createElement(Xe,{schema:{title:s.schema.title,description:s.schema.description,type:"object",properties:h,additionalProperties:!1},validator:We,formData:{...p,...s.formData},formContext:{defaultFormData:p},liveValidate:!0,onChange:f=>{var o;const l={};for(const[d,c]of Object.entries((o=f.formData)!==null&&o!==void 0?o:{})){const g=p[d];(g===void 0||!I.deepEqual(c,g))&&(l[d]=c)}s.onChange(l)},tagName:"div",translator:r??F,buttonStyle:"icons"}))}})}return u}},at={id:"@jupyterlab/codemirror-extension:binding",description:"Register the CodeMirror extension factory binding the editor and the shared model.",autoStart:!0,requires:[R],activate:(t,e)=>{e.addExtension({name:"shared-model-binding",factory:r=>{var a;const n=r.model.sharedModel;return O.createImmutableExtension(Ne({ytext:n.ysource,undoManager:(a=n.undoManager)!==null&&a!==void 0?a:void 0}))}})}},lt={id:"@jupyterlab/codemirror-extension:services",description:"Provides the service to instantiate CodeMirror editors.",provides:xe,requires:[X,R],optional:[T],activate:(t,e,r,a)=>({factoryService:new De({extensions:r,languages:e,translator:a??F}),mimeTypeService:new Oe(e)})},oe={id:"@jupyterlab/codemirror-extension:line-col-status",description:"Provides the code editor cursor position model.",autoStart:!0,requires:[T],optional:[Ue,Be],provides:Ae,activate:(t,e,r,a)=>{const n=new L(e),u=new Set;a&&a.registerStatusItem(oe.id,{priority:1,item:n,align:"right",rank:2,isActive:()=>!!n.model.editor});const m=h=>{u.add(h),t.shell.currentWidget&&p(t.shell,{newValue:t.shell.currentWidget})},s=()=>{p(t.shell,{oldValue:t.shell.currentWidget,newValue:t.shell.currentWidget})};function p(h,f){Promise.all([...u].map(o=>o(f.newValue))).then(o=>{var l;n.model.editor=(l=o.filter(d=>d!==null)[0])!==null&&l!==void 0?l:null}).catch(o=>{console.error("Get editors",o)})}return r&&r.currentChanged.connect(p),{addEditorProvider:m,update:s}}},Eo=[ot,nt,it,at,rt,lt,oe];export{Eo as default,oe as lineColItem};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ic as Je,id as Se,ie as Y,
|
|
1
|
+
import{ic as Je,id as Se,ie as Y,ck as de,eG as Ve,ig as Ge,k as H,aC as R,aD as U,dH as F,cd as x,dB as Ye,dP as Qe,ih as Xe,cq as V,eD as ue,aI as Ze,aJ as me,r as S,eM as ke,aA as Te,ce as et,ii as pe,ed as he,dJ as Ce,ij as tt,bg as je,_ as nt,gC as ot,ik as st,ay as Ee,il as at,cr as it,dI as Ie,du as J,im as xe,dy as rt,eJ as Ne,aw as Pe,d_ as ct,d$ as Le,io as ge,aE as lt,aF as Q,gB as fe,gu as dt,eI as ut,ip as mt}from"../datalayer-app-main.js";import{I as $,a as Ae}from"./tokens-DY_UrMLq.js";import{i as Me,b as G,L as z,G as pt,T as ht,j as gt,g as Oe,k as ft,K as bt,R as yt,l as Re,m as Fe,n as vt,I as _t,o as wt,c as St,e as We,d as Be,a as kt,p as Tt,W as Ct}from"./index-JmqWOkdt.js";import{f as De,c as jt,J as ne,e as ce}from"./index-B6-uQd5L.js";import{I as $e}from"./tokens-B7nNzQEE.js";import{s as Et}from"./hover-B3uFmZ-0.js";import{I as le}from"./tokens-Dyd4wiX6.js";import"./hoverbox-CStlKQWE.js";import"./Output-D9cwH5rg.js";import"./index-qhxI1VzX.js";import"./index-CEeyR3FZ.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-BYxXubsX.js";import"./d3-color-Jd8hXty2.js";import"./dist-BrUAt6vF.js";import"./KebabHorizontalIcon-D6AY8pIS.js";import"./PaintbrushIcon-CFBHU-3l.js";import"./index-CKWSKbHe.js";import"./RestartIcon-DvpOf5Mf.js";import"./CellSidebarExtension-DXPIz0Km.js";import"./NotebookSkeleton-CvO9WylK.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-We9CyR7b.js";import"./SquareIcon-Dy3l3VdH.js";import"./FileDirectoryOpenFillIcon-jGhuRcP3.js";import"./url-C6fJII94.js";/* empty css *//* empty css */import"./style-DdAxk_bj.js";/* empty css */import"./style-Cj1gzCjo.js";/* empty css */import"./style-rkw8dR9f.js";import"./style-GHJFdtIz.js";import"./style-ZSIOeMoX.js";import"./style-iVfD6mFL.js";import"./style-DA-Ya7rp.js";import"./style-D3tvWcFO.js";import"./style-BOqStzF9.js";import"./style-ADLQJ-E9.js";import"./style-DgglluaK.js";import"./ArrowLeftIcon-sX3iNMG1.js";import"./SkubbleIcon-CAaVh_BE.js";import"./usePrimerThemeBridge-NsTRGuo7.js";import"./index-DpN8KK6c.js";import"./KernelVariables-CXQagESp.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-D36duUxK.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-BAjGB6b-.js";import"./sessions-DdXtI_C1.js";import"./tokens-CTXFWLvM.js";import"./drivecontents-BsC6Y2Vl.js";import"./kernel-BmfZmtIo.js";const It=Je.bindprops({stylesheet:"commandPaletteHeader",className:"jp-icon-hoverShow-content"});var se;(function(e){class o extends Se.Renderer{renderHeader(n){const c=this.formatHeader(n);return Y.li({className:de("lm-CommandPalette-header","jp-icon-hoverShow")},c,Y.span(It))}renderItemIcon(n){const c=this.createIconClass(n);return n.item.isToggled?Y.div({className:c},Ve,n.item.iconLabel):Y.div({className:c},n.item.icon,n.item.iconLabel)}createIconClass(n){return de(Ge.styleClass({stylesheet:"commandPaletteItem"}),n.item.iconClass,"lm-CommandPalette-itemIcon")}}e.Renderer=o,e.defaultRenderer=new o})(se||(se={}));const be="help:open",xt="/lab/api/news",Nt="/lab/api/update",oe="https://jupyterlab.readthedocs.io/en/stable/privacy_policies.html";async function ye(e,o={},i){const n=i??H.ServerConnection.makeSettings(),c=x.URLExt.join(n.baseUrl,e);let t;try{t=await H.ServerConnection.makeRequest(c,o,n)}catch(g){throw new H.ServerConnection.NetworkError(g)}const s=await t.json();if(!t.ok)throw new H.ServerConnection.ResponseError(t,s.message);return s}const ze={id:"@jupyterlab/apputils-extension:announcements",description:"Add the announcement feature. It will fetch news on the internet and check for application updates.",autoStart:!0,optional:[H.IConfigSectionManager,$,R],activate:(e,o,i,n)=>{var c,t;const s=ze.id.replace(/\W/g,"");Promise.all([e.restored,(c=i?.load("@jupyterlab/apputils-extension:notification"))!==null&&c!==void 0?c:Promise.resolve(null),(t=o?.create({name:s}))!==null&&t!==void 0?t:Promise.resolve(null)]).then(async([g,m,l])=>{const r=(n??U).load("jupyterlab");if(F.manager.changed.connect((y,p)=>{var a;if(p.type!=="removed")return;const{id:h,tags:v}=(a=p.notification.options.data)!==null&&a!==void 0?a:{};if((v??[]).some(_=>["news","update"].includes(_))&&h){const _={};_[h]={seen:!0,dismissed:!0},l?.update(_).catch(k=>{console.error(`Failed to update the announcements config:
|
|
2
2
|
${k}`)})}}),m?.get("fetchNews").composite==="none"){const y=F.emit(r.__("Would you like to get notified about official Jupyter news?"),"default",{autoClose:!1,actions:[{label:r.__("Open privacy policy"),caption:oe,callback:p=>{p.preventDefault(),e.commands.hasCommand(be)?e.commands.execute(be,{text:r.__("Privacy policies"),url:oe}):window.open(oe,"_blank","noreferrer")},displayType:"link"},{label:r.__("Yes"),callback:()=>{F.dismiss(y),l?.update({}).then(()=>f()).catch(p=>{console.error(`Failed to get the news:
|
|
3
3
|
${p}`)}),m?.set("fetchNews","true").catch(p=>{console.error(`Failed to save setting 'fetchNews':
|
|
4
4
|
${p}`)})}},{label:r.__("No"),callback:()=>{F.dismiss(y),m?.set("fetchNews","false").catch(p=>{console.error(`Failed to save setting 'fetchNews':
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a9 as D,aA as L,aD as w,eC as W,r as M,J as I,aC as T,eD as k,eE as V,eF as K,eG as G,dI as $,eH as z}from"../datalayer-app-main.js";import{K as j,b as F,c as U,P as J,d as X,I as E,e as B,f as Q}from"./index-
|
|
1
|
+
import{a9 as D,aA as L,aD as w,eC as W,r as M,J as I,aC as T,eD as k,eE as V,eF as K,eG as G,dI as $,eH as z}from"../datalayer-app-main.js";import{K as j,b as F,c as U,P as J,d as X,I as E,e as B,f as Q}from"./index-qhxI1VzX.js";import{a as Y}from"./tokens-BYcJtuKD.js";import{I as q}from"./tokens-DY_UrMLq.js";import{I as H}from"./CellSidebarExtension-DXPIz0Km.js";import"./hoverbox-CStlKQWE.js";import"./NotebookSkeleton-CvO9WylK.js";import"./Avatar-Cv5OpUWu.js";import"./index-CEeyR3FZ.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-BYxXubsX.js";import"./d3-color-Jd8hXty2.js";import"./renderer-We9CyR7b.js";import"./SquareIcon-Dy3l3VdH.js";const A="CompletionProvider:context";class Z{constructor(){this.identifier=A,this.rank=500,this.renderer=null}async isApplicable(t){return!0}fetch(t,e){const n=e.editor;return n?new Promise(i=>{i(R.contextHint(n))}):Promise.reject("No editor")}}var R;(function(l){function t(n){const i=n.getTokenAtCursor(),r=e(i,n).filter(c=>c.type).map(c=>c.value),m=new Set(r),u=new Array;return m.forEach(c=>u.push({label:c})),{start:i.offset,end:i.offset+i.value.length,items:u}}l.contextHint=t;function e(n,i){return i.getTokens().filter(r=>r.value.indexOf(n.value)===0&&r.value!==n.value)}})(R||(R={}));class ee{constructor(){this._activeProviders=new Set([j,A]),this._inlineCompleterSettings=H.defaultSettings,this._providers=new Map,this._inlineProviders=new Map,this._panelHandlers=new Map,this._mostRecentContext=new Map,this._activeProvidersChanged=new D(this),this._selected=new D(this),this._inlineCompleterFactory=null}get activeProvidersChanged(){return this._activeProvidersChanged}get selected(){return this._selected}setTimeout(t){this._timeout=t}setShowDocumentationPanel(t){this._panelHandlers.forEach(e=>e.completer.showDocsPanel=t),this._showDoc=t}setSuppressIfInlineCompleterActive(t){this._panelHandlers.forEach(e=>e.completer.suppressIfInlineCompleterActive=t),this._suppressIfInlineCompleterActive=t}setContinuousHinting(t){this._panelHandlers.forEach(e=>e.autoCompletion=t),this._autoCompletion=t}registerProvider(t){const e=t.identifier;this._providers.has(e)?console.warn(`Completion provider with identifier ${e} is already registered`):(this._providers.set(e,t),this._panelHandlers.forEach((n,i)=>{this.updateCompleter(this._mostRecentContext.get(i))}))}registerInlineProvider(t){const e=t.identifier;this._inlineProviders.has(e)?console.warn(`Completion provider with identifier ${e} is already registered`):(this._inlineProviders.set(e,t),this._panelHandlers.forEach((n,i)=>{this.updateCompleter(this._mostRecentContext.get(i))}))}getProviders(){return this._providers}activateProvider(t){this._activeProviders=new Set([]),t.forEach(e=>{this._providers.has(e)&&this._activeProviders.add(e)}),this._activeProviders.size===0&&(this._activeProviders.add(j),this._activeProviders.add(A)),this._activeProvidersChanged.emit()}async updateCompleter(t){var e,n;const{widget:i,editor:o,sanitizer:r}=t,m=i.id,u=this._panelHandlers.get(m),c=[...this._activeProviders][0],a=this._providers.get(c);let _=(e=a?.renderer)!==null&&e!==void 0?e:F.getDefaultRenderer(r);const s=a?.modelFactory;let d;s?d=await s.call(a,t):d=new U,this._mostRecentContext.set(i.id,t);const f={model:d,editor:o,renderer:_,sanitizer:r,showDoc:this._showDoc};if(u){const h=u.completer;(n=h.model)===null||n===void 0||n.dispose(),h.model=f.model,h.renderer=f.renderer,h.showDocsPanel=f.showDoc,h.suppressIfInlineCompleterActive=this._suppressIfInlineCompleterActive,u.autoCompletion=this._autoCompletion,o&&(u.editor=o,u.reconciliator=await this.generateReconciliator(t))}else{const h=await this._generateHandler(t,f);this._panelHandlers.set(i.id,h),h.completer.selected.connect((p,g)=>this._selected.emit({insertText:g})),i.disposed.connect(p=>{this.disposeHandler(p.id,h),this._mostRecentContext.delete(m)})}}invoke(t){const e=this._panelHandlers.get(t);e&&e.invoke()}select(t){const e=this._panelHandlers.get(t);e&&e.completer.selectActive()}setInlineCompleterFactory(t){this._inlineCompleterFactory=t,this._panelHandlers.forEach((e,n)=>{this.updateCompleter(this._mostRecentContext.get(n))}),!this.inline&&(this.inline={invoke:e=>{const n=this._panelHandlers.get(e);n&&n.inlineCompleter&&n.invokeInline()},isActive:e=>{const n=this._panelHandlers.get(e);return n&&n.inlineCompleter?n.inlineCompleter.isActive:!1},cycle:(e,n)=>{const i=this._panelHandlers.get(e);i&&i.inlineCompleter&&i.inlineCompleter.cycle(n)},accept:e=>{const n=this._panelHandlers.get(e);n&&n.inlineCompleter&&n.inlineCompleter.accept()},configure:e=>{this._inlineCompleterSettings=e;for(const[n,i]of this._inlineProviders.entries())i.configure&&i.configure(e.providers[n]);this._panelHandlers.forEach((n,i)=>{n.inlineCompleter&&n.inlineCompleter.configure(e),this.updateCompleter(this._mostRecentContext.get(i))})}})}get inlineProviders(){return[...this._inlineProviders.values()]}async generateReconciliator(t){const e=[];for(const[o,r]of Object.entries(this._inlineCompleterSettings.providers))r.enabled===!0&&e.push(o);const n=[...this._inlineProviders.values()].filter(o=>e.includes(o.identifier)),i=[];for(const o of this._activeProviders){const r=this._providers.get(o);r&&i.push(r)}return new J({context:t,providers:i,inlineProviders:n,inlineProvidersSettings:this._inlineCompleterSettings.providers,timeout:this._timeout})}disposeHandler(t,e){var n,i,o,r;(n=e.completer.model)===null||n===void 0||n.dispose(),e.completer.dispose(),(o=(i=e.inlineCompleter)===null||i===void 0?void 0:i.model)===null||o===void 0||o.dispose(),(r=e.inlineCompleter)===null||r===void 0||r.dispose(),e.dispose(),this._panelHandlers.delete(t)}async _generateHandler(t,e){const n=new F(e),i=this._inlineCompleterFactory?this._inlineCompleterFactory.factory({...e,model:new H.Model}):void 0;n.hide(),L.attach(n,document.body),i&&(L.attach(i,document.body),i.hide(),i.configure(this._inlineCompleterSettings));const o=await this.generateReconciliator(t),r=new X({completer:n,inlineCompleter:i,reconciliator:o});return r.editor=t.editor,r}}class te{constructor(t){this.options=t,this.identifier="@jupyterlab/inline-completer:history",this._maxSuggestions=100;const e=t.translator||w;this._trans=e.load("jupyterlab")}get name(){return this._trans.__("History")}get icon(){return W}get schema(){return{properties:{maxSuggestions:{title:this._trans.__("Maximum number of suggestions"),description:this._trans.__("The maximum number of suggestions to retrieve from history."),type:"number"}},default:{enabled:!1,maxSuggestions:100}}}configure(t){var e;this._maxSuggestions=(e=t.maxSuggestions)!==null&&e!==void 0?e:100}async fetch(t,e,n){var i;const o=(i=e.session)===null||i===void 0?void 0:i.kernel;if(!o)throw new Error("No kernel for completion request.");const m=t.text.slice(0,t.offset).split(`
|
|
2
2
|
`).slice(-1)[0],u=t.text.slice(t.offset).split(`
|
|
3
3
|
`)[0];let c;const a=[];if(m===""){c={output:!1,raw:!0,hist_access_type:"tail",n:this._maxSuggestions};const _=await o.requestHistory(c);if(_.content.status==="ok"){let s=_.content.history;const d=new Map;for(const p of s.reverse()){const g=p[2];d.set(g,(d.get(g)||0)+1)}const h=Array.from(d.entries()).sort((p,g)=>p[1]>g[1]?-1:p[1]<g[1]?1:0);for(const p of h)a.push({insertText:p[0]})}}else{c={output:!1,raw:!0,hist_access_type:"search",pattern:O(m)+"*"+(u?O(u)+"*":""),unique:!0,n:this._maxSuggestions};const _=await o.requestHistory(c);if(_.content.status==="ok")for(const s of _.content.history){const d=s[2].split(`
|
|
4
4
|
`);for(let f=0;f<d.length;f++){const h=d[f];if(h.startsWith(m)){let p=h.slice(m.length);f+1<d.length&&(p+=`
|