notebook 7.3.0a1__py3-none-any.whl → 7.3.0b0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (231) hide show
  1. notebook/_version.py +1 -1
  2. notebook/app.py +10 -2
  3. notebook/static/113.bundle.js +1 -1
  4. notebook/static/1198.bundle.js +1 -1
  5. notebook/static/134.bundle.js +1 -1
  6. notebook/static/1408.bundle.js +1 -1
  7. notebook/static/1496.bundle.js +1 -1
  8. notebook/static/1584.bundle.js +1 -1
  9. notebook/static/1647.bundle.js +1 -1
  10. notebook/static/1650.bundle.js +1 -1
  11. notebook/static/1684.bundle.js +1 -1
  12. notebook/static/170.bundle.js +1 -1
  13. notebook/static/1809.bundle.js +1 -1
  14. notebook/static/1827.bundle.js +1 -1
  15. notebook/static/1828.bundle.js +1 -1
  16. notebook/static/1833.bundle.js +1 -1
  17. notebook/static/1958.bundle.js +1 -1
  18. notebook/static/1962.bundle.js +1 -1
  19. notebook/static/2007.bundle.js +1 -1
  20. notebook/static/2065.bundle.js +1 -1
  21. notebook/static/2088.bundle.js +1 -1
  22. notebook/static/2089.bundle.js +1 -1
  23. notebook/static/2122.bundle.js +1 -1
  24. notebook/static/2167.bundle.js +1 -1
  25. notebook/static/2184.bundle.js +1 -1
  26. notebook/static/2311.bundle.js +1 -1
  27. notebook/static/{3030.bundle.js → 2323.bundle.js} +1 -1
  28. notebook/static/2401.bundle.js +1 -1
  29. notebook/static/2424.bundle.js +377 -0
  30. notebook/static/2479.bundle.js +1 -1
  31. notebook/static/2489.bundle.js +1 -1
  32. notebook/static/2607.bundle.js +1 -1
  33. notebook/static/2615.bundle.js +1 -1
  34. notebook/static/2636.bundle.js +1 -1
  35. notebook/static/2756.bundle.js +1 -1
  36. notebook/static/2813.bundle.js +1 -1
  37. notebook/static/2866.bundle.js +1 -1
  38. notebook/static/2924.bundle.js +1 -1
  39. notebook/static/2944.bundle.js +1 -1
  40. notebook/static/2955.bundle.js +1 -0
  41. notebook/static/3129.bundle.js +1 -1
  42. notebook/static/3146.bundle.js +1 -1
  43. notebook/static/3187.bundle.js +1 -1
  44. notebook/static/3213.bundle.js +1 -1
  45. notebook/static/3301.bundle.js +1 -1
  46. notebook/static/3325.bundle.js +1 -1
  47. notebook/static/3340.bundle.js +1 -1
  48. notebook/static/3360.bundle.js +1 -1
  49. notebook/static/{1261.bundle.js → 3463.bundle.js} +1 -1
  50. notebook/static/3466.bundle.js +1 -1
  51. notebook/static/35.bundle.js +1 -1
  52. notebook/static/3512.bundle.js +1 -1
  53. notebook/static/3676.bundle.js +1 -1
  54. notebook/static/3680.bundle.js +1 -1
  55. notebook/static/374.bundle.js +1 -1
  56. notebook/static/3768.bundle.js +1 -1
  57. notebook/static/377.bundle.js +1 -1
  58. notebook/static/3863.bundle.js +1 -1
  59. notebook/static/3881.bundle.js +1 -1
  60. notebook/static/4042.bundle.js +1 -1
  61. notebook/static/4058.bundle.js +1 -1
  62. notebook/static/409.bundle.js +1 -1
  63. notebook/static/4212.bundle.js +1 -1
  64. notebook/static/4242.bundle.js +79 -0
  65. notebook/static/4271.bundle.js +1 -1
  66. notebook/static/4291.bundle.js +1 -1
  67. notebook/static/4382.bundle.js +1 -1
  68. notebook/static/4526.bundle.js +1 -1
  69. notebook/static/4588.bundle.js +1 -1
  70. notebook/static/4630.bundle.js +1 -1
  71. notebook/static/4645.bundle.js +1 -1
  72. notebook/static/4811.bundle.js +1 -1
  73. notebook/static/4837.bundle.js +1 -1
  74. notebook/static/5099.bundle.js +1 -1
  75. notebook/static/5135.bundle.js +1 -1
  76. notebook/static/5166.bundle.js +1 -1
  77. notebook/static/5234.bundle.js +1 -1
  78. notebook/static/5254.bundle.js +1 -1
  79. notebook/static/5261.bundle.js +1 -1
  80. notebook/static/5263.bundle.js +1 -0
  81. notebook/static/5313.bundle.js +1 -1
  82. notebook/static/5325.bundle.js +1 -1
  83. notebook/static/5346.bundle.js +1 -1
  84. notebook/static/5426.bundle.js +1 -1
  85. notebook/static/5430.bundle.js +653 -0
  86. notebook/static/545.bundle.js +1 -1
  87. notebook/static/5451.bundle.js +1 -1
  88. notebook/static/5573.bundle.js +1 -1
  89. notebook/static/5601.bundle.js +1 -1
  90. notebook/static/5649.bundle.js +3 -3
  91. notebook/static/5733.bundle.js +1 -1
  92. notebook/static/5850.bundle.js +1 -1
  93. notebook/static/5912.bundle.js +1 -1
  94. notebook/static/5921.bundle.js +1 -1
  95. notebook/static/6017.bundle.js +1 -1
  96. notebook/static/6061.bundle.js +1 -1
  97. notebook/static/6139.bundle.js +1 -1
  98. notebook/static/62.bundle.js +1 -1
  99. notebook/static/6271.bundle.js +1 -1
  100. notebook/static/6345.bundle.js +1 -1
  101. notebook/static/6604.bundle.js +1 -1
  102. notebook/static/6621.bundle.js +1 -1
  103. notebook/static/6627.bundle.js +1 -1
  104. notebook/static/6648.bundle.js +1 -0
  105. notebook/static/6731.bundle.js +1 -1
  106. notebook/static/6748.bundle.js +1 -1
  107. notebook/static/677.bundle.js +1 -1
  108. notebook/static/6815.bundle.js +1 -1
  109. notebook/static/6853.bundle.js +1 -1
  110. notebook/static/6893.bundle.js +1 -1
  111. notebook/static/690.bundle.js +1 -1
  112. notebook/static/6962.bundle.js +1 -1
  113. notebook/static/6999.bundle.js +1 -1
  114. notebook/static/7226.bundle.js +1 -1
  115. notebook/static/7252.bundle.js +1 -1
  116. notebook/static/7302.bundle.js +1 -1
  117. notebook/static/7369.bundle.js +1 -1
  118. notebook/static/7386.bundle.js +1 -1
  119. notebook/static/7391.bundle.js +1 -1
  120. notebook/static/7543.bundle.js +1 -1
  121. notebook/static/7603.bundle.js +1 -1
  122. notebook/static/7639.bundle.js +1 -1
  123. notebook/static/7655.bundle.js +1 -1
  124. notebook/static/7684.bundle.js +1 -1
  125. notebook/static/7812.bundle.js +1 -1
  126. notebook/static/7819.bundle.js +1 -1
  127. notebook/static/7821.bundle.js +1 -1
  128. notebook/static/7854.bundle.js +1 -1
  129. notebook/static/7866.bundle.js +1 -0
  130. notebook/static/7900.bundle.js +1 -1
  131. notebook/static/7906.bundle.js +1 -1
  132. notebook/static/8010.bundle.js +1 -1
  133. notebook/static/8032.bundle.js +1 -1
  134. notebook/static/8285.bundle.js +1 -1
  135. notebook/static/8471.bundle.js +1 -1
  136. notebook/static/8579.bundle.js +1 -1
  137. notebook/static/8633.bundle.js +1 -1
  138. notebook/static/8635.bundle.js +41 -0
  139. notebook/static/8771.bundle.js +1 -1
  140. notebook/static/8781.bundle.js +1 -1
  141. notebook/static/8875.bundle.js +1 -1
  142. notebook/static/8907.bundle.js +1 -1
  143. notebook/static/8928.bundle.js +1 -1
  144. notebook/static/8929.bundle.js +1 -1
  145. notebook/static/893.bundle.js +1 -1
  146. notebook/static/901.bundle.js +1 -1
  147. notebook/static/9068.bundle.js +1 -1
  148. notebook/static/911.bundle.js +1 -1
  149. notebook/static/9136.bundle.js +1 -1
  150. notebook/static/9151.bundle.js +1 -1
  151. notebook/static/9161.bundle.js +1 -1
  152. notebook/static/9268.bundle.js +1 -1
  153. notebook/static/9335.bundle.js +1 -1
  154. notebook/static/9341.bundle.js +1 -1
  155. notebook/static/9380.bundle.js +1 -1
  156. notebook/static/9605.bundle.js +1 -1
  157. notebook/static/9638.bundle.js +1 -1
  158. notebook/static/9672.bundle.js +352 -0
  159. notebook/static/9680.bundle.js +1 -1
  160. notebook/static/9685.bundle.js +1 -1
  161. notebook/static/9752.bundle.js +1 -1
  162. notebook/static/9799.bundle.js +1 -0
  163. notebook/static/9821.bundle.js +1 -1
  164. notebook/static/9852.bundle.js +1 -1
  165. notebook/static/bundle.js +1 -1
  166. notebook/static/third-party-licenses.json +124 -130
  167. notebook/templates/consoles.html +1 -1
  168. notebook/templates/edit.html +1 -1
  169. notebook/templates/error.html +1 -1
  170. notebook/templates/notebooks.html +1 -1
  171. notebook/templates/terminals.html +1 -1
  172. notebook/templates/tree.html +1 -1
  173. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/package.json.orig +17 -17
  174. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/documentsearch-extension/package.json.orig +5 -5
  175. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/package.json.orig +6 -6
  176. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/package.json.orig +11 -11
  177. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/package.json.orig +18 -18
  178. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/widget.json +0 -1
  179. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/package.json +13 -13
  180. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/package.json.orig +12 -12
  181. notebook-7.3.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.67f8b11d2af855286118.js +1 -0
  182. notebook-7.3.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/600.25341cef1598f2727482.js → notebook-7.3.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/907.767373e59d0c0e33ef12.js +1 -1
  183. notebook-7.3.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.50419fa0a72e54064396.js +1 -0
  184. notebook-7.3.0b0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.fd0956ebf15f666a19f8.js +1 -0
  185. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/third-party-licenses.json +2 -2
  186. {notebook-7.3.0a1.dist-info → notebook-7.3.0b0.dist-info}/METADATA +2 -2
  187. {notebook-7.3.0a1.dist-info → notebook-7.3.0b0.dist-info}/RECORD +210 -218
  188. notebook/static/1226.bundle.js +0 -1
  189. notebook/static/1750.bundle.js +0 -1
  190. notebook/static/1884.bundle.js +0 -386
  191. notebook/static/4045.bundle.js +0 -1
  192. notebook/static/4434.bundle.js +0 -1
  193. notebook/static/5018.bundle.js +0 -1
  194. notebook/static/5712.bundle.js +0 -1
  195. notebook/static/6164.bundle.js +0 -1
  196. notebook/static/6318.bundle.js +0 -1
  197. notebook/static/6619.bundle.js +0 -1
  198. notebook/static/6898.bundle.js +0 -1
  199. notebook/static/7506.bundle.js +0 -703
  200. notebook/static/7579.bundle.js +0 -1
  201. notebook/static/8054.bundle.js +0 -1
  202. notebook/static/8647.bundle.js +0 -1
  203. notebook/static/8723.bundle.js +0 -1
  204. notebook/static/9734.bundle.js +0 -1
  205. notebook/static/9906.bundle.js +0 -1
  206. notebook-7.3.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.45e1d3167710e94c3d26.js +0 -1
  207. notebook-7.3.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.b94c92715d631efb4a8f.js +0 -1
  208. notebook-7.3.0a1.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.8ca922abea871b34db72.js +0 -1
  209. /notebook/static/{7506.bundle.js.LICENSE.txt → 4242.bundle.js.LICENSE.txt} +0 -0
  210. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/etc/jupyter/jupyter_server_config.d/notebook.json +0 -0
  211. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/applications/jupyter-notebook.desktop +0 -0
  212. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/icons/hicolor/scalable/apps/notebook.svg +0 -0
  213. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/menus.json +0 -0
  214. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/pages.json +0 -0
  215. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/shell.json +0 -0
  216. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/title.json +0 -0
  217. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/top.json +0 -0
  218. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/zen.json +0 -0
  219. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/open.json +0 -0
  220. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/checkpoints.json +0 -0
  221. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/edit-notebook-metadata.json +0 -0
  222. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/kernel-logo.json +0 -0
  223. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/scroll-output.json +0 -0
  224. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +0 -0
  225. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/interface-switcher.json +0 -0
  226. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/launch-tree.json +0 -0
  227. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/93.eae3497dd223d842d198.js +0 -0
  228. {notebook-7.3.0a1.data → notebook-7.3.0b0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/style.js +0 -0
  229. {notebook-7.3.0a1.dist-info → notebook-7.3.0b0.dist-info}/WHEEL +0 -0
  230. {notebook-7.3.0a1.dist-info → notebook-7.3.0b0.dist-info}/entry_points.txt +0 -0
  231. {notebook-7.3.0a1.dist-info → notebook-7.3.0b0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[2955],{22955:(t,e,i)=>{i.r(e),i.d(e,{BidiSpan:()=>Bt,BlockInfo:()=>pi,BlockType:()=>ft,Decoration:()=>pt,Direction:()=>Ct,EditorView:()=>oo,GutterMarker:()=>Fs,MatchDecorator:()=>Io,RectangleMarker:()=>yo,ViewPlugin:()=>re,ViewUpdate:()=>be,WidgetType:()=>ut,__test:()=>pn,closeHoverTooltips:()=>Os,crosshairCursor:()=>as,drawSelection:()=>To,dropCursor:()=>Wo,getDrawSelectionConfig:()=>Oo,getPanel:()=>Bs,getTooltip:()=>As,gutter:()=>Ks,gutterLineClass:()=>Ws,gutters:()=>Ys,hasHoverTooltips:()=>Ds,highlightActiveLine:()=>Zo,highlightActiveLineGutter:()=>ln,highlightSpecialChars:()=>jo,highlightTrailingWhitespace:()=>fn,highlightWhitespace:()=>dn,hoverTooltip:()=>ks,keymap:()=>uo,layer:()=>ko,lineNumberMarkers:()=>Qs,lineNumbers:()=>on,logException:()=>ie,panels:()=>Ls,placeholder:()=>os,rectangularSelection:()=>rs,repositionTooltips:()=>Es,runScopeHandlers:()=>go,scrollPastEnd:()=>Jo,showPanel:()=>Ns,showTooltip:()=>bs,tooltips:()=>us});for(var o=i(89843),s=i(4434),n={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},r={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},l="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),h="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),a=0;a<10;a++)n[48+a]=n[96+a]=String(a);for(a=1;a<=24;a++)n[a+111]="F"+a;for(a=65;a<=90;a++)n[a]=String.fromCharCode(a+32),r[a]=String.fromCharCode(a);for(var c in n)r.hasOwnProperty(c)||(r[c]=n[c]);function d(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function u(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function f(t,e){if(!e.anchorNode)return!1;try{return u(t,e.anchorNode)}catch(t){return!1}}function p(t){return 3==t.nodeType?D(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function g(t,e,i,o){return!!i&&(v(t,e,i,o,-1)||v(t,e,i,o,1))}function m(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function w(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function v(t,e,i,o,s){for(;;){if(t==i&&e==o)return!0;if(e==(s<0?0:b(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=m(t)+(s<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(s<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=s<0?b(t):0}}}function b(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function y(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function S(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function x(t,e){let i=e.width/t.offsetWidth,o=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(o>.995&&o<1.005||!isFinite(o)||Math.abs(e.height-t.offsetHeight)<1)&&(o=1),{scaleX:i,scaleY:o}}class C{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?b(e):0),i,Math.min(t.focusOffset,i?b(i):0))}set(t,e,i,o){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=o}}let M,k=null;function A(t){if(t.setActive)return t.setActive();if(k)return t.focus(k);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==k?{get preventScroll(){return k={preventScroll:!0},!0}}:void 0),!k){k=!1;for(let t=0;t<e.length;){let i=e[t++],o=e[t++],s=e[t++];i.scrollTop!=o&&(i.scrollTop=o),i.scrollLeft!=s&&(i.scrollLeft=s)}}}function D(t,e,i=e){let o=M||(M=document.createRange());return o.setEnd(t,i),o.setStart(t,e),o}function T(t,e,i,o){let s={key:e,code:e,keyCode:i,which:i,cancelable:!0};o&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=o);let n=new KeyboardEvent("keydown",s);n.synthetic=!0,t.dispatchEvent(n);let r=new KeyboardEvent("keyup",s);return r.synthetic=!0,t.dispatchEvent(r),n.defaultPrevented||r.defaultPrevented}function O(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function E(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function R(t,e){for(let i=t,o=e;;){if(3==i.nodeType&&o>0)return{node:i,offset:o};if(1==i.nodeType&&o>0){if("false"==i.contentEditable)return null;i=i.childNodes[o-1],o=b(i)}else{if(!i.parentNode||w(i))return null;o=m(i),i=i.parentNode}}}function L(t,e){for(let i=t,o=e;;){if(3==i.nodeType&&o<i.nodeValue.length)return{node:i,offset:o};if(1==i.nodeType&&o<i.childNodes.length){if("false"==i.contentEditable)return null;i=i.childNodes[o],o=0}else{if(!i.parentNode||w(i))return null;o=m(i)+1,i=i.parentNode}}}class B{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new B(t.parentNode,m(t),e)}static after(t,e){return new B(t.parentNode,m(t)+1,e)}}const P=[];class H{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t){let e=this.posAtStart;for(let i of this.children){if(i==t)return e;e+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(2&this.flags){let i,o=this.dom,s=null;for(let n of this.children){if(7&n.flags){if(!n.dom&&(i=s?s.nextSibling:o.firstChild)){let t=H.get(i);(!t||!t.parent&&t.canReuseDOM(n))&&n.reuseDOM(i)}n.sync(t,e),n.flags&=-8}if(i=s?s.nextSibling:o.firstChild,e&&!e.written&&e.node==o&&i!=n.dom&&(e.written=!0),n.dom.parentNode==o)for(;i&&i!=n.dom;)i=V(i);else o.insertBefore(n.dom,i);s=n.dom}for(i=s?s.nextSibling:o.firstChild,i&&e&&e.node==o&&(e.written=!0);i;)i=V(i)}else if(1&this.flags)for(let i of this.children)7&i.flags&&(i.sync(t,e),i.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let i;if(t==this.dom)i=this.dom.childNodes[e];else{let o=0==b(t)?0:0==e?-1:1;for(;;){let e=t.parentNode;if(e==this.dom)break;0==o&&e.firstChild!=e.lastChild&&(o=t==e.firstChild?-1:1),t=e}i=o<0?t:t.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!H.get(i);)i=i.nextSibling;if(!i)return this.length;for(let t=0,e=0;;t++){let o=this.children[t];if(o.dom==i)return e;e+=o.length+o.breakAfter}}domBoundsAround(t,e,i=0){let o=-1,s=-1,n=-1,r=-1;for(let l=0,h=i,a=i;l<this.children.length;l++){let i=this.children[l],c=h+i.length;if(h<t&&c>e)return i.domBoundsAround(t,e,h);if(c>=t&&-1==o&&(o=l,s=h),h>e&&i.dom.parentNode==this.dom){n=l,r=a;break}a=c,h=c+i.breakAfter}return{from:s,to:r<0?i+this.length:r,startDOM:(o?this.children[o-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:n<this.children.length&&n>=0?this.children[n].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),1&e.flags)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,i=P){this.markDirty();for(let o=t;o<e;o++){let t=this.children[o];t.parent==this&&i.indexOf(t)<0&&t.destroy()}this.children.splice(t,e-t,...i);for(let t=0;t<i.length;t++)i[t].setParent(this)}ignoreMutation(t){return!1}ignoreEvent(t){return!1}childCursor(t=this.length){return new N(this.children,t,this.children.length)}childPos(t,e=1){return this.childCursor().findPos(t,e)}toString(){let t=this.constructor.name.replace("View","");return t+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==t?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(t){return t.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(t,e,i,o,s,n){return!1}become(t){return!1}canReuseDOM(t){return t.constructor==this.constructor&&!(8&(this.flags|t.flags))}getSide(){return 0}destroy(){for(let t of this.children)t.parent==this&&t.destroy();this.parent=null}}function V(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}H.prototype.breakAfter=0;class N{constructor(t,e,i){this.children=t,this.pos=e,this.i=i,this.off=0}findPos(t,e=1){for(;;){if(t>this.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function F(t,e,i,o,s,n,r,l,h){let{children:a}=t,c=a.length?a[e]:null,d=n.length?n[n.length-1]:null,u=d?d.breakAfter:r;if(!(e==o&&c&&!r&&!u&&n.length<2&&c.merge(i,s,n.length?d:null,0==i,l,h))){if(o<a.length){let t=a[o];t&&(s<t.length||t.breakAfter&&(null==d?void 0:d.breakAfter))?(e==o&&(t=t.split(s),s=0),!u&&d&&t.merge(0,s,d,!0,0,h)?n[n.length-1]=t:((s||t.children.length&&!t.children[0].length)&&t.merge(0,s,null,!1,0,h),n.push(t))):(null==t?void 0:t.breakAfter)&&(d?d.breakAfter=1:r=1),o++}for(c&&(c.breakAfter=r,i>0&&(!r&&n.length&&c.merge(i,c.length,n[0],!1,l,0)?c.breakAfter=n.shift().breakAfter:(i<c.length||c.children.length&&0==c.children[c.children.length-1].length)&&c.merge(i,c.length,null,!1,l,0),e++));e<o&&n.length;)if(a[o-1].become(n[n.length-1]))o--,n.pop(),h=n.length?0:l;else{if(!a[e].become(n[0]))break;e++,n.shift(),l=n.length?0:h}!n.length&&e&&o<a.length&&!a[e-1].breakAfter&&a[o].merge(0,0,a[e-1],!1,l,h)&&e--,(e<o||n.length)&&t.replaceChildren(e,o,n)}}function W(t,e,i,o,s,n){let r=t.childCursor(),{i:l,off:h}=r.findPos(i,1),{i:a,off:c}=r.findPos(e,-1),d=e-i;for(let t of o)d+=t.length;t.length+=d,F(t,a,c,l,h,o,0,s,n)}let z="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},I="undefined"!=typeof document?document:{documentElement:{style:{}}};const K=/Edge\/(\d+)/.exec(z.userAgent),q=/MSIE \d/.test(z.userAgent),Y=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(z.userAgent),_=!!(q||Y||K),X=!_&&/gecko\/(\d+)/i.test(z.userAgent),j=!_&&/Chrome\/(\d+)/.exec(z.userAgent),G="webkitFontSmoothing"in I.documentElement.style,U=!_&&/Apple Computer/.test(z.vendor),$=U&&(/Mobile\/\w+/.test(z.userAgent)||z.maxTouchPoints>2);var Q={mac:$||/Mac/.test(z.platform),windows:/Win/.test(z.platform),linux:/Linux|X11/.test(z.platform),ie:_,ie_version:q?I.documentMode||6:Y?+Y[1]:K?+K[1]:0,gecko:X,gecko_version:X?+(/Firefox\/(\d+)/.exec(z.userAgent)||[0,0])[1]:0,chrome:!!j,chrome_version:j?+j[1]:0,ios:$,android:/Android\b/.test(z.userAgent),webkit:G,safari:U,webkit_version:G?+(/\bAppleWebKit\/(\d+)/.exec(z.userAgent)||[0,0])[1]:0,tabSize:null!=I.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class J extends H{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){3==t.nodeType&&this.createDOM(t)}merge(t,e,i){return!(8&this.flags||i&&(!(i instanceof J)||this.length-(e-t)+i.length>256||8&i.flags)||(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),0))}split(t){let e=new J(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new B(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return function(t,e,i){let o=t.nodeValue.length;e>o&&(e=o);let s=e,n=e,r=0;0==e&&i<0||e==o&&i>=0?Q.chrome||Q.gecko||(e?(s--,r=1):n<o&&(n++,r=-1)):i<0?s--:n<o&&n++;let l=D(t,s,n).getClientRects();if(!l.length)return null;let h=l[(r?r<0:i>=0)?0:l.length-1];return Q.safari&&!r&&0==h.width&&(h=Array.prototype.find.call(l,(t=>t.width))||h),r?y(h,r<0):h||null}(this.dom,t,e)}}class Z extends H{constructor(t,e=[],i=0){super(),this.mark=t,this.children=e,this.length=i;for(let t of e)t.setParent(this)}setAttrs(t){if(O(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!(8&(this.flags|t.flags))}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,i,o,s,n){return!(i&&(!(i instanceof Z&&i.mark.eq(this.mark))||t&&s<=0||e<this.length&&n<=0)||(W(this,t,e,i?i.children.slice():[],s-1,n-1),this.markDirty(),0))}split(t){let e=[],i=0,o=-1,s=0;for(let n of this.children){let r=i+n.length;r>t&&e.push(i<t?n.split(t-i):n),o<0&&i>=t&&(o=s),i=r,s++}let n=this.length-t;return this.length=t,o>-1&&(this.children.length=o,this.markDirty()),new Z(this.mark,e,n)}domAtPos(t){return it(this,t)}coordsAt(t,e){return st(this,t,e)}}class tt extends H{static create(t,e,i){return new tt(t,e,i)}constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}split(t){let e=tt.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(t,e,i,o,s,n){return!(i&&(!(i instanceof tt&&this.widget.compare(i.widget))||t>0&&s<=0||e<this.length&&n<=0)||(this.length=t+(i?i.length:0)+(this.length-e),0))}become(t){return t instanceof tt&&t.side==this.side&&this.widget.constructor==t.widget.constructor&&(this.widget.compare(t.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,!0)}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get overrideDOMText(){if(0==this.length)return o.Text.empty;let t=this;for(;t.parent;)t=t.parent;let{view:e}=t,i=e&&e.state.doc,s=this.posAtStart;return i?i.slice(s,s+this.length):o.Text.empty}domAtPos(t){return(this.length?0==t:this.side>0)?B.before(this.dom):B.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.widget.coordsAt(this.dom,t,e);if(i)return i;let o=this.dom.getClientRects(),s=null;if(!o.length)return null;let n=this.side?this.side<0:t>0;for(let e=n?o.length-1:0;s=o[e],!(t>0?0==e:e==o.length-1||s.top<s.bottom);e+=n?-1:1);return y(s,!n)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class et extends H{constructor(t){super(),this.side=t}get length(){return 0}merge(){return!1}become(t){return t instanceof et&&t.side==this.side}split(){return new et(this.side)}sync(){if(!this.dom){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),this.setDOM(t)}}getSide(){return this.side}domAtPos(t){return this.side>0?B.before(this.dom):B.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return o.Text.empty}get isHidden(){return!0}}function it(t,e){let i=t.dom,{children:o}=t,s=0;for(let t=0;s<o.length;s++){let n=o[s],r=t+n.length;if(!(r==t&&n.getSide()<=0)){if(e>t&&e<r&&n.dom.parentNode==i)return n.domAtPos(e-t);if(e<=t)break;t=r}}for(let t=s;t>0;t--){let e=o[t-1];if(e.dom.parentNode==i)return e.domAtPos(e.length)}for(let t=s;t<o.length;t++){let e=o[t];if(e.dom.parentNode==i)return e.domAtPos(0)}return new B(i,0)}function ot(t,e,i){let o,{children:s}=t;i>0&&e instanceof Z&&s.length&&(o=s[s.length-1])instanceof Z&&o.mark.eq(e.mark)?ot(o,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function st(t,e,i){let o=null,s=-1,n=null,r=-1;!function t(e,l){for(let h=0,a=0;h<e.children.length&&a<=l;h++){let c=e.children[h],d=a+c.length;d>=l&&(c.children.length?t(c,l-a):(!n||n.isHidden&&i>0)&&(d>l||a==d&&c.getSide()>0)?(n=c,r=l-a):(a<l||a==d&&c.getSide()<0&&!c.isHidden)&&(o=c,s=l-a)),a=d}}(t,e);let l=(i<0?o:n)||o||n;return l?l.coordsAt(Math.max(0,l==o?s:r),i):function(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let i=p(e);return i[i.length-1]||null}(t)}function nt(t,e){for(let i in t)"class"==i&&e.class?e.class+=" "+t.class:"style"==i&&e.style?e.style+=";"+t.style:e[i]=t[i];return e}J.prototype.children=tt.prototype.children=et.prototype.children=P;const rt=Object.create(null);function lt(t,e,i){if(t==e)return!0;t||(t=rt),e||(e=rt);let o=Object.keys(t),s=Object.keys(e);if(o.length-(i&&o.indexOf(i)>-1?1:0)!=s.length-(i&&s.indexOf(i)>-1?1:0))return!1;for(let n of o)if(n!=i&&(-1==s.indexOf(n)||t[n]!==e[n]))return!1;return!0}function ht(t,e,i){let o=!1;if(e)for(let s in e)i&&s in i||(o=!0,"style"==s?t.style.cssText="":t.removeAttribute(s));if(i)for(let s in i)e&&e[s]==i[s]||(o=!0,"style"==s?t.style.cssText=i[s]:t.setAttribute(s,i[s]));return o}function at(t){let e=Object.create(null);for(let i=0;i<t.attributes.length;i++){let o=t.attributes[i];e[o.name]=o.value}return e}class ct extends H{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,o,s,n){if(i){if(!(i instanceof ct))return!1;this.dom||i.transferDOM(this)}return o&&this.setDeco(i?i.attrs:null),W(this,t,e,i?i.children.slice():[],s,n),!0}split(t){let e=new ct;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i,off:o}=this.childPos(t);o&&(e.append(this.children[i].split(o),0),this.children[i].merge(o,this.children[i].length,null,!1,0,0),i++);for(let t=i;t<this.children.length;t++)e.append(this.children[t],0);for(;i>0&&0==this.children[i-1].length;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){lt(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){ot(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=nt(e,this.attrs||{})),i&&(this.attrs=nt({class:i},this.attrs||{}))}domAtPos(t){return it(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}sync(t,e){var i;this.dom?4&this.flags&&(O(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(ht(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let o=this.dom.lastChild;for(;o&&H.get(o)instanceof Z;)o=o.lastChild;if(!(o&&this.length&&("BR"==o.nodeName||0!=(null===(i=H.get(o))||void 0===i?void 0:i.isEditable)||Q.ios&&this.children.some((t=>t instanceof J))))){let t=document.createElement("BR");t.cmIgnore=!0,this.dom.appendChild(t)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let t,e=0;for(let i of this.children){if(!(i instanceof J)||/[^ -~]/.test(i.text))return null;let o=p(i.dom);if(1!=o.length)return null;e+=o[0].width,t=o[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(t,e){let i=st(this,t,e);if(!this.children.length&&i&&this.parent){let{heightOracle:t}=this.parent.view.viewState,e=i.bottom-i.top;if(Math.abs(e-t.lineHeight)<2&&t.textHeight<e){let o=(e-t.textHeight)/2;return{top:i.top+o,bottom:i.bottom-o,left:i.left,right:i.left}}}return i}become(t){return t instanceof ct&&0==this.children.length&&0==t.children.length&&lt(this.attrs,t.attrs)&&this.breakAfter==t.breakAfter}covers(){return!0}static find(t,e){for(let i=0,o=0;i<t.children.length;i++){let s=t.children[i],n=o+s.length;if(n>=e){if(s instanceof ct)return s;if(n>e)break}o=n+s.breakAfter}return null}}class dt extends H{constructor(t,e,i){super(),this.widget=t,this.length=e,this.deco=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,o,s,n){return!(i&&(!(i instanceof dt&&this.widget.compare(i.widget))||t>0&&s<=0||e<this.length&&n<=0)||(this.length=t+(i?i.length:0)+(this.length-e),0))}domAtPos(t){return 0==t?B.before(this.dom):B.after(this.dom,t==this.length)}split(t){let e=this.length-t;this.length=t;let i=new dt(this.widget,e,this.deco);return i.breakAfter=this.breakAfter,i}get children(){return P}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):o.Text.empty}domBoundsAround(){return null}become(t){return t instanceof dt&&t.widget.constructor==this.widget.constructor&&(t.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,this.deco=t.deco,this.breakAfter=t.breakAfter,!0)}ignoreMutation(){return!0}ignoreEvent(t){return this.widget.ignoreEvent(t)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(t,e){return this.widget.coordsAt(this.dom,t,e)}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(t){let{startSide:e,endSide:i}=this.deco;return e!=i&&(t<0?e<0:i>0)}}class ut{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}}var ft=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(ft||(ft={}));class pt extends o.RangeValue{constructor(t,e,i,o){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=o}get heightRelevant(){return!1}static mark(t){return new gt(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new wt(t,e,e,i,t.widget||null,!1)}static replace(t){let e,i,o=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{let{start:s,end:n}=vt(t,o);e=(s?o?-3e8:-1:5e8)-1,i=1+(n?o?2e8:1:-6e8)}return new wt(t,e,i,o,t.widget||null,!0)}static line(t){return new mt(t)}static set(t,e=!1){return o.RangeSet.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}pt.none=o.RangeSet.empty;class gt extends pt{constructor(t){let{start:e,end:i}=vt(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,i;return this==t||t instanceof gt&&this.tagName==t.tagName&&(this.class||(null===(e=this.attrs)||void 0===e?void 0:e.class))==(t.class||(null===(i=t.attrs)||void 0===i?void 0:i.class))&&lt(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}gt.prototype.point=!1;class mt extends pt{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof mt&&this.spec.class==t.spec.class&&lt(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}mt.prototype.mapMode=o.MapMode.TrackBefore,mt.prototype.point=!0;class wt extends pt{constructor(t,e,i,s,n,r){super(e,i,n,t),this.block=s,this.isReplace=r,this.mapMode=s?e<=0?o.MapMode.TrackBefore:o.MapMode.TrackAfter:o.MapMode.TrackDel}get type(){return this.startSide!=this.endSide?ft.WidgetRange:this.startSide<=0?ft.WidgetBefore:ft.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof wt&&((e=this.widget)==(i=t.widget)||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}function vt(t,e=!1){let{inclusiveStart:i,inclusiveEnd:o}=t;return null==i&&(i=t.inclusive),null==o&&(o=t.inclusive),{start:null!=i?i:e,end:null!=o?o:e}}function bt(t,e,i,o=0){let s=i.length-1;s>=0&&i[s]+o>=t?i[s]=Math.max(i[s],e):i.push(t,e)}wt.prototype.point=!0;class yt{constructor(t,e,i,o){this.doc=t,this.pos=e,this.end=i,this.disallowBlockEffectsFor=o,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=e}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof dt&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ct),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(St(new et(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||t&&this.content.length&&this.content[this.content.length-1]instanceof dt||this.getLine()}buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){let{value:e,lineBreak:i,done:o}=this.cursor.next(this.skip);if(this.skip=0,o)throw new Error("Ran out of text content when drawing inline views");if(i){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}this.text=e,this.textOff=0}let o=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(St(new J(this.text.slice(this.textOff,this.textOff+o)),e),i),this.atCursorPos=!0,this.textOff+=o,t-=o,i=0}}span(t,e,i,o){this.buildText(e-t,i,o),this.pos=e,this.openStart<0&&(this.openStart=o)}point(t,e,i,o,s,n){if(this.disallowBlockEffectsFor[n]&&i instanceof wt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=e-t;if(i instanceof wt)if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new dt(i.widget||xt.block,r,i));else{let n=tt.create(i.widget||xt.inline,r,r?0:i.startSide),l=this.atCursorPos&&!n.isEditable&&s<=o.length&&(t<e||i.startSide>0),h=!n.isEditable&&(t<e||s>o.length||i.startSide<=0),a=this.getLine();2!=this.pendingBuffer||l||n.isEditable||(this.pendingBuffer=0),this.flushBuffer(o),l&&(a.append(St(new et(1),o),s),s=o.length+Math.max(0,s-o.length)),a.append(St(n,o),s),this.atCursorPos=h,this.pendingBuffer=h?t<e||s>o.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=o.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=s)}static build(t,e,i,s,n){let r=new yt(t,e,i,n);return r.openEnd=o.RangeSet.spans(s,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function St(t,e){for(let i of e)t=new Z(i,[t],t.length);return t}class xt extends ut{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}xt.inline=new xt("span"),xt.block=new xt("div");var Ct=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Ct||(Ct={}));const Mt=Ct.LTR,kt=Ct.RTL;function At(t){let e=[];for(let i=0;i<t.length;i++)e.push(1<<+t[i]);return e}const Dt=At("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Tt=At("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Ot=Object.create(null),Et=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),i=t.charCodeAt(1);Ot[e]=i,Ot[i]=-e}function Rt(t){return t<=247?Dt[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Tt[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const Lt=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Bt{get dir(){return this.level%2?kt:Mt}constructor(t,e,i){this.from=t,this.to=e,this.level=i}side(t,e){return this.dir==e==t?this.to:this.from}forward(t,e){return t==(this.dir==e)}static find(t,e,i,o){let s=-1;for(let n=0;n<t.length;n++){let r=t[n];if(r.from<=e&&r.to>=e){if(r.level==i)return n;(s<0||(0!=o?o<0?r.from<e:r.to>e:t[s].level>r.level))&&(s=n)}}if(s<0)throw new RangeError("Index out of range");return s}}function Pt(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let o=t[i],s=e[i];if(o.from!=s.from||o.to!=s.to||o.direction!=s.direction||!Pt(o.inner,s.inner))return!1}return!0}const Ht=[];function Vt(t,e,i,o,s,n,r){let l=o%2?2:1;if(o%2==s%2)for(let h=e,a=0;h<i;){let e=!0,c=!1;if(a==n.length||h<n[a].from){let t=Ht[h];t!=l&&(e=!1,c=16==t)}let d=e||1!=l?null:[],u=e?o:o+1,f=h;t:for(;;)if(a<n.length&&f==n[a].from){if(c)break t;let p=n[a];if(!e)for(let t=p.to,e=a+1;;){if(t==i)break t;if(!(e<n.length&&n[e].from==t)){if(Ht[t]==l)break t;break}t=n[e++].to}a++,d?d.push(p):(p.from>h&&r.push(new Bt(h,p.from,u)),Nt(t,p.direction==Mt!=!(u%2)?o+1:o,s,p.inner,p.from,p.to,r),h=p.to),f=p.to}else{if(f==i||(e?Ht[f]!=l:Ht[f]==l))break;f++}d?Vt(t,h,f,o+1,s,d,r):h<f&&r.push(new Bt(h,f,u)),h=f}else for(let h=i,a=n.length;h>e;){let i=!0,c=!1;if(!a||h>n[a-1].to){let t=Ht[h-1];t!=l&&(i=!1,c=16==t)}let d=i||1!=l?null:[],u=i?o:o+1,f=h;t:for(;;)if(a&&f==n[a-1].to){if(c)break t;let p=n[--a];if(!i)for(let t=p.from,i=a;;){if(t==e)break t;if(!i||n[i-1].to!=t){if(Ht[t-1]==l)break t;break}t=n[--i].from}d?d.push(p):(p.to<h&&r.push(new Bt(p.to,h,u)),Nt(t,p.direction==Mt!=!(u%2)?o+1:o,s,p.inner,p.from,p.to,r),h=p.from),f=p.from}else{if(f==e||(i?Ht[f-1]!=l:Ht[f-1]==l))break;f--}d?Vt(t,f,h,o+1,s,d,r):f<h&&r.push(new Bt(f,h,u)),h=f}}function Nt(t,e,i,o,s,n,r){let l=e%2?2:1;!function(t,e,i,o,s){for(let n=0;n<=o.length;n++){let r=n?o[n-1].to:e,l=n<o.length?o[n].from:i,h=n?256:s;for(let e=r,i=h,o=h;e<l;e++){let s=Rt(t.charCodeAt(e));512==s?s=i:8==s&&4==o&&(s=16),Ht[e]=4==s?2:s,7&s&&(o=s),i=s}for(let t=r,e=h,o=h;t<l;t++){let s=Ht[t];if(128==s)t<l-1&&e==Ht[t+1]&&24&e?s=Ht[t]=e:Ht[t]=256;else if(64==s){let s=t+1;for(;s<l&&64==Ht[s];)s++;let n=t&&8==e||s<i&&8==Ht[s]?1==o?1:8:256;for(let e=t;e<s;e++)Ht[e]=n;t=s-1}else 8==s&&1==o&&(Ht[t]=1);e=s,7&s&&(o=s)}}}(t,s,n,o,l),function(t,e,i,o,s){let n=1==s?2:1;for(let r=0,l=0,h=0;r<=o.length;r++){let a=r?o[r-1].to:e,c=r<o.length?o[r].from:i;for(let e,i,o,r=a;r<c;r++)if(i=Ot[e=t.charCodeAt(r)])if(i<0){for(let t=l-3;t>=0;t-=3)if(Et[t+1]==-i){let e=Et[t+2],i=2&e?s:4&e?1&e?n:s:0;i&&(Ht[r]=Ht[Et[t]]=i),l=t;break}}else{if(189==Et.length)break;Et[l++]=r,Et[l++]=e,Et[l++]=h}else if(2==(o=Ht[r])||1==o){let t=o==s;h=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Et[e+2];if(2&i)break;if(t)Et[e+2]|=2;else{if(4&i)break;Et[e+2]|=4}}}}}(t,s,n,o,l),function(t,e,i,o){for(let s=0,n=o;s<=i.length;s++){let r=s?i[s-1].to:t,l=s<i.length?i[s].from:e;for(let h=r;h<l;){let r=Ht[h];if(256==r){let r=h+1;for(;;)if(r==l){if(s==i.length)break;r=i[s++].to,l=s<i.length?i[s].from:e}else{if(256!=Ht[r])break;r++}let a=1==n,c=a==(1==(r<e?Ht[r]:o))?a?1:2:o;for(let e=r,o=s,n=o?i[o-1].to:t;e>h;)e==n&&(e=i[--o].from,n=o?i[o-1].to:t),Ht[--e]=c;h=r}else n=r,h++}}}(s,n,o,l),Vt(t,s,n,e,i,o,r)}function Ft(t,e,i){if(!t)return[new Bt(0,0,e==kt?1:0)];if(e==Mt&&!i.length&&!Lt.test(t))return Wt(t.length);if(i.length)for(;t.length>Ht.length;)Ht[Ht.length]=256;let o=[],s=e==Mt?0:1;return Nt(t,s,s,i,0,t.length,o),o}function Wt(t){return[new Bt(0,t,0)]}let zt="";function It(t,e,i,s,n){var r;let l=s.head-t.from,h=Bt.find(e,l,null!==(r=s.bidiLevel)&&void 0!==r?r:-1,s.assoc),a=e[h],c=a.side(n,i);if(l==c){let t=h+=n?1:-1;if(t<0||t>=e.length)return null;a=e[h=t],l=a.side(!n,i),c=a.side(n,i)}let d=(0,o.findClusterBreak)(t.text,l,a.forward(n,i));(d<a.from||d>a.to)&&(d=c),zt=t.text.slice(Math.min(l,d),Math.max(l,d));let u=h==(n?e.length-1:0)?null:e[h+(n?1:-1)];return u&&d==c&&u.level+(n?0:1)<a.level?o.EditorSelection.cursor(u.side(!n,i)+t.from,u.forward(n,i)?1:-1,u.level):o.EditorSelection.cursor(d+t.from,a.forward(n,i)?-1:1,a.level)}function Kt(t,e,i){for(let o=e;o<i;o++){let e=Rt(t.charCodeAt(o));if(1==e)return Mt;if(2==e||4==e)return kt}return Mt}const qt=o.Facet.define(),Yt=o.Facet.define(),_t=o.Facet.define(),Xt=o.Facet.define(),jt=o.Facet.define(),Gt=o.Facet.define(),Ut=o.Facet.define(),$t=o.Facet.define({combine:t=>t.some((t=>t))}),Qt=o.Facet.define({combine:t=>t.some((t=>t))}),Jt=o.Facet.define();class Zt{constructor(t,e="nearest",i="nearest",o=5,s=5,n=!1){this.range=t,this.y=e,this.x=i,this.yMargin=o,this.xMargin=s,this.isSnapshot=n}map(t){return t.empty?this:new Zt(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Zt(o.EditorSelection.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const te=o.StateEffect.define({map:(t,e)=>t.map(e)}),ee=o.StateEffect.define();function ie(t,e,i){let o=t.facet(Xt);o.length?o[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e)}const oe=o.Facet.define({combine:t=>!t.length||t[0]});let se=0;const ne=o.Facet.define();class re{constructor(t,e,i,o,s){this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=o,this.extension=s(this)}static define(t,e){const{eventHandlers:i,eventObservers:o,provide:s,decorations:n}=e||{};return new re(se++,t,i,o,(t=>{let e=[ne.of(t)];return n&&e.push(ce.of((e=>{let i=e.plugin(t);return i?n(i):pt.none}))),s&&e.push(s(t)),e}))}static fromClass(t,e){return re.define((e=>new t(e)),e)}}class le{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(e){if(ie(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){ie(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(e){ie(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const he=o.Facet.define(),ae=o.Facet.define(),ce=o.Facet.define(),de=o.Facet.define(),ue=o.Facet.define(),fe=o.Facet.define();function pe(t,e){let i=t.state.facet(fe);if(!i.length)return i;let s=i.map((e=>e instanceof Function?e(t):e)),n=[];return o.RangeSet.spans(s,e.from,e.to,{point(){},span(t,i,o,s){let r=t-e.from,l=i-e.from,h=n;for(let t=o.length-1;t>=0;t--,s--){let i,n=o[t].spec.bidiIsolate;if(null==n&&(n=Kt(e.text,r,l)),s>0&&h.length&&(i=h[h.length-1]).to==r&&i.direction==n)i.to=l,h=i.inner;else{let t={from:r,to:l,direction:n,inner:[]};h.push(t),h=t.inner}}}}),n}const ge=o.Facet.define();function me(t){let e=0,i=0,o=0,s=0;for(let n of t.state.facet(ge)){let r=n(t);r&&(null!=r.left&&(e=Math.max(e,r.left)),null!=r.right&&(i=Math.max(i,r.right)),null!=r.top&&(o=Math.max(o,r.top)),null!=r.bottom&&(s=Math.max(s,r.bottom)))}return{left:e,right:i,top:o,bottom:s}}const we=o.Facet.define();class ve{constructor(t,e,i,o){this.fromA=t,this.toA=e,this.fromB=i,this.toB=o}join(t){return new ve(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let o=t[e-1];if(!(o.fromA>i.toA)){if(o.toA<i.fromA)break;i=i.join(o),t.splice(e-1,1)}}return t.splice(e,0,i),t}static extendWithRanges(t,e){if(0==e.length)return t;let i=[];for(let o=0,s=0,n=0,r=0;;o++){let l=o==t.length?null:t[o],h=n-r,a=l?l.fromB:1e9;for(;s<e.length&&e[s]<a;){let t=e[s],o=e[s+1],n=Math.max(r,t),l=Math.min(a,o);if(n<=l&&new ve(n+h,l+h,n,l).addToSet(i),o>a)break;s+=2}if(!l)return i;new ve(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),n=l.toA,r=l.toB}}}class be{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=o.ChangeSet.empty(this.startState.doc.length);for(let t of i)this.changes=this.changes.compose(t.changes);let s=[];this.changes.iterChangedRanges(((t,e,i,o)=>s.push(new ve(t,e,i,o)))),this.changedRanges=s}static create(t,e,i){return new be(t,e,i)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((t=>t.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}class ye extends H{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=pt.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new ct],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ve(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let i=t.changedRanges;this.minWidth>0&&i.length&&(i.every((({fromA:t,toA:e})=>e<this.minWidthFrom||t>this.minWidthTo))?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?s=this.domChanged.newSel.head:function(t,e){let i=!1;return e&&t.iterChangedRanges(((t,o)=>{t<e.to&&o>e.from&&(i=!0)})),i}(t.changes,this.hasComposition)||t.selectionSet||(s=t.state.selection.main.head));let n=s>-1?function(t,e,i){let o=xe(t,i);if(!o)return null;let{node:s,from:n,to:r}=o,l=s.nodeValue;if(/[\n\r]/.test(l))return null;if(t.state.doc.sliceString(o.from,o.to)!=l)return null;let h=e.invertedDesc,a=new ve(h.mapPos(n),h.mapPos(r),n,r),c=[];for(let e=s.parentNode;;e=e.parentNode){let i=H.get(e);if(i instanceof Z)c.push({node:e,deco:i.mark});else{if(i instanceof ct||"DIV"==e.nodeName&&e.parentNode==t.contentDOM)return{range:a,text:s,marks:c,line:e};if(e==t.contentDOM)return null;c.push({node:e,deco:new gt({inclusive:!0,attributes:at(e),tagName:e.tagName.toLowerCase()})})}}}(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:e,to:o}=this.hasComposition;i=new ve(e,o,t.changes.mapPos(e,-1),t.changes.mapPos(o,1)).addToSet(i.slice())}this.hasComposition=n?{from:n.range.fromB,to:n.range.toB}:null,(Q.ie||Q.chrome)&&!n&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let r=function(t,e,i){let s=new Ce;return o.RangeSet.compare(t,e,i,s),s.changes}(this.decorations,this.updateDeco(),t.changes);return i=ve.extendWithRanges(i,r),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,t.startState.doc.length,n),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,i);let{observer:o}=this.view;o.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=Q.chrome||Q.ios?{node:o.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.flags&=-8,t&&(t.written||o.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((t=>t.flags&=-9));let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let t of this.children)t instanceof dt&&t.widget instanceof Se&&s.push(t.dom);o.updateGaps(s)}updateChildren(t,e,i){let o=i?i.range.addToSet(t.slice()):t,s=this.childCursor(e);for(let t=o.length-1;;t--){let e=t>=0?o[t]:null;if(!e)break;let n,r,l,h,{fromA:a,toA:c,fromB:d,toB:u}=e;if(i&&i.range.fromB<u&&i.range.toB>d){let t=yt.build(this.view.state.doc,d,i.range.fromB,this.decorations,this.dynamicDecorationMap),e=yt.build(this.view.state.doc,i.range.toB,u,this.decorations,this.dynamicDecorationMap);r=t.breakAtStart,l=t.openStart,h=e.openEnd;let o=this.compositionView(i);e.breakAtStart?o.breakAfter=1:e.content.length&&o.merge(o.length,o.length,e.content[0],!1,e.openStart,0)&&(o.breakAfter=e.content[0].breakAfter,e.content.shift()),t.content.length&&o.merge(0,0,t.content[t.content.length-1],!0,0,t.openEnd)&&t.content.pop(),n=t.content.concat(o).concat(e.content)}else({content:n,breakAtStart:r,openStart:l,openEnd:h}=yt.build(this.view.state.doc,d,u,this.decorations,this.dynamicDecorationMap));let{i:f,off:p}=s.findPos(c,1),{i:g,off:m}=s.findPos(a,-1);F(this,g,m,f,p,n,r,l,h)}i&&this.fixCompositionDOM(i)}updateEditContextFormatting(t){this.editContextFormatting=this.editContextFormatting.map(t.changes);for(let e of t.transactions)for(let t of e.effects)t.is(ee)&&(this.editContextFormatting=t.value)}compositionView(t){let e=new J(t.text.nodeValue);e.flags|=8;for(let{deco:i}of t.marks)e=new Z(i,[e],e.length);let i=new ct;return i.append(e,0),i}fixCompositionDOM(t){let e=(t,e)=>{e.flags|=8|(e.children.some((t=>7&t.flags))?1:0),this.markedForComposition.add(e);let i=H.get(t);i&&i!=e&&(i.dom=null),e.setDOM(t)},i=this.childPos(t.range.fromB,1),o=this.children[i.i];e(t.line,o);for(let s=t.marks.length-1;s>=-1;s--)i=o.childPos(i.off,1),o=o.children[i.i],e(s>=0?t.marks[s].node:t.text,o)}updateSelection(t=!1,e=!1){!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let i=this.view.root.activeElement,o=i==this.dom,s=!o&&f(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(o||e||s))return;let n=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(r.anchor)),h=r.empty?l:this.moveToLine(this.domAtPos(r.head));if(Q.gecko&&r.empty&&!this.hasComposition&&1==(a=l).node.nodeType&&a.node.firstChild&&(0==a.offset||"false"==a.node.childNodes[a.offset-1].contentEditable)&&(a.offset==a.node.childNodes.length||"false"==a.node.childNodes[a.offset].contentEditable)){let t=document.createTextNode("");this.view.observer.ignore((()=>l.node.insertBefore(t,l.node.childNodes[l.offset]||null))),l=h=new B(t,0),n=!0}var a;let c=this.view.observer.selectionRange;!n&&c.focusNode&&(g(l.node,l.offset,c.anchorNode,c.anchorOffset)&&g(h.node,h.offset,c.focusNode,c.focusOffset)||this.suppressWidgetCursorChange(c,r))||(this.view.observer.ignore((()=>{Q.android&&Q.chrome&&this.dom.contains(c.focusNode)&&function(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let t=d(this.view.root);if(t)if(r.empty){if(Q.gecko){let t=(e=l.node,o=l.offset,1!=e.nodeType?0:(o&&"false"==e.childNodes[o-1].contentEditable?1:0)|(o<e.childNodes.length&&"false"==e.childNodes[o].contentEditable?2:0));if(t&&3!=t){let e=(1==t?R:L)(l.node,l.offset);e&&(l=new B(e.node,e.offset))}}t.collapse(l.node,l.offset),null!=r.bidiLevel&&void 0!==t.caretBidiLevel&&(t.caretBidiLevel=r.bidiLevel)}else if(t.extend){t.collapse(l.node,l.offset);try{t.extend(h.node,h.offset)}catch(t){}}else{let e=document.createRange();r.anchor>r.head&&([l,h]=[h,l]),e.setEnd(h.node,h.offset),e.setStart(l.node,l.offset),t.removeAllRanges(),t.addRange(e)}var e,o;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(l,h)),this.impreciseAnchor=l.precise?null:new B(c.anchorNode,c.anchorOffset),this.impreciseHead=h.precise?null:new B(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&g(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=d(t.root),{anchorNode:o,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let n=ct.find(this,e.head);if(!n)return;let r=n.posAtStart;if(e.head==r||e.head==r+n.length)return;let l=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!l||!h||l.bottom>h.top)return;let a=this.domAtPos(e.head+e.assoc);i.collapse(a.node,a.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&i.collapse(o,s)}moveToLine(t){let e,i=this.dom;if(t.node!=i)return t;for(let o=t.offset;!e&&o<i.childNodes.length;o++){let t=H.get(i.childNodes[o]);t instanceof ct&&(e=t.domAtPos(0))}for(let o=t.offset-1;!e&&o>=0;o--){let t=H.get(i.childNodes[o]);t instanceof ct&&(e=t.domAtPos(t.length))}return e?new B(e.node,e.offset,!0):t}nearest(t){for(let e=t;e;){let t=H.get(e);if(t&&t.rootView==this)return t;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;e<this.children.length-1;){let t=this.children[e];if(i<t.length||t instanceof ct)break;e++,i=0}return this.children[e].domAtPos(i)}coordsAt(t,e){let i=null,o=0;for(let s=this.length,n=this.children.length-1;n>=0;n--){let r=this.children[n],l=s-r.breakAfter,h=l-r.length;if(l<t)break;if(h<=t&&(h<t||r.covers(-1))&&(l>t||r.covers(1))&&(!i||r instanceof ct&&!(i instanceof ct&&e>=0)))i=r,o=h;else if(i&&h==t&&l==t&&r instanceof dt&&Math.abs(e)<2){if(r.deco.startSide<0)break;n&&(i=null)}s=h}return i?i.coordsAt(t-o,e):null}coordsForChar(t){let{i:e,off:i}=this.childPos(t,1),s=this.children[e];if(!(s instanceof ct))return null;for(;s.children.length;){let{i:t,off:e}=s.childPos(i,1);for(;;t++){if(t==s.children.length)return null;if((s=s.children[t]).length)break}i=e}if(!(s instanceof J))return null;let n=(0,o.findClusterBreak)(s.text,i);if(n==i)return null;let r=D(s.dom,i,n).getClientRects();for(let t=0;t<r.length;t++){let e=r[t];if(t==r.length-1||e.top<e.bottom&&e.left<e.right)return e}return null}measureVisibleLineHeights(t){let e=[],{from:i,to:o}=t,s=this.view.contentDOM.clientWidth,n=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,l=this.view.textDirection==Ct.LTR;for(let t=0,h=0;h<this.children.length;h++){let a=this.children[h],c=t+a.length;if(c>o)break;if(t>=i){let i=a.dom.getBoundingClientRect();if(e.push(i.height),n){let e=a.dom.lastChild,o=e?p(e):[];if(o.length){let e=o[o.length-1],n=l?e.right-i.left:i.right-e.left;n>r&&(r=n,this.minWidth=s,this.minWidthFrom=t,this.minWidthTo=c)}}}t=c+a.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return"rtl"==getComputedStyle(this.children[e].dom).direction?Ct.RTL:Ct.LTR}measureTextSize(){for(let t of this.children)if(t instanceof ct){let e=t.measureTextSize();if(e)return e}let t,e,i,o=document.createElement("div");return o.className="cm-line",o.style.width="99999px",o.style.position="absolute",o.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(o);let s=p(o.firstChild)[0];t=o.getBoundingClientRect().height,e=s?s.width/27:7,i=s?s.height:t,o.remove()})),{lineHeight:t,charWidth:e,textHeight:i}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new N(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,o=0;;o++){let s=o==e.viewports.length?null:e.viewports[o],n=s?s.from-1:this.length;if(n>i){let o=(e.lineBlockAt(n).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(pt.replace({widget:new Se(o),block:!0,inclusive:!0,isBlockGap:!0}).range(i,n))}if(!s)break;i=s.to+1}return pt.set(t)}updateDeco(){let t=1,e=this.view.state.facet(ce).map((e=>(this.dynamicDecorationMap[t++]="function"==typeof e)?e(this.view):e)),i=!1,s=this.view.state.facet(de).map(((t,e)=>{let o="function"==typeof t;return o&&(i=!0),o?t(this.view):t}));for(s.length&&(this.dynamicDecorationMap[t++]=i,e.push(o.RangeSet.join(s))),this.decorations=[this.editContextFormatting,...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;return this.decorations}scrollIntoView(t){if(t.isSnapshot){let e=this.view.viewState.lineBlockAt(t.range.head);return this.view.scrollDOM.scrollTop=e.top-t.yMargin,void(this.view.scrollDOM.scrollLeft=t.xMargin)}for(let e of this.view.state.facet(Jt))try{if(e(this.view,t.range,t))return!0}catch(t){ie(this.view.state,t,"scroll handler")}let e,{range:i}=t,o=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1);if(!o)return;!i.empty&&(e=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(o={left:Math.min(o.left,e.left),top:Math.min(o.top,e.top),right:Math.max(o.right,e.right),bottom:Math.max(o.bottom,e.bottom)});let s=me(this.view),n={left:o.left-s.left,top:o.top-s.top,right:o.right+s.right,bottom:o.bottom+s.bottom},{offsetWidth:r,offsetHeight:l}=this.view.scrollDOM;!function(t,e,i,o,s,n,r,l){let h=t.ownerDocument,a=h.defaultView||window;for(let c=t,d=!1;c&&!d;)if(1==c.nodeType){let t,u=c==h.body,f=1,p=1;if(u)t=S(a);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(d=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();({scaleX:f,scaleY:p}=x(c,e)),t={left:e.left,right:e.left+c.clientWidth*f,top:e.top,bottom:e.top+c.clientHeight*p}}let g=0,m=0;if("nearest"==s)e.top<t.top?(m=-(t.top-e.top+r),i>0&&e.bottom>t.bottom+m&&(m=e.bottom-t.bottom+m+r)):e.bottom>t.bottom&&(m=e.bottom-t.bottom+r,i<0&&e.top-m<t.top&&(m=-(t.top+m-e.top+r)));else{let o=e.bottom-e.top,n=t.bottom-t.top;m=("center"==s&&o<=n?e.top+o/2-n/2:"start"==s||"center"==s&&i<0?e.top-r:e.bottom-n+r)-t.top}if("nearest"==o?e.left<t.left?(g=-(t.left-e.left+n),i>0&&e.right>t.right+g&&(g=e.right-t.right+g+n)):e.right>t.right&&(g=e.right-t.right+n,i<0&&e.left<t.left+g&&(g=-(t.left+g-e.left+n))):g=("center"==o?e.left+(e.right-e.left)/2-(t.right-t.left)/2:"start"==o==l?e.left-n:e.right-(t.right-t.left)+n)-t.left,g||m)if(u)a.scrollBy(g,m);else{let t=0,i=0;if(m){let t=c.scrollTop;c.scrollTop+=m/p,i=(c.scrollTop-t)*p}if(g){let e=c.scrollLeft;c.scrollLeft+=g/f,t=(c.scrollLeft-e)*f}e={left:e.left-t,top:e.top-i,right:e.right-t,bottom:e.bottom-i},t&&Math.abs(t-g)<1&&(o="nearest"),i&&Math.abs(i-m)<1&&(s="nearest")}if(u)break;c=c.assignedSlot||c.parentNode}else{if(11!=c.nodeType)break;c=c.host}}(this.view.scrollDOM,n,i.head<i.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,r),-r),Math.max(Math.min(t.yMargin,l),-l),this.view.textDirection==Ct.LTR)}}class Se extends ut{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function xe(t,e){let i=t.observer.selectionRange;if(!i.focusNode)return null;let o=R(i.focusNode,i.focusOffset),s=L(i.focusNode,i.focusOffset),n=o||s;if(s&&o&&s.node!=o.node){let e=H.get(s.node);if(!e||e instanceof J&&e.text!=s.node.nodeValue)n=s;else if(t.docView.lastCompositionAfterCursor){let t=H.get(o.node);!t||t instanceof J&&t.text!=o.node.nodeValue||(n=s)}}if(t.docView.lastCompositionAfterCursor=n!=o,!n)return null;let r=e-n.offset;return{from:r,to:r+n.node.nodeValue.length,node:n.node}}let Ce=class{constructor(){this.changes=[]}compareRange(t,e){bt(t,e,this.changes)}comparePoint(t,e){bt(t,e,this.changes)}};function Me(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function ke(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function Ae(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function De(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function Te(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function Oe(t,e,i){let o,s,n,r,l,h,a,c,d=!1;for(let u=t.firstChild;u;u=u.nextSibling){let t=p(u);for(let f=0;f<t.length;f++){let p=t[f];s&&Ae(s,p)&&(p=De(Te(p,s.bottom),s.top));let g=Me(e,p),m=ke(i,p);if(0==g&&0==m)return 3==u.nodeType?Ee(u,e,i):Oe(u,e,i);if(!o||r>m||r==m&&n>g){o=u,s=p,n=g,r=m;let l=m?i<p.top?-1:1:g?e<p.left?-1:1:0;d=!l||(l>0?f<t.length-1:f>0)}0==g?i>p.bottom&&(!a||a.bottom<p.bottom)?(l=u,a=p):i<p.top&&(!c||c.top>p.top)&&(h=u,c=p):a&&Ae(a,p)?a=Te(a,p.bottom):c&&Ae(c,p)&&(c=De(c,p.top))}}if(a&&a.bottom>=i?(o=l,s=a):c&&c.top<=i&&(o=h,s=c),!o)return{node:t,offset:0};let u=Math.max(s.left,Math.min(s.right,e));return 3==o.nodeType?Ee(o,u,i):d&&"false"!=o.contentEditable?Oe(o,u,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,o)+(e>=(s.left+s.right)/2?1:0)}}function Ee(t,e,i){let o=t.nodeValue.length,s=-1,n=1e9,r=0;for(let l=0;l<o;l++){let o=D(t,l,l+1).getClientRects();for(let h=0;h<o.length;h++){let a=o[h];if(a.top==a.bottom)continue;r||(r=e-a.left);let c=(a.top>i?a.top-i:i-a.bottom)-1;if(a.left-1<=e&&a.right+1>=e&&c<n){let i=e>=(a.left+a.right)/2,o=i;if((Q.chrome||Q.gecko)&&D(t,l).getBoundingClientRect().left==a.right&&(o=!i),c<=0)return{node:t,offset:l+(o?1:0)};s=l+(o?1:0),n=c}}}return{node:t,offset:s>-1?s:r>0?t.nodeValue.length:0}}function Re(t,e,i,o=-1){var s,n;let r,l=t.contentDOM.getBoundingClientRect(),h=l.top+t.viewState.paddingTop,{docHeight:a}=t.viewState,{x:c,y:d}=e,u=d-h;if(u<0)return 0;if(u>a)return t.state.doc.length;for(let e=t.viewState.heightOracle.textHeight/2,s=!1;r=t.elementAtHeight(u),r.type!=ft.Text;)for(;u=o>0?r.bottom+e:r.top-e,!(u>=0&&u<=a);){if(s)return i?null:0;s=!0,o=-o}d=h+u;let f=r.from;if(f<t.viewport.from)return 0==t.viewport.from?0:i?null:Le(t,l,r,c,d);if(f>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:Le(t,l,r,c,d);let p=t.dom.ownerDocument,g=t.root.elementFromPoint?t.root:p,m=g.elementFromPoint(c,d);m&&!t.contentDOM.contains(m)&&(m=null),m||(c=Math.max(l.left+1,Math.min(l.right-1,c)),m=g.elementFromPoint(c,d),m&&!t.contentDOM.contains(m)&&(m=null));let w,v=-1;if(m&&0!=(null===(s=t.docView.nearest(m))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,d);t&&({offsetNode:w,offset:v}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,d);e&&(({startContainer:w,startOffset:v}=e),(!t.contentDOM.contains(w)||Q.safari&&function(t,e,i){let o;if(3!=t.nodeType||e!=(o=t.nodeValue.length))return!1;for(let e=t.nextSibling;e;e=e.nextSibling)if(1!=e.nodeType||"BR"!=e.nodeName)return!1;return D(t,o-1,o).getBoundingClientRect().left>i}(w,v,c)||Q.chrome&&function(t,e,i){if(0!=e)return!1;for(let e=t;;){let t=e.parentNode;if(!t||1!=t.nodeType||t.firstChild!=e)return!1;if(t.classList.contains("cm-line"))break;e=t}return i-(1==t.nodeType?t.getBoundingClientRect():D(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}(w,v,c))&&(w=void 0))}if(!w||!t.docView.dom.contains(w)){let e=ct.find(t.docView,f);if(!e)return u>r.top+r.height/2?r.to:r.from;({node:w,offset:v}=Oe(e.dom,c,d))}let b=t.docView.nearest(w);if(!b)return null;if(b.isWidget&&1==(null===(n=b.dom)||void 0===n?void 0:n.nodeType)){let t=b.dom.getBoundingClientRect();return e.y<t.top||e.y<=t.bottom&&e.x<=(t.left+t.right)/2?b.posAtStart:b.posAtEnd}return b.localPosFromDOM(w,v)+b.posAtStart}function Le(t,e,i,s,n){let r=Math.round((s-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>1.5*t.defaultLineHeight){let e=t.viewState.heightOracle.textHeight;r+=Math.floor((n-i.top-.5*(t.defaultLineHeight-e))/e)*t.viewState.heightOracle.lineLength}let l=t.state.sliceDoc(i.from,i.to);return i.from+(0,o.findColumn)(l,r,t.state.tabSize)}function Be(t,e){let i=t.lineBlockAt(e);if(Array.isArray(i.type))for(let t of i.type)if(t.to>e||t.to==e&&(t.to==i.to||t.type==ft.Text))return t;return i}function Pe(t,e,i,o){let s=t.state.doc.lineAt(e.head),n=t.bidiSpans(s),r=t.textDirectionAt(s.from);for(let l=e,h=null;;){let e=It(s,n,r,l,i),a=zt;if(!e){if(s.number==(i?t.state.doc.lines:1))return l;a="\n",s=t.state.doc.line(s.number+(i?1:-1)),n=t.bidiSpans(s),e=t.visualLineSide(s,!i)}if(h){if(!h(a))return l}else{if(!o)return e;h=o(a)}l=e}}function He(t,e,i){for(;;){let o=0;for(let s of t)s.between(e-1,e+1,((t,s,n)=>{if(e>t&&e<s){let n=o||i||(e-t<s-e?-1:1);e=n<0?t:s,o=n}}));if(!o)return e}}function Ve(t,e,i){let s=He(t.state.facet(ue).map((e=>e(t))),i.from,e.head>i.from?-1:1);return s==i.from?i:o.EditorSelection.cursor(s,s<i.from?1:-1)}class Ne{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,Q.safari&&t.contentDOM.addEventListener("input",(()=>null)),Q.gecko&&function(t){ci.has(t)||(ci.add(t),t.addEventListener("copy",(()=>{})),t.addEventListener("cut",(()=>{})))}(t.contentDOM.ownerDocument)}handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i,o=e.target;o!=t.contentDOM;o=o.parentNode)if(!o||11==o.nodeType||(i=H.get(o))&&i.ignoreEvent(e))return!1;return!0})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||this.runHandlers(t.type,t))}runHandlers(t,e){let i=this.handlers[t];if(i){for(let t of i.observers)t(this.view,e);for(let t of i.handlers){if(e.defaultPrevented)break;if(t(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=We(t),i=this.handlers,o=this.view.contentDOM;for(let t in e)if("scroll"!=t){let s=!e[t].handlers.length,n=i[t];n&&s!=!n.handlers.length&&(o.removeEventListener(t,this.handleEvent),n=null),n||o.addEventListener(t,this.handleEvent,{passive:s})}for(let t in i)"scroll"==t||e[t]||o.removeEventListener(t,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=t.keyCode&&Ke.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Q.android&&Q.chrome&&!t.synthetic&&(13==t.keyCode||8==t.keyCode))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return!Q.ios||t.synthetic||t.altKey||t.metaKey||!((e=ze.find((e=>e.keyCode==t.keyCode)))&&!t.ctrlKey||Ie.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&!("Enter"==e.key&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString()))&&(this.pendingIOSKey=void 0,T(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Q.safari&&!Q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Fe(t,e){return(i,o)=>{try{return e.call(t,o,i)}catch(t){ie(i.state,t)}}}function We(t){let e=Object.create(null);function i(t){return e[t]||(e[t]={observers:[],handlers:[]})}for(let e of t){let t=e.spec;if(t&&t.domEventHandlers)for(let o in t.domEventHandlers){let s=t.domEventHandlers[o];s&&i(o).handlers.push(Fe(e.value,s))}if(t&&t.domEventObservers)for(let o in t.domEventObservers){let s=t.domEventObservers[o];s&&i(o).observers.push(Fe(e.value,s))}}for(let t in _e)i(t).handlers.push(_e[t]);for(let t in Xe)i(t).observers.push(Xe[t]);return e}const ze=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Ie="dthko",Ke=[16,17,18,20,91,92,224,225];function qe(t){return.7*Math.max(0,t)+8}class Ye{constructor(t,e,i,s){this.view=t,this.startEvent=e,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=function(t){let e=t.ownerDocument;for(let i=t.parentNode;i&&i!=e.body;)if(1==i.nodeType){if(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.assignedSlot||i.parentNode}else{if(11!=i.nodeType)break;i=i.host}return null}(t.contentDOM),this.atoms=t.state.facet(ue).map((e=>e(t)));let n=t.contentDOM.ownerDocument;n.addEventListener("mousemove",this.move=this.move.bind(this)),n.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(o.EditorState.allowMultipleSelections)&&function(t,e){let i=t.state.facet(qt);return i.length?i[0](e):Q.mac?e.metaKey:e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let o=d(t.root);if(!o||0==o.rangeCount)return!0;let s=o.getRangeAt(0).getClientRects();for(let t=0;t<s.length;t++){let i=s[t];if(i.left<=e.clientX&&i.right>=e.clientX&&i.top<=e.clientY&&i.bottom>=e.clientY)return!0}return!1}(t,e)||1!=si(e))&&null}start(t){!1===this.dragging&&this.select(t)}move(t){var e,i,o;if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(i=this.startEvent,o=t,Math.max(Math.abs(i.clientX-o.clientX),Math.abs(i.clientY-o.clientY))<10))return;this.select(this.lastEvent=t);let s=0,n=0,r=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},l=me(this.view);t.clientX-l.left<=r.left+6?s=-qe(r.left-t.clientX):t.clientX+l.right>=r.right-6&&(s=qe(t.clientX-r.right)),t.clientY-l.top<=r.top+6?n=-qe(r.top-t.clientY):t.clientY+l.bottom>=r.bottom-6&&(n=qe(t.clientY-r.bottom)),this.setScrollSpeed(s,n)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let i=0;i<t.ranges.length;i++){let s=t.ranges[i],n=null;if(s.empty){let t=He(this.atoms,s.from,0);t!=s.from&&(n=o.EditorSelection.cursor(t,-1))}else{let t=He(this.atoms,s.from,-1),e=He(this.atoms,s.to,1);t==s.from&&e==s.to||(n=o.EditorSelection.range(s.from==s.anchor?t:e,s.from==s.head?t:e))}n&&(e||(e=t.ranges.slice()),e[i]=n)}return e?o.EditorSelection.create(e,t.mainIndex):t}select(t){let{view:e}=this,i=this.skipAtoms(this.style.get(t,this.extend,this.multiple));!this.mustSelect&&i.eq(e.state.selection,!1===this.dragging)||this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some((t=>t.isUserEvent("input.type")))?this.destroy():this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}const _e=Object.create(null),Xe=Object.create(null),je=Q.ie&&Q.ie_version<15||Q.ios&&Q.webkit_version<604;function Ge(t,e){let i,{state:s}=t,n=1,r=s.toText(e),l=r.lines==s.selection.ranges.length;if(null!=ri&&s.selection.ranges.every((t=>t.empty))&&ri==r.toString()){let t=-1;i=s.changeByRange((i=>{let h=s.doc.lineAt(i.from);if(h.from==t)return{range:i};t=h.from;let a=s.toText((l?r.line(n++).text:e)+s.lineBreak);return{changes:{from:h.from,insert:a},range:o.EditorSelection.cursor(i.from+a.length)}}))}else i=l?s.changeByRange((t=>{let e=r.line(n++);return{changes:{from:t.from,to:t.to,insert:e.text},range:o.EditorSelection.cursor(t.from+e.length)}})):s.replaceSelection(r);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function Ue(t,e,i,s){if(1==s)return o.EditorSelection.cursor(e,i);if(2==s)return function(t,e,i=1){let s=t.charCategorizer(e),n=t.doc.lineAt(e),r=e-n.from;if(0==n.length)return o.EditorSelection.cursor(e);0==r?i=1:r==n.length&&(i=-1);let l=r,h=r;i<0?l=(0,o.findClusterBreak)(n.text,r,!1):h=(0,o.findClusterBreak)(n.text,r);let a=s(n.text.slice(l,h));for(;l>0;){let t=(0,o.findClusterBreak)(n.text,l,!1);if(s(n.text.slice(t,l))!=a)break;l=t}for(;h<n.length;){let t=(0,o.findClusterBreak)(n.text,h);if(s(n.text.slice(h,t))!=a)break;h=t}return o.EditorSelection.range(l+n.from,h+n.from)}(t.state,e,i);{let i=ct.find(t.docView,e),s=t.state.doc.lineAt(i?i.posAtEnd:e),n=i?i.posAtStart:s.from,r=i?i.posAtEnd:s.to;return r<t.state.doc.length&&r==s.to&&r++,o.EditorSelection.range(n,r)}}Xe.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},_e.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),27==e.keyCode&&0!=t.inputState.tabFocusMode&&(t.inputState.tabFocusMode=Date.now()+2e3),!1),Xe.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Xe.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},_e.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let i=null;for(let o of t.state.facet(_t))if(i=o(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=Ze(t,e),s=si(e),n=t.state.selection;return{update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),n=n.map(t.changes))},get(e,r,l){let h,a=Ze(t,e),c=Ue(t,a.pos,a.bias,s);if(i.pos!=a.pos&&!r){let e=Ue(t,i.pos,i.bias,s),n=Math.min(e.from,c.from),r=Math.max(e.to,c.to);c=n<c.from?o.EditorSelection.range(n,r):o.EditorSelection.range(r,n)}return r?n.replaceRange(n.main.extend(c.from,c.to)):l&&1==s&&n.ranges.length>1&&(h=function(t,e){for(let i=0;i<t.ranges.length;i++){let{from:s,to:n}=t.ranges[i];if(s<=e&&n>=e)return o.EditorSelection.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}(n,a.pos))?h:l?n.addRange(c):o.EditorSelection.create([c])}}}(t,e)),i){let o=!t.hasFocus;t.inputState.startMouseSelection(new Ye(t,e,i,o)),o&&t.observer.ignore((()=>{A(t.contentDOM);let e=t.root.activeElement;e&&!e.contains(t.contentDOM)&&e.blur()}));let s=t.inputState.mouseSelection;if(s)return s.start(e),!1===s.dragging}return!1};let $e=(t,e)=>t>=e.top&&t<=e.bottom,Qe=(t,e,i)=>$e(e,i)&&t>=i.left&&t<=i.right;function Je(t,e,i,o){let s=ct.find(t.docView,e);if(!s)return 1;let n=e-s.posAtStart;if(0==n)return 1;if(n==s.length)return-1;let r=s.coordsAt(n,-1);if(r&&Qe(i,o,r))return-1;let l=s.coordsAt(n,1);return l&&Qe(i,o,l)?1:r&&$e(o,r)?-1:1}function Ze(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:Je(t,i,e.clientX,e.clientY)}}const ti=Q.ie&&Q.ie_version<=11;let ei=null,ii=0,oi=0;function si(t){if(!ti)return t.detail;let e=ei,i=oi;return ei=t,oi=Date.now(),ii=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(ii+1)%3:1}function ni(t,e,i,o){if(!i)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:n}=t.inputState,r=o&&n&&function(t,e){let i=t.state.facet(Yt);return i.length?i[0](e):Q.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:n.from,to:n.to}:null,l={from:s,insert:i},h=t.state.changes(r?[r,l]:l);t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(s,-1),head:h.mapPos(s,1)},userEvent:r?"move.drop":"input.drop"}),t.inputState.draggedContent=null}_e.dragstart=(t,e)=>{let{selection:{main:i}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let t=s.posAtStart,e=t+s.length;(t>=i.to||e<=i.from)&&(i=o.EditorSelection.range(t,e))}}let{inputState:s}=t;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove"),!1},_e.dragend=t=>(t.inputState.draggedContent=null,!1),_e.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let i=e.dataTransfer.files;if(i&&i.length){let o=Array(i.length),s=0,n=()=>{++s==i.length&&ni(t,e,o.filter((t=>null!=t)).join(t.state.lineBreak),!1)};for(let t=0;t<i.length;t++){let e=new FileReader;e.onerror=n,e.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(o[t]=e.result),n()},e.readAsText(i[t])}return!0}{let i=e.dataTransfer.getData("Text");if(i)return ni(t,e,i,!0),!0}return!1},_e.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let i=je?null:e.clipboardData;return i?(Ge(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(function(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout((()=>{t.focus(),i.remove(),Ge(t,i.value)}),50)}(t),!1)};let ri=null;_e.copy=_e.cut=(t,e)=>{let{text:i,ranges:o,linewise:s}=function(t){let e=[],i=[],o=!1;for(let o of t.selection.ranges)o.empty||(e.push(t.sliceDoc(o.from,o.to)),i.push(o));if(!e.length){let s=-1;for(let{from:o}of t.selection.ranges){let n=t.doc.lineAt(o);n.number>s&&(e.push(n.text),i.push({from:n.from,to:Math.min(t.doc.length,n.to+1)})),s=n.number}o=!0}return{text:e.join(t.lineBreak),ranges:i,linewise:o}}(t.state);if(!i&&!s)return!1;ri=s?i:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:o,scrollIntoView:!0,userEvent:"delete.cut"});let n=je?null:e.clipboardData;return n?(n.clearData(),n.setData("text/plain",i),!0):(function(t,e){let i=t.dom.parentNode;if(!i)return;let o=i.appendChild(document.createElement("textarea"));o.style.cssText="position: fixed; left: -10000px; top: 10px",o.value=e,o.focus(),o.selectionEnd=e.length,o.selectionStart=0,setTimeout((()=>{o.remove(),t.focus()}),50)}(t,i),!1)};const li=o.Annotation.define();function hi(t,e){let i=[];for(let o of t.facet(Ut)){let s=o(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:li.of(!0)}):null}function ai(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=hi(t.state,e);i?t.dispatch(i):t.update([])}}),10)}Xe.focus=t=>{t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),ai(t)},Xe.blur=t=>{t.observer.clearSelectionRange(),ai(t)},Xe.compositionstart=Xe.compositionupdate=t=>{t.observer.editContext||(null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))},Xe.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Q.chrome&&Q.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])}),50))},Xe.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},_e.beforeinput=(t,e)=>{var i;let o;if(Q.chrome&&Q.android&&(o=ze.find((t=>t.inputType==e.inputType)))&&(t.observer.delayAndroidKey(o.key,o.keyCode),"Backspace"==o.key||"Delete"==o.key)){let e=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout((()=>{var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>e+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)}return Q.ios&&"deleteContentForward"==e.inputType&&t.observer.flushSoon(),Q.safari&&"insertText"==e.inputType&&t.inputState.composing>=0&&setTimeout((()=>Xe.compositionend(t,e)),20),!1};const ci=new Set,di=["pre-wrap","normal","pre-line","break-spaces"];class ui{constructor(t){this.lineWrapping=t,this.doc=o.Text.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return di.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i<t.length;i++){let o=t[i];o<0?i++:this.heightSamples[Math.floor(10*o)]||(e=!0,this.heightSamples[Math.floor(10*o)]=!0)}return e}refresh(t,e,i,o,s,n){let r=di.indexOf(t)>-1,l=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=r;if(this.lineWrapping=r,this.lineHeight=e,this.charWidth=i,this.textHeight=o,this.lineLength=s,l){this.heightSamples={};for(let t=0;t<n.length;t++){let e=n[t];e<0?t++:this.heightSamples[Math.floor(10*e)]=!0}}return l}}class fi{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class pi{constructor(t,e,i,o,s){this.from=t,this.length=e,this.top=i,this.height=o,this._content=s}get type(){return"number"==typeof this._content?ft.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof wt?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(t){let e=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new pi(this.from,this.length+t.length,this.top,this.height+t.height,e)}}var gi=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(gi||(gi={}));const mi=.001;class wi{constructor(t,e,i=2){this.length=t,this.height=e,this.flags=i}get outdated(){return(2&this.flags)>0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>mi&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return wi.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,o){let s=this,n=i.doc;for(let r=o.length-1;r>=0;r--){let{fromA:l,toA:h,fromB:a,toB:c}=o[r],d=s.lineAt(l,gi.ByPosNoHeight,i.setDoc(e),0,0),u=d.to>=h?d:s.lineAt(h,gi.ByPosNoHeight,i,0,0);for(c+=u.to-h,h=u.to;r>0&&d.from<=o[r-1].toA;)l=o[r-1].fromA,a=o[r-1].fromB,r--,l<d.from&&(d=s.lineAt(l,gi.ByPosNoHeight,i,0,0));a+=d.from-l,l=d.from;let f=Ci.build(i.setDoc(n),t,a,c);s=s.replace(l,h,f)}return s.updateHeight(i,0)}static empty(){return new bi(0,0)}static of(t){if(1==t.length)return t[0];let e=0,i=t.length,o=0,s=0;for(;;)if(e==i)if(o>2*s){let s=t[e-1];s.break?t.splice(--e,1,s.left,null,s.right):t.splice(--e,1,s.left,s.right),i+=1+s.break,o-=s.size}else{if(!(s>2*o))break;{let e=t[i];e.break?t.splice(i,1,e.left,null,e.right):t.splice(i,1,e.left,e.right),i+=2+e.break,s-=e.size}}else if(o<s){let i=t[e++];i&&(o+=i.size)}else{let e=t[--i];e&&(s+=e.size)}let n=0;return null==t[e-1]?(n=1,e--):null==t[e]&&(n=1,i++),new Si(wi.of(t.slice(0,e)),n,wi.of(t.slice(i)))}}wi.prototype.size=1;class vi extends wi{constructor(t,e,i){super(t,e),this.deco=i}blockAt(t,e,i,o){return new pi(o,this.length,i,this.height,this.deco||0)}lineAt(t,e,i,o,s){return this.blockAt(0,i,o,s)}forEachLine(t,e,i,o,s,n){t<=s+this.length&&e>=s&&n(this.blockAt(0,i,o,s))}updateHeight(t,e=0,i=!1,o){return o&&o.from<=e&&o.more&&this.setHeight(t,o.heights[o.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class bi extends vi{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,i,o){return new pi(o,this.length,i,this.height,this.breaks)}replace(t,e,i){let o=i[0];return 1==i.length&&(o instanceof bi||o instanceof yi&&4&o.flags)&&Math.abs(this.length-o.length)<10?(o instanceof yi?o=new bi(o.length,this.height):o.height=this.height,this.outdated||(o.outdated=!1),o):wi.of(i)}updateHeight(t,e=0,i=!1,o){return o&&o.from<=e&&o.more?this.setHeight(t,o.heights[o.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class yi extends wi{constructor(t){super(t,0)}heightMetrics(t,e){let i,o=t.doc.lineAt(e).number,s=t.doc.lineAt(e+this.length).number,n=s-o+1,r=0;if(t.lineWrapping){let e=Math.min(this.height,t.lineHeight*n);i=e/n,this.length>n+1&&(r=(this.height-e)/(this.length-n-1))}else i=this.height/n;return{firstLine:o,lastLine:s,perLine:i,perChar:r}}blockAt(t,e,i,o){let{firstLine:s,lastLine:n,perLine:r,perChar:l}=this.heightMetrics(e,o);if(e.lineWrapping){let s=o+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length)),n=e.doc.lineAt(s),h=r+n.length*l,a=Math.max(i,t-h/2);return new pi(n.from,n.length,a,h,0)}{let o=Math.max(0,Math.min(n-s,Math.floor((t-i)/r))),{from:l,length:h}=e.doc.line(s+o);return new pi(l,h,i+r*o,r,0)}}lineAt(t,e,i,o,s){if(e==gi.ByHeight)return this.blockAt(t,i,o,s);if(e==gi.ByPosNoHeight){let{from:e,to:o}=i.doc.lineAt(t);return new pi(e,o-e,0,0,0)}let{firstLine:n,perLine:r,perChar:l}=this.heightMetrics(i,s),h=i.doc.lineAt(t),a=r+h.length*l,c=h.number-n,d=o+r*c+l*(h.from-s-c);return new pi(h.from,h.length,Math.max(o,Math.min(d,o+this.height-a)),a,0)}forEachLine(t,e,i,o,s,n){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:r,perLine:l,perChar:h}=this.heightMetrics(i,s);for(let a=t,c=o;a<=e;){let e=i.doc.lineAt(a);if(a==t){let i=e.number-r;c+=l*i+h*(t-s-i)}let o=l+h*e.length;n(new pi(e.from,e.length,c,o,0)),c+=o,a=e.to+1}}replace(t,e,i){let o=this.length-e;if(o>0){let t=i[i.length-1];t instanceof yi?i[i.length-1]=new yi(t.length+o):i.push(null,new yi(o-1))}if(t>0){let e=i[0];e instanceof yi?i[0]=new yi(t+e.length):i.unshift(new yi(t-1),null)}return wi.of(i)}decomposeLeft(t,e){e.push(new yi(t-1),null)}decomposeRight(t,e){e.push(null,new yi(this.length-t-1))}updateHeight(t,e=0,i=!1,o){let s=e+this.length;if(o&&o.from<=e+this.length&&o.more){let i=[],n=Math.max(e,o.from),r=-1;for(o.from>e&&i.push(new yi(o.from-e-1).updateHeight(t,e));n<=s&&o.more;){let e=t.doc.lineAt(n).length;i.length&&i.push(null);let s=o.heights[o.index++];-1==r?r=s:Math.abs(s-r)>=mi&&(r=-2);let l=new bi(e,s);l.outdated=!1,i.push(l),n+=e+1}n<=s&&i.push(null,new yi(s-n).updateHeight(t,n));let l=wi.of(i);return(r<0||Math.abs(l.height-this.height)>=mi||Math.abs(r-this.heightMetrics(t,e).perLine)>=mi)&&(t.heightChanged=!0),l}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Si extends wi{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return 1&this.flags}blockAt(t,e,i,o){let s=i+this.left.height;return t<s?this.left.blockAt(t,e,i,o):this.right.blockAt(t,e,s,o+this.left.length+this.break)}lineAt(t,e,i,o,s){let n=o+this.left.height,r=s+this.left.length+this.break,l=e==gi.ByHeight?t<n:t<r,h=l?this.left.lineAt(t,e,i,o,s):this.right.lineAt(t,e,i,n,r);if(this.break||(l?h.to<r:h.from>r))return h;let a=e==gi.ByPosNoHeight?gi.ByPosNoHeight:gi.ByPos;return l?h.join(this.right.lineAt(r,a,i,n,r)):this.left.lineAt(r,a,i,o,s).join(h)}forEachLine(t,e,i,o,s,n){let r=o+this.left.height,l=s+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,e,i,o,s,n),e>=l&&this.right.forEachLine(t,e,i,r,l,n);else{let h=this.lineAt(l,gi.ByPos,i,o,s);t<h.from&&this.left.forEachLine(t,h.from-1,i,o,s,n),h.to>=t&&h.from<=e&&n(h),e>h.to&&this.right.forEachLine(h.to+1,e,i,r,l,n)}}replace(t,e,i){let o=this.left.length+this.break;if(e<o)return this.balanced(this.left.replace(t,e,i),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-o,e-o,i));let s=[];t>0&&this.decomposeLeft(t,s);let n=s.length;for(let t of i)s.push(t);if(t>0&&xi(s,n-1),e<this.length){let t=s.length;this.decomposeRight(e,s),xi(s,t)}return wi.of(s)}decomposeLeft(t,e){let i=this.left.length;if(t<=i)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&(i++,t>=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,o=i+this.break;if(t>=o)return this.right.decomposeRight(t-o,e);t<i&&this.left.decomposeRight(t,e),this.break&&t<o&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?wi.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,o){let{left:s,right:n}=this,r=e+s.length+this.break,l=null;return o&&o.from<=e+s.length&&o.more?l=s=s.updateHeight(t,e,i,o):s.updateHeight(t,e,i),o&&o.from<=r+n.length&&o.more?l=n=n.updateHeight(t,r,i,o):n.updateHeight(t,r,i),l?this.balanced(s,n):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function xi(t,e){let i,o;null==t[e]&&(i=t[e-1])instanceof yi&&(o=t[e+1])instanceof yi&&t.splice(e-1,3,new yi(i.length+1+o.length))}class Ci{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let t=Math.min(e,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof bi?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new bi(t-this.pos,-1)),this.writtenTo=t,e>t&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t<e||i.heightRelevant){let o=i.widget?i.widget.estimatedHeight:0,s=i.widget?i.widget.lineBreaks:0;o<0&&(o=this.oracle.lineHeight);let n=e-t;i.block?this.addBlock(new vi(n,o,i)):(n||s||o>=5)&&this.addLineDeco(o,s,n)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new bi(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new yi(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof bi)return t;let e=new bi(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,i){let o=this.ensureLine();o.length+=i,o.collapsed+=i,o.widgetHeight=Math.max(o.widgetHeight,t),o.breaks+=e,this.writtenTo=this.pos=this.pos+i}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof bi||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new bi(0,-1));let i=t;for(let t of this.nodes)t instanceof bi&&t.updateHeight(this.oracle,i),i+=t?t.length:1;return this.nodes}static build(t,e,i,s){let n=new Ci(i,t);return o.RangeSet.spans(e,i,s,n,0),n.finish(i)}}class Mi{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,i,o){(t<e||i&&i.heightRelevant||o&&o.heightRelevant)&&bt(t,e,this.changes,5)}}function ki(t,e){let i=t.getBoundingClientRect(),o=t.ownerDocument,s=o.defaultView||window,n=Math.max(0,i.left),r=Math.min(s.innerWidth,i.right),l=Math.max(0,i.top),h=Math.min(s.innerHeight,i.bottom);for(let e=t.parentNode;e&&e!=o.body;)if(1==e.nodeType){let i=e,o=window.getComputedStyle(i);if((i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)&&"visible"!=o.overflow){let o=i.getBoundingClientRect();n=Math.max(n,o.left),r=Math.min(r,o.right),l=Math.max(l,o.top),h=e==t.parentNode?o.bottom:Math.min(h,o.bottom)}e="absolute"==o.position||"fixed"==o.position?i.offsetParent:i.parentNode}else{if(11!=e.nodeType)break;e=e.host}return{left:n-i.left,right:Math.max(n,r)-i.left,top:l-(i.top+e),bottom:Math.max(l,h)-(i.top+e)}}function Ai(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class Di{constructor(t,e,i){this.from=t,this.to=e,this.size=i}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++){let o=t[i],s=e[i];if(o.from!=s.from||o.to!=s.to||o.size!=s.size)return!1}return!0}draw(t,e){return pt.replace({widget:new Ti(this.size*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}}class Ti extends ut{constructor(t,e){super(),this.size=t,this.vertical=e}eq(t){return t.size==this.size&&t.vertical==this.vertical}toDOM(){let t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}get estimatedHeight(){return this.vertical?this.size:-1}}class Oi{constructor(t){this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Bi,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Ct.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let e=t.facet(ae).some((t=>"function"!=typeof t&&"cm-lineWrapping"==t.class));this.heightOracle=new ui(e),this.stateDeco=t.facet(ce).filter((t=>"function"!=typeof t)),this.heightMap=wi.empty().applyChanges(this.stateDeco,o.Text.empty,this.heightOracle.setDoc(t.doc),[new ve(0,0,0,t.doc.length)]);for(let t=0;t<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());t++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=pt.set(this.lineGaps.map((t=>t.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let o=i?e.head:e.anchor;if(!t.some((({from:t,to:e})=>o>=t&&o<=e))){let{from:e,to:i}=this.lineBlockAt(o);t.push(new Ei(e,i))}}return this.viewports=t.sort(((t,e)=>t.from-e.from)),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?Bi:new Pi(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(t=>{this.viewportLines.push(Hi(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(ce).filter((t=>"function"!=typeof t));let s=t.changedRanges,n=ve.extendWithRanges(s,function(t,e,i){let s=new Mi;return o.RangeSet.compare(t,e,i,s,0),s.changes}(i,this.stateDeco,t?t.changes:o.ChangeSet.empty(this.state.doc.length))),r=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),n),this.heightMap.height!=r&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let h=n.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<h.from||e.range.head>h.to)||!this.viewportIsAppropriate(h))&&(h=this.getViewport(0,e));let a=h.from!=this.viewport.from||h.to!=this.viewport.to;this.viewport=h,t.flags|=this.updateForViewport(),(a||!t.changes.empty||2&t.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(Qt)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,i=window.getComputedStyle(e),s=this.heightOracle,n=i.whiteSpace;this.defaultTextDirection="rtl"==i.direction?Ct.RTL:Ct.LTR;let r=this.heightOracle.mustRefreshForWrapping(n),l=e.getBoundingClientRect(),h=r||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let a=0,c=0;if(l.width&&l.height){let{scaleX:t,scaleY:i}=x(e,l);(t>.005&&Math.abs(this.scaleX-t)>.005||i>.005&&Math.abs(this.scaleY-i)>.005)&&(this.scaleX=t,this.scaleY=i,a|=8,r=h=!0)}let d=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;this.paddingTop==d&&this.paddingBottom==u||(this.paddingTop=d,this.paddingBottom=u,a|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(h=!0),this.editorWidth=t.scrollDOM.clientWidth,a|=8);let f=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=f&&(this.scrollAnchorHeight=-1,this.scrollTop=f),this.scrolledToBottom=E(t.scrollDOM);let p=(this.printing?Ai:ki)(e,this.paddingTop),g=p.top-this.pixelViewport.top,m=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(h=!0)),!this.inView&&!this.scrollTarget)return 0;let v=l.width;if(this.contentDOMWidth==v&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,a|=8),h){let e=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(e)&&(r=!0),r||s.lineWrapping&&Math.abs(v-this.contentDOMWidth)>s.charWidth){let{lineHeight:i,charWidth:o,textHeight:l}=t.docView.measureTextSize();r=i>0&&s.refresh(n,i,o,l,v/o,e),r&&(t.docView.minWidth=0,a|=8)}g>0&&m>0?c=Math.max(g,m):g<0&&m<0&&(c=Math.min(g,m)),s.heightChanged=!1;for(let i of this.viewports){let n=i.from==this.viewport.from?e:t.docView.measureVisibleLineHeights(i);this.heightMap=(r?wi.empty().applyChanges(this.stateDeco,o.Text.empty,this.heightOracle,[new ve(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,r,new fi(i.from,n))}s.heightChanged&&(a|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return b&&(2&a&&(a|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),a|=this.updateForViewport()),(2&a||b)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(r?[]:this.lineGaps,t)),a|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),a}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),o=this.heightMap,s=this.heightOracle,{visibleTop:n,visibleBottom:r}=this,l=new Ei(o.lineAt(n-1e3*i,gi.ByHeight,s,0,0).from,o.lineAt(r+1e3*(1-i),gi.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(t<l.from||t>l.to){let i,n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),r=o.lineAt(t,gi.ByPos,s,0,0);i="center"==e.y?(r.top+r.bottom)/2-n/2:"start"==e.y||"nearest"==e.y&&t<l.from?r.top:r.bottom-n,l=new Ei(o.lineAt(i-500,gi.ByHeight,s,0,0).from,o.lineAt(i+n+500,gi.ByHeight,s,0,0).to)}}return l}mapViewport(t,e){let i=e.mapPos(t.from,-1),o=e.mapPos(t.to,1);return new Ei(this.heightMap.lineAt(i,gi.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(o,gi.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:e},i=0){if(!this.inView)return!0;let{top:o}=this.heightMap.lineAt(t,gi.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(e,gi.ByPos,this.heightOracle,0,0),{visibleTop:n,visibleBottom:r}=this;return(0==t||o<=n-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||s>=r+Math.max(10,Math.min(i,250)))&&o>n-2e3&&s<r+2e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let i=[];for(let o of t)e.touchesRange(o.from,o.to)||i.push(new Di(e.mapPos(o.from),e.mapPos(o.to),o.size));return i}ensureLineGaps(t,e){let i=this.heightOracle.lineWrapping,s=i?1e4:2e3,n=s>>1,r=s<<1;if(this.defaultTextDirection!=Ct.LTR&&!i)return[];let l=[],h=(s,r,a,c)=>{if(r-s<n)return;let d=this.state.selection.main,u=[d.from];d.empty||u.push(d.to);for(let t of u)if(t>s&&t<r)return h(s,t-10,a,c),void h(t+10,r,a,c);let f=function(t,e){for(let i of t)if(e(i))return i}(t,(t=>t.from>=a.from&&t.to<=a.to&&Math.abs(t.from-s)<n&&Math.abs(t.to-r)<n&&!u.some((e=>t.from<e&&t.to>e))));if(!f){if(r<a.to&&e&&i&&e.visibleRanges.some((t=>t.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(o.EditorSelection.cursor(r),!1,!0).head;t>s&&(r=t)}f=new Di(s,r,this.gapSize(a,s,r,c))}l.push(f)},a=t=>{if(t.length<r||t.type!=ft.Text)return;let e=function(t,e,i){let s=[],n=t,r=0;return o.RangeSet.spans(i,t,e,{span(){},point(t,e){t>n&&(s.push({from:n,to:t}),r+=t-n),n=e}},20),n<e&&(s.push({from:n,to:e}),r+=e-n),{total:r,ranges:s}}(t.from,t.to,this.stateDeco);if(e.total<r)return;let n,l,a=this.scrollTarget?this.scrollTarget.range.head:null;if(i){let i,o,r=s/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=a){let s=Li(e,a),n=((this.visibleBottom-this.visibleTop)/2+r)/t.height;i=s-n,o=s+n}else i=(this.visibleTop-t.top-r)/t.height,o=(this.visibleBottom-t.top+r)/t.height;n=Ri(e,i),l=Ri(e,o)}else{let t,i,o=e.total*this.heightOracle.charWidth,r=s*this.heightOracle.charWidth;if(null!=a){let s=Li(e,a),n=((this.pixelViewport.right-this.pixelViewport.left)/2+r)/o;t=s-n,i=s+n}else t=(this.pixelViewport.left-r)/o,i=(this.pixelViewport.right+r)/o;n=Ri(e,t),l=Ri(e,i)}n>t.from&&h(t.from,n,t,e),l<t.to&&h(l,t.to,t,e)};for(let t of this.viewportLines)Array.isArray(t.type)?t.type.forEach(a):a(t);return l}gapSize(t,e,i,o){let s=Li(o,i)-Li(o,e);return this.heightOracle.lineWrapping?t.height*s:o.total*this.heightOracle.charWidth*s}updateLineGaps(t){Di.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=pt.set(t.map((t=>t.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];o.RangeSet.spans(t,this.viewport.from,this.viewport.to,{span(t,i){e.push({from:t,to:i})},point(){}},20);let i=e.length!=this.visibleRanges.length||this.visibleRanges.some(((t,i)=>t.from!=e[i].from||t.to!=e[i].to));return this.visibleRanges=e,i?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find((e=>e.from<=t&&e.to>=t))||Hi(this.heightMap.lineAt(t,gi.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find((e=>e.top<=t&&e.bottom>=t))||Hi(this.heightMap.lineAt(this.scaler.fromDOM(t),gi.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return Hi(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Ei{constructor(t,e){this.from=t,this.to=e}}function Ri({total:t,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let o=Math.floor(t*i);for(let t=0;;t++){let{from:i,to:s}=e[t],n=s-i;if(o<=n)return i+o;o-=n}}function Li(t,e){let i=0;for(let{from:o,to:s}of t.ranges){if(e<=s){i+=e-o;break}i+=s-o}return i/t.total}const Bi={toDOM:t=>t,fromDOM:t=>t,scale:1,eq(t){return t==this}};class Pi{constructor(t,e,i){let o=0,s=0,n=0;this.viewports=i.map((({from:i,to:s})=>{let n=e.lineAt(i,gi.ByPos,t,0,0).top,r=e.lineAt(s,gi.ByPos,t,0,0).bottom;return o+=r-n,{from:i,to:s,top:n,bottom:r,domTop:0,domBottom:0}})),this.scale=(7e6-o)/(e.height-o);for(let t of this.viewports)t.domTop=n+(t.top-s)*this.scale,n=t.domBottom=t.domTop+(t.bottom-t.top),s=t.bottom}toDOM(t){for(let e=0,i=0,o=0;;e++){let s=e<this.viewports.length?this.viewports[e]:null;if(!s||t<s.top)return o+(t-i)*this.scale;if(t<=s.bottom)return s.domTop+(t-s.top);i=s.bottom,o=s.domBottom}}fromDOM(t){for(let e=0,i=0,o=0;;e++){let s=e<this.viewports.length?this.viewports[e]:null;if(!s||t<s.domTop)return i+(t-o)/this.scale;if(t<=s.domBottom)return s.top+(t-s.domTop);i=s.bottom,o=s.domBottom}}eq(t){return t instanceof Pi&&this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every(((e,i)=>e.from==t.viewports[i].from&&e.to==t.viewports[i].to))}}function Hi(t,e){if(1==e.scale)return t;let i=e.toDOM(t.top),o=e.toDOM(t.bottom);return new pi(t.from,t.length,i,o-i,Array.isArray(t._content)?t._content.map((t=>Hi(t,e))):t._content)}const Vi=o.Facet.define({combine:t=>t.join(" ")}),Ni=o.Facet.define({combine:t=>t.indexOf(!0)>-1}),Fi=s.V.newName(),Wi=s.V.newName(),zi=s.V.newName(),Ii={"&light":"."+Wi,"&dark":"."+zi};function Ki(t,e,i){return new s.V(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,(e=>{if("&"==e)return t;if(!i||!i[e])throw new RangeError(`Unsupported selector: ${e}`);return i[e]})):t+" "+e})}const qi=Ki("."+Fi,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Ii),Yi="￿";class _i{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(o.EditorState.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Yi}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let o=t;;){this.findPointBefore(i,o);let t=this.text.length;this.readNode(o);let s=o.nextSibling;if(s==e)break;let n=H.get(o),r=H.get(s);(n&&r?n.breakAfter:(n?n.breakAfter:w(o))||w(s)&&("BR"!=o.nodeName||o.cmIgnore)&&this.text.length>t)&&this.lineBreak(),o=s}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,o=this.lineSeparator?null:/\r\n?|\n/g;;){let s,n=-1,r=1;if(this.lineSeparator?(n=e.indexOf(this.lineSeparator,i),r=this.lineSeparator.length):(s=o.exec(e))&&(n=s.index,r=s[0].length),this.append(e.slice(i,n<0?e.length:n)),n<0)break;if(this.lineBreak(),r>1)for(let e of this.points)e.node==t&&e.pos>this.text.length&&(e.pos-=r-1);i=n+r}}readNode(t){if(t.cmIgnore)return;let e=H.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(let t=i.iter();!t.next().done;)t.lineBreak?this.lineBreak():this.append(t.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(3==t.nodeType?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+(Xi(t,i.node,i.offset)?e:0))}}function Xi(t,e,i){for(;;){if(!e||i<b(e))return!1;if(e==t)return!0;i=m(e)+1,e=e.parentNode}}class ji{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class Gi{constructor(t,e,i,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=e>-1;let{impreciseHead:n,impreciseAnchor:r}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){let e=n||r?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:n}=t.observer.selectionRange;return i&&(e.push(new ji(i,o)),s==i&&n==o||e.push(new ji(s,n))),e}(t),i=new _i(e,t.state);i.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=i.text,this.newSel=function(t,e){if(0==t.length)return null;let i=t[0].pos,s=2==t.length?t[1].pos:i;return i>-1&&s>-1?o.EditorSelection.single(i+e,s+e):null}(e,this.bounds.from)}else{let e=t.observer.selectionRange,i=n&&n.node==e.focusNode&&n.offset==e.focusOffset||!u(t.contentDOM,e.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),s=r&&r.node==e.anchorNode&&r.offset==e.anchorOffset||!u(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset),l=t.viewport;if((Q.ios||Q.chrome)&&t.state.selection.main.empty&&i!=s&&(l.from>0||l.to<t.state.doc.length)){let e=Math.min(i,s),o=Math.max(i,s),n=l.from-e,r=l.to-o;0!=n&&1!=n&&0!=e||0!=r&&-1!=r&&o!=t.state.doc.length||(i=0,s=t.state.doc.length)}this.newSel=o.EditorSelection.single(s,i)}}}function Ui(t,e){let i,{newSel:s}=e,n=t.state.selection.main,r=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:s,to:l}=e.bounds,h=n.from,a=null;(8===r||Q.android&&e.text.length<l-s)&&(h=n.to,a="end");let c=function(t,e,i,o){let s=Math.min(t.length,e.length),n=0;for(;n<s&&t.charCodeAt(n)==e.charCodeAt(n);)n++;if(n==s&&t.length==e.length)return null;let r=t.length,l=e.length;for(;r>0&&l>0&&t.charCodeAt(r-1)==e.charCodeAt(l-1);)r--,l--;return"end"==o&&(i-=r+Math.max(0,n-Math.min(r,l))-n),r<n&&t.length<e.length?(n-=i<=n&&i>=r?n-i:0,l=n+(l-r),r=n):l<n&&(n-=i<=n&&i>=l?n-i:0,r=n+(r-l),l=n),{from:n,toA:r,toB:l}}(t.state.doc.sliceString(s,l,Yi),e.text,h-s,a);c&&(Q.chrome&&13==r&&c.toB==c.from+2&&e.text.slice(c.from,c.toB)==Yi+Yi&&c.toB--,i={from:s+c.from,to:s+c.toA,insert:o.Text.of(e.text.slice(c.from,c.toB).split(Yi))})}else s&&(!t.hasFocus&&t.state.facet(oe)||s.main.eq(n))&&(s=null);if(!i&&!s)return!1;if(!i&&e.typeOver&&!n.empty&&s&&s.main.empty?i={from:n.from,to:n.to,insert:t.state.doc.slice(n.from,n.to)}:i&&i.from>=n.from&&i.to<=n.to&&(i.from!=n.from||i.to!=n.to)&&n.to-n.from-(i.to-i.from)<=4?i={from:n.from,to:n.to,insert:t.state.doc.slice(n.from,i.from).append(i.insert).append(t.state.doc.slice(i.to,n.to))}:(Q.mac||Q.android)&&i&&i.from==i.to&&i.from==n.head-1&&/^\. ?$/.test(i.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(s&&2==i.insert.length&&(s=o.EditorSelection.single(s.main.anchor-1,s.main.head-1)),i={from:n.from,to:n.to,insert:o.Text.of([" "])}):Q.chrome&&i&&i.from==i.to&&i.from==n.head&&"\n "==i.insert.toString()&&t.lineWrapping&&(s&&(s=o.EditorSelection.single(s.main.anchor-1,s.main.head-1)),i={from:n.from,to:n.to,insert:o.Text.of([" "])}),i)return $i(t,i,s,r);if(s&&!s.main.eq(n)){let e=!1,i="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(e=!0),i=t.inputState.lastSelectionOrigin),t.dispatch({selection:s,scrollIntoView:e,userEvent:i}),!0}return!1}function $i(t,e,i,s=-1){if(Q.ios&&t.inputState.flushIOSKey(e))return!0;let n=t.state.selection.main;if(Q.android&&(e.to==n.to&&(e.from==n.from||e.from==n.from-1&&" "==t.state.sliceDoc(e.from,n.from))&&1==e.insert.length&&2==e.insert.lines&&T(t.contentDOM,"Enter",13)||(e.from==n.from-1&&e.to==n.to&&0==e.insert.length||8==s&&e.insert.length<e.to-e.from&&e.to>n.head)&&T(t.contentDOM,"Backspace",8)||e.from==n.from&&e.to==n.to+1&&0==e.insert.length&&T(t.contentDOM,"Delete",46)))return!0;let r,l=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let h=()=>r||(r=function(t,e,i){let s,n=t.state,r=n.selection.main;if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let i=r.from<e.from?n.sliceDoc(r.from,e.from):"",o=r.to>e.to?n.sliceDoc(e.to,r.to):"";s=n.replaceSelection(t.state.toText(i+e.insert.sliceString(0,void 0,t.state.lineBreak)+o))}else{let l=n.changes(e),h=i&&i.main.to<=l.newLength?i.main:void 0;if(n.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=r.to&&e.to>=r.to-10){let a,c=t.state.sliceDoc(e.from,e.to),d=i&&xe(t,i.main.head);if(d){let t=e.insert.length-(e.to-e.from);a={from:d.from,to:d.to-t}}else a=t.state.doc.lineAt(r.head);let u=r.to-e.to,f=r.to-r.from;s=n.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:l,range:h||i.map(l)};let s=i.to-u,d=s-c.length;if(i.to-i.from!=f||t.state.sliceDoc(d,s)!=c||i.to>=a.from&&i.from<=a.to)return{range:i};let p=n.changes({from:d,to:s,insert:e.insert}),g=i.to-r.to;return{changes:p,range:h?o.EditorSelection.range(Math.max(0,h.anchor+g),Math.max(0,h.head+g)):i.map(p)}}))}else s={changes:l,selection:h&&n.selection.replaceRange(h)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),n.update(s,{userEvent:l,scrollIntoView:!0})}(t,e,i));return t.state.facet(Gt).some((i=>i(t,e.from,e.to,l,h)))||t.dispatch(h()),!0}const Qi={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Ji=Q.ie&&Q.ie_version<=11;class Zi{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new C,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver((e=>{for(let t of e)this.queue.push(t);(Q.ie&&Q.ie_version<=11||Q.ios&&t.composing)&&e.some((t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():this.flush()})),!window.EditContext||!1===t.constructor.EDIT_CONTEXT||Q.chrome&&Q.chrome_version<126||(this.editContext=new io(t),t.state.facet(oe)&&(t.contentDOM.editContext=this.editContext.editContext)),Ji&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()})),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(t){("change"!=t.type||t.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout((()=>{this.view.viewState.printing=!1,this.view.requestMeasure()}),500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some(((e,i)=>e!=t[i])))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,o=this.selectionRange;if(i.state.facet(oe)?i.root.activeElement!=this.dom:!f(i.dom,o))return;let s=o.anchorNode&&i.docView.nearest(o.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(Q.ie&&Q.ie_version<=11||Q.android&&Q.chrome)&&!i.state.selection.main.empty&&o.focusNode&&g(o.focusNode,o.focusOffset,o.anchorNode,o.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=d(t.root);if(!e)return!1;let i=Q.safari&&11==t.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return eo(t,i)}let i=null;function o(t){t.preventDefault(),t.stopImmediatePropagation(),i=t.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",o,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",o,!0),i?eo(t,i):null}(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;let o=f(this.dom,i);return o&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){let i=e.focusNode,o=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=o)return!1;for(o=Math.min(o,b(i));;)if(o){if(1!=i.nodeType)return!1;let t=i.childNodes[o-1];"false"==t.contentEditable?o--:(i=t,o=b(i))}else{if(i==t)return!0;o=m(i),i=i.parentNode}}(this.dom,i)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(i),o&&(this.selectionChanged=!0),!0)}setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let t=0,e=null;for(let i=this.dom;i;)if(1==i.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==i?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(i),i=i.assignedSlot||i.parentNode;else{if(11!=i.nodeType)break;i=i.host}if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);for(let t of this.scrollTargets=e)t.addEventListener("scroll",this.onScroll)}}ignore(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Qi),Ji&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Ji&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(t,e){var i;if(!this.delayedAndroidKey){let t=()=>{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=t.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&t.force&&T(this.dom,t.key,t.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(t)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(null===(i=this.delayedAndroidKey)||void 0===i?void 0:i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame((()=>{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,o=!1;for(let s of t){let t=this.readMutation(s);t&&(t.typeOver&&(o=!0),-1==e?({from:e,to:i}=t):(e=Math.min(t.from,e),i=Math.max(t.to,i)))}return{from:e,to:i,typeOver:o}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),o=this.selectionChanged&&f(this.dom,this.selectionRange);if(t<0&&!o)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new Gi(this.view,t,e,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let i=this.view.state,o=Ui(this.view,e);return this.view.state==i&&(e.domChanged||e.newSel&&!e.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),o}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){let i=to(e,t.previousSibling||t.target.previousSibling,-1),o=to(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:o?e.posBefore(o):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(oe)!=t.state.facet(oe)&&(t.view.contentDOM.editContext=t.state.facet(oe)?this.editContext.editContext:null))}destroy(){var t,e,i;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect();for(let t of this.scrollTargets)t.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function to(t,e,i){for(;e;){let o=H.get(e);if(o&&o.parent==t)return o;let s=e.parentNode;e=s!=t.dom?s:i>0?e.nextSibling:e.previousSibling}return null}function eo(t,e){let i=e.startContainer,o=e.startOffset,s=e.endContainer,n=e.endOffset,r=t.docView.domAtPos(t.state.selection.main.anchor);return g(r.node,r.offset,s,n)&&([i,o,s,n]=[s,n,i,o]),{anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:n}}class io{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.resetRange(t.state);let e=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});e.addEventListener("textupdate",(e=>{let{anchor:i}=t.state.selection.main,s={from:this.toEditorPos(e.updateRangeStart),to:this.toEditorPos(e.updateRangeEnd),insert:o.Text.of(e.text.split("\n"))};s.from==this.from&&i<this.from?s.from=i:s.to==this.to&&i>this.to&&(s.to=i),(s.from!=s.to||s.insert.length)&&(this.pendingContextChange=s,$i(t,s,o.EditorSelection.single(this.toEditorPos(e.selectionStart),this.toEditorPos(e.selectionEnd))),this.pendingContextChange&&this.revertPending(t.state))})),e.addEventListener("characterboundsupdate",(i=>{let o=[],s=null;for(let e=this.toEditorPos(i.rangeStart),n=this.toEditorPos(i.rangeEnd);e<n;e++){let i=t.coordsForChar(e);s=i&&new DOMRect(i.left,i.top,i.right-i.left,i.bottom-i.top)||s||new DOMRect,o.push(s)}e.updateCharacterBounds(i.rangeStart,o)})),e.addEventListener("textformatupdate",(e=>{let i=[];for(let t of e.getTextFormats()){let e=t.underlineStyle,o=t.underlineThickness;if("None"!=e&&"None"!=o){let s=`text-decoration: underline ${"Dashed"==e?"dashed ":"Squiggle"==e?"wavy ":""}${"Thin"==o?1:2}px`;i.push(pt.mark({attributes:{style:s}}).range(this.toEditorPos(t.rangeStart),this.toEditorPos(t.rangeEnd)))}}t.dispatch({effects:ee.of(pt.set(i))})})),e.addEventListener("compositionstart",(()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)})),e.addEventListener("compositionend",(()=>{t.inputState.composing=-1,t.inputState.compositionFirstChange=null})),this.measureReq={read:t=>{this.editContext.updateControlBounds(t.contentDOM.getBoundingClientRect());let e=d(t.root);e&&e.rangeCount&&this.editContext.updateSelectionBounds(e.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,i=!1,o=this.pendingContextChange;return t.changes.iterChanges(((s,n,r,l,h)=>{if(i)return;let a=h.length-(n-s);if(o&&n>=o.to){if(o.from==s&&o.to==n&&o.insert.eq(h))return o=this.pendingContextChange=null,void(e+=a);o=null,this.revertPending(t.state)}if(s+=e,(n+=e)<=this.from)this.from+=a,this.to+=a;else if(s<this.to){if(s<this.from||n>this.to||this.to-this.from+h.length>3e4)return void(i=!0);this.editContext.updateText(this.toContextPos(s),this.toContextPos(n),h.toString()),this.to+=a}e+=a})),o&&!i&&this.revertPending(t.state),!i}update(t){this.applyEdits(t)&&this.rangeIsValid(t.state)?(t.docChanged||t.selectionSet)&&this.setSelection(t.state):(this.pendingContextChange=null,this.resetRange(t.state),this.editContext.updateText(0,this.editContext.text.length,t.state.doc.sliceString(this.from,this.to)),this.setSelection(t.state)),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:e}=t.selection.main;this.from=Math.max(0,e-1e4),this.to=Math.min(t.doc.length,e+1e4)}revertPending(t){let e=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(e.from),this.toContextPos(e.to+e.insert.length),t.doc.sliceString(e.from,e.to))}setSelection(t){let{main:e}=t.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,e.anchor))),o=this.toContextPos(e.head);this.editContext.selectionStart==i&&this.editContext.selectionEnd==o||this.editContext.updateSelection(i,o)}rangeIsValid(t){let{head:e}=t.selection.main;return!(this.from>0&&e-this.from<500||this.to<t.doc.length&&this.to-e<500||this.to-this.from>3e4)}toEditorPos(t){return t+this.from}toContextPos(t){return t-this.from}}class oo{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:e}=t;this.dispatchTransactions=t.dispatchTransactions||e&&(t=>t.forEach((t=>e(t,this))))||(t=>this.update(t)),this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(t.parent)||document,this.viewState=new Oi(t.state||o.EditorState.create(t)),t.scrollTo&&t.scrollTo.is(te)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ne).map((t=>new le(t)));for(let t of this.plugins)t.update(this);this.observer=new Zi(this),this.inputState=new Ne(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ye(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...t){let e=1==t.length&&t[0]instanceof o.Transaction?t:1==t.length&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e,i=!1,s=!1,n=this.state;for(let e of t){if(e.startState!=n)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");n=e.state}if(this.destroyed)return void(this.viewState.state=n);let r=this.hasFocus,l=0,h=null;t.some((t=>t.annotation(li)))?(this.inputState.notifiedFocused=r,l=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,h=hi(n,r),h||(l=1));let a=this.observer.delayedAndroidKey,c=null;if(a?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(n.doc)||!this.state.selection.eq(n.selection))&&(c=null)):this.observer.clear(),n.facet(o.EditorState.phrases)!=this.state.facet(o.EditorState.phrases))return this.setState(n);e=be.create(this,n,t),e.flags|=l;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let e of t){if(d&&(d=d.map(e.changes)),e.scrollIntoView){let{main:t}=e.state.selection;d=new Zt(t.empty?t:o.EditorSelection.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(te)&&(d=t.value.clip(this.state))}this.viewState.update(e,d),this.bidiCache=ro.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(we)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(i,t.some((t=>t.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(e.startState.facet(Vi)!=e.state.facet(Vi)&&(this.viewState.mustMeasureContent=!0),(i||s||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!e.empty)for(let t of this.state.facet(jt))try{t(e)}catch(t){ie(this.state,t,"update listener")}(h||c)&&Promise.resolve().then((()=>{h&&this.state==h.startState&&this.dispatch(h),c&&!Ui(this,c)&&a.force&&T(this.contentDOM,a.key,a.keyCode)}))}setState(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=t);this.updateState=2;let e=this.hasFocus;try{for(let t of this.plugins)t.destroy(this);this.viewState=new Oi(t),this.plugins=t.facet(ne).map((t=>new le(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView.destroy(),this.docView=new ye(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(ne),i=t.state.facet(ne);if(e!=i){let o=[];for(let s of i){let i=e.indexOf(s);if(i<0)o.push(new le(s));else{let e=this.plugins[i];e.mustUpdate=t,o.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=o,this.pluginMap.clear()}else for(let e of this.plugins)e.mustUpdate=t;for(let t=0;t<this.plugins.length;t++)this.plugins[t].update(this);e!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let e=t.value;if(e&&e.docViewUpdate)try{e.docViewUpdate(this)}catch(t){ie(this.state,t,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,i=this.scrollDOM,o=i.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:n}=this.viewState;Math.abs(o-this.viewState.scrollTop)>1&&(n=-1),this.viewState.scrollAnchorHeight=-1;try{for(let t=0;;t++){if(n<0)if(E(i))s=-1,n=this.viewState.heightMap.height;else{let t=this.viewState.scrollAnchorAt(o);s=t.from,n=t.top}this.updateState=1;let r=this.viewState.measure(this);if(!r&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(t>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&r||([this.measureRequests,l]=[l,this.measureRequests]);let h=l.map((t=>{try{return t.read(this)}catch(t){return ie(this.state,t),no}})),a=be.create(this,this.state,[]),c=!1;a.flags|=r,e?e.flags|=r:e=a,this.updateState=2,a.empty||(this.updatePlugins(a),this.inputState.update(a),this.updateAttrs(),c=this.docView.update(a),c&&this.docViewUpdate());for(let t=0;t<l.length;t++)if(h[t]!=no)try{let e=l[t];e.write&&e.write(h[t],this)}catch(t){ie(this.state,t)}if(c&&this.docView.updateSelection(!0),!a.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,n=-1;continue}{let t=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-n;if(t>1||t<-1){o+=t,i.scrollTop=o/this.scaleY,n=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(jt))t(e)}get themeClasses(){return Fi+" "+(this.state.facet(Ni)?zi:Wi)+" "+this.state.facet(Vi)}updateAttrs(){let t=lo(this,he,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(oe)?"true":"false",class:"cm-content",style:`${Q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),lo(this,ae,e);let i=this.observer.ignore((()=>{let i=ht(this.contentDOM,this.contentAttrs,e),o=ht(this.dom,this.editorAttrs,t);return i||o}));return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let t of i.effects)t.is(oo.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value)}mountStyles(){this.styleModules=this.state.facet(we);let t=this.state.facet(oo.cspNonce);s.V.mount(this.root,this.styleModules.concat(qi).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(let e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===t.key)return void(this.measureRequests[e]=t);this.measureRequests.push(t)}}plugin(t){let e=this.pluginMap.get(t);return(void 0===e||e&&e.spec!=t)&&this.pluginMap.set(t,e=this.plugins.find((e=>e.spec==t))||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return Ve(this,t,Pe(this,t,e,i))}moveByGroup(t,e){return Ve(this,t,Pe(this,t,e,(e=>function(t,e,i){let s=t.state.charCategorizer(e),n=s(i);return t=>{let e=s(t);return n==o.CharCategory.Space&&(n=e),n==e}}(this,t.head,e))))}visualLineSide(t,e){let i=this.bidiSpans(t),s=this.textDirectionAt(t.from),n=i[e?i.length-1:0];return o.EditorSelection.cursor(n.side(e,s)+t.from,n.forward(!e,s)?1:-1)}moveToLineBoundary(t,e,i=!0){return function(t,e,i,s){let n=Be(t,e.head),r=s&&n.type==ft.Text&&(t.lineWrapping||n.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>n.from?e.head-1:e.head):null;if(r){let e=t.dom.getBoundingClientRect(),s=t.textDirectionAt(n.from),l=t.posAtCoords({x:i==(s==Ct.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=l)return o.EditorSelection.cursor(l,i?-1:1)}return o.EditorSelection.cursor(i?n.to:n.from,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return Ve(this,t,function(t,e,i,s){let n=e.head,r=i?1:-1;if(n==(i?t.state.doc.length:0))return o.EditorSelection.cursor(n,e.assoc);let l,h=e.goalColumn,a=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(n,e.assoc||-1),d=t.documentTop;if(c)null==h&&(h=c.left-a.left),l=r<0?c.top:c.bottom;else{let e=t.viewState.lineBlockAt(n);null==h&&(h=Math.min(a.right-a.left,t.defaultCharacterWidth*(n-e.from))),l=(r<0?e.top:e.bottom)+d}let u=a.left+h,f=null!=s?s:t.viewState.heightOracle.textHeight>>1;for(let e=0;;e+=10){let i=l+(f+e)*r,s=Re(t,{x:u,y:i},!1,r);if(i<a.top||i>a.bottom||(r<0?s<n:s>n)){let e=t.docView.coordsForChar(s),n=!e||i<e.top?-1:1;return o.EditorSelection.cursor(s,n,void 0,h)}}}(this,t,e,i))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),Re(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let o=this.state.doc.lineAt(t),s=this.bidiSpans(o);return y(i,s[Bt.find(s,t-o.from,-1,e)].dir==Ct.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet($t)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>so)return Wt(t.length);let e,i=this.textDirectionAt(t.from);for(let o of this.bidiCache)if(o.from==t.from&&o.dir==i&&(o.fresh||Pt(o.isolates,e=pe(this,t))))return o.order;e||(e=pe(this,t));let o=Ft(t.text,i,e);return this.bidiCache.push(new ro(t.from,t.to,i,e,!0,o)),o}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Q.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{A(this.contentDOM),this.docView.updateSelection()}))}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return te.of(new Zt("number"==typeof t?o.EditorSelection.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,i=this.viewState.scrollAnchorAt(t);return te.of(new Zt(o.EditorSelection.cursor(i.from),"start","start",i.top-t,e,!0))}setTabFocusMode(t){null==t?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof t?this.inputState.tabFocusMode=t?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return re.define((()=>({})),{eventHandlers:t})}static domEventObservers(t){return re.define((()=>({})),{eventObservers:t})}static theme(t,e){let i=s.V.newName(),o=[Vi.of(i),we.of(Ki(`.${i}`,t))];return e&&e.dark&&o.push(Ni.of(!0)),o}static baseTheme(t){return o.Prec.lowest(we.of(Ki("."+Fi,t,Ii)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),o=i&&H.get(i)||H.get(t);return(null===(e=null==o?void 0:o.rootView)||void 0===e?void 0:e.view)||null}}oo.styleModule=we,oo.inputHandler=Gt,oo.scrollHandler=Jt,oo.focusChangeEffect=Ut,oo.perLineTextDirection=$t,oo.exceptionSink=Xt,oo.updateListener=jt,oo.editable=oe,oo.mouseSelectionStyle=_t,oo.dragMovesSelection=Yt,oo.clickAddsSelectionRange=qt,oo.decorations=ce,oo.outerDecorations=de,oo.atomicRanges=ue,oo.bidiIsolatedRanges=fe,oo.scrollMargins=ge,oo.darkTheme=Ni,oo.cspNonce=o.Facet.define({combine:t=>t.length?t[0]:""}),oo.contentAttributes=ae,oo.editorAttributes=he,oo.lineWrapping=oo.contentAttributes.of({class:"cm-lineWrapping"}),oo.announce=o.StateEffect.define();const so=4096,no={};class ro{constructor(t,e,i,o,s,n){this.from=t,this.to=e,this.dir=i,this.isolates=o,this.fresh=s,this.order=n}static update(t,e){if(e.empty&&!t.some((t=>t.fresh)))return t;let i=[],o=t.length?t[t.length-1].dir:Ct.LTR;for(let s=Math.max(0,t.length-10);s<t.length;s++){let n=t[s];n.dir!=o||e.touchesRange(n.from,n.to)||i.push(new ro(e.mapPos(n.from,1),e.mapPos(n.to,-1),n.dir,n.isolates,!1,n.order))}return i}}function lo(t,e,i){for(let o=t.state.facet(e),s=o.length-1;s>=0;s--){let e=o[s],n="function"==typeof e?e(t):e;n&&nt(n,i)}return i}const ho=Q.mac?"mac":Q.windows?"win":Q.linux?"linux":"key";function ao(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t}const co=o.Prec.default(oo.domEventHandlers({keydown:(t,e)=>bo(po(e.state),t,e,"editor")})),uo=o.Facet.define({enables:co}),fo=new WeakMap;function po(t){let e=t.facet(uo),i=fo.get(e);return i||fo.set(e,i=function(t,e=ho){let i=Object.create(null),o=Object.create(null),s=(t,e)=>{let i=o[t];if(null==i)o[t]=e;else if(i!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},n=(t,o,n,r,l)=>{var h,a;let c=i[t]||(i[t]=Object.create(null)),d=o.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let o,s,n,r,l=i[i.length-1];"Space"==l&&(l=" ");for(let t=0;t<i.length-1;++t){const l=i[t];if(/^(cmd|meta|m)$/i.test(l))r=!0;else if(/^a(lt)?$/i.test(l))o=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))n=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);"mac"==e?r=!0:s=!0}}return o&&(l="Alt-"+l),s&&(l="Ctrl-"+l),r&&(l="Meta-"+l),n&&(l="Shift-"+l),l}(t,e)));for(let e=1;e<d.length;e++){let i=d.slice(0,e).join(" ");s(i,!0),c[i]||(c[i]={preventDefault:!0,stopPropagation:!1,run:[e=>{let o=mo={view:e,prefix:i,scope:t};return setTimeout((()=>{mo==o&&(mo=null)}),wo),!0}]})}let u=d.join(" ");s(u,!1);let f=c[u]||(c[u]={preventDefault:!1,stopPropagation:!1,run:(null===(a=null===(h=c._any)||void 0===h?void 0:h.run)||void 0===a?void 0:a.slice())||[]});n&&f.run.push(n),r&&(f.preventDefault=!0),l&&(f.stopPropagation=!0)};for(let o of t){let t=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let e of t){let t=i[e]||(i[e]=Object.create(null));t._any||(t._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:s}=o;for(let e in t)t[e].run.push((t=>s(t,vo)))}let s=o[e]||o.key;if(s)for(let e of t)n(e,s,o.run,o.preventDefault,o.stopPropagation),o.shift&&n(e,"Shift-"+s,o.shift,o.preventDefault,o.stopPropagation)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}function go(t,e,i){return bo(po(t.state),e,t,i)}let mo=null;const wo=4e3;let vo=null;function bo(t,e,i,s){vo=e;let a=function(t){var e=!(l&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||h&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?r:n)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(e),c=(0,o.codePointAt)(a,0),d=(0,o.codePointSize)(c)==a.length&&" "!=a,u="",f=!1,p=!1,g=!1;mo&&mo.view==i&&mo.scope==s&&(u=mo.prefix+" ",Ke.indexOf(e.keyCode)<0&&(p=!0,mo=null));let m,w,v=new Set,b=t=>{if(t){for(let e of t.run)if(!v.has(e)&&(v.add(e),e(i)))return t.stopPropagation&&(g=!0),!0;t.preventDefault&&(t.stopPropagation&&(g=!0),p=!0)}return!1},y=t[s];return y&&(b(y[u+ao(a,e,!d)])?f=!0:d&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Q.windows&&e.ctrlKey&&e.altKey)&&(m=n[e.keyCode])&&m!=a?(b(y[u+ao(m,e,!0)])||e.shiftKey&&(w=r[e.keyCode])!=a&&w!=m&&b(y[u+ao(w,e,!1)]))&&(f=!0):d&&e.shiftKey&&b(y[u+ao(a,e,!0)])&&(f=!0),!f&&b(y._any)&&(f=!0)),p&&(f=!0),f&&g&&e.stopPropagation(),vo=null,f}class yo{constructor(t,e,i,o,s){this.className=t,this.left=e,this.top=i,this.width=o,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(i.empty){let o=t.coordsAtPos(i.head,i.assoc||1);if(!o)return[];let s=So(t);return[new yo(e,o.left-s.left,o.top-s.top,null,o.bottom-o.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let o=Math.max(i.from,t.viewport.from),s=Math.min(i.to,t.viewport.to),n=t.textDirection==Ct.LTR,r=t.contentDOM,l=r.getBoundingClientRect(),h=So(t),a=r.querySelector(".cm-line"),c=a&&window.getComputedStyle(a),d=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),u=l.right-(c?parseInt(c.paddingRight):0),f=Be(t,o),p=Be(t,s),g=f.type==ft.Text?f:null,m=p.type==ft.Text?p:null;if(g&&(t.lineWrapping||f.widgetLineBreaks)&&(g=xo(t,o,1,g)),m&&(t.lineWrapping||p.widgetLineBreaks)&&(m=xo(t,s,-1,m)),g&&m&&g.from==m.from&&g.to==m.to)return v(b(i.from,i.to,g));{let e=g?b(i.from,null,g):y(f,!1),o=m?b(null,i.to,m):y(p,!0),s=[];return(g||f).to<(m||p).from-(g&&m?1:0)||f.widgetLineBreaks>1&&e.bottom+t.defaultLineHeight/2<o.top?s.push(w(d,e.bottom,u,o.top)):e.bottom<o.top&&t.elementAtHeight((e.bottom+o.top)/2).type==ft.Text&&(e.bottom=o.top=(e.bottom+o.top)/2),v(e).concat(s).concat(v(o))}function w(t,i,o,s){return new yo(e,t-h.left,i-h.top-.01,o-t,s-i+.01)}function v({top:t,bottom:e,horizontal:i}){let o=[];for(let s=0;s<i.length;s+=2)o.push(w(i[s],t,i[s+1],e));return o}function b(e,i,o){let s=1e9,r=-1e9,l=[];function h(e,i,h,a,c){let f=t.coordsAtPos(e,e==o.to?-2:2),p=t.coordsAtPos(h,h==o.from?2:-2);f&&p&&(s=Math.min(f.top,p.top,s),r=Math.max(f.bottom,p.bottom,r),c==Ct.LTR?l.push(n&&i?d:f.left,n&&a?u:p.right):l.push(!n&&a?d:p.left,!n&&i?u:f.right))}let a=null!=e?e:o.from,c=null!=i?i:o.to;for(let o of t.visibleRanges)if(o.to>a&&o.from<c)for(let s=Math.max(o.from,a),n=Math.min(o.to,c);;){let o=t.state.doc.lineAt(s);for(let r of t.bidiSpans(o)){let t=r.from+o.from,l=r.to+o.from;if(t>=n)break;l>s&&h(Math.max(t,s),null==e&&t<=a,Math.min(l,n),null==i&&l>=c,r.dir)}if(s=o.to+1,s>=n)break}return 0==l.length&&h(a,null==e,c,null==i,t.textDirection),{top:s,bottom:r,horizontal:l}}function y(t,e){let i=l.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i)}}function So(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Ct.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function xo(t,e,i,o){let s=t.coordsAtPos(e,2*i);if(!s)return o;let n=t.dom.getBoundingClientRect(),r=(s.top+s.bottom)/2,l=t.posAtCoords({x:n.left+1,y:r}),h=t.posAtCoords({x:n.right-1,y:r});return null==l||null==h?o:{from:Math.max(o.from,Math.min(l,h)),to:Math.min(o.to,Math.max(l,h))}}class Co{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(Mo)!=t.state.facet(Mo)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){!1!==this.layer.updateOnDocViewUpdate&&t.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(Mo);for(;e<i.length&&i[e]!=this.layer;)e++;this.dom.style.zIndex=String((this.layer.above?150:-1)-e)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:t,scaleY:e}=this.view;t==this.scaleX&&e==this.scaleY||(this.scaleX=t,this.scaleY=e,this.dom.style.transform=`scale(${1/t}, ${1/e})`)}draw(t){if(t.length!=this.drawn.length||t.some(((t,e)=>{return i=t,o=this.drawn[e],!(i.constructor==o.constructor&&i.eq(o));var i,o}))){let e=this.dom.firstChild,i=0;for(let o of t)o.update&&e&&o.constructor&&this.drawn[i].constructor&&o.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(o.draw(),e);for(;e;){let t=e.nextSibling;e.remove(),e=t}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Mo=o.Facet.define();function ko(t){return[re.define((e=>new Co(e,t))),Mo.of(t)]}const Ao=!Q.ios,Do=o.Facet.define({combine:t=>(0,o.combineConfig)(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function To(t={}){return[Do.of(t),Ro,Bo,Ho,Qt.of(!0)]}function Oo(t){return t.facet(Do)}function Eo(t){return t.startState.facet(Do)!=t.state.facet(Do)}const Ro=ko({above:!0,markers(t){let{state:e}=t,i=e.facet(Do),s=[];for(let n of e.selection.ranges){let r=n==e.selection.main;if(n.empty?!r||Ao:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=n.empty?n:o.EditorSelection.cursor(n.head,n.head>n.anchor?-1:1);for(let o of yo.forRange(t,e,i))s.push(o)}}return s},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=Eo(t);return i&&Lo(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){Lo(e.state,t)},class:"cm-cursorLayer"});function Lo(t,e){e.style.animationDuration=t.facet(Do).cursorBlinkRate+"ms"}const Bo=ko({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:yo.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||Eo(t),class:"cm-selectionLayer"}),Po={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};Ao&&(Po[".cm-line"].caretColor=Po[".cm-content"].caretColor="transparent !important");const Ho=o.Prec.highest(oo.theme(Po)),Vo=o.StateEffect.define({map:(t,e)=>null==t?null:e.mapPos(t)}),No=o.StateField.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(Vo)?e.value:t),t))}),Fo=re.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(No);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(No)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(No),i=null!=e&&t.coordsAtPos(e);if(!i)return null;let o=t.scrollDOM.getBoundingClientRect();return{left:i.left-o.left+t.scrollDOM.scrollLeft*t.scaleX,top:i.top-o.top+t.scrollDOM.scrollTop*t.scaleY,height:i.bottom-i.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:i}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/i+"px",this.cursor.style.height=t.height/i+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(No)!=t&&this.view.dispatch({effects:Vo.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Wo(){return[No,Fo]}function zo(t,e,i,o,s){e.lastIndex=0;for(let n,r=t.iterRange(i,o),l=i;!r.next().done;l+=r.value.length)if(!r.lineBreak)for(;n=e.exec(r.value);)s(l+n.index,n)}class Io{constructor(t){const{regexp:e,decoration:i,decorate:o,boundary:s,maxLength:n=1e3}=t;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,o)this.addMatch=(t,e,i,s)=>o(s,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,o,s)=>{let n=i(t,e,o);n&&s(o,o+t[0].length,n)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,o,s)=>s(o,o+t[0].length,i)}this.boundary=s,this.maxLength=n}createDeco(t){let e=new o.RangeSetBuilder,i=e.add.bind(e);for(let{from:e,to:o}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let o=[];for(let{from:s,to:n}of i)s=Math.max(t.state.doc.lineAt(s).from,s-e),n=Math.min(t.state.doc.lineAt(n).to,n+e),o.length&&o[o.length-1].to>=s?o[o.length-1].to=n:o.push({from:s,to:n});return o}(t,this.maxLength))zo(t.state.doc,this.regexp,e,o,((e,o)=>this.addMatch(o,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,o=-1;return t.docChanged&&t.changes.iterChanges(((e,s,n,r)=>{r>t.view.viewport.from&&n<t.view.viewport.to&&(i=Math.min(n,i),o=Math.max(r,o))})),t.viewportChanged||o-i>1e3?this.createDeco(t.view):o>-1?this.updateRange(t.view,e.map(t.changes),i,o):e}updateRange(t,e,i,o){for(let s of t.visibleRanges){let n=Math.max(s.from,i),r=Math.min(s.to,o);if(r>n){let i=t.state.doc.lineAt(n),o=i.to<r?t.state.doc.lineAt(r):i,l=Math.max(s.from,i.from),h=Math.min(s.to,o.to);if(this.boundary){for(;n>i.from;n--)if(this.boundary.test(i.text[n-1-i.from])){l=n;break}for(;r<o.to;r++)if(this.boundary.test(o.text[r-o.from])){h=r;break}}let a,c=[],d=(t,e,i)=>c.push(i.range(t,e));if(i==o)for(this.regexp.lastIndex=l-i.from;(a=this.regexp.exec(i.text))&&a.index<h-i.from;)this.addMatch(a,t,a.index+i.from,d);else zo(t.state.doc,this.regexp,l,h,((e,i)=>this.addMatch(i,t,e,d)));e=e.update({filterFrom:l,filterTo:h,filter:(t,e)=>t<l||e>h,add:c})}}return e}}const Ko=null!=/x/.unicode?"gu":"g",qo=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Ko),Yo={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let _o=null;const Xo=o.Facet.define({combine(t){let e=(0,o.combineConfig)(t,{render:null,specialChars:qo,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==_o&&"undefined"!=typeof document&&document.body){let e=document.body.style;_o=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return _o||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Ko)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Ko)),e}});function jo(t={}){return[Xo.of(t),Go||(Go=re.fromClass(class{constructor(t){this.view=t,this.decorations=pt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Xo)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Io({regexp:t.specialChars,decoration:(e,i,s)=>{let{doc:n}=i.state,r=(0,o.codePointAt)(e[0],0);if(9==r){let t=n.lineAt(s),e=i.state.tabSize,r=(0,o.countColumn)(t.text,e,s-t.from);return pt.replace({widget:new $o((e-r%e)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=pt.replace({widget:new Uo(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Xo);t.startState.facet(Xo)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let Go=null;class Uo extends ut{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){let e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),i=t.state.phrase("Control character")+" "+(Yo[this.code]||"0x"+this.code.toString(16)),o=this.options.render&&this.options.render(this.code,i,e);if(o)return o;let s=document.createElement("span");return s.textContent=e,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class $o extends ut{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}const Qo=re.fromClass(class{constructor(){this.height=1e3,this.attrs={style:"padding-bottom: 1000px"}}update(t){let{view:e}=t,i=e.viewState.editorHeight-e.defaultLineHeight-e.documentPadding.top-.5;i>=0&&i!=this.height&&(this.height=i,this.attrs={style:`padding-bottom: ${i}px`})}});function Jo(){return[Qo,ae.of((t=>{var e;return(null===(e=t.plugin(Qo))||void 0===e?void 0:e.attrs)||null}))]}function Zo(){return es}const ts=pt.line({class:"cm-activeLine"}),es=re.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let o of t.state.selection.ranges){let s=t.lineBlockAt(o.head);s.from>e&&(i.push(ts.range(s.from)),e=s.from)}return pt.set(i)}},{decorations:t=>t.decorations});class is extends ut{constructor(t){super(),this.content=t}toDOM(){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}coordsAt(t){let e=t.firstChild?p(t.firstChild):[];if(!e.length)return null;let i=window.getComputedStyle(t.parentNode),o=y(e[0],"rtl"!=i.direction),s=parseInt(i.lineHeight);return o.bottom-o.top>1.5*s?{left:o.left,right:o.right,top:o.top,bottom:o.top+s}:o}ignoreEvent(){return!1}}function os(t){return re.fromClass(class{constructor(e){this.view=e,this.placeholder=t?pt.set([pt.widget({widget:new is(t),side:1}).range(0)]):pt.none}get decorations(){return this.view.state.doc.length?pt.none:this.placeholder}},{decorations:t=>t.decorations})}const ss=2e3;function ns(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),s=t.state.doc.lineAt(i),n=i-s.from,r=n>ss?-1:n==s.length?function(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}(t,e.clientX):(0,o.countColumn)(s.text,t.state.tabSize,i-s.from);return{line:s.number,col:r,off:n}}function rs(t){let e=(null==t?void 0:t.eventFilter)||(t=>t.altKey&&0==t.button);return oo.mouseSelectionStyle.of(((t,i)=>e(i)?function(t,e){let i=ns(t,e),s=t.state.selection;return i?{update(t){if(t.docChanged){let e=t.changes.mapPos(t.startState.doc.line(i.line).from),o=t.state.doc.lineAt(e);i={line:o.number,col:i.col,off:Math.min(i.off,o.length)},s=s.map(t.changes)}},get(e,n,r){let l=ns(t,e);if(!l)return s;let h=function(t,e,i){let s=Math.min(e.line,i.line),n=Math.max(e.line,i.line),r=[];if(e.off>ss||i.off>ss||e.col<0||i.col<0){let l=Math.min(e.off,i.off),h=Math.max(e.off,i.off);for(let e=s;e<=n;e++){let i=t.doc.line(e);i.length<=h&&r.push(o.EditorSelection.range(i.from+l,i.to+h))}}else{let l=Math.min(e.col,i.col),h=Math.max(e.col,i.col);for(let e=s;e<=n;e++){let i=t.doc.line(e),s=(0,o.findColumn)(i.text,l,t.tabSize,!0);if(s<0)r.push(o.EditorSelection.cursor(i.to));else{let e=(0,o.findColumn)(i.text,h,t.tabSize);r.push(o.EditorSelection.range(i.from+s,i.from+e))}}}return r}(t.state,i,l);return h.length?r?o.EditorSelection.create(h.concat(s.ranges)):o.EditorSelection.create(h):s}}:null}(t,i):null))}const ls={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},hs={style:"cursor: crosshair"};function as(t={}){let[e,i]=ls[t.key||"Alt"],o=re.fromClass(class{constructor(t){this.view=t,this.isDown=!1}set(t){this.isDown!=t&&(this.isDown=t,this.view.update([]))}},{eventObservers:{keydown(t){this.set(t.keyCode==e||i(t))},keyup(t){t.keyCode!=e&&i(t)||this.set(!1)},mousemove(t){this.set(i(t))}}});return[o,oo.contentAttributes.of((t=>{var e;return(null===(e=t.plugin(o))||void 0===e?void 0:e.isDown)?hs:null}))]}const cs="-10000px";class ds{constructor(t,e,i,o){this.facet=e,this.createTooltipView=i,this.removeTooltipView=o,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t));let s=null;this.tooltipViews=this.tooltips.map((t=>s=i(t,s)))}update(t,e){var i;let o=t.state.facet(this.facet),s=o.filter((t=>t));if(o===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let n=[],r=e?[]:null;for(let i=0;i<s.length;i++){let o=s[i],l=-1;if(o){for(let t=0;t<this.tooltips.length;t++){let e=this.tooltips[t];e&&e.create==o.create&&(l=t)}if(l<0)n[i]=this.createTooltipView(o,i?n[i-1]:null),r&&(r[i]=!!o.above);else{let o=n[i]=this.tooltipViews[l];r&&(r[i]=e[l]),o.update&&o.update(t)}}}for(let t of this.tooltipViews)n.indexOf(t)<0&&(this.removeTooltipView(t),null===(i=t.destroy)||void 0===i||i.call(t));return e&&(r.forEach(((t,i)=>e[i]=t)),e.length=r.length),this.input=o,this.tooltips=s,this.tooltipViews=n,!0}}function us(t={}){return ps.of(t)}function fs(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const ps=o.Facet.define({combine:t=>{var e,i,o;return{position:Q.ios?"absolute":(null===(e=t.find((t=>t.position)))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((t=>t.parent)))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(o=t.find((t=>t.tooltipSpace)))||void 0===o?void 0:o.tooltipSpace)||fs}}}),gs=new WeakMap,ms=re.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(ps);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver((()=>this.measureSoon())):null,this.manager=new ds(t,bs,((t,e)=>this.createTooltip(t,e)),(t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()})),this.above=this.manager.tooltips.map((t=>!!t.above)),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let i=e||t.geometryChanged,o=t.state.facet(ps);if(o.position!=this.position&&!this.madeAbsolute){this.position=o.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(o.parent!=this.parent){this.parent&&this.container.remove(),this.parent=o.parent,this.createContainer();for(let t of this.manager.tooltipViews)this.container.appendChild(t.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t,e){let i=t.create(this.view),o=e?e.dom:null;if(i.dom.classList.add("cm-tooltip"),t.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",i.dom.appendChild(t)}return i.dom.style.position=this.position,i.dom.style.top=cs,i.dom.style.left="0px",this.container.insertBefore(i.dom,o),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i}destroy(){var t,e,i;this.view.win.removeEventListener("resize",this.measureSoon);for(let e of this.manager.tooltipViews)e.dom.remove(),null===(t=e.destroy)||void 0===t||t.call(e);this.parent&&this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(i=this.intersectionObserver)||void 0===i||i.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect(),e=1,i=1,o=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:t}=this.manager.tooltipViews[0];if(Q.gecko)o=t.offsetParent!=this.container.ownerDocument.body;else if(t.style.top==cs&&"0px"==t.style.left){let e=t.getBoundingClientRect();o=Math.abs(e.top+1e4)>1||Math.abs(e.left)>1}}if(o||"absolute"==this.position)if(this.parent){let t=this.parent.getBoundingClientRect();t.width&&t.height&&(e=t.width/this.parent.offsetWidth,i=t.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:i}=this.view.viewState);return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((({dom:t})=>t.getBoundingClientRect())),space:this.view.state.facet(ps).tooltipSpace(this.view),scaleX:e,scaleY:i,makeAbsolute:o}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let t of this.manager.tooltipViews)t.dom.style.position="absolute"}let{editor:i,space:o,scaleX:s,scaleY:n}=t,r=[];for(let l=0;l<this.manager.tooltips.length;l++){let h=this.manager.tooltips[l],a=this.manager.tooltipViews[l],{dom:c}=a,d=t.pos[l],u=t.size[l];if(!d||d.bottom<=Math.max(i.top,o.top)||d.top>=Math.min(i.bottom,o.bottom)||d.right<Math.max(i.left,o.left)-.1||d.left>Math.min(i.right,o.right)+.1){c.style.top=cs;continue}let f=h.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=u.right-u.left,m=null!==(e=gs.get(a))&&void 0!==e?e:u.bottom-u.top,w=a.offset||vs,v=this.view.textDirection==Ct.LTR,b=u.width>o.right-o.left?v?o.left:o.right-u.width:v?Math.min(d.left-(f?14:0)+w.x,o.right-g):Math.max(o.left,d.left-g+(f?14:0)-w.x),y=this.above[l];!h.strictSide&&(y?d.top-(u.bottom-u.top)-w.y<o.top:d.bottom+(u.bottom-u.top)+w.y>o.bottom)&&y==o.bottom-d.bottom>d.top-o.top&&(y=this.above[l]=!y);let S=(y?d.top-o.top:o.bottom-d.bottom)-p;if(S<m&&!1!==a.resize){if(S<this.view.defaultLineHeight){c.style.top=cs;continue}gs.set(a,m),c.style.height=(m=S)/n+"px"}else c.style.height&&(c.style.height="");let x=y?d.top-m-p-w.y:d.bottom+p+w.y,C=b+g;if(!0!==a.overlap)for(let t of r)t.left<C&&t.right>b&&t.top<x+m&&t.bottom>x&&(x=y?t.top-m-2-p:t.bottom+p+2);if("absolute"==this.position?(c.style.top=(x-t.parent.top)/n+"px",c.style.left=(b-t.parent.left)/s+"px"):(c.style.top=x/n+"px",c.style.left=b/s+"px"),f){let t=d.left+(v?w.x:-w.x)-(b+14-7);f.style.left=t/s+"px"}!0!==a.overlap&&r.push({left:b,top:x,right:C,bottom:x+m}),c.classList.toggle("cm-tooltip-above",y),c.classList.toggle("cm-tooltip-below",!y),a.positioned&&a.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=cs}},{eventObservers:{scroll(){this.maybeMeasure()}}}),ws=oo.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),vs={x:0,y:0},bs=o.Facet.define({enables:[ms,ws]}),ys=o.Facet.define({combine:t=>t.reduce(((t,e)=>t.concat(e)),[])});class Ss{static create(t){return new Ss(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new ds(t,ys,((t,e)=>this.createHostedView(t,e)),(t=>t.dom.remove()))}createHostedView(t,e){let i=t.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)null===(t=e.destroy)||void 0===t||t.call(e)}passProp(t){let e;for(let i of this.manager.tooltipViews){let o=i[t];if(void 0!==o)if(void 0===e)e=o;else if(e!==o)return}return e}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const xs=bs.compute([ys],(t=>{let e=t.facet(ys);return 0===e.length?null:{pos:Math.min(...e.map((t=>t.pos))),end:Math.max(...e.map((t=>{var e;return null!==(e=t.end)&&void 0!==e?e:t.pos}))),create:Ss.create,above:e[0].above,arrow:e.some((t=>t.arrow))}}));class Cs{constructor(t,e,i,o,s){this.view=t,this.source=e,this.field=i,this.setHover=o,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((()=>this.startHover()),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:t,lastMove:e}=this,i=t.docView.nearest(e.target);if(!i)return;let o,s=1;if(i instanceof tt)o=i.posAtStart;else{if(o=t.posAtCoords(e),null==o)return;let i=t.coordsAtPos(o);if(!i||e.y<i.top||e.y>i.bottom||e.x<i.left-t.defaultCharacterWidth||e.x>i.right+t.defaultCharacterWidth)return;let n=t.bidiSpans(t.state.doc.lineAt(o)).find((t=>t.from<=o&&t.to>=o)),r=n&&n.dir==Ct.RTL?-1:1;s=e.x<i.left?-r:r}let n=this.source(t,o,s);if(null==n?void 0:n.then){let e=this.pending={pos:o};n.then((i=>{this.pending==e&&(this.pending=null,!i||Array.isArray(i)&&!i.length||t.dispatch({effects:this.setHover.of(Array.isArray(i)?i:[i])}))}),(e=>ie(t.state,e,"hover tooltip")))}else!n||Array.isArray(n)&&!n.length||t.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])})}get tooltip(){let t=this.view.plugin(ms),e=t?t.manager.tooltips.findIndex((t=>t.create==Ss.create)):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,i;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:o,tooltip:s}=this;if(o.length&&s&&!function(t,e){let i=t.getBoundingClientRect();return e.clientX>=i.left-Ms&&e.clientX<=i.right+Ms&&e.clientY>=i.top-Ms&&e.clientY<=i.bottom+Ms}(s.dom,t)||this.pending){let{pos:s}=o[0]||this.pending,n=null!==(i=null===(e=o[0])||void 0===e?void 0:e.end)&&void 0!==i?i:s;(s==n?this.view.posAtCoords(this.lastMove)==s:function(t,e,i,o,s,n){let r=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(r.left>o||r.right<o||r.top>s||Math.min(r.bottom,l)<s)return!1;let h=t.posAtCoords({x:o,y:s},!1);return h>=e&&h<=i}(this.view,s,n,t.clientX,t.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:e}=this;e&&e.dom.contains(t.relatedTarget)?this.watchTooltipLeave(e.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=i=>{t.removeEventListener("mouseleave",e),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",e)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Ms=4;function ks(t,e={}){let i=o.StateEffect.define(),s=o.StateField.define({create:()=>[],update(t,s){if(t.length&&(e.hideOnChange&&(s.docChanged||s.selection)?t=[]:e.hideOn&&(t=t.filter((t=>!e.hideOn(s,t)))),s.docChanged)){let e=[];for(let i of t){let t=s.changes.mapPos(i.pos,-1,o.MapMode.TrackDel);if(null!=t){let o=Object.assign(Object.create(null),i);o.pos=t,null!=o.end&&(o.end=s.changes.mapPos(o.end)),e.push(o)}}t=e}for(let e of s.effects)e.is(i)&&(t=e.value),e.is(Ts)&&(t=[]);return t},provide:t=>ys.from(t)});return[s,re.define((o=>new Cs(o,t,s,i,e.hoverTime||300))),xs]}function As(t,e){let i=t.plugin(ms);if(!i)return null;let o=i.manager.tooltips.indexOf(e);return o<0?null:i.manager.tooltipViews[o]}function Ds(t){return t.facet(ys).some((t=>t))}const Ts=o.StateEffect.define(),Os=Ts.of(null);function Es(t){let e=t.plugin(ms);e&&e.maybeMeasure()}const Rs=o.Facet.define({combine(t){let e,i;for(let o of t)e=e||o.topContainer,i=i||o.bottomContainer;return{topContainer:e,bottomContainer:i}}});function Ls(t){return t?[Rs.of(t)]:[]}function Bs(t,e){let i=t.plugin(Ps),o=i?i.specs.indexOf(e):-1;return o>-1?i.panels[o]:null}const Ps=re.fromClass(class{constructor(t){this.input=t.state.facet(Ns),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(Rs);this.top=new Hs(t,!0,e.topContainer),this.bottom=new Hs(t,!1,e.bottomContainer),this.top.sync(this.panels.filter((t=>t.top))),this.bottom.sync(this.panels.filter((t=>!t.top)));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(t){let e=t.state.facet(Rs);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Hs(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Hs(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Ns);if(i!=this.input){let e=i.filter((t=>t)),o=[],s=[],n=[],r=[];for(let i of e){let e,l=this.specs.indexOf(i);l<0?(e=i(t.view),r.push(e)):(e=this.panels[l],e.update&&e.update(t)),o.push(e),(e.top?s:n).push(e)}this.specs=e,this.panels=o,this.top.sync(s),this.bottom.sync(n);for(let t of r)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}else for(let e of this.panels)e.update&&e.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>oo.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Hs{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Vs(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Vs(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function Vs(t){let e=t.nextSibling;return t.remove(),e}const Ns=o.Facet.define({enables:Ps});class Fs extends o.RangeValue{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Fs.prototype.elementClass="",Fs.prototype.toDOM=void 0,Fs.prototype.mapMode=o.MapMode.TrackBefore,Fs.prototype.startSide=Fs.prototype.endSide=-1,Fs.prototype.point=!0;const Ws=o.Facet.define(),zs={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>o.RangeSet.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Is=o.Facet.define();function Ks(t){return[Ys(),Is.of(Object.assign(Object.assign({},zs),t))]}const qs=o.Facet.define({combine:t=>t.some((t=>t))});function Ys(t){let e=[_s];return t&&!1===t.fixed&&e.push(qs.of(!0)),e}const _s=re.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Is).map((e=>new Us(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(qs),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,o=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(o<.8*(i.to-i.from))}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(qs)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let i=o.RangeSet.iter(this.view.state.facet(Ws),this.view.viewport.from),s=[],n=this.gutters.map((t=>new Gs(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks)if(s.length&&(s=[]),Array.isArray(t.type)){let e=!0;for(let o of t.type)if(o.type==ft.Text&&e){js(i,s,o.from);for(let t of n)t.line(this.view,o,s);e=!1}else if(o.widget)for(let t of n)t.widget(this.view,o)}else if(t.type==ft.Text){js(i,s,t.from);for(let e of n)e.line(this.view,t,s)}else if(t.widget)for(let e of n)e.widget(this.view,t);for(let t of n)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(Is),i=t.state.facet(Is),s=t.docChanged||t.heightChanged||t.viewportChanged||!o.RangeSet.eq(t.startState.facet(Ws),t.state.facet(Ws),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let e of this.gutters)e.update(t)&&(s=!0);else{s=!0;let o=[];for(let s of i){let i=e.indexOf(s);i<0?o.push(new Us(this.view,s)):(this.gutters[i].update(t),o.push(this.gutters[i]))}for(let t of this.gutters)t.dom.remove(),o.indexOf(t)<0&&t.destroy();for(let t of o)this.dom.appendChild(t.dom);this.gutters=o}return s}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>oo.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Ct.LTR?{left:i.dom.offsetWidth*e.scaleX}:{right:i.dom.offsetWidth*e.scaleX}:null}))});function Xs(t){return Array.isArray(t)?t:[t]}function js(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Gs{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=o.RangeSet.iter(t.markers,e.from)}addElement(t,e,i){let{gutter:o}=this,s=(e.top-this.height)/t.scaleY,n=e.height/t.scaleY;if(this.i==o.elements.length){let e=new $s(t,n,s,i);o.elements.push(e),o.dom.appendChild(e.dom)}else o.elements[this.i].update(t,n,s,i);this.height=e.bottom,this.i++}line(t,e,i){let o=[];js(this.cursor,o,e.from),i.length&&(o=o.concat(i));let s=this.gutter.config.lineMarker(t,e,o);s&&o.unshift(s);let n=this.gutter;(0!=o.length||n.config.renderEmptyElements)&&this.addElement(t,e,o)}widget(t,e){let i=this.gutter.config.widgetMarker(t,e.widget,e);i&&this.addElement(t,e,[i])}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class Us{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in e.domEventHandlers)this.dom.addEventListener(i,(o=>{let s,n=o.target;if(n!=this.dom&&this.dom.contains(n)){for(;n.parentNode!=this.dom;)n=n.parentNode;let t=n.getBoundingClientRect();s=(t.top+t.bottom)/2}else s=o.clientY;let r=t.lineBlockAtHeight(s-t.documentTop);e.domEventHandlers[i](t,r,o)&&o.preventDefault()}));this.markers=Xs(e.markers(t)),e.initialSpacer&&(this.spacer=new $s(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=Xs(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let e=this.config.updateSpacer(this.spacer.markers[0],t);e!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[e])}let i=t.view.viewport;return!o.RangeSet.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}destroy(){for(let t of this.elements)t.destroy()}}class $s{constructor(t,e,i,o){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,o)}update(t,e,i,o){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!t[i].compare(e[i]))return!1;return!0}(this.markers,o)||this.setMarkers(t,o)}setMarkers(t,e){let i="cm-gutterElement",o=this.dom.firstChild;for(let s=0,n=0;;){let r=n,l=s<e.length?e[s++]:null,h=!1;if(l){let t=l.elementClass;t&&(i+=" "+t);for(let t=n;t<this.markers.length;t++)if(this.markers[t].compare(l)){r=t,h=!0;break}}else r=this.markers.length;for(;n<r;){let t=this.markers[n++];if(t.toDOM){t.destroy(o);let e=o.nextSibling;o.remove(),o=e}}if(!l)break;l.toDOM&&(h?o=o.nextSibling:this.dom.insertBefore(l.toDOM(t),o)),h&&n++}this.dom.className=i,this.markers=e}destroy(){this.setMarkers(null,[])}}const Qs=o.Facet.define(),Js=o.Facet.define({combine:t=>(0,o.combineConfig)(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let t in e){let o=i[t],s=e[t];i[t]=o?(t,e,i)=>o(t,e,i)||s(t,e,i):s}return i}})});class Zs extends Fs{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function tn(t,e){return t.state.facet(Js).formatNumber(e,t.state)}const en=Is.compute([Js],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(Qs),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new Zs(tn(t,t.state.doc.lineAt(e.from).number)),widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(Js)!=t.state.facet(Js),initialSpacer:t=>new Zs(tn(t,sn(t.state.doc.lines))),updateSpacer(t,e){let i=tn(e.view,sn(e.view.state.doc.lines));return i==t.number?t:new Zs(i)},domEventHandlers:t.facet(Js).domEventHandlers})));function on(t={}){return[Js.of(t),Ys(),en]}function sn(t){let e=9;for(;e<t;)e=10*e+9;return e}const nn=new class extends Fs{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},rn=Ws.compute(["selection"],(t=>{let e=[],i=-1;for(let o of t.selection.ranges){let s=t.doc.lineAt(o.head).from;s>i&&(i=s,e.push(nn.range(s)))}return o.RangeSet.of(e)}));function ln(){return rn}const hn=new Map;function an(t){return re.define((e=>({decorations:t.createDeco(e),update(e){this.decorations=t.updateDeco(e,this.decorations)}})),{decorations:t=>t.decorations})}const cn=an(new Io({regexp:/\t| +/g,decoration:t=>function(t){let e=hn.get(t);return e||hn.set(t,e=pt.mark({attributes:"\t"===t?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":t.replace(/ /g,"·")}})),e}(t[0]),boundary:/\S/}));function dn(){return cn}const un=an(new Io({regexp:/\s+$/g,decoration:pt.mark({class:"cm-trailingSpace"}),boundary:/\S/}));function fn(){return un}const pn={HeightMap:wi,HeightOracle:ui,MeasuredHeights:fi,QueryType:gi,ChangedRange:ve,computeOrder:Ft,moveVisually:It}},4434:(t,e,i)=>{i.d(e,{V:()=>r});const o="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),s="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class r{constructor(t,e){this.rules=[];let{finish:i}=e||{};function o(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function s(t,e,n,r){let l=[],h=/^@(\w+)\b/.exec(t[0]),a=h&&"keyframes"==h[1];if(h&&null==e)return n.push(t[0]+";");for(let i in e){let r=e[i];if(/&/.test(i))s(i.split(/,\s*/).map((e=>t.map((t=>e.replace(/&/,t))))).reduce(((t,e)=>t.concat(e))),r,n);else if(r&&"object"==typeof r){if(!h)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(o(i),r,l,a)}else null!=r&&l.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+r+";")}(l.length||a)&&n.push((!i||h||r?t:t.map(i)).join(", ")+" {"+l.join(" ")+"}")}for(let e in t)s(o(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=n[o]||1;return n[o]=t+1,"ͼ"+t.toString(36)}static mount(t,e,i){let o=t[s],n=i&&i.nonce;o?n&&o.setNonce(n):o=new h(t,n),o.mount(Array.isArray(e)?e:[e])}}let l=new Map;class h{constructor(t,e){let i=t.ownerDocument||t,o=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&o.CSSStyleSheet){let e=l.get(i);if(e)return t.adoptedStyleSheets=[e.sheet,...t.adoptedStyleSheets],t[s]=e;this.sheet=new o.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],l.set(i,this)}else{this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);let o=t.head||t;o.insertBefore(this.styleTag,o.firstChild)}this.modules=[],t[s]=this}mount(t){let e=this.sheet,i=0,o=0;for(let s=0;s<t.length;s++){let n=t[s],r=this.modules.indexOf(n);if(r<o&&r>-1&&(this.modules.splice(r,1),o--,r=-1),-1==r){if(this.modules.splice(o++,0,n),e)for(let t=0;t<n.rules.length;t++)e.insertRule(n.rules[t],i++)}else{for(;o<r;)i+=this.modules[o++].rules.length;i+=n.rules.length,o++}}if(!e){let t="";for(let e=0;e<this.modules.length;e++)t+=this.modules[e].getRules()+"\n";this.styleTag.textContent=t}}setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3129,9268],{79268:(e,n,r)=>{r.r(n),r.d(n,{createMarkdownParser:()=>l,default:()=>u});var t=r(20998),a=r(44548),i=r(81059),o=r(50102),s=r(28986);const c="```~~~";function l(e,n){return{render:r=>d.render(r,e,n)}}const u={id:"@jupyterlab/markedparser-extension:plugin",description:"Provides the Markdown parser.",autoStart:!0,provides:o.IMarkdownParser,requires:[i.IEditorLanguageRegistry],optional:[s.IMermaidMarkdown],activate:(e,n,r)=>l(n,{blocks:r?[r]:[]})};var d;!function(e){let n=null,i=null,o=[],s=null,l={},u=new a.LruCache;async function d(e){if(i)return i;if(n)return await n.promise;o=(null==e?void 0:e.blocks)||[],o=o.sort(((e,n)=>{var r,t;return(null!==(r=e.rank)&&void 0!==r?r:1/0)-(null!==(t=n.rank)&&void 0!==t?t:1/0)})),n=new t.PromiseDelegate;const[{marked:a,Renderer:s},c]=await Promise.all([r.e(4329).then(r.t.bind(r,74329,23)),f()]);for(const e of c)a.use(e);return l={async:!0,gfm:!0,walkTokens:w,renderer:g(s)},i=a,n.resolve(i),i}async function f(){return Promise.all([(async()=>(await r.e(4152).then(r.t.bind(r,24152,23))).gfmHeadingId())(),(async()=>(await r.e(9853).then(r.t.bind(r,29853,23))).mangle())()])}function g(e){const n=new e,r=n.code;return n.code=(e,t)=>{for(const n of o)if(n.languages.includes(t)){const r=n.render(e);if(null!=r)return r}const a=`${t}${c}${e}${c}`,i=u.get(a);return null!=i?i:r.call(n,e,t)},n}async function w(e){if("code"===e.type){if(e.lang)for(const n of o)if(n.languages.includes(e.lang))return void await n.walk(e.text);await async function(e){const{lang:n,text:r}=e;if(!n||!s)return;const t=`${n}${c}${r}${c}`;if(u.get(t))return;const a=document.createElement("div");try{await s.highlight(r,s.findBest(n),a);const e=`<pre><code class="language-${n}">${a.innerHTML}</code></pre>`;u.set(t,e)}catch(e){console.error(`Failed to highlight ${n} code`,e)}finally{a.remove()}}(e)}}e.render=async function(e,n,r){return s=n,i||(i=await d(r)),i(e,l)},e.initializeMarked=d}(d||(d={}))}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3129,9268],{79268:(e,n,r)=>{r.r(n),r.d(n,{createMarkdownParser:()=>l,default:()=>u});var t=r(21961),a=r(20754),i=r(3984),o=r(58194),s=r(55352);const c="```~~~";function l(e,n){return{render:r=>d.render(r,e,n)}}const u={id:"@jupyterlab/markedparser-extension:plugin",description:"Provides the Markdown parser.",autoStart:!0,provides:o.IMarkdownParser,requires:[i.IEditorLanguageRegistry],optional:[s.IMermaidMarkdown],activate:(e,n,r)=>l(n,{blocks:r?[r]:[]})};var d;!function(e){let n=null,i=null,o=[],s=null,l={},u=new a.LruCache;async function d(e){if(i)return i;if(n)return await n.promise;o=(null==e?void 0:e.blocks)||[],o=o.sort(((e,n)=>{var r,t;return(null!==(r=e.rank)&&void 0!==r?r:1/0)-(null!==(t=n.rank)&&void 0!==t?t:1/0)})),n=new t.PromiseDelegate;const[{marked:a,Renderer:s},c]=await Promise.all([r.e(4329).then(r.t.bind(r,74329,23)),f()]);for(const e of c)a.use(e);return l={async:!0,gfm:!0,walkTokens:w,renderer:g(s)},i=a,n.resolve(i),i}async function f(){return Promise.all([(async()=>(await r.e(4152).then(r.t.bind(r,24152,23))).gfmHeadingId())(),(async()=>(await r.e(9853).then(r.t.bind(r,29853,23))).mangle())()])}function g(e){const n=new e,r=n.code;return n.code=(e,t)=>{for(const n of o)if(n.languages.includes(t)){const r=n.render(e);if(null!=r)return r}const a=`${t}${c}${e}${c}`,i=u.get(a);return null!=i?i:r.call(n,e,t)},n}async function w(e){if("code"===e.type){if(e.lang)for(const n of o)if(n.languages.includes(e.lang))return void await n.walk(e.text);await async function(e){const{lang:n,text:r}=e;if(!n||!s)return;const t=`${n}${c}${r}${c}`;if(u.get(t))return;const a=document.createElement("div");try{await s.highlight(r,s.findBest(n),a);const e=`<pre><code class="language-${n}">${a.innerHTML}</code></pre>`;u.set(t,e)}catch(e){console.error(`Failed to highlight ${n} code`,e)}finally{a.remove()}}(e)}}e.render=async function(e,n,r){return s=n,i||(i=await d(r)),i(e,l)},e.initializeMarked=d}(d||(d={}))}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3146,4837],{73146:(e,t,o)=>{o.r(t),o.d(t,{INotebookTree:()=>n,NotebookTreeWidget:()=>s});var r=o(12668),a=o(63485);class s extends a.TabPanel{constructor(){super({tabPlacement:"top",tabsMovable:!0,renderer:r.TabBarSvg.defaultRenderer}),this.addClass("jp-TreePanel")}}const n=new(o(20998).Token)("@jupyter-notebook/tree:INotebookTree")}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3146,4837],{73146:(e,t,o)=>{o.r(t),o.d(t,{INotebookTree:()=>n,NotebookTreeWidget:()=>s});var r=o(76878),a=o(2260);class s extends a.TabPanel{constructor(){super({tabPlacement:"top",tabsMovable:!0,renderer:r.TabBarSvg.defaultRenderer}),this.addClass("jp-TreePanel")}}const n=new(o(21961).Token)("@jupyter-notebook/tree:INotebookTree")}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3187],{53187:(e,n,a)=>{a.r(n),a.d(n,{default:()=>d});var l,r=a(27961),t=a(15465),i=a(25291),o=a(12668),s=a(44176);!function(e){e.open="pluginmanager:open",e.refreshPlugins="pluginmanager:refresh"}(l||(l={}));const u="@jupyterlab/pluginmanager-extension:plugin",d=[{id:u,description:"Enable or disable individual plugins.",autoStart:!0,requires:[],optional:[i.ITranslator,t.ICommandPalette,r.ILayoutRestorer],provides:s.IPluginManager,activate:(e,n,a,r)=>{const{commands:d,shell:c}=e,g=(n=null!=n?n:i.nullTranslator).load("jupyterlab"),p=g.__("Plugin Manager"),m=g.__("Advanced Plugin Manager"),P=g.__("Refresh Plugin List"),b=new t.WidgetTracker({namespace:"plugin-manager"});return d.addCommand(l.open,{label:m,execute:a=>{const r=function(a){const r=new s.PluginListModel({...a,pluginData:{availablePlugins:e.info.availablePlugins},serverSettings:e.serviceManager.serverSettings,extraLockedPlugins:[u,"@jupyterlab/application-extension:layout","@jupyterlab/apputils-extension:resolver"],translator:null!=n?n:i.nullTranslator}),c=new s.Plugins({model:r,translator:null!=n?n:i.nullTranslator});c.title.label=m,c.title.icon=o.extensionIcon,c.title.caption=g.__("Plugin Manager");const p=new t.MainAreaWidget({content:c,reveal:r.ready});return p.toolbar.addItem("refresh-plugins",new o.CommandToolbarButton({id:l.refreshPlugins,args:{noLabel:!0},commands:d})),p}(a);return c.add(r,"main",{type:"Plugins"}),b.add(r),r.content.model.trackerDataChanged.connect((()=>{b.save(r)})),r}}),d.addCommand(l.refreshPlugins,{label:e=>e.noLabel?"":P,caption:g.__("Refresh plugins list"),icon:o.refreshIcon,execute:async()=>{var e;return null===(e=b.currentWidget)||void 0===e?void 0:e.content.model.refresh().catch((e=>{console.error(`Failed to refresh the available plugins list:\n${e}`)}))}}),a&&a.addItem({command:l.open,category:p}),r&&r.restore(b,{command:l.open,name:e=>"plugins",args:e=>{const{query:n,isDisclaimed:a}=e.content.model;return{query:n,isDisclaimed:a}}}),{open:()=>e.commands.execute(l.open)}}}]}}]);
1
+ "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[3187],{53187:(e,n,a)=>{a.r(n),a.d(n,{default:()=>d});var l,r=a(73852),t=a(53876),i=a(93050),o=a(76878),s=a(77627);!function(e){e.open="pluginmanager:open",e.refreshPlugins="pluginmanager:refresh"}(l||(l={}));const u="@jupyterlab/pluginmanager-extension:plugin",d=[{id:u,description:"Enable or disable individual plugins.",autoStart:!0,requires:[],optional:[i.ITranslator,t.ICommandPalette,r.ILayoutRestorer],provides:s.IPluginManager,activate:(e,n,a,r)=>{const{commands:d,shell:c}=e,g=(n=null!=n?n:i.nullTranslator).load("jupyterlab"),p=g.__("Plugin Manager"),m=g.__("Advanced Plugin Manager"),P=g.__("Refresh Plugin List"),b=new t.WidgetTracker({namespace:"plugin-manager"});return d.addCommand(l.open,{label:m,execute:a=>{const r=function(a){const r=new s.PluginListModel({...a,pluginData:{availablePlugins:e.info.availablePlugins},serverSettings:e.serviceManager.serverSettings,extraLockedPlugins:[u,"@jupyterlab/application-extension:layout","@jupyterlab/apputils-extension:resolver"],translator:null!=n?n:i.nullTranslator}),c=new s.Plugins({model:r,translator:null!=n?n:i.nullTranslator});c.title.label=m,c.title.icon=o.extensionIcon,c.title.caption=g.__("Plugin Manager");const p=new t.MainAreaWidget({content:c,reveal:r.ready});return p.toolbar.addItem("refresh-plugins",new o.CommandToolbarButton({id:l.refreshPlugins,args:{noLabel:!0},commands:d})),p}(a);return c.add(r,"main",{type:"Plugins"}),b.add(r),r.content.model.trackerDataChanged.connect((()=>{b.save(r)})),r}}),d.addCommand(l.refreshPlugins,{label:e=>e.noLabel?"":P,caption:g.__("Refresh plugins list"),icon:o.refreshIcon,execute:async()=>{var e;return null===(e=b.currentWidget)||void 0===e?void 0:e.content.model.refresh().catch((e=>{console.error(`Failed to refresh the available plugins list:\n${e}`)}))}}),a&&a.addItem({command:l.open,category:p}),r&&r.restore(b,{command:l.open,name:e=>"plugins",args:e=>{const{query:n,isDisclaimed:a}=e.content.model;return{query:n,isDisclaimed:a}}}),{open:()=>e.commands.execute(l.open)}}}]}}]);
@@ -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(25291),h=s(18395),c=s(49503),d=s(63485);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(4708).then(s.t.bind(s,54708,23)),s.e(4430).then(s.t.bind(s,44430,23)),r?s.e(7884).then(s.t.bind(s,47884,23)):s.e(3462).then(s.t.bind(s,63462,23)),s.e(6521).then(s.t.bind(s,86521,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(21961);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(93050),h=s(47392),c=s(62633),d=s(2260);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(4708).then(s.t.bind(s,54708,23)),s.e(4430).then(s.t.bind(s,44430,23)),r?s.e(7884).then(s.t.bind(s,47884,23)):s.e(3462).then(s.t.bind(s,63462,23)),s.e(6521).then(s.t.bind(s,86521,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={}))}}]);