notebook 7.2.1__py3-none-any.whl → 7.2.2__py3-none-any.whl

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.

Potentially problematic release.


This version of notebook might be problematic. Click here for more details.

Files changed (168) hide show
  1. notebook/_version.py +1 -1
  2. notebook/static/{6078.bundle.js → 1053.bundle.js} +1 -1
  3. notebook/static/113.bundle.js +1 -1
  4. notebook/static/1198.bundle.js +1 -1
  5. notebook/static/134.bundle.js +1 -1
  6. notebook/static/1408.bundle.js +1 -1
  7. notebook/static/1496.bundle.js +1 -1
  8. notebook/static/1647.bundle.js +1 -1
  9. notebook/static/1650.bundle.js +1 -1
  10. notebook/static/1684.bundle.js +1 -1
  11. notebook/static/1809.bundle.js +1 -1
  12. notebook/static/1827.bundle.js +1 -1
  13. notebook/static/1833.bundle.js +1 -1
  14. notebook/static/1846.bundle.js +1 -1
  15. notebook/static/1958.bundle.js +1 -1
  16. notebook/static/1962.bundle.js +1 -1
  17. notebook/static/2007.bundle.js +1 -1
  18. notebook/static/2088.bundle.js +1 -1
  19. notebook/static/2089.bundle.js +1 -1
  20. notebook/static/2122.bundle.js +1 -1
  21. notebook/static/2167.bundle.js +1 -1
  22. notebook/static/2184.bundle.js +1 -1
  23. notebook/static/2311.bundle.js +1 -1
  24. notebook/static/2401.bundle.js +1 -1
  25. notebook/static/2479.bundle.js +1 -1
  26. notebook/static/2489.bundle.js +1 -1
  27. notebook/static/2607.bundle.js +1 -1
  28. notebook/static/2615.bundle.js +1 -1
  29. notebook/static/2636.bundle.js +1 -1
  30. notebook/static/2924.bundle.js +1 -1
  31. notebook/static/2944.bundle.js +1 -1
  32. notebook/static/3129.bundle.js +1 -1
  33. notebook/static/3146.bundle.js +1 -1
  34. notebook/static/3187.bundle.js +1 -1
  35. notebook/static/3213.bundle.js +1 -1
  36. notebook/static/3340.bundle.js +1 -1
  37. notebook/static/3360.bundle.js +1 -1
  38. notebook/static/3466.bundle.js +1 -1
  39. notebook/static/3512.bundle.js +1 -1
  40. notebook/static/3676.bundle.js +1 -1
  41. notebook/static/3680.bundle.js +1 -1
  42. notebook/static/374.bundle.js +1 -1
  43. notebook/static/3768.bundle.js +1 -1
  44. notebook/static/377.bundle.js +1 -1
  45. notebook/static/3863.bundle.js +1 -1
  46. notebook/static/3881.bundle.js +1 -1
  47. notebook/static/4042.bundle.js +1 -1
  48. notebook/static/4212.bundle.js +1 -1
  49. notebook/static/4382.bundle.js +1 -1
  50. notebook/static/4630.bundle.js +1 -1
  51. notebook/static/4645.bundle.js +1 -1
  52. notebook/static/4811.bundle.js +1 -1
  53. notebook/static/4837.bundle.js +1 -1
  54. notebook/static/5099.bundle.js +1 -1
  55. notebook/static/5135.bundle.js +1 -1
  56. notebook/static/5254.bundle.js +1 -1
  57. notebook/static/5263.bundle.js +1 -1
  58. notebook/static/5313.bundle.js +1 -1
  59. notebook/static/5325.bundle.js +1 -1
  60. notebook/static/5346.bundle.js +1 -1
  61. notebook/static/5425.bundle.js +1 -1
  62. notebook/static/5426.bundle.js +1 -1
  63. notebook/static/545.bundle.js +1 -1
  64. notebook/static/5573.bundle.js +1 -1
  65. notebook/static/5601.bundle.js +1 -1
  66. notebook/static/5733.bundle.js +1 -1
  67. notebook/static/5912.bundle.js +1 -1
  68. notebook/static/5921.bundle.js +1 -1
  69. notebook/static/6017.bundle.js +1 -1
  70. notebook/static/6139.bundle.js +1 -1
  71. notebook/static/62.bundle.js +1 -1
  72. notebook/static/6281.bundle.js +1 -1
  73. notebook/static/6345.bundle.js +1 -1
  74. notebook/static/{2756.bundle.js → 6593.bundle.js} +1 -1
  75. notebook/static/6604.bundle.js +1 -1
  76. notebook/static/6621.bundle.js +1 -1
  77. notebook/static/6627.bundle.js +1 -1
  78. notebook/static/6748.bundle.js +1 -1
  79. notebook/static/6815.bundle.js +1 -1
  80. notebook/static/6853.bundle.js +1 -1
  81. notebook/static/6893.bundle.js +1 -1
  82. notebook/static/690.bundle.js +1 -1
  83. notebook/static/6962.bundle.js +1 -1
  84. notebook/static/6999.bundle.js +1 -1
  85. notebook/static/7226.bundle.js +1 -1
  86. notebook/static/7252.bundle.js +1 -1
  87. notebook/static/7259.bundle.js +1 -1
  88. notebook/static/7302.bundle.js +1 -1
  89. notebook/static/7386.bundle.js +1 -1
  90. notebook/static/7391.bundle.js +1 -1
  91. notebook/static/7506.bundle.js +2 -2
  92. notebook/static/7543.bundle.js +1 -1
  93. notebook/static/7603.bundle.js +1 -1
  94. notebook/static/7639.bundle.js +1 -1
  95. notebook/static/7655.bundle.js +1 -1
  96. notebook/static/7684.bundle.js +1 -1
  97. notebook/static/7812.bundle.js +1 -1
  98. notebook/static/7819.bundle.js +1 -1
  99. notebook/static/7854.bundle.js +1 -1
  100. notebook/static/7900.bundle.js +1 -1
  101. notebook/static/7906.bundle.js +1 -1
  102. notebook/static/8471.bundle.js +1 -1
  103. notebook/static/8579.bundle.js +1 -1
  104. notebook/static/8633.bundle.js +1 -1
  105. notebook/static/8771.bundle.js +1 -1
  106. notebook/static/8781.bundle.js +1 -1
  107. notebook/static/8845.bundle.js +1 -1
  108. notebook/static/8875.bundle.js +1 -1
  109. notebook/static/8907.bundle.js +1 -1
  110. notebook/static/8928.bundle.js +1 -1
  111. notebook/static/893.bundle.js +1 -1
  112. notebook/static/901.bundle.js +1 -1
  113. notebook/static/9068.bundle.js +1 -1
  114. notebook/static/9136.bundle.js +1 -1
  115. notebook/static/9151.bundle.js +1 -1
  116. notebook/static/9161.bundle.js +1 -1
  117. notebook/static/9268.bundle.js +1 -1
  118. notebook/static/9335.bundle.js +1 -1
  119. notebook/static/9341.bundle.js +1 -1
  120. notebook/static/9380.bundle.js +1 -1
  121. notebook/static/9605.bundle.js +1 -1
  122. notebook/static/9638.bundle.js +1 -1
  123. notebook/static/9680.bundle.js +1 -1
  124. notebook/static/9685.bundle.js +1 -1
  125. notebook/static/9752.bundle.js +1 -1
  126. notebook/static/9821.bundle.js +1 -1
  127. notebook/static/9852.bundle.js +1 -1
  128. notebook/static/bundle.js +1 -1
  129. notebook/static/third-party-licenses.json +101 -101
  130. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/package.json.orig +14 -14
  131. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/documentsearch-extension/package.json.orig +4 -4
  132. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/package.json.orig +6 -6
  133. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/package.json.orig +9 -9
  134. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/package.json.orig +15 -15
  135. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/package.json +11 -11
  136. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/package.json.orig +10 -10
  137. notebook-7.2.1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/678.af323c3ff765541c6aa4.js → notebook-7.2.2.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/42.33f638f0a4239bed9676.js +1 -1
  138. notebook-7.2.1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.9cd06af416befd593828.js → notebook-7.2.2.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.3dd58d88e32a98358776.js +1 -1
  139. notebook-7.2.2.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.bf5955f09ff1e05edfbb.js +1 -0
  140. notebook-7.2.2.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.04dfa589925e7e7c6a3d.js +1 -0
  141. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/third-party-licenses.json +2 -2
  142. {notebook-7.2.1.dist-info → notebook-7.2.2.dist-info}/METADATA +1 -1
  143. {notebook-7.2.1.dist-info → notebook-7.2.2.dist-info}/RECORD +166 -166
  144. {notebook-7.2.1.dist-info → notebook-7.2.2.dist-info}/WHEEL +1 -1
  145. notebook-7.2.1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.6d26fccf0ddab13bf5bb.js +0 -1
  146. notebook-7.2.1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.d04be841d48ffe2a9bdd.js +0 -1
  147. {notebook-7.2.1.data → notebook-7.2.2.data}/data/etc/jupyter/jupyter_server_config.d/notebook.json +0 -0
  148. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/applications/jupyter-notebook.desktop +0 -0
  149. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/icons/hicolor/scalable/apps/notebook.svg +0 -0
  150. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/menus.json +0 -0
  151. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/pages.json +0 -0
  152. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/shell.json +0 -0
  153. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/title.json +0 -0
  154. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/top.json +0 -0
  155. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/zen.json +0 -0
  156. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/open.json +0 -0
  157. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/checkpoints.json +0 -0
  158. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/edit-notebook-metadata.json +0 -0
  159. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/kernel-logo.json +0 -0
  160. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/scroll-output.json +0 -0
  161. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +0 -0
  162. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/widget.json +0 -0
  163. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/interface-switcher.json +0 -0
  164. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/launch-tree.json +0 -0
  165. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/93.eae3497dd223d842d198.js +0 -0
  166. {notebook-7.2.1.data → notebook-7.2.2.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/style.js +0 -0
  167. {notebook-7.2.1.dist-info → notebook-7.2.2.dist-info}/entry_points.txt +0 -0
  168. {notebook-7.2.1.dist-info → notebook-7.2.2.dist-info}/licenses/LICENSE +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7543],{37543:(e,t,s)=>{s.r(t),s.d(t,{DocumentManager:()=>M,DocumentWidgetManager:()=>x,IDocumentManager:()=>A,IDocumentWidgetOpener:()=>E,IRecentsManager:()=>I,PathStatus:()=>F,RecentsManager:()=>N,SaveHandler:()=>f,SavingStatus:()=>W,isValidFileName:()=>d,renameDialog:()=>c,renameFile:()=>l,shouldOverwrite:()=>h});var n,i=s(53312),a=s(68722),o=s(12030),r=s(63485);function c(e,t,s){const n=(s=s||o.nullTranslator).load("jupyterlab"),a=t.localPath.split("/").pop()||t.localPath;return(0,i.showDialog)({title:n.__("Rename File"),body:new g(a),focusNodeSelector:"input",buttons:[i.Dialog.cancelButton(),i.Dialog.okButton({label:n.__("Rename"),ariaLabel:n.__("Rename File")})]}).then((e=>e.value?d(e.value)?t.rename(e.value):((0,i.showErrorMessage)(n.__("Rename Error"),Error(n.__('"%1" is not a valid name for a file. Names must have nonzero length, and cannot include "/", "\\", or ":"',e.value))),null):null))}function l(e,t,s){return e.rename(t,s).catch((n=>{if(409!==n.response.status)throw n;return h(s).then((n=>n?e.overwrite(t,s):Promise.reject("File not renamed")))}))}function h(e,t){const s=(t=t||o.nullTranslator).load("jupyterlab"),n={title:s.__("Overwrite file?"),body:s.__('"%1" already exists, overwrite?',e),buttons:[i.Dialog.cancelButton(),i.Dialog.warnButton({label:s.__("Overwrite"),ariaLabel:s.__("Overwrite Existing File")})]};return(0,i.showDialog)(n).then((e=>Promise.resolve(e.button.accept)))}function d(e){return e.length>0&&!/[\/\\:]/.test(e)}class g extends r.Widget{constructor(e){super({node:n.createRenameNode(e)}),this.addClass("jp-FileDialog");const t=a.PathExt.extname(e),s=this.inputNode.value=a.PathExt.basename(e);this.inputNode.setSelectionRange(0,s.length-t.length)}get inputNode(){return this.node.getElementsByTagName("input")[0]}getValue(){return this.inputNode.value}}!function(e){e.createRenameNode=function(e,t){const s=(t=t||o.nullTranslator).load("jupyterlab"),n=document.createElement("div"),i=document.createElement("label");i.textContent=s.__("File Path");const a=document.createElement("span");a.textContent=e;const r=document.createElement("label");r.textContent=s.__("New Name"),r.className="jp-new-name-title";const c=document.createElement("input");return n.appendChild(i),n.appendChild(a),n.appendChild(r),n.appendChild(c),n}}(n||(n={}));var _=s(65903),u=s(33625),m=s(20998),p=s(14421),v=s(81997);class f{constructor(e){this._autosaveTimer=-1,this._minInterval=-1,this._interval=-1,this._isActive=!1,this._inDialog=!1,this._isDisposed=!1,this._multiplier=10,this._context=e.context,this._isConnectedCallback=e.isConnectedCallback||(()=>!0);const t=e.saveInterval||120;this._minInterval=1e3*t,this._interval=this._minInterval,this._context.fileChanged.connect(this._setTimer,this),this._context.disposed.connect(this.dispose,this)}get saveInterval(){return this._interval/1e3}set saveInterval(e){this._minInterval=this._interval=1e3*e,this._isActive&&this._setTimer()}get isActive(){return this._isActive}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,clearTimeout(this._autosaveTimer),v.Signal.clearData(this))}start(){this._isActive=!0,this._setTimer()}stop(){this._isActive=!1,clearTimeout(this._autosaveTimer)}_setTimer(){clearTimeout(this._autosaveTimer),this._isActive&&(this._autosaveTimer=window.setTimeout((()=>{this._isConnectedCallback()&&this._save()}),this._interval))}_save(){const e=this._context;if(this._setTimer(),!e)return;if(!e.contentsModel||!e.contentsModel.writable||!e.model.dirty||this._inDialog)return;const t=(new Date).getTime();e.save().then((()=>{if(this.isDisposed)return;const e=(new Date).getTime()-t;this._interval=Math.max(this._multiplier*e,this._minInterval),this._setTimer()})).catch((e=>{const{name:t}=e;"ModalCancelError"!==t&&"ModalDuplicateError"!==t&&console.error("Error in Auto-Save",e.message)}))}}var w,y,C=s(2549),D=s(49503);class x{constructor(e){this._activateRequested=new v.Signal(this),this._confirmClosingTab=!1,this._isDisposed=!1,this._stateChanged=new v.Signal(this),this._registry=e.registry,this.translator=e.translator||o.nullTranslator,this._recentsManager=e.recentsManager||null}get activateRequested(){return this._activateRequested}get confirmClosingDocument(){return this._confirmClosingTab}set confirmClosingDocument(e){if(this._confirmClosingTab!==e){const t=this._confirmClosingTab;this._confirmClosingTab=e,this._stateChanged.emit({name:"confirmClosingDocument",oldValue:t,newValue:e})}}get stateChanged(){return this._stateChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,v.Signal.disconnectReceiver(this))}createWidget(e,t){const s=e.createNew(t);return this._initializeWidget(s,e,t),s}_initializeWidget(e,t,s){w.factoryProperty.set(e,t);const n=new C.DisposableSet;for(const i of this._registry.widgetExtensions(t.name)){const t=i.createNew(e,s);t&&n.add(t)}w.disposablesProperty.set(e,n),e.disposed.connect(this._onWidgetDisposed,this),this.adoptWidget(s,e),s.fileChanged.connect(this._onFileChanged,this),s.pathChanged.connect(this._onPathChanged,this),s.ready.then((()=>{this.setCaption(e)}))}adoptWidget(e,t){w.widgetsProperty.get(e).push(t),D.MessageLoop.installMessageHook(t,this),t.addClass("jp-Document"),t.title.closable=!0,t.disposed.connect(this._widgetDisposed,this),w.contextProperty.set(t,e)}findWidget(e,t){const s=w.widgetsProperty.get(e);if(s)return(0,u.find)(s,(e=>{const s=w.factoryProperty.get(e);return!!s&&s.name===t}))}contextForWidget(e){return w.contextProperty.get(e)}cloneWidget(e){const t=w.contextProperty.get(e);if(!t)return;const s=w.factoryProperty.get(e);if(!s)return;const n=s.createNew(t,e);return this._initializeWidget(n,s,t),n}closeWidgets(e){const t=w.widgetsProperty.get(e);return Promise.all(t.map((e=>this.onClose(e)))).then((()=>{}))}deleteWidgets(e){const t=w.widgetsProperty.get(e);return Promise.all(t.map((e=>this.onDelete(e)))).then((()=>{}))}messageHook(e,t){switch(t.type){case"close-request":return this.onClose(e),!1;case"activate-request":{const t=e,s=this.contextForWidget(t);s&&(s.ready.then((()=>{this._recordAsRecentlyOpened(t,s.contentsModel)})).catch((()=>{console.warn("Could not record the recents status for",s)})),this._activateRequested.emit(s.path));break}}return!0}async setCaption(e){const t=this.translator.load("jupyterlab"),s=w.contextProperty.get(e);if(!s)return;const n=s.contentsModel;if(n)return s.listCheckpoints().then((i=>{if(e.isDisposed)return;const o=i[i.length-1],r=o?a.Time.format(o.last_modified):"None";let c=t.__("Name: %1\nPath: %2\n",n.name,n.path);s.model.readOnly?c+=t.__("Read-only"):c+=t.__("Last Saved: %1\n",a.Time.format(n.last_modified))+t.__("Last Checkpoint: %1",r),e.title.caption=c}));e.title.caption=""}async onClose(e){var t;const[s,n]=await this._maybeClose(e,this.translator);if(e.isDisposed)return!0;if(s){const s=w.contextProperty.get(e);if(!n){if(!s)return!0;(null===(t=s.contentsModel)||void 0===t?void 0:t.writable)?await s.save():await s.saveAs()}if(s&&("timeout"===await Promise.race([s.ready,new Promise((e=>setTimeout(e,3e3,"timeout")))])?console.warn("Could not record the widget as recently closed because the context did not become ready in 3 seconds"):this._recordAsRecentlyClosed(e,s.contentsModel)),e.isDisposed)return!0;e.dispose()}return s}onDelete(e){return e.dispose(),Promise.resolve(void 0)}_recordAsRecentlyOpened(e,t){var s;const n=this._recentsManager;if(!n)return;const i=t.path,a=this._registry.getFileTypeForModel(t).contentType,o=null===(s=w.factoryProperty.get(e))||void 0===s?void 0:s.name;if(n.addRecent({path:i,contentType:a,factory:o},"opened"),"directory"!==a){const e=i.lastIndexOf("/")>0?i.slice(0,i.lastIndexOf("/")):"";n.addRecent({path:e,contentType:"directory"},"opened")}}_recordAsRecentlyClosed(e,t){var s;const n=this._recentsManager;if(!n)return;const i=t.path,a=this._registry.getFileTypeForModel(t).contentType,o=null===(s=w.factoryProperty.get(e))||void 0===s?void 0:s.name;n.addRecent({path:i,contentType:a,factory:o},"closed")}async _maybeClose(e,t){var s,n;const a=(t=t||o.nullTranslator).load("jupyterlab"),r=w.contextProperty.get(e);if(!r)return Promise.resolve([!0,!0]);let c=w.widgetsProperty.get(r);if(!c)return Promise.resolve([!0,!0]);c=c.filter((e=>{const t=w.factoryProperty.get(e);return!!t&&!1===t.readOnly}));const l=e.title.label,h=w.factoryProperty.get(e),d=r.model.dirty&&c.length<=1&&!(null===(s=null==h?void 0:h.readOnly)||void 0===s||s);if(this.confirmClosingDocument){const e=[i.Dialog.cancelButton(),i.Dialog.okButton({label:d?a.__("Close and save"):a.__("Close"),ariaLabel:d?a.__("Close and save Document"):a.__("Close Document")})];d&&e.splice(1,0,i.Dialog.warnButton({label:a.__("Close without saving"),ariaLabel:a.__("Close Document without saving")}));const t=await(0,i.showDialog)({title:a.__("Confirmation"),body:a.__('Please confirm you want to close "%1".',l),checkbox:d?null:{label:a.__("Do not ask me again."),caption:a.__("If checked, no confirmation to close a document will be asked in the future.")},buttons:e});return t.isChecked&&(this.confirmClosingDocument=!1),Promise.resolve([t.button.accept,!d||"warn"===t.button.displayType])}{if(!d)return Promise.resolve([!0,!0]);const e=(null===(n=r.contentsModel)||void 0===n?void 0:n.writable)?a.__("Save"):a.__("Save as"),t=await(0,i.showDialog)({title:a.__("Save your work"),body:a.__('Save changes in "%1" before closing?',l),buttons:[i.Dialog.cancelButton(),i.Dialog.warnButton({label:a.__("Discard"),ariaLabel:a.__("Discard changes to file")}),i.Dialog.okButton({label:e})]});return[t.button.accept,"warn"===t.button.displayType]}}_widgetDisposed(e){const t=w.contextProperty.get(e);if(!t)return;const s=w.widgetsProperty.get(t);s&&(u.ArrayExt.removeFirstOf(s,e),s.length||t.dispose())}_onWidgetDisposed(e){w.disposablesProperty.get(e).dispose()}_onFileChanged(e){const t=w.widgetsProperty.get(e);for(const e of t)this.setCaption(e)}_onPathChanged(e){const t=w.widgetsProperty.get(e);for(const e of t)this.setCaption(e)}}!function(e){e.contextProperty=new p.AttachedProperty({name:"context",create:()=>{}}),e.factoryProperty=new p.AttachedProperty({name:"factory",create:()=>{}}),e.widgetsProperty=new p.AttachedProperty({name:"widgets",create:()=>[]}),e.disposablesProperty=new p.AttachedProperty({name:"disposables",create:()=>new C.DisposableSet})}(w||(w={}));class M{constructor(e){var t;this._activateRequested=new v.Signal(this),this._contexts=[],this._isDisposed=!1,this._autosave=!0,this._autosaveInterval=120,this._lastModifiedCheckMargin=500,this._renameUntitledFileOnSave=!0,this._stateChanged=new v.Signal(this),this.translator=e.translator||o.nullTranslator,this.registry=e.registry,this.services=e.manager,this._dialogs=null!==(t=e.sessionDialogs)&&void 0!==t?t:new i.SessionContextDialogs({translator:e.translator}),this._isConnectedCallback=e.isConnectedCallback||(()=>!0),this._opener=e.opener,this._when=e.when||e.manager.ready;const s=new x({registry:this.registry,translator:this.translator,recentsManager:e.recentsManager});s.activateRequested.connect(this._onActivateRequested,this),s.stateChanged.connect(this._onWidgetStateChanged,this),this._widgetManager=s,this._setBusy=e.setBusy}get activateRequested(){return this._activateRequested}get autosave(){return this._autosave}set autosave(e){if(this._autosave!==e){const t=this._autosave;this._autosave=e,this._contexts.forEach((t=>{const s=y.saveHandlerProperty.get(t);s&&(!0!==e||s.isActive?!1===e&&s.isActive&&s.stop():s.start())})),this._stateChanged.emit({name:"autosave",oldValue:t,newValue:e})}}get autosaveInterval(){return this._autosaveInterval}set autosaveInterval(e){if(this._autosaveInterval!==e){const t=this._autosaveInterval;this._autosaveInterval=e,this._contexts.forEach((t=>{const s=y.saveHandlerProperty.get(t);s&&(s.saveInterval=e||120)})),this._stateChanged.emit({name:"autosaveInterval",oldValue:t,newValue:e})}}get confirmClosingDocument(){return this._widgetManager.confirmClosingDocument}set confirmClosingDocument(e){if(this._widgetManager.confirmClosingDocument!==e){const t=this._widgetManager.confirmClosingDocument;this._widgetManager.confirmClosingDocument=e,this._stateChanged.emit({name:"confirmClosingDocument",oldValue:t,newValue:e})}}get lastModifiedCheckMargin(){return this._lastModifiedCheckMargin}set lastModifiedCheckMargin(e){if(this._lastModifiedCheckMargin!==e){const t=this._lastModifiedCheckMargin;this._lastModifiedCheckMargin=e,this._contexts.forEach((t=>{t.lastModifiedCheckMargin=e})),this._stateChanged.emit({name:"lastModifiedCheckMargin",oldValue:t,newValue:e})}}get renameUntitledFileOnSave(){return this._renameUntitledFileOnSave}set renameUntitledFileOnSave(e){if(this._renameUntitledFileOnSave!==e){const t=this._renameUntitledFileOnSave;this._renameUntitledFileOnSave=e,this._stateChanged.emit({name:"renameUntitledFileOnSave",oldValue:t,newValue:e})}}get stateChanged(){return this._stateChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,v.Signal.clearData(this),this._contexts.forEach((e=>this._widgetManager.closeWidgets(e))),this._widgetManager.dispose(),this._contexts.length=0)}cloneWidget(e){return this._widgetManager.cloneWidget(e)}closeAll(){return Promise.all(this._contexts.map((e=>this._widgetManager.closeWidgets(e)))).then((()=>{}))}closeFile(e){const t=this._contextsForPath(e).map((e=>this._widgetManager.closeWidgets(e)));return Promise.all(t).then((e=>{}))}contextForWidget(e){return this._widgetManager.contextForWidget(e)}copy(e,t){return this.services.contents.copy(e,t)}createNew(e,t="default",s){return this._createOrOpenDocument("create",e,t,s)}deleteFile(e){return this.services.sessions.stopIfNeeded(e).then((()=>this.services.contents.delete(e))).then((()=>(this._contextsForPath(e).forEach((e=>this._widgetManager.deleteWidgets(e))),Promise.resolve(void 0))))}duplicate(e){const t=a.PathExt.dirname(e);return this.services.contents.copy(e,t)}findWidget(e,t="default"){const s=a.PathExt.normalize(e);let n=[t];if("default"===t){const e=this.registry.defaultWidgetFactory(s);if(!e)return;n=[e.name]}else null===t&&(n=this.registry.preferredWidgetFactories(s).map((e=>e.name)));for(const e of this._contextsForPath(s))for(const t of n)if(null!==t){const s=this._widgetManager.findWidget(e,t);if(s)return s}}newUntitled(e){return"file"===e.type&&(e.ext=e.ext||".txt"),this.services.contents.newUntitled(e)}open(e,t="default",s,n){return this._createOrOpenDocument("open",e,t,s,n)}openOrReveal(e,t="default",s,n){const i=this.findWidget(e,t);return i?(this._opener.open(i,{type:t,...n}),i):this.open(e,t,s,null!=n?n:{})}overwrite(e,t){const s=`${t}.${m.UUID.uuid4()}`,n=()=>this.rename(s,t);return this.rename(e,s).then((()=>this.deleteFile(t))).then(n,n)}rename(e,t){return this.services.contents.rename(e,t)}_findContext(e,t){const s=this.services.contents.normalize(e);return(0,u.find)(this._contexts,(e=>e.path===s&&e.factoryName===t))}_contextsForPath(e){const t=this.services.contents.normalize(e);return this._contexts.filter((e=>e.path===t))}_createContext(e,t,s){const n=new _.Context({opener:(e,t)=>{this._widgetManager.adoptWidget(n,e),this._opener.open(e,t)},manager:this.services,factory:t,path:e,kernelPreference:s,setBusy:this._setBusy,sessionDialogs:this._dialogs,lastModifiedCheckMargin:this._lastModifiedCheckMargin,translator:this.translator}),i=new f({context:n,isConnectedCallback:this._isConnectedCallback,saveInterval:this.autosaveInterval});return y.saveHandlerProperty.set(n,i),n.ready.then((()=>{this.autosave&&i.start()})),n.disposed.connect(this._onContextDisposed,this),this._contexts.push(n),n}_onContextDisposed(e){u.ArrayExt.removeFirstOf(this._contexts,e)}_widgetFactoryFor(e,t){const{registry:s}=this;if("default"===t){const n=s.defaultWidgetFactory(e);if(!n)return;t=n.name}return s.getWidgetFactory(t)}_createOrOpenDocument(e,t,s="default",n,i){const a=this._widgetFactoryFor(t,s);if(!a)return;const o=a.modelName||"text",r=this.registry.getModelFactory(o);if(!r)return;const c=this.registry.getKernelPreference(t,a.name,n);let l,h=Promise.resolve(void 0);if("open"===e)l=this._findContext(t,r.name)||null,l||(l=this._createContext(t,r,c),h=this._when.then((()=>l.initialize(!1))));else{if("create"!==e)throw new Error(`Invalid argument 'which': ${e}`);l=this._createContext(t,r,c),h=this._when.then((()=>l.initialize(!0)))}const d=this._widgetManager.createWidget(a,l);return this._opener.open(d,{type:a.name,...i}),h.catch((e=>{console.error(`Failed to initialize the context with '${r.name}' for ${t}`,e),d.close()})),d}_onActivateRequested(e,t){this._activateRequested.emit(t)}_onWidgetStateChanged(e,t){"confirmClosingDocument"===t.name&&this._stateChanged.emit(t)}}!function(e){e.saveHandlerProperty=new p.AttachedProperty({name:"saveHandler",create:()=>{}})}(y||(y={}));var P=s(71098),b=s(35613),R=s(78156),S=s.n(R);function T(e){return S().createElement(P.TextItem,{source:e.name,title:e.fullPath})}class F extends b.VDomRenderer{constructor(e){super(new F.Model(e.docManager)),this.node.title=this.model.path}render(){return S().createElement(T,{fullPath:this.model.path,name:this.model.name})}}function k(e){return S().createElement(P.TextItem,{source:e.fileStatus})}!function(e){class t extends b.VDomModel{constructor(e){super(),this._onTitleChange=e=>{const t=this._getAllState();this._name=e.label,this._triggerChange(t,this._getAllState())},this._onPathChange=(e,t)=>{const s=this._getAllState();this._path=t,this._name=a.PathExt.basename(t),this._triggerChange(s,this._getAllState())},this._path="",this._name="",this._widget=null,this._docManager=e}get path(){return this._path}get name(){return this._name}get widget(){return this._widget}set widget(e){const t=this._widget;if(null!==t){const e=this._docManager.contextForWidget(t);e?e.pathChanged.disconnect(this._onPathChange):t.title.changed.disconnect(this._onTitleChange)}const s=this._getAllState();if(this._widget=e,null===this._widget)this._path="",this._name="";else{const e=this._docManager.contextForWidget(this._widget);e?(this._path=e.path,this._name=a.PathExt.basename(e.path),e.pathChanged.connect(this._onPathChange)):(this._path="",this._name=this._widget.title.label,this._widget.title.changed.connect(this._onTitleChange))}this._triggerChange(s,this._getAllState())}_getAllState(){return[this._path,this._name]}_triggerChange(e,t){e[0]===t[0]&&e[1]===t[1]||this.stateChanged.emit(void 0)}}e.Model=t}(F||(F={}));class W extends b.VDomRenderer{constructor(e){super(new W.Model(e.docManager));const t=(e.translator||o.nullTranslator).load("jupyterlab");this._statusMap={completed:t.__("Saving completed"),started:t.__("Saving started"),failed:t.__("Saving failed")}}render(){return null===this.model||null===this.model.status?null:S().createElement(k,{fileStatus:this._statusMap[this.model.status]})}}!function(e){class t extends b.VDomModel{constructor(e){super(),this._onStatusChange=(e,t)=>{this._status=t,"completed"===this._status?(setTimeout((()=>{this._status=null,this.stateChanged.emit(void 0)}),2e3),this.stateChanged.emit(void 0)):this.stateChanged.emit(void 0)},this._status=null,this._widget=null,this._status=null,this.widget=null,this._docManager=e}get status(){return this._status}get widget(){return this._widget}set widget(e){var t,s;const n=this._widget;if(null!==n){const e=this._docManager.contextForWidget(n);e?e.saveState.disconnect(this._onStatusChange):(null===(t=this._widget.content)||void 0===t?void 0:t.saveStateChanged)&&this._widget.content.saveStateChanged.disconnect(this._onStatusChange)}if(this._widget=e,null===this._widget)this._status=null;else{const e=this._docManager.contextForWidget(this._widget);e?e.saveState.connect(this._onStatusChange):(null===(s=this._widget.content)||void 0===s?void 0:s.saveStateChanged)&&this._widget.content.saveStateChanged.connect(this._onStatusChange)}}}e.Model=t}(W||(W={}));const A=new m.Token("@jupyterlab/docmanager:IDocumentManager","A service for the manager for all\n documents used by the application. Use this if you want to open and close documents,\n create and delete files, and otherwise interact with the file system."),E=new m.Token("@jupyterlab/docmanager:IDocumentWidgetOpener","A service to open a widget."),I=new m.Token("@jupyterlab/docmanager:IRecentsManager","A service providing information about recently opened and closed documents");var O,B=s(97934);class N{constructor(e){this._recentsChanged=new v.Signal(this),this._recents={opened:[],closed:[]},this._isDisposed=!1,this._maxRecentsLength=10,this._saveDebouncer=new B.Debouncer(this._save.bind(this),500),this._stateDB=e.stateDB,this._contentsManager=e.contents,this.updateRootDir(),this._loadRecents().catch((e=>{console.error(`Failed to load recent list from state:\n${e}`)}))}get isDisposed(){return this._isDisposed}get recentlyOpened(){return(this._recents.opened||[]).filter((e=>e.root===this._serverRoot))}get recentlyClosed(){return(this._recents.closed||[]).filter((e=>e.root===this._serverRoot))}get changed(){return this._recentsChanged}get maximalRecentsLength(){return this._maxRecentsLength}set maximalRecentsLength(e){this._maxRecentsLength=Math.round(Math.max(1,e));let t=!1;for(const e of["opened","closed"])this._recents[e].length>this._maxRecentsLength&&(this._recents[e].length=this._maxRecentsLength,t=!0);t&&this._recentsChanged.emit(void 0)}dispose(){this.isDisposed||(this._isDisposed=!0,v.Signal.clearData(this),this._saveDebouncer.dispose())}addRecent(e,t){const s={...e,root:this._serverRoot},n=this._recents[t],i=n.findIndex((t=>t.path===e.path));i>=0&&n.splice(i,1),n.unshift(s),this._setRecents(n,t),this._recentsChanged.emit(void 0)}clearRecents(){this._setRecents([],"opened"),this._setRecents([],"closed"),this._recentsChanged.emit(void 0)}removeRecent(e,t){this._removeRecent(e.path,[t])}async validate(e){const t=await this._isValid(e);return t||this._removeRecent(e.path),t}updateRootDir(){this._serverRoot=a.PageConfig.getOption("serverRoot")}_removeRecent(e,t=["opened","closed"]){let s=!1;for(const n of t){const t=this._recents[n],i=t.filter((t=>e!==t.path));t.length!==i.length&&(this._setRecents(i,n),s=!0)}s&&this._recentsChanged.emit(void 0)}async _isValid(e){var t;try{await this._contentsManager.get(e.path,{content:!1})}catch(e){if(404===(null===(t=e.response)||void 0===t?void 0:t.status))return!1}return!0}_setRecents(e,t){this._recents[t]=e.slice(0,this.maximalRecentsLength).sort(((e,t)=>e.root===t.root?0:e.root!==this._serverRoot?1:-1)),this._saveDebouncer.invoke().catch(console.warn)}async _loadRecents(){const e=await this._stateDB.fetch(O.stateDBKey)||{opened:[],closed:[]},t=[...e.opened,...e.closed],s=new Set(await this._getInvalidPaths(t));for(const t of["opened","closed"])this._setRecents(e[t].filter((e=>!s.has(e.path))),t);this._recentsChanged.emit(void 0)}async _getInvalidPaths(e){return(await Promise.all(e.map((async e=>await this._isValid(e)?null:e.path)))).filter((e=>"string"==typeof e))}async _save(){try{await this._stateDB.save(O.stateDBKey,this._recents)}catch(e){console.log("Saving recents failed",e)}}}!function(e){e.stateDBKey="docmanager:recents"}(O||(O={}))}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7543],{37543:(e,t,s)=>{s.r(t),s.d(t,{DocumentManager:()=>M,DocumentWidgetManager:()=>x,IDocumentManager:()=>A,IDocumentWidgetOpener:()=>E,IRecentsManager:()=>I,PathStatus:()=>F,RecentsManager:()=>N,SaveHandler:()=>f,SavingStatus:()=>W,isValidFileName:()=>d,renameDialog:()=>c,renameFile:()=>l,shouldOverwrite:()=>h});var n,i=s(20005),a=s(64145),o=s(90646),r=s(63485);function c(e,t,s){const n=(s=s||o.nullTranslator).load("jupyterlab"),a=t.localPath.split("/").pop()||t.localPath;return(0,i.showDialog)({title:n.__("Rename File"),body:new g(a),focusNodeSelector:"input",buttons:[i.Dialog.cancelButton(),i.Dialog.okButton({label:n.__("Rename"),ariaLabel:n.__("Rename File")})]}).then((e=>e.value?d(e.value)?t.rename(e.value):((0,i.showErrorMessage)(n.__("Rename Error"),Error(n.__('"%1" is not a valid name for a file. Names must have nonzero length, and cannot include "/", "\\", or ":"',e.value))),null):null))}function l(e,t,s){return e.rename(t,s).catch((n=>{if(409!==n.response.status)throw n;return h(s).then((n=>n?e.overwrite(t,s):Promise.reject("File not renamed")))}))}function h(e,t){const s=(t=t||o.nullTranslator).load("jupyterlab"),n={title:s.__("Overwrite file?"),body:s.__('"%1" already exists, overwrite?',e),buttons:[i.Dialog.cancelButton(),i.Dialog.warnButton({label:s.__("Overwrite"),ariaLabel:s.__("Overwrite Existing File")})]};return(0,i.showDialog)(n).then((e=>Promise.resolve(e.button.accept)))}function d(e){return e.length>0&&!/[\/\\:]/.test(e)}class g extends r.Widget{constructor(e){super({node:n.createRenameNode(e)}),this.addClass("jp-FileDialog");const t=a.PathExt.extname(e),s=this.inputNode.value=a.PathExt.basename(e);this.inputNode.setSelectionRange(0,s.length-t.length)}get inputNode(){return this.node.getElementsByTagName("input")[0]}getValue(){return this.inputNode.value}}!function(e){e.createRenameNode=function(e,t){const s=(t=t||o.nullTranslator).load("jupyterlab"),n=document.createElement("div"),i=document.createElement("label");i.textContent=s.__("File Path");const a=document.createElement("span");a.textContent=e;const r=document.createElement("label");r.textContent=s.__("New Name"),r.className="jp-new-name-title";const c=document.createElement("input");return n.appendChild(i),n.appendChild(a),n.appendChild(r),n.appendChild(c),n}}(n||(n={}));var _=s(87973),u=s(33625),m=s(20998),p=s(14421),v=s(81997);class f{constructor(e){this._autosaveTimer=-1,this._minInterval=-1,this._interval=-1,this._isActive=!1,this._inDialog=!1,this._isDisposed=!1,this._multiplier=10,this._context=e.context,this._isConnectedCallback=e.isConnectedCallback||(()=>!0);const t=e.saveInterval||120;this._minInterval=1e3*t,this._interval=this._minInterval,this._context.fileChanged.connect(this._setTimer,this),this._context.disposed.connect(this.dispose,this)}get saveInterval(){return this._interval/1e3}set saveInterval(e){this._minInterval=this._interval=1e3*e,this._isActive&&this._setTimer()}get isActive(){return this._isActive}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,clearTimeout(this._autosaveTimer),v.Signal.clearData(this))}start(){this._isActive=!0,this._setTimer()}stop(){this._isActive=!1,clearTimeout(this._autosaveTimer)}_setTimer(){clearTimeout(this._autosaveTimer),this._isActive&&(this._autosaveTimer=window.setTimeout((()=>{this._isConnectedCallback()&&this._save()}),this._interval))}_save(){const e=this._context;if(this._setTimer(),!e)return;if(!e.contentsModel||!e.contentsModel.writable||!e.model.dirty||this._inDialog)return;const t=(new Date).getTime();e.save().then((()=>{if(this.isDisposed)return;const e=(new Date).getTime()-t;this._interval=Math.max(this._multiplier*e,this._minInterval),this._setTimer()})).catch((e=>{const{name:t}=e;"ModalCancelError"!==t&&"ModalDuplicateError"!==t&&console.error("Error in Auto-Save",e.message)}))}}var w,y,C=s(2549),D=s(49503);class x{constructor(e){this._activateRequested=new v.Signal(this),this._confirmClosingTab=!1,this._isDisposed=!1,this._stateChanged=new v.Signal(this),this._registry=e.registry,this.translator=e.translator||o.nullTranslator,this._recentsManager=e.recentsManager||null}get activateRequested(){return this._activateRequested}get confirmClosingDocument(){return this._confirmClosingTab}set confirmClosingDocument(e){if(this._confirmClosingTab!==e){const t=this._confirmClosingTab;this._confirmClosingTab=e,this._stateChanged.emit({name:"confirmClosingDocument",oldValue:t,newValue:e})}}get stateChanged(){return this._stateChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,v.Signal.disconnectReceiver(this))}createWidget(e,t){const s=e.createNew(t);return this._initializeWidget(s,e,t),s}_initializeWidget(e,t,s){w.factoryProperty.set(e,t);const n=new C.DisposableSet;for(const i of this._registry.widgetExtensions(t.name)){const t=i.createNew(e,s);t&&n.add(t)}w.disposablesProperty.set(e,n),e.disposed.connect(this._onWidgetDisposed,this),this.adoptWidget(s,e),s.fileChanged.connect(this._onFileChanged,this),s.pathChanged.connect(this._onPathChanged,this),s.ready.then((()=>{this.setCaption(e)}))}adoptWidget(e,t){w.widgetsProperty.get(e).push(t),D.MessageLoop.installMessageHook(t,this),t.addClass("jp-Document"),t.title.closable=!0,t.disposed.connect(this._widgetDisposed,this),w.contextProperty.set(t,e)}findWidget(e,t){const s=w.widgetsProperty.get(e);if(s)return(0,u.find)(s,(e=>{const s=w.factoryProperty.get(e);return!!s&&s.name===t}))}contextForWidget(e){return w.contextProperty.get(e)}cloneWidget(e){const t=w.contextProperty.get(e);if(!t)return;const s=w.factoryProperty.get(e);if(!s)return;const n=s.createNew(t,e);return this._initializeWidget(n,s,t),n}closeWidgets(e){const t=w.widgetsProperty.get(e);return Promise.all(t.map((e=>this.onClose(e)))).then((()=>{}))}deleteWidgets(e){const t=w.widgetsProperty.get(e);return Promise.all(t.map((e=>this.onDelete(e)))).then((()=>{}))}messageHook(e,t){switch(t.type){case"close-request":return this.onClose(e),!1;case"activate-request":{const t=e,s=this.contextForWidget(t);s&&(s.ready.then((()=>{this._recordAsRecentlyOpened(t,s.contentsModel)})).catch((()=>{console.warn("Could not record the recents status for",s)})),this._activateRequested.emit(s.path));break}}return!0}async setCaption(e){const t=this.translator.load("jupyterlab"),s=w.contextProperty.get(e);if(!s)return;const n=s.contentsModel;if(n)return s.listCheckpoints().then((i=>{if(e.isDisposed)return;const o=i[i.length-1],r=o?a.Time.format(o.last_modified):"None";let c=t.__("Name: %1\nPath: %2\n",n.name,n.path);s.model.readOnly?c+=t.__("Read-only"):c+=t.__("Last Saved: %1\n",a.Time.format(n.last_modified))+t.__("Last Checkpoint: %1",r),e.title.caption=c}));e.title.caption=""}async onClose(e){var t;const[s,n]=await this._maybeClose(e,this.translator);if(e.isDisposed)return!0;if(s){const s=w.contextProperty.get(e);if(!n){if(!s)return!0;(null===(t=s.contentsModel)||void 0===t?void 0:t.writable)?await s.save():await s.saveAs()}if(s&&("timeout"===await Promise.race([s.ready,new Promise((e=>setTimeout(e,3e3,"timeout")))])?console.warn("Could not record the widget as recently closed because the context did not become ready in 3 seconds"):this._recordAsRecentlyClosed(e,s.contentsModel)),e.isDisposed)return!0;e.dispose()}return s}onDelete(e){return e.dispose(),Promise.resolve(void 0)}_recordAsRecentlyOpened(e,t){var s;const n=this._recentsManager;if(!n)return;const i=t.path,a=this._registry.getFileTypeForModel(t).contentType,o=null===(s=w.factoryProperty.get(e))||void 0===s?void 0:s.name;if(n.addRecent({path:i,contentType:a,factory:o},"opened"),"directory"!==a){const e=i.lastIndexOf("/")>0?i.slice(0,i.lastIndexOf("/")):"";n.addRecent({path:e,contentType:"directory"},"opened")}}_recordAsRecentlyClosed(e,t){var s;const n=this._recentsManager;if(!n)return;const i=t.path,a=this._registry.getFileTypeForModel(t).contentType,o=null===(s=w.factoryProperty.get(e))||void 0===s?void 0:s.name;n.addRecent({path:i,contentType:a,factory:o},"closed")}async _maybeClose(e,t){var s,n;const a=(t=t||o.nullTranslator).load("jupyterlab"),r=w.contextProperty.get(e);if(!r)return Promise.resolve([!0,!0]);let c=w.widgetsProperty.get(r);if(!c)return Promise.resolve([!0,!0]);c=c.filter((e=>{const t=w.factoryProperty.get(e);return!!t&&!1===t.readOnly}));const l=e.title.label,h=w.factoryProperty.get(e),d=r.model.dirty&&c.length<=1&&!(null===(s=null==h?void 0:h.readOnly)||void 0===s||s);if(this.confirmClosingDocument){const e=[i.Dialog.cancelButton(),i.Dialog.okButton({label:d?a.__("Close and save"):a.__("Close"),ariaLabel:d?a.__("Close and save Document"):a.__("Close Document")})];d&&e.splice(1,0,i.Dialog.warnButton({label:a.__("Close without saving"),ariaLabel:a.__("Close Document without saving")}));const t=await(0,i.showDialog)({title:a.__("Confirmation"),body:a.__('Please confirm you want to close "%1".',l),checkbox:d?null:{label:a.__("Do not ask me again."),caption:a.__("If checked, no confirmation to close a document will be asked in the future.")},buttons:e});return t.isChecked&&(this.confirmClosingDocument=!1),Promise.resolve([t.button.accept,!d||"warn"===t.button.displayType])}{if(!d)return Promise.resolve([!0,!0]);const e=(null===(n=r.contentsModel)||void 0===n?void 0:n.writable)?a.__("Save"):a.__("Save as"),t=await(0,i.showDialog)({title:a.__("Save your work"),body:a.__('Save changes in "%1" before closing?',l),buttons:[i.Dialog.cancelButton(),i.Dialog.warnButton({label:a.__("Discard"),ariaLabel:a.__("Discard changes to file")}),i.Dialog.okButton({label:e})]});return[t.button.accept,"warn"===t.button.displayType]}}_widgetDisposed(e){const t=w.contextProperty.get(e);if(!t)return;const s=w.widgetsProperty.get(t);s&&(u.ArrayExt.removeFirstOf(s,e),s.length||t.dispose())}_onWidgetDisposed(e){w.disposablesProperty.get(e).dispose()}_onFileChanged(e){const t=w.widgetsProperty.get(e);for(const e of t)this.setCaption(e)}_onPathChanged(e){const t=w.widgetsProperty.get(e);for(const e of t)this.setCaption(e)}}!function(e){e.contextProperty=new p.AttachedProperty({name:"context",create:()=>{}}),e.factoryProperty=new p.AttachedProperty({name:"factory",create:()=>{}}),e.widgetsProperty=new p.AttachedProperty({name:"widgets",create:()=>[]}),e.disposablesProperty=new p.AttachedProperty({name:"disposables",create:()=>new C.DisposableSet})}(w||(w={}));class M{constructor(e){var t;this._activateRequested=new v.Signal(this),this._contexts=[],this._isDisposed=!1,this._autosave=!0,this._autosaveInterval=120,this._lastModifiedCheckMargin=500,this._renameUntitledFileOnSave=!0,this._stateChanged=new v.Signal(this),this.translator=e.translator||o.nullTranslator,this.registry=e.registry,this.services=e.manager,this._dialogs=null!==(t=e.sessionDialogs)&&void 0!==t?t:new i.SessionContextDialogs({translator:e.translator}),this._isConnectedCallback=e.isConnectedCallback||(()=>!0),this._opener=e.opener,this._when=e.when||e.manager.ready;const s=new x({registry:this.registry,translator:this.translator,recentsManager:e.recentsManager});s.activateRequested.connect(this._onActivateRequested,this),s.stateChanged.connect(this._onWidgetStateChanged,this),this._widgetManager=s,this._setBusy=e.setBusy}get activateRequested(){return this._activateRequested}get autosave(){return this._autosave}set autosave(e){if(this._autosave!==e){const t=this._autosave;this._autosave=e,this._contexts.forEach((t=>{const s=y.saveHandlerProperty.get(t);s&&(!0!==e||s.isActive?!1===e&&s.isActive&&s.stop():s.start())})),this._stateChanged.emit({name:"autosave",oldValue:t,newValue:e})}}get autosaveInterval(){return this._autosaveInterval}set autosaveInterval(e){if(this._autosaveInterval!==e){const t=this._autosaveInterval;this._autosaveInterval=e,this._contexts.forEach((t=>{const s=y.saveHandlerProperty.get(t);s&&(s.saveInterval=e||120)})),this._stateChanged.emit({name:"autosaveInterval",oldValue:t,newValue:e})}}get confirmClosingDocument(){return this._widgetManager.confirmClosingDocument}set confirmClosingDocument(e){if(this._widgetManager.confirmClosingDocument!==e){const t=this._widgetManager.confirmClosingDocument;this._widgetManager.confirmClosingDocument=e,this._stateChanged.emit({name:"confirmClosingDocument",oldValue:t,newValue:e})}}get lastModifiedCheckMargin(){return this._lastModifiedCheckMargin}set lastModifiedCheckMargin(e){if(this._lastModifiedCheckMargin!==e){const t=this._lastModifiedCheckMargin;this._lastModifiedCheckMargin=e,this._contexts.forEach((t=>{t.lastModifiedCheckMargin=e})),this._stateChanged.emit({name:"lastModifiedCheckMargin",oldValue:t,newValue:e})}}get renameUntitledFileOnSave(){return this._renameUntitledFileOnSave}set renameUntitledFileOnSave(e){if(this._renameUntitledFileOnSave!==e){const t=this._renameUntitledFileOnSave;this._renameUntitledFileOnSave=e,this._stateChanged.emit({name:"renameUntitledFileOnSave",oldValue:t,newValue:e})}}get stateChanged(){return this._stateChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,v.Signal.clearData(this),this._contexts.forEach((e=>this._widgetManager.closeWidgets(e))),this._widgetManager.dispose(),this._contexts.length=0)}cloneWidget(e){return this._widgetManager.cloneWidget(e)}closeAll(){return Promise.all(this._contexts.map((e=>this._widgetManager.closeWidgets(e)))).then((()=>{}))}closeFile(e){const t=this._contextsForPath(e).map((e=>this._widgetManager.closeWidgets(e)));return Promise.all(t).then((e=>{}))}contextForWidget(e){return this._widgetManager.contextForWidget(e)}copy(e,t){return this.services.contents.copy(e,t)}createNew(e,t="default",s){return this._createOrOpenDocument("create",e,t,s)}deleteFile(e){return this.services.sessions.stopIfNeeded(e).then((()=>this.services.contents.delete(e))).then((()=>(this._contextsForPath(e).forEach((e=>this._widgetManager.deleteWidgets(e))),Promise.resolve(void 0))))}duplicate(e){const t=a.PathExt.dirname(e);return this.services.contents.copy(e,t)}findWidget(e,t="default"){const s=a.PathExt.normalize(e);let n=[t];if("default"===t){const e=this.registry.defaultWidgetFactory(s);if(!e)return;n=[e.name]}else null===t&&(n=this.registry.preferredWidgetFactories(s).map((e=>e.name)));for(const e of this._contextsForPath(s))for(const t of n)if(null!==t){const s=this._widgetManager.findWidget(e,t);if(s)return s}}newUntitled(e){return"file"===e.type&&(e.ext=e.ext||".txt"),this.services.contents.newUntitled(e)}open(e,t="default",s,n){return this._createOrOpenDocument("open",e,t,s,n)}openOrReveal(e,t="default",s,n){const i=this.findWidget(e,t);return i?(this._opener.open(i,{type:t,...n}),i):this.open(e,t,s,null!=n?n:{})}overwrite(e,t){const s=`${t}.${m.UUID.uuid4()}`,n=()=>this.rename(s,t);return this.rename(e,s).then((()=>this.deleteFile(t))).then(n,n)}rename(e,t){return this.services.contents.rename(e,t)}_findContext(e,t){const s=this.services.contents.normalize(e);return(0,u.find)(this._contexts,(e=>e.path===s&&e.factoryName===t))}_contextsForPath(e){const t=this.services.contents.normalize(e);return this._contexts.filter((e=>e.path===t))}_createContext(e,t,s){const n=new _.Context({opener:(e,t)=>{this._widgetManager.adoptWidget(n,e),this._opener.open(e,t)},manager:this.services,factory:t,path:e,kernelPreference:s,setBusy:this._setBusy,sessionDialogs:this._dialogs,lastModifiedCheckMargin:this._lastModifiedCheckMargin,translator:this.translator}),i=new f({context:n,isConnectedCallback:this._isConnectedCallback,saveInterval:this.autosaveInterval});return y.saveHandlerProperty.set(n,i),n.ready.then((()=>{this.autosave&&i.start()})),n.disposed.connect(this._onContextDisposed,this),this._contexts.push(n),n}_onContextDisposed(e){u.ArrayExt.removeFirstOf(this._contexts,e)}_widgetFactoryFor(e,t){const{registry:s}=this;if("default"===t){const n=s.defaultWidgetFactory(e);if(!n)return;t=n.name}return s.getWidgetFactory(t)}_createOrOpenDocument(e,t,s="default",n,i){const a=this._widgetFactoryFor(t,s);if(!a)return;const o=a.modelName||"text",r=this.registry.getModelFactory(o);if(!r)return;const c=this.registry.getKernelPreference(t,a.name,n);let l,h=Promise.resolve(void 0);if("open"===e)l=this._findContext(t,r.name)||null,l||(l=this._createContext(t,r,c),h=this._when.then((()=>l.initialize(!1))));else{if("create"!==e)throw new Error(`Invalid argument 'which': ${e}`);l=this._createContext(t,r,c),h=this._when.then((()=>l.initialize(!0)))}const d=this._widgetManager.createWidget(a,l);return this._opener.open(d,{type:a.name,...i}),h.catch((e=>{console.error(`Failed to initialize the context with '${r.name}' for ${t}`,e),d.close()})),d}_onActivateRequested(e,t){this._activateRequested.emit(t)}_onWidgetStateChanged(e,t){"confirmClosingDocument"===t.name&&this._stateChanged.emit(t)}}!function(e){e.saveHandlerProperty=new p.AttachedProperty({name:"saveHandler",create:()=>{}})}(y||(y={}));var P=s(47652),b=s(14576),R=s(78156),S=s.n(R);function T(e){return S().createElement(P.TextItem,{source:e.name,title:e.fullPath})}class F extends b.VDomRenderer{constructor(e){super(new F.Model(e.docManager)),this.node.title=this.model.path}render(){return S().createElement(T,{fullPath:this.model.path,name:this.model.name})}}function k(e){return S().createElement(P.TextItem,{source:e.fileStatus})}!function(e){class t extends b.VDomModel{constructor(e){super(),this._onTitleChange=e=>{const t=this._getAllState();this._name=e.label,this._triggerChange(t,this._getAllState())},this._onPathChange=(e,t)=>{const s=this._getAllState();this._path=t,this._name=a.PathExt.basename(t),this._triggerChange(s,this._getAllState())},this._path="",this._name="",this._widget=null,this._docManager=e}get path(){return this._path}get name(){return this._name}get widget(){return this._widget}set widget(e){const t=this._widget;if(null!==t){const e=this._docManager.contextForWidget(t);e?e.pathChanged.disconnect(this._onPathChange):t.title.changed.disconnect(this._onTitleChange)}const s=this._getAllState();if(this._widget=e,null===this._widget)this._path="",this._name="";else{const e=this._docManager.contextForWidget(this._widget);e?(this._path=e.path,this._name=a.PathExt.basename(e.path),e.pathChanged.connect(this._onPathChange)):(this._path="",this._name=this._widget.title.label,this._widget.title.changed.connect(this._onTitleChange))}this._triggerChange(s,this._getAllState())}_getAllState(){return[this._path,this._name]}_triggerChange(e,t){e[0]===t[0]&&e[1]===t[1]||this.stateChanged.emit(void 0)}}e.Model=t}(F||(F={}));class W extends b.VDomRenderer{constructor(e){super(new W.Model(e.docManager));const t=(e.translator||o.nullTranslator).load("jupyterlab");this._statusMap={completed:t.__("Saving completed"),started:t.__("Saving started"),failed:t.__("Saving failed")}}render(){return null===this.model||null===this.model.status?null:S().createElement(k,{fileStatus:this._statusMap[this.model.status]})}}!function(e){class t extends b.VDomModel{constructor(e){super(),this._onStatusChange=(e,t)=>{this._status=t,"completed"===this._status?(setTimeout((()=>{this._status=null,this.stateChanged.emit(void 0)}),2e3),this.stateChanged.emit(void 0)):this.stateChanged.emit(void 0)},this._status=null,this._widget=null,this._status=null,this.widget=null,this._docManager=e}get status(){return this._status}get widget(){return this._widget}set widget(e){var t,s;const n=this._widget;if(null!==n){const e=this._docManager.contextForWidget(n);e?e.saveState.disconnect(this._onStatusChange):(null===(t=this._widget.content)||void 0===t?void 0:t.saveStateChanged)&&this._widget.content.saveStateChanged.disconnect(this._onStatusChange)}if(this._widget=e,null===this._widget)this._status=null;else{const e=this._docManager.contextForWidget(this._widget);e?e.saveState.connect(this._onStatusChange):(null===(s=this._widget.content)||void 0===s?void 0:s.saveStateChanged)&&this._widget.content.saveStateChanged.connect(this._onStatusChange)}}}e.Model=t}(W||(W={}));const A=new m.Token("@jupyterlab/docmanager:IDocumentManager","A service for the manager for all\n documents used by the application. Use this if you want to open and close documents,\n create and delete files, and otherwise interact with the file system."),E=new m.Token("@jupyterlab/docmanager:IDocumentWidgetOpener","A service to open a widget."),I=new m.Token("@jupyterlab/docmanager:IRecentsManager","A service providing information about recently opened and closed documents");var O,B=s(97934);class N{constructor(e){this._recentsChanged=new v.Signal(this),this._recents={opened:[],closed:[]},this._isDisposed=!1,this._maxRecentsLength=10,this._saveDebouncer=new B.Debouncer(this._save.bind(this),500),this._stateDB=e.stateDB,this._contentsManager=e.contents,this.updateRootDir(),this._loadRecents().catch((e=>{console.error(`Failed to load recent list from state:\n${e}`)}))}get isDisposed(){return this._isDisposed}get recentlyOpened(){return(this._recents.opened||[]).filter((e=>e.root===this._serverRoot))}get recentlyClosed(){return(this._recents.closed||[]).filter((e=>e.root===this._serverRoot))}get changed(){return this._recentsChanged}get maximalRecentsLength(){return this._maxRecentsLength}set maximalRecentsLength(e){this._maxRecentsLength=Math.round(Math.max(1,e));let t=!1;for(const e of["opened","closed"])this._recents[e].length>this._maxRecentsLength&&(this._recents[e].length=this._maxRecentsLength,t=!0);t&&this._recentsChanged.emit(void 0)}dispose(){this.isDisposed||(this._isDisposed=!0,v.Signal.clearData(this),this._saveDebouncer.dispose())}addRecent(e,t){const s={...e,root:this._serverRoot},n=this._recents[t],i=n.findIndex((t=>t.path===e.path));i>=0&&n.splice(i,1),n.unshift(s),this._setRecents(n,t),this._recentsChanged.emit(void 0)}clearRecents(){this._setRecents([],"opened"),this._setRecents([],"closed"),this._recentsChanged.emit(void 0)}removeRecent(e,t){this._removeRecent(e.path,[t])}async validate(e){const t=await this._isValid(e);return t||this._removeRecent(e.path),t}updateRootDir(){this._serverRoot=a.PageConfig.getOption("serverRoot")}_removeRecent(e,t=["opened","closed"]){let s=!1;for(const n of t){const t=this._recents[n],i=t.filter((t=>e!==t.path));t.length!==i.length&&(this._setRecents(i,n),s=!0)}s&&this._recentsChanged.emit(void 0)}async _isValid(e){var t;try{await this._contentsManager.get(e.path,{content:!1})}catch(e){if(404===(null===(t=e.response)||void 0===t?void 0:t.status))return!1}return!0}_setRecents(e,t){this._recents[t]=e.slice(0,this.maximalRecentsLength).sort(((e,t)=>e.root===t.root?0:e.root!==this._serverRoot?1:-1)),this._saveDebouncer.invoke().catch(console.warn)}async _loadRecents(){const e=await this._stateDB.fetch(O.stateDBKey)||{opened:[],closed:[]},t=[...e.opened,...e.closed],s=new Set(await this._getInvalidPaths(t));for(const t of["opened","closed"])this._setRecents(e[t].filter((e=>!s.has(e.path))),t);this._recentsChanged.emit(void 0)}async _getInvalidPaths(e){return(await Promise.all(e.map((async e=>await this._isValid(e)?null:e.path)))).filter((e=>"string"==typeof e))}async _save(){try{await this._stateDB.save(O.stateDBKey,this._recents)}catch(e){console.log("Saving recents failed",e)}}}!function(e){e.stateDBKey="docmanager:recents"}(O||(O={}))}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7603],{97603:(e,t,n)=>{n.r(t),n.d(t,{Commands:()=>S,default:()=>R,tabSpaceStatus:()=>L});var o=n(44604),r=n(53312),a=n(51429),i=n(30525),d=n(81002),c=n(67260),l=n(95183),s=n(71427),u=n(34663),m=n(86810),g=n(61907),p=n(29879),f=n(23295),v=n(71098),h=n(79426),C=n(12030),b=n(35613),y=n(33625),w=n(87797),_=n(24636),x=n(68722);const k="notebook:toggle-autoclosing-brackets",T="console:toggle-autoclosing-brackets";var E;!function(e){e.createNew="fileeditor:create-new",e.createNewMarkdown="fileeditor:create-new-markdown-file",e.changeFontSize="fileeditor:change-font-size",e.lineNumbers="fileeditor:toggle-line-numbers",e.currentLineNumbers="fileeditor:toggle-current-line-numbers",e.lineWrap="fileeditor:toggle-line-wrap",e.currentLineWrap="fileeditor:toggle-current-line-wrap",e.changeTabs="fileeditor:change-tabs",e.matchBrackets="fileeditor:toggle-match-brackets",e.currentMatchBrackets="fileeditor:toggle-current-match-brackets",e.autoClosingBrackets="fileeditor:toggle-autoclosing-brackets",e.autoClosingBracketsUniversal="fileeditor:toggle-autoclosing-brackets-universal",e.createConsole="fileeditor:create-console",e.replaceSelection="fileeditor:replace-selection",e.restartConsole="fileeditor:restart-console",e.runCode="fileeditor:run-code",e.runAllCode="fileeditor:run-all",e.markdownPreview="fileeditor:markdown-preview",e.undo="fileeditor:undo",e.redo="fileeditor:redo",e.cut="fileeditor:cut",e.copy="fileeditor:copy",e.paste="fileeditor:paste",e.selectAll="fileeditor:select-all",e.invokeCompleter="completer:invoke-file",e.selectCompleter="completer:select-file",e.openCodeViewer="code-viewer:open",e.changeTheme="fileeditor:change-theme",e.changeLanguage="fileeditor:change-language",e.find="fileeditor:find",e.goToLine="fileeditor:go-to-line"}(E||(E={}));const I="Editor";var S;!function(e){let t={},n=!0;function o(e){e.editor.setOptions({...t,scrollPastEnd:n})}function i(e){const t=e.getSelection(),{start:n,end:o}=t;return n.column!==o.column||n.line!==o.line}function d(e){const t=e.getSelection(),n=e.getOffsetAt(t.start),o=e.getOffsetAt(t.end);return e.model.sharedModel.getSource().substring(n,o)}async function c(e,t,n="txt"){const o=await e.execute("docmanager:new-untitled",{path:t,type:"file",ext:n});if(null!=o){const t=await e.execute("docmanager:open",{path:o.path,factory:I});return t.isUntitled=!0,t}}function l(e,t){e.add({command:E.createNew,category:t.__("Other"),rank:1})}function s(e,t){e.add({command:E.createNewMarkdown,category:t.__("Other"),rank:2})}function u(e,t){const n=t.__("Text Editor"),o=E.changeTabs;e.addItem({command:o,args:{size:4},category:n});for(const t of[1,2,4,8]){const r={size:t};e.addItem({command:o,args:r,category:n})}}function m(e,t){const n=t.__("Text Editor");e.addItem({command:E.createNew,args:{isPalette:!0},category:n})}function g(e,t){const n=t.__("Text Editor");e.addItem({command:E.createNewMarkdown,args:{isPalette:!0},category:n})}function p(e,t){const n=t.__("Text Editor"),o=E.changeFontSize;let r={delta:1};e.addItem({command:o,args:r,category:n}),r={delta:-1},e.addItem({command:o,args:r,category:n})}function f(e,t,n){const o=e=>n()&&e.context&&!!t.find((t=>{var n;return(null===(n=t.sessionContext.session)||void 0===n?void 0:n.path)===e.context.path}));e.runMenu.codeRunners.restart.add({id:E.restartConsole,isEnabled:o}),e.runMenu.codeRunners.run.add({id:E.runCode,isEnabled:o}),e.runMenu.codeRunners.runAll.add({id:E.runAllCode,isEnabled:o})}e.updateSettings=function(e,o){var r;t=null!==(r=e.get("editorConfig").composite)&&void 0!==r?r:{},n=e.get("scrollPasteEnd").composite,o.notifyCommandChanged(E.lineNumbers),o.notifyCommandChanged(E.currentLineNumbers),o.notifyCommandChanged(E.lineWrap),o.notifyCommandChanged(E.currentLineWrap),o.notifyCommandChanged(E.changeTabs),o.notifyCommandChanged(E.matchBrackets),o.notifyCommandChanged(E.currentMatchBrackets),o.notifyCommandChanged(E.autoClosingBrackets),o.notifyCommandChanged(E.changeLanguage)},e.updateTracker=function(e){e.forEach((e=>{o(e.content)}))},e.updateWidget=o,e.addCommands=function(e,n,o,l,s,u,m,g,p,f,v,h){var C;e.addCommand(E.changeFontSize,{execute:e=>{var o;const r=Number(e.delta);if(Number.isNaN(r))return void console.error(`${E.changeFontSize}: delta arg must be a number`);const a=window.getComputedStyle(document.documentElement),i=parseInt(a.getPropertyValue("--jp-code-font-size"),10);t.customStyles||(t.customStyles={});const d=(null!==(o=t.customStyles.fontSize)&&void 0!==o?o:g.baseConfiguration.customStyles.fontSize)||i;return t.customStyles.fontSize=d+r,n.set(l,"editorConfig",t).catch((e=>{console.error(`Failed to set ${l}: ${e.message}`)}))},label:e=>{const t=Number(e.delta);return Number.isNaN(t)&&console.error(`${E.changeFontSize}: delta arg must be a number`),t>0?e.isMenu?o.__("Increase Text Editor Font Size"):o.__("Increase Font Size"):e.isMenu?o.__("Decrease Text Editor Font Size"):o.__("Decrease Font Size")}}),e.addCommand(E.lineNumbers,{execute:async()=>{var e;t.lineNumbers=!(null!==(e=t.lineNumbers)&&void 0!==e?e:g.baseConfiguration.lineNumbers);try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},isEnabled:s,isToggled:()=>{var e;return null!==(e=t.lineNumbers)&&void 0!==e?e:g.baseConfiguration.lineNumbers},label:o.__("Show Line Numbers")}),e.addCommand(E.currentLineNumbers,{label:o.__("Show Line Numbers"),caption:o.__("Show the line numbers for the current file."),execute:()=>{const e=u.currentWidget;if(!e)return;const t=!e.content.editor.getOption("lineNumbers");e.content.editor.setOption("lineNumbers",t)},isEnabled:s,isToggled:()=>{var e;const t=u.currentWidget;return null!==(e=null==t?void 0:t.content.editor.getOption("lineNumbers"))&&void 0!==e&&e}}),e.addCommand(E.lineWrap,{execute:async e=>{var o;t.lineWrap=null!==(o=e.mode)&&void 0!==o&&o;try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},isEnabled:s,isToggled:e=>{var n,o;return(null!==(n=e.mode)&&void 0!==n&&n)===(null!==(o=t.lineWrap)&&void 0!==o?o:g.baseConfiguration.lineWrap)},label:o.__("Word Wrap")}),e.addCommand(E.currentLineWrap,{label:o.__("Wrap Words"),caption:o.__("Wrap words for the current file."),execute:()=>{const e=u.currentWidget;if(!e)return;const t=e.content.editor.getOption("lineWrap");e.content.editor.setOption("lineWrap",!t)},isEnabled:s,isToggled:()=>{var e;const t=u.currentWidget;return null!==(e=null==t?void 0:t.content.editor.getOption("lineWrap"))&&void 0!==e&&e}}),e.addCommand(E.changeTabs,{label:e=>{var t;return e.size?o._p("v4","Spaces: %1",null!==(t=e.size)&&void 0!==t?t:""):o.__("Indent with Tab")},execute:async e=>{var o;t.indentUnit=void 0!==e.size?(null!==(o=e.size)&&void 0!==o?o:"4").toString():"Tab";try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},isToggled:e=>{var n;const o=null!==(n=t.indentUnit)&&void 0!==n?n:g.baseConfiguration.indentUnit;return e.size?e.size===o:"Tab"==o}}),e.addCommand(E.matchBrackets,{execute:async()=>{var e;t.matchBrackets=!(null!==(e=t.matchBrackets)&&void 0!==e?e:g.baseConfiguration.matchBrackets);try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},label:o.__("Match Brackets"),isEnabled:s,isToggled:()=>{var e;return null!==(e=t.matchBrackets)&&void 0!==e?e:g.baseConfiguration.matchBrackets}}),e.addCommand(E.currentMatchBrackets,{label:o.__("Match Brackets"),caption:o.__("Change match brackets for the current file."),execute:()=>{const e=u.currentWidget;if(!e)return;const t=!e.content.editor.getOption("matchBrackets");e.content.editor.setOption("matchBrackets",t)},isEnabled:s,isToggled:()=>{var e;const t=u.currentWidget;return null!==(e=null==t?void 0:t.content.editor.getOption("matchBrackets"))&&void 0!==e&&e}}),e.addCommand(E.autoClosingBrackets,{execute:async e=>{var o,r;t.autoClosingBrackets=!!(null!==(o=e.force)&&void 0!==o?o:!(null!==(r=t.autoClosingBrackets)&&void 0!==r?r:g.baseConfiguration.autoClosingBrackets));try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},label:o.__("Auto Close Brackets in Text Editor"),isToggled:()=>{var e;return null!==(e=t.autoClosingBrackets)&&void 0!==e?e:g.baseConfiguration.autoClosingBrackets}}),e.addCommand(E.autoClosingBracketsUniversal,{execute:()=>{e.isToggled(E.autoClosingBrackets)||e.isToggled(k)||e.isToggled(T)?(e.execute(E.autoClosingBrackets,{force:!1}),e.execute(k,{force:!1}),e.execute(T,{force:!1})):(e.execute(E.autoClosingBrackets,{force:!0}),e.execute(k,{force:!0}),e.execute(T,{force:!0}))},label:o.__("Auto Close Brackets"),isToggled:()=>e.isToggled(E.autoClosingBrackets)||e.isToggled(k)||e.isToggled(T)}),e.addCommand(E.changeTheme,{label:e=>{var n,r,a,i;return null!==(i=null!==(a=null!==(r=null!==(n=e.displayName)&&void 0!==n?n:e.theme)&&void 0!==r?r:t.theme)&&void 0!==a?a:g.baseConfiguration.theme)&&void 0!==i?i:o.__("Editor Theme")},execute:async e=>{var o;t.theme=null!==(o=e.theme)&&void 0!==o?o:t.theme;try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set theme - ${e.message}`)}},isToggled:e=>{var n;return e.theme===(null!==(n=t.theme)&&void 0!==n?n:g.baseConfiguration.theme)}}),e.addCommand(E.find,{label:o.__("Find…"),execute:()=>{const e=u.currentWidget;e&&e.content.editor.execCommand(_.findNext)},isEnabled:s}),e.addCommand(E.goToLine,{label:o.__("Go to Line…"),execute:e=>{const t=u.currentWidget;if(!t)return;const n=t.content.editor,o=e.line,r=e.column;void 0!==o||void 0!==r?n.setCursorPosition({line:(null!=o?o:1)-1,column:(null!=r?r:1)-1}):n.execCommand(_.gotoLine)},isEnabled:s}),e.addCommand(E.changeLanguage,{label:e=>{var t,n;return null!==(n=null!==(t=e.displayName)&&void 0!==t?t:e.name)&&void 0!==n?n:o.__("Change editor language.")},execute:e=>{var t;const n=e.name,o=u.currentWidget;if(n&&o){const e=p.findByName(n);e&&(Array.isArray(e.mime)?o.content.model.mimeType=null!==(t=e.mime[0])&&void 0!==t?t:a.IEditorMimeTypeService.defaultMimeType:o.content.model.mimeType=e.mime)}},isEnabled:s,isToggled:e=>{const t=u.currentWidget;if(!t)return!1;const n=t.content.model.mimeType,o=p.findByMIME(n),r=o&&o.name;return e.name===r}}),e.addCommand(E.replaceSelection,{execute:e=>{var t,n;const o=e.text||"",r=u.currentWidget;r&&(null===(n=(t=r.content.editor).replaceSelection)||void 0===n||n.call(t,o))},isEnabled:s,label:o.__("Replace Selection in Editor")}),e.addCommand(E.createConsole,{execute:t=>{const n=u.currentWidget;if(n)return function(e,t){return async function(n,o){var r,a,i;const d=o||{},c=await e.execute("console:create",{activate:d.activate,name:null===(r=n.context.contentsModel)||void 0===r?void 0:r.name,path:n.context.path,preferredLanguage:n.context.model.defaultKernelLanguage||(null!==(i=null===(a=t.findByFileName(n.context.path))||void 0===a?void 0:a.name)&&void 0!==i?i:""),ref:n.id,insertMode:"split-bottom"});n.context.pathChanged.connect(((e,t)=>{var o;c.session.setPath(t),c.session.setName(null===(o=n.context.contentsModel)||void 0===o?void 0:o.name)}))}}(e,p)(n,t)},isEnabled:s,icon:b.consoleIcon,label:o.__("Create Console for Editor")}),e.addCommand(E.restartConsole,{execute:async()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t||null===f)return;const n=f.find((e=>{var n;return(null===(n=e.sessionContext.session)||void 0===n?void 0:n.path)===t.context.path}));return n?v.restart(n.sessionContext):void 0},label:o.__("Restart Kernel"),isEnabled:()=>null!==f&&s()}),e.addCommand(E.runCode,{execute:()=>{var t;const n=null===(t=u.currentWidget)||void 0===t?void 0:t.content;if(!n)return;let o="";const r=n.editor,a=n.context.path,i=x.PathExt.extname(a),d=r.getSelection(),{start:c,end:l}=d;let s=c.column!==l.column||c.line!==l.line;if(s){const e=r.getOffsetAt(d.start),t=r.getOffsetAt(d.end);o=r.model.sharedModel.getSource().substring(e,t)}else if(x.MarkdownCodeBlocks.isMarkdown(i)){const e=r.model.sharedModel.getSource(),t=x.MarkdownCodeBlocks.findMarkdownCodeBlocks(e);for(const e of t)if(e.startLine<=c.line&&c.line<=e.endLine){o=e.code,s=!0;break}}if(!s){o=r.getLine(d.start.line);const e=r.getCursorPosition();if(e.line+1===r.lineCount){const e=r.model.sharedModel.getSource();r.model.sharedModel.setSource(e+"\n")}r.setCursorPosition({line:e.line+1,column:e.column})}return o?e.execute("console:inject",{activate:!1,code:o,path:a}):Promise.resolve(void 0)},isEnabled:s,label:o.__("Run Selected Code")}),e.addCommand(E.runAllCode,{execute:()=>{var t;const n=null===(t=u.currentWidget)||void 0===t?void 0:t.content;if(!n)return;let o="";const r=n.editor.model.sharedModel.getSource(),a=n.context.path,i=x.PathExt.extname(a);if(x.MarkdownCodeBlocks.isMarkdown(i)){const e=x.MarkdownCodeBlocks.findMarkdownCodeBlocks(r);for(const t of e)o+=t.code}else o=r;return o?e.execute("console:inject",{activate:!1,code:o,path:a}):Promise.resolve(void 0)},isEnabled:s,label:o.__("Run All Code")}),e.addCommand(E.markdownPreview,{execute:()=>{const t=u.currentWidget;if(!t)return;const n=t.context.path;return e.execute("markdownviewer:open",{path:n,options:{mode:"split-right"}})},isVisible:()=>{const e=u.currentWidget;return e&&".md"===x.PathExt.extname(e.context.path)||!1},icon:b.markdownIcon,label:o.__("Show Markdown Preview")}),e.addCommand(E.createNew,{label:e=>{var t,n;return e.isPalette?null!==(t=e.paletteLabel)&&void 0!==t?t:o.__("New Text File"):null!==(n=e.launcherLabel)&&void 0!==n?n:o.__("Text File")},caption:e=>{var t;return null!==(t=e.caption)&&void 0!==t?t:o.__("Create a new text file")},icon:e=>{var t;return e.isPalette?void 0:b.LabIcon.resolve({icon:null!==(t=e.iconName)&&void 0!==t?t:b.textEditorIcon})},execute:t=>{var n;const o=t.cwd||m.model.path;return c(e,o,null!==(n=t.fileExt)&&void 0!==n?n:"txt")}}),e.addCommand(E.createNewMarkdown,{label:e=>e.isPalette?o.__("New Markdown File"):o.__("Markdown File"),caption:o.__("Create a new markdown file"),icon:e=>e.isPalette?void 0:b.markdownIcon,execute:t=>{const n=t.cwd||m.model.path;return c(e,n,"md")}}),e.addCommand(E.undo,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;t&&t.editor.undo()},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&t.editor.model.sharedModel.canUndo()},icon:b.undoIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Undo")}),e.addCommand(E.redo,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;t&&t.editor.redo()},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&t.editor.model.sharedModel.canRedo()},icon:b.redoIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Redo")}),e.addCommand(E.cut,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t)return;const n=t.editor,o=d(n);r.Clipboard.copyToSystem(o),n.replaceSelection&&n.replaceSelection("")},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&i(t.editor)},icon:b.cutIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Cut")}),e.addCommand(E.copy,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t)return;const n=d(t.editor);r.Clipboard.copyToSystem(n)},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&i(t.editor)},icon:b.copyIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Copy")}),e.addCommand(E.paste,{execute:async()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t)return;const n=t.editor,o=window.navigator.clipboard,r=await o.readText();r&&n.replaceSelection&&n.replaceSelection(r)},isEnabled:()=>{var e;return Boolean(s()&&(null===(e=u.currentWidget)||void 0===e?void 0:e.content))},icon:b.pasteIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Paste")}),e.addCommand(E.selectAll,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;t&&t.editor.execCommand(w.selectAll)},isEnabled:()=>{var e;return Boolean(s()&&(null===(e=u.currentWidget)||void 0===e?void 0:e.content))},label:o.__("Select All")});const y=[E.lineNumbers,E.currentLineNumbers,E.lineWrap,E.currentLineWrap,E.matchBrackets,E.currentMatchBrackets,E.find,E.goToLine,E.changeLanguage,E.replaceSelection,E.createConsole,E.restartConsole,E.runCode,E.runAllCode,E.undo,E.redo,E.cut,E.copy,E.paste,E.selectAll,E.createConsole],I=()=>{y.forEach((t=>e.notifyCommandChanged(t)))};u.currentChanged.connect(I),null===(C=h.currentChanged)||void 0===C||C.connect(I)},e.addCompleterCommands=function(e,t,n,o){const r=(null!=o?o:C.nullTranslator).load("jupyterlab");e.addCommand(E.invokeCompleter,{label:r.__("Display the completion helper."),execute:()=>{const e=t.currentWidget&&t.currentWidget.id;if(e)return n.invoke(e)}}),e.addCommand(E.selectCompleter,{label:r.__("Select the completion suggestion."),execute:()=>{const e=t.currentWidget&&t.currentWidget.id;if(e)return n.select(e)}}),e.addKeyBinding({command:E.selectCompleter,keys:["Enter"],selector:".jp-FileEditor .jp-mod-completer-active"})},e.addLauncherItems=function(e,t){l(e,t),s(e,t)},e.addCreateNewToLauncher=l,e.addCreateNewMarkdownToLauncher=s,e.addKernelLanguageLauncherItems=function(e,t,n){for(let o of n)e.add({command:E.createNew,category:t.__("Other"),rank:3,args:o})},e.addPaletteItems=function(e,t){u(e,t),m(e,t),g(e,t),p(e,t)},e.addChangeTabsCommandsToPalette=u,e.addCreateNewCommandToPalette=m,e.addCreateNewMarkdownCommandToPalette=g,e.addChangeFontSizeCommandsToPalette=p,e.addKernelLanguagePaletteItems=function(e,t,n){const o=t.__("Text Editor");for(let t of n)e.addItem({command:E.createNew,args:{...t,isPalette:!0},category:o})},e.addMenuItems=function(e,t,n,o){e.editMenu.undoers.redo.add({id:E.redo,isEnabled:o}),e.editMenu.undoers.undo.add({id:E.undo,isEnabled:o}),e.viewMenu.editorViewers.toggleLineNumbers.add({id:E.currentLineNumbers,isEnabled:o}),e.viewMenu.editorViewers.toggleMatchBrackets.add({id:E.currentMatchBrackets,isEnabled:o}),e.viewMenu.editorViewers.toggleWordWrap.add({id:E.currentLineWrap,isEnabled:o}),e.fileMenu.consoleCreators.add({id:E.createConsole,isEnabled:o}),n&&f(e,n,o)},e.addKernelLanguageMenuItems=function(e,t){for(let n of t)e.fileMenu.newMenu.addItem({command:E.createNew,args:n,rank:31})},e.addCodeRunnersToRunMenu=f,e.addOpenCodeViewerCommand=function(e,t,n,o){e.commands.addCommand(E.openCodeViewer,{label:o.__("Open Code Viewer"),execute:i=>(async i=>{var d;const c=t.factoryService.newDocumentEditor;let l=i.mimeType;!l&&i.extension&&(l=t.mimeTypeService.getMimeTypeByFilePath(`temp.${i.extension.replace(/\\.$/,"")}`));const s=a.CodeViewerWidget.createCodeViewer({factory:e=>c(e),content:i.content,mimeType:l});s.title.label=i.label||o.__("Code Viewer"),s.title.caption=s.title.label;const u=(0,y.find)(e.docRegistry.fileTypes(),(e=>!!l&&e.mimeTypes.includes(l)));s.title.icon=null!==(d=null==u?void 0:u.icon)&&void 0!==d?d:b.textEditorIcon,i.widgetId&&(s.id=i.widgetId);const m=new r.MainAreaWidget({content:s});return await n.add(m),e.shell.add(m,"main"),s})(i)})}}(S||(S={}));const M={id:"@jupyterlab/fileeditor-extension:editor-syntax-status",description:"Adds a file editor syntax status widget.",autoStart:!0,requires:[u.IEditorTracker,i.IEditorLanguageRegistry,o.ILabShell,C.ITranslator],optional:[v.IStatusBar],activate:(e,t,n,o,r,a)=>{if(!a)return;const i=new u.EditorSyntaxStatus({commands:e.commands,languages:n,translator:r});o.currentChanged.connect((()=>{const e=o.currentWidget;e&&t.has(e)&&i.model&&(i.model.editor=e.content.editor)})),a.registerStatusItem(M.id,{item:i,align:"left",rank:0,isActive:()=>!!o.currentWidget&&!!t.currentWidget&&o.currentWidget===t.currentWidget})}},W={activate:function(e,t,n,o,a,i,d,c,l,s,m,g,p,f,v,h,b){const y=W.id,w=null!=h?h:C.nullTranslator,_=null!=p?p:new r.SessionContextDialogs({translator:w}),x=w.load("jupyterlab");let k;v&&(k=(0,r.createToolbarFactory)(v,d,I,y,w));const T=new u.FileEditorFactory({editorServices:t,factoryOptions:{name:I,label:x.__("Editor"),fileTypes:["markdown","*"],defaultFor:["markdown","*"],toolbarFactory:k,translator:w}}),{commands:M,restored:L,shell:N}=e,P=new r.WidgetTracker({namespace:"editor"}),B=()=>null!==P.currentWidget&&P.currentWidget===N.currentWidget,F=new Map([["python",[{fileExt:"py",iconName:"ui-components:python",launcherLabel:x.__("Python File"),paletteLabel:x.__("New Python File"),caption:x.__("Create a new Python file")}]],["julia",[{fileExt:"jl",iconName:"ui-components:julia",launcherLabel:x.__("Julia File"),paletteLabel:x.__("New Julia File"),caption:x.__("Create a new Julia file")}]],["R",[{fileExt:"r",iconName:"ui-components:r-kernel",launcherLabel:x.__("R File"),paletteLabel:x.__("New R File"),caption:x.__("Create a new R file")}]]]);if(g&&g.restore(P,{command:"docmanager:open",args:e=>({path:e.context.path,factory:I}),name:e=>e.context.path}),Promise.all([d.load(y),L]).then((([e])=>{var t,n,r;if(m){const e=null===(t=m.viewMenu.items.find((e=>{var t;return"submenu"===e.type&&"jp-mainmenu-view-codemirror-language"===(null===(t=e.submenu)||void 0===t?void 0:t.id)})))||void 0===t?void 0:t.submenu;e&&o.getLanguages().sort(((e,t)=>{const n=e.name,o=t.name;return n.localeCompare(o)})).forEach((t=>{0!==t.name.toLowerCase().indexOf("brainf")&&e.addItem({command:E.changeLanguage,args:{...t}})}));const i=null===(n=m.settingsMenu.items.find((e=>{var t;return"submenu"===e.type&&"jp-mainmenu-settings-codemirror-theme"===(null===(t=e.submenu)||void 0===t?void 0:t.id)})))||void 0===n?void 0:n.submenu;if(i)for(const e of a.themes)i.addItem({command:E.changeTheme,args:{theme:e.name,displayName:null!==(r=e.displayName)&&void 0!==r?r:e.name}});m.editMenu.goToLiners.add({id:E.goToLine,isEnabled:e=>null!==P.currentWidget&&P.has(e)})}S.updateSettings(e,M),S.updateTracker(P),e.changed.connect((()=>{S.updateSettings(e,M),S.updateTracker(P)}))})).catch((e=>{console.error(e.message),S.updateTracker(P)})),b){const e=b.getRenderer("@jupyterlab/codemirror-extension:plugin.defaultConfig");e&&b.addRenderer("@jupyterlab/fileeditor-extension:plugin.editorConfig",e)}T.widgetCreated.connect(((e,t)=>{t.context.pathChanged.connect((()=>{P.save(t)})),P.add(t),S.updateWidget(t.content)})),e.docRegistry.addWidgetFactory(T),P.widgetAdded.connect(((e,t)=>{S.updateWidget(t.content)})),S.addCommands(e.commands,d,x,y,B,P,i,n,o,c,_,e.shell);const R=new r.WidgetTracker({namespace:"codeviewer"});return g&&g.restore(R,{command:E.openCodeViewer,args:e=>({content:e.content.content,label:e.content.title.label,mimeType:e.content.mimeType,widgetId:e.content.id}),name:e=>e.content.id}),S.addOpenCodeViewerCommand(e,t,R,x),s&&S.addLauncherItems(s,x),l&&S.addPaletteItems(l,x),m&&S.addMenuItems(m,P,c,B),(async()=>{var t,n;const o=e.serviceManager.kernelspecs;await o.ready;let r=new Set;const a=null!==(n=null===(t=o.specs)||void 0===t?void 0:t.kernelspecs)&&void 0!==n?n:{};return Object.keys(a).forEach((e=>{const t=a[e];if(t){const e=F.get(t.language);null==e||e.forEach((e=>r.add(e)))}})),r})().then((e=>{s&&S.addKernelLanguageLauncherItems(s,x,e),l&&S.addKernelLanguagePaletteItems(l,x,e),m&&S.addKernelLanguageMenuItems(m,e)})).catch((e=>{console.error(e.message)})),f&&(f.add(new u.LaTeXTableOfContentsFactory(P)),f.add(new u.MarkdownTableOfContentsFactory(P)),f.add(new u.PythonTableOfContentsFactory(P))),P},id:"@jupyterlab/fileeditor-extension:plugin",description:"Provides the file editor widget tracker.",requires:[a.IEditorServices,i.IEditorExtensionRegistry,i.IEditorLanguageRegistry,i.IEditorThemeRegistry,s.IDefaultFileBrowser,f.ISettingRegistry],optional:[c.IConsoleTracker,r.ICommandPalette,m.ILauncher,p.IMainMenu,o.ILayoutRestorer,r.ISessionContextDialogs,h.ITableOfContentsRegistry,r.IToolbarWidgetRegistry,C.ITranslator,b.IFormRendererRegistry],provides:u.IEditorTracker,autoStart:!0},L={id:"@jupyterlab/fileeditor-extension:tab-space-status",description:"Adds a file editor indentation status widget.",autoStart:!0,requires:[u.IEditorTracker,i.IEditorExtensionRegistry,f.ISettingRegistry,C.ITranslator],optional:[v.IStatusBar],activate:(e,t,n,o,r,a)=>{const i=r.load("jupyterlab");if(!a)return;const d=new b.MenuSvg({commands:e.commands}),c="fileeditor:change-tabs",{shell:l}=e,s={name:i.__("Indent with Tab")};d.addItem({command:c,args:s});for(const e of["1","2","4","8"]){const t={size:e,name:i._p("v4","Spaces: %1",e)};d.addItem({command:c,args:t})}const m=new u.TabSpaceStatus({menu:d,translator:r}),g=e=>{var t,o,r;m.model.indentUnit=null!==(r=null!==(o=null===(t=e.get("editorConfig").composite)||void 0===t?void 0:t.indentUnit)&&void 0!==o?o:n.baseConfiguration.indentUnit)&&void 0!==r?r:null};Promise.all([o.load("@jupyterlab/fileeditor-extension:plugin"),e.restored]).then((([e])=>{g(e),e.changed.connect(g)})),a.registerStatusItem("@jupyterlab/fileeditor-extension:tab-space-status",{item:m,align:"right",rank:1,isActive:()=>!!l.currentWidget&&t.has(l.currentWidget)})}},N={id:"@jupyterlab/fileeditor-extension:cursor-position",description:"Adds a file editor cursor position status widget.",activate:(e,t,n)=>{n.addEditorProvider((e=>Promise.resolve(e&&t.has(e)?e.content.editor:null)))},requires:[u.IEditorTracker,a.IPositionModel],autoStart:!0},P={id:"@jupyterlab/fileeditor-extension:completer",description:"Adds the completer capability to the file editor.",requires:[u.IEditorTracker],optional:[d.ICompletionProviderManager,C.ITranslator,r.ISanitizer],activate:function(e,t,n,o,a){if(!n)return;S.addCompleterCommands(e.commands,t,n,o);const i=e.serviceManager.sessions,d=null!=a?a:new r.Sanitizer,c=new Map,l=async(e,t)=>{const o={editor:t.content.editor,widget:t};await n.updateCompleter(o);const r=(e,o)=>{const r=c.get(t.id),a=(0,y.find)(o,(e=>e.path===t.context.path));if(a){if(r&&r.id===a.id)return;r&&(c.delete(t.id),r.dispose());const e=i.connectTo({model:a}),o={editor:t.content.editor,widget:t,session:e,sanitizer:d};n.updateCompleter(o).catch(console.error),c.set(t.id,e)}else r&&(c.delete(t.id),r.dispose())};r(0,Array.from(i.running())),i.runningChanged.connect(r),t.disposed.connect((()=>{i.runningChanged.disconnect(r);const e=c.get(t.id);e&&(c.delete(t.id),e.dispose())}))};t.widgetAdded.connect(l),n.activeProvidersChanged.connect((()=>{t.forEach((e=>{l(0,e).catch(console.error)}))}))},autoStart:!0},B={id:"@jupyterlab/fileeditor-extension:search",description:"Adds search capability to the file editor.",requires:[l.ISearchProviderRegistry],autoStart:!0,activate:(e,t)=>{t.add("jp-fileeditorSearchProvider",u.FileEditorSearchProvider)}},F={id:"@jupyterlab/fileeditor-extension:language-server",description:"Adds Language Server capability to the file editor.",requires:[u.IEditorTracker,g.ILSPDocumentConnectionManager,g.ILSPFeatureManager,g.ILSPCodeExtractorsManager,g.IWidgetLSPAdapterTracker],activate:function(e,t,n,o,r,a){t.widgetAdded.connect((async(t,i)=>{const d=new u.FileEditorAdapter(i,{connectionManager:n,featureManager:o,foreignCodeExtractorsManager:r,docRegistry:e.docRegistry});a.add(d)}))},autoStart:!0},R=[W,N,P,F,B,M,L]}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7603],{97603:(e,t,n)=>{n.r(t),n.d(t,{Commands:()=>S,default:()=>R,tabSpaceStatus:()=>L});var o=n(2756),r=n(20005),a=n(68481),i=n(75536),d=n(18101),c=n(92681),l=n(11523),s=n(42150),u=n(23413),m=n(30688),g=n(23184),p=n(98979),f=n(3339),v=n(47652),h=n(27333),C=n(90646),b=n(14576),y=n(33625),w=n(87797),_=n(24636),x=n(64145);const k="notebook:toggle-autoclosing-brackets",T="console:toggle-autoclosing-brackets";var E;!function(e){e.createNew="fileeditor:create-new",e.createNewMarkdown="fileeditor:create-new-markdown-file",e.changeFontSize="fileeditor:change-font-size",e.lineNumbers="fileeditor:toggle-line-numbers",e.currentLineNumbers="fileeditor:toggle-current-line-numbers",e.lineWrap="fileeditor:toggle-line-wrap",e.currentLineWrap="fileeditor:toggle-current-line-wrap",e.changeTabs="fileeditor:change-tabs",e.matchBrackets="fileeditor:toggle-match-brackets",e.currentMatchBrackets="fileeditor:toggle-current-match-brackets",e.autoClosingBrackets="fileeditor:toggle-autoclosing-brackets",e.autoClosingBracketsUniversal="fileeditor:toggle-autoclosing-brackets-universal",e.createConsole="fileeditor:create-console",e.replaceSelection="fileeditor:replace-selection",e.restartConsole="fileeditor:restart-console",e.runCode="fileeditor:run-code",e.runAllCode="fileeditor:run-all",e.markdownPreview="fileeditor:markdown-preview",e.undo="fileeditor:undo",e.redo="fileeditor:redo",e.cut="fileeditor:cut",e.copy="fileeditor:copy",e.paste="fileeditor:paste",e.selectAll="fileeditor:select-all",e.invokeCompleter="completer:invoke-file",e.selectCompleter="completer:select-file",e.openCodeViewer="code-viewer:open",e.changeTheme="fileeditor:change-theme",e.changeLanguage="fileeditor:change-language",e.find="fileeditor:find",e.goToLine="fileeditor:go-to-line"}(E||(E={}));const I="Editor";var S;!function(e){let t={},n=!0;function o(e){e.editor.setOptions({...t,scrollPastEnd:n})}function i(e){const t=e.getSelection(),{start:n,end:o}=t;return n.column!==o.column||n.line!==o.line}function d(e){const t=e.getSelection(),n=e.getOffsetAt(t.start),o=e.getOffsetAt(t.end);return e.model.sharedModel.getSource().substring(n,o)}async function c(e,t,n="txt"){const o=await e.execute("docmanager:new-untitled",{path:t,type:"file",ext:n});if(null!=o){const t=await e.execute("docmanager:open",{path:o.path,factory:I});return t.isUntitled=!0,t}}function l(e,t){e.add({command:E.createNew,category:t.__("Other"),rank:1})}function s(e,t){e.add({command:E.createNewMarkdown,category:t.__("Other"),rank:2})}function u(e,t){const n=t.__("Text Editor"),o=E.changeTabs;e.addItem({command:o,args:{size:4},category:n});for(const t of[1,2,4,8]){const r={size:t};e.addItem({command:o,args:r,category:n})}}function m(e,t){const n=t.__("Text Editor");e.addItem({command:E.createNew,args:{isPalette:!0},category:n})}function g(e,t){const n=t.__("Text Editor");e.addItem({command:E.createNewMarkdown,args:{isPalette:!0},category:n})}function p(e,t){const n=t.__("Text Editor"),o=E.changeFontSize;let r={delta:1};e.addItem({command:o,args:r,category:n}),r={delta:-1},e.addItem({command:o,args:r,category:n})}function f(e,t,n){const o=e=>n()&&e.context&&!!t.find((t=>{var n;return(null===(n=t.sessionContext.session)||void 0===n?void 0:n.path)===e.context.path}));e.runMenu.codeRunners.restart.add({id:E.restartConsole,isEnabled:o}),e.runMenu.codeRunners.run.add({id:E.runCode,isEnabled:o}),e.runMenu.codeRunners.runAll.add({id:E.runAllCode,isEnabled:o})}e.updateSettings=function(e,o){var r;t=null!==(r=e.get("editorConfig").composite)&&void 0!==r?r:{},n=e.get("scrollPasteEnd").composite,o.notifyCommandChanged(E.lineNumbers),o.notifyCommandChanged(E.currentLineNumbers),o.notifyCommandChanged(E.lineWrap),o.notifyCommandChanged(E.currentLineWrap),o.notifyCommandChanged(E.changeTabs),o.notifyCommandChanged(E.matchBrackets),o.notifyCommandChanged(E.currentMatchBrackets),o.notifyCommandChanged(E.autoClosingBrackets),o.notifyCommandChanged(E.changeLanguage)},e.updateTracker=function(e){e.forEach((e=>{o(e.content)}))},e.updateWidget=o,e.addCommands=function(e,n,o,l,s,u,m,g,p,f,v,h){var C;e.addCommand(E.changeFontSize,{execute:e=>{var o;const r=Number(e.delta);if(Number.isNaN(r))return void console.error(`${E.changeFontSize}: delta arg must be a number`);const a=window.getComputedStyle(document.documentElement),i=parseInt(a.getPropertyValue("--jp-code-font-size"),10);t.customStyles||(t.customStyles={});const d=(null!==(o=t.customStyles.fontSize)&&void 0!==o?o:g.baseConfiguration.customStyles.fontSize)||i;return t.customStyles.fontSize=d+r,n.set(l,"editorConfig",t).catch((e=>{console.error(`Failed to set ${l}: ${e.message}`)}))},label:e=>{const t=Number(e.delta);return Number.isNaN(t)&&console.error(`${E.changeFontSize}: delta arg must be a number`),t>0?e.isMenu?o.__("Increase Text Editor Font Size"):o.__("Increase Font Size"):e.isMenu?o.__("Decrease Text Editor Font Size"):o.__("Decrease Font Size")}}),e.addCommand(E.lineNumbers,{execute:async()=>{var e;t.lineNumbers=!(null!==(e=t.lineNumbers)&&void 0!==e?e:g.baseConfiguration.lineNumbers);try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},isEnabled:s,isToggled:()=>{var e;return null!==(e=t.lineNumbers)&&void 0!==e?e:g.baseConfiguration.lineNumbers},label:o.__("Show Line Numbers")}),e.addCommand(E.currentLineNumbers,{label:o.__("Show Line Numbers"),caption:o.__("Show the line numbers for the current file."),execute:()=>{const e=u.currentWidget;if(!e)return;const t=!e.content.editor.getOption("lineNumbers");e.content.editor.setOption("lineNumbers",t)},isEnabled:s,isToggled:()=>{var e;const t=u.currentWidget;return null!==(e=null==t?void 0:t.content.editor.getOption("lineNumbers"))&&void 0!==e&&e}}),e.addCommand(E.lineWrap,{execute:async e=>{var o;t.lineWrap=null!==(o=e.mode)&&void 0!==o&&o;try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},isEnabled:s,isToggled:e=>{var n,o;return(null!==(n=e.mode)&&void 0!==n&&n)===(null!==(o=t.lineWrap)&&void 0!==o?o:g.baseConfiguration.lineWrap)},label:o.__("Word Wrap")}),e.addCommand(E.currentLineWrap,{label:o.__("Wrap Words"),caption:o.__("Wrap words for the current file."),execute:()=>{const e=u.currentWidget;if(!e)return;const t=e.content.editor.getOption("lineWrap");e.content.editor.setOption("lineWrap",!t)},isEnabled:s,isToggled:()=>{var e;const t=u.currentWidget;return null!==(e=null==t?void 0:t.content.editor.getOption("lineWrap"))&&void 0!==e&&e}}),e.addCommand(E.changeTabs,{label:e=>{var t;return e.size?o._p("v4","Spaces: %1",null!==(t=e.size)&&void 0!==t?t:""):o.__("Indent with Tab")},execute:async e=>{var o;t.indentUnit=void 0!==e.size?(null!==(o=e.size)&&void 0!==o?o:"4").toString():"Tab";try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},isToggled:e=>{var n;const o=null!==(n=t.indentUnit)&&void 0!==n?n:g.baseConfiguration.indentUnit;return e.size?e.size===o:"Tab"==o}}),e.addCommand(E.matchBrackets,{execute:async()=>{var e;t.matchBrackets=!(null!==(e=t.matchBrackets)&&void 0!==e?e:g.baseConfiguration.matchBrackets);try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},label:o.__("Match Brackets"),isEnabled:s,isToggled:()=>{var e;return null!==(e=t.matchBrackets)&&void 0!==e?e:g.baseConfiguration.matchBrackets}}),e.addCommand(E.currentMatchBrackets,{label:o.__("Match Brackets"),caption:o.__("Change match brackets for the current file."),execute:()=>{const e=u.currentWidget;if(!e)return;const t=!e.content.editor.getOption("matchBrackets");e.content.editor.setOption("matchBrackets",t)},isEnabled:s,isToggled:()=>{var e;const t=u.currentWidget;return null!==(e=null==t?void 0:t.content.editor.getOption("matchBrackets"))&&void 0!==e&&e}}),e.addCommand(E.autoClosingBrackets,{execute:async e=>{var o,r;t.autoClosingBrackets=!!(null!==(o=e.force)&&void 0!==o?o:!(null!==(r=t.autoClosingBrackets)&&void 0!==r?r:g.baseConfiguration.autoClosingBrackets));try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set ${l}: ${e.message}`)}},label:o.__("Auto Close Brackets in Text Editor"),isToggled:()=>{var e;return null!==(e=t.autoClosingBrackets)&&void 0!==e?e:g.baseConfiguration.autoClosingBrackets}}),e.addCommand(E.autoClosingBracketsUniversal,{execute:()=>{e.isToggled(E.autoClosingBrackets)||e.isToggled(k)||e.isToggled(T)?(e.execute(E.autoClosingBrackets,{force:!1}),e.execute(k,{force:!1}),e.execute(T,{force:!1})):(e.execute(E.autoClosingBrackets,{force:!0}),e.execute(k,{force:!0}),e.execute(T,{force:!0}))},label:o.__("Auto Close Brackets"),isToggled:()=>e.isToggled(E.autoClosingBrackets)||e.isToggled(k)||e.isToggled(T)}),e.addCommand(E.changeTheme,{label:e=>{var n,r,a,i;return null!==(i=null!==(a=null!==(r=null!==(n=e.displayName)&&void 0!==n?n:e.theme)&&void 0!==r?r:t.theme)&&void 0!==a?a:g.baseConfiguration.theme)&&void 0!==i?i:o.__("Editor Theme")},execute:async e=>{var o;t.theme=null!==(o=e.theme)&&void 0!==o?o:t.theme;try{return await n.set(l,"editorConfig",t)}catch(e){console.error(`Failed to set theme - ${e.message}`)}},isToggled:e=>{var n;return e.theme===(null!==(n=t.theme)&&void 0!==n?n:g.baseConfiguration.theme)}}),e.addCommand(E.find,{label:o.__("Find…"),execute:()=>{const e=u.currentWidget;e&&e.content.editor.execCommand(_.findNext)},isEnabled:s}),e.addCommand(E.goToLine,{label:o.__("Go to Line…"),execute:e=>{const t=u.currentWidget;if(!t)return;const n=t.content.editor,o=e.line,r=e.column;void 0!==o||void 0!==r?n.setCursorPosition({line:(null!=o?o:1)-1,column:(null!=r?r:1)-1}):n.execCommand(_.gotoLine)},isEnabled:s}),e.addCommand(E.changeLanguage,{label:e=>{var t,n;return null!==(n=null!==(t=e.displayName)&&void 0!==t?t:e.name)&&void 0!==n?n:o.__("Change editor language.")},execute:e=>{var t;const n=e.name,o=u.currentWidget;if(n&&o){const e=p.findByName(n);e&&(Array.isArray(e.mime)?o.content.model.mimeType=null!==(t=e.mime[0])&&void 0!==t?t:a.IEditorMimeTypeService.defaultMimeType:o.content.model.mimeType=e.mime)}},isEnabled:s,isToggled:e=>{const t=u.currentWidget;if(!t)return!1;const n=t.content.model.mimeType,o=p.findByMIME(n),r=o&&o.name;return e.name===r}}),e.addCommand(E.replaceSelection,{execute:e=>{var t,n;const o=e.text||"",r=u.currentWidget;r&&(null===(n=(t=r.content.editor).replaceSelection)||void 0===n||n.call(t,o))},isEnabled:s,label:o.__("Replace Selection in Editor")}),e.addCommand(E.createConsole,{execute:t=>{const n=u.currentWidget;if(n)return function(e,t){return async function(n,o){var r,a,i;const d=o||{},c=await e.execute("console:create",{activate:d.activate,name:null===(r=n.context.contentsModel)||void 0===r?void 0:r.name,path:n.context.path,preferredLanguage:n.context.model.defaultKernelLanguage||(null!==(i=null===(a=t.findByFileName(n.context.path))||void 0===a?void 0:a.name)&&void 0!==i?i:""),ref:n.id,insertMode:"split-bottom"});n.context.pathChanged.connect(((e,t)=>{var o;c.session.setPath(t),c.session.setName(null===(o=n.context.contentsModel)||void 0===o?void 0:o.name)}))}}(e,p)(n,t)},isEnabled:s,icon:b.consoleIcon,label:o.__("Create Console for Editor")}),e.addCommand(E.restartConsole,{execute:async()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t||null===f)return;const n=f.find((e=>{var n;return(null===(n=e.sessionContext.session)||void 0===n?void 0:n.path)===t.context.path}));return n?v.restart(n.sessionContext):void 0},label:o.__("Restart Kernel"),isEnabled:()=>null!==f&&s()}),e.addCommand(E.runCode,{execute:()=>{var t;const n=null===(t=u.currentWidget)||void 0===t?void 0:t.content;if(!n)return;let o="";const r=n.editor,a=n.context.path,i=x.PathExt.extname(a),d=r.getSelection(),{start:c,end:l}=d;let s=c.column!==l.column||c.line!==l.line;if(s){const e=r.getOffsetAt(d.start),t=r.getOffsetAt(d.end);o=r.model.sharedModel.getSource().substring(e,t)}else if(x.MarkdownCodeBlocks.isMarkdown(i)){const e=r.model.sharedModel.getSource(),t=x.MarkdownCodeBlocks.findMarkdownCodeBlocks(e);for(const e of t)if(e.startLine<=c.line&&c.line<=e.endLine){o=e.code,s=!0;break}}if(!s){o=r.getLine(d.start.line);const e=r.getCursorPosition();if(e.line+1===r.lineCount){const e=r.model.sharedModel.getSource();r.model.sharedModel.setSource(e+"\n")}r.setCursorPosition({line:e.line+1,column:e.column})}return o?e.execute("console:inject",{activate:!1,code:o,path:a}):Promise.resolve(void 0)},isEnabled:s,label:o.__("Run Selected Code")}),e.addCommand(E.runAllCode,{execute:()=>{var t;const n=null===(t=u.currentWidget)||void 0===t?void 0:t.content;if(!n)return;let o="";const r=n.editor.model.sharedModel.getSource(),a=n.context.path,i=x.PathExt.extname(a);if(x.MarkdownCodeBlocks.isMarkdown(i)){const e=x.MarkdownCodeBlocks.findMarkdownCodeBlocks(r);for(const t of e)o+=t.code}else o=r;return o?e.execute("console:inject",{activate:!1,code:o,path:a}):Promise.resolve(void 0)},isEnabled:s,label:o.__("Run All Code")}),e.addCommand(E.markdownPreview,{execute:()=>{const t=u.currentWidget;if(!t)return;const n=t.context.path;return e.execute("markdownviewer:open",{path:n,options:{mode:"split-right"}})},isVisible:()=>{const e=u.currentWidget;return e&&".md"===x.PathExt.extname(e.context.path)||!1},icon:b.markdownIcon,label:o.__("Show Markdown Preview")}),e.addCommand(E.createNew,{label:e=>{var t,n;return e.isPalette?null!==(t=e.paletteLabel)&&void 0!==t?t:o.__("New Text File"):null!==(n=e.launcherLabel)&&void 0!==n?n:o.__("Text File")},caption:e=>{var t;return null!==(t=e.caption)&&void 0!==t?t:o.__("Create a new text file")},icon:e=>{var t;return e.isPalette?void 0:b.LabIcon.resolve({icon:null!==(t=e.iconName)&&void 0!==t?t:b.textEditorIcon})},execute:t=>{var n;const o=t.cwd||m.model.path;return c(e,o,null!==(n=t.fileExt)&&void 0!==n?n:"txt")}}),e.addCommand(E.createNewMarkdown,{label:e=>e.isPalette?o.__("New Markdown File"):o.__("Markdown File"),caption:o.__("Create a new markdown file"),icon:e=>e.isPalette?void 0:b.markdownIcon,execute:t=>{const n=t.cwd||m.model.path;return c(e,n,"md")}}),e.addCommand(E.undo,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;t&&t.editor.undo()},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&t.editor.model.sharedModel.canUndo()},icon:b.undoIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Undo")}),e.addCommand(E.redo,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;t&&t.editor.redo()},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&t.editor.model.sharedModel.canRedo()},icon:b.redoIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Redo")}),e.addCommand(E.cut,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t)return;const n=t.editor,o=d(n);r.Clipboard.copyToSystem(o),n.replaceSelection&&n.replaceSelection("")},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&i(t.editor)},icon:b.cutIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Cut")}),e.addCommand(E.copy,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t)return;const n=d(t.editor);r.Clipboard.copyToSystem(n)},isEnabled:()=>{var e;if(!s())return!1;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;return!!t&&i(t.editor)},icon:b.copyIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Copy")}),e.addCommand(E.paste,{execute:async()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;if(!t)return;const n=t.editor,o=window.navigator.clipboard,r=await o.readText();r&&n.replaceSelection&&n.replaceSelection(r)},isEnabled:()=>{var e;return Boolean(s()&&(null===(e=u.currentWidget)||void 0===e?void 0:e.content))},icon:b.pasteIcon.bindprops({stylesheet:"menuItem"}),label:o.__("Paste")}),e.addCommand(E.selectAll,{execute:()=>{var e;const t=null===(e=u.currentWidget)||void 0===e?void 0:e.content;t&&t.editor.execCommand(w.selectAll)},isEnabled:()=>{var e;return Boolean(s()&&(null===(e=u.currentWidget)||void 0===e?void 0:e.content))},label:o.__("Select All")});const y=[E.lineNumbers,E.currentLineNumbers,E.lineWrap,E.currentLineWrap,E.matchBrackets,E.currentMatchBrackets,E.find,E.goToLine,E.changeLanguage,E.replaceSelection,E.createConsole,E.restartConsole,E.runCode,E.runAllCode,E.undo,E.redo,E.cut,E.copy,E.paste,E.selectAll,E.createConsole],I=()=>{y.forEach((t=>e.notifyCommandChanged(t)))};u.currentChanged.connect(I),null===(C=h.currentChanged)||void 0===C||C.connect(I)},e.addCompleterCommands=function(e,t,n,o){const r=(null!=o?o:C.nullTranslator).load("jupyterlab");e.addCommand(E.invokeCompleter,{label:r.__("Display the completion helper."),execute:()=>{const e=t.currentWidget&&t.currentWidget.id;if(e)return n.invoke(e)}}),e.addCommand(E.selectCompleter,{label:r.__("Select the completion suggestion."),execute:()=>{const e=t.currentWidget&&t.currentWidget.id;if(e)return n.select(e)}}),e.addKeyBinding({command:E.selectCompleter,keys:["Enter"],selector:".jp-FileEditor .jp-mod-completer-active"})},e.addLauncherItems=function(e,t){l(e,t),s(e,t)},e.addCreateNewToLauncher=l,e.addCreateNewMarkdownToLauncher=s,e.addKernelLanguageLauncherItems=function(e,t,n){for(let o of n)e.add({command:E.createNew,category:t.__("Other"),rank:3,args:o})},e.addPaletteItems=function(e,t){u(e,t),m(e,t),g(e,t),p(e,t)},e.addChangeTabsCommandsToPalette=u,e.addCreateNewCommandToPalette=m,e.addCreateNewMarkdownCommandToPalette=g,e.addChangeFontSizeCommandsToPalette=p,e.addKernelLanguagePaletteItems=function(e,t,n){const o=t.__("Text Editor");for(let t of n)e.addItem({command:E.createNew,args:{...t,isPalette:!0},category:o})},e.addMenuItems=function(e,t,n,o){e.editMenu.undoers.redo.add({id:E.redo,isEnabled:o}),e.editMenu.undoers.undo.add({id:E.undo,isEnabled:o}),e.viewMenu.editorViewers.toggleLineNumbers.add({id:E.currentLineNumbers,isEnabled:o}),e.viewMenu.editorViewers.toggleMatchBrackets.add({id:E.currentMatchBrackets,isEnabled:o}),e.viewMenu.editorViewers.toggleWordWrap.add({id:E.currentLineWrap,isEnabled:o}),e.fileMenu.consoleCreators.add({id:E.createConsole,isEnabled:o}),n&&f(e,n,o)},e.addKernelLanguageMenuItems=function(e,t){for(let n of t)e.fileMenu.newMenu.addItem({command:E.createNew,args:n,rank:31})},e.addCodeRunnersToRunMenu=f,e.addOpenCodeViewerCommand=function(e,t,n,o){e.commands.addCommand(E.openCodeViewer,{label:o.__("Open Code Viewer"),execute:i=>(async i=>{var d;const c=t.factoryService.newDocumentEditor;let l=i.mimeType;!l&&i.extension&&(l=t.mimeTypeService.getMimeTypeByFilePath(`temp.${i.extension.replace(/\\.$/,"")}`));const s=a.CodeViewerWidget.createCodeViewer({factory:e=>c(e),content:i.content,mimeType:l});s.title.label=i.label||o.__("Code Viewer"),s.title.caption=s.title.label;const u=(0,y.find)(e.docRegistry.fileTypes(),(e=>!!l&&e.mimeTypes.includes(l)));s.title.icon=null!==(d=null==u?void 0:u.icon)&&void 0!==d?d:b.textEditorIcon,i.widgetId&&(s.id=i.widgetId);const m=new r.MainAreaWidget({content:s});return await n.add(m),e.shell.add(m,"main"),s})(i)})}}(S||(S={}));const M={id:"@jupyterlab/fileeditor-extension:editor-syntax-status",description:"Adds a file editor syntax status widget.",autoStart:!0,requires:[u.IEditorTracker,i.IEditorLanguageRegistry,o.ILabShell,C.ITranslator],optional:[v.IStatusBar],activate:(e,t,n,o,r,a)=>{if(!a)return;const i=new u.EditorSyntaxStatus({commands:e.commands,languages:n,translator:r});o.currentChanged.connect((()=>{const e=o.currentWidget;e&&t.has(e)&&i.model&&(i.model.editor=e.content.editor)})),a.registerStatusItem(M.id,{item:i,align:"left",rank:0,isActive:()=>!!o.currentWidget&&!!t.currentWidget&&o.currentWidget===t.currentWidget})}},W={activate:function(e,t,n,o,a,i,d,c,l,s,m,g,p,f,v,h,b){const y=W.id,w=null!=h?h:C.nullTranslator,_=null!=p?p:new r.SessionContextDialogs({translator:w}),x=w.load("jupyterlab");let k;v&&(k=(0,r.createToolbarFactory)(v,d,I,y,w));const T=new u.FileEditorFactory({editorServices:t,factoryOptions:{name:I,label:x.__("Editor"),fileTypes:["markdown","*"],defaultFor:["markdown","*"],toolbarFactory:k,translator:w}}),{commands:M,restored:L,shell:N}=e,P=new r.WidgetTracker({namespace:"editor"}),B=()=>null!==P.currentWidget&&P.currentWidget===N.currentWidget,F=new Map([["python",[{fileExt:"py",iconName:"ui-components:python",launcherLabel:x.__("Python File"),paletteLabel:x.__("New Python File"),caption:x.__("Create a new Python file")}]],["julia",[{fileExt:"jl",iconName:"ui-components:julia",launcherLabel:x.__("Julia File"),paletteLabel:x.__("New Julia File"),caption:x.__("Create a new Julia file")}]],["R",[{fileExt:"r",iconName:"ui-components:r-kernel",launcherLabel:x.__("R File"),paletteLabel:x.__("New R File"),caption:x.__("Create a new R file")}]]]);if(g&&g.restore(P,{command:"docmanager:open",args:e=>({path:e.context.path,factory:I}),name:e=>e.context.path}),Promise.all([d.load(y),L]).then((([e])=>{var t,n,r;if(m){const e=null===(t=m.viewMenu.items.find((e=>{var t;return"submenu"===e.type&&"jp-mainmenu-view-codemirror-language"===(null===(t=e.submenu)||void 0===t?void 0:t.id)})))||void 0===t?void 0:t.submenu;e&&o.getLanguages().sort(((e,t)=>{const n=e.name,o=t.name;return n.localeCompare(o)})).forEach((t=>{0!==t.name.toLowerCase().indexOf("brainf")&&e.addItem({command:E.changeLanguage,args:{...t}})}));const i=null===(n=m.settingsMenu.items.find((e=>{var t;return"submenu"===e.type&&"jp-mainmenu-settings-codemirror-theme"===(null===(t=e.submenu)||void 0===t?void 0:t.id)})))||void 0===n?void 0:n.submenu;if(i)for(const e of a.themes)i.addItem({command:E.changeTheme,args:{theme:e.name,displayName:null!==(r=e.displayName)&&void 0!==r?r:e.name}});m.editMenu.goToLiners.add({id:E.goToLine,isEnabled:e=>null!==P.currentWidget&&P.has(e)})}S.updateSettings(e,M),S.updateTracker(P),e.changed.connect((()=>{S.updateSettings(e,M),S.updateTracker(P)}))})).catch((e=>{console.error(e.message),S.updateTracker(P)})),b){const e=b.getRenderer("@jupyterlab/codemirror-extension:plugin.defaultConfig");e&&b.addRenderer("@jupyterlab/fileeditor-extension:plugin.editorConfig",e)}T.widgetCreated.connect(((e,t)=>{t.context.pathChanged.connect((()=>{P.save(t)})),P.add(t),S.updateWidget(t.content)})),e.docRegistry.addWidgetFactory(T),P.widgetAdded.connect(((e,t)=>{S.updateWidget(t.content)})),S.addCommands(e.commands,d,x,y,B,P,i,n,o,c,_,e.shell);const R=new r.WidgetTracker({namespace:"codeviewer"});return g&&g.restore(R,{command:E.openCodeViewer,args:e=>({content:e.content.content,label:e.content.title.label,mimeType:e.content.mimeType,widgetId:e.content.id}),name:e=>e.content.id}),S.addOpenCodeViewerCommand(e,t,R,x),s&&S.addLauncherItems(s,x),l&&S.addPaletteItems(l,x),m&&S.addMenuItems(m,P,c,B),(async()=>{var t,n;const o=e.serviceManager.kernelspecs;await o.ready;let r=new Set;const a=null!==(n=null===(t=o.specs)||void 0===t?void 0:t.kernelspecs)&&void 0!==n?n:{};return Object.keys(a).forEach((e=>{const t=a[e];if(t){const e=F.get(t.language);null==e||e.forEach((e=>r.add(e)))}})),r})().then((e=>{s&&S.addKernelLanguageLauncherItems(s,x,e),l&&S.addKernelLanguagePaletteItems(l,x,e),m&&S.addKernelLanguageMenuItems(m,e)})).catch((e=>{console.error(e.message)})),f&&(f.add(new u.LaTeXTableOfContentsFactory(P)),f.add(new u.MarkdownTableOfContentsFactory(P)),f.add(new u.PythonTableOfContentsFactory(P))),P},id:"@jupyterlab/fileeditor-extension:plugin",description:"Provides the file editor widget tracker.",requires:[a.IEditorServices,i.IEditorExtensionRegistry,i.IEditorLanguageRegistry,i.IEditorThemeRegistry,s.IDefaultFileBrowser,f.ISettingRegistry],optional:[c.IConsoleTracker,r.ICommandPalette,m.ILauncher,p.IMainMenu,o.ILayoutRestorer,r.ISessionContextDialogs,h.ITableOfContentsRegistry,r.IToolbarWidgetRegistry,C.ITranslator,b.IFormRendererRegistry],provides:u.IEditorTracker,autoStart:!0},L={id:"@jupyterlab/fileeditor-extension:tab-space-status",description:"Adds a file editor indentation status widget.",autoStart:!0,requires:[u.IEditorTracker,i.IEditorExtensionRegistry,f.ISettingRegistry,C.ITranslator],optional:[v.IStatusBar],activate:(e,t,n,o,r,a)=>{const i=r.load("jupyterlab");if(!a)return;const d=new b.MenuSvg({commands:e.commands}),c="fileeditor:change-tabs",{shell:l}=e,s={name:i.__("Indent with Tab")};d.addItem({command:c,args:s});for(const e of["1","2","4","8"]){const t={size:e,name:i._p("v4","Spaces: %1",e)};d.addItem({command:c,args:t})}const m=new u.TabSpaceStatus({menu:d,translator:r}),g=e=>{var t,o,r;m.model.indentUnit=null!==(r=null!==(o=null===(t=e.get("editorConfig").composite)||void 0===t?void 0:t.indentUnit)&&void 0!==o?o:n.baseConfiguration.indentUnit)&&void 0!==r?r:null};Promise.all([o.load("@jupyterlab/fileeditor-extension:plugin"),e.restored]).then((([e])=>{g(e),e.changed.connect(g)})),a.registerStatusItem("@jupyterlab/fileeditor-extension:tab-space-status",{item:m,align:"right",rank:1,isActive:()=>!!l.currentWidget&&t.has(l.currentWidget)})}},N={id:"@jupyterlab/fileeditor-extension:cursor-position",description:"Adds a file editor cursor position status widget.",activate:(e,t,n)=>{n.addEditorProvider((e=>Promise.resolve(e&&t.has(e)?e.content.editor:null)))},requires:[u.IEditorTracker,a.IPositionModel],autoStart:!0},P={id:"@jupyterlab/fileeditor-extension:completer",description:"Adds the completer capability to the file editor.",requires:[u.IEditorTracker],optional:[d.ICompletionProviderManager,C.ITranslator,r.ISanitizer],activate:function(e,t,n,o,a){if(!n)return;S.addCompleterCommands(e.commands,t,n,o);const i=e.serviceManager.sessions,d=null!=a?a:new r.Sanitizer,c=new Map,l=async(e,t)=>{const o={editor:t.content.editor,widget:t};await n.updateCompleter(o);const r=(e,o)=>{const r=c.get(t.id),a=(0,y.find)(o,(e=>e.path===t.context.path));if(a){if(r&&r.id===a.id)return;r&&(c.delete(t.id),r.dispose());const e=i.connectTo({model:a}),o={editor:t.content.editor,widget:t,session:e,sanitizer:d};n.updateCompleter(o).catch(console.error),c.set(t.id,e)}else r&&(c.delete(t.id),r.dispose())};r(0,Array.from(i.running())),i.runningChanged.connect(r),t.disposed.connect((()=>{i.runningChanged.disconnect(r);const e=c.get(t.id);e&&(c.delete(t.id),e.dispose())}))};t.widgetAdded.connect(l),n.activeProvidersChanged.connect((()=>{t.forEach((e=>{l(0,e).catch(console.error)}))}))},autoStart:!0},B={id:"@jupyterlab/fileeditor-extension:search",description:"Adds search capability to the file editor.",requires:[l.ISearchProviderRegistry],autoStart:!0,activate:(e,t)=>{t.add("jp-fileeditorSearchProvider",u.FileEditorSearchProvider)}},F={id:"@jupyterlab/fileeditor-extension:language-server",description:"Adds Language Server capability to the file editor.",requires:[u.IEditorTracker,g.ILSPDocumentConnectionManager,g.ILSPFeatureManager,g.ILSPCodeExtractorsManager,g.IWidgetLSPAdapterTracker],activate:function(e,t,n,o,r,a){t.widgetAdded.connect((async(t,i)=>{const d=new u.FileEditorAdapter(i,{connectionManager:n,featureManager:o,foreignCodeExtractorsManager:r,docRegistry:e.docRegistry});a.add(d)}))},autoStart:!0},R=[W,N,P,F,B,M,L]}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7639,3680],{53680:(e,t,s)=>{s.r(t),s.d(t,{GroupItem:()=>r,IStatusBar:()=>f,Popup:()=>h,ProgressBar:()=>l,ProgressCircle:()=>m,StatusBar:()=>v,TextItem:()=>u,showPopup:()=>d});var i=s(78156),a=s.n(i);function r(e){const{spacing:t,children:s,className:a,...r}=e,n=i.Children.count(s);return i.createElement("div",{className:`jp-StatusBar-GroupItem ${a||""}`,...r},i.Children.map(s,((e,s)=>0===s?i.createElement("div",{style:{marginRight:`${t}px`}},e):s===n-1?i.createElement("div",{style:{marginLeft:`${t}px`}},e):i.createElement("div",{style:{margin:`0px ${t}px`}},e))))}var n=s(35613),o=s(63485);function d(e){const t=new h(e);return e.startHidden||t.launch(),t}class h extends o.Widget{constructor(e){super(),this._body=e.body,this._body.addClass("jp-StatusBar-HoverItem"),this._anchor=e.anchor,this._align=e.align,e.hasDynamicSize&&(this._observer=new ResizeObserver((()=>{this.update()}))),(this.layout=new o.PanelLayout).addWidget(e.body),this._body.node.addEventListener("resize",(()=>{this.update()}))}launch(){this._setGeometry(),o.Widget.attach(this,document.body),this.update(),this._anchor.addClass("jp-mod-clicked"),this._anchor.removeClass("jp-mod-highlight")}onUpdateRequest(e){this._setGeometry(),super.onUpdateRequest(e)}onAfterAttach(e){var t;document.addEventListener("click",this,!1),this.node.addEventListener("keydown",this,!1),window.addEventListener("resize",this,!1),null===(t=this._observer)||void 0===t||t.observe(this._body.node)}onBeforeDetach(e){var t;null===(t=this._observer)||void 0===t||t.disconnect(),document.removeEventListener("click",this,!1),this.node.removeEventListener("keydown",this,!1),window.removeEventListener("resize",this,!1)}onResize(){this.update()}dispose(){var e;null===(e=this._observer)||void 0===e||e.disconnect(),super.dispose(),this._anchor.removeClass("jp-mod-clicked"),this._anchor.addClass("jp-mod-highlight")}handleEvent(e){switch(e.type){case"keydown":this._evtKeydown(e);break;case"click":this._evtClick(e);break;case"resize":this.onResize()}}_evtClick(e){!e.target||this._body.node.contains(e.target)||this._anchor.node.contains(e.target)||this.dispose()}_evtKeydown(e){27===e.keyCode&&(e.stopPropagation(),e.preventDefault(),this.dispose())}_setGeometry(){let e=0;const t=this._anchor.node.getBoundingClientRect(),s=this._body.node.getBoundingClientRect();"right"===this._align&&(e=-(s.width-t.width));const i=window.getComputedStyle(this._body.node);n.HoverBox.setGeometry({anchor:t,host:document.body,maxHeight:500,minHeight:20,node:this._body.node,offset:{horizontal:e},privilege:"forceAbove",style:i})}}function l(e){const{width:t,percentage:s,...a}=e;return i.createElement("div",{className:"jp-Statusbar-ProgressBar-progress-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s},i.createElement(c,{percentage:s,...a,contentWidth:t}))}function c(e){return i.createElement("div",{style:{width:`${e.percentage}%`}},i.createElement("p",null,e.content))}function u(e){const{title:t,source:s,className:a,...r}=e;return i.createElement("span",{className:`jp-StatusBar-TextItem ${a}`,title:t,...r},s)}function m(e){return a().createElement("div",{className:"jp-Statusbar-ProgressCircle",role:"progressbar","aria-label":e.label||"Unlabelled progress circle","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e.progress},a().createElement("svg",{viewBox:"0 0 250 250"},a().createElement("circle",{cx:"125",cy:"125",r:"104",stroke:"var(--jp-inverse-layout-color3)",strokeWidth:"20",fill:"none"}),a().createElement("path",{className:"jp-Statusbar-ProgressCirclePath",transform:"translate(125,125) scale(.9)",d:(e=>{const t=Math.max(3.6*e,.1),s=t*Math.PI/180,i=104*Math.sin(s),a=-104*Math.cos(s);return"M 0 0 v -104 A 104 104 1 "+(t<180?1:0)+" 0 "+i.toFixed(4)+" "+a.toFixed(4)+" z"})(e.progress),fill:"var(--jp-inverse-layout-color3)"})))}var p,g=s(33625),_=s(2549);class v extends o.Widget{constructor(){super(),this._isWindowNarrow=()=>window.innerWidth<=630,this._leftRankItems=[],this._rightRankItems=[],this._statusItems={},this._disposables=new _.DisposableSet,this.addClass("jp-StatusBar-Widget");const e=this.layout=new o.PanelLayout,t=this._leftSide=new o.Panel,s=this._middlePanel=new o.Panel,i=this._rightSide=new o.Panel;t.addClass("jp-StatusBar-Left"),s.addClass("jp-StatusBar-Middle"),i.addClass("jp-StatusBar-Right"),e.addWidget(t),e.addWidget(s),e.addWidget(i)}registerStatusItem(e,t){if(e in this._statusItems)throw new Error(`Status item ${e} already registered.`);const s={...p.statusItemDefaults,...t},{align:i,item:a,rank:r,priority:n}=s,o=()=>{this._refreshItem(e)};s.activeStateChanged&&s.activeStateChanged.connect(o);const d={id:e,rank:r,priority:n};if(s.item.addClass("jp-StatusBar-Item"),this._statusItems[e]=s,"left"===i){const e=this._findInsertIndex(this._leftRankItems,d);-1===e?(this._leftSide.addWidget(a),this._leftRankItems.push(d)):(g.ArrayExt.insert(this._leftRankItems,e,d),this._leftSide.insertWidget(e,a))}else if("right"===i){const e=this._findInsertIndex(this._rightRankItems,d);-1===e?(this._rightSide.addWidget(a),this._rightRankItems.push(d)):(g.ArrayExt.insert(this._rightRankItems,e,d),this._rightSide.insertWidget(e,a))}else this._middlePanel.addWidget(a);this._refreshItem(e);const h=new _.DisposableDelegate((()=>{delete this._statusItems[e],s.activeStateChanged&&s.activeStateChanged.disconnect(o),a.parent=null,a.dispose()}));return this._disposables.add(h),h}dispose(){this._leftRankItems.length=0,this._rightRankItems.length=0,this._disposables.dispose(),super.dispose()}onUpdateRequest(e){this._refreshAll(),super.onUpdateRequest(e)}_findInsertIndex(e,t){return g.ArrayExt.findFirstIndex(e,(e=>e.rank>t.rank))}_refreshItem(e){const t=this._statusItems[e];!t.isActive()||0===t.priority&&this._isWindowNarrow()?t.item.hide():(t.item.show(),t.item.update())}_refreshAll(){Object.keys(this._statusItems).forEach((e=>{this._refreshItem(e)}))}}!function(e){e.statusItemDefaults={align:"left",rank:0,priority:0,isActive:()=>!0,activeStateChanged:void 0}}(p||(p={}));const f=new(s(20998).Token)("@jupyterlab/statusbar:IStatusBar","A service for the status bar on the application. Use this if you want to add new status bar items.")}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7639,3680],{53680:(e,t,s)=>{s.r(t),s.d(t,{GroupItem:()=>r,IStatusBar:()=>f,Popup:()=>h,ProgressBar:()=>l,ProgressCircle:()=>m,StatusBar:()=>v,TextItem:()=>u,showPopup:()=>d});var i=s(78156),a=s.n(i);function r(e){const{spacing:t,children:s,className:a,...r}=e,n=i.Children.count(s);return i.createElement("div",{className:`jp-StatusBar-GroupItem ${a||""}`,...r},i.Children.map(s,((e,s)=>0===s?i.createElement("div",{style:{marginRight:`${t}px`}},e):s===n-1?i.createElement("div",{style:{marginLeft:`${t}px`}},e):i.createElement("div",{style:{margin:`0px ${t}px`}},e))))}var n=s(14576),o=s(63485);function d(e){const t=new h(e);return e.startHidden||t.launch(),t}class h extends o.Widget{constructor(e){super(),this._body=e.body,this._body.addClass("jp-StatusBar-HoverItem"),this._anchor=e.anchor,this._align=e.align,e.hasDynamicSize&&(this._observer=new ResizeObserver((()=>{this.update()}))),(this.layout=new o.PanelLayout).addWidget(e.body),this._body.node.addEventListener("resize",(()=>{this.update()}))}launch(){this._setGeometry(),o.Widget.attach(this,document.body),this.update(),this._anchor.addClass("jp-mod-clicked"),this._anchor.removeClass("jp-mod-highlight")}onUpdateRequest(e){this._setGeometry(),super.onUpdateRequest(e)}onAfterAttach(e){var t;document.addEventListener("click",this,!1),this.node.addEventListener("keydown",this,!1),window.addEventListener("resize",this,!1),null===(t=this._observer)||void 0===t||t.observe(this._body.node)}onBeforeDetach(e){var t;null===(t=this._observer)||void 0===t||t.disconnect(),document.removeEventListener("click",this,!1),this.node.removeEventListener("keydown",this,!1),window.removeEventListener("resize",this,!1)}onResize(){this.update()}dispose(){var e;null===(e=this._observer)||void 0===e||e.disconnect(),super.dispose(),this._anchor.removeClass("jp-mod-clicked"),this._anchor.addClass("jp-mod-highlight")}handleEvent(e){switch(e.type){case"keydown":this._evtKeydown(e);break;case"click":this._evtClick(e);break;case"resize":this.onResize()}}_evtClick(e){!e.target||this._body.node.contains(e.target)||this._anchor.node.contains(e.target)||this.dispose()}_evtKeydown(e){27===e.keyCode&&(e.stopPropagation(),e.preventDefault(),this.dispose())}_setGeometry(){let e=0;const t=this._anchor.node.getBoundingClientRect(),s=this._body.node.getBoundingClientRect();"right"===this._align&&(e=-(s.width-t.width));const i=window.getComputedStyle(this._body.node);n.HoverBox.setGeometry({anchor:t,host:document.body,maxHeight:500,minHeight:20,node:this._body.node,offset:{horizontal:e},privilege:"forceAbove",style:i})}}function l(e){const{width:t,percentage:s,...a}=e;return i.createElement("div",{className:"jp-Statusbar-ProgressBar-progress-bar",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":s},i.createElement(c,{percentage:s,...a,contentWidth:t}))}function c(e){return i.createElement("div",{style:{width:`${e.percentage}%`}},i.createElement("p",null,e.content))}function u(e){const{title:t,source:s,className:a,...r}=e;return i.createElement("span",{className:`jp-StatusBar-TextItem ${a}`,title:t,...r},s)}function m(e){return a().createElement("div",{className:"jp-Statusbar-ProgressCircle",role:"progressbar","aria-label":e.label||"Unlabelled progress circle","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e.progress},a().createElement("svg",{viewBox:"0 0 250 250"},a().createElement("circle",{cx:"125",cy:"125",r:"104",stroke:"var(--jp-inverse-layout-color3)",strokeWidth:"20",fill:"none"}),a().createElement("path",{className:"jp-Statusbar-ProgressCirclePath",transform:"translate(125,125) scale(.9)",d:(e=>{const t=Math.max(3.6*e,.1),s=t*Math.PI/180,i=104*Math.sin(s),a=-104*Math.cos(s);return"M 0 0 v -104 A 104 104 1 "+(t<180?1:0)+" 0 "+i.toFixed(4)+" "+a.toFixed(4)+" z"})(e.progress),fill:"var(--jp-inverse-layout-color3)"})))}var p,g=s(33625),_=s(2549);class v extends o.Widget{constructor(){super(),this._isWindowNarrow=()=>window.innerWidth<=630,this._leftRankItems=[],this._rightRankItems=[],this._statusItems={},this._disposables=new _.DisposableSet,this.addClass("jp-StatusBar-Widget");const e=this.layout=new o.PanelLayout,t=this._leftSide=new o.Panel,s=this._middlePanel=new o.Panel,i=this._rightSide=new o.Panel;t.addClass("jp-StatusBar-Left"),s.addClass("jp-StatusBar-Middle"),i.addClass("jp-StatusBar-Right"),e.addWidget(t),e.addWidget(s),e.addWidget(i)}registerStatusItem(e,t){if(e in this._statusItems)throw new Error(`Status item ${e} already registered.`);const s={...p.statusItemDefaults,...t},{align:i,item:a,rank:r,priority:n}=s,o=()=>{this._refreshItem(e)};s.activeStateChanged&&s.activeStateChanged.connect(o);const d={id:e,rank:r,priority:n};if(s.item.addClass("jp-StatusBar-Item"),this._statusItems[e]=s,"left"===i){const e=this._findInsertIndex(this._leftRankItems,d);-1===e?(this._leftSide.addWidget(a),this._leftRankItems.push(d)):(g.ArrayExt.insert(this._leftRankItems,e,d),this._leftSide.insertWidget(e,a))}else if("right"===i){const e=this._findInsertIndex(this._rightRankItems,d);-1===e?(this._rightSide.addWidget(a),this._rightRankItems.push(d)):(g.ArrayExt.insert(this._rightRankItems,e,d),this._rightSide.insertWidget(e,a))}else this._middlePanel.addWidget(a);this._refreshItem(e);const h=new _.DisposableDelegate((()=>{delete this._statusItems[e],s.activeStateChanged&&s.activeStateChanged.disconnect(o),a.parent=null,a.dispose()}));return this._disposables.add(h),h}dispose(){this._leftRankItems.length=0,this._rightRankItems.length=0,this._disposables.dispose(),super.dispose()}onUpdateRequest(e){this._refreshAll(),super.onUpdateRequest(e)}_findInsertIndex(e,t){return g.ArrayExt.findFirstIndex(e,(e=>e.rank>t.rank))}_refreshItem(e){const t=this._statusItems[e];!t.isActive()||0===t.priority&&this._isWindowNarrow()?t.item.hide():(t.item.show(),t.item.update())}_refreshAll(){Object.keys(this._statusItems).forEach((e=>{this._refreshItem(e)}))}}!function(e){e.statusItemDefaults={align:"left",rank:0,priority:0,isActive:()=>!0,activeStateChanged:void 0}}(p||(p={}));const f=new(s(20998).Token)("@jupyterlab/statusbar:IStatusBar","A service for the status bar on the application. Use this if you want to add new status bar items.")}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7655],{97655:(e,t,o)=>{o.r(t),o.d(t,{default:()=>S,lineColItem:()=>w});var r,n=o(44604),i=o(51429),a=o(71098),s=o(12030),d=o(87797),l=o(24636);!function(e){e.deleteLine="codemirror:delete-line",e.toggleBlockComment="codemirror:toggle-block-comment",e.toggleComment="codemirror:toggle-comment",e.selectNextOccurrence="codemirror:select-next-occurrence"}(r||(r={}));const c=".cm-content",m={id:"@jupyterlab/codemirror-extension:commands",description:"Registers commands acting on selected/active CodeMirror editor.",autoStart:!0,optional:[s.ITranslator],activate:(e,t)=>{const o=(t=null!=t?t:s.nullTranslator).load("jupyterlab"),n=e=>e.classList.contains(c),i=()=>{var t,o;const r=null!==(t=e.contextMenuHitTest(n))&&void 0!==t?t:null===(o=document.activeElement)||void 0===o?void 0:o.closest(c);if(r&&"cmView"in r)return r.cmView.view},a=()=>!!i();e.commands.addCommand(r.deleteLine,{label:o.__("Delete the current line"),execute:()=>{const e=i();e&&(0,d.deleteLine)(e)},isEnabled:a}),e.commands.addCommand(r.toggleBlockComment,{label:o.__("Toggle Block Comment"),caption:o.__("Toggles block commends in languages which support it (e.g. C, JavaScript)"),execute:()=>{const e=i();e&&(0,d.toggleBlockComment)(e)},isEnabled:a}),e.commands.addCommand(r.toggleComment,{label:o.__("Toggle Comment"),execute:()=>{const e=i();e&&(0,d.toggleComment)(e)},isEnabled:a}),e.commands.addCommand(r.selectNextOccurrence,{label:o.__("Select Next Occurrence"),execute:()=>{const e=i();e&&(0,l.selectNextOccurrence)(e)},isEnabled:a})}};var u=o(17592),g=o(30525),p=o(23295),h=o(35613),v=o(20998),y=o(27478),f=o.n(y),E=o(78156),x=o.n(E);const b="@jupyterlab/codemirror-extension:plugin",C={id:"@jupyterlab/codemirror-extension:languages",description:"Provides the CodeMirror languages registry.",provides:g.IEditorLanguageRegistry,optional:[s.ITranslator],activate:(e,t)=>{const r=new g.EditorLanguageRegistry;for(const e of g.EditorLanguageRegistry.getDefaultLanguages(t))r.addLanguage(e);return r.addLanguage({name:"ipythongfm",mime:"text/x-ipythongfm",load:async()=>{const[e,t,n]=await Promise.all([o.e(1120).then(o.t.bind(o,51120,23)),Promise.all([o.e(9799),o.e(2552),o.e(3546),o.e(9843),o.e(9352),o.e(2209)]).then(o.bind(o,12552)),o.e(311).then(o.bind(o,60311))]),i=e.markdown({base:e.markdownLanguage,codeLanguages:e=>r.findBest(e),extensions:[(0,g.parseMathIPython)(u.StreamLanguage.define(n.stexMath).parser)]});return new u.LanguageSupport(i.language,[i.support,(0,g.pythonBuiltin)(t.pythonLanguage)])}}),r}},T={id:"@jupyterlab/codemirror-extension:themes",description:"Provides the CodeMirror theme registry",provides:g.IEditorThemeRegistry,optional:[s.ITranslator],activate:(e,t)=>{const o=new g.EditorThemeRegistry;for(const e of g.EditorThemeRegistry.getDefaultThemes(t))o.addTheme(e);return o}},R={id:"@jupyterlab/codemirror-extension:extensions",description:"Provides the CodeMirror extension factory registry.",provides:g.IEditorExtensionRegistry,requires:[g.IEditorThemeRegistry],optional:[s.ITranslator,p.ISettingRegistry,h.IFormRendererRegistry],activate:(e,t,o,r,n)=>{const i=new g.EditorExtensionRegistry;for(const e of g.EditorExtensionRegistry.getDefaultExtensions({themes:t,translator:o}))i.addExtension(e);if(r){const t=e=>{var t;i.baseConfiguration=null!==(t=e.get("defaultConfig").composite)&&void 0!==t?t:{}};Promise.all([r.load(b),e.restored]).then((([e])=>{t(e),e.changed.connect(t)})),null==n||n.addRenderer(`${b}.defaultConfig`,{fieldRenderer:e=>{const t=x().useMemo((()=>i.settingsSchema),[]),r={};for(const[e,o]of Object.entries(i.defaultConfiguration))void 0!==t[e]&&(r[e]=o);return x().createElement("div",{className:"jp-FormGroup-contentNormal"},x().createElement("h3",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem"},e.schema.title),e.schema.description&&x().createElement("div",{className:"jp-FormGroup-description"},e.schema.description),x().createElement(h.FormComponent,{schema:{title:e.schema.title,description:e.schema.description,type:"object",properties:t,additionalProperties:!1},validator:f(),formData:{...r,...e.formData},formContext:{defaultFormData:r},liveValidate:!0,onChange:t=>{var o;const n={};for(const[e,i]of Object.entries(null!==(o=t.formData)&&void 0!==o?o:{})){const t=r[e];void 0!==t&&v.JSONExt.deepEqual(i,t)||(n[e]=i)}e.onChange(n)},tagName:"div",translator:null!=o?o:s.nullTranslator}))}})}return i}},I={id:"@jupyterlab/codemirror-extension:binding",description:"Register the CodeMirror extension factory binding the editor and the shared model.",autoStart:!0,requires:[g.IEditorExtensionRegistry],activate:(e,t)=>{t.addExtension({name:"shared-model-binding",factory:e=>{var t;const o=e.model.sharedModel;return g.EditorExtensionRegistry.createImmutableExtension((0,g.ybinding)({ytext:o.ysource,undoManager:null!==(t=o.undoManager)&&void 0!==t?t:void 0}))}})}},L={id:"@jupyterlab/codemirror-extension:services",description:"Provides the service to instantiate CodeMirror editors.",provides:i.IEditorServices,requires:[g.IEditorLanguageRegistry,g.IEditorExtensionRegistry],optional:[s.ITranslator],activate:(e,t,o,r)=>({factoryService:new g.CodeMirrorEditorFactory({extensions:o,languages:t,translator:null!=r?r:s.nullTranslator}),mimeTypeService:new g.CodeMirrorMimeTypeService(t)})},w={id:"@jupyterlab/codemirror-extension:line-col-status",description:"Provides the code editor cursor position model.",autoStart:!0,requires:[s.ITranslator],optional:[n.ILabShell,a.IStatusBar],provides:i.IPositionModel,activate:(e,t,o,r)=>{const n=new i.LineCol(t),a=new Set;function s(e,t){Promise.all([...a].map((e=>e(t.newValue)))).then((e=>{var t;n.model.editor=null!==(t=e.filter((e=>null!==e))[0])&&void 0!==t?t:null})).catch((e=>{console.error("Get editors",e)}))}return r&&r.registerStatusItem(w.id,{priority:1,item:n,align:"right",rank:2,isActive:()=>!!n.model.editor}),o&&o.currentChanged.connect(s),{addEditorProvider:t=>{a.add(t),e.shell.currentWidget&&s(e.shell,{newValue:e.shell.currentWidget,oldValue:null})},update:()=>{s(e.shell,{oldValue:e.shell.currentWidget,newValue:e.shell.currentWidget})}}}},S=[m,C,T,I,R,L,w]}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7655],{97655:(e,t,o)=>{o.r(t),o.d(t,{default:()=>S,lineColItem:()=>w});var r,n=o(2756),i=o(68481),a=o(47652),s=o(90646),d=o(87797),l=o(24636);!function(e){e.deleteLine="codemirror:delete-line",e.toggleBlockComment="codemirror:toggle-block-comment",e.toggleComment="codemirror:toggle-comment",e.selectNextOccurrence="codemirror:select-next-occurrence"}(r||(r={}));const c=".cm-content",m={id:"@jupyterlab/codemirror-extension:commands",description:"Registers commands acting on selected/active CodeMirror editor.",autoStart:!0,optional:[s.ITranslator],activate:(e,t)=>{const o=(t=null!=t?t:s.nullTranslator).load("jupyterlab"),n=e=>e.classList.contains(c),i=()=>{var t,o;const r=null!==(t=e.contextMenuHitTest(n))&&void 0!==t?t:null===(o=document.activeElement)||void 0===o?void 0:o.closest(c);if(r&&"cmView"in r)return r.cmView.view},a=()=>!!i();e.commands.addCommand(r.deleteLine,{label:o.__("Delete the current line"),execute:()=>{const e=i();e&&(0,d.deleteLine)(e)},isEnabled:a}),e.commands.addCommand(r.toggleBlockComment,{label:o.__("Toggle Block Comment"),caption:o.__("Toggles block commends in languages which support it (e.g. C, JavaScript)"),execute:()=>{const e=i();e&&(0,d.toggleBlockComment)(e)},isEnabled:a}),e.commands.addCommand(r.toggleComment,{label:o.__("Toggle Comment"),execute:()=>{const e=i();e&&(0,d.toggleComment)(e)},isEnabled:a}),e.commands.addCommand(r.selectNextOccurrence,{label:o.__("Select Next Occurrence"),execute:()=>{const e=i();e&&(0,l.selectNextOccurrence)(e)},isEnabled:a})}};var u=o(17592),g=o(75536),p=o(3339),h=o(14576),v=o(20998),y=o(27478),f=o.n(y),E=o(78156),x=o.n(E);const b="@jupyterlab/codemirror-extension:plugin",C={id:"@jupyterlab/codemirror-extension:languages",description:"Provides the CodeMirror languages registry.",provides:g.IEditorLanguageRegistry,optional:[s.ITranslator],activate:(e,t)=>{const r=new g.EditorLanguageRegistry;for(const e of g.EditorLanguageRegistry.getDefaultLanguages(t))r.addLanguage(e);return r.addLanguage({name:"ipythongfm",mime:"text/x-ipythongfm",load:async()=>{const[e,t,n]=await Promise.all([o.e(1120).then(o.t.bind(o,51120,23)),Promise.all([o.e(9799),o.e(2552),o.e(3546),o.e(9843),o.e(9352),o.e(2209)]).then(o.bind(o,12552)),o.e(311).then(o.bind(o,60311))]),i=e.markdown({base:e.markdownLanguage,codeLanguages:e=>r.findBest(e),extensions:[(0,g.parseMathIPython)(u.StreamLanguage.define(n.stexMath).parser)]});return new u.LanguageSupport(i.language,[i.support,(0,g.pythonBuiltin)(t.pythonLanguage)])}}),r}},T={id:"@jupyterlab/codemirror-extension:themes",description:"Provides the CodeMirror theme registry",provides:g.IEditorThemeRegistry,optional:[s.ITranslator],activate:(e,t)=>{const o=new g.EditorThemeRegistry;for(const e of g.EditorThemeRegistry.getDefaultThemes(t))o.addTheme(e);return o}},R={id:"@jupyterlab/codemirror-extension:extensions",description:"Provides the CodeMirror extension factory registry.",provides:g.IEditorExtensionRegistry,requires:[g.IEditorThemeRegistry],optional:[s.ITranslator,p.ISettingRegistry,h.IFormRendererRegistry],activate:(e,t,o,r,n)=>{const i=new g.EditorExtensionRegistry;for(const e of g.EditorExtensionRegistry.getDefaultExtensions({themes:t,translator:o}))i.addExtension(e);if(r){const t=e=>{var t;i.baseConfiguration=null!==(t=e.get("defaultConfig").composite)&&void 0!==t?t:{}};Promise.all([r.load(b),e.restored]).then((([e])=>{t(e),e.changed.connect(t)})),null==n||n.addRenderer(`${b}.defaultConfig`,{fieldRenderer:e=>{const t=x().useMemo((()=>i.settingsSchema),[]),r={};for(const[e,o]of Object.entries(i.defaultConfiguration))void 0!==t[e]&&(r[e]=o);return x().createElement("div",{className:"jp-FormGroup-contentNormal"},x().createElement("h3",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem"},e.schema.title),e.schema.description&&x().createElement("div",{className:"jp-FormGroup-description"},e.schema.description),x().createElement(h.FormComponent,{schema:{title:e.schema.title,description:e.schema.description,type:"object",properties:t,additionalProperties:!1},validator:f(),formData:{...r,...e.formData},formContext:{defaultFormData:r},liveValidate:!0,onChange:t=>{var o;const n={};for(const[e,i]of Object.entries(null!==(o=t.formData)&&void 0!==o?o:{})){const t=r[e];void 0!==t&&v.JSONExt.deepEqual(i,t)||(n[e]=i)}e.onChange(n)},tagName:"div",translator:null!=o?o:s.nullTranslator}))}})}return i}},I={id:"@jupyterlab/codemirror-extension:binding",description:"Register the CodeMirror extension factory binding the editor and the shared model.",autoStart:!0,requires:[g.IEditorExtensionRegistry],activate:(e,t)=>{t.addExtension({name:"shared-model-binding",factory:e=>{var t;const o=e.model.sharedModel;return g.EditorExtensionRegistry.createImmutableExtension((0,g.ybinding)({ytext:o.ysource,undoManager:null!==(t=o.undoManager)&&void 0!==t?t:void 0}))}})}},L={id:"@jupyterlab/codemirror-extension:services",description:"Provides the service to instantiate CodeMirror editors.",provides:i.IEditorServices,requires:[g.IEditorLanguageRegistry,g.IEditorExtensionRegistry],optional:[s.ITranslator],activate:(e,t,o,r)=>({factoryService:new g.CodeMirrorEditorFactory({extensions:o,languages:t,translator:null!=r?r:s.nullTranslator}),mimeTypeService:new g.CodeMirrorMimeTypeService(t)})},w={id:"@jupyterlab/codemirror-extension:line-col-status",description:"Provides the code editor cursor position model.",autoStart:!0,requires:[s.ITranslator],optional:[n.ILabShell,a.IStatusBar],provides:i.IPositionModel,activate:(e,t,o,r)=>{const n=new i.LineCol(t),a=new Set;function s(e,t){Promise.all([...a].map((e=>e(t.newValue)))).then((e=>{var t;n.model.editor=null!==(t=e.filter((e=>null!==e))[0])&&void 0!==t?t:null})).catch((e=>{console.error("Get editors",e)}))}return r&&r.registerStatusItem(w.id,{priority:1,item:n,align:"right",rank:2,isActive:()=>!!n.model.editor}),o&&o.currentChanged.connect(s),{addEditorProvider:t=>{a.add(t),e.shell.currentWidget&&s(e.shell,{newValue:e.shell.currentWidget,oldValue:null})},update:()=>{s(e.shell,{oldValue:e.shell.currentWidget,newValue:e.shell.currentWidget})}}}},S=[m,C,T,I,R,L,w]}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7684,6893],{56893:(t,e,o)=>{o.r(e),o.d(e,{CommandIDs:()=>n,default:()=>i});var n,a=o(44604),r=o(53312),s=o(68722),u=o(12030);!function(t){t.controlPanel="hub:control-panel",t.logout="hub:logout",t.restart="hub:restart"}(n||(n={}));const i=[{activate:function(t,e,o,a){const r=o.load("jupyterlab"),u=e.urls.hubHost||"",i=e.urls.hubPrefix||"",l=e.urls.hubUser||"",c=e.urls.hubServerName||"",d=e.urls.base;if(!i)return;console.debug("hub-extension: Found configuration ",{hubHost:u,hubPrefix:i});const b=s.URLExt.join(i,"spawn");let h;if(c){const t=s.URLExt.join(b,l,c);if(!t.startsWith(b))throw new Error("Can only be used for spawn requests");h=u+t}h=u+b;const{commands:_}=t;if(_.addCommand(n.restart,{label:r.__("Restart Server"),caption:r.__("Request that the Hub restart this server"),execute:()=>{window.open(h,"_blank")}}),_.addCommand(n.controlPanel,{label:r.__("Hub Control Panel"),caption:r.__("Open the Hub control panel in a new browser tab"),execute:()=>{window.open(u+s.URLExt.join(i,"home"),"_blank")}}),_.addCommand(n.logout,{label:r.__("Log Out"),caption:r.__("Log out of the Hub"),execute:()=>{window.location.href=u+s.URLExt.join(d,"logout")}}),a){const t=r.__("Hub");a.addItem({category:t,command:n.controlPanel}),a.addItem({category:t,command:n.logout})}},id:"@jupyterlab/hub-extension:plugin",description:"Registers commands related to the hub server",requires:[a.JupyterFrontEnd.IPaths,u.ITranslator],optional:[r.ICommandPalette],autoStart:!0},{activate:()=>{},id:"@jupyterlab/hub-extension:menu",description:"Adds hub related commands to the menu.",autoStart:!0},{id:"@jupyterlab/hub-extension:connectionlost",description:"Provides a service to be notified when the connection to the hub server is lost.",requires:[a.JupyterFrontEnd.IPaths,u.ITranslator],optional:[a.JupyterLab.IInfo],activate:(t,e,o,s)=>{const u=o.load("jupyterlab"),i=e.urls.hubPrefix||"",l=e.urls.base;if(!i)return a.ConnectionLost;let c=!1;return async(e,o)=>{if(c)return;c=!0,s&&(s.isConnected=!1);const a=await(0,r.showDialog)({title:u.__("Server unavailable or unreachable"),body:u.__("Your server at %1 is not running.\nWould you like to restart it?",l),buttons:[r.Dialog.okButton({label:u.__("Restart")}),r.Dialog.cancelButton({label:u.__("Dismiss")})]});s&&(s.isConnected=!0),c=!1,a.button.accept&&await t.commands.execute(n.restart)}},autoStart:!0,provides:a.IConnectionLost}]}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7684,6893],{56893:(t,e,o)=>{o.r(e),o.d(e,{CommandIDs:()=>n,default:()=>i});var n,a=o(2756),r=o(20005),s=o(64145),u=o(90646);!function(t){t.controlPanel="hub:control-panel",t.logout="hub:logout",t.restart="hub:restart"}(n||(n={}));const i=[{activate:function(t,e,o,a){const r=o.load("jupyterlab"),u=e.urls.hubHost||"",i=e.urls.hubPrefix||"",l=e.urls.hubUser||"",c=e.urls.hubServerName||"",d=e.urls.base;if(!i)return;console.debug("hub-extension: Found configuration ",{hubHost:u,hubPrefix:i});const b=s.URLExt.join(i,"spawn");let h=u+b;if(c){const t=s.URLExt.join(b,l,c);if(!t.startsWith(b))throw new Error("Can only be used for spawn requests");h=u+t}const{commands:_}=t;if(_.addCommand(n.restart,{label:r.__("Restart Server"),caption:r.__("Request that the Hub restart this server"),execute:()=>{window.open(h,"_blank")}}),_.addCommand(n.controlPanel,{label:r.__("Hub Control Panel"),caption:r.__("Open the Hub control panel in a new browser tab"),execute:()=>{window.open(u+s.URLExt.join(i,"home"),"_blank")}}),_.addCommand(n.logout,{label:r.__("Log Out"),caption:r.__("Log out of the Hub"),execute:()=>{window.location.href=u+s.URLExt.join(d,"logout")}}),a){const t=r.__("Hub");a.addItem({category:t,command:n.controlPanel}),a.addItem({category:t,command:n.logout})}},id:"@jupyterlab/hub-extension:plugin",description:"Registers commands related to the hub server",requires:[a.JupyterFrontEnd.IPaths,u.ITranslator],optional:[r.ICommandPalette],autoStart:!0},{activate:()=>{},id:"@jupyterlab/hub-extension:menu",description:"Adds hub related commands to the menu.",autoStart:!0},{id:"@jupyterlab/hub-extension:connectionlost",description:"Provides a service to be notified when the connection to the hub server is lost.",requires:[a.JupyterFrontEnd.IPaths,u.ITranslator],optional:[a.JupyterLab.IInfo],activate:(t,e,o,s)=>{const u=o.load("jupyterlab"),i=e.urls.hubPrefix||"",l=e.urls.base;if(!i)return a.ConnectionLost;let c=!1;return async(e,o)=>{if(c)return;c=!0,s&&(s.isConnected=!1);const a=await(0,r.showDialog)({title:u.__("Server unavailable or unreachable"),body:u.__("Your server at %1 is not running.\nWould you like to restart it?",l),buttons:[r.Dialog.okButton({label:u.__("Restart")}),r.Dialog.cancelButton({label:u.__("Dismiss")})]});s&&(s.isConnected=!0),c=!1,a.button.accept&&await t.commands.execute(n.restart)}},autoStart:!0,provides:a.IConnectionLost}]}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7812,9680],{99680:(e,t,n)=>{n.r(t),n.d(t,{IMarkdownViewerTracker:()=>a,MarkdownDocument:()=>w,MarkdownViewer:()=>f,MarkdownViewerFactory:()=>_,MarkdownViewerTableOfContentsFactory:()=>s,MarkdownViewerTableOfContentsModel:()=>i});var r=n(79426);class i extends r.TableOfContentsModel{constructor(e,t,n){super(e,n),this.parser=t}get documentType(){return"markdown-viewer"}get isAlwaysActive(){return!0}get supportedOptions(){return["maximalDepth","numberingH1","numberHeaders"]}getHeadings(){const e=this.widget.context.model.toString(),t=r.TableOfContentsUtils.filterHeadings(r.TableOfContentsUtils.Markdown.getHeadings(e),{...this.configuration,baseNumbering:1});return Promise.resolve(t)}}class s extends r.TableOfContentsFactory{constructor(e,t,n){super(e),this.parser=t,this.sanitizer=n}_createNew(e,t){const n=new i(e,this.parser,t);let s=new WeakMap;const o=(t,n)=>{if(n){const t=s.get(n);if(t){const n=e.content.node.getBoundingClientRect(),r=t.getBoundingClientRect();(r.top>n.bottom||r.bottom<n.top)&&t.scrollIntoView({block:"center"})}else console.warn("Heading element not found for heading",n,"in widget",e)}},a=()=>{this.parser&&(r.TableOfContentsUtils.clearNumbering(e.content.node),s=new WeakMap,n.headings.forEach((async t=>{var n;const i=await r.TableOfContentsUtils.Markdown.getHeadingId(this.parser,t.raw,t.level,this.sanitizer);if(!i)return;const o=`h${t.level}[id="${CSS.escape(i)}"]`;s.set(t,r.TableOfContentsUtils.addPrefix(e.content.node,o,null!==(n=t.prefix)&&void 0!==n?n:""))})))};return e.content.ready.then((()=>{a(),e.content.rendered.connect(a),n.activeHeadingChanged.connect(o),n.headingsChanged.connect(a),e.disposed.connect((()=>{e.content.rendered.disconnect(a),n.activeHeadingChanged.disconnect(o),n.headingsChanged.disconnect(a)}))})),n}}var o=n(20998);const a=new o.Token("@jupyterlab/markdownviewer:IMarkdownViewerTracker","A widget tracker for markdown\n document viewers. Use this if you want to iterate over and interact with rendered markdown documents.");var d=n(53312),c=n(68722),l=n(65903),h=n(81221),u=n(12030),g=n(81997),m=n(63485);const p="text/markdown";class f extends m.Widget{constructor(e){super(),this._config={...f.defaultConfig},this._fragment="",this._ready=new o.PromiseDelegate,this._isRendering=!1,this._renderRequested=!1,this._rendered=new g.Signal(this),this.context=e.context,this.translator=e.translator||u.nullTranslator,this._trans=this.translator.load("jupyterlab"),this.renderer=e.renderer,this.node.tabIndex=0,this.addClass("jp-MarkdownViewer"),(this.layout=new m.StackedLayout).addWidget(this.renderer),this.context.ready.then((async()=>{await this._render(),this._monitor=new c.ActivityMonitor({signal:this.context.model.contentChanged,timeout:this._config.renderTimeout}),this._monitor.activityStopped.connect(this.update,this),this._ready.resolve(void 0)}))}get ready(){return this._ready.promise}get rendered(){return this._rendered}setFragment(e){this._fragment=e,this.update()}setOption(e,t){if(this._config[e]===t)return;this._config[e]=t;const{style:n}=this.renderer.node;switch(e){case"fontFamily":n.setProperty("font-family",t);break;case"fontSize":n.setProperty("font-size",t?t+"px":null);break;case"hideFrontMatter":this.update();break;case"lineHeight":n.setProperty("line-height",t?t.toString():null);break;case"lineWidth":{const e=t?`calc(50% - ${t/2}ch)`:null;n.setProperty("padding-left",e),n.setProperty("padding-right",e);break}case"renderTimeout":this._monitor&&(this._monitor.timeout=t)}}dispose(){this.isDisposed||(this._monitor&&this._monitor.dispose(),this._monitor=null,super.dispose())}onUpdateRequest(e){this.context.isReady&&!this.isDisposed&&(this._render(),this._fragment="")}onActivateRequest(e){this.node.focus()}async _render(){if(this.isDisposed)return;if(this._isRendering)return void(this._renderRequested=!0);this._renderRequested=!1;const{context:e}=this,{model:t}=e,n=t.toString(),r={};r[p]=this._config.hideFrontMatter?y.removeFrontMatter(n):n;const i=new h.MimeModel({data:r,metadata:{fragment:this._fragment}});try{if(this._isRendering=!0,await this.renderer.renderModel(i),this._isRendering=!1,this._renderRequested)return this._render();this._rendered.emit()}catch(t){requestAnimationFrame((()=>{this.dispose()})),(0,d.showErrorMessage)(this._trans.__("Renderer Failure: %1",e.path),t)}}}!function(e){e.defaultConfig={fontFamily:null,fontSize:null,lineHeight:null,lineWidth:null,hideFrontMatter:!0,renderTimeout:1e3}}(f||(f={}));class w extends l.DocumentWidget{setFragment(e){this.content.setFragment(e)}}class _ extends l.ABCWidgetFactory{constructor(e){super(y.createRegistryOptions(e)),this._fileType=e.primaryFileType,this._rendermime=e.rendermime}createNewWidget(e){var t,n,r,i,s;const o=this._rendermime.clone({resolver:e.urlResolver}).createRenderer(p),a=new f({context:e,renderer:o});return a.title.icon=null===(t=this._fileType)||void 0===t?void 0:t.icon,a.title.iconClass=null!==(r=null===(n=this._fileType)||void 0===n?void 0:n.iconClass)&&void 0!==r?r:"",a.title.iconLabel=null!==(s=null===(i=this._fileType)||void 0===i?void 0:i.iconLabel)&&void 0!==s?s:"",a.title.caption=this.label,new w({content:a,context:e})}}var y;!function(e){e.createRegistryOptions=function(e){return{...e,readOnly:!0}},e.removeFrontMatter=function(e){const t=e.match(/^---\n[^]*?\n(---|...)\n/);if(!t)return e;const{length:n}=t[0];return e.slice(n)}}(y||(y={}))}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7812,9680],{99680:(e,t,n)=>{n.r(t),n.d(t,{IMarkdownViewerTracker:()=>a,MarkdownDocument:()=>w,MarkdownViewer:()=>f,MarkdownViewerFactory:()=>_,MarkdownViewerTableOfContentsFactory:()=>s,MarkdownViewerTableOfContentsModel:()=>i});var r=n(27333);class i extends r.TableOfContentsModel{constructor(e,t,n){super(e,n),this.parser=t}get documentType(){return"markdown-viewer"}get isAlwaysActive(){return!0}get supportedOptions(){return["maximalDepth","numberingH1","numberHeaders"]}getHeadings(){const e=this.widget.context.model.toString(),t=r.TableOfContentsUtils.filterHeadings(r.TableOfContentsUtils.Markdown.getHeadings(e),{...this.configuration,baseNumbering:1});return Promise.resolve(t)}}class s extends r.TableOfContentsFactory{constructor(e,t,n){super(e),this.parser=t,this.sanitizer=n}_createNew(e,t){const n=new i(e,this.parser,t);let s=new WeakMap;const o=(t,n)=>{if(n){const t=s.get(n);if(t){const n=e.content.node.getBoundingClientRect(),r=t.getBoundingClientRect();(r.top>n.bottom||r.bottom<n.top)&&t.scrollIntoView({block:"center"})}else console.warn("Heading element not found for heading",n,"in widget",e)}},a=()=>{this.parser&&(r.TableOfContentsUtils.clearNumbering(e.content.node),s=new WeakMap,n.headings.forEach((async t=>{var n;const i=await r.TableOfContentsUtils.Markdown.getHeadingId(this.parser,t.raw,t.level,this.sanitizer);if(!i)return;const o=`h${t.level}[id="${CSS.escape(i)}"]`;s.set(t,r.TableOfContentsUtils.addPrefix(e.content.node,o,null!==(n=t.prefix)&&void 0!==n?n:""))})))};return e.content.ready.then((()=>{a(),e.content.rendered.connect(a),n.activeHeadingChanged.connect(o),n.headingsChanged.connect(a),e.disposed.connect((()=>{e.content.rendered.disconnect(a),n.activeHeadingChanged.disconnect(o),n.headingsChanged.disconnect(a)}))})),n}}var o=n(20998);const a=new o.Token("@jupyterlab/markdownviewer:IMarkdownViewerTracker","A widget tracker for markdown\n document viewers. Use this if you want to iterate over and interact with rendered markdown documents.");var d=n(20005),c=n(64145),l=n(87973),h=n(1323),u=n(90646),g=n(81997),m=n(63485);const p="text/markdown";class f extends m.Widget{constructor(e){super(),this._config={...f.defaultConfig},this._fragment="",this._ready=new o.PromiseDelegate,this._isRendering=!1,this._renderRequested=!1,this._rendered=new g.Signal(this),this.context=e.context,this.translator=e.translator||u.nullTranslator,this._trans=this.translator.load("jupyterlab"),this.renderer=e.renderer,this.node.tabIndex=0,this.addClass("jp-MarkdownViewer"),(this.layout=new m.StackedLayout).addWidget(this.renderer),this.context.ready.then((async()=>{await this._render(),this._monitor=new c.ActivityMonitor({signal:this.context.model.contentChanged,timeout:this._config.renderTimeout}),this._monitor.activityStopped.connect(this.update,this),this._ready.resolve(void 0)}))}get ready(){return this._ready.promise}get rendered(){return this._rendered}setFragment(e){this._fragment=e,this.update()}setOption(e,t){if(this._config[e]===t)return;this._config[e]=t;const{style:n}=this.renderer.node;switch(e){case"fontFamily":n.setProperty("font-family",t);break;case"fontSize":n.setProperty("font-size",t?t+"px":null);break;case"hideFrontMatter":this.update();break;case"lineHeight":n.setProperty("line-height",t?t.toString():null);break;case"lineWidth":{const e=t?`calc(50% - ${t/2}ch)`:null;n.setProperty("padding-left",e),n.setProperty("padding-right",e);break}case"renderTimeout":this._monitor&&(this._monitor.timeout=t)}}dispose(){this.isDisposed||(this._monitor&&this._monitor.dispose(),this._monitor=null,super.dispose())}onUpdateRequest(e){this.context.isReady&&!this.isDisposed&&(this._render(),this._fragment="")}onActivateRequest(e){this.node.focus()}async _render(){if(this.isDisposed)return;if(this._isRendering)return void(this._renderRequested=!0);this._renderRequested=!1;const{context:e}=this,{model:t}=e,n=t.toString(),r={};r[p]=this._config.hideFrontMatter?y.removeFrontMatter(n):n;const i=new h.MimeModel({data:r,metadata:{fragment:this._fragment}});try{if(this._isRendering=!0,await this.renderer.renderModel(i),this._isRendering=!1,this._renderRequested)return this._render();this._rendered.emit()}catch(t){requestAnimationFrame((()=>{this.dispose()})),(0,d.showErrorMessage)(this._trans.__("Renderer Failure: %1",e.path),t)}}}!function(e){e.defaultConfig={fontFamily:null,fontSize:null,lineHeight:null,lineWidth:null,hideFrontMatter:!0,renderTimeout:1e3}}(f||(f={}));class w extends l.DocumentWidget{setFragment(e){this.content.setFragment(e)}}class _ extends l.ABCWidgetFactory{constructor(e){super(y.createRegistryOptions(e)),this._fileType=e.primaryFileType,this._rendermime=e.rendermime}createNewWidget(e){var t,n,r,i,s;const o=this._rendermime.clone({resolver:e.urlResolver}).createRenderer(p),a=new f({context:e,renderer:o});return a.title.icon=null===(t=this._fileType)||void 0===t?void 0:t.icon,a.title.iconClass=null!==(r=null===(n=this._fileType)||void 0===n?void 0:n.iconClass)&&void 0!==r?r:"",a.title.iconLabel=null!==(s=null===(i=this._fileType)||void 0===i?void 0:i.iconLabel)&&void 0!==s?s:"",a.title.caption=this.label,new w({content:a,context:e})}}var y;!function(e){e.createRegistryOptions=function(e){return{...e,readOnly:!0}},e.removeFrontMatter=function(e){const t=e.match(/^---\n[^]*?\n(---|...)\n/);if(!t)return e;const{length:n}=t[0];return e.slice(n)}}(y||(y={}))}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7819],{57819:(t,e,r)=>{function n(t){return t.replace("-","_")}r.r(e),r.d(e,{Gettext:()=>s,ITranslator:()=>d,ITranslatorConnector:()=>g,NullTranslator:()=>a,TranslationManager:()=>m,TranslatorConnector:()=>p,nullTranslator:()=>i,requestTranslationsAPI:()=>_});class s{constructor(t){t=t||{},this._defaults={domain:"messages",locale:document.documentElement.getAttribute("lang")||"en",pluralFunc:function(t){return{nplurals:2,plural:1!=t?1:0}},contextDelimiter:String.fromCharCode(4),stringsPrefix:""},this._locale=(t.locale||this._defaults.locale).replace("_","-"),this._domain=n(t.domain||this._defaults.domain),this._contextDelimiter=t.contextDelimiter||this._defaults.contextDelimiter,this._stringsPrefix=t.stringsPrefix||this._defaults.stringsPrefix,this._pluralFuncs={},this._dictionary={},this._pluralForms={},t.messages&&(this._dictionary[this._domain]={},this._dictionary[this._domain][this._locale]=t.messages),t.pluralForms&&(this._pluralForms[this._locale]=t.pluralForms)}setContextDelimiter(t){this._contextDelimiter=t}getContextDelimiter(){return this._contextDelimiter}setLocale(t){this._locale=t.replace("_","-")}getLocale(){return this._locale}setDomain(t){this._domain=n(t)}getDomain(){return this._domain}setStringsPrefix(t){this._stringsPrefix=t}getStringsPrefix(){return this._stringsPrefix}static strfmt(t,...e){return t.replace(/%%/g,"%% ").replace(/%(\d+)/g,(function(t,r){return e[r-1]})).replace(/%% /g,"%")}loadJSON(t,e){if(!t[""]||!t[""].language||!t[""].pluralForms)throw new Error(`Wrong jsonData, it must have an empty key ("") with "language" and "pluralForms" information: ${t}`);e=n(e);let r=t[""],s=JSON.parse(JSON.stringify(t));delete s[""],this.setMessages(e||this._defaults.domain,r.language,s,r.pluralForms)}__(t,...e){return this.gettext(t,...e)}_n(t,e,r,...n){return this.ngettext(t,e,r,...n)}_p(t,e,...r){return this.pgettext(t,e,...r)}_np(t,e,r,n,...s){return this.npgettext(t,e,r,n,...s)}gettext(t,...e){return this.dcnpgettext("","",t,"",0,...e)}ngettext(t,e,r,...n){return this.dcnpgettext("","",t,e,r,...n)}pgettext(t,e,...r){return this.dcnpgettext("",t,e,"",0,...r)}npgettext(t,e,r,n,...s){return this.dcnpgettext("",t,e,r,n,...s)}dcnpgettext(t,e,r,s,a,...i){let l;t=n(t)||this._domain;let o=e?e+this._contextDelimiter+r:r,u={pluralForm:!1},c=!1,h=this._locale,_=this.expandLocale(this._locale);for(let e in _)if(h=_[e],c=this._dictionary[t]&&this._dictionary[t][h]&&this._dictionary[t][h][o],c=s?c&&this._dictionary[t][h][o].length>1:c&&1==this._dictionary[t][h][o].length,c){u.locale=h;break}if(c?l=this._dictionary[t][h][o]:(l=[r],u.pluralFunc=this._defaults.pluralFunc),!s)return this.t(l,a,u,...i);u.pluralForm=!0;let g=c?l:[r,s];return this.t(g,a,u,...i)}expandLocale(t){let e=[t],r=t.lastIndexOf("-");for(;r>0;)t=t.slice(0,r),e.push(t),r=t.lastIndexOf("-");return e}getPluralFunc(t){if(!new RegExp("^\\s*nplurals\\s*=\\s*[0-9]+\\s*;\\s*plural\\s*=\\s*(?:\\s|[-\\?\\|&=!<>+*/%:;n0-9_()])+").test(t))throw new Error(s.strfmt('The plural form "%1" is not valid',t));return new Function("n","let plural, nplurals; "+t+" return { nplurals: nplurals, plural: (plural === true ? 1 : (plural ? plural : 0)) };")}removeContext(t){return-1!==t.indexOf(this._contextDelimiter)?t.split(this._contextDelimiter)[1]:t}t(t,e,r,...n){if(!r.pluralForm)return this._stringsPrefix+s.strfmt(this.removeContext(t[0]),...n);let a;return r.pluralFunc?a=r.pluralFunc(e):(this._pluralFuncs[r.locale||""]||(this._pluralFuncs[r.locale||""]=this.getPluralFunc(this._pluralForms[r.locale||""])),a=this._pluralFuncs[r.locale||""](e)),(void 0===!a.plural||a.plural>a.nplurals||t.length<=a.plural)&&(a.plural=0),this._stringsPrefix+s.strfmt(this.removeContext(t[a.plural]),...[e].concat(n))}setMessages(t,e,r,s){t=n(t),s&&(this._pluralForms[e]=s),this._dictionary[t]||(this._dictionary[t]={}),this._dictionary[t][e]=r}}class a{constructor(t){this.languageCode="en",this._languageBundle=t}load(t){return this._languageBundle}}const i=new a(new class{__(t,...e){return this.gettext(t,...e)}_n(t,e,r,...n){return this.ngettext(t,e,r,...n)}_p(t,e,...r){return this.pgettext(t,e,...r)}_np(t,e,r,n,...s){return this.npgettext(t,e,r,n,...s)}gettext(t,...e){return s.strfmt(t,...e)}ngettext(t,e,r,...n){return s.strfmt(1==r?t:e,...[r].concat(n))}pgettext(t,e,...r){return s.strfmt(e,...r)}npgettext(t,e,r,n,...s){return this.ngettext(e,r,n,...s)}dcnpgettext(t,e,r,n,s,...a){return this.ngettext(r,n,s,...a)}});var l=r(41053),o=r(20998),u=r(68722),c=r(87408);const h="api/translations";async function _(t="",e="",r={},n=void 0){const s=null!=n?n:c.ServerConnection.makeSettings();t=t||`${s.appUrl}/${h}`;const a=u.URLExt.join(s.baseUrl,t),i=u.URLExt.join(a,e);if(!i.startsWith(a))throw new Error("Can only be used for translations requests");let l;try{l=await c.ServerConnection.makeRequest(i,r,s)}catch(t){throw new c.ServerConnection.NetworkError(t)}let o=await l.text();if(o.length>0)try{o=JSON.parse(o)}catch(t){console.error("Not a JSON response body.",l)}if(!l.ok)throw new c.ServerConnection.ResponseError(l,o.message||o);return o}const g=new o.Token("@jupyterlab/translation:ITranslatorConnector","A service to connect to the server translation endpoint.");class p extends l.DataConnector{constructor(t="",e){super(),this._translationsUrl=t,this._serverSettings=e}async fetch(t){return _(this._translationsUrl,t.language,{},this._serverSettings)}}const d=new o.Token("@jupyterlab/translation:ITranslator","A service to translate strings.");class m{constructor(t="",e,r){this._domainData={},this._translationBundles={},this._connector=new p(t,r),this._stringsPrefix=e||"",this._englishBundle=new s({stringsPrefix:this._stringsPrefix})}get languageCode(){return this._currentLocale}async fetch(t){var e,r,n,s;if(this._languageData=await this._connector.fetch({language:t}),this._languageData&&"default"===t)try{for(const t of Object.values(null!==(e=this._languageData.data)&&void 0!==e?e:{})){this._currentLocale=t[""].language.replace("_","-");break}}catch(t){this._currentLocale="en"}else this._currentLocale=t;this._domainData=null!==(n=null===(r=this._languageData)||void 0===r?void 0:r.data)&&void 0!==n?n:{};const a=null===(s=this._languageData)||void 0===s?void 0:s.message;a&&"en"!==t&&console.warn(a)}load(t){if(this._domainData){if("en"==this._currentLocale)return this._englishBundle;if(!((t=n(t))in this._translationBundles)){let e=new s({domain:t,locale:this._currentLocale,stringsPrefix:this._stringsPrefix});if(t in this._domainData){let r=this._domainData[t][""];"plural_forms"in r&&(r.pluralForms=r.plural_forms,delete r.plural_forms,this._domainData[t][""]=r),e.loadJSON(this._domainData[t],t)}this._translationBundles[t]=e}return this._translationBundles[t]}return this._englishBundle}}}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7819],{57819:(t,e,r)=>{function n(t){return t.replace("-","_")}r.r(e),r.d(e,{Gettext:()=>s,ITranslator:()=>d,ITranslatorConnector:()=>g,NullTranslator:()=>a,TranslationManager:()=>m,TranslatorConnector:()=>p,nullTranslator:()=>i,requestTranslationsAPI:()=>_});class s{constructor(t){t=t||{},this._defaults={domain:"messages",locale:document.documentElement.getAttribute("lang")||"en",pluralFunc:function(t){return{nplurals:2,plural:1!=t?1:0}},contextDelimiter:String.fromCharCode(4),stringsPrefix:""},this._locale=(t.locale||this._defaults.locale).replace("_","-"),this._domain=n(t.domain||this._defaults.domain),this._contextDelimiter=t.contextDelimiter||this._defaults.contextDelimiter,this._stringsPrefix=t.stringsPrefix||this._defaults.stringsPrefix,this._pluralFuncs={},this._dictionary={},this._pluralForms={},t.messages&&(this._dictionary[this._domain]={},this._dictionary[this._domain][this._locale]=t.messages),t.pluralForms&&(this._pluralForms[this._locale]=t.pluralForms)}setContextDelimiter(t){this._contextDelimiter=t}getContextDelimiter(){return this._contextDelimiter}setLocale(t){this._locale=t.replace("_","-")}getLocale(){return this._locale}setDomain(t){this._domain=n(t)}getDomain(){return this._domain}setStringsPrefix(t){this._stringsPrefix=t}getStringsPrefix(){return this._stringsPrefix}static strfmt(t,...e){return t.replace(/%%/g,"%% ").replace(/%(\d+)/g,(function(t,r){return e[r-1]})).replace(/%% /g,"%")}loadJSON(t,e){if(!t[""]||!t[""].language||!t[""].pluralForms)throw new Error(`Wrong jsonData, it must have an empty key ("") with "language" and "pluralForms" information: ${t}`);e=n(e);let r=t[""],s=JSON.parse(JSON.stringify(t));delete s[""],this.setMessages(e||this._defaults.domain,r.language,s,r.pluralForms)}__(t,...e){return this.gettext(t,...e)}_n(t,e,r,...n){return this.ngettext(t,e,r,...n)}_p(t,e,...r){return this.pgettext(t,e,...r)}_np(t,e,r,n,...s){return this.npgettext(t,e,r,n,...s)}gettext(t,...e){return this.dcnpgettext("","",t,"",0,...e)}ngettext(t,e,r,...n){return this.dcnpgettext("","",t,e,r,...n)}pgettext(t,e,...r){return this.dcnpgettext("",t,e,"",0,...r)}npgettext(t,e,r,n,...s){return this.dcnpgettext("",t,e,r,n,...s)}dcnpgettext(t,e,r,s,a,...i){let l;t=n(t)||this._domain;let o=e?e+this._contextDelimiter+r:r,u={pluralForm:!1},c=!1,h=this._locale,_=this.expandLocale(this._locale);for(let e in _)if(h=_[e],c=this._dictionary[t]&&this._dictionary[t][h]&&this._dictionary[t][h][o],c=s?c&&this._dictionary[t][h][o].length>1:c&&1==this._dictionary[t][h][o].length,c){u.locale=h;break}if(c?l=this._dictionary[t][h][o]:(l=[r],u.pluralFunc=this._defaults.pluralFunc),!s)return this.t(l,a,u,...i);u.pluralForm=!0;let g=c?l:[r,s];return this.t(g,a,u,...i)}expandLocale(t){let e=[t],r=t.lastIndexOf("-");for(;r>0;)t=t.slice(0,r),e.push(t),r=t.lastIndexOf("-");return e}getPluralFunc(t){if(!new RegExp("^\\s*nplurals\\s*=\\s*[0-9]+\\s*;\\s*plural\\s*=\\s*(?:\\s|[-\\?\\|&=!<>+*/%:;n0-9_()])+").test(t))throw new Error(s.strfmt('The plural form "%1" is not valid',t));return new Function("n","let plural, nplurals; "+t+" return { nplurals: nplurals, plural: (plural === true ? 1 : (plural ? plural : 0)) };")}removeContext(t){return-1!==t.indexOf(this._contextDelimiter)?t.split(this._contextDelimiter)[1]:t}t(t,e,r,...n){if(!r.pluralForm)return this._stringsPrefix+s.strfmt(this.removeContext(t[0]),...n);let a;return r.pluralFunc?a=r.pluralFunc(e):(this._pluralFuncs[r.locale||""]||(this._pluralFuncs[r.locale||""]=this.getPluralFunc(this._pluralForms[r.locale||""])),a=this._pluralFuncs[r.locale||""](e)),(void 0===!a.plural||a.plural>a.nplurals||t.length<=a.plural)&&(a.plural=0),this._stringsPrefix+s.strfmt(this.removeContext(t[a.plural]),...[e].concat(n))}setMessages(t,e,r,s){t=n(t),s&&(this._pluralForms[e]=s),this._dictionary[t]||(this._dictionary[t]={}),this._dictionary[t][e]=r}}class a{constructor(t){this.languageCode="en",this._languageBundle=t}load(t){return this._languageBundle}}const i=new a(new class{__(t,...e){return this.gettext(t,...e)}_n(t,e,r,...n){return this.ngettext(t,e,r,...n)}_p(t,e,...r){return this.pgettext(t,e,...r)}_np(t,e,r,n,...s){return this.npgettext(t,e,r,n,...s)}gettext(t,...e){return s.strfmt(t,...e)}ngettext(t,e,r,...n){return s.strfmt(1==r?t:e,...[r].concat(n))}pgettext(t,e,...r){return s.strfmt(e,...r)}npgettext(t,e,r,n,...s){return this.ngettext(e,r,n,...s)}dcnpgettext(t,e,r,n,s,...a){return this.ngettext(r,n,s,...a)}});var l=r(48218),o=r(20998),u=r(64145),c=r(50558);const h="api/translations";async function _(t="",e="",r={},n=void 0){const s=null!=n?n:c.ServerConnection.makeSettings();t=t||`${s.appUrl}/${h}`;const a=u.URLExt.join(s.baseUrl,t),i=u.URLExt.join(a,e);if(!i.startsWith(a))throw new Error("Can only be used for translations requests");let l;try{l=await c.ServerConnection.makeRequest(i,r,s)}catch(t){throw new c.ServerConnection.NetworkError(t)}let o=await l.text();if(o.length>0)try{o=JSON.parse(o)}catch(t){console.error("Not a JSON response body.",l)}if(!l.ok)throw new c.ServerConnection.ResponseError(l,o.message||o);return o}const g=new o.Token("@jupyterlab/translation:ITranslatorConnector","A service to connect to the server translation endpoint.");class p extends l.DataConnector{constructor(t="",e){super(),this._translationsUrl=t,this._serverSettings=e}async fetch(t){return _(this._translationsUrl,t.language,{},this._serverSettings)}}const d=new o.Token("@jupyterlab/translation:ITranslator","A service to translate strings.");class m{constructor(t="",e,r){this._domainData={},this._translationBundles={},this._connector=new p(t,r),this._stringsPrefix=e||"",this._englishBundle=new s({stringsPrefix:this._stringsPrefix})}get languageCode(){return this._currentLocale}async fetch(t){var e,r,n,s;if(this._languageData=await this._connector.fetch({language:t}),this._languageData&&"default"===t)try{for(const t of Object.values(null!==(e=this._languageData.data)&&void 0!==e?e:{})){this._currentLocale=t[""].language.replace("_","-");break}}catch(t){this._currentLocale="en"}else this._currentLocale=t;this._domainData=null!==(n=null===(r=this._languageData)||void 0===r?void 0:r.data)&&void 0!==n?n:{};const a=null===(s=this._languageData)||void 0===s?void 0:s.message;a&&"en"!==t&&console.warn(a)}load(t){if(this._domainData){if("en"==this._currentLocale)return this._englishBundle;if(!((t=n(t))in this._translationBundles)){let e=new s({domain:t,locale:this._currentLocale,stringsPrefix:this._stringsPrefix});if(t in this._domainData){let r=this._domainData[t][""];"plural_forms"in r&&(r.pluralForms=r.plural_forms,delete r.plural_forms,this._domainData[t][""]=r),e.loadJSON(this._domainData[t],t)}this._translationBundles[t]=e}return this._translationBundles[t]}return this._englishBundle}}}}]);
