notebook 7.0.6__py3-none-any.whl → 7.1.0a1__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 (256) hide show
  1. notebook/_version.py +1 -1
  2. notebook/app.py +5 -2
  3. notebook/static/1053.bundle.js +1 -1
  4. notebook/static/1157.bundle.js +1 -0
  5. notebook/static/1169.bundle.js +1 -0
  6. notebook/static/1198.bundle.js +1 -1
  7. notebook/static/131.bundle.js +7 -0
  8. notebook/static/1326.bundle.js +2 -0
  9. notebook/static/1337.bundle.js +1 -1
  10. notebook/static/134.bundle.js +1 -1
  11. notebook/static/1408.bundle.js +1 -1
  12. notebook/static/1496.bundle.js +1 -0
  13. notebook/static/1584.bundle.js +1 -1
  14. notebook/static/1604.bundle.js +1 -0
  15. notebook/static/1647.bundle.js +1 -1
  16. notebook/static/1650.bundle.js +1 -1
  17. notebook/static/1682.bundle.js +1 -1
  18. notebook/static/1684.bundle.js +1 -1
  19. notebook/static/1696.bundle.js +1 -1
  20. notebook/static/1809.bundle.js +1 -1
  21. notebook/static/1827.bundle.js +1 -1
  22. notebook/static/1833.bundle.js +1 -1
  23. notebook/static/1835.bundle.js +1 -1
  24. notebook/static/1869.bundle.js +1 -0
  25. notebook/static/1895.bundle.js +1 -0
  26. notebook/static/1950.bundle.js +1 -1
  27. notebook/static/1958.bundle.js +1 -1
  28. notebook/static/2007.bundle.js +1 -1
  29. notebook/static/2067.bundle.js +1 -1
  30. notebook/static/2088.bundle.js +1 -1
  31. notebook/static/2089.bundle.js +1 -1
  32. notebook/static/2122.bundle.js +1 -1
  33. notebook/static/2167.bundle.js +1 -1
  34. notebook/static/2184.bundle.js +1 -1
  35. notebook/static/2311.bundle.js +1 -1
  36. notebook/static/2401.bundle.js +1 -1
  37. notebook/static/2479.bundle.js +1 -1
  38. notebook/static/2489.bundle.js +1 -0
  39. notebook/static/2502.bundle.js +1 -0
  40. notebook/static/2512.bundle.js +1 -1
  41. notebook/static/2515.bundle.js +1 -0
  42. notebook/static/2552.bundle.js +1 -1
  43. notebook/static/2577.bundle.js +1 -0
  44. notebook/static/2607.bundle.js +1 -1
  45. notebook/static/2615.bundle.js +1 -0
  46. notebook/static/2866.bundle.js +1 -1
  47. notebook/static/2883.bundle.js +1 -0
  48. notebook/static/2924.bundle.js +1 -1
  49. notebook/static/2944.bundle.js +1 -0
  50. notebook/static/2955.bundle.js +1 -1
  51. notebook/static/3079.bundle.js +1 -1
  52. notebook/static/3129.bundle.js +1 -0
  53. notebook/static/3146.bundle.js +1 -1
  54. notebook/static/3190.bundle.js +2 -0
  55. notebook/static/3190.bundle.js.LICENSE.txt +18 -0
  56. notebook/static/3213.bundle.js +1 -1
  57. notebook/static/3301.bundle.js +1 -1
  58. notebook/static/3340.bundle.js +1 -1
  59. notebook/static/3360.bundle.js +1 -1
  60. notebook/static/3466.bundle.js +1 -1
  61. notebook/static/35.bundle.js +1 -1
  62. notebook/static/3512.bundle.js +1 -0
  63. notebook/static/3642.bundle.js +1 -0
  64. notebook/static/3676.bundle.js +1 -1
  65. notebook/static/3680.bundle.js +1 -1
  66. notebook/static/3768.bundle.js +1 -1
  67. notebook/static/377.bundle.js +1 -1
  68. notebook/static/3797.bundle.js +1 -1
  69. notebook/static/3863.bundle.js +1 -1
  70. notebook/static/3881.bundle.js +1 -1
  71. notebook/static/4042.bundle.js +1 -1
  72. notebook/static/4058.bundle.js +1 -1
  73. notebook/static/4131.bundle.js +1 -1
  74. notebook/static/4166.bundle.js +1 -0
  75. notebook/static/4212.bundle.js +1 -1
  76. notebook/static/4271.bundle.js +1 -1
  77. notebook/static/4291.bundle.js +1 -1
  78. notebook/static/433.bundle.js +1 -0
  79. notebook/static/4382.bundle.js +1 -1
  80. notebook/static/4461.bundle.js +1 -0
  81. notebook/static/4499.bundle.js +1 -0
  82. notebook/static/4501.bundle.js +1 -0
  83. notebook/static/4526.bundle.js +1 -1
  84. notebook/static/4558.bundle.js +1 -1
  85. notebook/static/4630.bundle.js +2 -0
  86. notebook/static/4630.bundle.js.LICENSE.txt +9 -0
  87. notebook/static/4645.bundle.js +1 -1
  88. notebook/static/4811.bundle.js +1 -1
  89. notebook/static/4837.bundle.js +1 -1
  90. notebook/static/4892.bundle.js +1 -0
  91. notebook/static/5088.bundle.js +1 -1
  92. notebook/static/5099.bundle.js +1 -1
  93. notebook/static/5135.bundle.js +1 -1
  94. notebook/static/514.bundle.js +1 -1
  95. notebook/static/5261.bundle.js +1 -1
  96. notebook/static/5313.bundle.js +1 -1
  97. notebook/static/5325.bundle.js +1 -1
  98. notebook/static/5346.bundle.js +1 -1
  99. notebook/static/5376.bundle.js +1 -0
  100. notebook/static/5426.bundle.js +1 -1
  101. notebook/static/5573.bundle.js +1 -1
  102. notebook/static/5601.bundle.js +1 -1
  103. notebook/static/5649.bundle.js +3 -3
  104. notebook/static/5733.bundle.js +1 -1
  105. notebook/static/5828.bundle.js +1 -1
  106. notebook/static/5850.bundle.js +1 -1
  107. notebook/static/5874.bundle.js +744 -0
  108. notebook/static/5874.bundle.js.LICENSE.txt +4 -0
  109. notebook/static/5912.bundle.js +1 -1
  110. notebook/static/5921.bundle.js +1 -1
  111. notebook/static/5982.bundle.js +1 -0
  112. notebook/static/6017.bundle.js +1 -1
  113. notebook/static/6027.bundle.js +1 -1
  114. notebook/static/6061.bundle.js +1 -1
  115. notebook/static/6139.bundle.js +1 -1
  116. notebook/static/62.bundle.js +1 -1
  117. notebook/static/6249.bundle.js +1 -0
  118. notebook/static/6256.bundle.js +1 -1
  119. notebook/static/6262.bundle.js +1 -0
  120. notebook/static/6271.bundle.js +1 -1
  121. notebook/static/6345.bundle.js +1 -1
  122. notebook/static/6405.bundle.js +1 -0
  123. notebook/static/6604.bundle.js +1 -1
  124. notebook/static/6621.bundle.js +1 -1
  125. notebook/static/6627.bundle.js +1 -1
  126. notebook/static/6731.bundle.js +1 -1
  127. notebook/static/6815.bundle.js +1 -1
  128. notebook/static/6853.bundle.js +1 -1
  129. notebook/static/6869.bundle.js +1 -0
  130. notebook/static/6893.bundle.js +1 -1
  131. notebook/static/690.bundle.js +1 -1
  132. notebook/static/6962.bundle.js +1 -1
  133. notebook/static/6999.bundle.js +1 -1
  134. notebook/static/7179.bundle.js +1 -0
  135. notebook/static/7226.bundle.js +1 -1
  136. notebook/static/7252.bundle.js +1 -1
  137. notebook/static/7259.bundle.js +1 -0
  138. notebook/static/7302.bundle.js +1 -1
  139. notebook/static/7333.bundle.js +2 -0
  140. notebook/static/7333.bundle.js.LICENSE.txt +9 -0
  141. notebook/static/7339.bundle.js +1 -0
  142. notebook/static/7369.bundle.js +1 -1
  143. notebook/static/7386.bundle.js +1 -1
  144. notebook/static/7391.bundle.js +1 -1
  145. notebook/static/7394.bundle.js +1 -1
  146. notebook/static/7427.bundle.js +1 -1
  147. notebook/static/7450.bundle.js +1 -1
  148. notebook/static/7582.bundle.js +1 -1
  149. notebook/static/7590.bundle.js +1 -0
  150. notebook/static/7603.bundle.js +1 -1
  151. notebook/static/7639.bundle.js +1 -1
  152. notebook/static/7684.bundle.js +1 -1
  153. notebook/static/7811.bundle.js +2 -0
  154. notebook/static/7819.bundle.js +1 -1
  155. notebook/static/7866.bundle.js +1 -1
  156. notebook/static/7900.bundle.js +1 -1
  157. notebook/static/7906.bundle.js +1 -1
  158. notebook/static/7943.bundle.js +1 -0
  159. notebook/static/7957.bundle.js +1 -1
  160. notebook/static/7997.bundle.js +1 -1
  161. notebook/static/8010.bundle.js +1 -1
  162. notebook/static/8032.bundle.js +1 -1
  163. notebook/static/8055.bundle.js +1 -0
  164. notebook/static/8579.bundle.js +1 -1
  165. notebook/static/8633.bundle.js +1 -1
  166. notebook/static/8771.bundle.js +1 -1
  167. notebook/static/8781.bundle.js +1 -0
  168. notebook/static/882.bundle.js +1 -0
  169. notebook/static/8875.bundle.js +1 -1
  170. notebook/static/8907.bundle.js +1 -1
  171. notebook/static/8928.bundle.js +1 -1
  172. notebook/static/8929.bundle.js +1 -1
  173. notebook/static/893.bundle.js +1 -1
  174. notebook/static/901.bundle.js +1 -1
  175. notebook/static/9068.bundle.js +1 -1
  176. notebook/static/911.bundle.js +1 -1
  177. notebook/static/9151.bundle.js +1 -1
  178. notebook/static/9161.bundle.js +1 -0
  179. notebook/static/9239.bundle.js +1 -1
  180. notebook/static/9250.bundle.js +1 -1
  181. notebook/static/9268.bundle.js +1 -1
  182. notebook/static/9284.bundle.js +1 -0
  183. notebook/static/9308.bundle.js +1 -0
  184. notebook/static/9335.bundle.js +1 -1
  185. notebook/static/9341.bundle.js +1 -1
  186. notebook/static/9380.bundle.js +1 -1
  187. notebook/static/9466.bundle.js +1 -0
  188. notebook/static/9554.bundle.js +1 -0
  189. notebook/static/9605.bundle.js +1 -1
  190. notebook/static/9638.bundle.js +1 -1
  191. notebook/static/9680.bundle.js +1 -1
  192. notebook/static/9685.bundle.js +1 -1
  193. notebook/static/9752.bundle.js +1 -1
  194. notebook/static/9799.bundle.js +1 -1
  195. notebook/static/9821.bundle.js +1 -0
  196. notebook/static/9852.bundle.js +1 -1
  197. notebook/static/9987.bundle.js +1 -0
  198. notebook/static/bundle.js +1 -1
  199. notebook/static/third-party-licenses.json +513 -147
  200. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/package.json.orig +15 -15
  201. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/documentsearch-extension/package.json.orig +5 -5
  202. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/package.json.orig +6 -6
  203. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/package.json.orig +10 -10
  204. notebook-7.1.0a1.data/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +17 -0
  205. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/package.json.orig +17 -17
  206. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/package.json +12 -12
  207. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/package.json.orig +11 -11
  208. notebook-7.1.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/50.e41798f78fa32030e149.js +1 -0
  209. notebook-7.1.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.9fa8bfe8da6242a4fc6b.js +1 -0
  210. notebook-7.0.6.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.79046a2eb17bde1af38c.js → notebook-7.1.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.faa0d74ec3a151a81a90.js +1 -1
  211. notebook-7.1.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/93.eae3497dd223d842d198.js +1 -0
  212. notebook-7.1.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.02d92bfa6cab99929020.js +1 -0
  213. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/third-party-licenses.json +4 -4
  214. {notebook-7.0.6.dist-info → notebook-7.1.0a1.dist-info}/METADATA +3 -2
  215. notebook-7.1.0a1.dist-info/RECORD +430 -0
  216. notebook/static/1018.bundle.js +0 -1
  217. notebook/static/4234.bundle.js +0 -1
  218. notebook/static/4746.bundle.js +0 -1
  219. notebook/static/5125.bundle.js +0 -2
  220. notebook/static/5125.bundle.js.LICENSE.txt +0 -9
  221. notebook/static/5678.bundle.js +0 -1
  222. notebook/static/6774.bundle.js +0 -1
  223. notebook/static/6919.bundle.js +0 -7
  224. notebook/static/8548.bundle.js +0 -2
  225. notebook/static/880.bundle.js +0 -1
  226. notebook/static/9086.bundle.js +0 -1
  227. notebook/static/9609.bundle.js +0 -1
  228. notebook/static/9854.bundle.js +0 -2
  229. notebook-7.0.6.data/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +0 -10
  230. notebook-7.0.6.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.1e7b382fb5e84b6e7620.js +0 -1
  231. notebook-7.0.6.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/776.c7baadfaddfd4518c935.js +0 -1
  232. notebook-7.0.6.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/922.0beff4620746e288bd5e.js +0 -1
  233. notebook-7.0.6.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.b2792fe643cae74ea824.js +0 -1
  234. notebook-7.0.6.dist-info/RECORD +0 -389
  235. /notebook/static/{8548.bundle.js.LICENSE.txt → 1326.bundle.js.LICENSE.txt} +0 -0
  236. /notebook/static/{9854.bundle.js.LICENSE.txt → 7811.bundle.js.LICENSE.txt} +0 -0
  237. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/etc/jupyter/jupyter_server_config.d/notebook.json +0 -0
  238. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/applications/jupyter-notebook.desktop +0 -0
  239. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/icons/hicolor/scalable/apps/notebook.svg +0 -0
  240. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/menus.json +0 -0
  241. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/pages.json +0 -0
  242. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/shell.json +0 -0
  243. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/title.json +0 -0
  244. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/top.json +0 -0
  245. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/zen.json +0 -0
  246. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/open.json +0 -0
  247. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/checkpoints.json +0 -0
  248. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/kernel-logo.json +0 -0
  249. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/scroll-output.json +0 -0
  250. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/widget.json +0 -0
  251. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/interface-switcher.json +0 -0
  252. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/launch-tree.json +0 -0
  253. {notebook-7.0.6.data → notebook-7.1.0a1.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/style.js +0 -0
  254. {notebook-7.0.6.dist-info → notebook-7.1.0a1.dist-info}/WHEEL +0 -0
  255. {notebook-7.0.6.dist-info → notebook-7.1.0a1.dist-info}/entry_points.txt +0 -0
  256. {notebook-7.0.6.dist-info → notebook-7.1.0a1.dist-info}/licenses/LICENSE +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3213],{53213:(e,t,s)=>{s.r(t),s.d(t,{ITerminal:()=>o,ITerminalTracker:()=>n,Terminal:()=>l});var i=s(20998);const n=new i.Token("@jupyterlab/terminal:ITerminalTracker","A widget tracker for terminals.\n Use this if you want to be able to iterate over and interact with terminals\n created by the application.");var o;!function(e){e.defaultOptions={theme:"inherit",fontFamily:'Menlo, Consolas, "DejaVu Sans Mono", monospace',fontSize:13,lineHeight:1,scrollback:1e3,shutdownOnClose:!1,closeOnExit:!0,cursorBlink:!0,initialCommand:"",screenReaderMode:!1,pasteWithCtrlV:!0,autoFit:!0,macOptionIsMeta:!1}}(o||(o={}));var r,a=s(49255),h=s(18395),c=s(49503),d=s(9267);class l extends d.Widget{constructor(e,t={},s){super(),this._needsResize=!0,this._offsetWidth=-1,this._offsetHeight=-1,this._isReady=!1,this._ready=new i.PromiseDelegate,this._termOpened=!1,s=s||a.nullTranslator,this._trans=s.load("jupyterlab"),this.session=e,this._options={...o.defaultOptions,...t};const{theme:n,...h}=this._options,c={theme:r.getXTermTheme(n),...h};this.addClass("jp-Terminal"),this._setThemeAttribute(n);let d="";const l=(e,t)=>{"stdout"===t.type&&t.content&&(d+=t.content[0])};e.messageReceived.connect(l),e.disposed.connect((()=>{this.getOption("closeOnExit")&&this.dispose()}),this),r.createTerminal(c).then((([t,s])=>{this._term=t,this._fitAddon=s,this._initializeTerm(),this.id="jp-Terminal-"+r.id++,this.title.label=this._trans.__("Terminal"),this._isReady=!0,this._ready.resolve(),d&&this._term.write(d),e.messageReceived.disconnect(l),e.messageReceived.connect(this._onMessage,this),"connected"===e.connectionStatus?this._initialConnection():e.connectionStatusChanged.connect(this._initialConnection,this),this.update()})).catch((e=>{console.error("Failed to create a terminal.\n",e),this._ready.reject(e)}))}get ready(){return this._ready.promise}getOption(e){return this._options[e]}setOption(e,t){if("theme"===e||this._options[e]!==t&&"initialCommand"!==e){switch(this._options[e]=t,e){case"fontFamily":this._term.options.fontFamily=t;break;case"fontSize":this._term.options.fontSize=t;break;case"lineHeight":this._term.options.lineHeight=t;break;case"screenReaderMode":this._term.options.screenReaderMode=t;break;case"scrollback":this._term.options.scrollback=t;break;case"theme":this._term.options.theme={...r.getXTermTheme(t)},this._setThemeAttribute(t);break;case"macOptionIsMeta":this._term.options.macOptionIsMeta=t}this._needsResize=!0,this.update()}}dispose(){this.session.isDisposed||this.getOption("shutdownOnClose")&&this.session.shutdown().catch((e=>{console.error(`Terminal not shut down: ${e}`)})),this.ready.then((()=>{this._term.dispose()})),super.dispose()}async refresh(){!this.isDisposed&&this._isReady&&(await this.session.reconnect(),this._term.clear())}hasSelection(){return!(this.isDisposed||!this._isReady)&&this._term.hasSelection()}paste(e){if(!this.isDisposed&&this._isReady)return this._term.paste(e)}getSelection(){return!this.isDisposed&&this._isReady?this._term.getSelection():null}processMessage(e){super.processMessage(e),"fit-request"===e.type&&this.onFitRequest(e)}onAfterAttach(e){this.update()}onAfterShow(e){this.update()}onResize(e){this._offsetWidth=e.width,this._offsetHeight=e.height,this._needsResize=!0,this.update()}onUpdateRequest(e){var t;this.isVisible&&this.isAttached&&this._isReady&&(this._termOpened||(this._term.open(this.node),null===(t=this._term.element)||void 0===t||t.classList.add("jp-Terminal-body"),this._termOpened=!0),this._needsResize&&this._resizeTerminal())}onFitRequest(e){const t=d.Widget.ResizeMessage.UnknownSize;c.MessageLoop.sendMessage(this,t)}onActivateRequest(e){var t;null===(t=this._term)||void 0===t||t.focus()}_initialConnection(){this.isDisposed||"connected"===this.session.connectionStatus&&(this.title.label=this._trans.__("Terminal %1",this.session.name),this._setSessionSize(),this._options.initialCommand&&this.session.send({type:"stdin",content:[this._options.initialCommand+"\r"]}),this.session.connectionStatusChanged.disconnect(this._initialConnection,this))}_initializeTerm(){const e=this._term;e.onData((e=>{this.isDisposed||this.session.send({type:"stdin",content:[e]})})),e.onTitleChange((e=>{this.title.label=e})),h.Platform.IS_MAC||e.attachCustomKeyEventHandler((t=>!(t.ctrlKey&&"c"===t.key&&e.hasSelection()||t.ctrlKey&&"v"===t.key&&this._options.pasteWithCtrlV)))}_onMessage(e,t){switch(t.type){case"stdout":t.content&&this._term.write(t.content[0]);break;case"disconnect":this._term.write("\r\n\r\n[Finished… Term Session]\r\n")}}_resizeTerminal(){this._options.autoFit&&this._fitAddon.fit(),-1===this._offsetWidth&&(this._offsetWidth=this.node.offsetWidth),-1===this._offsetHeight&&(this._offsetHeight=this.node.offsetHeight),this._setSessionSize(),this._needsResize=!1}_setSessionSize(){const e=[this._term.rows,this._term.cols,this._offsetHeight,this._offsetWidth];this.isDisposed||this.session.send({type:"set_size",content:e})}_setThemeAttribute(e){this.isDisposed||this.node.setAttribute("data-term-theme",e?e.toLowerCase():"inherit")}}!function(e){e.id=0,e.lightTheme={foreground:"#000",background:"#fff",cursor:"#616161",cursorAccent:"#F5F5F5",selectionBackground:"rgba(97, 97, 97, 0.3)",selectionInactiveBackground:"rgba(189, 189, 189, 0.3)"},e.darkTheme={foreground:"#fff",background:"#000",cursor:"#fff",cursorAccent:"#000",selectionBackground:"rgba(255, 255, 255, 0.3)",selectionInactiveBackground:"rgba(238, 238, 238, 0.3)"},e.inheritTheme=()=>({foreground:getComputedStyle(document.body).getPropertyValue("--jp-ui-font-color0").trim(),background:getComputedStyle(document.body).getPropertyValue("--jp-layout-color0").trim(),cursor:getComputedStyle(document.body).getPropertyValue("--jp-ui-font-color1").trim(),cursorAccent:getComputedStyle(document.body).getPropertyValue("--jp-ui-inverse-font-color0").trim(),selectionBackground:getComputedStyle(document.body).getPropertyValue("--jp-layout-color3").trim(),selectionInactiveBackground:getComputedStyle(document.body).getPropertyValue("--jp-layout-color2").trim()}),e.getXTermTheme=function(t){switch(t){case"light":return e.lightTheme;case"dark":return e.darkTheme;default:return e.inheritTheme()}}}(r||(r={})),function(e){let t,i,n,o,r=!1;function a(e){let t=new o;e.loadAddon(t),r&&t.onContextLoss((s=>{console.debug("WebGL context lost - reinitialize Xtermjs renderer."),t.dispose(),a(e)}))}e.createTerminal=async function(e){var h;if(!t){r=function(){const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");try{return t instanceof WebGLRenderingContext}catch(e){return!1}}();const[e,a,c,d]=await Promise.all([s.e(4997).then(s.t.bind(s,94997,23)),s.e(2758).then(s.t.bind(s,72758,23)),r?s.e(6467).then(s.t.bind(s,6467,23)):s.e(2094).then(s.t.bind(s,12094,23)),s.e(4928).then(s.t.bind(s,44928,23))]);t=e.Terminal,i=a.FitAddon,o=null!==(h=c.WebglAddon)&&void 0!==h?h:c.CanvasAddon,n=d.WebLinksAddon}const c=new t(e);a(c);const d=new i;return c.loadAddon(d),c.loadAddon(new n),[c,d]}}(r||(r={}))}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3213],{53213:(e,t,s)=>{s.r(t),s.d(t,{ITerminal:()=>o,ITerminalTracker:()=>n,Terminal:()=>l});var i=s(20998);const n=new i.Token("@jupyterlab/terminal:ITerminalTracker","A widget tracker for terminals.\n Use this if you want to be able to iterate over and interact with terminals\n created by the application.");var o;!function(e){e.defaultOptions={theme:"inherit",fontFamily:'Menlo, Consolas, "DejaVu Sans Mono", monospace',fontSize:13,lineHeight:1,scrollback:1e3,shutdownOnClose:!1,closeOnExit:!0,cursorBlink:!0,initialCommand:"",screenReaderMode:!1,pasteWithCtrlV:!0,autoFit:!0,macOptionIsMeta:!1}}(o||(o={}));var r,a=s(5944),h=s(18395),c=s(49503),d=s(31516);class l extends d.Widget{constructor(e,t={},s){super(),this._needsResize=!0,this._offsetWidth=-1,this._offsetHeight=-1,this._isReady=!1,this._ready=new i.PromiseDelegate,this._termOpened=!1,s=s||a.nullTranslator,this._trans=s.load("jupyterlab"),this.session=e,this._options={...o.defaultOptions,...t};const{theme:n,...h}=this._options,c={theme:r.getXTermTheme(n),...h};this.addClass("jp-Terminal"),this._setThemeAttribute(n);let d="";const l=(e,t)=>{"stdout"===t.type&&t.content&&(d+=t.content[0])};e.messageReceived.connect(l),e.disposed.connect((()=>{this.getOption("closeOnExit")&&this.dispose()}),this),r.createTerminal(c).then((([t,s])=>{this._term=t,this._fitAddon=s,this._initializeTerm(),this.id="jp-Terminal-"+r.id++,this.title.label=this._trans.__("Terminal"),this._isReady=!0,this._ready.resolve(),d&&this._term.write(d),e.messageReceived.disconnect(l),e.messageReceived.connect(this._onMessage,this),"connected"===e.connectionStatus?this._initialConnection():e.connectionStatusChanged.connect(this._initialConnection,this),this.update()})).catch((e=>{console.error("Failed to create a terminal.\n",e),this._ready.reject(e)}))}get ready(){return this._ready.promise}getOption(e){return this._options[e]}setOption(e,t){if("theme"===e||this._options[e]!==t&&"initialCommand"!==e){switch(this._options[e]=t,e){case"fontFamily":this._term.options.fontFamily=t;break;case"fontSize":this._term.options.fontSize=t;break;case"lineHeight":this._term.options.lineHeight=t;break;case"screenReaderMode":this._term.options.screenReaderMode=t;break;case"scrollback":this._term.options.scrollback=t;break;case"theme":this._term.options.theme={...r.getXTermTheme(t)},this._setThemeAttribute(t);break;case"macOptionIsMeta":this._term.options.macOptionIsMeta=t}this._needsResize=!0,this.update()}}dispose(){this.session.isDisposed||this.getOption("shutdownOnClose")&&this.session.shutdown().catch((e=>{console.error(`Terminal not shut down: ${e}`)})),this.ready.then((()=>{this._term.dispose()})),super.dispose()}async refresh(){!this.isDisposed&&this._isReady&&(await this.session.reconnect(),this._term.clear())}hasSelection(){return!(this.isDisposed||!this._isReady)&&this._term.hasSelection()}paste(e){if(!this.isDisposed&&this._isReady)return this._term.paste(e)}getSelection(){return!this.isDisposed&&this._isReady?this._term.getSelection():null}processMessage(e){super.processMessage(e),"fit-request"===e.type&&this.onFitRequest(e)}onAfterAttach(e){this.update()}onAfterShow(e){this.update()}onResize(e){this._offsetWidth=e.width,this._offsetHeight=e.height,this._needsResize=!0,this.update()}onUpdateRequest(e){var t;this.isVisible&&this.isAttached&&this._isReady&&(this._termOpened||(this._term.open(this.node),null===(t=this._term.element)||void 0===t||t.classList.add("jp-Terminal-body"),this._termOpened=!0),this._needsResize&&this._resizeTerminal())}onFitRequest(e){const t=d.Widget.ResizeMessage.UnknownSize;c.MessageLoop.sendMessage(this,t)}onActivateRequest(e){var t;null===(t=this._term)||void 0===t||t.focus()}_initialConnection(){this.isDisposed||"connected"===this.session.connectionStatus&&(this.title.label=this._trans.__("Terminal %1",this.session.name),this._setSessionSize(),this._options.initialCommand&&this.session.send({type:"stdin",content:[this._options.initialCommand+"\r"]}),this.session.connectionStatusChanged.disconnect(this._initialConnection,this))}_initializeTerm(){const e=this._term;e.onData((e=>{this.isDisposed||this.session.send({type:"stdin",content:[e]})})),e.onTitleChange((e=>{this.title.label=e})),h.Platform.IS_MAC||e.attachCustomKeyEventHandler((t=>!(t.ctrlKey&&"c"===t.key&&e.hasSelection()||t.ctrlKey&&"v"===t.key&&this._options.pasteWithCtrlV)))}_onMessage(e,t){switch(t.type){case"stdout":t.content&&this._term.write(t.content[0]);break;case"disconnect":this._term.write("\r\n\r\n[Finished… Term Session]\r\n")}}_resizeTerminal(){this._options.autoFit&&this._fitAddon.fit(),-1===this._offsetWidth&&(this._offsetWidth=this.node.offsetWidth),-1===this._offsetHeight&&(this._offsetHeight=this.node.offsetHeight),this._setSessionSize(),this._needsResize=!1}_setSessionSize(){const e=[this._term.rows,this._term.cols,this._offsetHeight,this._offsetWidth];this.isDisposed||this.session.send({type:"set_size",content:e})}_setThemeAttribute(e){this.isDisposed||this.node.setAttribute("data-term-theme",e?e.toLowerCase():"inherit")}}!function(e){e.id=0,e.lightTheme={foreground:"#000",background:"#fff",cursor:"#616161",cursorAccent:"#F5F5F5",selectionBackground:"rgba(97, 97, 97, 0.3)",selectionInactiveBackground:"rgba(189, 189, 189, 0.3)"},e.darkTheme={foreground:"#fff",background:"#000",cursor:"#fff",cursorAccent:"#000",selectionBackground:"rgba(255, 255, 255, 0.3)",selectionInactiveBackground:"rgba(238, 238, 238, 0.3)"},e.inheritTheme=()=>({foreground:getComputedStyle(document.body).getPropertyValue("--jp-ui-font-color0").trim(),background:getComputedStyle(document.body).getPropertyValue("--jp-layout-color0").trim(),cursor:getComputedStyle(document.body).getPropertyValue("--jp-ui-font-color1").trim(),cursorAccent:getComputedStyle(document.body).getPropertyValue("--jp-ui-inverse-font-color0").trim(),selectionBackground:getComputedStyle(document.body).getPropertyValue("--jp-layout-color3").trim(),selectionInactiveBackground:getComputedStyle(document.body).getPropertyValue("--jp-layout-color2").trim()}),e.getXTermTheme=function(t){switch(t){case"light":return e.lightTheme;case"dark":return e.darkTheme;default:return e.inheritTheme()}}}(r||(r={})),function(e){let t,i,n,o,r=!1;function a(e){let t=new o;e.loadAddon(t),r&&t.onContextLoss((s=>{console.debug("WebGL context lost - reinitialize Xtermjs renderer."),t.dispose(),a(e)}))}e.createTerminal=async function(e){var h;if(!t){r=function(){const e=document.createElement("canvas"),t=e.getContext("webgl")||e.getContext("experimental-webgl");try{return t instanceof WebGLRenderingContext}catch(e){return!1}}();const[e,a,c,d]=await Promise.all([s.e(4997).then(s.t.bind(s,94997,23)),s.e(2758).then(s.t.bind(s,72758,23)),r?s.e(6467).then(s.t.bind(s,6467,23)):s.e(2094).then(s.t.bind(s,12094,23)),s.e(4928).then(s.t.bind(s,44928,23))]);t=e.Terminal,i=a.FitAddon,o=null!==(h=c.WebglAddon)&&void 0!==h?h:c.CanvasAddon,n=d.WebLinksAddon}const c=new t(e);a(c);const d=new i;return c.loadAddon(d),c.loadAddon(new n),[c,d]}}(r||(r={}))}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3301],{43301:(e,t,n)=>{n.r(t),n.d(t,{CommandRegistry:()=>d});var i,r=n(33625),s=n(20998),a=n(2549),o=n(18395),l=n(80554),c=n(81997);class d{constructor(){this._timerID=0,this._replaying=!1,this._keystrokes=[],this._keydownEvents=[],this._keyBindings=[],this._exactKeyMatch=null,this._commands=new Map,this._commandChanged=new c.Signal(this),this._commandExecuted=new c.Signal(this),this._keyBindingChanged=new c.Signal(this)}get commandChanged(){return this._commandChanged}get commandExecuted(){return this._commandExecuted}get keyBindingChanged(){return this._keyBindingChanged}get keyBindings(){return this._keyBindings}listCommands(){return Array.from(this._commands.keys())}hasCommand(e){return this._commands.has(e)}addCommand(e,t){if(this._commands.has(e))throw new Error(`Command '${e}' already registered.`);return this._commands.set(e,i.createCommand(t)),this._commandChanged.emit({id:e,type:"added"}),new a.DisposableDelegate((()=>{this._commands.delete(e),this._commandChanged.emit({id:e,type:"removed"})}))}notifyCommandChanged(e){if(void 0!==e&&!this._commands.has(e))throw new Error(`Command '${e}' is not registered.`);this._commandChanged.emit({id:e,type:e?"changed":"many-changed"})}describedBy(e,t=s.JSONExt.emptyObject){var n;let i=this._commands.get(e);return Promise.resolve(null!==(n=null==i?void 0:i.describedBy.call(void 0,t))&&void 0!==n?n:{args:null})}label(e,t=s.JSONExt.emptyObject){var n;let i=this._commands.get(e);return null!==(n=null==i?void 0:i.label.call(void 0,t))&&void 0!==n?n:""}mnemonic(e,t=s.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.mnemonic.call(void 0,t):-1}icon(e,t=s.JSONExt.emptyObject){var n;return null===(n=this._commands.get(e))||void 0===n?void 0:n.icon.call(void 0,t)}iconClass(e,t=s.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.iconClass.call(void 0,t):""}iconLabel(e,t=s.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.iconLabel.call(void 0,t):""}caption(e,t=s.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.caption.call(void 0,t):""}usage(e,t=s.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.usage.call(void 0,t):""}className(e,t=s.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.className.call(void 0,t):""}dataset(e,t=s.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.dataset.call(void 0,t):{}}isEnabled(e,t=s.JSONExt.emptyObject){let n=this._commands.get(e);return!!n&&n.isEnabled.call(void 0,t)}isToggled(e,t=s.JSONExt.emptyObject){let n=this._commands.get(e);return!!n&&n.isToggled.call(void 0,t)}isToggleable(e,t=s.JSONExt.emptyObject){let n=this._commands.get(e);return!!n&&n.isToggleable}isVisible(e,t=s.JSONExt.emptyObject){let n=this._commands.get(e);return!!n&&n.isVisible.call(void 0,t)}execute(e,t=s.JSONExt.emptyObject){let n,i=this._commands.get(e);if(!i)return Promise.reject(new Error(`Command '${e}' not registered.`));try{n=i.execute.call(void 0,t)}catch(e){n=Promise.reject(e)}let r=Promise.resolve(n);return this._commandExecuted.emit({id:e,args:t,result:r}),r}addKeyBinding(e){let t=i.createKeyBinding(e);return this._keyBindings.push(t),this._keyBindingChanged.emit({binding:t,type:"added"}),new a.DisposableDelegate((()=>{r.ArrayExt.removeFirstOf(this._keyBindings,t),this._keyBindingChanged.emit({binding:t,type:"removed"})}))}processKeydownEvent(e){if(this._replaying||d.isModifierKeyPressed(e))return;let t=d.keystrokeForKeydownEvent(e);if(!t)return this._replayKeydownEvents(),void this._clearPendingState();this._keystrokes.push(t);let{exact:n,partial:r}=i.matchKeyBinding(this._keyBindings,this._keystrokes,e);return n||r?(e.preventDefault(),e.stopPropagation(),n&&!r?(this._executeKeyBinding(n),void this._clearPendingState()):(n&&(this._exactKeyMatch=n),this._keydownEvents.push(e),void this._startTimer())):(this._replayKeydownEvents(),void this._clearPendingState())}_startTimer(){this._clearTimer(),this._timerID=window.setTimeout((()=>{this._onPendingTimeout()}),i.CHORD_TIMEOUT)}_clearTimer(){0!==this._timerID&&(clearTimeout(this._timerID),this._timerID=0)}_replayKeydownEvents(){0!==this._keydownEvents.length&&(this._replaying=!0,this._keydownEvents.forEach(i.replayKeyEvent),this._replaying=!1)}_executeKeyBinding(e){let{command:t,args:n}=e;if(this.hasCommand(t)&&this.isEnabled(t,n))this.execute(t,n);else{let n=this.hasCommand(t)?"enabled":"registered",i=`Cannot execute key binding '${e.keys.join(", ")}':`,r=`command '${t}' is not ${n}.`;console.warn(`${i} ${r}`)}}_clearPendingState(){this._clearTimer(),this._exactKeyMatch=null,this._keystrokes.length=0,this._keydownEvents.length=0}_onPendingTimeout(){this._timerID=0,this._exactKeyMatch?this._executeKeyBinding(this._exactKeyMatch):this._replayKeydownEvents(),this._clearPendingState()}}!function(e){function t(e){let t="",n=!1,i=!1,r=!1,s=!1;for(let a of e.split(/\s+/))"Accel"===a?o.Platform.IS_MAC?i=!0:r=!0:"Alt"===a?n=!0:"Cmd"===a?i=!0:"Ctrl"===a?r=!0:"Shift"===a?s=!0:a.length>0&&(t=a);return{cmd:i,ctrl:r,alt:n,shift:s,key:t}}function n(e){let n="",i=t(e);return i.ctrl&&(n+="Ctrl "),i.alt&&(n+="Alt "),i.shift&&(n+="Shift "),i.cmd&&o.Platform.IS_MAC&&(n+="Cmd "),n+i.key}e.parseKeystroke=t,e.normalizeKeystroke=n,e.normalizeKeys=function(e){let t;return t=o.Platform.IS_WIN?e.winKeys||e.keys:o.Platform.IS_MAC?e.macKeys||e.keys:e.linuxKeys||e.keys,t.map(n)},e.formatKeystroke=function(e){return"string"==typeof e?n(e):e.map(n).join(", ");function n(e){let n=[],r=o.Platform.IS_MAC?" ":"+",s=t(e);return s.ctrl&&n.push("Ctrl"),s.alt&&n.push("Alt"),s.shift&&n.push("Shift"),o.Platform.IS_MAC&&s.cmd&&n.push("Cmd"),n.push(s.key),n.map(i.formatKey).join(r)}},e.isModifierKeyPressed=function(e){let t=(0,l.getKeyboardLayout)(),n=t.keyForKeydownEvent(e);return t.isModifierKey(n)},e.keystrokeForKeydownEvent=function(e){let t=(0,l.getKeyboardLayout)(),n=t.keyForKeydownEvent(e);if(!n||t.isModifierKey(n))return"";let i=[];return e.ctrlKey&&i.push("Ctrl"),e.altKey&&i.push("Alt"),e.shiftKey&&i.push("Shift"),e.metaKey&&o.Platform.IS_MAC&&i.push("Cmd"),i.push(n),i.join(" ")}}(d||(d={})),function(e){e.CHORD_TIMEOUT=1e3,e.createCommand=function(e){return{execute:e.execute,describedBy:h("function"==typeof e.describedBy?e.describedBy:{args:null,...e.describedBy},(()=>({args:null}))),label:h(e.label,i),mnemonic:h(e.mnemonic,r),icon:h(e.icon,m),iconClass:h(e.iconClass,i),iconLabel:h(e.iconLabel,i),caption:h(e.caption,i),usage:h(e.usage,i),className:h(e.className,i),dataset:h(e.dataset,c),isEnabled:e.isEnabled||a,isToggled:e.isToggled||l,isToggleable:e.isToggleable||!!e.isToggled,isVisible:e.isVisible||a}},e.createKeyBinding=function(e){return{keys:d.normalizeKeys(e),selector:y(e),command:e.command,args:e.args||s.JSONExt.emptyObject}},e.matchKeyBinding=function(e,t,n){let i=null,r=!1,s=1/0,a=0;for(let l=0,c=e.length;l<c;++l){let c=e[l],d=u(c.keys,t);if(0===d)continue;if(2===d){r||-1===g(c.selector,n)||(r=!0);continue}let m=g(c.selector,n);if(-1===m||m>s)continue;let h=o.Selector.calculateSpecificity(c.selector);(!i||m<s||h>=a)&&(i=c,s=m,a=h)}return{exact:i,partial:r}},e.replayKeyEvent=function(e){e.target.dispatchEvent(function(e){let t=document.createEvent("Event"),n=e.bubbles||!0,i=e.cancelable||!0;return t.initEvent(e.type||"keydown",n,i),t.key=e.key||"",t.keyCode=e.keyCode||0,t.which=e.keyCode||0,t.ctrlKey=e.ctrlKey||!1,t.altKey=e.altKey||!1,t.shiftKey=e.shiftKey||!1,t.metaKey=e.metaKey||!1,t.view=e.view||window,t}(e))},e.formatKey=function(e){return o.Platform.IS_MAC?t.hasOwnProperty(e)?t[e]:e:n.hasOwnProperty(e)?n[e]:e};const t={Backspace:"⌫",Tab:"⇥",Enter:"⏎",Shift:"⇧",Ctrl:"⌃",Alt:"⌥",Escape:"⎋",PageUp:"⇞",PageDown:"⇟",End:"↘",Home:"↖",ArrowLeft:"←",ArrowUp:"↑",ArrowRight:"→",ArrowDown:"↓",Delete:"⌦",Cmd:"⌘"},n={Escape:"Esc",PageUp:"Page Up",PageDown:"Page Down",ArrowLeft:"Left",ArrowUp:"Up",ArrowRight:"Right",ArrowDown:"Down",Delete:"Del"},i=()=>"",r=()=>-1,a=()=>!0,l=()=>!1,c=()=>({}),m=()=>{};function h(e,t){return void 0===e?t:"function"==typeof e?e:()=>e}function y(e){if(-1!==e.selector.indexOf(","))throw new Error(`Selector cannot contain commas: ${e.selector}`);if(!o.Selector.isValid(e.selector))throw new Error(`Invalid selector: ${e.selector}`);return e.selector}function u(e,t){if(e.length<t.length)return 0;for(let n=0,i=t.length;n<i;++n)if(e[n]!==t[n])return 0;return e.length>t.length?2:1}function g(e,t){let n=t.target,i=t.currentTarget;for(let t=0;null!==n;n=n.parentElement,++t){if(n.hasAttribute("data-lm-suppress-shortcuts"))return-1;if(o.Selector.matches(n,e))return t;if(n===i)return-1}return-1}}(i||(i={}))}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3301],{43301:(e,t,n)=>{n.r(t),n.d(t,{CommandRegistry:()=>d});var i,s=n(33625),r=n(20998),a=n(2549),o=n(18395),l=n(80554),c=n(81997);class d{constructor(){this._timerID=0,this._replaying=!1,this._keystrokes=[],this._keydownEvents=[],this._keyBindings=[],this._exactKeyMatch=null,this._commands=new Map,this._commandChanged=new c.Signal(this),this._commandExecuted=new c.Signal(this),this._keyBindingChanged=new c.Signal(this)}get commandChanged(){return this._commandChanged}get commandExecuted(){return this._commandExecuted}get keyBindingChanged(){return this._keyBindingChanged}get keyBindings(){return this._keyBindings}listCommands(){return Array.from(this._commands.keys())}hasCommand(e){return this._commands.has(e)}addCommand(e,t){if(this._commands.has(e))throw new Error(`Command '${e}' already registered.`);return this._commands.set(e,i.createCommand(t)),this._commandChanged.emit({id:e,type:"added"}),new a.DisposableDelegate((()=>{this._commands.delete(e),this._commandChanged.emit({id:e,type:"removed"})}))}notifyCommandChanged(e){if(void 0!==e&&!this._commands.has(e))throw new Error(`Command '${e}' is not registered.`);this._commandChanged.emit({id:e,type:e?"changed":"many-changed"})}describedBy(e,t=r.JSONExt.emptyObject){var n;let i=this._commands.get(e);return Promise.resolve(null!==(n=null==i?void 0:i.describedBy.call(void 0,t))&&void 0!==n?n:{args:null})}label(e,t=r.JSONExt.emptyObject){var n;let i=this._commands.get(e);return null!==(n=null==i?void 0:i.label.call(void 0,t))&&void 0!==n?n:""}mnemonic(e,t=r.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.mnemonic.call(void 0,t):-1}icon(e,t=r.JSONExt.emptyObject){var n;return null===(n=this._commands.get(e))||void 0===n?void 0:n.icon.call(void 0,t)}iconClass(e,t=r.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.iconClass.call(void 0,t):""}iconLabel(e,t=r.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.iconLabel.call(void 0,t):""}caption(e,t=r.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.caption.call(void 0,t):""}usage(e,t=r.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.usage.call(void 0,t):""}className(e,t=r.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.className.call(void 0,t):""}dataset(e,t=r.JSONExt.emptyObject){let n=this._commands.get(e);return n?n.dataset.call(void 0,t):{}}isEnabled(e,t=r.JSONExt.emptyObject){let n=this._commands.get(e);return!!n&&n.isEnabled.call(void 0,t)}isToggled(e,t=r.JSONExt.emptyObject){let n=this._commands.get(e);return!!n&&n.isToggled.call(void 0,t)}isToggleable(e,t=r.JSONExt.emptyObject){let n=this._commands.get(e);return!!n&&n.isToggleable}isVisible(e,t=r.JSONExt.emptyObject){let n=this._commands.get(e);return!!n&&n.isVisible.call(void 0,t)}execute(e,t=r.JSONExt.emptyObject){let n,i=this._commands.get(e);if(!i)return Promise.reject(new Error(`Command '${e}' not registered.`));try{n=i.execute.call(void 0,t)}catch(e){n=Promise.reject(e)}let s=Promise.resolve(n);return this._commandExecuted.emit({id:e,args:t,result:s}),s}addKeyBinding(e){let t=i.createKeyBinding(e);return this._keyBindings.push(t),this._keyBindingChanged.emit({binding:t,type:"added"}),new a.DisposableDelegate((()=>{s.ArrayExt.removeFirstOf(this._keyBindings,t),this._keyBindingChanged.emit({binding:t,type:"removed"})}))}processKeydownEvent(e){if(this._replaying||d.isModifierKeyPressed(e))return;let t=d.keystrokeForKeydownEvent(e);if(!t)return this._replayKeydownEvents(),void this._clearPendingState();this._keystrokes.push(t);let{exact:n,partial:s}=i.matchKeyBinding(this._keyBindings,this._keystrokes,e);return n||s?(e.preventDefault(),e.stopPropagation(),n&&!s?(this._executeKeyBinding(n),void this._clearPendingState()):(n&&(this._exactKeyMatch=n),this._keydownEvents.push(e),void this._startTimer())):(this._replayKeydownEvents(),void this._clearPendingState())}_startTimer(){this._clearTimer(),this._timerID=window.setTimeout((()=>{this._onPendingTimeout()}),i.CHORD_TIMEOUT)}_clearTimer(){0!==this._timerID&&(clearTimeout(this._timerID),this._timerID=0)}_replayKeydownEvents(){0!==this._keydownEvents.length&&(this._replaying=!0,this._keydownEvents.forEach(i.replayKeyEvent),this._replaying=!1)}_executeKeyBinding(e){let{command:t,args:n}=e,i={_luminoEvent:{type:"keybinding",keys:e.keys},...n};if(this.hasCommand(t)&&this.isEnabled(t,i))this.execute(t,i);else{let n=this.hasCommand(t)?"enabled":"registered",i=`Cannot execute key binding '${e.keys.join(", ")}':`,s=`command '${t}' is not ${n}.`;console.warn(`${i} ${s}`)}}_clearPendingState(){this._clearTimer(),this._exactKeyMatch=null,this._keystrokes.length=0,this._keydownEvents.length=0}_onPendingTimeout(){this._timerID=0,this._exactKeyMatch?this._executeKeyBinding(this._exactKeyMatch):this._replayKeydownEvents(),this._clearPendingState()}}!function(e){function t(e){let t="",n=!1,i=!1,s=!1,r=!1;for(let a of e.split(/\s+/))"Accel"===a?o.Platform.IS_MAC?i=!0:s=!0:"Alt"===a?n=!0:"Cmd"===a?i=!0:"Ctrl"===a?s=!0:"Shift"===a?r=!0:a.length>0&&(t=a);return{cmd:i,ctrl:s,alt:n,shift:r,key:t}}function n(e){let n="",i=t(e);return i.ctrl&&(n+="Ctrl "),i.alt&&(n+="Alt "),i.shift&&(n+="Shift "),i.cmd&&o.Platform.IS_MAC&&(n+="Cmd "),n+i.key}e.parseKeystroke=t,e.normalizeKeystroke=n,e.normalizeKeys=function(e){let t;return t=o.Platform.IS_WIN?e.winKeys||e.keys:o.Platform.IS_MAC?e.macKeys||e.keys:e.linuxKeys||e.keys,t.map(n)},e.formatKeystroke=function(e){return"string"==typeof e?n(e):e.map(n).join(", ");function n(e){let n=[],s=o.Platform.IS_MAC?" ":"+",r=t(e);return r.ctrl&&n.push("Ctrl"),r.alt&&n.push("Alt"),r.shift&&n.push("Shift"),o.Platform.IS_MAC&&r.cmd&&n.push("Cmd"),n.push(r.key),n.map(i.formatKey).join(s)}},e.isModifierKeyPressed=function(e){let t=(0,l.getKeyboardLayout)(),n=t.keyForKeydownEvent(e);return t.isModifierKey(n)},e.keystrokeForKeydownEvent=function(e){let t=(0,l.getKeyboardLayout)(),n=t.keyForKeydownEvent(e);if(!n||t.isModifierKey(n))return"";let i=[];return e.ctrlKey&&i.push("Ctrl"),e.altKey&&i.push("Alt"),e.shiftKey&&i.push("Shift"),e.metaKey&&o.Platform.IS_MAC&&i.push("Cmd"),i.push(n),i.join(" ")}}(d||(d={})),function(e){e.CHORD_TIMEOUT=1e3,e.createCommand=function(e){return{execute:e.execute,describedBy:h("function"==typeof e.describedBy?e.describedBy:{args:null,...e.describedBy},(()=>({args:null}))),label:h(e.label,i),mnemonic:h(e.mnemonic,s),icon:h(e.icon,m),iconClass:h(e.iconClass,i),iconLabel:h(e.iconLabel,i),caption:h(e.caption,i),usage:h(e.usage,i),className:h(e.className,i),dataset:h(e.dataset,c),isEnabled:e.isEnabled||a,isToggled:e.isToggled||l,isToggleable:e.isToggleable||!!e.isToggled,isVisible:e.isVisible||a}},e.createKeyBinding=function(e){return{keys:d.normalizeKeys(e),selector:y(e),command:e.command,args:e.args||r.JSONExt.emptyObject}},e.matchKeyBinding=function(e,t,n){let i=null,s=!1,r=1/0,a=0;for(let l=0,c=e.length;l<c;++l){let c=e[l],d=u(c.keys,t);if(0===d)continue;if(2===d){s||-1===g(c.selector,n)||(s=!0);continue}let m=g(c.selector,n);if(-1===m||m>r)continue;let h=o.Selector.calculateSpecificity(c.selector);(!i||m<r||h>=a)&&(i=c,r=m,a=h)}return{exact:i,partial:s}},e.replayKeyEvent=function(e){e.target.dispatchEvent(function(e){let t=document.createEvent("Event"),n=e.bubbles||!0,i=e.cancelable||!0;return t.initEvent(e.type||"keydown",n,i),t.key=e.key||"",t.keyCode=e.keyCode||0,t.which=e.keyCode||0,t.ctrlKey=e.ctrlKey||!1,t.altKey=e.altKey||!1,t.shiftKey=e.shiftKey||!1,t.metaKey=e.metaKey||!1,t.view=e.view||window,t}(e))},e.formatKey=function(e){return o.Platform.IS_MAC?t.hasOwnProperty(e)?t[e]:e:n.hasOwnProperty(e)?n[e]:e};const t={Backspace:"⌫",Tab:"⇥",Enter:"⏎",Shift:"⇧",Ctrl:"⌃",Alt:"⌥",Escape:"⎋",PageUp:"⇞",PageDown:"⇟",End:"↘",Home:"↖",ArrowLeft:"←",ArrowUp:"↑",ArrowRight:"→",ArrowDown:"↓",Delete:"⌦",Cmd:"⌘"},n={Escape:"Esc",PageUp:"Page Up",PageDown:"Page Down",ArrowLeft:"Left",ArrowUp:"Up",ArrowRight:"Right",ArrowDown:"Down",Delete:"Del"},i=()=>"",s=()=>-1,a=()=>!0,l=()=>!1,c=()=>({}),m=()=>{};function h(e,t){return void 0===e?t:"function"==typeof e?e:()=>e}function y(e){if(-1!==e.selector.indexOf(","))throw new Error(`Selector cannot contain commas: ${e.selector}`);if(!o.Selector.isValid(e.selector))throw new Error(`Invalid selector: ${e.selector}`);return e.selector}function u(e,t){if(e.length<t.length)return 0;for(let n=0,i=t.length;n<i;++n)if(e[n]!==t[n])return 0;return e.length>t.length?2:1}function g(e,t){let n=t.target,i=t.currentTarget;for(let t=0;null!==n;n=n.parentElement,++t){if(n.hasAttribute("data-lm-suppress-shortcuts"))return-1;if(o.Selector.matches(n,e))return t;if(n===i)return-1}return-1}}(i||(i={}))}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3340],{33340:(e,t,r)=>{r.r(t),r.d(t,{default:()=>p});var o=r(45395),n=r(20457),a=r(59361),i=r(78156),s=r.n(i);const l="availableProviders";function c(e){const{schema:t}=e,r=t.title,o=t.description,n=e.formContext.settings,a=n.get(l).user,c={...t.default};if(a)for(const e of Object.keys(c))c[e]=e in a?a[e]:-1;const[d,m]=(0,i.useState)(c);return s().createElement("div",null,s().createElement("fieldset",null,s().createElement("legend",null,r),s().createElement("p",{className:"field-description"},o),Object.keys(c).map((e=>s().createElement("div",{key:e,className:"form-group small-field"},s().createElement("div",null,s().createElement("h3",null," ",e),s().createElement("div",{className:"inputFieldWrapper"},s().createElement("input",{className:"form-control",type:"number",value:d[e],onChange:t=>{((e,t)=>{const r={...d,[e]:parseInt(t.target.value)};n.set(l,r).catch(console.error),m(r)})(e,t)}}))))))))}const d="@jupyterlab/completer-extension:manager",m={id:"@jupyterlab/completer-extension:base-service",description:"Adds context and kernel completion providers.",requires:[o.ICompletionProviderManager],autoStart:!0,activate:(e,t)=>{t.registerProvider(new o.ContextCompleterProvider),t.registerProvider(new o.KernelCompleterProvider)}},u={id:d,description:"Provides the completion provider manager.",requires:[n.ISettingRegistry],optional:[a.IFormRendererRegistry],provides:o.ICompletionProviderManager,autoStart:!0,activate:(e,t,r)=>{const n="availableProviders",a=new o.CompletionProviderManager,i=(e,t)=>{var r;const o=e.get(n),i=e.get("providerTimeout"),s=e.get("showDocumentationPanel"),l=e.get("autoCompletion");a.setTimeout(i.composite),a.setShowDocumentationPanel(s.composite),a.setContinuousHinting(l.composite);const c=null!==(r=o.user)&&void 0!==r?r:o.composite,d=Object.entries(null!=c?c:{}).filter((e=>e[1]>=0&&t.includes(e[0]))).sort((([,e],[,t])=>t-e)).map((e=>e[0]));a.activateProvider(d)};if(e.restored.then((()=>{const e=[...a.getProviders().entries()],r=e.map((([e,t])=>e));t.transform(d,{fetch:t=>{const r=t.schema.properties,o={};return e.forEach((([e,t],r)=>{var n;o[e]=null!==(n=t.rank)&&void 0!==n?n:10*(r+1)})),r[n].default=o,t}}),t.load(d).then((e=>{i(e,r),e.changed.connect((e=>{i(e,r)}))})).catch(console.error)})).catch(console.error),r){const e={fieldRenderer:e=>c(e)};r.addRenderer(`${d}.availableProviders`,e)}return a}},p=[u,m]}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3340],{33340:(e,n,t)=>{t.r(n),t.d(n,{default:()=>y});var o=t(70798),i=t(79185),r=t(50727),l=t(5944),a=t(32895),c=t(78156),s=t.n(c);const d="availableProviders";function m(e){const{schema:n}=e,t=n.title,o=n.description,i=e.formContext.settings,r=i.get(d).user,l={...n.default};if(r)for(const e of Object.keys(l))l[e]=e in r?r[e]:-1;const[a,m]=(0,c.useState)(l);return s().createElement("div",null,s().createElement("fieldset",null,s().createElement("legend",null,t),s().createElement("p",{className:"field-description"},o),Object.keys(l).map((e=>s().createElement("div",{key:e,className:"form-group small-field"},s().createElement("div",null,s().createElement("h3",null," ",e),s().createElement("div",{className:"inputFieldWrapper"},s().createElement("input",{className:"form-control",type:"number",value:a[e],onChange:n=>{((e,n)=>{const t={...a,[e]:parseInt(n.target.value)};i.set(d,t).catch(console.error),m(t)})(e,n)}}))))))))}const p="@jupyterlab/completer-extension:manager",u="@jupyterlab/completer-extension:inline-completer";var v;!function(e){e.nextInline="inline-completer:next",e.previousInline="inline-completer:previous",e.acceptInline="inline-completer:accept",e.invokeInline="inline-completer:invoke"}(v||(v={}));const f={id:"@jupyterlab/completer-extension:base-service",description:"Adds context and kernel completion providers.",requires:[i.ICompletionProviderManager],autoStart:!0,activate:(e,n)=>{n.registerProvider(new i.ContextCompleterProvider),n.registerProvider(new i.KernelCompleterProvider)}},b={id:"@jupyterlab/completer-extension:inline-history",description:"Adds inline completion provider suggesting code from execution history.",requires:[i.ICompletionProviderManager],optional:[l.ITranslator],autoStart:!0,activate:(e,n,t)=>{n.registerInlineProvider(new i.HistoryInlineCompletionProvider({translator:null!=t?t:l.nullTranslator}))}},I={id:"@jupyterlab/completer-extension:inline-completer-factory",description:"Provides a factory for inline completer.",provides:i.IInlineCompleterFactory,optional:[l.ITranslator],autoStart:!0,activate:(e,n)=>{const t=(n||l.nullTranslator).load("jupyterlab");return{factory:n=>{const r=new i.InlineCompleter({...n,trans:t}),l=n=>{const t=e.commands.keyBindings.find((e=>e.command===n)),o=t?a.CommandRegistry.formatKeystroke(t.keys):"";return o?`${o}`:""};return r.toolbar.addItem("previous-inline-completion",new o.CommandToolbarButton({commands:e.commands,icon:o.caretLeftIcon,id:v.previousInline,label:l(v.previousInline),caption:t.__("Previous")})),r.toolbar.addItem("next-inline-completion",new o.CommandToolbarButton({commands:e.commands,icon:o.caretRightIcon,id:v.nextInline,label:l(v.nextInline),caption:t.__("Next")})),r.toolbar.addItem("accept-inline-completion",new o.CommandToolbarButton({commands:e.commands,icon:o.checkIcon,id:v.acceptInline,label:l(v.acceptInline),caption:t.__("Accept")})),r}}}},g={id:u,description:"Provides a factory for inline completer.",requires:[i.ICompletionProviderManager,i.IInlineCompleterFactory,r.ISettingRegistry],optional:[l.ITranslator],autoStart:!0,activate:(e,n,t,o,i)=>{n.setInlineCompleterFactory(t);const r=(i||l.nullTranslator).load("jupyterlab"),a=()=>!!e.shell.currentWidget&&!!n.inline;e.commands.addCommand(v.nextInline,{execute:()=>{var t;null===(t=n.inline)||void 0===t||t.cycle(e.shell.currentWidget.id,"next")},label:r.__("Next Inline Completion"),isEnabled:a}),e.commands.addCommand(v.previousInline,{execute:()=>{var t;null===(t=n.inline)||void 0===t||t.cycle(e.shell.currentWidget.id,"previous")},label:r.__("Previous Inline Completion"),isEnabled:a}),e.commands.addCommand(v.acceptInline,{execute:()=>{var t;null===(t=n.inline)||void 0===t||t.accept(e.shell.currentWidget.id)},label:r.__("Accept Inline Completion"),isEnabled:a}),e.commands.addCommand(v.invokeInline,{execute:()=>{var t;null===(t=n.inline)||void 0===t||t.invoke(e.shell.currentWidget.id)},label:r.__("Invoke Inline Completer"),isEnabled:a});const c=e=>{var t;null===(t=n.inline)||void 0===t||t.configure(e.composite)};e.restored.then((()=>{var e;const t=null!==(e=n.inlineProviders)&&void 0!==e?e:[],i=e=>{var n,t;return{enabled:!0,timeout:5e3,debouncerDelay:0,...null!==(t=null===(n=e.schema)||void 0===n?void 0:n.default)&&void 0!==t?t:{}}};o.transform(u,{compose:e=>{var n,o;const r=null!==(n=e.data.composite.providers)&&void 0!==n?n:{};for(const e of t){const n=i(e);r[e.identifier]={...n,...null!==(o=r[e.identifier])&&void 0!==o?o:{}}}return e.data.composite.providers=r,e},fetch:e=>{var n,o;const l=e.schema.properties,a={};for(const e of t)a[e.identifier]={title:r.__("%1 provider",e.name),properties:{...null!==(o=null===(n=e.schema)||void 0===n?void 0:n.properties)&&void 0!==o?o:{},timeout:{title:r.__("Timeout"),description:r.__("Timeout for %1 provider (in milliseconds).",e.name),type:"number",minimum:0},debouncerDelay:{title:r.__("Debouncer delay"),minimum:0,description:r.__("Time since the last key press to wait before requesting completions from %1 provider (in milliseconds).",e.name),type:"number"},enabled:{title:r.__("Enabled"),description:r.__("Whether to fetch completions %1 provider.",e.name),type:"boolean"}},default:i(e),type:"object"};return l.providers.properties=a,e}}),o.load(u).then((e=>{c(e),e.changed.connect((e=>{c(e)}))})).catch(console.error)})).catch(console.error)}},h={id:p,description:"Provides the completion provider manager.",requires:[r.ISettingRegistry],optional:[o.IFormRendererRegistry],provides:i.ICompletionProviderManager,autoStart:!0,activate:(e,n,t)=>{const o="availableProviders",r=new i.CompletionProviderManager,l=(e,n)=>{var t;const i=e.get(o),l=e.get("providerTimeout"),a=e.get("showDocumentationPanel"),c=e.get("autoCompletion");r.setTimeout(l.composite),r.setShowDocumentationPanel(a.composite),r.setContinuousHinting(c.composite);const s=null!==(t=i.user)&&void 0!==t?t:i.composite,d=Object.entries(null!=s?s:{}).filter((e=>e[1]>=0&&n.includes(e[0]))).sort((([,e],[,n])=>n-e)).map((e=>e[0]));r.activateProvider(d)};if(e.restored.then((()=>{const e=[...r.getProviders().entries()],t=e.map((([e,n])=>e));n.transform(p,{fetch:n=>{const t=n.schema.properties,i={};return e.forEach((([e,n],t)=>{var o;i[e]=null!==(o=n.rank)&&void 0!==o?o:10*(t+1)})),t[o].default=i,n}}),n.load(p).then((e=>{l(e,t),e.changed.connect((e=>{l(e,t)}))})).catch(console.error)})).catch(console.error),t){const e={fieldRenderer:e=>m(e)};t.addRenderer(`${p}.availableProviders`,e)}return r}},y=[h,f,b,I,g]}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3360],{63360:(t,e,s)=>{s.r(e),s.d(e,{IJSONSettingEditorTracker:()=>W.g,ISettingEditorTracker:()=>W.O,JsonSettingEditor:()=>M,SettingsEditor:()=>S});var i=s(56165),r=s(49255),n=s(59361),a=s(81997),o=s(9267),l=s(78156),d=s.n(l),h=s(33625);class c extends i.ReactWidget{constructor(t){var e;super(),this._changed=new a.Signal(this),this._handleSelectSignal=new a.Signal(this),this._updateFilterSignal=new a.Signal(this),this._allPlugins=[],this._settings={},this._scrollTop=0,this._selection="",this.registry=t.registry,this.translator=t.translator||r.nullTranslator,this.addClass("jp-PluginList"),this._confirm=t.confirm,this.registry.pluginChanged.connect((()=>{this.update()}),this),this.mapPlugins=this.mapPlugins.bind(this),this.setFilter=this.setFilter.bind(this),this.setFilter(t.query?(0,n.updateFilterFunction)(t.query,!1,!1):null),this.setError=this.setError.bind(this),this._evtMousedown=this._evtMousedown.bind(this),this._query=null!==(e=t.query)&&void 0!==e?e:"",this._allPlugins=c.sortPlugins(this.registry).filter((e=>{var s;const{schema:i}=e,r=!0===i["jupyter.lab.setting-deprecated"],n=Object.keys(i.properties||{}).length>0,a=!1!==i.additionalProperties,o=this._confirm||!this._confirm&&!(null!==(s=t.toSkip)&&void 0!==s?s:[]).includes(e.id);return!r&&o&&(n||a)})),(async()=>{for(const t of this._allPlugins){const e=await this.registry.load(t.id);this._settings[t.id]=e}this.update()})(),this._errors={}}get changed(){return this._changed}get scrollTop(){var t;return null===(t=this.node.querySelector("ul"))||void 0===t?void 0:t.scrollTop}get hasErrors(){for(const t in this._errors)if(this._errors[t])return!0;return!1}get filter(){return this._filter}get selection(){return this._selection}set selection(t){this._selection=t,this.update()}get updateFilterSignal(){return this._updateFilterSignal}get handleSelectSignal(){return this._handleSelectSignal}onUpdateRequest(t){const e=this.node.querySelector("ul");e&&void 0!==this._scrollTop&&(e.scrollTop=this._scrollTop),super.onUpdateRequest(t)}_evtMousedown(t){const e=t.currentTarget.getAttribute("data-id");e&&(this._confirm?this._confirm(e).then((()=>{this.selection=e,this._changed.emit(void 0),this.update()})).catch((()=>{})):(this._scrollTop=this.scrollTop,this._selection=e,this._handleSelectSignal.emit(e),this._changed.emit(void 0),this.update()))}getHint(t,e,s){let i=s.data.user[t];if(i||(i=s.data.composite[t]),i||(i=s.schema[t]),!i){const{properties:s}=e.schema;i=s&&s[t]&&s[t].default}return"string"==typeof i?i:""}getFilterString(t,e,s,i){var r;if(i&&s&&(i=i.replace("#/definitions/",""),e=null!==(r=s[i])&&void 0!==r?r:{}),e.properties)e=e.properties;else{if(!e.items)return[];e=e.items}return e.$ref?this.getFilterString(t,e,s,e.$ref):0===Object.keys(e).length?[]:Object.keys(e).reduce(((i,r)=>{var n,a;const o=e[r];if(!o){if(t(null!==(n=e.title)&&void 0!==n?n:""))return e.title;if(t(r))return r}return t(null!==(a=o.title)&&void 0!==a?a:"")&&i.push(o.title),t(r)&&i.push(r),i.concat(this.getFilterString(t,o,s,o.$ref)),i}),[])}setFilter(t,e){this._filter=t?e=>{var s,i;return!t||t(null!==(s=e.schema.title)&&void 0!==s?s:"")?null:this.getFilterString(t,null!==(i=e.schema)&&void 0!==i?i:{},e.schema.definitions)}:null,this._query=e,this._updateFilterSignal.emit(this._filter),this.update()}setError(t,e){this._errors[t]!==e?(this._errors[t]=e,this.update()):this._errors[t]=e}mapPlugins(t){var e,s,i,r;const{id:a,schema:o,version:l}=t,c=this.translator.load("jupyterlab"),u="string"==typeof o.title?c._p("schema",o.title):a,p=h.StringExt.matchSumOfSquares(u.toLocaleLowerCase(),null!==(s=null===(e=this._query)||void 0===e?void 0:e.toLocaleLowerCase())&&void 0!==s?s:""),g=h.StringExt.highlight(u,null!==(i=null==p?void 0:p.indices)&&void 0!==i?i:[],(t=>d().createElement("mark",null,t))),_=`${"string"==typeof o.description?c._p("schema",o.description):""}\n${a}\n${l}`,m=this.getHint("jupyter.lab.setting-icon",this.registry,t),v=this.getHint("jupyter.lab.setting-icon-class",this.registry,t),f=this.getHint("jupyter.lab.setting-icon-label",this.registry,t),S=this._filter?null===(r=this._filter(t))||void 0===r?void 0:r.map((t=>{var e,s,i;const r=h.StringExt.matchSumOfSquares(t.toLocaleLowerCase(),null!==(s=null===(e=this._query)||void 0===e?void 0:e.toLocaleLowerCase())&&void 0!==s?s:""),n=h.StringExt.highlight(t,null!==(i=null==r?void 0:r.indices)&&void 0!==i?i:[],(t=>d().createElement("mark",null,t)));return d().createElement("li",{key:`${a}-${t}`}," ",n," ")})):void 0;return d().createElement("div",{onClick:this._evtMousedown,className:`${a===this.selection?"jp-mod-selected jp-PluginList-entry":"jp-PluginList-entry"} ${this._errors[a]?"jp-ErrorPlugin":""}`,"data-id":a,key:a,title:_},d().createElement("div",{className:"jp-PluginList-entry-label",role:"tab"},d().createElement("div",{className:"jp-SelectedIndicator"}),d().createElement(n.LabIcon.resolveReact,{icon:m||(v?void 0:n.settingsIcon),iconClass:(0,n.classes)(v,"jp-Icon"),title:f,tag:"span",stylesheet:"settingsEditor"}),d().createElement("span",{className:"jp-PluginList-entry-label-text"},g)),d().createElement("ul",null,S))}render(){const t=this.translator.load("jupyterlab"),e=this._allPlugins.filter((t=>{if(!this._filter)return!1;const e=this._filter(t);return null===e||e.length>0})),s=e.filter((t=>{var e;return null===(e=this._settings[t.id])||void 0===e?void 0:e.isModified})),i=s.map(this.mapPlugins),r=e.filter((t=>!s.includes(t))).map(this.mapPlugins);return d().createElement("div",{className:"jp-PluginList-wrapper"},d().createElement(n.FilterBox,{updateFilter:this.setFilter,useFuzzyFilter:!1,placeholder:t.__("Search…"),forceRefresh:!1,caseSensitive:!1,initialQuery:this._query}),i.length>0&&d().createElement("div",null,d().createElement("h1",{className:"jp-PluginList-header"},t.__("Modified")),d().createElement("ul",null,i)),r.length>0&&d().createElement("div",null,d().createElement("h1",{className:"jp-PluginList-header"},t.__("Settings")),d().createElement("ul",null,r)),0===i.length&&0===r.length&&d().createElement("p",{className:"jp-PluginList-noResults"},t.__("No items match your search.")))}}!function(t){t.sortPlugins=function(t){return Object.keys(t.plugins).map((e=>t.plugins[e])).sort(((t,e)=>(t.schema.title||t.id).localeCompare(e.schema.title||e.id)))}}(c||(c={}));var u=s(20998),p=s(97934),g=s(89319),_=s.n(g);class m extends d().Component{constructor(t){super(t),this.reset=async t=>{t.stopPropagation();for(const t in this.props.settings.user)await this.props.settings.remove(t);this._formData=this.props.settings.composite,this.setState({isModified:!1})},this._onChange=t=>{this.props.hasError(0!==t.errors.length),this._formData=t.formData,0===t.errors.length&&(this.props.updateDirtyState(!0),this._debouncer.invoke()),this.props.onSelect(this.props.settings.id)};const{settings:e}=t;this._formData=e.composite,this.state={isModified:e.isModified,uiSchema:{},filteredSchema:this.props.settings.schema,formContext:{defaultFormData:this.props.settings.default(),settings:this.props.settings}},this.handleChange=this.handleChange.bind(this),this._debouncer=new p.Debouncer(this.handleChange)}componentDidMount(){this._setUiSchema(),this._setFilteredSchema()}componentDidUpdate(t){this._setUiSchema(t.renderers[t.settings.id]),this._setFilteredSchema(t.filteredValues),t.settings!==this.props.settings&&this.setState({formContext:{settings:this.props.settings,defaultFormData:this.props.settings.default()}})}componentWillUnmount(){this._debouncer.dispose()}handleChange(){!this.props.settings.isModified&&this._formData&&this.props.settings.isDefault(this._formData)?this.props.updateDirtyState(!1):this.props.settings.save(JSON.stringify(this._formData,void 0,4)).then((()=>{this.props.updateDirtyState(!1),this.setState({isModified:this.props.settings.isModified})})).catch((t=>{this.props.updateDirtyState(!1);const e=this.props.translator.load("jupyterlab");(0,i.showErrorMessage)(e.__("Error saving settings."),t)}))}render(){const t=this.props.translator.load("jupyterlab");return d().createElement(d().Fragment,null,d().createElement("div",{className:"jp-SettingsHeader"},d().createElement("h2",{className:"jp-SettingsHeader-title",title:this.props.settings.schema.description},this.props.settings.schema.title),d().createElement("div",{className:"jp-SettingsHeader-buttonbar"},this.state.isModified&&d().createElement(n.Button,{className:"jp-RestoreButton",onClick:this.reset},t.__("Restore to Defaults"))),d().createElement("div",{className:"jp-SettingsHeader-description"},this.props.settings.schema.description)),d().createElement(n.FormComponent,{validator:_(),schema:this.state.filteredSchema,formData:this._getFilteredFormData(this.state.filteredSchema),uiSchema:this.state.uiSchema,fields:this.props.renderers[this.props.settings.id],formContext:this.state.formContext,liveValidate:!0,idPrefix:`jp-SettingsEditor-${this.props.settings.id}`,onChange:this._onChange,translator:this.props.translator}))}_setUiSchema(t){var e;const s=this.props.renderers[this.props.settings.id];if(!u.JSONExt.deepEqual(Object.keys(null!=t?t:{}).sort(),Object.keys(null!=s?s:{}).sort())){const t={};for(const s in this.props.renderers[this.props.settings.id])Object.keys(null!==(e=this.props.settings.schema.properties)&&void 0!==e?e:{}).includes(s)&&(t[s]={"ui:field":s});this.setState({uiSchema:t})}}_setFilteredSchema(t){var e,s,i,r;if(void 0===t||!u.JSONExt.deepEqual(t,this.props.filteredValues)){const t=u.JSONExt.deepCopy(this.props.settings.schema);if(null!==(s=null===(e=this.props.filteredValues)||void 0===e?void 0:e.length)&&void 0!==s&&s)for(const e in t.properties)(null===(i=this.props.filteredValues)||void 0===i?void 0:i.includes(null!==(r=t.properties[e].title)&&void 0!==r?r:e))||delete t.properties[e];this.setState({filteredSchema:t})}}_getFilteredFormData(t){if(!(null==t?void 0:t.properties))return this._formData;const e=u.JSONExt.deepCopy(this._formData);for(const s in e)t.properties[s]||delete e[s];return e}}const v=({translator:t})=>{const e=t.load("jupyterlab");return d().createElement("div",{className:"jp-SettingsEditor-placeholder"},d().createElement("div",{className:"jp-SettingsEditor-placeholderContent"},d().createElement("h3",null,e.__("No Plugin Selected")),d().createElement("p",null,e.__("Select a plugin from the list to view and edit its preferences."))))},f=({settings:t,editorRegistry:e,onSelect:s,handleSelectSignal:i,hasError:r,updateDirtyState:n,updateFilterSignal:a,translator:o,initialFilter:h})=>{const[c,u]=(0,l.useState)(null),[p,g]=(0,l.useState)(h?()=>h:null),_=d().useRef(null),f=d().useRef({});(0,l.useEffect)((()=>{var t;const e=(t,e)=>{g(e?()=>e:null)};a.connect(e);const s=(t,e)=>{u(e)};return null===(t=null==i?void 0:i.connect)||void 0===t||t.call(i,s),()=>{var t;a.disconnect(e),null===(t=null==i?void 0:i.disconnect)||void 0===t||t.call(i,s)}}),[]);const S=d().useCallback(((t,e)=>{if(f.current){f.current[t]=e;for(const t in f.current)if(f.current[t])return void n(!0)}n(!1)}),[f,n]),y=d().useMemo((()=>Object.entries(e.renderers).reduce(((t,[e,s])=>{const i=e.lastIndexOf("."),r=e.substring(0,i),n=e.substring(i+1);return t[r]||(t[r]={}),!t[r][n]&&s.fieldRenderer&&(t[r][n]=s.fieldRenderer),t}),{})),[e]);return c||p?d().createElement("div",{className:"jp-SettingsPanel",ref:_},t.map((t=>{const e=p?p(t.plugin):null;if(!(c&&c!==t.id||null!==e&&0===e.length))return d().createElement("div",{className:"jp-SettingsForm",key:`${t.id}SettingsEditor`},d().createElement(m,{filteredValues:e,settings:t,renderers:y,hasError:e=>{r(t.id,e)},updateDirtyState:e=>{S(t.id,e)},onSelect:s,translator:o}))}))):d().createElement(v,{translator:o})};class S extends o.SplitPanel{constructor(t){super({orientation:"horizontal",renderer:o.SplitPanel.defaultRenderer,spacing:1}),this._clearDirty=null,this._dirty=!1,this._saveStateChange=new a.Signal(this),this.translator=t.translator||r.nullTranslator,this._status=t.status;const e=this._list=new c({registry:t.registry,toSkip:t.toSkip,translator:this.translator,query:t.query});this.addWidget(e),this.setDirtyState=this.setDirtyState.bind(this),Promise.all(c.sortPlugins(t.registry).filter((t=>{const{schema:e}=t,s=!0===e["jupyter.lab.setting-deprecated"],i=Object.keys(e.properties||{}).length>0,r=!1!==e.additionalProperties;return!s&&(i||r)})).map((async e=>await t.registry.load(e.id)))).then((e=>{const s=n.ReactWidget.create(d().createElement(f,{settings:e.filter((e=>{var s;return!(null!==(s=t.toSkip)&&void 0!==s?s:[]).includes(e.id)})),editorRegistry:t.editorRegistry,handleSelectSignal:this._list.handleSelectSignal,onSelect:t=>this._list.selection=t,hasError:this._list.setError,updateFilterSignal:this._list.updateFilterSignal,updateDirtyState:this.setDirtyState,translator:this.translator,initialFilter:this._list.filter}));this.addWidget(s)})).catch((t=>{console.error(`Fail to load the setting plugins:\n${t}`)}))}get saveStateChanged(){return this._saveStateChange}setDirtyState(t){this._dirty=t,this._dirty&&!this._clearDirty?this._clearDirty=this._status.setDirty():!this._dirty&&this._clearDirty&&(this._clearDirty.dispose(),this._clearDirty=null),t?this.title.className.includes("jp-mod-dirty")||(this.title.className+=" jp-mod-dirty"):this.title.className=this.title.className.replace("jp-mod-dirty",""),this._saveStateChange.emit(t?"started":"completed")}onCloseRequest(t){const e=this.translator.load("jupyterlab");this._list.hasErrors?(0,i.showDialog)({title:e.__("Warning"),body:e.__("Unsaved changes due to validation error. Continue without saving?")}).then((e=>{e.button.accept&&(this.dispose(),super.onCloseRequest(t))})):this._dirty?(0,i.showDialog)({title:e.__("Warning"),body:e.__("Some changes have not been saved. Continue without saving?")}).then((e=>{e.button.accept&&(this.dispose(),super.onCloseRequest(t))})):(this.dispose(),super.onCloseRequest(t))}}var y=s(8434);const E="jp-Inspector-content";class w extends o.Panel{constructor(t={}){super(),this._source=null,this.translator=t.translator||r.nullTranslator,this._trans=this.translator.load("jupyterlab"),t.initialContent instanceof o.Widget?this._content=t.initialContent:"string"==typeof t.initialContent?this._content=w._generateContentWidget(`<p>${t.initialContent}</p>`):this._content=w._generateContentWidget("<p>"+this._trans.__("Click on a function to see documentation.")+"</p>"),this.addClass("jp-Inspector"),this.layout.addWidget(this._content)}[i.Printing.symbol](){return()=>i.Printing.printWidget(this)}get source(){return this._source}set source(t){this._source!==t&&(this._source&&(this._source.standby=!0,this._source.inspected.disconnect(this.onInspectorUpdate,this),this._source.disposed.disconnect(this.onSourceDisposed,this)),t&&t.isDisposed&&(t=null),this._source=t,this._source&&(this._source.standby=!1,this._source.inspected.connect(this.onInspectorUpdate,this),this._source.disposed.connect(this.onSourceDisposed,this)))}dispose(){this.isDisposed||(this.source=null,super.dispose())}onInspectorUpdate(t,e){const{content:s}=e;s&&s!==this._content&&(this._content.dispose(),this._content=s,s.addClass(E),this.layout.addWidget(s))}onSourceDisposed(t,e){this.source=null}static _generateContentWidget(t){const e=new o.Widget;return e.node.innerHTML=t,e.addClass(E),e.addClass("jp-Inspector-default-content"),e}}var C=s(85421),b=s(42628);class j{constructor(t){this._cleared=new a.Signal(this),this._disposed=new a.Signal(this),this._editor=null,this._inspected=new a.Signal(this),this._isDisposed=!1,this._pending=0,this._standby=!0,this._lastInspectedReply=null,this._connector=t.connector,this._rendermime=t.rendermime,this._debouncer=new p.Debouncer(this.onEditorChange.bind(this),250)}get cleared(){return this._cleared}get disposed(){return this._disposed}get inspected(){return this._inspected}get editor(){return this._editor}set editor(t){if(t===this._editor)return;a.Signal.disconnectReceiver(this);const e=this._editor=t;e&&(this._cleared.emit(void 0),this.onEditorChange(),e.model.selections.changed.connect(this._onChange,this),e.model.sharedModel.changed.connect(this._onChange,this))}get standby(){return this._standby}set standby(t){this._standby=t}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this._debouncer.dispose(),this._disposed.emit(void 0),a.Signal.clearData(this))}onEditorChange(t){if(this._standby)return;const e=this.editor;if(!e)return;const s=t||e.model.sharedModel.getSource(),i=e.getCursorPosition(),r=C.Text.jsIndexToCharIndex(e.getOffsetAt(i),s),n={content:null},a=++this._pending;this._connector.fetch({offset:r,text:s}).then((t=>{if(!t||this.isDisposed||a!==this._pending)return this._lastInspectedReply=null,void this._inspected.emit(n);const{data:e}=t;if(this._lastInspectedReply&&u.JSONExt.deepEqual(this._lastInspectedReply,e))return;const s=this._rendermime.preferredMimeType(e);if(s){const t=this._rendermime.createRenderer(s),i=new b.MimeModel({data:e});t.renderModel(i),n.content=t}this._lastInspectedReply=t.data,this._inspected.emit(n)})).catch((t=>{this._lastInspectedReply=null,this._inspected.emit(n)}))}_onChange(){this._debouncer.invoke()}}var D=s(18245);class P extends D.DataConnector{constructor(t,e){super(),this._current=0,this._editor=t,this._trans=(null!=e?e:r.nullTranslator).load("jupyterlab")}fetch(t){return new Promise((e=>{const s=this._current=window.setTimeout((()=>{if(s!==this._current)return e(void 0);const i=this._validate(t.text);if(!i)return e({data:{"text/markdown":this._trans.__("No errors found")},metadata:{}});e({data:this.render(i),metadata:{}})}),100)}))}render(t){return{"text/markdown":t.map(this.renderError.bind(this)).join("")}}renderError(t){var e;switch(t.keyword){case"additionalProperties":return`**\`[${this._trans.__("additional property error")}]\`**\n ${this._trans.__("`%1` is not a valid property",null===(e=t.params)||void 0===e?void 0:e.additionalProperty)}`;case"syntax":return`**\`[${this._trans.__("syntax error")}]\`** *${t.message}*`;case"type":return`**\`[${this._trans.__("type error")}]\`**\n \`${t.instancePath}\` ${t.message}`;default:return`**\`[${this._trans.__("error")}]\`** *${t.message}*`}}_validate(t){const e=this._editor;if(!e.settings)return null;const{id:s,schema:i,version:r}=e.settings;return e.registry.validator.validateData({data:{composite:{},user:{}},id:s,raw:t,schema:i,version:r},!1)}}const T="jp-mod-error";class R extends o.SplitPanel{constructor(t){super({orientation:"horizontal",renderer:o.SplitPanel.defaultRenderer,spacing:1}),this._canRevert=!1,this._canSave=!1,this._commandsChanged=new a.Signal(this),this._settings=null,this._toolbar=new n.Toolbar;const{commands:e,editorFactory:s,registry:i,translator:l}=t;this.registry=i,this.translator=l||r.nullTranslator,this._commands=e;const d=this._defaults=new y.CodeEditorWrapper({editorOptions:{config:{readOnly:!0}},model:new y.CodeEditor.Model({mimeType:"text/javascript"}),factory:s}),h=this._user=new y.CodeEditorWrapper({editorOptions:{config:{lineNumbers:!0}},model:new y.CodeEditor.Model({mimeType:"text/javascript"}),factory:s});h.addClass("jp-SettingsRawEditor-user"),h.editor.model.sharedModel.changed.connect(this._onTextChanged,this),this._inspector=function(t,e,s){const i=(s=s||r.nullTranslator).load("jupyterlab"),n=new P(t,s),a=new w({initialContent:i.__("Any errors will be listed here"),translator:s}),o=new j({connector:n,rendermime:e||new b.RenderMimeRegistry({initialFactories:b.standardRendererFactories,translator:s})});return a.addClass("jp-SettingsDebug"),a.source=o,o.editor=t.source,a}(this,t.rendermime,this.translator),this.addClass("jp-SettingsRawEditor"),this._onSaveError=t.onSaveError,this.addWidget(x.defaultsEditor(d,this.translator)),this.addWidget(x.userEditor(h,this._toolbar,this._inspector,this.translator))}get canRevert(){return this._canRevert}get canSave(){return this._canSave}get commandsChanged(){return this._commandsChanged}get isDirty(){var t,e;return null!==(e=this._user.editor.model.sharedModel.getSource()!==(null===(t=this._settings)||void 0===t?void 0:t.raw))&&void 0!==e?e:""}get settings(){return this._settings}set settings(t){if(!t&&!this._settings)return;if(t&&this._settings&&t.plugin===this._settings.plugin)return;const e=this._defaults,s=this._user;this._settings&&this._settings.changed.disconnect(this._onSettingsChanged,this),t?(this._settings=t,this._settings.changed.connect(this._onSettingsChanged,this),this._onSettingsChanged()):(this._settings=null,e.editor.model.sharedModel.setSource(""),s.editor.model.sharedModel.setSource("")),this.update()}get sizes(){return this.relativeSizes()}set sizes(t){this.setRelativeSizes(t)}get source(){return this._user.editor}dispose(){this.isDisposed||(this._defaults.model.dispose(),this._defaults.dispose(),this._user.model.dispose(),this._user.dispose(),super.dispose())}revert(){var t,e;this._user.editor.model.sharedModel.setSource(null!==(e=null===(t=this.settings)||void 0===t?void 0:t.raw)&&void 0!==e?e:""),this._updateToolbar(!1,!1)}save(){if(!this.isDirty||!this._settings)return Promise.resolve(void 0);const t=this._settings,e=this._user.editor.model.sharedModel.getSource();return t.save(e).then((()=>{this._updateToolbar(!1,!1)})).catch((t=>{this._updateToolbar(!0,!1),this._onSaveError(t,this.translator)}))}onAfterAttach(t){x.populateToolbar(this._commands,this._toolbar),this.update()}_onTextChanged(){const t=this._user.editor.model.sharedModel.getSource(),e=this._settings;if(this.removeClass(T),e&&e.raw!==t)return e.validate(t)?(this.addClass(T),void this._updateToolbar(!0,!1)):void this._updateToolbar(!0,!0);this._updateToolbar(!1,!1)}_onSettingsChanged(){var t,e;const s=this._settings,i=this._defaults,r=this._user;i.editor.model.sharedModel.setSource(null!==(t=null==s?void 0:s.annotatedDefaults())&&void 0!==t?t:""),r.editor.model.sharedModel.setSource(null!==(e=null==s?void 0:s.raw)&&void 0!==e?e:"")}_updateToolbar(t=this._canRevert,e=this._canSave){const s=this._commands;this._canRevert=t,this._canSave=e,this._commandsChanged.emit([s.revert,s.save])}}var x,F;!function(t){t.defaultsEditor=function(t,e){const s=(e=e||r.nullTranslator).load("jupyterlab"),i=new o.Widget,a=i.layout=new o.BoxLayout({spacing:0}),l=new o.Widget,d=new n.Toolbar,h=s.__("System Defaults");return l.node.innerText=h,d.insertItem(0,"banner",l),a.addWidget(d),a.addWidget(t),i},t.populateToolbar=function(t,e){const{registry:s,revert:i,save:r}=t;e.addItem("spacer",n.Toolbar.createSpacerItem()),[i,r].forEach((t=>{const i=new n.CommandToolbarButton({commands:s,id:t});e.addItem(t,i)}))},t.userEditor=function(t,e,s,i){const n=(i=i||r.nullTranslator).load("jupyterlab").__("User Preferences"),a=new o.Widget,l=a.layout=new o.BoxLayout({spacing:0}),d=new o.Widget;return d.node.innerText=n,e.insertItem(0,"banner",d),l.addWidget(e),l.addWidget(t),l.addWidget(s),a}}(x||(x={}));class k extends o.Widget{constructor(t){super(),this._settings=null,this._stateChanged=new a.Signal(this),this.addClass("jp-PluginEditor");const{commands:e,editorFactory:s,registry:i,rendermime:n,translator:l}=t;this.translator=l||r.nullTranslator,this._trans=this.translator.load("jupyterlab");const d=this.layout=new o.StackedLayout,{onSaveError:h}=F;this.raw=this._rawEditor=new R({commands:e,editorFactory:s,onSaveError:h,registry:i,rendermime:n,translator:l}),this._rawEditor.handleMoved.connect(this._onStateChanged,this),d.addWidget(this._rawEditor)}get isDirty(){return this._rawEditor.isDirty}get settings(){return this._settings}set settings(t){if(this._settings===t)return;const e=this._rawEditor;this._settings=e.settings=t,this.update()}get state(){const t=this._settings?this._settings.id:"",{sizes:e}=this._rawEditor;return{plugin:t,sizes:e}}set state(t){u.JSONExt.deepEqual(this.state,t)||(this._rawEditor.sizes=t.sizes,this.update())}get stateChanged(){return this._stateChanged}confirm(){return!this.isHidden&&this.isAttached&&this.isDirty?(0,i.showDialog)({title:this._trans.__("You have unsaved changes."),body:this._trans.__("Do you want to leave without saving?"),buttons:[i.Dialog.cancelButton({label:this._trans.__("Cancel")}),i.Dialog.okButton({label:this._trans.__("Ok")})]}).then((t=>{if(!t.button.accept)throw new Error("User canceled.")})):Promise.resolve(void 0)}dispose(){this.isDisposed||(super.dispose(),this._rawEditor.dispose())}onAfterAttach(t){this.update()}onUpdateRequest(t){const e=this._rawEditor;this._settings?(this.show(),e.show()):this.hide()}_onStateChanged(){this.stateChanged.emit(void 0)}}!function(t){t.onSaveError=function(t,e){const s=(e=e||r.nullTranslator).load("jupyterlab");console.error(`Saving setting editor value failed: ${t.message}`),(0,i.showErrorMessage)(s.__("Your changes were not saved."),t)}}(F||(F={}));const N={sizes:[1,3],container:{editor:"raw",plugin:"",sizes:[1,1]}};class M extends o.SplitPanel{constructor(t){super({orientation:"horizontal",renderer:o.SplitPanel.defaultRenderer,spacing:1}),this._fetching=null,this._saving=!1,this._state=u.JSONExt.deepCopy(N),this.translator=t.translator||r.nullTranslator,this.addClass("jp-SettingEditor"),this.key=t.key,this.state=t.state;const{commands:e,editorFactory:s,rendermime:i}=t,a=this.registry=t.registry,d=this._instructions=n.ReactWidget.create(l.createElement(v,{translator:this.translator}));d.addClass("jp-SettingEditorInstructions");const h=this._editor=new k({commands:e,editorFactory:s,registry:a,rendermime:i,translator:this.translator}),p=this._list=new c({confirm:()=>h.confirm(),registry:a,translator:this.translator}),g=t.when;g&&(this._when=Array.isArray(g)?Promise.all(g):g),this.addWidget(p),this.addWidget(d),o.SplitPanel.setStretch(p,0),o.SplitPanel.setStretch(d,1),o.SplitPanel.setStretch(h,1),h.stateChanged.connect(this._onStateChanged,this),p.changed.connect(this._onStateChanged,this),this.handleMoved.connect(this._onStateChanged,this)}get canRevertRaw(){return this._editor.raw.canRevert}get canSaveRaw(){return this._editor.raw.canSave}get commandsChanged(){return this._editor.raw.commandsChanged}get settings(){return this._editor.settings}get source(){return this._editor.raw.source}dispose(){this.isDisposed||(super.dispose(),this._editor.dispose(),this._instructions.dispose(),this._list.dispose())}revert(){this._editor.raw.revert()}save(){return this._editor.raw.save()}onAfterAttach(t){super.onAfterAttach(t),this.hide(),this._fetchState().then((()=>{this.show(),this._setState()})).catch((t=>{console.error("Fetching setting editor state failed",t),this.show(),this._setState()}))}onCloseRequest(t){this._editor.confirm().then((()=>{super.onCloseRequest(t),this.dispose()})).catch((()=>{}))}_fetchState(){if(this._fetching)return this._fetching;const{key:t,state:e}=this,s=[e.fetch(t),this._when];return this._fetching=Promise.all(s).then((([t])=>{this._fetching=null,this._saving||(this._state=O.normalizeState(t,this._state))}))}async _onStateChanged(){this._state.sizes=this.relativeSizes(),this._state.container=this._editor.state,this._state.container.plugin=this._list.selection;try{await this._saveState()}catch(t){console.error("Saving setting editor state failed",t)}this._setState()}async _saveState(){const{key:t,state:e}=this,s=this._state;this._saving=!0;try{await e.save(t,s),this._saving=!1}catch(t){throw this._saving=!1,t}}_setLayout(){const t=this._editor,e=this._state;t.state=e.container,requestAnimationFrame((()=>{this.setRelativeSizes(e.sizes)}))}_setState(){const t=this._editor,e=this._list,{container:s}=this._state;if(!s.plugin)return t.settings=null,e.selection="",void this._setLayout();if(t.settings&&t.settings.id===s.plugin)return void this._setLayout();const i=this._instructions;this.registry.load(s.plugin).then((r=>{i.isAttached&&(i.parent=null),t.isAttached||this.addWidget(t),t.settings=r,e.selection=s.plugin,this._setLayout()})).catch((i=>{console.error(`Loading ${s.plugin} settings failed.`,i),e.selection=this._state.container.plugin="",t.settings=null,this._setLayout()}))}}var O;!function(t){function e(t){return Array.isArray(t)&&t.every((t=>"number"==typeof t))}t.normalizeState=function(t,s){if(!t)return u.JSONExt.deepCopy(N);if("sizes"in t&&e(t.sizes)||(t.sizes=u.JSONExt.deepCopy(N.sizes)),!("container"in t))return t.container=u.JSONExt.deepCopy(N.container),t;const i="container"in t&&t.container&&"object"==typeof t.container?t.container:{};return t.container={plugin:"string"==typeof i.plugin?i.plugin:N.container.plugin,sizes:e(i.sizes)?i.sizes:u.JSONExt.deepCopy(N.container.sizes)},t}}(O||(O={}));var W=s(24758)},24758:(t,e,s)=>{s.d(e,{O:()=>r,g:()=>n});var i=s(20998);const r=new i.Token("@jupyterlab/settingeditor:ISettingEditorTracker","A widget tracker for the interactive setting editor.\n Use this if you want to be able to iterate over and interact with setting editors\n created by the application."),n=new i.Token("@jupyterlab/settingeditor:IJSONSettingEditorTracker","A widget tracker for the JSON setting editor.\n Use this if you want to be able to iterate over and interact with setting editors\n created by the application.")}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3360],{63360:(t,e,s)=>{s.r(e),s.d(e,{IJSONSettingEditorTracker:()=>W.g,ISettingEditorTracker:()=>W.O,JsonSettingEditor:()=>M,SettingsEditor:()=>S});var i=s(78036),r=s(5944),n=s(70798),a=s(81997),o=s(31516),l=s(78156),d=s.n(l),h=s(33625);class c extends i.ReactWidget{constructor(t){var e;super(),this._changed=new a.Signal(this),this._handleSelectSignal=new a.Signal(this),this._updateFilterSignal=new a.Signal(this),this._allPlugins=[],this._settings={},this._scrollTop=0,this._selection="",this.registry=t.registry,this.translator=t.translator||r.nullTranslator,this.addClass("jp-PluginList"),this._confirm=t.confirm,this.registry.pluginChanged.connect((()=>{this.update()}),this),this.mapPlugins=this.mapPlugins.bind(this),this.setFilter=this.setFilter.bind(this),this.setFilter(t.query?(0,n.updateFilterFunction)(t.query,!1,!1):null),this.setError=this.setError.bind(this),this._evtMousedown=this._evtMousedown.bind(this),this._query=null!==(e=t.query)&&void 0!==e?e:"",this._allPlugins=c.sortPlugins(this.registry).filter((e=>{var s;const{schema:i}=e,r=!0===i["jupyter.lab.setting-deprecated"],n=Object.keys(i.properties||{}).length>0,a=!1!==i.additionalProperties,o=this._confirm||!this._confirm&&!(null!==(s=t.toSkip)&&void 0!==s?s:[]).includes(e.id);return!r&&o&&(n||a)})),(async()=>{for(const t of this._allPlugins){const e=await this.registry.load(t.id);this._settings[t.id]=e}this.update()})(),this._errors={}}get changed(){return this._changed}get scrollTop(){var t;return null===(t=this.node.querySelector("ul"))||void 0===t?void 0:t.scrollTop}get hasErrors(){for(const t in this._errors)if(this._errors[t])return!0;return!1}get filter(){return this._filter}get selection(){return this._selection}set selection(t){this._selection=t,this.update()}get updateFilterSignal(){return this._updateFilterSignal}get handleSelectSignal(){return this._handleSelectSignal}onUpdateRequest(t){const e=this.node.querySelector("ul");e&&void 0!==this._scrollTop&&(e.scrollTop=this._scrollTop),super.onUpdateRequest(t)}_evtMousedown(t){const e=t.currentTarget.getAttribute("data-id");e&&(this._confirm?this._confirm(e).then((()=>{this.selection=e,this._changed.emit(void 0),this.update()})).catch((()=>{})):(this._scrollTop=this.scrollTop,this._selection=e,this._handleSelectSignal.emit(e),this._changed.emit(void 0),this.update()))}getHint(t,e,s){let i=s.data.user[t];if(i||(i=s.data.composite[t]),i||(i=s.schema[t]),!i){const{properties:s}=e.schema;i=s&&s[t]&&s[t].default}return"string"==typeof i?i:""}getFilterString(t,e,s,i){var r;if(i&&s&&(i=i.replace("#/definitions/",""),e=null!==(r=s[i])&&void 0!==r?r:{}),e.properties)e=e.properties;else{if(!e.items)return[];e=e.items}return e.$ref?this.getFilterString(t,e,s,e.$ref):0===Object.keys(e).length?[]:Object.keys(e).reduce(((i,r)=>{var n,a;const o=e[r];if(!o){if(t(null!==(n=e.title)&&void 0!==n?n:""))return e.title;if(t(r))return r}return t(null!==(a=o.title)&&void 0!==a?a:"")&&i.push(o.title),t(r)&&i.push(r),i.concat(this.getFilterString(t,o,s,o.$ref)),i}),[])}setFilter(t,e){this._filter=t?e=>{var s,i;return!t||t(null!==(s=e.schema.title)&&void 0!==s?s:"")?null:this.getFilterString(t,null!==(i=e.schema)&&void 0!==i?i:{},e.schema.definitions)}:null,this._query=e,this._updateFilterSignal.emit(this._filter),this.update()}setError(t,e){this._errors[t]!==e?(this._errors[t]=e,this.update()):this._errors[t]=e}mapPlugins(t){var e,s,i,r;const{id:a,schema:o,version:l}=t,c=this.translator.load("jupyterlab"),u="string"==typeof o.title?c._p("schema",o.title):a,p=h.StringExt.matchSumOfSquares(u.toLocaleLowerCase(),null!==(s=null===(e=this._query)||void 0===e?void 0:e.toLocaleLowerCase())&&void 0!==s?s:""),g=h.StringExt.highlight(u,null!==(i=null==p?void 0:p.indices)&&void 0!==i?i:[],(t=>d().createElement("mark",null,t))),_=`${"string"==typeof o.description?c._p("schema",o.description):""}\n${a}\n${l}`,m=this.getHint("jupyter.lab.setting-icon",this.registry,t),v=this.getHint("jupyter.lab.setting-icon-class",this.registry,t),f=this.getHint("jupyter.lab.setting-icon-label",this.registry,t),S=this._filter?null===(r=this._filter(t))||void 0===r?void 0:r.map((t=>{var e,s,i;const r=h.StringExt.matchSumOfSquares(t.toLocaleLowerCase(),null!==(s=null===(e=this._query)||void 0===e?void 0:e.toLocaleLowerCase())&&void 0!==s?s:""),n=h.StringExt.highlight(t,null!==(i=null==r?void 0:r.indices)&&void 0!==i?i:[],(t=>d().createElement("mark",null,t)));return d().createElement("li",{key:`${a}-${t}`}," ",n," ")})):void 0;return d().createElement("div",{onClick:this._evtMousedown,className:`${a===this.selection?"jp-mod-selected jp-PluginList-entry":"jp-PluginList-entry"} ${this._errors[a]?"jp-ErrorPlugin":""}`,"data-id":a,key:a,title:_},d().createElement("div",{className:"jp-PluginList-entry-label",role:"tab"},d().createElement("div",{className:"jp-SelectedIndicator"}),d().createElement(n.LabIcon.resolveReact,{icon:m||(v?void 0:n.settingsIcon),iconClass:(0,n.classes)(v,"jp-Icon"),title:f,tag:"span",stylesheet:"settingsEditor"}),d().createElement("span",{className:"jp-PluginList-entry-label-text"},g)),d().createElement("ul",null,S))}render(){const t=this.translator.load("jupyterlab"),e=this._allPlugins.filter((t=>{if(!this._filter)return!1;const e=this._filter(t);return null===e||e.length>0})),s=e.filter((t=>{var e;return null===(e=this._settings[t.id])||void 0===e?void 0:e.isModified})),i=s.map(this.mapPlugins),r=e.filter((t=>!s.includes(t))).map(this.mapPlugins);return d().createElement("div",{className:"jp-PluginList-wrapper"},d().createElement(n.FilterBox,{updateFilter:this.setFilter,useFuzzyFilter:!1,placeholder:t.__("Search…"),forceRefresh:!1,caseSensitive:!1,initialQuery:this._query}),i.length>0&&d().createElement("div",null,d().createElement("h1",{className:"jp-PluginList-header"},t.__("Modified")),d().createElement("ul",null,i)),r.length>0&&d().createElement("div",null,d().createElement("h1",{className:"jp-PluginList-header"},t.__("Settings")),d().createElement("ul",null,r)),0===i.length&&0===r.length&&d().createElement("p",{className:"jp-PluginList-noResults"},t.__("No items match your search.")))}}!function(t){t.sortPlugins=function(t){return Object.keys(t.plugins).map((e=>t.plugins[e])).sort(((t,e)=>(t.schema.title||t.id).localeCompare(e.schema.title||e.id)))}}(c||(c={}));var u=s(20998),p=s(97934),g=s(8138),_=s.n(g);class m extends d().Component{constructor(t){super(t),this.reset=async t=>{t.stopPropagation();for(const t in this.props.settings.user)await this.props.settings.remove(t);this._formData=this.props.settings.composite,this.setState({isModified:!1})},this._onChange=t=>{this.props.hasError(0!==t.errors.length),this._formData=t.formData,0===t.errors.length&&(this.props.updateDirtyState(!0),this._debouncer.invoke()),this.props.onSelect(this.props.settings.id)};const{settings:e}=t;this._formData=e.composite,this.state={isModified:e.isModified,uiSchema:{},filteredSchema:this.props.settings.schema,formContext:{defaultFormData:this.props.settings.default(),settings:this.props.settings}},this.handleChange=this.handleChange.bind(this),this._debouncer=new p.Debouncer(this.handleChange)}componentDidMount(){this._setUiSchema(),this._setFilteredSchema()}componentDidUpdate(t){this._setUiSchema(t.renderers[t.settings.id]),this._setFilteredSchema(t.filteredValues),t.settings!==this.props.settings&&this.setState({formContext:{settings:this.props.settings,defaultFormData:this.props.settings.default()}})}componentWillUnmount(){this._debouncer.dispose()}handleChange(){!this.props.settings.isModified&&this._formData&&this.props.settings.isDefault(this._formData)?this.props.updateDirtyState(!1):this.props.settings.save(JSON.stringify(this._formData,void 0,4)).then((()=>{this.props.updateDirtyState(!1),this.setState({isModified:this.props.settings.isModified})})).catch((t=>{this.props.updateDirtyState(!1);const e=this.props.translator.load("jupyterlab");(0,i.showErrorMessage)(e.__("Error saving settings."),t)}))}render(){const t=this.props.translator.load("jupyterlab");return d().createElement(d().Fragment,null,d().createElement("div",{className:"jp-SettingsHeader"},d().createElement("h2",{className:"jp-SettingsHeader-title",title:this.props.settings.schema.description},this.props.settings.schema.title),d().createElement("div",{className:"jp-SettingsHeader-buttonbar"},this.state.isModified&&d().createElement(n.Button,{className:"jp-RestoreButton",onClick:this.reset},t.__("Restore to Defaults"))),d().createElement("div",{className:"jp-SettingsHeader-description"},this.props.settings.schema.description)),d().createElement(n.FormComponent,{validator:_(),schema:this.state.filteredSchema,formData:this._getFilteredFormData(this.state.filteredSchema),uiSchema:this.state.uiSchema,fields:this.props.renderers[this.props.settings.id],formContext:this.state.formContext,liveValidate:!0,idPrefix:`jp-SettingsEditor-${this.props.settings.id}`,onChange:this._onChange,translator:this.props.translator}))}_setUiSchema(t){var e;const s=this.props.renderers[this.props.settings.id];if(!u.JSONExt.deepEqual(Object.keys(null!=t?t:{}).sort(),Object.keys(null!=s?s:{}).sort())){const t={};for(const s in this.props.renderers[this.props.settings.id])Object.keys(null!==(e=this.props.settings.schema.properties)&&void 0!==e?e:{}).includes(s)&&(t[s]={"ui:field":s});this.setState({uiSchema:t})}}_setFilteredSchema(t){var e,s,i,r;if(void 0===t||!u.JSONExt.deepEqual(t,this.props.filteredValues)){const t=u.JSONExt.deepCopy(this.props.settings.schema);if(null!==(s=null===(e=this.props.filteredValues)||void 0===e?void 0:e.length)&&void 0!==s&&s)for(const e in t.properties)(null===(i=this.props.filteredValues)||void 0===i?void 0:i.includes(null!==(r=t.properties[e].title)&&void 0!==r?r:e))||delete t.properties[e];this.setState({filteredSchema:t})}}_getFilteredFormData(t){if(!(null==t?void 0:t.properties))return this._formData;const e=u.JSONExt.deepCopy(this._formData);for(const s in e)t.properties[s]||delete e[s];return e}}const v=({translator:t})=>{const e=t.load("jupyterlab");return d().createElement("div",{className:"jp-SettingsEditor-placeholder"},d().createElement("div",{className:"jp-SettingsEditor-placeholderContent"},d().createElement("h3",null,e.__("No Plugin Selected")),d().createElement("p",null,e.__("Select a plugin from the list to view and edit its preferences."))))},f=({settings:t,editorRegistry:e,onSelect:s,handleSelectSignal:i,hasError:r,updateDirtyState:n,updateFilterSignal:a,translator:o,initialFilter:h})=>{const[c,u]=(0,l.useState)(null),[p,g]=(0,l.useState)(h?()=>h:null),_=d().useRef(null),f=d().useRef({});(0,l.useEffect)((()=>{var t;const e=(t,e)=>{g(e?()=>e:null)};a.connect(e);const s=(t,e)=>{u(e)};return null===(t=null==i?void 0:i.connect)||void 0===t||t.call(i,s),()=>{var t;a.disconnect(e),null===(t=null==i?void 0:i.disconnect)||void 0===t||t.call(i,s)}}),[]);const S=d().useCallback(((t,e)=>{if(f.current){f.current[t]=e;for(const t in f.current)if(f.current[t])return void n(!0)}n(!1)}),[f,n]),y=d().useMemo((()=>Object.entries(e.renderers).reduce(((t,[e,s])=>{const i=e.lastIndexOf("."),r=e.substring(0,i),n=e.substring(i+1);return t[r]||(t[r]={}),!t[r][n]&&s.fieldRenderer&&(t[r][n]=s.fieldRenderer),t}),{})),[e]);return c||p?d().createElement("div",{className:"jp-SettingsPanel",ref:_},t.map((t=>{const e=p?p(t.plugin):null;if(!(c&&c!==t.id||null!==e&&0===e.length))return d().createElement("div",{className:"jp-SettingsForm",key:`${t.id}SettingsEditor`},d().createElement(m,{filteredValues:e,settings:t,renderers:y,hasError:e=>{r(t.id,e)},updateDirtyState:e=>{S(t.id,e)},onSelect:s,translator:o}))}))):d().createElement(v,{translator:o})};class S extends o.SplitPanel{constructor(t){super({orientation:"horizontal",renderer:o.SplitPanel.defaultRenderer,spacing:1}),this._clearDirty=null,this._dirty=!1,this._saveStateChange=new a.Signal(this),this.translator=t.translator||r.nullTranslator,this._status=t.status;const e=this._list=new c({registry:t.registry,toSkip:t.toSkip,translator:this.translator,query:t.query});this.addWidget(e),this.setDirtyState=this.setDirtyState.bind(this),Promise.all(c.sortPlugins(t.registry).filter((t=>{const{schema:e}=t,s=!0===e["jupyter.lab.setting-deprecated"],i=Object.keys(e.properties||{}).length>0,r=!1!==e.additionalProperties;return!s&&(i||r)})).map((async e=>await t.registry.load(e.id)))).then((e=>{const s=n.ReactWidget.create(d().createElement(f,{settings:e.filter((e=>{var s;return!(null!==(s=t.toSkip)&&void 0!==s?s:[]).includes(e.id)})),editorRegistry:t.editorRegistry,handleSelectSignal:this._list.handleSelectSignal,onSelect:t=>this._list.selection=t,hasError:this._list.setError,updateFilterSignal:this._list.updateFilterSignal,updateDirtyState:this.setDirtyState,translator:this.translator,initialFilter:this._list.filter}));this.addWidget(s)})).catch((t=>{console.error(`Fail to load the setting plugins:\n${t}`)}))}get saveStateChanged(){return this._saveStateChange}setDirtyState(t){this._dirty=t,this._dirty&&!this._clearDirty?this._clearDirty=this._status.setDirty():!this._dirty&&this._clearDirty&&(this._clearDirty.dispose(),this._clearDirty=null),t?this.title.className.includes("jp-mod-dirty")||(this.title.className+=" jp-mod-dirty"):this.title.className=this.title.className.replace("jp-mod-dirty",""),this._saveStateChange.emit(t?"started":"completed")}onCloseRequest(t){const e=this.translator.load("jupyterlab");this._list.hasErrors?(0,i.showDialog)({title:e.__("Warning"),body:e.__("Unsaved changes due to validation error. Continue without saving?")}).then((e=>{e.button.accept&&(this.dispose(),super.onCloseRequest(t))})):this._dirty?(0,i.showDialog)({title:e.__("Warning"),body:e.__("Some changes have not been saved. Continue without saving?")}).then((e=>{e.button.accept&&(this.dispose(),super.onCloseRequest(t))})):(this.dispose(),super.onCloseRequest(t))}}var y=s(97698);const E="jp-Inspector-content";class w extends o.Panel{constructor(t={}){super(),this._source=null,this.translator=t.translator||r.nullTranslator,this._trans=this.translator.load("jupyterlab"),t.initialContent instanceof o.Widget?this._content=t.initialContent:"string"==typeof t.initialContent?this._content=w._generateContentWidget(`<p>${t.initialContent}</p>`):this._content=w._generateContentWidget("<p>"+this._trans.__("Click on a function to see documentation.")+"</p>"),this.addClass("jp-Inspector"),this.layout.addWidget(this._content)}[i.Printing.symbol](){return()=>i.Printing.printWidget(this)}get source(){return this._source}set source(t){this._source!==t&&(this._source&&(this._source.standby=!0,this._source.inspected.disconnect(this.onInspectorUpdate,this),this._source.disposed.disconnect(this.onSourceDisposed,this)),t&&t.isDisposed&&(t=null),this._source=t,this._source&&(this._source.standby=!1,this._source.inspected.connect(this.onInspectorUpdate,this),this._source.disposed.connect(this.onSourceDisposed,this)))}dispose(){this.isDisposed||(this.source=null,super.dispose())}onInspectorUpdate(t,e){const{content:s}=e;s&&s!==this._content&&(this._content.dispose(),this._content=s,s.addClass(E),this.layout.addWidget(s))}onSourceDisposed(t,e){this.source=null}static _generateContentWidget(t){const e=new o.Widget;return e.node.innerHTML=t,e.addClass(E),e.addClass("jp-Inspector-default-content"),e}}var C=s(13558),b=s(99407);class j{constructor(t){this._cleared=new a.Signal(this),this._disposed=new a.Signal(this),this._editor=null,this._inspected=new a.Signal(this),this._isDisposed=!1,this._pending=0,this._standby=!0,this._lastInspectedReply=null,this._connector=t.connector,this._rendermime=t.rendermime,this._debouncer=new p.Debouncer(this.onEditorChange.bind(this),250)}get cleared(){return this._cleared}get disposed(){return this._disposed}get inspected(){return this._inspected}get editor(){return this._editor}set editor(t){if(t===this._editor)return;a.Signal.disconnectReceiver(this);const e=this._editor=t;e&&(this._cleared.emit(void 0),this.onEditorChange(),e.model.selections.changed.connect(this._onChange,this),e.model.sharedModel.changed.connect(this._onChange,this))}get standby(){return this._standby}set standby(t){this._standby=t}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this._debouncer.dispose(),this._disposed.emit(void 0),a.Signal.clearData(this))}onEditorChange(t){if(this._standby)return;const e=this.editor;if(!e)return;const s=t||e.model.sharedModel.getSource(),i=e.getCursorPosition(),r=C.Text.jsIndexToCharIndex(e.getOffsetAt(i),s),n={content:null},a=++this._pending;this._connector.fetch({offset:r,text:s}).then((t=>{if(!t||this.isDisposed||a!==this._pending)return this._lastInspectedReply=null,void this._inspected.emit(n);const{data:e}=t;if(this._lastInspectedReply&&u.JSONExt.deepEqual(this._lastInspectedReply,e))return;const s=this._rendermime.preferredMimeType(e);if(s){const t=this._rendermime.createRenderer(s),i=new b.MimeModel({data:e});t.renderModel(i),n.content=t}this._lastInspectedReply=t.data,this._inspected.emit(n)})).catch((t=>{this._lastInspectedReply=null,this._inspected.emit(n)}))}_onChange(){this._debouncer.invoke()}}var D=s(60278);class P extends D.DataConnector{constructor(t,e){super(),this._current=0,this._editor=t,this._trans=(null!=e?e:r.nullTranslator).load("jupyterlab")}fetch(t){return new Promise((e=>{const s=this._current=window.setTimeout((()=>{if(s!==this._current)return e(void 0);const i=this._validate(t.text);if(!i)return e({data:{"text/markdown":this._trans.__("No errors found")},metadata:{}});e({data:this.render(i),metadata:{}})}),100)}))}render(t){return{"text/markdown":t.map(this.renderError.bind(this)).join("")}}renderError(t){var e;switch(t.keyword){case"additionalProperties":return`**\`[${this._trans.__("additional property error")}]\`**\n ${this._trans.__("`%1` is not a valid property",null===(e=t.params)||void 0===e?void 0:e.additionalProperty)}`;case"syntax":return`**\`[${this._trans.__("syntax error")}]\`** *${t.message}*`;case"type":return`**\`[${this._trans.__("type error")}]\`**\n \`${t.instancePath}\` ${t.message}`;default:return`**\`[${this._trans.__("error")}]\`** *${t.message}*`}}_validate(t){const e=this._editor;if(!e.settings)return null;const{id:s,schema:i,version:r}=e.settings;return e.registry.validator.validateData({data:{composite:{},user:{}},id:s,raw:t,schema:i,version:r},!1)}}const T="jp-mod-error";class R extends o.SplitPanel{constructor(t){super({orientation:"horizontal",renderer:o.SplitPanel.defaultRenderer,spacing:1}),this._canRevert=!1,this._canSave=!1,this._commandsChanged=new a.Signal(this),this._settings=null,this._toolbar=new n.Toolbar;const{commands:e,editorFactory:s,registry:i,translator:l}=t;this.registry=i,this.translator=l||r.nullTranslator,this._commands=e;const d=this._defaults=new y.CodeEditorWrapper({editorOptions:{config:{readOnly:!0}},model:new y.CodeEditor.Model({mimeType:"text/javascript"}),factory:s}),h=this._user=new y.CodeEditorWrapper({editorOptions:{config:{lineNumbers:!0}},model:new y.CodeEditor.Model({mimeType:"text/javascript"}),factory:s});h.addClass("jp-SettingsRawEditor-user"),h.editor.model.sharedModel.changed.connect(this._onTextChanged,this),this._inspector=function(t,e,s){const i=(s=s||r.nullTranslator).load("jupyterlab"),n=new P(t,s),a=new w({initialContent:i.__("Any errors will be listed here"),translator:s}),o=new j({connector:n,rendermime:e||new b.RenderMimeRegistry({initialFactories:b.standardRendererFactories,translator:s})});return a.addClass("jp-SettingsDebug"),a.source=o,o.editor=t.source,a}(this,t.rendermime,this.translator),this.addClass("jp-SettingsRawEditor"),this._onSaveError=t.onSaveError,this.addWidget(x.defaultsEditor(d,this.translator)),this.addWidget(x.userEditor(h,this._toolbar,this._inspector,this.translator))}get canRevert(){return this._canRevert}get canSave(){return this._canSave}get commandsChanged(){return this._commandsChanged}get isDirty(){var t,e;return null!==(e=this._user.editor.model.sharedModel.getSource()!==(null===(t=this._settings)||void 0===t?void 0:t.raw))&&void 0!==e?e:""}get settings(){return this._settings}set settings(t){if(!t&&!this._settings)return;if(t&&this._settings&&t.plugin===this._settings.plugin)return;const e=this._defaults,s=this._user;this._settings&&this._settings.changed.disconnect(this._onSettingsChanged,this),t?(this._settings=t,this._settings.changed.connect(this._onSettingsChanged,this),this._onSettingsChanged()):(this._settings=null,e.editor.model.sharedModel.setSource(""),s.editor.model.sharedModel.setSource("")),this.update()}get sizes(){return this.relativeSizes()}set sizes(t){this.setRelativeSizes(t)}get source(){return this._user.editor}dispose(){this.isDisposed||(this._defaults.model.dispose(),this._defaults.dispose(),this._user.model.dispose(),this._user.dispose(),super.dispose())}revert(){var t,e;this._user.editor.model.sharedModel.setSource(null!==(e=null===(t=this.settings)||void 0===t?void 0:t.raw)&&void 0!==e?e:""),this._updateToolbar(!1,!1)}save(){if(!this.isDirty||!this._settings)return Promise.resolve(void 0);const t=this._settings,e=this._user.editor.model.sharedModel.getSource();return t.save(e).then((()=>{this._updateToolbar(!1,!1)})).catch((t=>{this._updateToolbar(!0,!1),this._onSaveError(t,this.translator)}))}onAfterAttach(t){x.populateToolbar(this._commands,this._toolbar),this.update()}_onTextChanged(){const t=this._user.editor.model.sharedModel.getSource(),e=this._settings;if(this.removeClass(T),e&&e.raw!==t)return e.validate(t)?(this.addClass(T),void this._updateToolbar(!0,!1)):void this._updateToolbar(!0,!0);this._updateToolbar(!1,!1)}_onSettingsChanged(){var t,e;const s=this._settings,i=this._defaults,r=this._user;i.editor.model.sharedModel.setSource(null!==(t=null==s?void 0:s.annotatedDefaults())&&void 0!==t?t:""),r.editor.model.sharedModel.setSource(null!==(e=null==s?void 0:s.raw)&&void 0!==e?e:"")}_updateToolbar(t=this._canRevert,e=this._canSave){const s=this._commands;this._canRevert=t,this._canSave=e,this._commandsChanged.emit([s.revert,s.save])}}var x,F;!function(t){t.defaultsEditor=function(t,e){const s=(e=e||r.nullTranslator).load("jupyterlab"),i=new o.Widget,a=i.layout=new o.BoxLayout({spacing:0}),l=new o.Widget,d=new n.Toolbar,h=s.__("System Defaults");return l.node.innerText=h,d.insertItem(0,"banner",l),a.addWidget(d),a.addWidget(t),i},t.populateToolbar=function(t,e){const{registry:s,revert:i,save:r}=t;e.addItem("spacer",n.Toolbar.createSpacerItem()),[i,r].forEach((t=>{const i=new n.CommandToolbarButton({commands:s,id:t});e.addItem(t,i)}))},t.userEditor=function(t,e,s,i){const n=(i=i||r.nullTranslator).load("jupyterlab").__("User Preferences"),a=new o.Widget,l=a.layout=new o.BoxLayout({spacing:0}),d=new o.Widget;return d.node.innerText=n,e.insertItem(0,"banner",d),l.addWidget(e),l.addWidget(t),l.addWidget(s),a}}(x||(x={}));class k extends o.Widget{constructor(t){super(),this._settings=null,this._stateChanged=new a.Signal(this),this.addClass("jp-PluginEditor");const{commands:e,editorFactory:s,registry:i,rendermime:n,translator:l}=t;this.translator=l||r.nullTranslator,this._trans=this.translator.load("jupyterlab");const d=this.layout=new o.StackedLayout,{onSaveError:h}=F;this.raw=this._rawEditor=new R({commands:e,editorFactory:s,onSaveError:h,registry:i,rendermime:n,translator:l}),this._rawEditor.handleMoved.connect(this._onStateChanged,this),d.addWidget(this._rawEditor)}get isDirty(){return this._rawEditor.isDirty}get settings(){return this._settings}set settings(t){if(this._settings===t)return;const e=this._rawEditor;this._settings=e.settings=t,this.update()}get state(){const t=this._settings?this._settings.id:"",{sizes:e}=this._rawEditor;return{plugin:t,sizes:e}}set state(t){u.JSONExt.deepEqual(this.state,t)||(this._rawEditor.sizes=t.sizes,this.update())}get stateChanged(){return this._stateChanged}confirm(){return!this.isHidden&&this.isAttached&&this.isDirty?(0,i.showDialog)({title:this._trans.__("You have unsaved changes."),body:this._trans.__("Do you want to leave without saving?"),buttons:[i.Dialog.cancelButton({label:this._trans.__("Cancel")}),i.Dialog.okButton({label:this._trans.__("Ok")})]}).then((t=>{if(!t.button.accept)throw new Error("User canceled.")})):Promise.resolve(void 0)}dispose(){this.isDisposed||(super.dispose(),this._rawEditor.dispose())}onAfterAttach(t){this.update()}onUpdateRequest(t){const e=this._rawEditor;this._settings?(this.show(),e.show()):this.hide()}_onStateChanged(){this.stateChanged.emit(void 0)}}!function(t){t.onSaveError=function(t,e){const s=(e=e||r.nullTranslator).load("jupyterlab");console.error(`Saving setting editor value failed: ${t.message}`),(0,i.showErrorMessage)(s.__("Your changes were not saved."),t)}}(F||(F={}));const N={sizes:[1,3],container:{editor:"raw",plugin:"",sizes:[1,1]}};class M extends o.SplitPanel{constructor(t){super({orientation:"horizontal",renderer:o.SplitPanel.defaultRenderer,spacing:1}),this._fetching=null,this._saving=!1,this._state=u.JSONExt.deepCopy(N),this.translator=t.translator||r.nullTranslator,this.addClass("jp-SettingEditor"),this.key=t.key,this.state=t.state;const{commands:e,editorFactory:s,rendermime:i}=t,a=this.registry=t.registry,d=this._instructions=n.ReactWidget.create(l.createElement(v,{translator:this.translator}));d.addClass("jp-SettingEditorInstructions");const h=this._editor=new k({commands:e,editorFactory:s,registry:a,rendermime:i,translator:this.translator}),p=this._list=new c({confirm:()=>h.confirm(),registry:a,translator:this.translator}),g=t.when;g&&(this._when=Array.isArray(g)?Promise.all(g):g),this.addWidget(p),this.addWidget(d),o.SplitPanel.setStretch(p,0),o.SplitPanel.setStretch(d,1),o.SplitPanel.setStretch(h,1),h.stateChanged.connect(this._onStateChanged,this),p.changed.connect(this._onStateChanged,this),this.handleMoved.connect(this._onStateChanged,this)}get canRevertRaw(){return this._editor.raw.canRevert}get canSaveRaw(){return this._editor.raw.canSave}get commandsChanged(){return this._editor.raw.commandsChanged}get settings(){return this._editor.settings}get source(){return this._editor.raw.source}dispose(){this.isDisposed||(super.dispose(),this._editor.dispose(),this._instructions.dispose(),this._list.dispose())}revert(){this._editor.raw.revert()}save(){return this._editor.raw.save()}onAfterAttach(t){super.onAfterAttach(t),this.hide(),this._fetchState().then((()=>{this.show(),this._setState()})).catch((t=>{console.error("Fetching setting editor state failed",t),this.show(),this._setState()}))}onCloseRequest(t){this._editor.confirm().then((()=>{super.onCloseRequest(t),this.dispose()})).catch((()=>{}))}_fetchState(){if(this._fetching)return this._fetching;const{key:t,state:e}=this,s=[e.fetch(t),this._when];return this._fetching=Promise.all(s).then((([t])=>{this._fetching=null,this._saving||(this._state=O.normalizeState(t,this._state))}))}async _onStateChanged(){this._state.sizes=this.relativeSizes(),this._state.container=this._editor.state,this._state.container.plugin=this._list.selection;try{await this._saveState()}catch(t){console.error("Saving setting editor state failed",t)}this._setState()}async _saveState(){const{key:t,state:e}=this,s=this._state;this._saving=!0;try{await e.save(t,s),this._saving=!1}catch(t){throw this._saving=!1,t}}_setLayout(){const t=this._editor,e=this._state;t.state=e.container,requestAnimationFrame((()=>{this.setRelativeSizes(e.sizes)}))}_setState(){const t=this._editor,e=this._list,{container:s}=this._state;if(!s.plugin)return t.settings=null,e.selection="",void this._setLayout();if(t.settings&&t.settings.id===s.plugin)return void this._setLayout();const i=this._instructions;this.registry.load(s.plugin).then((r=>{i.isAttached&&(i.parent=null),t.isAttached||this.addWidget(t),t.settings=r,e.selection=s.plugin,this._setLayout()})).catch((i=>{console.error(`Loading ${s.plugin} settings failed.`,i),e.selection=this._state.container.plugin="",t.settings=null,this._setLayout()}))}}var O;!function(t){function e(t){return Array.isArray(t)&&t.every((t=>"number"==typeof t))}t.normalizeState=function(t,s){if(!t)return u.JSONExt.deepCopy(N);if("sizes"in t&&e(t.sizes)||(t.sizes=u.JSONExt.deepCopy(N.sizes)),!("container"in t))return t.container=u.JSONExt.deepCopy(N.container),t;const i="container"in t&&t.container&&"object"==typeof t.container?t.container:{};return t.container={plugin:"string"==typeof i.plugin?i.plugin:N.container.plugin,sizes:e(i.sizes)?i.sizes:u.JSONExt.deepCopy(N.container.sizes)},t}}(O||(O={}));var W=s(24758)},24758:(t,e,s)=>{s.d(e,{O:()=>r,g:()=>n});var i=s(20998);const r=new i.Token("@jupyterlab/settingeditor:ISettingEditorTracker","A widget tracker for the interactive setting editor.\n Use this if you want to be able to iterate over and interact with setting editors\n created by the application."),n=new i.Token("@jupyterlab/settingeditor:IJSONSettingEditorTracker","A widget tracker for the JSON setting editor.\n Use this if you want to be able to iterate over and interact with setting editors\n created by the application.")}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3466],{83466:(e,t,r)=>{r.r(t),r.d(t,{RunningLanguageServer:()=>_,default:()=>j});var n=r(400),a=r(30279),s=r(20457),o=r(49255),i=r(59361),c=r(81997),l=r(20998),u=r(97934),m=r(78156),d=r.n(m);const p="languageServers",g="configuration";function h(e){const{[g]:t,...r}=e.schema,{[g]:n,serverName:a,...s}=e.settings,[o,i]=(0,m.useState)(a),c={};Object.entries(n).forEach((([e,t])=>{const r={property:e,type:typeof t,value:t};c[l.UUID.uuid4()]=r}));const[p,h]=(0,m.useState)(c),f={};Object.entries(r).forEach((([e,t])=>{f[e]=e in s?s[e]:t.default}));const[E,S]=(0,m.useState)(f),y=t=>{const r={};Object.entries(p).forEach((([n,a])=>{n!==t&&(r[n]=a);const s={};Object.values(r).forEach((e=>{s[e.property]=e.value})),e.updateSetting.invoke(e.serverHash,{[g]:s}).catch(console.error),h(r)}))},b=new u.Debouncer(((t,r)=>{if(t in p){const n={...p,[t]:r},a={};Object.values(n).forEach((e=>{a[e.property]=e.value})),h(n),e.updateSetting.invoke(e.serverHash,{[g]:a}).catch(console.error)}}));return d().createElement("div",{className:"array-item"},d().createElement("div",{className:"form-group "},d().createElement("div",{className:"jp-FormGroup-content"},d().createElement("div",{className:"jp-objectFieldWrapper"},d().createElement("fieldset",null,d().createElement("div",{className:"form-group small-field"},d().createElement("div",{className:"jp-modifiedIndicator jp-errorIndicator"}),d().createElement("div",{className:"jp-FormGroup-content"},d().createElement("h3",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem"},e.trans.__("Server name:")),d().createElement("div",{className:"jp-inputFieldWrapper jp-FormGroup-contentItem"},d().createElement("input",{className:"form-control",type:"text",required:!0,value:o,onChange:t=>{(t=>{e.updateSetting.invoke(e.serverHash,{serverName:t.target.value}).catch(console.error),i(t.target.value)})(t)}})),d().createElement("div",{className:"validationErrors"},d().createElement("div",null,d().createElement("ul",{className:"error-detail bs-callout bs-callout-info"},d().createElement("li",{className:"text-danger"},e.trans.__("is a required property"))))))),Object.entries(r).map((([t,r],n)=>d().createElement("div",{key:`${n}-${t}`,className:"form-group small-field"},d().createElement("div",{className:"jp-FormGroup-content"},d().createElement("h3",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem"},r.title),d().createElement("div",{className:"jp-inputFieldWrapper jp-FormGroup-contentItem"},d().createElement("input",{className:"form-control",placeholder:"",type:r.type,value:E[t],onChange:n=>((t,r,n)=>{let a=r;"number"===n&&(a=parseFloat(r));const s={...E,[t]:a};e.updateSetting.invoke(e.serverHash,s).catch(console.error),S(s)})(t,n.target.value,r.type)})),d().createElement("div",{className:"jp-FormGroup-description"},r.description),d().createElement("div",{className:"validationErrors"}))))),d().createElement("fieldset",null,d().createElement("legend",null,t.title),Object.entries(p).map((([e,t])=>d().createElement(v,{key:e,hash:e,property:t,removeProperty:y,setProperty:b}))),d().createElement("span",null,t.description)))))),d().createElement("div",{className:"jp-ArrayOperations"},d().createElement("button",{className:"jp-mod-styled jp-mod-reject",onClick:()=>{const t=l.UUID.uuid4(),r={...p,[t]:{property:"",type:"string",value:""}},n={};Object.values(r).forEach((e=>{n[e.property]=e.value})),e.updateSetting.invoke(e.serverHash,{[g]:n}).catch(console.error),h(r)}},e.trans.__("Add property")),d().createElement("button",{className:"jp-mod-styled jp-mod-warn jp-FormGroup-removeButton",onClick:()=>e.removeSetting(e.serverHash)},e.trans.__("Remove server"))))}function v(e){const[t,r]=(0,m.useState)({...e.property}),n=(n,a)=>{let s=n;"number"===a&&(s=parseFloat(n));const o={...t,value:s};e.setProperty.invoke(e.hash,o).catch(console.error),r(o)};return d().createElement("div",{key:e.hash,className:"form-group small-field"},d().createElement("div",{className:"jp-FormGroup-content jp-LSPExtension-FormGroup-content"},d().createElement("input",{className:"form-control",type:"text",required:!0,placeholder:"Property name",value:t.property,onChange:n=>{(n=>{const a={...t,property:n};e.setProperty.invoke(e.hash,a).catch(console.error),r(a)})(n.target.value)}}),d().createElement("select",{className:"form-control",value:t.type,onChange:n=>(n=>{let a;a="boolean"!==n&&("number"===n?0:"");const s={...t,type:n,value:a};r(s),e.setProperty.invoke(e.hash,s).catch(console.error)})(n.target.value)},d().createElement("option",{value:"string"},"String"),d().createElement("option",{value:"number"},"Number"),d().createElement("option",{value:"boolean"},"Boolean")),d().createElement("input",{className:"form-control",type:{string:"text",number:"number",boolean:"checkbox"}[t.type],required:!1,placeholder:"Property value",value:"boolean"!==t.type?t.value:void 0,checked:"boolean"===t.type?t.value:void 0,onChange:"boolean"!==t.type?e=>n(e.target.value,t.type):e=>n(e.target.checked,t.type)}),d().createElement("button",{className:"jp-mod-minimal jp-Button",onClick:()=>{e.removeProperty(e.hash)}},d().createElement(i.closeIcon.react,null))))}class f extends d().Component{constructor(e){super(e),this.removeSetting=e=>{if(e in this.state.items){const t={};for(const r in this.state.items)r!==e&&(t[r]=this.state.items[r]);this.setState((e=>({...e,items:t})),(()=>{this.saveServerSetting()}))}},this.updateSetting=(e,t)=>{if(e in this.state.items){const r={};for(const n in this.state.items)r[n]=n===e?{...this.state.items[n],...t}:this.state.items[n];this.setState((e=>({...e,items:r})),(()=>{this.saveServerSetting()}))}},this.addServerSetting=()=>{let e=0,t="newKey";for(;Object.values(this.state.items).map((e=>e.serverName)).includes(t);)e+=1,t=`newKey-${e}`;this.setState((e=>({...e,items:{...e.items,[l.UUID.uuid4()]:{...this._defaultSetting,serverName:t}}})),(()=>{this.saveServerSetting()}))},this.saveServerSetting=()=>{const e={};Object.values(this.state.items).forEach((t=>{const{serverName:r,...n}=t;e[r]=n})),this._setting.set(p,e).catch(console.error)},this._setting=e.formContext.settings,this._trans=e.translator.load("jupyterlab");const t=this._setting.schema.definitions;this._defaultSetting=t.languageServer.default,this._schema=t.languageServer.properties;const r=e.schema.title,n=e.schema.description,a=e.formContext.settings.get(p).composite;let s={};a&&Object.entries(a).forEach((([e,t])=>{if(t){const r=l.UUID.uuid4();s[r]={serverName:e,...t}}})),this.state={title:r,desc:n,items:s},this._debouncedUpdateSetting=new u.Debouncer(this.updateSetting.bind(this))}render(){return d().createElement("div",null,d().createElement("fieldset",null,d().createElement("legend",null,this.state.title),d().createElement("p",{className:"field-description"},this.state.desc),d().createElement("div",{className:"field field-array field-array-of-object"},Object.entries(this.state.items).map((([e,t],r)=>d().createElement(h,{key:`${r}-${e}`,trans:this._trans,removeSetting:this.removeSetting,updateSetting:this._debouncedUpdateSetting,serverHash:e,settings:t,schema:this._schema})))),d().createElement("div",null,d().createElement("button",{style:{margin:2},className:"jp-mod-styled jp-mod-reject",onClick:this.addServerSetting},this._trans.__("Add server")))))}}const E={activate:function(e,t,r){const a=new n.LanguageServerManager({settings:e.serviceManager.serverSettings}),s=new n.DocumentConnectionManager({languageServerManager:a});return r&&function(e,t,r){const n=r.load("jupyterlab"),a=new c.Signal(t);t.connected.connect((()=>a.emit(t))),t.disconnected.connect((()=>a.emit(t))),t.closed.connect((()=>a.emit(t))),t.documentsChanged.connect((()=>a.emit(t)));let s=[];e.add({name:n.__("Language servers"),running:()=>{const e=new Set([...t.connections.values()]);return s=[...e].map((e=>new _(e,t))),s},shutdownAll:()=>{s.forEach((e=>{e.shutdown()}))},refreshRunning:()=>{},runningChanged:a,shutdownLabel:n.__("Shut Down"),shutdownAllLabel:n.__("Shut Down All"),shutdownAllConfirmationText:n.__("Are you sure you want to permanently shut down all running language servers?")})}(r,s,t),s},id:"@jupyterlab/lsp-extension:plugin",description:"Provides the language server connection manager.",requires:[o.ITranslator],optional:[a.IRunningSessionManagers],provides:n.ILSPDocumentConnectionManager,autoStart:!0},S={id:"@jupyterlab/lsp-extension:feature",description:"Provides the language server feature manager.",activate:()=>new n.FeatureManager,provides:n.ILSPFeatureManager,autoStart:!0},y={activate:function(e,t,r,n,a){const s="languageServers",o=t.languageServerManager,i=e=>{const r=e.composite,n=r.languageServers||{};if("on"!==r.activate||o.isEnabled){if("off"===r.activate&&o.isEnabled)return void o.disable()}else o.enable().catch(console.error);t.initialConfigurations=n,t.updateConfiguration(n),t.updateServerConfigurations(n),t.updateLogging(r.logAllCommunication,r.setTrace)};if(r.transform(E.id,{fetch:e=>{const t=e.schema.properties,r={};return o.sessions.forEach(((e,t)=>{r[t]={rank:50,configuration:{}}})),t[s].default=r,e},compose:e=>{const t=e.schema.properties,r=e.data.user,n=t[s].default,a=r[s];let o={...n};a&&(o={...o,...a});const i={[s]:o};return Object.entries(t).forEach((([e,t])=>{e!==s&&(i[e]=e in r?r[e]:t.default)})),e.data.composite=i,e}}),o.sessionsChanged.connect((async()=>{await r.load(E.id,!0)})),r.load(E.id).then((e=>{i(e),e.changed.connect((()=>{i(e)})),o.disable()})).catch((e=>{console.error(e.message)})),a){const e={fieldRenderer:e=>function(e,t){return d().createElement(f,{...e,translator:t})}(e,n)};a.addRenderer(`${E.id}.${s}`,e)}},id:"@jupyterlab/lsp-extension:settings",description:"Provides the language server settings.",requires:[n.ILSPDocumentConnectionManager,s.ISettingRegistry,o.ITranslator],optional:[i.IFormRendererRegistry],autoStart:!0},b={id:n.ILSPCodeExtractorsManager.name,description:"Provides the code extractor manager.",activate:e=>{const t=new n.CodeExtractorsManager,r=new n.TextForeignCodeExtractor({language:"markdown",isStandalone:!1,file_extension:"md",cellType:["markdown"]});t.register(r,null);const a=new n.TextForeignCodeExtractor({language:"text",isStandalone:!1,file_extension:"txt",cellType:["raw"]});return t.register(a,null),t},provides:n.ILSPCodeExtractorsManager,autoStart:!0};class _{constructor(e,t){this._connection=new WeakSet([e]),this._manager=t,this._serverIdentifier=e.serverIdentifier,this._serverLanguage=e.serverLanguage}open(){}icon(){return i.pythonIcon}label(){var e,t;return`${null!==(e=this._serverIdentifier)&&void 0!==e?e:""} (${null!==(t=this._serverLanguage)&&void 0!==t?t:""})`}shutdown(){for(const[e,t]of this._manager.connections.entries())if(this._connection.has(t)){const{uri:t}=this._manager.documents.get(e);this._manager.unregisterDocument(t)}this._manager.disconnect(this._serverIdentifier)}}const j=[E,S,y,b]}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3466],{83466:(e,t,r)=>{r.r(t),r.d(t,{RunningLanguageServer:()=>j,default:()=>N});var n=r(94146),a=r(80038),s=r(50727),o=r(5944),i=r(70798),c=r(81997),l=r(20998),u=r(97934),m=r(78156),d=r.n(m);const p="languageServers",g="configuration";function h(e){const{[g]:t,...r}=e.schema,{[g]:n,serverName:a,...s}=e.settings,[o,i]=(0,m.useState)(a),c={};Object.entries(n).forEach((([e,t])=>{const r={property:e,type:typeof t,value:t};c[l.UUID.uuid4()]=r}));const[p,h]=(0,m.useState)(c),f={};Object.entries(r).forEach((([e,t])=>{f[e]=e in s?s[e]:t.default}));const[E,S]=(0,m.useState)(f),y=t=>{const r={};Object.entries(p).forEach((([n,a])=>{n!==t&&(r[n]=a);const s={};Object.values(r).forEach((e=>{s[e.property]=e.value})),e.updateSetting.invoke(e.serverHash,{[g]:s}).catch(console.error),h(r)}))},b=new u.Debouncer(((t,r)=>{if(t in p){const n={...p,[t]:r},a={};Object.values(n).forEach((e=>{a[e.property]=e.value})),h(n),e.updateSetting.invoke(e.serverHash,{[g]:a}).catch(console.error)}}));return d().createElement("div",{className:"array-item"},d().createElement("div",{className:"form-group "},d().createElement("div",{className:"jp-FormGroup-content"},d().createElement("div",{className:"jp-objectFieldWrapper"},d().createElement("fieldset",null,d().createElement("div",{className:"form-group small-field"},d().createElement("div",{className:"jp-modifiedIndicator jp-errorIndicator"}),d().createElement("div",{className:"jp-FormGroup-content"},d().createElement("h3",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem"},e.trans.__("Server name:")),d().createElement("div",{className:"jp-inputFieldWrapper jp-FormGroup-contentItem"},d().createElement("input",{className:"form-control",type:"text",required:!0,value:o,onChange:t=>{(t=>{e.updateSetting.invoke(e.serverHash,{serverName:t.target.value}).catch(console.error),i(t.target.value)})(t)}})),d().createElement("div",{className:"validationErrors"},d().createElement("div",null,d().createElement("ul",{className:"error-detail bs-callout bs-callout-info"},d().createElement("li",{className:"text-danger"},e.trans.__("is a required property"))))))),Object.entries(r).map((([t,r],n)=>d().createElement("div",{key:`${n}-${t}`,className:"form-group small-field"},d().createElement("div",{className:"jp-FormGroup-content"},d().createElement("h3",{className:"jp-FormGroup-fieldLabel jp-FormGroup-contentItem"},r.title),d().createElement("div",{className:"jp-inputFieldWrapper jp-FormGroup-contentItem"},d().createElement("input",{className:"form-control",placeholder:"",type:r.type,value:E[t],onChange:n=>((t,r,n)=>{let a=r;"number"===n&&(a=parseFloat(r));const s={...E,[t]:a};e.updateSetting.invoke(e.serverHash,s).catch(console.error),S(s)})(t,n.target.value,r.type)})),d().createElement("div",{className:"jp-FormGroup-description"},r.description),d().createElement("div",{className:"validationErrors"}))))),d().createElement("fieldset",null,d().createElement("legend",null,t.title),Object.entries(p).map((([e,t])=>d().createElement(v,{key:e,hash:e,property:t,removeProperty:y,setProperty:b}))),d().createElement("span",null,t.description)))))),d().createElement("div",{className:"jp-ArrayOperations"},d().createElement("button",{className:"jp-mod-styled jp-mod-reject",onClick:()=>{const t=l.UUID.uuid4(),r={...p,[t]:{property:"",type:"string",value:""}},n={};Object.values(r).forEach((e=>{n[e.property]=e.value})),e.updateSetting.invoke(e.serverHash,{[g]:n}).catch(console.error),h(r)}},e.trans.__("Add property")),d().createElement("button",{className:"jp-mod-styled jp-mod-warn jp-FormGroup-removeButton",onClick:()=>e.removeSetting(e.serverHash)},e.trans.__("Remove server"))))}function v(e){const[t,r]=(0,m.useState)({...e.property}),n=(n,a)=>{let s=n;"number"===a&&(s=parseFloat(n));const o={...t,value:s};e.setProperty.invoke(e.hash,o).catch(console.error),r(o)};return d().createElement("div",{key:e.hash,className:"form-group small-field"},d().createElement("div",{className:"jp-FormGroup-content jp-LSPExtension-FormGroup-content"},d().createElement("input",{className:"form-control",type:"text",required:!0,placeholder:"Property name",value:t.property,onChange:n=>{(n=>{const a={...t,property:n};e.setProperty.invoke(e.hash,a).catch(console.error),r(a)})(n.target.value)}}),d().createElement("select",{className:"form-control",value:t.type,onChange:n=>(n=>{let a;a="boolean"!==n&&("number"===n?0:"");const s={...t,type:n,value:a};r(s),e.setProperty.invoke(e.hash,s).catch(console.error)})(n.target.value)},d().createElement("option",{value:"string"},"String"),d().createElement("option",{value:"number"},"Number"),d().createElement("option",{value:"boolean"},"Boolean")),d().createElement("input",{className:"form-control",type:{string:"text",number:"number",boolean:"checkbox"}[t.type],required:!1,placeholder:"Property value",value:"boolean"!==t.type?t.value:void 0,checked:"boolean"===t.type?t.value:void 0,onChange:"boolean"!==t.type?e=>n(e.target.value,t.type):e=>n(e.target.checked,t.type)}),d().createElement("button",{className:"jp-mod-minimal jp-Button",onClick:()=>{e.removeProperty(e.hash)}},d().createElement(i.closeIcon.react,null))))}class f extends d().Component{constructor(e){super(e),this.removeSetting=e=>{if(e in this.state.items){const t={};for(const r in this.state.items)r!==e&&(t[r]=this.state.items[r]);this.setState((e=>({...e,items:t})),(()=>{this.saveServerSetting()}))}},this.updateSetting=(e,t)=>{if(e in this.state.items){const r={};for(const n in this.state.items)r[n]=n===e?{...this.state.items[n],...t}:this.state.items[n];this.setState((e=>({...e,items:r})),(()=>{this.saveServerSetting()}))}},this.addServerSetting=()=>{let e=0,t="newKey";for(;Object.values(this.state.items).map((e=>e.serverName)).includes(t);)e+=1,t=`newKey-${e}`;this.setState((e=>({...e,items:{...e.items,[l.UUID.uuid4()]:{...this._defaultSetting,serverName:t}}})),(()=>{this.saveServerSetting()}))},this.saveServerSetting=()=>{const e={};Object.values(this.state.items).forEach((t=>{const{serverName:r,...n}=t;e[r]=n})),this._setting.set(p,e).catch(console.error)},this._setting=e.formContext.settings,this._trans=e.translator.load("jupyterlab");const t=this._setting.schema.definitions;this._defaultSetting=t.languageServer.default,this._schema=t.languageServer.properties;const r=e.schema.title,n=e.schema.description,a=e.formContext.settings.get(p).composite;let s={};a&&Object.entries(a).forEach((([e,t])=>{if(t){const r=l.UUID.uuid4();s[r]={serverName:e,...t}}})),this.state={title:r,desc:n,items:s},this._debouncedUpdateSetting=new u.Debouncer(this.updateSetting.bind(this))}render(){return d().createElement("div",null,d().createElement("fieldset",null,d().createElement("legend",null,this.state.title),d().createElement("p",{className:"field-description"},this.state.desc),d().createElement("div",{className:"field field-array field-array-of-object"},Object.entries(this.state.items).map((([e,t],r)=>d().createElement(h,{key:`${r}-${e}`,trans:this._trans,removeSetting:this.removeSetting,updateSetting:this._debouncedUpdateSetting,serverHash:e,settings:t,schema:this._schema})))),d().createElement("div",null,d().createElement("button",{style:{margin:2},className:"jp-mod-styled jp-mod-reject",onClick:this.addServerSetting},this._trans.__("Add server")))))}}const E={activate:function(e,t,r,a){const s=new n.LanguageServerManager({settings:e.serviceManager.serverSettings}),o=new n.DocumentConnectionManager({languageServerManager:s,adapterTracker:r});return a&&function(e,t,r){const n=r.load("jupyterlab"),a=new c.Signal(t);t.connected.connect((()=>a.emit(t))),t.disconnected.connect((()=>a.emit(t))),t.closed.connect((()=>a.emit(t))),t.documentsChanged.connect((()=>a.emit(t)));let s=[];e.add({name:n.__("Language servers"),running:()=>{const e=new Set([...t.connections.values()]);return s=[...e].map((e=>new j(e,t))),s},shutdownAll:()=>{s.forEach((e=>{e.shutdown()}))},refreshRunning:()=>{},runningChanged:a,shutdownLabel:n.__("Shut Down"),shutdownAllLabel:n.__("Shut Down All"),shutdownAllConfirmationText:n.__("Are you sure you want to permanently shut down all running language servers?")})}(a,o,t),o},id:"@jupyterlab/lsp-extension:plugin",description:"Provides the language server connection manager.",requires:[o.ITranslator,n.IWidgetLSPAdapterTracker],optional:[a.IRunningSessionManagers],provides:n.ILSPDocumentConnectionManager,autoStart:!0},S={id:"@jupyterlab/lsp-extension:feature",description:"Provides the language server feature manager.",activate:()=>new n.FeatureManager,provides:n.ILSPFeatureManager,autoStart:!0},y={activate:function(e,t,r,n,a){const s="languageServers",o=t.languageServerManager,i=e=>{const r=e.composite,n=r.languageServers||{};if("on"!==r.activate||o.isEnabled){if("off"===r.activate&&o.isEnabled)return void o.disable()}else o.enable().catch(console.error);t.initialConfigurations=n,t.updateConfiguration(n),t.updateServerConfigurations(n),t.updateLogging(r.logAllCommunication,r.setTrace)};if(r.transform(E.id,{fetch:e=>{const t=e.schema.properties,r={};return o.sessions.forEach(((e,t)=>{r[t]={rank:50,configuration:{}}})),t[s].default=r,e},compose:e=>{const t=e.schema.properties,r=e.data.user,n=t[s].default,a=r[s];let o={...n};a&&(o={...o,...a});const i={[s]:o};return Object.entries(t).forEach((([e,t])=>{e!==s&&(i[e]=e in r?r[e]:t.default)})),e.data.composite=i,e}}),o.sessionsChanged.connect((async()=>{await r.load(E.id,!0)})),r.load(E.id).then((e=>{i(e),e.changed.connect((()=>{i(e)})),o.disable()})).catch((e=>{console.error(e.message)})),a){const e={fieldRenderer:e=>function(e,t){return d().createElement(f,{...e,translator:t})}(e,n)};a.addRenderer(`${E.id}.${s}`,e)}},id:"@jupyterlab/lsp-extension:settings",description:"Provides the language server settings.",requires:[n.ILSPDocumentConnectionManager,s.ISettingRegistry,o.ITranslator],optional:[i.IFormRendererRegistry],autoStart:!0},b={id:n.ILSPCodeExtractorsManager.name,description:"Provides the code extractor manager.",activate:e=>{const t=new n.CodeExtractorsManager,r=new n.TextForeignCodeExtractor({language:"markdown",isStandalone:!1,file_extension:"md",cellType:["markdown"]});t.register(r,null);const a=new n.TextForeignCodeExtractor({language:"text",isStandalone:!1,file_extension:"txt",cellType:["raw"]});return t.register(a,null),t},provides:n.ILSPCodeExtractorsManager,autoStart:!0};class j{constructor(e,t){this._connection=new WeakSet([e]),this._manager=t,this._serverIdentifier=e.serverIdentifier,this._serverLanguage=e.serverLanguage}open(){}icon(){return i.pythonIcon}label(){var e,t;return`${null!==(e=this._serverIdentifier)&&void 0!==e?e:""} (${null!==(t=this._serverLanguage)&&void 0!==t?t:""})`}shutdown(){for(const[e,t]of this._manager.connections.entries())if(this._connection.has(t)){const{uri:t}=this._manager.documents.get(e);this._manager.unregisterDocument(t)}this._manager.disconnect(this._serverIdentifier)}}const _={id:"@jupyterlab/lsp-extension:tracker",description:"Provides the tracker of `WidgetLSPAdapter`.",autoStart:!0,provides:n.IWidgetLSPAdapterTracker,activate:e=>new n.WidgetLSPAdapterTracker({shell:e.shell})},N=[E,S,y,b,_]}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[35],{50035:(t,e,s)=>{function a(t){let e=new Map;return t.changes.keys.forEach(((t,s)=>{e.set(s,{action:t.action,oldValue:t.oldValue,newValue:this.ymeta.get(s)})})),e}s.r(e),s.d(e,{YBaseCell:()=>b,YCodeCell:()=>v,YDocument:()=>m,YFile:()=>p,YMarkdownCell:()=>w,YNotebook:()=>C,YRawCell:()=>k,convertYMapEventToMapChange:()=>a,createMutex:()=>n,createStandaloneCell:()=>f});const n=()=>{let t=!0;return e=>{if(t){t=!1;try{e()}finally{t=!0}}}};var o=s(20998),i=s(81997),r=s(2431),d=s(11182),h=s(12330),l=s(38828),c=s(87946);class u extends h.y{constructor(t){super(),this.doc=t,this.clientID=t.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval((()=>{const t=r.ZG();null!==this.getLocalState()&&15e3<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const e=[];this.meta.forEach(((s,a)=>{a!==this.clientID&&3e4<=t-s.lastUpdated&&this.states.has(a)&&e.push(a)})),e.length>0&&g(this,e,"timeout")}),d.GW(3e3)),t.on("destroy",(()=>{this.destroy()})),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(t){const e=this.clientID,s=this.meta.get(e),a=void 0===s?0:s.clock+1,n=this.states.get(e);null===t?this.states.delete(e):this.states.set(e,t),this.meta.set(e,{clock:a,lastUpdated:r.ZG()});const o=[],i=[],d=[],h=[];null===t?h.push(e):null==n?null!=t&&o.push(e):(i.push(e),l.Hi(n,t)||d.push(e)),(o.length>0||d.length>0||h.length>0)&&this.emit("change",[{added:o,updated:d,removed:h},"local"]),this.emit("update",[{added:o,updated:i,removed:h},"local"])}setLocalStateField(t,e){const s=this.getLocalState();null!==s&&this.setLocalState({...s,[t]:e})}getStates(){return this.states}}const g=(t,e,s)=>{const a=[];for(let s=0;s<e.length;s++){const n=e[s];if(t.states.has(n)){if(t.states.delete(n),n===t.clientID){const e=t.meta.get(n);t.meta.set(n,{clock:e.clock+1,lastUpdated:r.ZG()})}a.push(n)}}a.length>0&&(t.emit("change",[{added:[],updated:[],removed:a},s]),t.emit("update",[{added:[],updated:[],removed:a},s]))};class m{constructor(t){var e;this.onStateChanged=t=>{const e=new Array;t.keysChanged.forEach((s=>{const a=t.changes.keys.get(s);a&&e.push({name:s,oldValue:a.oldValue,newValue:this.ystate.get(s)})})),this._changed.emit({stateChange:e})},this._changed=new i.Signal(this),this._isDisposed=!1,this._disposed=new i.Signal(this),this._ydoc=null!==(e=null==t?void 0:t.ydoc)&&void 0!==e?e:new c.Doc,this._ystate=this._ydoc.getMap("state"),this._undoManager=new c.UndoManager([],{trackedOrigins:new Set([this]),doc:this._ydoc}),this._awareness=new u(this._ydoc),this._ystate.observe(this.onStateChanged)}get ydoc(){return this._ydoc}get ystate(){return this._ystate}get undoManager(){return this._undoManager}get awareness(){return this._awareness}get changed(){return this._changed}get disposed(){return this._disposed}get isDisposed(){return this._isDisposed}get state(){return o.JSONExt.deepCopy(this.ystate.toJSON())}canUndo(){return this.undoManager.undoStack.length>0}canRedo(){return this.undoManager.redoStack.length>0}dispose(){this._isDisposed||(this._isDisposed=!0,this.ystate.unobserve(this.onStateChanged),this.awareness.destroy(),this.undoManager.destroy(),this.ydoc.destroy(),this._disposed.emit(),i.Signal.clearData(this))}getState(t){const e=this.ystate.get(t);return void 0===e?e:o.JSONExt.deepCopy(e)}setState(t,e){o.JSONExt.deepEqual(this.ystate.get(t),e)||this.ystate.set(t,e)}undo(){this.undoManager.undo()}redo(){this.undoManager.redo()}clearUndoHistory(){this.undoManager.clear()}transact(t,e=!0){this.ydoc.transact(t,e?this:null)}}class p extends m{constructor(){super(),this.version="1.0.0",this.ysource=this.ydoc.getText("source"),this._modelObserver=t=>{this._changed.emit({sourceChange:t.changes.delta})},this.undoManager.addToScope(this.ysource),this.ysource.observe(this._modelObserver)}static create(){return new p}get source(){return this.getSource()}set source(t){this.setSource(t)}dispose(){this.isDisposed||(this.ysource.unobserve(this._modelObserver),super.dispose())}getSource(){return this.ysource.toString()}setSource(t){this.transact((()=>{const e=this.ysource;e.delete(0,e.length),e.insert(0,t)}))}updateSource(t,e,s=""){this.transact((()=>{const a=this.ysource;a.insert(t,s),a.delete(t+s.length,e-t)}))}}const y=(t,e={})=>{switch(t.get("cell_type")){case"code":return new v(t,t.get("source"),t.get("outputs"),e);case"markdown":return new w(t,t.get("source"),e);case"raw":return new k(t,t.get("source"),e);default:throw new Error("Found unknown cell type")}},_=(t,e)=>{var s,a;const n=new c.Map,i=new c.Text,r=new c.Map;let d;switch(n.set("source",i),n.set("metadata",r),n.set("cell_type",t.cell_type),n.set("id",null!==(s=t.id)&&void 0!==s?s:o.UUID.uuid4()),t.cell_type){case"markdown":d=new w(n,i,{notebook:e},r),null!=t.attachments&&d.setAttachments(t.attachments);break;case"code":{const s=new c.Array;n.set("outputs",s),d=new v(n,i,s,{notebook:e},r);const o=t;d.execution_count=null!==(a=o.execution_count)&&void 0!==a?a:null,o.outputs&&d.setOutputs(o.outputs);break}default:d=new k(n,i,{notebook:e},r),t.attachments&&d.setAttachments(t.attachments)}return null!=t.metadata&&d.setMetadata(t.metadata),null!=t.source&&d.setSource("string"==typeof t.source?t.source:t.source.join("\n")),d},f=t=>_(t);class b{static create(t){return _({id:t,cell_type:this.prototype.cell_type})}constructor(t,e,s={},a){if(this._modelObserver=t=>{this._changed.emit(this.getChanges(t))},this._metadataChanged=new i.Signal(this),this._notebook=null,this._changed=new i.Signal(this),this._disposed=new i.Signal(this),this._isDisposed=!1,this._undoManager=null,this.ymodel=t,this._ysource=e,this._ymetadata=null!=a?a:this.ymodel.get("metadata"),this._prevSourceLength=e?e.length:0,this._notebook=null,this._awareness=null,this._undoManager=null,s.notebook)this._notebook=s.notebook;else{const t=new c.Doc;t.getArray().insert(0,[this.ymodel]),this._awareness=new u(t),this._undoManager=new c.UndoManager([this.ymodel],{trackedOrigins:new Set([this])})}this.ymodel.observeDeep(this._modelObserver)}get awareness(){var t,e,s;return null!==(s=null!==(t=this._awareness)&&void 0!==t?t:null===(e=this.notebook)||void 0===e?void 0:e.awareness)&&void 0!==s?s:null}get cell_type(){throw new Error("A YBaseCell must not be constructed")}get changed(){return this._changed}get disposed(){return this._disposed}get id(){return this.getId()}get isDisposed(){return this._isDisposed}get isStandalone(){return null!==this._notebook}get metadata(){return this.getMetadata()}set metadata(t){this.setMetadata(t)}get metadataChanged(){return this._metadataChanged}get notebook(){return this._notebook}get source(){return this.getSource()}set source(t){this.setSource(t)}get undoManager(){var t;return this.notebook?(null===(t=this.notebook)||void 0===t?void 0:t.disableDocumentWideUndoRedo)?this._undoManager:this.notebook.undoManager:this._undoManager}setUndoManager(){if(this._undoManager)throw new Error("The cell undo manager is already set.");this._notebook&&this._notebook.disableDocumentWideUndoRedo&&(this._undoManager=new c.UndoManager([this.ymodel],{trackedOrigins:new Set([this])}))}get ysource(){return this._ysource}canUndo(){return!!this.undoManager&&this.undoManager.undoStack.length>0}canRedo(){return!!this.undoManager&&this.undoManager.redoStack.length>0}clearUndoHistory(){var t;null===(t=this.undoManager)||void 0===t||t.clear()}undo(){var t;null===(t=this.undoManager)||void 0===t||t.undo()}redo(){var t;null===(t=this.undoManager)||void 0===t||t.redo()}dispose(){var t;if(!this._isDisposed){if(this._isDisposed=!0,this.ymodel.unobserveDeep(this._modelObserver),this._awareness){const t=this._awareness.doc;this._awareness.destroy(),t.destroy()}this._undoManager&&(this._undoManager===(null===(t=this.notebook)||void 0===t?void 0:t.undoManager)?this._undoManager=null:this._undoManager.destroy()),this._disposed.emit(),i.Signal.clearData(this)}}getId(){return this.ymodel.get("id")}getSource(){return this.ysource.toString()}setSource(t){this.transact((()=>{this.ysource.delete(0,this.ysource.length),this.ysource.insert(0,t)}))}updateSource(t,e,s=""){this.transact((()=>{const a=this.ysource;a.insert(t,s),a.delete(t+s.length,e-t)}))}deleteMetadata(t){void 0!==this.getMetadata(t)&&this.transact((()=>{this._ymetadata.delete(t);const e=this.getMetadata("jupyter");if("collapsed"===t&&e){const{outputs_hidden:t,...s}=e;0===Object.keys(s).length?this._ymetadata.delete("jupyter"):this._ymetadata.set("jupyter",s)}else"jupyter"===t&&this._ymetadata.delete("collapsed")}),!1)}getMetadata(t){const e=this._ymetadata;if(void 0!==e)return"string"==typeof t?void 0===e.get(t)?void 0:o.JSONExt.deepCopy(e.get(t)):o.JSONExt.deepCopy(e.toJSON())}setMetadata(t,e){var s,a;if("string"==typeof t){if(void 0===e)throw new TypeError(`Metadata value for ${t} cannot be 'undefined'; use deleteMetadata.`);const a=t;if(o.JSONExt.deepEqual(null!==(s=this.getMetadata(a))&&void 0!==s?s:null,e))return;this.transact((()=>{var t;if(this._ymetadata.set(a,e),"collapsed"===a){const s=null!==(t=this.getMetadata("jupyter"))&&void 0!==t?t:{};s.outputs_hidden!==e&&this.setMetadata("jupyter",{...s,outputs_hidden:e})}else if("jupyter"===a){const t=e.outputs_hidden;void 0!==t?this.getMetadata("collapsed")!==t&&this.setMetadata("collapsed",t):this.deleteMetadata("collapsed")}}),!1)}else{const e=o.JSONExt.deepCopy(t);null!=e.collapsed?(e.jupyter=e.jupyter||{},e.jupyter.outputs_hidden=e.collapsed):null!=(null===(a=null==e?void 0:e.jupyter)||void 0===a?void 0:a.outputs_hidden)&&(e.collapsed=e.jupyter.outputs_hidden),o.JSONExt.deepEqual(e,this.getMetadata())||this.transact((()=>{for(const[t,s]of Object.entries(e))this._ymetadata.set(t,s)}),!1)}}toJSON(){return{id:this.getId(),cell_type:this.cell_type,source:this.getSource(),metadata:this.getMetadata()}}transact(t,e=!0){!this.notebook||this.notebook.disableDocumentWideUndoRedo?null==this.ymodel.doc?t():this.ymodel.doc.transact(t,e?this:null):this.notebook.transact(t,e)}getChanges(t){const e={},s=t.find((t=>t.target===this.ymodel.get("source")));s&&(e.sourceChange=s.changes.delta);const a=t.find((t=>t.target===this._ymetadata));a&&(e.metadataChange=a.changes.keys,a.changes.keys.forEach(((t,e)=>{switch(t.action){case"add":this._metadataChanged.emit({key:e,newValue:this._ymetadata.get(e),type:"add"});break;case"delete":this._metadataChanged.emit({key:e,oldValue:t.oldValue,type:"remove"});break;case"update":{const s=this._ymetadata.get(e),a=t.oldValue;let n=!0;n="object"==typeof a&&"object"==typeof s?o.JSONExt.deepEqual(a,s):a===s,n||this._metadataChanged.emit({key:e,type:"change",oldValue:a,newValue:s})}}})));const n=t.find((t=>t.target===this.ymodel)),i=this.ymodel.get("source");return n&&n.keysChanged.has("source")&&(e.sourceChange=[{delete:this._prevSourceLength},{insert:i.toString()}]),this._prevSourceLength=i.length,e}}class v extends b{static create(t){return super.create(t)}constructor(t,e,s,a={},n){super(t,e,a,n),this._youtputs=s}get cell_type(){return"code"}get execution_count(){return this.ymodel.get("execution_count")||null}set execution_count(t){this.ymodel.get("execution_count")!==t&&this.transact((()=>{this.ymodel.set("execution_count",t)}),!1)}get outputs(){return this.getOutputs()}set outputs(t){this.setOutputs(t)}getOutputs(){return o.JSONExt.deepCopy(this._youtputs.toArray())}setOutputs(t){this.transact((()=>{this._youtputs.delete(0,this._youtputs.length),this._youtputs.insert(0,t)}),!1)}updateOutputs(t,e,s=[]){const a=e<this._youtputs.length?e-t:this._youtputs.length-t;this.transact((()=>{this._youtputs.delete(t,a),this._youtputs.insert(t,s)}),!1)}toJSON(){return{...super.toJSON(),outputs:this.getOutputs(),execution_count:this.execution_count}}getChanges(t){const e=super.getChanges(t),s=t.find((t=>t.target===this.ymodel.get("outputs")));s&&(e.outputsChange=s.changes.delta);const a=t.find((t=>t.target===this.ymodel));if(a&&a.keysChanged.has("execution_count")){const t=a.changes.keys.get("execution_count");e.executionCountChange={oldValue:t.oldValue,newValue:this.ymodel.get("execution_count")}}return e}}class M extends b{get attachments(){return this.getAttachments()}set attachments(t){this.setAttachments(t)}getAttachments(){return this.ymodel.get("attachments")}setAttachments(t){this.transact((()=>{null==t?this.ymodel.delete("attachments"):this.ymodel.set("attachments",t)}),!1)}getChanges(t){const e=super.getChanges(t),s=t.find((t=>t.target===this.ymodel));if(s&&s.keysChanged.has("attachments")){const t=s.changes.keys.get("attachments");e.executionCountChange={oldValue:t.oldValue,newValue:this.ymodel.get("attachments")}}return e}}class k extends M{static create(t){return super.create(t)}get cell_type(){return"raw"}toJSON(){return{id:this.getId(),cell_type:"raw",source:this.getSource(),metadata:this.getMetadata(),attachments:this.getAttachments()}}}class w extends M{static create(t){return super.create(t)}get cell_type(){return"markdown"}toJSON(){return{id:this.getId(),cell_type:"markdown",source:this.getSource(),metadata:this.getMetadata(),attachments:this.getAttachments()}}}class C extends m{constructor(t={}){var e;super(),this.version="1.0.0",this.ymeta=this.ydoc.getMap("meta"),this._onMetaChanged=t=>{const e=t.find((t=>t.target===this.ymeta.get("metadata")));if(e){const t=e.changes.keys,s=this.ymeta.get("metadata");e.changes.keys.forEach(((t,e)=>{switch(t.action){case"add":this._metadataChanged.emit({key:e,type:"add",newValue:s.get(e)});break;case"delete":this._metadataChanged.emit({key:e,type:"remove",oldValue:t.oldValue});break;case"update":{const a=s.get(e),n=t.oldValue;let i=!0;i="object"==typeof n&&"object"==typeof a?o.JSONExt.deepEqual(n,a):n===a,i||this._metadataChanged.emit({key:e,type:"change",oldValue:n,newValue:a})}}})),this._changed.emit({metadataChange:t})}const s=t.find((t=>t.target===this.ymeta));if(s){if(s.keysChanged.has("metadata")){const t=s.changes.keys.get("metadata");if("add"===(null==t?void 0:t.action)&&!t.oldValue){const t=new Map;for(const e of Object.keys(this.metadata))t.set(e,{action:"add",oldValue:void 0}),this._metadataChanged.emit({key:e,type:"add",newValue:this.getMetadata(e)});this._changed.emit({metadataChange:t})}}if(s.keysChanged.has("nbformat")){const t=s.changes.keys.get("nbformat"),e={key:"nbformat",oldValue:(null==t?void 0:t.oldValue)?t.oldValue:void 0,newValue:this.nbformat};this._changed.emit({nbformatChanged:e})}if(s.keysChanged.has("nbformat_minor")){const t=s.changes.keys.get("nbformat_minor"),e={key:"nbformat_minor",oldValue:(null==t?void 0:t.oldValue)?t.oldValue:void 0,newValue:this.nbformat_minor};this._changed.emit({nbformatChanged:e})}}},this._onYCellsChanged=t=>{t.changes.added.forEach((t=>{const e=t.content.type;if(!this._ycellMapping.has(e)){const t=y(e,{notebook:this});t.setUndoManager(),this._ycellMapping.set(e,t)}})),t.changes.deleted.forEach((t=>{const e=t.content.type,s=this._ycellMapping.get(e);s&&(s.dispose(),this._ycellMapping.delete(e))}));let e=0;const s=[];t.changes.delta.forEach((t=>{if(null!=t.insert){const a=t.insert.map((t=>this._ycellMapping.get(t)));s.push({insert:a}),this.cells.splice(e,0,...a),e+=t.insert.length}else null!=t.delete?(s.push(t),this.cells.splice(e,t.delete)):null!=t.retain&&(s.push(t),e+=t.retain)})),this._changed.emit({cellsChange:s})},this._metadataChanged=new i.Signal(this),this._ycells=this.ydoc.getArray("cells"),this._ycellMapping=new WeakMap,this._disableDocumentWideUndoRedo=null!==(e=t.disableDocumentWideUndoRedo)&&void 0!==e&&e,this.cells=this._ycells.toArray().map((t=>(this._ycellMapping.has(t)||this._ycellMapping.set(t,y(t,{notebook:this})),this._ycellMapping.get(t)))),this.undoManager.addToScope(this._ycells),this._ycells.observe(this._onYCellsChanged),this.ymeta.observeDeep(this._onMetaChanged)}static create(t={}){var e,s,a,n,o,i,r,d,h;const l=new C({disableDocumentWideUndoRedo:null!==(e=t.disableDocumentWideUndoRedo)&&void 0!==e&&e}),c={cells:null!==(a=null===(s=t.data)||void 0===s?void 0:s.cells)&&void 0!==a?a:[],nbformat:null!==(o=null===(n=t.data)||void 0===n?void 0:n.nbformat)&&void 0!==o?o:4,nbformat_minor:null!==(r=null===(i=t.data)||void 0===i?void 0:i.nbformat_minor)&&void 0!==r?r:5,metadata:null!==(h=null===(d=t.data)||void 0===d?void 0:d.metadata)&&void 0!==h?h:{}};return l.fromJSON(c),l}get disableDocumentWideUndoRedo(){return this._disableDocumentWideUndoRedo}get metadata(){return this.getMetadata()}set metadata(t){this.setMetadata(t)}get metadataChanged(){return this._metadataChanged}get nbformat(){return this.ymeta.get("nbformat")}set nbformat(t){this.transact((()=>{this.ymeta.set("nbformat",t)}),!1)}get nbformat_minor(){return this.ymeta.get("nbformat_minor")}set nbformat_minor(t){this.transact((()=>{this.ymeta.set("nbformat_minor",t)}),!1)}dispose(){this.isDisposed||(this._ycells.unobserve(this._onYCellsChanged),this.ymeta.unobserveDeep(this._onMetaChanged),super.dispose())}getCell(t){return this.cells[t]}addCell(t){return this.insertCell(this._ycells.length,t)}insertCell(t,e){return this.insertCells(t,[e])[0]}insertCells(t,e){const s=e.map((t=>{const e=_(t,this);return this._ycellMapping.set(e.ymodel,e),e}));return this.transact((()=>{this._ycells.insert(t,s.map((t=>t.ymodel)))})),s.forEach((t=>{t.setUndoManager()})),s}moveCell(t,e){this.moveCells(t,e)}moveCells(t,e,s=1){const a=new Array(s).fill(!0).map(((e,s)=>this.getCell(t+s).toJSON()));this.transact((()=>{this._ycells.delete(t,s),this._ycells.insert(t>e?e:e-s+1,a.map((t=>_(t,this).ymodel)))}))}deleteCell(t){this.deleteCellRange(t,t+1)}deleteCellRange(t,e){this.transact((()=>{this._ycells.delete(t,e-t)}))}deleteMetadata(t){if(void 0===this.getMetadata(t))return;const e=this.metadata;delete e[t],this.setMetadata(e)}getMetadata(t){const e=this.ymeta.get("metadata");if(void 0!==e){if("string"==typeof t){const s=e.get(t);return void 0===s?void 0:o.JSONExt.deepCopy(s)}return o.JSONExt.deepCopy(e.toJSON())}}setMetadata(t,e){var s;if("string"==typeof t){if(void 0===e)throw new TypeError(`Metadata value for ${t} cannot be 'undefined'; use deleteMetadata.`);if(o.JSONExt.deepEqual(null!==(s=this.getMetadata(t))&&void 0!==s?s:null,e))return;const a={};a[t]=e,this.updateMetadata(a)}else if(!this.metadata||!o.JSONExt.deepEqual(this.metadata,t)){const e=o.JSONExt.deepCopy(t),s=this.ymeta.get("metadata");if(void 0===s)return;this.transact((()=>{s.clear();for(const[t,a]of Object.entries(e))s.set(t,a)}))}}updateMetadata(t){const e=o.JSONExt.deepCopy(t),s=this.ymeta.get("metadata");void 0!==s&&this.transact((()=>{for(const[t,a]of Object.entries(e))s.set(t,a)}))}fromJSON(t){this.transact((()=>{this.nbformat=t.nbformat,this.nbformat_minor=t.nbformat_minor;const e=t.metadata;if(void 0!==e.orig_nbformat&&delete e.orig_nbformat,this.metadata)this.metadata=e;else{const t=new c.Map;for(const[s,a]of Object.entries(e))t.set(s,a);this.ymeta.set("metadata",t)}const s=4===t.nbformat&&t.nbformat_minor>=5,a=t.cells.map((t=>(s||delete t.id,t)));this.insertCells(this.cells.length,a),this.deleteCellRange(0,this.cells.length)}))}toJSON(){const t=4===this.nbformat&&this.nbformat_minor<=4;return{metadata:this.metadata,nbformat_minor:this.nbformat_minor,nbformat:this.nbformat,cells:this.cells.map((e=>{const s=e.toJSON();return t&&delete s.id,s}))}}}},79504:(t,e,s)=>{s.d(e,{Dp:()=>o,G:()=>i,JJ:()=>r,Z$:()=>a,kJ:()=>d,s7:()=>n});const a=t=>t[t.length-1],n=(t,e)=>{for(let s=0;s<e.length;s++)t.push(e[s])},o=Array.from,i=(t,e)=>{for(let s=0;s<t.length;s++)if(e(t[s],s,t))return!0;return!1},r=(t,e)=>{const s=new Array(t);for(let a=0;a<t;a++)s[a]=e(a,s);return s},d=Array.isArray},38828:(t,e,s)=>{s.d(e,{Hi:()=>r,PP:()=>o,gB:()=>d,id:()=>i});var a=s(79504),n=s(36498);const o=(t,e,s=0)=>{try{for(;s<t.length;s++)t[s](...e)}finally{s<t.length&&o(t,e,s+1)}},i=t=>t,r=(t,e)=>{if(null==t||null==e)return((t,e)=>t===e)(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:if(t.byteLength!==e.byteLength)return!1;for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;break;case Set:if(t.size!==e.size)return!1;for(const s of t)if(!e.has(s))return!1;break;case Map:if(t.size!==e.size)return!1;for(const s of t.keys())if(!e.has(s)||!r(t.get(s),e.get(s)))return!1;break;case Object:if(n.kE(t)!==n.kE(e))return!1;for(const s in t)if(!n.l$(t,s)||!r(t[s],e[s]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(!r(t[s],e[s]))return!1;break;default:return!1}return!0},d=(t,e)=>e.includes(t);a.kJ},22592:(t,e,s)=>{s.d(e,{JG:()=>n,UI:()=>i,Ue:()=>a,Yj:()=>r,Yu:()=>o});const a=()=>new Map,n=t=>{const e=a();return t.forEach(((t,s)=>{e.set(s,t)})),e},o=(t,e,s)=>{let a=t.get(e);return void 0===a&&t.set(e,a=s()),a},i=(t,e)=>{const s=[];for(const[a,n]of t)s.push(e(n,a));return s},r=(t,e)=>{for(const[s,a]of t)if(e(a,s))return!0;return!1}},11182:(t,e,s)=>{s.d(e,{Fp:()=>i,GR:()=>r,GW:()=>a,VV:()=>o,Wn:()=>n});const a=Math.floor,n=(Math.ceil,Math.abs),o=(Math.imul,Math.round,Math.log10,Math.log2,Math.log,Math.sqrt,(t,e)=>t<e?t:e),i=(t,e)=>t>e?t:e,r=(Number.isNaN,Math.pow,Math.sign,t=>0!==t?t<0:1/t<0)},36498:(t,e,s)=>{s.d(e,{$m:()=>h,Ed:()=>o,f0:()=>a,kE:()=>i,l$:()=>d,xb:()=>r});const a=Object.assign,n=Object.keys,o=(t,e)=>{for(const s in t)e(t[s],s)},i=t=>n(t).length,r=t=>{for(const e in t)return!1;return!0},d=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),h=(t,e)=>t===e||i(t)===i(e)&&((t,e)=>{for(const s in t)if(!e(t[s],s))return!1;return!0})(t,((t,s)=>(void 0!==t||d(e,s))&&e[s]===t))},12330:(t,e,s)=>{s.d(e,{y:()=>i});var a=s(22592),n=s(79287),o=s(79504);class i{constructor(){this._observers=a.Ue()}on(t,e){a.Yu(this._observers,t,n.Ue).add(e)}once(t,e){const s=(...a)=>{this.off(t,s),e(...a)};this.on(t,s)}off(t,e){const s=this._observers.get(t);void 0!==s&&(s.delete(e),0===s.size&&this._observers.delete(t))}emit(t,e){return o.Dp((this._observers.get(t)||a.Ue()).values()).forEach((t=>t(...e)))}destroy(){this._observers=a.Ue()}}},79287:(t,e,s)=>{s.d(e,{Ue:()=>a});const a=()=>new Set},2431:(t,e,s)=>{s.d(e,{ZG:()=>a});const a=Date.now}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[35],{50035:(t,e,s)=>{function a(t){let e=new Map;return t.changes.keys.forEach(((t,s)=>{e.set(s,{action:t.action,oldValue:t.oldValue,newValue:this.ymeta.get(s)})})),e}s.r(e),s.d(e,{YBaseCell:()=>b,YCodeCell:()=>v,YDocument:()=>m,YFile:()=>p,YMarkdownCell:()=>w,YNotebook:()=>C,YRawCell:()=>k,convertYMapEventToMapChange:()=>a,createMutex:()=>n,createStandaloneCell:()=>f});const n=()=>{let t=!0;return e=>{if(t){t=!1;try{e()}finally{t=!0}}}};var o=s(20998),i=s(81997),r=s(2431),d=s(11182),h=s(12330),l=s(38828),c=s(17843);class u extends h.y{constructor(t){super(),this.doc=t,this.clientID=t.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval((()=>{const t=r.ZG();null!==this.getLocalState()&&15e3<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const e=[];this.meta.forEach(((s,a)=>{a!==this.clientID&&3e4<=t-s.lastUpdated&&this.states.has(a)&&e.push(a)})),e.length>0&&g(this,e,"timeout")}),d.GW(3e3)),t.on("destroy",(()=>{this.destroy()})),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(t){const e=this.clientID,s=this.meta.get(e),a=void 0===s?0:s.clock+1,n=this.states.get(e);null===t?this.states.delete(e):this.states.set(e,t),this.meta.set(e,{clock:a,lastUpdated:r.ZG()});const o=[],i=[],d=[],h=[];null===t?h.push(e):null==n?null!=t&&o.push(e):(i.push(e),l.Hi(n,t)||d.push(e)),(o.length>0||d.length>0||h.length>0)&&this.emit("change",[{added:o,updated:d,removed:h},"local"]),this.emit("update",[{added:o,updated:i,removed:h},"local"])}setLocalStateField(t,e){const s=this.getLocalState();null!==s&&this.setLocalState({...s,[t]:e})}getStates(){return this.states}}const g=(t,e,s)=>{const a=[];for(let s=0;s<e.length;s++){const n=e[s];if(t.states.has(n)){if(t.states.delete(n),n===t.clientID){const e=t.meta.get(n);t.meta.set(n,{clock:e.clock+1,lastUpdated:r.ZG()})}a.push(n)}}a.length>0&&(t.emit("change",[{added:[],updated:[],removed:a},s]),t.emit("update",[{added:[],updated:[],removed:a},s]))};class m{constructor(t){var e;this.onStateChanged=t=>{const e=new Array;t.keysChanged.forEach((s=>{const a=t.changes.keys.get(s);a&&e.push({name:s,oldValue:a.oldValue,newValue:this.ystate.get(s)})})),this._changed.emit({stateChange:e})},this._changed=new i.Signal(this),this._isDisposed=!1,this._disposed=new i.Signal(this),this._ydoc=null!==(e=null==t?void 0:t.ydoc)&&void 0!==e?e:new c.Doc,this._ystate=this._ydoc.getMap("state"),this._undoManager=new c.UndoManager([],{trackedOrigins:new Set([this]),doc:this._ydoc}),this._awareness=new u(this._ydoc),this._ystate.observe(this.onStateChanged)}get ydoc(){return this._ydoc}get ystate(){return this._ystate}get undoManager(){return this._undoManager}get awareness(){return this._awareness}get changed(){return this._changed}get disposed(){return this._disposed}get isDisposed(){return this._isDisposed}get state(){return o.JSONExt.deepCopy(this.ystate.toJSON())}canUndo(){return this.undoManager.undoStack.length>0}canRedo(){return this.undoManager.redoStack.length>0}dispose(){this._isDisposed||(this._isDisposed=!0,this.ystate.unobserve(this.onStateChanged),this.awareness.destroy(),this.undoManager.destroy(),this.ydoc.destroy(),this._disposed.emit(),i.Signal.clearData(this))}getState(t){const e=this.ystate.get(t);return void 0===e?e:o.JSONExt.deepCopy(e)}setState(t,e){o.JSONExt.deepEqual(this.ystate.get(t),e)||this.ystate.set(t,e)}undo(){this.undoManager.undo()}redo(){this.undoManager.redo()}clearUndoHistory(){this.undoManager.clear()}transact(t,e=!0){this.ydoc.transact(t,e?this:null)}}class p extends m{constructor(){super(),this.version="1.0.0",this.ysource=this.ydoc.getText("source"),this._modelObserver=t=>{this._changed.emit({sourceChange:t.changes.delta})},this.undoManager.addToScope(this.ysource),this.ysource.observe(this._modelObserver)}static create(){return new p}get source(){return this.getSource()}set source(t){this.setSource(t)}dispose(){this.isDisposed||(this.ysource.unobserve(this._modelObserver),super.dispose())}getSource(){return this.ysource.toString()}setSource(t){this.transact((()=>{const e=this.ysource;e.delete(0,e.length),e.insert(0,t)}))}updateSource(t,e,s=""){this.transact((()=>{const a=this.ysource;a.insert(t,s),a.delete(t+s.length,e-t)}))}}const y=(t,e={})=>{switch(t.get("cell_type")){case"code":return new v(t,t.get("source"),t.get("outputs"),e);case"markdown":return new w(t,t.get("source"),e);case"raw":return new k(t,t.get("source"),e);default:throw new Error("Found unknown cell type")}},_=(t,e)=>{var s,a;const n=new c.Map,i=new c.Text,r=new c.Map;let d;switch(n.set("source",i),n.set("metadata",r),n.set("cell_type",t.cell_type),n.set("id",null!==(s=t.id)&&void 0!==s?s:o.UUID.uuid4()),t.cell_type){case"markdown":d=new w(n,i,{notebook:e},r),null!=t.attachments&&d.setAttachments(t.attachments);break;case"code":{const s=new c.Array;n.set("outputs",s),d=new v(n,i,s,{notebook:e},r);const o=t;d.execution_count=null!==(a=o.execution_count)&&void 0!==a?a:null,o.outputs&&d.setOutputs(o.outputs);break}default:d=new k(n,i,{notebook:e},r),t.attachments&&d.setAttachments(t.attachments)}return null!=t.metadata&&d.setMetadata(t.metadata),null!=t.source&&d.setSource("string"==typeof t.source?t.source:t.source.join("")),d},f=t=>_(t);class b{static create(t){return _({id:t,cell_type:this.prototype.cell_type})}constructor(t,e,s={},a){if(this._modelObserver=t=>{this._changed.emit(this.getChanges(t))},this._metadataChanged=new i.Signal(this),this._notebook=null,this._changed=new i.Signal(this),this._disposed=new i.Signal(this),this._isDisposed=!1,this._undoManager=null,this.ymodel=t,this._ysource=e,this._ymetadata=null!=a?a:this.ymodel.get("metadata"),this._prevSourceLength=e?e.length:0,this._notebook=null,this._awareness=null,this._undoManager=null,s.notebook)this._notebook=s.notebook;else{const t=new c.Doc;t.getArray().insert(0,[this.ymodel]),this._awareness=new u(t),this._undoManager=new c.UndoManager([this.ymodel],{trackedOrigins:new Set([this])})}this.ymodel.observeDeep(this._modelObserver)}get awareness(){var t,e,s;return null!==(s=null!==(t=this._awareness)&&void 0!==t?t:null===(e=this.notebook)||void 0===e?void 0:e.awareness)&&void 0!==s?s:null}get cell_type(){throw new Error("A YBaseCell must not be constructed")}get changed(){return this._changed}get disposed(){return this._disposed}get id(){return this.getId()}get isDisposed(){return this._isDisposed}get isStandalone(){return null!==this._notebook}get metadata(){return this.getMetadata()}set metadata(t){this.setMetadata(t)}get metadataChanged(){return this._metadataChanged}get notebook(){return this._notebook}get source(){return this.getSource()}set source(t){this.setSource(t)}get undoManager(){var t;return this.notebook?(null===(t=this.notebook)||void 0===t?void 0:t.disableDocumentWideUndoRedo)?this._undoManager:this.notebook.undoManager:this._undoManager}setUndoManager(){if(this._undoManager)throw new Error("The cell undo manager is already set.");this._notebook&&this._notebook.disableDocumentWideUndoRedo&&(this._undoManager=new c.UndoManager([this.ymodel],{trackedOrigins:new Set([this])}))}get ysource(){return this._ysource}canUndo(){return!!this.undoManager&&this.undoManager.undoStack.length>0}canRedo(){return!!this.undoManager&&this.undoManager.redoStack.length>0}clearUndoHistory(){var t;null===(t=this.undoManager)||void 0===t||t.clear()}undo(){var t;null===(t=this.undoManager)||void 0===t||t.undo()}redo(){var t;null===(t=this.undoManager)||void 0===t||t.redo()}dispose(){var t;if(!this._isDisposed){if(this._isDisposed=!0,this.ymodel.unobserveDeep(this._modelObserver),this._awareness){const t=this._awareness.doc;this._awareness.destroy(),t.destroy()}this._undoManager&&(this._undoManager===(null===(t=this.notebook)||void 0===t?void 0:t.undoManager)?this._undoManager=null:this._undoManager.destroy()),this._disposed.emit(),i.Signal.clearData(this)}}getId(){return this.ymodel.get("id")}getSource(){return this.ysource.toString()}setSource(t){this.transact((()=>{this.ysource.delete(0,this.ysource.length),this.ysource.insert(0,t)}))}updateSource(t,e,s=""){this.transact((()=>{const a=this.ysource;a.insert(t,s),a.delete(t+s.length,e-t)}))}deleteMetadata(t){void 0!==this.getMetadata(t)&&this.transact((()=>{this._ymetadata.delete(t);const e=this.getMetadata("jupyter");if("collapsed"===t&&e){const{outputs_hidden:t,...s}=e;0===Object.keys(s).length?this._ymetadata.delete("jupyter"):this._ymetadata.set("jupyter",s)}else"jupyter"===t&&this._ymetadata.delete("collapsed")}),!1)}getMetadata(t){const e=this._ymetadata;if(void 0!==e)return"string"==typeof t?void 0===e.get(t)?void 0:o.JSONExt.deepCopy(e.get(t)):o.JSONExt.deepCopy(e.toJSON())}setMetadata(t,e){var s,a;if("string"==typeof t){if(void 0===e)throw new TypeError(`Metadata value for ${t} cannot be 'undefined'; use deleteMetadata.`);const a=t;if(o.JSONExt.deepEqual(null!==(s=this.getMetadata(a))&&void 0!==s?s:null,e))return;this.transact((()=>{var t;if(this._ymetadata.set(a,e),"collapsed"===a){const s=null!==(t=this.getMetadata("jupyter"))&&void 0!==t?t:{};s.outputs_hidden!==e&&this.setMetadata("jupyter",{...s,outputs_hidden:e})}else if("jupyter"===a){const t=e.outputs_hidden;void 0!==t?this.getMetadata("collapsed")!==t&&this.setMetadata("collapsed",t):this.deleteMetadata("collapsed")}}),!1)}else{const e=o.JSONExt.deepCopy(t);null!=e.collapsed?(e.jupyter=e.jupyter||{},e.jupyter.outputs_hidden=e.collapsed):null!=(null===(a=null==e?void 0:e.jupyter)||void 0===a?void 0:a.outputs_hidden)&&(e.collapsed=e.jupyter.outputs_hidden),o.JSONExt.deepEqual(e,this.getMetadata())||this.transact((()=>{for(const[t,s]of Object.entries(e))this._ymetadata.set(t,s)}),!1)}}toJSON(){return{id:this.getId(),cell_type:this.cell_type,source:this.getSource(),metadata:this.getMetadata()}}transact(t,e=!0){!this.notebook||this.notebook.disableDocumentWideUndoRedo?null==this.ymodel.doc?t():this.ymodel.doc.transact(t,e?this:null):this.notebook.transact(t,e)}getChanges(t){const e={},s=t.find((t=>t.target===this.ymodel.get("source")));s&&(e.sourceChange=s.changes.delta);const a=t.find((t=>t.target===this._ymetadata));a&&(e.metadataChange=a.changes.keys,a.changes.keys.forEach(((t,e)=>{switch(t.action){case"add":this._metadataChanged.emit({key:e,newValue:this._ymetadata.get(e),type:"add"});break;case"delete":this._metadataChanged.emit({key:e,oldValue:t.oldValue,type:"remove"});break;case"update":{const s=this._ymetadata.get(e),a=t.oldValue;let n=!0;n="object"==typeof a&&"object"==typeof s?o.JSONExt.deepEqual(a,s):a===s,n||this._metadataChanged.emit({key:e,type:"change",oldValue:a,newValue:s})}}})));const n=t.find((t=>t.target===this.ymodel)),i=this.ymodel.get("source");return n&&n.keysChanged.has("source")&&(e.sourceChange=[{delete:this._prevSourceLength},{insert:i.toString()}]),this._prevSourceLength=i.length,e}}class v extends b{static create(t){return super.create(t)}constructor(t,e,s,a={},n){super(t,e,a,n),this._youtputs=s}get cell_type(){return"code"}get execution_count(){return this.ymodel.get("execution_count")||null}set execution_count(t){this.ymodel.get("execution_count")!==t&&this.transact((()=>{this.ymodel.set("execution_count",t)}),!1)}get outputs(){return this.getOutputs()}set outputs(t){this.setOutputs(t)}getOutputs(){return o.JSONExt.deepCopy(this._youtputs.toArray())}setOutputs(t){this.transact((()=>{this._youtputs.delete(0,this._youtputs.length),this._youtputs.insert(0,t)}),!1)}updateOutputs(t,e,s=[]){const a=e<this._youtputs.length?e-t:this._youtputs.length-t;this.transact((()=>{this._youtputs.delete(t,a),this._youtputs.insert(t,s)}),!1)}toJSON(){return{...super.toJSON(),outputs:this.getOutputs(),execution_count:this.execution_count}}getChanges(t){const e=super.getChanges(t),s=t.find((t=>t.target===this.ymodel.get("outputs")));s&&(e.outputsChange=s.changes.delta);const a=t.find((t=>t.target===this.ymodel));if(a&&a.keysChanged.has("execution_count")){const t=a.changes.keys.get("execution_count");e.executionCountChange={oldValue:t.oldValue,newValue:this.ymodel.get("execution_count")}}return e}}class M extends b{get attachments(){return this.getAttachments()}set attachments(t){this.setAttachments(t)}getAttachments(){return this.ymodel.get("attachments")}setAttachments(t){this.transact((()=>{null==t?this.ymodel.delete("attachments"):this.ymodel.set("attachments",t)}),!1)}getChanges(t){const e=super.getChanges(t),s=t.find((t=>t.target===this.ymodel));if(s&&s.keysChanged.has("attachments")){const t=s.changes.keys.get("attachments");e.executionCountChange={oldValue:t.oldValue,newValue:this.ymodel.get("attachments")}}return e}}class k extends M{static create(t){return super.create(t)}get cell_type(){return"raw"}toJSON(){return{id:this.getId(),cell_type:"raw",source:this.getSource(),metadata:this.getMetadata(),attachments:this.getAttachments()}}}class w extends M{static create(t){return super.create(t)}get cell_type(){return"markdown"}toJSON(){return{id:this.getId(),cell_type:"markdown",source:this.getSource(),metadata:this.getMetadata(),attachments:this.getAttachments()}}}class C extends m{constructor(t={}){var e;super(),this.version="1.0.0",this.ymeta=this.ydoc.getMap("meta"),this._onMetaChanged=t=>{const e=t.find((t=>t.target===this.ymeta.get("metadata")));if(e){const t=e.changes.keys,s=this.ymeta.get("metadata");e.changes.keys.forEach(((t,e)=>{switch(t.action){case"add":this._metadataChanged.emit({key:e,type:"add",newValue:s.get(e)});break;case"delete":this._metadataChanged.emit({key:e,type:"remove",oldValue:t.oldValue});break;case"update":{const a=s.get(e),n=t.oldValue;let i=!0;i="object"==typeof n&&"object"==typeof a?o.JSONExt.deepEqual(n,a):n===a,i||this._metadataChanged.emit({key:e,type:"change",oldValue:n,newValue:a})}}})),this._changed.emit({metadataChange:t})}const s=t.find((t=>t.target===this.ymeta));if(s){if(s.keysChanged.has("metadata")){const t=s.changes.keys.get("metadata");if("add"===(null==t?void 0:t.action)&&!t.oldValue){const t=new Map;for(const e of Object.keys(this.metadata))t.set(e,{action:"add",oldValue:void 0}),this._metadataChanged.emit({key:e,type:"add",newValue:this.getMetadata(e)});this._changed.emit({metadataChange:t})}}if(s.keysChanged.has("nbformat")){const t=s.changes.keys.get("nbformat"),e={key:"nbformat",oldValue:(null==t?void 0:t.oldValue)?t.oldValue:void 0,newValue:this.nbformat};this._changed.emit({nbformatChanged:e})}if(s.keysChanged.has("nbformat_minor")){const t=s.changes.keys.get("nbformat_minor"),e={key:"nbformat_minor",oldValue:(null==t?void 0:t.oldValue)?t.oldValue:void 0,newValue:this.nbformat_minor};this._changed.emit({nbformatChanged:e})}}},this._onYCellsChanged=t=>{t.changes.added.forEach((t=>{const e=t.content.type;if(!this._ycellMapping.has(e)){const t=y(e,{notebook:this});t.setUndoManager(),this._ycellMapping.set(e,t)}})),t.changes.deleted.forEach((t=>{const e=t.content.type,s=this._ycellMapping.get(e);s&&(s.dispose(),this._ycellMapping.delete(e))}));let e=0;const s=[];t.changes.delta.forEach((t=>{if(null!=t.insert){const a=t.insert.map((t=>this._ycellMapping.get(t)));s.push({insert:a}),this.cells.splice(e,0,...a),e+=t.insert.length}else null!=t.delete?(s.push(t),this.cells.splice(e,t.delete)):null!=t.retain&&(s.push(t),e+=t.retain)})),this._changed.emit({cellsChange:s})},this._metadataChanged=new i.Signal(this),this._ycells=this.ydoc.getArray("cells"),this._ycellMapping=new WeakMap,this._disableDocumentWideUndoRedo=null!==(e=t.disableDocumentWideUndoRedo)&&void 0!==e&&e,this.cells=this._ycells.toArray().map((t=>(this._ycellMapping.has(t)||this._ycellMapping.set(t,y(t,{notebook:this})),this._ycellMapping.get(t)))),this.undoManager.addToScope(this._ycells),this._ycells.observe(this._onYCellsChanged),this.ymeta.observeDeep(this._onMetaChanged)}static create(t={}){var e,s,a,n,o,i,r,d,h;const l=new C({disableDocumentWideUndoRedo:null!==(e=t.disableDocumentWideUndoRedo)&&void 0!==e&&e}),c={cells:null!==(a=null===(s=t.data)||void 0===s?void 0:s.cells)&&void 0!==a?a:[],nbformat:null!==(o=null===(n=t.data)||void 0===n?void 0:n.nbformat)&&void 0!==o?o:4,nbformat_minor:null!==(r=null===(i=t.data)||void 0===i?void 0:i.nbformat_minor)&&void 0!==r?r:5,metadata:null!==(h=null===(d=t.data)||void 0===d?void 0:d.metadata)&&void 0!==h?h:{}};return l.fromJSON(c),l}get disableDocumentWideUndoRedo(){return this._disableDocumentWideUndoRedo}get metadata(){return this.getMetadata()}set metadata(t){this.setMetadata(t)}get metadataChanged(){return this._metadataChanged}get nbformat(){return this.ymeta.get("nbformat")}set nbformat(t){this.transact((()=>{this.ymeta.set("nbformat",t)}),!1)}get nbformat_minor(){return this.ymeta.get("nbformat_minor")}set nbformat_minor(t){this.transact((()=>{this.ymeta.set("nbformat_minor",t)}),!1)}dispose(){this.isDisposed||(this._ycells.unobserve(this._onYCellsChanged),this.ymeta.unobserveDeep(this._onMetaChanged),super.dispose())}getCell(t){return this.cells[t]}addCell(t){return this.insertCell(this._ycells.length,t)}insertCell(t,e){return this.insertCells(t,[e])[0]}insertCells(t,e){const s=e.map((t=>{const e=_(t,this);return this._ycellMapping.set(e.ymodel,e),e}));return this.transact((()=>{this._ycells.insert(t,s.map((t=>t.ymodel)))})),s.forEach((t=>{t.setUndoManager()})),s}moveCell(t,e){this.moveCells(t,e)}moveCells(t,e,s=1){const a=new Array(s).fill(!0).map(((e,s)=>this.getCell(t+s).toJSON()));this.transact((()=>{this._ycells.delete(t,s),this._ycells.insert(t>e?e:e-s+1,a.map((t=>_(t,this).ymodel)))}))}deleteCell(t){this.deleteCellRange(t,t+1)}deleteCellRange(t,e){this.transact((()=>{this._ycells.delete(t,e-t)}))}deleteMetadata(t){if(void 0===this.getMetadata(t))return;const e=this.metadata;delete e[t],this.setMetadata(e)}getMetadata(t){const e=this.ymeta.get("metadata");if(void 0!==e){if("string"==typeof t){const s=e.get(t);return void 0===s?void 0:o.JSONExt.deepCopy(s)}return o.JSONExt.deepCopy(e.toJSON())}}setMetadata(t,e){var s;if("string"==typeof t){if(void 0===e)throw new TypeError(`Metadata value for ${t} cannot be 'undefined'; use deleteMetadata.`);if(o.JSONExt.deepEqual(null!==(s=this.getMetadata(t))&&void 0!==s?s:null,e))return;const a={};a[t]=e,this.updateMetadata(a)}else if(!this.metadata||!o.JSONExt.deepEqual(this.metadata,t)){const e=o.JSONExt.deepCopy(t),s=this.ymeta.get("metadata");if(void 0===s)return;this.transact((()=>{s.clear();for(const[t,a]of Object.entries(e))s.set(t,a)}))}}updateMetadata(t){const e=o.JSONExt.deepCopy(t),s=this.ymeta.get("metadata");void 0!==s&&this.transact((()=>{for(const[t,a]of Object.entries(e))s.set(t,a)}))}fromJSON(t){this.transact((()=>{this.nbformat=t.nbformat,this.nbformat_minor=t.nbformat_minor;const e=t.metadata;if(void 0!==e.orig_nbformat&&delete e.orig_nbformat,this.metadata)this.metadata=e;else{const t=new c.Map;for(const[s,a]of Object.entries(e))t.set(s,a);this.ymeta.set("metadata",t)}const s=4===t.nbformat&&t.nbformat_minor>=5,a=t.cells.map((t=>(s||delete t.id,t)));this.insertCells(this.cells.length,a),this.deleteCellRange(0,this.cells.length)}))}toJSON(){const t=4===this.nbformat&&this.nbformat_minor<=4;return{metadata:this.metadata,nbformat_minor:this.nbformat_minor,nbformat:this.nbformat,cells:this.cells.map((e=>{const s=e.toJSON();return t&&delete s.id,s}))}}}},79504:(t,e,s)=>{s.d(e,{Dp:()=>o,G:()=>i,JJ:()=>r,Z$:()=>a,kJ:()=>d,s7:()=>n});const a=t=>t[t.length-1],n=(t,e)=>{for(let s=0;s<e.length;s++)t.push(e[s])},o=Array.from,i=(t,e)=>{for(let s=0;s<t.length;s++)if(e(t[s],s,t))return!0;return!1},r=(t,e)=>{const s=new Array(t);for(let a=0;a<t;a++)s[a]=e(a,s);return s},d=Array.isArray},38828:(t,e,s)=>{s.d(e,{Hi:()=>r,PP:()=>o,gB:()=>d,id:()=>i});var a=s(79504),n=s(36498);const o=(t,e,s=0)=>{try{for(;s<t.length;s++)t[s](...e)}finally{s<t.length&&o(t,e,s+1)}},i=t=>t,r=(t,e)=>{if(null==t||null==e)return((t,e)=>t===e)(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:if(t.byteLength!==e.byteLength)return!1;for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;break;case Set:if(t.size!==e.size)return!1;for(const s of t)if(!e.has(s))return!1;break;case Map:if(t.size!==e.size)return!1;for(const s of t.keys())if(!e.has(s)||!r(t.get(s),e.get(s)))return!1;break;case Object:if(n.kE(t)!==n.kE(e))return!1;for(const s in t)if(!n.l$(t,s)||!r(t[s],e[s]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(!r(t[s],e[s]))return!1;break;default:return!1}return!0},d=(t,e)=>e.includes(t);a.kJ},22592:(t,e,s)=>{s.d(e,{JG:()=>n,UI:()=>i,Ue:()=>a,Yj:()=>r,Yu:()=>o});const a=()=>new Map,n=t=>{const e=a();return t.forEach(((t,s)=>{e.set(s,t)})),e},o=(t,e,s)=>{let a=t.get(e);return void 0===a&&t.set(e,a=s()),a},i=(t,e)=>{const s=[];for(const[a,n]of t)s.push(e(n,a));return s},r=(t,e)=>{for(const[s,a]of t)if(e(a,s))return!0;return!1}},11182:(t,e,s)=>{s.d(e,{Fp:()=>i,GR:()=>r,GW:()=>a,VV:()=>o,Wn:()=>n});const a=Math.floor,n=(Math.ceil,Math.abs),o=(Math.imul,Math.round,Math.log10,Math.log2,Math.log,Math.sqrt,(t,e)=>t<e?t:e),i=(t,e)=>t>e?t:e,r=(Number.isNaN,Math.pow,Math.sign,t=>0!==t?t<0:1/t<0)},36498:(t,e,s)=>{s.d(e,{$m:()=>h,Ed:()=>o,f0:()=>a,kE:()=>i,l$:()=>d,xb:()=>r});const a=Object.assign,n=Object.keys,o=(t,e)=>{for(const s in t)e(t[s],s)},i=t=>n(t).length,r=t=>{for(const e in t)return!1;return!0},d=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),h=(t,e)=>t===e||i(t)===i(e)&&((t,e)=>{for(const s in t)if(!e(t[s],s))return!1;return!0})(t,((t,s)=>(void 0!==t||d(e,s))&&e[s]===t))},12330:(t,e,s)=>{s.d(e,{y:()=>i});var a=s(22592),n=s(79287),o=s(79504);class i{constructor(){this._observers=a.Ue()}on(t,e){a.Yu(this._observers,t,n.Ue).add(e)}once(t,e){const s=(...a)=>{this.off(t,s),e(...a)};this.on(t,s)}off(t,e){const s=this._observers.get(t);void 0!==s&&(s.delete(e),0===s.size&&this._observers.delete(t))}emit(t,e){return o.Dp((this._observers.get(t)||a.Ue()).values()).forEach((t=>t(...e)))}destroy(){this._observers=a.Ue()}}},79287:(t,e,s)=>{s.d(e,{Ue:()=>a});const a=()=>new Set},2431:(t,e,s)=>{s.d(e,{ZG:()=>a});const a=Date.now}}]);