(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[1682,5135],{21682:(n,e,t)=>{"use strict";t.r(e),t.d(e,{default:()=>g});var s=t(21483),a=t(17134),i=t(43821),o=t(60699),l=t(60977),r=t(81734);var d,h=t(7234),u=t(58646);class c{constructor(n){this._tabsChanged=new u.Signal(this),this._widgets=[],this._labShell=n,this._labShell.layoutModified.connect(this._emitTabsChanged,this)}get tabsChanged(){return this._tabsChanged}addWidget(n){n.title.changed.connect(this._emitTabsChanged,this),this._widgets.push(n)}_emitTabsChanged(){this._widgets.forEach((n=>{n.title.changed.disconnect(this._emitTabsChanged,this)})),this._widgets=[],this._tabsChanged.emit(void 0)}}!function(n){n.showPanel="running:show-panel"}(d||(d={}));const g={activate:function(n,e,t,s){const i=e.load("jupyterlab"),u=new a.RunningSessionManagers,g=new a.RunningSessions(u,e);return g.id="jp-running-sessions",g.title.caption=i.__("Running Terminals and Kernels"),g.title.icon=o.runningIcon,g.node.setAttribute("role","region"),g.node.setAttribute("aria-label",i.__("Running Sessions section")),t&&t.add(g,"running-sessions"),s&&function(n,e,t){const s=new c(t),a=e.load("jupyterlab");n.add({name:a.__("Open Tabs"),running:()=>(0,r.toArray)(t.widgets("main")).map((n=>(s.addWidget(n),new i(n)))),shutdownAll:()=>{(0,r.toArray)(t.widgets("main")).forEach((n=>{n.close()}))},refreshRunning:()=>{},runningChanged:s.tabsChanged,shutdownLabel:a.__("Close"),shutdownAllLabel:a.__("Close All"),shutdownAllConfirmationText:a.__("Are you sure you want to close all open tabs?")});class i{constructor(n){this._widget=n}open(){t.activateById(this._widget.id)}shutdown(){this._widget.close()}icon(){const n=this._widget.title.icon;return n instanceof o.LabIcon?n:o.fileIcon}label(){return this._widget.title.label}labelTitle(){let n;return n=this._widget instanceof h.DocumentWidget?this._widget.context.path:this._widget.title.label,n}}}(u,e,s),function(n,e,t){const s=e.load("jupyterlab"),a=t.serviceManager.sessions,i=t.serviceManager.kernelspecs;function d(n){return!(-1===(n.name||l.PathExt.basename(n.path)).indexOf(".")&&!n.name)}n.add({name:s.__("Kernels"),running:()=>(0,r.toArray)(a.running()).filter(d).map((n=>new h(n))),shutdownAll:()=>a.shutdownAll(),refreshRunning:()=>a.refreshRunning(),runningChanged:a.runningChanged,shutdownLabel:s.__("Shut Down"),shutdownAllLabel:s.__("Shut Down All"),shutdownAllConfirmationText:s.__("Are you sure you want to permanently shut down all running kernels?")});class h{constructor(n){this._model=n}open(){const{path:n,type:e}=this._model;"console"===e.toLowerCase()?t.commands.execute("console:open",{path:n}):t.commands.execute("docmanager:open",{path:n})}shutdown(){return a.shutdown(this._model.id)}icon(){const{name:n,path:e,type:t}=this._model;return-1!==(n||l.PathExt.basename(e)).indexOf(".ipynb")?o.notebookIcon:"console"===t.toLowerCase()?o.consoleIcon:o.fileIcon}label(){return this._model.name||l.PathExt.basename(this._model.path)}labelTitle(){const{kernel:n,path:e}=this._model;let t=null==n?void 0:n.name;if(t&&i.specs){const n=i.specs.kernelspecs[t];t=n?n.display_name:"unknown"}return s.__("Path: %1\nKernel: %2",e,t)}}}(u,e,n),n.shell.add(g,"left",{rank:200}),n.commands.addCommand(d.showPanel,{label:i.__("Sessions and Tabs"),execute:()=>{n.shell.activateById(g.id)}}),u},id:"@jupyterlab/running-extension:plugin",provides:a.IRunningSessionManagers,requires:[i.ITranslator],optional:[s.ILayoutRestorer,s.ILabShell],autoStart:!0}}}]);