@@ -1 +1 @@
1
- "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)}}}]}}]);
1
+ "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(2756),o=t(20005),i=t(93994),a=t(50712),r=t(48218),l=t(90646),c=t(14576),d=t(64145),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(87973);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)}}}]}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7900,8928],{67900:(t,e,i)=>{i.r(e),i.d(e,{IImageTracker:()=>r,ImageViewer:()=>l,ImageViewerFactory:()=>d});var s=i(20998);const r=new s.Token("@jupyterlab/imageviewer:IImageTracker","A widget tracker for images.\n Use this if you want to be able to iterate over and interact with images\n viewed by the application.");var a,o=i(68722),n=i(53312),c=i(65903),h=i(63485);class l extends h.Widget{constructor(t){super(),this._scale=1,this._matrix=[1,0,0,1],this._colorinversion=0,this._ready=new s.PromiseDelegate,this.context=t,this.node.tabIndex=0,this.addClass("jp-ImageViewer"),this._img=document.createElement("img"),this.node.appendChild(this._img),this._onTitleChanged(),t.pathChanged.connect(this._onTitleChanged,this),t.ready.then((()=>{if(this.isDisposed)return;const e=t.contentsModel;this._mimeType=e.mimetype,this._render(),t.model.contentChanged.connect(this.update,this),t.fileChanged.connect(this.update,this),this._ready.resolve(void 0)}))}[n.Printing.symbol](){return()=>n.Printing.printWidget(this)}get ready(){return this._ready.promise}get scale(){return this._scale}set scale(t){t!==this._scale&&(this._scale=t,this._updateStyle())}get colorinversion(){return this._colorinversion}set colorinversion(t){t!==this._colorinversion&&(this._colorinversion=t,this._updateStyle())}dispose(){this._img.src&&URL.revokeObjectURL(this._img.src||""),super.dispose()}resetRotationFlip(){this._matrix=[1,0,0,1],this._updateStyle()}rotateCounterclockwise(){this._matrix=a.prod(this._matrix,a.rotateCounterclockwiseMatrix),this._updateStyle()}rotateClockwise(){this._matrix=a.prod(this._matrix,a.rotateClockwiseMatrix),this._updateStyle()}flipHorizontal(){this._matrix=a.prod(this._matrix,a.flipHMatrix),this._updateStyle()}flipVertical(){this._matrix=a.prod(this._matrix,a.flipVMatrix),this._updateStyle()}onUpdateRequest(t){!this.isDisposed&&this.context.isReady&&this._render()}onActivateRequest(t){this.node.focus()}_onTitleChanged(){this.title.label=o.PathExt.basename(this.context.localPath)}_render(){const t=this.context,e=t.contentsModel;if(!e)return;const i=this._img.src||"";let s=t.model.toString();if("base64"===e.format)this._img.src=`data:${this._mimeType};base64,${s}`;else{const t=new Blob([s],{type:this._mimeType});this._img.src=URL.createObjectURL(t)}URL.revokeObjectURL(i)}_updateStyle(){const[t,e,i,s]=this._matrix,[r,o]=a.prodVec(this._matrix,[1,1]),n=`matrix(${t}, ${e}, ${i}, ${s}, 0, 0) translate(${r<0?-100:0}%, ${o<0?-100:0}%) `;this._img.style.transform=`scale(${this._scale}) ${n}`,this._img.style.filter=`invert(${this._colorinversion})`}}class d extends c.ABCWidgetFactory{createNewWidget(t){const e=new l(t);return new c.DocumentWidget({content:e,context:t})}}!function(t){t.prod=function([t,e,i,s],[r,a,o,n]){return[t*r+e*o,t*a+e*n,i*r+s*o,i*a+s*n]},t.prodVec=function([t,e,i,s],[r,a]){return[t*r+e*a,i*r+s*a]},t.rotateClockwiseMatrix=[0,1,-1,0],t.rotateCounterclockwiseMatrix=[0,-1,1,0],t.flipHMatrix=[-1,0,0,1],t.flipVMatrix=[1,0,0,-1]}(a||(a={}))}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7900,8928],{67900:(t,e,i)=>{i.r(e),i.d(e,{IImageTracker:()=>r,ImageViewer:()=>l,ImageViewerFactory:()=>d});var s=i(20998);const r=new s.Token("@jupyterlab/imageviewer:IImageTracker","A widget tracker for images.\n Use this if you want to be able to iterate over and interact with images\n viewed by the application.");var a,o=i(64145),n=i(20005),c=i(87973),h=i(63485);class l extends h.Widget{constructor(t){super(),this._scale=1,this._matrix=[1,0,0,1],this._colorinversion=0,this._ready=new s.PromiseDelegate,this.context=t,this.node.tabIndex=0,this.addClass("jp-ImageViewer"),this._img=document.createElement("img"),this.node.appendChild(this._img),this._onTitleChanged(),t.pathChanged.connect(this._onTitleChanged,this),t.ready.then((()=>{if(this.isDisposed)return;const e=t.contentsModel;this._mimeType=e.mimetype,this._render(),t.model.contentChanged.connect(this.update,this),t.fileChanged.connect(this.update,this),this._ready.resolve(void 0)}))}[n.Printing.symbol](){return()=>n.Printing.printWidget(this)}get ready(){return this._ready.promise}get scale(){return this._scale}set scale(t){t!==this._scale&&(this._scale=t,this._updateStyle())}get colorinversion(){return this._colorinversion}set colorinversion(t){t!==this._colorinversion&&(this._colorinversion=t,this._updateStyle())}dispose(){this._img.src&&URL.revokeObjectURL(this._img.src||""),super.dispose()}resetRotationFlip(){this._matrix=[1,0,0,1],this._updateStyle()}rotateCounterclockwise(){this._matrix=a.prod(this._matrix,a.rotateCounterclockwiseMatrix),this._updateStyle()}rotateClockwise(){this._matrix=a.prod(this._matrix,a.rotateClockwiseMatrix),this._updateStyle()}flipHorizontal(){this._matrix=a.prod(this._matrix,a.flipHMatrix),this._updateStyle()}flipVertical(){this._matrix=a.prod(this._matrix,a.flipVMatrix),this._updateStyle()}onUpdateRequest(t){!this.isDisposed&&this.context.isReady&&this._render()}onActivateRequest(t){this.node.focus()}_onTitleChanged(){this.title.label=o.PathExt.basename(this.context.localPath)}_render(){const t=this.context,e=t.contentsModel;if(!e)return;const i=this._img.src||"";let s=t.model.toString();if("base64"===e.format)this._img.src=`data:${this._mimeType};base64,${s}`;else{const t=new Blob([s],{type:this._mimeType});this._img.src=URL.createObjectURL(t)}URL.revokeObjectURL(i)}_updateStyle(){const[t,e,i,s]=this._matrix,[r,o]=a.prodVec(this._matrix,[1,1]),n=`matrix(${t}, ${e}, ${i}, ${s}, 0, 0) translate(${r<0?-100:0}%, ${o<0?-100:0}%) `;this._img.style.transform=`scale(${this._scale}) ${n}`,this._img.style.filter=`invert(${this._colorinversion})`}}class d extends c.ABCWidgetFactory{createNewWidget(t){const e=new l(t);return new c.DocumentWidget({content:e,context:t})}}!function(t){t.prod=function([t,e,i,s],[r,a,o,n]){return[t*r+e*o,t*a+e*n,i*r+s*o,i*a+s*n]},t.prodVec=function([t,e,i,s],[r,a]){return[t*r+e*a,i*r+s*a]},t.rotateClockwiseMatrix=[0,1,-1,0],t.rotateCounterclockwiseMatrix=[0,-1,1,0],t.flipHMatrix=[-1,0,0,1],t.flipVMatrix=[1,0,0,-1]}(a||(a={}))}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7906,4382],{54382:(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var n=r(95183),o=r(1635);const c="jp-mod-searchable",a=[{id:"@jupyter-notebook/documentsearch-extension:notebookShellWidgetListener",requires:[o.INotebookShell,n.ISearchProviderRegistry],autoStart:!0,description:"A plugin to add document search functionalities",activate:(e,t,r)=>{const n=e=>{e&&(r.hasProvider(e)?e.addClass(c):e.removeClass(c))};r.changed.connect((()=>n(t.currentWidget))),t.currentChanged.connect(((e,r)=>{t.currentWidget&&n(t.currentWidget)}))}}]}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7906,4382],{54382:(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var n=r(11523),o=r(69867);const c="jp-mod-searchable",a=[{id:"@jupyter-notebook/documentsearch-extension:notebookShellWidgetListener",requires:[o.INotebookShell,n.ISearchProviderRegistry],autoStart:!0,description:"A plugin to add document search functionalities",activate:(e,t,r)=>{const n=e=>{e&&(r.hasProvider(e)?e.addClass(c):e.removeClass(c))};r.changed.connect((()=>n(t.currentWidget))),t.currentChanged.connect(((e,r)=>{t.currentWidget&&n(t.currentWidget)}))}}]}}]);