notebook 7.0.0b4__py3-none-any.whl → 7.0.0rc0__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 (205) hide show
  1. notebook/_version.py +1 -1
  2. notebook/app.py +17 -13
  3. notebook/static/1018.bundle.js +1 -1
  4. notebook/static/1198.bundle.js +1 -1
  5. notebook/static/1337.bundle.js +1 -1
  6. notebook/static/134.bundle.js +1 -0
  7. notebook/static/1408.bundle.js +1 -1
  8. notebook/static/1584.bundle.js +1 -1
  9. notebook/static/162.bundle.js +1 -1
  10. notebook/static/1647.bundle.js +1 -1
  11. notebook/static/1650.bundle.js +1 -1
  12. notebook/static/1682.bundle.js +1 -1
  13. notebook/static/1684.bundle.js +1 -1
  14. notebook/static/1809.bundle.js +1 -1
  15. notebook/static/1827.bundle.js +1 -1
  16. notebook/static/1833.bundle.js +1 -1
  17. notebook/static/1835.bundle.js +1 -1
  18. notebook/static/1950.bundle.js +1 -1
  19. notebook/static/1958.bundle.js +1 -1
  20. notebook/static/2007.bundle.js +1 -1
  21. notebook/static/2067.bundle.js +1 -1
  22. notebook/static/2088.bundle.js +1 -1
  23. notebook/static/2089.bundle.js +1 -1
  24. notebook/static/2122.bundle.js +1 -1
  25. notebook/static/2167.bundle.js +1 -1
  26. notebook/static/2184.bundle.js +1 -1
  27. notebook/static/2251.bundle.js +1 -1
  28. notebook/static/2311.bundle.js +1 -1
  29. notebook/static/2323.bundle.js +1 -1
  30. notebook/static/2330.bundle.js +1 -1
  31. notebook/static/2401.bundle.js +1 -1
  32. notebook/static/2479.bundle.js +1 -0
  33. notebook/static/2512.bundle.js +1 -1
  34. notebook/static/2607.bundle.js +1 -1
  35. notebook/static/2913.bundle.js +1 -1
  36. notebook/static/2924.bundle.js +1 -1
  37. notebook/static/2955.bundle.js +1 -0
  38. notebook/static/2979.bundle.js +1 -1
  39. notebook/static/3146.bundle.js +1 -1
  40. notebook/static/3213.bundle.js +1 -1
  41. notebook/static/3340.bundle.js +1 -1
  42. notebook/static/3360.bundle.js +1 -1
  43. notebook/static/3466.bundle.js +1 -1
  44. notebook/static/35.bundle.js +1 -1
  45. notebook/static/3676.bundle.js +1 -1
  46. notebook/static/3680.bundle.js +1 -1
  47. notebook/static/3768.bundle.js +1 -1
  48. notebook/static/377.bundle.js +1 -1
  49. notebook/static/3797.bundle.js +1 -1
  50. notebook/static/3863.bundle.js +1 -1
  51. notebook/static/3881.bundle.js +1 -1
  52. notebook/static/4042.bundle.js +1 -0
  53. notebook/static/4131.bundle.js +1 -1
  54. notebook/static/4205.bundle.js +1 -1
  55. notebook/static/4212.bundle.js +1 -1
  56. notebook/static/4234.bundle.js +1 -1
  57. notebook/static/4382.bundle.js +1 -1
  58. notebook/static/4558.bundle.js +1 -1
  59. notebook/static/4645.bundle.js +1 -1
  60. notebook/static/4746.bundle.js +1 -0
  61. notebook/static/4785.bundle.js +1 -1
  62. notebook/static/4810.bundle.js +1 -1
  63. notebook/static/4811.bundle.js +1 -1
  64. notebook/static/4837.bundle.js +1 -0
  65. notebook/static/5016.bundle.js +1 -1
  66. notebook/static/5088.bundle.js +1 -1
  67. notebook/static/5099.bundle.js +1 -1
  68. notebook/static/5125.bundle.js +2 -0
  69. notebook/static/5135.bundle.js +1 -1
  70. notebook/static/5261.bundle.js +1 -0
  71. notebook/static/5313.bundle.js +1 -1
  72. notebook/static/5325.bundle.js +1 -1
  73. notebook/static/5346.bundle.js +1 -1
  74. notebook/static/5426.bundle.js +1 -1
  75. notebook/static/5573.bundle.js +1 -1
  76. notebook/static/5601.bundle.js +1 -1
  77. notebook/static/5678.bundle.js +1 -1
  78. notebook/static/5733.bundle.js +1 -1
  79. notebook/static/5765.bundle.js +1 -1
  80. notebook/static/5777.bundle.js +1 -1
  81. notebook/static/5828.bundle.js +1 -1
  82. notebook/static/5912.bundle.js +1 -1
  83. notebook/static/5921.bundle.js +1 -1
  84. notebook/static/6017.bundle.js +1 -1
  85. notebook/static/6027.bundle.js +1 -1
  86. notebook/static/6139.bundle.js +1 -1
  87. notebook/static/62.bundle.js +1 -1
  88. notebook/static/6256.bundle.js +1 -1
  89. notebook/static/6271.bundle.js +1 -1
  90. notebook/static/6345.bundle.js +1 -1
  91. notebook/static/6604.bundle.js +1 -1
  92. notebook/static/6621.bundle.js +1 -1
  93. notebook/static/6627.bundle.js +1 -1
  94. notebook/static/6774.bundle.js +1 -0
  95. notebook/static/6815.bundle.js +1 -1
  96. notebook/static/6853.bundle.js +1 -1
  97. notebook/static/6893.bundle.js +1 -1
  98. notebook/static/690.bundle.js +1 -0
  99. notebook/static/6919.bundle.js +3 -3
  100. notebook/static/6962.bundle.js +1 -1
  101. notebook/static/6999.bundle.js +1 -1
  102. notebook/static/7226.bundle.js +1 -1
  103. notebook/static/7252.bundle.js +1 -0
  104. notebook/static/7302.bundle.js +1 -1
  105. notebook/static/7369.bundle.js +1 -1
  106. notebook/static/7386.bundle.js +1 -1
  107. notebook/static/7391.bundle.js +1 -1
  108. notebook/static/7394.bundle.js +1 -1
  109. notebook/static/7427.bundle.js +1 -0
  110. notebook/static/7439.bundle.js +1 -1
  111. notebook/static/7450.bundle.js +1 -1
  112. notebook/static/7603.bundle.js +1 -1
  113. notebook/static/7639.bundle.js +1 -1
  114. notebook/static/7679.bundle.js +1 -0
  115. notebook/static/7684.bundle.js +1 -1
  116. notebook/static/7819.bundle.js +1 -1
  117. notebook/static/7900.bundle.js +1 -0
  118. notebook/static/7906.bundle.js +1 -1
  119. notebook/static/7957.bundle.js +1 -1
  120. notebook/static/7997.bundle.js +1 -1
  121. notebook/static/8010.bundle.js +1 -1
  122. notebook/static/8136.bundle.js +1 -1
  123. notebook/static/8578.bundle.js +1 -1
  124. notebook/static/8579.bundle.js +1 -1
  125. notebook/static/8633.bundle.js +1 -1
  126. notebook/static/8771.bundle.js +1 -1
  127. notebook/static/880.bundle.js +1 -1
  128. notebook/static/8845.bundle.js +1 -1
  129. notebook/static/8845.bundle.js.LICENSE.txt +2 -2
  130. notebook/static/8875.bundle.js +1 -1
  131. notebook/static/8907.bundle.js +1 -1
  132. notebook/static/8914.bundle.js +1 -1
  133. notebook/static/8928.bundle.js +1 -0
  134. notebook/static/893.bundle.js +1 -1
  135. notebook/static/901.bundle.js +1 -1
  136. notebook/static/9068.bundle.js +1 -1
  137. notebook/static/9086.bundle.js +1 -1
  138. notebook/static/9151.bundle.js +1 -1
  139. notebook/static/9268.bundle.js +1 -1
  140. notebook/static/9335.bundle.js +1 -1
  141. notebook/static/9341.bundle.js +1 -1
  142. notebook/static/9380.bundle.js +1 -1
  143. notebook/static/9605.bundle.js +1 -1
  144. notebook/static/9609.bundle.js +1 -1
  145. notebook/static/9638.bundle.js +1 -1
  146. notebook/static/9680.bundle.js +1 -0
  147. notebook/static/9685.bundle.js +1 -0
  148. notebook/static/9752.bundle.js +1 -1
  149. notebook/static/9799.bundle.js +1 -1
  150. notebook/static/9852.bundle.js +1 -1
  151. notebook/static/9854.bundle.js +2 -0
  152. notebook/static/bundle.js +1 -1
  153. notebook/static/third-party-licenses.json +151 -127
  154. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/package.json.orig +14 -14
  155. notebook-7.0.0rc0.data/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/shell.json +34 -0
  156. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/documentsearch-extension/package.json.orig +4 -4
  157. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/package.json.orig +6 -6
  158. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/package.json.orig +9 -9
  159. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/package.json.orig +15 -15
  160. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/package.json +11 -11
  161. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/package.json.orig +10 -10
  162. notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.a7e9e50b675118021681.js → notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/568.1b31bd587bea2c1816b1.js +1 -1
  163. notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/7.d4d2f899a93808dccf3d.js +1 -0
  164. notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.2aa8888b3e6b5670842f.js → notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/928.a832439d17633285a072.js +1 -1
  165. notebook-7.0.0rc0.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.b00379f3c5b2b5eb657f.js +1 -0
  166. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/third-party-licenses.json +2 -2
  167. {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/METADATA +2 -2
  168. notebook-7.0.0rc0.dist-info/RECORD +389 -0
  169. {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/WHEEL +1 -1
  170. notebook/static/2274.bundle.js +0 -1
  171. notebook/static/3063.bundle.js +0 -2
  172. notebook/static/3344.bundle.js +0 -1
  173. notebook/static/4190.bundle.js +0 -1
  174. notebook/static/435.bundle.js +0 -1
  175. notebook/static/4964.bundle.js +0 -1
  176. notebook/static/5282.bundle.js +0 -1
  177. notebook/static/5975.bundle.js +0 -1
  178. notebook/static/6695.bundle.js +0 -1
  179. notebook/static/771.bundle.js +0 -1
  180. notebook/static/7827.bundle.js +0 -2
  181. notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/7.9bd87123f72aaa959984.js +0 -1
  182. notebook-7.0.0b4.data/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/remoteEntry.ed19884b54327368a389.js +0 -1
  183. notebook-7.0.0b4.dist-info/RECORD +0 -381
  184. /notebook/static/{3063.bundle.js.LICENSE.txt → 5125.bundle.js.LICENSE.txt} +0 -0
  185. /notebook/static/{7827.bundle.js.LICENSE.txt → 9854.bundle.js.LICENSE.txt} +0 -0
  186. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/etc/jupyter/jupyter_server_config.d/notebook.json +0 -0
  187. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/applications/jupyter-notebook.desktop +0 -0
  188. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/icons/hicolor/scalable/apps/notebook.svg +0 -0
  189. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/menus.json +0 -0
  190. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/pages.json +0 -0
  191. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/title.json +0 -0
  192. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/top.json +0 -0
  193. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/application-extension/zen.json +0 -0
  194. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/help-extension/open.json +0 -0
  195. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/checkpoints.json +0 -0
  196. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/kernel-logo.json +0 -0
  197. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/notebook-extension/scroll-output.json +0 -0
  198. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/file-actions.json +0 -0
  199. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/lab/schemas/@jupyter-notebook/tree-extension/widget.json +0 -0
  200. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/interface-switcher.json +0 -0
  201. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/schemas/@jupyter-notebook/lab-extension/launch-tree.json +0 -0
  202. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/776.c7baadfaddfd4518c935.js +0 -0
  203. {notebook-7.0.0b4.data → notebook-7.0.0rc0.data}/data/share/jupyter/labextensions/@jupyter-notebook/lab-extension/static/style.js +0 -0
  204. {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/entry_points.txt +0 -0
  205. {notebook-7.0.0b4.dist-info → notebook-7.0.0rc0.dist-info}/licenses/LICENSE +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[435],{60690:(e,t,r)=>{r.r(t),r.d(t,{MIME_TYPE:()=>d,RenderedJSON:()=>l,default:()=>h,rendererFactory:()=>c});var o=r(61153),n=r(80259),s=r(46947),a=r(78156),i=r(37634);const d="application/json";class l extends s.Widget{constructor(e){super(),this._rootDOM=null,this.addClass("jp-RenderedJSON"),this.addClass("CodeMirror"),this._mimeType=e.mimeType,this.translator=e.translator||n.nullTranslator}[o.Printing.symbol](){return()=>o.Printing.printWidget(this)}async renderModel(e){const{Component:t}=await Promise.all([r.e(9752),r.e(9501),r.e(9768),r.e(9476),r.e(2308)]).then(r.bind(r,69752)),o=e.data[this._mimeType]||{},n=e.metadata[this._mimeType]||{};return null===this._rootDOM&&(this._rootDOM=(0,i.s)(this.node)),new Promise(((e,r)=>{this._rootDOM.render(a.createElement(t,{data:o,metadata:n,translator:this.translator,forwardedRef:()=>e()}))}))}onBeforeDetach(e){this._rootDOM&&(this._rootDOM.unmount(),this._rootDOM=null)}}const c={safe:!0,mimeTypes:[d],createRenderer:e=>new l(e)},h=[{id:"@jupyterlab/json-extension:factory",description:"Adds renderer for JSON content.",rendererFactory:c,rank:0,dataType:"json",documentWidgetFactoryOptions:{name:"JSON",primaryFileType:"json",fileTypes:["json","notebook","geojson"],defaultFor:["json"]}}]},37634:(e,t,r)=>{var o=r(38005);t.s=o.createRoot,o.hydrateRoot}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[4964],{91138:(t,n,r)=>{r.d(n,{Z:()=>a});var e=r(35050);const o=function(t,n){for(var r=t.length;r--;)if((0,e.Z)(t[r][0],n))return r;return-1};var c=Array.prototype.splice;function i(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}i.prototype.clear=function(){this.__data__=[],this.size=0},i.prototype.delete=function(t){var n=this.__data__,r=o(n,t);return!(r<0||(r==n.length-1?n.pop():c.call(n,r,1),--this.size,0))},i.prototype.get=function(t){var n=this.__data__,r=o(n,t);return r<0?void 0:n[r][1]},i.prototype.has=function(t){return o(this.__data__,t)>-1},i.prototype.set=function(t,n){var r=this.__data__,e=o(r,t);return e<0?(++this.size,r.push([t,n])):r[e][1]=n,this};const a=i},81700:(t,n,r)=>{r.d(n,{Z:()=>c});var e=r(26266),o=r(94311);const c=(0,e.Z)(o.Z,"Map")},24395:(t,n,r)=>{r.d(n,{Z:()=>p});const e=(0,r(26266).Z)(Object,"create");var o=Object.prototype.hasOwnProperty;var c=Object.prototype.hasOwnProperty;function i(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}i.prototype.clear=function(){this.__data__=e?e(null):{},this.size=0},i.prototype.delete=function(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n},i.prototype.get=function(t){var n=this.__data__;if(e){var r=n[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(n,t)?n[t]:void 0},i.prototype.has=function(t){var n=this.__data__;return e?void 0!==n[t]:c.call(n,t)},i.prototype.set=function(t,n){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=e&&void 0===n?"__lodash_hash_undefined__":n,this};const a=i;var s=r(91138),u=r(81700);const l=function(t,n){var r,e,o=t.__data__;return("string"==(e=typeof(r=n))||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==r:null===r)?o["string"==typeof n?"string":"hash"]:o.map};function f(t){var n=-1,r=null==t?0:t.length;for(this.clear();++n<r;){var e=t[n];this.set(e[0],e[1])}}f.prototype.clear=function(){this.size=0,this.__data__={hash:new a,map:new(u.Z||s.Z),string:new a}},f.prototype.delete=function(t){var n=l(this,t).delete(t);return this.size-=n?1:0,n},f.prototype.get=function(t){return l(this,t).get(t)},f.prototype.has=function(t){return l(this,t).has(t)},f.prototype.set=function(t,n){var r=l(this,t),e=r.size;return r.set(t,n),this.size+=r.size==e?0:1,this};const p=f},91642:(t,n,r)=>{r.d(n,{Z:()=>e});const e=r(94311).Z.Symbol},33043:(t,n,r)=>{r.d(n,{Z:()=>e});const e=function(t,n){for(var r=-1,e=null==t?0:t.length,o=Array(e);++r<e;)o[r]=n(t[r],r,t);return o}},78402:(t,n,r)=>{r.d(n,{Z:()=>c});var e=r(79148),o=r(13550);const c=function(t,n){for(var r=0,c=(n=(0,e.Z)(n,t)).length;null!=t&&r<c;)t=t[(0,o.Z)(n[r++])];return r&&r==c?t:void 0}},77070:(t,n,r)=>{r.d(n,{Z:()=>l});var e=r(91642),o=Object.prototype,c=o.hasOwnProperty,i=o.toString,a=e.Z?e.Z.toStringTag:void 0;var s=Object.prototype.toString;var u=e.Z?e.Z.toStringTag:void 0;const l=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?function(t){var n=c.call(t,a),r=t[a];try{t[a]=void 0;var e=!0}catch(t){}var o=i.call(t);return e&&(n?t[a]=r:delete t[a]),o}(t):function(t){return s.call(t)}(t)}},79148:(t,n,r)=>{r.d(n,{Z:()=>a});var e=r(64058),o=r(3818),c=r(72977),i=r(70023);const a=function(t,n){return(0,e.Z)(t)?t:(0,o.Z)(t,n)?[t]:(0,c.Z)((0,i.Z)(t))}},89268:(t,n,r)=>{r.d(n,{Z:()=>e});const e="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g},26266:(t,n,r)=>{r.d(n,{Z:()=>d});var e=r(48489);const o=r(94311).Z["__core-js_shared__"];var c,i=(c=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+c:"";var a=r(60417),s=r(62392),u=/^\[object .+?Constructor\]$/,l=Function.prototype,f=Object.prototype,p=l.toString,h=f.hasOwnProperty,_=RegExp("^"+p.call(h).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const v=function(t){return!(!(0,a.Z)(t)||(n=t,i&&i in n))&&((0,e.Z)(t)?_:u).test((0,s.Z)(t));var n},d=function(t,n){var r=function(t,n){return null==t?void 0:t[n]}(t,n);return v(r)?r:void 0}},3818:(t,n,r)=>{r.d(n,{Z:()=>a});var e=r(64058),o=r(59660),c=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,i=/^\w*$/;const a=function(t,n){if((0,e.Z)(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!(0,o.Z)(t))||i.test(t)||!c.test(t)||null!=n&&t in Object(n)}},94311:(t,n,r)=>{r.d(n,{Z:()=>c});var e=r(89268),o="object"==typeof self&&self&&self.Object===Object&&self;const c=e.Z||o||Function("return this")()},72977:(t,n,r)=>{r.d(n,{Z:()=>a});var e=r(24395);function o(t,n){if("function"!=typeof t||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var r=function(){var e=arguments,o=n?n.apply(this,e):e[0],c=r.cache;if(c.has(o))return c.get(o);var i=t.apply(this,e);return r.cache=c.set(o,i)||c,i};return r.cache=new(o.Cache||e.Z),r}o.Cache=e.Z;var c=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;const a=(s=o((function(t){var n=[];return 46===t.charCodeAt(0)&&n.push(""),t.replace(c,(function(t,r,e,o){n.push(e?o.replace(i,"$1"):r||t)})),n}),(function(t){return 500===u.size&&u.clear(),t})),u=s.cache,s);var s,u},13550:(t,n,r)=>{r.d(n,{Z:()=>o});var e=r(59660);const o=function(t){if("string"==typeof t||(0,e.Z)(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},62392:(t,n,r)=>{r.d(n,{Z:()=>o});var e=Function.prototype.toString;const o=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},35050:(t,n,r)=>{r.d(n,{Z:()=>e});const e=function(t,n){return t===n||t!=t&&n!=n}},44964:(t,n,r)=>{r.d(n,{Z:()=>o});var e=r(78402);const o=function(t,n,r){var o=null==t?void 0:(0,e.Z)(t,n);return void 0===o?r:o}},64058:(t,n,r)=>{r.d(n,{Z:()=>e});const e=Array.isArray},48489:(t,n,r)=>{r.d(n,{Z:()=>c});var e=r(77070),o=r(60417);const c=function(t){if(!(0,o.Z)(t))return!1;var n=(0,e.Z)(t);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}},60417:(t,n,r)=>{r.d(n,{Z:()=>e});const e=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)}},9615:(t,n,r)=>{r.d(n,{Z:()=>e});const e=function(t){return null!=t&&"object"==typeof t}},59660:(t,n,r)=>{r.d(n,{Z:()=>c});var e=r(77070),o=r(9615);const c=function(t){return"symbol"==typeof t||(0,o.Z)(t)&&"[object Symbol]"==(0,e.Z)(t)}},70023:(t,n,r)=>{r.d(n,{Z:()=>l});var e=r(91642),o=r(33043),c=r(64058),i=r(59660),a=e.Z?e.Z.prototype:void 0,s=a?a.toString:void 0;const u=function t(n){if("string"==typeof n)return n;if((0,c.Z)(n))return(0,o.Z)(n,t)+"";if((0,i.Z)(n))return s?s.call(n):"";var r=n+"";return"0"==r&&1/n==-1/0?"-0":r},l=function(t){return null==t?"":u(t)}}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[5282,3344],{55282:()=>{}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[5975],{85975:(t,e,i)=>{i.r(e),i.d(e,{BidiSpan:()=>oe,BlockInfo:()=>ri,BlockType:()=>ut,Decoration:()=>ft,Direction:()=>Yt,EditorView:()=>qi,GutterMarker:()=>Mo,MatchDecorator:()=>ks,RectangleMarker:()=>os,ViewPlugin:()=>Ft,ViewUpdate:()=>$t,WidgetType:()=>dt,__test:()=>Qo,closeHoverTooltips:()=>po,crosshairCursor:()=>Us,drawSelection:()=>fs,dropCursor:()=>Ms,getPanel:()=>vo,getTooltip:()=>co,gutter:()=>Do,gutterLineClass:()=>Co,gutters:()=>Oo,hasHoverTooltips:()=>uo,highlightActiveLine:()=>Ns,highlightActiveLineGutter:()=>jo,highlightSpecialChars:()=>Rs,highlightTrailingWhitespace:()=>Jo,highlightWhitespace:()=>Yo,hoverTooltip:()=>ao,keymap:()=>Ji,layer:()=>cs,lineNumberMarkers:()=>Po,lineNumbers:()=>Io,logException:()=>Vt,panels:()=>wo,placeholder:()=>Is,rectangularSelection:()=>Gs,repositionTooltips:()=>go,runScopeHandlers:()=>ts,scrollPastEnd:()=>Ps,showPanel:()=>xo,showTooltip:()=>so,tooltips:()=>Xs});for(var s=i(34837),o=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&&/Chrome\/(\d+)/.exec(navigator.userAgent),h=("undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent),"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)),a="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),c=h||l&&+l[1]<57,d=0;d<10;d++)n[48+d]=n[96+d]=String(d);for(d=1;d<=24;d++)n[d+111]="F"+d;for(d=65;d<=90;d++)n[d]=String.fromCharCode(d+32),r[d]=String.fromCharCode(d);for(var u in n)r.hasOwnProperty(u)||(r[u]=n[u]);function f(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function p(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function g(t,e){if(!e.anchorNode)return!1;try{return p(t,e.anchorNode)}catch(t){return!1}}function m(t){return 3==t.nodeType?D(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function w(t,e,i,s){return!!i&&(b(t,e,i,s,-1)||b(t,e,i,s,1))}function v(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function b(t,e,i,s,o){for(;;){if(t==i&&e==s)return!0;if(e==(o<0?0:y(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=v(t)+(o<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(o<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=o<0?y(t):0}}}function y(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function S(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function x(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class M{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){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,s){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=s}}let C,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++],s=e[t++],o=e[t++];i.scrollTop!=s&&(i.scrollTop=s),i.scrollLeft!=o&&(i.scrollLeft=o)}}}function D(t,e,i=e){let s=C||(C=document.createRange());return s.setEnd(t,i),s.setStart(t,e),s}function T(t,e,i){let s={key:e,code:e,keyCode:i,which:i,cancelable:!0},o=new KeyboardEvent("keydown",s);o.synthetic=!0,t.dispatchEvent(o);let n=new KeyboardEvent("keyup",s);return n.synthetic=!0,t.dispatchEvent(n),o.defaultPrevented||n.defaultPrevented}function O(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}class E{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new E(t.parentNode,v(t),e)}static after(t,e){return new E(t.parentNode,v(t)+1,e)}}const R=[];class B{constructor(){this.parent=null,this.dom=null,this.dirty=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.dirty){let i,s=this.dom,o=null;for(let n of this.children){if(n.dirty){if(!n.dom&&(i=o?o.nextSibling:s.firstChild)){let t=B.get(i);(!t||!t.parent&&t.canReuseDOM(n))&&n.reuseDOM(i)}n.sync(t,e),n.dirty=0}if(i=o?o.nextSibling:s.firstChild,e&&!e.written&&e.node==s&&i!=n.dom&&(e.written=!0),n.dom.parentNode==s)for(;i&&i!=n.dom;)i=L(i);else s.insertBefore(n.dom,i);o=n.dom}for(i=o?o.nextSibling:s.firstChild,i&&e&&e.node==s&&(e.written=!0);i;)i=L(i)}else if(1&this.dirty)for(let i of this.children)i.dirty&&(i.sync(t,e),i.dirty=0)}reuseDOM(t){}localPosFromDOM(t,e){let i;if(t==this.dom)i=this.dom.childNodes[e];else{let s=0==y(t)?0:0==e?-1:1;for(;;){let e=t.parentNode;if(e==this.dom)break;0==s&&e.firstChild!=e.lastChild&&(s=t==e.firstChild?-1:1),t=e}i=s<0?t:t.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!B.get(i);)i=i.nextSibling;if(!i)return this.length;for(let t=0,e=0;;t++){let s=this.children[t];if(s.dom==i)return e;e+=s.length+s.breakAfter}}domBoundsAround(t,e,i=0){let s=-1,o=-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==s&&(s=l,o=h),h>e&&i.dom.parentNode==this.dom){n=l,r=a;break}a=c,h=c+i.breakAfter}return{from:o,to:r<0?i+this.length:r,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:n<this.children.length&&n>=0?this.children[n].dom:null}}markDirty(t=!1){this.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(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=R){this.markDirty();for(let i=t;i<e;i++){let t=this.children[i];t.parent==this&&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 H(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,s,o,n){return!1}become(t){return!1}canReuseDOM(t){return t.constructor==this.constructor}getSide(){return 0}destroy(){this.parent=null}}function L(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}B.prototype.breakAfter=0;class H{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 V(t,e,i,s,o,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==s&&c&&!r&&!u&&n.length<2&&c.merge(i,o,n.length?d:null,0==i,l,h))){if(s<a.length){let t=a[s];t&&o<t.length?(e==s&&(t=t.split(o),o=0),!u&&d&&t.merge(0,o,d,!0,0,h)?n[n.length-1]=t:(o&&t.merge(0,o,null,!1,0,h),n.push(t))):(null==t?void 0:t.breakAfter)&&(d?d.breakAfter=1:r=1),s++}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<s&&n.length;)if(a[s-1].become(n[n.length-1]))s--,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&&s<a.length&&!a[e-1].breakAfter&&a[s].merge(0,0,a[e-1],!1,l,h)&&e--,(e<s||n.length)&&t.replaceChildren(e,s,n)}}function P(t,e,i,s,o,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 s)d+=t.length;t.length+=d,V(t,a,c,l,h,s,0,o,n)}let N="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},W="undefined"!=typeof document?document:{documentElement:{style:{}}};const F=/Edge\/(\d+)/.exec(N.userAgent),z=/MSIE \d/.test(N.userAgent),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(N.userAgent),K=!!(z||I||F),q=!K&&/gecko\/(\d+)/i.test(N.userAgent),G=!K&&/Chrome\/(\d+)/.exec(N.userAgent),j="webkitFontSmoothing"in W.documentElement.style,_=!K&&/Apple Computer/.test(N.vendor),U=_&&(/Mobile\/\w+/.test(N.userAgent)||N.maxTouchPoints>2);var $={mac:U||/Mac/.test(N.platform),windows:/Win/.test(N.platform),linux:/Linux|X11/.test(N.platform),ie:K,ie_version:z?W.documentMode||6:I?+I[1]:F?+F[1]:0,gecko:q,gecko_version:q?+(/Firefox\/(\d+)/.exec(N.userAgent)||[0,0])[1]:0,chrome:!!G,chrome_version:G?+G[1]:0,ios:U,android:/Android\b/.test(N.userAgent),webkit:j,safari:_,webkit_version:j?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=W.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Y extends B{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(!i||i instanceof Y&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new Y(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new E(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 J(this.dom,t,e)}}class X extends B{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}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t,e){this.dom?4&this.dirty&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,i,s,o,n){return!(i&&(!(i instanceof X&&i.mark.eq(this.mark))||t&&o<=0||e<this.length&&n<=0)||(P(this,t,e,i?i.children:[],o-1,n-1),this.markDirty(),0))}split(t){let e=[],i=0,s=-1,o=0;for(let n of this.children){let r=i+n.length;r>t&&e.push(i<t?n.split(t-i):n),s<0&&i>=t&&(s=o),i=r,o++}let n=this.length-t;return this.length=t,s>-1&&(this.children.length=s,this.markDirty()),new X(this.mark,e,n)}domAtPos(t){return nt(this,t)}coordsAt(t,e){return lt(this,t,e)}}function J(t,e,i){let s=t.nodeValue.length;e>s&&(e=s);let o=e,n=e,r=0;0==e&&i<0||e==s&&i>=0?$.chrome||$.gecko||(e?(o--,r=1):n<s&&(n++,r=-1)):i<0?o--:n<s&&n++;let l=D(t,o,n).getClientRects();if(!l.length)return null;let h=l[(r?r<0:i>=0)?0:l.length-1];return $.safari&&!r&&0==h.width&&(h=Array.prototype.find.call(l,(t=>t.width))||h),r?S(h,r<0):h||null}class Q extends B{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||Q)(t,e,i)}split(t){let e=Q.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.dom.contentEditable="false")}getSide(){return this.side}merge(t,e,i,s,o,n){return!(i&&(!(i instanceof Q&&this.widget.compare(i.widget))||t>0&&o<=0||e<this.length&&n<=0)||(this.length=t+(i?i.length:0)+(this.length-e),0))}become(t){return t instanceof Q&&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 s.Text.empty;let t=this;for(;t.parent;)t=t.parent;let{view:e}=t,i=e&&e.state.doc,o=this.posAtStart;return i?i.slice(o,o+this.length):s.Text.empty}domAtPos(t){return(this.length?0==t:this.side>0)?E.before(this.dom):E.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 s=this.dom.getClientRects(),o=null;if(!s.length)return null;for(let e=t>0?s.length-1:0;o=s[e],!(t>0?0==e:e==s.length-1||o.top<o.bottom);e+=t>0?-1:1);return this.length?o:S(o,this.side>0)}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 Z extends Q{domAtPos(t){let{topView:e,text:i}=this.widget;return e?tt(t,0,e,i,this.length-e.length,((t,e)=>t.domAtPos(e)),((t,e)=>new E(t,Math.min(e,t.nodeValue.length)))):new E(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:s}=this.widget;return i?it(t,e,i,s,this.length-i.length):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:s}=this.widget;return i?tt(t,e,i,s,this.length-i.length,((t,e,i)=>t.coordsAt(e,i)),((t,e,i)=>J(t,e,i))):J(s,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function tt(t,e,i,s,o,n,r){if(i instanceof X){for(let l=i.dom.firstChild;l;l=l.nextSibling){let i=B.get(l);if(i){let h=p(l,s),a=i.length+(h?o:0);if(t<a||t==a&&i.getSide()<=0)return h?tt(t,e,i,s,o,n,r):n(i,t,e);t-=a}else{let i=et(t,e,l,r);if("number"!=typeof i)return i;t=i}}return n(i,i.length,-1)}return i.dom==s?r(s,t,e):n(i,t,e)}function et(t,e,i,s){if(3==i.nodeType){let o=i.nodeValue.length;if(t<=o)return s(i,t,e);t-=o}else if(1==i.nodeType&&"false"!=i.contentEditable)for(let o=i.firstChild;o;o=o.nextSibling){let i=et(t,e,o,s);if("number"!=typeof i)return i;t=i}return t}function it(t,e,i,s,o){if(i instanceof X){let n=0;for(let r=i.dom.firstChild;r;r=r.nextSibling){let i=B.get(r);if(i){let l=p(r,s);if(p(r,t))return n+(l?it(t,e,i,s,o):i.localPosFromDOM(t,e));n+=i.length+(l?o:0)}else{let i=st(t,e,r);if(null!=i.result)return n+i.result;n+=i.size}}}else if(i.dom==s)return Math.min(e,s.nodeValue.length);return i.localPosFromDOM(t,e)}function st(t,e,i){if(3==i.nodeType)return t==i?{result:e}:{size:i.nodeValue.length};if(1!=i.nodeType||"false"==i.contentEditable)return i.contains(t)?{result:0}:{size:0};{let s=0;for(let o=i.firstChild,n=0;;o=o.nextSibling,n++){if(t==i&&n==e)return{result:s};if(!o)return{size:s};let r=st(t,e,o);if(null!=r.result)return{result:e+r.result};s+=r.size}}}class ot extends B{constructor(t){super(),this.side=t}get length(){return 0}merge(){return!1}become(t){return t instanceof ot&&t.side==this.side}split(){return new ot(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?E.before(this.dom):E.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return s.Text.empty}get isHidden(){return!0}}function nt(t,e){let i=t.dom,{children:s}=t,o=0;for(let t=0;o<s.length;o++){let n=s[o],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=o;t>0;t--){let e=s[t-1];if(e.dom.parentNode==i)return e.domAtPos(e.length)}for(let t=o;t<s.length;t++){let e=s[t];if(e.dom.parentNode==i)return e.domAtPos(0)}return new E(i,0)}function rt(t,e,i){let s,{children:o}=t;i>0&&e instanceof X&&o.length&&(s=o[o.length-1])instanceof X&&s.mark.eq(e.mark)?rt(s,e.children[0],i-1):(o.push(e),e.setParent(t)),t.length+=e.length}function lt(t,e,i){let s=null,o=-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)&&(s=c,o=l-a)),a=d}}(t,e);let l=(i<0?s:n)||s||n;return l?l.coordsAt(Math.max(0,l==s?o:r),i):function(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let i=m(e);return i[i.length-1]||null}(t)}function ht(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}function at(t,e){if(t==e)return!0;if(!t||!e)return!1;let i=Object.keys(t),s=Object.keys(e);if(i.length!=s.length)return!1;for(let o of i)if(-1==s.indexOf(o)||t[o]!==e[o])return!1;return!0}function ct(t,e,i){let s=null;if(e)for(let o in e)i&&o in i||t.removeAttribute(s=o);if(i)for(let o in i)e&&e[o]==i[o]||t.setAttribute(s=o,i[o]);return!!s}Y.prototype.children=Q.prototype.children=ot.prototype.children=R;class dt{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}ignoreEvent(t){return!0}coordsAt(t,e,i){return null}get customView(){return null}get isHidden(){return!1}destroy(t){}}var ut=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(ut||(ut={}));class ft extends s.RangeValue{constructor(t,e,i,s){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(t){return new pt(t)}static widget(t){let e=t.side||0,i=!!t.block;return e+=i?e>0?3e8:-4e8:e>0?1e8:-1e8,new mt(t,e,e,i,t.widget||null,!1)}static replace(t){let e,i,s=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{let{start:o,end:n}=wt(t,s);e=(o?s?-3e8:-1:5e8)-1,i=1+(n?s?2e8:1:-6e8)}return new mt(t,e,i,s,t.widget||null,!0)}static line(t){return new gt(t)}static set(t,e=!1){return s.RangeSet.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}ft.none=s.RangeSet.empty;class pt extends ft{constructor(t){let{start:e,end:i}=wt(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){return this==t||t instanceof pt&&this.tagName==t.tagName&&this.class==t.class&&at(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}pt.prototype.point=!1;class gt extends ft{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof gt&&this.spec.class==t.spec.class&&at(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)}}gt.prototype.mapMode=s.MapMode.TrackBefore,gt.prototype.point=!0;class mt extends ft{constructor(t,e,i,o,n,r){super(e,i,n,t),this.block=o,this.isReplace=r,this.mapMode=o?e<=0?s.MapMode.TrackBefore:s.MapMode.TrackAfter:s.MapMode.TrackDel}get type(){return this.startSide<this.endSide?ut.WidgetRange:this.startSide<=0?ut.WidgetBefore:ut.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&this.widget.estimatedHeight>=5}eq(t){return t instanceof mt&&((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 wt(t,e=!1){let{inclusiveStart:i,inclusiveEnd:s}=t;return null==i&&(i=t.inclusive),null==s&&(s=t.inclusive),{start:null!=i?i:e,end:null!=s?s:e}}function vt(t,e,i,s=0){let o=i.length-1;o>=0&&i[o]+s>=t?i[o]=Math.max(i[o],e):i.push(t,e)}mt.prototype.point=!0;class bt extends B{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,s,o,n){if(i){if(!(i instanceof bt))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),P(this,t,e,i?i.children:[],o,n),!0}split(t){let e=new bt;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i,off:s}=this.childPos(t);s&&(e.append(this.children[i].split(s),0),this.children[i].merge(s,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){at(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){rt(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=ht(e,this.attrs||{})),i&&(this.attrs=ht({class:i},this.attrs||{}))}domAtPos(t){return nt(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t,e){var i;this.dom?4&this.dirty&&(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&&(ct(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let s=this.dom.lastChild;for(;s&&B.get(s)instanceof X;)s=s.lastChild;if(!(s&&this.length&&("BR"==s.nodeName||0!=(null===(i=B.get(s))||void 0===i?void 0:i.isEditable)||$.ios&&this.children.some((t=>t instanceof Y))))){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 Y)||/[^ -~]/.test(i.text))return null;let s=m(i.dom);if(1!=s.length)return null;e+=s[0].width,t=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(t,e){let i=lt(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 s=(e-t.textHeight)/2;return{top:i.top+s,bottom:i.bottom-s,left:i.left,right:i.left}}}return i}become(t){return!1}get type(){return ut.Text}static find(t,e){for(let i=0,s=0;i<t.children.length;i++){let o=t.children[i],n=s+o.length;if(n>=e){if(o instanceof bt)return o;if(n>e)break}s=n+o.breakAfter}return null}}class yt extends B{constructor(t,e,i){super(),this.widget=t,this.length=e,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,s,o,n){return!(i&&(!(i instanceof yt&&this.widget.compare(i.widget))||t>0&&o<=0||e<this.length&&n<=0)||(this.length=t+(i?i.length:0)+(this.length-e),0))}domAtPos(t){return 0==t?E.before(this.dom):E.after(this.dom,t==this.length)}split(t){let e=this.length-t;this.length=t;let i=new yt(this.widget,e,this.type);return i.breakAfter=this.breakAfter,i}get children(){return R}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.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):s.Text.empty}domBoundsAround(){return null}become(t){return t instanceof yt&&t.type==this.type&&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.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)}}class St{constructor(t,e,i,s){this.doc=t,this.pos=e,this.end=i,this.disallowBlockEffectsFor=s,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 yt&&t.type==ut.WidgetBefore)}getLine(){return this.curLine||(this.content.push(this.curLine=new bt),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(xt(new ot(-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()||this.getLine()}buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){let{value:e,lineBreak:i,done:s}=this.cursor.next(this.skip);if(this.skip=0,s)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 s=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(xt(new Y(this.text.slice(this.textOff,this.textOff+s)),e),i),this.atCursorPos=!0,this.textOff+=s,t-=s,i=0}}span(t,e,i,s){this.buildText(e-t,i,s),this.pos=e,this.openStart<0&&(this.openStart=s)}point(t,e,i,s,o,n){if(this.disallowBlockEffectsFor[n]&&i instanceof mt){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 mt)if(i.block){let{type:t}=i;t!=ut.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new yt(i.widget||new Mt("div"),r,t))}else{let n=Q.create(i.widget||new Mt("span"),r,r?0:i.startSide),l=this.atCursorPos&&!n.isEditable&&o<=s.length&&(t<e||i.startSide>0),h=!n.isEditable&&(t<e||o>s.length||i.startSide<=0),a=this.getLine();2!=this.pendingBuffer||l||n.isEditable||(this.pendingBuffer=0),this.flushBuffer(s),l&&(a.append(xt(new ot(1),s),o),o=s.length+Math.max(0,o-s.length)),a.append(xt(n,s),o),this.atCursorPos=h,this.pendingBuffer=h?t<e||o>s.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.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=o)}static build(t,e,i,o,n){let r=new St(t,e,i,n);return r.openEnd=s.RangeSet.spans(o,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function xt(t,e){for(let i of e)t=new X(i,[t],t.length);return t}class Mt extends dt{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}}const Ct=s.Facet.define(),kt=s.Facet.define(),At=s.Facet.define(),Dt=s.Facet.define(),Tt=s.Facet.define(),Ot=s.Facet.define(),Et=s.Facet.define(),Rt=s.Facet.define({combine:t=>t.some((t=>t))}),Bt=s.Facet.define({combine:t=>t.some((t=>t))});class Lt{constructor(t,e="nearest",i="nearest",s=5,o=5){this.range=t,this.y=e,this.x=i,this.yMargin=s,this.xMargin=o}map(t){return t.empty?this:new Lt(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const Ht=s.StateEffect.define({map:(t,e)=>t.map(e)});function Vt(t,e,i){let s=t.facet(Dt);s.length?s[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e)}const Pt=s.Facet.define({combine:t=>!t.length||t[0]});let Nt=0;const Wt=s.Facet.define();class Ft{constructor(t,e,i,s){this.id=t,this.create=e,this.domEventHandlers=i,this.extension=s(this)}static define(t,e){const{eventHandlers:i,provide:s,decorations:o}=e||{};return new Ft(Nt++,t,i,(t=>{let e=[Wt.of(t)];return o&&e.push(qt.of((e=>{let i=e.plugin(t);return i?o(i):ft.none}))),s&&e.push(s(t)),e}))}static fromClass(t,e){return Ft.define((e=>new t(e)),e)}}class zt{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(Vt(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){Vt(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){Vt(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const It=s.Facet.define(),Kt=s.Facet.define(),qt=s.Facet.define(),Gt=s.Facet.define(),jt=s.Facet.define(),_t=s.Facet.define();class Ut{constructor(t,e,i,s){this.fromA=t,this.toA=e,this.fromB=i,this.toB=s}join(t){return new Ut(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 s=t[e-1];if(!(s.fromA>i.toA)){if(s.toA<i.fromA)break;i=i.join(s),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 s=0,o=0,n=0,r=0;;s++){let l=s==t.length?null:t[s],h=n-r,a=l?l.fromB:1e9;for(;o<e.length&&e[o]<a;){let t=e[o],s=e[o+1],n=Math.max(r,t),l=Math.min(a,s);if(n<=l&&new Ut(n+h,l+h,n,l).addToSet(i),s>a)break;o+=2}if(!l)return i;new Ut(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),n=l.toA,r=l.toB}}}class $t{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=s.ChangeSet.empty(this.startState.doc.length);for(let t of i)this.changes=this.changes.compose(t.changes);let o=[];this.changes.iterChangedRanges(((t,e,i,s)=>o.push(new Ut(t,e,i,s)))),this.changedRanges=o}static create(t,e,i){return new $t(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}}var Yt=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Yt||(Yt={}));const Xt=Yt.LTR,Jt=Yt.RTL;function Qt(t){let e=[];for(let i=0;i<t.length;i++)e.push(1<<+t[i]);return e}const Zt=Qt("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),te=Qt("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ee=Object.create(null),ie=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),i=t.charCodeAt(1);ee[e]=i,ee[i]=-e}const se=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class oe{constructor(t,e,i){this.from=t,this.to=e,this.level=i}get dir(){return this.level%2?Jt:Xt}side(t,e){return this.dir==e==t?this.to:this.from}static find(t,e,i,s){let o=-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;(o<0||(0!=s?s<0?r.from<e:r.to>e:t[o].level>r.level))&&(o=n)}}if(o<0)throw new RangeError("Index out of range");return o}}const ne=[];function re(t,e){let i=t.length,s=e==Xt?1:2,o=e==Xt?2:1;if(!t||1==s&&!se.test(t))return le(i);for(let e=0,o=s,r=s;e<i;e++){let i=(n=t.charCodeAt(e))<=247?Zt[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?te[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8203?256:64336<=n&&n<=65023?4:8204==n?256:1;512==i?i=o:8==i&&4==r&&(i=16),ne[e]=4==i?2:i,7&i&&(r=i),o=i}var n;for(let t=0,e=s,o=s;t<i;t++){let s=ne[t];if(128==s)t<i-1&&e==ne[t+1]&&24&e?s=ne[t]=e:ne[t]=256;else if(64==s){let s=t+1;for(;s<i&&64==ne[s];)s++;let n=t&&8==e||s<i&&8==ne[s]?1==o?1:8:256;for(let e=t;e<s;e++)ne[e]=n;t=s-1}else 8==s&&1==o&&(ne[t]=1);e=s,7&s&&(o=s)}for(let e,n,r,l=0,h=0,a=0;l<i;l++)if(n=ee[e=t.charCodeAt(l)])if(n<0){for(let t=h-3;t>=0;t-=3)if(ie[t+1]==-n){let e=ie[t+2],i=2&e?s:4&e?1&e?o:s:0;i&&(ne[l]=ne[ie[t]]=i),h=t;break}}else{if(189==ie.length)break;ie[h++]=l,ie[h++]=e,ie[h++]=a}else if(2==(r=ne[l])||1==r){let t=r==s;a=t?0:1;for(let e=h-3;e>=0;e-=3){let i=ie[e+2];if(2&i)break;if(t)ie[e+2]|=2;else{if(4&i)break;ie[e+2]|=4}}}for(let t=0;t<i;t++)if(256==ne[t]){let e=t+1;for(;e<i&&256==ne[e];)e++;let o=1==(t?ne[t-1]:s),n=o==(1==(e<i?ne[e]:s))?o?1:2:s;for(let i=t;i<e;i++)ne[i]=n;t=e-1}let r=[];if(1==s)for(let t=0;t<i;){let e=t,s=1!=ne[t++];for(;t<i&&s==(1!=ne[t]);)t++;if(s)for(let i=t;i>e;){let t=i,s=2!=ne[--i];for(;i>e&&s==(2!=ne[i-1]);)i--;r.push(new oe(i,t,s?2:1))}else r.push(new oe(e,t,0))}else for(let t=0;t<i;){let e=t,s=2==ne[t++];for(;t<i&&s==(2==ne[t]);)t++;r.push(new oe(e,t,s?1:2))}return r}function le(t){return[new oe(0,t,0)]}let he="";function ae(t,e,i,o,n){var r;let l=o.head-t.from,h=-1;if(0==l){if(!n||!t.length)return null;e[0].level!=i&&(l=e[0].side(!1,i),h=0)}else if(l==t.length){if(n)return null;let t=e[e.length-1];t.level!=i&&(l=t.side(!0,i),h=e.length-1)}h<0&&(h=oe.find(e,l,null!==(r=o.bidiLevel)&&void 0!==r?r:-1,o.assoc));let a=e[h];l==a.side(n,i)&&(a=e[h+=n?1:-1],l=a.side(!n,i));let c=n==(a.dir==i),d=(0,s.findClusterBreak)(t.text,l,c);if(he=t.text.slice(Math.min(l,d),Math.max(l,d)),d!=a.side(n,i))return s.EditorSelection.cursor(d+t.from,c?-1:1,a.level);let u=h==(n?e.length-1:0)?null:e[h+(n?1:-1)];return u||a.level==i?u&&u.level<a.level?s.EditorSelection.cursor(u.side(!n,i)+t.from,n?1:-1,u.level):s.EditorSelection.cursor(d+t.from,n?-1:1,a.level):s.EditorSelection.cursor(n?t.to:t.from,n?-1:1,i)}const ce="￿";class de{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(s.EditorState.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=ce}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let s=t;;){this.findPointBefore(i,s),this.readNode(s);let t=s.nextSibling;if(t==e)break;let o=B.get(s),n=B.get(t);(o&&n?o.breakAfter:(o?o.breakAfter:ue(s))||ue(t)&&("BR"!=s.nodeName||s.cmIgnore))&&this.lineBreak(),s=t}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,s=this.lineSeparator?null:/\r\n?|\n/g;;){let o,n=-1,r=1;if(this.lineSeparator?(n=e.indexOf(this.lineSeparator,i),r=this.lineSeparator.length):(o=s.exec(e))&&(n=o.index,r=o[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=B.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+Math.min(e,i.offset))}}function ue(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class fe{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class pe extends B{constructor(t){super(),this.view=t,this.compositionDeco=ft.none,this.decorations=[],this.dynamicDecorationMap=[],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 bt],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Ut(0,0,0,t.state.doc.length)],0)}get length(){return this.view.state.doc.length}update(t){let e=t.changedRanges;this.minWidth>0&&e.length&&(e.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.view.inputState.composing<0?this.compositionDeco=ft.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=me(t);if(!i)return ft.none;let{from:s,to:o,node:n,text:r}=i,l=e.mapPos(s,1),h=Math.max(l,e.mapPos(o,-1)),{state:a}=t,c=3==n.nodeType?n.nodeValue:new de([],a).readRange(n.firstChild,null).text;if(h-l<c.length)if(a.doc.sliceString(l,Math.min(a.doc.length,l+c.length),ce)==c)h=l+c.length;else{if(a.doc.sliceString(Math.max(0,h-c.length),h,ce)!=c)return ft.none;l=h-c.length}else if(a.doc.sliceString(l,h,ce)!=c)return ft.none;let d=B.get(n);return d instanceof Z?d=d.widget.topView:d&&(d.parent=null),ft.set(ft.replace({widget:new we(n,r,d),inclusive:!0}).range(l,h))}(this.view,t.changes)),($.ie||$.chrome)&&!this.compositionDeco.size&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let i=function(t,e,i){let o=new be;return s.RangeSet.compare(t,e,i,o),o.changes}(this.decorations,this.updateDeco(),t.changes);return e=Ut.extendWithRanges(e,i),(0!=this.dirty||0!=e.length)&&(this.updateInner(e,t.startState.doc.length),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e);let{observer:i}=this.view;i.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=$.chrome||$.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""}));let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let t of this.children)t instanceof yt&&t.widget instanceof ge&&s.push(t.dom);i.updateGaps(s)}updateChildren(t,e){let i=this.childCursor(e);for(let e=t.length-1;;e--){let s=e>=0?t[e]:null;if(!s)break;let{fromA:o,toA:n,fromB:r,toB:l}=s,{content:h,breakAtStart:a,openStart:c,openEnd:d}=St.build(this.view.state.doc,r,l,this.decorations,this.dynamicDecorationMap),{i:u,off:f}=i.findPos(n,1),{i:p,off:g}=i.findPos(o,-1);V(this,p,g,u,f,h,a,c,d)}}updateSelection(t=!1,e=!1){!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let i=this.view.root.activeElement,s=i==this.dom,o=!s&&g(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||e||o))return;let n=this.forceSelection;this.forceSelection=!1;let r=this.view.state.selection.main,l=this.domAtPos(r.anchor),h=r.empty?l:this.domAtPos(r.head);if($.gecko&&r.empty&&!this.compositionDeco.size&&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 E(t,0),n=!0}var a;let c=this.view.observer.selectionRange;!n&&c.focusNode&&w(l.node,l.offset,c.anchorNode,c.anchorOffset)&&w(h.node,h.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{$.android&&$.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=f(this.view.root);if(t)if(r.empty){if($.gecko){let t=(e=l.node,s=l.offset,1!=e.nodeType?0:(s&&"false"==e.childNodes[s-1].contentEditable?1:0)|(s<e.childNodes.length&&"false"==e.childNodes[s].contentEditable?2:0));if(t&&3!=t){let e=ve(l.node,l.offset,1==t?1:-1);e&&(l=new E(e,1==t?0:e.nodeValue.length))}}t.collapse(l.node,l.offset),null!=r.bidiLevel&&null!=c.cursorBidiLevel&&(c.cursorBidiLevel=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,s;o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(l,h)),this.impreciseAnchor=l.precise?null:new E(c.anchorNode,c.anchorOffset),this.impreciseHead=h.precise?null:new E(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=f(t.root),{anchorNode:s,anchorOffset:o}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let n=bt.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(s,o)}nearest(t){for(let e=t;e;){let t=B.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 bt)break;e++,i=0}return this.children[e].domAtPos(i)}coordsAt(t,e){for(let i=this.length,s=this.children.length-1;;s--){let o=this.children[s],n=i-o.breakAfter-o.length;if(t>n||t==n&&o.type!=ut.WidgetBefore&&o.type!=ut.WidgetAfter&&(!s||2==e||this.children[s-1].breakAfter||this.children[s-1].type==ut.WidgetBefore&&e>-2))return o.coordsAt(t-n,e);i=n}}measureVisibleLineHeights(t){let e=[],{from:i,to:s}=t,o=this.view.contentDOM.clientWidth,n=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,l=this.view.textDirection==Yt.LTR;for(let t=0,h=0;h<this.children.length;h++){let a=this.children[h],c=t+a.length;if(c>s)break;if(t>=i){let i=a.dom.getBoundingClientRect();if(e.push(i.height),n){let e=a.dom.lastChild,s=e?m(e):[];if(s.length){let e=s[s.length-1],n=l?e.right-i.left:i.right-e.left;n>r&&(r=n,this.minWidth=o,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?Yt.RTL:Yt.LTR}measureTextSize(){for(let t of this.children)if(t instanceof bt){let e=t.measureTextSize();if(e)return e}let t,e,i,s=document.createElement("div");return s.className="cm-line",s.style.width="99999px",s.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(s);let o=m(s.firstChild)[0];t=s.getBoundingClientRect().height,e=o?o.width/27:7,i=o?o.height:t,s.remove()})),{lineHeight:t,charWidth:e,textHeight:i}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new H(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,s=0;;s++){let o=s==e.viewports.length?null:e.viewports[s],n=o?o.from-1:this.length;if(n>i){let s=e.lineBlockAt(n).bottom-e.lineBlockAt(i).top;t.push(ft.replace({widget:new ge(s),block:!0,inclusive:!0,isBlockGap:!0}).range(i,n))}if(!o)break;i=o.to+1}return ft.set(t)}updateDeco(){let t=this.view.state.facet(qt).map(((t,e)=>(this.dynamicDecorationMap[e]="function"==typeof t)?t(this.view):t));for(let e=t.length;e<t.length+3;e++)this.dynamicDecorationMap[e]=!1;return this.decorations=[...t,this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollIntoView(t){let e,{range:i}=t,s=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1);if(!s)return;!i.empty&&(e=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(s={left:Math.min(s.left,e.left),top:Math.min(s.top,e.top),right:Math.max(s.right,e.right),bottom:Math.max(s.bottom,e.bottom)});let o=0,n=0,r=0,l=0;for(let t of this.view.state.facet(jt).map((t=>t(this.view))))if(t){let{left:e,right:i,top:s,bottom:h}=t;null!=e&&(o=Math.max(o,e)),null!=i&&(n=Math.max(n,i)),null!=s&&(r=Math.max(r,s)),null!=h&&(l=Math.max(l,h))}let h={left:s.left-o,top:s.top-r,right:s.right+n,bottom:s.bottom+l};!function(t,e,i,s,o,n,r,l){let h=t.ownerDocument,a=h.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let t,d=c==h.body;if(d)t=x(a);else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();t={left:e.left,right:e.left+c.clientWidth,top:e.top,bottom:e.top+c.clientHeight}}let u=0,f=0;if("nearest"==o)e.top<t.top?(f=-(t.top-e.top+r),i>0&&e.bottom>t.bottom+f&&(f=e.bottom-t.bottom+f+r)):e.bottom>t.bottom&&(f=e.bottom-t.bottom+r,i<0&&e.top-f<t.top&&(f=-(t.top+f-e.top+r)));else{let s=e.bottom-e.top,n=t.bottom-t.top;f=("center"==o&&s<=n?e.top+s/2-n/2:"start"==o||"center"==o&&i<0?e.top-r:e.bottom-n+r)-t.top}if("nearest"==s?e.left<t.left?(u=-(t.left-e.left+n),i>0&&e.right>t.right+u&&(u=e.right-t.right+u+n)):e.right>t.right&&(u=e.right-t.right+n,i<0&&e.left<t.left+u&&(u=-(t.left+u-e.left+n))):u=("center"==s?e.left+(e.right-e.left)/2-(t.right-t.left)/2:"start"==s==l?e.left-n:e.right-(t.right-t.left)+n)-t.left,u||f)if(d)a.scrollBy(u,f);else{let t=0,i=0;if(f){let t=c.scrollTop;c.scrollTop+=f,i=c.scrollTop-t}if(u){let e=c.scrollLeft;c.scrollLeft+=u,t=c.scrollLeft-e}e={left:e.left-t,top:e.top-i,right:e.right-t,bottom:e.bottom-i},t&&Math.abs(t-u)<1&&(s="nearest"),i&&Math.abs(i-f)<1&&(o="nearest")}if(d)break;c=c.assignedSlot||c.parentNode}else{if(11!=c.nodeType)break;c=c.host}}(this.view.scrollDOM,h,i.head<i.anchor?-1:1,t.x,t.y,t.xMargin,t.yMargin,this.view.textDirection==Yt.LTR)}}class ge extends dt{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}}function me(t){let e=t.observer.selectionRange,i=e.focusNode&&ve(e.focusNode,e.focusOffset,0);if(!i)return null;let s=t.docView.nearest(i);if(!s)return null;if(s instanceof bt){let t=i;for(;t.parentNode!=s.dom;)t=t.parentNode;let e=t.previousSibling;for(;e&&!B.get(e);)e=e.previousSibling;let o=e?B.get(e).posAtEnd:s.posAtStart;return{from:o,to:o,node:t,text:i}}{for(;;){let{parent:t}=s;if(!t)return null;if(t instanceof bt)break;s=t}let t=s.posAtStart;return{from:t,to:t+s.length,node:s.dom,text:i}}}class we extends dt{constructor(t,e,i){super(),this.top=t,this.text=e,this.topView=i}eq(t){return this.top==t.top&&this.text==t.text}toDOM(){return this.top}ignoreEvent(){return!1}get customView(){return Z}}function ve(t,e,i){if(i<=0)for(let i=t,s=e;;){if(3==i.nodeType)return i;if(!(1==i.nodeType&&s>0))break;i=i.childNodes[s-1],s=y(i)}if(i>=0)for(let s=t,o=e;;){if(3==s.nodeType)return s;if(!(1==s.nodeType&&o<s.childNodes.length&&i>=0))break;s=s.childNodes[o],o=0}return null}class be{constructor(){this.changes=[]}compareRange(t,e){vt(t,e,this.changes)}comparePoint(t,e){vt(t,e,this.changes)}}function ye(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function Se(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function xe(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function Me(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function Ce(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function ke(t,e,i){let s,o,n,r,l,h,a,c,d=!1;for(let u=t.firstChild;u;u=u.nextSibling){let t=m(u);for(let f=0;f<t.length;f++){let p=t[f];o&&xe(o,p)&&(p=Me(Ce(p,o.bottom),o.top));let g=ye(e,p),m=Se(i,p);if(0==g&&0==m)return 3==u.nodeType?Ae(u,e,i):ke(u,e,i);if(!s||r>m||r==m&&n>g){s=u,o=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&&xe(a,p)?a=Ce(a,p.bottom):c&&xe(c,p)&&(c=Me(c,p.top))}}if(a&&a.bottom>=i?(s=l,o=a):c&&c.top<=i&&(s=h,o=c),!s)return{node:t,offset:0};let u=Math.max(o.left,Math.min(o.right,e));return 3==s.nodeType?Ae(s,u,i):d&&"false"!=s.contentEditable?ke(s,u,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,s)+(e>=(o.left+o.right)/2?1:0)}}function Ae(t,e,i){let s=t.nodeValue.length,o=-1,n=1e9,r=0;for(let l=0;l<s;l++){let s=D(t,l,l+1).getClientRects();for(let h=0;h<s.length;h++){let a=s[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,s=i;if(($.chrome||$.gecko)&&D(t,l).getBoundingClientRect().left==a.right&&(s=!i),c<=0)return{node:t,offset:l+(s?1:0)};o=l+(s?1:0),n=c}}}return{node:t,offset:o>-1?o:r>0?t.nodeValue.length:0}}function De(t,e,i,s=-1){var o,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.defaultLineHeight/2,o=!1;r=t.elementAtHeight(u),r.type!=ut.Text;)for(;u=s>0?r.bottom+e:r.top-e,!(u>=0&&u<=a);){if(o)return i?null:0;o=!0,s=-s}d=h+u;let f=r.from;if(f<t.viewport.from)return 0==t.viewport.from?0:i?null:Te(t,l,r,c,d);if(f>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:Te(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===(o=t.docView.nearest(m))||void 0===o?void 0:o.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)||$.safari&&function(t,e,i){let s;if(3!=t.nodeType||e!=(s=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,s-1,s).getBoundingClientRect().left>i}(w,v,c)||$.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=bt.find(t.docView,f);if(!e)return u>r.top+r.height/2?r.to:r.from;({node:w,offset:v}=ke(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 Te(t,e,i,o,n){let r=Math.round((o-e.left)*t.defaultCharacterWidth);t.lineWrapping&&i.height>1.5*t.defaultLineHeight&&(r+=Math.floor((n-i.top)/t.defaultLineHeight)*t.viewState.heightOracle.lineLength);let l=t.state.sliceDoc(i.from,i.to);return i.from+(0,s.findColumn)(l,r,t.state.tabSize)}function Oe(t,e,i,o){let n=t.state.doc.lineAt(e.head),r=t.bidiSpans(n),l=t.textDirectionAt(n.from);for(let h=e,a=null;;){let e=ae(n,r,l,h,i),c=he;if(!e){if(n.number==(i?t.state.doc.lines:1))return h;c="\n",n=t.state.doc.line(n.number+(i?1:-1)),r=t.bidiSpans(n),e=s.EditorSelection.cursor(i?n.from:n.to)}if(a){if(!a(c))return h}else{if(!o)return e;a=o(c)}h=e}}function Ee(t,e,i){let o=t.state.facet(Gt).map((e=>e(t)));for(;;){let t=!1;for(let n of o)n.between(i.from-1,i.from+1,((o,n,r)=>{i.from>o&&i.from<n&&(i=e.head>i.from?s.EditorSelection.cursor(o,1):s.EditorSelection.cursor(n,-1),t=!0)}));if(!t)return i}}class Re{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let e=(e,i)=>{this.ignoreDuringComposition(i)||"keydown"==i.type&&this.keydown(t,i)||(this.mustFlushObserver(i)&&t.observer.forceFlush(),this.runCustomHandlers(i.type,t,i)?i.preventDefault():e(t,i))};for(let i in We){let s=We[i];t.contentDOM.addEventListener(i,(i=>{Ne(t,i)&&e(s,i)}),Fe[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(We.mousedown,i),!i.defaultPrevented&&2==i.button)){let e=t.contentDOM.style.minHeight;t.contentDOM.style.minHeight="100%",setTimeout((()=>t.contentDOM.style.minHeight=e),200)}})),t.scrollDOM.addEventListener("drop",(i=>{i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&e(We.drop,i)})),$.chrome&&102==$.chrome_version&&t.scrollDOM.addEventListener("wheel",(()=>{this.chromeScrollHack<0?t.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout((()=>{this.chromeScrollHack=-1,t.contentDOM.style.pointerEvents=""}),100)}),{passive:!0}),this.notifiedFocused=t.hasFocus,$.safari&&t.contentDOM.addEventListener("input",(()=>null))}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}ensureHandlers(t,e){var i;let s;this.customHandlers=[];for(let o of e)if(s=null===(i=o.update(t).spec)||void 0===i?void 0:i.domEventHandlers){this.customHandlers.push({plugin:o.value,handlers:s});for(let e in s)this.registeredEvents.indexOf(e)<0&&"scroll"!=e&&(this.registeredEvents.push(e),t.contentDOM.addEventListener(e,(i=>{Ne(t,i)&&this.runCustomHandlers(e,t,i)&&i.preventDefault()})))}}runCustomHandlers(t,e,i){for(let s of this.customHandlers){let o=s.handlers[t];if(o)try{if(o.call(s.plugin,i,e)||i.defaultPrevented)return!0}catch(t){Vt(e.state,t)}}return!1}runScrollHandlers(t,e){this.lastScrollTop=t.scrollDOM.scrollTop,this.lastScrollLeft=t.scrollDOM.scrollLeft;for(let i of this.customHandlers){let s=i.handlers.scroll;if(s)try{s.call(i.plugin,e,t)}catch(e){Vt(t.state,e)}}}keydown(t,e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&Date.now()<this.lastEscPress+2e3)return!0;if(27!=e.keyCode&&He.indexOf(e.keyCode)<0&&(t.inputState.lastEscPress=0),$.android&&$.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return t.observer.delayAndroidKey(e.key,e.keyCode),!0;let i;return!(!$.ios||e.synthetic||e.altKey||e.metaKey||!((i=Be.find((t=>t.keyCode==e.keyCode)))&&!e.ctrlKey||Le.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)||(this.pendingIOSKey=i||e,setTimeout((()=>this.flushIOSKey(t)),250),0))}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,T(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!($.safari&&!$.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}mustFlushObserver(t){return"keydown"==t.type&&229!=t.keyCode}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const Be=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Le="dthko",He=[16,17,18,20,91,92,224,225];function Ve(t){return.7*Math.max(0,t)+8}class Pe{constructor(t,e,i,o){this.view=t,this.style=i,this.mustSelect=o,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);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(s.EditorState.allowMultipleSelections)&&function(t,e){let i=t.state.facet(Ct);return i.length?i[0](e):$.mac?e.metaKey:e.ctrlKey}(t,e),this.dragMove=function(t,e){let i=t.state.facet(kt);return i.length?i[0](e):$.mac?!e.altKey:!e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let s=f(t.root);if(!s||0==s.rangeCount)return!0;let o=s.getRangeAt(0).getClientRects();for(let t=0;t<o.length;t++){let i=o[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!=Je(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,s=0,o=(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};t.clientX<=o.left+6?i=-Ve(o.left-t.clientX):t.clientX>=o.right-6&&(i=Ve(t.clientX-o.right)),t.clientY<=o.top+6?s=-Ve(o.top-t.clientY):t.clientY>=o.bottom-6&&(s=Ve(t.clientY-o.bottom)),this.setScrollSpeed(i,s)}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=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)}select(t){let e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((()=>this.select(this.lastEvent)),20)}}function Ne(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i,s=e.target;s!=t.contentDOM;s=s.parentNode)if(!s||11==s.nodeType||(i=B.get(s))&&i.ignoreEvent(e))return!1;return!0}const We=Object.create(null),Fe=Object.create(null),ze=$.ie&&$.ie_version<15||$.ios&&$.webkit_version<604;function Ie(t,e){let i,{state:o}=t,n=1,r=o.toText(e),l=r.lines==o.selection.ranges.length;if(null!=Ze&&o.selection.ranges.every((t=>t.empty))&&Ze==r.toString()){let t=-1;i=o.changeByRange((i=>{let h=o.doc.lineAt(i.from);if(h.from==t)return{range:i};t=h.from;let a=o.toText((l?r.line(n++).text:e)+o.lineBreak);return{changes:{from:h.from,insert:a},range:s.EditorSelection.cursor(i.from+a.length)}}))}else i=l?o.changeByRange((t=>{let e=r.line(n++);return{changes:{from:t.from,to:t.to,insert:e.text},range:s.EditorSelection.cursor(t.from+e.length)}})):o.replaceSelection(r);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function Ke(t,e,i,o){if(1==o)return s.EditorSelection.cursor(e,i);if(2==o)return function(t,e,i=1){let o=t.charCategorizer(e),n=t.doc.lineAt(e),r=e-n.from;if(0==n.length)return s.EditorSelection.cursor(e);0==r?i=1:r==n.length&&(i=-1);let l=r,h=r;i<0?l=(0,s.findClusterBreak)(n.text,r,!1):h=(0,s.findClusterBreak)(n.text,r);let a=o(n.text.slice(l,h));for(;l>0;){let t=(0,s.findClusterBreak)(n.text,l,!1);if(o(n.text.slice(t,l))!=a)break;l=t}for(;h<n.length;){let t=(0,s.findClusterBreak)(n.text,h);if(o(n.text.slice(h,t))!=a)break;h=t}return s.EditorSelection.range(l+n.from,h+n.from)}(t.state,e,i);{let i=bt.find(t.docView,e),o=t.state.doc.lineAt(i?i.posAtEnd:e),n=i?i.posAtStart:o.from,r=i?i.posAtEnd:o.to;return r<t.state.doc.length&&r==o.to&&r++,s.EditorSelection.range(n,r)}}We.keydown=(t,e)=>{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},We.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},We.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},Fe.touchstart=Fe.touchmove={passive:!0},We.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let s of t.state.facet(At))if(i=s(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=_e(t,e),o=Je(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=_e(t,e),c=Ke(t,a.pos,a.bias,o);if(i.pos!=a.pos&&!r){let e=Ke(t,i.pos,i.bias,o),n=Math.min(e.from,c.from),r=Math.max(e.to,c.to);c=n<c.from?s.EditorSelection.range(n,r):s.EditorSelection.range(r,n)}return r?n.replaceRange(n.main.extend(c.from,c.to)):l&&1==o&&n.ranges.length>1&&(h=function(t,e){for(let i=0;i<t.ranges.length;i++){let{from:o,to:n}=t.ranges[i];if(o<=e&&n>=e)return s.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):s.EditorSelection.create([c])}}}(t,e)),i){let s=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new Pe(t,e,i,s)),s&&t.observer.ignore((()=>A(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let qe=(t,e)=>t>=e.top&&t<=e.bottom,Ge=(t,e,i)=>qe(e,i)&&t>=i.left&&t<=i.right;function je(t,e,i,s){let o=bt.find(t.docView,e);if(!o)return 1;let n=e-o.posAtStart;if(0==n)return 1;if(n==o.length)return-1;let r=o.coordsAt(n,-1);if(r&&Ge(i,s,r))return-1;let l=o.coordsAt(n,1);return l&&Ge(i,s,l)?1:r&&qe(s,r)?-1:1}function _e(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 Ue=$.ie&&$.ie_version<=11;let $e=null,Ye=0,Xe=0;function Je(t){if(!Ue)return t.detail;let e=$e,i=Xe;return $e=t,Xe=Date.now(),Ye=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Ye+1)%3:1}function Qe(t,e,i,s){if(!i)return;let o=t.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:n}=t.inputState,r=s&&n&&n.dragging&&n.dragMove?{from:n.dragging.from,to:n.dragging.to}:null,l={from:o,insert:i},h=t.state.changes(r?[r,l]:l);t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(o,-1),head:h.mapPos(o,1)},userEvent:r?"move.drop":"input.drop"})}We.dragstart=(t,e)=>{let{selection:{main:i}}=t.state,{mouseSelection:s}=t.inputState;s&&(s.dragging=i),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove")},We.drop=(t,e)=>{if(!e.dataTransfer)return;if(t.state.readOnly)return e.preventDefault();let i=e.dataTransfer.files;if(i&&i.length){e.preventDefault();let s=Array(i.length),o=0,n=()=>{++o==i.length&&Qe(t,e,s.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)||(s[t]=e.result),n()},e.readAsText(i[t])}}else Qe(t,e,e.dataTransfer.getData("Text"),!0)},We.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=ze?null:e.clipboardData;i?(Ie(t,i.getData("text/plain")||i.getData("text/uri-text")),e.preventDefault()):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(),Ie(t,i.value)}),50)}(t)};let Ze=null;We.copy=We.cut=(t,e)=>{let{text:i,ranges:s,linewise:o}=function(t){let e=[],i=[],s=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),i.push(s));if(!e.length){let o=-1;for(let{from:s}of t.selection.ranges){let n=t.doc.lineAt(s);n.number>o&&(e.push(n.text),i.push({from:n.from,to:Math.min(t.doc.length,n.to+1)})),o=n.number}s=!0}return{text:e.join(t.lineBreak),ranges:i,linewise:s}}(t.state);if(!i&&!o)return;Ze=o?i:null;let n=ze?null:e.clipboardData;n?(e.preventDefault(),n.clearData(),n.setData("text/plain",i)):function(t,e){let i=t.dom.parentNode;if(!i)return;let s=i.appendChild(document.createElement("textarea"));s.style.cssText="position: fixed; left: -10000px; top: 10px",s.value=e,s.focus(),s.selectionEnd=e.length,s.selectionStart=0,setTimeout((()=>{s.remove(),t.focus()}),50)}(t,i),"cut"!=e.type||t.state.readOnly||t.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"})};const ti=s.Annotation.define();function ei(t,e){let i=[];for(let s of t.facet(Et)){let o=s(t,e);o&&i.push(o)}return i?t.update({effects:i,annotations:ti.of(!0)}):null}function ii(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=ei(t.state,e);i?t.dispatch(i):t.update([])}}),10)}We.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),ii(t)},We.blur=t=>{t.observer.clearSelectionRange(),ii(t)},We.compositionstart=We.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},We.compositionend=t=>{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,$.chrome&&$.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},We.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},We.beforeinput=(t,e)=>{var i;let s;if($.chrome&&$.android&&(s=Be.find((t=>t.inputType==e.inputType)))&&(t.observer.delayAndroidKey(s.key,s.keyCode),"Backspace"==s.key||"Delete"==s.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)}};const si=["pre-wrap","normal","pre-line","break-spaces"];class oi{constructor(t){this.lineWrapping=t,this.doc=s.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 si.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i<t.length;i++){let s=t[i];s<0?i++:this.heightSamples[Math.floor(10*s)]||(e=!0,this.heightSamples[Math.floor(10*s)]=!0)}return e}refresh(t,e,i,s,o,n){let r=si.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=s,this.lineLength=o,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 ni{constructor(t,e){this.from=t,this.heights=e,this.index=0}get more(){return this.index<this.heights.length}}class ri{constructor(t,e,i,s,o,n){this.from=t,this.length=e,this.top=i,this.height=s,this.children=o,this.deco=n}get type(){var t,e,i;return null!==(i=null!==(t=this.children)&&void 0!==t?t:null===(e=this.deco)||void 0===e?void 0:e.type)&&void 0!==i?i:ut.Text}get widget(){return this.deco&&this.deco.widget}get to(){return this.from+this.length}get bottom(){return this.top+this.height}join(t){let e=(this.children||[this]).concat(t.children||[t]);return new ri(this.from,this.length+t.length,this.top,this.height+t.height,e,null)}}var li=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(li||(li={}));const hi=.001;class ai{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)>hi&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return ai.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,s){let o=this,n=i.doc;for(let r=s.length-1;r>=0;r--){let{fromA:l,toA:h,fromB:a,toB:c}=s[r],d=o.lineAt(l,li.ByPosNoHeight,i.setDoc(e),0,0),u=d.to>=h?d:o.lineAt(h,li.ByPosNoHeight,i,0,0);for(c+=u.to-h,h=u.to;r>0&&d.from<=s[r-1].toA;)l=s[r-1].fromA,a=s[r-1].fromB,r--,l<d.from&&(d=o.lineAt(l,li.ByPosNoHeight,i,0,0));a+=d.from-l,l=d.from;let f=gi.build(i.setDoc(n),t,a,c);o=o.replace(l,h,f)}return o.updateHeight(i,0)}static empty(){return new di(0,0)}static of(t){if(1==t.length)return t[0];let e=0,i=t.length,s=0,o=0;for(;;)if(e==i)if(s>2*o){let o=t[e-1];o.break?t.splice(--e,1,o.left,null,o.right):t.splice(--e,1,o.left,o.right),i+=1+o.break,s-=o.size}else{if(!(o>2*s))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,o-=e.size}}else if(s<o){let i=t[e++];i&&(s+=i.size)}else{let e=t[--i];e&&(o+=e.size)}let n=0;return null==t[e-1]?(n=1,e--):null==t[e]&&(n=1,i++),new fi(ai.of(t.slice(0,e)),n,ai.of(t.slice(i)))}}ai.prototype.size=1;class ci extends ai{constructor(t,e,i){super(t,e),this.deco=i}blockAt(t,e,i,s){return new ri(s,this.length,i,this.height,null,this.deco)}lineAt(t,e,i,s,o){return this.blockAt(0,i,s,o)}forEachLine(t,e,i,s,o,n){t<=o+this.length&&e>=o&&n(this.blockAt(0,i,s,o))}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more&&this.setHeight(t,s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class di extends ci{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let s=i[0];return 1==i.length&&(s instanceof di||s instanceof ui&&4&s.flags)&&Math.abs(this.length-s.length)<10?(s instanceof ui?s=new di(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):ai.of(i)}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more?this.setHeight(t,s.heights[s.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ui extends ai{constructor(t){super(t,0)}heightMetrics(t,e){let i,s=t.doc.lineAt(e).number,o=t.doc.lineAt(e+this.length).number,n=o-s+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:s,lastLine:o,perLine:i,perChar:r}}blockAt(t,e,i,s){let{firstLine:o,lastLine:n,perLine:r,perChar:l}=this.heightMetrics(e,s);if(e.lineWrapping){let o=s+Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length),n=e.doc.lineAt(o),h=r+n.length*l,a=Math.max(i,t-h/2);return new ri(n.from,n.length,a,h,null,null)}{let s=Math.max(0,Math.min(n-o,Math.floor((t-i)/r))),{from:l,length:h}=e.doc.line(o+s);return new ri(l,h,i+r*s,r,null,null)}}lineAt(t,e,i,s,o){if(e==li.ByHeight)return this.blockAt(t,i,s,o);if(e==li.ByPosNoHeight){let{from:e,to:s}=i.doc.lineAt(t);return new ri(e,s-e,0,0,null,null)}let{firstLine:n,perLine:r,perChar:l}=this.heightMetrics(i,o),h=i.doc.lineAt(t),a=r+h.length*l,c=h.number-n,d=s+r*c+l*(h.from-o-c);return new ri(h.from,h.length,Math.max(s,Math.min(d,s+this.height-a)),a,null,null)}forEachLine(t,e,i,s,o,n){t=Math.max(t,o),e=Math.min(e,o+this.length);let{firstLine:r,perLine:l,perChar:h}=this.heightMetrics(i,o);for(let a=t,c=s;a<=e;){let e=i.doc.lineAt(a);if(a==t){let i=e.number-r;c+=l*i+h*(t-o-i)}let s=l+h*e.length;n(new ri(e.from,e.length,c,s,null,null)),c+=s,a=e.to+1}}replace(t,e,i){let s=this.length-e;if(s>0){let t=i[i.length-1];t instanceof ui?i[i.length-1]=new ui(t.length+s):i.push(null,new ui(s-1))}if(t>0){let e=i[0];e instanceof ui?i[0]=new ui(t+e.length):i.unshift(new ui(t-1),null)}return ai.of(i)}decomposeLeft(t,e){e.push(new ui(t-1),null)}decomposeRight(t,e){e.push(null,new ui(this.length-t-1))}updateHeight(t,e=0,i=!1,s){let o=e+this.length;if(s&&s.from<=e+this.length&&s.more){let i=[],n=Math.max(e,s.from),r=-1;for(s.from>e&&i.push(new ui(s.from-e-1).updateHeight(t,e));n<=o&&s.more;){let e=t.doc.lineAt(n).length;i.length&&i.push(null);let o=s.heights[s.index++];-1==r?r=o:Math.abs(o-r)>=hi&&(r=-2);let l=new di(e,o);l.outdated=!1,i.push(l),n+=e+1}n<=o&&i.push(null,new ui(o-n).updateHeight(t,n));let l=ai.of(i);return(r<0||Math.abs(l.height-this.height)>=hi||Math.abs(r-this.heightMetrics(t,e).perLine)>=hi)&&(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 fi extends ai{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,s){let o=i+this.left.height;return t<o?this.left.blockAt(t,e,i,s):this.right.blockAt(t,e,o,s+this.left.length+this.break)}lineAt(t,e,i,s,o){let n=s+this.left.height,r=o+this.left.length+this.break,l=e==li.ByHeight?t<n:t<r,h=l?this.left.lineAt(t,e,i,s,o):this.right.lineAt(t,e,i,n,r);if(this.break||(l?h.to<r:h.from>r))return h;let a=e==li.ByPosNoHeight?li.ByPosNoHeight:li.ByPos;return l?h.join(this.right.lineAt(r,a,i,n,r)):this.left.lineAt(r,a,i,s,o).join(h)}forEachLine(t,e,i,s,o,n){let r=s+this.left.height,l=o+this.left.length+this.break;if(this.break)t<l&&this.left.forEachLine(t,e,i,s,o,n),e>=l&&this.right.forEachLine(t,e,i,r,l,n);else{let h=this.lineAt(l,li.ByPos,i,s,o);t<h.from&&this.left.forEachLine(t,h.from-1,i,s,o,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 s=this.left.length+this.break;if(e<s)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-s,e-s,i));let o=[];t>0&&this.decomposeLeft(t,o);let n=o.length;for(let t of i)o.push(t);if(t>0&&pi(o,n-1),e<this.length){let t=o.length;this.decomposeRight(e,o),pi(o,t)}return ai.of(o)}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,s=i+this.break;if(t>=s)return this.right.decomposeRight(t-s,e);t<i&&this.left.decomposeRight(t,e),this.break&&t<s&&e.push(null),e.push(this.right)}balanced(t,e){return t.size>2*e.size||e.size>2*t.size?ai.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,s){let{left:o,right:n}=this,r=e+o.length+this.break,l=null;return s&&s.from<=e+o.length&&s.more?l=o=o.updateHeight(t,e,i,s):o.updateHeight(t,e,i),s&&s.from<=r+n.length&&s.more?l=n=n.updateHeight(t,r,i,s):n.updateHeight(t,r,i),l?this.balanced(o,n):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function pi(t,e){let i,s;null==t[e]&&(i=t[e-1])instanceof ui&&(s=t[e+1])instanceof ui&&t.splice(e-1,3,new ui(i.length+1+s.length))}class gi{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 di?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new di(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 s=i.widget?i.widget.estimatedHeight:0;s<0&&(s=this.oracle.lineHeight);let o=e-t;i.block?this.addBlock(new ci(o,s,i)):(o||s>=5)&&this.addLineDeco(s,o)}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 di(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new ui(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 di)return t;let e=new di(0,-1);return this.nodes.push(e),e}addBlock(t){var e;this.enterLine();let i=null===(e=t.deco)||void 0===e?void 0:e.type;i!=ut.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,i!=ut.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof di||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new di(0,-1));let i=t;for(let t of this.nodes)t instanceof di&&t.updateHeight(this.oracle,i),i+=t?t.length:1;return this.nodes}static build(t,e,i,o){let n=new gi(i,t);return s.RangeSet.spans(e,i,o,n,0),n.finish(i)}}class mi{constructor(){this.changes=[]}compareRange(){}comparePoint(t,e,i,s){(t<e||i&&i.heightRelevant||s&&s.heightRelevant)&&vt(t,e,this.changes,5)}}function wi(t,e){let i=t.getBoundingClientRect(),s=t.ownerDocument,o=s.defaultView||window,n=Math.max(0,i.left),r=Math.min(o.innerWidth,i.right),l=Math.max(0,i.top),h=Math.min(o.innerHeight,i.bottom);for(let e=t.parentNode;e&&e!=s.body;)if(1==e.nodeType){let i=e,s=window.getComputedStyle(i);if((i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)&&"visible"!=s.overflow){let s=i.getBoundingClientRect();n=Math.max(n,s.left),r=Math.min(r,s.right),l=Math.max(l,s.top),h=e==t.parentNode?s.bottom:Math.min(h,s.bottom)}e="absolute"==s.position||"fixed"==s.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 vi(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class bi{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 s=t[i],o=e[i];if(s.from!=o.from||s.to!=o.to||s.size!=o.size)return!1}return!0}draw(t){return ft.replace({widget:new yi(this.size,t)}).range(this.from,this.to)}}class yi extends dt{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 Si{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.scaler=Ai,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Yt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let e=t.facet(Kt).some((t=>"function"!=typeof t&&"cm-lineWrapping"==t.class));this.heightOracle=new oi(e),this.stateDeco=t.facet(qt).filter((t=>"function"!=typeof t)),this.heightMap=ai.empty().applyChanges(this.stateDeco,s.Text.empty,this.heightOracle.setDoc(t.doc),[new Ut(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ft.set(this.lineGaps.map((t=>t.draw(!1)))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let s=i?e.head:e.anchor;if(!t.some((({from:t,to:e})=>s>=t&&s<=e))){let{from:e,to:i}=this.lineBlockAt(s);t.push(new xi(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?Ai:new Di(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(t=>{this.viewportLines.push(1==this.scaler.scale?t:Ti(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(qt).filter((t=>"function"!=typeof t));let o=t.changedRanges,n=Ut.extendWithRanges(o,function(t,e,i){let o=new mi;return s.RangeSet.compare(t,e,i,o,0),o.changes}(i,this.stateDeco,t?t.changes:s.ChangeSet.empty(this.state.doc.length))),r=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),n),this.heightMap.height!=r&&(t.flags|=2);let l=n.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<l.from||e.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));let h=!t.changes.empty||2&t.flags||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),h&&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(Bt)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,i=window.getComputedStyle(e),o=this.heightOracle,n=i.whiteSpace;this.defaultTextDirection="rtl"==i.direction?Yt.RTL:Yt.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,d=parseInt(i.paddingTop)||0,u=parseInt(i.paddingBottom)||0;this.paddingTop==d&&this.paddingBottom==u||(this.paddingTop=d,this.paddingBottom=u,a|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(o.lineWrapping&&(h=!0),this.editorWidth=t.scrollDOM.clientWidth,a|=8);let f=(this.printing?vi:wi)(e,this.paddingTop),p=f.top-this.pixelViewport.top,g=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(h=!0)),!this.inView&&!this.scrollTarget)return 0;let w=l.width;if(this.contentDOMWidth==w&&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(o.mustRefreshForHeights(e)&&(r=!0),r||o.lineWrapping&&Math.abs(w-this.contentDOMWidth)>o.charWidth){let{lineHeight:i,charWidth:s,textHeight:l}=t.docView.measureTextSize();r=i>0&&o.refresh(n,i,s,l,w/s,e),r&&(t.docView.minWidth=0,a|=8)}p>0&&g>0?c=Math.max(p,g):p<0&&g<0&&(c=Math.min(p,g)),o.heightChanged=!1;for(let i of this.viewports){let n=i.from==this.viewport.from?e:t.docView.measureVisibleLineHeights(i);this.heightMap=(r?ai.empty().applyChanges(this.stateDeco,s.Text.empty,this.heightOracle,[new Ut(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(o,0,r,new ni(i.from,n))}o.heightChanged&&(a|=2)}let v=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return v&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&a||v)&&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)),s=this.heightMap,o=this.heightOracle,{visibleTop:n,visibleBottom:r}=this,l=new xi(s.lineAt(n-1e3*i,li.ByHeight,o,0,0).from,s.lineAt(r+1e3*(1-i),li.ByHeight,o,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=s.lineAt(t,li.ByPos,o,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 xi(s.lineAt(i-500,li.ByHeight,o,0,0).from,s.lineAt(i+n+500,li.ByHeight,o,0,0).to)}}return l}mapViewport(t,e){let i=e.mapPos(t.from,-1),s=e.mapPos(t.to,1);return new xi(this.heightMap.lineAt(i,li.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,li.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:t,to:e},i=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(t,li.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(e,li.ByPos,this.heightOracle,0,0),{visibleTop:n,visibleBottom:r}=this;return(0==t||s<=n-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||o>=r+Math.max(10,Math.min(i,250)))&&s>n-2e3&&o<r+2e3}mapLineGaps(t,e){if(!t.length||e.empty)return t;let i=[];for(let s of t)e.touchesRange(s.from,s.to)||i.push(new bi(e.mapPos(s.from),e.mapPos(s.to),s.size));return i}ensureLineGaps(t,e){let i=this.heightOracle.lineWrapping,o=i?1e4:2e3,n=o>>1,r=o<<1;if(this.defaultTextDirection!=Yt.LTR&&!i)return[];let l=[],h=(o,r,a,c)=>{if(r-o<n)return;let d=this.state.selection.main,u=[d.from];d.empty||u.push(d.to);for(let t of u)if(t>o&&t<r)return h(o,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-o)<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(s.EditorSelection.cursor(r),!1,!0).head;t>o&&(r=t)}f=new bi(o,r,this.gapSize(a,o,r,c))}l.push(f)};for(let t of this.viewportLines){if(t.length<r)continue;let e=Mi(t.from,t.to,this.stateDeco);if(e.total<r)continue;let s,n,l=this.scrollTarget?this.scrollTarget.range.head:null;if(i){let i,r,h=o/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=l){let s=ki(e,l),o=((this.visibleBottom-this.visibleTop)/2+h)/t.height;i=s-o,r=s+o}else i=(this.visibleTop-t.top-h)/t.height,r=(this.visibleBottom-t.top+h)/t.height;s=Ci(e,i),n=Ci(e,r)}else{let t,i,r=e.total*this.heightOracle.charWidth,h=o*this.heightOracle.charWidth;if(null!=l){let s=ki(e,l),o=((this.pixelViewport.right-this.pixelViewport.left)/2+h)/r;t=s-o,i=s+o}else t=(this.pixelViewport.left-h)/r,i=(this.pixelViewport.right+h)/r;s=Ci(e,t),n=Ci(e,i)}s>t.from&&h(t.from,s,t,e),n<t.to&&h(n,t.to,t,e)}return l}gapSize(t,e,i,s){let o=ki(s,i)-ki(s,e);return this.heightOracle.lineWrapping?t.height*o:s.total*this.heightOracle.charWidth*o}updateLineGaps(t){bi.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=ft.set(t.map((t=>t.draw(this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];s.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))||Ti(this.heightMap.lineAt(t,li.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return Ti(this.heightMap.lineAt(this.scaler.fromDOM(t),li.ByHeight,this.heightOracle,0,0),this.scaler)}elementAtHeight(t){return Ti(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 xi{constructor(t,e){this.from=t,this.to=e}}function Mi(t,e,i){let o=[],n=t,r=0;return s.RangeSet.spans(i,t,e,{span(){},point(t,e){t>n&&(o.push({from:n,to:t}),r+=t-n),n=e}},20),n<e&&(o.push({from:n,to:e}),r+=e-n),{total:r,ranges:o}}function Ci({total:t,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let s=Math.floor(t*i);for(let t=0;;t++){let{from:i,to:o}=e[t],n=o-i;if(s<=n)return i+s;s-=n}}function ki(t,e){let i=0;for(let{from:s,to:o}of t.ranges){if(e<=o){i+=e-s;break}i+=o-s}return i/t.total}const Ai={toDOM:t=>t,fromDOM:t=>t,scale:1};class Di{constructor(t,e,i){let s=0,o=0,n=0;this.viewports=i.map((({from:i,to:o})=>{let n=e.lineAt(i,li.ByPos,t,0,0).top,r=e.lineAt(o,li.ByPos,t,0,0).bottom;return s+=r-n,{from:i,to:o,top:n,bottom:r,domTop:0,domBottom:0}})),this.scale=(7e6-s)/(e.height-s);for(let t of this.viewports)t.domTop=n+(t.top-o)*this.scale,n=t.domBottom=t.domTop+(t.bottom-t.top),o=t.bottom}toDOM(t){for(let e=0,i=0,s=0;;e++){let o=e<this.viewports.length?this.viewports[e]:null;if(!o||t<o.top)return s+(t-i)*this.scale;if(t<=o.bottom)return o.domTop+(t-o.top);i=o.bottom,s=o.domBottom}}fromDOM(t){for(let e=0,i=0,s=0;;e++){let o=e<this.viewports.length?this.viewports[e]:null;if(!o||t<o.domTop)return i+(t-s)/this.scale;if(t<=o.domBottom)return o.top+(t-o.domTop);i=o.bottom,s=o.domBottom}}}function Ti(t,e){if(1==e.scale)return t;let i=e.toDOM(t.top),s=e.toDOM(t.bottom);return new ri(t.from,t.length,i,s-i,t.children&&t.children.map((t=>Ti(t,e))),t.deco)}const Oi=s.Facet.define({combine:t=>t.join(" ")}),Ei=s.Facet.define({combine:t=>t.indexOf(!0)>-1}),Ri=o.V.newName(),Bi=o.V.newName(),Li=o.V.newName(),Hi={"&light":"."+Bi,"&dark":"."+Li};function Vi(t,e,i){return new o.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 Pi=Vi("."+Ri,{"&":{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",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"},"&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",left: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"}},Hi);class Ni{constructor(t,e,i,o){this.typeOver=o,this.bounds=null,this.text="";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:s,focusNode:o,focusOffset:n}=t.observer.selectionRange;return i&&(e.push(new fe(i,s)),o==i&&n==s||e.push(new fe(o,n))),e}(t),i=new de(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,o=2==t.length?t[1].pos:i;return i>-1&&o>-1?s.EditorSelection.single(i+e,o+e):null}(e,this.bounds.from)}else{let e=t.observer.selectionRange,i=n&&n.node==e.focusNode&&n.offset==e.focusOffset||!p(t.contentDOM,e.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),o=r&&r.node==e.anchorNode&&r.offset==e.anchorOffset||!p(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=s.EditorSelection.single(o,i)}}}function Wi(t,e){let i,{newSel:o}=e,n=t.state.selection.main;if(e.bounds){let{from:o,to:r}=e.bounds,l=n.from,h=null;(8===t.inputState.lastKeyCode&&t.inputState.lastKeyTime>Date.now()-100||$.android&&e.text.length<r-o)&&(l=n.to,h="end");let a=function(t,e,i,s){let o=Math.min(t.length,e.length),n=0;for(;n<o&&t.charCodeAt(n)==e.charCodeAt(n);)n++;if(n==o&&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"==s&&(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(o,r,ce),e.text,l-o,h);a&&($.chrome&&13==t.inputState.lastKeyCode&&a.toB==a.from+2&&e.text.slice(a.from,a.toB)==ce+ce&&a.toB--,i={from:o+a.from,to:o+a.toA,insert:s.Text.of(e.text.slice(a.from,a.toB).split(ce))})}else o&&(!t.hasFocus&&t.state.facet(Pt)||o.main.eq(n))&&(o=null);if(!i&&!o)return!1;if(!i&&e.typeOver&&!n.empty&&o&&o.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))}:($.mac||$.android)&&i&&i.from==i.to&&i.from==n.head-1&&/^\. ?$/.test(i.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(o&&2==i.insert.length&&(o=s.EditorSelection.single(o.main.anchor-1,o.main.head-1)),i={from:n.from,to:n.to,insert:s.Text.of([" "])}):$.chrome&&i&&i.from==i.to&&i.from==n.head&&"\n "==i.insert.toString()&&t.lineWrapping&&(o&&(o=s.EditorSelection.single(o.main.anchor-1,o.main.head-1)),i={from:n.from,to:n.to,insert:s.Text.of([" "])}),i){let e=t.state;if($.ios&&t.inputState.flushIOSKey(t))return!0;if($.android&&(i.from==n.from&&i.to==n.to&&1==i.insert.length&&2==i.insert.lines&&T(t.contentDOM,"Enter",13)||i.from==n.from-1&&i.to==n.to&&0==i.insert.length&&T(t.contentDOM,"Backspace",8)||i.from==n.from&&i.to==n.to+1&&0==i.insert.length&&T(t.contentDOM,"Delete",46)))return!0;let r,l=i.insert.toString();if(t.state.facet(Ot).some((e=>e(t,i.from,i.to,l))))return!0;if(t.inputState.composing>=0&&t.inputState.composing++,i.from>=n.from&&i.to<=n.to&&i.to-i.from>=(n.to-n.from)/3&&(!o||o.main.empty&&o.main.from==i.from+i.insert.length)&&t.inputState.composing<0){let s=n.from<i.from?e.sliceDoc(n.from,i.from):"",o=n.to>i.to?e.sliceDoc(i.to,n.to):"";r=e.replaceSelection(t.state.toText(s+i.insert.sliceString(0,void 0,t.state.lineBreak)+o))}else{let l=e.changes(i),h=o&&o.main.to<=l.newLength?o.main:void 0;if(e.selection.ranges.length>1&&t.inputState.composing>=0&&i.to<=n.to&&i.to>=n.to-10){let o=t.state.sliceDoc(i.from,i.to),a=me(t)||t.state.doc.lineAt(n.head),c=n.to-i.to,d=n.to-n.from;r=e.changeByRange((r=>{if(r.from==n.from&&r.to==n.to)return{changes:l,range:h||r.map(l)};let u=r.to-c,f=u-o.length;if(r.to-r.from!=d||t.state.sliceDoc(f,u)!=o||a&&r.to>=a.from&&r.from<=a.to)return{range:r};let p=e.changes({from:f,to:u,insert:i.insert}),g=r.to-n.to;return{changes:p,range:h?s.EditorSelection.range(Math.max(0,h.anchor+g),Math.max(0,h.head+g)):r.map(p)}}))}else r={changes:l,selection:h&&e.selection.replaceRange(h)}}let h="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,h+=".compose",t.inputState.compositionFirstChange&&(h+=".start",t.inputState.compositionFirstChange=!1)),t.dispatch(r,{scrollIntoView:!0,userEvent:h}),!0}if(o&&!o.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:o,scrollIntoView:e,userEvent:i}),!0}return!1}const Fi={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zi=$.ie&&$.ie_version<=11;class Ii{constructor(t){this.view=t,this.active=!1,this.selectionRange=new M,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.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver((e=>{for(let t of e)this.queue.push(t);($.ie&&$.ie_version<=11||$.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()})),zi&&(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),"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.resizeContent=new ResizeObserver((()=>this.view.requestMeasure())),this.resizeContent.observe(t.contentDOM)),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.runScrollHandlers(this.view,t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(){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,s=this.selectionRange;if(i.state.facet(Pt)?i.root.activeElement!=this.dom:!g(i.dom,s))return;let o=s.anchorNode&&i.docView.nearest(s.anchorNode);o&&o.ignoreEvent(t)?e||(this.selectionChanged=!1):($.ie&&$.ie_version<=11||$.android&&$.chrome)&&!i.state.selection.main.empty&&s.focusNode&&w(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=$.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){let e=null;function i(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",i,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),!e)return null;let s=e.startContainer,o=e.startOffset,n=e.endContainer,r=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return w(l.node,l.offset,n,r)&&([s,o,n,r]=[n,r,s,o]),{anchorNode:s,anchorOffset:o,focusNode:n,focusOffset:r}}(this.view)||f(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=g(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){let i=e.focusNode,s=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=s)return!1;for(;;)if(s){if(1!=i.nodeType)return!1;let t=i.childNodes[s-1];"false"==t.contentEditable?s--:(i=t,s=y(i))}else{if(i==t)return!0;s=v(i),i=i.parentNode}}(this.dom,e)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(e),i&&(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,Fi),zi&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),zi&&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.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,s=!1;for(let o of t){let t=this.readMutation(o);t&&(t.typeOver&&(s=!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:s}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),s=this.selectionChanged&&g(this.dom,this.selectionRange);return t<0&&!s?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ni(this.view,t,e,i))}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return!1;let i=this.view.state,s=Wi(this.view,e);return this.view.state==i&&this.view.update([]),s}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.dirty|=4),"childList"==t.type){let i=Ki(e,t.previousSibling||t.target.previousSibling,-1),s=Ki(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:s?e.posBefore(s):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),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),t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var t,e,i,s;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(),null===(s=this.resizeContent)||void 0===s||s.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 Ki(t,e,i){for(;e;){let s=B.get(e);if(s&&s.parent==t)return s;let o=e.parentNode;e=o!=t.dom?o:i>0?e.nextSibling:e.previousSibling}return null}class qi{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.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=t.dispatch||(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 Si(t.state||s.EditorState.create(t)),this.plugins=this.state.facet(Wt).map((t=>new zt(t)));for(let t of this.plugins)t.update(this);this.observer=new Ii(this),this.inputState=new Re(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new pe(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}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}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof s.Transaction?t[0]:this.state.update(...t))}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,o=!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(ti)))?(this.inputState.notifiedFocused=r,l=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,h=ei(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(s.EditorState.phrases)!=this.state.facet(s.EditorState.phrases))return this.setState(n);e=$t.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 Lt(t.empty?t:s.EditorSelection.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(Ht)&&(d=t.value)}this.viewState.update(e,d),this.bidiCache=_i.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(_t)!=this.styleModules&&this.mountStyles(),o=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(i,t.some((t=>t.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(e.startState.facet(Oi)!=e.state.facet(Oi)&&(this.viewState.mustMeasureContent=!0),(i||o||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(Tt))t(e);(h||c)&&Promise.resolve().then((()=>{h&&this.state==h.startState&&this.dispatch(h),c&&!Wi(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 Si(t),this.plugins=t.facet(Wt).map((t=>new zt(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new pe(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Wt),i=t.state.facet(Wt);if(e!=i){let s=[];for(let o of i){let i=e.indexOf(o);if(i<0)s.push(new zt(o));else{let e=this.plugins[i];e.mustUpdate=t,s.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=s,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let e of this.plugins)e.mustUpdate=t;for(let t=0;t<this.plugins.length;t++)this.plugins[t].update(this)}measure(t=!0){if(this.destroyed)return;this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:s,clientHeight:o}=this.scrollDOM,n=s>i-o-4?i:s;try{for(let t=0;;t++){this.updateState=1;let i=this.viewport,s=this.viewState.lineBlockAtHeight(n),o=this.viewState.measure(this);if(!o&&!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 r=[];4&o||([this.measureRequests,r]=[r,this.measureRequests]);let l=r.map((t=>{try{return t.read(this)}catch(t){return Vt(this.state,t),ji}})),h=$t.create(this,this.state,[]),a=!1,c=!1;h.flags|=o,e?e.flags|=o:e=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),a=this.docView.update(h));for(let t=0;t<r.length;t++)if(l[t]!=ji)try{let e=r[t];e.write&&e.write(l[t],this)}catch(t){Vt(this.state,t)}if(this.viewState.editorHeight)if(this.viewState.scrollTarget)this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,c=!0;else{let t=this.viewState.lineBlockAt(s.from).top-s.top;(t>1||t<-1)&&(this.scrollDOM.scrollTop+=t,c=!0)}if(a&&this.docView.updateSelection(!0),this.viewport.from==i.from&&this.viewport.to==i.to&&!c&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(Tt))t(e)}get themeClasses(){return Ri+" "+(this.state.facet(Ei)?Li:Bi)+" "+this.state.facet(Oi)}updateAttrs(){let t=Ui(this,It,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Pt)?"true":"false",class:"cm-content",style:`${$.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ui(this,Kt,e);let i=this.observer.ignore((()=>{let i=ct(this.contentDOM,this.contentAttrs,e),s=ct(this.dom,this.editorAttrs,t);return i||s}));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(qi.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value)}mountStyles(){this.styleModules=this.state.facet(_t),o.V.mount(this.root,this.styleModules.concat(Pi).reverse())}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}}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 Ee(this,t,Oe(this,t,e,i))}moveByGroup(t,e){return Ee(this,t,Oe(this,t,e,(e=>function(t,e,i){let o=t.state.charCategorizer(e),n=o(i);return t=>{let e=o(t);return n==s.CharCategory.Space&&(n=e),n==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,o){let n=t.state.doc.lineAt(e.head),r=o&&t.lineWrapping?t.coordsAtPos(e.assoc<0&&e.head>n.from?e.head-1:e.head):null;if(r){let e=t.dom.getBoundingClientRect(),o=t.textDirectionAt(n.from),l=t.posAtCoords({x:i==(o==Yt.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=l)return s.EditorSelection.cursor(l,i?-1:1)}let l=bt.find(t.docView,e.head),h=l?i?l.posAtEnd:l.posAtStart:i?n.to:n.from;return s.EditorSelection.cursor(h,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return Ee(this,t,function(t,e,i,o){let n=e.head,r=i?1:-1;if(n==(i?t.state.doc.length:0))return s.EditorSelection.cursor(n,e.assoc);let l,h=e.goalColumn,a=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(n),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!=o?o:t.defaultLineHeight>>1;for(let i=0;;i+=10){let o=l+(f+i)*r,c=De(t,{x:u,y:o},!1,r);if(o<a.top||o>a.bottom||(r<0?c<n:c>n))return s.EditorSelection.cursor(c,e.assoc,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(),De(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 s=this.state.doc.lineAt(t),o=this.bidiSpans(s);return S(i,o[oe.find(o,t-s.from,-1,e)].dir==Yt.LTR==e>0)}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(Rt)||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>Gi)return le(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let i=re(t.text,e);return this.bidiCache.push(new _i(t.from,t.to,e,i)),i}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||$.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(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return Ht.of(new Lt("number"==typeof t?s.EditorSelection.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return Ft.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=o.V.newName(),s=[Oi.of(i),_t.of(Vi(`.${i}`,t))];return e&&e.dark&&s.push(Ei.of(!0)),s}static baseTheme(t){return s.Prec.lowest(_t.of(Vi("."+Ri,t,Hi)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),s=i&&B.get(i)||B.get(t);return(null===(e=null==s?void 0:s.rootView)||void 0===e?void 0:e.view)||null}}qi.styleModule=_t,qi.inputHandler=Ot,qi.focusChangeEffect=Et,qi.perLineTextDirection=Rt,qi.exceptionSink=Dt,qi.updateListener=Tt,qi.editable=Pt,qi.mouseSelectionStyle=At,qi.dragMovesSelection=kt,qi.clickAddsSelectionRange=Ct,qi.decorations=qt,qi.atomicRanges=Gt,qi.scrollMargins=jt,qi.darkTheme=Ei,qi.contentAttributes=Kt,qi.editorAttributes=It,qi.lineWrapping=qi.contentAttributes.of({class:"cm-lineWrapping"}),qi.announce=s.StateEffect.define();const Gi=4096,ji={};class _i{constructor(t,e,i,s){this.from=t,this.to=e,this.dir=i,this.order=s}static update(t,e){if(e.empty)return t;let i=[],s=t.length?t[t.length-1].dir:Yt.LTR;for(let o=Math.max(0,t.length-10);o<t.length;o++){let n=t[o];n.dir!=s||e.touchesRange(n.from,n.to)||i.push(new _i(e.mapPos(n.from,1),e.mapPos(n.to,-1),n.dir,n.order))}return i}}function Ui(t,e,i){for(let s=t.state.facet(e),o=s.length-1;o>=0;o--){let e=s[o],n="function"==typeof e?e(t):e;n&&ht(n,i)}return i}const $i=$.mac?"mac":$.windows?"win":$.linux?"linux":"key";function Yi(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 Xi=s.Prec.default(qi.domEventHandlers({keydown:(t,e)=>ss(Zi(e.state),t,e,"editor")})),Ji=s.Facet.define({enables:Xi}),Qi=new WeakMap;function Zi(t){let e=t.facet(Ji),i=Qi.get(e);return i||Qi.set(e,i=function(t,e=$i){let i=Object.create(null),s=Object.create(null),o=(t,e)=>{let i=s[t];if(null==i)s[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,s,n,r)=>{var l,h;let a=i[t]||(i[t]=Object.create(null)),c=s.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let s,o,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))s=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!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:o=!0}}return s&&(l="Alt-"+l),o&&(l="Ctrl-"+l),r&&(l="Meta-"+l),n&&(l="Shift-"+l),l}(t,e)));for(let e=1;e<c.length;e++){let i=c.slice(0,e).join(" ");o(i,!0),a[i]||(a[i]={preventDefault:!0,run:[e=>{let s=es={view:e,prefix:i,scope:t};return setTimeout((()=>{es==s&&(es=null)}),is),!0}]})}let d=c.join(" ");o(d,!1);let u=a[d]||(a[d]={preventDefault:!1,run:(null===(h=null===(l=a._any)||void 0===l?void 0:l.run)||void 0===h?void 0:h.slice())||[]});n&&u.run.push(n),r&&(u.preventDefault=!0)};for(let s of t){let t=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let e of t){let t=i[e]||(i[e]=Object.create(null));t._any||(t._any={preventDefault:!1,run:[]});for(let e in t)t[e].run.push(s.any)}let o=s[e]||s.key;if(o)for(let e of t)n(e,o,s.run,s.preventDefault),s.shift&&n(e,"Shift-"+o,s.shift,s.preventDefault)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}function ts(t,e,i){return ss(Zi(t.state),e,t,i)}let es=null;const is=4e3;function ss(t,e,i,o){let l=function(t){var e=!(c&&(t.ctrlKey||t.altKey||t.metaKey)||a&&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),h=(0,s.codePointAt)(l,0),d=(0,s.codePointSize)(h)==l.length&&" "!=l,u="",f=!1;es&&es.view==i&&es.scope==o&&(u=es.prefix+" ",(f=He.indexOf(e.keyCode)<0)&&(es=null));let p,g,m=new Set,w=t=>{if(t){for(let s of t.run)if(!m.has(s)&&(m.add(s),s(i,e)))return!0;t.preventDefault&&(f=!0)}return!1},v=t[o];if(v){if(w(v[u+Yi(l,e,!d)]))return!0;if(d&&(e.altKey||e.metaKey||e.ctrlKey)&&!($.windows&&e.ctrlKey&&e.altKey)&&(p=n[e.keyCode])&&p!=l){if(w(v[u+Yi(p,e,!0)]))return!0;if(e.shiftKey&&(g=r[e.keyCode])!=l&&g!=p&&w(v[u+Yi(g,e,!1)]))return!0}else if(d&&e.shiftKey&&w(v[u+Yi(l,e,!0)]))return!0;if(w(v._any))return!0}return f}class os{constructor(t,e,i,s,o){this.className=t,this.left=e,this.top=i,this.width=s,this.height=o}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 s=t.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let o=ns(t);return[new os(e,s.left-o.left,s.top-o.top,null,s.bottom-s.top)]}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let s=Math.max(i.from,t.viewport.from),o=Math.min(i.to,t.viewport.to),n=t.textDirection==Yt.LTR,r=t.contentDOM,l=r.getBoundingClientRect(),h=ns(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=ls(t,s),p=ls(t,o),g=f.type==ut.Text?f:null,m=p.type==ut.Text?p:null;if(t.lineWrapping&&(g&&(g=rs(t,s,g)),m&&(m=rs(t,o,m))),g&&m&&g.from==m.from)return v(b(i.from,i.to,g));{let e=g?b(i.from,null,g):y(f,!1),s=m?b(null,i.to,m):y(p,!0),o=[];return(g||f).to<(m||p).from-1?o.push(w(d,e.bottom,u,s.top)):e.bottom<s.top&&t.elementAtHeight((e.bottom+s.top)/2).type==ut.Text&&(e.bottom=s.top=(e.bottom+s.top)/2),v(e).concat(o).concat(v(s))}function w(t,i,s,o){return new os(e,t-h.left,i-h.top-.01,s-t,o-i+.01)}function v({top:t,bottom:e,horizontal:i}){let s=[];for(let o=0;o<i.length;o+=2)s.push(w(i[o],t,i[o+1],e));return s}function b(e,i,s){let o=1e9,r=-1e9,l=[];function h(e,i,h,a,c){let f=t.coordsAtPos(e,e==s.to?-2:2),p=t.coordsAtPos(h,h==s.from?2:-2);f&&p&&(o=Math.min(f.top,p.top,o),r=Math.max(f.bottom,p.bottom,r),c==Yt.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:s.from,c=null!=i?i:s.to;for(let s of t.visibleRanges)if(s.to>a&&s.from<c)for(let o=Math.max(s.from,a),n=Math.min(s.to,c);;){let s=t.state.doc.lineAt(o);for(let r of t.bidiSpans(s)){let t=r.from+s.from,l=r.to+s.from;if(t>=n)break;l>o&&h(Math.max(t,o),null==e&&t<=a,Math.min(l,n),null==i&&l>=c,r.dir)}if(o=s.to+1,o>=n)break}return 0==l.length&&h(a,null==e,c,null==i,t.textDirection),{top:o,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 ns(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Yt.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function rs(t,e,i){let o=s.EditorSelection.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(o,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(o,!0,!0).from),type:ut.Text}}function ls(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==ut.Text))return t;return i}class hs{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],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.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(as)!=t.state.facet(as)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(as);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)}draw(t){if(t.length!=this.drawn.length||t.some(((t,e)=>{return i=t,s=this.drawn[e],!(i.constructor==s.constructor&&i.eq(s));var i,s}))){let e=this.dom.firstChild,i=0;for(let s of t)s.update&&e&&s.constructor&&this.drawn[i].constructor&&s.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(s.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 as=s.Facet.define();function cs(t){return[Ft.define((e=>new hs(e,t))),as.of(t)]}const ds=!$.ios,us=s.Facet.define({combine:t=>(0,s.combineConfig)(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function fs(t={}){return[us.of(t),gs,ws,bs,Bt.of(!0)]}function ps(t){return t.startState.facet(us)!=t.state.facet(us)}const gs=cs({above:!0,markers(t){let{state:e}=t,i=e.facet(us),o=[];for(let n of e.selection.ranges){let r=n==e.selection.main;if(n.empty?!r||ds:i.drawRangeCursor){let e=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",i=n.empty?n:s.EditorSelection.cursor(n.head,n.head>n.anchor?-1:1);for(let s of os.forRange(t,e,i))o.push(s)}}return o},update(t,e){t.transactions.some((t=>t.selection))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=ps(t);return i&&ms(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){ms(e.state,t)},class:"cm-cursorLayer"});function ms(t,e){e.style.animationDuration=t.facet(us).cursorBlinkRate+"ms"}const ws=cs({above:!1,markers:t=>t.state.selection.ranges.map((e=>e.empty?[]:os.forRange(t,"cm-selectionBackground",e))).reduce(((t,e)=>t.concat(e))),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||ps(t),class:"cm-selectionLayer"}),vs={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};ds&&(vs[".cm-line"].caretColor="transparent !important");const bs=s.Prec.highest(qi.theme(vs)),ys=s.StateEffect.define({map:(t,e)=>null==t?null:e.mapPos(t)}),Ss=s.StateField.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(((t,e)=>e.is(ys)?e.value:t),t))}),xs=Ft.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(Ss);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(Ss)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(Ss),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(Ss)!=t&&this.view.dispatch({effects:ys.of(t)})}},{eventHandlers:{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 Ms(){return[Ss,xs]}function Cs(t,e,i,s,o){e.lastIndex=0;for(let n,r=t.iterRange(i,s),l=i;!r.next().done;l+=r.value.length)if(!r.lineBreak)for(;n=e.exec(r.value);)o(l+n.index,n)}class ks{constructor(t){const{regexp:e,decoration:i,decorate:s,boundary:o,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,s)this.addMatch=(t,e,i,o)=>s(o,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,s,o)=>{let n=i(t,e,s);n&&o(s,s+t[0].length,n)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(t,e,s,o)=>o(s,s+t[0].length,i)}this.boundary=o,this.maxLength=n}createDeco(t){let e=new s.RangeSetBuilder,i=e.add.bind(e);for(let{from:e,to:s}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 s=[];for(let{from:o,to:n}of i)o=Math.max(t.state.doc.lineAt(o).from,o-e),n=Math.min(t.state.doc.lineAt(n).to,n+e),s.length&&s[s.length-1].to>=o?s[s.length-1].to=n:s.push({from:o,to:n});return s}(t,this.maxLength))Cs(t.state.doc,this.regexp,e,s,((e,s)=>this.addMatch(s,t,e,i)));return e.finish()}updateDeco(t,e){let i=1e9,s=-1;return t.docChanged&&t.changes.iterChanges(((e,o,n,r)=>{r>t.view.viewport.from&&n<t.view.viewport.to&&(i=Math.min(n,i),s=Math.max(r,s))})),t.viewportChanged||s-i>1e3?this.createDeco(t.view):s>-1?this.updateRange(t.view,e.map(t.changes),i,s):e}updateRange(t,e,i,s){for(let o of t.visibleRanges){let n=Math.max(o.from,i),r=Math.min(o.to,s);if(r>n){let i=t.state.doc.lineAt(n),s=i.to<r?t.state.doc.lineAt(r):i,l=Math.max(o.from,i.from),h=Math.min(o.to,s.to);if(this.boundary){for(;n>i.from;n--)if(this.boundary.test(i.text[n-1-i.from])){l=n;break}for(;r<s.to;r++)if(this.boundary.test(s.text[r-s.from])){h=r;break}}let a,c=[],d=(t,e,i)=>c.push(i.range(t,e));if(i==s)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 Cs(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 As=null!=/x/.unicode?"gu":"g",Ds=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",As),Ts={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 Os=null;const Es=s.Facet.define({combine(t){let e=(0,s.combineConfig)(t,{render:null,specialChars:Ds,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==Os&&"undefined"!=typeof document&&document.body){let e=document.body.style;Os=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return Os||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,As)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,As)),e}});function Rs(t={}){return[Es.of(t),Bs||(Bs=Ft.fromClass(class{constructor(t){this.view=t,this.decorations=ft.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Es)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new ks({regexp:t.specialChars,decoration:(e,i,o)=>{let{doc:n}=i.state,r=(0,s.codePointAt)(e[0],0);if(9==r){let t=n.lineAt(o),e=i.state.tabSize,r=(0,s.countColumn)(t.text,e,o-t.from);return ft.replace({widget:new Hs((e-r%e)*this.view.defaultCharacterWidth)})}return this.decorationCache[r]||(this.decorationCache[r]=ft.replace({widget:new Ls(t,r)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Es);t.startState.facet(Es)!=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 Bs=null;class Ls extends dt{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")+" "+(Ts[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,e);if(s)return s;let o=document.createElement("span");return o.textContent=e,o.title=i,o.setAttribute("aria-label",i),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class Hs extends dt{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 Vs=Ft.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!=this.height&&(this.height=i,this.attrs={style:`padding-bottom: ${i}px`})}});function Ps(){return[Vs,Kt.of((t=>{var e;return(null===(e=t.plugin(Vs))||void 0===e?void 0:e.attrs)||null}))]}function Ns(){return Fs}const Ws=ft.line({class:"cm-activeLine"}),Fs=Ft.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 s of t.state.selection.ranges){let o=t.lineBlockAt(s.head);o.from>e&&(i.push(Ws.range(o.from)),e=o.from)}return ft.set(i)}},{decorations:t=>t.decorations});class zs extends dt{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?m(t.firstChild):[];if(!e.length)return null;let i=window.getComputedStyle(t.parentNode),s=S(e[0],"rtl"!=i.direction),o=parseInt(i.lineHeight);return s.bottom-s.top>1.5*o?{left:s.left,right:s.right,top:s.top,bottom:s.top+o}:s}ignoreEvent(){return!1}}function Is(t){return Ft.fromClass(class{constructor(e){this.view=e,this.placeholder=ft.set([ft.widget({widget:new zs(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?ft.none:this.placeholder}},{decorations:t=>t.decorations})}const Ks=2e3;function qs(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),o=t.state.doc.lineAt(i),n=i-o.from,r=n>Ks?-1:n==o.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,s.countColumn)(o.text,t.state.tabSize,i-o.from);return{line:o.number,col:r,off:n}}function Gs(t){let e=(null==t?void 0:t.eventFilter)||(t=>t.altKey&&0==t.button);return qi.mouseSelectionStyle.of(((t,i)=>e(i)?function(t,e){let i=qs(t,e),o=t.state.selection;return i?{update(t){if(t.docChanged){let e=t.changes.mapPos(t.startState.doc.line(i.line).from),s=t.state.doc.lineAt(e);i={line:s.number,col:i.col,off:Math.min(i.off,s.length)},o=o.map(t.changes)}},get(e,n,r){let l=qs(t,e);if(!l)return o;let h=function(t,e,i){let o=Math.min(e.line,i.line),n=Math.max(e.line,i.line),r=[];if(e.off>Ks||i.off>Ks||e.col<0||i.col<0){let l=Math.min(e.off,i.off),h=Math.max(e.off,i.off);for(let e=o;e<=n;e++){let i=t.doc.line(e);i.length<=h&&r.push(s.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=o;e<=n;e++){let i=t.doc.line(e),o=(0,s.findColumn)(i.text,l,t.tabSize,!0);if(o<0)r.push(s.EditorSelection.cursor(i.to));else{let e=(0,s.findColumn)(i.text,h,t.tabSize);r.push(s.EditorSelection.range(i.from+o,i.from+e))}}}return r}(t.state,i,l);return h.length?r?s.EditorSelection.create(h.concat(o.ranges)):s.EditorSelection.create(h):o}}:null}(t,i):null))}const js={Alt:[18,t=>t.altKey],Control:[17,t=>t.ctrlKey],Shift:[16,t=>t.shiftKey],Meta:[91,t=>t.metaKey]},_s={style:"cursor: crosshair"};function Us(t={}){let[e,i]=js[t.key||"Alt"],s=Ft.fromClass(class{constructor(t){this.view=t,this.isDown=!1}set(t){this.isDown!=t&&(this.isDown=t,this.view.update([]))}},{eventHandlers:{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[s,qi.contentAttributes.of((t=>{var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.isDown)?_s:null}))]}const $s="-10000px";class Ys{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter((t=>t)),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),s=i.filter((t=>t));if(i===this.input){for(let e of this.tooltipViews)e.update&&e.update(t);return!1}let o=[];for(let e=0;e<s.length;e++){let i=s[e],n=-1;if(i){for(let t=0;t<this.tooltips.length;t++){let e=this.tooltips[t];e&&e.create==i.create&&(n=t)}if(n<0)o[e]=this.createTooltipView(i);else{let i=o[e]=this.tooltipViews[n];i.update&&i.update(t)}}}for(let t of this.tooltipViews)o.indexOf(t)<0&&(t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t));return this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function Xs(t={}){return Qs.of(t)}function Js(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Qs=s.Facet.define({combine:t=>{var e,i,s;return{position:$.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===(s=t.find((t=>t.tooltipSpace)))||void 0===s?void 0:s.tooltipSpace)||Js}}}),Zs=new WeakMap,to=Ft.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(Qs);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.manager=new Ys(t,so,(t=>this.createTooltip(t))),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);e&&this.observeIntersection();let i=e||t.geometryChanged,s=t.state.facet(Qs);if(s.position!=this.position){this.position=s.position;for(let t of this.manager.tooltipViews)t.dom.style.position=this.position;i=!0}if(s.parent!=this.parent){this.parent&&this.container.remove(),this.parent=s.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){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=$s,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;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);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();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(Qs).tooltipSpace(this.view)}}writeMeasure(t){var e;let{editor:i,space:s}=t,o=[];for(let n=0;n<this.manager.tooltips.length;n++){let r=this.manager.tooltips[n],l=this.manager.tooltipViews[n],{dom:h}=l,a=t.pos[n],c=t.size[n];if(!a||a.bottom<=Math.max(i.top,s.top)||a.top>=Math.min(i.bottom,s.bottom)||a.right<Math.max(i.left,s.left)-.1||a.left>Math.min(i.right,s.right)+.1){h.style.top=$s;continue}let d=r.arrow?l.dom.querySelector(".cm-tooltip-arrow"):null,u=d?7:0,f=c.right-c.left,p=null!==(e=Zs.get(l))&&void 0!==e?e:c.bottom-c.top,g=l.offset||io,m=this.view.textDirection==Yt.LTR,w=c.width>s.right-s.left?m?s.left:s.right-c.width:m?Math.min(a.left-(d?14:0)+g.x,s.right-f):Math.max(s.left,a.left-f+(d?14:0)-g.x),v=!!r.above;!r.strictSide&&(v?a.top-(c.bottom-c.top)-g.y<s.top:a.bottom+(c.bottom-c.top)+g.y>s.bottom)&&v==s.bottom-a.bottom>a.top-s.top&&(v=!v);let b=(v?a.top-s.top:s.bottom-a.bottom)-u;if(b<p&&!1!==l.resize){if(b<this.view.defaultLineHeight){h.style.top=$s;continue}Zs.set(l,p),h.style.height=(p=b)+"px"}else h.style.height&&(h.style.height="");let y=v?a.top-p-u-g.y:a.bottom+u+g.y,S=w+f;if(!0!==l.overlap)for(let t of o)t.left<S&&t.right>w&&t.top<y+p&&t.bottom>y&&(y=v?t.top-p-2-u:t.bottom+u+2);"absolute"==this.position?(h.style.top=y-t.parent.top+"px",h.style.left=w-t.parent.left+"px"):(h.style.top=y+"px",h.style.left=w+"px"),d&&(d.style.left=a.left+(m?g.x:-g.x)-(w+14-7)+"px"),!0!==l.overlap&&o.push({left:w,top:y,right:S,bottom:y+p}),h.classList.toggle("cm-tooltip-above",v),h.classList.toggle("cm-tooltip-below",!v),l.positioned&&l.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=$s}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),eo=qi.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"}}}),io={x:0,y:0},so=s.Facet.define({enables:[to,eo]}),oo=s.Facet.define();class no{constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Ys(t,oo,(t=>this.createHostedView(t)))}static create(t){return new no(t)}createHostedView(t){let e=t.create(this.view);return e.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(e.dom),this.mounted&&e.mount&&e.mount(this.view),e}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)}}const ro=so.compute([oo],(t=>{let e=t.facet(oo).filter((t=>t));return 0===e.length?null:{pos:Math.min(...e.map((t=>t.pos))),end:Math.max(...e.filter((t=>null!=t.end)).map((t=>t.end))),create:no.create,above:e[0].above,arrow:e.some((t=>t.arrow))}}));class lo{constructor(t,e,i,s,o){this.view=t,this.source=e,this.field=i,this.setHover=s,this.hoverTime=o,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)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{lastMove:t}=this,e=this.view.contentDOM.contains(t.target)?this.view.posAtCoords(t):null;if(null==e)return;let i=this.view.coordsAtPos(e);if(null==i||t.y<i.top||t.y>i.bottom||t.x<i.left-this.view.defaultCharacterWidth||t.x>i.right+this.view.defaultCharacterWidth)return;let s=this.view.bidiSpans(this.view.state.doc.lineAt(e)).find((t=>t.from<=e&&t.to>=e)),o=s&&s.dir==Yt.RTL?-1:1,n=this.source(this.view,e,t.x<i.left?-o:o);if(null==n?void 0:n.then){let t=this.pending={pos:e};n.then((e=>{this.pending==t&&(this.pending=null,e&&this.view.dispatch({effects:this.setHover.of(e)}))}),(t=>Vt(this.view.state,t,"hover tooltip")))}else n&&this.view.dispatch({effects:this.setHover.of(n)})}mousemove(t){var e;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 i=this.active;if(i&&!ho(this.lastMove.target)||this.pending){let{pos:s}=i||this.pending,o=null!==(e=null==i?void 0:i.end)&&void 0!==e?e:s;(s==o?this.view.posAtCoords(this.lastMove)==s:function(t,e,i,s,o,n){let r=document.createRange(),l=t.domAtPos(e),h=t.domAtPos(i);r.setEnd(h.node,h.offset),r.setStart(l.node,l.offset);let a=r.getClientRects();r.detach();for(let t=0;t<a.length;t++){let e=a[t];if(Math.max(e.top-o,o-e.bottom,e.left-s,s-e.right)<=6)return!0}return!1}(this.view,s,o,t.clientX,t.clientY))||(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!ho(t.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function ho(t){for(let e=t;e;e=e.parentNode)if(1==e.nodeType&&e.classList.contains("cm-tooltip"))return!0;return!1}function ao(t,e={}){let i=s.StateEffect.define(),o=s.StateField.define({create:()=>null,update(t,o){if(t&&(e.hideOnChange&&(o.docChanged||o.selection)||e.hideOn&&e.hideOn(o,t)))return null;if(t&&o.docChanged){let e=o.changes.mapPos(t.pos,-1,s.MapMode.TrackDel);if(null==e)return null;let i=Object.assign(Object.create(null),t);i.pos=e,null!=t.end&&(i.end=o.changes.mapPos(t.end)),t=i}for(let e of o.effects)e.is(i)&&(t=e.value),e.is(fo)&&(t=null);return t},provide:t=>oo.from(t)});return[o,Ft.define((s=>new lo(s,t,o,i,e.hoverTime||300))),ro]}function co(t,e){let i=t.plugin(to);if(!i)return null;let s=i.manager.tooltips.indexOf(e);return s<0?null:i.manager.tooltipViews[s]}function uo(t){return t.facet(oo).some((t=>t))}const fo=s.StateEffect.define(),po=fo.of(null);function go(t){var e;null===(e=t.plugin(to))||void 0===e||e.maybeMeasure()}const mo=s.Facet.define({combine(t){let e,i;for(let s of t)e=e||s.topContainer,i=i||s.bottomContainer;return{topContainer:e,bottomContainer:i}}});function wo(t){return t?[mo.of(t)]:[]}function vo(t,e){let i=t.plugin(bo),s=i?i.specs.indexOf(e):-1;return s>-1?i.panels[s]:null}const bo=Ft.fromClass(class{constructor(t){this.input=t.state.facet(xo),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(mo);this.top=new yo(t,!0,e.topContainer),this.bottom=new yo(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(mo);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new yo(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new yo(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(xo);if(i!=this.input){let e=i.filter((t=>t)),s=[],o=[],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)),s.push(e),(e.top?o:n).push(e)}this.specs=e,this.panels=s,this.top.sync(o),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=>qi.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class yo{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=So(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=So(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 So(t){let e=t.nextSibling;return t.remove(),e}const xo=s.Facet.define({enables:bo});class Mo extends s.RangeValue{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Mo.prototype.elementClass="",Mo.prototype.toDOM=void 0,Mo.prototype.mapMode=s.MapMode.TrackBefore,Mo.prototype.startSide=Mo.prototype.endSide=-1,Mo.prototype.point=!0;const Co=s.Facet.define(),ko={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>s.RangeSet.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Ao=s.Facet.define();function Do(t){return[Oo(),Ao.of(Object.assign(Object.assign({},ko),t))]}const To=s.Facet.define({combine:t=>t.some((t=>t))});function Oo(t){let e=[Eo];return t&&!1===t.fixed&&e.push(To.of(!0)),e}const Eo=Ft.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+"px",this.gutters=t.state.facet(Ao).map((e=>new Ho(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(To),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,s=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(s<.8*(i.to-i.from))}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(To)!=!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=s.RangeSet.iter(this.view.state.facet(Co),this.view.viewport.from),o=[],n=this.gutters.map((t=>new Lo(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks)if(o.length&&(o=[]),Array.isArray(t.type)){let e=!0;for(let s of t.type)if(s.type==ut.Text&&e){Bo(i,o,s.from);for(let t of n)t.line(this.view,s,o);e=!1}else if(s.widget)for(let t of n)t.widget(this.view,s)}else if(t.type==ut.Text){Bo(i,o,t.from);for(let e of n)e.line(this.view,t,o)}for(let t of n)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(Ao),i=t.state.facet(Ao),o=t.docChanged||t.heightChanged||t.viewportChanged||!s.RangeSet.eq(t.startState.facet(Co),t.state.facet(Co),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let e of this.gutters)e.update(t)&&(o=!0);else{o=!0;let s=[];for(let o of i){let i=e.indexOf(o);i<0?s.push(new Ho(this.view,o)):(this.gutters[i].update(t),s.push(this.gutters[i]))}for(let t of this.gutters)t.dom.remove(),s.indexOf(t)<0&&t.destroy();for(let t of s)this.dom.appendChild(t.dom);this.gutters=s}return o}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>qi.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Yt.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))});function Ro(t){return Array.isArray(t)?t:[t]}function Bo(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class Lo{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=s.RangeSet.iter(t.markers,e.from)}addElement(t,e,i){let{gutter:s}=this,o=e.top-this.height;if(this.i==s.elements.length){let n=new Vo(t,e.height,o,i);s.elements.push(n),s.dom.appendChild(n.dom)}else s.elements[this.i].update(t,e.height,o,i);this.height=e.bottom,this.i++}line(t,e,i){let s=[];Bo(this.cursor,s,e.from),i.length&&(s=s.concat(i));let o=this.gutter.config.lineMarker(t,e,s);o&&s.unshift(o);let n=this.gutter;(0!=s.length||n.config.renderEmptyElements)&&this.addElement(t,e,s)}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 Ho{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,(s=>{let o,n=s.target;if(n!=this.dom&&this.dom.contains(n)){for(;n.parentNode!=this.dom;)n=n.parentNode;let t=n.getBoundingClientRect();o=(t.top+t.bottom)/2}else o=s.clientY;let r=t.lineBlockAtHeight(o-t.documentTop);e.domEventHandlers[i](t,r,s)&&s.preventDefault()}));this.markers=Ro(e.markers(t)),e.initialSpacer&&(this.spacer=new Vo(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=Ro(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!s.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 Vo{constructor(t,e,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,s)}update(t,e,i,s){this.height!=e&&(this.dom.style.height=(this.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,s)||this.setMarkers(t,s)}setMarkers(t,e){let i="cm-gutterElement",s=this.dom.firstChild;for(let o=0,n=0;;){let r=n,l=o<e.length?e[o++]: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(s);let e=s.nextSibling;s.remove(),s=e}}if(!l)break;l.toDOM&&(h?s=s.nextSibling:this.dom.insertBefore(l.toDOM(t),s)),h&&n++}this.dom.className=i,this.markers=e}destroy(){this.setMarkers(null,[])}}const Po=s.Facet.define(),No=s.Facet.define({combine:t=>(0,s.combineConfig)(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let t in e){let s=i[t],o=e[t];i[t]=s?(t,e,i)=>s(t,e,i)||o(t,e,i):o}return i}})});class Wo extends Mo{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function Fo(t,e){return t.state.facet(No).formatNumber(e,t.state)}const zo=Ao.compute([No],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(Po),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new Wo(Fo(t,t.state.doc.lineAt(e.from).number)),widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(No)!=t.state.facet(No),initialSpacer:t=>new Wo(Fo(t,Ko(t.state.doc.lines))),updateSpacer(t,e){let i=Fo(e.view,Ko(e.view.state.doc.lines));return i==t.number?t:new Wo(i)},domEventHandlers:t.facet(No).domEventHandlers})));function Io(t={}){return[No.of(t),Oo(),zo]}function Ko(t){let e=9;for(;e<t;)e=10*e+9;return e}const qo=new class extends Mo{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Go=Co.compute(["selection"],(t=>{let e=[],i=-1;for(let s of t.selection.ranges){let o=t.doc.lineAt(s.head).from;o>i&&(i=o,e.push(qo.range(o)))}return s.RangeSet.of(e)}));function jo(){return Go}const _o=new Map;function Uo(t){return Ft.define((e=>({decorations:t.createDeco(e),update(e){this.decorations=t.updateDeco(e,this.decorations)}})),{decorations:t=>t.decorations})}const $o=Uo(new ks({regexp:/\t| +/g,decoration:t=>function(t){let e=_o.get(t);return e||_o.set(t,e=ft.mark({attributes:"\t"===t?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":t.replace(/ /g,"·")}})),e}(t[0]),boundary:/\S/}));function Yo(){return $o}const Xo=Uo(new ks({regexp:/\s+$/g,decoration:ft.mark({class:"cm-trailingSpace"}),boundary:/\S/}));function Jo(){return Xo}const Qo={HeightMap:ai,HeightOracle:oi,MeasuredHeights:ni,QueryType:li,ChangedRange:Ut,computeOrder:re,moveVisually:ae}},4434:(t,e,i)=>{i.d(e,{V:()=>r});const s="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),o="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 s(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function o(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))o(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.");o(s(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)o(s(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=n[s]||1;return n[s]=t+1,"ͼ"+t.toString(36)}static mount(t,e){(t[o]||new h(t)).mount(Array.isArray(e)?e:[e])}}let l=new Map;class h{constructor(t){let e=t.ownerDocument||t,i=e.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let s=l.get(e);if(s)return t.adoptedStyleSheets=[s.sheet,...t.adoptedStyleSheets],t[o]=s;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],l.set(e,this)}else{this.styleTag=e.createElement("style");let i=t.head||t;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],t[o]=this}mount(t){let e=this.sheet,i=0,s=0;for(let o=0;o<t.length;o++){let n=t[o],r=this.modules.indexOf(n);if(r<s&&r>-1&&(this.modules.splice(r,1),s--,r=-1),-1==r){if(this.modules.splice(s++,0,n),e)for(let t=0;t<n.rules.length;t++)e.insertRule(n.rules[t],i++)}else{for(;s<r;)i+=this.modules[s++].rules.length;i+=n.rules.length,s++}}if(!e){let t="";for(let e=0;e<this.modules.length;e++)t+=this.modules[e].getRules()+"\n";this.styleTag.textContent=t}}}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6695],{66695:(e,t,s)=>{s.r(t),s.d(t,{AttachmentsCell:()=>me,AttachmentsCellModel:()=>j,Cell:()=>ce,CellDragUtils:()=>l,CellFooter:()=>v,CellHeader:()=>C,CellModel:()=>k,CellSearchProvider:()=>J,CodeCell:()=>ge,CodeCellLayout:()=>pe,CodeCellModel:()=>W,Collapser:()=>p,InputArea:()=>w,InputCollapser:()=>g,InputPlaceholder:()=>R,InputPrompt:()=>f,MarkdownCell:()=>_e,MarkdownCellModel:()=>F,OutputCollapser:()=>m,OutputPlaceholder:()=>V,Placeholder:()=>L,RawCell:()=>Ce,RawCellModel:()=>N,SELECTED_HIGHLIGHT_CLASS:()=>$,createCellSearchProvider:()=>q,isCodeCellModel:()=>H,isMarkdownCellModel:()=>D,isRawCellModel:()=>I});var i=s(98215);const n="jp-dragImage",r="jp-dragImage-singlePrompt",a="jp-dragImage-content",o="jp-dragImage-prompt",d="jp-dragImage-multipleBack";var l;!function(e){e.findCell=function(e,t,s){let i=-1;for(;e&&e.parentElement;){if(s(e)){let s=-1;for(const n of t)if(n.node===e){i=++s;break}break}e=e.parentElement}return i},e.detectTargetArea=function(e,t){var s,i;let n;return n=e?(null===(s=e.editorWidget)||void 0===s?void 0:s.node.contains(t))?"input":(null===(i=e.promptNode)||void 0===i?void 0:i.contains(t))?"prompt":"cell":"unknown",n},e.shouldStartDrag=function(e,t,s,i){const n=Math.abs(s-e),r=Math.abs(i-t);return n>=5||r>=5},e.createCellDragImage=function(e,t){const s=t.length;let l;if("code"===e.model.type){const t=e.model.executionCount;l=" ",t&&(l=t.toString())}else l="";const h=e.model.sharedModel.getSource().split("\n")[0].slice(0,26);return s>1?""!==l?i.VirtualDOM.realize(i.h.div(i.h.div({className:n},i.h.span({className:o},"["+l+"]:"),i.h.span({className:a},h)),i.h.div({className:d},""))):i.VirtualDOM.realize(i.h.div(i.h.div({className:n},i.h.span({className:o}),i.h.span({className:a},h)),i.h.div({className:d},""))):""!==l?i.VirtualDOM.realize(i.h.div(i.h.div({className:`${n} ${r}`},i.h.span({className:o},"["+l+"]:"),i.h.span({className:a},h)))):i.VirtualDOM.realize(i.h.div(i.h.div({className:`${n} ${r}`},i.h.span({className:o}),i.h.span({className:a},h))))}}(l||(l={}));var h=s(9768),u=s(38e3),c=s(78156);class p extends h.ReactWidget{constructor(){super(),this.addClass("jp-Collapser")}get collapsed(){return!1}render(){return c.createElement("div",{className:"jp-Collapser-child",onClick:e=>this.handleClick(e)})}}class g extends p{constructor(){super(),this.addClass("jp-InputCollapser")}get collapsed(){var e;const t=null===(e=this.parent)||void 0===e?void 0:e.parent;return!!t&&t.inputHidden}handleClick(e){var t;const s=null===(t=this.parent)||void 0===t?void 0:t.parent;s&&(s.inputHidden=!s.inputHidden),this.update()}}class m extends p{constructor(){super(),this.addClass("jp-OutputCollapser")}get collapsed(){var e;const t=null===(e=this.parent)||void 0===e?void 0:e.parent;return!!t&&t.outputHidden}handleClick(e){var t,s;const i=null===(t=this.parent)||void 0===t?void 0:t.parent;if(i&&(i.outputHidden=!i.outputHidden,i.outputHidden)){let e=null===(s=i.parent)||void 0===s?void 0:s.node;e&&u.ElementExt.scrollIntoViewIfNeeded(e,i.node)}this.update()}}var _=s(46947);class C extends _.Widget{constructor(){super(),this.addClass("jp-CellHeader")}}class v extends _.Widget{constructor(){super(),this.addClass("jp-CellFooter")}}var y=s(47500);class w extends _.Widget{constructor(e){super(),this.addClass("jp-InputArea");const{contentFactory:t,editorOptions:s,model:i}=e;this.model=i,this.contentFactory=t;const n=this._prompt=t.createInputPrompt();n.addClass("jp-InputArea-prompt");const r=this._editor=new y.CodeEditorWrapper({factory:t.editorFactory,model:i,editorOptions:s});r.addClass("jp-InputArea-editor");const a=this.layout=new _.PanelLayout;a.addWidget(n),a.addWidget(r)}get editorWidget(){return this._editor}get editor(){return this._editor.editor}get promptNode(){return this._prompt.node}get renderedInput(){return this._rendered}renderInput(e){const t=this.layout;this._rendered&&(this._rendered.parent=null),this._editor.hide(),this._rendered=e,t.addWidget(e)}showEditor(){this._rendered&&(this._rendered.parent=null),this._editor.show()}setPrompt(e){this._prompt.executionCount=e}dispose(){this.isDisposed||(this._prompt=null,this._editor=null,this._rendered=null,super.dispose())}}!function(e){e.ContentFactory=class{constructor(e){this._editor=e.editorFactory}get editorFactory(){return this._editor}createInputPrompt(){return new f}}}(w||(w={}));class f extends _.Widget{constructor(){super(),this._executionCount=null,this.addClass("jp-InputPrompt")}get executionCount(){return this._executionCount}set executionCount(e){this._executionCount=e,this.node.textContent=null===e?" ":`[${e||" "}]:`}}var M=s(47479),x=s(23899),O=s(18223);class P{constructor(e){var t;if(this._map=new x.ObservableMap,this._isDisposed=!1,this._stateChanged=new M.Signal(this),this._changed=new M.Signal(this),this._serialized=null,this._changeGuard=!1,this.contentFactory=null!==(t=e.contentFactory)&&void 0!==t?t:P.defaultContentFactory,e.values)for(const t of Object.keys(e.values))void 0!==e.values[t]&&this.set(t,e.values[t]);this._map.changed.connect(this._onMapChanged,this)}get stateChanged(){return this._stateChanged}get changed(){return this._changed}get keys(){return this._map.keys()}get length(){return this._map.keys().length}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,this._map.dispose(),M.Signal.clearData(this))}has(e){return this._map.has(e)}get(e){return this._map.get(e)}set(e,t){const s=this._createItem({value:t});this._map.set(e,s)}remove(e){this._map.delete(e)}clear(){this._map.values().forEach((e=>{e.dispose()})),this._map.clear()}fromJSON(e){this.clear(),Object.keys(e).forEach((t=>{void 0!==e[t]&&this.set(t,e[t])}))}toJSON(){const e={};for(const t of this._map.keys())e[t]=this._map.get(t).toJSON();return e}_createItem(e){const t=this.contentFactory.createAttachmentModel(e);return t.changed.connect(this._onGenericChange,this),t}_onMapChanged(e,t){this._serialized&&!this._changeGuard&&(this._changeGuard=!0,this._serialized.set(this.toJSON()),this._changeGuard=!1),this._changed.emit(t),this._stateChanged.emit(void 0)}_onGenericChange(){this._stateChanged.emit(void 0)}}!function(e){class t{createAttachmentModel(e){return new O.AttachmentModel(e)}}e.ContentFactory=t,e.defaultContentFactory=new t}(P||(P={}));class S{constructor(e){this._parent=e.parent||null,this._model=e.model}async resolveUrl(e){return this._parent&&!e.startsWith("attachment:")?this._parent.resolveUrl(e):e}async getDownloadUrl(e){if(this._parent&&!e.startsWith("attachment:"))return this._parent.getDownloadUrl(e);const t=e.slice(11),s=this._model.get(t);if(void 0===s)return e;const{data:i}=s,n=Object.keys(i)[0];if(void 0===n||-1===O.imageRendererFactory.mimeTypes.indexOf(n))throw new Error(`Cannot render unknown image mime type "${n}".`);return`data:${n};base64,${i[n]}`}isLocal(e){var t,s,i;return!(this._parent&&!e.startsWith("attachment:"))||null===(i=null===(s=(t=this._parent).isLocal)||void 0===s?void 0:s.call(t,e))||void 0===i||i}}var b=s(46847),A=s(69688);const E=(0,A.createMutex)();function H(e){return"code"===e.type}function D(e){return"markdown"===e.type}function I(e){return"raw"===e.type}class k extends y.CodeEditor.Model{constructor(e={}){const{cell_type:t,sharedModel:s,...i}=e;super({sharedModel:null!=s?s:(0,A.createStandaloneCell)({cell_type:null!=t?t:"raw",id:e.id}),...i}),this.contentChanged=new M.Signal(this),this.stateChanged=new M.Signal(this),this._metadataChanged=new M.Signal(this),this._trusted=!1,this.standaloneModel=void 0===e.sharedModel,this.trusted=!!this.getMetadata("trusted")||!!e.trusted,this.sharedModel.changed.connect(this.onGenericChange,this),this.sharedModel.metadataChanged.connect(this._onMetadataChanged,this)}get metadataChanged(){return this._metadataChanged}get id(){return this.sharedModel.getId()}get metadata(){return this.sharedModel.metadata}get trusted(){return this._trusted}set trusted(e){const t=this.trusted;t!==e&&(this._trusted=e,this.onTrustedChanged(this,{newValue:e,oldValue:t}))}dispose(){this.isDisposed||(this.sharedModel.changed.disconnect(this.onGenericChange,this),this.sharedModel.metadataChanged.disconnect(this._onMetadataChanged,this),super.dispose())}onTrustedChanged(e,t){}deleteMetadata(e){return this.sharedModel.deleteMetadata(e)}getMetadata(e){return this.sharedModel.getMetadata(e)}setMetadata(e,t){void 0===t?this.sharedModel.deleteMetadata(e):this.sharedModel.setMetadata(e,t)}toJSON(){return this.sharedModel.toJSON()}onGenericChange(){this.contentChanged.emit(void 0)}_onMetadataChanged(e,t){this._metadataChanged.emit(t)}}class j extends k{constructor(e){var t;super(e);const s=null!==(t=e.contentFactory)&&void 0!==t?t:j.defaultContentFactory,i=this.sharedModel.getAttachments();this._attachments=s.createAttachmentsModel({values:i}),this._attachments.stateChanged.connect(this.onGenericChange,this),this._attachments.changed.connect(this._onAttachmentsChange,this),this.sharedModel.changed.connect(this._onSharedModelChanged,this)}get attachments(){return this._attachments}dispose(){this.isDisposed||(this._attachments.stateChanged.disconnect(this.onGenericChange,this),this._attachments.changed.disconnect(this._onAttachmentsChange,this),this._attachments.dispose(),this.sharedModel.changed.disconnect(this._onSharedModelChanged,this),super.dispose())}toJSON(){return super.toJSON()}_onAttachmentsChange(e,t){const s=this.sharedModel;E((()=>s.setAttachments(e.toJSON())))}_onSharedModelChanged(e,t){if(t.attachmentsChange){const e=this.sharedModel;E((()=>{var t;return this._attachments.fromJSON(null!==(t=e.getAttachments())&&void 0!==t?t:{})}))}}}!function(e){class t{createAttachmentsModel(e){return new P(e)}}e.ContentFactory=t,e.defaultContentFactory=new t}(j||(j={}));class N extends j{constructor(e={}){super({cell_type:"raw",...e})}get type(){return"raw"}toJSON(){return super.toJSON()}}class F extends j{constructor(e={}){super({cell_type:"markdown",...e}),this.mimeType="text/x-ipythongfm"}get type(){return"markdown"}toJSON(){return super.toJSON()}}class W extends k{constructor(e={}){var t;super({cell_type:"code",...e}),this._executedCode="",this._isDirty=!1;const s=null!==(t=null==e?void 0:e.contentFactory)&&void 0!==t?t:W.defaultContentFactory,i=this.trusted,n=this.sharedModel.getOutputs();this._outputs=s.createOutputArea({trusted:i,values:n}),this.sharedModel.changed.connect(this._onSharedModelChanged,this),this._outputs.changed.connect(this.onGenericChange,this),this._outputs.changed.connect(this.onOutputsChange,this)}get type(){return"code"}get executionCount(){return this.sharedModel.execution_count||null}set executionCount(e){this.sharedModel.execution_count=e||null}get isDirty(){return this._isDirty}get outputs(){return this._outputs}clearExecution(){this.outputs.clear(),this.executionCount=null,this._setDirty(!1),this.sharedModel.deleteMetadata("execution"),this.trusted=!0}dispose(){this.isDisposed||(this.sharedModel.changed.disconnect(this._onSharedModelChanged,this),this._outputs.changed.disconnect(this.onGenericChange,this),this._outputs.changed.disconnect(this.onOutputsChange,this),this._outputs.dispose(),this._outputs=null,super.dispose())}onTrustedChanged(e,t){const s=t.newValue;if(this._outputs&&(this._outputs.trusted=s),s){const e=this.sharedModel,t=e.getMetadata();t.trusted=!0,e.setMetadata(t)}this.stateChanged.emit({name:"trusted",oldValue:t.oldValue,newValue:s})}toJSON(){return super.toJSON()}onOutputsChange(e,t){const s=this.sharedModel;E((()=>{switch(t.type){case"add":{const e=t.newValues.map((e=>e.toJSON()));s.updateOutputs(t.newIndex,t.newIndex,e);break}case"set":{const e=t.newValues.map((e=>e.toJSON()));s.updateOutputs(t.oldIndex,t.oldIndex+e.length,e);break}case"remove":s.updateOutputs(t.oldIndex,t.oldValues.length);break;default:throw new Error(`Invalid event type: ${t.type}`)}}))}_onSharedModelChanged(e,t){t.outputsChange&&E((()=>{this.outputs.clear(),e.getOutputs().forEach((e=>this._outputs.add(e)))})),t.executionCountChange&&(!t.executionCountChange.newValue||!this.isDirty&&t.executionCountChange.oldValue||this._setDirty(!1),this.stateChanged.emit({name:"executionCount",oldValue:t.executionCountChange.oldValue,newValue:t.executionCountChange.newValue})),t.sourceChange&&null!==this.executionCount&&this._setDirty(this._executedCode!==this.sharedModel.getSource().trim())}_setDirty(e){e||(this._executedCode=this.sharedModel.getSource().trim()),e!==this._isDirty&&(this._isDirty=e,this.stateChanged.emit({name:"isDirty",oldValue:!e,newValue:e}))}}!function(e){class t{createOutputArea(e){return new b.OutputAreaModel(e)}}e.ContentFactory=t,e.defaultContentFactory=new t}(W||(W={}));var T=s(80259);class L extends _.Widget{constructor(e){var t,s,i;const n=document.createElement("div");super({node:n});const r=(null!==(t=e.translator)&&void 0!==t?t:T.nullTranslator).load("jupyterlab"),a=document.createElement("div");a.className=null!==(s=e.promptClass)&&void 0!==s?s:"",n.insertAdjacentHTML("afterbegin",a.outerHTML),this._cell=document.createElement("div"),this._cell.classList.add("jp-Placeholder-content"),this._cell.title=r.__("Click to expand");const o=this._cell.appendChild(document.createElement("div"));o.classList.add("jp-Placeholder-contentContainer"),this._textContent=o.appendChild(document.createElement("span")),this._textContent.className="jp-PlaceholderText",this._textContent.innerText=null!==(i=e.text)&&void 0!==i?i:"",n.appendChild(this._cell),h.ellipsesIcon.element({container:o.appendChild(document.createElement("span")),className:"jp-MoreHorizIcon",elementPosition:"center",height:"auto",width:"32px"}),this.addClass("jp-Placeholder"),this._callback=e.callback}set text(e){this._textContent.innerText=e}get text(){return this._textContent.innerText}onAfterAttach(e){super.onAfterAttach(e),this.node.addEventListener("click",this._callback)}onBeforeDetach(e){this.node.removeEventListener("click",this._callback),super.onBeforeDetach(e)}}class R extends L{constructor(e){super({...e,promptClass:"jp-Placeholder-prompt jp-InputPrompt"}),this.addClass("jp-InputPlaceholder")}}class V extends L{constructor(e){super({...e,promptClass:"jp-Placeholder-prompt jp-OutputPrompt"}),this.addClass("jp-OutputPlaceholder")}}var B=s(69476),z=s(79452),U=s(690);const $="jp-mod-selected";class J extends B.EditorSearchProvider{constructor(e){super(),this.cell=e,this.cell.inViewport||this.cell.editor||(0,z.signalToPromise)(e.inViewportChanged).then((([,e])=>{e&&this.cmHandler.setEditor(this.editor)}))}get editor(){return this.cell.editor}get model(){return this.cell.model}}class G extends J{constructor(e){super(e),this.currentProviderIndex=-1,this.outputsProvider=[];const t=this.cell.outputArea;this._onOutputsChanged(t,t.widgets.length).catch((e=>{console.error("Failed to initialize search on cell outputs.",e)})),t.outputLengthChanged.connect(this._onOutputsChanged,this),t.disposed.connect((()=>{t.outputLengthChanged.disconnect(this._onOutputsChanged)}),this)}get matchesCount(){return this.isActive?super.matchesCount+this.outputsProvider.reduce(((e,t)=>{var s;return e+(null!==(s=t.matchesCount)&&void 0!==s?s:0)}),0):0}async clearHighlight(){await super.clearHighlight(),await Promise.all(this.outputsProvider.map((e=>e.clearHighlight())))}dispose(){this.isDisposed||(super.dispose(),this.outputsProvider.map((e=>{e.dispose()})),this.outputsProvider.length=0)}async highlightNext(e,t){if(0!==this.matchesCount&&this.isActive){if(-1===this.currentProviderIndex){const e=await super.highlightNext(!0,t);if(e)return this.currentIndex=this.cmHandler.currentIndex,e;this.currentProviderIndex=0}for(;this.currentProviderIndex<this.outputsProvider.length;){const e=this.outputsProvider[this.currentProviderIndex],t=await e.highlightNext(!1);if(t)return this.currentIndex=super.matchesCount+this.outputsProvider.slice(0,this.currentProviderIndex).reduce(((e,t)=>{var s;return e+(null!==(s=t.matchesCount)&&void 0!==s?s:0)}),0)+e.currentMatchIndex,t;this.currentProviderIndex+=1}return this.currentProviderIndex=-1,void(this.currentIndex=null)}this.currentIndex=null}async highlightPrevious(){if(0!==this.matchesCount&&this.isActive){for(null===this.currentIndex&&(this.currentProviderIndex=this.outputsProvider.length-1);this.currentProviderIndex>=0;){const e=this.outputsProvider[this.currentProviderIndex],t=await e.highlightPrevious(!1);if(t)return this.currentIndex=super.matchesCount+this.outputsProvider.slice(0,this.currentProviderIndex).reduce(((e,t)=>{var s;return e+(null!==(s=t.matchesCount)&&void 0!==s?s:0)}),0)+e.currentMatchIndex,t;this.currentProviderIndex-=1}const e=await super.highlightPrevious();return e?(this.currentIndex=this.cmHandler.currentIndex,e):void(this.currentIndex=null)}this.currentIndex=null}async startQuery(e,t){await super.startQuery(e,t),!1!==(null==t?void 0:t.output)&&this.isActive&&await Promise.all(this.outputsProvider.map((t=>t.startQuery(e))))}async endQuery(){var e;await super.endQuery(),!1!==(null===(e=this.filters)||void 0===e?void 0:e.output)&&this.isActive&&await Promise.all(this.outputsProvider.map((e=>e.endQuery())))}async _onOutputsChanged(e,t){var s;this.outputsProvider.forEach((e=>{e.dispose()})),this.outputsProvider.length=0,this.currentProviderIndex=-1,this.outputsProvider=this.cell.outputArea.widgets.map((e=>new U.GenericSearchProvider(e))),this.isActive&&this.query&&!1!==(null===(s=this.filters)||void 0===s?void 0:s.output)&&await Promise.all([this.outputsProvider.map((e=>{e.startQuery(this.query)}))]),this._stateChanged.emit()}}class Q extends J{constructor(e){super(e),this._unrenderedByHighligh=!1,this.renderedProvider=new U.GenericSearchProvider(e.renderer)}async clearHighlight(){await super.clearHighlight(),await this.renderedProvider.clearHighlight()}dispose(){this.isDisposed||(super.dispose(),this.renderedProvider.dispose())}async endQuery(){await super.endQuery(),await this.renderedProvider.endQuery()}async highlightNext(){let e;if(!this.isActive)return e;const t=this.cell;if(t.rendered&&this.matchesCount>0){this._unrenderedByHighligh=!0;const e=(0,z.signalToPromise)(t.renderedChanged);t.rendered=!1,await e}return e=await super.highlightNext(),e}async highlightPrevious(){let e;const t=this.cell;if(t.rendered&&this.matchesCount>0){this._unrenderedByHighligh=!0;const e=(0,z.signalToPromise)(t.renderedChanged);t.rendered=!1,await e}return e=await super.highlightPrevious(),e}async startQuery(e,t){await super.startQuery(e,t);const s=this.cell;s.rendered&&this.onRenderedChanged(s,s.rendered),s.renderedChanged.connect(this.onRenderedChanged,this)}async replaceAllMatches(e){const t=await super.replaceAllMatches(e);return this.cell.rendered&&this.cell.update(),t}onRenderedChanged(e,t){var s;this._unrenderedByHighligh||(this.currentIndex=null),this._unrenderedByHighligh=!1,this.isActive&&(t?this.renderedProvider.startQuery(this.query):(null===(s=e.editor)||void 0===s||s.setCursorPosition({column:0,line:0}),this.renderedProvider.endQuery()))}}function q(e){if(e.isPlaceholder())return new J(e);switch(e.model.type){case"code":return new G(e);case"markdown":return new Q(e);default:return new J(e)}}var X=s(63835),Y=s(38344),K=s(49501),Z=s(20882),ee=s(30807),te=s(70176);const se="jp-mod-resizedCell";class ie extends _.Widget{constructor(e){super(),this.targetNode=e,this._isActive=!1,this._isDragging=!1,this.addClass("jp-CellResizeHandle"),this._resizer=new te.Throttler((e=>this._resize(e)),50)}dispose(){this._resizer.dispose(),super.dispose()}handleEvent(e){var t,s;switch(e.type){case"dblclick":null===(t=this.targetNode.parentNode)||void 0===t||t.childNodes.forEach((e=>{e.classList.remove(se)})),document.documentElement.style.setProperty("--jp-side-by-side-output-size","1fr"),this._isActive=!1;break;case"mousedown":this._isDragging=!0,this._isActive||(null===(s=this.targetNode.parentNode)||void 0===s||s.childNodes.forEach((e=>{e.classList.add(se)})),this._isActive=!0),window.addEventListener("mousemove",this),window.addEventListener("mouseup",this);break;case"mousemove":this._isActive&&this._isDragging&&this._resizer.invoke(e);break;case"mouseup":this._isDragging=!1,window.removeEventListener("mousemove",this),window.removeEventListener("mouseup",this)}}onAfterAttach(e){this.node.addEventListener("dblclick",this),this.node.addEventListener("mousedown",this),super.onAfterAttach(e)}onBeforeDetach(e){this.node.removeEventListener("dblclick",this),this.node.removeEventListener("mousedown",this),super.onBeforeDetach(e)}_resize(e){const{width:t,x:s}=this.targetNode.getBoundingClientRect(),i=t/(e.clientX-s)-1;if(0<i){const e=Math.max(Math.min(Math.abs(i),50),.05);document.documentElement.style.setProperty("--jp-side-by-side-output-size",`${e}fr`)}}}const ne="jp-Cell-outputWrapper",re="jp-mod-dirty",ae="jp-MarkdownHeadingCollapsed",oe="jp-collapseHeadingButton",de="jp-showHiddenCellsButton",le="jp-mod-rendered",he="jp-mod-noOutputs",ue="application/x-jupyter-icontentsrich";class ce extends _.Widget{constructor(e){var t,s,i,n;super(),this.prompt="",this._displayChanged=new M.Signal(this),this._editorConfig={},this._inputHidden=!1,this._inViewportChanged=new M.Signal(this),this._readOnly=!1,this._ready=new K.PromiseDelegate,this._resizeDebouncer=new te.Debouncer((()=>{this._displayChanged.emit()}),0),this._syncCollapse=!1,this._syncEditable=!1,this.addClass("jp-Cell");const r=this._model=e.model;this.contentFactory=e.contentFactory,this.layout=null!==(t=e.layout)&&void 0!==t?t:new _.PanelLayout,this.translator=null!==(s=e.translator)&&void 0!==s?s:T.nullTranslator,this._editorConfig=null!==(i=e.editorConfig)&&void 0!==i?i:{},this._placeholder=!0,this._inViewport=!1,this.placeholder=null===(n=e.placeholder)||void 0===n||n,r.metadataChanged.connect(this.onMetadataChanged,this)}initializeState(){return this.loadCollapseState(),this.loadEditableState(),this}get displayChanged(){return this._displayChanged}get inViewport(){return this._inViewport}set inViewport(e){this._inViewport!==e&&(this._inViewport=e,this._inViewportChanged.emit(this._inViewport))}get inViewportChanged(){return this._inViewportChanged}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder!==e&&!1===e&&(this.initializeDOM(),this._placeholder=e,this._ready.resolve())}get promptNode(){return this.placeholder?null:this._inputHidden?this._inputPlaceholder.node.firstElementChild:this._input.promptNode}get editorWidget(){var e,t;return null!==(t=null===(e=this._input)||void 0===e?void 0:e.editorWidget)&&void 0!==t?t:null}get editor(){var e,t;return null!==(t=null===(e=this._input)||void 0===e?void 0:e.editor)&&void 0!==t?t:null}get editorConfig(){return this._editorConfig}get headings(){return new Array}get model(){return this._model}get inputArea(){return this._input}get readOnly(){return this._readOnly}set readOnly(e){e!==this._readOnly&&(this._readOnly=e,this.syncEditable&&this.saveEditableState(),this.update())}isPlaceholder(){return this.placeholder}saveEditableState(){const{sharedModel:e}=this.model,t=e.getMetadata("editable");this.readOnly&&!1===t||!this.readOnly&&void 0===t||(this.readOnly?e.setMetadata("editable",!1):e.deleteMetadata("editable"))}loadEditableState(){this.readOnly=!1===this.model.sharedModel.getMetadata("editable")}get ready(){return this._ready.promise}setPrompt(e){var t;this.prompt=e,null===(t=this._input)||void 0===t||t.setPrompt(e)}get inputHidden(){return this._inputHidden}set inputHidden(e){var t;if(this._inputHidden!==e){if(!this.placeholder){const s=this._inputWrapper.layout;e?(this._input.parent=null,this._inputPlaceholder&&(this._inputPlaceholder.text=null===(t=this.model.sharedModel.getSource().split("\n"))||void 0===t?void 0:t[0]),s.addWidget(this._inputPlaceholder)):(this._inputPlaceholder.parent=null,s.addWidget(this._input))}this._inputHidden=e,this.syncCollapse&&this.saveCollapseState(),this.handleInputHidden(e)}}saveCollapseState(){const e={...this.model.getMetadata("jupyter")};this.inputHidden&&!0===e.source_hidden||!this.inputHidden&&void 0===e.source_hidden||(this.inputHidden?e.source_hidden=!0:delete e.source_hidden,0===Object.keys(e).length?this.model.deleteMetadata("jupyter"):this.model.setMetadata("jupyter",e))}loadCollapseState(){var e;const t=null!==(e=this.model.getMetadata("jupyter"))&&void 0!==e?e:{};this.inputHidden=!!t.source_hidden}handleInputHidden(e){}get syncCollapse(){return this._syncCollapse}set syncCollapse(e){this._syncCollapse!==e&&(this._syncCollapse=e,e&&this.loadCollapseState())}get syncEditable(){return this._syncEditable}set syncEditable(e){this._syncEditable!==e&&(this._syncEditable=e,e&&this.loadEditableState())}clone(){return new(0,this.constructor)({model:this.model,contentFactory:this.contentFactory,placeholder:!1,translator:this.translator})}dispose(){this.isDisposed||(this._resizeDebouncer.dispose(),this._input=null,this._model=null,this._inputWrapper=null,this._inputPlaceholder=null,super.dispose())}updateEditorConfig(e){this._editorConfig={...this._editorConfig,...e},this.editor&&this.editor.setOptions(this._editorConfig)}initializeDOM(){if(!this.placeholder)return;const e=this.contentFactory,t=this._model,s=e.createCellHeader();s.addClass("jp-Cell-header"),this.layout.addWidget(s);const i=this._inputWrapper=new _.Panel;i.addClass("jp-Cell-inputWrapper");const n=new g;n.addClass("jp-Cell-inputCollapser");const r=this._input=new w({model:t,contentFactory:e,editorOptions:this.getEditorOptions()});r.addClass("jp-Cell-inputArea"),i.addWidget(n),i.addWidget(r),this.layout.addWidget(i),this._inputPlaceholder=new R({callback:()=>{this.inputHidden=!this.inputHidden},text:r.model.sharedModel.getSource().split("\n")[0],translator:this.translator}),r.model.contentChanged.connect(((e,t)=>{var s;this._inputPlaceholder&&this.inputHidden&&(this._inputPlaceholder.text=null===(s=e.sharedModel.getSource().split("\n"))||void 0===s?void 0:s[0])})),this.inputHidden&&(r.parent=null,i.layout.addWidget(this._inputPlaceholder));const a=this.contentFactory.createCellFooter();a.addClass("jp-Cell-footer"),this.layout.addWidget(a)}getEditorOptions(){return{config:this.editorConfig}}onBeforeAttach(e){this.placeholder&&(this.placeholder=!1)}onAfterAttach(e){this.update()}onActivateRequest(e){var t;null===(t=this.editor)||void 0===t||t.focus()}onResize(e){this._resizeDebouncer.invoke()}onUpdateRequest(e){var t,s;this._model&&(null===(t=this.editor)||void 0===t?void 0:t.getOption("readOnly"))!==this._readOnly&&(null===(s=this.editor)||void 0===s||s.setOption("readOnly",this._readOnly))}onContentChanged(){var e;this.inputHidden&&this._inputPlaceholder&&(this._inputPlaceholder.text=null===(e=this.model.sharedModel.getSource().split("\n"))||void 0===e?void 0:e[0])}onMetadataChanged(e,t){switch(t.key){case"jupyter":this.syncCollapse&&this.loadCollapseState();break;case"editable":this.syncEditable&&this.loadEditableState()}}}!function(e){let t;!function(e){e[e.HTML=0]="HTML",e[e.Markdown=1]="Markdown"}(t=e.HeadingType||(e.HeadingType={})),e.ContentFactory=class{constructor(e){this._editorFactory=e.editorFactory}get editorFactory(){return this._editorFactory}createCellHeader(){return new C}createCellFooter(){return new v}createInputPrompt(){return new f}createOutputPrompt(){return new b.OutputPrompt}createStdin(e){return new b.Stdin(e)}}}(ce||(ce={}));class pe extends _.PanelLayout{onBeforeAttach(e){let t=!0;const s=this.parent.node.firstElementChild;for(const i of this)s&&(i.node===s?t=!1:(ee.MessageLoop.sendMessage(i,e),t?this.parent.node.insertBefore(i.node,s):this.parent.node.appendChild(i.node),this.parent.isHidden||i.setFlag(_.Widget.Flag.IsVisible),ee.MessageLoop.sendMessage(i,_.Widget.Msg.AfterAttach)))}onAfterDetach(e){for(const t of this)!t.hasClass(ne)&&t.node.isConnected&&(ee.MessageLoop.sendMessage(t,_.Widget.Msg.BeforeDetach),this.parent.node.removeChild(t.node),ee.MessageLoop.sendMessage(t,e))}}class ge extends ce{constructor(e){var t;super({layout:new pe,...e,placeholder:!0}),this._headingsCache=null,this._outputHidden=!1,this._outputWrapper=null,this._outputPlaceholder=null,this._syncScrolled=!1,this.addClass("jp-CodeCell");const s=this.translator.load("jupyterlab"),i=this._rendermime=e.rendermime,n=this.contentFactory,r=this.model;this.maxNumberOutputs=e.maxNumberOutputs;const a=0===r.outputs.length?s.__("Code Cell Content"):s.__("Code Cell Content with Output");this.node.setAttribute("aria-label",a);const o=this._output=new b.OutputArea({model:this.model.outputs,rendermime:i,contentFactory:n,maxNumberOutputs:this.maxNumberOutputs,translator:this.translator,promptOverlay:!0,inputHistoryScope:e.inputHistoryScope});o.addClass("jp-Cell-outputArea"),o.toggleScrolling.connect((()=>{this.outputsScrolled=!this.outputsScrolled})),this.placeholder=null===(t=e.placeholder)||void 0===t||t,r.outputs.changed.connect(this.onOutputChanged,this),r.outputs.stateChanged.connect(this.onOutputChanged,this),r.stateChanged.connect(this.onStateChanged,this)}initializeDOM(){if(!this.placeholder)return;super.initializeDOM(),this.setPrompt(this.prompt);const e=this._outputWrapper=new _.Panel;e.addClass(ne);const t=new m;t.addClass("jp-Cell-outputCollapser"),e.addWidget(t),0===this.model.outputs.length&&this.addClass(he),this._output.outputLengthChanged.connect(this._outputLengthHandler,this),e.addWidget(this._output);const s=this.layout;s.insertWidget(s.widgets.length-1,new ie(this.node)),s.insertWidget(s.widgets.length-1,e),this.model.isDirty&&this.addClass(re),this._outputPlaceholder=new V({callback:()=>{this.outputHidden=!this.outputHidden},text:this.getOutputPlaceholderText(),translator:this.translator});const i=e.layout;this.outputHidden&&(i.removeWidget(this._output),i.addWidget(this._outputPlaceholder),this.inputHidden&&!e.isHidden&&this._outputWrapper.hide());const n=this.translator.load("jupyterlab"),r=0===this.model.outputs.length?n.__("Code Cell Content"):n.__("Code Cell Content with Output");this.node.setAttribute("aria-label",r)}getOutputPlaceholderText(){var e;const t=this.model.outputs.get(0);if(!(null==t?void 0:t.data))return;const s=["text/html","image/svg+xml","application/pdf","text/markdown","text/plain","application/vnd.jupyter.stderr","application/vnd.jupyter.stdout","text"].find((e=>{const s=t.data[e];return"string"==(Array.isArray(s)?typeof s[0]:typeof s)})),i=t.data[null!=s?s:""];return void 0!==i?null===(e=Array.isArray(i)?i:null==i?void 0:i.split("\n"))||void 0===e?void 0:e.find((e=>""!==e)):void 0}initializeState(){return super.initializeState(),this.loadScrolledState(),this.setPrompt(`${this.model.executionCount||""}`),this}get headings(){if(!this._headingsCache){const e=[],t=this.model.outputs;for(let s=0;s<t.length;s++){const i=t.get(s);let n=null,r=null;Object.keys(i.data).forEach((e=>{!r&&Y.TableOfContentsUtils.Markdown.isMarkdown(e)?r=e:!n&&Y.TableOfContentsUtils.isHTML(e)&&(n=e)})),n?e.push(...Y.TableOfContentsUtils.getHTMLHeadings(this._rendermime.sanitizer.sanitize(i.data[n])).map((e=>({...e,outputIndex:s,type:ce.HeadingType.HTML})))):r&&e.push(...Y.TableOfContentsUtils.Markdown.getHeadings(i.data[r]).map((e=>({...e,outputIndex:s,type:ce.HeadingType.Markdown}))))}this._headingsCache=e}return[...this._headingsCache]}get outputArea(){return this._output}get outputHidden(){return this._outputHidden}set outputHidden(e){var t;if(this._outputHidden!==e){if(!this.placeholder){const s=this._outputWrapper.layout;e?(s.removeWidget(this._output),s.addWidget(this._outputPlaceholder),this.inputHidden&&!this._outputWrapper.isHidden&&this._outputWrapper.hide(),this._outputPlaceholder&&(this._outputPlaceholder.text=null!==(t=this.getOutputPlaceholderText())&&void 0!==t?t:"")):(this._outputWrapper.isHidden&&this._outputWrapper.show(),s.removeWidget(this._outputPlaceholder),s.addWidget(this._output))}this._outputHidden=e,this.syncCollapse&&this.saveCollapseState()}}saveCollapseState(){this.model.sharedModel.transact((()=>{super.saveCollapseState();const e=this.model.getMetadata("collapsed");this.outputHidden&&!0===e||!this.outputHidden&&void 0===e||(this.outputHidden?this.model.setMetadata("collapsed",!0):this.model.deleteMetadata("collapsed"))}),!1)}loadCollapseState(){super.loadCollapseState(),this.outputHidden=!!this.model.getMetadata("collapsed")}get outputsScrolled(){return this._outputsScrolled}set outputsScrolled(e){this.toggleClass("jp-mod-outputsScrolled",e),this._outputsScrolled=e,this.syncScrolled&&this.saveScrolledState()}saveScrolledState(){const e=this.model.getMetadata("scrolled");this.outputsScrolled&&!0===e||!this.outputsScrolled&&void 0===e||(this.outputsScrolled?this.model.setMetadata("scrolled",!0):this.model.deleteMetadata("scrolled"))}loadScrolledState(){"auto"===this.model.getMetadata("scrolled")?this.outputsScrolled=!1:this.outputsScrolled=!!this.model.getMetadata("scrolled")}get syncScrolled(){return this._syncScrolled}set syncScrolled(e){this._syncScrolled!==e&&(this._syncScrolled=e,e&&this.loadScrolledState())}handleInputHidden(e){this.placeholder||(!e&&this._outputWrapper.isHidden?this._outputWrapper.show():e&&!this._outputWrapper.isHidden&&this._outputHidden&&this._outputWrapper.hide())}clone(){return new(0,this.constructor)({model:this.model,contentFactory:this.contentFactory,rendermime:this._rendermime,placeholder:!1,translator:this.translator})}cloneOutputArea(){return new b.SimplifiedOutputArea({model:this.model.outputs,contentFactory:this.contentFactory,rendermime:this._rendermime})}dispose(){this.isDisposed||(this._output.outputLengthChanged.disconnect(this._outputLengthHandler,this),this._rendermime=null,this._output=null,this._outputWrapper=null,this._outputPlaceholder=null,super.dispose())}onStateChanged(e,t){switch(t.name){case"executionCount":this.setPrompt(`${e.executionCount||""}`);break;case"isDirty":e.isDirty?this.addClass(re):this.removeClass(re)}}onOutputChanged(){var e;this._headingsCache=null,this._outputPlaceholder&&this.outputHidden&&(this._outputPlaceholder.text=null!==(e=this.getOutputPlaceholderText())&&void 0!==e?e:"")}onMetadataChanged(e,t){switch(t.key){case"scrolled":this.syncScrolled&&this.loadScrolledState();break;case"collapsed":this.syncCollapse&&this.loadCollapseState()}super.onMetadataChanged(e,t)}_outputLengthHandler(e,t){const s=0===t;this.toggleClass(he,s);const i=this.translator.load("jupyterlab"),n=s?i.__("Code Cell Content"):i.__("Code Cell Content with Output");this.node.setAttribute("aria-label",n)}}!function(e){e.execute=async function(e,t,s){var i;const n=e.model,r=n.sharedModel.getSource();if(!r.trim()||!(null===(i=t.session)||void 0===i?void 0:i.kernel))return void n.sharedModel.transact((()=>{n.clearExecution()}),!1);const a={cellId:n.sharedModel.getId()};s={...n.metadata,...s,...a};const{recordTiming:o}=s;let d;n.sharedModel.transact((()=>{n.clearExecution(),e.outputHidden=!1}),!1),e.setPrompt("*"),n.trusted=!0;try{const i=b.OutputArea.execute(r,e.outputArea,t,s);if(o){const t=e=>{let t;switch(e.header.msg_type){case"status":t=`status.${e.content.execution_state}`;break;case"execute_input":t="execute_input";break;default:return!0}const s=e.header.date||(new Date).toISOString(),i=Object.assign({},n.getMetadata("execution"));return i[`iopub.${t}`]=s,n.setMetadata("execution",i),!0};e.outputArea.future.registerMessageHook(t)}else n.deleteMetadata("execution");d=e.outputArea.future;const a=await i;if(n.executionCount=a.content.execution_count,o){const e=Object.assign({},n.getMetadata("execution")),t=a.metadata.started;t&&(e["shell.execute_reply.started"]=t);const s=a.header.date;e["shell.execute_reply"]=s||(new Date).toISOString(),n.setMetadata("execution",e)}return a}catch(t){throw d&&!e.isDisposed&&e.outputArea.future===d&&e.setPrompt(""),t}}}(ge||(ge={}));class me extends ce{handleEvent(e){switch(e.type){case"lm-dragover":this._evtDragOver(e);break;case"lm-drop":this._evtDrop(e)}}getEditorOptions(){var e,t;const s=null!==(e=super.getEditorOptions())&&void 0!==e?e:{};return s.extensions=[...null!==(t=s.extensions)&&void 0!==t?t:[],X.EditorView.domEventHandlers({dragenter:e=>{e.preventDefault()},dragover:e=>{e.preventDefault()},drop:e=>{this._evtNativeDrop(e)},paste:e=>{this._evtPaste(e)}})],s}onAfterAttach(e){super.onAfterAttach(e);const t=this.node;t.addEventListener("lm-dragover",this),t.addEventListener("lm-drop",this)}onBeforeDetach(e){const t=this.node;t.removeEventListener("lm-dragover",this),t.removeEventListener("lm-drop",this),super.onBeforeDetach(e)}_evtDragOver(e){(0,Z.some)(O.imageRendererFactory.mimeTypes,(t=>!!e.mimeData.hasData(ue)&&e.mimeData.getData(ue).model.mimetype===t))&&(e.preventDefault(),e.stopPropagation(),e.dropAction=e.proposedAction)}_evtPaste(e){if(e.clipboardData){const t=e.clipboardData.items;for(let s=0;s<t.length;s++){if("text/plain"===t[s].type){if(s<t.length-1&&"file"===t[s+1].kind)continue;t[s].getAsString((e=>{var t,s;null===(s=(t=this.editor).replaceSelection)||void 0===s||s.call(t,e)}))}this._attachFiles(e.clipboardData.items)}}e.preventDefault()}_evtNativeDrop(e){e.dataTransfer&&this._attachFiles(e.dataTransfer.items),e.preventDefault()}_evtDrop(e){const t=e.mimeData.types().filter((t=>{if(t===ue){const t=e.mimeData.getData(ue);return-1!==O.imageRendererFactory.mimeTypes.indexOf(t.model.mimetype)}return-1!==O.imageRendererFactory.mimeTypes.indexOf(t)}));if(0!==t.length)if(e.preventDefault(),e.stopPropagation(),"none"!==e.proposedAction){e.dropAction="copy";for(const s of t)if(s===ue){const{model:t,withContent:s}=e.mimeData.getData(ue);if("file"===t.type){const e=this._generateURI(t.name);this.updateCellSourceWithAttachment(t.name,e),s().then((t=>{this.model.attachments.set(e,{[t.mimetype]:t.content})}))}}else{const t=this._generateURI();this.model.attachments.set(t,{[s]:e.mimeData.getData(s)}),this.updateCellSourceWithAttachment(t,t)}}else e.dropAction="none"}_attachFiles(e){for(let t=0;t<e.length;t++){const s=e[t];if("file"===s.kind){const e=s.getAsFile();e&&this._attachFile(e)}}}_attachFile(e){const t=new FileReader;t.onload=s=>{const{href:i,protocol:n}=z.URLExt.parse(t.result);if("data:"!==n)return;const r=/([\w+\/\+]+)?(?:;(charset=[\w\d-]*|base64))?,(.*)/.exec(i);if(!r||4!==r.length)return;const a=r[1],o={[a]:r[3]},d=this._generateURI(e.name);a.startsWith("image/")&&(this.model.attachments.set(d,o),this.updateCellSourceWithAttachment(e.name,d))},t.onerror=t=>{console.error(`Failed to attach ${e.name}`+t)},t.readAsDataURL(e)}_generateURI(e=""){const t=e.lastIndexOf(".");return-1!==t?K.UUID.uuid4().concat(e.substring(t)):K.UUID.uuid4()}}class _e extends me{constructor(e){var t,s,i,n;super({...e,placeholder:!0}),this._headingsCache=null,this._headingCollapsedChanged=new M.Signal(this),this._prevText="",this._rendered=!0,this._renderedChanged=new M.Signal(this),this._showEditorForReadOnlyMarkdown=!0,this.addClass("jp-MarkdownCell"),this.model.contentChanged.connect(this.onContentChanged,this);const r=this.translator.load("jupyterlab");this.node.setAttribute("aria-label",r.__("Markdown Cell Content")),this._rendermime=e.rendermime.clone({resolver:new S({parent:null!==(t=e.rendermime.resolver)&&void 0!==t?t:void 0,model:this.model.attachments})}),this._renderer=this._rendermime.createRenderer("text/markdown"),this._renderer.addClass("jp-MarkdownOutput"),this._headingCollapsed=null!==(s=this.model.getMetadata(ae))&&void 0!==s&&s,this._showEditorForReadOnlyMarkdown=null!==(i=e.showEditorForReadOnlyMarkdown)&&void 0!==i?i:_e.defaultShowEditorForReadOnlyMarkdown,this.placeholder=null===(n=e.placeholder)||void 0===n||n,this._monitor=new z.ActivityMonitor({signal:this.model.contentChanged,timeout:1e3}),this.ready.then((()=>{this.isDisposed||this._monitor.activityStopped.connect((()=>{this._rendered&&this.update()}),this)})).catch((e=>{console.error("Failed to be ready",e)}))}get headingInfo(){const e=this.headings;if(e.length>0){const{text:t,level:s}=e.reduce(((e,t)=>e.level<=t.level?e:t),e[0]);return{text:t,level:s}}return{text:"",level:-1}}get headings(){if(!this._headingsCache){const e=Y.TableOfContentsUtils.Markdown.getHeadings(this.model.sharedModel.getSource());this._headingsCache=e.map((e=>({...e,type:ce.HeadingType.Markdown})))}return[...this._headingsCache]}get headingCollapsed(){return this._headingCollapsed}set headingCollapsed(e){var t;if(this._headingCollapsed!==e){this._headingCollapsed=e,e?this.model.setMetadata(ae,e):"undefined"!==this.model.getMetadata(ae)&&this.model.deleteMetadata(ae);const s=null===(t=this.inputArea)||void 0===t?void 0:t.promptNode.getElementsByClassName(oe)[0];s&&(e?s.classList.add("jp-mod-collapsed"):s.classList.remove("jp-mod-collapsed")),this.renderCollapseButtons(this._renderer),this._headingCollapsedChanged.emit(this._headingCollapsed)}}get numberChildNodes(){return this._numberChildNodes}set numberChildNodes(e){this._numberChildNodes=e,this.renderCollapseButtons(this._renderer)}get headingCollapsedChanged(){return this._headingCollapsedChanged}get rendered(){return this._rendered}set rendered(e){this.readOnly&&!1===this._showEditorForReadOnlyMarkdown&&(e=!0),e!==this._rendered&&(this._rendered=e,this._handleRendered().then((()=>{this._displayChanged.emit(),this._renderedChanged.emit(this._rendered)})).catch((e=>{console.error("Failed to render",e)})))}get renderedChanged(){return this._renderedChanged}get showEditorForReadOnly(){return this._showEditorForReadOnlyMarkdown}set showEditorForReadOnly(e){this._showEditorForReadOnlyMarkdown=e,!1===e&&(this.rendered=!0)}get renderer(){return this._renderer}dispose(){this.isDisposed||(this._monitor.dispose(),super.dispose())}initializeDOM(){this.placeholder&&(super.initializeDOM(),this.renderCollapseButtons(this._renderer),this._handleRendered().catch((e=>{console.error("Failed to render",e)})))}maybeCreateCollapseButton(){var e;const{level:t}=this.headingInfo;if(t>0&&0==(null===(e=this.inputArea)||void 0===e?void 0:e.promptNode.getElementsByClassName(oe).length)){let e=this.inputArea.promptNode.appendChild(document.createElement("button"));e.className=`jp-Button ${oe}`,e.setAttribute("data-heading-level",t.toString()),this._headingCollapsed?e.classList.add("jp-mod-collapsed"):e.classList.remove("jp-mod-collapsed"),e.onclick=e=>{this.headingCollapsed=!this.headingCollapsed}}}maybeCreateOrUpdateExpandButton(){const e=this.node.getElementsByClassName(de);let t=this.translator.load("jupyterlab")._n("%1 cell hidden","%1 cells hidden",this._numberChildNodes);if(this.headingCollapsed&&this._numberChildNodes>0&&0==e.length){const e=document.createElement("button");e.className=`jp-mod-minimal jp-Button ${de}`,h.addIcon.render(e);const s=document.createElement("div");s.textContent=t,e.appendChild(s),e.onclick=()=>{this.headingCollapsed=!1},this.node.appendChild(e)}if(this.headingCollapsed&&this._numberChildNodes>0&&1==e.length&&(e[0].childNodes[1].textContent=t),!(this.headingCollapsed&&this._numberChildNodes>0))for(const t of e)this.node.removeChild(t)}onContentChanged(){super.onContentChanged(),this._headingsCache=null}renderCollapseButtons(e){this.node.classList.toggle(ae,this._headingCollapsed),this.maybeCreateCollapseButton(),this.maybeCreateOrUpdateExpandButton()}renderInput(e){this.addClass(le),this.placeholder||this.isDisposed||(this.renderCollapseButtons(e),this.inputArea.renderInput(e))}showEditor(){if(this.removeClass(le),!this.placeholder&&!this.isDisposed){this.inputArea.showEditor();let e=(this.model.sharedModel.getSource().match(/^#+/g)||[""])[0].length;e>0&&this.inputArea.editor.setCursorPosition({column:e+1,line:0})}}onUpdateRequest(e){this._handleRendered().catch((e=>{console.error("Failed to render",e)})),super.onUpdateRequest(e)}updateCellSourceWithAttachment(e,t){var s,i;const n=`![${e}](attachment:${null!=t?t:e})`;null===(i=null===(s=this.editor)||void 0===s?void 0:s.replaceSelection)||void 0===i||i.call(s,n)}async _handleRendered(){this._rendered?(await this._updateRenderedInput(),this._rendered&&this.renderInput(this._renderer)):this.showEditor()}_updateRenderedInput(){if(this.placeholder)return Promise.resolve();const e=this.model,t=e&&e.sharedModel.getSource()||"Type Markdown and LaTeX: $ α^2 $";if(t!==this._prevText){const e=new O.MimeModel({data:{"text/markdown":t}});return this._prevText=t,this._renderer.renderModel(e)}return Promise.resolve()}clone(){return new(0,this.constructor)({model:this.model,contentFactory:this.contentFactory,rendermime:this._rendermime,placeholder:!1,translator:this.translator})}}!function(e){e.defaultShowEditorForReadOnlyMarkdown=!0}(_e||(_e={}));class Ce extends ce{constructor(e){super(e),this.addClass("jp-RawCell");const t=this.translator.load("jupyterlab");this.node.setAttribute("aria-label",t.__("Raw Cell Content"))}clone(){return new(0,this.constructor)({model:this.model,contentFactory:this.contentFactory,placeholder:!1,translator:this.translator})}}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[771,3146],{73146:(e,t,o)=>{o.r(t),o.d(t,{INotebookTree:()=>n,NotebookTreeWidget:()=>s});var r=o(9768),a=o(46947);class s extends a.TabPanel{constructor(){super({tabPlacement:"top",tabsMovable:!0,renderer:r.TabBarSvg.defaultRenderer}),this.addClass("jp-TreePanel")}}const n=new(o(49501).Token)("@jupyter-notebook/tree:INotebookTree")}}]);