notebook 7.2.0a0__py3-none-any.whl → 7.2.0b0__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 (182) hide show
  1. notebook/_version.py +1 -1
  2. notebook/static/113.bundle.js +1 -0
  3. notebook/static/1198.bundle.js +1 -1
  4. notebook/static/134.bundle.js +1 -1
  5. notebook/static/1408.bundle.js +1 -1
  6. notebook/static/1496.bundle.js +1 -1
  7. notebook/static/1647.bundle.js +1 -1
  8. notebook/static/1650.bundle.js +1 -1
  9. notebook/static/1684.bundle.js +1 -1
  10. notebook/static/1809.bundle.js +1 -1
  11. notebook/static/1827.bundle.js +1 -1
  12. notebook/static/1833.bundle.js +1 -1
  13. notebook/static/1958.bundle.js +1 -1
  14. notebook/static/1962.bundle.js +1 -0
  15. notebook/static/2007.bundle.js +1 -1
  16. notebook/static/2065.bundle.js +1 -1
  17. notebook/static/2088.bundle.js +1 -1
  18. notebook/static/2089.bundle.js +1 -1
  19. notebook/static/2122.bundle.js +1 -1
  20. notebook/static/2167.bundle.js +1 -1
  21. notebook/static/2184.bundle.js +1 -1
  22. notebook/static/2311.bundle.js +1 -1
  23. notebook/static/2401.bundle.js +1 -1
  24. notebook/static/2479.bundle.js +1 -1
  25. notebook/static/2489.bundle.js +1 -1
  26. notebook/static/2557.bundle.js +5 -5
  27. notebook/static/2607.bundle.js +1 -1
  28. notebook/static/2615.bundle.js +1 -1
  29. notebook/static/2636.bundle.js +1 -0
  30. notebook/static/2692.bundle.js +1 -1
  31. notebook/static/2924.bundle.js +1 -1
  32. notebook/static/2944.bundle.js +1 -1
  33. notebook/static/3129.bundle.js +1 -1
  34. notebook/static/3146.bundle.js +1 -1
  35. notebook/static/3187.bundle.js +1 -1
  36. notebook/static/3213.bundle.js +1 -1
  37. notebook/static/3340.bundle.js +1 -1
  38. notebook/static/3360.bundle.js +1 -1
  39. notebook/static/3462.bundle.js +1 -0
  40. notebook/static/3466.bundle.js +1 -1
  41. notebook/static/3512.bundle.js +1 -1
  42. notebook/static/3676.bundle.js +1 -1
  43. notebook/static/3680.bundle.js +1 -1
  44. notebook/static/374.bundle.js +1 -0
  45. notebook/static/3768.bundle.js +1 -1
  46. notebook/static/377.bundle.js +1 -1
  47. notebook/static/3863.bundle.js +1 -1
  48. notebook/static/3881.bundle.js +1 -1
  49. notebook/static/4042.bundle.js +1 -1
  50. notebook/static/4212.bundle.js +1 -1
  51. notebook/static/4382.bundle.js +1 -1
  52. notebook/static/4430.bundle.js +1 -0
  53. notebook/static/4630.bundle.js +1 -1
  54. notebook/static/4645.bundle.js +1 -1
  55. notebook/static/4708.bundle.js +1 -0
  56. notebook/static/4811.bundle.js +1 -1
  57. notebook/static/4837.bundle.js +1 -1
  58. notebook/static/5099.bundle.js +1 -1
  59. notebook/static/5135.bundle.js +1 -1
  60. notebook/static/5263.bundle.js +1 -1
  61. notebook/static/5299.bundle.js +1 -1
  62. notebook/static/5313.bundle.js +1 -1
  63. notebook/static/5325.bundle.js +1 -1
  64. notebook/static/5346.bundle.js +1 -1
  65. notebook/static/5426.bundle.js +1 -1
  66. notebook/static/545.bundle.js +1 -1
  67. notebook/static/5573.bundle.js +1 -1
  68. notebook/static/5601.bundle.js +1 -1
  69. notebook/static/5733.bundle.js +1 -1
  70. notebook/static/5912.bundle.js +1 -1
  71. notebook/static/5921.bundle.js +1 -1
  72. notebook/static/6017.bundle.js +1 -1
  73. notebook/static/6139.bundle.js +1 -1
  74. notebook/static/62.bundle.js +1 -1
  75. notebook/static/6345.bundle.js +1 -1
  76. notebook/static/6521.bundle.js +1 -0
  77. notebook/static/6604.bundle.js +1 -1
  78. notebook/static/6621.bundle.js +1 -1
  79. notebook/static/6627.bundle.js +1 -1
  80. notebook/static/6748.bundle.js +1 -0
  81. notebook/static/6815.bundle.js +1 -1
  82. notebook/static/6853.bundle.js +1 -1
  83. notebook/static/6893.bundle.js +1 -1
  84. notebook/static/690.bundle.js +1 -1
  85. notebook/static/6962.bundle.js +1 -1
  86. notebook/static/6999.bundle.js +1 -1
  87. notebook/static/7226.bundle.js +1 -1
  88. notebook/static/7252.bundle.js +1 -1
  89. notebook/static/7302.bundle.js +1 -1
  90. notebook/static/7386.bundle.js +1 -1
  91. notebook/static/7391.bundle.js +1 -1
  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 -0
  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/7884.bundle.js +1 -0
  101. notebook/static/7900.bundle.js +1 -1
  102. notebook/static/7906.bundle.js +1 -1
  103. notebook/static/8032.bundle.js +1 -1
  104. notebook/static/8471.bundle.js +1 -1
  105. notebook/static/8579.bundle.js +1 -1
  106. notebook/static/8633.bundle.js +1 -1
  107. notebook/static/8771.bundle.js +1 -1
  108. notebook/static/8781.bundle.js +1 -1
  109. notebook/static/8845.bundle.js +1 -1
  110. notebook/static/8875.bundle.js +1 -1
  111. notebook/static/8907.bundle.js +1 -1
  112. notebook/static/8928.bundle.js +1 -1
  113. notebook/static/893.bundle.js +1 -1
  114. notebook/static/901.bundle.js +1 -1
  115. notebook/static/9068.bundle.js +1 -1
  116. notebook/static/9136.bundle.js +1 -0
  117. notebook/static/9151.bundle.js +1 -1
  118. notebook/static/9161.bundle.js +1 -1
  119. notebook/static/9268.bundle.js +1 -1
  120. notebook/static/9335.bundle.js +1 -1
  121. notebook/static/9341.bundle.js +1 -1
  122. notebook/static/9380.bundle.js +1 -1
  123. notebook/static/9605.bundle.js +1 -1
  124. notebook/static/9638.bundle.js +1 -1
  125. notebook/static/9680.bundle.js +1 -1
  126. notebook/static/9685.bundle.js +1 -1
  127. notebook/static/9752.bundle.js +1 -1
  128. notebook/static/9821.bundle.js +1 -1
  129. notebook/static/9852.bundle.js +1 -1
  130. notebook/static/bundle.js +1 -1
  131. notebook/static/third-party-licenses.json +132 -132
  132. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/package.json.orig +14 -14
  133. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/documentsearch-extension/package.json.orig +4 -4
  134. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/package.json.orig +6 -6
  135. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/package.json.orig +9 -9
  136. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/package.json.orig +15 -15
  137. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/package.json +11 -11
  138. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/package.json.orig +10 -10
  139. notebook-7.2.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.b92b1e59d9f727c2f830.js +1 -0
  140. notebook-7.2.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/993.b8375a7b921d370031f6.js → notebook-7.2.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/877.847ad8d470afd79714ba.js +1 -1
  141. notebook-7.2.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.1e2ca839fc49c8dc7f13.js → notebook-7.2.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.9eeacfc9b1fa36be5053.js +1 -1
  142. notebook-7.2.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.5b6c0284fcb63e11cdf4.js +1 -0
  143. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/third-party-licenses.json +2 -2
  144. {notebook-7.2.0a0.dist-info → notebook-7.2.0b0.dist-info}/METADATA +2 -2
  145. {notebook-7.2.0a0.dist-info → notebook-7.2.0b0.dist-info}/RECORD +168 -168
  146. {notebook-7.2.0a0.dist-info → notebook-7.2.0b0.dist-info}/WHEEL +1 -1
  147. notebook/static/1950.bundle.js +0 -1
  148. notebook/static/2067.bundle.js +0 -1
  149. notebook/static/2094.bundle.js +0 -1
  150. notebook/static/2512.bundle.js +0 -1
  151. notebook/static/2577.bundle.js +0 -1
  152. notebook/static/2758.bundle.js +0 -1
  153. notebook/static/3654.bundle.js +0 -1
  154. notebook/static/4928.bundle.js +0 -1
  155. notebook/static/4997.bundle.js +0 -1
  156. notebook/static/6256.bundle.js +0 -1
  157. notebook/static/6467.bundle.js +0 -1
  158. notebook/static/7394.bundle.js +0 -1
  159. notebook-7.2.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.7788635067bbb0f78314.js +0 -1
  160. notebook-7.2.0a0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.e5cd5d0bbfa59d2e79c6.js +0 -1
  161. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/etc/jupyter/jupyter_server_config.d/notebook.json +0 -0
  162. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/applications/jupyter-notebook.desktop +0 -0
  163. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/icons/hicolor/scalable/apps/notebook.svg +0 -0
  164. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/menus.json +0 -0
  165. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/pages.json +0 -0
  166. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/shell.json +0 -0
  167. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/title.json +0 -0
  168. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/top.json +0 -0
  169. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/zen.json +0 -0
  170. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/open.json +0 -0
  171. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/checkpoints.json +0 -0
  172. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/edit-notebook-metadata.json +0 -0
  173. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/kernel-logo.json +0 -0
  174. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/scroll-output.json +0 -0
  175. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +0 -0
  176. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/widget.json +0 -0
  177. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/interface-switcher.json +0 -0
  178. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/launch-tree.json +0 -0
  179. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/93.eae3497dd223d842d198.js +0 -0
  180. {notebook-7.2.0a0.data → notebook-7.2.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/style.js +0 -0
  181. {notebook-7.2.0a0.dist-info → notebook-7.2.0b0.dist-info}/entry_points.txt +0 -0
  182. {notebook-7.2.0a0.dist-info → notebook-7.2.0b0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[374],{90374:(e,t,n)=>{n.r(t),n.d(t,{CellList:()=>_,CellTypeSwitcher:()=>y,CommandEditStatus:()=>N,ExecutionIndicator:()=>x,ExecutionIndicatorComponent:()=>S,INotebookCellExecutor:()=>xe,INotebookTools:()=>ke,INotebookTracker:()=>Se,INotebookWidgetFactory:()=>be,KernelError:()=>C,Notebook:()=>ge,NotebookActions:()=>m,NotebookAdapter:()=>D,NotebookModel:()=>E,NotebookModelFactory:()=>A,NotebookPanel:()=>me,NotebookSearchProvider:()=>_e,NotebookToCFactory:()=>we,NotebookToCModel:()=>fe,NotebookTools:()=>W,NotebookTracker:()=>Me,NotebookTrustStatus:()=>Ee,NotebookViewModel:()=>G,NotebookWidgetFactory:()=>Te,NotebookWindowedLayout:()=>Q,RunningStatus:()=>ve,StaticNotebook:()=>ue,ToolbarItems:()=>f,getIdForHeading:()=>ye,runCell:()=>u,setCellExecutor:()=>v});var o=n(95297),i=n(2867),s=n(9983),l=n(60502),a=n(33625),d=n(20998),r=n(81997),c=n(78156),h=n.n(c);async function u({cell:e,notebook:t,notebookConfig:n,onCellExecuted:s,onCellExecutionScheduled:d,sessionContext:r,sessionDialogs:c,translator:h}){var u;const g=(h=null!=h?h:l.nullTranslator).load("jupyterlab");switch(e.model.type){case"markdown":e.rendered=!0,e.inputHidden=!1,s({cell:e,success:!0});break;case"code":if(r){if(r.isTerminating){await(0,o.showDialog)({title:g.__("Kernel Terminating"),body:g.__("The kernel for %1 appears to be terminating. You can not run any cell for now.",null===(u=r.session)||void 0===u?void 0:u.path),buttons:[o.Dialog.okButton()]});break}if(r.pendingInput)return await(0,o.showDialog)({title:g.__("Cell not executed due to pending input"),body:g.__("The cell has not been executed to avoid kernel deadlock as there is another pending input! Submit your pending input and try again."),buttons:[o.Dialog.okButton()]}),!1;if(r.hasNoKernel&&await r.startKernel()&&c&&await c.selectKernel(r),r.hasNoKernel)return e.model.sharedModel.transact((()=>{e.model.clearExecution()})),!0;const l=t.deletedCells;d({cell:e});let h=!1;try{const o=await i.CodeCell.execute(e,r,{deletedCells:l,recordTiming:n.recordTiming});l.splice(0,l.length),h=(()=>{if(e.isDisposed)return!1;if(!o)return!0;if("ok"===o.content.status){const n=o.content;return n.payload&&n.payload.length&&function(e,t,n){var o;const i=null===(o=e.payload)||void 0===o?void 0:o.filter((e=>"set_next_input"===e.source))[0];if(!i)return;const s=i.text;if(i.replace)return void n.model.sharedModel.setSource(s);const l=t.sharedModel,d=t.cells,r=(0,a.findIndex)(d,(e=>e===n.model));-1===r?l.insertCell(l.cells.length,{cell_type:"code",source:s,metadata:{trusted:!1}}):l.insertCell(r+1,{cell_type:"code",source:s,metadata:{trusted:!1}})}(n,t,e),!0}throw new C(o.content)})()}catch(t){if(!e.isDisposed&&!t.message.startsWith("Canceled"))throw s({cell:e,success:!1,error:t}),t;h=!1}return h&&s({cell:e,success:!0}),h}e.model.sharedModel.transact((()=>{e.model.clearExecution()}),!1)}return Promise.resolve(!0)}const g="application/vnd.jupyter.cells";class C extends Error{constructor(e){const t=e,n=t.ename,o=t.evalue;super(`KernelReplyNotOK: ${n} ${o}`),this.errorName=n,this.errorValue=o,this.traceback=t.traceback,Object.setPrototypeOf(this,C.prototype)}}class m{static get executed(){return p.executed}static get executionScheduled(){return p.executionScheduled}static get selectionExecuted(){return p.selectionExecuted}static get outputCleared(){return p.outputCleared}constructor(){}}function v(e){if(p.executor)throw new Error("Cell executor can only be set once.");p.executor=e}var p;!function(e){function t(e,t){if(!e.model||!e.activeCell)return;const n=p.getState(e),o=e.widgets.findIndex((t=>e.isSelectedOrActive(t)));let i=e.widgets.slice(o+1).findIndex((t=>!e.isSelectedOrActive(t)));i>=0?i+=o+1:i=e.model.cells.length,t>0?e.moveCell(o,i,i-o):e.moveCell(o,o+t,i-o),p.handleState(e,n,!0)}function n(e,t="below",n,o=!1){if(!e.model||!e.activeCell)return;const i=p.getState(e),s=e.model;e.mode="command";let l=0;const a=e.activeCellIndex;s.sharedModel.transact((()=>{switch(t){case"below":l=e.activeCellIndex+1;break;case"belowSelected":e.widgets.forEach(((t,n)=>{e.isSelectedOrActive(t)&&(l=n+1)}));break;case"above":l=e.activeCellIndex;break;case"replace":{const t=[];e.widgets.forEach(((n,o)=>{const i=!1!==n.model.sharedModel.getMetadata("deletable");e.isSelectedOrActive(n)&&i&&t.push(o)})),t.length>0&&t.reverse().forEach((e=>{s.sharedModel.deleteCell(e)})),l=t[0];break}}s.sharedModel.insertCells(l,n.map((t=>(t.id="code"===t.cell_type&&"cut"===e.lastClipboardInteraction&&"string"==typeof t.id?t.id:void 0,t))))})),e.activeCellIndex=a+n.length,e.deselectAll(),o&&(e.lastClipboardInteraction="paste"),p.handleState(e,i,!0)}function r(t,n,o){const s=(0,a.findIndex)(o.widgets,((e,n)=>t.model.id===e.model.id));if(-1===s)return-1;if(!o.widgets.length)return s+1;let l=e.getHeadingInfo(t);if(t.isHidden||!(t instanceof i.MarkdownCell)||!l.isHeading)return s+1;let d,r=!1,c=0;for(d=s+1;d<o.widgets.length;d++){let t=o.widgets[d],i=e.getHeadingInfo(t);if(i.isHeading&&i.headingLevel<=l.headingLevel){d-=1;break}r&&i.isHeading&&i.headingLevel<=c&&(r=!1),n||r?t.setHidden(!0):(i.collapsed&&i.isHeading&&(r=!0,c=i.headingLevel),t.setHidden(!1))}return d===o.widgets.length?t.numberChildNodes=d-s-1:t.numberChildNodes=d-s,e.setCellCollapse(t,n),d+1}function h(e){if(!(e instanceof i.MarkdownCell))return{isHeading:!1,headingLevel:7};let t=e.headingInfo.level;return{isHeading:t>0,headingLevel:t,collapsed:e.headingCollapsed}}async function u(e,t={waitUntilReady:!0,preventScroll:!1}){const{activeCell:n}=e,{waitUntilReady:o,preventScroll:i}=t;n&&(o&&await n.ready,e.isDisposed||n.isDisposed||n.node.focus({preventScroll:i}))}e.splitCell=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);e.mode="edit",e.deselectAll();const n=e.model,o=e.activeCellIndex,i=e.widgets[o],s=i.editor;if(!s)return;const l=s.getSelections(),a=i.model.sharedModel.getSource(),d=[0];let r=-1,c=-1;for(let e=0;e<l.length;e++)r=s.getOffsetAt(l[e].start),c=s.getOffsetAt(l[e].end),r<c?(d.push(r),d.push(c)):c<r?(d.push(c),d.push(r)):d.push(r);d.push(a.length);const h=d.length-1,u=d.slice(0,-1).map(((e,t)=>{const{cell_type:n,metadata:o,outputs:s}=i.model.sharedModel.toJSON();return{cell_type:n,metadata:o,source:a.slice(e,d[t+1]).replace(/^\n+/,"").replace(/\n+$/,""),outputs:t===h-1&&"code"===n?s:void 0}}));n.sharedModel.transact((()=>{n.sharedModel.deleteCell(o),n.sharedModel.insertCells(o,u)}));const g=r!==c?2:1;e.activeCellIndex=o+u.length-g,e.scrollToItem(e.activeCellIndex).then((()=>{var t;null===(t=e.activeCell)||void 0===t||t.editor.focus()})).catch((e=>{})),p.handleState(e,t)},e.mergeCells=function(e,t=!1){if(!e.model||!e.activeCell)return;const n=p.getState(e),o=[],s=[],l=e.model,a=l.cells,d=e.activeCell,r=e.activeCellIndex,c={};if(e.widgets.forEach(((t,n)=>{if(e.isSelectedOrActive(t)){o.push(t.model.sharedModel.getSource()),n!==r&&s.push(n);const e=t.model;if((0,i.isRawCellModel)(e)||(0,i.isMarkdownCellModel)(e))for(const t of e.attachments.keys)c[t]=e.attachments.get(t).toJSON()}})),1===o.length)if(!0===t){if(0===r)return;const e=a.get(r-1);o.unshift(e.sharedModel.getSource()),s.push(r-1)}else if(!1===t){if(r===a.length-1)return;const e=a.get(r+1);o.push(e.sharedModel.getSource()),s.push(r+1)}e.deselectAll();const h=d.model.sharedModel,{cell_type:u,metadata:g}=h.toJSON();"code"===h.cell_type&&(g.trusted=!0);const C={cell_type:u,metadata:g,source:o.join("\n\n"),attachments:"markdown"===h.cell_type||"raw"===h.cell_type?c:void 0};l.sharedModel.transact((()=>{l.sharedModel.deleteCell(r),l.sharedModel.insertCell(r,C),s.sort(((e,t)=>t-e)).forEach((e=>{l.sharedModel.deleteCell(e)}))})),d instanceof i.MarkdownCell&&(e.activeCell.rendered=!1),p.handleState(e,n)},e.deleteCells=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);p.deleteCells(e),p.handleState(e,t,!0)},e.insertAbove=function(e){if(!e.model)return;const t=p.getState(e),n=e.model,o=e.activeCell?e.activeCellIndex:0;n.sharedModel.insertCell(o,{cell_type:e.notebookConfig.defaultCell,metadata:"code"===e.notebookConfig.defaultCell?{trusted:!0}:{}}),e.activeCellIndex=o,e.deselectAll(),p.handleState(e,t,!0)},e.insertBelow=function(e){if(!e.model)return;const t=p.getState(e),n=e.model,o=e.activeCell?e.activeCellIndex+1:0;n.sharedModel.insertCell(o,{cell_type:e.notebookConfig.defaultCell,metadata:"code"===e.notebookConfig.defaultCell?{trusted:!0}:{}}),e.activeCellIndex=o,e.deselectAll(),p.handleState(e,t,!0)},e.moveDown=function(e){t(e,1)},e.moveUp=function(e){t(e,-1)},e.changeCellType=function(e,t,n){if(!e.model||!e.activeCell)return;const o=p.getState(e);p.changeCellType(e,t,n),p.handleState(e,o)},e.run=function(e,t,n,o){if(!e.model||!e.activeCell)return Promise.resolve(!1);const i=p.getState(e),s=p.runSelected(e,t,n,o);return p.handleRunState(e,i),s},e.runCells=function(e,t,n,o,i){if(!e.model)return Promise.resolve(!1);const s=p.getState(e),l=p.runCells(e,t,n,o,i);return p.handleRunState(e,s),l},e.runAndAdvance=async function(e,t,n,o){var i;if(!e.model||!e.activeCell)return Promise.resolve(!1);const l=p.getState(e),a=p.runSelected(e,t,n,o),d=e.model;return e.activeCellIndex===e.widgets.length-1?(d.sharedModel.insertCell(e.widgets.length,{cell_type:e.notebookConfig.defaultCell,metadata:"code"===e.notebookConfig.defaultCell?{trusted:!0}:{}}),e.activeCellIndex++,!1===(null===(i=e.activeCell)||void 0===i?void 0:i.inViewport)&&await(0,s.signalToPromise)(e.activeCell.inViewportChanged,200).catch((()=>{})),e.mode="edit"):e.activeCellIndex++,p.handleRunState(e,l,"center"),a},e.runAndInsert=async function(e,t,n,o){var i;if(!e.model||!e.activeCell)return Promise.resolve(!1);const l=p.getState(e),a=p.runSelected(e,t,n,o);return e.model.sharedModel.insertCell(e.activeCellIndex+1,{cell_type:e.notebookConfig.defaultCell,metadata:"code"===e.notebookConfig.defaultCell?{trusted:!0}:{}}),e.activeCellIndex++,!1===(null===(i=e.activeCell)||void 0===i?void 0:i.inViewport)&&await(0,s.signalToPromise)(e.activeCell.inViewportChanged,200).catch((()=>{})),e.mode="edit",p.handleRunState(e,l,"center"),a},e.runAll=function(e,t,n,o){if(!e.model||!e.activeCell)return Promise.resolve(!1);const i=p.getState(e),s=e.widgets.length,l=p.runCells(e,e.widgets,t,n,o);return e.activeCellIndex=s,e.deselectAll(),p.handleRunState(e,i),l},e.renderAllMarkdown=function(e){if(!e.model||!e.activeCell)return Promise.resolve(!1);const t=e.activeCellIndex,n=p.getState(e);if(e.widgets.forEach(((t,n)=>{"markdown"===t.model.type&&(e.select(t),e.activeCellIndex=n)})),"markdown"!==e.activeCell.model.type)return Promise.resolve(!0);const o=p.runSelected(e);return e.activeCellIndex=t,p.handleRunState(e,n),o},e.runAllAbove=function(e,t,n,o){const{activeCell:i,activeCellIndex:s,model:l}=e;if(!l||!i||s<1)return Promise.resolve(!1);const a=p.getState(e),d=p.runCells(e,e.widgets.slice(0,e.activeCellIndex),t,n,o);return e.deselectAll(),p.handleRunState(e,a),d},e.runAllBelow=function(e,t,n,o){if(!e.model||!e.activeCell)return Promise.resolve(!1);const i=p.getState(e),s=e.widgets.length,l=p.runCells(e,e.widgets.slice(e.activeCellIndex),t,n,o);return e.activeCellIndex=s,e.deselectAll(),p.handleRunState(e,i),l},e.replaceSelection=function(e,t){var n,o,i;e.model&&(null===(n=e.activeCell)||void 0===n?void 0:n.editor)&&(null===(i=(o=e.activeCell.editor).replaceSelection)||void 0===i||i.call(o,t))},e.selectAbove=function(e){if(!e.model||!e.activeCell)return;const t=e.layout.footer;if(t&&document.activeElement===t.node)return t.node.blur(),void(e.mode="command");if(0===e.activeCellIndex)return;let n=e.activeCellIndex-1;for(;n>=0;){const t=e.widgets[n];if(!t.inputHidden&&!t.isHidden)break;n-=1}const o=p.getState(e);e.activeCellIndex=n,e.deselectAll(),p.handleState(e,o,!0)},e.selectBelow=function(e){if(!e.model||!e.activeCell)return;let t=e.widgets.length-1;for(;e.widgets[t].isHidden||e.widgets[t].inputHidden;)t-=1;if(e.activeCellIndex===t){const t=e.layout.footer;return void(null==t||t.node.focus())}let n=e.activeCellIndex+1;for(;n<t;){let t=e.widgets[n];if(!t.inputHidden&&!t.isHidden)break;n+=1}const o=p.getState(e);e.activeCellIndex=n,e.deselectAll(),p.handleState(e,o,!0)},e.insertSameLevelHeadingAbove=async function(e){if(!e.model||!e.activeCell)return;let t=p.Headings.determineHeadingLevel(e.activeCell,e);-1==t?await p.Headings.insertHeadingAboveCellIndex(0,1,e):await p.Headings.insertHeadingAboveCellIndex(e.activeCellIndex,t,e)},e.insertSameLevelHeadingBelow=async function(e){if(!e.model||!e.activeCell)return;let t=p.Headings.determineHeadingLevel(e.activeCell,e);t=t>-1?t:1;let n=p.Headings.findLowerEqualLevelHeadingBelow(e.activeCell,e,!0);await p.Headings.insertHeadingAboveCellIndex(-1==n?e.model.cells.length:n,t,e)},e.selectHeadingAboveOrCollapseHeading=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);let n=h(e.activeCell);if(n.isHeading&&!n.collapsed)r(e.activeCell,!0,e);else{let t=p.Headings.findLowerEqualLevelParentHeadingAbove(e.activeCell,e,!0);t>-1&&(e.activeCellIndex=t)}e.deselectAll(),p.handleState(e,t,!0)},e.selectHeadingBelowOrExpandHeading=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);let n=h(e.activeCell);if(n.isHeading&&n.collapsed)r(e.activeCell,!1,e);else{let t=p.Headings.findHeadingBelow(e.activeCell,e,!0);t>-1&&(e.activeCellIndex=t)}e.deselectAll(),p.handleState(e,t,!0)},e.extendSelectionAbove=function(e,t=!1){if(!e.model||!e.activeCell)return;if(0===e.activeCellIndex)return;const n=p.getState(e);e.mode="command",t?e.extendContiguousSelectionTo(0):e.extendContiguousSelectionTo(e.activeCellIndex-1),p.handleState(e,n,!0)},e.extendSelectionBelow=function(e,t=!1){if(!e.model||!e.activeCell)return;if(e.activeCellIndex===e.widgets.length-1)return;const n=p.getState(e);e.mode="command",t?e.extendContiguousSelectionTo(e.widgets.length-1):e.extendContiguousSelectionTo(e.activeCellIndex+1),p.handleState(e,n,!0)},e.selectAll=function(e){e.model&&e.activeCell&&e.widgets.forEach((t=>{e.select(t)}))},e.deselectAll=function(e){e.model&&e.activeCell&&e.deselectAll()},e.copy=function(e){p.copyOrCut(e,!1)},e.cut=function(e){p.copyOrCut(e,!0)},e.paste=function(e,t="below"){const i=o.Clipboard.getInstance();i.hasData(g)&&(n(e,t,i.getData(g),!0),u(e))},e.duplicate=function(e,t="below"){const o=p.selectedCells(e);o&&0!==o.length&&n(e,t,o,!1)},e.undo=function(e){if(!e.model)return;const t=p.getState(e);e.mode="command",e.model.sharedModel.undo(),e.deselectAll(),p.handleState(e,t)},e.redo=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);e.mode="command",e.model.sharedModel.redo(),e.deselectAll(),p.handleState(e,t)},e.toggleAllLineNumbers=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e),n=e.editorConfig,o=!(n.code.lineNumbers&&n.markdown.lineNumbers&&n.raw.lineNumbers),i={code:{...n.code,lineNumbers:o},markdown:{...n.markdown,lineNumbers:o},raw:{...n.raw,lineNumbers:o}};e.editorConfig=i,p.handleState(e,t)},e.clearOutputs=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);let n=-1;for(const t of e.model.cells){const o=e.widgets[++n];e.isSelectedOrActive(o)&&"code"===t.type&&(t.sharedModel.transact((()=>{t.clearExecution(),o.outputHidden=!1}),!1),p.outputCleared.emit({notebook:e,cell:o}))}p.handleState(e,t,!0)},e.clearAllOutputs=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);let n=-1;for(const t of e.model.cells){const o=e.widgets[++n];"code"===t.type&&(t.sharedModel.transact((()=>{t.clearExecution(),o.outputHidden=!1}),!1),p.outputCleared.emit({notebook:e,cell:o}))}p.handleState(e,t,!0)},e.hideCode=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);e.widgets.forEach((t=>{e.isSelectedOrActive(t)&&"code"===t.model.type&&(t.inputHidden=!0)})),p.handleState(e,t)},e.showCode=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);e.widgets.forEach((t=>{e.isSelectedOrActive(t)&&"code"===t.model.type&&(t.inputHidden=!1)})),p.handleState(e,t)},e.hideAllCode=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);e.widgets.forEach((e=>{"code"===e.model.type&&(e.inputHidden=!0)})),p.handleState(e,t)},e.showAllCode=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);e.widgets.forEach((e=>{"code"===e.model.type&&(e.inputHidden=!1)})),p.handleState(e,t)},e.hideOutput=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);e.widgets.forEach((t=>{e.isSelectedOrActive(t)&&"code"===t.model.type&&(t.outputHidden=!0)})),p.handleState(e,t,!0)},e.showOutput=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);e.widgets.forEach((t=>{e.isSelectedOrActive(t)&&"code"===t.model.type&&(t.outputHidden=!1)})),p.handleState(e,t)},e.hideAllOutputs=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);e.widgets.forEach((e=>{"code"===e.model.type&&(e.outputHidden=!0)})),p.handleState(e,t,!0)},e.renderSideBySide=function(e){e.renderingLayout="side-by-side"},e.renderDefault=function(e){e.renderingLayout="default"},e.showAllOutputs=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);e.widgets.forEach((e=>{"code"===e.model.type&&(e.outputHidden=!1)})),p.handleState(e,t)},e.enableOutputScrolling=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);e.widgets.forEach((t=>{e.isSelectedOrActive(t)&&"code"===t.model.type&&(t.outputsScrolled=!0)})),p.handleState(e,t,!0)},e.disableOutputScrolling=function(e){if(!e.model||!e.activeCell)return;const t=p.getState(e);e.widgets.forEach((t=>{e.isSelectedOrActive(t)&&"code"===t.model.type&&(t.outputsScrolled=!1)})),p.handleState(e,t)},e.selectLastRunCell=function(e){let t=null,n=null;e.widgets.forEach(((e,o)=>{if("code"===e.model.type){const i=e.model.getMetadata("execution");if(i&&d.JSONExt.isObject(i)&&void 0!==i["iopub.status.busy"]){const e=i["iopub.status.busy"].toString();if(e){const i=new Date(e);(!t||i>=t)&&(t=i,n=o)}}}})),null!==n&&(e.activeCellIndex=n)},e.setMarkdownHeader=function(e,t,n){if(!e.model||!e.activeCell)return;const o=p.getState(e),i=e.model.cells;t=Math.min(Math.max(t,1),6),e.widgets.forEach(((n,o)=>{e.isSelectedOrActive(n)&&p.setMarkdownHeader(i.get(o),t)})),p.changeCellType(e,"markdown",n),p.handleState(e,o)},e.collapseAllHeadings=function(t){const n=p.getState(t);for(const n of t.widgets)e.getHeadingInfo(n).isHeading&&(e.setHeadingCollapse(n,!0,t),e.setCellCollapse(n,!0));t.activeCellIndex=0,p.handleState(t,n,!0)},e.expandAllHeadings=function(t){for(const n of t.widgets)e.getHeadingInfo(n).isHeading&&(e.setHeadingCollapse(n,!1,t),e.setCellCollapse(n,!1))},e.expandParent=function e(t,n){let o=function(e,t){const n=(0,a.findIndex)(t.widgets,((t,n)=>e.model.id===t.model.id));if(-1===n)return;if(n>=t.widgets.length)return;let o=h(t.widgets[n]);for(let e=n-1;e>=0;e--)if(e<t.widgets.length){let n=h(t.widgets[e]);if(n.isHeading&&n.headingLevel<o.headingLevel)return t.widgets[e]}}(t,n);o&&(h(o).collapsed||o.isHidden)&&(o.isHidden&&e(o,n),h(o).collapsed&&r(o,!1,n))},e.findNextParentHeading=function(e,t){let n=(0,a.findIndex)(t.widgets,((t,n)=>e.model.id===t.model.id));if(-1===n)return-1;let o=h(e);for(n+=1;n<t.widgets.length;n++){let e=h(t.widgets[n]);if(e.isHeading&&e.headingLevel<=o.headingLevel)return n}return t.widgets.length},e.setHeadingCollapse=r,e.toggleCurrentHeadingCollapse=function(t){if(!t.activeCell||void 0===t.activeCellIndex)return;let n=e.getHeadingInfo(t.activeCell);n.isHeading&&e.setHeadingCollapse(t.activeCell,!n.collapsed,t),t.scrollToItem(t.activeCellIndex).catch((e=>{}))},e.setCellCollapse=function(e,t){e instanceof i.MarkdownCell?e.headingCollapsed=t:e.setHidden(t)},e.getHeadingInfo=h,e.trust=function(e,t){const n=(t=t||l.nullTranslator).load("jupyterlab");if(!e.model)return Promise.resolve();const i=(0,a.every)(e.model.cells,(e=>e.trusted)),s=c.createElement("p",null,n.__("A trusted Jupyter notebook may execute hidden malicious code when you open it."),c.createElement("br",null),n.__('Selecting "Trust" will re-render this notebook in a trusted state.'),c.createElement("br",null),n.__("For more information, see")," ",c.createElement("a",{href:"https://jupyter-server.readthedocs.io/en/stable/operators/security.html",target:"_blank",rel:"noopener noreferrer"},n.__("the Jupyter security documentation")),".");return i?(0,o.showDialog)({body:n.__("Notebook is already trusted"),buttons:[o.Dialog.okButton()]}).then((()=>{})):(0,o.showDialog)({body:s,title:n.__("Trust this notebook?"),buttons:[o.Dialog.cancelButton(),o.Dialog.warnButton({label:n.__("Trust"),ariaLabel:n.__("Confirm Trusting this notebook")})]}).then((t=>{if(t.button.accept&&e.model)for(const t of e.model.cells)t.trusted=!0}))},e.focusActiveCell=u,e.accessPreviousHistory=async function(e){if(!e.notebookConfig.accessKernelHistory)return;const t=e.activeCell;if(t&&e.kernelHistory){const n=await e.kernelHistory.back(t);e.kernelHistory.updateEditor(t,n)}},e.accessNextHistory=async function(e){if(!e.notebookConfig.accessKernelHistory)return;const t=e.activeCell;if(t&&e.kernelHistory){const n=await e.kernelHistory.forward(t);e.kernelHistory.updateEditor(t,n)}}}(m||(m={})),function(e){function t(e){var t,n;return{wasFocused:e.node.contains(document.activeElement),activeCellId:null!==(n=null===(t=e.activeCell)||void 0===t?void 0:t.model.id)&&void 0!==n?n:null}}async function n(e,t,n=!1){const{activeCell:o,activeCellIndex:i}=e;n&&o&&await e.scrollToItem(i,"auto",0).catch((e=>{})),(t.wasFocused||"edit"===e.mode)&&e.activate()}function i(t,n,i,s,a){const d=n[-1];t.mode="command";let r=!1;return Promise.all(n.map((n=>{if("code"===n.model.type&&t.notebookConfig.enableKernelInitNotification&&i&&"initializing"===i.kernelDisplayStatus&&!r){r=!0;const e=(a=a||l.nullTranslator).load("jupyterlab");return o.Notification.emit(e.__(`Kernel '${i.kernelDisplayName}' for '${i.path}' is still initializing. You can run code cells when the kernel has initialized.`),"warning",{autoClose:!1}),Promise.resolve(!1)}return"code"===n.model.type&&t.notebookConfig.enableKernelInitNotification&&r?Promise.resolve(!1):async function(t,n,o,i,s){e.executor||console.warn("Requesting cell execution without any cell executor defined. Falling back to default execution.");const l={cell:n,notebook:t.model,notebookConfig:t.notebookConfig,onCellExecuted:n=>{e.executed.emit({notebook:t,...n})},onCellExecutionScheduled:n=>{e.executionScheduled.emit({notebook:t,...n})},sessionContext:o,sessionDialogs:i,translator:s};return e.executor?e.executor.runCell(l):u(l)}(t,n,i,s,a)}))).then((n=>!t.isDisposed&&(e.selectionExecuted.emit({notebook:t,lastCell:d}),t.update(),n.every((e=>e))))).catch((o=>{if(!o.message.startsWith("KernelReplyNotOK"))throw o;return n.map((e=>{"code"===e.model.type&&null==e.model.executionCount&&e.setPrompt("")})),e.selectionExecuted.emit({notebook:t,lastCell:d}),t.update(),!1}))}function a(e){const t=e.model.sharedModel,n=[];e.mode="command",e.widgets.forEach(((t,o)=>{var i;const s=!1!==t.model.getMetadata("deletable");e.isSelectedOrActive(t)&&s&&(n.push(o),null===(i=e.model)||void 0===i||i.deletedCells.push(t.model.id))})),n.length>0&&(t.transact((()=>{n.reverse().forEach((e=>{t.deleteCell(e)})),t.cells.length==n.length&&t.insertCell(0,{cell_type:e.notebookConfig.defaultCell,metadata:"code"===e.notebookConfig.defaultCell?{trusted:!0}:{}})})),e.activeCellIndex=n[0]-n.length+1),e.deselectAll()}let d;e.executed=new r.Signal({}),e.executionScheduled=new r.Signal({}),e.selectionExecuted=new r.Signal({}),e.outputCleared=new r.Signal({}),e.getState=t,e.handleState=n,e.handleRunState=async function(e,t,n){const{activeCell:o,activeCellIndex:i}=e;o&&await e.scrollToItem(i,"smart",0,n).catch((e=>{})),(t.wasFocused||"edit"===e.mode)&&e.activate()},e.runCells=i,e.runSelected=function(e,t,n,o){e.mode="command";let s=e.activeCellIndex;const l=e.widgets.filter(((t,n)=>{const o=e.isSelectedOrActive(t);return o&&(s=n),o}));return e.activeCellIndex=s,e.deselectAll(),i(e,l,t,n,o)},e.selectedCells=function(e){return e.widgets.filter((t=>e.isSelectedOrActive(t))).map((e=>e.model.toJSON())).map((e=>(void 0!==e.metadata.deletable&&delete e.metadata.deletable,e)))},e.copyOrCut=function(i,s){if(!i.model||!i.activeCell)return;const l=t(i),d=o.Clipboard.getInstance();i.mode="command",d.clear();const r=e.selectedCells(i);d.setData(g,r),s?a(i):i.deselectAll(),i.lastClipboardInteraction=s?"cut":"copy",n(i,l)},e.changeCellType=function(e,t,n){const i=e.model.sharedModel;e.widgets.forEach(((s,a)=>{if(e.isSelectedOrActive(s))if("code"===s.model.type&&s.outputArea.pendingInput){const e=(n=n||l.nullTranslator).load("jupyterlab");(0,o.showDialog)({title:e.__("Cell type not changed due to pending input"),body:e.__("The cell type has not been changed to avoid kernel deadlock as this cell has pending input! Submit your pending input and try again."),buttons:[o.Dialog.okButton()]})}else{if(s.model.type!==t){const e=s.model.toJSON();i.transact((()=>{i.deleteCell(a),e.metadata.trusted="code"===t||void 0;const n=i.insertCell(a,{cell_type:t,source:e.source,metadata:e.metadata});e.attachments&&["markdown","raw"].includes(t)&&(n.attachments=e.attachments)}))}"markdown"===t&&((s=e.widgets[a]).rendered=!1)}})),e.deselectAll()},e.deleteCells=a,e.setMarkdownHeader=function(e,t){let n=e.sharedModel.getSource();const o=Array(t+1).join("#")+" ",i=/^(#+\s*)|^(\s*)/.exec(n);i&&(n=n.slice(i[0].length)),e.sharedModel.setSource(o+n)},function(t){function n(e,t,n=!1,o=!1){let i=t.widgets.indexOf(e)-(n?1:0);for(;i>=0;){if(m.getHeadingInfo(t.widgets[i]).isHeading)return o?i:t.widgets[i];i--}return o?-1:null}t.findParentHeading=n,t.findLowerEqualLevelParentHeadingAbove=function(t,n,o=!1){let i=e.Headings.determineHeadingLevel(t,n);-1==i&&(i=1);let s=n.widgets.indexOf(t)-1;for(;s>=0;){let e=n.widgets[s],t=m.getHeadingInfo(e);if(t.isHeading&&t.headingLevel<=i)return o?s:e;s--}return o?-1:null},t.findLowerEqualLevelHeadingBelow=function(t,n,o=!1){let i=e.Headings.determineHeadingLevel(t,n);-1==i&&(i=1);let s=n.widgets.indexOf(t)+1;for(;s<n.widgets.length;){let e=n.widgets[s],t=m.getHeadingInfo(e);if(t.isHeading&&t.headingLevel<=i)return o?s:e;s++}return o?-1:null},t.findHeadingBelow=function(e,t,n=!1){let o=t.widgets.indexOf(e)+1;for(;o<t.widgets.length;){let e=t.widgets[o];if(m.getHeadingInfo(e).isHeading)return n?o:e;o++}return n?-1:null},t.determineHeadingLevel=function(e,t){let o=m.getHeadingInfo(e);if(o.isHeading)return o.headingLevel;{let o=n(e,t,!0);return null==o?-1:m.getHeadingInfo(o).headingLevel}},t.insertHeadingAboveCellIndex=async function(t,n,o){var i;n=Math.min(Math.max(n,1),6);const l=e.getState(o);o.model.sharedModel.insertCell(t,{cell_type:"markdown",source:"#".repeat(n)+" "}),o.activeCellIndex=t,!1===(null===(i=o.activeCell)||void 0===i?void 0:i.inViewport)&&await(0,s.signalToPromise)(o.activeCell.inViewportChanged,200).catch((()=>{})),o.deselectAll(),e.handleState(o,l,!0),o.mode="edit",o.widgets[t].setHidden(!1)}}(d=e.Headings||(e.Headings={}))}(p||(p={}));class _{constructor(e){this.model=e,this._cellMap=new WeakMap,this._changed=new r.Signal(this),this._isDisposed=!1,this._insertCells(0,this.model.cells),this.model.changed.connect(this._onSharedModelChanged,this)}get changed(){return this._changed}get isDisposed(){return this._isDisposed}get length(){return this.model.cells.length}*[Symbol.iterator](){for(const e of this.model.cells)yield this._cellMap.get(e)}dispose(){var e;if(!this._isDisposed){this._isDisposed=!0;for(const t of this.model.cells)null===(e=this._cellMap.get(t))||void 0===e||e.dispose();r.Signal.clearData(this)}}get(e){return this._cellMap.get(this.model.cells[e])}_insertCells(e,t){return t.forEach((e=>{let t;switch(e.cell_type){case"code":t=new i.CodeCellModel({sharedModel:e});break;case"markdown":t=new i.MarkdownCellModel({sharedModel:e});break;default:t=new i.RawCellModel({sharedModel:e})}this._cellMap.set(e,t),e.disposed.connect((()=>{t.dispose(),this._cellMap.delete(e)}))})),this.length}_onSharedModelChanged(e,t){var n;let o=0;const i=new Array;null===(n=t.cellsChange)||void 0===n||n.forEach((e=>{null!=e.insert?(this._insertCells(o,e.insert),i.push({type:"add",newIndex:o,newValues:e.insert.map((e=>this._cellMap.get(e))),oldIndex:-2,oldValues:[]}),o+=e.insert.length):null!=e.delete?i.push({type:"remove",newIndex:-1,newValues:[],oldIndex:o,oldValues:new Array(e.delete).fill(void 0)}):null!=e.retain&&(o+=e.retain)})),i.forEach((e=>this._changed.emit(e)))}}var f,w=n(31589);!function(e){function t(e,t){const n=(t||l.nullTranslator).load("jupyterlab");function i(){if(e.context.model.readOnly)return(0,o.showDialog)({title:n.__("Cannot Save"),body:n.__("Document is read-only"),buttons:[o.Dialog.okButton()]});e.context.save().then((()=>{if(!e.isDisposed)return e.context.createCheckpoint()}))}return(0,w.addToolbarButtonClass)(w.ReactWidget.create(c.createElement(w.UseSignal,{signal:e.context.fileChanged},(()=>c.createElement(w.ToolbarButtonComponent,{icon:w.saveIcon,onClick:i,tooltip:n.__("Save the notebook contents and create checkpoint"),enabled:!!(e&&e.context&&e.context.contentsModel&&e.context.contentsModel.writable)})))))}function n(e,t){const n=(t||l.nullTranslator).load("jupyterlab");return new w.ToolbarButton({icon:w.addIcon,onClick:()=>{m.insertBelow(e.content)},tooltip:n.__("Insert a cell below")})}function i(e,t){const n=(t||l.nullTranslator).load("jupyterlab");return new w.ToolbarButton({icon:w.cutIcon,onClick:()=>{m.cut(e.content)},tooltip:n.__("Cut the selected cells")})}function s(e,t){const n=(t||l.nullTranslator).load("jupyterlab");return new w.ToolbarButton({icon:w.copyIcon,onClick:()=>{m.copy(e.content)},tooltip:n.__("Copy the selected cells")})}function a(e,t){const n=(t||l.nullTranslator).load("jupyterlab");return new w.ToolbarButton({icon:w.pasteIcon,onClick:()=>{m.paste(e.content)},tooltip:n.__("Paste cells from the clipboard")})}function d(e,t,n){const o=(null!=n?n:l.nullTranslator).load("jupyterlab");return new w.ToolbarButton({icon:w.runIcon,onClick:()=>{m.runAndAdvance(e.content,e.sessionContext,t,n)},tooltip:o.__("Run the selected cells and advance")})}function r(e,t,n){const i=(null!=n?n:l.nullTranslator).load("jupyterlab");return new w.ToolbarButton({icon:w.fastForwardIcon,onClick:()=>{const i=null!=t?t:new o.SessionContextDialogs({translator:n});i.restart(e.sessionContext).then((t=>(t&&m.runAll(e.content,e.sessionContext,i,n),t)))},tooltip:i.__("Restart the kernel, then re-run the whole notebook")})}function h(e,t){return new y(e.content,t)}e.createSaveButton=t,e.createInsertButton=n,e.createCutButton=i,e.createCopyButton=s,e.createPasteButton=a,e.createRunButton=d,e.createRestartRunAllButton=r,e.createCellTypeItem=h,e.getDefaultItems=function(e,l,c){return[{name:"save",widget:t(e,c)},{name:"insert",widget:n(e,c)},{name:"cut",widget:i(e,c)},{name:"copy",widget:s(e,c)},{name:"paste",widget:a(e,c)},{name:"run",widget:d(e,l,c)},{name:"interrupt",widget:o.Toolbar.createInterruptButton(e.sessionContext,c)},{name:"restart",widget:o.Toolbar.createRestartButton(e.sessionContext,l,c)},{name:"restart-and-run",widget:r(e,l,c)},{name:"cellType",widget:h(e,c)},{name:"spacer",widget:w.Toolbar.createSpacerItem()},{name:"kernelName",widget:o.Toolbar.createKernelNameItem(e.sessionContext,l,c)}]}}(f||(f={}));class y extends w.ReactWidget{constructor(e,t){super(),this.handleChange=e=>{"-"!==e.target.value&&(m.changeCellType(this._notebook,e.target.value),this._notebook.activate())},this.handleKeyDown=e=>{13===e.keyCode&&this._notebook.activate()},this._trans=(t||l.nullTranslator).load("jupyterlab"),this.addClass("jp-Notebook-toolbarCellType"),this._notebook=e,e.model&&this.update(),e.activeCellChanged.connect(this.update,this),e.selectionChanged.connect(this.update,this)}render(){let e="-";this._notebook.activeCell&&(e=this._notebook.activeCell.model.type);for(const t of this._notebook.widgets)if(this._notebook.isSelectedOrActive(t)&&t.model.type!==e){e="-";break}return c.createElement(w.HTMLSelect,{className:"jp-Notebook-toolbarCellTypeDropdown",onChange:this.handleChange,onKeyDown:this.handleKeyDown,value:e,"aria-label":this._trans.__("Cell type"),title:this._trans.__("Select the cell type")},c.createElement("option",{value:"-"},"-"),c.createElement("option",{value:"code"},this._trans.__("Code")),c.createElement("option",{value:"markdown"},this._trans.__("Markdown")),c.createElement("option",{value:"raw"},this._trans.__("Raw")))}}var b=n(47568),k=n(59341);function S(e){const t=e.translator||l.nullTranslator,n=(0,o.translateKernelStatuses)(t),i=t.load("jupyterlab"),s=e.state,a=e.displayOption.showOnToolBar,d=e.displayOption.showProgress,r=a?"down":"up",c=h().createElement("div",null);if(!s)return c;const u=s.kernelStatus,g={alignSelf:"normal",height:"24px"},C=s.totalTime,m=s.scheduledCellNumber||0,v=m-(s.scheduledCell.size||0);let p=100*v/m,_=d?"":"hidden";!d&&p<100&&(p=0);const f=e=>h().createElement(b.ProgressCircle,{progress:e,width:16,height:24,label:i.__("Kernel status")}),y=e=>i.__("Kernel status: %1",e),k=(e,t,o)=>h().createElement("div",{className:"jp-Notebook-ExecutionIndicator",title:d?"":y(n[e]),"data-status":e},t,h().createElement("div",{className:`jp-Notebook-ExecutionIndicator-tooltip ${r} ${_}`},h().createElement("span",null," ",y(n[e])," "),o));if("connecting"===s.kernelStatus||"disconnected"===s.kernelStatus||"unknown"===s.kernelStatus)return k(u,h().createElement(w.offlineBoltIcon.react,{...g}),[]);if("starting"===s.kernelStatus||"terminating"===s.kernelStatus||"restarting"===s.kernelStatus||"initializing"===s.kernelStatus)return k(u,h().createElement(w.circleIcon.react,{...g}),[]);if("busy"===s.executionStatus)return k("busy",f(p),[h().createElement("span",{key:0},i.__(`Executed ${v}/${m} cells`)),h().createElement("span",{key:1},i._n("Elapsed time: %1 second","Elapsed time: %1 seconds",C))]);{const e="busy"===s.kernelStatus?0:100,t="busy"===s.kernelStatus||0===C?[]:[h().createElement("span",{key:0},i._n("Executed %1 cell","Executed %1 cells",m)),h().createElement("span",{key:1},i._n("Elapsed time: %1 second","Elapsed time: %1 seconds",C))];return k(s.kernelStatus,f(e),t)}}class x extends w.VDomRenderer{constructor(e,t=!0){super(new x.Model),this.translator=e||l.nullTranslator,this.addClass("jp-mod-highlighted")}render(){if(null!==this.model&&this.model.renderFlag){const e=this.model.currentNotebook;return e?h().createElement(S,{displayOption:this.model.displayOption,state:this.model.executionState(e),translator:this.translator}):h().createElement(S,{displayOption:this.model.displayOption,state:void 0,translator:this.translator})}return h().createElement("div",null)}}!function(e){class t extends w.VDomModel{constructor(){super(),this._notebookExecutionProgress=new WeakMap,this._displayOption={showOnToolBar:!0,showProgress:!0},this._renderFlag=!0}attachNotebook(e){var t,n,o,i;if(e&&e.content&&e.context){const s=e.content,l=e.context;if(this._currentNotebook=s,!this._notebookExecutionProgress.has(s)){this._notebookExecutionProgress.set(s,{executionStatus:"idle",kernelStatus:"idle",totalTime:0,interval:0,timeout:0,scheduledCell:new Set,scheduledCellNumber:0,needReset:!0});const e=this._notebookExecutionProgress.get(s),a=t=>{e&&(e.kernelStatus=t.kernelDisplayStatus),this.stateChanged.emit(void 0)};l.statusChanged.connect(a,this);const d=t=>{e&&(e.kernelStatus=t.kernelDisplayStatus),this.stateChanged.emit(void 0)};l.connectionStatusChanged.connect(d,this),l.disposed.connect((e=>{e.connectionStatusChanged.disconnect(d,this),e.statusChanged.disconnect(a,this)}));const r=(e,t)=>{const n=t.msg,o=n.header.msg_id;if("execute_request"===n.header.msg_type)this._cellScheduledCallback(s,o);else if(k.KernelMessage.isStatusMsg(n)&&"idle"===n.content.execution_state){const e=n.parent_header.msg_id;this._cellExecutedCallback(s,e)}else k.KernelMessage.isStatusMsg(n)&&"restarting"===n.content.execution_state?this._restartHandler(s):"execute_input"===n.header.msg_type&&this._startTimer(s)};null===(n=null===(t=l.session)||void 0===t?void 0:t.kernel)||void 0===n||n.anyMessage.connect(r),null===(i=null===(o=l.session)||void 0===o?void 0:o.kernel)||void 0===i||i.disposed.connect((e=>e.anyMessage.disconnect(r)));const c=(t,n)=>{e&&(this._resetTime(e),this.stateChanged.emit(void 0),n.newValue&&n.newValue.anyMessage.connect(r))};l.kernelChanged.connect(c),l.disposed.connect((e=>e.kernelChanged.disconnect(c)))}}}get currentNotebook(){return this._currentNotebook}get displayOption(){return this._displayOption}set displayOption(e){this._displayOption=e}executionState(e){return this._notebookExecutionProgress.get(e)}_scheduleSwitchToIdle(e){window.setTimeout((()=>{e.executionStatus="idle",clearInterval(e.interval),this.stateChanged.emit(void 0)}),150),e.timeout=window.setTimeout((()=>{e.needReset=!0}),1e3)}_cellExecutedCallback(e,t){const n=this._notebookExecutionProgress.get(e);n&&n.scheduledCell.has(t)&&(n.scheduledCell.delete(t),0===n.scheduledCell.size&&this._scheduleSwitchToIdle(n))}_restartHandler(e){const t=this._notebookExecutionProgress.get(e);t&&(t.scheduledCell.clear(),this._scheduleSwitchToIdle(t))}_startTimer(e){const t=this._notebookExecutionProgress.get(e);t&&(t.scheduledCell.size>0?"busy"!==t.executionStatus&&(t.executionStatus="busy",clearTimeout(t.timeout),this.stateChanged.emit(void 0),t.interval=window.setInterval((()=>{this._tick(t)}),1e3)):this._resetTime(t))}_cellScheduledCallback(e,t){const n=this._notebookExecutionProgress.get(e);n&&!n.scheduledCell.has(t)&&(n.needReset&&this._resetTime(n),n.scheduledCell.add(t),n.scheduledCellNumber+=1)}_tick(e){e.totalTime+=1,this.stateChanged.emit(void 0)}_resetTime(e){e.totalTime=0,e.scheduledCellNumber=0,e.executionStatus="idle",e.scheduledCell=new Set,clearTimeout(e.timeout),clearInterval(e.interval),e.needReset=!1}get renderFlag(){return this._renderFlag}updateRenderOption(e){this.displayOption.showOnToolBar&&(e.showOnToolBar?this._renderFlag=!0:this._renderFlag=!1),this.displayOption.showProgress=e.showProgress,this.stateChanged.emit(void 0)}}function n(e){let t=!0,n=!0;const o=e.get("kernelStatus").composite;return o&&(t=!o.showOnStatusBar,n=o.showProgress),{showOnToolBar:t,showProgress:n}}e.Model=t,e.createExecutionIndicatorItem=function(t,o,i){const s=new e(o);return s.model.displayOption={showOnToolBar:!0,showProgress:!0},s.model.attachNotebook({content:t.content,context:t.sessionContext}),i&&i.then((e=>{const t=e=>{s.model.updateRenderOption(n(e))};e.changed.connect(t),t(e),s.disposed.connect((()=>{e.changed.disconnect(t)}))})).catch((e=>{console.error(e.message)})),s},e.getSettingValue=n}(x||(x={}));var M=n(76642),I=n(57508);class E{constructor(e={}){var t,n;this.standaloneModel=!1,this._dirty=!1,this._readOnly=!1,this._contentChanged=new r.Signal(this),this._stateChanged=new r.Signal(this),this._isDisposed=!1,this._metadataChanged=new r.Signal(this),this.standaloneModel=void 0===e.sharedModel,e.sharedModel?this.sharedModel=e.sharedModel:this.sharedModel=I.YNotebook.create({disableDocumentWideUndoRedo:null===(t=e.disableDocumentWideUndoRedo)||void 0===t||t,data:{nbformat:M.MAJOR_VERSION,nbformat_minor:M.MINOR_VERSION,metadata:{kernelspec:{name:"",display_name:""},language_info:{name:null!==(n=e.languagePreference)&&void 0!==n?n:""}}}}),this._cells=new _(this.sharedModel),this._trans=(e.translator||l.nullTranslator).load("jupyterlab"),this._deletedCells=[],this._collaborationEnabled=!!(null==e?void 0:e.collaborationEnabled),this._cells.changed.connect(this._onCellsChanged,this),this.sharedModel.changed.connect(this._onStateChanged,this),this.sharedModel.metadataChanged.connect(this._onMetadataChanged,this)}get contentChanged(){return this._contentChanged}get metadataChanged(){return this._metadataChanged}get stateChanged(){return this._stateChanged}get cells(){return this._cells}get dirty(){return this._dirty}set dirty(e){const t=this._dirty;e!==t&&(this._dirty=e,this.triggerStateChange({name:"dirty",oldValue:t,newValue:e}))}get readOnly(){return this._readOnly}set readOnly(e){if(e===this._readOnly)return;const t=this._readOnly;this._readOnly=e,this.triggerStateChange({name:"readOnly",oldValue:t,newValue:e})}get metadata(){return this.sharedModel.metadata}get nbformat(){return this.sharedModel.nbformat}get nbformatMinor(){return this.sharedModel.nbformat_minor}get defaultKernelName(){var e;const t=this.getMetadata("kernelspec");return null!==(e=null==t?void 0:t.name)&&void 0!==e?e:""}get deletedCells(){return this._deletedCells}get defaultKernelLanguage(){var e;const t=this.getMetadata("language_info");return null!==(e=null==t?void 0:t.name)&&void 0!==e?e:""}get collaborative(){return this._collaborationEnabled}dispose(){if(this.isDisposed)return;this._isDisposed=!0;const e=this.cells;this._cells=null,e.dispose(),this.standaloneModel&&this.sharedModel.dispose(),r.Signal.clearData(this)}deleteMetadata(e){return this.sharedModel.deleteMetadata(e)}getMetadata(e){return this.sharedModel.getMetadata(e)}setMetadata(e,t){void 0===t?this.sharedModel.deleteMetadata(e):this.sharedModel.setMetadata(e,t)}toString(){return JSON.stringify(this.toJSON())}fromString(e){this.fromJSON(JSON.parse(e))}toJSON(){return this._ensureMetadata(),this.sharedModel.toJSON()}fromJSON(e){var t,n;const i=d.JSONExt.deepCopy(e),s=e.metadata.orig_nbformat;if(i.nbformat=Math.max(e.nbformat,M.MAJOR_VERSION),(i.nbformat!==e.nbformat||i.nbformat_minor<M.MINOR_VERSION)&&(i.nbformat_minor=M.MINOR_VERSION),void 0!==s&&i.nbformat!==s){let e;e=i.nbformat>s?this._trans.__("This notebook has been converted from an older notebook format (v%1)\nto the current notebook format (v%2).\nThe next time you save this notebook, the current notebook format (v%2) will be used.\n'Older versions of Jupyter may not be able to read the new format.' To preserve the original format version,\nclose the notebook without saving it.",s,i.nbformat):this._trans.__("This notebook has been converted from an newer notebook format (v%1)\nto the current notebook format (v%2).\nThe next time you save this notebook, the current notebook format (v%2) will be used.\nSome features of the original notebook may not be available.' To preserve the original format version,\nclose the notebook without saving it.",s,i.nbformat),(0,o.showDialog)({title:this._trans.__("Notebook converted"),body:e,buttons:[o.Dialog.okButton({label:this._trans.__("Ok")})]})}0===(null!==(n=null===(t=i.cells)||void 0===t?void 0:t.length)&&void 0!==n?n:0)&&(i.cells=[{cell_type:"code",source:"",metadata:{trusted:!0}}]),this.sharedModel.fromJSON(i),this._ensureMetadata(),this.dirty=!0}_onCellsChanged(e,t){switch(t.type){case"add":case"set":t.newValues.forEach((e=>{e.contentChanged.connect(this.triggerContentChange,this)}))}this.triggerContentChange()}_onMetadataChanged(e,t){this._metadataChanged.emit(t),this.triggerContentChange()}_onStateChanged(e,t){t.stateChange&&t.stateChange.forEach((e=>{"dirty"===e.name?this.dirty=e.newValue:e.oldValue!==e.newValue&&this.triggerStateChange({newValue:void 0,oldValue:void 0,...e})}))}_ensureMetadata(e=""){this.getMetadata("language_info")||this.sharedModel.setMetadata("language_info",{name:e}),this.getMetadata("kernelspec")||this.sharedModel.setMetadata("kernelspec",{name:"",display_name:""})}triggerStateChange(e){this._stateChanged.emit(e)}triggerContentChange(){this._contentChanged.emit(void 0),this.dirty=!0}get isDisposed(){return this._isDisposed}}class A{constructor(e={}){var t,n;this._disposed=!1,this._disableDocumentWideUndoRedo=null===(t=e.disableDocumentWideUndoRedo)||void 0===t||t,this._collaborative=null===(n=e.collaborative)||void 0===n||n}get disableDocumentWideUndoRedo(){return this._disableDocumentWideUndoRedo}set disableDocumentWideUndoRedo(e){this._disableDocumentWideUndoRedo=e}get name(){return"notebook"}get contentType(){return"notebook"}get fileFormat(){return"json"}get collaborative(){return this._collaborative}get isDisposed(){return this._disposed}dispose(){this._disposed=!0}createNew(e={}){return new E({languagePreference:e.languagePreference,sharedModel:e.sharedModel,collaborationEnabled:e.collaborationEnabled&&this.collaborative,disableDocumentWideUndoRedo:this._disableDocumentWideUndoRedo})}preferredLanguage(e){return""}}function T(e){const t=(e.translator||l.nullTranslator).load("jupyterlab");return c.createElement(b.TextItem,{source:t.__("Mode: %1",e.modeNames[e.notebookMode])})}class N extends w.VDomRenderer{constructor(e){super(new N.Model),this.translator=e||l.nullTranslator,this._trans=this.translator.load("jupyterlab"),this._modeNames={command:this._trans.__("Command"),edit:this._trans.__("Edit")}}render(){return this.model?(this.node.title=this._trans.__("Notebook is in %1 mode",this._modeNames[this.model.notebookMode]),c.createElement(T,{notebookMode:this.model.notebookMode,translator:this.translator,modeNames:this._modeNames})):null}}!function(e){class t extends w.VDomModel{constructor(){super(...arguments),this._onChanged=e=>{const t=this._notebookMode;this._notebook?this._notebookMode=e.mode:this._notebookMode="command",this._triggerChange(t,this._notebookMode)},this._notebookMode="command",this._notebook=null}get notebookMode(){return this._notebookMode}set notebook(e){const t=this._notebook;null!==t&&(t.stateChanged.disconnect(this._onChanged,this),t.activeCellChanged.disconnect(this._onChanged,this),t.modelContentChanged.disconnect(this._onChanged,this));const n=this._notebookMode;this._notebook=e,null===this._notebook?this._notebookMode="command":(this._notebookMode=this._notebook.mode,this._notebook.stateChanged.connect(this._onChanged,this),this._notebook.activeCellChanged.connect(this._onChanged,this),this._notebook.modelContentChanged.connect(this._onChanged,this)),this._triggerChange(n,this._notebookMode)}_triggerChange(e,t){e!==t&&this.stateChanged.emit(void 0)}}e.Model=t}(N||(N={}));var H=n(97231),P=n(35964);class D extends P.WidgetLSPAdapter{constructor(e,t){super(e,t),this.editorWidget=e,this.options=t,this._type="code",this._readyDelegate=new d.PromiseDelegate,this._editorToCell=new Map,this.editor=e.content,this._cellToEditor=new WeakMap,Promise.all([this.widget.context.sessionContext.ready,this.connectionManager.ready]).then((async()=>{await this.initOnceReady(),this._readyDelegate.resolve()})).catch(console.error)}get documentPath(){return this.widget.context.path}get mimeType(){var e;let t,n=this.language_info();return t=n&&n.mimetype?n.mimetype:this.widget.content.codeMimetype,Array.isArray(t)?null!==(e=t[0])&&void 0!==e?e:H.IEditorMimeTypeService.defaultMimeType:t}get languageFileExtension(){let e=this.language_info();if(e&&e.file_extension)return e.file_extension.replace(".","")}get wrapperElement(){return this.widget.node}get editors(){if(this.isDisposed)return[];let e=this.widget.content;return this._editorToCell.clear(),e.isDisposed?[]:e.widgets.map((e=>({ceEditor:this._getCellEditor(e),type:e.model.type,value:e.model.sharedModel.getSource()})))}get activeEditor(){return this.editor.activeCell?this._getCellEditor(this.editor.activeCell):void 0}get ready(){return this._readyDelegate.promise}getEditorIndexAt(e){let t=this._getCellAt(e);return this.widget.content.widgets.findIndex((e=>t===e))}getEditorIndex(e){let t=this._editorToCell.get(e);return this.editor.widgets.findIndex((e=>t===e))}getEditorWrapper(e){return this._editorToCell.get(e).node}async onKernelChanged(e,t){if(t.newValue)try{const e=this._languageInfo;await(0,P.untilReady)(this.isReady,-1),await this._updateLanguageInfo();const t=this._languageInfo;(null==e?void 0:e.name)!=t.name||(null==e?void 0:e.mimetype)!=(null==t?void 0:t.mimetype)||(null==e?void 0:e.file_extension)!=(null==t?void 0:t.file_extension)?(console.log(`Changed to ${this._languageInfo.name} kernel, reconnecting`),this.reloadConnection()):console.log("Keeping old LSP connection as the new kernel uses the same langauge")}catch(e){console.warn(e),this.reloadConnection()}}dispose(){this.isDisposed||(this.widget.context.sessionContext.kernelChanged.disconnect(this.onKernelChanged,this),this.widget.content.activeCellChanged.disconnect(this._activeCellChanged,this),super.dispose(),this._editorToCell.clear(),r.Signal.clearData(this))}isReady(){var e;return!this.widget.isDisposed&&this.widget.context.isReady&&this.widget.content.isVisible&&this.widget.content.widgets.length>0&&null!=(null===(e=this.widget.context.sessionContext.session)||void 0===e?void 0:e.kernel)}async handleCellChange(e,t){let n=[],o=[];const i=this._type;if("set"===t.type){let e=[],s=[];if(t.newValues.length===t.oldValues.length){for(let n=0;n<t.newValues.length;n++)t.oldValues[n].type===i&&t.newValues[n].type!==i?e.push(t.newValues[n]):t.oldValues[n].type!==i&&t.newValues[n].type===i&&s.push(t.newValues[n]);n=s,o=e}}else"add"==t.type&&(n=t.newValues.filter((e=>e.type===i)));(o.length||n.length||"set"===t.type||"move"===t.type||"remove"===t.type)&&await this.updateDocuments();for(let e of n){let t=this.widget.content.widgets.find((t=>t.model.id===e.id));t?this._getCellEditor(t):console.warn(`Widget for added cell with ID: ${e.id} not found!`)}}createVirtualDocument(){return new P.VirtualDocument({language:this.language,foreignCodeExtractors:this.options.foreignCodeExtractorsManager,path:this.documentPath,fileExtension:this.languageFileExtension,standalone:!1,hasLspSupportedFile:!1})}language_info(){return this._languageInfo}async initOnceReady(){await(0,P.untilReady)(this.isReady.bind(this),-1),await this._updateLanguageInfo(),this.initVirtual(),this.connectDocument(this.virtualDocument,!1).catch(console.warn),this.widget.context.sessionContext.kernelChanged.connect(this.onKernelChanged,this),this.widget.content.activeCellChanged.connect(this._activeCellChanged,this),this._connectModelSignals(this.widget),this.editor.modelChanged.connect((e=>{console.warn("Model changed, connecting cell change handler; this is not something we were expecting"),this._connectModelSignals(e)}))}_connectModelSignals(e){null===e.model?console.warn(`Model is missing for notebook ${e}, cannot connect cell changed signal!`):e.model.cells.changed.connect(this.handleCellChange,this)}async _updateLanguageInfo(){var e,t,n,o;const i=null===(o=await(null===(n=null===(t=null===(e=this.widget.context.sessionContext)||void 0===e?void 0:e.session)||void 0===t?void 0:t.kernel)||void 0===n?void 0:n.info))||void 0===o?void 0:o.language_info;if(!i)throw new Error("Language info update failed (no session, kernel, or info available)");this._languageInfo=i}_activeCellChanged(e,t){t&&t.model.type===this._type&&this._activeEditorChanged.emit({editor:this._getCellEditor(t)})}_getCellAt(e){let t=this.virtualDocument.getEditorAtVirtualLine(e);return this._editorToCell.get(t)}_getCellEditor(e){if(!this._cellToEditor.has(e)){const t=Object.freeze({getEditor:()=>e.editor,ready:async()=>(await e.ready,e.editor),reveal:async()=>(await this.editor.scrollToCell(e),e.editor)});this._cellToEditor.set(e,t),this._editorToCell.set(t,e),e.disposed.connect((()=>{this._cellToEditor.delete(e),this._editorToCell.delete(t),this._editorRemoved.emit({editor:t})})),this._editorAdded.emit({editor:t})}return this._cellToEditor.get(e)}}var L,O=n(95012),R=n(49503),B=n(63485);class F extends B.Widget{constructor(){super(),this._items=[],this.layout=new B.PanelLayout,this.addClass("jp-RankedPanel")}addWidget(e,t){const n={widget:e,rank:t},o=a.ArrayExt.upperBound(this._items,n,L.itemCmp);a.ArrayExt.insert(this._items,o,n),this.layout.insertWidget(o,e)}onChildRemoved(e){const t=a.ArrayExt.findFirstIndex(this._items,(t=>t.widget===e.child));-1!==t&&a.ArrayExt.removeAt(this._items,t)}}class W extends B.Widget{constructor(e){super(),this.addClass("jp-NotebookTools"),this.translator=e.translator||l.nullTranslator,this._tools=[],this.layout=new B.PanelLayout,this._tracker=e.tracker,this._tracker.currentChanged.connect(this._onActiveNotebookPanelChanged,this),this._tracker.activeCellChanged.connect(this._onActiveCellChanged,this),this._tracker.selectionChanged.connect(this._onSelectionChanged,this),this._onActiveNotebookPanelChanged(),this._onActiveCellChanged(),this._onSelectionChanged()}get activeCell(){return this._tracker.activeCell}get selectedCells(){const e=this._tracker.currentWidget;if(!e)return[];const t=e.content;return t.widgets.filter((e=>t.isSelectedOrActive(e)))}get activeNotebookPanel(){return this._tracker.currentWidget}addItem(e){var t;const n=e.tool,o=null!==(t=e.rank)&&void 0!==t?t:100;let i;const s=this._tools.find((t=>t.section===e.section));if(!s)throw new Error(`The section ${e.section} does not exist`);i=s.panel,n.addClass("jp-NotebookTools-tool"),i.addWidget(n,o),n.notebookTools=this,R.MessageLoop.sendMessage(n,W.ActiveNotebookPanelMessage),R.MessageLoop.sendMessage(n,W.ActiveCellMessage)}addSection(e){var t;const n=e.sectionName,o=e.label||e.sectionName,i=e.tool;let s=null!==(t=e.rank)&&void 0!==t?t:null;const l=new F;if(l.title.label=o,i&&l.addWidget(i,0),this._tools.push({section:n,panel:l,rank:s}),null!=s)this.layout.insertWidget(s,new w.Collapser({widget:l}));else{let e=null;const t=this.layout;for(let n=0;n<t.widgets.length;n++){let o=t.widgets[n];if(o instanceof w.Collapser&&"advancedToolsSection"===o.widget.id){e=n;break}}null!==e?this.layout.insertWidget(e,new w.Collapser({widget:l})):this.layout.addWidget(new w.Collapser({widget:l}))}}_onActiveNotebookPanelChanged(){this._prevActiveNotebookModel&&!this._prevActiveNotebookModel.isDisposed&&this._prevActiveNotebookModel.metadataChanged.disconnect(this._onActiveNotebookPanelMetadataChanged,this);const e=this.activeNotebookPanel&&this.activeNotebookPanel.content?this.activeNotebookPanel.content.model:null;this._prevActiveNotebookModel=e,e&&e.metadataChanged.connect(this._onActiveNotebookPanelMetadataChanged,this);for(const e of this._toolChildren())R.MessageLoop.sendMessage(e,W.ActiveNotebookPanelMessage)}_onActiveCellChanged(){this._prevActiveCell&&!this._prevActiveCell.isDisposed&&this._prevActiveCell.metadataChanged.disconnect(this._onActiveCellMetadataChanged,this);const e=this.activeCell?this.activeCell.model:null;this._prevActiveCell=e,e&&e.metadataChanged.connect(this._onActiveCellMetadataChanged,this);for(const e of this._toolChildren())R.MessageLoop.sendMessage(e,W.ActiveCellMessage)}_onSelectionChanged(){for(const e of this._toolChildren())R.MessageLoop.sendMessage(e,W.SelectionMessage)}_onActiveNotebookPanelMetadataChanged(e,t){const n=new O.ObservableJSON.ChangeMessage("activenotebookpanel-metadata-changed",{oldValue:void 0,newValue:void 0,...t});for(const e of this._toolChildren())R.MessageLoop.sendMessage(e,n)}_onActiveCellMetadataChanged(e,t){const n=new O.ObservableJSON.ChangeMessage("activecell-metadata-changed",{newValue:void 0,oldValue:void 0,...t});for(const e of this._toolChildren())R.MessageLoop.sendMessage(e,n)}*_toolChildren(){for(let e of this._tools)yield*e.panel.children()}}!function(e){e.ActiveNotebookPanelMessage=new R.ConflatableMessage("activenotebookpanel-changed"),e.ActiveCellMessage=new R.ConflatableMessage("activecell-changed"),e.SelectionMessage=new R.ConflatableMessage("selection-changed");class t extends B.Widget{dispose(){super.dispose(),this.notebookTools&&(this.notebookTools=null)}processMessage(e){switch(super.processMessage(e),e.type){case"activenotebookpanel-changed":this.onActiveNotebookPanelChanged(e);break;case"activecell-changed":this.onActiveCellChanged(e);break;case"selection-changed":this.onSelectionChanged(e);break;case"activecell-metadata-changed":this.onActiveCellMetadataChanged(e);break;case"activenotebookpanel-metadata-changed":this.onActiveNotebookPanelMetadataChanged(e)}}onActiveNotebookPanelChanged(e){}onActiveCellChanged(e){}onSelectionChanged(e){}onActiveCellMetadataChanged(e){}onActiveNotebookPanelMetadataChanged(e){}}e.Tool=t,e.MetadataEditorTool=class extends t{constructor(e){super();const{editorFactory:t}=e;this.addClass("jp-MetadataEditorTool");const n=this.layout=new B.PanelLayout;this._editorFactory=t,this._editorLabel=e.label||"Edit Metadata",this.createEditor();const o=new B.Widget({node:document.createElement("label")});o.node.textContent=e.label||"Edit Metadata",n.addWidget(o),n.addWidget(this.editor)}get editor(){return this._editor}onActiveNotebookPanelChanged(e){this.editor.dispose(),this.notebookTools.activeNotebookPanel&&this.createEditor()}createEditor(){this._editor=new H.JSONEditor({editorFactory:this._editorFactory}),this.editor.title.label=this._editorLabel,this.layout.addWidget(this.editor)}}}(W||(W={})),function(e){e.itemCmp=function(e,t){return e.rank-t.rank}}(L||(L={}));var V=n(42782),j=n(63072),U=n(18395),q=n(99615),K=n(14421),z=n(24475);const $="jp-mod-dropTarget",J="jp-mod-dropSource";var Y=n(97934);class G extends w.WindowedListModel{constructor(e,t){super(t),this.cells=e,this.estimateWidgetSize=e=>{var t;const n=this.cells[e].model,o=this.cellsEstimatedHeight.get(n.id);if("number"==typeof o)return o;const s=n.sharedModel.getSource().split("\n").length;let l=0;if(n instanceof i.CodeCellModel)for(let e=0;e<n.outputs.length;e++)l=(null!==(t=n.outputs.get(e).data["text/plain"])&&void 0!==t?t:"").split("\n").length;return G.DEFAULT_EDITOR_LINE_HEIGHT*(s+l)+G.DEFAULT_CELL_MARGIN},this.widgetRenderer=e=>this.cells[e],this.scrollDownThreshold=G.DEFAULT_CELL_MARGIN/2+G.DEFAULT_EDITOR_LINE_HEIGHT,this.scrollUpThreshold=G.DEFAULT_CELL_MARGIN/2,this.cellsEstimatedHeight=new Map,this._emitEstimatedHeightChanged=new Y.Debouncer((()=>{this._stateChanged.emit({name:"estimatedWidgetSize",newValue:null,oldValue:null})})),this._estimatedWidgetSize=G.DEFAULT_CELL_SIZE}setEstimatedWidgetSize(e,t){null===t?this.cellsEstimatedHeight.has(e)&&this.cellsEstimatedHeight.delete(e):(this.cellsEstimatedHeight.set(e,t),this._emitEstimatedHeightChanged.invoke().catch((e=>{console.error("Fail to trigger an update following a estimated height update.",e)})))}}G.DEFAULT_CELL_SIZE=39,G.DEFAULT_EDITOR_LINE_HEIGHT=17,G.DEFAULT_CELL_MARGIN=22;class Q extends w.WindowedLayout{constructor(){super(...arguments),this._header=null,this._footer=null,this._willBeRemoved=null,this._topHiddenCodeCells=-1}get header(){return this._header}set header(e){var t;this._header&&this._header.isAttached&&B.Widget.detach(this._header),this._header=e,this._header&&(null===(t=this.parent)||void 0===t?void 0:t.isAttached)&&B.Widget.attach(this._header,this.parent.node)}get footer(){return this._footer}set footer(e){var t;this._footer&&this._footer.isAttached&&B.Widget.detach(this._footer),this._footer=e,this._footer&&(null===(t=this.parent)||void 0===t?void 0:t.isAttached)&&B.Widget.attach(this._footer,this.parent.outerNode)}get activeCell(){return this._activeCell}set activeCell(e){this._activeCell=e}dispose(){var e,t;this.isDisposed||(null===(e=this._header)||void 0===e||e.dispose(),null===(t=this._footer)||void 0===t||t.dispose(),super.dispose())}removeWidget(e){const t=this.widgets.indexOf(e);t>=0?this.removeWidgetAt(t):e===this._willBeRemoved&&this.parent&&this.detachWidget(t,e)}attachWidget(e,t){const n=t.isPlaceholder(),o=this._isSoftHidden(t);if(this.parent.isAttached&&!o&&R.MessageLoop.sendMessage(t,B.Widget.Msg.BeforeAttach),o&&this._toggleSoftVisibility(t,!0),!n&&t instanceof i.CodeCell&&t.node.parentElement)t.node.style.display="",this._topHiddenCodeCells=-1;else if(!o){const e=this._findNearestChildBinarySearch(this.parent.viewportNode.childElementCount-1,0,parseInt(t.dataset.windowedListIndex,10)+1);let n=this.parent.viewportNode.children[e];this.parent.viewportNode.insertBefore(t.node,n),this.parent.isAttached&&R.MessageLoop.sendMessage(t,B.Widget.Msg.AfterAttach)}t.inViewport=!0}detachWidget(e,t){t.inViewport=!1,t!==this.activeCell||t===this._willBeRemoved?(t instanceof i.CodeCell&&!t.node.classList.contains(J)&&t!==this._willBeRemoved?(t.node.style.display="none",this._topHiddenCodeCells=-1):(this.parent.isAttached&&R.MessageLoop.sendMessage(t,B.Widget.Msg.BeforeDetach),this.parent.viewportNode.removeChild(t.node),t.node.classList.remove($)),this.parent.isAttached&&R.MessageLoop.sendMessage(t,B.Widget.Msg.AfterDetach)):this._toggleSoftVisibility(t,!1)}moveWidget(e,t,n){if(this._topHiddenCodeCells<0){this._topHiddenCodeCells=0;for(let e=0;e<this.parent.viewportNode.children.length&&"none"==this.parent.viewportNode.children[e].style.display;e++)this._topHiddenCodeCells++}const o=this.parent.viewportNode.children[t+this._topHiddenCodeCells];e<t?o.insertAdjacentElement("afterend",n.node):o.insertAdjacentElement("beforebegin",n.node)}onAfterAttach(e){super.onAfterAttach(e),this._header&&!this._header.isAttached&&B.Widget.attach(this._header,this.parent.node,this.parent.node.firstElementChild),this._footer&&!this._footer.isAttached&&B.Widget.attach(this._footer,this.parent.outerNode)}onBeforeDetach(e){var t,n;(null===(t=this._header)||void 0===t?void 0:t.isAttached)&&B.Widget.detach(this._header),(null===(n=this._footer)||void 0===n?void 0:n.isAttached)&&B.Widget.detach(this._footer),super.onBeforeDetach(e)}onChildRemoved(e){this._willBeRemoved=e.child,super.onChildRemoved(e),this._willBeRemoved=null}_toggleSoftVisibility(e,t){t?(e.node.style.opacity="",e.node.style.height="",e.node.style.padding=""):(e.node.style.opacity="0",e.node.style.height="0",e.node.style.padding="0")}_isSoftHidden(e){return"0"===e.node.style.opacity}_findNearestChildBinarySearch(e,t,n){for(;t<=e;){const o=t+Math.floor((e-t)/2),i=parseInt(this.parent.viewportNode.children[o].dataset.windowedListIndex,10);if(i===n)return o;i<n?t=o+1:i>n&&(e=o-1)}return t>0?t:0}}class X extends B.Widget{constructor(e){super({node:document.createElement("button")}),this.notebook=e;const t=e.translator.load("jupyterlab");this.addClass("jp-Notebook-footer"),this.node.setAttribute("tabindex","-1"),this.node.innerText=t.__("Click to add a cell.")}handleEvent(e){switch(e.type){case"click":this.onClick();break;case"keydown":if("ArrowUp"===e.key){this.onArrowUp();break}}}onClick(){this.notebook.widgets.length>0&&(this.notebook.activeCellIndex=this.notebook.widgets.length-1),m.insertBelow(this.notebook),m.focusActiveCell(this.notebook)}onArrowUp(){}onAfterAttach(e){super.onAfterAttach(e),this.node.addEventListener("click",this),this.node.addEventListener("keydown",this)}onBeforeDetach(e){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),super.onBeforeDetach(e)}}const Z="jp-Notebook-cell",ee="jp-mod-editMode",te="jp-mod-commandMode",ne="jp-mod-active",oe="jp-mod-selected",ie="jp-mod-multiSelected",se="jp-dragImage",le="jp-dragImage-singlePrompt",ae="jp-dragImage-content",de="jp-dragImage-prompt",re="jp-dragImage-multipleBack",ce="application/vnd.jupyter.cells",he="jp-mod-sideBySide";void 0===window.requestIdleCallback&&(window.requestIdleCallback=function(e){let t=Date.now();return setTimeout((function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})}),1)},window.cancelIdleCallback=function(e){clearTimeout(e)});class ue extends w.WindowedList{constructor(e){var t,n,o,i,s,a;const d=new Array,c="full"===(null!==(n=null===(t=e.notebookConfig)||void 0===t?void 0:t.windowingMode)&&void 0!==n?n:ue.defaultNotebookConfig.windowingMode);super({model:new G(d,{overscanCount:null!==(i=null===(o=e.notebookConfig)||void 0===o?void 0:o.overscanCount)&&void 0!==i?i:ue.defaultNotebookConfig.overscanCount,windowingActive:c}),layout:new Q,renderer:null!==(s=e.renderer)&&void 0!==s?s:w.WindowedList.defaultRenderer,scrollbar:!1}),this._cellCollapsed=new r.Signal(this),this._cellInViewportChanged=new r.Signal(this),this._renderingLayoutChanged=new r.Signal(this),this.addClass("jp-Notebook"),this.cellsArray=d,this._idleCallBack=null,this._editorConfig=ue.defaultEditorConfig,this._notebookConfig=ue.defaultNotebookConfig,this._mimetype=H.IEditorMimeTypeService.defaultMimeType,this._notebookModel=null,this._modelChanged=new r.Signal(this),this._modelContentChanged=new r.Signal(this),this.node.dataset.jpKernelUser="true",this.node.dataset.jpUndoer="true",this.node.dataset.jpCodeRunner="true",this.rendermime=e.rendermime,this.translator=e.translator||l.nullTranslator,this.contentFactory=e.contentFactory,this.editorConfig=e.editorConfig||ue.defaultEditorConfig,this.notebookConfig=e.notebookConfig||ue.defaultNotebookConfig,this._updateNotebookConfig(),this._mimetypeService=e.mimeTypeService,this.renderingLayout=null===(a=e.notebookConfig)||void 0===a?void 0:a.renderingLayout,this.kernelHistory=e.kernelHistory}get cellCollapsed(){return this._cellCollapsed}get cellInViewportChanged(){return this._cellInViewportChanged}get modelChanged(){return this._modelChanged}get modelContentChanged(){return this._modelContentChanged}get renderingLayoutChanged(){return this._renderingLayoutChanged}get model(){return this._notebookModel}set model(e){var t;if(e=e||null,this._notebookModel===e)return;const n=this._notebookModel;this._notebookModel=e,this._onModelChanged(n,e),this.onModelChanged(n,e),this._modelChanged.emit(void 0),this.viewModel.itemsList=null!==(t=null==e?void 0:e.cells)&&void 0!==t?t:null}get codeMimetype(){return this._mimetype}get widgets(){return this.cellsArray}get editorConfig(){return this._editorConfig}set editorConfig(e){this._editorConfig=e,this._updateEditorConfig()}get notebookConfig(){return this._notebookConfig}set notebookConfig(e){this._notebookConfig=e,this._updateNotebookConfig()}get renderingLayout(){return this._renderingLayout}set renderingLayout(e){var t;this._renderingLayout=e,"side-by-side"===this._renderingLayout?this.node.classList.add(he):this.node.classList.remove(he),this._renderingLayoutChanged.emit(null!==(t=this._renderingLayout)&&void 0!==t?t:"default")}dispose(){var e;this.isDisposed||(this._notebookModel=null,null===(e=this.layout.header)||void 0===e||e.dispose(),super.dispose())}moveCell(e,t,n=1){if(!this.model)return;const o=Math.min(this.model.cells.length-1,Math.max(0,t));if(o===e)return;const i=new Array(n);for(let t=0;t<n;t++){i[t]={};const n=this.widgets[e+t];if("markdown"===n.model.type)for(const e of["rendered","headingCollapsed"])i[t][e]=n[e]}this.model.sharedModel.moveCells(e,o,n);for(let e=0;e<n;e++){const n=this.widgets[t+e],o=i[e];for(const e in o)n[e]=o[e]}}renderCellOutputs(e){const t=this.viewModel.widgetRenderer(e);t instanceof i.CodeCell&&t.isPlaceholder()&&(t.dataset.windowedListIndex=`${e}`,this.layout.insertWidget(e,t),"full"===this.notebookConfig.windowingMode&&requestAnimationFrame((()=>{this.layout.removeWidget(t)})))}addHeader(){const e=this.translator.load("jupyterlab"),t=new B.Widget;t.node.textContent=e.__("The notebook is empty. Click the + button on the toolbar to add a new cell."),this.layout.header=t}removeHeader(){var e;null===(e=this.layout.header)||void 0===e||e.dispose(),this.layout.header=null}onModelChanged(e,t){}onModelContentChanged(e,t){this._modelContentChanged.emit(void 0)}onMetadataChanged(e,t){"language_info"===t.key&&this._updateMimetype()}onCellInserted(e,t){}onCellRemoved(e,t){}onUpdateRequest(e){"defer"===this.notebookConfig.windowingMode?this._runOnIdleTime():super.onUpdateRequest(e)}_onModelChanged(e,t){var n;if(e)for(e.contentChanged.disconnect(this.onModelContentChanged,this),e.metadataChanged.disconnect(this.onMetadataChanged,this),e.cells.changed.disconnect(this._onCellsChanged,this);this.cellsArray.length;)this._removeCell(0);if(!t)return void(this._mimetype=H.IEditorMimeTypeService.defaultMimeType);this._updateMimetype();const o=t.cells;null!==(n=t.collaborative)&&void 0!==n&&n||o.length||t.sharedModel.insertCell(0,{cell_type:this.notebookConfig.defaultCell,metadata:"code"===this.notebookConfig.defaultCell?{trusted:!0}:{}});let i=-1;for(const e of o)this._insertCell(++i,e);t.cells.changed.connect(this._onCellsChanged,this),t.metadataChanged.connect(this.onMetadataChanged,this),t.contentChanged.connect(this.onModelContentChanged,this)}_onCellsChanged(e,t){switch(this.removeHeader(),t.type){case"add":{let e=0;e=t.newIndex;for(const n of t.newValues)this._insertCell(e++,n);this._updateDataWindowedListIndex(t.newIndex,this.model.cells.length,t.newValues.length);break}case"remove":for(let e=t.oldValues.length;e>0;e--)this._removeCell(t.oldIndex);if(this._updateDataWindowedListIndex(t.oldIndex,this.model.cells.length+t.oldValues.length,-1*t.oldValues.length),!e.length){const e=this.model;requestAnimationFrame((()=>{!e||e.isDisposed||e.sharedModel.cells.length||e.sharedModel.insertCell(0,{cell_type:this.notebookConfig.defaultCell,metadata:"code"===this.notebookConfig.defaultCell?{trusted:!0}:{}})}))}break;default:return}this.model.sharedModel.cells.length||this.addHeader(),this.update()}_insertCell(e,t){let n;switch(t.type){case"code":n=this._createCodeCell(t),n.model.mimeType=this._mimetype;break;case"markdown":n=this._createMarkdownCell(t),""===t.sharedModel.getSource()&&(n.rendered=!1);break;default:n=this._createRawCell(t)}n.inViewportChanged.connect(this._onCellInViewportChanged,this),n.addClass(Z),a.ArrayExt.insert(this.cellsArray,e,n),this.onCellInserted(e,n),this._scheduleCellRenderOnIdle()}_createCodeCell(e){const t=this.rendermime,n={contentFactory:this.contentFactory,editorConfig:this.editorConfig.code,inputHistoryScope:this.notebookConfig.inputHistoryScope,maxNumberOutputs:this.notebookConfig.maxNumberOutputs,model:e,placeholder:"none"!==this._notebookConfig.windowingMode,rendermime:t,translator:this.translator},o=this.contentFactory.createCodeCell(n);return o.syncCollapse=!0,o.syncEditable=!0,o.syncScrolled=!0,o.outputArea.inputRequested.connect(((e,t)=>{this._onInputRequested(o).catch((e=>{console.error("Failed to scroll to cell requesting input.",e)})),t.disposed.connect((()=>{o.node.focus()}))})),o}_createMarkdownCell(e){const t=this.rendermime,n={contentFactory:this.contentFactory,editorConfig:this.editorConfig.markdown,model:e,placeholder:"none"!==this._notebookConfig.windowingMode,rendermime:t,showEditorForReadOnlyMarkdown:this._notebookConfig.showEditorForReadOnlyMarkdown},o=this.contentFactory.createMarkdownCell(n);return o.syncCollapse=!0,o.syncEditable=!0,o.headingCollapsedChanged.connect(this._onCellCollapsed,this),o}_createRawCell(e){const t=this.contentFactory,n={editorConfig:this.editorConfig.raw,model:e,contentFactory:t,placeholder:"none"!==this._notebookConfig.windowingMode},o=this.contentFactory.createRawCell(n);return o.syncCollapse=!0,o.syncEditable=!0,o}_removeCell(e){const t=this.cellsArray[e];t.parent=null,a.ArrayExt.removeAt(this.cellsArray,e),this.onCellRemoved(e,t),t.dispose()}_updateMimetype(){var e;const t=null===(e=this._notebookModel)||void 0===e?void 0:e.getMetadata("language_info");if(t){this._mimetype=this._mimetypeService.getMimeTypeByLanguage(t);for(const e of this.widgets)"code"===e.model.type&&(e.model.mimeType=this._mimetype)}}_onCellCollapsed(e,t){m.setHeadingCollapse(e,t,this),this._cellCollapsed.emit(e)}_onCellInViewportChanged(e){this._cellInViewportChanged.emit(e)}async _onInputRequested(e){if(!e.inViewport){const t=this.widgets.findIndex((t=>t===e));if(t>=0){await this.scrollToItem(t);const n=e.node.querySelector(".jp-Stdin");n&&(U.ElementExt.scrollIntoViewIfNeeded(this.node,n),n.focus())}}}_scheduleCellRenderOnIdle(){"none"===this.notebookConfig.windowingMode||this.isDisposed||this._idleCallBack||(this._idleCallBack=requestIdleCallback((e=>{this._idleCallBack=null,this._runOnIdleTime(e.didTimeout?50:e.timeRemaining())}),{timeout:3e3}))}_updateDataWindowedListIndex(e,t,n){for(let o=0;o<this.viewportNode.childElementCount;o++){const i=this.viewportNode.children[o],s=parseInt(i.dataset.windowedListIndex,10);s>=e&&s<t&&(i.dataset.windowedListIndex=`${s+n}`)}}_updateEditorConfig(){for(let e=0;e<this.widgets.length;e++){const t=this.widgets[e];let n={};switch(t.model.type){case"code":n=this._editorConfig.code;break;case"markdown":n=this._editorConfig.markdown;break;default:n=this._editorConfig.raw}t.updateEditorConfig({...n})}}async _runOnIdleTime(e=50){const t=Date.now();let n=0;for(;Date.now()-t<e&&n<this.cellsArray.length;){const e=this.cellsArray[n];e.isPlaceholder()&&["defer","full"].includes(this.notebookConfig.windowingMode)&&(await this._updateForDeferMode(e,n),"full"===this.notebookConfig.windowingMode&&requestAnimationFrame((()=>{this.viewModel.setEstimatedWidgetSize(e.model.id,e.node.getBoundingClientRect().height),this.layout.removeWidget(e)}))),n++}n<this.cellsArray.length?"defer"===this.notebookConfig.windowingMode&&this.viewportNode.clientHeight<this.node.clientHeight?await this._runOnIdleTime():this._scheduleCellRenderOnIdle():this._idleCallBack&&(window.cancelIdleCallback(this._idleCallBack),this._idleCallBack=null)}async _updateForDeferMode(e,t){e.dataset.windowedListIndex=`${t}`,this.layout.insertWidget(t,e),await e.ready}_updateNotebookConfig(){this.toggleClass("jp-mod-scrollPastEnd",this._notebookConfig.scrollPastEnd),this.toggleClass("jp-mod-showHiddenCellsButton",this._notebookConfig.showHiddenCellsButton);const e=this._notebookConfig.showEditorForReadOnlyMarkdown;if(void 0!==e)for(const t of this.cellsArray)"markdown"===t.model.type&&(t.showEditorForReadOnly=e);this.viewModel.windowingActive="full"===this._notebookConfig.windowingMode}}!function(e){e.defaultEditorConfig={code:{lineNumbers:!1,lineWrap:!1,matchBrackets:!0,tabFocusable:!1},markdown:{lineNumbers:!1,lineWrap:!0,matchBrackets:!1,tabFocusable:!1},raw:{lineNumbers:!1,lineWrap:!0,matchBrackets:!1,tabFocusable:!1}},e.defaultNotebookConfig={enableKernelInitNotification:!1,showHiddenCellsButton:!0,scrollPastEnd:!0,defaultCell:"code",recordTiming:!1,inputHistoryScope:"global",maxNumberOutputs:50,showEditorForReadOnlyMarkdown:!0,disableDocumentWideUndoRedo:!0,renderingLayout:"default",sideBySideLeftMarginOverride:"10px",sideBySideRightMarginOverride:"10px",sideBySideOutputRatio:1,overscanCount:1,windowingMode:"full",accessKernelHistory:!1};class t extends i.Cell.ContentFactory{createCodeCell(e){return new i.CodeCell(e).initializeState()}createMarkdownCell(e){return new i.MarkdownCell(e).initializeState()}createRawCell(e){return new i.RawCell(e).initializeState()}}e.ContentFactory=t}(ue||(ue={}));class ge extends ue{constructor(e){super({renderer:{createOuter:()=>document.createElement("div"),createViewport(){const e=document.createElement("div");return e.setAttribute("role","feed"),e.setAttribute("aria-label","Cells"),e},createScrollbar:()=>document.createElement("ol"),createScrollbarItem(e,t,n){const o=document.createElement("li");return o.appendChild(document.createTextNode(`${t+1}`)),e.activeCellIndex===t&&o.classList.add("jp-mod-active"),e.selectedCells.some((e=>n===e.model))&&o.classList.add("jp-mod-selected"),o}},...e}),this._activeCellIndex=-1,this._activeCell=null,this._mode="command",this._drag=null,this._dragData=null,this._mouseMode=null,this._activeCellChanged=new r.Signal(this),this._stateChanged=new r.Signal(this),this._selectionChanged=new r.Signal(this),this._checkCacheOnNextResize=!1,this._lastClipboardInteraction=null,this._selectedCells=[],this.outerNode.setAttribute("data-lm-dragscroll","true"),this.activeCellChanged.connect(this._updateSelectedCells,this),this.jumped.connect(((e,t)=>this.activeCellIndex=t)),this.selectionChanged.connect(this._updateSelectedCells,this),this.addFooter()}get selectedCells(){return this._selectedCells}addFooter(){const e=new X(this);this.layout.footer=e}_onCellsChanged(e,t){var n,o;const i=null===(n=this.activeCell)||void 0===n?void 0:n.model.id;if(super._onCellsChanged(e,t),i){const e=null===(o=this.model)||void 0===o?void 0:o.sharedModel.cells.findIndex((e=>e.getId()===i));null!=e&&(this.activeCellIndex=e)}}get activeCellChanged(){return this._activeCellChanged}get stateChanged(){return this._stateChanged}get selectionChanged(){return this._selectionChanged}get mode(){return this._mode}set mode(e){this.setMode(e)}setMode(e,t={}){var n;const o=null===(n=t.focus)||void 0===n||n,s=this.activeCell;if(s||(e="command"),e===this._mode)return void(o&&this._ensureFocus());this.update();const l=this._mode;if(this._mode=e,"edit"===e){for(const e of this.widgets)this.deselect(e);s instanceof i.MarkdownCell&&(s.rendered=!1),s.inputHidden=!1}else o&&m.focusActiveCell(this,{waitUntilReady:!1,preventScroll:!0});this._stateChanged.emit({name:"mode",oldValue:l,newValue:e}),o&&this._ensureFocus()}get activeCellIndex(){return this.model&&this.widgets.length?this._activeCellIndex:-1}set activeCellIndex(e){var t;const n=this._activeCellIndex;this.model&&this.widgets.length?(e=Math.max(e,0),e=Math.min(e,this.widgets.length-1)):e=-1,this._activeCellIndex=e;const o=null!==(t=this.widgets[e])&&void 0!==t?t:null;this.layout.activeCell=o;const s=o!==this._activeCell;s&&(this.update(),this._activeCell=o),(s||e!=n)&&this._activeCellChanged.emit(o),"edit"===this.mode&&o instanceof i.MarkdownCell&&(o.rendered=!1),this._ensureFocus(),e!==n&&(this._trimSelections(),this._stateChanged.emit({name:"activeCellIndex",oldValue:n,newValue:e}))}get activeCell(){return this._activeCell}get lastClipboardInteraction(){return this._lastClipboardInteraction}set lastClipboardInteraction(e){this._lastClipboardInteraction=e}dispose(){this.isDisposed||(this._activeCell=null,super.dispose())}moveCell(e,t,n=1){const o=e<=this.activeCellIndex&&this.activeCellIndex<e+n?this.activeCellIndex+t-e-(e>t?0:n-1):-1,i=this.widgets.slice(e,e+n).map((e=>this.isSelected(e)));super.moveCell(e,t,n),o>=0&&(this.activeCellIndex=o),e>t?i.forEach(((e,n)=>{e&&this.select(this.widgets[t+n])})):i.forEach(((e,o)=>{e&&this.select(this.widgets[t-n+1+o])}))}select(e){Ce.selectedProperty.get(e)||(Ce.selectedProperty.set(e,!0),this._selectionChanged.emit(void 0),this.update())}deselect(e){Ce.selectedProperty.get(e)&&(Ce.selectedProperty.set(e,!1),this._selectionChanged.emit(void 0),this.update())}isSelected(e){return Ce.selectedProperty.get(e)}isSelectedOrActive(e){return e===this._activeCell||Ce.selectedProperty.get(e)}deselectAll(){let e=!1;for(const t of this.widgets)Ce.selectedProperty.get(t)&&(e=!0),Ce.selectedProperty.set(t,!1);e&&this._selectionChanged.emit(void 0),this.activeCellIndex=this.activeCellIndex,this.update()}extendContiguousSelectionTo(e){let t,{head:n,anchor:o}=this.getContiguousSelection();if(null===o||null===n){if(e===this.activeCellIndex)return;n=this.activeCellIndex,o=this.activeCellIndex}if(this.activeCellIndex=e,(e=this.activeCellIndex)===o)return void this.deselectAll();let i=!1;if(n<e)for(n<o&&(Ce.selectedProperty.set(this.widgets[n],!1),i=!0),t=n+1;t<e;t++)t!==o&&(Ce.selectedProperty.set(this.widgets[t],!Ce.selectedProperty.get(this.widgets[t])),i=!0);else if(e<n)for(o<n&&(Ce.selectedProperty.set(this.widgets[n],!1),i=!0),t=e+1;t<n;t++)t!==o&&(Ce.selectedProperty.set(this.widgets[t],!Ce.selectedProperty.get(this.widgets[t])),i=!0);Ce.selectedProperty.get(this.widgets[o])||(i=!0),Ce.selectedProperty.set(this.widgets[o],!0),Ce.selectedProperty.get(this.widgets[e])||(i=!0),Ce.selectedProperty.set(this.widgets[e],!0),i&&this._selectionChanged.emit(void 0)}getContiguousSelection(){const e=this.widgets,t=a.ArrayExt.findFirstIndex(e,(e=>this.isSelected(e)));if(-1===t)return{head:null,anchor:null};const n=a.ArrayExt.findLastIndex(e,(e=>this.isSelected(e)),-1,t);for(let o=t;o<=n;o++)if(!this.isSelected(e[o]))throw new Error("Selection not contiguous");const o=this.activeCellIndex;if(t!==o&&n!==o)throw new Error("Active cell not at endpoint of selection");return t===o?{head:t,anchor:n}:{head:n,anchor:t}}async scrollToCell(e,t="auto"){try{await this.scrollToItem(this.widgets.findIndex((t=>t===e)),t)}catch(e){}this.deselectAll(),this.select(e),e.activate()}_parseFragment(e){const t=e.slice(1);if(!t)return;const n=t.split("=");return 1===n.length?{kind:"heading",value:t}:{kind:n[0],value:n.slice(1).join("=")}}async setFragment(e){const t=this._parseFragment(e);if(!t)return;let n;switch(t.kind){case"heading":n=await this._findHeading(t.value);break;case"cell-id":n=this._findCellById(t.value);break;default:console.warn(`Unknown target type for URI fragment ${e}, interpreting as a heading`),n=await this._findHeading(t.kind+"="+t.value)}if(null==n)return;let{cell:o,element:i}=n;o.inViewport||await this.scrollToCell(o,"center"),null==i&&(i=o.node);const s=this.node.getBoundingClientRect(),l=i.getBoundingClientRect();(l.top>s.bottom||l.bottom<s.top)&&i.scrollIntoView({block:"center"})}handleEvent(e){if(this.model)switch(e.type){case"contextmenu":e.eventPhase===Event.CAPTURING_PHASE&&this._evtContextMenuCapture(e);break;case"mousedown":e.eventPhase===Event.CAPTURING_PHASE?this._evtMouseDownCapture(e):e.defaultPrevented||this._evtMouseDown(e);break;case"mouseup":e.currentTarget===document&&this._evtDocumentMouseup(e);break;case"mousemove":e.currentTarget===document&&this._evtDocumentMousemove(e);break;case"keydown":this._ensureFocus(!0);break;case"dblclick":this._evtDblClick(e);break;case"focusin":this._evtFocusIn(e);break;case"focusout":this._evtFocusOut(e);break;case"lm-dragenter":this._evtDragEnter(e);break;case"lm-dragleave":this._evtDragLeave(e);break;case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e);break;default:super.handleEvent(e)}}onAfterAttach(e){super.onAfterAttach(e);const t=this.node;t.addEventListener("contextmenu",this,!0),t.addEventListener("mousedown",this,!0),t.addEventListener("mousedown",this),t.addEventListener("keydown",this),t.addEventListener("dblclick",this),t.addEventListener("focusin",this),t.addEventListener("focusout",this),t.addEventListener("lm-dragenter",this,!0),t.addEventListener("lm-dragleave",this,!0),t.addEventListener("lm-dragover",this,!0),t.addEventListener("lm-drop",this,!0)}onBeforeDetach(e){const t=this.node;t.removeEventListener("contextmenu",this,!0),t.removeEventListener("mousedown",this,!0),t.removeEventListener("mousedown",this),t.removeEventListener("keydown",this),t.removeEventListener("dblclick",this),t.removeEventListener("focusin",this),t.removeEventListener("focusout",this),t.removeEventListener("lm-dragenter",this,!0),t.removeEventListener("lm-dragleave",this,!0),t.removeEventListener("lm-dragover",this,!0),t.removeEventListener("lm-drop",this,!0),document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),super.onBeforeAttach(e)}onAfterShow(e){super.onAfterShow(e),this._checkCacheOnNextResize=!0}onResize(e){var t;if(!this._checkCacheOnNextResize)return super.onResize(e);super.onResize(e),this._checkCacheOnNextResize=!1;const n=this._cellLayoutStateCache,o=parseInt(this.node.style.width,10);if(!n||o!==n.width){this._cellLayoutStateCache={width:o};for(const e of this.widgets)e instanceof i.Cell&&e.inViewport&&(null===(t=e.editorWidget)||void 0===t||t.update())}}onBeforeHide(e){super.onBeforeHide(e);const t=parseInt(this.node.style.width,10);this._cellLayoutStateCache={width:t}}onActivateRequest(e){super.onActivateRequest(e),this._ensureFocus(!0)}onUpdateRequest(e){super.onUpdateRequest(e);const t=this.activeCell;"edit"===this.mode?(this.addClass(ee),this.removeClass(te)):(this.addClass(te),this.removeClass(ee));let n=0;for(const e of this.widgets)e.node.tabIndex=-1,e.removeClass(ne),e.removeClass(ie),this.isSelectedOrActive(e)?(e.addClass(oe),n++):e.removeClass(oe);t&&(t.addClass(ne),t.addClass(oe),t.node.tabIndex=0,n>1&&t.addClass(ie))}onCellInserted(e,t){t.ready.then((()=>{t.isDisposed||t.editor.edgeRequested.connect(this._onEdgeRequest,this)})),t.scrollRequested.connect(((e,n)=>{if(t!==this.activeCell)return;if(!n.defaultPrevented)return;const o=this.outerNode;if(t.inViewport)return n.scrollWithinCell({scroller:o});this.scrollToItem(this.activeCellIndex).then((()=>{t.ready.then((()=>{n.scrollWithinCell({scroller:o})}))})).catch((e=>{}))})),this.activeCellIndex=e<=this.activeCellIndex?this.activeCellIndex+1:this.activeCellIndex}onCellRemoved(e,t){this.activeCellIndex=e<=this.activeCellIndex?this.activeCellIndex-1:this.activeCellIndex,this.isSelected(t)&&this._selectionChanged.emit(void 0)}onModelChanged(e,t){super.onModelChanged(e,t),this.activeCellIndex=0}_onEdgeRequest(e,t){const n=this.activeCellIndex;if("top"===t){if(this.activeCellIndex--,this.activeCellIndex<n){const e=this.activeCell.editor;if(e){const t=e.lineCount-1;e.setCursorPosition({line:t,column:0})}}}else if("bottom"===t&&(this.activeCellIndex++,this.activeCellIndex>n)){const e=this.activeCell.editor;e&&e.setCursorPosition({line:0,column:0})}this.mode="edit"}_ensureFocus(e=!1){var t,n;const o=this.layout.footer;if(o&&document.activeElement===o.node)return;const i=this.activeCell;"edit"===this.mode&&i&&!0!==(null===(t=i.editor)||void 0===t?void 0:t.hasFocus())&&(i.inViewport?null===(n=i.editor)||void 0===n||n.focus():this.scrollToItem(this.activeCellIndex).then((()=>{i.ready.then((()=>{var e;null===(e=i.editor)||void 0===e||e.focus()}))})).catch((e=>{}))),e&&i&&!i.node.contains(document.activeElement)&&m.focusActiveCell(this,{preventScroll:!0})}_findCell(e){let t=e;for(;t&&t!==this.node;){if(t.classList.contains(Z)){const e=a.ArrayExt.findFirstIndex(this.widgets,(e=>e.node===t));if(-1!==e)return e;break}t=t.parentElement}return-1}_findEventTargetAndCell(e){let t=e.target,n=this._findCell(t);return-1===n&&(t=document.elementFromPoint(e.clientX,e.clientY),n=this._findCell(t)),[t,n]}async _findHeading(e){for(let t=0;t<this.widgets.length;t++){const n=this.widgets[t];if("raw"!==n.model.type&&("markdown"!==n.model.type||n.rendered))for(const t of n.headings){let o="";switch(t.type){case i.Cell.HeadingType.HTML:o=t.id;break;case i.Cell.HeadingType.Markdown:{const e=t;o=await j.TableOfContentsUtils.Markdown.getHeadingId(this.rendermime.markdownParser,e.raw,e.level,this.rendermime.sanitizer)}}if(o===e)return{cell:n,element:this.node.querySelector(`h${t.level}[id="${CSS.escape(o)}"]`)}}}return null}_findCellById(e){for(let t=0;t<this.widgets.length;t++){const n=this.widgets[t];if(n.model.id===e)return{cell:n}}return null}_evtContextMenuCapture(e){var t;if(e.shiftKey)return;const[n,o]=this._findEventTargetAndCell(e),i=this.widgets[o];i&&(null===(t=i.editorWidget)||void 0===t?void 0:t.node.contains(n))&&e.preventDefault()}_evtMouseDownCapture(e){var t;const{button:n,shiftKey:o}=e,[i,s]=this._findEventTargetAndCell(e),l=this.widgets[s];2===n&&!o&&l&&(null===(t=l.editorWidget)||void 0===t?void 0:t.node.contains(i))&&(this.mode="command",e.preventDefault())}_evtMouseDown(e){var t,n,o;const{button:i,shiftKey:s}=e;if(0!==i&&2!==i)return;if(s&&2===i)return;const[l,a]=this._findEventTargetAndCell(e),d=this.widgets[a];let r;if(r=d?(null===(t=d.editorWidget)||void 0===t?void 0:t.node.contains(l))?"input":(null===(n=d.promptNode)||void 0===n?void 0:n.contains(l))?"prompt":"cell":"notebook","input"!==r&&(this.mode="command"),"notebook"===r)this.deselectAll();else if("prompt"===r||"cell"===r){const t=""!==(null!==(o=window.getSelection())&&void 0!==o?o:"").toString();if(0!==i||!s||t||["INPUT","OPTION"].includes(l.tagName))0!==i||s?2===i&&(this.isSelectedOrActive(d)||(this.deselectAll(),this.activeCellIndex=a),e.preventDefault()):("prompt"===r&&(this._dragData={pressX:e.clientX,pressY:e.clientY,index:a},this._mouseMode="couldDrag",document.addEventListener("mouseup",this,!0),document.addEventListener("mousemove",this,!0),e.preventDefault()),this.isSelectedOrActive(d)||(this.deselectAll(),this.activeCellIndex=a));else{e.preventDefault();try{this.extendContiguousSelectionTo(a)}catch(e){return console.error(e),void this.deselectAll()}this._mouseMode="select",document.addEventListener("mouseup",this,!0),document.addEventListener("mousemove",this,!0)}}else"input"===r&&(2!==i||this.isSelectedOrActive(d)||(this.deselectAll(),this.activeCellIndex=a));this._ensureFocus(!0)}_evtDocumentMouseup(e){if(e.preventDefault(),e.stopPropagation(),document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),"couldDrag"===this._mouseMode){const[,t]=this._findEventTargetAndCell(e);this.deselectAll(),this.activeCellIndex=t,this.activeCell.node.contains(document.activeElement)||m.focusActiveCell(this)}this._mouseMode=null}_evtDocumentMousemove(e){switch(e.preventDefault(),e.stopPropagation(),this._mouseMode){case"select":{const t=e.target,n=this._findCell(t);-1!==n&&this.extendContiguousSelectionTo(n);break}case"couldDrag":{const t=this._dragData,n=Math.abs(e.clientX-t.pressX),o=Math.abs(e.clientY-t.pressY);(n>=5||o>=5)&&(this._mouseMode=null,this._startDrag(t.index,e.clientX,e.clientY));break}}}_evtDragEnter(e){if(!e.mimeData.hasData(ce))return;e.preventDefault(),e.stopPropagation();const t=e.target,n=this._findCell(t);-1!==n&&this.cellsArray[n].node.classList.add($)}_evtDragLeave(e){if(!e.mimeData.hasData(ce))return;e.preventDefault(),e.stopPropagation();const t=this.node.getElementsByClassName($);t.length&&t[0].classList.remove($)}_evtDragOver(e){if(!e.mimeData.hasData(ce))return;e.preventDefault(),e.stopPropagation(),e.dropAction=e.proposedAction;const t=this.node.getElementsByClassName($);t.length&&t[0].classList.remove($);const n=e.target,o=this._findCell(n);-1!==o&&this.cellsArray[o].node.classList.add($)}_evtDrop(e){if(!e.mimeData.hasData(ce))return;if(e.preventDefault(),e.stopPropagation(),"none"===e.proposedAction)return void(e.dropAction="none");let t=e.target;for(;t&&t.parentElement;){if(t.classList.contains($)){t.classList.remove($);break}t=t.parentElement}const n=this.model,o=e.source;if(o===this){e.dropAction="move";const n=e.mimeData.getData("internal:cells"),s=n[n.length-1];if(s instanceof i.MarkdownCell&&s.headingCollapsed){const e=m.findNextParentHeading(s,o);if(e>0){const t=(0,a.findIndex)(o.widgets,(e=>s.model.id===e.model.id));n.push(...o.widgets.slice(t+1,e))}}let l=a.ArrayExt.firstIndexOf(this.widgets,n[0]),d=this._findCell(t);if(-1!==d&&d>l?d-=1:-1===d&&(d=this.widgets.length-1),d>=l&&d<l+n.length)return;this.moveCell(l,d,n.length)}else{e.dropAction="copy";let o=this._findCell(t);-1===o&&(o=this.widgets.length);const i=o,s=e.mimeData.getData(ce);n.sharedModel.insertCells(o,s),this.deselectAll(),this.activeCellIndex=i,this.extendContiguousSelectionTo(o-1)}m.focusActiveCell(this)}_startDrag(e,t,n){var o;const i=this.model.cells,s=[],l=[];let a=-1;for(const e of this.widgets){const t=i.get(++a);this.isSelectedOrActive(e)&&(e.addClass(J),s.push(t.toJSON()),l.push(e))}const r=this.activeCell;let c,h=null;if("code"===(null==r?void 0:r.model.type)){const e=r.model.executionCount;c=" ",e&&(c=e.toString())}else c="";h=Ce.createDragImage(s.length,c,null!==(o=null==r?void 0:r.model.sharedModel.getSource().split("\n")[0].slice(0,26))&&void 0!==o?o:""),this._drag=new q.Drag({mimeData:new d.MimeData,dragImage:h,supportedActions:"copy-move",proposedAction:"copy",source:this}),this._drag.mimeData.setData(ce,s),this._drag.mimeData.setData("internal:cells",l);const u=l.map((e=>e.model.sharedModel.getSource())).join("\n");this._drag.mimeData.setData("text/plain",u),document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),this._mouseMode=null,this._drag.start(t,n).then((e=>{if(!this.isDisposed){this._drag=null;for(const e of l)e.removeClass(J)}}))}_updateReadWrite(){const e=o.DOMUtils.hasActiveEditableElement(this.node);this.node.classList.toggle("jp-mod-readWrite",e)}_evtFocusIn(e){var t,n;this._updateReadWrite();const o=e.target,i=this._findCell(o);if(-1!==i){const e=this.widgets[i];e.editorWidget&&!e.editorWidget.node.contains(o)&&this.setMode("command",{focus:!1}),this.activeCellIndex=i;const n=null===(t=e.editorWidget)||void 0===t?void 0:t.node;(null==n?void 0:n.contains(o))&&this.setMode("edit",{focus:!1})}else{this.setMode("command",{focus:!1}),e.preventDefault();const t=e.relatedTarget;this._activeCell&&!this._activeCell.node.contains(t)?this._activeCell.ready.then((()=>{var e;null===(e=this._activeCell)||void 0===e||e.node.focus({preventScroll:!0})})).catch((()=>{var e;null===(e=this.layout.footer)||void 0===e||e.node.focus({preventScroll:!0})})):null===(n=this.layout.footer)||void 0===n||n.node.focus({preventScroll:!0})}}_evtFocusOut(e){var t;this._updateReadWrite();const n=e.relatedTarget;if(!n)return;const o=this._findCell(n);-1!==o&&(null===(t=this.widgets[o].editorWidget)||void 0===t?void 0:t.node.contains(n))||"command"!==this.mode&&this.setMode("command",{focus:!1})}_evtDblClick(e){const t=this.model;if(!t)return;this.deselectAll();const[n,o]=this._findEventTargetAndCell(e);e.target.classList.contains("jp-collapseHeadingButton")||-1===o||(this.activeCellIndex=o,"markdown"===t.cells.get(o).type?this.widgets[o].rendered=!1:"img"===n.localName&&n.classList.toggle("jp-mod-unconfined"))}_trimSelections(){for(let e=0;e<this.widgets.length;e++)if(e!==this._activeCellIndex){const t=this.widgets[e];!t.model.isDisposed&&t.editor&&t.model.selections.delete(t.editor.uuid)}}_updateSelectedCells(){this._selectedCells=this.widgets.filter((e=>this.isSelectedOrActive(e))),this.kernelHistory&&this.kernelHistory.reset()}}var Ce;!function(e){class t extends ue.ContentFactory{}e.ContentFactory=t}(ge||(ge={})),function(e){e.selectedProperty=new K.AttachedProperty({name:"selected",create:()=>!1});class t extends B.PanelLayout{onUpdateRequest(e){}}e.NotebookPanelLayout=t,e.createDragImage=function(e,t,n){return e>1?""!==t?z.VirtualDOM.realize(z.h.div(z.h.div({className:se},z.h.span({className:de},"["+t+"]:"),z.h.span({className:ae},n)),z.h.div({className:re},""))):z.VirtualDOM.realize(z.h.div(z.h.div({className:se},z.h.span({className:de}),z.h.span({className:ae},n)),z.h.div({className:re},""))):""!==t?z.VirtualDOM.realize(z.h.div(z.h.div({className:`${se} ${le}`},z.h.span({className:de},"["+t+"]:"),z.h.span({className:ae},n)))):z.VirtualDOM.realize(z.h.div(z.h.div({className:`${se} ${le}`},z.h.span({className:de}),z.h.span({className:ae},n))))}}(Ce||(Ce={}));class me extends V.DocumentWidget{constructor(e){super(e),this._autorestarting=!1,this.addClass("jp-NotebookPanel"),this.toolbar.addClass("jp-NotebookPanel-toolbar"),this.content.addClass("jp-NotebookPanel-notebook"),this.content.model=this.context.model,this.context.sessionContext.kernelChanged.connect(this._onKernelChanged,this),this.context.sessionContext.statusChanged.connect(this._onSessionStatusChanged,this),this.context.saveState.connect(this._onSave,this),this.revealed.then((()=>{if(!this.isDisposed&&1===this.content.widgets.length){const e=this.content.widgets[0].model;"code"===e.type&&""===e.sharedModel.getSource()&&(this.content.mode="edit")}}))}_onSave(e,t){if("started"===t&&this.model)for(const e of this.model.cells)if((0,i.isMarkdownCellModel)(e))for(const t of e.attachments.keys)e.sharedModel.getSource().includes(t)||e.attachments.remove(t)}get sessionContext(){return this.context.sessionContext}get model(){return this.content.model}setConfig(e){this.content.editorConfig=e.editorConfig,this.content.notebookConfig=e.notebookConfig;const t=this.context.sessionContext.kernelPreference;this.context.sessionContext.kernelPreference={...t,shutdownOnDispose:e.kernelShutdown,autoStartDefault:e.autoStartDefault}}setFragment(e){this.context.ready.then((()=>{this.content.setFragment(e)}))}dispose(){this.content.dispose(),super.dispose()}[o.Printing.symbol](){return async()=>{this.context.model.dirty&&!this.context.model.readOnly&&await this.context.save(),await o.Printing.printURL(s.PageConfig.getNBConvertURL({format:"html",download:!1,path:this.context.path}))}}onBeforeHide(e){super.onBeforeHide(e),this.content.isParentHidden=!0}onBeforeShow(e){this.content.isParentHidden=!1,super.onBeforeShow(e)}_onKernelChanged(e,t){if(!this.model||!t.newValue)return;const{newValue:n}=t;n.info.then((e=>{var t;this.model&&(null===(t=this.context.sessionContext.session)||void 0===t?void 0:t.kernel)===n&&this._updateLanguage(e.language_info)})),this._updateSpec(n)}_onSessionStatusChanged(e,t){var n;"autorestarting"!==t||this._autorestarting?"restarting"===t||(this._autorestarting=!1):((0,o.showDialog)({title:this._trans.__("Kernel Restarting"),body:this._trans.__("The kernel for %1 appears to have died. It will restart automatically.",null===(n=this.sessionContext.session)||void 0===n?void 0:n.path),buttons:[o.Dialog.okButton({label:this._trans.__("Ok")})]}),this._autorestarting=!0)}_updateLanguage(e){this.model.setMetadata("language_info",e)}async _updateSpec(e){const t=await e.spec;this.isDisposed||this.model.setMetadata("kernelspec",{name:e.name,display_name:null==t?void 0:t.display_name,language:null==t?void 0:t.language})}}!function(e){class t extends ge.ContentFactory{createNotebook(e){return new ge(e)}}e.ContentFactory=t,e.IContentFactory=new d.Token("@jupyterlab/notebook:IContentFactory","A factory object that creates new notebooks.\n Use this if you want to create and host notebooks in your own UI elements.")}(me||(me={}));var ve,pe=n(43766);class _e extends pe.SearchProvider{constructor(e,t=l.nullTranslator){super(e),this.translator=t,this._textSelection=null,this._currentProviderIndex=null,this._delayedActiveCellChangeHandler=null,this._onSelection=!1,this._selectedCells=1,this._selectedLines=0,this._query=null,this._searchProviders=[],this._editorSelectionsObservable=null,this._selectionSearchMode="cells",this._selectionLock=!1,this._searchActive=!1,this._handleHighlightsAfterActiveCellChange=this._handleHighlightsAfterActiveCellChange.bind(this),this.widget.model.cells.changed.connect(this._onCellsChanged,this),this.widget.content.activeCellChanged.connect(this._onActiveCellChanged,this),this.widget.content.selectionChanged.connect(this._onCellSelectionChanged,this),this.widget.content.stateChanged.connect(this._onNotebookStateChanged,this),this._observeActiveCell(),this._filtersChanged.connect(this._setEnginesSelectionSearchMode,this)}_onNotebookStateChanged(e,t){"mode"===t.name&&window.setTimeout((()=>{var e;"command"===t.newValue&&(null===(e=document.activeElement)||void 0===e?void 0:e.closest(".jp-DocumentSearch-overlay"))||(this._updateSelectionMode(),this._filtersChanged.emit())}),0)}static isApplicable(e){return e instanceof me}static createNew(e,t){return new _e(e,t)}get currentMatchIndex(){let e=0,t=!1;for(let n=0;n<this._searchProviders.length;n++){const o=this._searchProviders[n];if(this._currentProviderIndex==n){const n=o.currentMatchIndex;if(null===n)return null;e+=n,t=!0;break}e+=o.matchesCount}return t?e:null}get matchesCount(){return this._searchProviders.reduce(((e,t)=>e+t.matchesCount),0)}get isReadOnly(){var e,t,n;return null!==(n=null===(t=null===(e=this.widget)||void 0===e?void 0:e.content.model)||void 0===t?void 0:t.readOnly)&&void 0!==n&&n}get replaceOptionsSupport(){return{preserveCase:!0}}getSelectionState(){const e="cells"===this._selectionSearchMode,t=e?this._selectedCells:this._selectedLines;return t>1?"multiple":1!==t||e?"none":"single"}dispose(){var e;if(this.isDisposed)return;this.widget.content.activeCellChanged.disconnect(this._onActiveCellChanged,this),null===(e=this.widget.model)||void 0===e||e.cells.changed.disconnect(this._onCellsChanged,this),this.widget.content.stateChanged.disconnect(this._onNotebookStateChanged,this),this.widget.content.selectionChanged.disconnect(this._onCellSelectionChanged,this),this._stopObservingLastCell(),super.dispose();const t=this.widget.content.activeCellIndex;this.endQuery().then((()=>{this.widget.isDisposed||(this.widget.content.activeCellIndex=t)})).catch((e=>{console.error(`Fail to end search query in notebook:\n${e}`)}))}getFilters(){const e=this.translator.load("jupyterlab");return{output:{title:e.__("Search Cell Outputs"),description:e.__("Search in the cell outputs."),disabledDescription:e.__("Search in the cell outputs (not available when replace options are shown)."),default:!1,supportReplace:!1},selection:{title:"cells"===this._selectionSearchMode?e._n("Search in %1 Selected Cell","Search in %1 Selected Cells",this._selectedCells):e._n("Search in %1 Selected Line","Search in %1 Selected Lines",this._selectedLines),description:e.__("Search only in the selected cells or text (depending on edit/command mode)."),default:!1,supportReplace:!0}}}_updateSelectionMode(){this._selectionLock||(this._selectionSearchMode=1===this._selectedCells&&"edit"===this.widget.content.mode&&0!==this._selectedLines?"text":"cells")}getInitialQuery(){var e;return(null===(e=window.getSelection())||void 0===e?void 0:e.toString())||""}async clearHighlight(){this._selectionLock=!0,null!==this._currentProviderIndex&&this._currentProviderIndex<this._searchProviders.length&&(await this._searchProviders[this._currentProviderIndex].clearHighlight(),this._currentProviderIndex=null),this._selectionLock=!1}async highlightNext(e=!0,t){const n=await this._stepNext(!1,e,t);return null!=n?n:void 0}async highlightPrevious(e=!0,t){const n=await this._stepNext(!0,e,t);return null!=n?n:void 0}async startQuery(e,t){if(!this.widget)return;await this.endQuery(),this._searchActive=!0;let n=this.widget.content.widgets;this._query=e,this._filters={output:!1,selection:!1,...null!=t?t:{}},this._onSelection=this._filters.selection;const o=this.widget.content.activeCellIndex;return this._searchProviders=await Promise.all(n.map((async(t,n)=>{const s=(0,i.createCellSearchProvider)(t);return await s.setIsActive(!this._filters.selection||this.widget.content.isSelectedOrActive(t)),this._onSelection&&"text"===this._selectionSearchMode&&n===o&&this._textSelection&&await s.setSearchSelection(this._textSelection),await s.startQuery(e,this._filters),s}))),this._currentProviderIndex=o,await this.highlightNext(!0,{from:"selection-start",scroll:!1,select:!1}),Promise.resolve()}async endQuery(){await Promise.all(this._searchProviders.map((e=>e.endQuery().then((()=>{e.dispose()}))))),this._searchActive=!1,this._searchProviders.length=0,this._currentProviderIndex=null}async replaceCurrentMatch(e,t=!0,n){let o=!1;const i=async(e=!1)=>{var n;const o=null===(n=this.widget)||void 0===n?void 0:n.content.activeCell;"markdown"===(null==o?void 0:o.model.type)&&o.rendered&&(o.rendered=!1,e&&await this.highlightNext(t))};if(null!==this._currentProviderIndex){await i();const s=this._searchProviders[this._currentProviderIndex];o=await s.replaceCurrentMatch(e,!1,n),null===s.currentMatchIndex&&await this.highlightNext(t)}return await i(!0),o}async replaceAllMatches(e,t){return(await Promise.all(this._searchProviders.map((n=>n.replaceAllMatches(e,t))))).includes(!0)}async validateFilter(e,t){if("output"!==e)return t;if(t&&this.widget.content.widgets.some((e=>e instanceof i.CodeCell&&e.isPlaceholder()))){const e=this.translator.load("jupyterlab");if(!(await(0,o.showDialog)({title:e.__("Confirmation"),body:e.__("Searching outputs requires you to run all cells and render their outputs. Are you sure you want to search in the cell outputs?"),buttons:[o.Dialog.cancelButton({label:e.__("Cancel")}),o.Dialog.okButton({label:e.__("Ok")})]})).button.accept)return!1;this.widget.content.widgets.forEach(((e,t)=>{e instanceof i.CodeCell&&e.isPlaceholder()&&this.widget.content.renderCellOutputs(t)}))}return t}_addCellProvider(e){var t,n;const o=this.widget.content.widgets[e],s=(0,i.createCellSearchProvider)(o);a.ArrayExt.insert(this._searchProviders,e,s),s.setIsActive(!(null!==(n=null===(t=this._filters)||void 0===t?void 0:t.selection)&&void 0!==n&&n)||this.widget.content.isSelectedOrActive(o)).then((()=>{this._searchActive&&s.startQuery(this._query,this._filters)}))}_removeCellProvider(e){const t=a.ArrayExt.removeAt(this._searchProviders,e);null==t||t.dispose()}async _onCellsChanged(e,t){switch(t.type){case"add":t.newValues.forEach(((e,n)=>{this._addCellProvider(t.newIndex+n)}));break;case"move":a.ArrayExt.move(this._searchProviders,t.oldIndex,t.newIndex);break;case"remove":for(let e=0;e<t.oldValues.length;e++)this._removeCellProvider(t.oldIndex);break;case"set":t.newValues.forEach(((e,n)=>{this._addCellProvider(t.newIndex+n),this._removeCellProvider(t.newIndex+n+1)}))}this._stateChanged.emit()}async _stepNext(e=!1,t=!1,n){const o=async e=>{var t;if(null!==(t=null==n?void 0:n.scroll)&&void 0!==t&&!t)return;if(this._selectionLock=!0,this.widget.content.activeCellIndex!==this._currentProviderIndex&&(this.widget.content.activeCellIndex=this._currentProviderIndex),-1===this.widget.content.activeCellIndex)return console.warn("No active cell (no cells or no model), aborting search"),void(this._selectionLock=!1);const o=this.widget.content.activeCell;if(!o.inViewport)try{await this.widget.content.scrollToItem(this._currentProviderIndex)}catch(e){}if(o.inputHidden&&(o.inputHidden=!1),!o.inViewport)return void(this._selectionLock=!1);await o.ready;const i=o.editor;i.revealPosition(i.getPositionAt(e.position)),this._selectionLock=!1};null===this._currentProviderIndex&&(this._currentProviderIndex=this.widget.content.activeCellIndex),e&&"command"===this.widget.content.mode&&(this._searchProviders[this._currentProviderIndex].getCurrentMatch()||(this._currentProviderIndex-=1),t&&(this._currentProviderIndex=(this._currentProviderIndex+this._searchProviders.length)%this._searchProviders.length));const i=this._currentProviderIndex;do{const i=this._searchProviders[this._currentProviderIndex],s=e?await i.highlightPrevious(!1,n):await i.highlightNext(!1,n);if(s)return await o(s),s;this._currentProviderIndex=this._currentProviderIndex+(e?-1:1),t&&(this._currentProviderIndex=(this._currentProviderIndex+this._searchProviders.length)%this._searchProviders.length)}while(t?this._currentProviderIndex!==i:0<=this._currentProviderIndex&&this._currentProviderIndex<this._searchProviders.length);if(t){const t=this._searchProviders[i],s=e?await t.highlightPrevious(!1,n):await t.highlightNext(!1,n);if(s)return await o(s),s}return this._currentProviderIndex=null,null}async _onActiveCellChanged(){null!==this._delayedActiveCellChangeHandler&&(clearTimeout(this._delayedActiveCellChangeHandler),this._delayedActiveCellChangeHandler=null),this.widget.content.activeCellIndex!==this._currentProviderIndex&&(this._delayedActiveCellChangeHandler=window.setTimeout((()=>{this.delayedActiveCellChangeHandlerReady=this._handleHighlightsAfterActiveCellChange()}),0)),this._observeActiveCell()}async _handleHighlightsAfterActiveCellChange(){if(this._onSelection){const e=null!==this._currentProviderIndex&&this._currentProviderIndex<this.widget.content.widgets.length?this.widget.content.widgets[this._currentProviderIndex]:null;e&&this.widget.content.isSelectedOrActive(e)||(await this._updateCellSelection(),await this.clearHighlight(),this._currentProviderIndex=this.widget.content.activeCellIndex)}await this._ensureCurrentMatch()}async _ensureCurrentMatch(){if(null!==this._currentProviderIndex){const e=this._searchProviders[this._currentProviderIndex];if(!e)return;!e.getCurrentMatch()&&this.matchesCount&&await this.highlightNext(!0,{from:"start",scroll:!1,select:!1})}}_observeActiveCell(){var e;const t=null===(e=this.widget.content.activeCell)||void 0===e?void 0:e.editor;t&&(this._stopObservingLastCell(),t.model.selections.changed.connect(this._setSelectedLines,this),this._editorSelectionsObservable=t.model.selections)}_stopObservingLastCell(){this._editorSelectionsObservable&&this._editorSelectionsObservable.changed.disconnect(this._setSelectedLines,this)}_setSelectedLines(){var e;const t=null===(e=this.widget.content.activeCell)||void 0===e?void 0:e.editor;if(!t)return;const n=t.getSelection(),{start:o,end:i}=n,s=i.line===o.line&&i.column===o.column?0:i.line-o.line+1;this._textSelection=n,s!==this._selectedLines&&(this._selectedLines=s,this._updateSelectionMode()),this._filtersChanged.emit()}async _setEnginesSelectionSearchMode(){let e;e=!!this._onSelection&&"text"===this._selectionSearchMode,this._selectionLock||await Promise.all(this._searchProviders.map(((t,n)=>{const o=this.widget.content.activeCellIndex===n;return t.setProtectSelection(o&&this._onSelection),t.setSearchSelection(o&&e?this._textSelection:null)})))}async _onCellSelectionChanged(){if(null!==this._delayedActiveCellChangeHandler&&(clearTimeout(this._delayedActiveCellChangeHandler),this._delayedActiveCellChangeHandler=null),await this._updateCellSelection(),null===this._currentProviderIndex){const e=this.widget.content.widgets.findIndex((e=>this.widget.content.isSelectedOrActive(e)));this._currentProviderIndex=e}await this._ensureCurrentMatch()}async _updateCellSelection(){const e=this.widget.content.widgets;let t=0;await Promise.all(e.map((async(e,n)=>{const o=this._searchProviders[n],i=this.widget.content.isSelectedOrActive(e);i&&(t+=1),o&&this._onSelection&&await o.setIsActive(i)}))),t!==this._selectedCells&&(this._selectedCells=t,this._updateSelectionMode()),this._filtersChanged.emit()}}!function(e){e[e.Idle=-1]="Idle",e[e.Error=-.5]="Error",e[e.Scheduled=0]="Scheduled",e[e.Running=1]="Running"}(ve||(ve={}));class fe extends j.TableOfContentsModel{constructor(e,t,n,o){super(e,o),this.parser=t,this.sanitizer=n,this.configMetadataMap={numberHeaders:["toc-autonumbering","toc/number_sections"],numberingH1:["!toc/skip_h1_title"],baseNumbering:["toc/base_numbering"]},this._runningCells=new Array,this._errorCells=new Array,this._cellToHeadingIndex=new WeakMap,e.context.ready.then((()=>{this.setConfiguration({})})),this.widget.context.model.metadataChanged.connect(this.onMetadataChanged,this),this.widget.content.activeCellChanged.connect(this.onActiveCellChanged,this),m.executionScheduled.connect(this.onExecutionScheduled,this),m.executed.connect(this.onExecuted,this),m.outputCleared.connect(this.onOutputCleared,this),this.headingsChanged.connect(this.onHeadingsChanged,this)}get documentType(){return"notebook"}get isAlwaysActive(){return!0}get supportedOptions(){return["baseNumbering","maximalDepth","numberingH1","numberHeaders","includeOutput","syncCollapseState"]}getCellHeadings(e){const t=new Array;let n=this._cellToHeadingIndex.get(e);if(void 0!==n){const e=this.headings[n];for(t.push(e);this.headings[n-1]&&this.headings[n-1].cellRef===e.cellRef;)n--,t.unshift(this.headings[n])}return t}dispose(){var e,t,n;this.isDisposed||(this.headingsChanged.disconnect(this.onHeadingsChanged,this),null===(t=null===(e=this.widget.context)||void 0===e?void 0:e.model)||void 0===t||t.metadataChanged.disconnect(this.onMetadataChanged,this),null===(n=this.widget.content)||void 0===n||n.activeCellChanged.disconnect(this.onActiveCellChanged,this),m.executionScheduled.disconnect(this.onExecutionScheduled,this),m.executed.disconnect(this.onExecuted,this),m.outputCleared.disconnect(this.onOutputCleared,this),this._runningCells.length=0,this._errorCells.length=0,super.dispose())}setConfiguration(e){const t=this.loadConfigurationFromMetadata();super.setConfiguration({...this.configuration,...t,...e})}toggleCollapse(e){super.toggleCollapse(e),this.updateRunningStatus(this.headings)}getHeadings(){const e=this.widget.content.widgets,t=[],n=new Array;for(let o=0;o<e.length;o++){const i=e[o];switch(i.model.type){case"code":!this.configuration.syncCollapseState&&this.configuration.includeOutput&&t.push(...j.TableOfContentsUtils.filterHeadings(i.headings,this.configuration,n).map((e=>({...e,cellRef:i,collapsed:!1,isRunning:ve.Idle}))));break;case"markdown":{const e=j.TableOfContentsUtils.filterHeadings(i.headings,this.configuration,n).map(((e,t)=>({...e,cellRef:i,collapsed:!1,isRunning:ve.Idle})));if(this.configuration.syncCollapseState&&i.headingCollapsed){const t=Math.min(...e.map((e=>e.level)));e.find((e=>e.level===t)).collapsed=i.headingCollapsed}t.push(...e);break}}t.length>0&&this._cellToHeadingIndex.set(i,t.length-1)}return this.updateRunningStatus(t),Promise.resolve(t)}isHeadingEqual(e,t){return super.isHeadingEqual(e,t)&&e.cellRef===t.cellRef}loadConfigurationFromMetadata(){const e=this.widget.content.model,t={};if(e)for(const n in this.configMetadataMap){const o=this.configMetadataMap[n];for(const i of o){let o=i;const s="!"===o[0];s&&(o=o.slice(1));const l=o.split("/");let a=e.getMetadata(l[0]);for(let e=1;e<l.length;e++)a=(null!=a?a:{})[l[e]];void 0!==a&&("boolean"==typeof a&&s&&(a=!a),t[n]=a)}}return t}onActiveCellChanged(e,t){const n=this.getCellHeadings(t)[0];this.setActiveHeading(null!=n?n:null,!1)}onHeadingsChanged(){this.widget.content.activeCell&&this.onActiveCellChanged(this.widget.content,this.widget.content.activeCell)}onExecuted(e,t){this._runningCells.forEach(((e,n)=>{var o;if(e===t.cell){this._runningCells.splice(n,1);const i=this._cellToHeadingIndex.get(e);if(void 0!==i){const n=this.headings[i];if(t.success||void 0===(null===(o=t.error)||void 0===o?void 0:o.errorName))return void(n.isRunning=ve.Idle);n.isRunning=ve.Error,this._errorCells.includes(e)||this._errorCells.push(e)}}})),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onExecutionScheduled(e,t){this._runningCells.includes(t.cell)||this._runningCells.push(t.cell),this._errorCells.forEach(((e,n)=>{e===t.cell&&this._errorCells.splice(n,1)})),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onOutputCleared(e,t){this._errorCells.forEach(((e,n)=>{if(e===t.cell){this._errorCells.splice(n,1);const t=this._cellToHeadingIndex.get(e);void 0!==t&&(this.headings[t].isRunning=ve.Idle)}})),this.updateRunningStatus(this.headings),this.stateChanged.emit()}onMetadataChanged(){this.setConfiguration({})}updateRunningStatus(e){this._runningCells.forEach(((e,t)=>{const n=this._cellToHeadingIndex.get(e);if(void 0!==n){const e=this.headings[n];e.isRunning!==ve.Running&&(e.isRunning=t>0?ve.Scheduled:ve.Running)}})),this._errorCells.forEach(((e,t)=>{const n=this._cellToHeadingIndex.get(e);if(void 0!==n){const e=this.headings[n];e.isRunning===ve.Idle&&(e.isRunning=ve.Error)}}));let t=0;for(;t<e.length;){const o=e[t];if(t++,o.collapsed){const t=Math.max(o.isRunning,n(e,o.level));o.dataset={...o.dataset,"data-running":t.toString()}}else o.dataset={...o.dataset,"data-running":o.isRunning.toString()}}function n(e,o){let i=ve.Idle;for(;t<e.length;){const s=e[t];if(s.dataset={...s.dataset,"data-running":s.isRunning.toString()},!(s.level>o))break;t++,i=Math.max(s.isRunning,i),s.collapsed&&(i=Math.max(i,n(e,s.level)),s.dataset={...s.dataset,"data-running":i.toString()})}return i}}}class we extends j.TableOfContentsFactory{constructor(e,t,n){super(e),this.parser=t,this.sanitizer=n,this._scrollToTop=!0}get scrollToTop(){return this._scrollToTop}set scrollToTop(e){this._scrollToTop=e}_createNew(e,t){const n=new fe(e,this.parser,this.sanitizer,t);let o=new WeakMap;const s=(t,n)=>{if(n){const t=async t=>{if(!t.inViewport)return;const i=o.get(n);if(i)if(this.scrollToTop)i.scrollIntoView({block:"start"});else{const t=e.content.node.getBoundingClientRect(),n=i.getBoundingClientRect();(n.top>t.bottom||n.bottom<t.top)&&i.scrollIntoView({block:"center"})}else console.debug("scrolling to heading: using fallback strategy"),await e.content.scrollToItem(e.content.activeCellIndex,this.scrollToTop?"start":void 0,0)},i=n.cellRef,s=e.content.widgets.indexOf(i);"markdown"==i.model.type&&"command"!=e.content.mode&&(e.content.mode="command"),e.content.activeCellIndex=s,i.inViewport?t(i).catch((e=>{console.error(`Fail to scroll to cell to display the required heading (${e}).`)})):e.content.scrollToItem(s,this.scrollToTop?"start":void 0).then((()=>t(i))).catch((e=>{console.error(`Fail to scroll to cell to display the required heading (${e}).`)}))}},l=e=>{n.getCellHeadings(e).forEach((async e=>{var t,n;const i=await ye(e,this.parser,this.sanitizer),s=i?`h${e.level}[id="${CSS.escape(i)}"]`:`h${e.level}`;void 0!==e.outputIndex?o.set(e,j.TableOfContentsUtils.addPrefix(e.cellRef.outputArea.widgets[e.outputIndex].node,s,null!==(t=e.prefix)&&void 0!==t?t:"")):o.set(e,j.TableOfContentsUtils.addPrefix(e.cellRef.node,s,null!==(n=e.prefix)&&void 0!==n?n:""))}))},a=t=>{this.parser&&(j.TableOfContentsUtils.clearNumbering(e.content.node),o=new WeakMap,e.content.widgets.forEach((e=>{l(e)})))},d=(t,o)=>{var s,l,a,d;if(n.configuration.syncCollapseState)if(null!==o){const e=o.cellRef;e.headingCollapsed!==(null!==(s=o.collapsed)&&void 0!==s&&s)&&(e.headingCollapsed=null!==(l=o.collapsed)&&void 0!==l&&l)}else{const t=null!==(d=null===(a=n.headings[0])||void 0===a?void 0:a.collapsed)&&void 0!==d&&d;e.content.widgets.forEach((e=>{e instanceof i.MarkdownCell&&e.headingInfo.level>=0&&(e.headingCollapsed=t)}))}},r=(e,t)=>{if(n.configuration.syncCollapseState){const e=n.getCellHeadings(t)[0];e&&n.toggleCollapse({heading:e,collapsed:t.headingCollapsed})}},c=(e,t)=>{t.inViewport?l(t):j.TableOfContentsUtils.clearNumbering(t.node)};return e.context.ready.then((()=>{a(),n.activeHeadingChanged.connect(s),n.headingsChanged.connect(a),n.collapseChanged.connect(d),e.content.cellCollapsed.connect(r),e.content.cellInViewportChanged.connect(c),e.disposed.connect((()=>{n.activeHeadingChanged.disconnect(s),n.headingsChanged.disconnect(a),n.collapseChanged.disconnect(d),e.content.cellCollapsed.disconnect(r),e.content.cellInViewportChanged.disconnect(c)}))})),n}}async function ye(e,t,n){let o=null;return e.type===i.Cell.HeadingType.Markdown?o=await j.TableOfContentsUtils.Markdown.getHeadingId(t,e.raw,e.level,n):e.type===i.Cell.HeadingType.HTML&&(o=e.id),o}const be=new d.Token("@jupyterlab/notebook:INotebookWidgetFactory","A service to create the notebook viewer."),ke=new d.Token("@jupyterlab/notebook:INotebookTools",'A service for the "Notebook Tools" panel in the\n right sidebar. Use this to add your own functionality to the panel.'),Se=new d.Token("@jupyterlab/notebook:INotebookTracker","A widget tracker for notebooks.\n Use this if you want to be able to iterate over and interact with notebooks\n created by the application."),xe=new d.Token("@jupyterlab/notebook:INotebookCellExecutor","The notebook cell executor");class Me extends o.WidgetTracker{constructor(){super(...arguments),this._activeCell=null,this._activeCellChanged=new r.Signal(this),this._selectionChanged=new r.Signal(this)}get activeCell(){const e=this.currentWidget;return e&&e.content.activeCell||null}get activeCellChanged(){return this._activeCellChanged}get selectionChanged(){return this._selectionChanged}add(e){const t=super.add(e);return e.content.activeCellChanged.connect(this._onActiveCellChanged,this),e.content.selectionChanged.connect(this._onSelectionChanged,this),t}dispose(){this._activeCell=null,super.dispose()}onCurrentChanged(e){const t=this.activeCell;t&&t===this._activeCell||(this._activeCell=t,e&&this._activeCellChanged.emit(e.content.activeCell||null))}_onActiveCellChanged(e,t){this.currentWidget&&this.currentWidget.content===e&&(this._activeCell=t||null,this._activeCellChanged.emit(this._activeCell))}_onSelectionChanged(e){this.currentWidget&&this.currentWidget.content===e&&this._selectionChanged.emit(void 0)}}function Ie(e){return e.allCellsTrusted?h().createElement(w.trustedIcon.react,{top:"2px",stylesheet:"statusBar"}):h().createElement(w.notTrustedIcon.react,{top:"2px",stylesheet:"statusBar"})}class Ee extends w.VDomRenderer{constructor(e){super(new Ee.Model),this.translator=e||l.nullTranslator,this.node.classList.add("jp-StatusItem-trust")}render(){if(!this.model)return null;const e=function(e,t){const n=(t=t||l.nullTranslator).load("jupyterlab");return e.trustedCells===e.totalCells?n.__("Notebook trusted: %1 of %2 code cells trusted.",e.trustedCells,e.totalCells):e.activeCellTrusted?n.__("Active cell trusted: %1 of %2 code cells trusted.",e.trustedCells,e.totalCells):n.__("Notebook not trusted: %1 of %2 code cells trusted.",e.trustedCells,e.totalCells)}(this.model,this.translator);return e!==this.node.title&&(this.node.title=e),h().createElement(Ie,{allCellsTrusted:this.model.trustedCells===this.model.totalCells,activeCellTrusted:this.model.activeCellTrusted,totalCells:this.model.totalCells,trustedCells:this.model.trustedCells})}}!function(e){class t extends w.VDomModel{constructor(){super(...arguments),this._trustedCells=0,this._totalCells=0,this._activeCellTrusted=!1,this._notebook=null}get trustedCells(){return this._trustedCells}get totalCells(){return this._totalCells}get activeCellTrusted(){return this._activeCellTrusted}get notebook(){return this._notebook}set notebook(e){const t=this._notebook;null!==t&&(t.activeCellChanged.disconnect(this._onActiveCellChanged,this),t.modelContentChanged.disconnect(this._onModelChanged,this));const n=this._getAllState();if(this._notebook=e,null===this._notebook)this._trustedCells=0,this._totalCells=0,this._activeCellTrusted=!1;else{this._notebook.activeCellChanged.connect(this._onActiveCellChanged,this),this._notebook.modelContentChanged.connect(this._onModelChanged,this),this._notebook.activeCell?this._activeCellTrusted=this._notebook.activeCell.model.trusted:this._activeCellTrusted=!1;const{total:e,trusted:t}=this._deriveCellTrustState(this._notebook.model);this._totalCells=e,this._trustedCells=t}this._triggerChange(n,this._getAllState())}_onModelChanged(e){const t=this._getAllState(),{total:n,trusted:o}=this._deriveCellTrustState(e.model);this._totalCells=n,this._trustedCells=o,this._triggerChange(t,this._getAllState())}_onActiveCellChanged(e,t){const n=this._getAllState();this._activeCellTrusted=!!t&&t.model.trusted,this._triggerChange(n,this._getAllState())}_deriveCellTrustState(e){if(null===e)return{total:0,trusted:0};let t=0,n=0;for(const o of e.cells)"code"===o.type&&(t++,o.trusted&&n++);return{total:t,trusted:n}}_getAllState(){return[this._trustedCells,this._totalCells,this.activeCellTrusted]}_triggerChange(e,t){e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]||this.stateChanged.emit(void 0)}}e.Model=t}(Ee||(Ee={}));class Ae{constructor(e){this._requestBatchSize=10,this._cursor=0,this._hasSession=!1,this._history=[],this._placeholder="",this._kernelSession="",this._setByHistory=!1,this._isDisposed=!1,this._editor=null,this._filtered=[],this._kernel=null,this._sessionContext=e.sessionContext,this._trans=(e.translator||l.nullTranslator).load("jupyterlab"),this._handleKernel().then((()=>{this._sessionContext.kernelChanged.connect(this._handleKernel,this)})),this._toRequest=this._requestBatchSize}get editor(){return this._editor}set editor(e){if(this._editor===e)return;const t=this._editor;t&&t.model.sharedModel.changed.disconnect(this.onTextChange,this),this._editor=e,e&&e.model.sharedModel.changed.connect(this.onTextChange,this)}get placeholder(){return this._placeholder}get kernelSession(){return this._kernelSession}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed=!0,this._history.length=0,r.Signal.clearData(this)}async checkSession(e){var t;this._hasSession||(await this._retrieveHistory(),this._hasSession=!0,this.editor=e.editor,this._placeholder=(null===(t=this._editor)||void 0===t?void 0:t.model.sharedModel.getSource())||"",this.setFilter(this._placeholder),this._cursor=this._filtered.length-1)}async back(e){return await this.checkSession(e),--this._cursor,this._cursor<0&&await this.fetchBatch(),this._cursor=Math.max(0,this._cursor),this._filtered[this._cursor]}async forward(e){return await this.checkSession(e),++this._cursor,this._cursor=Math.min(this._filtered.length-1,this._cursor),this._filtered[this._cursor]}updateEditor(e,t){var n,o;if(e){const i=null===(n=e.editor)||void 0===n?void 0:n.model,s=null==i?void 0:i.sharedModel.getSource();if(this.isDisposed||!t)return;if(s===t)return;this._setByHistory=!0,null==i||i.sharedModel.setSource(t);let l=0;l=t.indexOf("\n"),l<0&&(l=t.length),null===(o=e.editor)||void 0===o||o.setCursorPosition({line:0,column:l})}}reset(){this._hasSession=!1,this._placeholder="",this._toRequest=this._requestBatchSize}async fetchBatch(){this._toRequest+=this._requestBatchSize;let e=this._filtered.slice().reverse(),t=this._history.slice();await this._retrieveHistory().then((()=>{this.setFilter(this._placeholder);let t=0,n=this._filtered.slice().reverse();for(let o=0;o<e.length;o++){let i=e[o];for(let e=o+t;e<n.length&&i!==n[e];e++)t+=1}this._cursor=this._filtered.length-(e.length+1)-t})),this._cursor<0&&this._history.length>t.length&&await this.fetchBatch()}onHistory(e,t){this._history.length=0;let n=["","",""],o=["","",""],i="";if("ok"===e.content.status){for(let t=0;t<e.content.history.length;t++)o=e.content.history[t],o!==n&&(i=e.content.history[t][0],this._history.push(n=o));this.kernelSession||o[2]==(null==t?void 0:t.model.sharedModel.getSource())&&(this._kernelSession=i)}}onTextChange(){this._setByHistory?this._setByHistory=!1:this.reset()}async _handleKernel(){var e;this._kernel=null===(e=this._sessionContext.session)||void 0===e?void 0:e.kernel,this._kernel?await this._retrieveHistory().catch():this._history.length=0}async _retrieveHistory(e){var t,n;return await(null===(t=this._kernel)||void 0===t?void 0:t.requestHistory((n=this._toRequest,{output:!1,raw:!0,hist_access_type:"tail",n})).then((t=>{this.onHistory(t,e)})).catch((()=>{console.warn(this._trans.__("History was unable to be retrieved"))})))}setFilter(e=""){this._filtered.length=0;let t="",n="";for(let o=0;o<this._history.length;o++)n=this._history[o][2],n!==t&&e!==n&&this._filtered.push(t=n);this._filtered.push(e)}}class Te extends V.ABCWidgetFactory{constructor(e){super(e),this.rendermime=e.rendermime,this.contentFactory=e.contentFactory,this.mimeTypeService=e.mimeTypeService,this._editorConfig=e.editorConfig||ue.defaultEditorConfig,this._notebookConfig=e.notebookConfig||ue.defaultNotebookConfig}get editorConfig(){return this._editorConfig}set editorConfig(e){this._editorConfig=e}get notebookConfig(){return this._notebookConfig}set notebookConfig(e){this._notebookConfig=e}createNewWidget(e,t){const n=e.translator,o=new Ae({sessionContext:e.sessionContext,translator:n}),i={rendermime:t?t.content.rendermime:this.rendermime.clone({resolver:e.urlResolver}),contentFactory:this.contentFactory,mimeTypeService:this.mimeTypeService,editorConfig:t?t.content.editorConfig:this._editorConfig,notebookConfig:t?t.content.notebookConfig:this._notebookConfig,translator:n,kernelHistory:o},s=this.contentFactory.createNotebook(i);return new me({context:e,content:s})}}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3768,7302],{83768:(e,t,o)=>{o.r(t),o.d(t,{default:()=>F});var n=o(23051),r=o(92972),i=o(60546),a=o(13532),s=o(80724),l=o(1527),d=o(31721),c=o(36478),g=o(81997),u=o(63485),w=o(36230),h=o(78156),b=o.n(h);class p{constructor(e){this._onSelectionChanged=()=>{var e,t,o,n,r,i;const a=Array.from(this._browser.selectedItems()),s=a.length>0,l=a.some((e=>"directory"===e.type));null===(e=this._widgets.get("placeholder"))||void 0===e||e.setHidden(s),null===(t=this._widgets.get("delete"))||void 0===t||t.setHidden(!s),null===(o=this._widgets.get("duplicate"))||void 0===o||o.setHidden(!s||l),null===(n=this._widgets.get("download"))||void 0===n||n.setHidden(!s||l),null===(r=this._widgets.get("open"))||void 0===r||r.setHidden(!s||l),null===(i=this._widgets.get("rename"))||void 0===i||i.setHidden(1!==a.length)},this._widgets=new Map,this._browser=e.browser;const{commands:t,selectionChanged:o,translator:r}=e,i=r.load("notebook"),a=n.ReactWidget.create(b().createElement("div",{key:"placeholder"},i.__("Select items to perform actions on them.")));a.id="fileAction-placeholder",this._widgets.set("placeholder",a),["open","download","rename","duplicate","delete"].forEach((e=>{const o=n.ReactWidget.create(b().createElement(n.CommandToolbarButtonComponent,{key:e,commands:t,id:`filebrowser:${e}`,args:{toolbar:!0},icon:void 0}));o.id=`fileAction-${e}`,o.addClass("jp-ToolbarButton"),o.addClass("jp-FileAction"),this._widgets.set(e,o)})),o.connect(this._onSelectionChanged,this),this._onSelectionChanged()}get widgets(){return this._widgets.values()}}const m="FileBrowser";var f;!function(e){e.activate="filebrowser:activate"}(f||(f={}));const _={id:"@jupyter-notebook/tree-extension:new",description:"Plugin to add extra commands to the file browser to create new notebooks, files, consoles and terminals.",requires:[d.ITranslator],optional:[n.IToolbarWidgetRegistry],autoStart:!0,activate:(e,t,o)=>{var n;const{commands:r,serviceManager:i}=e,a=t.load("notebook"),s={overflowMenuOptions:{isVisible:!1}},l=new u.MenuBar(s),d=new u.Menu({commands:r});d.title.label=a.__("New"),d.title.icon=c.caretDownIcon,l.addMenu(d);const g=()=>{var e,t;const o=null===(t=null===(e=i.kernelspecs)||void 0===e?void 0:e.specs)||void 0===t?void 0:t.kernelspecs;for(const e in o)d.addItem({args:{kernelName:e,isLauncher:!0},command:"notebook:create-new"});["terminal:create-new","console:create","filebrowser:create-new-file","filebrowser:create-new-directory"].forEach((e=>{d.addItem({command:e})}))};null===(n=i.kernelspecs)||void 0===n||n.specsChanged.connect((()=>{d.clearItems(),g()})),g(),o&&o.addFactory(m,"new-dropdown",(e=>{const t=new u.MenuBar(s);return t.addMenu(d),t.addClass("jp-DropdownMenu"),t}))}},v={id:"@jupyter-notebook/tree-extension:file-actions",description:"A plugin to add file browser actions to the file browser toolbar.",autoStart:!0,requires:[i.IDefaultFileBrowser,n.IToolbarWidgetRegistry,d.ITranslator],activate:(e,t,o,n)=>{const r=new g.Signal(t);["_selectItem","_handleMultiSelect","handleFileSelect"].forEach((e=>{const o=t.listing[e];t.listing[e]=(...e)=>{o.call(t.listing,...e),r.emit(void 0)}}));const{commands:i}=e,a=new p({commands:i,browser:t,selectionChanged:r,translator:n});for(const e of a.widgets)o.addFactory(m,e.id,(()=>e))}},y={id:"@jupyter-notebook/tree-extension:load-plugins",description:"Plugin to load the default plugins that are loaded on all the Notebook pages (tree, edit, view, etc.) so they are visible in the settings editor.",autoStart:!0,requires:[a.ISettingRegistry],activate(e,t){const{isDisabled:o}=r.PageConfig.Extension,n=t.connector,i=r.PageConfig.getOption("allPlugins");if(!i)return;const a=JSON.parse(i),s=new Set;Object.keys(a).forEach((e=>{const t=a[e];Object.keys(t).forEach((e=>{const o=t[e];"boolean"==typeof o&&o?s.add(e):Array.isArray(o)&&o.forEach((e=>{s.add(e)}))}))})),e.restored.then((async()=>{(await n.list("all")).ids.forEach((async e=>{const[n]=e.split(":");if((s.has(n)||s.has(e))&&!o(e)&&!(e in t.plugins))try{await t.load(e)}catch(t){console.warn(`Settings failed to load for (${e})`,t)}}))}))}},k={id:"@jupyter-notebook/tree-extension:open-file-browser",description:"A plugin to add file browser commands for the tree view.",requires:[w.INotebookTree,i.IDefaultFileBrowser],autoStart:!0,activate:(e,t,o)=>{const{commands:n}=e;n.addCommand(f.activate,{execute:()=>{t.currentWidget=o}})}},S={id:"@jupyter-notebook/tree-extension:widget",description:"A plugin to add the file browser widget to an INotebookShell.",requires:[i.IDefaultFileBrowser,d.ITranslator,a.ISettingRegistry,n.IToolbarWidgetRegistry,i.IFileBrowserFactory],optional:[s.IRunningSessionManagers,l.ISettingEditorTracker,l.IJSONSettingEditorTracker],autoStart:!0,provides:w.INotebookTree,activate:(e,t,o,r,a,l,d,g,u)=>{const h=new w.NotebookTreeWidget,b=o.load("notebook");if(t.title.label=b.__("Files"),t.node.setAttribute("role","region"),t.node.setAttribute("aria-label",b.__("File Browser Section")),t.title.icon=c.folderIcon,h.addWidget(t),h.tabBar.addTab(t.title),h.tabsMovable=!1,a.addFactory(m,"uploader",(e=>new i.Uploader({model:e.model,translator:o,label:b.__("Upload")}))),a.addFactory(m,"fileNameSearcher",(e=>{const t=(0,c.FilenameSearcher)({updateFilter:(t,o)=>{e.model.setFilter((e=>t(e.name.toLowerCase())))},useFuzzyFilter:!0,placeholder:b.__("Filter files by name"),forceRefresh:!0});return t.addClass("jp-FileBrowser-filterBox"),t})),(0,n.setToolbar)(t,(0,n.createToolbarFactory)(a,r,m,S.id,o)),d){const e=new s.RunningSessions(d,o);e.id="jp-running-sessions-tree",e.title.label=b.__("Running"),e.title.icon=c.runningIcon,h.addWidget(e),h.tabBar.addTab(e.title)}const p=r.load("@jupyterlab/filebrowser-extension:browser");Promise.all([p,e.restored]).then((([e])=>{["showFileCheckboxes","showFileSizeColumn","sortNotebooksFirst","showFullPath"].forEach((t=>{void 0===e.user[t]&&e.set(t,!0)}))})).catch((e=>{console.error(e.message)})),e.shell.add(h,"main",{rank:100}),[g,u].forEach((e=>{e&&e.widgetAdded.connect(((e,t)=>{h.addWidget(t),h.tabBar.addTab(t.title),h.currentWidget=t}))}));const{tracker:f}=l,_=()=>{f._pool.current=t};return f.widgetAdded.connect(((e,t)=>_())),_(),h}},F=[_,v,y,k,S]}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3768,7302],{83768:(e,t,o)=>{o.r(t),o.d(t,{default:()=>F});var n=o(95297),r=o(9983),i=o(58802),a=o(2277),s=o(91317),l=o(43959),d=o(60502),c=o(31589),g=o(81997),u=o(63485),w=o(69224),h=o(78156),b=o.n(h);class p{constructor(e){this._onSelectionChanged=()=>{var e,t,o,n,r,i;const a=Array.from(this._browser.selectedItems()),s=a.length>0,l=a.some((e=>"directory"===e.type));null===(e=this._widgets.get("placeholder"))||void 0===e||e.setHidden(s),null===(t=this._widgets.get("delete"))||void 0===t||t.setHidden(!s),null===(o=this._widgets.get("duplicate"))||void 0===o||o.setHidden(!s||l),null===(n=this._widgets.get("download"))||void 0===n||n.setHidden(!s||l),null===(r=this._widgets.get("open"))||void 0===r||r.setHidden(!s||l),null===(i=this._widgets.get("rename"))||void 0===i||i.setHidden(1!==a.length)},this._widgets=new Map,this._browser=e.browser;const{commands:t,selectionChanged:o,translator:r}=e,i=r.load("notebook"),a=n.ReactWidget.create(b().createElement("div",{key:"placeholder"},i.__("Select items to perform actions on them.")));a.id="fileAction-placeholder",this._widgets.set("placeholder",a),["open","download","rename","duplicate","delete"].forEach((e=>{const o=n.ReactWidget.create(b().createElement(n.CommandToolbarButtonComponent,{key:e,commands:t,id:`filebrowser:${e}`,args:{toolbar:!0},icon:void 0}));o.id=`fileAction-${e}`,o.addClass("jp-ToolbarButton"),o.addClass("jp-FileAction"),this._widgets.set(e,o)})),o.connect(this._onSelectionChanged,this),this._onSelectionChanged()}get widgets(){return this._widgets.values()}}const m="FileBrowser";var f;!function(e){e.activate="filebrowser:activate"}(f||(f={}));const _={id:"@jupyter-notebook/tree-extension:new",description:"Plugin to add extra commands to the file browser to create new notebooks, files, consoles and terminals.",requires:[d.ITranslator],optional:[n.IToolbarWidgetRegistry],autoStart:!0,activate:(e,t,o)=>{var n;const{commands:r,serviceManager:i}=e,a=t.load("notebook"),s={overflowMenuOptions:{isVisible:!1}},l=new u.MenuBar(s),d=new u.Menu({commands:r});d.title.label=a.__("New"),d.title.icon=c.caretDownIcon,l.addMenu(d);const g=()=>{var e,t;const o=null===(t=null===(e=i.kernelspecs)||void 0===e?void 0:e.specs)||void 0===t?void 0:t.kernelspecs;for(const e in o)d.addItem({args:{kernelName:e,isLauncher:!0},command:"notebook:create-new"});["terminal:create-new","console:create","filebrowser:create-new-file","filebrowser:create-new-directory"].forEach((e=>{d.addItem({command:e})}))};null===(n=i.kernelspecs)||void 0===n||n.specsChanged.connect((()=>{d.clearItems(),g()})),g(),o&&o.addFactory(m,"new-dropdown",(e=>{const t=new u.MenuBar(s);return t.addMenu(d),t.addClass("jp-DropdownMenu"),t}))}},v={id:"@jupyter-notebook/tree-extension:file-actions",description:"A plugin to add file browser actions to the file browser toolbar.",autoStart:!0,requires:[i.IDefaultFileBrowser,n.IToolbarWidgetRegistry,d.ITranslator],activate:(e,t,o,n)=>{const r=new g.Signal(t);["_selectItem","_handleMultiSelect","handleFileSelect"].forEach((e=>{const o=t.listing[e];t.listing[e]=(...e)=>{o.call(t.listing,...e),r.emit(void 0)}}));const{commands:i}=e,a=new p({commands:i,browser:t,selectionChanged:r,translator:n});for(const e of a.widgets)o.addFactory(m,e.id,(()=>e))}},y={id:"@jupyter-notebook/tree-extension:load-plugins",description:"Plugin to load the default plugins that are loaded on all the Notebook pages (tree, edit, view, etc.) so they are visible in the settings editor.",autoStart:!0,requires:[a.ISettingRegistry],activate(e,t){const{isDisabled:o}=r.PageConfig.Extension,n=t.connector,i=r.PageConfig.getOption("allPlugins");if(!i)return;const a=JSON.parse(i),s=new Set;Object.keys(a).forEach((e=>{const t=a[e];Object.keys(t).forEach((e=>{const o=t[e];"boolean"==typeof o&&o?s.add(e):Array.isArray(o)&&o.forEach((e=>{s.add(e)}))}))})),e.restored.then((async()=>{(await n.list("all")).ids.forEach((async e=>{const[n]=e.split(":");if((s.has(n)||s.has(e))&&!o(e)&&!(e in t.plugins))try{await t.load(e)}catch(t){console.warn(`Settings failed to load for (${e})`,t)}}))}))}},k={id:"@jupyter-notebook/tree-extension:open-file-browser",description:"A plugin to add file browser commands for the tree view.",requires:[w.INotebookTree,i.IDefaultFileBrowser],autoStart:!0,activate:(e,t,o)=>{const{commands:n}=e;n.addCommand(f.activate,{execute:()=>{t.currentWidget=o}})}},S={id:"@jupyter-notebook/tree-extension:widget",description:"A plugin to add the file browser widget to an INotebookShell.",requires:[i.IDefaultFileBrowser,d.ITranslator,a.ISettingRegistry,n.IToolbarWidgetRegistry,i.IFileBrowserFactory],optional:[s.IRunningSessionManagers,l.ISettingEditorTracker,l.IJSONSettingEditorTracker],autoStart:!0,provides:w.INotebookTree,activate:(e,t,o,r,a,l,d,g,u)=>{const h=new w.NotebookTreeWidget,b=o.load("notebook");if(t.title.label=b.__("Files"),t.node.setAttribute("role","region"),t.node.setAttribute("aria-label",b.__("File Browser Section")),t.title.icon=c.folderIcon,h.addWidget(t),h.tabBar.addTab(t.title),h.tabsMovable=!1,a.addFactory(m,"uploader",(e=>new i.Uploader({model:e.model,translator:o,label:b.__("Upload")}))),a.addFactory(m,"fileNameSearcher",(e=>{const t=(0,c.FilenameSearcher)({updateFilter:(t,o)=>{e.model.setFilter((e=>t(e.name.toLowerCase())))},useFuzzyFilter:!0,placeholder:b.__("Filter files by name"),forceRefresh:!0});return t.addClass("jp-FileBrowser-filterBox"),t})),(0,n.setToolbar)(t,(0,n.createToolbarFactory)(a,r,m,S.id,o)),d){const e=new s.RunningSessions(d,o);e.id="jp-running-sessions-tree",e.title.label=b.__("Running"),e.title.icon=c.runningIcon,h.addWidget(e),h.tabBar.addTab(e.title)}const p=r.load("@jupyterlab/filebrowser-extension:browser");Promise.all([p,e.restored]).then((([e])=>{["showFileCheckboxes","showFileSizeColumn","sortNotebooksFirst","showFullPath"].forEach((t=>{void 0===e.user[t]&&e.set(t,!0)}))})).catch((e=>{console.error(e.message)})),e.shell.add(h,"main",{rank:100}),[g,u].forEach((e=>{e&&e.widgetAdded.connect(((e,t)=>{h.addWidget(t),h.tabBar.addTab(t.title),h.currentWidget=t}))}));const{tracker:f}=l,_=()=>{f._pool.current=t};return f.widgetAdded.connect(((e,t)=>_())),_(),h}},F=[_,v,y,k,S]}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[377,5325],{35325:(t,e,n)=>{n.r(e),n.d(e,{HTMLViewer:()=>h,HTMLViewerFactory:()=>m,IHTMLViewerTracker:()=>r,ToolbarItems:()=>o});const r=new(n(20998).Token)("@jupyterlab/htmlviewer:IHTMLViewerTracker","A widget tracker for rendered HTML documents.\n Use this if you want to be able to iterate over and interact with HTML documents\n viewed by the application.");var o,a,s=n(92972),i=n(21733),l=n(31721),u=n(36478),c=n(81997),d=n(78156);class h extends i.DocumentWidget{constructor(t){super({...t,content:new u.IFrame({sandbox:["allow-same-origin"]})}),this._renderPending=!1,this._parser=new DOMParser,this._monitor=null,this._objectUrl="",this._trustedChanged=new c.Signal(this),this.translator=t.translator||l.nullTranslator,this.content.addClass("jp-HTMLViewer"),this.context.ready.then((()=>{this.update(),this._monitor=new s.ActivityMonitor({signal:this.context.model.contentChanged,timeout:1e3}),this._monitor.activityStopped.connect(this.update,this)}))}get trusted(){return-1!==this.content.sandbox.indexOf("allow-scripts")}set trusted(t){this.trusted!==t&&(this.content.sandbox=t?a.trusted:a.untrusted,this.update(),this._trustedChanged.emit(t))}get trustedChanged(){return this._trustedChanged}dispose(){if(this._objectUrl)try{URL.revokeObjectURL(this._objectUrl)}catch(t){}super.dispose()}onUpdateRequest(){this._renderPending||(this._renderPending=!0,this._renderModel().then((()=>this._renderPending=!1)))}async _renderModel(){let t=this.context.model.toString();t=await this._setupDocument(t);const e=new Blob([t],{type:"text/html"}),n=this._objectUrl;if(this._objectUrl=URL.createObjectURL(e),this.content.url=this._objectUrl,n)try{URL.revokeObjectURL(n)}catch(t){}}async _setupDocument(t){const e=this._parser.parseFromString(t,"text/html");let n=e.querySelector("base");n||(n=e.createElement("base"),e.head.insertBefore(n,e.head.firstChild));const r=this.context.path,o=await this.context.urlResolver.getDownloadUrl(r);if(n.href=o,n.target="_self",!this.trusted){const t=this.translator.load("jupyterlab").__("Action disabled as the file is not trusted.");e.body.insertAdjacentHTML("beforeend",`<style>\na[target="_blank"],\narea[target="_blank"],\nform[target="_blank"],\nbutton[formtarget="_blank"],\ninput[formtarget="_blank"][type="image"],\ninput[formtarget="_blank"][type="submit"] {\n cursor: not-allowed !important;\n}\na[target="_blank"]:hover::after,\narea[target="_blank"]:hover::after,\nform[target="_blank"]:hover::after,\nbutton[formtarget="_blank"]:hover::after,\ninput[formtarget="_blank"][type="image"]:hover::after,\ninput[formtarget="_blank"][type="submit"]:hover::after {\n content: "${{warning:t}.warning}";\n box-sizing: border-box;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n z-index: 1000;\n border: 2px solid #e65100;\n background-color: #ffb74d;\n color: black;\n font-family: system-ui, -apple-system, blinkmacsystemfont, 'Segoe UI', helvetica, arial, sans-serif;\n text-align: center;\n}\n</style>`)}return e.documentElement.innerHTML}}class m extends i.ABCWidgetFactory{createNewWidget(t){return new h({context:t})}defaultToolbarFactory(t){return[{name:"refresh",widget:o.createRefreshButton(t,this.translator)},{name:"trust",widget:o.createTrustButton(t,this.translator)}]}}!function(t){t.createRefreshButton=function(t,e){const n=(null!=e?e:l.nullTranslator).load("jupyterlab");return new u.ToolbarButton({icon:u.refreshIcon,onClick:async()=>{t.context.model.dirty||(await t.context.revert(),t.update())},tooltip:n.__("Rerender HTML Document")})},t.createTrustButton=function(t,e){return u.ReactWidget.create(d.createElement(a.TrustButtonComponent,{htmlDocument:t,translator:e}))}}(o||(o={})),function(t){t.untrusted=[],t.trusted=["allow-scripts","allow-popups"],t.TrustButtonComponent=function(t){const e=(t.translator||l.nullTranslator).load("jupyterlab");return d.createElement(u.UseSignal,{signal:t.htmlDocument.trustedChanged,initialSender:t.htmlDocument},(()=>d.createElement(u.ToolbarButtonComponent,{className:"",onClick:()=>t.htmlDocument.trusted=!t.htmlDocument.trusted,tooltip:e.__("Whether the HTML file is trusted.\nTrusting the file allows opening pop-ups and running scripts\nwhich may result in security risks.\nOnly enable for files you trust."),label:t.htmlDocument.trusted?e.__("Distrust HTML"):e.__("Trust HTML")})))}}(a||(a={}))}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[377,5325],{35325:(t,e,n)=>{n.r(e),n.d(e,{HTMLViewer:()=>h,HTMLViewerFactory:()=>m,IHTMLViewerTracker:()=>r,ToolbarItems:()=>o});const r=new(n(20998).Token)("@jupyterlab/htmlviewer:IHTMLViewerTracker","A widget tracker for rendered HTML documents.\n Use this if you want to be able to iterate over and interact with HTML documents\n viewed by the application.");var o,a,s=n(9983),i=n(42782),l=n(60502),u=n(31589),c=n(81997),d=n(78156);class h extends i.DocumentWidget{constructor(t){super({...t,content:new u.IFrame({sandbox:["allow-same-origin"]})}),this._renderPending=!1,this._parser=new DOMParser,this._monitor=null,this._objectUrl="",this._trustedChanged=new c.Signal(this),this.translator=t.translator||l.nullTranslator,this.content.addClass("jp-HTMLViewer"),this.context.ready.then((()=>{this.update(),this._monitor=new s.ActivityMonitor({signal:this.context.model.contentChanged,timeout:1e3}),this._monitor.activityStopped.connect(this.update,this)}))}get trusted(){return-1!==this.content.sandbox.indexOf("allow-scripts")}set trusted(t){this.trusted!==t&&(this.content.sandbox=t?a.trusted:a.untrusted,this.update(),this._trustedChanged.emit(t))}get trustedChanged(){return this._trustedChanged}dispose(){if(this._objectUrl)try{URL.revokeObjectURL(this._objectUrl)}catch(t){}super.dispose()}onUpdateRequest(){this._renderPending||(this._renderPending=!0,this._renderModel().then((()=>this._renderPending=!1)))}async _renderModel(){let t=this.context.model.toString();t=await this._setupDocument(t);const e=new Blob([t],{type:"text/html"}),n=this._objectUrl;if(this._objectUrl=URL.createObjectURL(e),this.content.url=this._objectUrl,n)try{URL.revokeObjectURL(n)}catch(t){}}async _setupDocument(t){const e=this._parser.parseFromString(t,"text/html");let n=e.querySelector("base");n||(n=e.createElement("base"),e.head.insertBefore(n,e.head.firstChild));const r=this.context.path,o=await this.context.urlResolver.getDownloadUrl(r);if(n.href=o,n.target="_self",!this.trusted){const t=this.translator.load("jupyterlab").__("Action disabled as the file is not trusted.");e.body.insertAdjacentHTML("beforeend",`<style>\na[target="_blank"],\narea[target="_blank"],\nform[target="_blank"],\nbutton[formtarget="_blank"],\ninput[formtarget="_blank"][type="image"],\ninput[formtarget="_blank"][type="submit"] {\n cursor: not-allowed !important;\n}\na[target="_blank"]:hover::after,\narea[target="_blank"]:hover::after,\nform[target="_blank"]:hover::after,\nbutton[formtarget="_blank"]:hover::after,\ninput[formtarget="_blank"][type="image"]:hover::after,\ninput[formtarget="_blank"][type="submit"]:hover::after {\n content: "${{warning:t}.warning}";\n box-sizing: border-box;\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n z-index: 1000;\n border: 2px solid #e65100;\n background-color: #ffb74d;\n color: black;\n font-family: system-ui, -apple-system, blinkmacsystemfont, 'Segoe UI', helvetica, arial, sans-serif;\n text-align: center;\n}\n</style>`)}return e.documentElement.innerHTML}}class m extends i.ABCWidgetFactory{createNewWidget(t){return new h({context:t})}defaultToolbarFactory(t){return[{name:"refresh",widget:o.createRefreshButton(t,this.translator)},{name:"trust",widget:o.createTrustButton(t,this.translator)}]}}!function(t){t.createRefreshButton=function(t,e){const n=(null!=e?e:l.nullTranslator).load("jupyterlab");return new u.ToolbarButton({icon:u.refreshIcon,onClick:async()=>{t.context.model.dirty||(await t.context.revert(),t.update())},tooltip:n.__("Rerender HTML Document")})},t.createTrustButton=function(t,e){return u.ReactWidget.create(d.createElement(a.TrustButtonComponent,{htmlDocument:t,translator:e}))}}(o||(o={})),function(t){t.untrusted=[],t.trusted=["allow-scripts","allow-popups"],t.TrustButtonComponent=function(t){const e=(t.translator||l.nullTranslator).load("jupyterlab");return d.createElement(u.UseSignal,{signal:t.htmlDocument.trustedChanged,initialSender:t.htmlDocument},(()=>d.createElement(u.ToolbarButtonComponent,{className:"",onClick:()=>t.htmlDocument.trusted=!t.htmlDocument.trusted,tooltip:e.__("Whether the HTML file is trusted.\nTrusting the file allows opening pop-ups and running scripts\nwhich may result in security risks.\nOnly enable for files you trust."),label:t.htmlDocument.trusted?e.__("Distrust HTML"):e.__("Trust HTML")})))}}(a||(a={}))}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3863],{73863:(e,r,t)=>{t.r(r),t.d(r,{default:()=>i});var n=t(36478);const i=[{id:"@jupyterlab/ui-components-extension:labicon-manager",description:"Provides the icon manager.",provides:n.ILabIconManager,autoStart:!0,activate:e=>Object.create(null)},{id:"@jupyterlab/ui-components-extension:form-renderer-registry",description:"Provides the settings form renderer registry.",provides:n.IFormRendererRegistry,autoStart:!0,activate:e=>new n.FormRendererRegistry}]}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3863],{73863:(e,r,t)=>{t.r(r),t.d(r,{default:()=>i});var n=t(31589);const i=[{id:"@jupyterlab/ui-components-extension:labicon-manager",description:"Provides the icon manager.",provides:n.ILabIconManager,autoStart:!0,activate:e=>Object.create(null)},{id:"@jupyterlab/ui-components-extension:form-renderer-registry",description:"Provides the settings form renderer registry.",provides:n.IFormRendererRegistry,autoStart:!0,activate:e=>new n.FormRendererRegistry}]}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3881],{92871:(e,t,a)=>{a.r(t),a.d(t,{DEFAULT_CONTEXT_ITEM_RANK:()=>f,default:()=>D});var o=a(11510),i=a(23051),n=a(92972),r=a(10702),l=a(13532),s=a(91077),d=a(56653),c=a(31721),u=a(36478),p=a(33625),g=a(20998),m=a(16934),b=a(2549),h=a(63485),v=a(78156);const y={id:"@jupyterlab/application-extension:top-bar",description:"Adds a toolbar to the top area (next to the main menu bar).",autoStart:!0,requires:[l.ISettingRegistry,i.IToolbarWidgetRegistry],optional:[c.ITranslator],activate:(e,t,a,o)=>{const n=new u.Toolbar;n.id="jp-top-bar",(0,i.setToolbar)(n,(0,i.createToolbarFactory)(a,t,"TopBar",y.id,null!=o?o:c.nullTranslator),n),e.shell.add(n,"top",{rank:900})}},f=100;var _;!function(e){e.activateNextTab="application:activate-next-tab",e.activatePreviousTab="application:activate-previous-tab",e.activateNextTabBar="application:activate-next-tab-bar",e.activatePreviousTabBar="application:activate-previous-tab-bar",e.close="application:close",e.closeOtherTabs="application:close-other-tabs",e.closeRightTabs="application:close-right-tabs",e.closeAll="application:close-all",e.setMode="application:set-mode",e.showPropertyPanel="property-inspector:show-panel",e.resetLayout="application:reset-layout",e.toggleHeader="application:toggle-header",e.toggleMode="application:toggle-mode",e.toggleLeftArea="application:toggle-left-area",e.toggleRightArea="application:toggle-right-area",e.toggleSideTabBar="application:toggle-side-tabbar",e.toggleSidebarWidget="application:toggle-sidebar-widget",e.togglePresentationMode="application:toggle-presentation-mode",e.tree="router:tree",e.switchSidebar="sidebar:switch"}(_||(_={}));const x={id:"@jupyterlab/application-extension:commands",description:"Adds commands related to the shell.",autoStart:!0,requires:[c.ITranslator],optional:[o.ILabShell,i.ICommandPalette],activate:(e,t,a,i)=>{const{commands:r,shell:l}=e,s=t.load("jupyterlab"),d=s.__("Main Area");r.addCommand(o.JupyterFrontEndContextMenu.contextMenu,{label:s.__("Shift+Right Click for Browser Menu"),isEnabled:()=>!1,execute:()=>{}});const c=()=>{const t=e.contextMenuHitTest((e=>!!e.dataset.id));return t&&(0,p.find)(l.widgets("main"),(e=>e.id===t.dataset.id))||l.currentWidget},u=(e,t)=>{if("tab-area"===e.type)return e.widgets.includes(t)?e:null;if("split-area"===e.type)for(const a of e.children){const e=u(a,t);if(e)return e}return null},g=e=>{const{id:t}=e,o=(e=>{var t;const o=null==a?void 0:a.saveLayout(),i=null==o?void 0:o.mainArea;if(!i||"multiple-document"!==n.PageConfig.getOption("mode"))return null;const r=null===(t=i.dock)||void 0===t?void 0:t.main;return r?u(r,e):null})(e),i=o&&o.widgets||[],r=i.findIndex((e=>e.id===t));return r<0?[]:i.slice(r+1)};function m(e){e&&e.focus()}r.addCommand(_.close,{label:()=>s.__("Close Tab"),isEnabled:()=>{const e=c();return!!e&&e.title.closable},execute:()=>{const e=c();e&&e.close()}}),r.addCommand(_.closeOtherTabs,{label:()=>s.__("Close All Other Tabs"),isEnabled:()=>(0,p.some)(l.widgets("main"),((e,t)=>1===t)),execute:()=>{const e=c();if(!e)return;const{id:t}=e;for(const e of l.widgets("main"))e.id!==t&&e.close()}}),r.addCommand(_.closeRightTabs,{label:()=>s.__("Close Tabs to Right"),isEnabled:()=>!!c()&&g(c()).length>0,execute:()=>{const e=c();e&&g(e).forEach((e=>e.close()))}}),a&&(r.addCommand(_.activateNextTab,{label:s.__("Activate Next Tab"),execute:()=>{a.activateNextTab()}}),r.addCommand(_.activatePreviousTab,{label:s.__("Activate Previous Tab"),execute:()=>{a.activatePreviousTab()}}),r.addCommand(_.activateNextTabBar,{label:s.__("Activate Next Tab Bar"),execute:()=>{a.activateNextTabBar()}}),r.addCommand(_.activatePreviousTabBar,{label:s.__("Activate Previous Tab Bar"),execute:()=>{a.activatePreviousTabBar()}}),r.addCommand(_.closeAll,{label:s.__("Close All Tabs"),execute:()=>{a.closeAll()}}),r.addCommand(_.toggleHeader,{label:s.__("Show Header"),execute:()=>{"single-document"===a.mode&&a.toggleTopInSimpleModeVisibility()},isToggled:()=>a.isTopInSimpleModeVisible(),isVisible:()=>"single-document"===a.mode}),r.addCommand(_.toggleLeftArea,{label:s.__("Show Left Sidebar"),execute:()=>{a.leftCollapsed?a.expandLeft():(a.collapseLeft(),a.currentWidget&&a.activateById(a.currentWidget.id))},isToggled:()=>!a.leftCollapsed,isEnabled:()=>!a.isEmpty("left")}),r.addCommand(_.toggleRightArea,{label:s.__("Show Right Sidebar"),execute:()=>{a.rightCollapsed?a.expandRight():(a.collapseRight(),a.currentWidget&&a.activateById(a.currentWidget.id))},isToggled:()=>!a.rightCollapsed,isEnabled:()=>!a.isEmpty("right")}),r.addCommand(_.toggleSidebarWidget,{label:s.__("Toggle Sidebar Element"),execute:e=>{const t=parseInt(e.index,10);if("left"!=e.side&&"right"!=e.side)throw Error(`Unsupported sidebar: ${e.side}`);const o=Array.from(a.widgets(e.side));if(t>=o.length)return;const i=o[t].id,n=document.querySelector("[data-id='"+i+"']");(e=>{let t;if("left"!=e&&"right"!=e)throw Error(`Unsupported sidebar: ${e}`);if("left"===e)t=document.querySelector(".lm-TabBar-tab.lm-mod-current");else{const e=document.querySelectorAll(".lm-TabBar-tab.lm-mod-current");t=e[e.length-1]}const a=null==t?void 0:t.getAttribute("data-id");return a?null==a?void 0:a.toString():""})(e.side)===i?("left"==e.side&&(a.collapseLeft(),m(n)),"right"==e.side&&(a.collapseRight(),m(n))):(a.activateById(i),m(n))}}),r.addCommand(_.toggleSideTabBar,{label:e=>"right"===e.side?s.__("Show Right Activity Bar"):s.__("Show Left Activity Bar"),execute:e=>{"right"===e.side?a.toggleSideTabBarVisibility("right"):a.toggleSideTabBarVisibility("left")},isToggled:e=>"right"===e.side?a.isSideTabBarVisible("right"):a.isSideTabBarVisible("left"),isEnabled:e=>"right"===e.side?!a.isEmpty("right"):!a.isEmpty("left")}),r.addCommand(_.togglePresentationMode,{label:()=>s.__("Presentation Mode"),execute:()=>{a.presentationMode=!a.presentationMode},isToggled:()=>a.presentationMode,isVisible:()=>!0}),r.addCommand(_.setMode,{label:e=>e.mode?s.__("Set %1 mode.",e.mode):s.__("Set the layout `mode`."),caption:s.__('The layout `mode` can be "single-document" or "multiple-document".'),isVisible:e=>{const t=e.mode;return"single-document"===t||"multiple-document"===t},execute:e=>{const t=e.mode;if("single-document"!==t&&"multiple-document"!==t)throw new Error(`Unsupported application shell mode: ${t}`);a.mode=t}}),r.addCommand(_.toggleMode,{label:s.__("Simple Interface"),isToggled:()=>"single-document"===a.mode,execute:()=>{const e="multiple-document"===a.mode?{mode:"single-document"}:{mode:"multiple-document"};return r.execute(_.setMode,e)}}),r.addCommand(_.resetLayout,{label:s.__("Reset Default Layout"),execute:()=>{a.presentationMode&&r.execute(_.togglePresentationMode).catch((e=>{console.error("Failed to undo presentation mode.",e)})),"single-document"!==a.mode||a.isTopInSimpleModeVisible()||r.execute(_.toggleHeader).catch((e=>{console.error("Failed to display title header.",e)})),["left","right"].forEach((e=>{a.isSideTabBarVisible(e)||a.isEmpty(e)||r.execute(_.toggleSideTabBar,{side:e}).catch((t=>{console.error(`Failed to show ${e} activity bar.`,t)}))}))}})),i&&([_.activateNextTab,_.activatePreviousTab,_.activateNextTabBar,_.activatePreviousTabBar,_.close,_.closeAll,_.closeOtherTabs,_.closeRightTabs,_.toggleHeader,_.toggleLeftArea,_.toggleRightArea,_.togglePresentationMode,_.toggleMode,_.resetLayout].forEach((e=>i.addItem({command:e,category:d}))),["right","left"].forEach((e=>{i.addItem({command:_.toggleSideTabBar,category:d,args:{side:e}})})))}},S={id:"@jupyterlab/application-extension:main",description:"Initializes the application and provides the URL tree path handler.",requires:[o.IRouter,i.IWindowResolver,c.ITranslator,o.JupyterFrontEnd.ITreeResolver],optional:[o.IConnectionLost],provides:o.ITreePathUpdater,activate:(e,t,a,r,l,s)=>{const d=r.load("jupyterlab");if(!(e instanceof o.JupyterLab))throw new Error(`${S.id} must be activated in JupyterLab.`);let c="",u="";const p=a.name;if(console.debug(`Starting application in workspace: "${p}"`),0!==e.registerPluginErrors.length){const t=v.createElement("pre",null,e.registerPluginErrors.map((e=>e.message)).join("\n"));(0,i.showErrorMessage)(d.__("Error Registering Plugins"),{message:t})}e.shell.layoutModified.connect((()=>{e.commands.notifyCommandChanged()})),e.shell.modeChanged.connect(((e,a)=>{const o=n.PageConfig.getUrl({mode:a}),i=n.URLExt.parse(o).pathname;t.navigate(i,{skipRouting:!0}),n.PageConfig.setOption("mode",a)})),l.paths.then((()=>{e.shell.currentPathChanged.connect(((e,a)=>{const o=a.newValue,i=o||u,r=n.PageConfig.getUrl({treePath:i}),l=n.URLExt.parse(r).pathname;t.navigate(l,{skipRouting:!0}),n.PageConfig.setOption("treePath",i),c=o}))})),s=s||o.ConnectionLost,e.serviceManager.connectionFailure.connect(((e,t)=>s(e,t,r)));const g=e.serviceManager.builder,m=()=>g.build().then((()=>(0,i.showDialog)({title:d.__("Build Complete"),body:v.createElement("div",null,d.__("Build successfully completed, reload page?"),v.createElement("br",null),d.__("You will lose any unsaved changes.")),buttons:[i.Dialog.cancelButton({label:d.__("Reload Without Saving"),actions:["reload"]}),i.Dialog.okButton({label:d.__("Save and Reload")})],hasClose:!0}))).then((({button:{accept:a,actions:o}})=>{a?e.commands.execute("docmanager:save").then((()=>{t.reload()})).catch((e=>{(0,i.showErrorMessage)(d.__("Save Failed"),{message:v.createElement("pre",null,e.message)})})):o.includes("reload")&&t.reload()})).catch((e=>{(0,i.showErrorMessage)(d.__("Build Failed"),{message:v.createElement("pre",null,e.message)})}));return g.isAvailable&&g.shouldCheck&&g.getStatus().then((e=>{if("building"===e.status)return m();if("needed"!==e.status)return;const t=v.createElement("div",null,d.__("JupyterLab build is suggested:"),v.createElement("br",null),v.createElement("pre",null,e.message));(0,i.showDialog)({title:d.__("Build Recommended"),body:t,buttons:[i.Dialog.cancelButton(),i.Dialog.okButton({label:d.__("Build")})]}).then((e=>e.button.accept?m():void 0))})),function(e){l.paths.then((()=>{if(u=e,!c){const a=n.PageConfig.getUrl({treePath:e}),o=n.URLExt.parse(a).pathname;t.navigate(o,{skipRouting:!0}),n.PageConfig.setOption("treePath",e)}}))}},autoStart:!0},w={id:"@jupyterlab/application-extension:context-menu",description:"Populates the context menu.",autoStart:!0,requires:[l.ISettingRegistry,c.ITranslator],activate:(e,t,a)=>{const o=a.load("jupyterlab");function i(t){const a=new u.RankedMenu({...t,commands:e.commands});return t.label&&(a.title.label=o.__(t.label)),a}e.started.then((()=>O.loadSettingsContextMenu(e.contextMenu,t,i,a))).catch((e=>{console.error("Failed to load context menu items from settings registry.",e)}))}},T={id:"@jupyterlab/application-extension:dirty",description:"Adds safeguard dialog when closing the browser tab with unsaved modifications.",autoStart:!0,requires:[c.ITranslator],activate:(e,t)=>{if(!(e instanceof o.JupyterLab))throw new Error(`${T.id} must be activated in JupyterLab.`);const a=t.load("jupyterlab").__("Are you sure you want to exit JupyterLab?\n\nAny unsaved changes will be lost.");window.addEventListener("beforeunload",(t=>{if(e.status.isDirty)return t.returnValue=a}))}},I={id:"@jupyterlab/application-extension:layout",description:"Provides the shell layout restorer.",requires:[s.IStateDB,o.ILabShell,l.ISettingRegistry],optional:[c.ITranslator],activate:(e,t,a,r,l)=>{const s=(null!=l?l:c.nullTranslator).load("jupyterlab"),d=e.started,u=e.commands,p=n.PageConfig.getOption("mode"),m=new o.LayoutRestorer({connector:t,first:d,registry:u,mode:p});return r.load(R.id).then((t=>{var o,i;const n=t.composite.layout;a.restoreLayout(p,m,{"multiple-document":null!==(o=n.multiple)&&void 0!==o?o:{},"single-document":null!==(i=n.single)&&void 0!==i?i:{}}).then((()=>{a.layoutModified.connect((()=>{m.save(a.saveLayout())})),t.changed.connect(b),O.activateSidebarSwitcher(e,a,t,s)}))})).catch((e=>{console.error("Fail to load settings for the layout restorer."),console.error(e)})),m;async function b(e){g.JSONExt.deepEqual(e.composite.layout,{single:a.userLayout["single-document"],multiple:a.userLayout["multiple-document"]})||(await(0,i.showDialog)({title:s.__("Information"),body:s.__("User layout customization has changed. You may need to reload JupyterLab to see the changes."),buttons:[i.Dialog.cancelButton(),i.Dialog.okButton({label:s.__("Reload")})]})).button.accept&&location.reload()}},autoStart:!0,provides:o.ILayoutRestorer},E={id:"@jupyterlab/application-extension:router",description:"Provides the URL router",requires:[o.JupyterFrontEnd.IPaths],activate:(e,t)=>{const{commands:a}=e,i=t.urls.base,n=new o.Router({base:i,commands:a});return e.started.then((()=>{n.route(),window.addEventListener("popstate",(()=>{n.route()}))})),n},autoStart:!0,provides:o.IRouter},C={id:"@jupyterlab/application-extension:tree-resolver",description:"Provides the tree route resolver",autoStart:!0,requires:[o.IRouter],provides:o.JupyterFrontEnd.ITreeResolver,activate:(e,t)=>{const{commands:a}=e,o=new b.DisposableSet,i=new g.PromiseDelegate,r=new RegExp("/(lab|doc)(/workspaces/[a-zA-Z0-9-_]+)?(/tree/.*)?");o.add(a.addCommand(_.tree,{execute:async e=>{var t;if(o.isDisposed)return;const a=n.URLExt.queryStringToObject(null!==(t=e.search)&&void 0!==t?t:""),r=a["file-browser-path"]||"";delete a["file-browser-path"],o.dispose(),i.resolve({browser:r,file:n.PageConfig.getOption("treePath")})}})),o.add(t.register({command:_.tree,pattern:r}));const l=()=>{o.isDisposed||(o.dispose(),i.resolve(null))};return t.routed.connect(l),o.add(new b.DisposableDelegate((()=>{t.routed.disconnect(l)}))),{paths:i.promise}}},P={id:"@jupyterlab/application-extension:notfound",description:"Defines the behavior for not found URL (aka route).",requires:[o.JupyterFrontEnd.IPaths,o.IRouter,c.ITranslator],activate:(e,t,a,o)=>{const n=o.load("jupyterlab"),r=t.urls.notFound;if(!r)return;const l=a.base,s=n.__("The path: %1 was not found. JupyterLab redirected to: %2",r,l);a.navigate(""),(0,i.showErrorMessage)(n.__("Path Not Found"),{message:s})},autoStart:!0},L={id:"@jupyterlab/application-extension:faviconbusy",description:"Handles the favicon depending on the application status.",requires:[o.ILabStatus],activate:async(e,t)=>{t.busySignal.connect(((e,t)=>{const a=document.querySelector('link[rel="icon"]'+(t?".idle.favicon":".busy.favicon"));if(!a)return;const o=document.querySelector("link"+(t?".busy.favicon":".idle.favicon"));o&&a!==o&&(a.rel="",o.rel="icon",o.parentNode.replaceChild(o,o))}))},autoStart:!0},R={id:"@jupyterlab/application-extension:shell",description:"Provides the JupyterLab shell. It has an extended API compared to `app.shell`.",optional:[l.ISettingRegistry],activate:(e,t)=>{if(!(e.shell instanceof o.LabShell))throw new Error(`${R.id} did not find a LabShell instance.`);return t&&t.load(R.id).then((t=>{e.shell.updateConfig(t.composite),t.changed.connect((()=>{e.shell.updateConfig(t.composite)}))})),e.shell},autoStart:!0,provides:o.ILabShell},B={id:"@jupyterlab/application-extension:status",description:"Provides the application status.",activate:e=>{if(!(e instanceof o.JupyterLab))throw new Error(`${B.id} must be activated in JupyterLab.`);return e.status},autoStart:!0,provides:o.ILabStatus},M={id:"@jupyterlab/application-extension:info",description:"Provides the application information.",activate:e=>{if(!(e instanceof o.JupyterLab))throw new Error(`${M.id} must be activated in JupyterLab.`);return e.info},autoStart:!0,provides:o.JupyterLab.IInfo},j={id:"@jupyterlab/application-extension:paths",description:"Provides the application paths.",activate:e=>{if(!(e instanceof o.JupyterLab))throw new Error(`${j.id} must be activated in JupyterLab.`);return e.paths},autoStart:!0,provides:o.JupyterFrontEnd.IPaths},A={id:"@jupyterlab/application-extension:property-inspector",description:"Provides the property inspector.",autoStart:!0,requires:[o.ILabShell,c.ITranslator],optional:[o.ILayoutRestorer],provides:r.IPropertyInspectorProvider,activate:(e,t,a,o)=>{const i=a.load("jupyterlab"),n=new r.SideBarPropertyInspectorProvider({shell:t,translator:a});return n.title.icon=u.buildIcon,n.title.caption=i.__("Property Inspector"),n.id="jp-property-inspector",t.add(n,"right",{rank:100,type:"Property Inspector"}),e.commands.addCommand(_.showPropertyPanel,{label:i.__("Property Inspector"),execute:()=>{t.activateById(n.id)}}),o&&o.add(n,"jp-property-inspector"),n}},k={id:"@jupyterlab/application-extension:logo",description:"Sets the application logo.",autoStart:!0,requires:[o.ILabShell],activate:(e,t)=>{const a=new h.Widget;u.jupyterIcon.element({container:a.node,elementPosition:"center",margin:"2px 2px 2px 8px",height:"auto",width:"16px"}),a.id="jp-MainLogo",t.add(a,"top",{rank:0})}},J={id:"@jupyterlab/application-extension:mode-switch",description:"Adds the interface mode switch",requires:[o.ILabShell,c.ITranslator],optional:[d.IStatusBar,l.ISettingRegistry],activate:(e,t,a,o,i)=>{if(null===o)return;const n=a.load("jupyterlab"),r=new u.Switch;if(r.id="jp-single-document-mode",r.valueChanged.connect(((e,a)=>{t.mode=a.newValue?"single-document":"multiple-document"})),t.modeChanged.connect(((e,t)=>{r.value="single-document"===t})),i){const a=i.load(R.id),o=e=>{const a=e.get("startMode").composite;a&&(t.mode="single"===a?"single-document":"multiple-document")};Promise.all([a,e.restored]).then((([e])=>{o(e)})).catch((e=>{console.error(e.message)}))}const l=()=>{const t=e.commands.keyBindings.find((e=>"application:toggle-mode"===e.command));if(t){const e=t.keys.map(m.CommandRegistry.formatKeystroke).join(", ");r.caption=n.__("Simple Interface (%1)",e)}else r.caption=n.__("Simple Interface")};l(),e.commands.keyBindingChanged.connect((()=>{l()})),r.label=n.__("Simple"),o.registerStatusItem(J.id,{priority:1,item:r,align:"left",rank:-1})},autoStart:!0},D=[w,T,S,x,I,E,C,P,L,R,B,M,J,j,A,k,y];var O;!function(e){async function t(e){(await(0,i.showDialog)({title:e.__("Information"),body:e.__("Context menu customization has changed. You will need to reload JupyterLab to see the changes."),buttons:[i.Dialog.cancelButton(),i.Dialog.okButton({label:e.__("Reload")})]})).button.accept&&location.reload()}e.loadSettingsContextMenu=async function(e,a,o,n){var r;const s=n.load("jupyterlab"),d=w.id;let c=null,u={};function p(e){var t,o;u={};const i=Object.keys(a.plugins).map((e=>{var t,o;const i=null!==(o=null===(t=a.plugins[e].schema["jupyter.lab.menus"])||void 0===t?void 0:t.context)&&void 0!==o?o:[];return u[e]=i,i})).concat([null!==(o=null===(t=e["jupyter.lab.menus"])||void 0===t?void 0:t.context)&&void 0!==o?o:[]]).reduceRight(((e,t)=>l.SettingRegistry.reconcileItems(e,t,!0)),[]);e.properties.contextMenu.default=l.SettingRegistry.reconcileItems(i,e.properties.contextMenu.default,!0).sort(((e,t)=>{var a,o;return(null!==(a=e.rank)&&void 0!==a?a:1/0)-(null!==(o=t.rank)&&void 0!==o?o:1/0)}))}a.transform(d,{compose:e=>{var t,a,o,i;c||(c=g.JSONExt.deepCopy(e.schema),p(c));const n=null!==(o=null===(a=null===(t=c.properties)||void 0===t?void 0:t.contextMenu)||void 0===a?void 0:a.default)&&void 0!==o?o:[],r={...e.data.user,contextMenu:null!==(i=e.data.user.contextMenu)&&void 0!==i?i:[]},s={...e.data.composite,contextMenu:l.SettingRegistry.reconcileItems(n,r.contextMenu,!1)};return e.data={composite:s,user:r},e},fetch:e=>(c||(c=g.JSONExt.deepCopy(e.schema),p(c)),{data:e.data,id:e.id,raw:e.raw,schema:c,version:e.version})});const m=await a.load(d),b=null!==(r=m.composite.contextMenu)&&void 0!==r?r:[];l.SettingRegistry.filterDisabledItems(b).forEach((t=>{i.MenuFactory.addContextItem({rank:f,...t},e,o)})),m.changed.connect((()=>{var e;const a=null!==(e=m.composite.contextMenu)&&void 0!==e?e:[];g.JSONExt.deepEqual(b,a)||t(s)})),a.pluginChanged.connect((async(n,r)=>{var c,p,m,h;if(r!==d){const n=null!==(c=u[r])&&void 0!==c?c:[],d=null!==(m=null===(p=a.plugins[r].schema["jupyter.lab.menus"])||void 0===p?void 0:p.context)&&void 0!==m?m:[];if(!g.JSONExt.deepEqual(n,d))if(u[r])await t(s);else{u[r]=g.JSONExt.deepCopy(d);const t=null!==(h=l.SettingRegistry.reconcileItems(d,b,!1,!1))&&void 0!==h?h:[];l.SettingRegistry.filterDisabledItems(t).forEach((t=>{i.MenuFactory.addContextItem({rank:f,...t},e,o)}))}}}))},e.activateSidebarSwitcher=function(e,t,a,o){e.commands.addCommand(_.switchSidebar,{label:o.__("Switch Sidebar Side"),execute:()=>{const o=e.contextMenuHitTest((e=>!!e.dataset.id));if(!o)return;const i=o.dataset.id,n=document.getElementById("jp-left-stack"),r=document.getElementById(i);let l=null;if(n&&r&&n.contains(r)){const e=(0,p.find)(t.widgets("left"),(e=>e.id===i));e&&(l=t.move(e,"right"),t.activateById(e.id))}else{const e=(0,p.find)(t.widgets("right"),(e=>e.id===i));e&&(l=t.move(e,"left"),t.activateById(e.id))}l&&a.set("layout",{single:l["single-document"],multiple:l["multiple-document"]}).catch((e=>{console.error("Failed to save user layout customization.",e)}))}}),e.commands.commandExecuted.connect(((e,t)=>{t.id===_.resetLayout&&a.remove("layout").catch((e=>{console.error("Failed to remove user layout customization.",e)}))}))}}(O||(O={}))}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3881],{92871:(e,t,a)=>{a.r(t),a.d(t,{DEFAULT_CONTEXT_ITEM_RANK:()=>f,default:()=>D});var o=a(25007),i=a(95297),n=a(9983),r=a(22964),l=a(2277),s=a(12287),d=a(47568),c=a(60502),u=a(31589),p=a(33625),g=a(20998),m=a(16934),b=a(2549),h=a(63485),v=a(78156);const y={id:"@jupyterlab/application-extension:top-bar",description:"Adds a toolbar to the top area (next to the main menu bar).",autoStart:!0,requires:[l.ISettingRegistry,i.IToolbarWidgetRegistry],optional:[c.ITranslator],activate:(e,t,a,o)=>{const n=new u.Toolbar;n.id="jp-top-bar",(0,i.setToolbar)(n,(0,i.createToolbarFactory)(a,t,"TopBar",y.id,null!=o?o:c.nullTranslator),n),e.shell.add(n,"top",{rank:900})}},f=100;var _;!function(e){e.activateNextTab="application:activate-next-tab",e.activatePreviousTab="application:activate-previous-tab",e.activateNextTabBar="application:activate-next-tab-bar",e.activatePreviousTabBar="application:activate-previous-tab-bar",e.close="application:close",e.closeOtherTabs="application:close-other-tabs",e.closeRightTabs="application:close-right-tabs",e.closeAll="application:close-all",e.setMode="application:set-mode",e.showPropertyPanel="property-inspector:show-panel",e.resetLayout="application:reset-layout",e.toggleHeader="application:toggle-header",e.toggleMode="application:toggle-mode",e.toggleLeftArea="application:toggle-left-area",e.toggleRightArea="application:toggle-right-area",e.toggleSideTabBar="application:toggle-side-tabbar",e.toggleSidebarWidget="application:toggle-sidebar-widget",e.togglePresentationMode="application:toggle-presentation-mode",e.tree="router:tree",e.switchSidebar="sidebar:switch"}(_||(_={}));const x={id:"@jupyterlab/application-extension:commands",description:"Adds commands related to the shell.",autoStart:!0,requires:[c.ITranslator],optional:[o.ILabShell,i.ICommandPalette],activate:(e,t,a,i)=>{var r;const{commands:l,shell:s}=e,d=t.load("jupyterlab"),c=d.__("Main Area");l.addCommand(o.JupyterFrontEndContextMenu.contextMenu,{label:d.__("Shift+Right Click for Browser Menu"),isEnabled:()=>!1,execute:()=>{}});const u=()=>{const t=e.contextMenuHitTest((e=>!!e.dataset.id));return t&&(0,p.find)(s.widgets("main"),(e=>e.id===t.dataset.id))||s.currentWidget},g=(e,t)=>{if("tab-area"===e.type)return e.widgets.includes(t)?e:null;if("split-area"===e.type)for(const a of e.children){const e=g(a,t);if(e)return e}return null},m=e=>{const{id:t}=e,o=(e=>{var t;const o=null==a?void 0:a.saveLayout(),i=null==o?void 0:o.mainArea;if(!i||"multiple-document"!==n.PageConfig.getOption("mode"))return null;const r=null===(t=i.dock)||void 0===t?void 0:t.main;return r?g(r,e):null})(e),i=o&&o.widgets||[],r=i.findIndex((e=>e.id===t));return r<0?[]:i.slice(r+1)};function b(e){e&&e.focus()}l.addCommand(_.close,{label:()=>d.__("Close Tab"),isEnabled:()=>{const e=u();return!!e&&e.title.closable},execute:()=>{const e=u();e&&e.close()}}),l.addCommand(_.closeOtherTabs,{label:()=>d.__("Close All Other Tabs"),isEnabled:()=>(0,p.some)(s.widgets("main"),((e,t)=>1===t)),execute:()=>{const e=u();if(!e)return;const{id:t}=e;for(const e of s.widgets("main"))e.id!==t&&e.close()}}),l.addCommand(_.closeRightTabs,{label:()=>d.__("Close Tabs to Right"),isEnabled:()=>!!u()&&m(u()).length>0,execute:()=>{const e=u();e&&m(e).forEach((e=>e.close()))}}),null===(r=s.currentChanged)||void 0===r||r.connect((()=>{[_.close,_.closeOtherTabs,_.closeRightTabs].forEach((e=>l.notifyCommandChanged(e)))})),a&&(l.addCommand(_.activateNextTab,{label:d.__("Activate Next Tab"),execute:()=>{a.activateNextTab()}}),l.addCommand(_.activatePreviousTab,{label:d.__("Activate Previous Tab"),execute:()=>{a.activatePreviousTab()}}),l.addCommand(_.activateNextTabBar,{label:d.__("Activate Next Tab Bar"),execute:()=>{a.activateNextTabBar()}}),l.addCommand(_.activatePreviousTabBar,{label:d.__("Activate Previous Tab Bar"),execute:()=>{a.activatePreviousTabBar()}}),l.addCommand(_.closeAll,{label:d.__("Close All Tabs"),execute:()=>{a.closeAll()}}),l.addCommand(_.toggleHeader,{label:d.__("Show Header"),execute:()=>{"single-document"===a.mode&&a.toggleTopInSimpleModeVisibility()},isToggled:()=>a.isTopInSimpleModeVisible(),isVisible:()=>"single-document"===a.mode}),l.addCommand(_.toggleLeftArea,{label:d.__("Show Left Sidebar"),execute:()=>{a.leftCollapsed?a.expandLeft():(a.collapseLeft(),a.currentWidget&&a.activateById(a.currentWidget.id))},isToggled:()=>!a.leftCollapsed,isEnabled:()=>!a.isEmpty("left")}),l.addCommand(_.toggleRightArea,{label:d.__("Show Right Sidebar"),execute:()=>{a.rightCollapsed?a.expandRight():(a.collapseRight(),a.currentWidget&&a.activateById(a.currentWidget.id))},isToggled:()=>!a.rightCollapsed,isEnabled:()=>!a.isEmpty("right")}),l.addCommand(_.toggleSidebarWidget,{label:d.__("Toggle Sidebar Element"),execute:e=>{const t=parseInt(e.index,10);if("left"!=e.side&&"right"!=e.side)throw Error(`Unsupported sidebar: ${e.side}`);const o=Array.from(a.widgets(e.side));if(t>=o.length)return;const i=o[t].id,n=document.querySelector("[data-id='"+i+"']");(e=>{let t;if("left"!=e&&"right"!=e)throw Error(`Unsupported sidebar: ${e}`);if("left"===e)t=document.querySelector(".lm-TabBar-tab.lm-mod-current");else{const e=document.querySelectorAll(".lm-TabBar-tab.lm-mod-current");t=e[e.length-1]}const a=null==t?void 0:t.getAttribute("data-id");return a?null==a?void 0:a.toString():""})(e.side)===i?("left"==e.side&&(a.collapseLeft(),b(n)),"right"==e.side&&(a.collapseRight(),b(n))):(a.activateById(i),b(n))}}),l.addCommand(_.toggleSideTabBar,{label:e=>"right"===e.side?d.__("Show Right Activity Bar"):d.__("Show Left Activity Bar"),execute:e=>{"right"===e.side?a.toggleSideTabBarVisibility("right"):a.toggleSideTabBarVisibility("left")},isToggled:e=>"right"===e.side?a.isSideTabBarVisible("right"):a.isSideTabBarVisible("left"),isEnabled:e=>"right"===e.side?!a.isEmpty("right"):!a.isEmpty("left")}),l.addCommand(_.togglePresentationMode,{label:()=>d.__("Presentation Mode"),execute:()=>{a.presentationMode=!a.presentationMode},isToggled:()=>a.presentationMode,isVisible:()=>!0}),l.addCommand(_.setMode,{label:e=>e.mode?d.__("Set %1 mode.",e.mode):d.__("Set the layout `mode`."),caption:d.__('The layout `mode` can be "single-document" or "multiple-document".'),isVisible:e=>{const t=e.mode;return"single-document"===t||"multiple-document"===t},execute:e=>{const t=e.mode;if("single-document"!==t&&"multiple-document"!==t)throw new Error(`Unsupported application shell mode: ${t}`);a.mode=t}}),l.addCommand(_.toggleMode,{label:d.__("Simple Interface"),isToggled:()=>"single-document"===a.mode,execute:()=>{const e="multiple-document"===a.mode?{mode:"single-document"}:{mode:"multiple-document"};return l.execute(_.setMode,e)}}),l.addCommand(_.resetLayout,{label:d.__("Reset Default Layout"),execute:()=>{a.presentationMode&&l.execute(_.togglePresentationMode).catch((e=>{console.error("Failed to undo presentation mode.",e)})),"single-document"!==a.mode||a.isTopInSimpleModeVisible()||l.execute(_.toggleHeader).catch((e=>{console.error("Failed to display title header.",e)})),["left","right"].forEach((e=>{a.isSideTabBarVisible(e)||a.isEmpty(e)||l.execute(_.toggleSideTabBar,{side:e}).catch((t=>{console.error(`Failed to show ${e} activity bar.`,t)}))}))}})),i&&([_.activateNextTab,_.activatePreviousTab,_.activateNextTabBar,_.activatePreviousTabBar,_.close,_.closeAll,_.closeOtherTabs,_.closeRightTabs,_.toggleHeader,_.toggleLeftArea,_.toggleRightArea,_.togglePresentationMode,_.toggleMode,_.resetLayout].forEach((e=>i.addItem({command:e,category:c}))),["right","left"].forEach((e=>{i.addItem({command:_.toggleSideTabBar,category:c,args:{side:e}})})))}},S={id:"@jupyterlab/application-extension:main",description:"Initializes the application and provides the URL tree path handler.",requires:[o.IRouter,i.IWindowResolver,c.ITranslator,o.JupyterFrontEnd.ITreeResolver],optional:[o.IConnectionLost],provides:o.ITreePathUpdater,activate:(e,t,a,r,l,s)=>{const d=r.load("jupyterlab");if(!(e instanceof o.JupyterLab))throw new Error(`${S.id} must be activated in JupyterLab.`);let c="",u="";const p=a.name;if(console.debug(`Starting application in workspace: "${p}"`),0!==e.registerPluginErrors.length){const t=v.createElement("pre",null,e.registerPluginErrors.map((e=>e.message)).join("\n"));(0,i.showErrorMessage)(d.__("Error Registering Plugins"),{message:t})}e.shell.modeChanged.connect(((e,a)=>{const o=n.PageConfig.getUrl({mode:a}),i=n.URLExt.parse(o).pathname;t.navigate(i,{skipRouting:!0}),n.PageConfig.setOption("mode",a)})),l.paths.then((()=>{e.shell.currentPathChanged.connect(((e,a)=>{const o=a.newValue,i=o||u,r=n.PageConfig.getUrl({treePath:i}),l=n.URLExt.parse(r).pathname;t.navigate(l,{skipRouting:!0}),n.PageConfig.setOption("treePath",i),c=o}))})),s=s||o.ConnectionLost,e.serviceManager.connectionFailure.connect(((e,t)=>s(e,t,r)));const g=e.serviceManager.builder,m=()=>g.build().then((()=>(0,i.showDialog)({title:d.__("Build Complete"),body:v.createElement("div",null,d.__("Build successfully completed, reload page?"),v.createElement("br",null),d.__("You will lose any unsaved changes.")),buttons:[i.Dialog.cancelButton({label:d.__("Reload Without Saving"),actions:["reload"]}),i.Dialog.okButton({label:d.__("Save and Reload")})],hasClose:!0}))).then((({button:{accept:a,actions:o}})=>{a?e.commands.execute("docmanager:save").then((()=>{t.reload()})).catch((e=>{(0,i.showErrorMessage)(d.__("Save Failed"),{message:v.createElement("pre",null,e.message)})})):o.includes("reload")&&t.reload()})).catch((e=>{(0,i.showErrorMessage)(d.__("Build Failed"),{message:v.createElement("pre",null,e.message)})}));return g.isAvailable&&g.shouldCheck&&g.getStatus().then((e=>{if("building"===e.status)return m();if("needed"!==e.status)return;const t=v.createElement("div",null,d.__("JupyterLab build is suggested:"),v.createElement("br",null),v.createElement("pre",null,e.message));(0,i.showDialog)({title:d.__("Build Recommended"),body:t,buttons:[i.Dialog.cancelButton(),i.Dialog.okButton({label:d.__("Build")})]}).then((e=>e.button.accept?m():void 0))})),function(e){l.paths.then((()=>{if(u=e,!c){const a=n.PageConfig.getUrl({treePath:e}),o=n.URLExt.parse(a).pathname;t.navigate(o,{skipRouting:!0}),n.PageConfig.setOption("treePath",e)}}))}},autoStart:!0},w={id:"@jupyterlab/application-extension:context-menu",description:"Populates the context menu.",autoStart:!0,requires:[l.ISettingRegistry,c.ITranslator],activate:(e,t,a)=>{const o=a.load("jupyterlab");function i(t){const a=new u.RankedMenu({...t,commands:e.commands});return t.label&&(a.title.label=o.__(t.label)),a}e.started.then((()=>O.loadSettingsContextMenu(e.contextMenu,t,i,a))).catch((e=>{console.error("Failed to load context menu items from settings registry.",e)}))}},T={id:"@jupyterlab/application-extension:dirty",description:"Adds safeguard dialog when closing the browser tab with unsaved modifications.",autoStart:!0,requires:[c.ITranslator],activate:(e,t)=>{if(!(e instanceof o.JupyterLab))throw new Error(`${T.id} must be activated in JupyterLab.`);const a=t.load("jupyterlab").__("Are you sure you want to exit JupyterLab?\n\nAny unsaved changes will be lost.");window.addEventListener("beforeunload",(t=>{if(e.status.isDirty)return t.returnValue=a}))}},I={id:"@jupyterlab/application-extension:layout",description:"Provides the shell layout restorer.",requires:[s.IStateDB,o.ILabShell,l.ISettingRegistry],optional:[c.ITranslator],activate:(e,t,a,r,l)=>{const s=(null!=l?l:c.nullTranslator).load("jupyterlab"),d=e.started,u=e.commands,p=n.PageConfig.getOption("mode"),m=new o.LayoutRestorer({connector:t,first:d,registry:u,mode:p});return r.load(R.id).then((t=>{var o,i;const n=t.composite.layout;a.restoreLayout(p,m,{"multiple-document":null!==(o=n.multiple)&&void 0!==o?o:{},"single-document":null!==(i=n.single)&&void 0!==i?i:{}}).then((()=>{a.layoutModified.connect((()=>{m.save(a.saveLayout())})),t.changed.connect(b),O.activateSidebarSwitcher(e,a,t,s)}))})).catch((e=>{console.error("Fail to load settings for the layout restorer."),console.error(e)})),m;async function b(e){g.JSONExt.deepEqual(e.composite.layout,{single:a.userLayout["single-document"],multiple:a.userLayout["multiple-document"]})||(await(0,i.showDialog)({title:s.__("Information"),body:s.__("User layout customization has changed. You may need to reload JupyterLab to see the changes."),buttons:[i.Dialog.cancelButton(),i.Dialog.okButton({label:s.__("Reload")})]})).button.accept&&location.reload()}},autoStart:!0,provides:o.ILayoutRestorer},E={id:"@jupyterlab/application-extension:router",description:"Provides the URL router",requires:[o.JupyterFrontEnd.IPaths],activate:(e,t)=>{const{commands:a}=e,i=t.urls.base,n=new o.Router({base:i,commands:a});return e.started.then((()=>{n.route(),window.addEventListener("popstate",(()=>{n.route()}))})),n},autoStart:!0,provides:o.IRouter},C={id:"@jupyterlab/application-extension:tree-resolver",description:"Provides the tree route resolver",autoStart:!0,requires:[o.IRouter],provides:o.JupyterFrontEnd.ITreeResolver,activate:(e,t)=>{const{commands:a}=e,o=new b.DisposableSet,i=new g.PromiseDelegate,r=new RegExp("/(lab|doc)(/workspaces/[a-zA-Z0-9-_]+)?(/tree/.*)?");o.add(a.addCommand(_.tree,{execute:async e=>{var t;if(o.isDisposed)return;const a=n.URLExt.queryStringToObject(null!==(t=e.search)&&void 0!==t?t:""),r=a["file-browser-path"]||"";delete a["file-browser-path"],o.dispose(),i.resolve({browser:r,file:n.PageConfig.getOption("treePath")})}})),o.add(t.register({command:_.tree,pattern:r}));const l=()=>{o.isDisposed||(o.dispose(),i.resolve(null))};return t.routed.connect(l),o.add(new b.DisposableDelegate((()=>{t.routed.disconnect(l)}))),{paths:i.promise}}},P={id:"@jupyterlab/application-extension:notfound",description:"Defines the behavior for not found URL (aka route).",requires:[o.JupyterFrontEnd.IPaths,o.IRouter,c.ITranslator],activate:(e,t,a,o)=>{const n=o.load("jupyterlab"),r=t.urls.notFound;if(!r)return;const l=a.base,s=n.__("The path: %1 was not found. JupyterLab redirected to: %2",r,l);a.navigate(""),(0,i.showErrorMessage)(n.__("Path Not Found"),{message:s})},autoStart:!0},L={id:"@jupyterlab/application-extension:faviconbusy",description:"Handles the favicon depending on the application status.",requires:[o.ILabStatus],activate:async(e,t)=>{t.busySignal.connect(((e,t)=>{const a=document.querySelector('link[rel="icon"]'+(t?".idle.favicon":".busy.favicon"));if(!a)return;const o=document.querySelector("link"+(t?".busy.favicon":".idle.favicon"));o&&a!==o&&(a.rel="",o.rel="icon",o.parentNode.replaceChild(o,o))}))},autoStart:!0},R={id:"@jupyterlab/application-extension:shell",description:"Provides the JupyterLab shell. It has an extended API compared to `app.shell`.",optional:[l.ISettingRegistry],activate:(e,t)=>{if(!(e.shell instanceof o.LabShell))throw new Error(`${R.id} did not find a LabShell instance.`);return t&&t.load(R.id).then((t=>{e.shell.updateConfig(t.composite),t.changed.connect((()=>{e.shell.updateConfig(t.composite)}))})),e.shell},autoStart:!0,provides:o.ILabShell},B={id:"@jupyterlab/application-extension:status",description:"Provides the application status.",activate:e=>{if(!(e instanceof o.JupyterLab))throw new Error(`${B.id} must be activated in JupyterLab.`);return e.status},autoStart:!0,provides:o.ILabStatus},M={id:"@jupyterlab/application-extension:info",description:"Provides the application information.",activate:e=>{if(!(e instanceof o.JupyterLab))throw new Error(`${M.id} must be activated in JupyterLab.`);return e.info},autoStart:!0,provides:o.JupyterLab.IInfo},j={id:"@jupyterlab/application-extension:paths",description:"Provides the application paths.",activate:e=>{if(!(e instanceof o.JupyterLab))throw new Error(`${j.id} must be activated in JupyterLab.`);return e.paths},autoStart:!0,provides:o.JupyterFrontEnd.IPaths},A={id:"@jupyterlab/application-extension:property-inspector",description:"Provides the property inspector.",autoStart:!0,requires:[o.ILabShell,c.ITranslator],optional:[o.ILayoutRestorer],provides:r.IPropertyInspectorProvider,activate:(e,t,a,o)=>{const i=a.load("jupyterlab"),n=new r.SideBarPropertyInspectorProvider({shell:t,translator:a});return n.title.icon=u.buildIcon,n.title.caption=i.__("Property Inspector"),n.id="jp-property-inspector",t.add(n,"right",{rank:100,type:"Property Inspector"}),e.commands.addCommand(_.showPropertyPanel,{label:i.__("Property Inspector"),execute:()=>{t.activateById(n.id)}}),o&&o.add(n,"jp-property-inspector"),n}},k={id:"@jupyterlab/application-extension:logo",description:"Sets the application logo.",autoStart:!0,requires:[o.ILabShell],activate:(e,t)=>{const a=new h.Widget;u.jupyterIcon.element({container:a.node,elementPosition:"center",margin:"2px 2px 2px 8px",height:"auto",width:"16px"}),a.id="jp-MainLogo",t.add(a,"top",{rank:0})}},J={id:"@jupyterlab/application-extension:mode-switch",description:"Adds the interface mode switch",requires:[o.ILabShell,c.ITranslator],optional:[d.IStatusBar,l.ISettingRegistry],activate:(e,t,a,o,i)=>{if(null===o)return;const n=a.load("jupyterlab"),r=new u.Switch;if(r.id="jp-single-document-mode",r.valueChanged.connect(((e,a)=>{t.mode=a.newValue?"single-document":"multiple-document"})),t.modeChanged.connect(((e,t)=>{r.value="single-document"===t})),i){const a=i.load(R.id),o=e=>{const a=e.get("startMode").composite;a&&(t.mode="single"===a?"single-document":"multiple-document")};Promise.all([a,e.restored]).then((([e])=>{o(e)})).catch((e=>{console.error(e.message)}))}const l=()=>{const t=e.commands.keyBindings.find((e=>"application:toggle-mode"===e.command));if(t){const e=t.keys.map(m.CommandRegistry.formatKeystroke).join(", ");r.caption=n.__("Simple Interface (%1)",e)}else r.caption=n.__("Simple Interface")};l(),e.commands.keyBindingChanged.connect((()=>{l()})),r.label=n.__("Simple"),o.registerStatusItem(J.id,{priority:1,item:r,align:"left",rank:-1})},autoStart:!0},D=[w,T,S,x,I,E,C,P,L,R,B,M,J,j,A,k,y];var O;!function(e){async function t(e){(await(0,i.showDialog)({title:e.__("Information"),body:e.__("Context menu customization has changed. You will need to reload JupyterLab to see the changes."),buttons:[i.Dialog.cancelButton(),i.Dialog.okButton({label:e.__("Reload")})]})).button.accept&&location.reload()}e.loadSettingsContextMenu=async function(e,a,o,n){var r;const s=n.load("jupyterlab"),d=w.id;let c=null,u={};function p(e){var t,o;u={};const i=Object.keys(a.plugins).map((e=>{var t,o;const i=null!==(o=null===(t=a.plugins[e].schema["jupyter.lab.menus"])||void 0===t?void 0:t.context)&&void 0!==o?o:[];return u[e]=i,i})).concat([null!==(o=null===(t=e["jupyter.lab.menus"])||void 0===t?void 0:t.context)&&void 0!==o?o:[]]).reduceRight(((e,t)=>l.SettingRegistry.reconcileItems(e,t,!0)),[]);e.properties.contextMenu.default=l.SettingRegistry.reconcileItems(i,e.properties.contextMenu.default,!0).sort(((e,t)=>{var a,o;return(null!==(a=e.rank)&&void 0!==a?a:1/0)-(null!==(o=t.rank)&&void 0!==o?o:1/0)}))}a.transform(d,{compose:e=>{var t,a,o,i;c||(c=g.JSONExt.deepCopy(e.schema),p(c));const n=null!==(o=null===(a=null===(t=c.properties)||void 0===t?void 0:t.contextMenu)||void 0===a?void 0:a.default)&&void 0!==o?o:[],r={...e.data.user,contextMenu:null!==(i=e.data.user.contextMenu)&&void 0!==i?i:[]},s={...e.data.composite,contextMenu:l.SettingRegistry.reconcileItems(n,r.contextMenu,!1)};return e.data={composite:s,user:r},e},fetch:e=>(c||(c=g.JSONExt.deepCopy(e.schema),p(c)),{data:e.data,id:e.id,raw:e.raw,schema:c,version:e.version})});const m=await a.load(d),b=null!==(r=m.composite.contextMenu)&&void 0!==r?r:[];l.SettingRegistry.filterDisabledItems(b).forEach((t=>{i.MenuFactory.addContextItem({rank:f,...t},e,o)})),m.changed.connect((()=>{var e;const a=null!==(e=m.composite.contextMenu)&&void 0!==e?e:[];g.JSONExt.deepEqual(b,a)||t(s)})),a.pluginChanged.connect((async(n,r)=>{var c,p,m,h;if(r!==d){const n=null!==(c=u[r])&&void 0!==c?c:[],d=null!==(m=null===(p=a.plugins[r].schema["jupyter.lab.menus"])||void 0===p?void 0:p.context)&&void 0!==m?m:[];if(!g.JSONExt.deepEqual(n,d))if(u[r])await t(s);else{u[r]=g.JSONExt.deepCopy(d);const t=null!==(h=l.SettingRegistry.reconcileItems(d,b,!1,!1))&&void 0!==h?h:[];l.SettingRegistry.filterDisabledItems(t).forEach((t=>{i.MenuFactory.addContextItem({rank:f,...t},e,o)}))}}}))},e.activateSidebarSwitcher=function(e,t,a,o){e.commands.addCommand(_.switchSidebar,{label:o.__("Switch Sidebar Side"),execute:()=>{const o=e.contextMenuHitTest((e=>!!e.dataset.id));if(!o)return;const i=o.dataset.id,n=document.getElementById("jp-left-stack"),r=document.getElementById(i);let l=null;if(n&&r&&n.contains(r)){const e=(0,p.find)(t.widgets("left"),(e=>e.id===i));e&&(l=t.move(e,"right"),t.activateById(e.id))}else{const e=(0,p.find)(t.widgets("right"),(e=>e.id===i));e&&(l=t.move(e,"left"),t.activateById(e.id))}l&&a.set("layout",{single:l["single-document"],multiple:l["multiple-document"]}).catch((e=>{console.error("Failed to save user layout customization.",e)}))}}),e.commands.commandExecuted.connect(((e,t)=>{t.id===_.resetLayout&&a.remove("layout").catch((e=>{console.error("Failed to remove user layout customization.",e)}))}))}}(O||(O={}))}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[4042,134],{44042:(t,e,s)=>{s.r(e),s.d(e,{AttachmentsModel:()=>r,AttachmentsResolver:()=>h});var a=s(92071),n=s(1678),i=s(81997);class r{constructor(t){var e;if(this._map=new a.ObservableMap,this._isDisposed=!1,this._stateChanged=new i.Signal(this),this._changed=new i.Signal(this),this._serialized=null,this._changeGuard=!1,this.contentFactory=null!==(e=t.contentFactory)&&void 0!==e?e:r.defaultContentFactory,t.values)for(const e of Object.keys(t.values))void 0!==t.values[e]&&this.set(e,t.values[e]);this._map.changed.connect(this._onMapChanged,this)}get stateChanged(){return this._stateChanged}get changed(){return this._changed}get keys(){return this._map.keys()}get length(){return this._map.keys().length}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this._map.dispose(),i.Signal.clearData(this))}has(t){return this._map.has(t)}get(t){return this._map.get(t)}set(t,e){const s=this._createItem({value:e});this._map.set(t,s)}remove(t){this._map.delete(t)}clear(){this._map.values().forEach((t=>{t.dispose()})),this._map.clear()}fromJSON(t){this.clear(),Object.keys(t).forEach((e=>{void 0!==t[e]&&this.set(e,t[e])}))}toJSON(){const t={};for(const e of this._map.keys())t[e]=this._map.get(e).toJSON();return t}_createItem(t){const e=this.contentFactory.createAttachmentModel(t);return e.changed.connect(this._onGenericChange,this),e}_onMapChanged(t,e){this._serialized&&!this._changeGuard&&(this._changeGuard=!0,this._serialized.set(this.toJSON()),this._changeGuard=!1),this._changed.emit(e),this._stateChanged.emit(void 0)}_onGenericChange(){this._stateChanged.emit(void 0)}}!function(t){class e{createAttachmentModel(t){return new n.AttachmentModel(t)}}t.ContentFactory=e,t.defaultContentFactory=new e}(r||(r={}));class h{constructor(t){this._parent=t.parent||null,this._model=t.model}async resolveUrl(t){return this._parent&&!t.startsWith("attachment:")?this._parent.resolveUrl(t):t}async getDownloadUrl(t){if(this._parent&&!t.startsWith("attachment:"))return this._parent.getDownloadUrl(t);const e=t.slice(11),s=this._model.get(e);if(void 0===s)return t;const{data:a}=s,i=Object.keys(a)[0];if(void 0===i||-1===n.imageRendererFactory.mimeTypes.indexOf(i))throw new Error(`Cannot render unknown image mime type "${i}".`);return`data:${i};base64,${a[i]}`}isLocal(t){var e,s,a;return!(this._parent&&!t.startsWith("attachment:"))||null===(a=null===(s=(e=this._parent).isLocal)||void 0===s?void 0:s.call(e,t))||void 0===a||a}}}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[4042,134],{44042:(t,e,s)=>{s.r(e),s.d(e,{AttachmentsModel:()=>r,AttachmentsResolver:()=>h});var a=s(95012),n=s(61709),i=s(81997);class r{constructor(t){var e;if(this._map=new a.ObservableMap,this._isDisposed=!1,this._stateChanged=new i.Signal(this),this._changed=new i.Signal(this),this._serialized=null,this._changeGuard=!1,this.contentFactory=null!==(e=t.contentFactory)&&void 0!==e?e:r.defaultContentFactory,t.values)for(const e of Object.keys(t.values))void 0!==t.values[e]&&this.set(e,t.values[e]);this._map.changed.connect(this._onMapChanged,this)}get stateChanged(){return this._stateChanged}get changed(){return this._changed}get keys(){return this._map.keys()}get length(){return this._map.keys().length}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this._map.dispose(),i.Signal.clearData(this))}has(t){return this._map.has(t)}get(t){return this._map.get(t)}set(t,e){const s=this._createItem({value:e});this._map.set(t,s)}remove(t){this._map.delete(t)}clear(){this._map.values().forEach((t=>{t.dispose()})),this._map.clear()}fromJSON(t){this.clear(),Object.keys(t).forEach((e=>{void 0!==t[e]&&this.set(e,t[e])}))}toJSON(){const t={};for(const e of this._map.keys())t[e]=this._map.get(e).toJSON();return t}_createItem(t){const e=this.contentFactory.createAttachmentModel(t);return e.changed.connect(this._onGenericChange,this),e}_onMapChanged(t,e){this._serialized&&!this._changeGuard&&(this._changeGuard=!0,this._serialized.set(this.toJSON()),this._changeGuard=!1),this._changed.emit(e),this._stateChanged.emit(void 0)}_onGenericChange(){this._stateChanged.emit(void 0)}}!function(t){class e{createAttachmentModel(t){return new n.AttachmentModel(t)}}t.ContentFactory=e,t.defaultContentFactory=new e}(r||(r={}));class h{constructor(t){this._parent=t.parent||null,this._model=t.model}async resolveUrl(t){return this._parent&&!t.startsWith("attachment:")?this._parent.resolveUrl(t):t}async getDownloadUrl(t){if(this._parent&&!t.startsWith("attachment:"))return this._parent.getDownloadUrl(t);const e=t.slice(11),s=this._model.get(e);if(void 0===s)return t;const{data:a}=s,i=Object.keys(a)[0];if(void 0===i||-1===n.imageRendererFactory.mimeTypes.indexOf(i))throw new Error(`Cannot render unknown image mime type "${i}".`);return`data:${i};base64,${a[i]}`}isLocal(t){var e,s,a;return!(this._parent&&!t.startsWith("attachment:"))||null===(a=null===(s=(e=this._parent).isLocal)||void 0===s?void 0:s.call(e,t))||void 0===a||a}}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[4212],{24212:(e,t,n)=>{n.r(t),n.d(t,{default:()=>v});var i=n(11510),c=n(23051),s=n(17093),a=n(13532),d=n(31721),o=n(63485);const r="jp-mod-searchable",l="jp-mod-search-active";var h;!function(e){e.search="documentsearch:start",e.searchAndReplace="documentsearch:startWithReplace",e.findNext="documentsearch:highlightNext",e.findPrevious="documentsearch:highlightPrevious",e.end="documentsearch:end",e.toggleSearchInSelection="documentsearch:toggleSearchInSelection"}(h||(h={}));const u={id:"@jupyterlab/documentsearch-extension:labShellWidgetListener",description:"Active search on valid document",requires:[i.ILabShell,s.ISearchProviderRegistry],autoStart:!0,activate:(e,t,n)=>{const i=e=>{e&&(n.hasProvider(e)?e.addClass(r):e.removeClass(r))};n.changed.connect((()=>i(t.activeWidget))),t.activeChanged.connect(((e,t)=>{const n=t.oldValue;n&&n.removeClass(r),i(t.newValue)}))}};class g{constructor(e){this._commandRegistry=e,this._cache=this._buildCache(),this._commandRegistry.keyBindingChanged.connect(this._rebuildCache,this)}get next(){return this._cache.next}get previous(){return this._cache.previous}get toggleSearchInSelection(){return this._cache.toggleSearchInSelection}_rebuildCache(){this._cache=this._buildCache()}_buildCache(){return{next:this._commandRegistry.keyBindings.find((e=>e.command===h.findNext)),previous:this._commandRegistry.keyBindings.find((e=>e.command===h.findPrevious)),toggleSearchInSelection:this._commandRegistry.keyBindings.find((e=>e.command===h.toggleSearchInSelection))}}dispose(){this._commandRegistry.keyBindingChanged.disconnect(this._rebuildCache,this)}}const m={id:"@jupyterlab/documentsearch-extension:plugin",description:"Provides the document search registry.",provides:s.ISearchProviderRegistry,requires:[d.ITranslator],optional:[c.ICommandPalette,a.ISettingRegistry],autoStart:!0,activate:(e,t,n,i)=>{const a=t.load("jupyterlab");let d=500,r="never";const u=new s.SearchProviderRegistry(t),v=new Map;if(i){const t=i.load(m.id),n=e=>{d=e.get("searchDebounceTime").composite,r=e.get("autoSearchInSelection").composite};Promise.all([t,e.restored]).then((([e])=>{n(e),e.changed.connect((e=>{n(e)}))})).catch((e=>{console.error(e.message)}))}const p=()=>{const t=e.shell.currentWidget;return!!t&&u.hasProvider(t)},S=n=>{if(!n)return;const i=n.id;let a=v.get(i);if(!a){const c=u.getProvider(n);if(!c)return;const o=new s.SearchDocumentModel(c,d),r=new g(e.commands),m=new s.SearchDocumentView(o,t,r);v.set(i,m),[h.findNext,h.findPrevious,h.end,h.toggleSearchInSelection].forEach((t=>{e.commands.notifyCommandChanged(t)})),m.closed.connect((()=>{n.isDisposed||(n.activate(),n.removeClass(l))})),m.disposed.connect((()=>{n.isDisposed||(n.activate(),n.removeClass(l)),v.delete(i),[h.findNext,h.findPrevious,h.end,h.toggleSearchInSelection].forEach((t=>{e.commands.notifyCommandChanged(t)}))})),n.disposed.connect((()=>{m.dispose(),o.dispose(),c.dispose(),r.dispose()})),a=m}return a.isAttached||(o.Widget.attach(a,n.node),n.addClass(l),n instanceof c.MainAreaWidget&&(a.node.style.top=`${n.toolbar.node.getBoundingClientRect().height+n.contentHeader.node.getBoundingClientRect().height}px`),a.model.searchExpression&&a.model.refresh()),a};return e.commands.addCommand(h.search,{label:a.__("Find…"),isEnabled:p,execute:async t=>{const n=S(e.shell.currentWidget);if(n){const e=t.searchText;e?n.setSearchText(e):n.setSearchText(n.model.suggestedInitialQuery);const i=n.model.selectionState;let c=!1;switch(r){case"multiple-selected":c="multiple"===i;break;case"any-selected":c="multiple"===i||"single"===i}c&&await n.model.setFilter("selection",!0),n.focusSearchInput()}}}),e.commands.addCommand(h.searchAndReplace,{label:a.__("Find and Replace…"),isEnabled:p,execute:t=>{const n=S(e.shell.currentWidget);if(n){const e=t.searchText;e?n.setSearchText(e):n.setSearchText(n.model.suggestedInitialQuery);const i=t.replaceText;i&&n.setReplaceText(i),n.showReplace(),n.focusSearchInput()}}}),e.commands.addCommand(h.findNext,{label:a.__("Find Next"),isEnabled:()=>!!e.shell.currentWidget&&v.has(e.shell.currentWidget.id),execute:async()=>{var t;const n=e.shell.currentWidget;n&&await(null===(t=v.get(n.id))||void 0===t?void 0:t.model.highlightNext())}}),e.commands.addCommand(h.findPrevious,{label:a.__("Find Previous"),isEnabled:()=>!!e.shell.currentWidget&&v.has(e.shell.currentWidget.id),execute:async()=>{var t;const n=e.shell.currentWidget;n&&await(null===(t=v.get(n.id))||void 0===t?void 0:t.model.highlightPrevious())}}),e.commands.addCommand(h.end,{label:a.__("End Search"),isEnabled:()=>!!e.shell.currentWidget&&v.has(e.shell.currentWidget.id),execute:async()=>{var t;const n=e.shell.currentWidget;n&&(null===(t=v.get(n.id))||void 0===t||t.close())}}),e.commands.addCommand(h.toggleSearchInSelection,{label:a.__("Search in Selection"),isEnabled:()=>!!e.shell.currentWidget&&v.has(e.shell.currentWidget.id)&&"selection"in v.get(e.shell.currentWidget.id).model.filtersDefinition,execute:async()=>{var t;const n=e.shell.currentWidget;if(!n)return;const i=null===(t=v.get(n.id))||void 0===t?void 0:t.model;if(!i)return;const c=i.filters.selection;return i.setFilter("selection",!c)}}),n&&[h.search,h.findNext,h.findPrevious,h.end,h.toggleSearchInSelection].forEach((e=>{n.addItem({command:e,category:a.__("Main Area")})})),u}},v=[m,u]}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[4212],{24212:(e,t,n)=>{n.r(t),n.d(t,{default:()=>v});var i=n(25007),c=n(95297),s=n(43766),a=n(2277),d=n(60502),o=n(63485);const r="jp-mod-searchable",l="jp-mod-search-active";var h;!function(e){e.search="documentsearch:start",e.searchAndReplace="documentsearch:startWithReplace",e.findNext="documentsearch:highlightNext",e.findPrevious="documentsearch:highlightPrevious",e.end="documentsearch:end",e.toggleSearchInSelection="documentsearch:toggleSearchInSelection"}(h||(h={}));const u={id:"@jupyterlab/documentsearch-extension:labShellWidgetListener",description:"Active search on valid document",requires:[i.ILabShell,s.ISearchProviderRegistry],autoStart:!0,activate:(e,t,n)=>{const i=e=>{e&&(n.hasProvider(e)?e.addClass(r):e.removeClass(r))};n.changed.connect((()=>i(t.activeWidget))),t.activeChanged.connect(((e,t)=>{const n=t.oldValue;n&&n.removeClass(r),i(t.newValue)}))}};class g{constructor(e){this._commandRegistry=e,this._cache=this._buildCache(),this._commandRegistry.keyBindingChanged.connect(this._rebuildCache,this)}get next(){return this._cache.next}get previous(){return this._cache.previous}get toggleSearchInSelection(){return this._cache.toggleSearchInSelection}_rebuildCache(){this._cache=this._buildCache()}_buildCache(){return{next:this._commandRegistry.keyBindings.find((e=>e.command===h.findNext)),previous:this._commandRegistry.keyBindings.find((e=>e.command===h.findPrevious)),toggleSearchInSelection:this._commandRegistry.keyBindings.find((e=>e.command===h.toggleSearchInSelection))}}dispose(){this._commandRegistry.keyBindingChanged.disconnect(this._rebuildCache,this)}}const m={id:"@jupyterlab/documentsearch-extension:plugin",description:"Provides the document search registry.",provides:s.ISearchProviderRegistry,requires:[d.ITranslator],optional:[c.ICommandPalette,a.ISettingRegistry],autoStart:!0,activate:(e,t,n,i)=>{var a;const d=t.load("jupyterlab");let r=500,u="never";const v=new s.SearchProviderRegistry(t),p=new Map;if(i){const t=i.load(m.id),n=e=>{r=e.get("searchDebounceTime").composite,u=e.get("autoSearchInSelection").composite};Promise.all([t,e.restored]).then((([e])=>{n(e),e.changed.connect((e=>{n(e)}))})).catch((e=>{console.error(e.message)}))}const S=()=>{const t=e.shell.currentWidget;return!!t&&v.hasProvider(t)},f=n=>{if(!n)return;const i=n.id;let a=p.get(i);if(!a){const c=v.getProvider(n);if(!c)return;const d=new s.SearchDocumentModel(c,r),o=new g(e.commands),u=new s.SearchDocumentView(d,t,o);p.set(i,u),[h.findNext,h.findPrevious,h.end,h.toggleSearchInSelection].forEach((t=>{e.commands.notifyCommandChanged(t)})),u.closed.connect((()=>{n.isDisposed||(n.activate(),n.removeClass(l))})),u.disposed.connect((()=>{n.isDisposed||(n.activate(),n.removeClass(l)),p.delete(i),[h.findNext,h.findPrevious,h.end,h.toggleSearchInSelection].forEach((t=>{e.commands.notifyCommandChanged(t)}))})),n.disposed.connect((()=>{u.dispose(),d.dispose(),c.dispose(),o.dispose()})),a=u}return a.isAttached||(o.Widget.attach(a,n.node),n.addClass(l),n instanceof c.MainAreaWidget&&(a.node.style.top=`${n.toolbar.node.getBoundingClientRect().height+n.contentHeader.node.getBoundingClientRect().height}px`),a.model.searchExpression&&a.model.refresh()),a};return e.commands.addCommand(h.search,{label:d.__("Find…"),isEnabled:S,execute:async t=>{const n=f(e.shell.currentWidget);if(n){const e=t.searchText;e?n.setSearchText(e):n.setSearchText(n.model.suggestedInitialQuery);const i=n.model.selectionState;let c=!1;switch(u){case"multiple-selected":c="multiple"===i;break;case"any-selected":c="multiple"===i||"single"===i}c&&await n.model.setFilter("selection",!0),n.focusSearchInput()}}}),e.commands.addCommand(h.searchAndReplace,{label:d.__("Find and Replace…"),isEnabled:S,execute:t=>{const n=f(e.shell.currentWidget);if(n){const e=t.searchText;e?n.setSearchText(e):n.setSearchText(n.model.suggestedInitialQuery);const i=t.replaceText;i&&n.setReplaceText(i),n.showReplace(),n.focusSearchInput()}}}),e.commands.addCommand(h.findNext,{label:d.__("Find Next"),isEnabled:()=>!!e.shell.currentWidget&&p.has(e.shell.currentWidget.id),execute:async()=>{var t;const n=e.shell.currentWidget;n&&await(null===(t=p.get(n.id))||void 0===t?void 0:t.model.highlightNext())}}),e.commands.addCommand(h.findPrevious,{label:d.__("Find Previous"),isEnabled:()=>!!e.shell.currentWidget&&p.has(e.shell.currentWidget.id),execute:async()=>{var t;const n=e.shell.currentWidget;n&&await(null===(t=p.get(n.id))||void 0===t?void 0:t.model.highlightPrevious())}}),e.commands.addCommand(h.end,{label:d.__("End Search"),isEnabled:()=>!!e.shell.currentWidget&&p.has(e.shell.currentWidget.id),execute:async()=>{var t;const n=e.shell.currentWidget;n&&(null===(t=p.get(n.id))||void 0===t||t.close())}}),e.commands.addCommand(h.toggleSearchInSelection,{label:d.__("Search in Selection"),isEnabled:()=>!!e.shell.currentWidget&&p.has(e.shell.currentWidget.id)&&"selection"in p.get(e.shell.currentWidget.id).model.filtersDefinition,execute:async()=>{var t;const n=e.shell.currentWidget;if(!n)return;const i=null===(t=p.get(n.id))||void 0===t?void 0:t.model;if(!i)return;const c=i.filters.selection;return i.setFilter("selection",!c)}}),null===(a=e.shell.currentChanged)||void 0===a||a.connect((()=>{Object.values(h).forEach((t=>{e.commands.notifyCommandChanged(t)}))})),n&&[h.search,h.findNext,h.findPrevious,h.end,h.toggleSearchInSelection].forEach((e=>{n.addItem({command:e,category:d.__("Main Area")})})),v}},v=[m,u]}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[4382,7906],{54382:(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var n=r(17093),o=r(25206);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([[4382,7906],{54382:(e,t,r)=>{r.r(t),r.d(t,{default:()=>a});var n=r(43766),o=r(37057);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)}))}}]}}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[4430],{44430:e=>{var t;self,t=()=>(()=>{"use strict";var e,t={};return e=t,Object.defineProperty(e,"__esModule",{value:!0}),e.FitAddon=void 0,e.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const r=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,s=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(s.getPropertyValue("height")),n=Math.max(0,parseInt(s.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),a=i-(parseInt(l.getPropertyValue("padding-top"))+parseInt(l.getPropertyValue("padding-bottom"))),o=n-(parseInt(l.getPropertyValue("padding-right"))+parseInt(l.getPropertyValue("padding-left")))-r;return{cols:Math.max(2,Math.floor(o/t.css.cell.width)),rows:Math.max(1,Math.floor(a/t.css.cell.height))}}},t})(),e.exports=t()}}]);