@datalayer/agent-runtimes 1.6.50 → 1.6.52
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/{CollapsiblePlugin-DyobyCLm.js → CollapsiblePlugin-O3bSOnT2.js} +1 -1
- package/dist-embed/chunks/{DeckComponent-B5IMw4r1.js → DeckComponent-BBzW9lJ6.js} +1 -1
- package/dist-embed/chunks/{DocumentView-IqGVIpnF.js → DocumentView-cAXnkJfm.js} +1 -1
- package/dist-embed/chunks/{EphemeralDocument-DZ8Wk5du.js → EphemeralDocument-Dhya_KwN.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawComponent-9ant-hu6.js → ExcalidrawComponent-B8OYc8cp.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawModal-92wiYWnH.js → ExcalidrawModal-BW5tAKHi.js} +1 -1
- package/dist-embed/chunks/{JupyterLexicalExtension-DbMi7Dam.js → JupyterLexicalExtension-BZdwpb1B.js} +5 -5
- package/dist-embed/chunks/{NotebookToolSurfaces-Gk8Hsn0c.js → NotebookToolSurfaces-Bh-LUzM-.js} +1 -1
- package/dist-embed/chunks/{Output-DtWAAuKd.js → Output-DNFUWYih.js} +8 -8
- package/dist-embed/chunks/{YouTubePlugin-DS4rJSGB.js → YouTubePlugin-N0bkcExZ.js} +1 -1
- package/dist-embed/chunks/{ar-SA-G6X2FPQ2-oGeNqqRN.js → ar-SA-G6X2FPQ2-E6Tk_QWw.js} +1 -1
- package/dist-embed/chunks/{az-AZ-76LH7QW2-Ckdua9fG.js → az-AZ-76LH7QW2-K7Oiu-pY.js} +1 -1
- package/dist-embed/chunks/{bg-BG-XCXSNQG7-D0NWa5AJ.js → bg-BG-XCXSNQG7-6JXDKtWk.js} +1 -1
- package/dist-embed/chunks/{bn-BD-2XOGV67Q-CZbU71zu.js → bn-BD-2XOGV67Q-Djg2MZl8.js} +1 -1
- package/dist-embed/chunks/{ca-ES-6MX7JW3Y-CDkEhhvJ.js → ca-ES-6MX7JW3Y-BTPklJXF.js} +1 -1
- package/dist-embed/chunks/{cs-CZ-2BRQDIVT-D3Tf2yLX.js → cs-CZ-2BRQDIVT-gVrmcBET.js} +1 -1
- package/dist-embed/chunks/{da-DK-5WZEPLOC-8FuM_s_4.js → da-DK-5WZEPLOC-BBbJOknE.js} +1 -1
- package/dist-embed/chunks/{de-DE-XR44H4JA-BczLv19p.js → de-DE-XR44H4JA-DDAe1n4-.js} +1 -1
- package/dist-embed/chunks/{el-GR-BZB4AONW-XmdkMj04.js → el-GR-BZB4AONW-_O5d2fpo.js} +1 -1
- package/dist-embed/chunks/{es-ES-U4NZUMDT-BM8o7VhK.js → es-ES-U4NZUMDT-8tcn7kxA.js} +1 -1
- package/dist-embed/chunks/{eu-ES-A7QVB2H4-C92PACcO.js → eu-ES-A7QVB2H4-swWuvm8T.js} +1 -1
- package/dist-embed/chunks/{fa-IR-HGAKTJCU-C0v8l3W9.js → fa-IR-HGAKTJCU-BMdvmquE.js} +1 -1
- package/dist-embed/chunks/{fi-FI-Z5N7JZ37-C5OmBq6V.js → fi-FI-Z5N7JZ37-CtiUEJw3.js} +1 -1
- package/dist-embed/chunks/{fr-FR-RHASNOE6-D2EL4poR.js → fr-FR-RHASNOE6-9oRayPJc.js} +1 -1
- package/dist-embed/chunks/{gl-ES-HMX3MZ6V-YWFm4WxA.js → gl-ES-HMX3MZ6V-BOznTumG.js} +1 -1
- package/dist-embed/chunks/{he-IL-6SHJWFNN-mX7JSlN-.js → he-IL-6SHJWFNN-DUVMGygM.js} +1 -1
- package/dist-embed/chunks/{hi-IN-IWLTKZ5I-D6yhTM4e.js → hi-IN-IWLTKZ5I-oYSW7Bx5.js} +1 -1
- package/dist-embed/chunks/{hu-HU-A5ZG7DT2-eb6aNn0F.js → hu-HU-A5ZG7DT2-BJFV7jEm.js} +1 -1
- package/dist-embed/chunks/{id-ID-SAP4L64H-EhGa_Mrn.js → id-ID-SAP4L64H-DG1Dwi63.js} +1 -1
- package/dist-embed/chunks/{index-mXYl0SDo.js → index-BIl72fAm.js} +2 -2
- package/dist-embed/chunks/{it-IT-JPQ66NNP-BEhvmrUK.js → it-IT-JPQ66NNP-B6bSeHaH.js} +1 -1
- package/dist-embed/chunks/{ja-JP-DBVTYXUO-lmsxmH6A.js → ja-JP-DBVTYXUO-BRWx5KlM.js} +1 -1
- package/dist-embed/chunks/{kaa-6HZHGXH3-C2eZOrFk.js → kaa-6HZHGXH3-SpLqZeKb.js} +1 -1
- package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-BtO_Ccgd.js → kab-KAB-ZGHBKWFO-dGdDDYwn.js} +1 -1
- package/dist-embed/chunks/{kk-KZ-P5N5QNE5-BlIG0olU.js → kk-KZ-P5N5QNE5-ZTSO8W-K.js} +1 -1
- package/dist-embed/chunks/{km-KH-HSX4SM5Z-Dixy2EU_.js → km-KH-HSX4SM5Z-CleCdXdx.js} +1 -1
- package/dist-embed/chunks/{ko-KR-MTYHY66A-CUkVgSOW.js → ko-KR-MTYHY66A-Ff92uevY.js} +1 -1
- package/dist-embed/chunks/{ku-TR-6OUDTVRD-BKl1H1lo.js → ku-TR-6OUDTVRD-cBz5nBl7.js} +1 -1
- package/dist-embed/chunks/{lib-BuHiJKfL.js → lib-6TPLItTb.js} +1 -1
- package/dist-embed/chunks/{lib-DEmXqC05.js → lib-Bd-DHxvY.js} +1 -1
- package/dist-embed/chunks/{lib-3oZnFGZf.js → lib-CCVTi39i.js} +1 -1
- package/dist-embed/chunks/{lib-C65GpCKu.js → lib-CU3GZ7XB.js} +1 -1
- package/dist-embed/chunks/{lib-ClP1grrt.js → lib-CUtLTghG.js} +1 -1
- package/dist-embed/chunks/{lib-BCX_PXlV.js → lib-CYUbVv7y.js} +1 -1
- package/dist-embed/chunks/{lib-DdpVsCS-.js → lib-CaT_vwu7.js} +1 -1
- package/dist-embed/chunks/{lib-D7ZIPOgc.js → lib-Co6Mrwf9.js} +1 -1
- package/dist-embed/chunks/{lib-B9Uql7XT.js → lib-Cq0WigYa.js} +1 -1
- package/dist-embed/chunks/{lib-Bj5kYV-X.js → lib-CuhljIuI.js} +1 -1
- package/dist-embed/chunks/{lib-BpgMIewI.js → lib-DNmIagIq.js} +1 -1
- package/dist-embed/chunks/{lib-C1F_0rhP.js → lib-Dn5yvA1f.js} +1 -1
- package/dist-embed/chunks/{lib-jE6-GvLb.js → lib-FBlRWkj7.js} +1 -1
- package/dist-embed/chunks/{lib-ByfYxpOp.js → lib-Ipz2nrlj.js} +1 -1
- package/dist-embed/chunks/{lib-BBoRpP0j.js → lib-O-8MG1Py.js} +1 -1
- package/dist-embed/chunks/{lib-UcItgdUY.js → lib-pMZ7syE4.js} +1 -1
- package/dist-embed/chunks/{lib-DHfhUiNX.js → lib-sw4DQLI8.js} +1 -1
- package/dist-embed/chunks/{lib-DgCQUDNp.js → lib-x42_0GMo.js} +1 -1
- package/dist-embed/chunks/{lt-LT-XHIRWOB4-TTj82TW7.js → lt-LT-XHIRWOB4-DfXp5Gx2.js} +1 -1
- package/dist-embed/chunks/{lv-LV-5QDEKY6T-DLiLVd-V.js → lv-LV-5QDEKY6T-DNVNDCM1.js} +1 -1
- package/dist-embed/chunks/{mr-IN-CRQNXWMA-CiVi-oiY.js → mr-IN-CRQNXWMA-CnaNZ5Wl.js} +1 -1
- package/dist-embed/chunks/{my-MM-5M5IBNSE-DiSnYIcD.js → my-MM-5M5IBNSE-B5iDGCTn.js} +1 -1
- package/dist-embed/chunks/{nb-NO-T6EIAALU-DfSOBb64.js → nb-NO-T6EIAALU-LWClJ4r8.js} +1 -1
- package/dist-embed/chunks/{nl-NL-IS3SIHDZ-BF72RX5n.js → nl-NL-IS3SIHDZ-DSjZNAbY.js} +1 -1
- package/dist-embed/chunks/{nn-NO-6E72VCQL-Ck3xjqMu.js → nn-NO-6E72VCQL-2WY6Xk1L.js} +1 -1
- package/dist-embed/chunks/{oc-FR-POXYY2M6-CEdstZI1.js → oc-FR-POXYY2M6-Ddep6jAF.js} +1 -1
- package/dist-embed/chunks/{pa-IN-N4M65BXN-D8DDwUFn.js → pa-IN-N4M65BXN-BqkRbMII.js} +1 -1
- package/dist-embed/chunks/{percentages-BXMCSKIN-CxyBCxgG.js → percentages-BXMCSKIN-2Z9DWWGZ.js} +3 -3
- package/dist-embed/chunks/{pl-PL-T2D74RX3-bJIlJVUJ.js → pl-PL-T2D74RX3-B2bWZwI4.js} +1 -1
- package/dist-embed/chunks/{pt-BR-5N22H2LF-T_zS_1UI.js → pt-BR-5N22H2LF-C7L47RXu.js} +1 -1
- package/dist-embed/chunks/{pt-PT-UZXXM6DQ-BGYBI-AZ.js → pt-PT-UZXXM6DQ-BVYWqiIW.js} +1 -1
- package/dist-embed/chunks/{ro-RO-JPDTUUEW-BF-LNyWr.js → ro-RO-JPDTUUEW-CCpzzSh1.js} +1 -1
- package/dist-embed/chunks/{ru-RU-B4JR7IUQ-CYsp0VFS.js → ru-RU-B4JR7IUQ-D6MNDylx.js} +1 -1
- package/dist-embed/chunks/{si-LK-N5RQ5JYF-DPP2zzI4.js → si-LK-N5RQ5JYF-eSMzuFfz.js} +1 -1
- package/dist-embed/chunks/{sk-SK-C5VTKIMK-Bsy5tZJ9.js → sk-SK-C5VTKIMK-DCnPMFe9.js} +1 -1
- package/dist-embed/chunks/{sl-SI-NN7IZMDC-BSN6metY.js → sl-SI-NN7IZMDC-DrRNO1Te.js} +1 -1
- package/dist-embed/chunks/{subset-shared.chunk-cWEwjmHn.js → subset-shared.chunk-1Lj1fws8.js} +1 -1
- package/dist-embed/chunks/{subset-worker.chunk-CoJnEmh6.js → subset-worker.chunk-BY_1WzGX.js} +1 -1
- package/dist-embed/chunks/{sv-SE-XGPEYMSR-DtD64Ekq.js → sv-SE-XGPEYMSR-C1C77U8p.js} +1 -1
- package/dist-embed/chunks/{ta-IN-2NMHFXQM-DgbGGIjW.js → ta-IN-2NMHFXQM-kh2J7KJQ.js} +1 -1
- package/dist-embed/chunks/{th-TH-HPSO5L25-CCZDC3pr.js → th-TH-HPSO5L25-CY7qyqUN.js} +1 -1
- package/dist-embed/chunks/{tr-TR-DEFEU3FU-akGa6iYJ.js → tr-TR-DEFEU3FU-DcrDFByj.js} +1 -1
- package/dist-embed/chunks/{uk-UA-QMV73CPH-t35eBlzl.js → uk-UA-QMV73CPH-D0oYF2ZU.js} +1 -1
- package/dist-embed/chunks/{vi-VN-M7AON7JQ-xWA8FWTO.js → vi-VN-M7AON7JQ-PLL4mabe.js} +1 -1
- package/dist-embed/chunks/{zh-CN-LNUGB5OW-D7M8yyYf.js → zh-CN-LNUGB5OW-CTSXkL4H.js} +1 -1
- package/dist-embed/chunks/{zh-HK-E62DVLB3-DvMmnROR.js → zh-HK-E62DVLB3-CfhgYw9m.js} +1 -1
- package/dist-embed/chunks/{zh-TW-RAJ6MFWO-DSL_-5li.js → zh-TW-RAJ6MFWO-BTJqeNq3.js} +1 -1
- package/dist-embed/datalayer-app-main.js +13 -13
- package/lib/specs/actions.js +6 -3
- package/lib/specs/agents/agents.js +18 -4
- package/lib/specs/apps.js +18 -6
- package/lib/specs/appspecSchema.js +6 -0
- package/lib/specs/backendTools.d.ts +3 -0
- package/lib/specs/backendTools.js +59 -0
- package/lib/types/agentspecs.d.ts +14 -3
- package/lib/types/agentspecs.js +6 -2
- package/lib/types/tools.d.ts +5 -0
- package/package.json +1 -1
- package/scripts/codegen/generate_agents.py +18 -4
- package/scripts/codegen/generate_backend_tools.py +10 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aA as Ve,gk as Ue,d$ as $e,fQ as Ke,aw as ye,bg as qe,gl as ee,gm as He,cq as Ie,gn as De,ci as Ne,ax as Qe,aD as Q,J as ue,ce as Ee,go as Ge,gp as Xe,d_ as Ye,dZ as Je,_ as Ze,gq as et,gr as tt,gs as ot,cd as q,dQ as Te,cj as nt,dP as Me,gt as it,gu as rt,dM as at,dG as he,dI as dt,dN as st,gv as lt,dx as fe,cr as We,aC as ne,ev as Le,e2 as ct,eD as ut,aG as pt,eL as gt,dD as Se,gw 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-CcDn6aA5.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-
|
|
1
|
+
import{aA as Ve,gk as Ue,d$ as $e,fQ as Ke,aw as ye,bg as qe,gl as ee,gm as He,cq as Ie,gn as De,ci as Ne,ax as Qe,aD as Q,J as ue,ce as Ee,go as Ge,gp as Xe,d_ as Ye,dZ as Je,_ as Ze,gq as et,gr as tt,gs as ot,cd as q,dQ as Te,cj as nt,dP as Me,gt as it,gu as rt,dM as at,dG as he,dI as dt,dN as st,gv as lt,dx as fe,cr as We,aC as ne,ev as Le,e2 as ct,eD as ut,aG as pt,eL as gt,dD as Se,gw 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-CcDn6aA5.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-BIl72fAm.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 Nt}from"./tokens-BYcJtuKD.js";import{I as Et}from"./index-Xpn7qE4M.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-DNFUWYih.js";import"./index-CW9jwmnF.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-CO9-1hO8.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-vXN5wge0.js";import"./NotebookSkeleton-BaU6vrsb.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-CKt61TR-.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-CQzZPse_.js";import"./KernelVariables-lzdkfkh4.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-CO_qaXBp.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-ByUGXe7J.js";import"./sessions-CmElNrqo.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 $e).addWidget(u)}static createCodeViewer(o){const{content:d,mimeType:u,...m}=o,h=new Ke.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 Ne{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 Ee{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 Ne{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 Ee{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 $t={part:1,chapter:1,section:1,subsection:2,subsubsection:3,paragraph:4,subparagraph:5},Kt=/^\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(Kt);if(f){const y=$t[f[1]];if(y<=this.configuration.maximalDepth){const w=Ge(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&&Xe(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 Gt 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 +1 @@
|
|
|
1
|
-
import{ce as E,ay as I,az as j,ci as N,aD as x,r as d,cj as L,ck as w,cl as A,aA as D,cm as R,cn as M,aC as O,co as P,cp as T,cq as U,cr as W}from"../datalayer-app-main.js";import{I as q}from"./tokens-D1WVYIDT.js";import{c as z}from"./index-
|
|
1
|
+
import{ce as E,ay as I,az as j,ci as N,aD as x,r as d,cj as L,ck as w,cl as A,aA as D,cm as R,cn as M,aC as O,co as P,cp as T,cq as U,cr as W}from"../datalayer-app-main.js";import{I as q}from"./tokens-D1WVYIDT.js";import{c as z}from"./index-BIl72fAm.js";import{b as F}from"./index-CcDn6aA5.js";import{I as H}from"./tokens-DbNnxPrX.js";import"./Output-DNFUWYih.js";import"./index-Xpn7qE4M.js";import"./hoverbox-CStlKQWE.js";import"./index-CW9jwmnF.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-CO9-1hO8.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-vXN5wge0.js";import"./NotebookSkeleton-BaU6vrsb.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-CKt61TR-.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-CQzZPse_.js";import"./KernelVariables-lzdkfkh4.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-CO_qaXBp.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-ByUGXe7J.js";import"./sessions-CmElNrqo.js";import"./tokens-CTXFWLvM.js";import"./drivecontents-BsC6Y2Vl.js";import"./kernel-BmfZmtIo.js";const K="jp-Launcher";class V extends E{constructor(){super(...arguments),this.itemsList=[]}add(r){const e=k.createItem(r);return this.itemsList.push(e),this.stateChanged.emit(void 0),new I(()=>{j.removeFirstOf(this.itemsList,e),this.stateChanged.emit(void 0)})}items(){return this.itemsList[Symbol.iterator]()}}class $ extends N{constructor(r){super(r.model),this._pending=!1,this._cwd="",this._cwd=r.cwd,this.translator=r.translator||x,this._trans=this.translator.load("jupyterlab"),this._callback=r.callback,this._commands=r.commands,this.addClass(K)}get cwd(){return this._cwd}set cwd(r){this._cwd=r,this.update()}get pending(){return this._pending}set pending(r){this._pending=r}render(){if(!this.model)return null;const r=[this._trans.__("Notebook"),this._trans.__("Console")],e=Object.create(null);for(const t of this.model.items()){const a=t.category||this._trans.__("Other");a in e||(e[a]=[]),e[a].push(t)}for(const t in e)e[t]=e[t].sort((a,n)=>k.sortCmp(a,n,this._cwd,this._commands));const p=[];let o;const u={[this._trans.__("Notebook")]:0,[this._trans.__("Console")]:20,[this._trans.__("Other")]:100};return Object.keys(e).sort((t,a)=>{const n=h=>{var _,g;const i=(_=e[h])!==null&&_!==void 0?_:[],f=(g=u[h])!==null&&g!==void 0?g:1/0;return Math.min(...i.map(y=>{var v;return(v=y.categoryRank)!==null&&v!==void 0?v:f}))},c=n(t),s=n(a);return c!==s?c-s:t.localeCompare(a)}).forEach(t=>{if(!e[t])return;const a=e[t][0],n={...a.args,cwd:this.cwd},c=r.indexOf(t)>-1,s=this._commands.iconClass(a.command,n),h=this._commands.icon(a.command,n);t in e&&(o=d.createElement("div",{className:"jp-Launcher-section",key:t},d.createElement("div",{className:"jp-Launcher-sectionHeader"},d.createElement(L.resolveReact,{icon:h,iconClass:w(s,"jp-Icon-cover"),stylesheet:"launcherSection","aria-hidden":"true"}),d.createElement("h2",{className:"jp-Launcher-sectionTitle"},t)),d.createElement("div",{className:"jp-Launcher-cardContainer"},Array.from(A(e[t],_=>G(c,_,this,this._commands,this._trans,this._callback))))),p.push(o))}),d.createElement("div",{className:"jp-Launcher-body jp-zoom-target"},d.createElement("div",{className:"jp-Launcher-content"},d.createElement("div",{className:"jp-Launcher-cwd"},d.createElement("h3",null,this.cwd)),p))}}function G(m,r,e,p,o,u){const l=r.command,t={...r.args,cwd:e.cwd},a=p.caption(l,t),n=p.label(l,t),c=m?n:a||n,s=()=>{e.pending!==!0&&(e.pending=!0,p.execute(l,{...r.args,cwd:e.cwd}).then(i=>{e.pending=!1,i instanceof D&&u(i)}).catch(i=>{console.error(i),e.pending=!1,R(o._p("Error","Launcher Error"),i)}))},h=i=>{(i.key==="Enter"||i.key===" "||i.key==="Spacebar")&&(i.preventDefault(),s())},_=p.iconClass(l,t),g=p.icon(l,t);return d.createElement("div",{className:"jp-LauncherCard",title:c,role:"button",onClick:s,onKeyDown:h,tabIndex:0,"data-category":r.category||o.__("Other"),key:k.keyProperty.get(r)},d.createElement("div",{className:"jp-LauncherCard-icon"},m?r.kernelIconUrl?d.createElement("img",{src:r.kernelIconUrl,className:"jp-Launcher-kernelIcon",alt:c}):d.createElement("div",{className:"jp-LauncherCard-noKernelIcon"},n[0].toUpperCase()):d.createElement(L.resolveReact,{icon:g,iconClass:w(_,"jp-Icon-cover"),stylesheet:"launcherCard"})),d.createElement("div",{className:"jp-LauncherCard-label",title:c},d.createElement("p",null,n)))}var k;(function(m){let r=0;m.keyProperty=new M({name:"key",create:()=>r++});function e(o){return{...o,category:o.category||"",rank:o.rank!==void 0?o.rank:1/0}}m.createItem=e;function p(o,u,l,t){const a=o.rank,n=u.rank;if(a!==n&&a!==void 0&&n!==void 0)return a<n?-1:1;const c=t.label(o.command,{...o.args,cwd:l}),s=t.label(u.command,{...u.args,cwd:l});return c.localeCompare(s)}m.sortCmp=p})(k||(k={}));var C;(function(m){m.create="launcher:create"})(C||(C={}));const Qe={activate:J,id:"@jupyterlab/launcher-extension:plugin",description:"Provides the launcher tab service.",requires:[O],optional:[z,F,H],provides:q,autoStart:!0};function J(m,r,e,p,o){const{commands:u,shell:l}=m,t=r.load("jupyterlab"),a=new V;return u.addCommand(C.create,{label:t.__("New Launcher"),icon:n=>n.toolbar?P:void 0,describedBy:{args:{type:"object",properties:{cwd:{type:"string",description:t.__("The current working directory")},toolbar:{type:"boolean",description:t.__("Whether the command is executed from a toolbar")},activate:{type:"boolean",description:t.__("Whether to activate the widget")},ref:{type:"string",description:t.__("The reference widget id")}}}},execute:n=>{var c,s;const h=(s=(c=n.cwd)!==null&&c!==void 0?c:o?.model.path)!==null&&s!==void 0?s:"",_=`launcher-${b.id++}`,g=y=>{W(l.widgets("main"),v=>v===y)&&(l.add(y,"main",{ref:_}),i.dispose())},i=new $({model:a,cwd:h,callback:g,commands:u,translator:r});i.model=a,i.title.icon=T,i.title.label=t.__("Launcher");const f=new U({content:i});if(f.title.closable=!!Array.from(l.widgets("main")).length,f.id=_,l.add(f,"main",{activate:n.activate,ref:n.ref}),e&&e.layoutModified.connect(()=>{f.title.closable=Array.from(e.widgets("main")).length>1},f),o){const y=v=>{i.cwd=v.path};o.model.pathChanged.connect(y),i.disposed.connect(()=>{o.model.pathChanged.disconnect(y)})}return f}}),e&&Promise.all([m.restored,o?.model.restored]).then(()=>{function n(){e.isEmpty("main")&&u.execute(C.create)}e.layoutModified.connect(()=>{n()})}),p&&p.addItem({command:C.create,category:t.__("Launcher")}),e&&(e.addButtonEnabled=!0,e.addRequested.connect((n,c)=>{var s;const h=((s=c.currentTitle)===null||s===void 0?void 0:s.owner.id)||c.titles[c.titles.length-1].owner.id;return u.execute(C.create,{ref:h})})),a}var b;(function(m){m.id=0})(b||(b={}));export{Qe as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ie as Je,ig as Se,ih as Y,ck as de,eI as Ve,ii as Ge,k as H,aC as R,aD as U,dJ as F,cd as x,dD as Ye,dR as Qe,ij as Xe,cq as V,eF as ue,aI as Ze,aJ as me,r as S,eO as ke,aA as Te,ce as et,ik as pe,ef as he,dL as Ce,il as tt,bg as je,_ as nt,gE as ot,im as st,ay as Ee,io as at,cr as it,dK as Ie,dw as J,ip as xe,dA as rt,eL as Ne,aw as Pe,e0 as ct,e1 as Le,iq as ge,aE as lt,aF as Q,gD as fe,gw as dt,eK as ut,ir 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-CcDn6aA5.js";import{f as De,c as jt,J as ne,e as ce}from"./index-
|
|
1
|
+
import{ie as Je,ig as Se,ih as Y,ck as de,eI as Ve,ii as Ge,k as H,aC as R,aD as U,dJ as F,cd as x,dD as Ye,dR as Qe,ij as Xe,cq as V,eF as ue,aI as Ze,aJ as me,r as S,eO as ke,aA as Te,ce as et,ik as pe,ef as he,dL as Ce,il as tt,bg as je,_ as nt,gE as ot,im as st,ay as Ee,io as at,cr as it,dK as Ie,dw as J,ip as xe,dA as rt,eL as Ne,aw as Pe,e0 as ct,e1 as Le,iq as ge,aE as lt,aF as Q,gD as fe,gw as dt,eK as ut,ir 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-CcDn6aA5.js";import{f as De,c as jt,J as ne,e as ce}from"./index-BIl72fAm.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-DNFUWYih.js";import"./index-Xpn7qE4M.js";import"./index-CW9jwmnF.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-CO9-1hO8.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-vXN5wge0.js";import"./NotebookSkeleton-BaU6vrsb.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-CKt61TR-.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-CQzZPse_.js";import"./KernelVariables-lzdkfkh4.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-CO_qaXBp.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-ByUGXe7J.js";import"./sessions-CmElNrqo.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 +1 @@
|
|
|
1
|
-
import{aC as v,aD as h,au as k}from"../datalayer-app-main.js";import{I as g,a as y,b as L}from"./index-
|
|
1
|
+
import{aC as v,aD as h,au as k}from"../datalayer-app-main.js";import{I as g,a as y,b as L}from"./index-BIl72fAm.js";import{I as b}from"./tokens-Nkg3e_k9.js";import{a as R}from"./index-CcDn6aA5.js";import{R as _}from"./index-CW9jwmnF.js";import"./Output-DNFUWYih.js";import"./index-Xpn7qE4M.js";import"./hoverbox-CStlKQWE.js";import"./dist-BrUAt6vF.js";import"./KebabHorizontalIcon-D6AY8pIS.js";import"./PaintbrushIcon-CFBHU-3l.js";import"./index-CKWSKbHe.js";import"./RestartIcon-DvpOf5Mf.js";import"./CellSidebarExtension-vXN5wge0.js";import"./NotebookSkeleton-BaU6vrsb.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-CKt61TR-.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-CQzZPse_.js";import"./KernelVariables-lzdkfkh4.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-CO_qaXBp.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-ByUGXe7J.js";import"./sessions-CmElNrqo.js";import"./tokens-CTXFWLvM.js";import"./drivecontents-BsC6Y2Vl.js";import"./kernel-BmfZmtIo.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-CO9-1hO8.js";import"./d3-color-Jd8hXty2.js";var a;(function(t){t.handleLink="rendermime:handle-local-link"})(a||(a={}));const Ie={id:"@jupyterlab/rendermime-extension:plugin",description:"Provides the render mime registry.",optional:[b,y,R,L,v],provides:g,activate:I,autoStart:!0},f="debugger:open-source";function I(t,n,p,s,l,i){const d=(i??h).load("jupyterlab");return n&&t.commands.addCommand(a.handleLink,{label:d.__("Handle Local Link"),execute:e=>{const r=e.path,o=e.id,m=e.scope||"server";if(r){if(m==="kernel"){if(!t.commands.hasCommand(f)){console.warn("Cannot open kernel file: debugger sources provider not available");return}return t.commands.execute(f,{path:r})}return n.services.contents.get(r,{content:!1}).then(()=>{const u=n.registry.defaultRenderedWidgetFactory(r),c=n.openOrReveal(r,u.name);c&&o&&c.setFragment(o)})}},describedBy:{args:{type:"object",properties:{path:{type:"string",description:d.__("The file path to open")},id:{type:"string",description:d.__("Fragment identifier to navigate to")},scope:{type:"string",enum:["kernel","server"],description:d.__("Scope of the file location")}},required:["path"]}}}),new _({initialFactories:k,trustHandler:{markTrusted:e=>{t.commandLinker.markTrusted(e)},unmarkTrusted:e=>{t.commandLinker.unmarkTrusted(e)}},linkHandler:n?{handleLink:(e,r,o)=>{e.tagName==="A"&&e.hasAttribute("download")||e.addEventListener("click",m=>{m.preventDefault(),t.commands.execute(a.handleLink,{path:r,id:o})})},handlePath:(e,r,o,m)=>{e.addEventListener("click",u=>{u.preventDefault(),t.commands.execute(a.handleLink,{path:r,id:m,scope:o})})}}:void 0,latexTypesetter:p??void 0,markdownParser:l??void 0,translator:i??void 0,sanitizer:s??void 0})}export{Ie as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a9 as R,aF as I,aA as O,fQ as M,r as n,dK as w,cg as b,fR as q,eI as F,fS as H,fT as U,az as W,fU as k,ee as x,dS as J,fV as z,fW as $,co as Q,J as P,aC as V,ev as G,aD as Y,dA as X,dx as Z}from"../datalayer-app-main.js";import{H as tt}from"./htmlselect-5N6NdDqL.js";import{o as et}from"./index-mXYl0SDo.js";import{a as st}from"./tokens-BYcJtuKD.js";import{I as ot}from"./tokens-DY_UrMLq.js";import"./Output-DtWAAuKd.js";import"./index-CcDn6aA5.js";import"./hoverbox-CStlKQWE.js";import"./index-Xpn7qE4M.js";import"./index-CW9jwmnF.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-CO9-1hO8.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-vXN5wge0.js";import"./NotebookSkeleton-BaU6vrsb.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-CKt61TR-.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-CQzZPse_.js";import"./KernelVariables-lzdkfkh4.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-CO_qaXBp.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-ByUGXe7J.js";import"./sessions-CmElNrqo.js";import"./tokens-CTXFWLvM.js";import"./drivecontents-BsC6Y2Vl.js";import"./kernel-BmfZmtIo.js";class it{constructor(e){this.reset=()=>{this._shortcut={id:"new shortcut",command:"",keybindings:[],selector:"body",category:"",args:{}},this._changed.emit()},this.addKeybinding=async(t,o)=>{this._shortcut.keybindings.push({keys:o,isDefault:!1}),this._changed.emit()},this.replaceKeybinding=async(t,o,s)=>{if(s=s.filter(i=>i!==""),!s.length)return this.deleteKeybinding(t,o);const r=this._shortcut.keybindings.findIndex(i=>i.keys===o.keys);r>-1?this._shortcut.keybindings[r]={keys:s,isDefault:!1}:this.addKeybinding(t,s),this._changed.emit()},this.deleteKeybinding=async(t,o)=>{const s=this._shortcut.keybindings.findIndex(r=>r.keys===o.keys);s>-1&&(this._shortcut.keybindings.splice(s,1),this._changed.emit())},this.resetKeybindings=async t=>{this._shortcut={...this._shortcut,keybindings:[]},this._changed.emit()},this.setCustomOptions=async(t,o)=>(this._shortcut={...this._shortcut,selector:o.selector,args:o.args},this._changed.emit(),!0),this.updateCommand=(t,o)=>{this._shortcut={...this._shortcut,command:t,category:o},this._changed.emit()},this._changed=new R(this),this._shortcut={id:"new shortcut",command:"",keybindings:[],selector:"body",category:"",args:{}},this.findConflictsFor=e.findConflictsFor,this.showSelectors=e.showSelectors,this.external=e.external}get shortcut(){return this._shortcut}get changed(){return this._changed}}class rt extends I{constructor(e){const{shortcut:t,translator:o,editorFactory:s}=e,r=o.load("jupyterlab"),i=new nt(t,o,s,()=>this._checkValidation(),e.readOnly),a=[];e.readOnly?a.push(I.cancelButton({label:r.__("OK")})):(a.push(I.cancelButton({label:r.__("Cancel")})),a.push(I.okButton({label:r.__("Apply")}))),super({title:e.readOnly?r.__("Shortcut Options"):r.__("Custom Shortcut Options"),body:i,buttons:a})}_evtKeydown(e){if(e.key==="Enter"){const t=this.node.querySelector(".jp-JSONEditor"),o=document.activeElement;if(t instanceof HTMLElement&&o instanceof HTMLElement&&t.contains(o)){e.stopPropagation();return}}super._evtKeydown(e)}}class nt extends O{constructor(e,t,o,s,r){var i,a;super();const c=t.load("jupyterlab");this.addClass("jp-Shortcuts-CustomOptionsDialogBody");const g=document.createElement("div");g.className="jp-Shortcuts-CustomOptionDialog-container";const p=document.createElement("label");p.textContent=c.__("Selector:"),p.className="jp-Dialog-label",this._selectorInput=document.createElement("input"),this._selectorInput.type="text",this._selectorInput.disabled=r??!1,this._selectorInput.value=e.selector,this._selectorInput.className="jp-mod-styled",g.appendChild(p),g.appendChild(this._selectorInput);const f=document.createElement("label");if(f.textContent=c.__("Arguments:"),f.className="jp-Dialog-label",g.appendChild(f),r){const d=document.createElement("pre");d.textContent=JSON.stringify((i=e.args)!==null&&i!==void 0?i:{},void 0,2),g.appendChild(d)}else this._editorWidget=new at((a=e.args)!==null&&a!==void 0?a:{},o,s),g.appendChild(this._editorWidget.node);this.node.appendChild(g)}getValue(){var e,t;const o=(t=(e=this._editorWidget)===null||e===void 0?void 0:e.getJSON())!==null&&t!==void 0?t:"{}";let s;try{s=JSON.parse(o)}catch(r){console.error(`Invalid JSON in arguments: ${r instanceof Error?r.message:String(r)}`),s={}}return{selector:this._selectorInput.value,args:s}}dispose(){var e;(e=this._editorWidget)===null||e===void 0||e.dispose(),super.dispose()}}class at extends O{constructor(e,t,o){super(),this._validateJSON=()=>{try{const a=this._editor.model.sharedModel.getSource();JSON.parse(a),this.node.classList.remove("jp-mod-error")}catch{this.node.classList.add("jp-mod-error")}this._checkValidation()},this.addClass("jp-JSONEditor"),this._checkValidation=o;const s=document.createElement("div");s.className="jp-JSONEditor-host";const r=new M.Model({mimeType:"application/json"}),i=JSON.stringify(e,null,2);r.sharedModel.setSource(i),this._editor=t({host:s,model:r,config:{readOnly:!1}}),this.node.appendChild(s),this._editor.model.sharedModel.changed.connect(this._validateJSON,this)}getJSON(){return this._editor.model.sharedModel.getSource()}dispose(){this._editor.model.sharedModel.changed.disconnect(this._validateJSON,this),this._editor.dispose(),super.dispose()}}const D="jp-Shortcuts-ConflictContainer";class A extends n.Component{constructor(e){super(e),this.handleSubmit=async()=>{this._isReplacingExistingKeybinding?this.state.selected?this.props.toggleInput():await this._updateShortcut():(await this._updateShortcut(),this.props.toggleInput())},this._updateShortcut=async()=>{const t=[...this.state.keys,this.state.currentChain];this.setState({keys:t}),this.props.keybinding?await this.props.replaceKeybinding(this.props.shortcut,this.props.keybinding,t):await this.props.addKeybinding(this.props.shortcut,t)},this._handleOverwrite=async(t,o)=>{const s=o.map(w.normalizeKeystroke);for(const r of t){const i=r.keybindings.filter(a=>b.deepEqual(a.keys,s)||s.some(c=>b.deepEqual(a.keys,[c])))[0];if(!i){console.error(`Conflicting binding could not be found for ${r} using keys ${o}`);continue}await this.props.deleteKeybinding(r,i)}await this._updateShortcut()},this.parseChaining=(t,o,s,r,i)=>{let a=q.keyForKeydownEvent(t.nativeEvent);const c=["Shift","Control","Alt","Meta","Ctrl","Accel"];if(t.key==="Backspace")s="",o="",r=[],i="",this.setState({value:o,userInput:s,keys:r,currentChain:i});else if(t.key!=="CapsLock"){const g=s.substr(s.lastIndexOf(" ")+1,s.length).trim();c.lastIndexOf(g)===-1&&g!=""?(s=s+",",r.push(i),i="",t.ctrlKey&&t.key!="Control"&&(s=(s+" Ctrl").trim(),i=(i+" Ctrl").trim()),t.metaKey&&t.key!="Meta"&&(s=(s+" Accel").trim(),i=(i+" Accel").trim()),t.altKey&&t.key!="Alt"&&(s=(s+" Alt").trim(),i=(i+" Alt").trim()),t.shiftKey&&t.key!="Shift"&&(s=(s+" Shift").trim(),i=(i+" Shift").trim()),c.lastIndexOf(t.key)===-1?(s=(s+" "+a).trim(),i=(i+" "+a).trim()):t.key==="Meta"?(s=(s+" Accel").trim(),i=(i+" Accel").trim()):t.key==="Control"?(s=(s+" Ctrl").trim(),i=(i+" Ctrl").trim()):t.key==="Shift"?(s=(s+" Shift").trim(),i=(i+" Shift").trim()):t.key==="Alt"?(s=(s+" Alt").trim(),i=(i+" Alt").trim()):(s=(s+" "+t.key).trim(),i=(i+" "+t.key).trim())):t.key==="Control"?(s=(s+" Ctrl").trim(),i=(i+" Ctrl").trim()):t.key==="Meta"?(s=(s+" Accel").trim(),i=(i+" Accel").trim()):t.key==="Shift"?(s=(s+" Shift").trim(),i=(i+" Shift").trim()):t.key==="Alt"?(s=(s+" Alt").trim(),i=(i+" Alt").trim()):(s=(s+" "+a).trim(),i=(i+" "+a).trim())}return this.setState({keys:r,currentChain:i}),[s,r,i]},this.checkNonFunctional=()=>{const t=["Ctrl","Alt","Accel","Shift"],o=this.state.currentChain.split(" "),s=o[o.length-1];return this.setState({isFunctional:t.indexOf(s)===-1}),t.indexOf(s)!==-1},this.checkShortcutAvailability=(t,o,s)=>{const r=this.props.findConflictsFor([...o,s],this.props.shortcut.selector),i=t===""||r.length===0;return!i&&r.length===1&&r[0].id===this.props.shortcut.id&&this._isReplacingExistingKeybinding?(this.setState({isAvailable:!0}),[]):(this.setState({isAvailable:i}),r)},this.handleInput=t=>{t.preventDefault(),this.setState({selected:!1});const o=this.parseChaining(t,this.state.value,this.state.userInput,this.state.keys,this.state.currentChain),s=o[0],r=o[1],i=o[2],a=this.props.toSymbols(s);let c=this.checkShortcutAvailability(s,r,i);this.setState({value:a,userInput:s,keys:r,currentChain:i},()=>{this.checkNonFunctional(),this._emitConflicts(c)})},this._handleBlur=t=>{var o,s;!((o=this._ref.current)===null||o===void 0)&&o.contains(t.relatedTarget)||!((s=t.relatedTarget)===null||s===void 0)&&s.closest(`.${D}`)||this.props.toggleInput()},this._ref=n.createRef(),this.state={value:this.props.placeholder,userInput:"",isAvailable:!0,isFunctional:this._isReplacingExistingKeybinding,keys:[],currentChain:"",selected:!0}}get _isReplacingExistingKeybinding(){return!!this.props.keybinding}_emitConflicts(e){const t=[...this.state.keys,this.state.currentChain];this.props.displayConflicts({conflictsWith:e,keys:this.state.keys,overwrite:async()=>{this.setState({isAvailable:!0}),await this._handleOverwrite(e,t),this.props.toggleInput()},cancel:()=>{this.props.toggleInput()}})}render(){const e=this.props.translator.load("jupyterlab");let t="jp-Shortcuts-Input";return this.state.isAvailable||(t+=" jp-mod-unavailable-Input"),n.createElement("div",{className:this.props.displayInput?this._isReplacingExistingKeybinding?"jp-Shortcuts-InputBox":"jp-Shortcuts-InputBox jp-Shortcuts-InputBoxNew":"jp-mod-hidden",ref:this._ref,onBlur:this._handleBlur},n.createElement("div",{tabIndex:0,className:t,onKeyDown:this.handleInput,ref:o=>o&&o.focus(),"data-lm-suppress-shortcuts":"true"},n.createElement("p",{className:this.state.selected&&this._isReplacingExistingKeybinding?"jp-Shortcuts-InputText jp-mod-selected-InputText":this.state.value===""?"jp-Shortcuts-InputText jp-mod-waiting-InputText":"jp-Shortcuts-InputText"},this.state.value===""?e.__("press keys"):this.state.value)),n.createElement("button",{className:this.state.isFunctional?this.state.isAvailable?"jp-Shortcuts-Submit":"jp-Shortcuts-Submit jp-mod-conflict-Submit":"jp-Shortcuts-Submit jp-mod-defunc-Submit",disabled:!this.state.isAvailable||!this.state.isFunctional,onClick:this.handleSubmit,tabIndex:0},this.state.isAvailable?n.createElement(F.react,null):n.createElement(H.react,null)))}}var C;(function(l){l.editBinding="shortcuts:edit-keybinding",l.addBinding="shortcuts:add-keybinding",l.deleteBinding="shortcuts:delete-keybinding",l.toggleSelectors="shortcuts:toggle-selectors",l.resetAll="shortcuts:reset-all"})(C||(C={}));var E;(function(l){l[l.Label=0]="Label",l[l.Category=1]="Category",l[l.Split=2]="Split",l[l.Default=3]="Default"})(E||(E={}));class j extends Map{constructor(e){var t,o,s,r;super();const{settings:i,commandRegistry:a,allCommands:c}=e;if(c)for(const g of a.listCommands()){const p={command:g,selector:"body"},f=this._computeTargetId(p),d=p.command.split(":"),m=(t=a.label(p.command,p.args))!==null&&t!==void 0?t:d.length>1?d[1]:void 0,u=d[0],y={...p,id:f,keybindings:[],category:u,label:m,args:{}};this.set(f,y)}else if(i){const g=(o=i.user.shortcuts)!==null&&o!==void 0?o:[],p=new Set(g.map(this._computeKeybindingId.bind(this))),f=(s=i.composite.shortcuts)!==null&&s!==void 0?s:[],d=i.default("shortcuts").map(m=>this._computeTargetId(m));for(const m of f){const u=this._computeTargetId(m),y=this._computeKeybindingId(m),h={keys:w.normalizeKeys(m),isDefault:!p.has(y),...m.preventDefault===void 0?{}:{preventDefault:m.preventDefault}},S=this.get(u);if(S)S.keybindings.push(h);else{const _=m.command.split(":"),K=(r=a.label(m.command,m.args))!==null&&r!==void 0?r:_.length>1?_[1]:void 0,B=_[0];this.set(u,{id:u,selector:m.selector,command:m.command,category:B,label:K,args:m.args,keybindings:[h],userDefined:!d.includes(u)})}}}}findConflictsFor(e,t){const o=new lt({registry:this}),s=e.map(w.normalizeKeystroke);let r=o.findConflicts(s,t);if(r.length!==0)return r;for(const i of s)if(r=o.findConflicts([i],t),r.length!==0)return r;return[]}_computeTargetId(e){var t;return e.command+"_"+e.selector+"_"+JSON.stringify((t=e.args)!==null&&t!==void 0?t:{})}_computeKeybindingId(e){var t;return[e.command,e.selector,JSON.stringify((t=e.args)!==null&&t!==void 0?t:{}),w.normalizeKeys(e).join(" ")].join("_")}}class lt{constructor(e){var t;const o=new Map;for(const s of e.registry.values())for(const r of s.keybindings){const i=this._keybindingHash(r.keys,s.selector),a=(t=o.get(i))!==null&&t!==void 0?t:[];a.push(s),o.set(i,a)}this._keybindingsMap=o}findConflicts(e,t){var o;const s=this._keybindingHash(e,t);return(o=this._keybindingsMap.get(s))!==null&&o!==void 0?o:[]}_keybindingHash(e,t){return e.join(" ")+"_"+t}}(function(l){function e(s){return s.replace(/\s+/g,"").toLowerCase()}function t(s,r){var i;const a=s.category.toLowerCase(),c=((i=s.label)!==null&&i!==void 0?i:"").toLowerCase(),g=`${a} ${c}`;let p=1/0,f=null;const d=/\b\w/g;for(;;){const S=d.exec(g);if(!S)break;const _=U.matchSumOfDeltas(g,r,S.index);if(!_)break;_&&_.score<=p&&(p=_.score,f=_.indices)}if(!f||p===1/0)return null;const m=a.length+1,u=W.lowerBound(f,m,(S,_)=>S-_),y=f.slice(0,u),h=f.slice(u);for(let S=0,_=h.length;S<_;++S)h[S]-=m;return y.length===0?{matchType:E.Label,categoryIndices:null,labelIndices:h,score:p,item:s}:h.length===0?{matchType:E.Category,categoryIndices:y,labelIndices:null,score:p,item:s}:{matchType:E.Split,categoryIndices:y,labelIndices:h,score:p,item:s}}function o(s,r){r=e(r);let i=[];for(const a of s.values()){if(!r){i.push({matchType:E.Default,categoryIndices:null,labelIndices:null,score:0,item:a});continue}let c=t(a,r);c&&i.push(c)}return i}l.matchItems=o})(j||(j={}));const ct={Ctrl:"⌃",Alt:"⌥",Shift:"⇧",Accel:"⌘",Cmd:"⌘"};class L extends n.Component{constructor(e){super(e),this.toggleInputNew=()=>{this.setState({displayNewInput:!this.state.displayNewInput,conflicts:new Map})},this.toSymbols=t=>k.IS_MAC?t.split(" ").map(o=>{var s;return(s=ct[o])!==null&&s!==void 0?s:o}).join(" "):t.split(" ").map(o=>o==="Accel"?"Ctrl":o).join(" "),this._trans=this.props.external.translator.load("jupyterlab"),this.state={displayNewInput:!1,displayReplaceInput:Object.freeze({}),conflicts:new Map}}componentDidMount(){this.props.external.actionRequested.connect(this._onActionRequested,this)}componentWillUnmount(){this.props.external.actionRequested.disconnect(this._onActionRequested,this)}async _onActionRequested(e,t){if(!("shortcutId"in t&&t.shortcutId!==this.props.shortcut.id)){if(t.request==="add-keybinding")return this.toggleInputNew();if(t.request==="edit-keybinding"&&this.toggleInputReplaceMethod(t.keybinding),t.request==="delete-keybinding"){const o=this.props.shortcut,s=o.keybindings[t.keybinding];this.props.deleteKeybinding(o,s).catch(console.error)}}}getCategoryCell(){return n.createElement("div",{className:"jp-Shortcuts-Cell"},this.props.shortcut.category)}getLabelCell(){var e;if(this.props.newShortcutUtils){const t=this._getFilteredCommands();return n.createElement("div",{className:"jp-Shortcuts-Cell"},n.createElement(tt,{value:this.props.shortcut.command,options:[{value:"",label:this._trans.__("Select a command")},...t.map(o=>({value:o.command,label:`${o.category}: ${o.label}`}))],onChange:o=>{var s,r,i;const a=t.find(c=>c.command===o.target.value);(s=this.props.newShortcutUtils)===null||s===void 0||s.updateCommand((r=a?.command)!==null&&r!==void 0?r:"",(i=a?.category)!==null&&i!==void 0?i:"")}}))}else return n.createElement("div",{className:"jp-Shortcuts-Cell"},n.createElement("div",{className:"jp-label"},(e=this.props.shortcut.label)!==null&&e!==void 0?e:this._trans.__("(Command label missing)")))}getResetShortCutLink(){return n.createElement("a",{className:"jp-Shortcuts-Reset",onClick:()=>this.props.resetKeybindings(this.props.shortcut)},this.props.shortcut.userDefined?this._trans.__("Delete"):this._trans.__("Reset"))}getSourceCell(){var e;const t=this.props.shortcut.keybindings.every(r=>r.isDefault),o=this.props.shortcut.userDefined||!!this.props.newShortcutUtils,s=o?this._trans.__("Custom options"):this._trans.__("Show options");return n.createElement("div",{className:"jp-Shortcuts-Cell"},!this.props.newShortcutUtils&&n.createElement("div",{className:"jp-Shortcuts-SourceCell"},t?this._trans.__("Default"):this._trans.__("Custom")),t?"":this.getResetShortCutLink(),this.props.external.editorFactory&&n.createElement(x,{className:"jp-mod-styled jp-mod-reject jp-Shortcuts-CustomOptions",onClick:async()=>{if(!this.props.external.editorFactory){console.error("Cannot build the custom options form");return}const i=await new rt({shortcut:this.props.shortcut,translator:this.props.external.translator,editorFactory:this.props.external.editorFactory,readOnly:!o}).launch();i.button.accept&&o&&i.value&&await this.props.setCustomOptions(this.props.shortcut,i.value)},title:s,"aria-label":s,appearance:"neutral"},o?n.createElement(J.react,{tag:null}):n.createElement(z.react,{tag:null})),!!this.props.newShortcutUtils&&n.createElement(n.Fragment,null,n.createElement(x,{className:"jp-mod-styled jp-mod-accept jp-Shortcuts-SaveNew",onClick:(e=this.props.newShortcutUtils)===null||e===void 0?void 0:e.saveShortcut,title:this._trans.__("Save shortcut"),"aria-label":this._trans.__("Save shortcut"),appearance:"neutral",disabled:!this.props.shortcut.command||!this.props.shortcut.keybindings.length||this.props.shortcut.keybindings.every(r=>!r.keys||r.keys.length===0)},n.createElement(F.react,{tag:null}))))}getOptionalSelectorCell(){return this.props.showSelectors?n.createElement("div",{className:"jp-Shortcuts-Cell"},n.createElement("div",{className:"jp-selector"},this.props.shortcut.selector)):null}getClassNameForShortCuts(e){const t=["jp-Shortcuts-ShortcutCell"];switch(e.length){case 1:t.push("jp-Shortcuts-SingleCell");break;case 0:t.push("jp-Shortcuts-EmptyCell");break}return t.join(" ")}toggleInputReplaceMethod(e){const t=this.state.displayReplaceInput[e];this.setState({displayReplaceInput:{...this.state.displayReplaceInput,[e]:!t},conflicts:new Map})}getDisplayReplaceInput(e){return this.state.displayReplaceInput[e]}getOrDisplayIfNeeded(e){const t=["jp-Shortcuts-Or"];return(e||this.state.displayNewInput)&&t.push("jp-Shortcuts-Or-Forced"),n.createElement("div",{className:t.join(" ")},this._trans.__("or"))}getShortCutAsInput(e,t){return n.createElement(A,{addKeybinding:this.props.addKeybinding,replaceKeybinding:this.props.replaceKeybinding,deleteKeybinding:this.props.deleteKeybinding,findConflictsFor:this.props.findConflictsFor,toggleInput:()=>this.toggleInputReplaceMethod(t),shortcut:this.props.shortcut,keybinding:e,displayConflicts:o=>{const s=new Map(this.state.conflicts);s.set(e,o),this.setState({conflicts:s})},toSymbols:this.toSymbols,displayInput:this.getDisplayReplaceInput(t),placeholder:this.toSymbols(e.keys.join(", ")),translator:this.props.external.translator})}getShortCutForDisplayOnly(e){return e.keys.map((t,o)=>n.createElement("div",{className:"jp-Shortcuts-ShortcutKeysContainer",key:o},n.createElement("div",{className:"jp-Shortcuts-ShortcutKeys"},this.toSymbols(t).split(" ").map((s,r,i)=>n.createElement(n.Fragment,{key:`${o}-${s}-${r}`},n.createElement("span",{className:"jp-ContextualShortcut-Key"},s),r+1<i.length?" + ":null))),o+1<e.keys.length?n.createElement("div",{className:"jp-Shortcuts-Comma"},","):null))}isLocationBeingEdited(e){return this.state.displayReplaceInput[e]}getDivForKey(e,t,o){return n.createElement("div",{className:"jp-Shortcuts-ShortcutContainer",key:this.props.shortcut.id+"_"+e,"data-keybinding":e,"data-shortcut":this.props.shortcut.id,onClick:()=>this.toggleInputReplaceMethod(e)},this.isLocationBeingEdited(e)?this.getShortCutAsInput(t,e):this.getShortCutForDisplayOnly(t),!(e===this._nonEmptyBindings.length-1&&Object.values(this.state.displayReplaceInput).some(Boolean))&&this.getOrDisplayIfNeeded(e<this._nonEmptyBindings.length-1))}getAddLink(){return n.createElement("a",{className:this.state.displayNewInput?"":"jp-Shortcuts-Plus",onClick:()=>{this.toggleInputNew()}},this._trans.__("Add"))}getInputBoxWhenToggled(){return this.state.displayNewInput?n.createElement(A,{addKeybinding:this.props.addKeybinding,replaceKeybinding:this.props.replaceKeybinding,deleteKeybinding:this.props.deleteKeybinding,findConflictsFor:this.props.findConflictsFor,toggleInput:this.toggleInputNew,shortcut:this.props.shortcut,displayConflicts:e=>{const t=new Map(this.state.conflicts);t.set(null,e),this.setState({conflicts:t})},toSymbols:this.toSymbols,displayInput:this.state.displayNewInput,placeholder:"",translator:this.props.external.translator}):n.createElement("div",null)}getShortCutsCell(e){return n.createElement("div",{className:"jp-Shortcuts-Cell"},n.createElement("div",{className:this.getClassNameForShortCuts(e)},e.map((t,o)=>this.getDivForKey(o,t,e)),e.length>=1&&!this.state.displayNewInput&&!Object.values(this.state.displayReplaceInput).some(Boolean)&&this.getAddLink(),e.length===0&&!this.state.displayNewInput&&this.getAddLink(),this.getInputBoxWhenToggled()))}getConflicts(){const e=[...this.state.conflicts.values()].filter(t=>t.conflictsWith.length!==0);return e.length===0?n.createElement(n.Fragment,null):n.createElement("div",{className:"jp-Shortcuts-Row jp-Shortcuts-RowWithConflict"},n.createElement("div",{className:D},e.map(t=>{const o=t.keys.join(" ")+"_"+t.conflictsWith.map(s=>s.id).join("");return n.createElement("div",{className:"jp-Shortcuts-Conflict",key:o},n.createElement("div",{className:"jp-Shortcuts-ErrorMessage"},this._trans.__("Shortcut already in use by %1. Overwrite it?",t.conflictsWith.map(s=>{var r;return(r=s.label)!==null&&r!==void 0?r:s.command}).join(", "))),n.createElement("div",{className:"jp-Shortcuts-ErrorButton"},n.createElement("button",{className:"jp-Button jp-mod-reject jp-mod-styled",onClick:()=>{this._clearConflict(t),t.cancel()}},this._trans.__("Cancel")),n.createElement("button",{className:"jp-Button jp-mod-warn jp-mod-styled",onClick:()=>{this._clearConflict(t),t.overwrite()}},this._trans.__("Overwrite"))))})))}_clearConflict(e){const t=new Map,o=this._conflictId(e);for(const[s,r]of this.state.conflicts.entries())this._conflictId(r)!==o&&t.set(s,r);this.setState({conflicts:t})}_conflictId(e){return e.keys.join(" ")+"_"+e.conflictsWith.map(t=>t.id).join("")}_getFilteredCommands(){var e,t;const o=new j({commandRegistry:this.props.external.commandRegistry,allCommands:!0}),s=j.matchItems(o,(t=(e=this.props.newShortcutUtils)===null||e===void 0?void 0:e.searchQuery)!==null&&t!==void 0?t:"").map(r=>r.item).filter(r=>!r.command.startsWith("__internal:"));return s.sort((r,i)=>{var a,c;const g=r.category,p=i.category,f=g.localeCompare(p);if(f)return f;{const d=(a=r.label)!==null&&a!==void 0?a:"",m=(c=i.label)!==null&&c!==void 0?c:"";return d.localeCompare(m)}}),s}get _nonEmptyBindings(){return this.props.shortcut.keybindings.filter(e=>e.keys.filter(t=>t!="").length!==0)}render(){return n.createElement(n.Fragment,null,n.createElement("div",{className:`jp-Shortcuts-Row${this.props.newShortcutUtils?" jp-Shortcuts-Row-newShortcut":""}`,"data-shortcut":this.props.shortcut.id},this.getCategoryCell(),this.getLabelCell(),this.getShortCutsCell(this._nonEmptyBindings),this.getSourceCell(),this.getOptionalSelectorCell()),this.getConflicts())}}const dt=115;class ht extends n.Component{render(){return n.createElement("div",{className:"jp-Shortcuts-ShortcutListContainer",style:{height:`${this.props.height-dt}px`},id:"shortcutListContainer"},n.createElement("div",{className:"jp-Shortcuts-ShortcutList"},this.props.shortcuts.map(e=>n.createElement(L,{key:e.id,addKeybinding:this.props.addKeybinding,replaceKeybinding:this.props.replaceKeybinding,deleteKeybinding:this.props.deleteKeybinding,resetKeybindings:this.props.resetKeybindings,findConflictsFor:this.props.findConflictsFor,setCustomOptions:this.props.setCustomOptions,shortcut:e,showSelectors:this.props.showSelectors,external:this.props.external}))))}}class ut extends n.Component{render(){return n.createElement("div",{className:this.props.title.toLowerCase()===this.props.active?"jp-Shortcuts-Header jp-Shortcuts-CurrentHeader":"jp-Shortcuts-Header",onClick:()=>this.props.updateSort(this.props.columnId)},this.props.title,n.createElement($.react,{className:"jp-Shortcuts-SortButton jp-ShortcutTitleItem-sortButton"}))}}function pt(l){const e=l.translator.load("jupyterlab");return n.createElement("div",{className:"jp-Shortcuts-AdvancedOptions"},n.createElement("a",{className:"jp-Shortcuts-AdvancedOptionsLink",onClick:()=>l.toggleSelectors()},l.showSelectors?e.__("Hide Selectors"):e.__("Show Selectors")),n.createElement("a",{className:"jp-Shortcuts-AdvancedOptionsLink",onClick:()=>l.resetShortcuts()},e.__("Reset All")),n.createElement(x,{className:"jp-mod-styled jp-mod-accept jp-Shortcuts-AdvancedOptionsButton",onClick:l.toggleAddCommandRow,title:e.__("Tool for adding shortcuts"),"aria-label":e.__("Tool for adding shortcuts")},n.createElement(Q.react,{tag:"span",elementSize:"xlarge",elementPosition:"center"})))}class mt extends n.Component{constructor(e){super(e)}getShortCutTitleItem(e,t){return n.createElement("div",{className:"jp-Shortcuts-Cell"},n.createElement(ut,{title:e,updateSort:this.props.updateSort,active:this.props.currentSort,columnId:t}))}render(){const e=this.props.translator.load("jupyterlab");return n.createElement("div",{className:"jp-Shortcuts-Top"},n.createElement("div",{className:"jp-Shortcuts-TopNav"},n.createElement(et,{"aria-label":e.__("Search shortcuts"),updateFilter:(t,o)=>this.props.updateSearchQuery(o??""),placeholder:e.__("Search…"),useFuzzyFilter:!1}),n.createElement(pt,{toggleSelectors:this.props.toggleSelectors,showSelectors:this.props.showSelectors,resetShortcuts:this.props.resetShortcuts,toggleAddCommandRow:this.props.toggleAddCommandRow,translator:this.props.translator})),n.createElement("div",{className:"jp-Shortcuts-HeaderRowContainer"},n.createElement("div",{className:"jp-Shortcuts-HeaderRow"},this.getShortCutTitleItem(e.__("Category"),"category"),this.getShortCutTitleItem(e.__("Command"),"command"),n.createElement("div",{className:"jp-Shortcuts-Cell"},n.createElement("div",{className:"title-div"},e.__("Shortcut"))),this.getShortCutTitleItem(e.__("Source"),"source"),this.props.showSelectors&&this.getShortCutTitleItem(e.__("Selectors"),"selector"))))}}class gt extends n.Component{constructor(e){super(e),this.updateSearchQuery=t=>{this.setState({searchQuery:t},()=>{const o=this.state.shortcutRegistry;this.setState({filteredShortcutList:this._searchFilterShortcuts(o)},()=>{this.sortShortcuts()})})},this.resetShortcuts=async()=>{await(await this.props.external.getSettings()).set("shortcuts",[]),await this._refreshShortcutList()},this.resetKeybindings=async t=>{await this._setKeybinding(t,[])},this.replaceKeybinding=async(t,o,s)=>this._setKeybinding(t,s,o),this.deleteKeybinding=async(t,o)=>{await this._setKeybinding(t,[],o)},this.addKeybinding=async(t,o)=>{await this._setKeybinding(t,o)},this.setCustomOptions=async(t,o)=>{var s;const r=await this.props.external.getSettings(),i=(s=r.user.shortcuts)!==null&&s!==void 0?s:[],a=i.filter(c=>{var g,p;return c.command===t.command&&c.selector===t.selector&&b.deepEqual((g=c.args)!==null&&g!==void 0?g:{},(p=t.args)!==null&&p!==void 0?p:{})});return a.length?(a.forEach(c=>{c.selector=o.selector,c.args=o.args}),await r.set("shortcuts",i),await this._refreshShortcutList(),!0):(console.error("Error writing the custom options: target not found"),!1)},this.toggleSelectors=()=>{this.setState({showSelectors:!this.state.showSelectors})},this.toggleAddCommandRow=async()=>{this.setState({showAddCommand:!this.state.showAddCommand})},this.updateSort=t=>{t!==this.state.currentSort&&this.setState({currentSort:t},this.sortShortcuts)},this.saveNewShortcut=async()=>{const t={...this.state.newShortcut,args:void 0};for(let s of t.keybindings)await this.addKeybinding(t,s.keys);await this.setCustomOptions(t,{selector:t.selector,args:this.state.newShortcut.args})&&(this._newShortcutItem.reset(),this.toggleAddCommandRow())},this._newShortcutItem=new it({showSelectors:!1,findConflictsFor:(t,o)=>this.state.shortcutRegistry?this.state.shortcutRegistry.findConflictsFor(t,o):(console.error("Cannot search for keybinding conflicts at this time: registry is not ready"),[]),external:this.props.external}),this.state={shortcutRegistry:null,filteredShortcutList:new Array,shortcutsFetched:!1,searchQuery:"",showSelectors:!1,currentSort:"category",showAddCommand:!1,newShortcut:this._newShortcutItem.shortcut},this._newShortcutItem.changed.connect(()=>{this.setState({newShortcut:{...this._newShortcutItem.shortcut}})})}componentDidMount(){this.props.external.actionRequested.connect(this._onActionRequested,this),this._refreshShortcutList()}componentWillUnmount(){this.props.external.actionRequested.disconnect(this._onActionRequested,this)}async _onActionRequested(e,t){if(t.request==="toggle-selectors")return this.toggleSelectors();t.request==="reset-all"&&await this.resetShortcuts()}async _refreshShortcutList(){const e=await this.props.external.getSettings(),t=new j({commandRegistry:this.props.external.commandRegistry,settings:e});this.setState({shortcutRegistry:t,filteredShortcutList:this._searchFilterShortcuts(t),shortcutsFetched:!0},()=>{this.sortShortcuts()})}_searchFilterShortcuts(e){return e?j.matchItems(e,this.state.searchQuery).map(o=>o.item):[]}async _setKeybinding(e,t,o){var s,r,i,a,c;t.length===1&&t[0]==""&&(t=[]);const g=t.map(w.normalizeKeystroke),p=await this.props.external.getSettings(),f=(s=p.user.shortcuts)!==null&&s!==void 0?s:[],d=[];let m=!1;for(let u of f)if(u.command===e.command&&u.selector===e.selector&&b.deepEqual((r=u.args)!==null&&r!==void 0?r:{},(i=e.args)!==null&&i!==void 0?i:{})&&o&&b.deepEqual(o.keys,w.normalizeKeys(u))){const y=o.isDefault&&b.deepEqual(o.keys,g);t.length!==0&&!y&&d.push(this._setShortcutKeys(u,t)),m=!0}else{if(u.command===e.command&&u.selector===e.selector&&b.deepEqual((a=u.args)!==null&&a!==void 0?a:{},(c=e.args)!==null&&c!==void 0?c:{})&&!o&&t.length===0)continue;d.push(u)}if(!m){const u=!o||!b.deepEqual(o.keys,g);o&&o.isDefault&&u&&d.push(this._shortcutFromTarget(e,o.keys,{disabled:!0,preventDefault:o.preventDefault})),t.length!==0&&u&&d.push(this._shortcutFromTarget(e,t,{preventDefault:o?.preventDefault}))}await p.set("shortcuts",d),await this._refreshShortcutList()}_setShortcutKeys(e,t){const o=this._platformKeys(e);return{...e,[o]:t}}_shortcutFromTarget(e,t,o={}){const s={command:e.command,selector:e.selector,keys:t};return e.args&&!b.deepEqual(e.args,{})&&(s.args=e.args),o.disabled&&(s.disabled=!0),o.preventDefault!==void 0&&(s.preventDefault=o.preventDefault),s}_platformKeys(e){return k.IS_WIN&&e.winKeys?"winKeys":k.IS_MAC&&e.macKeys?"macKeys":!k.IS_WIN&&!k.IS_MAC&&e.linuxKeys?"linuxKeys":"keys"}sortShortcuts(){const e=this.state.filteredShortcutList;let t=this.state.currentSort;t==="command"&&(t="label");const o=s=>{var r;return t==="source"?s.keybindings.every(i=>i.isDefault)?"default":"other":(r=s[t])!==null&&r!==void 0?r:""};e.sort((s,r)=>{var i,a;const c=o(s),g=o(r),p=c.localeCompare(g);if(p)return p;{const f=(i=s.label)!==null&&i!==void 0?i:"",d=(a=r.label)!==null&&a!==void 0?a:"";return f.localeCompare(d)}}),this.setState({filteredShortcutList:e})}render(){return this.state.shortcutsFetched?n.createElement("div",{className:"jp-Shortcuts-ShortcutUI",id:"jp-shortcutui"},n.createElement(mt,{updateSearchQuery:this.updateSearchQuery,resetShortcuts:this.resetShortcuts,toggleSelectors:this.toggleSelectors,showSelectors:this.state.showSelectors,updateSort:this.updateSort,currentSort:this.state.currentSort,toggleAddCommandRow:this.toggleAddCommandRow,width:this.props.width,translator:this.props.external.translator}),this.state.showAddCommand&&n.createElement(L,{...this._newShortcutItem,shortcut:this.state.newShortcut,newShortcutUtils:{searchQuery:this.state.searchQuery,updateCommand:this._newShortcutItem.updateCommand,saveShortcut:this.saveNewShortcut}}),n.createElement(ht,{shortcuts:this.state.filteredShortcutList,resetKeybindings:this.resetKeybindings,addKeybinding:this.addKeybinding,replaceKeybinding:this.replaceKeybinding,deleteKeybinding:this.deleteKeybinding,setCustomOptions:this.setCustomOptions,showSelectors:this.state.showSelectors,findConflictsFor:(e,t)=>this.state.shortcutRegistry?this.state.shortcutRegistry.findConflictsFor(e,t):(console.error("Cannot search for keybinding conflicts at this time: registry is not ready"),[]),height:this.props.height,external:this.props.external})):null}}const yt=l=>P.createElement(gt,{external:l.external,height:1e3,width:1e3}),T="@jupyterlab/shortcuts-extension:shortcuts";function ft(l,e,t,o,s){return{translator:t,getSettings:()=>l.load(T,!0),commandRegistry:e.commands,actionRequested:o,editorFactory:s}}const v={id:T,description:"Adds the keyboard shortcuts editor.",requires:[ot],optional:[V,st,G],activate:async(l,e,t,o,s)=>{const r=t??Y,i=r.load("jupyterlab"),{commands:a}=l;let c,g,p={};if(o){const d=new R({}),m=h=>h.dataset.shortcut!==void 0;l.commands.addCommand(C.editBinding,{label:i.__("Edit Keybinding"),caption:i.__("Edit existing keybinding"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const h=l.contextMenuHitTest(m),S=h?.dataset.keybinding,_=h?.dataset.shortcut;if(!_||!S)return console.log("Missing shortcut id/keybinding information");d.emit({request:"edit-keybinding",keybinding:parseInt(S,10),shortcutId:_})}}),l.commands.addCommand(C.deleteBinding,{label:i.__("Delete Keybinding"),caption:i.__("Delete chosen keybinding"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const h=l.contextMenuHitTest(m),S=h?.dataset.keybinding,_=h?.dataset.shortcut;if(!_||!S)return console.log("Missing shortcut id/keybinding information");d.emit({request:"delete-keybinding",keybinding:parseInt(S,10),shortcutId:_})}}),l.commands.addCommand(C.addBinding,{label:i.__("Add Keybinding"),caption:i.__("Add new keybinding for existing shortcut target"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const h=l.contextMenuHitTest(m),S=h?.dataset.shortcut;if(!S)return console.log("Missing shortcut id to add keybinding to");d.emit({request:"add-keybinding",shortcutId:S})}}),a.addCommand(C.toggleSelectors,{label:i.__("Toggle Selectors"),caption:i.__("Toggle command selectors"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{d.emit({request:"toggle-selectors"})}}),a.addCommand(C.resetAll,{label:i.__("Reset All"),caption:i.__("Reset all shortcuts"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{d.emit({request:"reset-all"})}});const u=s?h=>s.factoryService.newInlineEditor(h):void 0,y={fieldRenderer:h=>yt({external:ft(e,l,r,d,u),...h})};o.addRenderer(`${v.id}.shortcuts`,y)}function f(d){const m=l.commands.listCommands().join(`
|
|
1
|
+
import{a9 as R,aF as I,aA as O,fQ as M,r as n,dK as w,cg as b,fR as q,eI as F,fS as H,fT as U,az as W,fU as k,ee as x,dS as J,fV as z,fW as $,co as Q,J as P,aC as V,ev as G,aD as Y,dA as X,dx as Z}from"../datalayer-app-main.js";import{H as tt}from"./htmlselect-5N6NdDqL.js";import{o as et}from"./index-BIl72fAm.js";import{a as st}from"./tokens-BYcJtuKD.js";import{I as ot}from"./tokens-DY_UrMLq.js";import"./Output-DNFUWYih.js";import"./index-CcDn6aA5.js";import"./hoverbox-CStlKQWE.js";import"./index-Xpn7qE4M.js";import"./index-CW9jwmnF.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-CO9-1hO8.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-vXN5wge0.js";import"./NotebookSkeleton-BaU6vrsb.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-CKt61TR-.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-CQzZPse_.js";import"./KernelVariables-lzdkfkh4.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-CO_qaXBp.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-ByUGXe7J.js";import"./sessions-CmElNrqo.js";import"./tokens-CTXFWLvM.js";import"./drivecontents-BsC6Y2Vl.js";import"./kernel-BmfZmtIo.js";class it{constructor(e){this.reset=()=>{this._shortcut={id:"new shortcut",command:"",keybindings:[],selector:"body",category:"",args:{}},this._changed.emit()},this.addKeybinding=async(t,o)=>{this._shortcut.keybindings.push({keys:o,isDefault:!1}),this._changed.emit()},this.replaceKeybinding=async(t,o,s)=>{if(s=s.filter(i=>i!==""),!s.length)return this.deleteKeybinding(t,o);const r=this._shortcut.keybindings.findIndex(i=>i.keys===o.keys);r>-1?this._shortcut.keybindings[r]={keys:s,isDefault:!1}:this.addKeybinding(t,s),this._changed.emit()},this.deleteKeybinding=async(t,o)=>{const s=this._shortcut.keybindings.findIndex(r=>r.keys===o.keys);s>-1&&(this._shortcut.keybindings.splice(s,1),this._changed.emit())},this.resetKeybindings=async t=>{this._shortcut={...this._shortcut,keybindings:[]},this._changed.emit()},this.setCustomOptions=async(t,o)=>(this._shortcut={...this._shortcut,selector:o.selector,args:o.args},this._changed.emit(),!0),this.updateCommand=(t,o)=>{this._shortcut={...this._shortcut,command:t,category:o},this._changed.emit()},this._changed=new R(this),this._shortcut={id:"new shortcut",command:"",keybindings:[],selector:"body",category:"",args:{}},this.findConflictsFor=e.findConflictsFor,this.showSelectors=e.showSelectors,this.external=e.external}get shortcut(){return this._shortcut}get changed(){return this._changed}}class rt extends I{constructor(e){const{shortcut:t,translator:o,editorFactory:s}=e,r=o.load("jupyterlab"),i=new nt(t,o,s,()=>this._checkValidation(),e.readOnly),a=[];e.readOnly?a.push(I.cancelButton({label:r.__("OK")})):(a.push(I.cancelButton({label:r.__("Cancel")})),a.push(I.okButton({label:r.__("Apply")}))),super({title:e.readOnly?r.__("Shortcut Options"):r.__("Custom Shortcut Options"),body:i,buttons:a})}_evtKeydown(e){if(e.key==="Enter"){const t=this.node.querySelector(".jp-JSONEditor"),o=document.activeElement;if(t instanceof HTMLElement&&o instanceof HTMLElement&&t.contains(o)){e.stopPropagation();return}}super._evtKeydown(e)}}class nt extends O{constructor(e,t,o,s,r){var i,a;super();const c=t.load("jupyterlab");this.addClass("jp-Shortcuts-CustomOptionsDialogBody");const g=document.createElement("div");g.className="jp-Shortcuts-CustomOptionDialog-container";const p=document.createElement("label");p.textContent=c.__("Selector:"),p.className="jp-Dialog-label",this._selectorInput=document.createElement("input"),this._selectorInput.type="text",this._selectorInput.disabled=r??!1,this._selectorInput.value=e.selector,this._selectorInput.className="jp-mod-styled",g.appendChild(p),g.appendChild(this._selectorInput);const f=document.createElement("label");if(f.textContent=c.__("Arguments:"),f.className="jp-Dialog-label",g.appendChild(f),r){const d=document.createElement("pre");d.textContent=JSON.stringify((i=e.args)!==null&&i!==void 0?i:{},void 0,2),g.appendChild(d)}else this._editorWidget=new at((a=e.args)!==null&&a!==void 0?a:{},o,s),g.appendChild(this._editorWidget.node);this.node.appendChild(g)}getValue(){var e,t;const o=(t=(e=this._editorWidget)===null||e===void 0?void 0:e.getJSON())!==null&&t!==void 0?t:"{}";let s;try{s=JSON.parse(o)}catch(r){console.error(`Invalid JSON in arguments: ${r instanceof Error?r.message:String(r)}`),s={}}return{selector:this._selectorInput.value,args:s}}dispose(){var e;(e=this._editorWidget)===null||e===void 0||e.dispose(),super.dispose()}}class at extends O{constructor(e,t,o){super(),this._validateJSON=()=>{try{const a=this._editor.model.sharedModel.getSource();JSON.parse(a),this.node.classList.remove("jp-mod-error")}catch{this.node.classList.add("jp-mod-error")}this._checkValidation()},this.addClass("jp-JSONEditor"),this._checkValidation=o;const s=document.createElement("div");s.className="jp-JSONEditor-host";const r=new M.Model({mimeType:"application/json"}),i=JSON.stringify(e,null,2);r.sharedModel.setSource(i),this._editor=t({host:s,model:r,config:{readOnly:!1}}),this.node.appendChild(s),this._editor.model.sharedModel.changed.connect(this._validateJSON,this)}getJSON(){return this._editor.model.sharedModel.getSource()}dispose(){this._editor.model.sharedModel.changed.disconnect(this._validateJSON,this),this._editor.dispose(),super.dispose()}}const D="jp-Shortcuts-ConflictContainer";class A extends n.Component{constructor(e){super(e),this.handleSubmit=async()=>{this._isReplacingExistingKeybinding?this.state.selected?this.props.toggleInput():await this._updateShortcut():(await this._updateShortcut(),this.props.toggleInput())},this._updateShortcut=async()=>{const t=[...this.state.keys,this.state.currentChain];this.setState({keys:t}),this.props.keybinding?await this.props.replaceKeybinding(this.props.shortcut,this.props.keybinding,t):await this.props.addKeybinding(this.props.shortcut,t)},this._handleOverwrite=async(t,o)=>{const s=o.map(w.normalizeKeystroke);for(const r of t){const i=r.keybindings.filter(a=>b.deepEqual(a.keys,s)||s.some(c=>b.deepEqual(a.keys,[c])))[0];if(!i){console.error(`Conflicting binding could not be found for ${r} using keys ${o}`);continue}await this.props.deleteKeybinding(r,i)}await this._updateShortcut()},this.parseChaining=(t,o,s,r,i)=>{let a=q.keyForKeydownEvent(t.nativeEvent);const c=["Shift","Control","Alt","Meta","Ctrl","Accel"];if(t.key==="Backspace")s="",o="",r=[],i="",this.setState({value:o,userInput:s,keys:r,currentChain:i});else if(t.key!=="CapsLock"){const g=s.substr(s.lastIndexOf(" ")+1,s.length).trim();c.lastIndexOf(g)===-1&&g!=""?(s=s+",",r.push(i),i="",t.ctrlKey&&t.key!="Control"&&(s=(s+" Ctrl").trim(),i=(i+" Ctrl").trim()),t.metaKey&&t.key!="Meta"&&(s=(s+" Accel").trim(),i=(i+" Accel").trim()),t.altKey&&t.key!="Alt"&&(s=(s+" Alt").trim(),i=(i+" Alt").trim()),t.shiftKey&&t.key!="Shift"&&(s=(s+" Shift").trim(),i=(i+" Shift").trim()),c.lastIndexOf(t.key)===-1?(s=(s+" "+a).trim(),i=(i+" "+a).trim()):t.key==="Meta"?(s=(s+" Accel").trim(),i=(i+" Accel").trim()):t.key==="Control"?(s=(s+" Ctrl").trim(),i=(i+" Ctrl").trim()):t.key==="Shift"?(s=(s+" Shift").trim(),i=(i+" Shift").trim()):t.key==="Alt"?(s=(s+" Alt").trim(),i=(i+" Alt").trim()):(s=(s+" "+t.key).trim(),i=(i+" "+t.key).trim())):t.key==="Control"?(s=(s+" Ctrl").trim(),i=(i+" Ctrl").trim()):t.key==="Meta"?(s=(s+" Accel").trim(),i=(i+" Accel").trim()):t.key==="Shift"?(s=(s+" Shift").trim(),i=(i+" Shift").trim()):t.key==="Alt"?(s=(s+" Alt").trim(),i=(i+" Alt").trim()):(s=(s+" "+a).trim(),i=(i+" "+a).trim())}return this.setState({keys:r,currentChain:i}),[s,r,i]},this.checkNonFunctional=()=>{const t=["Ctrl","Alt","Accel","Shift"],o=this.state.currentChain.split(" "),s=o[o.length-1];return this.setState({isFunctional:t.indexOf(s)===-1}),t.indexOf(s)!==-1},this.checkShortcutAvailability=(t,o,s)=>{const r=this.props.findConflictsFor([...o,s],this.props.shortcut.selector),i=t===""||r.length===0;return!i&&r.length===1&&r[0].id===this.props.shortcut.id&&this._isReplacingExistingKeybinding?(this.setState({isAvailable:!0}),[]):(this.setState({isAvailable:i}),r)},this.handleInput=t=>{t.preventDefault(),this.setState({selected:!1});const o=this.parseChaining(t,this.state.value,this.state.userInput,this.state.keys,this.state.currentChain),s=o[0],r=o[1],i=o[2],a=this.props.toSymbols(s);let c=this.checkShortcutAvailability(s,r,i);this.setState({value:a,userInput:s,keys:r,currentChain:i},()=>{this.checkNonFunctional(),this._emitConflicts(c)})},this._handleBlur=t=>{var o,s;!((o=this._ref.current)===null||o===void 0)&&o.contains(t.relatedTarget)||!((s=t.relatedTarget)===null||s===void 0)&&s.closest(`.${D}`)||this.props.toggleInput()},this._ref=n.createRef(),this.state={value:this.props.placeholder,userInput:"",isAvailable:!0,isFunctional:this._isReplacingExistingKeybinding,keys:[],currentChain:"",selected:!0}}get _isReplacingExistingKeybinding(){return!!this.props.keybinding}_emitConflicts(e){const t=[...this.state.keys,this.state.currentChain];this.props.displayConflicts({conflictsWith:e,keys:this.state.keys,overwrite:async()=>{this.setState({isAvailable:!0}),await this._handleOverwrite(e,t),this.props.toggleInput()},cancel:()=>{this.props.toggleInput()}})}render(){const e=this.props.translator.load("jupyterlab");let t="jp-Shortcuts-Input";return this.state.isAvailable||(t+=" jp-mod-unavailable-Input"),n.createElement("div",{className:this.props.displayInput?this._isReplacingExistingKeybinding?"jp-Shortcuts-InputBox":"jp-Shortcuts-InputBox jp-Shortcuts-InputBoxNew":"jp-mod-hidden",ref:this._ref,onBlur:this._handleBlur},n.createElement("div",{tabIndex:0,className:t,onKeyDown:this.handleInput,ref:o=>o&&o.focus(),"data-lm-suppress-shortcuts":"true"},n.createElement("p",{className:this.state.selected&&this._isReplacingExistingKeybinding?"jp-Shortcuts-InputText jp-mod-selected-InputText":this.state.value===""?"jp-Shortcuts-InputText jp-mod-waiting-InputText":"jp-Shortcuts-InputText"},this.state.value===""?e.__("press keys"):this.state.value)),n.createElement("button",{className:this.state.isFunctional?this.state.isAvailable?"jp-Shortcuts-Submit":"jp-Shortcuts-Submit jp-mod-conflict-Submit":"jp-Shortcuts-Submit jp-mod-defunc-Submit",disabled:!this.state.isAvailable||!this.state.isFunctional,onClick:this.handleSubmit,tabIndex:0},this.state.isAvailable?n.createElement(F.react,null):n.createElement(H.react,null)))}}var C;(function(l){l.editBinding="shortcuts:edit-keybinding",l.addBinding="shortcuts:add-keybinding",l.deleteBinding="shortcuts:delete-keybinding",l.toggleSelectors="shortcuts:toggle-selectors",l.resetAll="shortcuts:reset-all"})(C||(C={}));var E;(function(l){l[l.Label=0]="Label",l[l.Category=1]="Category",l[l.Split=2]="Split",l[l.Default=3]="Default"})(E||(E={}));class j extends Map{constructor(e){var t,o,s,r;super();const{settings:i,commandRegistry:a,allCommands:c}=e;if(c)for(const g of a.listCommands()){const p={command:g,selector:"body"},f=this._computeTargetId(p),d=p.command.split(":"),m=(t=a.label(p.command,p.args))!==null&&t!==void 0?t:d.length>1?d[1]:void 0,u=d[0],y={...p,id:f,keybindings:[],category:u,label:m,args:{}};this.set(f,y)}else if(i){const g=(o=i.user.shortcuts)!==null&&o!==void 0?o:[],p=new Set(g.map(this._computeKeybindingId.bind(this))),f=(s=i.composite.shortcuts)!==null&&s!==void 0?s:[],d=i.default("shortcuts").map(m=>this._computeTargetId(m));for(const m of f){const u=this._computeTargetId(m),y=this._computeKeybindingId(m),h={keys:w.normalizeKeys(m),isDefault:!p.has(y),...m.preventDefault===void 0?{}:{preventDefault:m.preventDefault}},S=this.get(u);if(S)S.keybindings.push(h);else{const _=m.command.split(":"),K=(r=a.label(m.command,m.args))!==null&&r!==void 0?r:_.length>1?_[1]:void 0,B=_[0];this.set(u,{id:u,selector:m.selector,command:m.command,category:B,label:K,args:m.args,keybindings:[h],userDefined:!d.includes(u)})}}}}findConflictsFor(e,t){const o=new lt({registry:this}),s=e.map(w.normalizeKeystroke);let r=o.findConflicts(s,t);if(r.length!==0)return r;for(const i of s)if(r=o.findConflicts([i],t),r.length!==0)return r;return[]}_computeTargetId(e){var t;return e.command+"_"+e.selector+"_"+JSON.stringify((t=e.args)!==null&&t!==void 0?t:{})}_computeKeybindingId(e){var t;return[e.command,e.selector,JSON.stringify((t=e.args)!==null&&t!==void 0?t:{}),w.normalizeKeys(e).join(" ")].join("_")}}class lt{constructor(e){var t;const o=new Map;for(const s of e.registry.values())for(const r of s.keybindings){const i=this._keybindingHash(r.keys,s.selector),a=(t=o.get(i))!==null&&t!==void 0?t:[];a.push(s),o.set(i,a)}this._keybindingsMap=o}findConflicts(e,t){var o;const s=this._keybindingHash(e,t);return(o=this._keybindingsMap.get(s))!==null&&o!==void 0?o:[]}_keybindingHash(e,t){return e.join(" ")+"_"+t}}(function(l){function e(s){return s.replace(/\s+/g,"").toLowerCase()}function t(s,r){var i;const a=s.category.toLowerCase(),c=((i=s.label)!==null&&i!==void 0?i:"").toLowerCase(),g=`${a} ${c}`;let p=1/0,f=null;const d=/\b\w/g;for(;;){const S=d.exec(g);if(!S)break;const _=U.matchSumOfDeltas(g,r,S.index);if(!_)break;_&&_.score<=p&&(p=_.score,f=_.indices)}if(!f||p===1/0)return null;const m=a.length+1,u=W.lowerBound(f,m,(S,_)=>S-_),y=f.slice(0,u),h=f.slice(u);for(let S=0,_=h.length;S<_;++S)h[S]-=m;return y.length===0?{matchType:E.Label,categoryIndices:null,labelIndices:h,score:p,item:s}:h.length===0?{matchType:E.Category,categoryIndices:y,labelIndices:null,score:p,item:s}:{matchType:E.Split,categoryIndices:y,labelIndices:h,score:p,item:s}}function o(s,r){r=e(r);let i=[];for(const a of s.values()){if(!r){i.push({matchType:E.Default,categoryIndices:null,labelIndices:null,score:0,item:a});continue}let c=t(a,r);c&&i.push(c)}return i}l.matchItems=o})(j||(j={}));const ct={Ctrl:"⌃",Alt:"⌥",Shift:"⇧",Accel:"⌘",Cmd:"⌘"};class L extends n.Component{constructor(e){super(e),this.toggleInputNew=()=>{this.setState({displayNewInput:!this.state.displayNewInput,conflicts:new Map})},this.toSymbols=t=>k.IS_MAC?t.split(" ").map(o=>{var s;return(s=ct[o])!==null&&s!==void 0?s:o}).join(" "):t.split(" ").map(o=>o==="Accel"?"Ctrl":o).join(" "),this._trans=this.props.external.translator.load("jupyterlab"),this.state={displayNewInput:!1,displayReplaceInput:Object.freeze({}),conflicts:new Map}}componentDidMount(){this.props.external.actionRequested.connect(this._onActionRequested,this)}componentWillUnmount(){this.props.external.actionRequested.disconnect(this._onActionRequested,this)}async _onActionRequested(e,t){if(!("shortcutId"in t&&t.shortcutId!==this.props.shortcut.id)){if(t.request==="add-keybinding")return this.toggleInputNew();if(t.request==="edit-keybinding"&&this.toggleInputReplaceMethod(t.keybinding),t.request==="delete-keybinding"){const o=this.props.shortcut,s=o.keybindings[t.keybinding];this.props.deleteKeybinding(o,s).catch(console.error)}}}getCategoryCell(){return n.createElement("div",{className:"jp-Shortcuts-Cell"},this.props.shortcut.category)}getLabelCell(){var e;if(this.props.newShortcutUtils){const t=this._getFilteredCommands();return n.createElement("div",{className:"jp-Shortcuts-Cell"},n.createElement(tt,{value:this.props.shortcut.command,options:[{value:"",label:this._trans.__("Select a command")},...t.map(o=>({value:o.command,label:`${o.category}: ${o.label}`}))],onChange:o=>{var s,r,i;const a=t.find(c=>c.command===o.target.value);(s=this.props.newShortcutUtils)===null||s===void 0||s.updateCommand((r=a?.command)!==null&&r!==void 0?r:"",(i=a?.category)!==null&&i!==void 0?i:"")}}))}else return n.createElement("div",{className:"jp-Shortcuts-Cell"},n.createElement("div",{className:"jp-label"},(e=this.props.shortcut.label)!==null&&e!==void 0?e:this._trans.__("(Command label missing)")))}getResetShortCutLink(){return n.createElement("a",{className:"jp-Shortcuts-Reset",onClick:()=>this.props.resetKeybindings(this.props.shortcut)},this.props.shortcut.userDefined?this._trans.__("Delete"):this._trans.__("Reset"))}getSourceCell(){var e;const t=this.props.shortcut.keybindings.every(r=>r.isDefault),o=this.props.shortcut.userDefined||!!this.props.newShortcutUtils,s=o?this._trans.__("Custom options"):this._trans.__("Show options");return n.createElement("div",{className:"jp-Shortcuts-Cell"},!this.props.newShortcutUtils&&n.createElement("div",{className:"jp-Shortcuts-SourceCell"},t?this._trans.__("Default"):this._trans.__("Custom")),t?"":this.getResetShortCutLink(),this.props.external.editorFactory&&n.createElement(x,{className:"jp-mod-styled jp-mod-reject jp-Shortcuts-CustomOptions",onClick:async()=>{if(!this.props.external.editorFactory){console.error("Cannot build the custom options form");return}const i=await new rt({shortcut:this.props.shortcut,translator:this.props.external.translator,editorFactory:this.props.external.editorFactory,readOnly:!o}).launch();i.button.accept&&o&&i.value&&await this.props.setCustomOptions(this.props.shortcut,i.value)},title:s,"aria-label":s,appearance:"neutral"},o?n.createElement(J.react,{tag:null}):n.createElement(z.react,{tag:null})),!!this.props.newShortcutUtils&&n.createElement(n.Fragment,null,n.createElement(x,{className:"jp-mod-styled jp-mod-accept jp-Shortcuts-SaveNew",onClick:(e=this.props.newShortcutUtils)===null||e===void 0?void 0:e.saveShortcut,title:this._trans.__("Save shortcut"),"aria-label":this._trans.__("Save shortcut"),appearance:"neutral",disabled:!this.props.shortcut.command||!this.props.shortcut.keybindings.length||this.props.shortcut.keybindings.every(r=>!r.keys||r.keys.length===0)},n.createElement(F.react,{tag:null}))))}getOptionalSelectorCell(){return this.props.showSelectors?n.createElement("div",{className:"jp-Shortcuts-Cell"},n.createElement("div",{className:"jp-selector"},this.props.shortcut.selector)):null}getClassNameForShortCuts(e){const t=["jp-Shortcuts-ShortcutCell"];switch(e.length){case 1:t.push("jp-Shortcuts-SingleCell");break;case 0:t.push("jp-Shortcuts-EmptyCell");break}return t.join(" ")}toggleInputReplaceMethod(e){const t=this.state.displayReplaceInput[e];this.setState({displayReplaceInput:{...this.state.displayReplaceInput,[e]:!t},conflicts:new Map})}getDisplayReplaceInput(e){return this.state.displayReplaceInput[e]}getOrDisplayIfNeeded(e){const t=["jp-Shortcuts-Or"];return(e||this.state.displayNewInput)&&t.push("jp-Shortcuts-Or-Forced"),n.createElement("div",{className:t.join(" ")},this._trans.__("or"))}getShortCutAsInput(e,t){return n.createElement(A,{addKeybinding:this.props.addKeybinding,replaceKeybinding:this.props.replaceKeybinding,deleteKeybinding:this.props.deleteKeybinding,findConflictsFor:this.props.findConflictsFor,toggleInput:()=>this.toggleInputReplaceMethod(t),shortcut:this.props.shortcut,keybinding:e,displayConflicts:o=>{const s=new Map(this.state.conflicts);s.set(e,o),this.setState({conflicts:s})},toSymbols:this.toSymbols,displayInput:this.getDisplayReplaceInput(t),placeholder:this.toSymbols(e.keys.join(", ")),translator:this.props.external.translator})}getShortCutForDisplayOnly(e){return e.keys.map((t,o)=>n.createElement("div",{className:"jp-Shortcuts-ShortcutKeysContainer",key:o},n.createElement("div",{className:"jp-Shortcuts-ShortcutKeys"},this.toSymbols(t).split(" ").map((s,r,i)=>n.createElement(n.Fragment,{key:`${o}-${s}-${r}`},n.createElement("span",{className:"jp-ContextualShortcut-Key"},s),r+1<i.length?" + ":null))),o+1<e.keys.length?n.createElement("div",{className:"jp-Shortcuts-Comma"},","):null))}isLocationBeingEdited(e){return this.state.displayReplaceInput[e]}getDivForKey(e,t,o){return n.createElement("div",{className:"jp-Shortcuts-ShortcutContainer",key:this.props.shortcut.id+"_"+e,"data-keybinding":e,"data-shortcut":this.props.shortcut.id,onClick:()=>this.toggleInputReplaceMethod(e)},this.isLocationBeingEdited(e)?this.getShortCutAsInput(t,e):this.getShortCutForDisplayOnly(t),!(e===this._nonEmptyBindings.length-1&&Object.values(this.state.displayReplaceInput).some(Boolean))&&this.getOrDisplayIfNeeded(e<this._nonEmptyBindings.length-1))}getAddLink(){return n.createElement("a",{className:this.state.displayNewInput?"":"jp-Shortcuts-Plus",onClick:()=>{this.toggleInputNew()}},this._trans.__("Add"))}getInputBoxWhenToggled(){return this.state.displayNewInput?n.createElement(A,{addKeybinding:this.props.addKeybinding,replaceKeybinding:this.props.replaceKeybinding,deleteKeybinding:this.props.deleteKeybinding,findConflictsFor:this.props.findConflictsFor,toggleInput:this.toggleInputNew,shortcut:this.props.shortcut,displayConflicts:e=>{const t=new Map(this.state.conflicts);t.set(null,e),this.setState({conflicts:t})},toSymbols:this.toSymbols,displayInput:this.state.displayNewInput,placeholder:"",translator:this.props.external.translator}):n.createElement("div",null)}getShortCutsCell(e){return n.createElement("div",{className:"jp-Shortcuts-Cell"},n.createElement("div",{className:this.getClassNameForShortCuts(e)},e.map((t,o)=>this.getDivForKey(o,t,e)),e.length>=1&&!this.state.displayNewInput&&!Object.values(this.state.displayReplaceInput).some(Boolean)&&this.getAddLink(),e.length===0&&!this.state.displayNewInput&&this.getAddLink(),this.getInputBoxWhenToggled()))}getConflicts(){const e=[...this.state.conflicts.values()].filter(t=>t.conflictsWith.length!==0);return e.length===0?n.createElement(n.Fragment,null):n.createElement("div",{className:"jp-Shortcuts-Row jp-Shortcuts-RowWithConflict"},n.createElement("div",{className:D},e.map(t=>{const o=t.keys.join(" ")+"_"+t.conflictsWith.map(s=>s.id).join("");return n.createElement("div",{className:"jp-Shortcuts-Conflict",key:o},n.createElement("div",{className:"jp-Shortcuts-ErrorMessage"},this._trans.__("Shortcut already in use by %1. Overwrite it?",t.conflictsWith.map(s=>{var r;return(r=s.label)!==null&&r!==void 0?r:s.command}).join(", "))),n.createElement("div",{className:"jp-Shortcuts-ErrorButton"},n.createElement("button",{className:"jp-Button jp-mod-reject jp-mod-styled",onClick:()=>{this._clearConflict(t),t.cancel()}},this._trans.__("Cancel")),n.createElement("button",{className:"jp-Button jp-mod-warn jp-mod-styled",onClick:()=>{this._clearConflict(t),t.overwrite()}},this._trans.__("Overwrite"))))})))}_clearConflict(e){const t=new Map,o=this._conflictId(e);for(const[s,r]of this.state.conflicts.entries())this._conflictId(r)!==o&&t.set(s,r);this.setState({conflicts:t})}_conflictId(e){return e.keys.join(" ")+"_"+e.conflictsWith.map(t=>t.id).join("")}_getFilteredCommands(){var e,t;const o=new j({commandRegistry:this.props.external.commandRegistry,allCommands:!0}),s=j.matchItems(o,(t=(e=this.props.newShortcutUtils)===null||e===void 0?void 0:e.searchQuery)!==null&&t!==void 0?t:"").map(r=>r.item).filter(r=>!r.command.startsWith("__internal:"));return s.sort((r,i)=>{var a,c;const g=r.category,p=i.category,f=g.localeCompare(p);if(f)return f;{const d=(a=r.label)!==null&&a!==void 0?a:"",m=(c=i.label)!==null&&c!==void 0?c:"";return d.localeCompare(m)}}),s}get _nonEmptyBindings(){return this.props.shortcut.keybindings.filter(e=>e.keys.filter(t=>t!="").length!==0)}render(){return n.createElement(n.Fragment,null,n.createElement("div",{className:`jp-Shortcuts-Row${this.props.newShortcutUtils?" jp-Shortcuts-Row-newShortcut":""}`,"data-shortcut":this.props.shortcut.id},this.getCategoryCell(),this.getLabelCell(),this.getShortCutsCell(this._nonEmptyBindings),this.getSourceCell(),this.getOptionalSelectorCell()),this.getConflicts())}}const dt=115;class ht extends n.Component{render(){return n.createElement("div",{className:"jp-Shortcuts-ShortcutListContainer",style:{height:`${this.props.height-dt}px`},id:"shortcutListContainer"},n.createElement("div",{className:"jp-Shortcuts-ShortcutList"},this.props.shortcuts.map(e=>n.createElement(L,{key:e.id,addKeybinding:this.props.addKeybinding,replaceKeybinding:this.props.replaceKeybinding,deleteKeybinding:this.props.deleteKeybinding,resetKeybindings:this.props.resetKeybindings,findConflictsFor:this.props.findConflictsFor,setCustomOptions:this.props.setCustomOptions,shortcut:e,showSelectors:this.props.showSelectors,external:this.props.external}))))}}class ut extends n.Component{render(){return n.createElement("div",{className:this.props.title.toLowerCase()===this.props.active?"jp-Shortcuts-Header jp-Shortcuts-CurrentHeader":"jp-Shortcuts-Header",onClick:()=>this.props.updateSort(this.props.columnId)},this.props.title,n.createElement($.react,{className:"jp-Shortcuts-SortButton jp-ShortcutTitleItem-sortButton"}))}}function pt(l){const e=l.translator.load("jupyterlab");return n.createElement("div",{className:"jp-Shortcuts-AdvancedOptions"},n.createElement("a",{className:"jp-Shortcuts-AdvancedOptionsLink",onClick:()=>l.toggleSelectors()},l.showSelectors?e.__("Hide Selectors"):e.__("Show Selectors")),n.createElement("a",{className:"jp-Shortcuts-AdvancedOptionsLink",onClick:()=>l.resetShortcuts()},e.__("Reset All")),n.createElement(x,{className:"jp-mod-styled jp-mod-accept jp-Shortcuts-AdvancedOptionsButton",onClick:l.toggleAddCommandRow,title:e.__("Tool for adding shortcuts"),"aria-label":e.__("Tool for adding shortcuts")},n.createElement(Q.react,{tag:"span",elementSize:"xlarge",elementPosition:"center"})))}class mt extends n.Component{constructor(e){super(e)}getShortCutTitleItem(e,t){return n.createElement("div",{className:"jp-Shortcuts-Cell"},n.createElement(ut,{title:e,updateSort:this.props.updateSort,active:this.props.currentSort,columnId:t}))}render(){const e=this.props.translator.load("jupyterlab");return n.createElement("div",{className:"jp-Shortcuts-Top"},n.createElement("div",{className:"jp-Shortcuts-TopNav"},n.createElement(et,{"aria-label":e.__("Search shortcuts"),updateFilter:(t,o)=>this.props.updateSearchQuery(o??""),placeholder:e.__("Search…"),useFuzzyFilter:!1}),n.createElement(pt,{toggleSelectors:this.props.toggleSelectors,showSelectors:this.props.showSelectors,resetShortcuts:this.props.resetShortcuts,toggleAddCommandRow:this.props.toggleAddCommandRow,translator:this.props.translator})),n.createElement("div",{className:"jp-Shortcuts-HeaderRowContainer"},n.createElement("div",{className:"jp-Shortcuts-HeaderRow"},this.getShortCutTitleItem(e.__("Category"),"category"),this.getShortCutTitleItem(e.__("Command"),"command"),n.createElement("div",{className:"jp-Shortcuts-Cell"},n.createElement("div",{className:"title-div"},e.__("Shortcut"))),this.getShortCutTitleItem(e.__("Source"),"source"),this.props.showSelectors&&this.getShortCutTitleItem(e.__("Selectors"),"selector"))))}}class gt extends n.Component{constructor(e){super(e),this.updateSearchQuery=t=>{this.setState({searchQuery:t},()=>{const o=this.state.shortcutRegistry;this.setState({filteredShortcutList:this._searchFilterShortcuts(o)},()=>{this.sortShortcuts()})})},this.resetShortcuts=async()=>{await(await this.props.external.getSettings()).set("shortcuts",[]),await this._refreshShortcutList()},this.resetKeybindings=async t=>{await this._setKeybinding(t,[])},this.replaceKeybinding=async(t,o,s)=>this._setKeybinding(t,s,o),this.deleteKeybinding=async(t,o)=>{await this._setKeybinding(t,[],o)},this.addKeybinding=async(t,o)=>{await this._setKeybinding(t,o)},this.setCustomOptions=async(t,o)=>{var s;const r=await this.props.external.getSettings(),i=(s=r.user.shortcuts)!==null&&s!==void 0?s:[],a=i.filter(c=>{var g,p;return c.command===t.command&&c.selector===t.selector&&b.deepEqual((g=c.args)!==null&&g!==void 0?g:{},(p=t.args)!==null&&p!==void 0?p:{})});return a.length?(a.forEach(c=>{c.selector=o.selector,c.args=o.args}),await r.set("shortcuts",i),await this._refreshShortcutList(),!0):(console.error("Error writing the custom options: target not found"),!1)},this.toggleSelectors=()=>{this.setState({showSelectors:!this.state.showSelectors})},this.toggleAddCommandRow=async()=>{this.setState({showAddCommand:!this.state.showAddCommand})},this.updateSort=t=>{t!==this.state.currentSort&&this.setState({currentSort:t},this.sortShortcuts)},this.saveNewShortcut=async()=>{const t={...this.state.newShortcut,args:void 0};for(let s of t.keybindings)await this.addKeybinding(t,s.keys);await this.setCustomOptions(t,{selector:t.selector,args:this.state.newShortcut.args})&&(this._newShortcutItem.reset(),this.toggleAddCommandRow())},this._newShortcutItem=new it({showSelectors:!1,findConflictsFor:(t,o)=>this.state.shortcutRegistry?this.state.shortcutRegistry.findConflictsFor(t,o):(console.error("Cannot search for keybinding conflicts at this time: registry is not ready"),[]),external:this.props.external}),this.state={shortcutRegistry:null,filteredShortcutList:new Array,shortcutsFetched:!1,searchQuery:"",showSelectors:!1,currentSort:"category",showAddCommand:!1,newShortcut:this._newShortcutItem.shortcut},this._newShortcutItem.changed.connect(()=>{this.setState({newShortcut:{...this._newShortcutItem.shortcut}})})}componentDidMount(){this.props.external.actionRequested.connect(this._onActionRequested,this),this._refreshShortcutList()}componentWillUnmount(){this.props.external.actionRequested.disconnect(this._onActionRequested,this)}async _onActionRequested(e,t){if(t.request==="toggle-selectors")return this.toggleSelectors();t.request==="reset-all"&&await this.resetShortcuts()}async _refreshShortcutList(){const e=await this.props.external.getSettings(),t=new j({commandRegistry:this.props.external.commandRegistry,settings:e});this.setState({shortcutRegistry:t,filteredShortcutList:this._searchFilterShortcuts(t),shortcutsFetched:!0},()=>{this.sortShortcuts()})}_searchFilterShortcuts(e){return e?j.matchItems(e,this.state.searchQuery).map(o=>o.item):[]}async _setKeybinding(e,t,o){var s,r,i,a,c;t.length===1&&t[0]==""&&(t=[]);const g=t.map(w.normalizeKeystroke),p=await this.props.external.getSettings(),f=(s=p.user.shortcuts)!==null&&s!==void 0?s:[],d=[];let m=!1;for(let u of f)if(u.command===e.command&&u.selector===e.selector&&b.deepEqual((r=u.args)!==null&&r!==void 0?r:{},(i=e.args)!==null&&i!==void 0?i:{})&&o&&b.deepEqual(o.keys,w.normalizeKeys(u))){const y=o.isDefault&&b.deepEqual(o.keys,g);t.length!==0&&!y&&d.push(this._setShortcutKeys(u,t)),m=!0}else{if(u.command===e.command&&u.selector===e.selector&&b.deepEqual((a=u.args)!==null&&a!==void 0?a:{},(c=e.args)!==null&&c!==void 0?c:{})&&!o&&t.length===0)continue;d.push(u)}if(!m){const u=!o||!b.deepEqual(o.keys,g);o&&o.isDefault&&u&&d.push(this._shortcutFromTarget(e,o.keys,{disabled:!0,preventDefault:o.preventDefault})),t.length!==0&&u&&d.push(this._shortcutFromTarget(e,t,{preventDefault:o?.preventDefault}))}await p.set("shortcuts",d),await this._refreshShortcutList()}_setShortcutKeys(e,t){const o=this._platformKeys(e);return{...e,[o]:t}}_shortcutFromTarget(e,t,o={}){const s={command:e.command,selector:e.selector,keys:t};return e.args&&!b.deepEqual(e.args,{})&&(s.args=e.args),o.disabled&&(s.disabled=!0),o.preventDefault!==void 0&&(s.preventDefault=o.preventDefault),s}_platformKeys(e){return k.IS_WIN&&e.winKeys?"winKeys":k.IS_MAC&&e.macKeys?"macKeys":!k.IS_WIN&&!k.IS_MAC&&e.linuxKeys?"linuxKeys":"keys"}sortShortcuts(){const e=this.state.filteredShortcutList;let t=this.state.currentSort;t==="command"&&(t="label");const o=s=>{var r;return t==="source"?s.keybindings.every(i=>i.isDefault)?"default":"other":(r=s[t])!==null&&r!==void 0?r:""};e.sort((s,r)=>{var i,a;const c=o(s),g=o(r),p=c.localeCompare(g);if(p)return p;{const f=(i=s.label)!==null&&i!==void 0?i:"",d=(a=r.label)!==null&&a!==void 0?a:"";return f.localeCompare(d)}}),this.setState({filteredShortcutList:e})}render(){return this.state.shortcutsFetched?n.createElement("div",{className:"jp-Shortcuts-ShortcutUI",id:"jp-shortcutui"},n.createElement(mt,{updateSearchQuery:this.updateSearchQuery,resetShortcuts:this.resetShortcuts,toggleSelectors:this.toggleSelectors,showSelectors:this.state.showSelectors,updateSort:this.updateSort,currentSort:this.state.currentSort,toggleAddCommandRow:this.toggleAddCommandRow,width:this.props.width,translator:this.props.external.translator}),this.state.showAddCommand&&n.createElement(L,{...this._newShortcutItem,shortcut:this.state.newShortcut,newShortcutUtils:{searchQuery:this.state.searchQuery,updateCommand:this._newShortcutItem.updateCommand,saveShortcut:this.saveNewShortcut}}),n.createElement(ht,{shortcuts:this.state.filteredShortcutList,resetKeybindings:this.resetKeybindings,addKeybinding:this.addKeybinding,replaceKeybinding:this.replaceKeybinding,deleteKeybinding:this.deleteKeybinding,setCustomOptions:this.setCustomOptions,showSelectors:this.state.showSelectors,findConflictsFor:(e,t)=>this.state.shortcutRegistry?this.state.shortcutRegistry.findConflictsFor(e,t):(console.error("Cannot search for keybinding conflicts at this time: registry is not ready"),[]),height:this.props.height,external:this.props.external})):null}}const yt=l=>P.createElement(gt,{external:l.external,height:1e3,width:1e3}),T="@jupyterlab/shortcuts-extension:shortcuts";function ft(l,e,t,o,s){return{translator:t,getSettings:()=>l.load(T,!0),commandRegistry:e.commands,actionRequested:o,editorFactory:s}}const v={id:T,description:"Adds the keyboard shortcuts editor.",requires:[ot],optional:[V,st,G],activate:async(l,e,t,o,s)=>{const r=t??Y,i=r.load("jupyterlab"),{commands:a}=l;let c,g,p={};if(o){const d=new R({}),m=h=>h.dataset.shortcut!==void 0;l.commands.addCommand(C.editBinding,{label:i.__("Edit Keybinding"),caption:i.__("Edit existing keybinding"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const h=l.contextMenuHitTest(m),S=h?.dataset.keybinding,_=h?.dataset.shortcut;if(!_||!S)return console.log("Missing shortcut id/keybinding information");d.emit({request:"edit-keybinding",keybinding:parseInt(S,10),shortcutId:_})}}),l.commands.addCommand(C.deleteBinding,{label:i.__("Delete Keybinding"),caption:i.__("Delete chosen keybinding"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const h=l.contextMenuHitTest(m),S=h?.dataset.keybinding,_=h?.dataset.shortcut;if(!_||!S)return console.log("Missing shortcut id/keybinding information");d.emit({request:"delete-keybinding",keybinding:parseInt(S,10),shortcutId:_})}}),l.commands.addCommand(C.addBinding,{label:i.__("Add Keybinding"),caption:i.__("Add new keybinding for existing shortcut target"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{const h=l.contextMenuHitTest(m),S=h?.dataset.shortcut;if(!S)return console.log("Missing shortcut id to add keybinding to");d.emit({request:"add-keybinding",shortcutId:S})}}),a.addCommand(C.toggleSelectors,{label:i.__("Toggle Selectors"),caption:i.__("Toggle command selectors"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{d.emit({request:"toggle-selectors"})}}),a.addCommand(C.resetAll,{label:i.__("Reset All"),caption:i.__("Reset all shortcuts"),describedBy:{args:{type:"object",properties:{}}},execute:()=>{d.emit({request:"reset-all"})}});const u=s?h=>s.factoryService.newInlineEditor(h):void 0,y={fieldRenderer:h=>yt({external:ft(e,l,r,d,u),...h})};o.addRenderer(`${v.id}.shortcuts`,y)}function f(d){const m=l.commands.listCommands().join(`
|
|
2
2
|
`);g||(g=b.deepCopy(d.properties.shortcuts.default)),p={},d.properties.shortcuts.default=Object.keys(e.plugins).map(u=>{const y=e.plugins[u].schema["jupyter.lab.shortcuts"]||[];return p[u]=y,y}).concat([g]).reduce((u,y)=>k.IS_MAC?u.concat(y):u.concat(y.filter(h=>!h.keys.some(S=>{const{cmd:_}=w.parseKeystroke(S);return _}))),[]).sort((u,y)=>u.command.localeCompare(y.command)),d.properties.shortcuts.description=i.__(`Note: To disable a system default shortcut,
|
|
3
3
|
copy it to User Preferences and add the
|
|
4
4
|
"disabled" key, for example:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aD as Q,cr as Z,fN as te,az as S,aC as D,cd as J,cm as ne,ax as re,bg as ie,aE as L,aF as T,k as P,aA as se,dU as oe,dR as ae,fO as de,fP as le,cg as K,dA as E}from"../datalayer-app-main.js";import{c as ce}from"./tokens-DbNnxPrX.js";import{a as ue}from"./tokens-Nkg3e_k9.js";import{I as ee}from"./tokens-B7nNzQEE.js";import{h as _,b as pe,M as z}from"./index-CcDn6aA5.js";import{M as v,c as me,e as he}from"./index-mXYl0SDo.js";import{I as be}from"./tokens-DY_UrMLq.js";import{R as j,I as _e}from"./menu-Ntu8pEH0.js";import"./hoverbox-CStlKQWE.js";import"./Output-DtWAAuKd.js";import"./index-Xpn7qE4M.js";import"./index-CW9jwmnF.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-CO9-1hO8.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-vXN5wge0.js";import"./NotebookSkeleton-BaU6vrsb.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-CKt61TR-.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-CQzZPse_.js";import"./KernelVariables-lzdkfkh4.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-CO_qaXBp.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-ByUGXe7J.js";import"./sessions-CmElNrqo.js";import"./tokens-CTXFWLvM.js";import"./drivecontents-BsC6Y2Vl.js";import"./kernel-BmfZmtIo.js";function f(t){const{id:e,commands:n,shell:r,semanticCommands:i,default:c,overrides:u,trans:o}=t;n.addCommand(e,{...fe({commands:n,shell:r},i,c??{},o??Q.load("jupyterlab")),...u});const a=Array.isArray(i)?i:[i],l=(s,d)=>{if(d.id){if(d.id===e&&d.type==="removed")s.commandChanged.disconnect(l);else if(a.reduce((h,B)=>h.concat(B.ids),[]).includes(d.id))switch(d.type){case"changed":case"many-changed":s.notifyCommandChanged(e);break;case"removed":for(const h of a)h.remove(d.id);break}}};n.commandChanged.connect(l)}function fe(t,e,n,r){const{commands:i,shell:c}=t,u=Array.isArray(e)?e:[e];return{label:a("label"),caption:a("caption"),isEnabled:()=>{var l;const s=o("isEnabled");return s.length>0?!s.some(d=>d===!1):(l=n.isEnabled)!==null&&l!==void 0?l:!1},isToggled:()=>{var l;const s=o("isToggled");return s.length>0?s.some(d=>d===!0):(l=n.isToggled)!==null&&l!==void 0?l:!1},isVisible:()=>{var l;const s=o("isVisible");return s.length>0?!s.some(d=>d===!1):(l=n.isVisible)!==null&&l!==void 0?l:!0},execute:async()=>{const l=c.currentWidget,d=u.map(h=>l!==null?h.getActiveCommandId(l):null).filter(h=>h!==null&&i.isEnabled(h));let b=null;if(d.length>0)for(const h of d){const B={[_.WIDGET]:l.id};if(b=await i.execute(h,B),typeof b=="boolean"&&b===!1)break}else n.execute&&(b=await i.execute(n.execute));return b}};function o(l){const s=c.currentWidget;return u.map(h=>s!==null?h.getActiveCommandId(s):null).filter(h=>h!==null).map(h=>i[l](h))}function a(l){return()=>{var s;const d=o(l).map((b,h)=>l=="caption"&&h>0?b.toLocaleLowerCase():b);switch(d.length){case 0:return(s=n[l])!==null&&s!==void 0?s:"";case 1:return d[0];default:{const b=d.some(m=>/…$/.test(m)),h=d.slice(void 0,-1).map(m=>m.replace(/…$/,"")).join(", "),B=d.slice(-1)[0].replace(/…$/,"")+(b?"…":"");return r.__("%1 and %2",h,B)}}}}}class U extends j{constructor(e){super(e),this.undoers={redo:new _,undo:new _},this.clearers={clearAll:new _,clearCurrent:new _},this.goToLiners=new _}}class V extends j{constructor(e){super(e),this.quitEntry=!1,this.closeAndCleaners=new _,this.consoleCreators=new _}get newMenu(){var e,n;return this._newMenu||(this._newMenu=(n=(e=Z(this.items,r=>{var i;return((i=r.submenu)===null||i===void 0?void 0:i.id)==="jp-mainmenu-file-new"}))===null||e===void 0?void 0:e.submenu)!==null&&n!==void 0?n:new j({commands:this.commands})),this._newMenu}dispose(){var e;(e=this._newMenu)===null||e===void 0||e.dispose(),super.dispose()}}class W extends j{constructor(e){super(e),this.getKernel=new _}}class F extends j{constructor(e){super(e),this.kernelUsers={changeKernel:new _,clearWidget:new _,interruptKernel:new _,reconnectToKernel:new _,restartKernel:new _,shutdownKernel:new _}}}class q extends j{constructor(e){super(e),this.codeRunners={restart:new _,run:new _,runAll:new _}}}class N extends j{constructor(e){super(e)}}class $ extends j{constructor(e){super(e)}}class G extends j{constructor(e){super(e),this.editorViewers={toggleLineNumbers:new _,toggleMinimap:new _,toggleMatchBrackets:new _,toggleWordWrap:new _}}}class X extends te{constructor(e){let n={forceItemsPosition:{forceX:!1,forceY:!0}};super(n),this._items=[],this._commands=e}get editMenu(){return this._editMenu||(this._editMenu=new U({commands:this._commands,rank:2,renderer:v.defaultRenderer})),this._editMenu}get fileMenu(){return this._fileMenu||(this._fileMenu=new V({commands:this._commands,rank:1,renderer:v.defaultRenderer})),this._fileMenu}get helpMenu(){return this._helpMenu||(this._helpMenu=new W({commands:this._commands,rank:1e3,renderer:v.defaultRenderer})),this._helpMenu}get kernelMenu(){return this._kernelMenu||(this._kernelMenu=new F({commands:this._commands,rank:5,renderer:v.defaultRenderer})),this._kernelMenu}get runMenu(){return this._runMenu||(this._runMenu=new q({commands:this._commands,rank:4,renderer:v.defaultRenderer})),this._runMenu}get settingsMenu(){return this._settingsMenu||(this._settingsMenu=new N({commands:this._commands,rank:999,renderer:v.defaultRenderer})),this._settingsMenu}get viewMenu(){return this._viewMenu||(this._viewMenu=new G({commands:this._commands,rank:3,renderer:v.defaultRenderer})),this._viewMenu}get tabsMenu(){return this._tabsMenu||(this._tabsMenu=new $({commands:this._commands,rank:500,renderer:v.defaultRenderer})),this._tabsMenu}addMenu(e,n=!0,r={}){if(S.firstIndexOf(this.menus,e)>-1)return;v.overrideDefaultRenderer(e);const i="rank"in r?r.rank:"rank"in e?e.rank:_e.DEFAULT_RANK,c={menu:e,rank:i},u=S.upperBound(this._items,c,H.itemCmp);switch(e.disposed.connect(this._onMenuDisposed,this),S.insert(this._items,u,c),this.insertMenu(u,e),e.id){case"jp-mainmenu-file":!this._fileMenu&&e instanceof V&&(this._fileMenu=e);break;case"jp-mainmenu-edit":!this._editMenu&&e instanceof U&&(this._editMenu=e);break;case"jp-mainmenu-view":!this._viewMenu&&e instanceof G&&(this._viewMenu=e);break;case"jp-mainmenu-run":!this._runMenu&&e instanceof q&&(this._runMenu=e);break;case"jp-mainmenu-kernel":!this._kernelMenu&&e instanceof F&&(this._kernelMenu=e);break;case"jp-mainmenu-tabs":!this._tabsMenu&&e instanceof $&&(this._tabsMenu=e);break;case"jp-mainmenu-settings":!this._settingsMenu&&e instanceof N&&(this._settingsMenu=e);break;case"jp-mainmenu-help":!this._helpMenu&&e instanceof W&&(this._helpMenu=e);break}}dispose(){var e,n,r,i,c,u,o,a;(e=this._editMenu)===null||e===void 0||e.dispose(),(n=this._fileMenu)===null||n===void 0||n.dispose(),(r=this._helpMenu)===null||r===void 0||r.dispose(),(i=this._kernelMenu)===null||i===void 0||i.dispose(),(c=this._runMenu)===null||c===void 0||c.dispose(),(u=this._settingsMenu)===null||u===void 0||u.dispose(),(o=this._viewMenu)===null||o===void 0||o.dispose(),(a=this._tabsMenu)===null||a===void 0||a.dispose(),super.dispose()}static generateMenu(e,n,r){let i;const{id:c,label:u,rank:o}=n;switch(c){case"jp-mainmenu-file":i=new V({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-edit":i=new U({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-view":i=new G({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-run":i=new q({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-kernel":i=new F({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-tabs":i=new $({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-settings":i=new N({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-help":i=new W({commands:e,rank:o,renderer:v.defaultRenderer});break;default:i=new j({commands:e,rank:o,renderer:v.defaultRenderer})}return u&&(i.title.label=r._p("menu",u)),i}_onMenuDisposed(e){this.removeMenu(e);const n=S.findFirstIndex(this._items,r=>r.menu===e);n!==-1&&S.removeAt(this._items,n)}}var H;(function(t){function e(n,r){return n.rank-r.rank}t.itemCmp=e})(H||(H={}));const ge="@jupyterlab/mainmenu-extension:recents";var C;(function(t){t.openRecent="recentmenu:open-recent",t.reopenLast="recentmenu:reopen-last",t.clearRecents="docmanager:clear-recents"})(C||(C={}));class ve extends re{constructor(e){super(e),this._manager=e.manager,this._showDirectories=e.showDirectories,this.updateItems(),this._manager.changed.connect(this.updateItems,this)}async _validateRecentlyOpened(){Promise.all(this._manager.recentlyOpened.map(e=>this._manager.validate(e)))}onBeforeAttach(e){const n=new ie;setTimeout(()=>{n.reject("Recents validation timed out.")},550),Promise.race([n.promise,this._validateRecentlyOpened()]).then(()=>{this.update()}).catch(()=>{}),super.onBeforeAttach(e)}updateItems(){this.clearItems(),this.addItem({command:C.reopenLast}),this.addItem({type:"separator"});let e=!0,n=!1;this._manager.recentlyOpened.sort((r,i)=>r.contentType===i.contentType?0:r.contentType!=="directory"?1:-1).forEach(r=>{if(r.contentType==="directory"){if(!this._showDirectories)return;n=!0}else e&&n&&(e=!1,this.addItem({type:"separator"}));this.addItem({command:C.openRecent,args:{recent:r}})}),this.addItem({type:"separator"}),this.addItem({command:C.clearRecents})}}const ye={id:ge,description:"Adds sub-menu for opening recent documents to the File section of the main menu.",autoStart:!0,requires:[ue,ee],optional:[ce,D],activate:(t,e,n,r,i)=>{const{commands:c}=t,u=(i??Q).load("jupyterlab"),o=r!==null,a=async s=>{const d=await e.validate(s);return d||await ne(u.__("Could Not Open Recent"),u.__("%1 is no longer valid and will be removed from the list",s.path)),d};c.addCommand(C.openRecent,{execute:async s=>{const d=s.recent,b=d.path===""?"/":d.path;await a(d)&&(r&&d.contentType==="directory"?await c.execute(r.openPath,{path:b}):await c.execute("docmanager:open",{path:b,factory:d.factory}))},label:s=>{const d=s.recent;return d?J.PathExt.joinWithLeadingSlash(d.root,d.path):u.__("Open a Recent Document (given by `recent` argument)")},isEnabled:s=>e.recentlyOpened.includes(s.recent),describedBy:{args:{type:"object",properties:{recent:{type:"object",description:u.__("Recent document to open")}}}}}),t.commands.addCommand(C.reopenLast,{execute:async()=>{const s=e.recentlyClosed[0];!s||!await a(s)||(await c.execute("docmanager:open",{path:s.path,factory:s.factory}),e.removeRecent(s,"closed"))},label:()=>{const s=e.recentlyClosed[0];return s?u.__("Reopen %1",s.path):u.__("Reopen Closed Document")},isEnabled:()=>e.recentlyClosed.length!==0,caption:u.__("Reopen recently closed file or notebook."),describedBy:{args:{type:"object",properties:{}}}});const l=new ve({commands:c,manager:e,showDirectories:o});l.title.label=u.__("Open Recent"),n.fileMenu.addItem({type:"submenu",submenu:l,rank:1})}},I="@jupyterlab/mainmenu-extension:plugin";var p;(function(t){t.openEdit="editmenu:open",t.undo="editmenu:undo",t.redo="editmenu:redo",t.clearCurrent="editmenu:clear-current",t.clearAll="editmenu:clear-all",t.find="editmenu:find",t.goToLine="editmenu:go-to-line",t.openFile="filemenu:open",t.closeAndCleanup="filemenu:close-and-cleanup",t.createConsole="filemenu:create-console",t.shutdown="filemenu:shutdown",t.logout="filemenu:logout",t.openKernel="kernelmenu:open",t.interruptKernel="kernelmenu:interrupt",t.reconnectToKernel="kernelmenu:reconnect-to-kernel",t.restartKernel="kernelmenu:restart",t.restartKernelAndClear="kernelmenu:restart-and-clear",t.changeKernel="kernelmenu:change",t.shutdownKernel="kernelmenu:shutdown",t.shutdownAllKernels="kernelmenu:shutdownAll",t.openView="viewmenu:open",t.wordWrap="viewmenu:word-wrap",t.lineNumbering="viewmenu:line-numbering",t.minimap="viewmenu:show-minimap",t.matchBrackets="viewmenu:match-brackets",t.openRun="runmenu:open",t.run="runmenu:run",t.runAll="runmenu:run-all",t.restartAndRunAll="runmenu:restart-and-run-all",t.runAbove="runmenu:run-above",t.runBelow="runmenu:run-below",t.openTabs="tabsmenu:open",t.activateById="tabsmenu:activate-by-id",t.activatePreviouslyUsedTab="tabsmenu:activate-previously-used-tab",t.openSettings="settingsmenu:open",t.openHelp="helpmenu:open",t.getKernel="helpmenu:get-kernel",t.openFirst="mainmenu:open-first"})(p||(p={}));const we={id:I,description:"Adds and provides the application main menu.",requires:[he,D],optional:[pe,me,be],provides:ee,activate:async(t,e,n,r,i,c)=>{const{commands:u}=t,o=n.load("jupyterlab"),a=new X(u);a.id="jp-MainMenu",a.addClass("jp-scrollbar-tiny"),c&&(await Y.loadSettingsMenu(c,d=>{a.addMenu(d,!1,{rank:d.rank})},d=>X.generateMenu(u,d,o),n),a.update());const l=J.PageConfig.getOption("quitButton").toLowerCase();a.fileMenu.quitEntry=l==="true",Me(t,a.editMenu,o),ke(t,a.fileMenu,e,o),Re(t,a.kernelMenu,o),Ae(t,a.runMenu,o),je(t,a.viewMenu,o),Ce(t,a.helpMenu,o),i&&Be(t,a.tabsMenu,i,o);const s=d=>{a.activeMenu=d,a.openActiveMenu()};return u.addCommand(p.openEdit,{label:o.__("Open Edit Menu"),execute:()=>s(a.editMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openFile,{label:o.__("Open File Menu"),execute:()=>s(a.fileMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openKernel,{label:o.__("Open Kernel Menu"),execute:()=>s(a.kernelMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openRun,{label:o.__("Open Run Menu"),execute:()=>s(a.runMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openView,{label:o.__("Open View Menu"),execute:()=>s(a.viewMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openSettings,{label:o.__("Open Settings Menu"),execute:()=>s(a.settingsMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openTabs,{label:o.__("Open Tabs Menu"),execute:()=>s(a.tabsMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openHelp,{label:o.__("Open Help Menu"),execute:()=>s(a.helpMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openFirst,{label:o.__("Open First Menu"),execute:()=>{a.activeIndex=0,a.openActiveMenu()},describedBy:{args:{type:"object",properties:{}}}}),r&&(r.addItem({command:p.shutdown,category:o.__("Main Area")}),r.addItem({command:p.logout,category:o.__("Main Area")}),r.addItem({command:p.shutdownAllKernels,category:o.__("Kernel Operations")}),r.addItem({command:p.activatePreviouslyUsedTab,category:o.__("Main Area")})),t.shell.add(a,"menu",{rank:100}),a}};function Me(t,e,n){const{commands:r,shell:i}=t;f({id:p.undo,commands:r,shell:i,semanticCommands:e.undoers.undo,default:{label:n.__("Undo")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.redo,commands:r,shell:i,semanticCommands:e.undoers.redo,default:{label:n.__("Redo")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.clearCurrent,commands:r,shell:i,semanticCommands:e.clearers.clearCurrent,default:{label:n.__("Clear")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.clearAll,commands:r,shell:i,semanticCommands:e.clearers.clearAll,default:{label:n.__("Clear All")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.goToLine,commands:r,shell:i,semanticCommands:e.goToLiners,default:{label:n.__("Go to Line…")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n})}function ke(t,e,n,r){const{commands:i,shell:c}=t;f({id:p.closeAndCleanup,commands:i,shell:c,semanticCommands:e.closeAndCleaners,default:{execute:"application:close",label:r.__("Close and Shut Down"),isEnabled:!0},overrides:{isEnabled:()=>!!t.shell.currentWidget&&!!t.shell.currentWidget.title.closable,describedBy:{args:{type:"object",properties:{}}}},trans:r}),f({id:p.createConsole,commands:i,shell:c,semanticCommands:e.consoleCreators,default:{label:r.__("New Console for Activity")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:r}),i.addCommand(p.shutdown,{label:r.__("Shut Down"),caption:r.__("Shut down %1",t.name),isVisible:()=>e.quitEntry,isEnabled:()=>e.quitEntry,describedBy:{args:{type:"object",properties:{}}},execute:()=>L({title:r.__("Shutdown confirmation"),body:r.__("Please confirm you want to shut down %1.",t.name),buttons:[T.cancelButton(),T.warnButton({label:r.__("Shut Down")})]}).then(async u=>{if(u.button.accept){const o=t.serviceManager.serverSettings,a=J.URLExt.join(o.baseUrl,"api/shutdown");try{await Promise.all([t.serviceManager.sessions.shutdownAll(),t.serviceManager.terminals.shutdownAll()])}catch(l){console.log(`Failed to shutdown sessions and terminals: ${l}`)}return P.ServerConnection.makeRequest(a,{method:"POST"},o).then(l=>{if(l.ok){const s=document.createElement("div"),d=document.createElement("p");d.textContent=r.__("You have shut down the Jupyter server. You can now close this tab.");const b=document.createElement("p");b.textContent=r.__("To use %1 again, you will need to relaunch it.",t.name),s.appendChild(d),s.appendChild(b),L({title:r.__("Server stopped"),body:new se({node:s}),buttons:[]}),window.close()}else throw new P.ServerConnection.ResponseError(l)}).catch(l=>{throw new P.ServerConnection.NetworkError(l)})}})}),i.addCommand(p.logout,{label:r.__("Log Out"),caption:r.__("Log out of %1",t.name),isVisible:()=>e.quitEntry,isEnabled:()=>e.quitEntry,describedBy:{args:{type:"object",properties:{}}},execute:()=>{n.navigate("/logout",{hard:!0})}})}function Re(t,e,n){const{commands:r,shell:i}=t;f({id:p.interruptKernel,commands:r,shell:i,semanticCommands:e.kernelUsers.interruptKernel,default:{label:n.__("Interrupt Kernel"),caption:n.__("Interrupt the kernel")},overrides:{icon:c=>c.toolbar?oe:void 0,describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.reconnectToKernel,commands:r,shell:i,semanticCommands:e.kernelUsers.reconnectToKernel,default:{label:n.__("Reconnect to Kernel")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.restartKernel,commands:r,shell:i,semanticCommands:e.kernelUsers.restartKernel,default:{label:n.__("Restart Kernel…"),caption:n.__("Restart the kernel")},overrides:{icon:c=>c.toolbar?ae:void 0,describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.restartKernelAndClear,commands:r,shell:i,semanticCommands:[e.kernelUsers.restartKernel,e.kernelUsers.clearWidget],default:{label:n.__("Restart Kernel and Clear…")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.changeKernel,commands:r,shell:i,semanticCommands:e.kernelUsers.changeKernel,default:{label:n.__("Change Kernel…")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.shutdownKernel,commands:r,shell:i,semanticCommands:e.kernelUsers.shutdownKernel,default:{label:n.__("Shut Down Kernel"),caption:n.__("Shut down kernel")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),r.addCommand(p.shutdownAllKernels,{label:n.__("Shut Down All Kernels…"),isEnabled:()=>!t.serviceManager.sessions.running().next().done,describedBy:{args:{type:"object",properties:{}}},execute:()=>L({title:n.__("Shut Down All?"),body:n._n("Are you sure you want to permanently shut down the running kernel?","Are you sure you want to permanently shut down the %1 running kernels?",t.serviceManager.kernels.runningCount),buttons:[T.cancelButton(),T.warnButton({label:n.__("Shut Down All")})]}).then(c=>{if(c.button.accept)return t.serviceManager.sessions.shutdownAll()})})}function je(t,e,n){const{commands:r,shell:i}=t;f({id:p.lineNumbering,commands:r,shell:i,semanticCommands:e.editorViewers.toggleLineNumbers,default:{label:n.__("Show Line Numbers")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.minimap,commands:r,shell:i,semanticCommands:e.editorViewers.toggleMinimap,default:{label:n.__("Show Minimap")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.matchBrackets,commands:r,shell:i,semanticCommands:e.editorViewers.toggleMatchBrackets,default:{label:n.__("Match Brackets")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.wordWrap,commands:r,shell:i,semanticCommands:e.editorViewers.toggleWordWrap,default:{label:n.__("Wrap Words")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n})}function Ae(t,e,n){const{commands:r,shell:i}=t;f({id:p.run,commands:r,shell:i,semanticCommands:e.codeRunners.run,default:{label:n.__("Run Selected"),caption:n.__("Run Selected")},overrides:{icon:c=>c.toolbar?de:void 0,describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.runAll,commands:r,shell:i,semanticCommands:e.codeRunners.runAll,default:{label:n.__("Run All"),caption:n.__("Run All")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.restartAndRunAll,commands:r,shell:i,semanticCommands:[e.codeRunners.restart,e.codeRunners.runAll],default:{label:n.__("Restart Kernel and Run All"),caption:n.__("Restart Kernel and Run All")},overrides:{icon:c=>c.toolbar?le:void 0,describedBy:{args:{type:"object",properties:{}}}},trans:n})}function Be(t,e,n,r){const i=t.commands,c=[];let u;i.addCommand(p.activateById,{label:a=>{if(a.id===void 0)return r.__("Activate a widget by its `id`.");const l=a.id||"",s=Z(t.shell.widgets("main"),d=>d.id===l);return s&&s.title.label||""},isToggled:a=>{const l=a.id||"";return!!t.shell.currentWidget&&t.shell.currentWidget.id===l},describedBy:{args:{type:"object",properties:{id:{type:"string",description:r.__("The widget id to activate")}},required:["id"]}},execute:a=>t.shell.activateById(a.id||"")});let o="";i.addCommand(p.activatePreviouslyUsedTab,{label:r.__("Activate Previously Used Tab"),isEnabled:()=>!!o,describedBy:{args:{type:"object",properties:{}}},execute:()=>i.execute(p.activateById,{id:o})}),n&&t.restored.then(()=>{const a=()=>{u&&!u.isDisposed&&u.dispose(),c.length=0;let l=!1;for(const s of t.shell.widgets("main"))s.id===o&&(l=!0),c.push({command:p.activateById,args:{id:s.id}});u=e.addGroup(c,1),o=l?o:""};a(),n.layoutModified.connect(()=>{a()}),n.currentChanged.connect((l,s)=>{const d=s.oldValue;d&&(o=d.id)})})}function Ce(t,e,n){const{commands:r,shell:i}=t;f({id:p.getKernel,commands:r,shell:i,semanticCommands:e.getKernel,default:{label:n.__("Get Kernel"),isVisible:!1},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n})}const Tt=[we,ye];var Y;(function(t){async function e(r){(await L({title:r.__("Information"),body:r.__("Menu customization has changed. You will need to reload JupyterLab to see the changes."),buttons:[T.cancelButton(),T.okButton({label:r.__("Reload")})]})).button.accept&&location.reload()}async function n(r,i,c,u){var o;const a=u.load("jupyterlab");let l=null,s={};function d(m){var g,M;s={};const A=Object.keys(r.plugins).map(y=>{var k,w;const R=(w=(k=r.plugins[y].schema["jupyter.lab.menus"])===null||k===void 0?void 0:k.main)!==null&&w!==void 0?w:[];return s[y]=R,R}).concat([(M=(g=m["jupyter.lab.menus"])===null||g===void 0?void 0:g.main)!==null&&M!==void 0?M:[]]).reduceRight((y,k)=>E.reconcileMenus(y,k,!0),m.properties.menus.default);m.properties.menus.default=E.reconcileMenus(A,m.properties.menus.default,!0).sort((y,k)=>{var w,R;return((w=y.rank)!==null&&w!==void 0?w:1/0)-((R=k.rank)!==null&&R!==void 0?R:1/0)})}r.transform(I,{compose:m=>{var g,M,A,y;l||(l=K.deepCopy(m.schema),d(l));const k=(A=(M=(g=l.properties)===null||g===void 0?void 0:g.menus)===null||M===void 0?void 0:M.default)!==null&&A!==void 0?A:[],w={...m.data.user,menus:(y=m.data.user.menus)!==null&&y!==void 0?y:[]},R={...m.data.composite,menus:E.reconcileMenus(k,w.menus)};return m.data={composite:R,user:w},m},fetch:m=>(l||(l=K.deepCopy(m.schema),d(l)),{data:m.data,id:m.id,raw:m.raw,schema:l,version:m.version})});const b=await r.load(I),h=(o=K.deepCopy(b.composite.menus))!==null&&o!==void 0?o:[],B=new Array;z.createMenus(h.filter(m=>!m.disabled).map(m=>{var g;return{...m,items:E.filterDisabledItems((g=m.items)!==null&&g!==void 0?g:[])}}),c).forEach(m=>{B.push(m),i(m)}),b.changed.connect(()=>{var m;const g=(m=b.composite.menus)!==null&&m!==void 0?m:[];K.deepEqual(h,g)||e(a)}),r.pluginChanged.connect(async(m,g)=>{var M,A,y;if(g!==I){const k=(M=s[g])!==null&&M!==void 0?M:[],w=(y=(A=r.plugins[g].schema["jupyter.lab.menus"])===null||A===void 0?void 0:A.main)!==null&&y!==void 0?y:[];if(!K.deepEqual(k,w))if(s[g])await e(a);else{s[g]=K.deepCopy(w);const R=E.reconcileMenus(w,h,!1,!1).filter(x=>!x.disabled).map(x=>{var O;return{...x,items:E.filterDisabledItems((O=x.items)!==null&&O!==void 0?O:[])}});z.updateMenus(B,R,c).forEach(x=>{i(x)})}}})}t.loadSettingsMenu=n})(Y||(Y={}));export{p as CommandIDs,Tt as default};
|
|
1
|
+
import{aD as Q,cr as Z,fN as te,az as S,aC as D,cd as J,cm as ne,ax as re,bg as ie,aE as L,aF as T,k as P,aA as se,dU as oe,dR as ae,fO as de,fP as le,cg as K,dA as E}from"../datalayer-app-main.js";import{c as ce}from"./tokens-DbNnxPrX.js";import{a as ue}from"./tokens-Nkg3e_k9.js";import{I as ee}from"./tokens-B7nNzQEE.js";import{h as _,b as pe,M as z}from"./index-CcDn6aA5.js";import{M as v,c as me,e as he}from"./index-BIl72fAm.js";import{I as be}from"./tokens-DY_UrMLq.js";import{R as j,I as _e}from"./menu-Ntu8pEH0.js";import"./hoverbox-CStlKQWE.js";import"./Output-DNFUWYih.js";import"./index-Xpn7qE4M.js";import"./index-CW9jwmnF.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-CO9-1hO8.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-vXN5wge0.js";import"./NotebookSkeleton-BaU6vrsb.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-CKt61TR-.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-CQzZPse_.js";import"./KernelVariables-lzdkfkh4.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-CO_qaXBp.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-ByUGXe7J.js";import"./sessions-CmElNrqo.js";import"./tokens-CTXFWLvM.js";import"./drivecontents-BsC6Y2Vl.js";import"./kernel-BmfZmtIo.js";function f(t){const{id:e,commands:n,shell:r,semanticCommands:i,default:c,overrides:u,trans:o}=t;n.addCommand(e,{...fe({commands:n,shell:r},i,c??{},o??Q.load("jupyterlab")),...u});const a=Array.isArray(i)?i:[i],l=(s,d)=>{if(d.id){if(d.id===e&&d.type==="removed")s.commandChanged.disconnect(l);else if(a.reduce((h,B)=>h.concat(B.ids),[]).includes(d.id))switch(d.type){case"changed":case"many-changed":s.notifyCommandChanged(e);break;case"removed":for(const h of a)h.remove(d.id);break}}};n.commandChanged.connect(l)}function fe(t,e,n,r){const{commands:i,shell:c}=t,u=Array.isArray(e)?e:[e];return{label:a("label"),caption:a("caption"),isEnabled:()=>{var l;const s=o("isEnabled");return s.length>0?!s.some(d=>d===!1):(l=n.isEnabled)!==null&&l!==void 0?l:!1},isToggled:()=>{var l;const s=o("isToggled");return s.length>0?s.some(d=>d===!0):(l=n.isToggled)!==null&&l!==void 0?l:!1},isVisible:()=>{var l;const s=o("isVisible");return s.length>0?!s.some(d=>d===!1):(l=n.isVisible)!==null&&l!==void 0?l:!0},execute:async()=>{const l=c.currentWidget,d=u.map(h=>l!==null?h.getActiveCommandId(l):null).filter(h=>h!==null&&i.isEnabled(h));let b=null;if(d.length>0)for(const h of d){const B={[_.WIDGET]:l.id};if(b=await i.execute(h,B),typeof b=="boolean"&&b===!1)break}else n.execute&&(b=await i.execute(n.execute));return b}};function o(l){const s=c.currentWidget;return u.map(h=>s!==null?h.getActiveCommandId(s):null).filter(h=>h!==null).map(h=>i[l](h))}function a(l){return()=>{var s;const d=o(l).map((b,h)=>l=="caption"&&h>0?b.toLocaleLowerCase():b);switch(d.length){case 0:return(s=n[l])!==null&&s!==void 0?s:"";case 1:return d[0];default:{const b=d.some(m=>/…$/.test(m)),h=d.slice(void 0,-1).map(m=>m.replace(/…$/,"")).join(", "),B=d.slice(-1)[0].replace(/…$/,"")+(b?"…":"");return r.__("%1 and %2",h,B)}}}}}class U extends j{constructor(e){super(e),this.undoers={redo:new _,undo:new _},this.clearers={clearAll:new _,clearCurrent:new _},this.goToLiners=new _}}class V extends j{constructor(e){super(e),this.quitEntry=!1,this.closeAndCleaners=new _,this.consoleCreators=new _}get newMenu(){var e,n;return this._newMenu||(this._newMenu=(n=(e=Z(this.items,r=>{var i;return((i=r.submenu)===null||i===void 0?void 0:i.id)==="jp-mainmenu-file-new"}))===null||e===void 0?void 0:e.submenu)!==null&&n!==void 0?n:new j({commands:this.commands})),this._newMenu}dispose(){var e;(e=this._newMenu)===null||e===void 0||e.dispose(),super.dispose()}}class W extends j{constructor(e){super(e),this.getKernel=new _}}class F extends j{constructor(e){super(e),this.kernelUsers={changeKernel:new _,clearWidget:new _,interruptKernel:new _,reconnectToKernel:new _,restartKernel:new _,shutdownKernel:new _}}}class q extends j{constructor(e){super(e),this.codeRunners={restart:new _,run:new _,runAll:new _}}}class N extends j{constructor(e){super(e)}}class $ extends j{constructor(e){super(e)}}class G extends j{constructor(e){super(e),this.editorViewers={toggleLineNumbers:new _,toggleMinimap:new _,toggleMatchBrackets:new _,toggleWordWrap:new _}}}class X extends te{constructor(e){let n={forceItemsPosition:{forceX:!1,forceY:!0}};super(n),this._items=[],this._commands=e}get editMenu(){return this._editMenu||(this._editMenu=new U({commands:this._commands,rank:2,renderer:v.defaultRenderer})),this._editMenu}get fileMenu(){return this._fileMenu||(this._fileMenu=new V({commands:this._commands,rank:1,renderer:v.defaultRenderer})),this._fileMenu}get helpMenu(){return this._helpMenu||(this._helpMenu=new W({commands:this._commands,rank:1e3,renderer:v.defaultRenderer})),this._helpMenu}get kernelMenu(){return this._kernelMenu||(this._kernelMenu=new F({commands:this._commands,rank:5,renderer:v.defaultRenderer})),this._kernelMenu}get runMenu(){return this._runMenu||(this._runMenu=new q({commands:this._commands,rank:4,renderer:v.defaultRenderer})),this._runMenu}get settingsMenu(){return this._settingsMenu||(this._settingsMenu=new N({commands:this._commands,rank:999,renderer:v.defaultRenderer})),this._settingsMenu}get viewMenu(){return this._viewMenu||(this._viewMenu=new G({commands:this._commands,rank:3,renderer:v.defaultRenderer})),this._viewMenu}get tabsMenu(){return this._tabsMenu||(this._tabsMenu=new $({commands:this._commands,rank:500,renderer:v.defaultRenderer})),this._tabsMenu}addMenu(e,n=!0,r={}){if(S.firstIndexOf(this.menus,e)>-1)return;v.overrideDefaultRenderer(e);const i="rank"in r?r.rank:"rank"in e?e.rank:_e.DEFAULT_RANK,c={menu:e,rank:i},u=S.upperBound(this._items,c,H.itemCmp);switch(e.disposed.connect(this._onMenuDisposed,this),S.insert(this._items,u,c),this.insertMenu(u,e),e.id){case"jp-mainmenu-file":!this._fileMenu&&e instanceof V&&(this._fileMenu=e);break;case"jp-mainmenu-edit":!this._editMenu&&e instanceof U&&(this._editMenu=e);break;case"jp-mainmenu-view":!this._viewMenu&&e instanceof G&&(this._viewMenu=e);break;case"jp-mainmenu-run":!this._runMenu&&e instanceof q&&(this._runMenu=e);break;case"jp-mainmenu-kernel":!this._kernelMenu&&e instanceof F&&(this._kernelMenu=e);break;case"jp-mainmenu-tabs":!this._tabsMenu&&e instanceof $&&(this._tabsMenu=e);break;case"jp-mainmenu-settings":!this._settingsMenu&&e instanceof N&&(this._settingsMenu=e);break;case"jp-mainmenu-help":!this._helpMenu&&e instanceof W&&(this._helpMenu=e);break}}dispose(){var e,n,r,i,c,u,o,a;(e=this._editMenu)===null||e===void 0||e.dispose(),(n=this._fileMenu)===null||n===void 0||n.dispose(),(r=this._helpMenu)===null||r===void 0||r.dispose(),(i=this._kernelMenu)===null||i===void 0||i.dispose(),(c=this._runMenu)===null||c===void 0||c.dispose(),(u=this._settingsMenu)===null||u===void 0||u.dispose(),(o=this._viewMenu)===null||o===void 0||o.dispose(),(a=this._tabsMenu)===null||a===void 0||a.dispose(),super.dispose()}static generateMenu(e,n,r){let i;const{id:c,label:u,rank:o}=n;switch(c){case"jp-mainmenu-file":i=new V({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-edit":i=new U({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-view":i=new G({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-run":i=new q({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-kernel":i=new F({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-tabs":i=new $({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-settings":i=new N({commands:e,rank:o,renderer:v.defaultRenderer});break;case"jp-mainmenu-help":i=new W({commands:e,rank:o,renderer:v.defaultRenderer});break;default:i=new j({commands:e,rank:o,renderer:v.defaultRenderer})}return u&&(i.title.label=r._p("menu",u)),i}_onMenuDisposed(e){this.removeMenu(e);const n=S.findFirstIndex(this._items,r=>r.menu===e);n!==-1&&S.removeAt(this._items,n)}}var H;(function(t){function e(n,r){return n.rank-r.rank}t.itemCmp=e})(H||(H={}));const ge="@jupyterlab/mainmenu-extension:recents";var C;(function(t){t.openRecent="recentmenu:open-recent",t.reopenLast="recentmenu:reopen-last",t.clearRecents="docmanager:clear-recents"})(C||(C={}));class ve extends re{constructor(e){super(e),this._manager=e.manager,this._showDirectories=e.showDirectories,this.updateItems(),this._manager.changed.connect(this.updateItems,this)}async _validateRecentlyOpened(){Promise.all(this._manager.recentlyOpened.map(e=>this._manager.validate(e)))}onBeforeAttach(e){const n=new ie;setTimeout(()=>{n.reject("Recents validation timed out.")},550),Promise.race([n.promise,this._validateRecentlyOpened()]).then(()=>{this.update()}).catch(()=>{}),super.onBeforeAttach(e)}updateItems(){this.clearItems(),this.addItem({command:C.reopenLast}),this.addItem({type:"separator"});let e=!0,n=!1;this._manager.recentlyOpened.sort((r,i)=>r.contentType===i.contentType?0:r.contentType!=="directory"?1:-1).forEach(r=>{if(r.contentType==="directory"){if(!this._showDirectories)return;n=!0}else e&&n&&(e=!1,this.addItem({type:"separator"}));this.addItem({command:C.openRecent,args:{recent:r}})}),this.addItem({type:"separator"}),this.addItem({command:C.clearRecents})}}const ye={id:ge,description:"Adds sub-menu for opening recent documents to the File section of the main menu.",autoStart:!0,requires:[ue,ee],optional:[ce,D],activate:(t,e,n,r,i)=>{const{commands:c}=t,u=(i??Q).load("jupyterlab"),o=r!==null,a=async s=>{const d=await e.validate(s);return d||await ne(u.__("Could Not Open Recent"),u.__("%1 is no longer valid and will be removed from the list",s.path)),d};c.addCommand(C.openRecent,{execute:async s=>{const d=s.recent,b=d.path===""?"/":d.path;await a(d)&&(r&&d.contentType==="directory"?await c.execute(r.openPath,{path:b}):await c.execute("docmanager:open",{path:b,factory:d.factory}))},label:s=>{const d=s.recent;return d?J.PathExt.joinWithLeadingSlash(d.root,d.path):u.__("Open a Recent Document (given by `recent` argument)")},isEnabled:s=>e.recentlyOpened.includes(s.recent),describedBy:{args:{type:"object",properties:{recent:{type:"object",description:u.__("Recent document to open")}}}}}),t.commands.addCommand(C.reopenLast,{execute:async()=>{const s=e.recentlyClosed[0];!s||!await a(s)||(await c.execute("docmanager:open",{path:s.path,factory:s.factory}),e.removeRecent(s,"closed"))},label:()=>{const s=e.recentlyClosed[0];return s?u.__("Reopen %1",s.path):u.__("Reopen Closed Document")},isEnabled:()=>e.recentlyClosed.length!==0,caption:u.__("Reopen recently closed file or notebook."),describedBy:{args:{type:"object",properties:{}}}});const l=new ve({commands:c,manager:e,showDirectories:o});l.title.label=u.__("Open Recent"),n.fileMenu.addItem({type:"submenu",submenu:l,rank:1})}},I="@jupyterlab/mainmenu-extension:plugin";var p;(function(t){t.openEdit="editmenu:open",t.undo="editmenu:undo",t.redo="editmenu:redo",t.clearCurrent="editmenu:clear-current",t.clearAll="editmenu:clear-all",t.find="editmenu:find",t.goToLine="editmenu:go-to-line",t.openFile="filemenu:open",t.closeAndCleanup="filemenu:close-and-cleanup",t.createConsole="filemenu:create-console",t.shutdown="filemenu:shutdown",t.logout="filemenu:logout",t.openKernel="kernelmenu:open",t.interruptKernel="kernelmenu:interrupt",t.reconnectToKernel="kernelmenu:reconnect-to-kernel",t.restartKernel="kernelmenu:restart",t.restartKernelAndClear="kernelmenu:restart-and-clear",t.changeKernel="kernelmenu:change",t.shutdownKernel="kernelmenu:shutdown",t.shutdownAllKernels="kernelmenu:shutdownAll",t.openView="viewmenu:open",t.wordWrap="viewmenu:word-wrap",t.lineNumbering="viewmenu:line-numbering",t.minimap="viewmenu:show-minimap",t.matchBrackets="viewmenu:match-brackets",t.openRun="runmenu:open",t.run="runmenu:run",t.runAll="runmenu:run-all",t.restartAndRunAll="runmenu:restart-and-run-all",t.runAbove="runmenu:run-above",t.runBelow="runmenu:run-below",t.openTabs="tabsmenu:open",t.activateById="tabsmenu:activate-by-id",t.activatePreviouslyUsedTab="tabsmenu:activate-previously-used-tab",t.openSettings="settingsmenu:open",t.openHelp="helpmenu:open",t.getKernel="helpmenu:get-kernel",t.openFirst="mainmenu:open-first"})(p||(p={}));const we={id:I,description:"Adds and provides the application main menu.",requires:[he,D],optional:[pe,me,be],provides:ee,activate:async(t,e,n,r,i,c)=>{const{commands:u}=t,o=n.load("jupyterlab"),a=new X(u);a.id="jp-MainMenu",a.addClass("jp-scrollbar-tiny"),c&&(await Y.loadSettingsMenu(c,d=>{a.addMenu(d,!1,{rank:d.rank})},d=>X.generateMenu(u,d,o),n),a.update());const l=J.PageConfig.getOption("quitButton").toLowerCase();a.fileMenu.quitEntry=l==="true",Me(t,a.editMenu,o),ke(t,a.fileMenu,e,o),Re(t,a.kernelMenu,o),Ae(t,a.runMenu,o),je(t,a.viewMenu,o),Ce(t,a.helpMenu,o),i&&Be(t,a.tabsMenu,i,o);const s=d=>{a.activeMenu=d,a.openActiveMenu()};return u.addCommand(p.openEdit,{label:o.__("Open Edit Menu"),execute:()=>s(a.editMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openFile,{label:o.__("Open File Menu"),execute:()=>s(a.fileMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openKernel,{label:o.__("Open Kernel Menu"),execute:()=>s(a.kernelMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openRun,{label:o.__("Open Run Menu"),execute:()=>s(a.runMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openView,{label:o.__("Open View Menu"),execute:()=>s(a.viewMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openSettings,{label:o.__("Open Settings Menu"),execute:()=>s(a.settingsMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openTabs,{label:o.__("Open Tabs Menu"),execute:()=>s(a.tabsMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openHelp,{label:o.__("Open Help Menu"),execute:()=>s(a.helpMenu),describedBy:{args:{type:"object",properties:{}}}}),u.addCommand(p.openFirst,{label:o.__("Open First Menu"),execute:()=>{a.activeIndex=0,a.openActiveMenu()},describedBy:{args:{type:"object",properties:{}}}}),r&&(r.addItem({command:p.shutdown,category:o.__("Main Area")}),r.addItem({command:p.logout,category:o.__("Main Area")}),r.addItem({command:p.shutdownAllKernels,category:o.__("Kernel Operations")}),r.addItem({command:p.activatePreviouslyUsedTab,category:o.__("Main Area")})),t.shell.add(a,"menu",{rank:100}),a}};function Me(t,e,n){const{commands:r,shell:i}=t;f({id:p.undo,commands:r,shell:i,semanticCommands:e.undoers.undo,default:{label:n.__("Undo")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.redo,commands:r,shell:i,semanticCommands:e.undoers.redo,default:{label:n.__("Redo")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.clearCurrent,commands:r,shell:i,semanticCommands:e.clearers.clearCurrent,default:{label:n.__("Clear")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.clearAll,commands:r,shell:i,semanticCommands:e.clearers.clearAll,default:{label:n.__("Clear All")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.goToLine,commands:r,shell:i,semanticCommands:e.goToLiners,default:{label:n.__("Go to Line…")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n})}function ke(t,e,n,r){const{commands:i,shell:c}=t;f({id:p.closeAndCleanup,commands:i,shell:c,semanticCommands:e.closeAndCleaners,default:{execute:"application:close",label:r.__("Close and Shut Down"),isEnabled:!0},overrides:{isEnabled:()=>!!t.shell.currentWidget&&!!t.shell.currentWidget.title.closable,describedBy:{args:{type:"object",properties:{}}}},trans:r}),f({id:p.createConsole,commands:i,shell:c,semanticCommands:e.consoleCreators,default:{label:r.__("New Console for Activity")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:r}),i.addCommand(p.shutdown,{label:r.__("Shut Down"),caption:r.__("Shut down %1",t.name),isVisible:()=>e.quitEntry,isEnabled:()=>e.quitEntry,describedBy:{args:{type:"object",properties:{}}},execute:()=>L({title:r.__("Shutdown confirmation"),body:r.__("Please confirm you want to shut down %1.",t.name),buttons:[T.cancelButton(),T.warnButton({label:r.__("Shut Down")})]}).then(async u=>{if(u.button.accept){const o=t.serviceManager.serverSettings,a=J.URLExt.join(o.baseUrl,"api/shutdown");try{await Promise.all([t.serviceManager.sessions.shutdownAll(),t.serviceManager.terminals.shutdownAll()])}catch(l){console.log(`Failed to shutdown sessions and terminals: ${l}`)}return P.ServerConnection.makeRequest(a,{method:"POST"},o).then(l=>{if(l.ok){const s=document.createElement("div"),d=document.createElement("p");d.textContent=r.__("You have shut down the Jupyter server. You can now close this tab.");const b=document.createElement("p");b.textContent=r.__("To use %1 again, you will need to relaunch it.",t.name),s.appendChild(d),s.appendChild(b),L({title:r.__("Server stopped"),body:new se({node:s}),buttons:[]}),window.close()}else throw new P.ServerConnection.ResponseError(l)}).catch(l=>{throw new P.ServerConnection.NetworkError(l)})}})}),i.addCommand(p.logout,{label:r.__("Log Out"),caption:r.__("Log out of %1",t.name),isVisible:()=>e.quitEntry,isEnabled:()=>e.quitEntry,describedBy:{args:{type:"object",properties:{}}},execute:()=>{n.navigate("/logout",{hard:!0})}})}function Re(t,e,n){const{commands:r,shell:i}=t;f({id:p.interruptKernel,commands:r,shell:i,semanticCommands:e.kernelUsers.interruptKernel,default:{label:n.__("Interrupt Kernel"),caption:n.__("Interrupt the kernel")},overrides:{icon:c=>c.toolbar?oe:void 0,describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.reconnectToKernel,commands:r,shell:i,semanticCommands:e.kernelUsers.reconnectToKernel,default:{label:n.__("Reconnect to Kernel")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.restartKernel,commands:r,shell:i,semanticCommands:e.kernelUsers.restartKernel,default:{label:n.__("Restart Kernel…"),caption:n.__("Restart the kernel")},overrides:{icon:c=>c.toolbar?ae:void 0,describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.restartKernelAndClear,commands:r,shell:i,semanticCommands:[e.kernelUsers.restartKernel,e.kernelUsers.clearWidget],default:{label:n.__("Restart Kernel and Clear…")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.changeKernel,commands:r,shell:i,semanticCommands:e.kernelUsers.changeKernel,default:{label:n.__("Change Kernel…")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.shutdownKernel,commands:r,shell:i,semanticCommands:e.kernelUsers.shutdownKernel,default:{label:n.__("Shut Down Kernel"),caption:n.__("Shut down kernel")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),r.addCommand(p.shutdownAllKernels,{label:n.__("Shut Down All Kernels…"),isEnabled:()=>!t.serviceManager.sessions.running().next().done,describedBy:{args:{type:"object",properties:{}}},execute:()=>L({title:n.__("Shut Down All?"),body:n._n("Are you sure you want to permanently shut down the running kernel?","Are you sure you want to permanently shut down the %1 running kernels?",t.serviceManager.kernels.runningCount),buttons:[T.cancelButton(),T.warnButton({label:n.__("Shut Down All")})]}).then(c=>{if(c.button.accept)return t.serviceManager.sessions.shutdownAll()})})}function je(t,e,n){const{commands:r,shell:i}=t;f({id:p.lineNumbering,commands:r,shell:i,semanticCommands:e.editorViewers.toggleLineNumbers,default:{label:n.__("Show Line Numbers")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.minimap,commands:r,shell:i,semanticCommands:e.editorViewers.toggleMinimap,default:{label:n.__("Show Minimap")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.matchBrackets,commands:r,shell:i,semanticCommands:e.editorViewers.toggleMatchBrackets,default:{label:n.__("Match Brackets")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.wordWrap,commands:r,shell:i,semanticCommands:e.editorViewers.toggleWordWrap,default:{label:n.__("Wrap Words")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n})}function Ae(t,e,n){const{commands:r,shell:i}=t;f({id:p.run,commands:r,shell:i,semanticCommands:e.codeRunners.run,default:{label:n.__("Run Selected"),caption:n.__("Run Selected")},overrides:{icon:c=>c.toolbar?de:void 0,describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.runAll,commands:r,shell:i,semanticCommands:e.codeRunners.runAll,default:{label:n.__("Run All"),caption:n.__("Run All")},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n}),f({id:p.restartAndRunAll,commands:r,shell:i,semanticCommands:[e.codeRunners.restart,e.codeRunners.runAll],default:{label:n.__("Restart Kernel and Run All"),caption:n.__("Restart Kernel and Run All")},overrides:{icon:c=>c.toolbar?le:void 0,describedBy:{args:{type:"object",properties:{}}}},trans:n})}function Be(t,e,n,r){const i=t.commands,c=[];let u;i.addCommand(p.activateById,{label:a=>{if(a.id===void 0)return r.__("Activate a widget by its `id`.");const l=a.id||"",s=Z(t.shell.widgets("main"),d=>d.id===l);return s&&s.title.label||""},isToggled:a=>{const l=a.id||"";return!!t.shell.currentWidget&&t.shell.currentWidget.id===l},describedBy:{args:{type:"object",properties:{id:{type:"string",description:r.__("The widget id to activate")}},required:["id"]}},execute:a=>t.shell.activateById(a.id||"")});let o="";i.addCommand(p.activatePreviouslyUsedTab,{label:r.__("Activate Previously Used Tab"),isEnabled:()=>!!o,describedBy:{args:{type:"object",properties:{}}},execute:()=>i.execute(p.activateById,{id:o})}),n&&t.restored.then(()=>{const a=()=>{u&&!u.isDisposed&&u.dispose(),c.length=0;let l=!1;for(const s of t.shell.widgets("main"))s.id===o&&(l=!0),c.push({command:p.activateById,args:{id:s.id}});u=e.addGroup(c,1),o=l?o:""};a(),n.layoutModified.connect(()=>{a()}),n.currentChanged.connect((l,s)=>{const d=s.oldValue;d&&(o=d.id)})})}function Ce(t,e,n){const{commands:r,shell:i}=t;f({id:p.getKernel,commands:r,shell:i,semanticCommands:e.getKernel,default:{label:n.__("Get Kernel"),isVisible:!1},overrides:{describedBy:{args:{type:"object",properties:{}}}},trans:n})}const Tt=[we,ye];var Y;(function(t){async function e(r){(await L({title:r.__("Information"),body:r.__("Menu customization has changed. You will need to reload JupyterLab to see the changes."),buttons:[T.cancelButton(),T.okButton({label:r.__("Reload")})]})).button.accept&&location.reload()}async function n(r,i,c,u){var o;const a=u.load("jupyterlab");let l=null,s={};function d(m){var g,M;s={};const A=Object.keys(r.plugins).map(y=>{var k,w;const R=(w=(k=r.plugins[y].schema["jupyter.lab.menus"])===null||k===void 0?void 0:k.main)!==null&&w!==void 0?w:[];return s[y]=R,R}).concat([(M=(g=m["jupyter.lab.menus"])===null||g===void 0?void 0:g.main)!==null&&M!==void 0?M:[]]).reduceRight((y,k)=>E.reconcileMenus(y,k,!0),m.properties.menus.default);m.properties.menus.default=E.reconcileMenus(A,m.properties.menus.default,!0).sort((y,k)=>{var w,R;return((w=y.rank)!==null&&w!==void 0?w:1/0)-((R=k.rank)!==null&&R!==void 0?R:1/0)})}r.transform(I,{compose:m=>{var g,M,A,y;l||(l=K.deepCopy(m.schema),d(l));const k=(A=(M=(g=l.properties)===null||g===void 0?void 0:g.menus)===null||M===void 0?void 0:M.default)!==null&&A!==void 0?A:[],w={...m.data.user,menus:(y=m.data.user.menus)!==null&&y!==void 0?y:[]},R={...m.data.composite,menus:E.reconcileMenus(k,w.menus)};return m.data={composite:R,user:w},m},fetch:m=>(l||(l=K.deepCopy(m.schema),d(l)),{data:m.data,id:m.id,raw:m.raw,schema:l,version:m.version})});const b=await r.load(I),h=(o=K.deepCopy(b.composite.menus))!==null&&o!==void 0?o:[],B=new Array;z.createMenus(h.filter(m=>!m.disabled).map(m=>{var g;return{...m,items:E.filterDisabledItems((g=m.items)!==null&&g!==void 0?g:[])}}),c).forEach(m=>{B.push(m),i(m)}),b.changed.connect(()=>{var m;const g=(m=b.composite.menus)!==null&&m!==void 0?m:[];K.deepEqual(h,g)||e(a)}),r.pluginChanged.connect(async(m,g)=>{var M,A,y;if(g!==I){const k=(M=s[g])!==null&&M!==void 0?M:[],w=(y=(A=r.plugins[g].schema["jupyter.lab.menus"])===null||A===void 0?void 0:A.main)!==null&&y!==void 0?y:[];if(!K.deepEqual(k,w))if(s[g])await e(a);else{s[g]=K.deepCopy(w);const R=E.reconcileMenus(w,h,!1,!1).filter(x=>!x.disabled).map(x=>{var O;return{...x,items:E.filterDisabledItems((O=x.items)!==null&&O!==void 0?O:[])}});z.updateMenus(B,R,c).forEach(x=>{i(x)})}}})}t.loadSettingsMenu=n})(Y||(Y={}));export{p as CommandIDs,Tt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aC as b}from"../datalayer-app-main.js";import{b as f,S}from"./index-CcDn6aA5.js";import{I}from"./tokens-Dyd4wiX6.js";import{c as h}from"./index-
|
|
1
|
+
import{aC as b}from"../datalayer-app-main.js";import{b as f,S}from"./index-CcDn6aA5.js";import{I}from"./tokens-Dyd4wiX6.js";import{c as h}from"./index-BIl72fAm.js";import{I as g}from"./tokens-DY_UrMLq.js";import"./hoverbox-CStlKQWE.js";import"./Output-DNFUWYih.js";import"./index-Xpn7qE4M.js";import"./index-CW9jwmnF.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-CO9-1hO8.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-vXN5wge0.js";import"./NotebookSkeleton-BaU6vrsb.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-CKt61TR-.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-CQzZPse_.js";import"./KernelVariables-lzdkfkh4.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-CO_qaXBp.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-ByUGXe7J.js";import"./sessions-CmElNrqo.js";import"./tokens-CTXFWLvM.js";import"./drivecontents-BsC6Y2Vl.js";import"./kernel-BmfZmtIo.js";const s="@jupyterlab/statusbar-extension:plugin",vt={id:s,description:"Provides the application status bar.",requires:[b],provides:I,autoStart:!0,activate:(i,l,p,r,n)=>{const c=l.load("jupyterlab"),t=new S;t.id="jp-main-statusbar",i.shell.add(t,"bottom"),p&&p.layoutModified.connect(()=>{t.update()});const u=c.__("Main Area"),e="statusbar:toggle";if(i.commands.addCommand(e,{label:c.__("Show Status Bar"),execute:()=>{t.setHidden(t.isVisible),r&&r.set(s,"visible",t.isVisible)},isToggled:()=>t.isVisible,describedBy:{args:{type:"object",properties:{}}}}),i.commands.commandExecuted.connect((d,m)=>{m.id==="application:reset-layout"&&!t.isVisible&&i.commands.execute(e).catch(o=>{console.error("Failed to show the status bar.",o)})}),n&&n.addItem({command:e,category:u}),r){const d=r.load(s),m=o=>{const a=o.get("visible").composite;t.setHidden(!a)};Promise.all([d,i.restored]).then(([o])=>{m(o),o.changed.connect(a=>{m(a)})}).catch(o=>{console.error(o.message)})}return t},optional:[h,g,f]};export{vt as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ct as I,cu as w,cv as g,cw as B,cx as b,aC as C,aF as v,aE as E}from"../datalayer-app-main.js";import{J as P,c as M}from"./index-
|
|
1
|
+
import{ct as I,cu as w,cv as g,cw as B,cx as b,aC as C,aF as v,aE as E}from"../datalayer-app-main.js";import{J as P,c as M}from"./index-BIl72fAm.js";import{I as L}from"./tokens-DY_UrMLq.js";import{I as N}from"./tokens-B7nNzQEE.js";import{b as A}from"./index-CcDn6aA5.js";import"./Output-DNFUWYih.js";import"./index-Xpn7qE4M.js";import"./hoverbox-CStlKQWE.js";import"./index-CW9jwmnF.js";import"./dayjs.min-u3zuoSR8.js";import"./isEqual-CO9-1hO8.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-vXN5wge0.js";import"./NotebookSkeleton-BaU6vrsb.js";import"./Avatar-Cv5OpUWu.js";import"./renderer-CKt61TR-.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-CQzZPse_.js";import"./KernelVariables-lzdkfkh4.js";import"./index-C0d-d3s4.js";import"./SortAscIcon-CmH04s3F.js";import"./SortDescIcon-Qif6E10I.js";import"./NotebookToolbar-CO_qaXBp.js";import"./RepoPushIcon-BtXQRhLa.js";import"./Toolbar-ByUGXe7J.js";import"./sessions-CmElNrqo.js";import"./tokens-CTXFWLvM.js";import"./drivecontents-BsC6Y2Vl.js";import"./kernel-BmfZmtIo.js";class T{constructor(t="",e,n,a){this._domainData={},this._translationBundles={},this._connector=a??new I(t,n),this._stringsPrefix=e||"",this._englishBundle=new w({stringsPrefix:this._stringsPrefix}),this._currentLocale=g}get languageCode(){return this._currentLocale}async fetch(t){var e,n,a,o;this._languageData=await this._connector.fetch({language:t});let i;if(this._languageData&&t==="default")try{for(const s of Object.values((e=this._languageData.data)!==null&&e!==void 0?e:{})){i=s[""].language;break}}catch{}this._currentLocale=(t!=="default"?t:i??g).replace("_","-"),this._domainData=(a=(n=this._languageData)===null||n===void 0?void 0:n.data)!==null&&a!==void 0?a:{};const r=(o=this._languageData)===null||o===void 0?void 0:o.message;r&&this._currentLocale!==g&&console.warn(r)}load(t){if(this._domainData){if(this._currentLocale==g)return this._englishBundle;if(t=B(t),!(t in this._translationBundles)){let e=new w({domain:t,locale:this._currentLocale,stringsPrefix:this._stringsPrefix});if(t in this._domainData){const n=this._domainData[t][""],a={...this._domainData[t],"":{...n,pluralForms:n.plural_forms}};e.loadJSON(a,t)}this._translationBundles[t]=e}return this._translationBundles[t]}else return this._englishBundle}}const y="@jupyterlab/translation-extension:plugin",$={id:"@jupyterlab/translation-extension:translator-connector",description:"Provides the application translation connector.",autoStart:!0,requires:[P.IPaths],provides:b,activate:(m,t)=>{const e=t.urls.translations,n=m.serviceManager.serverSettings;return new I(e,n)}},F={id:"@jupyterlab/translation-extension:translator",description:"Provides the application translation object.",autoStart:!0,requires:[P.IPaths,L],optional:[M,b],provides:C,activate:async(m,t,e,n,a)=>{const o=await e.load(y),i=o.get("locale").composite;let r=o.get("stringsPrefix").composite;r=o.get("displayStringsPrefix").composite?r:"";const c=m.serviceManager.serverSettings,l=new T(t.urls.translations,r,c,a??void 0);return await l.fetch(i),document.documentElement.lang=l.languageCode,n&&(n.translator=l),v.translator=l,l}},k={id:y,description:"Adds translation commands and settings.",requires:[L,C,b],optional:[N,A],autoStart:!0,activate:(m,t,e,n,a,o)=>{var i;const r=e.load("jupyterlab"),{commands:s}=m,c=a?(i=a.settingsMenu.items.find(u=>{var p;return u.type==="submenu"&&((p=u.submenu)===null||p===void 0?void 0:p.id)==="jp-mainmenu-settings-language"}))===null||i===void 0?void 0:i.submenu:null,l="jupyterlab-translation:install-languages";s.addCommand(l,{label:r.__("Install more languages…"),caption:r.__("Search for language packs in the Extension Manager"),isEnabled:()=>s.hasCommand("extensionmanager:show-panel")&&s.isVisible("extensionmanager:show-panel"),execute:()=>s.execute("extensionmanager:show-panel",{query:"jupyterlab-language-pack"}),describedBy:{args:{type:"object",properties:{}}}}),o&&o.addItem({category:r.__("Display Languages"),command:l}),n.fetch().then(u=>{const p=e.languageCode.replace("-","_");for(const d in u.data){const x=u.data[d],D=x.displayName,S=x.nativeName,h=p===d,_=h?`${D}`:`${D} - ${S}`,f=`jupyterlab-translation:${d}`;s.addCommand(f,{label:_,caption:r.__("Change interface language to %1",_),isEnabled:()=>!h,isToggled:()=>h,execute:async()=>{if((await E({title:r.__("Change interface language?"),body:r.__("After changing the interface language to %1, you will need to reload JupyterLab to see the changes.",_),buttons:[v.cancelButton(),v.okButton({label:r.__("Change and reload")})]})).button.accept)try{await t.set(y,"locale",d),window.location.reload()}catch(j){console.error(`Failed to update language locale to ${d}`,j)}},describedBy:{args:{type:"object",properties:{}}}}),c&&c.addItem({command:f,args:{}}),o&&o.addItem({category:r.__("Display Languages"),command:f})}}).catch(u=>{console.error(`Available locales errored!
|
|
2
2
|
${u}`)}).finally(()=>{c&&(c.items.length>0&&c.addItem({type:"separator"}),c.addItem({command:l,args:{}}))})}},Gt=[$,F,k];export{Gt as default};
|