"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([["1774"],{77965(e,t,o){o.r(t),o.d(t,{default:()=>b});var n=o(42471),r=o(37210),i=o(85553),a=o(74053),l=o(17329),s=o(6193),d=o(93169),c=o(30761),p=o(86554);let u={id:"@jupyter-notebook/console-extension:opener",requires:[n.IRouter],autoStart:!0,description:"A plugin to open consoles in a new tab",activate:(e,t)=>{let{commands:o}=e,n=RegExp("/consoles/(.*)"),r="router:console";o.addCommand(r,{execute:e=>{let t=e.path.match(n);if(!t)return;let[,r]=t;if(!r)return;let i=decodeURIComponent(r);o.execute("console:create",{path:i})},describedBy:{args:{type:"object",properties:{path:{type:"string",description:"The routed URL path to handle."}},required:["path"]}}}),t.register({command:r,pattern:n})}},h={id:"@jupyter-notebook/console-extension:redirect",requires:[i.IConsoleTracker],optional:[c.INotebookPathOpener,c.INotebookShell,l.INotebookTracker],autoStart:!0,description:"Open consoles in a new tab",activate:(e,t,o,n,r)=>{let i=a.PageConfig.getBaseUrl(),l=null!=o?o:c.defaultNotebookPathOpener;t.widgetAdded.connect(async(t,o)=>{var s,d,c,u;if(n&&r){let e=r.currentWidget;if(await Promise.all([null==e?void 0:e.sessionContext.ready,o.sessionContext.ready]),(null==(d=null==(s=null==e?void 0:e.sessionContext.session)?void 0:s.kernel)?void 0:d.id)===(null==(u=null==(c=o.sessionContext.session)?void 0:c.kernel)?void 0:u.id)){n.add(o,"right"),n.expandRight(o.id);return}}let{sessionContext:h}=o;await h.ready,(0,p.find)(e.shell.widgets("main"),e=>e.id===o.id)||(l.open({prefix:a.URLExt.join(i,"consoles"),path:h.path,target:"_blank"}),o.dispose())})}},g={id:"@jupyter-notebook/console-extension:scratchpad-console",requires:[l.INotebookTracker],optional:[c.INotebookShell,r.ICommandPalette,s.ITranslator],autoStart:!0,description:"Open scratchpad console in side panel",activate:(e,t,o,n,r)=>{let{commands:i}=e,a=e.serviceManager,l=(null!=r?r:s.nullTranslator).load("notebook"),c="scratchpad-console:open";i.addCommand(c,{label:e=>e.isPalette?l.__("Open a scratchpad console"):l.__("Scratchpad console"),isVisible:()=>!!t.currentWidget,icon:e=>e.isPalette?void 0:d.consoleIcon,execute:async e=>{var n,r,s,d;if(!o)return;let c=g.id,p=o.rightHandler;if(p.isVisible&&(null==(n=p.currentWidget)?void 0:n.id)===c){e.isPalette||e.isMenu||(o.collapseRight(),null==(r=o.currentWidget)||r.activate());return}let u=p.widgets.find(e=>e.id===c);if(u)o.expandRight(c);else{let e=t.currentWidget;if(!e)return;let o=e.sessionContext;await Promise.all([o.ready,a.ready]);let n=null==(d=null==(s=o.session)?void 0:s.kernel)?void 0:d.id,r=o.kernelPreference;if(!(u=await i.execute("console:create",{kernelPreference:{...r,id:n},preventTitleUpdate:!0})))return void console.error("An error occurred during scratchpad console creation");u.title.caption=l.__("Console"),u.id=c}},describedBy:{args:{type:"object",properties:{isPalette:{type:"boolean",description:l.__("Whether the command is executed from the palette")},isMenu:{type:"boolean",description:l.__("Whether the command is executed from the menu")}}}}}),n&&n.addItem({category:"Notebook Console",command:c,args:{isPalette:!0}})}},b=[u,h,g]}}]);