mbuali's picture
Upload folder using huggingface_hub
d1ceb73 verified
"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7854],{97854:(e,n,t)=>{t.r(n),t.d(n,{CommandIDs:()=>b,default:()=>k});var s=t(44604),o=t(53312),i=t(9235),a=t(5094),r=t(41053),l=t(12030),c=t(35613),d=t(68722),u=t(97934),h=t(81997),g=t(78156),m=t.n(g);const p="jp-mod-kernel";var _;!function(e){e.KernelSpecItem=class{constructor(e){this._name=e.name,this.className="jp-mod-kernelspec",this._kernels=e.kernels,this.spec=e.spec||null,this.trans=e.trans}icon(){const{spec:e}=this;return e&&e.resources?e.resources["logo-svg"]||e.resources["logo-64x64"]||e.resources["logo-32x32"]:c.jupyterIcon}label(){const{_name:e,spec:n}=this;return(null==n?void 0:n.display_name)||e}get children(){return this._kernels}},e.RunningKernel=class{constructor(e){this.className=p,this.commands=e.commands,this.kernel=e.kernel,this.context=this.kernel.id,this.kernels=e.kernels,this.sessions=e.sessions,this.trans=e.trans}get children(){var e;const n=[],t=b.kernelOpenSession,{commands:s}=this;for(const o of this.sessions.running())if(this.kernel.id===(null===(e=o.kernel)||void 0===e?void 0:e.id)){const{name:e,path:i,type:a}=o;n.push({className:"jp-mod-kernel-widget",context:this.kernel.id,open:()=>{s.execute(t,{name:e,path:i,type:a})},icon:()=>"console"===a?c.consoleIcon:"notebook"===a?c.notebookIcon:c.jupyterIcon,label:()=>e,labelTitle:()=>i})}return n}shutdown(){return this.kernels.shutdown(this.kernel.id)}icon(){return c.kernelIcon}label(){const{kernel:e}=this,n=e.id.split("-")[0];return m().createElement(m().Fragment,null,this._summary," ",m().createElement("span",{className:"jp-RunningSessions-item-label-kernel-id"},"(",n,")"))}labelTitle(){var e;const{trans:n}=this,{id:t}=this.kernel,s=[`${this._summary}: ${t}`];for(const t of this.sessions.running())if(this.kernel.id===(null===(e=t.kernel)||void 0===e?void 0:e.id)){const{path:e,type:o}=t;s.push(n.__("%1\nPath: %2",o,e))}return s.join("\n\n")}get _summary(){const e=this.children;return 0===e.length?this.trans.__("No sessions connected"):1==e.length?e[0].label():this.trans.__("%1 and %2 more",e[0].label(),e.length-1)}},e.runningChanged=new h.Signal({})}(_||(_={}));var b,w=t(65903);class f{constructor(e){this._tabsChanged=new h.Signal(this),this._widgets=[],this._labShell=e,this._labShell.layoutModified.connect(this._emitTabsChanged,this)}get tabsChanged(){return this._tabsChanged}addWidget(e){e.title.changed.connect(this._emitTabsChanged,this),this._widgets.push(e)}_emitTabsChanged(){this._widgets.forEach((e=>{e.title.changed.disconnect(this._emitTabsChanged,this)})),this._widgets=[],this._tabsChanged.emit(void 0)}}!function(e){e.kernelNewConsole="running:kernel-new-console",e.kernelNewNotebook="running:kernel-new-notebook",e.kernelOpenSession="running:kernel-open-session",e.kernelShutDown="running:kernel-shut-down",e.showPanel="running:show-panel",e.showModal="running:show-modal"}(b||(b={}));const k=[{id:"@jupyterlab/running-extension:plugin",description:"Provides the running session managers.",provides:i.IRunningSessionManagers,requires:[l.ITranslator],optional:[s.ILabShell],autoStart:!0,activate:(e,n,t)=>{const s=new i.RunningSessionManagers;return t&&function(e,n,t){const s=new f(t),o=n.load("jupyterlab");e.add({name:o.__("Open Tabs"),running:()=>Array.from(t.widgets("main")).map((e=>(s.addWidget(e),new i(e)))),shutdownAll:()=>{for(const e of t.widgets("main"))e.close()},refreshRunning:()=>{},runningChanged:s.tabsChanged,shutdownLabel:o.__("Close"),shutdownAllLabel:o.__("Close All"),shutdownAllConfirmationText:o.__("Are you sure you want to close all open tabs?")});class i{constructor(e){this._widget=e}open(){t.activateById(this._widget.id)}shutdown(){this._widget.close()}icon(){const e=this._widget.title.icon;return e instanceof c.LabIcon?e:c.fileIcon}label(){return this._widget.title.label}labelTitle(){let e;return e=this._widget instanceof w.DocumentWidget?this._widget.context.path:this._widget.title.label,e}}}(s,n,t),async function(e,n,t){const{commands:s,contextMenu:o,serviceManager:i}=t,{kernels:a,kernelspecs:r,sessions:l}=i,{runningChanged:h,RunningKernel:g}=_,m=new u.Throttler((()=>h.emit(void 0)),100),w=n.load("jupyterlab");a.runningChanged.connect((()=>{m.invoke()})),l.runningChanged.connect((()=>{m.invoke()})),await Promise.all([a.ready,r.ready,l.ready]),e.add({name:w.__("Kernels"),running:()=>{var e;const n=new Map;for(const t of a.running()){const o=null!==(e=n.get(t.name))&&void 0!==e?e:[];n.set(t.name,o),o.push(new g({commands:s,kernel:t,kernels:a,sessions:l,trans:w}))}return Array.from(n.entries()).map((([e,n])=>{var t;return new _.KernelSpecItem({name:e,kernels:n,spec:null===(t=r.specs)||void 0===t?void 0:t.kernelspecs[e],trans:w})}))},shutdownAll:()=>a.shutdownAll(),refreshRunning:()=>Promise.all([a.refreshRunning(),l.refreshRunning()]),runningChanged:h,shutdownLabel:w.__("Shut Down Kernel"),shutdownAllLabel:w.__("Shut Down All"),shutdownAllConfirmationText:w.__("Are you sure you want to permanently shut down all running kernels?")});const f=e=>e.classList.contains(p);s.addCommand(b.kernelNewConsole,{icon:c.consoleIcon,label:w.__("New Console for Kernel"),execute:e=>{var n;const o=t.contextMenuHitTest(f),i=null!==(n=e.id)&&void 0!==n?n:null==o?void 0:o.dataset.context;if(i)return s.execute("console:create",{kernelPreference:{id:i}})}}),s.addCommand(b.kernelNewNotebook,{icon:c.notebookIcon,label:w.__("New Notebook for Kernel"),execute:e=>{var n;const o=t.contextMenuHitTest(f),i=null!==(n=e.id)&&void 0!==n?n:null==o?void 0:o.dataset.context;if(i)return s.execute("notebook:create-new",{kernelId:i})}}),s.addCommand(b.kernelOpenSession,{icon:e=>"console"===e.type?c.consoleIcon:"notebook"===e.type?c.notebookIcon:void 0,isEnabled:({path:e,type:n})=>!!n||void 0!==e,label:({name:e,path:n})=>e||d.PathExt.basename(n||w.__("Unknown Session")),execute:({path:e,type:n})=>{if(!n||void 0===e)return;const t="console"===n?"console:open":"docmanager:open";return s.execute(t,{path:e})}}),s.addCommand(b.kernelShutDown,{icon:c.closeIcon,label:w.__("Shut Down Kernel"),execute:e=>{var n;const s=t.contextMenuHitTest(f),o=null!==(n=e.id)&&void 0!==n?n:null==s?void 0:s.dataset.context;if(o)return a.shutdown(o)}});const k=[];o.opened.connect((async()=>{var e,n,s;const i=null!==(n=null===(e=o.menu.items.find((e=>{var n;return"submenu"===e.type&&"jp-contextmenu-connected-sessions"===(null===(n=e.submenu)||void 0===n?void 0:n.id)})))||void 0===e?void 0:e.submenu)&&void 0!==n?n:null;if(!i)return;k.forEach((e=>e.dispose())),k.length=0,i.clearItems();const a=t.contextMenuHitTest(f),r=null==a?void 0:a.dataset.context;if(!r)return;const c=b.kernelOpenSession;for(const e of l.running())if(r===(null===(s=e.kernel)||void 0===s?void 0:s.id)){const{name:n,path:t,type:s}=e;k.push(i.addItem({command:c,args:{name:n,path:t,type:s}}))}}))}(s,n,e),s}},{id:"@jupyterlab/running-extension:sidebar",description:"Provides the running session sidebar.",provides:i.IRunningSessionSidebar,requires:[i.IRunningSessionManagers,l.ITranslator],optional:[s.ILayoutRestorer,r.IStateDB],autoStart:!0,activate:(e,n,t,s,o)=>{const a=t.load("jupyterlab"),r=new i.RunningSessions(n,t,o);return r.id="jp-running-sessions",r.title.caption=a.__("Running Terminals and Kernels"),r.title.icon=c.runningIcon,r.node.setAttribute("role","region"),r.node.setAttribute("aria-label",a.__("Running Sessions section")),s&&s.add(r,"running-sessions"),e.shell.add(r,"left",{rank:200,type:"Sessions and Tabs"}),e.commands.addCommand(b.showPanel,{label:a.__("Sessions and Tabs"),execute:()=>{e.shell.activateById(r.id)}}),r}},{id:"@jupyterlab/running-extension:recently-closed",description:"Adds recently closed documents list.",requires:[i.IRunningSessionManagers,a.IRecentsManager,l.ITranslator],autoStart:!0,activate:(e,n,t,s)=>{!function(e,n,t,s,o){const i=o.load("jupyterlab");e.add({name:i.__("Recently Closed"),running:()=>n.recentlyClosed.map((e=>new a(e))),shutdownAll:()=>{for(const e of n.recentlyClosed)n.removeRecent(e,"closed")},refreshRunning:()=>{},runningChanged:n.changed,shutdownLabel:i.__("Forget"),shutdownAllLabel:i.__("Forget All"),shutdownAllConfirmationText:i.__("Are you sure you want to clear recently closed tabs?")});class a{constructor(e){this._recent=e}async open(){const e=this._recent;await n.validate(e)&&(await t.execute("docmanager:open",{path:e.path,factory:e.factory}),n.removeRecent(e,"closed"))}shutdown(){n.removeRecent(this._recent,"closed")}icon(){if(!this._recent.factory)return c.fileIcon;const e=s.getFileTypesForPath(this._recent.path);for(const n of e){const e=n.icon;if(e instanceof c.LabIcon)return e}const n=s.getWidgetFactory(this._recent.factory);if(n)for(const e of n.fileTypes){const n=s.getFileType(e),t=null==n?void 0:n.icon;if(t instanceof c.LabIcon)return t}return c.fileIcon}label(){return d.PathExt.basename(this._recent.path)}labelTitle(){return this._recent.path}}}(n,t,e.commands,e.docRegistry,s)}},{id:"@jupyterlab/running-extension:search-tabs",description:"Adds a widget to search open and closed tabs.",requires:[i.IRunningSessionManagers,l.ITranslator],optional:[o.ICommandPalette,i.IRunningSessionSidebar],autoStart:!0,activate:(e,n,t,s,a)=>{const r=t.load("jupyterlab");if(e.commands.addCommand(b.showModal,{execute:()=>{const e=new i.SearchableSessions(n,t),s=new o.Dialog({title:r.__("Tabs and Running Sessions"),body:e,buttons:[o.Dialog.okButton({})],hasClose:!0});return s.addClass("jp-SearchableSessions-modal"),s.launch()},label:r.__("Search Tabs and Running Sessions")}),s&&s.addItem({command:b.showModal,category:r.__("Running")}),a){const n=new c.CommandToolbarButton({commands:e.commands,id:b.showModal,icon:c.launcherIcon,label:""});a.toolbar.addItem("open-as-modal",n)}}}]}}]);