"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6604,2088],{6604:(e,o,t)=>{t.r(o),t.d(o,{default:()=>T});var n,r=t(1292),i=t(46605),l=t(44196),a=t(26915),s=t(54230),d=t(87705),c=t(86072),u=t(39233),p=t(34340);!function(e){e.dismiss="tooltip:dismiss",e.launchConsole="tooltip:launch-console",e.launchNotebook="tooltip:launch-notebook",e.launchFile="tooltip:launch-file"}(n||(n={}));const m={id:"@jupyterlab/tooltip-extension:manager",autoStart:!0,optional:[c.ITranslator],provides:d.ITooltipManager,activate:(e,o)=>{const t=(null!=o?o:c.nullTranslator).load("jupyterlab");let r=null;return e.commands.addCommand(n.dismiss,{label:t.__("Dismiss the tooltip"),execute:()=>{r&&(r.dispose(),r=null)}}),{invoke(e){const{anchor:o,editor:t,kernel:n,rendermime:i}=e;return r&&(r.dispose(),r=null),b.fetch({detail:0,editor:t,kernel:n}).then((e=>{r=new d.Tooltip({anchor:o,bundle:e,editor:t,rendermime:i}),p.Widget.attach(r,document.body)})).catch((()=>{}))}}}},h={id:"@jupyterlab/tooltip-extension:consoles",autoStart:!0,optional:[c.ITranslator],requires:[d.ITooltipManager,r.IConsoleTracker],activate:(e,o,t,r)=>{const i=(null!=r?r:c.nullTranslator).load("jupyterlab");e.commands.addCommand(n.launchConsole,{label:i.__("Open the tooltip"),execute:()=>{var e,n;const r=t.currentWidget;if(!r)return;const i=r.console,l=null===(e=i.promptCell)||void 0===e?void 0:e.editor,a=null===(n=i.sessionContext.session)||void 0===n?void 0:n.kernel,s=i.rendermime;return l&&a&&s?o.invoke({anchor:i,editor:l,kernel:a,rendermime:s}):void 0}})}},v={id:"@jupyterlab/tooltip-extension:notebooks",autoStart:!0,optional:[c.ITranslator],requires:[d.ITooltipManager,a.INotebookTracker],activate:(e,o,t,r)=>{const i=(null!=r?r:c.nullTranslator).load("jupyterlab");e.commands.addCommand(n.launchNotebook,{label:i.__("Open the tooltip"),execute:()=>{var e,n;const r=t.currentWidget;if(!r)return;const i=r.content,l=null===(e=i.activeCell)||void 0===e?void 0:e.editor,a=null===(n=r.sessionContext.session)||void 0===n?void 0:n.kernel,s=i.rendermime;return l&&a&&s?o.invoke({anchor:i,editor:l,kernel:a,rendermime:s}):void 0}})}},k={id:"@jupyterlab/tooltip-extension:files",autoStart:!0,optional:[c.ITranslator],requires:[d.ITooltipManager,l.IEditorTracker,s.IRenderMimeRegistry],activate:(e,o,t,r,i)=>{const l=(null!=i?i:c.nullTranslator).load("jupyterlab"),a={},s=e.serviceManager.sessions,d=(e,o)=>{t.forEach((e=>{const t=(0,u.find)(o,(o=>e.context.path===o.path));if(t){const o=a[e.id];if(o&&o.id===t.id)return;o&&(delete a[e.id],o.dispose());const n=s.connectTo({model:t});a[e.id]=n}else{const o=a[e.id];o&&(o.dispose(),delete a[e.id])}}))};d(0,s.running()),s.runningChanged.connect(d),t.widgetAdded.connect(((e,o)=>{o.disposed.connect((e=>{const o=a[e.id];o&&(o.dispose(),delete a[e.id])}))})),e.commands.addCommand(n.launchFile,{label:l.__("Open the tooltip"),execute:async()=>{const e=t.currentWidget,n=e&&a[e.id]&&a[e.id].kernel;if(!n)return;const i=e.content,l=null==i?void 0:i.editor;return l&&n&&r?o.invoke({anchor:i,editor:l,kernel:n,rendermime:r}):void 0}})}},T=[m,h,v,k];var b;!function(e){let o=0;e.fetch=function(e){const{detail:t,editor:n,kernel:r}=e,l=n.model.sharedModel.getSource(),a=n.getCursorPosition(),s=i.Text.jsIndexToCharIndex(n.getOffsetAt(a),l);if(!l||!r)return Promise.reject(void 0);const d={code:l,cursor_pos:s,detail_level:t||0},c=++o;return r.requestInspect(d).then((e=>{const t=e.content;return c!==o?Promise.reject(void 0):"ok"===t.status&&t.found?Promise.resolve(t.data):Promise.reject(void 0)}))}}(b||(b={}))}}]);