@aquera/nile-elements 0.0.91 → 0.0.93

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.
Files changed (172) hide show
  1. package/README.md +9 -0
  2. package/demo/variables.css +1 -0
  3. package/demo/variables_v2.css +1 -0
  4. package/dist/{angular-ts-da0fd838.cjs.js → angular-ts-a95c67aa.cjs.js} +2 -2
  5. package/dist/{angular-ts-da0fd838.cjs.js.map → angular-ts-a95c67aa.cjs.js.map} +1 -1
  6. package/dist/{asciidoc-de6540f7.esm.js → asciidoc-b8046ce8.esm.js} +1 -1
  7. package/dist/{asciidoc-b383cc2e.cjs.js → asciidoc-c0ae04c3.cjs.js} +2 -2
  8. package/dist/{asciidoc-b383cc2e.cjs.js.map → asciidoc-c0ae04c3.cjs.js.map} +1 -1
  9. package/dist/{astro-05e2da78.cjs.js → astro-97602850.cjs.js} +2 -2
  10. package/dist/{astro-05e2da78.cjs.js.map → astro-97602850.cjs.js.map} +1 -1
  11. package/dist/{astro-1223c814.esm.js → astro-de938e80.esm.js} +1 -1
  12. package/dist/{crystal-00fdf85b.esm.js → crystal-5e351a7d.esm.js} +1 -1
  13. package/dist/{crystal-ae510520.cjs.js → crystal-bfe435a1.cjs.js} +2 -2
  14. package/dist/{crystal-ae510520.cjs.js.map → crystal-bfe435a1.cjs.js.map} +1 -1
  15. package/dist/dotenv-2978380a.esm.js +1 -0
  16. package/dist/dotenv-6a845f3d.cjs.js +2 -0
  17. package/dist/dotenv-6a845f3d.cjs.js.map +1 -0
  18. package/dist/{edge-9983b50e.cjs.js → edge-f122fee4.cjs.js} +2 -2
  19. package/dist/{edge-9983b50e.cjs.js.map → edge-f122fee4.cjs.js.map} +1 -1
  20. package/dist/{erb-6afdf0fc.cjs.js → erb-4ff167eb.cjs.js} +2 -2
  21. package/dist/{erb-6afdf0fc.cjs.js.map → erb-4ff167eb.cjs.js.map} +1 -1
  22. package/dist/{erb-e26dd182.esm.js → erb-baff1e72.esm.js} +1 -1
  23. package/dist/everforest-dark-0ddfeebd.cjs.js +2 -0
  24. package/dist/everforest-dark-0ddfeebd.cjs.js.map +1 -0
  25. package/dist/everforest-dark-c8bfaab7.esm.js +1 -0
  26. package/dist/everforest-light-d4dc4485.esm.js +1 -0
  27. package/dist/everforest-light-eee329e3.cjs.js +2 -0
  28. package/dist/everforest-light-eee329e3.cjs.js.map +1 -0
  29. package/dist/{fortran-fixed-form-dc511aa4.cjs.js → fortran-fixed-form-48ce1631.cjs.js} +2 -2
  30. package/dist/{fortran-fixed-form-dc511aa4.cjs.js.map → fortran-fixed-form-48ce1631.cjs.js.map} +1 -1
  31. package/dist/{fsharp-33f71ce3.esm.js → fsharp-941d0410.esm.js} +1 -1
  32. package/dist/{fsharp-2716dc4e.cjs.js → fsharp-9f65d045.cjs.js} +2 -2
  33. package/dist/{fsharp-2716dc4e.cjs.js.map → fsharp-9f65d045.cjs.js.map} +1 -1
  34. package/dist/{gdresource-10e5a92c.cjs.js → gdresource-f69c4269.cjs.js} +2 -2
  35. package/dist/{gdresource-10e5a92c.cjs.js.map → gdresource-f69c4269.cjs.js.map} +1 -1
  36. package/dist/{git-rebase-3af101f6.esm.js → git-rebase-a164f4f3.esm.js} +1 -1
  37. package/dist/{git-rebase-6c8a29e3.cjs.js → git-rebase-d4b1bf1e.cjs.js} +2 -2
  38. package/dist/{git-rebase-6c8a29e3.cjs.js.map → git-rebase-d4b1bf1e.cjs.js.map} +1 -1
  39. package/dist/{haml-0a4f1779.esm.js → haml-2548eb67.esm.js} +1 -1
  40. package/dist/{haml-9562b9cb.cjs.js → haml-a62722ee.cjs.js} +2 -2
  41. package/dist/{haml-9562b9cb.cjs.js.map → haml-a62722ee.cjs.js.map} +1 -1
  42. package/dist/{http-fbb08279.cjs.js → http-243ce707.cjs.js} +2 -2
  43. package/dist/{http-fbb08279.cjs.js.map → http-243ce707.cjs.js.map} +1 -1
  44. package/dist/{http-93fe835e.esm.js → http-5eea627d.esm.js} +1 -1
  45. package/dist/{hxml-84e30280.cjs.js → hxml-36e954b2.cjs.js} +2 -2
  46. package/dist/{hxml-84e30280.cjs.js.map → hxml-36e954b2.cjs.js.map} +1 -1
  47. package/dist/julia-289248e3.esm.js +1 -0
  48. package/dist/julia-e6d02a84.cjs.js +2 -0
  49. package/dist/julia-e6d02a84.cjs.js.map +1 -0
  50. package/dist/kotlin-0426de90.cjs.js +2 -0
  51. package/dist/kotlin-0426de90.cjs.js.map +1 -0
  52. package/dist/kotlin-9232cba2.esm.js +1 -0
  53. package/dist/latex-1732805a.cjs.js +2 -0
  54. package/dist/latex-1732805a.cjs.js.map +1 -0
  55. package/dist/latex-d31ca0af.esm.js +1 -0
  56. package/dist/less-263f5e43.esm.js +1 -0
  57. package/dist/less-d05a73ab.cjs.js +2 -0
  58. package/dist/less-d05a73ab.cjs.js.map +1 -0
  59. package/dist/{marko-6fdf941d.cjs.js → marko-5bdb0e54.cjs.js} +2 -2
  60. package/dist/{marko-6fdf941d.cjs.js.map → marko-5bdb0e54.cjs.js.map} +1 -1
  61. package/dist/{marko-f6122312.esm.js → marko-b0214c2c.esm.js} +1 -1
  62. package/dist/{mdc-34a9ac72.cjs.js → mdc-a3ab9285.cjs.js} +2 -2
  63. package/dist/{mdc-34a9ac72.cjs.js.map → mdc-a3ab9285.cjs.js.map} +1 -1
  64. package/dist/nile-code-editor/extensionSetup.cjs.js +2 -2
  65. package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
  66. package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
  67. package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
  68. package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
  69. package/dist/nile-highlighter/nile-highlighter.cjs.js +1 -1
  70. package/dist/nile-highlighter/nile-highlighter.cjs.js.map +1 -1
  71. package/dist/nile-highlighter/nile-highlighter.esm.js +1 -1
  72. package/dist/nile-icon/index.cjs.js +1 -1
  73. package/dist/nile-icon/index.cjs.js.map +1 -1
  74. package/dist/nile-icon/index.esm.js +1 -1
  75. package/dist/nile-menu/index.cjs.js +1 -1
  76. package/dist/nile-menu/index.esm.js +1 -1
  77. package/dist/nile-menu/nile-menu.cjs.js +1 -1
  78. package/dist/nile-menu/nile-menu.cjs.js.map +1 -1
  79. package/dist/nile-menu/nile-menu.css.cjs.js +1 -1
  80. package/dist/nile-menu/nile-menu.css.cjs.js.map +1 -1
  81. package/dist/nile-menu/nile-menu.css.esm.js +24 -2
  82. package/dist/nile-menu/nile-menu.esm.js +7 -3
  83. package/dist/nile-select/nile-select.cjs.js +1 -1
  84. package/dist/nile-select/nile-select.cjs.js.map +1 -1
  85. package/dist/nile-select/nile-select.esm.js +2 -2
  86. package/dist/nile-stepper/nile-stepper.cjs.js +1 -1
  87. package/dist/nile-stepper/nile-stepper.cjs.js.map +1 -1
  88. package/dist/nile-stepper/nile-stepper.esm.js +3 -3
  89. package/dist/{nim-808435cb.cjs.js → nim-df5f9efe.cjs.js} +2 -2
  90. package/dist/{nim-808435cb.cjs.js.map → nim-df5f9efe.cjs.js.map} +1 -1
  91. package/dist/{rst-98199db8.esm.js → rst-32451dee.esm.js} +1 -1
  92. package/dist/{rst-a41b2bdd.cjs.js → rst-64e995dc.cjs.js} +2 -2
  93. package/dist/{rst-a41b2bdd.cjs.js.map → rst-64e995dc.cjs.js.map} +1 -1
  94. package/dist/{ruby-44a4045d.cjs.js → ruby-82bc8c10.cjs.js} +2 -2
  95. package/dist/{ruby-44a4045d.cjs.js.map → ruby-82bc8c10.cjs.js.map} +1 -1
  96. package/dist/{ruby-ed20df8b.esm.js → ruby-b8bcac40.esm.js} +1 -1
  97. package/dist/{shaderlab-75efb6b5.cjs.js → shaderlab-8f7349ac.cjs.js} +2 -2
  98. package/dist/{shaderlab-75efb6b5.cjs.js.map → shaderlab-8f7349ac.cjs.js.map} +1 -1
  99. package/dist/{shellscript-95a6b265.esm.js → shellscript-9a12df8f.esm.js} +1 -1
  100. package/dist/{shellscript-ada948c5.cjs.js → shellscript-9c815bf4.cjs.js} +2 -2
  101. package/dist/shellscript-9c815bf4.cjs.js.map +1 -0
  102. package/dist/{shellsession-c69f0eea.esm.js → shellsession-a931a3f3.esm.js} +1 -1
  103. package/dist/{shellsession-c26f94d1.cjs.js → shellsession-c07da9ea.cjs.js} +2 -2
  104. package/dist/{shellsession-c26f94d1.cjs.js.map → shellsession-c07da9ea.cjs.js.map} +1 -1
  105. package/dist/{sparql-933afbfc.cjs.js → sparql-cd3386f5.cjs.js} +2 -2
  106. package/dist/{sparql-933afbfc.cjs.js.map → sparql-cd3386f5.cjs.js.map} +1 -1
  107. package/dist/src/nile-code-editor/nile-code-editor.d.ts +9 -9
  108. package/dist/src/nile-code-editor/nile-code-editor.js +49 -50
  109. package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
  110. package/dist/src/nile-icon/index.js +1 -1
  111. package/dist/src/nile-icon/index.js.map +1 -1
  112. package/dist/src/nile-menu/nile-menu.css.js +22 -0
  113. package/dist/src/nile-menu/nile-menu.css.js.map +1 -1
  114. package/dist/src/nile-menu/nile-menu.d.ts +1 -0
  115. package/dist/src/nile-menu/nile-menu.js +9 -3
  116. package/dist/src/nile-menu/nile-menu.js.map +1 -1
  117. package/dist/src/nile-select/nile-select.d.ts +1 -0
  118. package/dist/src/nile-select/nile-select.js +14 -0
  119. package/dist/src/nile-select/nile-select.js.map +1 -1
  120. package/dist/src/nile-stepper/nile-stepper.js +4 -4
  121. package/dist/src/nile-stepper/nile-stepper.js.map +1 -1
  122. package/dist/{svelte-03aa9546.esm.js → svelte-00ac1b62.esm.js} +1 -1
  123. package/dist/{svelte-4fa7ff17.cjs.js → svelte-eaee6dea.cjs.js} +2 -2
  124. package/dist/{svelte-4fa7ff17.cjs.js.map → svelte-eaee6dea.cjs.js.map} +1 -1
  125. package/dist/ts-tags-7b4b630f.esm.js +1 -0
  126. package/dist/ts-tags-bf26a4cd.cjs.js +2 -0
  127. package/dist/ts-tags-bf26a4cd.cjs.js.map +1 -0
  128. package/dist/tsconfig.tsbuildinfo +1 -1
  129. package/dist/{twig-78fca8e5.esm.js → twig-25cabcad.esm.js} +1 -1
  130. package/dist/{twig-585d978b.cjs.js → twig-ef3a2f8e.cjs.js} +2 -2
  131. package/dist/{twig-585d978b.cjs.js.map → twig-ef3a2f8e.cjs.js.map} +1 -1
  132. package/dist/{vitesse-black-30667039.esm.js → vitesse-black-36f4f5ae.esm.js} +1 -1
  133. package/dist/{vitesse-black-3dbe0082.cjs.js → vitesse-black-8f7b8bf9.cjs.js} +2 -2
  134. package/dist/vitesse-black-8f7b8bf9.cjs.js.map +1 -0
  135. package/dist/{vitesse-dark-222eaa70.cjs.js → vitesse-dark-877d0b03.cjs.js} +2 -2
  136. package/dist/vitesse-dark-877d0b03.cjs.js.map +1 -0
  137. package/dist/{vitesse-dark-2e5d272b.esm.js → vitesse-dark-b177c06b.esm.js} +1 -1
  138. package/dist/{vitesse-light-0f794f0d.esm.js → vitesse-light-1305bc40.esm.js} +1 -1
  139. package/dist/{vitesse-light-9d496793.cjs.js → vitesse-light-3f1d75bb.cjs.js} +2 -2
  140. package/dist/vitesse-light-3f1d75bb.cjs.js.map +1 -0
  141. package/dist/{vue-29da39c3.esm.js → vue-711d75a4.esm.js} +1 -1
  142. package/dist/{vue-0e328a24.cjs.js → vue-d4c63178.cjs.js} +2 -2
  143. package/dist/{vue-0e328a24.cjs.js.map → vue-d4c63178.cjs.js.map} +1 -1
  144. package/dist/{vue-html-fa1c51e6.cjs.js → vue-html-13711be2.cjs.js} +2 -2
  145. package/dist/{vue-html-fa1c51e6.cjs.js.map → vue-html-13711be2.cjs.js.map} +1 -1
  146. package/dist/{vue-html-c781b090.esm.js → vue-html-b805e078.esm.js} +1 -1
  147. package/dist/{wikitext-4b6b7007.esm.js → wikitext-724303c6.esm.js} +1 -1
  148. package/dist/{wikitext-6feef894.cjs.js → wikitext-d4ad7e43.cjs.js} +2 -2
  149. package/dist/{wikitext-6feef894.cjs.js.map → wikitext-d4ad7e43.cjs.js.map} +1 -1
  150. package/package.json +2 -2
  151. package/src/nile-code-editor/nile-code-editor.ts +71 -65
  152. package/src/nile-icon/index.ts +1 -1
  153. package/src/nile-menu/nile-menu.css.ts +22 -0
  154. package/src/nile-menu/nile-menu.ts +14 -3
  155. package/src/nile-select/nile-select.ts +13 -1
  156. package/src/nile-stepper/nile-stepper.ts +4 -4
  157. package/dist/julia-1cad9870.esm.js +0 -1
  158. package/dist/julia-b0cea839.cjs.js +0 -2
  159. package/dist/julia-b0cea839.cjs.js.map +0 -1
  160. package/dist/kotlin-6283300f.esm.js +0 -1
  161. package/dist/kotlin-a0fd9eaf.cjs.js +0 -2
  162. package/dist/kotlin-a0fd9eaf.cjs.js.map +0 -1
  163. package/dist/latex-90a1da91.cjs.js +0 -2
  164. package/dist/latex-90a1da91.cjs.js.map +0 -1
  165. package/dist/latex-9439b9a5.esm.js +0 -1
  166. package/dist/less-cab2de0f.cjs.js +0 -2
  167. package/dist/less-cab2de0f.cjs.js.map +0 -1
  168. package/dist/less-fa4eebf7.esm.js +0 -1
  169. package/dist/shellscript-ada948c5.cjs.js.map +0 -1
  170. package/dist/vitesse-black-3dbe0082.cjs.js.map +0 -1
  171. package/dist/vitesse-dark-222eaa70.cjs.js.map +0 -1
  172. package/dist/vitesse-light-9d496793.cjs.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  System.register([],function(_export,_context){"use strict";var t,e,i,n,h,l,o,f,_t18,d,M,x,S,A,R,T,B,N,$,z,V,F,q,U,J,G,_,X,Y,Q,Z,it,st,rt,nt,ht,lt,ot,ut,ft,at,ct,dt,bt,kt,yt,Mt,St,Ct,Dt,Et,It,Rt,Bt,Lt,$t,qt,Ut,Jt,Gt,Kt,_t,Xt,Yt,Qt,Zt,te,ee,pe,me,ge,Se,Ae,Ce,Oe,Re,Te,Be,Le,Ne,$e,je,ze,Pe,He,We,Ve,Fe,qe,Ue,Je,Ye,ei,ii,si,ri,ni,hi,li,oi,ai,di,pi,mi,gi,bi,vi,ki,yi,_i66,_arr,_t66,_e61,_i67,xi,Si,Ci,Ii,Bi,Li,Ni,$i,ji,zi,Pi,Hi,Wi,Vi,Fi,qi,Ji,Gi,Ki,_i,Xi,Yi,Qi,Zi,ts,es,is,rs,hs,ls,os,us,fs,cs,Cs,Es,Is,Rs,Bs,Ls,Ns,$s,Ps,Hs,Fs,qs,Us,Js,_s,Xs,Zs,tr,er,ir,sr,rr,nr,hr,lr,or,ur,fr,cr,dr,gr,wr,br,vr,xr,Sr,Cr,Dr,Or,Er,Ir,Rr,Br,Lr,Nr,jr,zr,Hr,Wr,Vr,Ur,Jr,Gr,Kr,Xr,Qr,Zr,tn,sn,rn,hn,un,fn,cn,dn,mn,wn,bn,vn,kn,yn,Mn,Sn,An,Cn,Dn,On,En,In,Rn,Tn,Bn,Ln,Nn,zn,Pn,Hn,Wn,Fn,qn,Un,Jn,Gn,Kn,_n,Xn,Yn,Qn,Zn,ih,sh,nh,hh,oh,uh,fh,ah,ch,ph,gh,vh,kh,yh,Mh,xh,Sh,Ch,Eh,Ih,Rh,Th,Bh,Lh,Nh,$h,jh,zh,Ph,Hh,Wh,Vh,Fh,qh,Gh,Kh,Yh,Qh,tl,el,sl,hl,ll,ol,ul,fl,al,cl,dl,ml,gl,vl,kl,yl,Ml,xl,Sl,Al,Cl,Dl,Ol,El,Il,Rl,Tl,Bl,Ll,Nl,$l,jl,Pl,Hl,Vl,ql,Ul,Jl,Kl,_l,Xl,Yl,Ql,Zl,to,eo,no,ho,fo,mo,wo,bo,xo,So,Co,Ro,To,Bo,$o,jo,zo,Po,Ho,Wo,Vo,Fo,Uo,Jo,Go,Ko,_o,Xo,Yo,Qo,Zo,eu,iu,su,ou,uu,fu,au,cu,_i171,_arr2,_arr2$_i,_t243,_e205,gu,wu,bu,ku,xu,Su,Au,Cu,Du,Eu,Iu,Ru,Tu,Bu,$u,ju,Vu,Fu,qu,Yu,Qu,rf,nf,of,uf,df,pf,wf,bf,kf,yf,Mf,xf,Sf,Af,Of,Ef,If,Rf,Tf,$f,Pf,Vf,Ff,qf,Uf,Jf,Gf,Kf,_f,Qf,Zf,ta,ea,ia,sa,ra,ha,la,oa,ua,fa,ca,ga,wa,ba,va,ka,ya,Ma,xa,Aa,Ca,Da,Oa,Ea,La,Na,$a,ja,Pa,Ha,Va,Fa,qa,Ka,Ya,Qa,tc,ec,ic,sc,rc,oc,ac,cc,dc,mc,wc,bc,vc,kc,yc,xc,Ac,Cc,Dc,Oc,Ec,Ic,Rc,Tc,Bc,Lc,Nc,$c,jc,zc,Vc,Fc,qc,Jc,Gc,Kc,_c,Xc,Yc,td,ed,id,ad,cd,dd,pd,gd,wd,bd,vd,kd,xd,Sd,Ad,Od,Ed,Id,Td,Bd,Ld,Nd;function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e260){throw _e260;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e261){didErr=true;err=_e261;},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]();}finally{if(didErr)throw err;}}};}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function s(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1e9;for(var _r9=0,_n11=0,_h8=!0;_n11<t.length&&_r9<=s;_n11++){var _l7=t[_n11],_o4=_r9+_l7.length;_o4>=i&&(_o4>s&&(_l7=_l7.slice(0,s-_r9)),_r9<i&&(_l7=_l7.slice(i-_r9)),_h8?(e[e.length-1]+=_l7,_h8=!1):e.push(_l7)),_r9=_o4+1;}return e;}function r(t,e,i){return s(t,[""],e,i);}function u(t,e,i){return[e=Math.max(0,Math.min(t.length,e)),Math.max(e,Math.min(t.length,i))];}function a(t){for(var _e13=1;_e13<f.length;_e13+=2)if(f[_e13]>t)return f[_e13-1]<=t;return!1;}function c(t){return t>=127462&&t<=127487;}function p(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;return(i?m:g)(t,e,s);}function m(t,e,i){if(e==t.length)return e;e&&w(t.charCodeAt(e))&&b(t.charCodeAt(e-1))&&e--;var s=v(t,e);for(e+=y(s);e<t.length;){var _r11=v(t,e);if(s==d||_r11==d||i&&a(_r11))e+=y(_r11),s=_r11;else{if(!c(_r11))break;{var _i9=0,_s4=e-2;for(;_s4>=0&&c(v(t,_s4));)_i9++,_s4-=2;if(_i9%2==0)break;e+=2;}}}return e;}function g(t,e,i){for(;e>0;){var _s5=m(t,e-2,i);if(_s5<e)return _s5;e--;}return 0;}function w(t){return t>=56320&&t<57344;}function b(t){return t>=55296&&t<56320;}function v(t,e){var i=t.charCodeAt(e);if(!b(i)||e+1==t.length)return i;var s=t.charCodeAt(e+1);return w(s)?s-56320+(i-55296<<10)+65536:i;}function k(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)));}function y(t){return t<65536?1:2;}function C(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1;if(0==e&&i<=0)return;var r=t.length-2;r>=0&&i<=0&&i==t[r+1]?t[r]+=e:0==e&&0==t[r]?t[r+1]+=i:s?(t[r]+=e,t[r+1]+=i):t.push(e,i);}function D(e,i,s){if(0==s.length)return;var r=i.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(s);else{for(;e.length<r;)e.push(t.empty);e.push(s);}}function O(e,i,s){var r=e.inserted;for(var _n20=0,_h13=0,_l13=0;_l13<e.sections.length;){var _o8=e.sections[_l13++],_u15=e.sections[_l13++];if(_u15<0)_n20+=_o8,_h13+=_o8;else{var _f3=_n20,_a3=_h13,_c3=t.empty;for(;_f3+=_o8,_a3+=_u15,_u15&&r&&(_c3=_c3.append(r[_l13-2>>1])),!(s||_l13==e.sections.length||e.sections[_l13+1]<0);)_o8=e.sections[_l13++],_u15=e.sections[_l13++];i(_n20,_f3,_h13,_a3,_c3),_n20=_f3,_h13=_a3;}}}function E(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1;var r=[],n=s?[]:null,h=new R(t),l=new R(e);for(var _t22=-1;;)if(-1==h.ins&&-1==l.ins){var _t23=Math.min(h.len,l.len);C(r,_t23,-1),h.forward(_t23),l.forward(_t23);}else if(l.ins>=0&&(h.ins<0||_t22==h.i||0==h.off&&(l.len<h.len||l.len==h.len&&!i))){var _e21=l.len;for(C(r,l.ins,-1);_e21;){var _i16=Math.min(h.len,_e21);h.ins>=0&&_t22<h.i&&h.len<=_i16&&(C(r,0,h.ins),n&&D(n,r,h.text),_t22=h.i),h.forward(_i16),_e21-=_i16;}l.next();}else{if(!(h.ins>=0)){if(h.done&&l.done)return n?A.createSet(r,n):S.create(r);throw new Error("Mismatched change set lengths");}{var _e22=0,_i17=h.len;for(;_i17;)if(-1==l.ins){var _t24=Math.min(_i17,l.len);_e22+=_t24,_i17-=_t24,l.forward(_t24);}else{if(!(0==l.ins&&l.len<_i17))break;_i17-=l.len,l.next();}C(r,_e22,_t22<h.i?h.ins:0),n&&_t22<h.i&&D(n,r,h.text),_t22=h.i,h.forward(h.len-_i17);}}}function I(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=[],r=i?[]:null,n=new R(t),h=new R(e);for(var _t25=!1;;){if(n.done&&h.done)return r?A.createSet(s,r):S.create(s);if(0==n.ins)C(s,n.len,0,_t25),n.next();else if(0!=h.len||h.done){if(n.done||h.done)throw new Error("Mismatched change set lengths");{var _e23=Math.min(n.len2,h.len),_i18=s.length;if(-1==n.ins){var _i19=-1==h.ins?-1:h.off?0:h.ins;C(s,_e23,_i19,_t25),r&&_i19&&D(r,s,h.text);}else-1==h.ins?(C(s,n.off?0:n.len,_e23,_t25),r&&D(r,s,n.textBit(_e23))):(C(s,n.off?0:n.len,h.off?0:h.ins,_t25),r&&!h.off&&D(r,s,h.text));_t25=(n.ins>_e23||h.ins>=0&&h.len>_e23)&&(_t25||s.length>_i18),n.forward2(_e23),h.forward(_e23);}}else C(s,0,h.ins,_t25),r&&D(r,s,h.text),h.next();}}function L(t,e){var _iterator11=_createForOfIteratorHelper(t.ranges),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var _i23=_step11.value;if(_i23.to>e)throw new RangeError("Selection points outside of document");}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}}function j(t,e){return t==e||t.length==e.length&&t.every(function(t,i){return t===e[i];});}function P(t,e,i){if(t.length!=e.length)return!1;for(var _s13=0;_s13<t.length;_s13++)if(!i(t[_s13],e[_s13]))return!1;return!0;}function H(t,e){var i=!1;var _iterator13=_createForOfIteratorHelper(e),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var _s14=_step13.value;1&tt(t,_s14)&&(i=!0);}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}return i;}function W(t,e,i){var s=i.map(function(e){return t[e.id];}),r=i.map(function(t){return t.type;}),n=s.filter(function(t){return!(1&t);}),h=t[e.id]>>1;function l(t){var i=[];for(var _e25=0;_e25<s.length;_e25++){var _n22=et(t,s[_e25]);if(2==r[_e25]){var _iterator14=_createForOfIteratorHelper(_n22),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var _t26=_step14.value;i.push(_t26);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}else i.push(_n22);}return e.combine(i);}return{create:function create(t){var _iterator15=_createForOfIteratorHelper(s),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var _e26=_step15.value;tt(t,_e26);}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}return t.values[h]=l(t),1;},update:function update(t,i){if(!H(t,n))return 0;var s=l(t);return e.compare(s,t.values[h])?0:(t.values[h]=s,1);},reconfigure:function reconfigure(t,r){var n=H(t,s),o=r.config.facets[e.id],u=r.facet(e);if(o&&!n&&j(i,o))return t.values[h]=u,0;var f=l(t);return e.compare(f,u)?(t.values[h]=u,0):(t.values[h]=f,1);}};}function K(t){return function(e){return new X(e,t);};}function tt(t,e){if(1&e)return 2;var i=e>>1,s=t.status[i];if(4==s)throw new Error("Cyclic dependency between fields and/or facets");if(2&s)return s;t.status[i]=4;var r=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|r;}function et(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1];}function pt(t,e){var i=[];for(var _s18=0,_r19=0;;){var _n23=void 0,_h15=void 0;if(_s18<t.length&&(_r19==e.length||e[_r19]>=t[_s18]))_n23=t[_s18++],_h15=t[_s18++];else{if(!(_r19<e.length))return i;_n23=e[_r19++],_h15=e[_r19++];}!i.length||i[i.length-1]<_n23?i.push(_n23,_h15):i[i.length-1]<_h15&&(i[i.length-1]=_h15);}}function mt(t,e,i){var s;var r,n,h;return i?(r=e.changes,n=A.empty(e.changes.length),h=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),n=t.changes.mapDesc(e.changes,!0),h=t.changes.compose(r)),{changes:h,selection:e.selection?e.selection.map(n):null===(s=t.selection)||void 0===s?void 0:s.map(r),effects:ct.mapEffects(t.effects,r).concat(ct.mapEffects(e.effects,n)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView};}function gt(t,e,i){var s=e.selection,r=vt(e.annotations);return e.userEvent&&(r=r.concat(dt.userEvent.of(e.userEvent))),{changes:e.changes instanceof A?e.changes:A.of(e.changes||[],i,t.facet(rt)),selection:s&&(s instanceof B?s:B.single(s.anchor,s.head)),effects:vt(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView};}function wt(t,e,i){var s=gt(t,e.length?e[0]:{},t.doc.length);e.length&&!1===e[0].filter&&(i=!1);for(var _r20=1;_r20<e.length;_r20++){!1===e[_r20].filter&&(i=!1);var _n24=!!e[_r20].sequential;s=mt(s,gt(t,e[_r20],_n24?s.changes.newLength:t.doc.length),_n24);}var r=dt.create(t,s.changes,s.selection,s.effects,s.annotations,s.scrollIntoView);return function(t){var e=t.startState,i=e.facet(lt),s=t;for(var _r21=i.length-1;_r21>=0;_r21--){var _n25=i[_r21](t);_n25&&Object.keys(_n25).length&&(s=mt(s,gt(e,_n25,t.changes.newLength),!0));}return s==t?t:dt.create(e,t.changes,t.selection,s.effects,s.annotations,s.scrollIntoView);}(i?function(t){var e=t.startState,i=!0;var _iterator21=_createForOfIteratorHelper(e.facet(nt)),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var _s20=_step21.value;var _e32=_s20(t);if(!1===_e32){i=!1;break;}Array.isArray(_e32)&&(i=!0===i?_e32:pt(i,_e32));}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}if(!0!==i){var _s19,_r22;if(!1===i)_r22=t.changes.invertedDesc,_s19=A.empty(e.doc.length);else{var _e31=t.changes.filter(i);_s19=_e31.changes,_r22=_e31.filtered.mapDesc(_e31.changes).invertedDesc;}t=dt.create(e,_s19,t.selection&&t.selection.map(_r22),ct.mapEffects(t.effects,_r22),t.annotations,t.scrollIntoView);}var s=e.facet(ht);for(var _i27=s.length-1;_i27>=0;_i27--){var _r23=s[_i27](t);t=_r23 instanceof dt?_r23:Array.isArray(_r23)&&1==_r23.length&&_r23[0]instanceof dt?_r23[0]:wt(e,vt(_r23),!1);}return t;}(r):r);}function vt(t){return null==t?bt:Array.isArray(t)?t:[t];}function xt(t){return function(e){if(!/\S/.test(e))return kt.Space;if(function(t){if(Mt)return Mt.test(t);for(var _e33=0;_e33<t.length;_e33++){var _i28=t[_e33];if(/\w/.test(_i28)||_i28>"€"&&(_i28.toUpperCase()!=_i28.toLowerCase()||yt.test(_i28)))return!0;}return!1;}(e))return kt.Word;for(var _i29=0;_i29<t.length;_i29++)if(e.indexOf(t[_i29])>-1)return kt.Word;return kt.Other;};}function At(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var s={};var _iterator26=_createForOfIteratorHelper(t),_step26;try{for(_iterator26.s();!(_step26=_iterator26.n()).done;){var _e37=_step26.value;for(var _i33=0,_Object$keys=Object.keys(_e37);_i33<_Object$keys.length;_i33++){var _t35=_Object$keys[_i33];var _r26=_e37[_t35],_n28=s[_t35];if(void 0===_n28)s[_t35]=_r26;else if(_n28===_r26||void 0===_r26);else{if(!Object.hasOwnProperty.call(i,_t35))throw new Error("Config merge conflict for field "+_t35);s[_t35]=i[_t35](_n28,_r26);}}}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}for(var _t34 in e)void 0===s[_t34]&&(s[_t34]=e[_t34]);return s;}function Ot(t,e){return t.from-e.from||t.value.startSide-e.value.startSide;}function Tt(t,e,i){var s=new Map();var _iterator29=_createForOfIteratorHelper(t),_step29;try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var _e40=_step29.value;for(var _t40=0;_t40<_e40.chunk.length;_t40++)_e40.chunk[_t40].maxPoint<=0&&s.set(_e40.chunk[_t40],_e40.chunkPos[_t40]);}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}var r=new Set();var _iterator30=_createForOfIteratorHelper(e),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var _t41=_step30.value;for(var _e41=0;_e41<_t41.chunk.length;_e41++){var _n33=s.get(_t41.chunk[_e41]);null==_n33||(i?i.mapPos(_n33):_n33)!=_t41.chunkPos[_e41]||(null==i?void 0:i.touchesRange(_n33,_n33+_t41.chunk[_e41].length))||r.add(_t41.chunk[_e41]);}}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}return r;}function Nt(t,e){for(var _i40=t[e];;){var _s28=1+(e<<1);if(_s28>=t.length)break;var _r33=t[_s28];if(_s28+1<t.length&&_r33.compare(t[_s28+1])>=0&&(_r33=t[_s28+1],_s28++),_i40.compare(_r33)<0)break;t[_s28]=_i40,t[e]=_r33,e=_s28;}}function jt(t,e,i,s,r,n){t["goto"](e),i["goto"](s);var h=s+r,l=s,o=s-e;for(;;){var _e45=t.to+o-i.to||t.endSide-i.endSide,_s30=_e45<0?t.to+o:i.to,_r34=Math.min(_s30,h);if(t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&zt(t.activeForPoint(t.to),i.activeForPoint(i.to))||n.comparePoint(l,_r34,t.point,i.point):_r34>l&&!zt(t.active,i.active)&&n.compareRange(l,_r34,t.active,i.active),_s30>h)break;l=_s30,_e45<=0&&t.next(),_e45>=0&&i.next();}}function zt(t,e){if(t.length!=e.length)return!1;for(var _i43=0;_i43<t.length;_i43++)if(t[_i43]!=e[_i43]&&!t[_i43].eq(e[_i43]))return!1;return!0;}function Pt(t,e){for(var _i44=e,_s31=t.length-1;_i44<_s31;_i44++)t[_i44]=t[_i44+1];t.pop();}function Ht(t,e,i){for(var _i45=t.length-1;_i45>=e;_i45--)t[_i45+1]=t[_i45];t[e]=i;}function Wt(t,e){var i=-1,s=1e9;for(var _r35=0;_r35<e.length;_r35++)(e[_r35]-s||t[_r35].endSide-t[i].endSide)<0&&(i=_r35,s=e[_r35]);return i;}function Vt(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:t.length;var s=0;for(var _r36=0;_r36<i;)9==t.charCodeAt(_r36)?(s+=e-s%e,_r36++):(s++,_r36=p(t,_r36));return s;}function Ft(t,e,i,s){for(var _s32=0,_r37=0;;){if(_r37>=e)return _s32;if(_s32==t.length)break;_r37+=9==t.charCodeAt(_s32)?i-_r37%i:1,_s32=p(t,_s32);}return!0===s?-1:t.length;}function ie(t){var e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection();}function se(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e));}function re(t,e){if(!e.anchorNode)return!1;try{return se(t,e.anchorNode);}catch(t){return!1;}}function ne(t){return 3==t.nodeType?be(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[];}function he(t,e,i,s){return!!i&&(ue(t,e,i,s,-1)||ue(t,e,i,s,1));}function le(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e;}function oe(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName);}function ue(t,e,i,s,r){for(;;){if(t==i&&e==s)return!0;if(e==(r<0?0:fe(t))){if("DIV"==t.nodeName)return!1;var _i48=t.parentNode;if(!_i48||1!=_i48.nodeType)return!1;e=le(t)+(r<0?0:1),t=_i48;}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=r<0?fe(t):0;}}}function fe(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length;}function ae(t,e){var i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom};}function ce(t){var e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight};}function de(t,e){var i=e.width/t.offsetWidth,s=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(s>.995&&s<1.005||!isFinite(s)||Math.abs(e.height-t.offsetHeight)<1)&&(s=1),{scaleX:i,scaleY:s};}function we(t){if(t.setActive)return t.setActive();if(ge)return t.focus(ge);var e=[];for(var _i49=t;_i49&&(e.push(_i49,_i49.scrollTop,_i49.scrollLeft),_i49!=_i49.ownerDocument);_i49=_i49.parentNode);if(t.focus(null==ge?{get preventScroll(){return ge={preventScroll:!0},!0;}}:void 0),!ge){ge=!1;for(var _t49=0;_t49<e.length;){var _i50=e[_t49++],_s33=e[_t49++],_r38=e[_t49++];_i50.scrollTop!=_s33&&(_i50.scrollTop=_s33),_i50.scrollLeft!=_r38&&(_i50.scrollLeft=_r38);}}}function be(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:e;var s=me||(me=document.createRange());return s.setEnd(t,i),s.setStart(t,e),s;}function ve(t,e,i,s){var _s34;var r={key:e,code:e,keyCode:i,which:i,cancelable:!0};s&&(_s34=s,r.altKey=_s34.altKey,r.ctrlKey=_s34.ctrlKey,r.shiftKey=_s34.shiftKey,r.metaKey=_s34.metaKey,_s34);var n=new KeyboardEvent("keydown",r);n.synthetic=!0,t.dispatchEvent(n);var h=new KeyboardEvent("keyup",r);return h.synthetic=!0,t.dispatchEvent(h),n.defaultPrevented||h.defaultPrevented;}function ke(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0]);}function ye(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4);}function Me(t,e){for(var _i51=t,_s35=e;;){if(3==_i51.nodeType&&_s35>0)return{node:_i51,offset:_s35};if(1==_i51.nodeType&&_s35>0){if("false"==_i51.contentEditable)return null;_i51=_i51.childNodes[_s35-1],_s35=fe(_i51);}else{if(!_i51.parentNode||oe(_i51))return null;_s35=le(_i51),_i51=_i51.parentNode;}}}function xe(t,e){for(var _i52=t,_s36=e;;){if(3==_i52.nodeType&&_s36<_i52.nodeValue.length)return{node:_i52,offset:_s36};if(1==_i52.nodeType&&_s36<_i52.childNodes.length){if("false"==_i52.contentEditable)return null;_i52=_i52.childNodes[_s36],_s36=0;}else{if(!_i52.parentNode||oe(_i52))return null;_s36=le(_i52)+1,_i52=_i52.parentNode;}}}function De(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e;}function Ee(t,e,i,s,r,n,h,l,o){var u=t.children,f=u.length?u[e]:null,a=n.length?n[n.length-1]:null,c=a?a.breakAfter:h;if(!(e==s&&f&&!h&&!c&&n.length<2&&f.merge(i,r,n.length?a:null,0==i,l,o))){if(s<u.length){var _t56=u[s];_t56&&(r<_t56.length||_t56.breakAfter&&(null==a?void 0:a.breakAfter))?(e==s&&(_t56=_t56.split(r),r=0),!c&&a&&_t56.merge(0,r,a,!0,0,o)?n[n.length-1]=_t56:((r||_t56.children.length&&!_t56.children[0].length)&&_t56.merge(0,r,null,!1,0,o),n.push(_t56))):(null==_t56?void 0:_t56.breakAfter)&&(a?a.breakAfter=1:h=1),s++;}for(f&&(f.breakAfter=h,i>0&&(!h&&n.length&&f.merge(i,f.length,n[0],!1,l,0)?f.breakAfter=n.shift().breakAfter:(i<f.length||f.children.length&&0==f.children[f.children.length-1].length)&&f.merge(i,f.length,null,!1,l,0),e++));e<s&&n.length;)if(u[s-1].become(n[n.length-1]))s--,n.pop(),o=n.length?0:l;else{if(!u[e].become(n[0]))break;e++,n.shift(),l=n.length?0:o;}!n.length&&e&&s<u.length&&!u[e-1].breakAfter&&u[s].merge(0,0,u[e-1],!1,l,o)&&e--,(e<s||n.length)&&t.replaceChildren(e,s,n);}}function Ie(t,e,i,s,r,n){var h=t.childCursor(),_h$findPos=h.findPos(i,1),l=_h$findPos.i,o=_h$findPos.off,_h$findPos2=h.findPos(e,-1),u=_h$findPos2.i,f=_h$findPos2.off,a=e-i;var _iterator37=_createForOfIteratorHelper(s),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var _t57=_step37.value;a+=_t57.length;}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}t.length+=a,Ee(t,u,f,l,o,s,0,r,n);}function Ge(t,e){var i=t.dom,s=t.children,r=0;for(var _t60=0;r<s.length;r++){var _n38=s[r],_h22=_t60+_n38.length;if(!(_h22==_t60&&_n38.getSide()<=0)){if(e>_t60&&e<_h22&&_n38.dom.parentNode==i)return _n38.domAtPos(e-_t60);if(e<=_t60)break;_t60=_h22;}}for(var _t61=r;_t61>0;_t61--){var _e57=s[_t61-1];if(_e57.dom.parentNode==i)return _e57.domAtPos(_e57.length);}for(var _t62=r;_t62<s.length;_t62++){var _e58=s[_t62];if(_e58.dom.parentNode==i)return _e58.domAtPos(0);}return new Se(i,0);}function Ke(t,e,i){var s,r=t.children;i>0&&e instanceof qe&&r.length&&(s=r[r.length-1])instanceof qe&&s.mark.eq(e.mark)?Ke(s,e.children[0],i-1):(r.push(e),e.setParent(t)),t.length+=e.length;}function _e(t,e,i){var s=null,r=-1,n=null,h=-1;!function t(e,l){for(var _o12=0,_u19=0;_o12<e.children.length&&_u19<=l;_o12++){var _f6=e.children[_o12],_a5=_u19+_f6.length;_a5>=l&&(_f6.children.length?t(_f6,l-_u19):(!n||n.isHidden&&i>0)&&(_a5>l||_u19==_a5&&_f6.getSide()>0)?(n=_f6,h=l-_u19):(_u19<l||_u19==_a5&&_f6.getSide()<0&&!_f6.isHidden)&&(s=_f6,r=l-_u19)),_u19=_a5;}}(t,e);var l=(i<0?s:n)||s||n;return l?l.coordsAt(Math.max(0,l==s?r:h),i):function(t){var e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();var i=ne(e);return i[i.length-1]||null;}(t);}function Xe(t,e){for(var _i58 in t)"class"==_i58&&e["class"]?e["class"]+=" "+t["class"]:"style"==_i58&&e.style?e.style+=";"+t.style:e[_i58]=t[_i58];return e;}function Qe(t,e,i){if(t==e)return!0;t||(t=Ye),e||(e=Ye);var s=Object.keys(t),r=Object.keys(e);if(s.length-(i&&s.indexOf(i)>-1?1:0)!=r.length-(i&&r.indexOf(i)>-1?1:0))return!1;for(var _i59=0,_s41=s;_i59<_s41.length;_i59++){var _n39=_s41[_i59];if(_n39!=i&&(-1==r.indexOf(_n39)||t[_n39]!==e[_n39]))return!1;}return!0;}function Ze(t,e,i){var s=!1;if(e)for(var _r40 in e)i&&_r40 in i||(s=!0,"style"==_r40?t.style.cssText="":t.removeAttribute(_r40));if(i)for(var _r41 in i)e&&e[_r41]==i[_r41]||(s=!0,"style"==_r41?t.style.cssText=i[_r41]:t.setAttribute(_r41,i[_r41]));return s;}function ti(t){var e=Object.create(null);for(var _i60=0;_i60<t.attributes.length;_i60++){var _s42=t.attributes[_i60];e[_s42.name]=_s42.value;}return e;}function ui(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;var i=t.inclusiveStart,s=t.inclusiveEnd;return null==i&&(i=t.inclusive),null==s&&(s=t.inclusive),{start:null!=i?i:e,end:null!=s?s:e};}function fi(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=i.length-1;r>=0&&i[r]+s>=t?i[r]=Math.max(i[r],e):i.push(t,e);}function ci(t,e){var _iterator41=_createForOfIteratorHelper(e),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var _i64=_step41.value;t=new qe(_i64,[t],t.length);}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}return t;}function wi(t){var e=[];for(var _i65=0;_i65<t.length;_i65++)e.push(1<<+t[_i65]);return e;}function Mi(t){return t<=247?bi[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?vi[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1;}function Ai(t,e){if(t.length!=e.length)return!1;for(var _i68=0;_i68<t.length;_i68++){var _s48=t[_i68],_r44=e[_i68];if(_s48.from!=_r44.from||_s48.to!=_r44.to||_s48.direction!=_r44.direction||!Ai(_s48.inner,_r44.inner))return!1;}return!0;}function Di(t,e,i,s,r,n,h){var l=s%2?2:1;if(s%2==r%2)for(var _o14=e,_u21=0;_o14<i;){var _e62=!0,_f7=!1;if(_u21==n.length||_o14<n[_u21].from){var _t67=Ci[_o14];_t67!=l&&(_e62=!1,_f7=16==_t67);}var _a6=_e62||1!=l?null:[],_c5=_e62?s:s+1,_d=_o14;t:for(;;)if(_u21<n.length&&_d==n[_u21].from){if(_f7)break t;var _p=n[_u21];if(!_e62)for(var _t68=_p.to,_e63=_u21+1;;){if(_t68==i)break t;if(!(_e63<n.length&&n[_e63].from==_t68)){if(Ci[_t68]==l)break t;break;}_t68=n[_e63++].to;}if(_u21++,_a6)_a6.push(_p);else{_p.from>_o14&&h.push(new Si(_o14,_p.from,_c5)),Oi(t,_p.direction==mi!=!(_c5%2)?s+1:s,r,_p.inner,_p.from,_p.to,h),_o14=_p.to;}_d=_p.to;}else{if(_d==i||(_e62?Ci[_d]!=l:Ci[_d]==l))break;_d++;}_a6?Di(t,_o14,_d,s+1,r,_a6,h):_o14<_d&&h.push(new Si(_o14,_d,_c5)),_o14=_d;}else for(var _o15=i,_u22=n.length;_o15>e;){var _i69=!0,_f8=!1;if(!_u22||_o15>n[_u22-1].to){var _t69=Ci[_o15-1];_t69!=l&&(_i69=!1,_f8=16==_t69);}var _a7=_i69||1!=l?null:[],_c6=_i69?s:s+1,_d2=_o15;t:for(;;)if(_u22&&_d2==n[_u22-1].to){if(_f8)break t;var _p2=n[--_u22];if(!_i69)for(var _t70=_p2.from,_i70=_u22;;){if(_t70==e)break t;if(!_i70||n[_i70-1].to!=_t70){if(Ci[_t70-1]==l)break t;break;}_t70=n[--_i70].from;}if(_a7)_a7.push(_p2);else{_p2.to<_o15&&h.push(new Si(_p2.to,_o15,_c6)),Oi(t,_p2.direction==mi!=!(_c6%2)?s+1:s,r,_p2.inner,_p2.from,_p2.to,h),_o15=_p2.from;}_d2=_p2.from;}else{if(_d2==e||(_i69?Ci[_d2-1]!=l:Ci[_d2-1]==l))break;_d2--;}_a7?Di(t,_d2,_o15,s+1,r,_a7,h):_d2<_o15&&h.push(new Si(_d2,_o15,_c6)),_o15=_d2;}}function Oi(t,e,i,s,r,n,h){var l=e%2?2:1;!function(t,e,i,s,r){for(var _n44=0;_n44<=s.length;_n44++){var _h24=_n44?s[_n44-1].to:e,_l21=_n44<s.length?s[_n44].from:i,_o16=_n44?256:r;for(var _e64=_h24,_i71=_o16,_s49=_o16;_e64<_l21;_e64++){var _r45=Mi(t.charCodeAt(_e64));512==_r45?_r45=_i71:8==_r45&&4==_s49&&(_r45=16),Ci[_e64]=4==_r45?2:_r45,7&_r45&&(_s49=_r45),_i71=_r45;}for(var _t71=_h24,_e65=_o16,_s50=_o16;_t71<_l21;_t71++){var _r46=Ci[_t71];if(128==_r46)_t71<_l21-1&&_e65==Ci[_t71+1]&&24&_e65?_r46=Ci[_t71]=_e65:Ci[_t71]=256;else if(64==_r46){var _r47=_t71+1;for(;_r47<_l21&&64==Ci[_r47];)_r47++;var _n45=_t71&&8==_e65||_r47<i&&8==Ci[_r47]?1==_s50?1:8:256;for(var _e66=_t71;_e66<_r47;_e66++)Ci[_e66]=_n45;_t71=_r47-1;}else 8==_r46&&1==_s50&&(Ci[_t71]=1);_e65=_r46,7&_r46&&(_s50=_r46);}}}(t,r,n,s,l),function(t,e,i,s,r){var n=1==r?2:1;for(var _h25=0,_l22=0,_o17=0;_h25<=s.length;_h25++){var _u23=_h25?s[_h25-1].to:e,_f9=_h25<s.length?s[_h25].from:i;for(var _e67,_i72,_s51,_h26=_u23;_h26<_f9;_h26++)if(_i72=ki[_e67=t.charCodeAt(_h26)]){if(_i72<0){for(var _t72=_l22-3;_t72>=0;_t72-=3)if(yi[_t72+1]==-_i72){var _e68=yi[_t72+2],_i73=2&_e68?r:4&_e68?1&_e68?n:r:0;_i73&&(Ci[_h26]=Ci[yi[_t72]]=_i73),_l22=_t72;break;}}else{if(189==yi.length)break;yi[_l22++]=_h26,yi[_l22++]=_e67,yi[_l22++]=_o17;}}else if(2==(_s51=Ci[_h26])||1==_s51){var _t73=_s51==r;_o17=_t73?0:1;for(var _e69=_l22-3;_e69>=0;_e69-=3){var _i74=yi[_e69+2];if(2&_i74)break;if(_t73)yi[_e69+2]|=2;else{if(4&_i74)break;yi[_e69+2]|=4;}}}}}(t,r,n,s,l),function(t,e,i,s){for(var _r48=0,_n46=s;_r48<=i.length;_r48++){var _h27=_r48?i[_r48-1].to:t,_l23=_r48<i.length?i[_r48].from:e;for(var _o18=_h27;_o18<_l23;){var _h28=Ci[_o18];if(256==_h28){var _h29=_o18+1;for(;;)if(_h29==_l23){if(_r48==i.length)break;_h29=i[_r48++].to,_l23=_r48<i.length?i[_r48].from:e;}else{if(256!=Ci[_h29])break;_h29++;}var _u24=1==_n46,_f10=_u24==(1==(_h29<e?Ci[_h29]:s))?_u24?1:2:s;for(var _e70=_h29,_s52=_r48,_n47=_s52?i[_s52-1].to:t;_e70>_o18;)_e70==_n47&&(_e70=i[--_s52].from,_n47=_s52?i[_s52-1].to:t),Ci[--_e70]=_f10;_o18=_h29;}else _n46=_h28,_o18++;}}}(r,n,s,l),Di(t,r,n,e,i,s,h);}function Ei(t){return[new Si(0,t,0)];}function Ri(t,e,i,s,r){var n;var h=s.head-t.from,l=Si.find(e,h,null!==(n=s.bidiLevel)&&void 0!==n?n:-1,s.assoc),o=e[l],u=o.side(r,i);if(h==u){var _t74=l+=r?1:-1;if(_t74<0||_t74>=e.length)return null;o=e[l=_t74],h=o.side(!r,i),u=o.side(r,i);}var f=p(t.text,h,o.forward(r,i));(f<o.from||f>o.to)&&(f=u),Ii=t.text.slice(Math.min(h,f),Math.max(h,f));var a=l==(r?e.length-1:0)?null:e[l+(r?1:-1)];return a&&f==u&&a.level+(r?0:1)<o.level?B.cursor(a.side(!r,i)+t.from,a.forward(r,i)?1:-1,a.level):B.cursor(f+t.from,o.forward(r,i)?-1:1,o.level);}function Ti(t,e,i){for(var _s53=e;_s53<i;_s53++){var _e71=Mi(t.charCodeAt(_s53));if(1==_e71)return mi;if(2==_e71||4==_e71)return gi;}return mi;}function Ui(t,e,i){var s=t.facet($i);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);}function ss(t,e){var i=t.state.facet(is);if(!i.length)return i;var s=i.map(function(e){return e instanceof Function?e(t):e;}),r=[];return It.spans(s,e.from,e.to,{point:function point(){},span:function span(t,i,s,n){var h=t-e.from,l=i-e.from,o=r;for(var _t76=s.length-1;_t76>=0;_t76--,n--){var _i75=void 0,_r49=s[_t76].spec.bidiIsolate;if(null==_r49&&(_r49=Ti(e.text,h,l)),n>0&&o.length&&(_i75=o[o.length-1]).to==h&&_i75.direction==_r49)_i75.to=l,o=_i75.inner;else{var _t77={from:h,to:l,direction:_r49,inner:[]};o.push(_t77),o=_t77.inner;}}}}),r;}function ns(t){var e=0,i=0,s=0,r=0;var _iterator42=_createForOfIteratorHelper(t.state.facet(rs)),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var _n48=_step42.value;var _h30=_n48(t);_h30&&(null!=_h30.left&&(e=Math.max(e,_h30.left)),null!=_h30.right&&(i=Math.max(i,_h30.right)),null!=_h30.top&&(s=Math.max(s,_h30.top)),null!=_h30.bottom&&(r=Math.max(r,_h30.bottom)));}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}return{left:e,right:i,top:s,bottom:r};}function as(t,e){var i=t.observer.selectionRange;if(!i.focusNode)return null;var s=Me(i.focusNode,i.focusOffset),r=xe(i.focusNode,i.focusOffset),n=s||r;if(r&&s&&r.node!=s.node){var _e89=Ce.get(r.node);if(!_e89||_e89 instanceof Fe&&_e89.text!=r.node.nodeValue)n=r;else if(t.docView.lastCompositionAfterCursor){var _t96=Ce.get(s.node);!_t96||_t96 instanceof Fe&&_t96.text!=s.node.nodeValue||(n=r);}}if(t.docView.lastCompositionAfterCursor=n!=s,!n)return null;var h=e-n.offset;return{from:h,to:h+n.node.nodeValue.length,node:n.node};}function ds(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right);}function ps(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom);}function ms(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1;}function gs(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t;}function ws(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t;}function bs(t,e,i){var s,r,n,h,l,o,u,f,a=!1;for(var _c9=t.firstChild;_c9;_c9=_c9.nextSibling){var _t97=ne(_c9);for(var _d5=0;_d5<_t97.length;_d5++){var _p5=_t97[_d5];r&&ms(r,_p5)&&(_p5=gs(ws(_p5,r.bottom),r.top));var _m3=ds(e,_p5),_g3=ps(i,_p5);if(0==_m3&&0==_g3)return 3==_c9.nodeType?vs(_c9,e,i):bs(_c9,e,i);if(!s||h>_g3||h==_g3&&n>_m3){s=_c9,r=_p5,n=_m3,h=_g3;var _l28=_g3?i<_p5.top?-1:1:_m3?e<_p5.left?-1:1:0;a=!_l28||(_l28>0?_d5<_t97.length-1:_d5>0);}0==_m3?i>_p5.bottom&&(!u||u.bottom<_p5.bottom)?(l=_c9,u=_p5):i<_p5.top&&(!f||f.top>_p5.top)&&(o=_c9,f=_p5):u&&ms(u,_p5)?u=ws(u,_p5.bottom):f&&ms(f,_p5)&&(f=gs(f,_p5.top));}}if(u&&u.bottom>=i?(s=l,r=u):f&&f.top<=i&&(s=o,r=f),!s)return{node:t,offset:0};var c=Math.max(r.left,Math.min(r.right,e));return 3==s.nodeType?vs(s,c,i):a&&"false"!=s.contentEditable?bs(s,c,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,s)+(e>=(r.left+r.right)/2?1:0)};}function vs(t,e,i){var s=t.nodeValue.length,r=-1,n=1e9,h=0;for(var _l29=0;_l29<s;_l29++){var _s65=be(t,_l29,_l29+1).getClientRects();for(var _o23=0;_o23<_s65.length;_o23++){var _u28=_s65[_o23];if(_u28.top==_u28.bottom)continue;h||(h=e-_u28.left);var _f14=(_u28.top>i?_u28.top-i:i-_u28.bottom)-1;if(_u28.left-1<=e&&_u28.right+1>=e&&_f14<n){var _i82=e>=(_u28.left+_u28.right)/2,_s66=_i82;if(Ve.chrome||Ve.gecko){be(t,_l29).getBoundingClientRect().left==_u28.right&&(_s66=!_i82);}if(_f14<=0)return{node:t,offset:_l29+(_s66?1:0)};r=_l29+(_s66?1:0),n=_f14;}}}return{node:t,offset:r>-1?r:h>0?t.nodeValue.length:0};}function ks(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:-1;var r,n;var h,l=t.contentDOM.getBoundingClientRect(),o=l.top+t.viewState.paddingTop,u=t.viewState.docHeight,f=e.x,a=e.y,c=a-o;if(c<0)return 0;if(c>u)return t.state.doc.length;for(var _e90=t.viewState.heightOracle.textHeight/2,_r54=!1;h=t.elementAtHeight(c),h.type!=ri.Text;)for(;c=s>0?h.bottom+_e90:h.top-_e90,!(c>=0&&c<=u);){if(_r54)return i?null:0;_r54=!0,s=-s;}a=o+c;var d=h.from;if(d<t.viewport.from)return 0==t.viewport.from?0:i?null:ys(t,l,h,f,a);if(d>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:ys(t,l,h,f,a);var p=t.dom.ownerDocument,m=t.root.elementFromPoint?t.root:p,g=m.elementFromPoint(f,a);g&&!t.contentDOM.contains(g)&&(g=null),g||(f=Math.max(l.left+1,Math.min(l.right-1,f)),g=m.elementFromPoint(f,a),g&&!t.contentDOM.contains(g)&&(g=null));var w,b=-1;if(g&&0!=(null===(r=t.docView.nearest(g))||void 0===r?void 0:r.isEditable))if(p.caretPositionFromPoint){var _t99;var _t98=p.caretPositionFromPoint(f,a);_t98&&(_t99=_t98,w=_t99.offsetNode,b=_t99.offset,_t99);}else if(p.caretRangeFromPoint){var _e91=p.caretRangeFromPoint(f,a);_e91&&((w=_e91.startContainer,b=_e91.startOffset),(!t.contentDOM.contains(w)||Ve.safari&&function(t,e,i){var s;if(3!=t.nodeType||e!=(s=t.nodeValue.length))return!1;for(var _e92=t.nextSibling;_e92;_e92=_e92.nextSibling)if(1!=_e92.nodeType||"BR"!=_e92.nodeName)return!1;return be(t,s-1,s).getBoundingClientRect().left>i;}(w,b,f)||Ve.chrome&&function(t,e,i){if(0!=e)return!1;for(var _e93=t;;){var _t100=_e93.parentNode;if(!_t100||1!=_t100.nodeType||_t100.firstChild!=_e93)return!1;if(_t100.classList.contains("cm-line"))break;_e93=_t100;}var s=1==t.nodeType?t.getBoundingClientRect():be(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-s.left>5;}(w,b,f))&&(w=void 0));}if(!w||!t.docView.dom.contains(w)){var _e94=ei.find(t.docView,d);if(!_e94)return c>h.top+h.height/2?h.to:h.from;var _bs=bs(_e94.dom,f,a);w=_bs.node;b=_bs.offset;}var v=t.docView.nearest(w);if(!v)return null;if(v.isWidget&&1==(null===(n=v.dom)||void 0===n?void 0:n.nodeType)){var _t101=v.dom.getBoundingClientRect();return e.y<_t101.top||e.y<=_t101.bottom&&e.x<=(_t101.left+_t101.right)/2?v.posAtStart:v.posAtEnd;}return v.localPosFromDOM(w,b)+v.posAtStart;}function ys(t,e,i,s,r){var n=Math.round((s-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>1.5*t.defaultLineHeight){var _e95=t.viewState.heightOracle.textHeight;n+=Math.floor((r-i.top-.5*(t.defaultLineHeight-_e95))/_e95)*t.viewState.heightOracle.lineLength;}var h=t.state.sliceDoc(i.from,i.to);return i.from+Ft(h,n,t.state.tabSize);}function Ms(t,e){var i=t.lineBlockAt(e);if(Array.isArray(i.type)){var _iterator48=_createForOfIteratorHelper(i.type),_step48;try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){var _t102=_step48.value;if(_t102.to>e||_t102.to==e&&(_t102.to==i.to||_t102.type==ri.Text))return _t102;}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}}return i;}function xs(t,e,i,s){var r=t.state.doc.lineAt(e.head),n=t.bidiSpans(r),h=t.textDirectionAt(r.from);for(var _l30=e,_o24=null;;){var _e96=Ri(r,n,h,_l30,i),_u29=Ii;if(!_e96){if(r.number==(i?t.state.doc.lines:1))return _l30;_u29="\n",r=t.state.doc.line(r.number+(i?1:-1)),n=t.bidiSpans(r),_e96=t.visualLineSide(r,!i);}if(_o24){if(!_o24(_u29))return _l30;}else{if(!s)return _e96;_o24=s(_u29);}_l30=_e96;}}function Ss(t,e,i){var _loop5=function _loop5(){var s=0;var _iterator49=_createForOfIteratorHelper(t),_step49;try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){var _r55=_step49.value;_r55.between(e-1,e+1,function(t,r,n){if(e>t&&e<r){var _n56=s||i||(e-t<r-e?-1:1);e=_n56<0?t:r,s=_n56;}});}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}if(!s)return{v:e};},_ret;for(;;){_ret=_loop5();if(_ret)return _ret.v;}}function As(t,e,i){var s=Ss(t.state.facet(es).map(function(e){return e(t);}),i.from,e.head>i.from?-1:1);return s==i.from?i:B.cursor(s,s<i.from?1:-1);}function Ds(t,e){return function(i,s){try{return e.call(t,s,i);}catch(t){Ui(i.state,t);}};}function Os(t){var e=Object.create(null);function i(t){return e[t]||(e[t]={observers:[],handlers:[]});}var _iterator52=_createForOfIteratorHelper(t),_step52;try{for(_iterator52.s();!(_step52=_iterator52.n()).done;){var _e97=_step52.value;var _t109=_e97.spec;if(_t109&&_t109.domEventHandlers)for(var _s68 in _t109.domEventHandlers){var _r57=_t109.domEventHandlers[_s68];_r57&&i(_s68).handlers.push(Ds(_e97.value,_r57));}if(_t109&&_t109.domEventObservers)for(var _s69 in _t109.domEventObservers){var _r58=_t109.domEventObservers[_s69];_r58&&i(_s69).observers.push(Ds(_e97.value,_r58));}}}catch(err){_iterator52.e(err);}finally{_iterator52.f();}for(var _t107 in Ls)i(_t107).handlers.push(Ls[_t107]);for(var _t108 in Ns)i(_t108).observers.push(Ns[_t108]);return e;}function Ts(t){return .7*Math.max(0,t)+8;}function js(t,e){var i,s=t.state,r=1,n=s.toText(e),h=n.lines==s.selection.ranges.length;if(null!=_s&&s.selection.ranges.every(function(t){return t.empty;})&&_s==n.toString()){var _t113=-1;i=s.changeByRange(function(i){var l=s.doc.lineAt(i.from);if(l.from==_t113)return{range:i};_t113=l.from;var o=s.toText((h?n.line(r++).text:e)+s.lineBreak);return{changes:{from:l.from,insert:o},range:B.cursor(i.from+o.length)};});}else i=h?s.changeByRange(function(t){var e=n.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:B.cursor(t.from+e.length)};}):s.replaceSelection(n);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0});}function zs(t,e,i,s){if(1==s)return B.cursor(e,i);if(2==s)return function(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;var s=t.charCategorizer(e),r=t.doc.lineAt(e),n=e-r.from;if(0==r.length)return B.cursor(e);0==n?i=1:n==r.length&&(i=-1);var h=n,l=n;i<0?h=p(r.text,n,!1):l=p(r.text,n);var o=s(r.text.slice(h,l));for(;h>0;){var _t114=p(r.text,h,!1);if(s(r.text.slice(_t114,h))!=o)break;h=_t114;}for(;l<r.length;){var _t115=p(r.text,l);if(s(r.text.slice(l,_t115))!=o)break;l=_t115;}return B.range(h+r.from,l+r.from);}(t.state,e,i);{var _i87=ei.find(t.docView,e),_s71=t.state.doc.lineAt(_i87?_i87.posAtEnd:e),_r60=_i87?_i87.posAtStart:_s71.from,_n58=_i87?_i87.posAtEnd:_s71.to;return _n58<t.state.doc.length&&_n58==_s71.to&&_n58++,B.range(_r60,_n58);}}function Ws(t,e,i,s){var r=ei.find(t.docView,e);if(!r)return 1;var n=e-r.posAtStart;if(0==n)return 1;if(n==r.length)return-1;var h=r.coordsAt(n,-1);if(h&&Hs(i,s,h))return-1;var l=r.coordsAt(n,1);return l&&Hs(i,s,l)?1:h&&Ps(s,h)?-1:1;}function Vs(t,e){var i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:Ws(t,i,e.clientX,e.clientY)};}function Gs(t){if(!Fs)return t.detail;var e=qs,i=Js;return qs=t,Js=Date.now(),Us=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Us+1)%3:1;}function Ks(t,e,i,s){if(!i)return;var r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.inputState.draggedContent,h=s&&n&&function(t,e){var i=t.state.facet(Li);return i.length?i[0](e):Ve.mac?!e.altKey:!e.ctrlKey;}(t,e)?{from:n.from,to:n.to}:null,l={from:r,insert:i},o=t.state.changes(h?[h,l]:l);t.focus(),t.dispatch({changes:o,selection:{anchor:o.mapPos(r,-1),head:o.mapPos(r,1)},userEvent:h?"move.drop":"input.drop"}),t.inputState.draggedContent=null;}function Ys(t,e){var i=[];var _iterator56=_createForOfIteratorHelper(t.facet(Pi)),_step56;try{for(_iterator56.s();!(_step56=_iterator56.n()).done;){var _s79=_step56.value;var _r66=_s79(t,e);_r66&&i.push(_r66);}}catch(err){_iterator56.e(err);}finally{_iterator56.f();}return i?t.update({effects:i,annotations:Xs.of(!0)}):null;}function Qs(t){setTimeout(function(){var e=t.hasFocus;if(e!=t.inputState.notifiedFocused){var _i90=Ys(t.state,e);_i90?t.dispatch(_i90):t.update([]);}},10);}function ar(t,e){var i,s;null==t[e]&&(i=t[e-1])instanceof ur&&(s=t[e+1])instanceof ur&&t.splice(e-1,3,new ur(i.length+1+s.length));}function pr(t,e){var i=t.getBoundingClientRect(),s=t.ownerDocument,r=s.defaultView||window,n=Math.max(0,i.left),h=Math.min(r.innerWidth,i.right),l=Math.max(0,i.top),o=Math.min(r.innerHeight,i.bottom);for(var _e110=t.parentNode;_e110&&_e110!=s.body;)if(1==_e110.nodeType){var _i96=_e110,_s85=window.getComputedStyle(_i96);if((_i96.scrollHeight>_i96.clientHeight||_i96.scrollWidth>_i96.clientWidth)&&"visible"!=_s85.overflow){var _s86=_i96.getBoundingClientRect();n=Math.max(n,_s86.left),h=Math.min(h,_s86.right),l=Math.max(l,_s86.top),o=_e110==t.parentNode?_s86.bottom:Math.min(o,_s86.bottom);}_e110="absolute"==_s85.position||"fixed"==_s85.position?_i96.offsetParent:_i96.parentNode;}else{if(11!=_e110.nodeType)break;_e110=_e110.host;}return{left:n-i.left,right:Math.max(n,h)-i.left,top:l-(i.top+e),bottom:Math.max(l,o)-(i.top+e)};}function mr(t,e){var i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)};}function kr(t,e,i){var s=[],r=t,n=0;return It.spans(i,t,e,{span:function span(){},point:function point(t,e){t>r&&(s.push({from:r,to:t}),n+=t-r),r=e;}},20),r<e&&(s.push({from:r,to:e}),n+=e-r),{total:n,ranges:s};}function yr(_ref10,i){var t=_ref10.total,e=_ref10.ranges;if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;var s=Math.floor(t*i);for(var _t131=0;;_t131++){var _e$_t=e[_t131],_i106=_e$_t.from,_r75=_e$_t.to,_n69=_r75-_i106;if(s<=_n69)return _i106+s;s-=_n69;}}function Mr(t,e){var i=0;var _iterator63=_createForOfIteratorHelper(t.ranges),_step63;try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){var _step63$value=_step63.value,_s93=_step63$value.from,_r76=_step63$value.to;if(e<=_r76){i+=e-_s93;break;}i+=_r76-_s93;}}catch(err){_iterator63.e(err);}finally{_iterator63.f();}return i/t.total;}function Ar(t,e){if(1==e.scale)return t;var i=e.toDOM(t.top),s=e.toDOM(t.bottom);return new sr(t.from,t.length,i,s-i,Array.isArray(t._content)?t._content.map(function(t){return Ar(t,e);}):t._content);}function Tr(t,e,i){return new Gt(e,{finish:function finish(e){return /&/.test(e)?e.replace(/&\w*/,function(e){if("&"==e)return t;if(!i||!i[e])throw new RangeError("Unsupported selector: ".concat(e));return i[e];}):t+" "+e;}});}function $r(t,e,i){for(;;){if(!e||i<fe(e))return!1;if(e==t)return!0;i=le(e)+1,e=e.parentNode;}}function Pr(e,i){var s,r=i.newSel,n=e.state.selection.main,h=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(i.bounds){var _i$bounds=i.bounds,_r82=_i$bounds.from,_l39=_i$bounds.to,_o30=n.from,_u33=null;(8===h||Ve.android&&i.text.length<_l39-_r82)&&(_o30=n.to,_u33="end");var _f17=function(t,e,i,s){var r=Math.min(t.length,e.length),n=0;for(;n<r&&t.charCodeAt(n)==e.charCodeAt(n);)n++;if(n==r&&t.length==e.length)return null;var h=t.length,l=e.length;for(;h>0&&l>0&&t.charCodeAt(h-1)==e.charCodeAt(l-1);)h--,l--;if("end"==s){i-=h+Math.max(0,n-Math.min(h,l))-n;}if(h<n&&t.length<e.length){n-=i<=n&&i>=h?n-i:0,l=n+(l-h),h=n;}else if(l<n){n-=i<=n&&i>=l?n-i:0,h=n+(h-l),l=n;}return{from:n,toA:h,toB:l};}(e.state.doc.sliceString(_r82,_l39,Lr),i.text,_o30-_r82,_u33);_f17&&(Ve.chrome&&13==h&&_f17.toB==_f17.from+2&&i.text.slice(_f17.from,_f17.toB)==Lr+Lr&&_f17.toB--,s={from:_r82+_f17.from,to:_r82+_f17.toA,insert:t.of(i.text.slice(_f17.from,_f17.toB).split(Lr))});}else r&&(!e.hasFocus&&e.state.facet(Ji)||r.main.eq(n))&&(r=null);if(!s&&!r)return!1;if(!s&&i.typeOver&&!n.empty&&r&&r.main.empty?s={from:n.from,to:n.to,insert:e.state.doc.slice(n.from,n.to)}:s&&s.from>=n.from&&s.to<=n.to&&(s.from!=n.from||s.to!=n.to)&&n.to-n.from-(s.to-s.from)<=4?s={from:n.from,to:n.to,insert:e.state.doc.slice(n.from,s.from).append(s.insert).append(e.state.doc.slice(s.to,n.to))}:(Ve.mac||Ve.android)&&s&&s.from==s.to&&s.from==n.head-1&&/^\. ?$/.test(s.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==s.insert.length&&(r=B.single(r.main.anchor-1,r.main.head-1)),s={from:n.from,to:n.to,insert:t.of([" "])}):Ve.chrome&&s&&s.from==s.to&&s.from==n.head&&"\n "==s.insert.toString()&&e.lineWrapping&&(r&&(r=B.single(r.main.anchor-1,r.main.head-1)),s={from:n.from,to:n.to,insert:t.of([" "])}),s){if(Ve.ios&&e.inputState.flushIOSKey(s))return!0;if(Ve.android&&(s.to==n.to&&(s.from==n.from||s.from==n.from-1&&" "==e.state.sliceDoc(s.from,n.from))&&1==s.insert.length&&2==s.insert.lines&&ve(e.contentDOM,"Enter",13)||(s.from==n.from-1&&s.to==n.to&&0==s.insert.length||8==h&&s.insert.length<s.to-s.from&&s.to>n.head)&&ve(e.contentDOM,"Backspace",8)||s.from==n.from&&s.to==n.to+1&&0==s.insert.length&&ve(e.contentDOM,"Delete",46)))return!0;var _t135,_i115=s.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;var _l40=function _l40(){return _t135||(_t135=function(t,e,i){var s,r=t.state,n=r.selection.main;if(e.from>=n.from&&e.to<=n.to&&e.to-e.from>=(n.to-n.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){var _i116=n.from<e.from?r.sliceDoc(n.from,e.from):"",_h41=n.to>e.to?r.sliceDoc(e.to,n.to):"";s=r.replaceSelection(t.state.toText(_i116+e.insert.sliceString(0,void 0,t.state.lineBreak)+_h41));}else{var _h42=r.changes(e),_l41=i&&i.main.to<=_h42.newLength?i.main:void 0;if(r.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=n.to&&e.to>=n.to-10){var _o31,_u34=t.state.sliceDoc(e.from,e.to),_f18=i&&as(t,i.main.head);if(_f18){var _t136=e.insert.length-(e.to-e.from);_o31={from:_f18.from,to:_f18.to-_t136};}else _o31=t.state.doc.lineAt(n.head);var _a12=n.to-e.to,_c11=n.to-n.from;s=r.changeByRange(function(i){if(i.from==n.from&&i.to==n.to)return{changes:_h42,range:_l41||i.map(_h42)};var s=i.to-_a12,f=s-_u34.length;if(i.to-i.from!=_c11||t.state.sliceDoc(f,s)!=_u34||i.to>=_o31.from&&i.from<=_o31.to)return{range:i};var d=r.changes({from:f,to:s,insert:e.insert}),p=i.to-n.to;return{changes:d,range:_l41?B.range(Math.max(0,_l41.anchor+p),Math.max(0,_l41.head+p)):i.map(d)};});}else s={changes:_h42,selection:_l41&&r.selection.replaceRange(_l41)};}var h="input.type";(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));return r.update(s,{userEvent:h,scrollIntoView:!0});}(e,s,r));};return e.state.facet(zi).some(function(t){return t(e,s.from,s.to,_i115,_l40);})||e.dispatch(_l40()),!0;}if(r&&!r.main.eq(n)){var _t137=!1,_i117="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(_t137=!0),_i117=e.inputState.lastSelectionOrigin),e.dispatch({selection:r,scrollIntoView:_t137,userEvent:_i117}),!0;}return!1;}function Fr(t,e,i){for(;e;){var _s100=Ce.get(e);if(_s100&&_s100.parent==t)return _s100;var _r84=e.parentNode;e=_r84!=t.dom?_r84:i>0?e.nextSibling:e.previousSibling;}return null;}function qr(t,e){var _ref12;var i=e.startContainer,s=e.startOffset,r=e.endContainer,n=e.endOffset,h=t.docView.domAtPos(t.state.selection.main.anchor);return he(h.node,h.offset,r,n)&&(_ref12=[r,n,i,s],i=_ref12[0],s=_ref12[1],r=_ref12[2],n=_ref12[3],_ref12),{anchorNode:i,anchorOffset:s,focusNode:r,focusOffset:n};}function _r(t,e,i){for(var _s105=t.state.facet(e),_r88=_s105.length-1;_r88>=0;_r88--){var _e133=_s105[_r88],_n74="function"==typeof _e133?_e133(t):_e133;_n74&&Xe(_n74,i);}return i;}function Yr(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;}function en(t){var e=t.facet(Zr),i=tn.get(e);return i||tn.set(e,i=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Xr;var i=Object.create(null),s=Object.create(null),r=function r(t,e){var 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=function n(t,s,_n75,h,l){var o,u;var f=i[t]||(i[t]=Object.create(null)),a=s.split(/ (?!$)/).map(function(t){return function(t,e){var i=t.split(/-(?!$)/);var s,r,n,h,l=i[i.length-1];"Space"==l&&(l=" ");for(var _t162=0;_t162<i.length-1;++_t162){var _l43=i[_t162];if(/^(cmd|meta|m)$/i.test(_l43))h=!0;else if(/^a(lt)?$/i.test(_l43))s=!0;else if(/^(c|ctrl|control)$/i.test(_l43))r=!0;else if(/^s(hift)?$/i.test(_l43))n=!0;else{if(!/^mod$/i.test(_l43))throw new Error("Unrecognized modifier name: "+_l43);"mac"==e?h=!0:r=!0;}}return s&&(l="Alt-"+l),r&&(l="Ctrl-"+l),h&&(l="Meta-"+l),n&&(l="Shift-"+l),l;}(t,e);});var _loop8=function _loop8(){var i=a.slice(0,_e134).join(" ");r(i,!0),f[i]||(f[i]={preventDefault:!0,stopPropagation:!1,run:[function(e){var s=sn={view:e,prefix:i,scope:t};return setTimeout(function(){sn==s&&(sn=null);},rn),!0;}]});};for(var _e134=1;_e134<a.length;_e134++){_loop8();}var c=a.join(" ");r(c,!1);var d=f[c]||(f[c]={preventDefault:!1,stopPropagation:!1,run:(null===(u=null===(o=f._any)||void 0===o?void 0:o.run)||void 0===u?void 0:u.slice())||[]});_n75&&d.run.push(_n75),h&&(d.preventDefault=!0),l&&(d.stopPropagation=!0);};var _iterator92=_createForOfIteratorHelper(t),_step92;try{for(_iterator92.s();!(_step92=_iterator92.n()).done;){var _s106=_step92.value;var _t163=_s106.scope?_s106.scope.split(" "):["editor"];if(_s106.any){var _iterator93=_createForOfIteratorHelper(_t163),_step93;try{for(_iterator93.s();!(_step93=_iterator93.n()).done;){var _e135=_step93.value;var _t164=i[_e135]||(i[_e135]=Object.create(null));_t164._any||(_t164._any={preventDefault:!1,stopPropagation:!1,run:[]});for(var _e136 in _t164)_t164[_e136].run.push(_s106.any);}}catch(err){_iterator93.e(err);}finally{_iterator93.f();}}var _r89=_s106[e]||_s106.key;if(_r89){var _iterator94=_createForOfIteratorHelper(_t163),_step94;try{for(_iterator94.s();!(_step94=_iterator94.n()).done;){var _e137=_step94.value;n(_e137,_r89,_s106.run,_s106.preventDefault,_s106.stopPropagation),_s106.shift&&n(_e137,"Shift-"+_r89,_s106.shift,_s106.preventDefault,_s106.stopPropagation);}}catch(err){_iterator94.e(err);}finally{_iterator94.f();}}}}catch(err){_iterator92.e(err);}finally{_iterator92.f();}return i;}(e.reduce(function(t,e){return t.concat(e);},[]))),i;}function nn(t,e,i,s){var r=function(t){var e=!(Qt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Zt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Yt:Xt)[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),n=y(v(r,0))==r.length&&" "!=r,h="",l=!1,o=!1,u=!1;sn&&sn.view==i&&sn.scope==s&&(h=sn.prefix+" ",Rs.indexOf(e.keyCode)<0&&(o=!0,sn=null));var f,a,c=new Set(),d=function d(t){if(t){var _iterator95=_createForOfIteratorHelper(t.run),_step95;try{for(_iterator95.s();!(_step95=_iterator95.n()).done;){var _s107=_step95.value;if(!c.has(_s107)&&(c.add(_s107),_s107(i,e)))return t.stopPropagation&&(u=!0),!0;}}catch(err){_iterator95.e(err);}finally{_iterator95.f();}t.preventDefault&&(t.stopPropagation&&(u=!0),o=!0);}return!1;},p=t[s];return p&&(d(p[h+Yr(r,e,!n)])?l=!0:n&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ve.windows&&e.ctrlKey&&e.altKey)&&(f=Xt[e.keyCode])&&f!=r?(d(p[h+Yr(f,e,!0)])||e.shiftKey&&(a=Yt[e.keyCode])!=r&&a!=f&&d(p[h+Yr(a,e,!1)]))&&(l=!0):n&&e.shiftKey&&d(p[h+Yr(r,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),o&&(l=!0),l&&u&&e.stopPropagation(),l;}function ln(t){var e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==pi.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY};}function on(t,e,i){var s=B.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(s,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(s,!0,!0).from),type:ri.Text};}function an(t){return[_i.define(function(e){return new un(e,t);}),fn.of(t)];}function pn(t){return t.startState.facet(dn)!=t.state.facet(dn);}function gn(t,e){e.style.animationDuration=t.facet(dn).cursorBlinkRate+"ms";}function xn(t,e,i,s,r){e.lastIndex=0;for(var _n78,_h46=t.iterRange(i,s),_l45=i;!_h46.next().done;_l45+=_h46.value.length)if(!_h46.lineBreak)for(;_n78=e.exec(_h46.value);)r(_l45+_n78.index,_n78);}function $n(t,e){var i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),s=t.state.doc.lineAt(i),r=i-s.from,n=r>Nn?-1:r==s.length?function(t,e){var i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1;}(t,e.clientX):Vt(s.text,t.state.tabSize,i-s.from);return{line:s.number,col:n,off:r};}function jn(t,e){var i=$n(t,e),s=t.state.selection;return i?{update:function update(t){if(t.docChanged){var _e144=t.changes.mapPos(t.startState.doc.line(i.line).from),_r98=t.state.doc.lineAt(_e144);i={line:_r98.number,col:i.col,off:Math.min(i.off,_r98.length)},s=s.map(t.changes);}},get:function get(e,r,n){var h=$n(t,e);if(!h)return s;var l=function(t,e,i){var s=Math.min(e.line,i.line),r=Math.max(e.line,i.line),n=[];if(e.off>Nn||i.off>Nn||e.col<0||i.col<0){var _h47=Math.min(e.off,i.off),_l47=Math.max(e.off,i.off);for(var _e145=s;_e145<=r;_e145++){var _i128=t.doc.line(_e145);_i128.length<=_l47&&n.push(B.range(_i128.from+_h47,_i128.to+_l47));}}else{var _h48=Math.min(e.col,i.col),_l48=Math.max(e.col,i.col);for(var _e146=s;_e146<=r;_e146++){var _i129=t.doc.line(_e146),_s116=Ft(_i129.text,_h48,t.tabSize,!0);if(_s116<0)n.push(B.cursor(_i129.to));else{var _e147=Ft(_i129.text,_l48,t.tabSize);n.push(B.range(_i129.from+_s116,_i129.from+_e147));}}}return n;}(t.state,i,h);return l.length?n?B.create(l.concat(s.ranges)):B.create(l):s;}}:null;}function Vn(t){var e=t.win;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth};}function th(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var i=ct.define(),s=F.define({create:function create(){return[];},update:function update(t,s){if(t.length&&(e.hideOnChange&&(s.docChanged||s.selection)?t=[]:e.hideOn&&(t=t.filter(function(t){return!e.hideOn(s,t);})),s.docChanged)){var _e157=[];var _iterator118=_createForOfIteratorHelper(t),_step118;try{for(_iterator118.s();!(_step118=_iterator118.n()).done;){var _i133=_step118.value;var _t179=s.changes.mapPos(_i133.pos,-1,x.TrackDel);if(null!=_t179){var _r100=Object.assign(Object.create(null),_i133);_r100.pos=_t179,null!=_r100.end&&(_r100.end=s.changes.mapPos(_r100.end)),_e157.push(_r100);}}}catch(err){_iterator118.e(err);}finally{_iterator118.f();}t=_e157;}var _iterator119=_createForOfIteratorHelper(s.effects),_step119;try{for(_iterator119.s();!(_step119=_iterator119.n()).done;){var _e158=_step119.value;_e158.is(i)&&(t=_e158.value),_e158.is(ih)&&(t=[]);}}catch(err){_iterator119.e(err);}finally{_iterator119.f();}return t;},provide:function provide(t){return _n.from(t);}});return[s,_i.define(function(r){return new Qn(r,t,s,i,e.hoverTime||300);}),Yn];}function eh(t,e){var i=t.plugin(Un);if(!i)return null;var s=i.manager.tooltips.indexOf(e);return s<0?null:i.manager.tooltipViews[s];}function rh(t,e){var i=t.plugin(nh),s=i?i.specs.indexOf(e):-1;return s>-1?i.panels[s]:null;}function lh(t){var e=t.nextSibling;return t.remove(),e;}function dh(t){return[mh(),ch.of(Object.assign(Object.assign({},ah),t))];}function mh(t){var e=[gh];return t&&!1===t.fixed&&e.push(ph.of(!0)),e;}function wh(t){return Array.isArray(t)?t:[t];}function bh(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next();}function Ah(t,e){return t.state.facet(xh).formatNumber(e,t.state);}function Dh(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[xh.of(t),mh(),Ch];}function Oh(t){var e=9;for(;e<t;)e=10*e+9;return e;}function Uh(t,e,i,s){switch(t){case-2:return i<e;case-1:return s>=e&&i<e;case 0:return i<e&&s>e;case 1:return i<=e&&s>e;case 2:return s>e;case 4:return!0;}}function Jh(t,e,i,s){for(var r;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to<e);){var _e185=!s&&t instanceof Kh&&t.index<0?null:t.parent;if(!_e185)return t;t=_e185;}var n=s?0:Wh.IgnoreOverlays;if(s)for(var _s131=t,_h56=_s131.parent;_h56;_s131=_h56,_h56=_s131.parent)_s131 instanceof Kh&&_s131.index<0&&(null===(r=_h56.enter(e,i,n))||void 0===r?void 0:r.from)!=_s131.from&&(t=_h56);for(;;){var _s132=t.enter(e,i,n);if(!_s132)return t;t=_s132;}}function _h(t,e,i,s){var r=t.cursor(),n=[];if(!r.firstChild())return n;if(null!=i)for(var _t213=!1;!_t213;)if(_t213=r.type.is(i),!r.nextSibling())return n;for(;;){if(null!=s&&r.type.is(s))return n;if(r.type.is(e)&&n.push(r.node),!r.nextSibling())return null==s?n:[];}}function Xh(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:e.length-1;for(var _s133=t.parent;i>=0;_s133=_s133.parent){if(!_s133)return!1;if(!_s133.type.isAnonymous){if(e[i]&&e[i]!=_s133.name)return!1;i--;}}return!0;}function Zh(t){if(!t.length)return null;var e=0,i=t[0];for(var _s134=1;_s134<t.length;_s134++){var _r111=t[_s134];(_r111.from>i.from||_r111.to<i.to)&&(i=_r111,e=_s134);}var s=i instanceof Kh&&i.index<0?null:i.parent,r=t.slice();return s?r[e]=s:r.splice(e,1),new tl(r,i);}function il(t){return t.children.some(function(t){return t instanceof qh||!t.type.isAnonymous||il(t);});}function rl(t,e){if(!t.isAnonymous||e instanceof qh||e.type!=t)return 1;var i=sl.get(e);if(null==i){i=1;var _iterator149=_createForOfIteratorHelper(e.children),_step149;try{for(_iterator149.s();!(_step149=_iterator149.n()).done;){var _s139=_step149.value;if(_s139.type!=t||!(_s139 instanceof Vh)){i=1;break;}i+=rl(t,_s139);}}catch(err){_iterator149.e(err);}finally{_iterator149.f();}sl.set(e,i);}return i;}function nl(t,e,i,s,r,n,h,l,o){var u=0;for(var _i153=s;_i153<r;_i153++)u+=rl(t,e[_i153]);var f=Math.ceil(1.5*u/8),a=[],c=[];return function e(i,s,r,h,l){for(var _u39=r;_u39<h;){var _r115=_u39,_d8=s[_u39],_p7=rl(t,i[_u39]);for(_u39++;_u39<h;_u39++){var _e187=rl(t,i[_u39]);if(_p7+_e187>=f)break;_p7+=_e187;}if(_u39==_r115+1){if(_p7>f){var _t219=i[_r115];e(_t219.children,_t219.positions,0,_t219.children.length,s[_r115]+l);continue;}a.push(i[_r115]);}else{var _e188=s[_u39-1]+i[_u39-1].length-_d8;a.push(nl(t,i,s,_r115,_u39,_d8,_e188,null,o));}c.push(_d8+l-n);}}(e,i,s,r,0),(l||o)(a,c,h);}function pl(t){var e=Object.create(null);for(var _i158 in t){var _s141=t[_i158];Array.isArray(_s141)||(_s141=[_s141]);var _iterator155=_createForOfIteratorHelper(_i158.split(" ")),_step155;try{for(_iterator155.s();!(_step155=_iterator155.n()).done;){var _t224=_step155.value;if(_t224){var _i159=[],_r117=2,_n93=_t224;for(var _e191=0;;){if("..."==_n93&&_e191>0&&_e191+3==_t224.length){_r117=1;break;}var _s142=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(_n93);if(!_s142)throw new RangeError("Invalid path: "+_t224);if(_i159.push("*"==_s142[0]?"":'"'==_s142[0][0]?JSON.parse(_s142[0]):_s142[0]),_e191+=_s142[0].length,_e191==_t224.length)break;var _h61=_t224[_e191++];if(_e191==_t224.length&&"!"==_h61){_r117=0;break;}if("/"!=_h61)throw new RangeError("Invalid path: "+_t224);_n93=_t224.slice(_e191);}var _h62=_i159.length-1,_l59=_i159[_h62];if(!_l59)throw new RangeError("Invalid path: "+_t224);var _o40=new gl(_s141,_r117,_h62>0?_i159.slice(0,_h62):null);e[_l59]=_o40.sort(e[_l59]);}}}catch(err){_iterator155.e(err);}finally{_iterator155.f();}}return ml.add(e);}function wl(t,e){var i=Object.create(null);var _iterator156=_createForOfIteratorHelper(t),_step156;try{for(_iterator156.s();!(_step156=_iterator156.n()).done;){var _e192=_step156.value;if(Array.isArray(_e192.tag)){var _iterator159=_createForOfIteratorHelper(_e192.tag),_step159;try{for(_iterator159.s();!(_step159=_iterator159.n()).done;){var _t226=_step159.value;i[_t226.id]=_e192["class"];}}catch(err){_iterator159.e(err);}finally{_iterator159.f();}}else i[_e192.tag.id]=_e192["class"];}}catch(err){_iterator156.e(err);}finally{_iterator156.f();}var _ref17=e||{},s=_ref17.scope,_ref17$all=_ref17.all,r=_ref17$all===void 0?null:_ref17$all;return{style:function style(t){var e=r;var _iterator157=_createForOfIteratorHelper(t),_step157;try{for(_iterator157.s();!(_step157=_iterator157.n()).done;){var _s143=_step157.value;var _iterator158=_createForOfIteratorHelper(_s143.set),_step158;try{for(_iterator158.s();!(_step158=_iterator158.n()).done;){var _t225=_step158.value;var _s144=i[_t225.id];if(_s144){e=e?e+" "+_s144:_s144;break;}}}catch(err){_iterator158.e(err);}finally{_iterator158.f();}}}catch(err){_iterator157.e(err);}finally{_iterator157.f();}return e;},scope:s};}function bl(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:t.length;var n=new vl(s,Array.isArray(e)?e:[e],i);n.highlightRange(t.cursor(),s,r,"",n.highlighters),n.flush(r);}function zl(t){return $.define({combine:t?function(e){return e.concat(t);}:void 0});}function Wl(t,e,i){var s=t.facet(Ql),r=Fl(t).topNode;if(!s||s.allowsNesting)for(var _t230=r;_t230;_t230=_t230.enter(e,i,Wh.ExcludeBuffers))_t230.type.isTop&&(r=_t230);return r;}function Fl(t){var e=t.field(Hl.state,!1);return e?e.tree:Vh.empty;}function Gl(t,e,i){return ll.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}]);}function io(t){var e=t.facet(eo);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length;}function so(t,e){var i="",s=t.tabSize,r=t.facet(eo)[0];if("\t"==r){for(;e>=s;)i+="\t",e-=s;r=" ";}for(var _t233=0;_t233<e;_t233++)i+=r;return i;}function ro(t,e){t instanceof St&&(t=new no(t));var _iterator166=_createForOfIteratorHelper(t.state.facet(to)),_step166;try{for(_iterator166.s();!(_step166=_iterator166.n()).done;){var _i164=_step166.value;var _s149=_i164(t,e);if(void 0!==_s149)return _s149;}}catch(err){_iterator166.e(err);}finally{_iterator166.f();}var i=Fl(t.state);return i.length>=e?function(t,e,i){var s=e.resolveStack(i),r=s.node.enterUnfinishedNodesBefore(i);if(r!=s.node){var _t234=[];for(var _e199=r;_e199!=s.node;_e199=_e199.parent)_t234.push(_e199);for(var _e200=_t234.length-1;_e200>=0;_e200--)s={node:_t234[_e200],next:s};}return lo(s,t,i);}(t,i,e):null;}function lo(t,e,i){for(var _s150=t;_s150;_s150=_s150.next){var _t236=oo(_s150.node);if(_t236)return _t236(fo.create(e,i,_s150));}return 0;}function oo(t){var e=t.type.prop(ho);if(e)return e;var i,s=t.firstChild;if(s&&(i=s.type.prop(Lh.closedBy))){var _e201=t.lastChild,_s151=_e201&&i.indexOf(_e201.name)>-1;return function(t){return po(t,!0,1,void 0,_s151&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak;}(t)?_e201.from:void 0);};}return null==t.parent?uo:null;}function uo(){return 0;}function ao(t,e){for(var _i166=e;_i166;_i166=_i166.parent)if(t==_i166)return!0;return!1;}function co(_ref18){var t=_ref18.closing,_ref18$align=_ref18.align,e=_ref18$align===void 0?!0:_ref18$align,_ref18$units=_ref18.units,i=_ref18$units===void 0?1:_ref18$units;return function(s){return po(s,e,i,t);};}function po(t,e,i,s,r){var n=t.textAfter,h=n.match(/^\s*/)[0].length,l=s&&n.slice(h,h+s.length)==s||r==t.pos+h,o=e?function(t){var e=t.node,i=e.childAfter(e.from),s=e.lastChild;if(!i)return null;var r=t.options.simulateBreak,n=t.state.doc.lineAt(i.from),h=null==r||r<=n.from?n.to:Math.min(n.to,r);for(var _t237=i.to;;){var _r120=e.childAfter(_t237);if(!_r120||_r120==s)return null;if(!_r120.type.isSkipped)return _r120.from<h?i:null;_t237=_r120.to;}}(t):null;return o?l?t.column(o.from):t.column(o.to):t.baseIndent+(l?0:t.unit*i);}function go(){var _ref19=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},t=_ref19.except,_ref19$units=_ref19.units,e=_ref19$units===void 0?1:_ref19$units;return function(i){var s=t&&t.test(i.textAfter);return i.baseIndent+(s?0:e*i.unit);};}function vo(t){var e=t.firstChild,i=t.lastChild;return e&&e.to<i.from?{from:e.to,to:i.type.isError?t.to:i.from}:null;}function ko(t){var e=t.lastChild;return e&&e.to==t.to&&e.type.isError;}function yo(t,e,i){var _iterator167=_createForOfIteratorHelper(t.facet(wo)),_step167;try{for(_iterator167.s();!(_step167=_iterator167.n()).done;){var _s153=_step167.value;var _r121=_s153(t,e,i);if(_r121)return _r121;}}catch(err){_iterator167.e(err);}finally{_iterator167.f();}return function(t,e,i){var s=Fl(t);if(s.length<i)return null;var r=null;for(var _n95=s.resolveStack(i,1);_n95;_n95=_n95.next){var _h63=_n95.node;if(_h63.to<=i||_h63.from>i)continue;if(r&&_h63.from<e)break;var _l60=_h63.type.prop(bo);if(_l60&&(_h63.to<s.length-50||s.length==t.doc.length||!ko(_h63))){var _s152=_l60(_h63,t);_s152&&_s152.from<=i&&_s152.from>=e&&_s152.to>i&&(r=_s152);}}return r;}(t,e,i);}function Mo(t,e){var i=e.mapPos(t.from,1),s=e.mapPos(t.to,-1);return i>=s?void 0:{from:i,to:s};}function Ao(t){var e=[];var _iterator168=_createForOfIteratorHelper(t.state.selection.ranges),_step168;try{var _loop12=function _loop12(){var i=_step168.value.head;e.some(function(t){return t.from<=i&&t.to>=i;})||e.push(t.lineBlockAt(i));};for(_iterator168.s();!(_step168=_iterator168.n()).done;){_loop12();}}catch(err){_iterator168.e(err);}finally{_iterator168.f();}return e;}function Do(t,e,i){var s;var r=null;return null===(s=t.field(Co,!1))||void 0===s||s.between(e,i,function(t,e){(!r||r.from>t)&&(r={from:t,to:e});}),r;}function Oo(t,e,i){var s=!1;return t.between(e,e,function(t,r){t==e&&r==i&&(s=!0);}),s;}function Eo(t,e){return t.field(Co,!1)?e:e.concat(ct.appendConfig.of(Lo()));}function Io(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var s=t.state.doc.lineAt(e.from).number,r=t.state.doc.lineAt(e.to).number;return Ur.announce.of("".concat(t.state.phrase(i?"Folded lines":"Unfolded lines")," ").concat(s," ").concat(t.state.phrase("to")," ").concat(r,"."));}function Lo(t){var e=[Co,Ho];return t&&e.push(Bo.of(t)),e;}function No(t,e){var i=t.state,s=i.facet(Bo),r=function r(e){var i=t.lineBlockAt(t.posAtDOM(e.target)),s=Do(t.state,i.from,i.to);s&&t.dispatch({effects:So.of(s)}),e.preventDefault();};if(s.placeholderDOM)return s.placeholderDOM(t,r,e);var n=document.createElement("span");return n.textContent=s.placeholderText,n.setAttribute("aria-label",i.phrase("folded code")),n.title=i.phrase("unfold"),n.className="cm-foldPlaceholder",n.onclick=r,n;}function qo(t){var e=t.facet(Vo);return e.length?e:t.facet(Fo);}function tu(t){var e=[],i=t.matched?Qo:Zo;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e;}function ru(t,e,i){var s=t.prop(e<0?Lh.openedBy:Lh.closedBy);if(s)return s;if(1==t.name.length){var _s160=i.indexOf(t.name);if(_s160>-1&&_s160%2==(e<0?1:0))return[i[_s160+e]];}return null;}function nu(t){var e=t.type.prop(su);return e?e(t.node):t;}function hu(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};var r=s.maxScanDistance||_o,n=s.brackets||Xo,h=Fl(t),l=h.resolveInner(e,i);for(var _s161=l;_s161;_s161=_s161.parent){var _r127=ru(_s161.type,i,n);if(_r127&&_s161.from<_s161.to){var _h64=nu(_s161);if(_h64&&(i>0?e>=_h64.from&&e<_h64.to:e>_h64.from&&e<=_h64.to))return lu(t,e,i,_s161,_h64,_r127,n);}}return function(t,e,i,s,r,n,h){var l=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),o=h.indexOf(l);if(o<0||o%2==0!=i>0)return null;var u={from:i<0?e-1:e,to:i>0?e+1:e},f=t.doc.iterRange(e,i>0?t.doc.length:0),a=0;for(var _t239=0;!f.next().done&&_t239<=n;){var _n97=f.value;i<0&&(_t239+=_n97.length);var _l61=e+_t239*i;for(var _t240=i>0?0:_n97.length-1,_e203=i>0?_n97.length:-1;_t240!=_e203;_t240+=i){var _e204=h.indexOf(_n97[_t240]);if(!(_e204<0||s.resolveInner(_l61+_t240,1).type!=r))if(_e204%2==0==i>0)a++;else{if(1==a)return{start:u,end:{from:_l61+_t240,to:_l61+_t240+1},matched:_e204>>1==o>>1};a--;}}i>0&&(_t239+=_n97.length);}return f.done?{start:u,matched:!1}:null;}(t,e,i,h,l.type,r,n);}function lu(t,e,i,s,r,n,h){var l=s.parent,o={from:r.from,to:r.to},u=0,f=null==l?void 0:l.cursor();if(f&&(i<0?f.childBefore(s.from):f.childAfter(s.to)))do{if(i<0?f.to<=s.from:f.from>=s.to){if(0==u&&n.indexOf(f.type.name)>-1&&f.from<f.to){var _t241=nu(f);return{start:o,end:_t241?{from:_t241.from,to:_t241.to}:void 0,matched:!0};}if(ru(f.type,i,h))u++;else if(ru(f.type,-i,h)){if(0==u){var _t242=nu(f);return{start:o,end:_t242&&_t242.from<_t242.to?{from:_t242.from,to:_t242.to}:void 0,matched:!1};}u--;}}}while(i<0?f.prevSibling():f.nextSibling());return{start:o,matched:!1};}function du(t,e){fu.indexOf(t)>-1||(fu.push(t),console.warn(e));}function pu(t,e){var i=[];var _iterator174=_createForOfIteratorHelper(e.split(" ")),_step174;try{for(_iterator174.s();!(_step174=_iterator174.n()).done;){var _s162=_step174.value;var _e206=[];var _iterator175=_createForOfIteratorHelper(_s162.split(".")),_step175;try{for(_iterator175.s();!(_step175=_iterator175.n()).done;){var _i172=_step175.value;var _s163=t[_i172]||Nl[_i172];_s163?"function"==typeof _s163?_e206.length?_e206=_e206.map(_s163):du(_i172,"Modifier ".concat(_i172," used at start of tag")):_e206.length?du(_i172,"Tag ".concat(_i172," used as modifier")):_e206=Array.isArray(_s163)?_s163:[_s163]:du(_i172,"Unknown highlighting tag ".concat(_i172));}}catch(err){_iterator175.e(err);}finally{_iterator175.f();}var _iterator176=_createForOfIteratorHelper(_e206),_step176;try{for(_iterator176.s();!(_step176=_iterator176.n()).done;){var _t244=_step176.value;i.push(_t244);}}catch(err){_iterator176.e(err);}finally{_iterator176.f();}}}catch(err){_iterator174.e(err);}finally{_iterator174.f();}if(!i.length)return 0;var s=e.replace(/ /g,"_"),r=s+" "+i.map(function(t){return t.id;}),n=au[r];if(n)return n.id;var h=au[r]=jh.define({id:uu.length,name:s,props:[pl(_defineProperty({},s,i))]});return uu.push(h),h.id;}function mu(t,e){return function(_ref20){var i=_ref20.state,s=_ref20.dispatch;if(i.readOnly)return!1;var r=t(e,i);return!!r&&(s(i.update(r)),!0);};}function vu(t,e){var i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{};}function yu(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:e.selection.ranges;var s=i.map(function(t){return vu(e,t.from).block;});if(!s.every(function(t){return t;}))return null;var r=i.map(function(t,i){return function(t,_ref21,s,r){var e=_ref21.open,i=_ref21.close;var n,h,l=t.sliceDoc(s-ku,s),o=t.sliceDoc(r,r+ku),u=/\s*$/.exec(l)[0].length,f=/^\s*/.exec(o)[0].length,a=l.length-u;if(l.slice(a-e.length,a)==e&&o.slice(f,f+i.length)==i)return{open:{pos:s-u,margin:u&&1},close:{pos:r+f,margin:f&&1}};r-s<=2*ku?n=h=t.sliceDoc(s,r):(n=t.sliceDoc(s,s+ku),h=t.sliceDoc(r-ku,r));var c=/^\s*/.exec(n)[0].length,d=/\s*$/.exec(h)[0].length,p=h.length-d-i.length;return n.slice(c,c+e.length)==e&&h.slice(p,p+i.length)==i?{open:{pos:s+c+e.length,margin:/\s/.test(n.charAt(c+e.length))?1:0},close:{pos:r-d-i.length,margin:/\s/.test(h.charAt(p-1))?1:0}}:null;}(e,s[i],t.from,t.to);});if(2!=t&&!r.every(function(t){return t;}))return{changes:e.changes(i.map(function(t,e){return r[e]?[]:[{from:t.from,insert:s[e].open+" "},{from:t.to,insert:" "+s[e].close}];}))};if(1!=t&&r.some(function(t){return t;})){var _t245=[];for(var _e207,_i174=0;_i174<r.length;_i174++)if(_e207=r[_i174]){var _r129=s[_i174],_e208=_e207,_n99=_e208.open,_h65=_e208.close;_t245.push({from:_n99.pos-_r129.open.length,to:_n99.pos+_n99.margin},{from:_h65.pos-_h65.margin,to:_h65.pos+_r129.close.length});}return{changes:_t245};}return null;}function Mu(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:e.selection.ranges;var s=[],r=-1;var _iterator178=_createForOfIteratorHelper(i),_step178;try{for(_iterator178.s();!(_step178=_iterator178.n()).done;){var _step178$value=_step178.value,_t248=_step178$value.from,_n102=_step178$value.to;var _i178=s.length,_h67=1e9,_l62=vu(e,_t248).line;if(_l62){for(var _i179=_t248;_i179<=_n102;){var _o41=e.doc.lineAt(_i179);if(_o41.from>r&&(_t248==_n102||_n102>_o41.from)){r=_o41.from;var _t249=/^\s*/.exec(_o41.text)[0].length,_e211=_t249==_o41.length,_i180=_o41.text.slice(_t249,_t249+_l62.length)==_l62?_t249:-1;_t249<_o41.text.length&&_t249<_h67&&(_h67=_t249),s.push({line:_o41,comment:_i180,token:_l62,indent:_t249,empty:_e211,single:!1});}_i179=_o41.to+1;}if(_h67<1e9)for(var _t250=_i178;_t250<s.length;_t250++)s[_t250].indent<s[_t250].line.text.length&&(s[_t250].indent=_h67);s.length==_i178+1&&(s[_i178].single=!0);}}}catch(err){_iterator178.e(err);}finally{_iterator178.f();}if(2!=t&&s.some(function(t){return t.comment<0&&(!t.empty||t.single);})){var _t246=[];var _iterator179=_createForOfIteratorHelper(s),_step179;try{for(_iterator179.s();!(_step179=_iterator179.n()).done;){var _step179$value=_step179.value,_e209=_step179$value.line,_i176=_step179$value.token,_r130=_step179$value.indent,_n100=_step179$value.empty,_h66=_step179$value.single;!_h66&&_n100||_t246.push({from:_e209.from+_r130,insert:_i176+" "});}}catch(err){_iterator179.e(err);}finally{_iterator179.f();}var _i175=e.changes(_t246);return{changes:_i175,selection:e.selection.map(_i175,1)};}if(1!=t&&s.some(function(t){return t.comment>=0;})){var _t247=[];var _iterator180=_createForOfIteratorHelper(s),_step180;try{for(_iterator180.s();!(_step180=_iterator180.n()).done;){var _step180$value=_step180.value,_e210=_step180$value.line,_i177=_step180$value.comment,_r131=_step180$value.token;if(_i177>=0){var _s165=_e210.from+_i177,_n101=_s165+_r131.length;" "==_e210.text[_n101-_e210.from]&&_n101++,_t247.push({from:_s165,to:_n101});}}}catch(err){_iterator180.e(err);}finally{_iterator180.f();}return{changes:_t247};}return null;}function Ou(t,e){return function(_ref22){var i=_ref22.state,s=_ref22.dispatch;if(!e&&i.readOnly)return!1;var r=i.field(Du,!1);if(!r)return!1;var n=r.pop(t,i,e);return!!n&&(s(n),!0);};}function Lu(t,e,i,s){var r=e+1>i+20?e-i-1:0,n=t.slice(r,e);return n.push(s),n;}function Nu(t,e){return t.length?e.length?t.concat(e):t:e;}function zu(t,e){if(t.length){var _i181=t[t.length-1],_s167=_i181.selectionsAfter.slice(Math.max(0,_i181.selectionsAfter.length-ju));return _s167.length&&_s167[_s167.length-1].eq(e)?t:(_s167.push(e),Lu(t,t.length-1,1e9,_i181.setSelAfter(_s167)));}return[Bu.selection([e])];}function Pu(t){var e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i;}function Hu(t,e){if(!t.length)return t;var i=t.length,s=$u;for(;i;){var _r133=Wu(t[i-1],e,s);if(_r133.changes&&!_r133.changes.empty||_r133.effects.length){var _e213=t.slice(0,i);return _e213[i-1]=_r133,_e213;}e=_r133.mapped,i--,s=_r133.selectionsAfter;}return s.length?[Bu.selection(s)]:$u;}function Wu(t,e,i){var s=Nu(t.selectionsAfter.length?t.selectionsAfter.map(function(t){return t.map(e);}):$u,i);if(!t.changes)return Bu.selection(s);var r=t.changes.map(e),n=e.mapDesc(t.changes,!0),h=t.mapped?t.mapped.composeDesc(n):n;return new Bu(r,ct.mapEffects(t.effects,e),h,t.startSelection.map(n),s);}function Uu(t,e){return B.create(t.ranges.map(e),t.mainIndex);}function Ju(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"});}function Gu(_ref23,i){var t=_ref23.state,e=_ref23.dispatch;var s=Uu(t.selection,i);return!s.eq(t.selection,!0)&&(e(Ju(t,s)),!0);}function Ku(t,e){return B.cursor(e?t.to:t.from);}function _u(t,e){return Gu(t,function(i){return i.empty?t.moveByChar(i,e):Ku(i,e);});}function Xu(t){return t.textDirectionAt(t.state.selection.main.head)==pi.LTR;}function Zu(t,e){return Gu(t,function(i){return i.empty?t.moveByGroup(i,e):Ku(i,e);});}function tf(t,e,i){if(e.type.prop(i))return!0;var s=e.to-e.from;return s&&(s>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild;}function ef(t,e,i){var s,r,n=Fl(t).resolveInner(e.head),h=i?Lh.closedBy:Lh.openedBy;for(var _s168=e.head;;){var _e215=i?n.childAfter(_s168):n.childBefore(_s168);if(!_e215)break;tf(t,_e215,h)?n=_e215:_s168=i?_e215.to:_e215.from;}return r=n.type.prop(h)&&(s=i?hu(t,n.from,1):hu(t,n.to,-1))&&s.matched?i?s.end.to:s.end.from:i?n.to:n.from,B.cursor(r,i?-1:1);}function sf(t,e){return Gu(t,function(i){if(!i.empty)return Ku(i,e);var s=t.moveVertically(i,e);return s.head!=i.head?s:t.moveToLineBoundary(i,e);});}function hf(t){var e,i=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,s=0,r=0;if(i){var _iterator182=_createForOfIteratorHelper(t.state.facet(Ur.scrollMargins)),_step182;try{for(_iterator182.s();!(_step182=_iterator182.n()).done;){var _e216=_step182.value;var _i183=_e216(t);(null==_i183?void 0:_i183.top)&&(s=Math.max(null==_i183?void 0:_i183.top,s)),(null==_i183?void 0:_i183.bottom)&&(r=Math.max(null==_i183?void 0:_i183.bottom,r));}}catch(err){_iterator182.e(err);}finally{_iterator182.f();}e=t.scrollDOM.clientHeight-s-r;}else e=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:s,marginBottom:r,selfScroll:i,height:Math.max(t.defaultLineHeight,e-5)};}function lf(t,e){var i,s=hf(t),r=t.state,n=Uu(r.selection,function(i){return i.empty?t.moveVertically(i,e,s.height):Ku(i,e);});if(n.eq(r.selection))return!1;if(s.selfScroll){var _e217=t.coordsAtPos(r.selection.main.head),_h70=t.scrollDOM.getBoundingClientRect(),_l63=_h70.top+s.marginTop,_o42=_h70.bottom-s.marginBottom;_e217&&_e217.top>_l63&&_e217.bottom<_o42&&(i=Ur.scrollIntoView(n.main.head,{y:"start",yMargin:_e217.top-_l63}));}return t.dispatch(Ju(r,n),{effects:i}),!0;}function ff(t,e,i){var s=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?s.to:s.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==s.from&&s.length){var _i184=/^\s*/.exec(t.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;_i184&&e.head!=s.from+_i184&&(r=B.cursor(s.from+_i184));}return r;}function af(t,e){var i=Uu(t.state.selection,function(t){var i=e(t);return B.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0);});return!i.eq(t.state.selection)&&(t.dispatch(Ju(t.state,i)),!0);}function cf(t,e){return af(t,function(i){return t.moveByChar(i,e);});}function mf(t,e){return af(t,function(i){return t.moveByGroup(i,e);});}function gf(t,e){return af(t,function(i){return t.moveVertically(i,e);});}function vf(t,e){return af(t,function(i){return t.moveVertically(i,e,hf(t).height);});}function Cf(t,e){if(t.state.readOnly)return!1;var i="delete.selection",s=t.state,r=s.changeByRange(function(s){var r=s.from,n=s.to;if(r==n){var _h71=e(s);_h71<r?(i="delete.backward",_h71=Df(t,_h71,!1)):_h71>r&&(i="delete.forward",_h71=Df(t,_h71,!0)),r=Math.min(r,_h71),n=Math.max(n,_h71);}else r=Df(t,r,!1),n=Df(t,n,!0);return r==n?{range:s}:{changes:{from:r,to:n},range:B.cursor(r,r<s.head?-1:1)};});return!r.changes.empty&&(t.dispatch(s.update(r,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ur.announce.of(s.phrase("Selection deleted")):void 0})),!0);}function Df(t,e,i){if(t instanceof Ur){var _iterator183=_createForOfIteratorHelper(t.state.facet(Ur.atomicRanges).map(function(e){return e(t);})),_step183;try{for(_iterator183.s();!(_step183=_iterator183.n()).done;){var _s169=_step183.value;_s169.between(e,e,function(t,s){t<e&&s>e&&(e=i?s:t);});}}catch(err){_iterator183.e(err);}finally{_iterator183.f();}}return e;}function Bf(t){var e=[],i=-1;var _iterator184=_createForOfIteratorHelper(t.selection.ranges),_step184;try{for(_iterator184.s();!(_step184=_iterator184.n()).done;){var _s170=_step184.value;var _r134=t.doc.lineAt(_s170.from),_n104=t.doc.lineAt(_s170.to);if(_s170.empty||_s170.to!=_n104.from||(_n104=t.doc.lineAt(_s170.to-1)),i>=_r134.number){var _t254=e[e.length-1];_t254.to=_n104.to,_t254.ranges.push(_s170);}else e.push({from:_r134.from,to:_n104.to,ranges:[_s170]});i=_n104.number+1;}}catch(err){_iterator184.e(err);}finally{_iterator184.f();}return e;}function Lf(t,e,i){if(t.readOnly)return!1;var s=[],r=[];var _iterator185=_createForOfIteratorHelper(Bf(t)),_step185;try{for(_iterator185.s();!(_step185=_iterator185.n()).done;){var _e219=_step185.value;if(i?_e219.to==t.doc.length:0==_e219.from)continue;var _n105=t.doc.lineAt(i?_e219.to+1:_e219.from-1),_h72=_n105.length+1;if(i){s.push({from:_e219.to,to:_n105.to},{from:_e219.from,insert:_n105.text+t.lineBreak});var _iterator186=_createForOfIteratorHelper(_e219.ranges),_step186;try{for(_iterator186.s();!(_step186=_iterator186.n()).done;){var _i185=_step186.value;r.push(B.range(Math.min(t.doc.length,_i185.anchor+_h72),Math.min(t.doc.length,_i185.head+_h72)));}}catch(err){_iterator186.e(err);}finally{_iterator186.f();}}else{s.push({from:_n105.from,to:_e219.from},{from:_e219.to,insert:t.lineBreak+_n105.text});var _iterator187=_createForOfIteratorHelper(_e219.ranges),_step187;try{for(_iterator187.s();!(_step187=_iterator187.n()).done;){var _t255=_step187.value;r.push(B.range(_t255.anchor-_h72,_t255.head-_h72));}}catch(err){_iterator187.e(err);}finally{_iterator187.f();}}}}catch(err){_iterator185.e(err);}finally{_iterator185.f();}return!!s.length&&(e(t.update({changes:s,scrollIntoView:!0,selection:B.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0);}function Nf(t,e,i){if(t.readOnly)return!1;var s=[];var _iterator188=_createForOfIteratorHelper(Bf(t)),_step188;try{for(_iterator188.s();!(_step188=_iterator188.n()).done;){var _e220=_step188.value;i?s.push({from:_e220.from,insert:t.doc.slice(_e220.from,_e220.to)+t.lineBreak}):s.push({from:_e220.to,insert:t.lineBreak+t.doc.slice(_e220.from,_e220.to)});}}catch(err){_iterator188.e(err);}finally{_iterator188.f();}return e(t.update({changes:s,scrollIntoView:!0,userEvent:"input.copyline"})),!0;}function jf(e){return function(_ref28){var i=_ref28.state,s=_ref28.dispatch;if(i.readOnly)return!1;var r=i.changeByRange(function(s){var _l65;var r=s.from,n=s.to,h=i.doc.lineAt(r),l=!e&&r==n&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};var i,s=Fl(t).resolveInner(e),r=s.childBefore(e),n=s.childAfter(e);return r&&n&&r.to<=e&&n.from>=e&&(i=r.type.prop(Lh.closedBy))&&i.indexOf(n.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(n.from).from&&!/\S/.test(t.sliceDoc(r.to,n.from))?{from:r.to,to:n.from}:null;}(i,r);e&&(r=n=(n<=h.to?h:i.doc.lineAt(n)).to);var o=new no(i,{simulateBreak:r,simulateDoubleBreak:!!l}),u=ro(o,r);for(null==u&&(u=Vt(/^\s*/.exec(i.doc.lineAt(r).text)[0],i.tabSize));n<h.to&&/\s/.test(h.text[n-h.from]);)n++;l?(_l65=l,r=_l65.from,n=_l65.to,_l65):r>h.from&&r<h.from+100&&!/\S/.test(h.text.slice(0,r))&&(r=h.from);var f=["",so(i,u)];return l&&f.push(so(i,o.lineIndent(h.from,-1))),{changes:{from:r,to:n,insert:t.of(f)},range:B.cursor(r+1+f[1].length)};});return s(i.update(r,{scrollIntoView:!0,userEvent:"input"})),!0;};}function zf(t,e){var i=-1;return t.changeByRange(function(s){var r=[];for(var _n106=s.from;_n106<=s.to;){var _h73=t.doc.lineAt(_n106);_h73.number>i&&(s.empty||s.to>_h73.from)&&(e(_h73,r,s),i=_h73.number),_n106=_h73.to+1;}var n=t.changes(r);return{changes:r,range:B.range(n.mapPos(s.anchor,1),n.mapPos(s.head,1))};});}function Hf(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&"object"==_typeof(i)&&null==i.nodeType&&!Array.isArray(i)){for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){var r=i[s];"string"==typeof r?t.setAttribute(s,r):null!=r&&(t[s]=r);}e++;}for(;e<arguments.length;e++)Wf(t,arguments[e]);return t;}function Wf(t,e){if("string"==typeof e)t.appendChild(document.createTextNode(e));else if(null==e);else if(null!=e.nodeType)t.appendChild(e);else{if(!Array.isArray(e))throw new RangeError("Unsupported child node: "+e);for(var i=0;i<e.length;i++)Wf(t,e[i]);}}function Xf(t,e){if(e>=t.length)return e;var i,s=t.lineAt(e);for(;e<s.to&&(i=s.text.charCodeAt(e-s.from))>=56320&&i<57344;)e++;return e;}function Yf(t){var e=Hf("input",{"class":"cm-textfield",name:"line",value:String(t.state.doc.lineAt(t.state.selection.main.head).number)});function i(){var i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!i)return;var s=t.state,r=s.doc.lineAt(s.selection.main.head),_i189=_slicedToArray(i,5),n=_i189[1],h=_i189[2],l=_i189[3],o=_i189[4],u=l?+l.slice(1):0,f=h?+h:r.number;if(h&&o){var _t262=f/100;n&&(_t262=_t262*("-"==n?-1:1)+r.number/s.doc.lines),f=Math.round(s.doc.lines*_t262);}else h&&n&&(f=f*("-"==n?-1:1)+r.number);var a=s.doc.line(Math.max(1,Math.min(s.doc.lines,f))),c=B.cursor(a.from+Math.max(0,Math.min(u,a.length)));t.dispatch({effects:[Qf.of(!1),Ur.scrollIntoView(c.from,{y:"center"})],selection:c}),t.focus();}return{dom:Hf("form",{"class":"cm-gotoLine",onkeydown:function onkeydown(e){27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Qf.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i());},onsubmit:function onsubmit(t){t.preventDefault(),i();}},Hf("label",t.state.phrase("Go to line"),": ",e)," ",Hf("button",{"class":"cm-button",type:"submit"},t.state.phrase("go")))};}function na(t,e,i,s){return!(0!=i&&t(e.sliceDoc(i-1,i))==kt.Word||s!=e.doc.length&&t(e.sliceDoc(s,s+1))==kt.Word);}function aa(t,e,i,s){return new Ff(e.doc,t.unquoted,i,s,t.caseSensitive?void 0:function(t){return t.toLowerCase();},t.wholeWord?function(t,e){return function(i,s,r,n){return(n>i||n+r.length<s)&&(n=Math.max(0,i-2),r=t.sliceString(n,Math.min(t.length,s+2))),!(e(pa(r,i-n))==kt.Word&&e(ma(r,i-n))==kt.Word||e(ma(r,s-n))==kt.Word&&e(pa(r,s-n))==kt.Word);};}(e.doc,e.charCategorizer(e.selection.main.head)):void 0);}function da(t,e,i,s){return new Jf(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(r=e.charCategorizer(e.selection.main.head),function(t,e,i){return!i[0].length||(r(pa(i.input,i.index))!=kt.Word||r(ma(i.input,i.index))!=kt.Word)&&(r(ma(i.input,i.index+i[0].length))!=kt.Word||r(pa(i.input,i.index+i[0].length))!=kt.Word);}):void 0},i,s);var r;}function pa(t,e){return t.slice(p(t,e,!1),e);}function ma(t,e){return t.slice(e,p(t,e));}function Sa(t){return function(e){var i=e.state.field(va,!1);return i&&i.query.spec.valid?t(e,i):La(e);};}function Ia(t){return t.state.facet(oa).createPanel(t);}function Ra(t,e){var i,s,r,n,h;var l=t.selection.main,o=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!o)return e;var u=t.facet(oa);return new ua({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:u.literal)?o:o.replace(/\n/g,"\\n"),caseSensitive:null!==(s=null==e?void 0:e.caseSensitive)&&void 0!==s?s:u.caseSensitive,literal:null!==(r=null==e?void 0:e.literal)&&void 0!==r?r:u.literal,regexp:null!==(n=null==e?void 0:e.regexp)&&void 0!==n?n:u.regexp,wholeWord:null!==(h=null==e?void 0:e.wholeWord)&&void 0!==h?h:u.wholeWord});}function Ta(t){var e=rh(t,Ia);return e&&e.dom.querySelector("[main-field]");}function Ba(t){var e=Ta(t);e&&e==t.root.activeElement&&e.select();}function za(t,e){return t.state.phrase(e);}function Wa(t,_ref54){var e=_ref54.from,i=_ref54.to;var s=t.state.doc.lineAt(e),r=t.state.doc.lineAt(i).to,n=Math.max(s.from,e-Pa),h=Math.min(r,i+Pa),l=t.state.sliceDoc(n,h);if(n!=s.from)for(var _t267=0;_t267<Pa;_t267++)if(!Ha.test(l[_t267+1])&&Ha.test(l[_t267])){l=l.slice(_t267);break;}if(h!=r)for(var _t268=l.length-1;_t268>l.length-Pa;_t268--)if(!Ha.test(l[_t268-1])&&Ha.test(l[_t268])){l=l.slice(0,_t268);break;}return Ur.announce.of("".concat(t.state.phrase("current match"),". ").concat(l," ").concat(t.state.phrase("on line")," ").concat(s.number,"."));}function Ua(t){var e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),"[".concat(i?"\\w":"").concat(e.replace(/[^\w\s]/g,"\\$&"),"]");}function Ja(t){var e=t.map(function(t){return"string"==typeof t?{label:t}:t;}),_ref55=e.every(function(t){return /^\w+$/.test(t.label);})?[/\w*$/,/\w+$/]:function(t){var e=Object.create(null),i=Object.create(null);var _iterator194=_createForOfIteratorHelper(t),_step194;try{for(_iterator194.s();!(_step194=_iterator194.n()).done;){var _s182=_step194.value.label;e[_s182[0]]=!0;for(var _t269=1;_t269<_s182.length;_t269++)i[_s182[_t269]]=!0;}}catch(err){_iterator194.e(err);}finally{_iterator194.f();}var s=Ua(e)+Ua(i)+"*$";return[new RegExp("^"+s),new RegExp(s)];}(e),_ref56=_slicedToArray(_ref55,2),i=_ref56[0],s=_ref56[1];return function(t){var r=t.matchBefore(s);return r||t.explicit?{from:r?r.from:t.pos,options:e,validFor:i}:null;};}function Ga(t,e){return function(i){for(var _e230=Fl(i.state).resolveInner(i.pos,-1);_e230;_e230=_e230.parent){if(t.indexOf(_e230.name)>-1)return null;if(_e230.type.isTop)break;}return e(i);};}function _a(t){return t.selection.main.from;}function Xa(t,e){var i;var s=t.source,r=e&&"^"!=s[0],n="$"!=s[s.length-1];return r||n?new RegExp("".concat(r?"^":"","(?:").concat(s,")").concat(n?"$":""),null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t;}function Za(t){if(!Array.isArray(t))return t;var e=Qa.get(t);return e||Qa.set(t,e=Ja(t)),e;}function nc(t,e){return t?e?t+" "+e:t:e;}function hc(t,e,i,s,r,n){var h,l,o=t.textDirection==pi.RTL,u=o,f=!1,a="top",c=e.left-r.left,d=r.right-e.right,p=s.right-s.left,m=s.bottom-s.top;if(u&&c<Math.min(p,d)?u=!1:!u&&d<Math.min(p,c)&&(u=!0),p<=(u?c:d))h=Math.max(r.top,Math.min(i.top,r.bottom-m))-e.top,l=Math.min(400,u?c:d);else{f=!0,l=Math.min(400,(o?e.right:r.right-e.left)-30);var _t271=r.bottom-e.bottom;_t271>=m||_t271>e.top?h=i.bottom-e.top:(a="bottom",h=e.bottom-i.top);}return{style:"".concat(a,": ").concat(h/((e.bottom-e.top)/n.offsetHeight),"px; max-width: ").concat(l/((e.right-e.left)/n.offsetWidth),"px"),"class":"cm-completionInfo-"+(f?o?"left-narrow":"right-narrow":u?"left":"right")};}function lc(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){var _t272=Math.floor(e/i);return{from:_t272*i,to:(_t272+1)*i};}var s=Math.floor((t-e)/i);return{from:t-(s+1)*i,to:t-s*i};}function uc(t,e){return function(i){return new oc(i,t,e);};}function fc(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0);}function pc(t,e){var i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i;}function gc(t,e){if(t.isUserEvent("input.complete")){var _i205=t.annotation(Ya);if(_i205&&e.activateOnCompletion(_i205))return"input";}return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null;}function Mc(t,e){var i=e.completion.apply||e.completion.label;var s=t.state.field(yc).active.find(function(t){return t.source==e.source;});return s instanceof bc&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,s){var r=t.selection.main,n=i-r.from,h=s-r.from;return Object.assign(Object.assign({},t.changeByRange(function(l){return l!=r&&i!=s&&t.sliceDoc(l.from+n,l.from+h)!=t.sliceDoc(i,s)?{range:l}:{changes:{from:l.from+n,to:s==r.from?l.to:l.from+h,insert:e},range:B.cursor(l.from+n+e.length)};})),{scrollIntoView:!0,userEvent:"input.complete"});}(t.state,i,s.from,s.to)),{annotations:Ya.of(e.completion)})):i(t,e.completion,s.from,s.to),!0);}function Sc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"option";return function(i){var s=i.state.field(yc,!1);if(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<i.state.facet(rc).interactionDelay)return!1;var r,n=1;"page"==e&&(r=eh(i,s.open.tooltip))&&(n=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1));var h=s.open.options.length,l=s.open.selected>-1?s.open.selected+n*(t?1:-1):t?0:h-1;return l<0?l="page"==e?0:h-1:l>=h&&(l="page"==e?h-1:0),i.dispatch({effects:kc.of(l)}),!0;};}function Pc(t,e){return B.create(t.filter(function(t){return t.field==e;}).map(function(t){return B.range(t.from,t.to);}));}function Hc(e){var i=Tc.parse(e);return function(e,s,r,n){var _i$instantiate=i.instantiate(e.state,r),h=_i$instantiate.text,l=_i$instantiate.ranges,o={changes:{from:r,to:n,insert:t.of(h)},scrollIntoView:!0,annotations:s?[Ya.of(s),dt.userEvent.of("input.complete")]:void 0};if(l.length&&(o.selection=Pc(l,0)),l.some(function(t){return t.field>0;})){var _t291=new Nc(l,0),_i211=o.effects=[$c.of(_t291)];void 0===e.state.field(zc,!1)&&_i211.push(ct.appendConfig.of([zc,qc,Jc,Ec]));}e.dispatch(e.state.update(o));};}function Wc(t){return function(_ref57){var e=_ref57.state,i=_ref57.dispatch;var s=e.field(zc,!1);if(!s||t<0&&0==s.active)return!1;var r=s.active+t,n=t>0&&!s.ranges.some(function(e){return e.field==r+t;});return i(e.update({selection:Pc(s.ranges,r),effects:$c.of(n?null:new Nc(s.ranges,r)),scrollIntoView:!0})),!0;};}function Uc(t,e){return Object.assign(Object.assign({},e),{apply:Hc(t)});}function Qc(t){for(var _e253=0;_e253<Yc.length;_e253+=2)if(Yc.charCodeAt(_e253)==t)return Yc.charAt(_e253+1);return k(t<128?t:t+1);}function Zc(t,e){return t.languageDataAt("closeBrackets",e)[0]||Gc;}function sd(t,e){var i=!1;return t.field(Xc).between(0,t.doc.length,function(t){t==e&&(i=!0);}),i;}function rd(t,e){var i=t.sliceString(e,e+2);return i.slice(0,y(v(i,0)));}function nd(t,e,i,s){var r=null,n=t.changeByRange(function(n){if(!n.empty)return{changes:[{insert:e,from:n.from},{insert:i,from:n.to}],effects:Kc.of(n.to+e.length),range:B.range(n.anchor+e.length,n.head+e.length)};var h=rd(t.doc,n.head);return!h||/\s/.test(h)||s.indexOf(h)>-1?{changes:{insert:e+i,from:n.head},effects:Kc.of(n.head+e.length),range:B.cursor(n.head+e.length)}:{range:r=n};});return r?null:t.update(n,{scrollIntoView:!0,userEvent:"input.type"});}function hd(t,e,i){var s=null,r=t.changeByRange(function(e){return e.empty&&rd(t.doc,e.head)==i?{changes:{from:e.head,to:e.head+i.length,insert:i},range:B.cursor(e.head+i.length)}:s={range:e};});return s?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"});}function ld(t,e,i,s){var r=s.stringPrefixes||Gc.stringPrefixes,n=null,h=t.changeByRange(function(s){if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:e,from:s.to}],effects:Kc.of(s.to+e.length),range:B.range(s.anchor+e.length,s.head+e.length)};var h,l=s.head,o=rd(t.doc,l);if(o==e){if(od(t,l))return{changes:{insert:e+e,from:l},effects:Kc.of(l+e.length),range:B.cursor(l+e.length)};if(sd(t,l)){var _s196=i&&t.sliceDoc(l,l+3*e.length)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+_s196.length,insert:_s196},range:B.cursor(l+_s196.length)};}}else{if(i&&t.sliceDoc(l-2*e.length,l)==e+e&&(h=ud(t,l-2*e.length,r))>-1&&od(t,h))return{changes:{insert:e+e+e+e,from:l},effects:Kc.of(l+e.length),range:B.cursor(l+e.length)};if(t.charCategorizer(l)(o)!=kt.Word&&ud(t,l,r)>-1&&!function(t,e,i,s){var r=Fl(t).resolveInner(e,-1),n=s.reduce(function(t,e){return Math.max(t,e.length);},0);for(var _h82=0;_h82<5;_h82++){var _h83=t.sliceDoc(r.from,Math.min(r.to,r.from+i.length+n)),_l71=_h83.indexOf(i);if(!_l71||_l71>-1&&s.indexOf(_h83.slice(0,_l71))>-1){var _e254=r.firstChild;for(;_e254&&_e254.from==r.from&&_e254.to-_e254.from>i.length+_l71;){if(t.sliceDoc(_e254.to-i.length,_e254.to)==i)return!1;_e254=_e254.firstChild;}return!0;}var _o47=r.to==e&&r.parent;if(!_o47)break;r=_o47;}return!1;}(t,l,e,r))return{changes:{insert:e+e,from:l},effects:Kc.of(l+e.length),range:B.cursor(l+e.length)};}return{range:n=s};});return n?null:t.update(h,{scrollIntoView:!0,userEvent:"input.type"});}function od(t,e){var i=Fl(t).resolveInner(e+1);return i.parent&&i.from==e;}function ud(t,e,i){var s=t.charCategorizer(e);if(s(t.sliceDoc(e-1,e))!=kt.Word)return e;var _iterator223=_createForOfIteratorHelper(i),_step223;try{for(_iterator223.s();!(_step223=_iterator223.n()).done;){var _r155=_step223.value;var _i214=e-_r155.length;if(t.sliceDoc(_i214,e)==_r155&&s(t.sliceDoc(_i214-1,_i214))!=kt.Word)return _i214;}}catch(err){_iterator223.e(err);}finally{_iterator223.f();}return-1;}function fd(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[Oc,yc,rc.of(t),Cc,cd,Ec];}function md(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=null;return t.between(i,1e9,function(t,i,_ref60){var r=_ref60.spec;if(!e||r.diagnostic==e)return s=new dd(t,i,r.diagnostic),!1;}),s;}function yd(t,e,i){var _t$state$field=t.state.field(vd),s=_t$state$field.diagnostics,r=[],n=2e8,h=0;s.between(e-(i<0?1:0),e+(i>0?1:0),function(t,s,_ref61){var l=_ref61.spec;e>=t&&e<=s&&(t==s||(e>t||i>0)&&(e<s||i<0))&&(r.push(l.diagnostic),n=Math.min(t,n),h=Math.max(s,h));});var l=t.state.facet(Ad).tooltipFilter;return l&&(r=l(r,t.state)),r.length?{pos:n,end:h,above:t.state.doc.lineAt(n).to<h,create:function create(){return{dom:Md(t,r)};}}:null;}function Md(t,e){return Hf("ul",{"class":"cm-tooltip-lint"},e.map(function(e){return Dd(t,e,!1);}));}function Cd(t){var e=[];if(t){var _iterator225=_createForOfIteratorHelper(t),_step225;try{t:for(_iterator225.s();!(_step225=_iterator225.n()).done;){var _i217=_step225.value.name;var _loop17=function _loop17(){var s=_i217[_t292];if(/[a-zA-Z]/.test(s)&&!e.some(function(t){return t.toLowerCase()==s.toLowerCase();})){e.push(s);return 1;// continue t
2
- }};for(var _t292=0;_t292<_i217.length;_t292++){if(_loop17())continue t;}e.push("");}}catch(err){_iterator225.e(err);}finally{_iterator225.f();}}return e;}function Dd(t,e,i){var s;var r=i?Cd(e.actions):[];return Hf("li",{"class":"cm-diagnostic cm-diagnostic-"+e.severity},Hf("span",{"class":"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),null===(s=e.actions)||void 0===s?void 0:s.map(function(i,s){var n=!1,h=function h(s){if(s.preventDefault(),n)return;n=!0;var r=md(t.state.field(vd).diagnostics,e);r&&i.apply(t,r.from,r.to);},l=i.name,o=r[s]?l.indexOf(r[s]):-1,u=o<0?l:[l.slice(0,o),Hf("u",l.slice(o,o+1)),l.slice(o+1)];return Hf("button",{type:"button","class":"cm-diagnosticAction",onclick:h,onmousedown:h,"aria-label":" Action: ".concat(l).concat(o<0?"":" (access key \"".concat(r[s],")\""),".")},u);}),e.source&&Hf("div",{"class":"cm-diagnosticSource"},e.source));}function Rd(t){return function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'viewBox="0 0 40 40"';return"url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" ".concat(e,">").concat(encodeURIComponent(t),"</svg>')");}("<path d=\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\" stroke=\"".concat(t,"\" fill=\"none\" stroke-width=\".7\"/>"),'width="6" height="3"');}_export({c:go,d:co,g:vo,j:Ga,k:Ja,l:Fl,n:Uc,p:zl,r:Dh,s:pl,w:fd,I:void 0});return{setters:[],execute:function execute(){t=/*#__PURE__*/function(){function t(){_classCallCheck(this,t);}return _createClass(t,[{key:"lineAt",value:function lineAt(_t2){if(_t2<0||_t2>this.length)throw new RangeError("Invalid position ".concat(_t2," in document of length ").concat(this.length));return this.lineInner(_t2,!1,1,0);}},{key:"line",value:function line(_t3){if(_t3<1||_t3>this.lines)throw new RangeError("Invalid line number ".concat(_t3," in ").concat(this.lines,"-line document"));return this.lineInner(_t3,!0,1,0);}},{key:"replace",value:function replace(_t4,e,s){var _u2=u(this,_t4,e);var _u3=_slicedToArray(_u2,2);_t4=_u3[0];e=_u3[1];var r=[];return this.decompose(0,_t4,r,2),s.length&&s.decompose(0,s.length,r,3),this.decompose(e,this.length,r,1),i.from(r,this.length-(e-_t4)+s.length);}},{key:"append",value:function append(_t5){return this.replace(this.length,this.length,_t5);}},{key:"slice",value:function slice(_t6){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;var _u4=u(this,_t6,e);var _u5=_slicedToArray(_u4,2);_t6=_u5[0];e=_u5[1];var s=[];return this.decompose(_t6,e,s,0),i.from(s,e-_t6);}},{key:"eq",value:function eq(_t7){if(_t7==this)return!0;if(_t7.length!=this.length||_t7.lines!=this.lines)return!1;var e=this.scanIdentical(_t7,1),i=this.length-this.scanIdentical(_t7,-1),s=new n(this),r=new n(_t7);for(var _t13=e,_n2=e;;){if(s.next(_t13),r.next(_t13),_t13=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(_n2+=s.value.length,s.done||_n2>=i)return!0;}}},{key:"iter",value:function iter(){var _t9=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;return new n(this,_t9);}},{key:"iterRange",value:function iterRange(_t10){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;return new h(this,_t10,e);}},{key:"iterLines",value:function iterLines(_t11,e){var i;if(null==_t11)i=this.iter();else{null==e&&(e=this.lines+1);var _s2=this.line(_t11).from;i=this.iterRange(_s2,Math.max(_s2,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to));}return new l(i);}},{key:"toString",value:function toString(){return this.sliceString(0);}},{key:"toJSON",value:function toJSON(){var _t12=[];return this.flatten(_t12),_t12;}}],[{key:"of",value:function of(s){if(0==s.length)throw new RangeError("A document must have at least one line");return 1!=s.length||s[0]?s.length<=32?new e(s):i.from(e.split(s,[])):t.empty;}}]);}();e=/*#__PURE__*/function(_t14){function e(t){var _this;var _e2=arguments.length>1&&arguments[1]!==undefined?arguments[1]:function(t){var e=-1;var _iterator=_createForOfIteratorHelper(t),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _i2=_step.value;e+=_i2.length+1;}}catch(err){_iterator.e(err);}finally{_iterator.f();}return e;}(t);_classCallCheck(this,e);_this=_callSuper(this,e),_this.text=t,_this.length=_e2;return _this;}_inherits(e,_t14);return _createClass(e,[{key:"lines",get:function get(){return this.text.length;}},{key:"children",get:function get(){return null;}},{key:"lineInner",value:function lineInner(t,_e3,i,s){for(var _r2=0;;_r2++){var _n3=this.text[_r2],_h2=s+_n3.length;if((_e3?i:_h2)>=t)return new o(s,_h2,i,_n3);s=_h2+1,i++;}}},{key:"decompose",value:function decompose(t,i,n,h){var l=t<=0&&i>=this.length?this:new e(r(this.text,t,i),Math.min(i,this.length)-Math.max(0,t));if(1&h){var _t15=n.pop(),_i3=s(l.text,_t15.text.slice(),0,l.length);if(_i3.length<=32)n.push(new e(_i3,_t15.length+l.length));else{var _t16=_i3.length>>1;n.push(new e(_i3.slice(0,_t16)),new e(_i3.slice(_t16)));}}else n.push(l);}},{key:"replace",value:function replace(t,n,h){if(!(h instanceof e))return _get(_getPrototypeOf(e.prototype),"replace",this).call(this,t,n,h);var _u6=u(this,t,n);var _u7=_slicedToArray(_u6,2);t=_u7[0];n=_u7[1];var l=s(this.text,s(h.text,r(this.text,0,t)),n),o=this.length+h.length-(n-t);return l.length<=32?new e(l,o):i.from(e.split(l,[]),o);}},{key:"sliceString",value:function sliceString(t){var _e4=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"\n";var _u8=u(this,t,_e4);var _u9=_slicedToArray(_u8,2);t=_u9[0];_e4=_u9[1];var s="";for(var _r3=0,_n4=0;_r3<=_e4&&_n4<this.text.length;_n4++){var _h3=this.text[_n4],_l2=_r3+_h3.length;_r3>t&&_n4&&(s+=i),t<_l2&&_e4>_r3&&(s+=_h3.slice(Math.max(0,t-_r3),_e4-_r3)),_r3=_l2+1;}return s;}},{key:"flatten",value:function flatten(t){var _iterator2=_createForOfIteratorHelper(this.text),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _e5=_step2.value;t.push(_e5);}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}},{key:"scanIdentical",value:function scanIdentical(){return 0;}}],[{key:"split",value:function split(t,i){var s=[],r=-1;var _iterator3=_createForOfIteratorHelper(t),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _n5=_step3.value;s.push(_n5),r+=_n5.length+1,32==s.length&&(i.push(new e(s,r)),s=[],r=-1);}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}return r>-1&&i.push(new e(s,r)),i;}}]);}(t);i=/*#__PURE__*/function(_t17){function i(t,e){var _this2;_classCallCheck(this,i);_this2=_callSuper(this,i),_this2.children=t,_this2.length=e,_this2.lines=0;var _iterator4=_createForOfIteratorHelper(t),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _e6=_step4.value;_this2.lines+=_e6.lines;}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}return _this2;}_inherits(i,_t17);return _createClass(i,[{key:"lineInner",value:function lineInner(t,e,_i4,s){for(var _r4=0;;_r4++){var _n6=this.children[_r4],_h4=s+_n6.length,_l3=_i4+_n6.lines-1;if((e?_l3:_h4)>=t)return _n6.lineInner(t,e,_i4,s);s=_h4+1,_i4=_l3+1;}}},{key:"decompose",value:function decompose(t,e,_i5,s){for(var _r5=0,_n7=0;_n7<=e&&_r5<this.children.length;_r5++){var _h5=this.children[_r5],_l4=_n7+_h5.length;if(t<=_l4&&e>=_n7){var _r6=s&((_n7<=t?1:0)|(_l4>=e?2:0));_n7>=t&&_l4<=e&&!_r6?_i5.push(_h5):_h5.decompose(t-_n7,e-_n7,_i5,_r6);}_n7=_l4+1;}}},{key:"replace",value:function replace(t,e,s){var _u10,_u11;if((_u10=u(this,t,e),_u11=_slicedToArray(_u10,2),t=_u11[0],e=_u11[1]),s.lines<this.lines)for(var _r7=0,_n8=0;_r7<this.children.length;_r7++){var _h6=this.children[_r7],_l5=_n8+_h6.length;if(t>=_n8&&e<=_l5){var _o2=_h6.replace(t-_n8,e-_n8,s),_u12=this.lines-_h6.lines+_o2.lines;if(_o2.lines<_u12>>4&&_o2.lines>_u12>>6){var _n9=this.children.slice();return _n9[_r7]=_o2,new i(_n9,this.length-(e-t)+s.length);}return _get(_getPrototypeOf(i.prototype),"replace",this).call(this,_n8,_l5,_o2);}_n8=_l5+1;}return _get(_getPrototypeOf(i.prototype),"replace",this).call(this,t,e,s);}},{key:"sliceString",value:function sliceString(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;var _i6=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"\n";var _u13=u(this,t,e);var _u14=_slicedToArray(_u13,2);t=_u14[0];e=_u14[1];var s="";for(var _r8=0,_n10=0;_r8<this.children.length&&_n10<=e;_r8++){var _h7=this.children[_r8],_l6=_n10+_h7.length;_n10>t&&_r8&&(s+=_i6),t<_l6&&e>_n10&&(s+=_h7.sliceString(t-_n10,e-_n10,_i6)),_n10=_l6+1;}return s;}},{key:"flatten",value:function flatten(t){var _iterator5=_createForOfIteratorHelper(this.children),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _e7=_step5.value;_e7.flatten(t);}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}},{key:"scanIdentical",value:function scanIdentical(t,e){if(!(t instanceof i))return 0;var s=0,_ref=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1],_ref2=_slicedToArray(_ref,4),r=_ref2[0],n=_ref2[1],h=_ref2[2],l=_ref2[3];for(;;r+=e,n+=e){if(r==h||n==l)return s;var _i7=this.children[r],_o3=t.children[n];if(_i7!=_o3)return s+_i7.scanIdentical(_o3,e);s+=_i7.length+1;}}}],[{key:"from",value:function from(t){var s=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t.reduce(function(t,e){return t+e.length+1;},-1);var r=0;var _iterator6=_createForOfIteratorHelper(t),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _e10=_step6.value;r+=_e10.lines;}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}if(r<32){var _i8=[];var _iterator7=_createForOfIteratorHelper(t),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _e8=_step7.value;_e8.flatten(_i8);}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}return new e(_i8,s);}var n=Math.max(32,r>>5),h=n<<1,l=n>>1,o=[],u=0,f=-1,a=[];function c(t){var s;if(t.lines>h&&t instanceof i){var _iterator8=_createForOfIteratorHelper(t.children),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _e9=_step8.value;c(_e9);}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}else t.lines>l&&(u>l||!u)?(d(),o.push(t)):t instanceof e&&u&&(s=a[a.length-1])instanceof e&&t.lines+s.lines<=32?(u+=t.lines,f+=t.length+1,a[a.length-1]=new e(s.text.concat(t.text),s.length+1+t.length)):(u+t.lines>n&&d(),u+=t.lines,f+=t.length+1,a.push(t));}function d(){0!=u&&(o.push(1==a.length?a[0]:i.from(a,f)),f=-1,u=a.length=0);}var _iterator9=_createForOfIteratorHelper(t),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _e11=_step9.value;c(_e11);}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}return d(),1==o.length?o[0]:new i(o,s);}}]);}(t);t.empty=new e([""],0);n=/*#__PURE__*/function(){function n(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;_classCallCheck(this,n);this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[i>0?1:(t instanceof e?t.text.length:t.children.length)<<1];}return _createClass(n,[{key:"nextInner",value:function nextInner(t,i){for(this.done=this.lineBreak=!1;;){var _s3=this.nodes.length-1,_r10=this.nodes[_s3],_n12=this.offsets[_s3],_h9=_n12>>1,_l8=_r10 instanceof e?_r10.text.length:_r10.children.length;if(_h9==(i>0?_l8:0)){if(0==_s3)return this.done=!0,this.value="",this;i>0&&this.offsets[_s3-1]++,this.nodes.pop(),this.offsets.pop();}else if((1&_n12)==(i>0?0:1)){if(this.offsets[_s3]+=i,0==t)return this.lineBreak=!0,this.value="\n",this;t--;}else if(_r10 instanceof e){var _e12=_r10.text[_h9+(i<0?-1:0)];if(this.offsets[_s3]+=i,_e12.length>Math.max(0,t))return this.value=0==t?_e12:i>0?_e12.slice(t):_e12.slice(0,_e12.length-t),this;t-=_e12.length;}else{var _n13=_r10.children[_h9+(i<0?-1:0)];t>_n13.length?(t-=_n13.length,this.offsets[_s3]+=i):(i<0&&this.offsets[_s3]--,this.nodes.push(_n13),this.offsets.push(i>0?1:(_n13 instanceof e?_n13.text.length:_n13.children.length)<<1));}}}},{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir);}}]);}();h=/*#__PURE__*/function(){function h(t,e,i){_classCallCheck(this,h);this.value="",this.done=!1,this.cursor=new n(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i);}return _createClass(h,[{key:"nextInner",value:function nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);var i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;var _this$cursor$next=this.cursor.next(t),s=_this$cursor$next.value;return this.pos+=(s.length+t)*e,this.value=s.length<=i?s:e<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this;}},{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir);}},{key:"lineBreak",get:function get(){return this.cursor.lineBreak&&""!=this.value;}}]);}();l=/*#__PURE__*/function(){function l(t){_classCallCheck(this,l);this.inner=t,this.afterBreak=!0,this.value="",this.done=!1;}return _createClass(l,[{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var _this$inner$next=this.inner.next(t),e=_this$inner$next.done,i=_this$inner$next.lineBreak,s=_this$inner$next.value;return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this;}},{key:"lineBreak",get:function get(){return!1;}}]);}();"undefined"!=typeof Symbol&&(t.prototype[Symbol.iterator]=function(){return this.iter();},n.prototype[Symbol.iterator]=h.prototype[Symbol.iterator]=l.prototype[Symbol.iterator]=function(){return this;});o=/*#__PURE__*/function(){function o(t,e,i,s){_classCallCheck(this,o);this.from=t,this.to=e,this.number=i,this.text=s;}return _createClass(o,[{key:"length",get:function get(){return this.to-this.from;}}]);}();f="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(function(t){return t?parseInt(t,36):1;});for(_t18=1;_t18<f.length;_t18++)f[_t18]+=f[_t18-1];d=8205;M=/\r\n?|\n/;x=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t;}(x||(x={}));S=/*#__PURE__*/function(){function S(t){_classCallCheck(this,S);this.sections=t;}return _createClass(S,[{key:"length",get:function get(){var t=0;for(var _e14=0;_e14<this.sections.length;_e14+=2)t+=this.sections[_e14];return t;}},{key:"newLength",get:function get(){var t=0;for(var _e15=0;_e15<this.sections.length;_e15+=2){var _i10=this.sections[_e15+1];t+=_i10<0?this.sections[_e15]:_i10;}return t;}},{key:"empty",get:function get(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0;}},{key:"iterGaps",value:function iterGaps(t){for(var _e16=0,_i11=0,_s6=0;_e16<this.sections.length;){var _r12=this.sections[_e16++],_n14=this.sections[_e16++];_n14<0?(t(_i11,_s6,_r12),_s6+=_r12):_s6+=_n14,_i11+=_r12;}}},{key:"iterChangedRanges",value:function iterChangedRanges(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;O(this,t,e);}},{key:"invertedDesc",get:function get(){var t=[];for(var _e17=0;_e17<this.sections.length;){var _i12=this.sections[_e17++],_s7=this.sections[_e17++];_s7<0?t.push(_i12,_s7):t.push(_s7,_i12);}return new S(t);}},{key:"composeDesc",value:function composeDesc(t){return this.empty?t:t.empty?this:I(this,t);}},{key:"mapDesc",value:function mapDesc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return t.empty?this:E(this,t,e);}},{key:"mapPos",value:function mapPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:x.Simple;var s=0,r=0;for(var _n15=0;_n15<this.sections.length;){var _h10=this.sections[_n15++],_l9=this.sections[_n15++],_o5=s+_h10;if(_l9<0){if(_o5>t)return r+(t-s);r+=_h10;}else{if(i!=x.Simple&&_o5>=t&&(i==x.TrackDel&&s<t&&_o5>t||i==x.TrackBefore&&s<t||i==x.TrackAfter&&_o5>t))return null;if(_o5>t||_o5==t&&e<0&&!_h10)return t==s||e<0?r:r+_l9;r+=_l9;}s=_o5;}if(t>s)throw new RangeError("Position ".concat(t," is out of range for changeset of length ").concat(s));return r;}},{key:"touchesRange",value:function touchesRange(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;for(var _i13=0,_s8=0;_i13<this.sections.length&&_s8<=e;){var _r13=_s8+this.sections[_i13++];if(this.sections[_i13++]>=0&&_s8<=e&&_r13>=t)return!(_s8<t&&_r13>e)||"cover";_s8=_r13;}return!1;}},{key:"toString",value:function toString(){var t="";for(var _e18=0;_e18<this.sections.length;){var _i14=this.sections[_e18++],_s9=this.sections[_e18++];t+=(t?" ":"")+_i14+(_s9>=0?":"+_s9:"");}return t;}},{key:"toJSON",value:function toJSON(){return this.sections;}}],[{key:"fromJSON",value:function fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(function(t){return"number"!=typeof t;}))throw new RangeError("Invalid JSON representation of ChangeDesc");return new S(t);}},{key:"create",value:function create(t){return new S(t);}}]);}();A=/*#__PURE__*/function(_S){function A(t,e){var _this3;_classCallCheck(this,A);_this3=_callSuper(this,A,[t]),_this3.inserted=e;return _this3;}_inherits(A,_S);return _createClass(A,[{key:"apply",value:function apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return O(this,function(e,i,s,r,n){return t=t.replace(s,s+(i-e),n);},!1),t;}},{key:"mapDesc",value:function mapDesc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return E(this,t,e,!0);}},{key:"invert",value:function invert(e){var i=this.sections.slice(),s=[];for(var _r14=0,_n16=0;_r14<i.length;_r14+=2){var _h11=i[_r14],_l10=i[_r14+1];if(_l10>=0){i[_r14]=_l10,i[_r14+1]=_h11;var _o6=_r14>>1;for(;s.length<_o6;)s.push(t.empty);s.push(_h11?e.slice(_n16,_n16+_h11):t.empty);}_n16+=_h11;}return new A(i,s);}},{key:"compose",value:function compose(t){return this.empty?t:t.empty?this:I(this,t,!0);}},{key:"map",value:function map(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return t.empty?this:E(this,t,e,!0);}},{key:"iterChanges",value:function iterChanges(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;O(this,t,e);}},{key:"desc",get:function get(){return S.create(this.sections);}},{key:"filter",value:function filter(t){var e=[],i=[],s=[],r=new R(this);t:for(var _n17=0,_h12=0;;){var _l11=_n17==t.length?1e9:t[_n17++];for(;_h12<_l11||_h12==_l11&&0==r.len;){if(r.done)break t;var _t19=Math.min(r.len,_l11-_h12);C(s,_t19,-1);var _n18=-1==r.ins?-1:0==r.off?r.ins:0;C(e,_t19,_n18),_n18>0&&D(i,e,r.text),r.forward(_t19),_h12+=_t19;}var _o7=t[_n17++];for(;_h12<_o7;){if(r.done)break t;var _t20=Math.min(r.len,_o7-_h12);C(e,_t20,-1),C(s,_t20,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(_t20),_h12+=_t20;}}return{changes:new A(e,i),filtered:S.create(s)};}},{key:"toJSON",value:function toJSON(){var t=[];for(var _e19=0;_e19<this.sections.length;_e19+=2){var _i15=this.sections[_e19],_s10=this.sections[_e19+1];_s10<0?t.push(_i15):0==_s10?t.push([_i15]):t.push([_i15].concat(this.inserted[_e19>>1].toJSON()));}return t;}}],[{key:"of",value:function of(e,i,s){var r=[],n=[],h=0,l=null;function o(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;if(!t&&!r.length)return;h<i&&C(r,i-h,-1);var e=new A(r,n);l=l?l.compose(e.map(l)):e,r=[],n=[],h=0;}return function e(u){if(Array.isArray(u)){var _iterator10=_createForOfIteratorHelper(u),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var _t21=_step10.value;e(_t21);}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}else if(u instanceof A){if(u.length!=i)throw new RangeError("Mismatched change set length (got ".concat(u.length,", expected ").concat(i,")"));o(),l=l?l.compose(u.map(l)):u;}else{var _e20=u.from,_u$to=u.to,_l12=_u$to===void 0?_e20:_u$to,_f2=u.insert;if(_e20>_l12||_e20<0||_l12>i)throw new RangeError("Invalid change range ".concat(_e20," to ").concat(_l12," (in doc of length ").concat(i,")"));var _a2=_f2?"string"==typeof _f2?t.of(_f2.split(s||M)):_f2:t.empty,_c2=_a2.length;if(_e20==_l12&&0==_c2)return;_e20<h&&o(),_e20>h&&C(r,_e20-h,-1),C(r,_l12-_e20,_c2),D(n,r,_a2),h=_l12;}}(e),o(!l),l;}},{key:"empty",value:function empty(t){return new A(t?[t,-1]:[],[]);}},{key:"fromJSON",value:function fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");var i=[],s=[];for(var _r15=0;_r15<e.length;_r15++){var _n19=e[_r15];if("number"==typeof _n19)i.push(_n19,-1);else{if(!Array.isArray(_n19)||"number"!=typeof _n19[0]||_n19.some(function(t,e){return e&&"string"!=typeof t;}))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==_n19.length)i.push(_n19[0],0);else{for(;s.length<_r15;)s.push(t.empty);s[_r15]=t.of(_n19.slice(1)),i.push(_n19[0],s[_r15].length);}}}return new A(i,s);}},{key:"createSet",value:function createSet(t,e){return new A(t,e);}}]);}(S);R=/*#__PURE__*/function(){function R(t){_classCallCheck(this,R);this.set=t,this.i=0,this.next();}return _createClass(R,[{key:"next",value:function next(){var t=this.set.sections;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0;}},{key:"done",get:function get(){return-2==this.ins;}},{key:"len2",get:function get(){return this.ins<0?this.len:this.ins;}},{key:"text",get:function get(){var e=this.set.inserted,i=this.i-2>>1;return i>=e.length?t.empty:e[i];}},{key:"textBit",value:function textBit(e){var i=this.set.inserted,s=this.i-2>>1;return s>=i.length&&!e?t.empty:i[s].slice(this.off,null==e?void 0:this.off+e);}},{key:"forward",value:function forward(t){t==this.len?this.next():(this.len-=t,this.off+=t);}},{key:"forward2",value:function forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t);}}]);}();T=/*#__PURE__*/function(){function T(t,e,i){_classCallCheck(this,T);this.from=t,this.to=e,this.flags=i;}return _createClass(T,[{key:"anchor",get:function get(){return 32&this.flags?this.to:this.from;}},{key:"head",get:function get(){return 32&this.flags?this.from:this.to;}},{key:"empty",get:function get(){return this.from==this.to;}},{key:"assoc",get:function get(){return 8&this.flags?-1:16&this.flags?1:0;}},{key:"bidiLevel",get:function get(){var t=7&this.flags;return 7==t?null:t;}},{key:"goalColumn",get:function get(){var t=this.flags>>6;return 16777215==t?void 0:t;}},{key:"map",value:function map(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;var i,s;return this.empty?i=s=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),s=t.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new T(i,s,this.flags);}},{key:"extend",value:function extend(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(t<=this.anchor&&e>=this.anchor)return B.range(t,e);var i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return B.range(this.anchor,i);}},{key:"eq",value:function eq(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return!(this.anchor!=t.anchor||this.head!=t.head||e&&this.empty&&this.assoc!=t.assoc);}},{key:"toJSON",value:function toJSON(){return{anchor:this.anchor,head:this.head};}}],[{key:"fromJSON",value:function fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return B.range(t.anchor,t.head);}},{key:"create",value:function create(t,e,i){return new T(t,e,i);}}]);}();_export("m",B=/*#__PURE__*/function(){function B(t,e){_classCallCheck(this,B);this.ranges=t,this.mainIndex=e;}return _createClass(B,[{key:"map",value:function map(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;return t.empty?this:B.create(this.ranges.map(function(i){return i.map(t,e);}),this.mainIndex);}},{key:"eq",value:function eq(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(var _i20=0;_i20<this.ranges.length;_i20++)if(!this.ranges[_i20].eq(t.ranges[_i20],e))return!1;return!0;}},{key:"main",get:function get(){return this.ranges[this.mainIndex];}},{key:"asSingle",value:function asSingle(){return 1==this.ranges.length?this:new B([this.main],0);}},{key:"addRange",value:function addRange(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;return B.create([t].concat(this.ranges),e?0:this.mainIndex+1);}},{key:"replaceRange",value:function replaceRange(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.mainIndex;var i=this.ranges.slice();return i[e]=t,B.create(i,this.mainIndex);}},{key:"toJSON",value:function toJSON(){return{ranges:this.ranges.map(function(t){return t.toJSON();}),main:this.mainIndex};}}],[{key:"fromJSON",value:function fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new B(t.ranges.map(function(t){return T.fromJSON(t);}),t.main);}},{key:"single",value:function single(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;return new B([B.range(t,e)],0);}},{key:"create",value:function create(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(0==t.length)throw new RangeError("A selection needs at least one range");for(var _i21=0,_s11=0;_s11<t.length;_s11++){var _r16=t[_s11];if(_r16.empty?_r16.from<=_i21:_r16.from<_i21)return B.normalized(t.slice(),e);_i21=_r16.to;}return new B(t,e);}},{key:"cursor",value:function cursor(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2?arguments[2]:undefined;var s=arguments.length>3?arguments[3]:undefined;return T.create(t,t,(0==e?0:e<0?8:16)|(null==i?7:Math.min(6,i))|(null!=s?s:16777215)<<6);}},{key:"range",value:function range(t,e,i,s){var r=(null!=i?i:16777215)<<6|(null==s?7:Math.min(6,s));return e<t?T.create(e,t,48|r):T.create(t,e,(e>t?8:0)|r);}},{key:"normalized",value:function normalized(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=t[e];t.sort(function(t,e){return t.from-e.from;}),e=t.indexOf(i);for(var _i22=1;_i22<t.length;_i22++){var _s12=t[_i22],_r17=t[_i22-1];if(_s12.empty?_s12.from<=_r17.to:_s12.from<_r17.to){var _n21=_r17.from,_h14=Math.max(_s12.to,_r17.to);_i22<=e&&e--,t.splice(--_i22,2,_s12.anchor>_s12.head?B.range(_h14,_n21):B.range(_n21,_h14));}}return new B(t,e);}}]);}());N=0;$=/*#__PURE__*/function(){function $(t,e,i,s,r){_classCallCheck(this,$);this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=s,this.id=N++,this["default"]=t([]),this.extensions="function"==typeof r?r(this):r;}return _createClass($,[{key:"reader",get:function get(){return this;}},{key:"of",value:function of(t){return new z([],this,0,t);}},{key:"compute",value:function compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new z(t,this,1,e);}},{key:"computeN",value:function computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new z(t,this,2,e);}},{key:"from",value:function from(t,e){return e||(e=function e(t){return t;}),this.compute([t],function(i){return e(i.field(t));});}}],[{key:"define",value:function define(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new $(t.combine||function(t){return t;},t.compareInput||function(t,e){return t===e;},t.compare||(t.combine?function(t,e){return t===e;}:j),!!t["static"],t.enables);}}]);}();z=/*#__PURE__*/function(){function z(t,e,i,s){_classCallCheck(this,z);this.dependencies=t,this.facet=e,this.type=i,this.value=s,this.id=N++;}return _createClass(z,[{key:"dynamicSlot",value:function dynamicSlot(t){var _this4=this;var e;var i=this.value,s=this.facet.compareInput,r=this.id,n=t[r]>>1,h=2==this.type,l=!1,o=!1,u=[];var _iterator12=_createForOfIteratorHelper(this.dependencies),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var _i24=_step12.value;"doc"==_i24?l=!0:"selection"==_i24?o=!0:1&(null!==(e=t[_i24.id])&&void 0!==e?e:1)||u.push(t[_i24.id]);}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}return{create:function create(t){return t.values[n]=i(t),1;},update:function update(t,e){if(l&&e.docChanged||o&&(e.docChanged||e.selection)||H(t,u)){var _e24=i(t);if(h?!P(_e24,t.values[n],s):!s(_e24,t.values[n]))return t.values[n]=_e24,1;}return 0;},reconfigure:function reconfigure(t,e){var l,o=e.config.address[r];if(null!=o){var _r18=et(e,o);if(_this4.dependencies.every(function(i){return i instanceof $?e.facet(i)===t.facet(i):!(i instanceof F)||e.field(i,!1)==t.field(i,!1);})||(h?P(l=i(t),_r18,s):s(l=i(t),_r18)))return t.values[n]=_r18,0;}else l=i(t);return t.values[n]=l,1;}};}}]);}();V=$.define({"static":!0});F=/*#__PURE__*/function(){function F(t,e,i,s,r){_classCallCheck(this,F);this.id=t,this.createF=e,this.updateF=i,this.compareF=s,this.spec=r,this.provides=void 0;}return _createClass(F,[{key:"create",value:function create(t){var _this5=this;var e=t.facet(V).find(function(t){return t.field==_this5;});return((null==e?void 0:e.create)||this.createF)(t);}},{key:"slot",value:function slot(t){var _this6=this;var e=t[this.id]>>1;return{create:function create(t){return t.values[e]=_this6.create(t),1;},update:function update(t,i){var s=t.values[e],r=_this6.updateF(s,i);return _this6.compareF(s,r)?0:(t.values[e]=r,1);},reconfigure:function reconfigure(t,i){return null!=i.config.address[_this6.id]?(t.values[e]=i.field(_this6),0):(t.values[e]=_this6.create(t),1);}};}},{key:"init",value:function init(t){return[this,V.of({field:this,create:t})];}},{key:"extension",get:function get(){return this;}}],[{key:"define",value:function define(t){var e=new F(N++,t.create,t.update,t.compare||function(t,e){return t===e;},t);return t.provide&&(e.provides=t.provide(e)),e;}}]);}();q=4;U=3;J=2;G=1;_={highest:K(0),high:K(G),"default":K(J),low:K(U),lowest:K(q)};X=/*#__PURE__*/_createClass(function X(t,e){_classCallCheck(this,X);this.inner=t,this.prec=e;});_export("C",Y=/*#__PURE__*/function(){function Y(){_classCallCheck(this,Y);}return _createClass(Y,[{key:"of",value:function of(t){return new Q(this,t);}},{key:"reconfigure",value:function reconfigure(t){return Y.reconfigure.of({compartment:this,extension:t});}},{key:"get",value:function get(t){return t.config.compartments.get(this);}}]);}());Q=/*#__PURE__*/_createClass(function Q(t,e){_classCallCheck(this,Q);this.compartment=t,this.inner=e;});Z=/*#__PURE__*/function(){function Z(t,e,i,s,r,n){_classCallCheck(this,Z);for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=n,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0);}return _createClass(Z,[{key:"staticFacet",value:function staticFacet(t){var e=this.address[t.id];return null==e?t["default"]:this.staticValues[e>>1];}}],[{key:"resolve",value:function resolve(t,e,i){var s=[],r=Object.create(null),n=new Map();var _iterator16=_createForOfIteratorHelper(function(t,e,i){var s=[[],[],[],[],[]],r=new Map();function n(t,h){var l=r.get(t);if(null!=l){if(l<=h)return;var _e27=s[l].indexOf(t);_e27>-1&&s[l].splice(_e27,1),t instanceof Q&&i["delete"](t.compartment);}if(r.set(t,h),Array.isArray(t)){var _iterator17=_createForOfIteratorHelper(t),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var _e28=_step17.value;n(_e28,h);}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}}else if(t instanceof Q){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");var _s16=e.get(t.compartment)||t.inner;i.set(t.compartment,_s16),n(_s16,h);}else if(t instanceof X)n(t.inner,t.prec);else if(t instanceof F)s[h].push(t),t.provides&&n(t.provides,h);else if(t instanceof z)s[h].push(t),t.facet.extensions&&n(t.facet.extensions,J);else{var _e29=t.extension;if(!_e29)throw new Error("Unrecognized extension value in extension set (".concat(t,"). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks."));n(_e29,h);}}return n(t,J),s.reduce(function(t,e){return t.concat(e);});}(t,e,n)),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var _i26=_step16.value;_i26 instanceof F?s.push(_i26):(r[_i26.facet.id]||(r[_i26.facet.id]=[])).push(_i26);}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}var h=Object.create(null),l=[],o=[];var _loop=function _loop(){var t=_s15[_i25];h[t.id]=o.length<<1,o.push(function(e){return t.slot(e);});};for(var _i25=0,_s15=s;_i25<_s15.length;_i25++){_loop();}var u=null==i?void 0:i.config.facets;var _loop2=function _loop2(){var e=r[_t27],s=e[0].facet,n=u&&u[_t27]||[];if(e.every(function(t){return 0==t.type;})){if(h[s.id]=l.length<<1|1,j(n,e))l.push(i.facet(s));else{var _t28=s.combine(e.map(function(t){return t.value;}));l.push(i&&s.compare(_t28,i.facet(s))?i.facet(s):_t28);}}else{var _iterator18=_createForOfIteratorHelper(e),_step18;try{var _loop3=function _loop3(){var t=_step18.value;0==t.type?(h[t.id]=l.length<<1|1,l.push(t.value)):(h[t.id]=o.length<<1,o.push(function(e){return t.dynamicSlot(e);}));};for(_iterator18.s();!(_step18=_iterator18.n()).done;){_loop3();}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}h[s.id]=o.length<<1,o.push(function(t){return W(t,s,e);});}};for(var _t27 in r){_loop2();}var f=o.map(function(t){return t(h);});return new Z(t,n,f,h,l,r);}}]);}();it=$.define();st=$.define({combine:function combine(t){return t.some(function(t){return t;});},"static":!0});rt=$.define({combine:function combine(t){return t.length?t[0]:void 0;},"static":!0});nt=$.define();ht=$.define();lt=$.define();ot=$.define({combine:function combine(t){return!!t.length&&t[0];}});ut=/*#__PURE__*/function(){function ut(t,e){_classCallCheck(this,ut);this.type=t,this.value=e;}return _createClass(ut,null,[{key:"define",value:function define(){return new ft();}}]);}();ft=/*#__PURE__*/function(){function ft(){_classCallCheck(this,ft);}return _createClass(ft,[{key:"of",value:function of(t){return new ut(this,t);}}]);}();at=/*#__PURE__*/function(){function at(t){_classCallCheck(this,at);this.map=t;}return _createClass(at,[{key:"of",value:function of(t){return new ct(this,t);}}]);}();ct=/*#__PURE__*/function(){function ct(t,e){_classCallCheck(this,ct);this.type=t,this.value=e;}return _createClass(ct,[{key:"map",value:function map(t){var e=this.type.map(this.value,t);return void 0===e?void 0:e==this.value?this:new ct(this.type,e);}},{key:"is",value:function is(t){return this.type==t;}}],[{key:"define",value:function define(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new at(t.map||function(t){return t;});}},{key:"mapEffects",value:function mapEffects(t,e){if(!t.length)return t;var i=[];var _iterator19=_createForOfIteratorHelper(t),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var _s17=_step19.value;var _t29=_s17.map(e);_t29&&i.push(_t29);}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}return i;}}]);}();ct.reconfigure=ct.define(),ct.appendConfig=ct.define();dt=/*#__PURE__*/function(){function dt(t,e,i,s,r,n){_classCallCheck(this,dt);this.startState=t,this.changes=e,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=n,this._doc=null,this._state=null,i&&L(i,e.newLength),r.some(function(t){return t.type==dt.time;})||(this.annotations=r.concat(dt.time.of(Date.now())));}return _createClass(dt,[{key:"newDoc",get:function get(){return this._doc||(this._doc=this.changes.apply(this.startState.doc));}},{key:"newSelection",get:function get(){return this.selection||this.startState.selection.map(this.changes);}},{key:"state",get:function get(){return this._state||this.startState.applyTransaction(this),this._state;}},{key:"annotation",value:function annotation(t){var _iterator20=_createForOfIteratorHelper(this.annotations),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var _e30=_step20.value;if(_e30.type==t)return _e30.value;}}catch(err){_iterator20.e(err);}finally{_iterator20.f();}}},{key:"docChanged",get:function get(){return!this.changes.empty;}},{key:"reconfigured",get:function get(){return this.startState.config!=this.state.config;}},{key:"isUserEvent",value:function isUserEvent(t){var e=this.annotation(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]));}}],[{key:"create",value:function create(t,e,i,s,r,n){return new dt(t,e,i,s,r,n);}}]);}();dt.time=ut.define(),dt.userEvent=ut.define(),dt.addToHistory=ut.define(),dt.remote=ut.define();bt=[];kt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t;}(kt||(kt={}));yt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{Mt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u");}catch(t){}_export("u",St=/*#__PURE__*/function(){function St(t,e,i,s,r,n){_classCallCheck(this,St);this.config=t,this.doc=e,this.selection=i,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=r,n&&(n._state=this);for(var _t30=0;_t30<this.config.dynamicSlots.length;_t30++)tt(this,_t30<<1);this.computeSlot=null;}return _createClass(St,[{key:"field",value:function field(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var i=this.config.address[t.id];if(null!=i)return tt(this,i),et(this,i);if(e)throw new RangeError("Field is not present in this state");}},{key:"update",value:function update(){for(var _len=arguments.length,t=new Array(_len),_key=0;_key<_len;_key++){t[_key]=arguments[_key];}return wt(this,t,!0);}},{key:"applyTransaction",value:function applyTransaction(t){var _this7=this;var e,i=this.config,_i30=i,s=_i30.base,r=_i30.compartments;var _iterator22=_createForOfIteratorHelper(t.effects),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var _e34=_step22.value;_e34.is(Y.reconfigure)?(i&&(r=new Map(),i.compartments.forEach(function(t,e){return r.set(e,t);}),i=null),r.set(_e34.value.compartment,_e34.value.extension)):_e34.is(ct.reconfigure)?(i=null,s=_e34.value):_e34.is(ct.appendConfig)&&(i=null,s=vt(s).concat(_e34.value));}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}if(i)e=t.startState.values.slice();else{i=Z.resolve(s,r,this),e=new St(i,this.doc,this.selection,i.dynamicSlots.map(function(){return null;}),function(t,e){return e.reconfigure(t,_this7);},null).values;}var n=t.startState.facet(st)?t.newSelection:t.newSelection.asSingle();new St(i,t.newDoc,n,e,function(e,i){return i.update(e,t);},t);}},{key:"replaceSelection",value:function replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange(function(e){return{changes:{from:e.from,to:e.to,insert:t},range:B.cursor(e.from+t.length)};});}},{key:"changeByRange",value:function changeByRange(t){var e=this.selection,i=t(e.ranges[0]),s=this.changes(i.changes),r=[i.range],n=vt(i.effects);for(var _i31=1;_i31<e.ranges.length;_i31++){var _h16=t(e.ranges[_i31]),_l14=this.changes(_h16.changes),_o9=_l14.map(s);for(var _t31=0;_t31<_i31;_t31++)r[_t31]=r[_t31].map(_o9);var _u16=s.mapDesc(_l14,!0);r.push(_h16.range.map(_u16)),s=s.compose(_o9),n=ct.mapEffects(n,_o9).concat(ct.mapEffects(vt(_h16.effects),_u16));}return{changes:s,selection:B.create(r,e.mainIndex),effects:n};}},{key:"changes",value:function changes(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];return t instanceof A?t:A.of(t,this.doc.length,this.facet(St.lineSeparator));}},{key:"toText",value:function toText(e){return t.of(e.split(this.facet(St.lineSeparator)||M));}},{key:"sliceDoc",value:function sliceDoc(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.doc.length;return this.doc.sliceString(t,e,this.lineBreak);}},{key:"facet",value:function facet(t){var e=this.config.address[t.id];return null==e?t["default"]:(tt(this,e),et(this,e));}},{key:"toJSON",value:function toJSON(t){var e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(var _i32 in t){var _s21=t[_i32];_s21 instanceof F&&null!=this.config.address[_s21.id]&&(e[_i32]=_s21.spec.toJSON(this.field(t[_i32]),this));}return e;}},{key:"tabSize",get:function get(){return this.facet(St.tabSize);}},{key:"lineBreak",get:function get(){return this.facet(St.lineSeparator)||"\n";}},{key:"readOnly",get:function get(){return this.facet(ot);}},{key:"phrase",value:function phrase(t){for(var _len2=arguments.length,e=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){e[_key2-1]=arguments[_key2];}var _iterator23=_createForOfIteratorHelper(this.facet(St.phrases)),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var _e35=_step23.value;if(Object.prototype.hasOwnProperty.call(_e35,t)){t=_e35[t];break;}}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}return e.length&&(t=t.replace(/\$(\$|\d*)/g,function(t,i){if("$"==i)return"$";var s=+(i||1);return!s||s>e.length?t:e[s-1];})),t;}},{key:"languageDataAt",value:function languageDataAt(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;var s=[];var _iterator24=_createForOfIteratorHelper(this.facet(it)),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var _r24=_step24.value;var _iterator25=_createForOfIteratorHelper(_r24(this,e,i)),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _n26=_step25.value;Object.prototype.hasOwnProperty.call(_n26,t)&&s.push(_n26[t]);}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}return s;}},{key:"charCategorizer",value:function charCategorizer(t){return xt(this.languageDataAt("wordChars",t).join(""));}},{key:"wordAt",value:function wordAt(t){var _this$doc$lineAt=this.doc.lineAt(t),e=_this$doc$lineAt.text,i=_this$doc$lineAt.from,s=_this$doc$lineAt.length,r=this.charCategorizer(t),n=t-i,h=t-i;for(;n>0;){var _t32=p(e,n,!1);if(r(e.slice(_t32,n))!=kt.Word)break;n=_t32;}for(;h<s;){var _t33=p(e,h);if(r(e.slice(h,_t33))!=kt.Word)break;h=_t33;}return n==h?null:B.range(n+i,h+i);}}],[{key:"fromJSON",value:function fromJSON(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var i=arguments.length>2?arguments[2]:undefined;if(!t||"string"!=typeof t.doc)throw new RangeError("Invalid JSON representation for EditorState");var s=[];if(i){var _loop4=function _loop4(){if(Object.prototype.hasOwnProperty.call(t,_e36)){var _r25=i[_e36],_n27=t[_e36];s.push(_r25.init(function(t){return _r25.spec.fromJSON(_n27,t);}));}};for(var _e36 in i){_loop4();}}return St.create({doc:t.doc,selection:B.fromJSON(t.selection),extensions:e.extensions?s.concat([e.extensions]):s});}},{key:"create",value:function create(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var i=Z.resolve(e.extensions||[],new Map()),s=e.doc instanceof t?e.doc:t.of((e.doc||"").split(i.staticFacet(St.lineSeparator)||M)),r=e.selection?e.selection instanceof B?e.selection:B.single(e.selection.anchor,e.selection.head):B.single(0);return L(r,s.length),i.staticFacet(st)||(r=r.asSingle()),new St(i,s,r,i.dynamicSlots.map(function(){return null;}),function(t,e){return e.create(t);},null);}}]);}());St.allowMultipleSelections=st,St.tabSize=$.define({combine:function combine(t){return t.length?t[0]:4;}}),St.lineSeparator=rt,St.readOnly=ot,St.phrases=$.define({compare:function compare(t,e){var i=Object.keys(t),s=Object.keys(e);return i.length==s.length&&i.every(function(i){return t[i]==e[i];});}}),St.languageData=it,St.changeFilter=nt,St.transactionFilter=ht,St.transactionExtender=lt,Y.reconfigure=ct.define();Ct=/*#__PURE__*/function(){function Ct(){_classCallCheck(this,Ct);}return _createClass(Ct,[{key:"eq",value:function eq(t){return this==t;}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;return Dt.create(t,e,this);}}]);}();Ct.prototype.startSide=Ct.prototype.endSide=0,Ct.prototype.point=!1,Ct.prototype.mapMode=x.TrackDel;Dt=/*#__PURE__*/function(){function t(_t36,e,i){_classCallCheck(this,t);this.from=_t36,this.to=e,this.value=i;}return _createClass(t,null,[{key:"create",value:function create(e,i,s){return new t(e,i,s);}}]);}();Et=/*#__PURE__*/function(){function Et(t,e,i,s){_classCallCheck(this,Et);this.from=t,this.to=e,this.value=i,this.maxPoint=s;}return _createClass(Et,[{key:"length",get:function get(){return this.to[this.to.length-1];}},{key:"findIndex",value:function findIndex(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=i?this.to:this.from;for(var _n29=s,_h17=r.length;;){if(_n29==_h17)return _n29;var _s22=_n29+_h17>>1,_l15=r[_s22]-t||(i?this.value[_s22].endSide:this.value[_s22].startSide)-e;if(_s22==_n29)return _l15>=0?_n29:_h17;_l15>=0?_h17=_s22:_n29=_s22+1;}}},{key:"between",value:function between(t,e,i,s){for(var _r27=this.findIndex(e,-1e9,!0),_n30=this.findIndex(i,1e9,!1,_r27);_r27<_n30;_r27++)if(!1===s(this.from[_r27]+t,this.to[_r27]+t,this.value[_r27]))return!1;}},{key:"map",value:function map(t,e){var i=[],s=[],r=[],n=-1,h=-1;for(var _l16=0;_l16<this.value.length;_l16++){var _o10=void 0,_u17=void 0,_f4=this.value[_l16],_a4=this.from[_l16]+t,_c4=this.to[_l16]+t;if(_a4==_c4){var _t37=e.mapPos(_a4,_f4.startSide,_f4.mapMode);if(null==_t37)continue;if(_o10=_u17=_t37,_f4.startSide!=_f4.endSide&&(_u17=e.mapPos(_a4,_f4.endSide),_u17<_o10))continue;}else if(_o10=e.mapPos(_a4,_f4.startSide),_u17=e.mapPos(_c4,_f4.endSide),_o10>_u17||_o10==_u17&&_f4.startSide>0&&_f4.endSide<=0)continue;(_u17-_o10||_f4.endSide-_f4.startSide)<0||(n<0&&(n=_o10),_f4.point&&(h=Math.max(h,_u17-_o10)),i.push(_f4),s.push(_o10-n),r.push(_u17-n));}return{mapped:i.length?new Et(s,r,i,h):null,pos:n};}}]);}();It=/*#__PURE__*/function(){function It(t,e,i,s){_classCallCheck(this,It);this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=s;}return _createClass(It,[{key:"length",get:function get(){var t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length);}},{key:"size",get:function get(){if(this.isEmpty)return 0;var t=this.nextLayer.size;var _iterator27=_createForOfIteratorHelper(this.chunk),_step27;try{for(_iterator27.s();!(_step27=_iterator27.n()).done;){var _e38=_step27.value;t+=_e38.value.length;}}catch(err){_iterator27.e(err);}finally{_iterator27.f();}return t;}},{key:"chunkEnd",value:function chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length;}},{key:"update",value:function update(t){var _t$add=t.add,e=_t$add===void 0?[]:_t$add,_t$sort=t.sort,i=_t$sort===void 0?!1:_t$sort,_t$filterFrom=t.filterFrom,s=_t$filterFrom===void 0?0:_t$filterFrom,_t$filterTo=t.filterTo,r=_t$filterTo===void 0?this.length:_t$filterTo,n=t.filter;if(0==e.length&&!n)return this;if(i&&(e=e.slice().sort(Ot)),this.isEmpty)return e.length?It.of(e):this;var h=new Bt(this,null,-1)["goto"](0),l=0,o=[],u=new Rt();for(;h.value||l<e.length;)if(l<e.length&&(h.from-e[l].from||h.startSide-e[l].value.startSide)>=0){var _t38=e[l++];u.addInner(_t38.from,_t38.to,_t38.value)||o.push(_t38);}else 1==h.rangeIndex&&h.chunkIndex<this.chunk.length&&(l==e.length||this.chunkEnd(h.chunkIndex)<e[l].from)&&(!n||s>this.chunkEnd(h.chunkIndex)||r<this.chunkPos[h.chunkIndex])&&u.addChunk(this.chunkPos[h.chunkIndex],this.chunk[h.chunkIndex])?h.nextChunk():((!n||s>h.to||r<h.from||n(h.from,h.to,h.value))&&(u.addInner(h.from,h.to,h.value)||o.push(Dt.create(h.from,h.to,h.value))),h.next());return u.finishInner(this.nextLayer.isEmpty&&!o.length?It.empty:this.nextLayer.update({add:o,filter:n,filterFrom:s,filterTo:r}));}},{key:"map",value:function map(t){if(t.empty||this.isEmpty)return this;var e=[],i=[],s=-1;for(var _r28=0;_r28<this.chunk.length;_r28++){var _n31=this.chunkPos[_r28],_h18=this.chunk[_r28],_l17=t.touchesRange(_n31,_n31+_h18.length);if(!1===_l17)s=Math.max(s,_h18.maxPoint),e.push(_h18),i.push(t.mapPos(_n31));else if(!0===_l17){var _h18$map=_h18.map(_n31,t),_r29=_h18$map.mapped,_l18=_h18$map.pos;_r29&&(s=Math.max(s,_r29.maxPoint),e.push(_r29),i.push(_l18));}}var r=this.nextLayer.map(t);return 0==e.length?r:new It(i,e,r||It.empty,s);}},{key:"between",value:function between(t,e,i){if(!this.isEmpty){for(var _s23=0;_s23<this.chunk.length;_s23++){var _r30=this.chunkPos[_s23],_n32=this.chunk[_s23];if(e>=_r30&&t<=_r30+_n32.length&&!1===_n32.between(_r30,t-_r30,e-_r30,i))return;}this.nextLayer.between(t,e,i);}}},{key:"iter",value:function iter(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return Lt.from([this])["goto"](t);}},{key:"isEmpty",get:function get(){return this.nextLayer==this;}}],[{key:"create",value:function create(t,e,i,s){return new It(t,e,i,s);}},{key:"iter",value:function iter(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Lt.from(t)["goto"](e);}},{key:"compare",value:function compare(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:-1;var n=t.filter(function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r;}),h=e.filter(function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r;}),l=Tt(n,h,i),o=new $t(n,l,r),u=new $t(h,l,r);i.iterGaps(function(t,e,i){return jt(o,t,u,e,i,s);}),i.empty&&0==i.length&&jt(o,0,u,0,0,s);}},{key:"eq",value:function eq(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3?arguments[3]:undefined;null==s&&(s=999999999);var r=t.filter(function(t){return!t.isEmpty&&e.indexOf(t)<0;}),n=e.filter(function(e){return!e.isEmpty&&t.indexOf(e)<0;});if(r.length!=n.length)return!1;if(!r.length)return!0;var h=Tt(r,n),l=new $t(r,h,0)["goto"](i),o=new $t(n,h,0)["goto"](i);for(;;){if(l.to!=o.to||!zt(l.active,o.active)||l.point&&(!o.point||!l.point.eq(o.point)))return!1;if(l.to>s)return!0;l.next(),o.next();}}},{key:"spans",value:function spans(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:-1;var n=new $t(t,null,r)["goto"](e),h=e,l=n.openStart;for(;;){var _t39=Math.min(n.to,i);if(n.point){var _i34=n.activeForPoint(n.to),_r31=n.pointFrom<e?_i34.length+1:n.point.startSide<0?_i34.length:Math.min(_i34.length,l);s.point(h,_t39,n.point,_i34,_r31,n.pointRank),l=Math.min(n.openEnd(_t39),_i34.length);}else _t39>h&&(s.span(h,_t39,n.active,l),l=n.openEnd(_t39));if(n.to>i)return l+(n.point&&n.to>i?1:0);h=n.to,n.next();}}},{key:"of",value:function of(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;var i=new Rt();var _iterator28=_createForOfIteratorHelper(t instanceof Dt?[t]:e?function(t){if(t.length>1)for(var _e39=t[0],_i35=1;_i35<t.length;_i35++){var _s24=t[_i35];if(Ot(_e39,_s24)>0)return t.slice().sort(Ot);_e39=_s24;}return t;}(t):t),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var _s25=_step28.value;i.add(_s25.from,_s25.to,_s25.value);}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}return i.finish();}},{key:"join",value:function join(t){if(!t.length)return It.empty;var e=t[t.length-1];for(var _i36=t.length-2;_i36>=0;_i36--)for(var _s26=t[_i36];_s26!=It.empty;_s26=_s26.nextLayer)e=new It(_s26.chunkPos,_s26.chunk,e,Math.max(_s26.maxPoint,e.maxPoint));return e;}}]);}();It.empty=new It([],[],null,-1),It.empty.nextLayer=It.empty;Rt=/*#__PURE__*/function(){function Rt(){_classCallCheck(this,Rt);this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null;}return _createClass(Rt,[{key:"finishChunk",value:function finishChunk(t){this.chunks.push(new Et(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[]);}},{key:"add",value:function add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Rt())).add(t,e,i);}},{key:"addInner",value:function addInner(t,e,i){var s=t-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(s<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0);}},{key:"addChunk",value:function addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);var i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0;}},{key:"finish",value:function finish(){return this.finishInner(It.empty);}},{key:"finishInner",value:function finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;var e=It.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e;}}]);}();Bt=/*#__PURE__*/function(){function Bt(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;_classCallCheck(this,Bt);this.layer=t,this.skip=e,this.minPoint=i,this.rank=s;}return _createClass(Bt,[{key:"startSide",get:function get(){return this.value?this.value.startSide:0;}},{key:"endSide",get:function get(){return this.value?this.value.endSide:0;}},{key:"goto",value:function goto(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this;}},{key:"gotoInner",value:function gotoInner(t,e,i){for(;this.chunkIndex<this.layer.chunk.length;){var _e42=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(_e42)||this.layer.chunkEnd(this.chunkIndex)<t||_e42.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1;}if(this.chunkIndex<this.layer.chunk.length){var _s27=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!i||this.rangeIndex<_s27)&&this.setRangeIndex(_s27);}this.next();}},{key:"forward",value:function forward(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0);}},{key:"next",value:function next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break;}{var _t42=this.layer.chunkPos[this.chunkIndex],_e43=this.layer.chunk[this.chunkIndex],_i37=_t42+_e43.from[this.rangeIndex];if(this.from=_i37,this.to=_t42+_e43.to[this.rangeIndex],this.value=_e43.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break;}}}},{key:"setRangeIndex",value:function setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0;}else this.rangeIndex=t;}},{key:"nextChunk",value:function nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next();}},{key:"compare",value:function compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide;}}]);}();Lt=/*#__PURE__*/function(){function Lt(t){_classCallCheck(this,Lt);this.heap=t;}return _createClass(Lt,[{key:"startSide",get:function get(){return this.value?this.value.startSide:0;}},{key:"goto",value:function goto(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1e9;var _iterator31=_createForOfIteratorHelper(this.heap),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var _i38=_step31.value;_i38["goto"](t,e);}}catch(err){_iterator31.e(err);}finally{_iterator31.f();}for(var _t43=this.heap.length>>1;_t43>=0;_t43--)Nt(this.heap,_t43);return this.next(),this;}},{key:"forward",value:function forward(t,e){var _iterator32=_createForOfIteratorHelper(this.heap),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var _i39=_step32.value;_i39.forward(t,e);}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}for(var _t44=this.heap.length>>1;_t44>=0;_t44--)Nt(this.heap,_t44);(this.to-t||this.value.endSide-e)<0&&this.next();}},{key:"next",value:function next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var _t45=this.heap[0];this.from=_t45.from,this.to=_t45.to,this.value=_t45.value,this.rank=_t45.rank,_t45.value&&_t45.next(),Nt(this.heap,0);}}}],[{key:"from",value:function from(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;var s=[];for(var _r32=0;_r32<t.length;_r32++)for(var _n34=t[_r32];!_n34.isEmpty;_n34=_n34.nextLayer)_n34.maxPoint>=i&&s.push(new Bt(_n34,e,i,_r32));return 1==s.length?s[0]:new Lt(s);}}]);}();$t=/*#__PURE__*/function(){function $t(t,e,i){_classCallCheck(this,$t);this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Lt.from(t,e,i);}return _createClass($t,[{key:"goto",value:function goto(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1e9;return this.cursor["goto"](t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this;}},{key:"forward",value:function forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e);}},{key:"removeActive",value:function removeActive(t){Pt(this.active,t),Pt(this.activeTo,t),Pt(this.activeRank,t),this.minActive=Wt(this.active,this.activeTo);}},{key:"addActive",value:function addActive(t){var e=0,_this$cursor=this.cursor,i=_this$cursor.value,s=_this$cursor.to,r=_this$cursor.rank;for(;e<this.activeRank.length&&(r-this.activeRank[e]||s-this.activeTo[e])>0;)e++;Ht(this.active,e,i),Ht(this.activeTo,e,s),Ht(this.activeRank,e,r),t&&Ht(t,e,this.cursor.from),this.minActive=Wt(this.active,this.activeTo);}},{key:"next",value:function next(){var t=this.to,e=this.point;this.point=null;var i=this.openStart<0?[]:null;for(;;){var _s29=this.minActive;if(_s29>-1&&(this.activeTo[_s29]-this.cursor.from||this.active[_s29].endSide-this.cursor.startSide)<0){if(this.activeTo[_s29]>t){this.to=this.activeTo[_s29],this.endSide=this.active[_s29].endSide;break;}this.removeActive(_s29),i&&Pt(i,_s29);}else{if(!this.cursor.value){this.to=this.endSide=1e9;break;}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break;}{var _t46=this.cursor.value;if(_t46.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=_t46,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=_t46.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break;}this.cursor.next();}else this.addActive(i),this.cursor.next();}}}if(i){this.openStart=0;for(var _e44=i.length-1;_e44>=0&&i[_e44]<t;_e44--)this.openStart++;}}},{key:"activeForPoint",value:function activeForPoint(t){if(!this.active.length)return this.active;var e=[];for(var _i41=this.active.length-1;_i41>=0&&!(this.activeRank[_i41]<this.pointRank);_i41--)(this.activeTo[_i41]>t||this.activeTo[_i41]==t&&this.active[_i41].endSide>=this.point.endSide)&&e.push(this.active[_i41]);return e.reverse();}},{key:"openEnd",value:function openEnd(t){var e=0;for(var _i42=this.activeTo.length-1;_i42>=0&&this.activeTo[_i42]>t;_i42--)e++;return e;}}]);}();qt="undefined"==typeof Symbol?"__ͼ":Symbol["for"]("ͼ");Ut="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet");Jt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};Gt=/*#__PURE__*/function(){function Gt(t,e){_classCallCheck(this,Gt);this.rules=[];var _ref3=e||{},i=_ref3.finish;function s(t){return /^@/.test(t)?[t]:t.split(/,\s*/);}function r(t,e,n,h){var l=[],o=/^@(\w+)\b/.exec(t[0]),u=o&&"keyframes"==o[1];if(o&&null==e)return n.push(t[0]+";");for(var _i46 in e){var _h19=e[_i46];if(/&/.test(_i46))r(_i46.split(/,\s*/).map(function(e){return t.map(function(t){return e.replace(/&/,t);});}).reduce(function(t,e){return t.concat(e);}),_h19,n);else if(_h19&&"object"==_typeof(_h19)){if(!o)throw new RangeError("The value of a property ("+_i46+") should be a primitive value.");r(s(_i46),_h19,l,u);}else null!=_h19&&l.push(_i46.replace(/_.*/,"").replace(/[A-Z]/g,function(t){return"-"+t.toLowerCase();})+": "+_h19+";");}(l.length||u)&&n.push((!i||o||h?t:t.map(i)).join(", ")+" {"+l.join(" ")+"}");}for(var _e46 in t)r(s(_e46),t[_e46],this.rules);}return _createClass(Gt,[{key:"getRules",value:function getRules(){return this.rules.join("\n");}}],[{key:"newName",value:function newName(){var t=Jt[qt]||1;return Jt[qt]=t+1,"ͼ"+t.toString(36);}},{key:"mount",value:function mount(t,e,i){var s=t[Ut],r=i&&i.nonce;s?r&&s.setNonce(r):s=new _t(t,r),s.mount(Array.isArray(e)?e:[e],t);}}]);}();Kt=new Map();_t=/*#__PURE__*/function(){function _t(t,e){_classCallCheck(this,_t);var i=t.ownerDocument||t,s=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){var _e47=Kt.get(i);if(_e47)return t[Ut]=_e47;this.sheet=new s.CSSStyleSheet(),Kt.set(i,this);}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[Ut]=this;}return _createClass(_t,[{key:"mount",value:function mount(t,e){var i=this.sheet,s=0,r=0;for(var _e48=0;_e48<t.length;_e48++){var _n35=t[_e48],_h20=this.modules.indexOf(_n35);if(_h20<r&&_h20>-1&&(this.modules.splice(_h20,1),r--,_h20=-1),-1==_h20){if(this.modules.splice(r++,0,_n35),i)for(var _t47=0;_t47<_n35.rules.length;_t47++)i.insertRule(_n35.rules[_t47],s++);}else{for(;r<_h20;)s+=this.modules[r++].rules.length;s+=_n35.rules.length,r++;}}if(i)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet].concat(_toConsumableArray(e.adoptedStyleSheets)));else{var _t48="";for(var _e49=0;_e49<this.modules.length;_e49++)_t48+=this.modules[_e49].getRules()+"\n";this.styleTag.textContent=_t48;var _i47=e.head||e;this.styleTag.parentNode!=_i47&&_i47.insertBefore(this.styleTag,_i47.firstChild);}}},{key:"setNonce",value:function setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t);}}]);}();for(Xt={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:"'"},Yt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Qt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Zt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),te=0;te<10;te++)Xt[48+te]=Xt[96+te]=String(te);for(te=1;te<=24;te++)Xt[te+111]="F"+te;for(te=65;te<=90;te++)Xt[te]=String.fromCharCode(te+32),Yt[te]=String.fromCharCode(te);for(ee in Xt)Yt.hasOwnProperty(ee)||(Yt[ee]=Xt[ee]);pe=/*#__PURE__*/function(){function pe(){_classCallCheck(this,pe);this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0;}return _createClass(pe,[{key:"eq",value:function eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset;}},{key:"setRange",value:function setRange(t){var e=t.anchorNode,i=t.focusNode;this.set(e,Math.min(t.anchorOffset,e?fe(e):0),i,Math.min(t.focusOffset,i?fe(i):0));}},{key:"set",value:function set(t,e,i,s){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=s;}}]);}();ge=null;Se=/*#__PURE__*/function(){function Se(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;_classCallCheck(this,Se);this.node=t,this.offset=e,this.precise=i;}return _createClass(Se,null,[{key:"before",value:function before(t,e){return new Se(t.parentNode,le(t),e);}},{key:"after",value:function after(t,e){return new Se(t.parentNode,le(t)+1,e);}}]);}();Ae=[];Ce=/*#__PURE__*/function(){function Ce(){_classCallCheck(this,Ce);this.parent=null,this.dom=null,this.flags=2;}return _createClass(Ce,[{key:"overrideDOMText",get:function get(){return null;}},{key:"posAtStart",get:function get(){return this.parent?this.parent.posBefore(this):0;}},{key:"posAtEnd",get:function get(){return this.posAtStart+this.length;}},{key:"posBefore",value:function posBefore(t){var e=this.posAtStart;var _iterator33=_createForOfIteratorHelper(this.children),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var _i53=_step33.value;if(_i53==t)return e;e+=_i53.length+_i53.breakAfter;}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}throw new RangeError("Invalid child in posBefore");}},{key:"posAfter",value:function posAfter(t){return this.posBefore(t)+t.length;}},{key:"sync",value:function sync(t,e){if(2&this.flags){var _i54,_s37=this.dom,_r39=null;var _iterator34=_createForOfIteratorHelper(this.children),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _n36=_step34.value;if(7&_n36.flags){if(!_n36.dom&&(_i54=_r39?_r39.nextSibling:_s37.firstChild)){var _t50=Ce.get(_i54);(!_t50||!_t50.parent&&_t50.canReuseDOM(_n36))&&_n36.reuseDOM(_i54);}_n36.sync(t,e),_n36.flags&=-8;}if(_i54=_r39?_r39.nextSibling:_s37.firstChild,e&&!e.written&&e.node==_s37&&_i54!=_n36.dom&&(e.written=!0),_n36.dom.parentNode==_s37)for(;_i54&&_i54!=_n36.dom;)_i54=De(_i54);else _s37.insertBefore(_n36.dom,_i54);_r39=_n36.dom;}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}for(_i54=_r39?_r39.nextSibling:_s37.firstChild,_i54&&e&&e.node==_s37&&(e.written=!0);_i54;)_i54=De(_i54);}else if(1&this.flags){var _iterator35=_createForOfIteratorHelper(this.children),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _i55=_step35.value;7&_i55.flags&&(_i55.sync(t,e),_i55.flags&=-8);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}}}},{key:"reuseDOM",value:function reuseDOM(t){}},{key:"localPosFromDOM",value:function localPosFromDOM(t,e){var i;if(t==this.dom)i=this.dom.childNodes[e];else{var _s38=0==fe(t)?0:0==e?-1:1;for(;;){var _e50=t.parentNode;if(_e50==this.dom)break;0==_s38&&_e50.firstChild!=_e50.lastChild&&(_s38=t==_e50.firstChild?-1:1),t=_e50;}i=_s38<0?t:t.nextSibling;}if(i==this.dom.firstChild)return 0;for(;i&&!Ce.get(i);)i=i.nextSibling;if(!i)return this.length;for(var _t51=0,_e51=0;;_t51++){var _s39=this.children[_t51];if(_s39.dom==i)return _e51;_e51+=_s39.length+_s39.breakAfter;}}},{key:"domBoundsAround",value:function domBoundsAround(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=-1,r=-1,n=-1,h=-1;for(var _l19=0,_o11=i,_u18=i;_l19<this.children.length;_l19++){var _i56=this.children[_l19],_f5=_o11+_i56.length;if(_o11<t&&_f5>e)return _i56.domBoundsAround(t,e,_o11);if(_f5>=t&&-1==s&&(s=_l19,r=_o11),_o11>e&&_i56.dom.parentNode==this.dom){n=_l19,h=_u18;break;}_u18=_f5,_o11=_f5+_i56.breakAfter;}return{from:r,to:h<0?i+this.length:h,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:n<this.children.length&&n>=0?this.children[n].dom:null};}},{key:"markDirty",value:function markDirty(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;this.flags|=2,this.markParentsDirty(t);}},{key:"markParentsDirty",value:function markParentsDirty(t){for(var _e52=this.parent;_e52;_e52=_e52.parent){if(t&&(_e52.flags|=2),1&_e52.flags)return;_e52.flags|=1,t=!1;}}},{key:"setParent",value:function setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0));}},{key:"setDOM",value:function setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this);}},{key:"rootView",get:function get(){for(var _t52=this;;){var _e53=_t52.parent;if(!_e53)return _t52;_t52=_e53;}}},{key:"replaceChildren",value:function replaceChildren(t,e){var _this$children;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:Ae;this.markDirty();for(var _s40=t;_s40<e;_s40++){var _t53=this.children[_s40];_t53.parent==this&&i.indexOf(_t53)<0&&_t53.destroy();}(_this$children=this.children).splice.apply(_this$children,[t,e-t].concat(_toConsumableArray(i)));for(var _t54=0;_t54<i.length;_t54++)i[_t54].setParent(this);}},{key:"ignoreMutation",value:function ignoreMutation(t){return!1;}},{key:"ignoreEvent",value:function ignoreEvent(t){return!1;}},{key:"childCursor",value:function childCursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.length;return new Oe(this.children,t,this.children.length);}},{key:"childPos",value:function childPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;return this.childCursor().findPos(t,e);}},{key:"toString",value:function toString(){var t=this.constructor.name.replace("View","");return t+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==t?this.text:this.length)+"]":"")+(this.breakAfter?"#":"");}},{key:"isEditable",get:function get(){return!0;}},{key:"isWidget",get:function get(){return!1;}},{key:"isHidden",get:function get(){return!1;}},{key:"merge",value:function merge(t,e,i,s,r,n){return!1;}},{key:"become",value:function become(t){return!1;}},{key:"canReuseDOM",value:function canReuseDOM(t){return t.constructor==this.constructor&&!(8&(this.flags|t.flags));}},{key:"getSide",value:function getSide(){return 0;}},{key:"destroy",value:function destroy(){var _iterator36=_createForOfIteratorHelper(this.children),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _t55=_step36.value;_t55.parent==this&&_t55.destroy();}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}this.parent=null;}}],[{key:"get",value:function get(t){return t.cmView;}}]);}();Ce.prototype.breakAfter=0;Oe=/*#__PURE__*/function(){function Oe(t,e,i){_classCallCheck(this,Oe);this.children=t,this.pos=e,this.i=i,this.off=0;}return _createClass(Oe,[{key:"findPos",value:function findPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]: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;var _i57=this.children[--this.i];this.pos-=_i57.length+_i57.breakAfter;}}}]);}();Re="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""};Te="undefined"!=typeof document?document:{documentElement:{style:{}}};Be=/Edge\/(\d+)/.exec(Re.userAgent);Le=/MSIE \d/.test(Re.userAgent);Ne=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Re.userAgent);$e=!!(Le||Ne||Be);je=!$e&&/gecko\/(\d+)/i.test(Re.userAgent);ze=!$e&&/Chrome\/(\d+)/.exec(Re.userAgent);Pe="webkitFontSmoothing"in Te.documentElement.style;He=!$e&&/Apple Computer/.test(Re.vendor);We=He&&(/Mobile\/\w+/.test(Re.userAgent)||Re.maxTouchPoints>2);Ve={mac:We||/Mac/.test(Re.platform),windows:/Win/.test(Re.platform),linux:/Linux|X11/.test(Re.platform),ie:$e,ie_version:Le?Te.documentMode||6:Ne?+Ne[1]:Be?+Be[1]:0,gecko:je,gecko_version:je?+(/Firefox\/(\d+)/.exec(Re.userAgent)||[0,0])[1]:0,chrome:!!ze,chrome_version:ze?+ze[1]:0,ios:We,android:/Android\b/.test(Re.userAgent),webkit:Pe,safari:He,webkit_version:Pe?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Te.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};Fe=/*#__PURE__*/function(_Ce){function Fe(t){var _this8;_classCallCheck(this,Fe);_this8=_callSuper(this,Fe),_this8.text=t;return _this8;}_inherits(Fe,_Ce);return _createClass(Fe,[{key:"length",get:function get(){return this.text.length;}},{key:"createDOM",value:function createDOM(t){this.setDOM(t||document.createTextNode(this.text));}},{key:"sync",value:function 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);}},{key:"reuseDOM",value:function reuseDOM(t){3==t.nodeType&&this.createDOM(t);}},{key:"merge",value:function merge(t,e,i){return!(8&this.flags||i&&(!(i instanceof Fe)||this.length-(e-t)+i.length>256||8&i.flags))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0);}},{key:"split",value:function split(t){var e=new Fe(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e;}},{key:"localPosFromDOM",value:function localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0;}},{key:"domAtPos",value:function domAtPos(t){return new Se(this.dom,t);}},{key:"domBoundsAround",value:function domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling};}},{key:"coordsAt",value:function coordsAt(t,e){return function(t,e,i){var s=t.nodeValue.length;e>s&&(e=s);var r=e,n=e,h=0;0==e&&i<0||e==s&&i>=0?Ve.chrome||Ve.gecko||(e?(r--,h=1):n<s&&(n++,h=-1)):i<0?r--:n<s&&n++;var l=be(t,r,n).getClientRects();if(!l.length)return null;var o=l[(h?h<0:i>=0)?0:l.length-1];Ve.safari&&!h&&0==o.width&&(o=Array.prototype.find.call(l,function(t){return t.width;})||o);return h?ae(o,h<0):o||null;}(this.dom,t,e);}}]);}(Ce);qe=/*#__PURE__*/function(_Ce2){function qe(t){var _this9;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_classCallCheck(this,qe);_this9=_callSuper(this,qe),_this9.mark=t,_this9.children=e,_this9.length=i;var _iterator38=_createForOfIteratorHelper(e),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var _t58=_step38.value;_t58.setParent(_this9);}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}return _this9;}_inherits(qe,_Ce2);return _createClass(qe,[{key:"setAttrs",value:function setAttrs(t){if(ke(t),this.mark["class"]&&(t.className=this.mark["class"]),this.mark.attrs)for(var _e54 in this.mark.attrs)t.setAttribute(_e54,this.mark.attrs[_e54]);return t;}},{key:"canReuseDOM",value:function canReuseDOM(t){return _get(_getPrototypeOf(qe.prototype),"canReuseDOM",this).call(this,t)&&!(8&(this.flags|t.flags));}},{key:"reuseDOM",value:function reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6);}},{key:"sync",value:function sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),_get(_getPrototypeOf(qe.prototype),"sync",this).call(this,t,e);}},{key:"merge",value:function merge(t,e,i,s,r,n){return(!i||!(!(i instanceof qe&&i.mark.eq(this.mark))||t&&r<=0||e<this.length&&n<=0))&&(Ie(this,t,e,i?i.children.slice():[],r-1,n-1),this.markDirty(),!0);}},{key:"split",value:function split(t){var e=[],i=0,s=-1,r=0;var _iterator39=_createForOfIteratorHelper(this.children),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var _n37=_step39.value;var _h21=i+_n37.length;_h21>t&&e.push(i<t?_n37.split(t-i):_n37),s<0&&i>=t&&(s=r),i=_h21,r++;}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}var n=this.length-t;return this.length=t,s>-1&&(this.children.length=s,this.markDirty()),new qe(this.mark,e,n);}},{key:"domAtPos",value:function domAtPos(t){return Ge(this,t);}},{key:"coordsAt",value:function coordsAt(t,e){return _e(this,t,e);}}]);}(Ce);Ue=/*#__PURE__*/function(_Ce3){function Ue(t,e,i){var _this10;_classCallCheck(this,Ue);_this10=_callSuper(this,Ue),_this10.widget=t,_this10.length=e,_this10.side=i,_this10.prevWidget=null;return _this10;}_inherits(Ue,_Ce3);return _createClass(Ue,[{key:"split",value:function split(t){var e=Ue.create(this.widget,this.length-t,this.side);return this.length-=t,e;}},{key:"sync",value:function sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"));}},{key:"getSide",value:function getSide(){return this.side;}},{key:"merge",value:function merge(t,e,i,s,r,n){return!(i&&(!(i instanceof Ue&&this.widget.compare(i.widget))||t>0&&r<=0||e<this.length&&n<=0))&&(this.length=t+(i?i.length:0)+(this.length-e),!0);}},{key:"become",value:function become(t){return t instanceof Ue&&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);}},{key:"ignoreMutation",value:function ignoreMutation(){return!0;}},{key:"ignoreEvent",value:function ignoreEvent(t){return this.widget.ignoreEvent(t);}},{key:"overrideDOMText",get:function get(){if(0==this.length)return t.empty;var e=this;for(;e.parent;)e=e.parent;var _e55=e,i=_e55.view,s=i&&i.state.doc,r=this.posAtStart;return s?s.slice(r,r+this.length):t.empty;}},{key:"domAtPos",value:function domAtPos(t){return(this.length?0==t:this.side>0)?Se.before(this.dom):Se.after(this.dom,t==this.length);}},{key:"domBoundsAround",value:function domBoundsAround(){return null;}},{key:"coordsAt",value:function coordsAt(t,e){var i=this.widget.coordsAt(this.dom,t,e);if(i)return i;var s=this.dom.getClientRects(),r=null;if(!s.length)return null;var n=this.side?this.side<0:t>0;for(var _e56=n?s.length-1:0;r=s[_e56],!(t>0?0==_e56:_e56==s.length-1||r.top<r.bottom);_e56+=n?-1:1);return ae(r,!n);}},{key:"isEditable",get:function get(){return!1;}},{key:"isWidget",get:function get(){return!0;}},{key:"isHidden",get:function get(){return this.widget.isHidden;}},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(Ue.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom);}}],[{key:"create",value:function create(t,e,i){return new Ue(t,e,i);}}]);}(Ce);Je=/*#__PURE__*/function(_Ce4){function Je(t){var _this11;_classCallCheck(this,Je);_this11=_callSuper(this,Je),_this11.side=t;return _this11;}_inherits(Je,_Ce4);return _createClass(Je,[{key:"length",get:function get(){return 0;}},{key:"merge",value:function merge(){return!1;}},{key:"become",value:function become(t){return t instanceof Je&&t.side==this.side;}},{key:"split",value:function split(){return new Je(this.side);}},{key:"sync",value:function sync(){if(!this.dom){var _t59=document.createElement("img");_t59.className="cm-widgetBuffer",_t59.setAttribute("aria-hidden","true"),this.setDOM(_t59);}}},{key:"getSide",value:function getSide(){return this.side;}},{key:"domAtPos",value:function domAtPos(t){return this.side>0?Se.before(this.dom):Se.after(this.dom);}},{key:"localPosFromDOM",value:function localPosFromDOM(){return 0;}},{key:"domBoundsAround",value:function domBoundsAround(){return null;}},{key:"coordsAt",value:function coordsAt(t){return this.dom.getBoundingClientRect();}},{key:"overrideDOMText",get:function get(){return t.empty;}},{key:"isHidden",get:function get(){return!0;}}]);}(Ce);Fe.prototype.children=Ue.prototype.children=Je.prototype.children=Ae;Ye=Object.create(null);ei=/*#__PURE__*/function(_Ce5){function ei(){var _this12;_classCallCheck(this,ei);_this12=_callSuper(this,ei,arguments),_this12.children=[],_this12.length=0,_this12.prevAttrs=void 0,_this12.attrs=null,_this12.breakAfter=0;return _this12;}_inherits(ei,_Ce5);return _createClass(ei,[{key:"merge",value:function merge(t,e,i,s,r,n){if(i){if(!(i instanceof ei))return!1;this.dom||i.transferDOM(this);}return s&&this.setDeco(i?i.attrs:null),Ie(this,t,e,i?i.children.slice():[],r,n),!0;}},{key:"split",value:function split(t){var e=new ei();if(e.breakAfter=this.breakAfter,0==this.length)return e;var _this$childPos=this.childPos(t),i=_this$childPos.i,s=_this$childPos.off;s&&(e.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(var _t63=i;_t63<this.children.length;_t63++)e.append(this.children[_t63],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;}},{key:"transferDOM",value:function 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);}},{key:"setDeco",value:function setDeco(t){Qe(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t);}},{key:"append",value:function append(t,e){Ke(this,t,e);}},{key:"addLineDeco",value:function addLineDeco(t){var e=t.spec.attributes,i=t.spec["class"];e&&(this.attrs=Xe(e,this.attrs||{})),i&&(this.attrs=Xe({"class":i},this.attrs||{}));}},{key:"domAtPos",value:function domAtPos(t){return Ge(this,t);}},{key:"reuseDOM",value:function reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6);}},{key:"sync",value:function sync(t,e){var i;this.dom?4&this.flags&&(ke(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&&(Ze(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),_get(_getPrototypeOf(ei.prototype),"sync",this).call(this,t,e);var s=this.dom.lastChild;for(;s&&Ce.get(s)instanceof qe;)s=s.lastChild;if(!(s&&this.length&&("BR"==s.nodeName||0!=(null===(i=Ce.get(s))||void 0===i?void 0:i.isEditable)||Ve.ios&&this.children.some(function(t){return t instanceof Fe;})))){var _t64=document.createElement("BR");_t64.cmIgnore=!0,this.dom.appendChild(_t64);}}},{key:"measureTextSize",value:function measureTextSize(){if(0==this.children.length||this.length>20)return null;var t,e=0;var _iterator40=_createForOfIteratorHelper(this.children),_step40;try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var _i61=_step40.value;if(!(_i61 instanceof Fe)||/[^ -~]/.test(_i61.text))return null;var _s43=ne(_i61.dom);if(1!=_s43.length)return null;e+=_s43[0].width,t=_s43[0].height;}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null;}},{key:"coordsAt",value:function coordsAt(t,e){var i=_e(this,t,e);if(!this.children.length&&i&&this.parent){var _t65=this.parent.view.viewState.heightOracle,_e59=i.bottom-i.top;if(Math.abs(_e59-_t65.lineHeight)<2&&_t65.textHeight<_e59){var _s44=(_e59-_t65.textHeight)/2;return{top:i.top+_s44,bottom:i.bottom-_s44,left:i.left,right:i.left};}}return i;}},{key:"become",value:function become(t){return!1;}},{key:"covers",value:function covers(){return!0;}}],[{key:"find",value:function find(t,e){for(var _i62=0,_s45=0;_i62<t.children.length;_i62++){var _r42=t.children[_i62],_n40=_s45+_r42.length;if(_n40>=e){if(_r42 instanceof ei)return _r42;if(_n40>e)break;}_s45=_n40+_r42.breakAfter;}return null;}}]);}(Ce);ii=/*#__PURE__*/function(_Ce6){function ii(t,e,i){var _this13;_classCallCheck(this,ii);_this13=_callSuper(this,ii),_this13.widget=t,_this13.length=e,_this13.deco=i,_this13.breakAfter=0,_this13.prevWidget=null;return _this13;}_inherits(ii,_Ce6);return _createClass(ii,[{key:"merge",value:function merge(t,e,i,s,r,n){return!(i&&(!(i instanceof ii&&this.widget.compare(i.widget))||t>0&&r<=0||e<this.length&&n<=0))&&(this.length=t+(i?i.length:0)+(this.length-e),!0);}},{key:"domAtPos",value:function domAtPos(t){return 0==t?Se.before(this.dom):Se.after(this.dom,t==this.length);}},{key:"split",value:function split(t){var e=this.length-t;this.length=t;var i=new ii(this.widget,e,this.deco);return i.breakAfter=this.breakAfter,i;}},{key:"children",get:function get(){return Ae;}},{key:"sync",value:function sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"));}},{key:"overrideDOMText",get:function get(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):t.empty;}},{key:"domBoundsAround",value:function domBoundsAround(){return null;}},{key:"become",value:function become(t){return t instanceof ii&&t.widget.constructor==this.widget.constructor&&(t.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,this.deco=t.deco,this.breakAfter=t.breakAfter,!0);}},{key:"ignoreMutation",value:function ignoreMutation(){return!0;}},{key:"ignoreEvent",value:function ignoreEvent(t){return this.widget.ignoreEvent(t);}},{key:"isEditable",get:function get(){return!1;}},{key:"isWidget",get:function get(){return!0;}},{key:"coordsAt",value:function coordsAt(t,e){return this.widget.coordsAt(this.dom,t,e);}},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(ii.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom);}},{key:"covers",value:function covers(t){var _this$deco=this.deco,e=_this$deco.startSide,i=_this$deco.endSide;return e!=i&&(t<0?e<0:i>0);}}]);}(Ce);si=/*#__PURE__*/function(){function si(){_classCallCheck(this,si);}return _createClass(si,[{key:"eq",value:function eq(t){return!1;}},{key:"updateDOM",value:function updateDOM(t,e){return!1;}},{key:"compare",value:function compare(t){return this==t||this.constructor==t.constructor&&this.eq(t);}},{key:"estimatedHeight",get:function get(){return-1;}},{key:"lineBreaks",get:function get(){return 0;}},{key:"ignoreEvent",value:function ignoreEvent(t){return!0;}},{key:"coordsAt",value:function coordsAt(t,e,i){return null;}},{key:"isHidden",get:function get(){return!1;}},{key:"editable",get:function get(){return!1;}},{key:"destroy",value:function destroy(t){}}]);}();ri=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t;}(ri||(ri={}));ni=/*#__PURE__*/function(_Ct){function ni(t,e,i,s){var _this14;_classCallCheck(this,ni);_this14=_callSuper(this,ni),_this14.startSide=t,_this14.endSide=e,_this14.widget=i,_this14.spec=s;return _this14;}_inherits(ni,_Ct);return _createClass(ni,[{key:"heightRelevant",get:function get(){return!1;}},{key:"hasHeight",value:function hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1;}}],[{key:"mark",value:function mark(t){return new hi(t);}},{key:"widget",value:function widget(t){var e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new oi(t,e,e,i,t.widget||null,!1);}},{key:"replace",value:function replace(t){var e,i,s=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{var _ui=ui(t,s),_r43=_ui.start,_n41=_ui.end;e=(_r43?s?-3e8:-1:5e8)-1,i=1+(_n41?s?2e8:1:-6e8);}return new oi(t,e,i,s,t.widget||null,!0);}},{key:"line",value:function line(t){return new li(t);}},{key:"set",value:function set(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return It.of(t,e);}}]);}(Ct);ni.none=It.empty;hi=/*#__PURE__*/function(_ni){function hi(t){var _this15;_classCallCheck(this,hi);var _ui2=ui(t),e=_ui2.start,i=_ui2.end;_this15=_callSuper(this,hi,[e?-1:5e8,i?1:-6e8,null,t]),_this15.tagName=t.tagName||"span",_this15["class"]=t["class"]||"",_this15.attrs=t.attributes||null;return _this15;}_inherits(hi,_ni);return _createClass(hi,[{key:"eq",value:function eq(t){var e,i;return this==t||t instanceof hi&&this.tagName==t.tagName&&(this["class"]||(null===(e=this.attrs)||void 0===e?void 0:e["class"]))==(t["class"]||(null===(i=t.attrs)||void 0===i?void 0:i["class"]))&&Qe(this.attrs,t.attrs,"class");}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(t>=e)throw new RangeError("Mark decorations may not be empty");return _get(_getPrototypeOf(hi.prototype),"range",this).call(this,t,e);}}]);}(ni);hi.prototype.point=!1;li=/*#__PURE__*/function(_ni2){function li(t){_classCallCheck(this,li);return _callSuper(this,li,[-2e8,-2e8,null,t]);}_inherits(li,_ni2);return _createClass(li,[{key:"eq",value:function eq(t){return t instanceof li&&this.spec["class"]==t.spec["class"]&&Qe(this.spec.attributes,t.spec.attributes);}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return _get(_getPrototypeOf(li.prototype),"range",this).call(this,t,e);}}]);}(ni);li.prototype.mapMode=x.TrackBefore,li.prototype.point=!0;oi=/*#__PURE__*/function(_ni3){function oi(t,e,i,s,r,n){var _this16;_classCallCheck(this,oi);_this16=_callSuper(this,oi,[e,i,r,t]),_this16.block=s,_this16.isReplace=n,_this16.mapMode=s?e<=0?x.TrackBefore:x.TrackAfter:x.TrackDel;return _this16;}_inherits(oi,_ni3);return _createClass(oi,[{key:"type",get:function get(){return this.startSide!=this.endSide?ri.WidgetRange:this.startSide<=0?ri.WidgetBefore:ri.WidgetAfter;}},{key:"heightRelevant",get:function get(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0);}},{key:"eq",value:function eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i;}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]: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 _get(_getPrototypeOf(oi.prototype),"range",this).call(this,t,e);}}]);}(ni);oi.prototype.point=!0;ai=/*#__PURE__*/function(){function ai(t,e,i,s){_classCallCheck(this,ai);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;}return _createClass(ai,[{key:"posCovered",value:function posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;var t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof ii&&t.deco.endSide<0);}},{key:"getLine",value:function getLine(){return this.curLine||(this.content.push(this.curLine=new ei()),this.atCursorPos=!0),this.curLine;}},{key:"flushBuffer",value:function flushBuffer(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(ci(new Je(-1),t),t.length),this.pendingBuffer=0);}},{key:"addBlockWidget",value:function addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t);}},{key:"finish",value:function finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||t&&this.content.length&&this.content[this.content.length-1]instanceof ii||this.getLine();}},{key:"buildText",value:function buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){var _this$cursor$next2=this.cursor.next(this.skip),_e60=_this$cursor$next2.value,_i63=_this$cursor$next2.lineBreak,_s46=_this$cursor$next2.done;if(this.skip=0,_s46)throw new Error("Ran out of text content when drawing inline views");if(_i63){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=_e60,this.textOff=0;}var _s47=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(ci(new Fe(this.text.slice(this.textOff,this.textOff+_s47)),e),i),this.atCursorPos=!0,this.textOff+=_s47,t-=_s47,i=0;}}},{key:"span",value:function span(t,e,i,s){this.buildText(e-t,i,s),this.pos=e,this.openStart<0&&(this.openStart=s);}},{key:"point",value:function point(t,e,i,s,r,n){if(this.disallowBlockEffectsFor[n]&&i instanceof oi){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");}var h=e-t;if(i instanceof oi){if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ii(i.widget||di.block,h,i));else{var _n42=Ue.create(i.widget||di.inline,h,h?0:i.startSide),_l20=this.atCursorPos&&!_n42.isEditable&&r<=s.length&&(t<e||i.startSide>0),_o13=!_n42.isEditable&&(t<e||r>s.length||i.startSide<=0),_u20=this.getLine();2!=this.pendingBuffer||_l20||_n42.isEditable||(this.pendingBuffer=0),this.flushBuffer(s),_l20&&(_u20.append(ci(new Je(1),s),r),r=s.length+Math.max(0,r-s.length)),_u20.append(ci(_n42,s),r),this.atCursorPos=_o13,this.pendingBuffer=_o13?t<e||r>s.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice());}}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);h&&(this.textOff+h<=this.text.length?this.textOff+=h:(this.skip+=h-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r);}}],[{key:"build",value:function build(t,e,i,s,r){var n=new ai(t,e,i,r);return n.openEnd=It.spans(s,e,i,n),n.openStart<0&&(n.openStart=n.openEnd),n.finish(n.openEnd),n;}}]);}();di=/*#__PURE__*/function(_si){function di(t){var _this17;_classCallCheck(this,di);_this17=_callSuper(this,di),_this17.tag=t;return _this17;}_inherits(di,_si);return _createClass(di,[{key:"eq",value:function eq(t){return t.tag==this.tag;}},{key:"toDOM",value:function toDOM(){return document.createElement(this.tag);}},{key:"updateDOM",value:function updateDOM(t){return t.nodeName.toLowerCase()==this.tag;}},{key:"isHidden",get:function get(){return!0;}}]);}(si);di.inline=new di("span"),di.block=new di("div");pi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t;}(pi||(pi={}));mi=pi.LTR;gi=pi.RTL;bi=wi("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008");vi=wi("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333");ki=Object.create(null);yi=[];for(_i66=0,_arr=["()","[]","{}"];_i66<_arr.length;_i66++){_t66=_arr[_i66];_e61=_t66.charCodeAt(0);_i67=_t66.charCodeAt(1);ki[_e61]=_i67,ki[_i67]=-_e61;}xi=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;Si=/*#__PURE__*/function(){function Si(t,e,i){_classCallCheck(this,Si);this.from=t,this.to=e,this.level=i;}return _createClass(Si,[{key:"dir",get:function get(){return this.level%2?gi:mi;}},{key:"side",value:function side(t,e){return this.dir==e==t?this.to:this.from;}},{key:"forward",value:function forward(t,e){return t==(this.dir==e);}}],[{key:"find",value:function find(t,e,i,s){var r=-1;for(var _n43=0;_n43<t.length;_n43++){var _h23=t[_n43];if(_h23.from<=e&&_h23.to>=e){if(_h23.level==i)return _n43;(r<0||(0!=s?s<0?_h23.from<e:_h23.to>e:t[r].level>_h23.level))&&(r=_n43);}}if(r<0)throw new RangeError("Index out of range");return r;}}]);}();Ci=[];Ii="";Bi=$.define();Li=$.define();Ni=$.define();$i=$.define();ji=$.define();zi=$.define();Pi=$.define();Hi=$.define({combine:function combine(t){return t.some(function(t){return t;});}});Wi=$.define({combine:function combine(t){return t.some(function(t){return t;});}});Vi=$.define();Fi=/*#__PURE__*/function(){function Fi(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"nearest";var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"nearest";var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:5;var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:5;var n=arguments.length>5&&arguments[5]!==undefined?arguments[5]:!1;_classCallCheck(this,Fi);this.range=t,this.y=e,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=n;}return _createClass(Fi,[{key:"map",value:function map(t){return t.empty?this:new Fi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot);}},{key:"clip",value:function clip(t){return this.range.to<=t.doc.length?this:new Fi(B.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot);}}]);}();qi=ct.define({map:function map(t,e){return t.map(e);}});Ji=$.define({combine:function combine(t){return!t.length||t[0];}});Gi=0;Ki=$.define();_i=/*#__PURE__*/function(){function _i(t,e,i,s,r){_classCallCheck(this,_i);this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=s,this.extension=r(this);}return _createClass(_i,null,[{key:"define",value:function define(t,e){var _ref4=e||{},i=_ref4.eventHandlers,s=_ref4.eventObservers,r=_ref4.provide,n=_ref4.decorations;return new _i(Gi++,t,i,s,function(t){var e=[Ki.of(t)];return n&&e.push(Zi.of(function(e){var i=e.plugin(t);return i?n(i):ni.none;})),r&&e.push(r(t)),e;});}},{key:"fromClass",value:function fromClass(t,e){return _i.define(function(e){return new t(e);},e);}}]);}();Xi=/*#__PURE__*/function(){function Xi(t){_classCallCheck(this,Xi);this.spec=t,this.mustUpdate=null,this.value=null;}return _createClass(Xi,[{key:"update",value:function update(t){if(this.value){if(this.mustUpdate){var _t75=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(_t75);}catch(e){if(Ui(_t75.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){Ui(t.state,e,"CodeMirror plugin crashed"),this.deactivate();}return this;}},{key:"destroy",value:function destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy();}catch(e){Ui(t.state,e,"CodeMirror plugin crashed");}}},{key:"deactivate",value:function deactivate(){this.spec=this.value=null;}}]);}();Yi=$.define();Qi=$.define();Zi=$.define();ts=$.define();es=$.define();is=$.define();rs=$.define();hs=$.define();ls=/*#__PURE__*/function(){function ls(t,e,i,s){_classCallCheck(this,ls);this.fromA=t,this.toA=e,this.fromB=i,this.toB=s;}return _createClass(ls,[{key:"join",value:function join(t){return new ls(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB));}},{key:"addToSet",value:function addToSet(t){var e=t.length,i=this;for(;e>0;e--){var _s54=t[e-1];if(!(_s54.fromA>i.toA)){if(_s54.toA<i.fromA)break;i=i.join(_s54),t.splice(e-1,1);}}return t.splice(e,0,i),t;}}],[{key:"extendWithRanges",value:function extendWithRanges(t,e){if(0==e.length)return t;var i=[];for(var _s55=0,_r50=0,_n49=0,_h31=0;;_s55++){var _l24=_s55==t.length?null:t[_s55],_o19=_n49-_h31,_u25=_l24?_l24.fromB:1e9;for(;_r50<e.length&&e[_r50]<_u25;){var _t78=e[_r50],_s56=e[_r50+1],_n50=Math.max(_h31,_t78),_l25=Math.min(_u25,_s56);if(_n50<=_l25&&new ls(_n50+_o19,_l25+_o19,_n50,_l25).addToSet(i),_s56>_u25)break;_r50+=2;}if(!_l24)return i;new ls(_l24.fromA,_l24.toA,_l24.fromB,_l24.toB).addToSet(i),_n49=_l24.toA,_h31=_l24.toB;}}}]);}();os=/*#__PURE__*/function(){function os(t,e,i){_classCallCheck(this,os);this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=A.empty(this.startState.doc.length);var _iterator43=_createForOfIteratorHelper(i),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var _t79=_step43.value;this.changes=this.changes.compose(_t79.changes);}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}var s=[];this.changes.iterChangedRanges(function(t,e,i,r){return s.push(new ls(t,e,i,r));}),this.changedRanges=s;}return _createClass(os,[{key:"viewportChanged",get:function get(){return(4&this.flags)>0;}},{key:"heightChanged",get:function get(){return(2&this.flags)>0;}},{key:"geometryChanged",get:function get(){return this.docChanged||(10&this.flags)>0;}},{key:"focusChanged",get:function get(){return(1&this.flags)>0;}},{key:"docChanged",get:function get(){return!this.changes.empty;}},{key:"selectionSet",get:function get(){return this.transactions.some(function(t){return t.selection;});}},{key:"empty",get:function get(){return 0==this.flags&&0==this.transactions.length;}}],[{key:"create",value:function create(t,e,i){return new os(t,e,i);}}]);}();us=/*#__PURE__*/function(_Ce7){function us(t){var _this18;_classCallCheck(this,us);_this18=_callSuper(this,us),_this18.view=t,_this18.decorations=[],_this18.dynamicDecorationMap=[],_this18.domChanged=null,_this18.hasComposition=null,_this18.markedForComposition=new Set(),_this18.lastCompositionAfterCursor=!1,_this18.minWidth=0,_this18.minWidthFrom=0,_this18.minWidthTo=0,_this18.impreciseAnchor=null,_this18.impreciseHead=null,_this18.forceSelection=!1,_this18.lastUpdate=Date.now(),_this18.setDOM(t.contentDOM),_this18.children=[new ei()],_this18.children[0].setParent(_assertThisInitialized(_this18)),_this18.updateDeco(),_this18.updateInner([new ls(0,0,0,t.state.doc.length)],0,null);return _this18;}_inherits(us,_Ce7);return _createClass(us,[{key:"length",get:function get(){return this.view.state.doc.length;}},{key:"update",value:function update(t){var _this19=this;var e;var i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(function(_ref5){var t=_ref5.fromA,e=_ref5.toA;return e<_this19.minWidthFrom||t>_this19.minWidthTo;})?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);var s=-1;this.view.inputState.composing>=0&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?s=this.domChanged.newSel.head:function(t,e){var i=!1;e&&t.iterChangedRanges(function(t,s){t<e.to&&s>e.from&&(i=!0);});return i;}(t.changes,this.hasComposition)||t.selectionSet||(s=t.state.selection.main.head));var r=s>-1?function(t,e,i){var s=as(t,i);if(!s)return null;var r=s.node,n=s.from,h=s.to,l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(t.state.doc.sliceString(s.from,s.to)!=l)return null;var o=e.invertedDesc,u=new ls(o.mapPos(n),o.mapPos(h),n,h),f=[];for(var _e72=r.parentNode;;_e72=_e72.parentNode){var _i76=Ce.get(_e72);if(_i76 instanceof qe)f.push({node:_e72,deco:_i76.mark});else{if(_i76 instanceof ei||"DIV"==_e72.nodeName&&_e72.parentNode==t.contentDOM)return{range:u,text:r,marks:f,line:_e72};if(_e72==t.contentDOM)return null;f.push({node:_e72,deco:new hi({inclusive:!0,attributes:ti(_e72),tagName:_e72.tagName.toLowerCase()})});}}}(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();var _this$hasComposition=this.hasComposition,_e73=_this$hasComposition.from,_s57=_this$hasComposition.to;i=new ls(_e73,_s57,t.changes.mapPos(_e73,-1),t.changes.mapPos(_s57,1)).addToSet(i.slice());}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Ve.ie||Ve.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);var n=function(t,e,i){var s=new cs();return It.compare(t,e,i,s),s.changes;}(this.decorations,this.updateDeco(),t.changes);return i=ls.extendWithRanges(i,n),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,t.startState.doc.length,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0);}},{key:"updateInner",value:function updateInner(t,e,i){var _this20=this;this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,i);var s=this.view.observer;s.ignore(function(){_this20.dom.style.height=_this20.view.viewState.contentHeight/_this20.view.scaleY+"px",_this20.dom.style.flexBasis=_this20.minWidth?_this20.minWidth+"px":"";var t=Ve.chrome||Ve.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;_this20.sync(_this20.view,t),_this20.flags&=-8,t&&(t.written||s.selectionRange.focusNode!=t.node)&&(_this20.forceSelection=!0),_this20.dom.style.height="";}),this.markedForComposition.forEach(function(t){return t.flags&=-9;});var r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){var _iterator44=_createForOfIteratorHelper(this.children),_step44;try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var _t80=_step44.value;_t80 instanceof ii&&_t80.widget instanceof fs&&r.push(_t80.dom);}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}}s.updateGaps(r);}},{key:"updateChildren",value:function updateChildren(t,e,i){var s=i?i.range.addToSet(t.slice()):t,r=this.childCursor(e);for(var _t81=s.length-1;;_t81--){var _e74=_t81>=0?s[_t81]:null;if(!_e74)break;var _n51=void 0,_h32=void 0,_l26=void 0,_o20=void 0,_u26=_e74.fromA,_f11=_e74.toA,_a8=_e74.fromB,_c7=_e74.toB;if(i&&i.range.fromB<_c7&&i.range.toB>_a8){var _t82=ai.build(this.view.state.doc,_a8,i.range.fromB,this.decorations,this.dynamicDecorationMap),_e75=ai.build(this.view.state.doc,i.range.toB,_c7,this.decorations,this.dynamicDecorationMap);_h32=_t82.breakAtStart,_l26=_t82.openStart,_o20=_e75.openEnd;var _s58=this.compositionView(i);_e75.breakAtStart?_s58.breakAfter=1:_e75.content.length&&_s58.merge(_s58.length,_s58.length,_e75.content[0],!1,_e75.openStart,0)&&(_s58.breakAfter=_e75.content[0].breakAfter,_e75.content.shift()),_t82.content.length&&_s58.merge(0,0,_t82.content[_t82.content.length-1],!0,0,_t82.openEnd)&&_t82.content.pop(),_n51=_t82.content.concat(_s58).concat(_e75.content);}else{var _ai$build=ai.build(this.view.state.doc,_a8,_c7,this.decorations,this.dynamicDecorationMap);_n51=_ai$build.content;_h32=_ai$build.breakAtStart;_l26=_ai$build.openStart;_o20=_ai$build.openEnd;}var _r$findPos=r.findPos(_f11,1),_d3=_r$findPos.i,_p3=_r$findPos.off,_r$findPos2=r.findPos(_u26,-1),_m=_r$findPos2.i,_g=_r$findPos2.off;Ee(this,_m,_g,_d3,_p3,_n51,_h32,_l26,_o20);}i&&this.fixCompositionDOM(i);}},{key:"compositionView",value:function compositionView(t){var e=new Fe(t.text.nodeValue);e.flags|=8;var _iterator45=_createForOfIteratorHelper(t.marks),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var _i77=_step45.value.deco;e=new qe(_i77,[e],e.length);}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}var i=new ei();return i.append(e,0),i;}},{key:"fixCompositionDOM",value:function fixCompositionDOM(t){var _this21=this;var e=function e(t,_e76){_e76.flags|=8|(_e76.children.some(function(t){return 7&t.flags;})?1:0),_this21.markedForComposition.add(_e76);var i=Ce.get(t);i&&i!=_e76&&(i.dom=null),_e76.setDOM(t);},i=this.childPos(t.range.fromB,1),s=this.children[i.i];e(t.line,s);for(var _r51=t.marks.length-1;_r51>=-1;_r51--)i=s.childPos(i.off,1),s=s.children[i.i],e(_r51>=0?t.marks[_r51].node:t.text,s);}},{key:"updateSelection",value:function updateSelection(){var _this22=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();var i=this.view.root.activeElement,s=i==this.dom,r=!s&&re(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||e||r))return;var n=this.forceSelection;this.forceSelection=!1;var h=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(h.anchor)),o=h.empty?l:this.moveToLine(this.domAtPos(h.head));if(Ve.gecko&&h.empty&&!this.hasComposition&&1==(u=l).node.nodeType&&u.node.firstChild&&(0==u.offset||"false"==u.node.childNodes[u.offset-1].contentEditable)&&(u.offset==u.node.childNodes.length||"false"==u.node.childNodes[u.offset].contentEditable)){var _t83=document.createTextNode("");this.view.observer.ignore(function(){return l.node.insertBefore(_t83,l.node.childNodes[l.offset]||null);}),l=o=new Se(_t83,0),n=!0;}var u;var f=this.view.observer.selectionRange;!n&&f.focusNode&&(he(l.node,l.offset,f.anchorNode,f.anchorOffset)&&he(o.node,o.offset,f.focusNode,f.focusOffset)||this.suppressWidgetCursorChange(f,h))||(this.view.observer.ignore(function(){Ve.android&&Ve.chrome&&_this22.dom.contains(f.focusNode)&&function(t,e){for(var _i78=t;_i78&&_i78!=e;_i78=_i78.assignedSlot||_i78.parentNode)if(1==_i78.nodeType&&"false"==_i78.contentEditable)return!0;return!1;}(f.focusNode,_this22.dom)&&(_this22.dom.blur(),_this22.dom.focus({preventScroll:!0}));var t=ie(_this22.view.root);if(t){if(h.empty){if(Ve.gecko){var _t84=(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(_t84&&3!=_t84){var _e77=(1==_t84?Me:xe)(l.node,l.offset);_e77&&(l=new Se(_e77.node,_e77.offset));}}t.collapse(l.node,l.offset),null!=h.bidiLevel&&void 0!==t.caretBidiLevel&&(t.caretBidiLevel=h.bidiLevel);}else if(t.extend){t.collapse(l.node,l.offset);try{t.extend(o.node,o.offset);}catch(t){}}else{var _ref6;var _e78=document.createRange();h.anchor>h.head&&(_ref6=[o,l],l=_ref6[0],o=_ref6[1],_ref6),_e78.setEnd(o.node,o.offset),_e78.setStart(l.node,l.offset),t.removeAllRanges(),t.addRange(_e78);}}else;var e,s;r&&_this22.view.root.activeElement==_this22.dom&&(_this22.dom.blur(),i&&i.focus());}),this.view.observer.setSelectionRange(l,o)),this.impreciseAnchor=l.precise?null:new Se(f.anchorNode,f.anchorOffset),this.impreciseHead=o.precise?null:new Se(f.focusNode,f.focusOffset);}},{key:"suppressWidgetCursorChange",value:function suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&he(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head;}},{key:"enforceCursorAssoc",value:function enforceCursorAssoc(){if(this.hasComposition)return;var t=this.view,e=t.state.selection.main,i=ie(t.root),_t$observer$selection=t.observer.selectionRange,s=_t$observer$selection.anchorNode,r=_t$observer$selection.anchorOffset;if(!(i&&e.empty&&e.assoc&&i.modify))return;var n=ei.find(this,e.head);if(!n)return;var h=n.posAtStart;if(e.head==h||e.head==h+n.length)return;var l=this.coordsAt(e.head,-1),o=this.coordsAt(e.head,1);if(!l||!o||l.bottom>o.top)return;var u=this.domAtPos(e.head+e.assoc);i.collapse(u.node,u.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();var f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=e.from&&i.collapse(s,r);}},{key:"moveToLine",value:function moveToLine(t){var e,i=this.dom;if(t.node!=i)return t;for(var _s59=t.offset;!e&&_s59<i.childNodes.length;_s59++){var _t85=Ce.get(i.childNodes[_s59]);_t85 instanceof ei&&(e=_t85.domAtPos(0));}for(var _s60=t.offset-1;!e&&_s60>=0;_s60--){var _t86=Ce.get(i.childNodes[_s60]);_t86 instanceof ei&&(e=_t86.domAtPos(_t86.length));}return e?new Se(e.node,e.offset,!0):t;}},{key:"nearest",value:function nearest(t){for(var _e79=t;_e79;){var _t87=Ce.get(_e79);if(_t87&&_t87.rootView==this)return _t87;_e79=_e79.parentNode;}return null;}},{key:"posFromDOM",value:function posFromDOM(t,e){var 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;}},{key:"domAtPos",value:function domAtPos(t){var _this$childCursor$fin=this.childCursor().findPos(t,-1),e=_this$childCursor$fin.i,i=_this$childCursor$fin.off;for(;e<this.children.length-1;){var _t88=this.children[e];if(i<_t88.length||_t88 instanceof ei)break;e++,i=0;}return this.children[e].domAtPos(i);}},{key:"coordsAt",value:function coordsAt(t,e){var i=null,s=0;for(var _r52=this.length,_n52=this.children.length-1;_n52>=0;_n52--){var _h33=this.children[_n52],_l27=_r52-_h33.breakAfter,_o21=_l27-_h33.length;if(_l27<t)break;_o21<=t&&(_o21<t||_h33.covers(-1))&&(_l27>t||_h33.covers(1))&&(!i||_h33 instanceof ei&&!(i instanceof ei&&e>=0))&&(i=_h33,s=_o21),_r52=_o21;}return i?i.coordsAt(t-s,e):null;}},{key:"coordsForChar",value:function coordsForChar(t){var _this$childPos2=this.childPos(t,1),e=_this$childPos2.i,i=_this$childPos2.off,s=this.children[e];if(!(s instanceof ei))return null;for(;s.children.length;){var _s$childPos=s.childPos(i,1),_t89=_s$childPos.i,_e80=_s$childPos.off;for(;;_t89++){if(_t89==s.children.length)return null;if((s=s.children[_t89]).length)break;}i=_e80;}if(!(s instanceof Fe))return null;var r=p(s.text,i);if(r==i)return null;var n=be(s.dom,i,r).getClientRects();for(var _t90=0;_t90<n.length;_t90++){var _e81=n[_t90];if(_t90==n.length-1||_e81.top<_e81.bottom&&_e81.left<_e81.right)return _e81;}return null;}},{key:"measureVisibleLineHeights",value:function measureVisibleLineHeights(t){var e=[],i=t.from,s=t.to,r=this.view.contentDOM.clientWidth,n=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,h=-1,l=this.view.textDirection==pi.LTR;for(var _t91=0,_o22=0;_o22<this.children.length;_o22++){var _u27=this.children[_o22],_f12=_t91+_u27.length;if(_f12>s)break;if(_t91>=i){var _i79=_u27.dom.getBoundingClientRect();if(e.push(_i79.height),n){var _e82=_u27.dom.lastChild,_s61=_e82?ne(_e82):[];if(_s61.length){var _e83=_s61[_s61.length-1],_n53=l?_e83.right-_i79.left:_i79.right-_e83.left;_n53>h&&(h=_n53,this.minWidth=r,this.minWidthFrom=_t91,this.minWidthTo=_f12);}}}_t91=_f12+_u27.breakAfter;}return e;}},{key:"textDirectionAt",value:function textDirectionAt(t){var _this$childPos3=this.childPos(t,1),e=_this$childPos3.i;return"rtl"==getComputedStyle(this.children[e].dom).direction?pi.RTL:pi.LTR;}},{key:"measureTextSize",value:function measureTextSize(){var _this23=this;var _iterator46=_createForOfIteratorHelper(this.children),_step46;try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){var _t92=_step46.value;if(_t92 instanceof ei){var _e84=_t92.measureTextSize();if(_e84)return _e84;}}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}var t,e,i,s=document.createElement("div");return s.className="cm-line",s.style.width="99999px",s.style.position="absolute",s.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(function(){_this23.dom.appendChild(s);var r=ne(s.firstChild)[0];t=s.getBoundingClientRect().height,e=r?r.width/27:7,i=r?r.height:t,s.remove();}),{lineHeight:t,charWidth:e,textHeight:i};}},{key:"childCursor",value:function childCursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.length;var e=this.children.length;return e&&(t-=this.children[--e].length),new Oe(this.children,t,e);}},{key:"computeBlockGapDeco",value:function computeBlockGapDeco(){var t=[],e=this.view.viewState;for(var _i80=0,_s62=0;;_s62++){var _r53=_s62==e.viewports.length?null:e.viewports[_s62],_n54=_r53?_r53.from-1:this.length;if(_n54>_i80){var _s63=(e.lineBlockAt(_n54).bottom-e.lineBlockAt(_i80).top)/this.view.scaleY;t.push(ni.replace({widget:new fs(_s63),block:!0,inclusive:!0,isBlockGap:!0}).range(_i80,_n54));}if(!_r53)break;_i80=_r53.to+1;}return ni.set(t);}},{key:"updateDeco",value:function updateDeco(){var _this24=this;var t=0,e=this.view.state.facet(Zi).map(function(e){return(_this24.dynamicDecorationMap[t++]="function"==typeof e)?e(_this24.view):e;}),i=!1,s=this.view.state.facet(ts).map(function(t,e){var s="function"==typeof t;return s&&(i=!0),s?t(_this24.view):t;});for(s.length&&(this.dynamicDecorationMap[t++]=i,e.push(It.join(s))),this.decorations=[].concat(_toConsumableArray(e),[this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]);t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;return this.decorations;}},{key:"scrollIntoView",value:function scrollIntoView(t){if(t.isSnapshot){var _e85=this.view.viewState.lineBlockAt(t.range.head);return this.view.scrollDOM.scrollTop=_e85.top-t.yMargin,void(this.view.scrollDOM.scrollLeft=t.xMargin);}var _iterator47=_createForOfIteratorHelper(this.view.state.facet(Vi)),_step47;try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){var _e88=_step47.value;try{if(_e88(this.view,t.range,t))return!0;}catch(t){Ui(this.view.state,t,"scroll handler");}}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}var e,i=t.range,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)});var r=ns(this.view),n={left:s.left-r.left,top:s.top-r.top,right:s.right+r.right,bottom:s.bottom+r.bottom},_this$view$scrollDOM=this.view.scrollDOM,h=_this$view$scrollDOM.offsetWidth,l=_this$view$scrollDOM.offsetHeight;!function(t,e,i,s,r,n,h,l){var o=t.ownerDocument,u=o.defaultView||window;for(var _f13=t,_a9=!1;_f13&&!_a9;)if(1==_f13.nodeType){var _t93=void 0,_c8=_f13==o.body,_d4=1,_p4=1;if(_c8)_t93=ce(u);else{var _de;if(/^(fixed|sticky)$/.test(getComputedStyle(_f13).position)&&(_a9=!0),_f13.scrollHeight<=_f13.clientHeight&&_f13.scrollWidth<=_f13.clientWidth){_f13=_f13.assignedSlot||_f13.parentNode;continue;}var _e86=_f13.getBoundingClientRect();(_de=de(_f13,_e86),_d4=_de.scaleX,_p4=_de.scaleY),_t93={left:_e86.left,right:_e86.left+_f13.clientWidth*_d4,top:_e86.top,bottom:_e86.top+_f13.clientHeight*_p4};}var _m2=0,_g2=0;if("nearest"==r)e.top<_t93.top?(_g2=-(_t93.top-e.top+h),i>0&&e.bottom>_t93.bottom+_g2&&(_g2=e.bottom-_t93.bottom+_g2+h)):e.bottom>_t93.bottom&&(_g2=e.bottom-_t93.bottom+h,i<0&&e.top-_g2<_t93.top&&(_g2=-(_t93.top+_g2-e.top+h)));else{var _s64=e.bottom-e.top,_n55=_t93.bottom-_t93.top;_g2=("center"==r&&_s64<=_n55?e.top+_s64/2-_n55/2:"start"==r||"center"==r&&i<0?e.top-h:e.bottom-_n55+h)-_t93.top;}if("nearest"==s?e.left<_t93.left?(_m2=-(_t93.left-e.left+n),i>0&&e.right>_t93.right+_m2&&(_m2=e.right-_t93.right+_m2+n)):e.right>_t93.right&&(_m2=e.right-_t93.right+n,i<0&&e.left<_t93.left+_m2&&(_m2=-(_t93.left+_m2-e.left+n))):_m2=("center"==s?e.left+(e.right-e.left)/2-(_t93.right-_t93.left)/2:"start"==s==l?e.left-n:e.right-(_t93.right-_t93.left)+n)-_t93.left,_m2||_g2)if(_c8)u.scrollBy(_m2,_g2);else{var _t94=0,_i81=0;if(_g2){var _t95=_f13.scrollTop;_f13.scrollTop+=_g2/_p4,_i81=(_f13.scrollTop-_t95)*_p4;}if(_m2){var _e87=_f13.scrollLeft;_f13.scrollLeft+=_m2/_d4,_t94=(_f13.scrollLeft-_e87)*_d4;}e={left:e.left-_t94,top:e.top-_i81,right:e.right-_t94,bottom:e.bottom-_i81},_t94&&Math.abs(_t94-_m2)<1&&(s="nearest"),_i81&&Math.abs(_i81-_g2)<1&&(r="nearest");}if(_c8)break;_f13=_f13.assignedSlot||_f13.parentNode;}else{if(11!=_f13.nodeType)break;_f13=_f13.host;}}(this.view.scrollDOM,n,i.head<i.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,h),-h),Math.max(Math.min(t.yMargin,l),-l),this.view.textDirection==pi.LTR);}}]);}(Ce);fs=/*#__PURE__*/function(_si2){function fs(t){var _this25;_classCallCheck(this,fs);_this25=_callSuper(this,fs),_this25.height=t;return _this25;}_inherits(fs,_si2);return _createClass(fs,[{key:"toDOM",value:function toDOM(){var t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t;}},{key:"eq",value:function eq(t){return t.height==this.height;}},{key:"updateDOM",value:function updateDOM(t){return t.style.height=this.height+"px",!0;}},{key:"editable",get:function get(){return!0;}},{key:"estimatedHeight",get:function get(){return this.height;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);cs=/*#__PURE__*/function(){function cs(){_classCallCheck(this,cs);this.changes=[];}return _createClass(cs,[{key:"compareRange",value:function compareRange(t,e){fi(t,e,this.changes);}},{key:"comparePoint",value:function comparePoint(t,e){fi(t,e,this.changes);}}]);}();Cs=/*#__PURE__*/function(){function Cs(t){_classCallCheck(this,Cs);this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,Ve.safari&&t.contentDOM.addEventListener("input",function(){return null;}),Ve.gecko&&function(t){Zs.has(t)||(Zs.add(t),t.addEventListener("copy",function(){}),t.addEventListener("cut",function(){}));}(t.contentDOM.ownerDocument);}return _createClass(Cs,[{key:"setSelectionOrigin",value:function setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now();}},{key:"handleEvent",value:function handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var _i83,_s67=e.target;_s67!=t.contentDOM;_s67=_s67.parentNode)if(!_s67||11==_s67.nodeType||(_i83=Ce.get(_s67))&&_i83.ignoreEvent(e))return!1;return!0;})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||this.runHandlers(t.type,t));}},{key:"runHandlers",value:function runHandlers(t,e){var i=this.handlers[t];if(i){var _iterator50=_createForOfIteratorHelper(i.observers),_step50;try{for(_iterator50.s();!(_step50=_iterator50.n()).done;){var _t103=_step50.value;_t103(this.view,e);}}catch(err){_iterator50.e(err);}finally{_iterator50.f();}var _iterator51=_createForOfIteratorHelper(i.handlers),_step51;try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){var _t104=_step51.value;if(e.defaultPrevented)break;if(_t104(this.view,e)){e.preventDefault();break;}}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}}}},{key:"ensureHandlers",value:function ensureHandlers(t){var e=Os(t),i=this.handlers,s=this.view.contentDOM;for(var _t105 in e)if("scroll"!=_t105){var _r56=!e[_t105].handlers.length,_n57=i[_t105];_n57&&_r56!=!_n57.handlers.length&&(s.removeEventListener(_t105,this.handleEvent),_n57=null),_n57||s.addEventListener(_t105,this.handleEvent,{passive:_r56});}for(var _t106 in i)"scroll"==_t106||e[_t106]||s.removeEventListener(_t106,this.handleEvent);this.handlers=e;}},{key:"keydown",value:function keydown(t){var _this26=this;if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&Date.now()<this.lastEscPress+2e3)return!0;if(27!=t.keyCode&&Rs.indexOf(t.keyCode)<0&&(this.view.inputState.lastEscPress=0),Ve.android&&Ve.chrome&&!t.synthetic&&(13==t.keyCode||8==t.keyCode))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;var e;return!Ve.ios||t.synthetic||t.altKey||t.metaKey||!((e=Es.find(function(e){return e.keyCode==t.keyCode;}))&&!t.ctrlKey||Is.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout(function(){return _this26.flushIOSKey();},250),!0);}},{key:"flushIOSKey",value:function flushIOSKey(t){var e=this.pendingIOSKey;return!!e&&!("Enter"==e.key&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString()))&&(this.pendingIOSKey=void 0,ve(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0));}},{key:"ignoreDuringComposition",value:function ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Ve.safari&&!Ve.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0));}},{key:"startMouseSelection",value:function startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t;}},{key:"update",value:function update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0);}},{key:"destroy",value:function destroy(){this.mouseSelection&&this.mouseSelection.destroy();}}]);}();Es=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}];Is="dthko";Rs=[16,17,18,20,91,92,224,225];Bs=/*#__PURE__*/function(){function Bs(t,e,i,s){_classCallCheck(this,Bs);this.view=t,this.startEvent=e,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=function(t){var e=t.ownerDocument;for(var _i84=t.parentNode;_i84&&_i84!=e.body;)if(1==_i84.nodeType){if(_i84.scrollHeight>_i84.clientHeight||_i84.scrollWidth>_i84.clientWidth)return _i84;_i84=_i84.assignedSlot||_i84.parentNode;}else{if(11!=_i84.nodeType)break;_i84=_i84.host;}return null;}(t.contentDOM),this.atoms=t.state.facet(es).map(function(e){return e(t);});var r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(St.allowMultipleSelections)&&function(t,e){var i=t.state.facet(Bi);return i.length?i[0](e):Ve.mac?e.metaKey:e.ctrlKey;}(t,e),this.dragging=!(!function(t,e){var i=t.state.selection.main;if(i.empty)return!1;var s=ie(t.root);if(!s||0==s.rangeCount)return!0;var r=s.getRangeAt(0).getClientRects();for(var _t110=0;_t110<r.length;_t110++){var _i85=r[_t110];if(_i85.left<=e.clientX&&_i85.right>=e.clientX&&_i85.top<=e.clientY&&_i85.bottom>=e.clientY)return!0;}return!1;}(t,e)||1!=Gs(e))&&null;}return _createClass(Bs,[{key:"start",value:function start(t){!1===this.dragging&&this.select(t);}},{key:"move",value:function move(t){var e,i,s;if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(i=this.startEvent,s=t,Math.max(Math.abs(i.clientX-s.clientX),Math.abs(i.clientY-s.clientY))<10))return;this.select(this.lastEvent=t);var r=0,n=0,h=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},l=ns(this.view);t.clientX-l.left<=h.left+6?r=-Ts(h.left-t.clientX):t.clientX+l.right>=h.right-6&&(r=Ts(t.clientX-h.right)),t.clientY-l.top<=h.top+6?n=-Ts(h.top-t.clientY):t.clientY+l.bottom>=h.bottom-6&&(n=Ts(t.clientY-h.bottom)),this.setScrollSpeed(r,n);}},{key:"up",value:function up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy();}},{key:"destroy",value:function destroy(){this.setScrollSpeed(0,0);var t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null;}},{key:"setScrollSpeed",value:function setScrollSpeed(t,e){var _this27=this;this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(function(){return _this27.scroll();},50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1);}},{key:"scroll",value:function 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);}},{key:"skipAtoms",value:function skipAtoms(t){var e=null;for(var _i86=0;_i86<t.ranges.length;_i86++){var _s70=t.ranges[_i86],_r59=null;if(_s70.empty){var _t111=Ss(this.atoms,_s70.from,0);_t111!=_s70.from&&(_r59=B.cursor(_t111,-1));}else{var _t112=Ss(this.atoms,_s70.from,-1),_e98=Ss(this.atoms,_s70.to,1);_t112==_s70.from&&_e98==_s70.to||(_r59=B.range(_s70.from==_s70.anchor?_t112:_e98,_s70.from==_s70.head?_t112:_e98));}_r59&&(e||(e=t.ranges.slice()),e[_i86]=_r59);}return e?B.create(e,t.mainIndex):t;}},{key:"select",value:function select(t){var e=this.view,i=this.skipAtoms(this.style.get(t,this.extend,this.multiple));!this.mustSelect&&i.eq(e.state.selection,!1===this.dragging)||this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1;}},{key:"update",value:function update(t){var _this28=this;this.style.update(t)&&setTimeout(function(){return _this28.select(_this28.lastEvent);},20);}}]);}();Ls=Object.create(null);Ns=Object.create(null);$s=Ve.ie&&Ve.ie_version<15||Ve.ios&&Ve.webkit_version<604;Ns.scroll=function(t){t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft;},Ls.keydown=function(t,e){return t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now()),!1;},Ns.touchstart=function(t,e){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer");},Ns.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer");},Ls.mousedown=function(t,e){if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;var i=null;var _iterator53=_createForOfIteratorHelper(t.state.facet(Ni)),_step53;try{for(_iterator53.s();!(_step53=_iterator53.n()).done;){var _s74=_step53.value;if(i=_s74(t,e),i)break;}}catch(err){_iterator53.e(err);}finally{_iterator53.f();}if(i||0!=e.button||(i=function(t,e){var i=Vs(t,e),s=Gs(e),r=t.state.selection;return{update:function update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),r=r.map(t.changes));},get:function get(e,n,h){var l,o=Vs(t,e),u=zs(t,o.pos,o.bias,s);if(i.pos!=o.pos&&!n){var _e99=zs(t,i.pos,i.bias,s),_r61=Math.min(_e99.from,u.from),_n59=Math.max(_e99.to,u.to);u=_r61<u.from?B.range(_r61,_n59):B.range(_n59,_r61);}return n?r.replaceRange(r.main.extend(u.from,u.to)):h&&1==s&&r.ranges.length>1&&(l=function(t,e){for(var _i88=0;_i88<t.ranges.length;_i88++){var _t$ranges$_i=t.ranges[_i88],_s72=_t$ranges$_i.from,_r62=_t$ranges$_i.to;if(_s72<=e&&_r62>=e)return B.create(t.ranges.slice(0,_i88).concat(t.ranges.slice(_i88+1)),t.mainIndex==_i88?0:t.mainIndex-(t.mainIndex>_i88?1:0));}return null;}(r,o.pos))?l:h?r.addRange(u):B.create([u]);}};}(t,e)),i){var _s73=!t.hasFocus;t.inputState.startMouseSelection(new Bs(t,e,i,_s73)),_s73&&t.observer.ignore(function(){return we(t.contentDOM);});var _r63=t.inputState.mouseSelection;if(_r63)return _r63.start(e),!1===_r63.dragging;}return!1;};Ps=function Ps(t,e){return t>=e.top&&t<=e.bottom;};Hs=function Hs(t,e,i){return Ps(e,i)&&t>=i.left&&t<=i.right;};Fs=Ve.ie&&Ve.ie_version<=11;qs=null;Us=0;Js=0;Ls.dragstart=function(t,e){var i=t.state.selection.main;if(e.target.draggable){var _s75=t.docView.nearest(e.target);if(_s75&&_s75.isWidget){var _t116=_s75.posAtStart,_e100=_t116+_s75.length;(_t116>=i.to||_e100<=i.from)&&(i=B.range(_t116,_e100));}}var s=t.inputState;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove"),!1;},Ls.dragend=function(t){return t.inputState.draggedContent=null,!1;},Ls.drop=function(t,e){if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;var i=e.dataTransfer.files;if(i&&i.length){var _s76=Array(i.length),_r64=0,_n60=function _n60(){++_r64==i.length&&Ks(t,e,_s76.filter(function(t){return null!=t;}).join(t.state.lineBreak),!1);};var _loop6=function _loop6(_t117){var e=new FileReader();e.onerror=_n60,e.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(_s76[_t117]=e.result),_n60();},e.readAsText(i[_t117]);};for(var _t117=0;_t117<i.length;_t117++){_loop6(_t117);}return!0;}{var _i89=e.dataTransfer.getData("Text");if(_i89)return Ks(t,e,_i89,!0),!0;}return!1;},Ls.paste=function(t,e){if(t.state.readOnly)return!0;t.observer.flush();var i=$s?null:e.clipboardData;return i?(js(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(function(t){var e=t.dom.parentNode;if(!e)return;var i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(function(){t.focus(),i.remove(),js(t,i.value);},50);}(t),!1);};_s=null;Ls.copy=Ls.cut=function(t,e){var _ref7=function(t){var e=[],i=[],s=!1;var _iterator54=_createForOfIteratorHelper(t.selection.ranges),_step54;try{for(_iterator54.s();!(_step54=_iterator54.n()).done;){var _s78=_step54.value;_s78.empty||(e.push(t.sliceDoc(_s78.from,_s78.to)),i.push(_s78));}}catch(err){_iterator54.e(err);}finally{_iterator54.f();}if(!e.length){var _r65=-1;var _iterator55=_createForOfIteratorHelper(t.selection.ranges),_step55;try{for(_iterator55.s();!(_step55=_iterator55.n()).done;){var _s77=_step55.value.from;var _n61=t.doc.lineAt(_s77);_n61.number>_r65&&(e.push(_n61.text),i.push({from:_n61.from,to:Math.min(t.doc.length,_n61.to+1)})),_r65=_n61.number;}}catch(err){_iterator55.e(err);}finally{_iterator55.f();}s=!0;}return{text:e.join(t.lineBreak),ranges:i,linewise:s};}(t.state),i=_ref7.text,s=_ref7.ranges,r=_ref7.linewise;if(!i&&!r)return!1;_s=r?i:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});var n=$s?null:e.clipboardData;return n?(n.clearData(),n.setData("text/plain",i),!0):(function(t,e){var i=t.dom.parentNode;if(!i)return;var 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(function(){s.remove(),t.focus();},50);}(t,i),!1);};Xs=ut.define();Ns.focus=function(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),Qs(t);},Ns.blur=function(t){t.observer.clearSelectionRange(),Qs(t);},Ns.compositionstart=Ns.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0);},Ns.compositionend=function(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,Ve.chrome&&Ve.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(function(){return t.observer.flush();}):setTimeout(function(){t.inputState.composing<0&&t.docView.hasComposition&&t.update([]);},50);},Ns.contextmenu=function(t){t.inputState.lastContextMenu=Date.now();},Ls.beforeinput=function(t,e){var i;var s;if(Ve.chrome&&Ve.android&&(s=Es.find(function(t){return t.inputType==e.inputType;}))&&(t.observer.delayAndroidKey(s.key,s.keyCode),"Backspace"==s.key||"Delete"==s.key)){var _e101=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout(function(){var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>_e101+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus());},100);}return Ve.ios&&"deleteContentForward"==e.inputType&&t.observer.flushSoon(),Ve.safari&&"insertText"==e.inputType&&t.inputState.composing>=0&&setTimeout(function(){return Ns.compositionend(t,e);},20),!1;};Zs=new Set();tr=["pre-wrap","normal","pre-line","break-spaces"];er=/*#__PURE__*/function(){function er(e){_classCallCheck(this,er);this.lineWrapping=e,this.doc=t.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1;}return _createClass(er,[{key:"heightForGap",value:function heightForGap(t,e){var 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;}},{key:"heightForLine",value:function heightForLine(t){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight;}},{key:"setDoc",value:function setDoc(t){return this.doc=t,this;}},{key:"mustRefreshForWrapping",value:function mustRefreshForWrapping(t){return tr.indexOf(t)>-1!=this.lineWrapping;}},{key:"mustRefreshForHeights",value:function mustRefreshForHeights(t){var e=!1;for(var _i91=0;_i91<t.length;_i91++){var _s80=t[_i91];_s80<0?_i91++:this.heightSamples[Math.floor(10*_s80)]||(e=!0,this.heightSamples[Math.floor(10*_s80)]=!0);}return e;}},{key:"refresh",value:function refresh(t,e,i,s,r,n){var h=tr.indexOf(t)>-1,l=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=h;if(this.lineWrapping=h,this.lineHeight=e,this.charWidth=i,this.textHeight=s,this.lineLength=r,l){this.heightSamples={};for(var _t118=0;_t118<n.length;_t118++){var _e102=n[_t118];_e102<0?_t118++:this.heightSamples[Math.floor(10*_e102)]=!0;}}return l;}}]);}();ir=/*#__PURE__*/function(){function ir(t,e){_classCallCheck(this,ir);this.from=t,this.heights=e,this.index=0;}return _createClass(ir,[{key:"more",get:function get(){return this.index<this.heights.length;}}]);}();sr=/*#__PURE__*/function(){function sr(t,e,i,s,r){_classCallCheck(this,sr);this.from=t,this.length=e,this.top=i,this.height=s,this._content=r;}return _createClass(sr,[{key:"type",get:function get(){return"number"==typeof this._content?ri.Text:Array.isArray(this._content)?this._content:this._content.type;}},{key:"to",get:function get(){return this.from+this.length;}},{key:"bottom",get:function get(){return this.top+this.height;}},{key:"widget",get:function get(){return this._content instanceof oi?this._content.widget:null;}},{key:"widgetLineBreaks",get:function get(){return"number"==typeof this._content?this._content:0;}},{key:"join",value:function join(t){var e=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new sr(this.from,this.length+t.length,this.top,this.height+t.height,e);}}]);}();rr=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t;}(rr||(rr={}));nr=.001;hr=/*#__PURE__*/function(){function hr(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:2;_classCallCheck(this,hr);this.length=t,this.height=e,this.flags=i;}return _createClass(hr,[{key:"outdated",get:function get(){return(2&this.flags)>0;},set:function set(t){this.flags=(t?2:0)|-3&this.flags;}},{key:"setHeight",value:function setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>nr&&(t.heightChanged=!0),this.height=e);}},{key:"replace",value:function replace(t,e,i){return hr.of(i);}},{key:"decomposeLeft",value:function decomposeLeft(t,e){e.push(this);}},{key:"decomposeRight",value:function decomposeRight(t,e){e.push(this);}},{key:"applyChanges",value:function applyChanges(t,e,i,s){var r=this,n=i.doc;for(var _h34=s.length-1;_h34>=0;_h34--){var _s$_h=s[_h34],_l31=_s$_h.fromA,_o25=_s$_h.toA,_u30=_s$_h.fromB,_f15=_s$_h.toB,_a10=r.lineAt(_l31,rr.ByPosNoHeight,i.setDoc(e),0,0),_c10=_a10.to>=_o25?_a10:r.lineAt(_o25,rr.ByPosNoHeight,i,0,0);for(_f15+=_c10.to-_o25,_o25=_c10.to;_h34>0&&_a10.from<=s[_h34-1].toA;)_l31=s[_h34-1].fromA,_u30=s[_h34-1].fromB,_h34--,_l31<_a10.from&&(_a10=r.lineAt(_l31,rr.ByPosNoHeight,i,0,0));_u30+=_a10.from-_l31,_l31=_a10.from;var _d6=cr.build(i.setDoc(n),t,_u30,_f15);r=r.replace(_l31,_o25,_d6);}return r.updateHeight(i,0);}}],[{key:"empty",value:function empty(){return new or(0,0);}},{key:"of",value:function of(t){if(1==t.length)return t[0];var e=0,i=t.length,s=0,r=0;for(;;)if(e==i){if(s>2*r){var _r67=t[e-1];_r67["break"]?t.splice(--e,1,_r67.left,null,_r67.right):t.splice(--e,1,_r67.left,_r67.right),i+=1+_r67["break"],s-=_r67.size;}else{if(!(r>2*s))break;{var _e103=t[i];_e103["break"]?t.splice(i,1,_e103.left,null,_e103.right):t.splice(i,1,_e103.left,_e103.right),i+=2+_e103["break"],r-=_e103.size;}}}else if(s<r){var _i92=t[e++];_i92&&(s+=_i92.size);}else{var _e104=t[--i];_e104&&(r+=_e104.size);}var n=0;return null==t[e-1]?(n=1,e--):null==t[e]&&(n=1,i++),new fr(hr.of(t.slice(0,e)),n,hr.of(t.slice(i)));}}]);}();hr.prototype.size=1;lr=/*#__PURE__*/function(_hr){function lr(t,e,i){var _this29;_classCallCheck(this,lr);_this29=_callSuper(this,lr,[t,e]),_this29.deco=i;return _this29;}_inherits(lr,_hr);return _createClass(lr,[{key:"blockAt",value:function blockAt(t,e,i,s){return new sr(s,this.length,i,this.height,this.deco||0);}},{key:"lineAt",value:function lineAt(t,e,i,s,r){return this.blockAt(0,i,s,r);}},{key:"forEachLine",value:function forEachLine(t,e,i,s,r,n){t<=r+this.length&&e>=r&&n(this.blockAt(0,i,s,r));}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;return s&&s.from<=e&&s.more&&this.setHeight(t,s.heights[s.index++]),this.outdated=!1,this;}},{key:"toString",value:function toString(){return"block(".concat(this.length,")");}}]);}(hr);or=/*#__PURE__*/function(_lr){function or(t,e){var _this30;_classCallCheck(this,or);_this30=_callSuper(this,or,[t,e,null]),_this30.collapsed=0,_this30.widgetHeight=0,_this30.breaks=0;return _this30;}_inherits(or,_lr);return _createClass(or,[{key:"blockAt",value:function blockAt(t,e,i,s){return new sr(s,this.length,i,this.height,this.breaks);}},{key:"replace",value:function replace(t,e,i){var s=i[0];return 1==i.length&&(s instanceof or||s instanceof ur&&4&s.flags)&&Math.abs(this.length-s.length)<10?(s instanceof ur?s=new or(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):hr.of(i);}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;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.breaks*t.lineHeight),this.outdated=!1,this;}},{key:"toString",value:function toString(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")");}}]);}(lr);ur=/*#__PURE__*/function(_hr2){function ur(t){_classCallCheck(this,ur);return _callSuper(this,ur,[t,0]);}_inherits(ur,_hr2);return _createClass(ur,[{key:"heightMetrics",value:function heightMetrics(t,e){var i,s=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,n=r-s+1,h=0;if(t.lineWrapping){var _e105=Math.min(this.height,t.lineHeight*n);i=_e105/n,this.length>n+1&&(h=(this.height-_e105)/(this.length-n-1));}else i=this.height/n;return{firstLine:s,lastLine:r,perLine:i,perChar:h};}},{key:"blockAt",value:function blockAt(t,e,i,s){var _this$heightMetrics=this.heightMetrics(e,s),r=_this$heightMetrics.firstLine,n=_this$heightMetrics.lastLine,h=_this$heightMetrics.perLine,l=_this$heightMetrics.perChar;if(e.lineWrapping){var _r68=s+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length)),_n62=e.doc.lineAt(_r68),_o26=h+_n62.length*l,_u31=Math.max(i,t-_o26/2);return new sr(_n62.from,_n62.length,_u31,_o26,0);}{var _s81=Math.max(0,Math.min(n-r,Math.floor((t-i)/h))),_e$doc$line=e.doc.line(r+_s81),_l32=_e$doc$line.from,_o27=_e$doc$line.length;return new sr(_l32,_o27,i+h*_s81,h,0);}}},{key:"lineAt",value:function lineAt(t,e,i,s,r){if(e==rr.ByHeight)return this.blockAt(t,i,s,r);if(e==rr.ByPosNoHeight){var _i$doc$lineAt=i.doc.lineAt(t),_e106=_i$doc$lineAt.from,_s82=_i$doc$lineAt.to;return new sr(_e106,_s82-_e106,0,0,0);}var _this$heightMetrics2=this.heightMetrics(i,r),n=_this$heightMetrics2.firstLine,h=_this$heightMetrics2.perLine,l=_this$heightMetrics2.perChar,o=i.doc.lineAt(t),u=h+o.length*l,f=o.number-n,a=s+h*f+l*(o.from-r-f);return new sr(o.from,o.length,Math.max(s,Math.min(a,s+this.height-u)),u,0);}},{key:"forEachLine",value:function forEachLine(t,e,i,s,r,n){t=Math.max(t,r),e=Math.min(e,r+this.length);var _this$heightMetrics3=this.heightMetrics(i,r),h=_this$heightMetrics3.firstLine,l=_this$heightMetrics3.perLine,o=_this$heightMetrics3.perChar;for(var _u32=t,_f16=s;_u32<=e;){var _e107=i.doc.lineAt(_u32);if(_u32==t){var _i93=_e107.number-h;_f16+=l*_i93+o*(t-r-_i93);}var _s83=l+o*_e107.length;n(new sr(_e107.from,_e107.length,_f16,_s83,0)),_f16+=_s83,_u32=_e107.to+1;}}},{key:"replace",value:function replace(t,e,i){var s=this.length-e;if(s>0){var _t119=i[i.length-1];_t119 instanceof ur?i[i.length-1]=new ur(_t119.length+s):i.push(null,new ur(s-1));}if(t>0){var _e108=i[0];_e108 instanceof ur?i[0]=new ur(t+_e108.length):i.unshift(new ur(t-1),null);}return hr.of(i);}},{key:"decomposeLeft",value:function decomposeLeft(t,e){e.push(new ur(t-1),null);}},{key:"decomposeRight",value:function decomposeRight(t,e){e.push(null,new ur(this.length-t-1));}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;var r=e+this.length;if(s&&s.from<=e+this.length&&s.more){var _i94=[],_n63=Math.max(e,s.from),_h35=-1;for(s.from>e&&_i94.push(new ur(s.from-e-1).updateHeight(t,e));_n63<=r&&s.more;){var _e109=t.doc.lineAt(_n63).length;_i94.length&&_i94.push(null);var _r69=s.heights[s.index++];-1==_h35?_h35=_r69:Math.abs(_r69-_h35)>=nr&&(_h35=-2);var _l33=new or(_e109,_r69);_l33.outdated=!1,_i94.push(_l33),_n63+=_e109+1;}_n63<=r&&_i94.push(null,new ur(r-_n63).updateHeight(t,_n63));var _l34=hr.of(_i94);return(_h35<0||Math.abs(_l34.height-this.height)>=nr||Math.abs(_h35-this.heightMetrics(t,e).perLine)>=nr)&&(t.heightChanged=!0),_l34;}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this;}},{key:"toString",value:function toString(){return"gap(".concat(this.length,")");}}]);}(hr);fr=/*#__PURE__*/function(_hr3){function fr(t,e,i){var _this31;_classCallCheck(this,fr);_this31=_callSuper(this,fr,[t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)]),_this31.left=t,_this31.right=i,_this31.size=t.size+i.size;return _this31;}_inherits(fr,_hr3);return _createClass(fr,[{key:"break",get:function get(){return 1&this.flags;}},{key:"blockAt",value:function blockAt(t,e,i,s){var r=i+this.left.height;return t<r?this.left.blockAt(t,e,i,s):this.right.blockAt(t,e,r,s+this.left.length+this["break"]);}},{key:"lineAt",value:function lineAt(t,e,i,s,r){var n=s+this.left.height,h=r+this.left.length+this["break"],l=e==rr.ByHeight?t<n:t<h,o=l?this.left.lineAt(t,e,i,s,r):this.right.lineAt(t,e,i,n,h);if(this["break"]||(l?o.to<h:o.from>h))return o;var u=e==rr.ByPosNoHeight?rr.ByPosNoHeight:rr.ByPos;return l?o.join(this.right.lineAt(h,u,i,n,h)):this.left.lineAt(h,u,i,s,r).join(o);}},{key:"forEachLine",value:function forEachLine(t,e,i,s,r,n){var h=s+this.left.height,l=r+this.left.length+this["break"];if(this["break"])t<l&&this.left.forEachLine(t,e,i,s,r,n),e>=l&&this.right.forEachLine(t,e,i,h,l,n);else{var _o28=this.lineAt(l,rr.ByPos,i,s,r);t<_o28.from&&this.left.forEachLine(t,_o28.from-1,i,s,r,n),_o28.to>=t&&_o28.from<=e&&n(_o28),e>_o28.to&&this.right.forEachLine(_o28.to+1,e,i,h,l,n);}}},{key:"replace",value:function replace(t,e,i){var 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));var r=[];t>0&&this.decomposeLeft(t,r);var n=r.length;var _iterator57=_createForOfIteratorHelper(i),_step57;try{for(_iterator57.s();!(_step57=_iterator57.n()).done;){var _t121=_step57.value;r.push(_t121);}}catch(err){_iterator57.e(err);}finally{_iterator57.f();}if(t>0&&ar(r,n-1),e<this.length){var _t120=r.length;this.decomposeRight(e,r),ar(r,_t120);}return hr.of(r);}},{key:"decomposeLeft",value:function decomposeLeft(t,e){var 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);}},{key:"decomposeRight",value:function decomposeRight(t,e){var 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);}},{key:"balanced",value:function balanced(t,e){return t.size>2*e.size||e.size>2*t.size?hr.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);}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;var r=this.left,n=this.right,h=e+r.length+this["break"],l=null;return s&&s.from<=e+r.length&&s.more?l=r=r.updateHeight(t,e,i,s):r.updateHeight(t,e,i),s&&s.from<=h+n.length&&s.more?l=n=n.updateHeight(t,h,i,s):n.updateHeight(t,h,i),l?this.balanced(r,n):(this.height=this.left.height+this.right.height,this.outdated=!1,this);}},{key:"toString",value:function toString(){return this.left+(this["break"]?" ":"-")+this.right;}}]);}(hr);cr=/*#__PURE__*/function(){function cr(t,e){_classCallCheck(this,cr);this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t;}return _createClass(cr,[{key:"isCovered",get:function get(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering;}},{key:"span",value:function span(t,e){if(this.lineStart>-1){var _t122=Math.min(e,this.lineEnd),_i95=this.nodes[this.nodes.length-1];_i95 instanceof or?_i95.length+=_t122-this.pos:(_t122>this.pos||!this.isCovered)&&this.nodes.push(new or(_t122-this.pos,-1)),this.writtenTo=_t122,e>_t122&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1);}this.pos=e;}},{key:"point",value:function point(t,e,i){if(t<e||i.heightRelevant){var _s84=i.widget?i.widget.estimatedHeight:0,_r70=i.widget?i.widget.lineBreaks:0;_s84<0&&(_s84=this.oracle.lineHeight);var _n64=e-t;i.block?this.addBlock(new lr(_n64,_s84,i)):(_n64||_r70||_s84>=5)&&this.addLineDeco(_s84,_r70,_n64);}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to);}},{key:"enterLine",value:function enterLine(){if(this.lineStart>-1)return;var _this$oracle$doc$line=this.oracle.doc.lineAt(this.pos),t=_this$oracle$doc$line.from,e=_this$oracle$doc$line.to;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 or(this.pos-t,-1)),this.writtenTo=this.pos;}},{key:"blankContent",value:function blankContent(t,e){var i=new ur(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i;}},{key:"ensureLine",value:function ensureLine(){this.enterLine();var t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof or)return t;var e=new or(0,-1);return this.nodes.push(e),e;}},{key:"addBlock",value:function addBlock(t){this.enterLine();var e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t);}},{key:"addLineDeco",value:function addLineDeco(t,e,i){var s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,t),s.breaks+=e,this.writtenTo=this.pos=this.pos+i;}},{key:"finish",value:function finish(t){var e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof or||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new or(0,-1));var i=t;var _iterator58=_createForOfIteratorHelper(this.nodes),_step58;try{for(_iterator58.s();!(_step58=_iterator58.n()).done;){var _t123=_step58.value;_t123 instanceof or&&_t123.updateHeight(this.oracle,i),i+=_t123?_t123.length:1;}}catch(err){_iterator58.e(err);}finally{_iterator58.f();}return this.nodes;}}],[{key:"build",value:function build(t,e,i,s){var r=new cr(i,t);return It.spans(e,i,s,r,0),r.finish(i);}}]);}();dr=/*#__PURE__*/function(){function dr(){_classCallCheck(this,dr);this.changes=[];}return _createClass(dr,[{key:"compareRange",value:function compareRange(){}},{key:"comparePoint",value:function comparePoint(t,e,i,s){(t<e||i&&i.heightRelevant||s&&s.heightRelevant)&&fi(t,e,this.changes,5);}}]);}();gr=/*#__PURE__*/function(){function gr(t,e,i){_classCallCheck(this,gr);this.from=t,this.to=e,this.size=i;}return _createClass(gr,[{key:"draw",value:function draw(t,e){return ni.replace({widget:new wr(this.size*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to);}}],[{key:"same",value:function same(t,e){if(t.length!=e.length)return!1;for(var _i97=0;_i97<t.length;_i97++){var _s87=t[_i97],_r71=e[_i97];if(_s87.from!=_r71.from||_s87.to!=_r71.to||_s87.size!=_r71.size)return!1;}return!0;}}]);}();wr=/*#__PURE__*/function(_si3){function wr(t,e){var _this32;_classCallCheck(this,wr);_this32=_callSuper(this,wr),_this32.size=t,_this32.vertical=e;return _this32;}_inherits(wr,_si3);return _createClass(wr,[{key:"eq",value:function eq(t){return t.size==this.size&&t.vertical==this.vertical;}},{key:"toDOM",value:function toDOM(){var 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;}},{key:"estimatedHeight",get:function get(){return this.vertical?this.size:-1;}}]);}(si);br=/*#__PURE__*/function(){function br(e){var _this33=this;_classCallCheck(this,br);this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=xr,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=pi.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;var i=e.facet(Qi).some(function(t){return"function"!=typeof t&&"cm-lineWrapping"==t["class"];});this.heightOracle=new er(i),this.stateDeco=e.facet(Zi).filter(function(t){return"function"!=typeof t;}),this.heightMap=hr.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new ls(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map(function(t){return t.draw(_this33,!1);})),this.computeVisibleRanges();}return _createClass(br,[{key:"updateForViewport",value:function updateForViewport(){var _this34=this;var t=[this.viewport],e=this.state.selection.main;var _loop7=function _loop7(){var s=_i98?e.head:e.anchor;if(!t.some(function(_ref8){var t=_ref8.from,e=_ref8.to;return s>=t&&s<=e;})){var _this34$lineBlockAt=_this34.lineBlockAt(s),_e111=_this34$lineBlockAt.from,_i99=_this34$lineBlockAt.to;t.push(new vr(_e111,_i99));}};for(var _i98=0;_i98<=1;_i98++){_loop7();}this.viewports=t.sort(function(t,e){return t.from-e.from;}),this.scaler=this.heightMap.height<=7e6?xr:new Sr(this.heightOracle,this.heightMap,this.viewports);}},{key:"updateViewportLines",value:function updateViewportLines(){var _this35=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,function(t){_this35.viewportLines.push(1==_this35.scaler.scale?t:Ar(t,_this35.scaler));});}},{key:"update",value:function update(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;this.state=t.state;var i=this.stateDeco;this.stateDeco=this.state.facet(Zi).filter(function(t){return"function"!=typeof t;});var s=t.changedRanges,r=ls.extendWithRanges(s,function(t,e,i){var s=new dr();return It.compare(t,e,i,s,0),s.changes;}(i,this.stateDeco,t?t.changes:A.empty(this.state.doc.length))),n=this.heightMap.height,h=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=n&&(t.flags|=2),h?(this.scrollAnchorPos=t.changes.mapPos(h.from,-1),this.scrollAnchorHeight=h.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);var l=r.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));var o=!t.changes.empty||2&t.flags||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),o&&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(Wi)&&(this.mustEnforceCursorAssoc=!0);}},{key:"measure",value:function measure(e){var i=e.contentDOM,s=window.getComputedStyle(i),r=this.heightOracle,n=s.whiteSpace;this.defaultTextDirection="rtl"==s.direction?pi.RTL:pi.LTR;var h=this.heightOracle.mustRefreshForWrapping(n),l=i.getBoundingClientRect(),o=h||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;var u=0,f=0;if(l.width&&l.height){var _de2=de(i,l),_t124=_de2.scaleX,_e112=_de2.scaleY;(_t124>.005&&Math.abs(this.scaleX-_t124)>.005||_e112>.005&&Math.abs(this.scaleY-_e112)>.005)&&(this.scaleX=_t124,this.scaleY=_e112,u|=8,h=o=!0);}var a=(parseInt(s.paddingTop)||0)*this.scaleY,c=(parseInt(s.paddingBottom)||0)*this.scaleY;this.paddingTop==a&&this.paddingBottom==c||(this.paddingTop=a,this.paddingBottom=c,u|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(o=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=8);var d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=ye(e.scrollDOM);var p=(this.printing?mr:pr)(i,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;var w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(o=!0)),!this.inView&&!this.scrollTarget)return 0;var b=l.width;if(this.contentDOMWidth==b&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,u|=8),o){var _i100=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(_i100)&&(h=!0),h||r.lineWrapping&&Math.abs(b-this.contentDOMWidth)>r.charWidth){var _e$docView$measureTex=e.docView.measureTextSize(),_t125=_e$docView$measureTex.lineHeight,_s88=_e$docView$measureTex.charWidth,_l35=_e$docView$measureTex.textHeight;h=_t125>0&&r.refresh(n,_t125,_s88,_l35,b/_s88,_i100),h&&(e.docView.minWidth=0,u|=8);}m>0&&g>0?f=Math.max(m,g):m<0&&g<0&&(f=Math.min(m,g)),r.heightChanged=!1;var _iterator59=_createForOfIteratorHelper(this.viewports),_step59;try{for(_iterator59.s();!(_step59=_iterator59.n()).done;){var _s89=_step59.value;var _n65=_s89.from==this.viewport.from?_i100:e.docView.measureVisibleLineHeights(_s89);this.heightMap=(h?hr.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle,[new ls(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,h,new ir(_s89.from,_n65));}}catch(err){_iterator59.e(err);}finally{_iterator59.f();}r.heightChanged&&(u|=2);}var v=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return v&&(this.viewport=this.getViewport(f,this.scrollTarget)),this.updateForViewport(),(2&u||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(h?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u;}},{key:"visibleTop",get:function get(){return this.scaler.fromDOM(this.pixelViewport.top);}},{key:"visibleBottom",get:function get(){return this.scaler.fromDOM(this.pixelViewport.bottom);}},{key:"getViewport",value:function getViewport(t,e){var i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,r=this.heightOracle,n=this.visibleTop,h=this.visibleBottom,l=new vr(s.lineAt(n-1e3*i,rr.ByHeight,r,0,0).from,s.lineAt(h+1e3*(1-i),rr.ByHeight,r,0,0).to);if(e){var _t126=e.range.head;if(_t126<l.from||_t126>l.to){var _i101,_n66=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),_h36=s.lineAt(_t126,rr.ByPos,r,0,0);_i101="center"==e.y?(_h36.top+_h36.bottom)/2-_n66/2:"start"==e.y||"nearest"==e.y&&_t126<l.from?_h36.top:_h36.bottom-_n66,l=new vr(s.lineAt(_i101-500,rr.ByHeight,r,0,0).from,s.lineAt(_i101+_n66+500,rr.ByHeight,r,0,0).to);}}return l;}},{key:"mapViewport",value:function mapViewport(t,e){var i=e.mapPos(t.from,-1),s=e.mapPos(t.to,1);return new vr(this.heightMap.lineAt(i,rr.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,rr.ByPos,this.heightOracle,0,0).to);}},{key:"viewportIsAppropriate",value:function viewportIsAppropriate(_ref9){var t=_ref9.from,e=_ref9.to;var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(!this.inView)return!0;var _this$heightMap$lineA=this.heightMap.lineAt(t,rr.ByPos,this.heightOracle,0,0),s=_this$heightMap$lineA.top,_this$heightMap$lineA2=this.heightMap.lineAt(e,rr.ByPos,this.heightOracle,0,0),r=_this$heightMap$lineA2.bottom,n=this.visibleTop,h=this.visibleBottom;return(0==t||s<=n-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||r>=h+Math.max(10,Math.min(i,250)))&&s>n-2e3&&r<h+2e3;}},{key:"mapLineGaps",value:function mapLineGaps(t,e){if(!t.length||e.empty)return t;var i=[];var _iterator60=_createForOfIteratorHelper(t),_step60;try{for(_iterator60.s();!(_step60=_iterator60.n()).done;){var _s90=_step60.value;e.touchesRange(_s90.from,_s90.to)||i.push(new gr(e.mapPos(_s90.from),e.mapPos(_s90.to),_s90.size));}}catch(err){_iterator60.e(err);}finally{_iterator60.f();}return i;}},{key:"ensureLineGaps",value:function ensureLineGaps(t,e){var _this36=this;var i=this.heightOracle.lineWrapping,s=i?1e4:2e3,r=s>>1,n=s<<1;if(this.defaultTextDirection!=pi.LTR&&!i)return[];var h=[],l=function l(s,n,o,u){if(n-s<r)return;var f=_this36.state.selection.main,a=[f.from];f.empty||a.push(f.to);for(var _i102=0,_a11=a;_i102<_a11.length;_i102++){var _t127=_a11[_i102];if(_t127>s&&_t127<n)return l(s,_t127-10,o,u),void l(_t127+10,n,o,u);}var c=function(t,e){var _iterator61=_createForOfIteratorHelper(t),_step61;try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){var _i103=_step61.value;if(e(_i103))return _i103;}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}return;}(t,function(t){return t.from>=o.from&&t.to<=o.to&&Math.abs(t.from-s)<r&&Math.abs(t.to-n)<r&&!a.some(function(e){return t.from<e&&t.to>e;});});if(!c){if(n<o.to&&e&&i&&e.visibleRanges.some(function(t){return t.from<=n&&t.to>=n;})){var _t128=e.moveToLineBoundary(B.cursor(n),!1,!0).head;_t128>s&&(n=_t128);}c=new gr(s,n,_this36.gapSize(o,s,n,u));}h.push(c);};var _iterator62=_createForOfIteratorHelper(this.viewportLines),_step62;try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){var _t129=_step62.value;if(_t129.length<n)continue;var _e113=kr(_t129.from,_t129.to,this.stateDeco);if(_e113.total<n)continue;var _r72=void 0,_h37=void 0,_o29=this.scrollTarget?this.scrollTarget.range.head:null;if(i){var _i104=void 0,_n67=void 0,_l36=s/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=_o29){var _s91=Mr(_e113,_o29),_r73=((this.visibleBottom-this.visibleTop)/2+_l36)/_t129.height;_i104=_s91-_r73,_n67=_s91+_r73;}else _i104=(this.visibleTop-_t129.top-_l36)/_t129.height,_n67=(this.visibleBottom-_t129.top+_l36)/_t129.height;_r72=yr(_e113,_i104),_h37=yr(_e113,_n67);}else{var _t130=void 0,_i105=void 0,_n68=_e113.total*this.heightOracle.charWidth,_l37=s*this.heightOracle.charWidth;if(null!=_o29){var _s92=Mr(_e113,_o29),_r74=((this.pixelViewport.right-this.pixelViewport.left)/2+_l37)/_n68;_t130=_s92-_r74,_i105=_s92+_r74;}else _t130=(this.pixelViewport.left-_l37)/_n68,_i105=(this.pixelViewport.right+_l37)/_n68;_r72=yr(_e113,_t130),_h37=yr(_e113,_i105);}_r72>_t129.from&&l(_t129.from,_r72,_t129,_e113),_h37<_t129.to&&l(_h37,_t129.to,_t129,_e113);}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}return h;}},{key:"gapSize",value:function gapSize(t,e,i,s){var r=Mr(s,i)-Mr(s,e);return this.heightOracle.lineWrapping?t.height*r:s.total*this.heightOracle.charWidth*r;}},{key:"updateLineGaps",value:function updateLineGaps(t){var _this37=this;gr.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=ni.set(t.map(function(t){return t.draw(_this37,_this37.heightOracle.lineWrapping);})));}},{key:"computeVisibleRanges",value:function computeVisibleRanges(){var t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));var e=[];It.spans(t,this.viewport.from,this.viewport.to,{span:function span(t,i){e.push({from:t,to:i});},point:function point(){}},20);var i=e.length!=this.visibleRanges.length||this.visibleRanges.some(function(t,i){return t.from!=e[i].from||t.to!=e[i].to;});return this.visibleRanges=e,i?4:0;}},{key:"lineBlockAt",value:function lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(function(e){return e.from<=t&&e.to>=t;})||Ar(this.heightMap.lineAt(t,rr.ByPos,this.heightOracle,0,0),this.scaler);}},{key:"lineBlockAtHeight",value:function lineBlockAtHeight(t){return Ar(this.heightMap.lineAt(this.scaler.fromDOM(t),rr.ByHeight,this.heightOracle,0,0),this.scaler);}},{key:"scrollAnchorAt",value:function scrollAnchorAt(t){var e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0];}},{key:"elementAtHeight",value:function elementAtHeight(t){return Ar(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler);}},{key:"docHeight",get:function get(){return this.scaler.toDOM(this.heightMap.height);}},{key:"contentHeight",get:function get(){return this.docHeight+this.paddingTop+this.paddingBottom;}}]);}();vr=/*#__PURE__*/_createClass(function vr(t,e){_classCallCheck(this,vr);this.from=t,this.to=e;});xr={toDOM:function toDOM(t){return t;},fromDOM:function fromDOM(t){return t;},scale:1};Sr=/*#__PURE__*/function(){function Sr(t,e,i){_classCallCheck(this,Sr);var s=0,r=0,n=0;this.viewports=i.map(function(_ref11){var i=_ref11.from,r=_ref11.to;var n=e.lineAt(i,rr.ByPos,t,0,0).top,h=e.lineAt(r,rr.ByPos,t,0,0).bottom;return s+=h-n,{from:i,to:r,top:n,bottom:h,domTop:0,domBottom:0};}),this.scale=(7e6-s)/(e.height-s);var _iterator64=_createForOfIteratorHelper(this.viewports),_step64;try{for(_iterator64.s();!(_step64=_iterator64.n()).done;){var _t132=_step64.value;_t132.domTop=n+(_t132.top-r)*this.scale,n=_t132.domBottom=_t132.domTop+(_t132.bottom-_t132.top),r=_t132.bottom;}}catch(err){_iterator64.e(err);}finally{_iterator64.f();}}return _createClass(Sr,[{key:"toDOM",value:function toDOM(t){for(var _e114=0,_i107=0,_s94=0;;_e114++){var _r77=_e114<this.viewports.length?this.viewports[_e114]:null;if(!_r77||t<_r77.top)return _s94+(t-_i107)*this.scale;if(t<=_r77.bottom)return _r77.domTop+(t-_r77.top);_i107=_r77.bottom,_s94=_r77.domBottom;}}},{key:"fromDOM",value:function fromDOM(t){for(var _e115=0,_i108=0,_s95=0;;_e115++){var _r78=_e115<this.viewports.length?this.viewports[_e115]:null;if(!_r78||t<_r78.domTop)return _i108+(t-_s95)/this.scale;if(t<=_r78.domBottom)return _r78.top+(t-_r78.domTop);_i108=_r78.bottom,_s95=_r78.domBottom;}}}]);}();Cr=$.define({combine:function combine(t){return t.join(" ");}});Dr=$.define({combine:function combine(t){return t.indexOf(!0)>-1;}});Or=Gt.newName();Er=Gt.newName();Ir=Gt.newName();Rr={"&light":"."+Er,"&dark":"."+Ir};Br=Tr("."+Or,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Rr);Lr="￿";Nr=/*#__PURE__*/function(){function Nr(t,e){_classCallCheck(this,Nr);this.points=t,this.text="",this.lineSeparator=e.facet(St.lineSeparator);}return _createClass(Nr,[{key:"append",value:function append(t){this.text+=t;}},{key:"lineBreak",value:function lineBreak(){this.text+=Lr;}},{key:"readRange",value:function readRange(t,e){if(!t)return this;var i=t.parentNode;for(var _s96=t;;){this.findPointBefore(i,_s96);var _t133=this.text.length;this.readNode(_s96);var _r79=_s96.nextSibling;if(_r79==e)break;var _n70=Ce.get(_s96),_h38=Ce.get(_r79);(_n70&&_h38?_n70.breakAfter:(_n70?_n70.breakAfter:oe(_s96))||oe(_r79)&&("BR"!=_s96.nodeName||_s96.cmIgnore)&&this.text.length>_t133)&&this.lineBreak(),_s96=_r79;}return this.findPointBefore(i,e),this;}},{key:"readTextNode",value:function readTextNode(t){var e=t.nodeValue;var _iterator65=_createForOfIteratorHelper(this.points),_step65;try{for(_iterator65.s();!(_step65=_iterator65.n()).done;){var _i110=_step65.value;_i110.node==t&&(_i110.pos=this.text.length+Math.min(_i110.offset,e.length));}}catch(err){_iterator65.e(err);}finally{_iterator65.f();}for(var _i109=0,_s97=this.lineSeparator?null:/\r\n?|\n/g;;){var _r80=void 0,_n71=-1,_h39=1;if(this.lineSeparator?(_n71=e.indexOf(this.lineSeparator,_i109),_h39=this.lineSeparator.length):(_r80=_s97.exec(e))&&(_n71=_r80.index,_h39=_r80[0].length),this.append(e.slice(_i109,_n71<0?e.length:_n71)),_n71<0)break;if(this.lineBreak(),_h39>1){var _iterator66=_createForOfIteratorHelper(this.points),_step66;try{for(_iterator66.s();!(_step66=_iterator66.n()).done;){var _e116=_step66.value;_e116.node==t&&_e116.pos>this.text.length&&(_e116.pos-=_h39-1);}}catch(err){_iterator66.e(err);}finally{_iterator66.f();}}_i109=_n71+_h39;}}},{key:"readNode",value:function readNode(t){if(t.cmIgnore)return;var e=Ce.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(var _t134=i.iter();!_t134.next().done;)_t134.lineBreak?this.lineBreak():this.append(_t134.value);}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null);}},{key:"findPointBefore",value:function findPointBefore(t,e){var _iterator67=_createForOfIteratorHelper(this.points),_step67;try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){var _i111=_step67.value;_i111.node==t&&t.childNodes[_i111.offset]==e&&(_i111.pos=this.text.length);}}catch(err){_iterator67.e(err);}finally{_iterator67.f();}}},{key:"findPointInside",value:function findPointInside(t,e){var _iterator68=_createForOfIteratorHelper(this.points),_step68;try{for(_iterator68.s();!(_step68=_iterator68.n()).done;){var _i112=_step68.value;(3==t.nodeType?_i112.node==t:t.contains(_i112.node))&&(_i112.pos=this.text.length+($r(t,_i112.node,_i112.offset)?e:0));}}catch(err){_iterator68.e(err);}finally{_iterator68.f();}}}]);}();jr=/*#__PURE__*/_createClass(function jr(t,e){_classCallCheck(this,jr);this.node=t,this.offset=e,this.pos=-1;});zr=/*#__PURE__*/_createClass(function zr(t,e,i,s){_classCallCheck(this,zr);this.typeOver=s,this.bounds=null,this.text="";var _t$docView=t.docView,r=_t$docView.impreciseHead,n=_t$docView.impreciseAnchor;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){var _e117=r||n?[]:function(t){var e=[];if(t.root.activeElement!=t.contentDOM)return e;var _t$observer$selection2=t.observer.selectionRange,i=_t$observer$selection2.anchorNode,s=_t$observer$selection2.anchorOffset,r=_t$observer$selection2.focusNode,n=_t$observer$selection2.focusOffset;i&&(e.push(new jr(i,s)),r==i&&n==s||e.push(new jr(r,n)));return e;}(t),_i113=new Nr(_e117,t.state);_i113.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=_i113.text,this.newSel=function(t,e){if(0==t.length)return null;var i=t[0].pos,s=2==t.length?t[1].pos:i;return i>-1&&s>-1?B.single(i+e,s+e):null;}(_e117,this.bounds.from);}else{var _e118=t.observer.selectionRange,_i114=r&&r.node==_e118.focusNode&&r.offset==_e118.focusOffset||!se(t.contentDOM,_e118.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(_e118.focusNode,_e118.focusOffset),_s98=n&&n.node==_e118.anchorNode&&n.offset==_e118.anchorOffset||!se(t.contentDOM,_e118.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(_e118.anchorNode,_e118.anchorOffset),_h40=t.viewport;if((Ve.ios||Ve.chrome)&&t.state.selection.main.empty&&_i114!=_s98&&(_h40.from>0||_h40.to<t.state.doc.length)){var _e119=Math.min(_i114,_s98),_r81=Math.max(_i114,_s98),_n72=_h40.from-_e119,_l38=_h40.to-_r81;0!=_n72&&1!=_n72&&0!=_e119||0!=_l38&&-1!=_l38&&_r81!=t.state.doc.length||(_i114=0,_s98=t.state.doc.length);}this.newSel=B.single(_s98,_i114);}});Hr={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0};Wr=Ve.ie&&Ve.ie_version<=11;Vr=/*#__PURE__*/function(){function Vr(t){var _this38=this;_classCallCheck(this,Vr);this.view=t,this.active=!1,this.selectionRange=new pe(),this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(function(e){var _iterator69=_createForOfIteratorHelper(e),_step69;try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){var _t138=_step69.value;_this38.queue.push(_t138);}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}(Ve.ie&&Ve.ie_version<=11||Ve.ios&&t.composing)&&e.some(function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length;})?_this38.flushSoon():_this38.flush();}),Wr&&(this.onCharData=function(t){_this38.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),_this38.flushSoon();}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(function(){var t;(null===(t=_this38.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&_this38.onResize();}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(function(t){_this38.parentCheck<0&&(_this38.parentCheck=setTimeout(_this38.listenForScroll.bind(_this38),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=_this38.intersecting&&(_this38.intersecting=!_this38.intersecting,_this38.intersecting!=_this38.view.inView&&_this38.onScrollChanged(document.createEvent("Event")));},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(function(t){t.length>0&&t[t.length-1].intersectionRatio>0&&_this38.onScrollChanged(document.createEvent("Event"));},{})),this.listenForScroll(),this.readSelectionRange();}return _createClass(Vr,[{key:"onScrollChanged",value:function onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure();}},{key:"onScroll",value:function onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t);}},{key:"onResize",value:function onResize(){var _this39=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(function(){_this39.resizeTimeout=-1,_this39.view.requestMeasure();},50));}},{key:"onPrint",value:function onPrint(t){var _this40=this;("change"!=t.type||t.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(function(){_this40.view.viewState.printing=!1,_this40.view.requestMeasure();},500));}},{key:"updateGaps",value:function updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some(function(e,i){return e!=t[i];}))){this.gapIntersection.disconnect();var _iterator70=_createForOfIteratorHelper(t),_step70;try{for(_iterator70.s();!(_step70=_iterator70.n()).done;){var _e120=_step70.value;this.gapIntersection.observe(_e120);}}catch(err){_iterator70.e(err);}finally{_iterator70.f();}this.gaps=t;}}},{key:"onSelectionChange",value:function onSelectionChange(t){var e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;var i=this.view,s=this.selectionRange;if(i.state.facet(Ji)?i.root.activeElement!=this.dom:!re(i.dom,s))return;var r=s.anchorNode&&i.docView.nearest(s.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(Ve.ie&&Ve.ie_version<=11||Ve.android&&Ve.chrome)&&!i.state.selection.main.empty&&s.focusNode&&he(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1);}},{key:"readSelectionRange",value:function readSelectionRange(){var t=this.view,e=ie(t.root);if(!e)return!1;var i=Ve.safari&&11==t.root.nodeType&&function(t){var e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e;}(this.dom.ownerDocument)==this.dom&&function(t,e){if(e.getComposedRanges){var _i118=e.getComposedRanges(t.root)[0];if(_i118)return qr(t,_i118);}var i=null;function s(t){t.preventDefault(),t.stopImmediatePropagation(),i=t.getTargetRanges()[0];}return t.contentDOM.addEventListener("beforeinput",s,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",s,!0),i?qr(t,i):null;}(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;var s=re(this.dom,i);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){var i=e.focusNode,s=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=s)return!1;for(s=Math.min(s,fe(i));;)if(s){if(1!=i.nodeType)return!1;var _t139=i.childNodes[s-1];"false"==_t139.contentEditable?s--:(i=_t139,s=fe(i));}else{if(i==t)return!0;s=le(i),i=i.parentNode;}}(this.dom,i)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(i),s&&(this.selectionChanged=!0),!0);}},{key:"setSelectionRange",value:function setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1;}},{key:"clearSelectionRange",value:function clearSelectionRange(){this.selectionRange.set(null,0,null,0);}},{key:"listenForScroll",value:function listenForScroll(){this.parentCheck=-1;var t=0,e=null;for(var _i119=this.dom;_i119;)if(1==_i119.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==_i119?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(_i119),_i119=_i119.assignedSlot||_i119.parentNode;else{if(11!=_i119.nodeType)break;_i119=_i119.host;}if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){var _iterator71=_createForOfIteratorHelper(this.scrollTargets),_step71;try{for(_iterator71.s();!(_step71=_iterator71.n()).done;){var _t140=_step71.value;_t140.removeEventListener("scroll",this.onScroll);}}catch(err){_iterator71.e(err);}finally{_iterator71.f();}var _iterator72=_createForOfIteratorHelper(this.scrollTargets=e),_step72;try{for(_iterator72.s();!(_step72=_iterator72.n()).done;){var _t141=_step72.value;_t141.addEventListener("scroll",this.onScroll);}}catch(err){_iterator72.e(err);}finally{_iterator72.f();}}}},{key:"ignore",value:function ignore(t){if(!this.active)return t();try{return this.stop(),t();}finally{this.start(),this.clear();}}},{key:"start",value:function start(){this.active||(this.observer.observe(this.dom,Hr),Wr&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0);}},{key:"stop",value:function stop(){this.active&&(this.active=!1,this.observer.disconnect(),Wr&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData));}},{key:"clear",value:function clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1;}},{key:"delayAndroidKey",value:function delayAndroidKey(t,e){var _this41=this;var i;if(!this.delayedAndroidKey){var _t142=function _t142(){var t=_this41.delayedAndroidKey;if(t){_this41.clearDelayedAndroidKey(),_this41.view.inputState.lastKeyCode=t.keyCode,_this41.view.inputState.lastKeyTime=Date.now(),!_this41.flush()&&t.force&&ve(_this41.dom,t.key,t.keyCode);}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(_t142);}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)});}},{key:"clearDelayedAndroidKey",value:function clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1;}},{key:"flushSoon",value:function flushSoon(){var _this42=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(function(){_this42.delayedFlush=-1,_this42.flush();}));}},{key:"forceFlush",value:function forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush();}},{key:"pendingRecords",value:function pendingRecords(){var _iterator73=_createForOfIteratorHelper(this.observer.takeRecords()),_step73;try{for(_iterator73.s();!(_step73=_iterator73.n()).done;){var _t143=_step73.value;this.queue.push(_t143);}}catch(err){_iterator73.e(err);}finally{_iterator73.f();}return this.queue;}},{key:"processRecords",value:function processRecords(){var t=this.pendingRecords();t.length&&(this.queue=[]);var e=-1,i=-1,s=!1;var _iterator74=_createForOfIteratorHelper(t),_step74;try{for(_iterator74.s();!(_step74=_iterator74.n()).done;){var _t145;var _r83=_step74.value;var _t144=this.readMutation(_r83);_t144&&(_t144.typeOver&&(s=!0),-1==e?(_t145=_t144,e=_t145.from,i=_t145.to,_t145):(e=Math.min(_t144.from,e),i=Math.max(_t144.to,i)));}}catch(err){_iterator74.e(err);}finally{_iterator74.f();}return{from:e,to:i,typeOver:s};}},{key:"readChange",value:function readChange(){var _this$processRecords=this.processRecords(),t=_this$processRecords.from,e=_this$processRecords.to,i=_this$processRecords.typeOver,s=this.selectionChanged&&re(this.dom,this.selectionRange);if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;var r=new zr(this.view,t,e,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r;}},{key:"flush",value:function flush(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();var e=this.readChange();if(!e)return this.view.requestMeasure(),!1;var i=this.view.state,s=Pr(this.view,e);return this.view.state==i&&this.view.update([]),s;}},{key:"readMutation",value:function readMutation(t){var e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){var _i120=Fr(e,t.previousSibling||t.target.previousSibling,-1),_s99=Fr(e,t.nextSibling||t.target.nextSibling,1);return{from:_i120?e.posAfter(_i120):e.posAtStart,to:_s99?e.posBefore(_s99):e.posAtEnd,typeOver:!1};}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null;}},{key:"setWindow",value:function setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win));}},{key:"addWindowListeners",value:function addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange);}},{key:"removeWindowListeners",value:function removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange);}},{key:"destroy",value:function destroy(){var t,e,i;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect();var _iterator75=_createForOfIteratorHelper(this.scrollTargets),_step75;try{for(_iterator75.s();!(_step75=_iterator75.n()).done;){var _t146=_step75.value;_t146.removeEventListener("scroll",this.onScroll);}}catch(err){_iterator75.e(err);}finally{_iterator75.f();}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey);}}]);}();_export("E",Ur=/*#__PURE__*/function(){function Ur(){var _this43=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,Ur);this.plugins=[],this.pluginMap=new Map(),this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);var e=t.dispatch;this.dispatchTransactions=t.dispatchTransactions||e&&function(t){return t.forEach(function(t){return e(t,_this43);});}||function(t){return _this43.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 br(t.state||St.create(t)),t.scrollTo&&t.scrollTo.is(qi)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ki).map(function(t){return new Xi(t);});var _iterator76=_createForOfIteratorHelper(this.plugins),_step76;try{for(_iterator76.s();!(_step76=_iterator76.n()).done;){var _t147=_step76.value;_t147.update(this);}}catch(err){_iterator76.e(err);}finally{_iterator76.f();}this.observer=new Vr(this),this.inputState=new Cs(this),this.inputState.ensureHandlers(this.plugins),this.docView=new us(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure();}return _createClass(Ur,[{key:"state",get:function get(){return this.viewState.state;}},{key:"viewport",get:function get(){return this.viewState.viewport;}},{key:"visibleRanges",get:function get(){return this.viewState.visibleRanges;}},{key:"inView",get:function get(){return this.viewState.inView;}},{key:"composing",get:function get(){return this.inputState.composing>0;}},{key:"compositionStarted",get:function get(){return this.inputState.composing>=0;}},{key:"root",get:function get(){return this._root;}},{key:"win",get:function get(){return this.dom.ownerDocument.defaultView||window;}},{key:"dispatch",value:function dispatch(){var _this$state;for(var _len3=arguments.length,t=new Array(_len3),_key3=0;_key3<_len3;_key3++){t[_key3]=arguments[_key3];}var e=1==t.length&&t[0]instanceof dt?t:1==t.length&&Array.isArray(t[0])?t[0]:[(_this$state=this.state).update.apply(_this$state,t)];this.dispatchTransactions(e,this);}},{key:"update",value:function update(t){var _this44=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");var e,i=!1,s=!1,r=this.state;var _iterator77=_createForOfIteratorHelper(t),_step77;try{for(_iterator77.s();!(_step77=_iterator77.n()).done;){var _e122=_step77.value;if(_e122.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=_e122.state;}}catch(err){_iterator77.e(err);}finally{_iterator77.f();}if(this.destroyed)return void(this.viewState.state=r);var n=this.hasFocus,h=0,l=null;t.some(function(t){return t.annotation(Xs);})?(this.inputState.notifiedFocused=n,h=1):n!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=n,l=Ys(r,n),l||(h=1));var o=this.observer.delayedAndroidKey,u=null;if(o?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(u=null)):this.observer.clear(),r.facet(St.phrases)!=this.state.facet(St.phrases))return this.setState(r);e=os.create(this,r,t),e.flags|=h;var f=this.viewState.scrollTarget;try{this.updateState=2;var _iterator78=_createForOfIteratorHelper(t),_step78;try{for(_iterator78.s();!(_step78=_iterator78.n()).done;){var _e121=_step78.value;if(f&&(f=f.map(_e121.changes)),_e121.scrollIntoView){var _t148=_e121.state.selection.main;f=new Fi(_t148.empty?_t148:B.cursor(_t148.head,_t148.head>_t148.anchor?-1:1));}var _iterator79=_createForOfIteratorHelper(_e121.effects),_step79;try{for(_iterator79.s();!(_step79=_iterator79.n()).done;){var _t149=_step79.value;_t149.is(qi)&&(f=_t149.value.clip(this.state));}}catch(err){_iterator79.e(err);}finally{_iterator79.f();}}}catch(err){_iterator78.e(err);}finally{_iterator78.f();}this.viewState.update(e,f),this.bidiCache=Kr.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(hs)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(i,t.some(function(t){return t.isUserEvent("select.pointer");}));}finally{this.updateState=0;}if(e.startState.facet(Cr)!=e.state.facet(Cr)&&(this.viewState.mustMeasureContent=!0),(i||s||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!e.empty){var _iterator80=_createForOfIteratorHelper(this.state.facet(ji)),_step80;try{for(_iterator80.s();!(_step80=_iterator80.n()).done;){var _t150=_step80.value;try{_t150(e);}catch(t){Ui(this.state,t,"update listener");}}}catch(err){_iterator80.e(err);}finally{_iterator80.f();}}(l||u)&&Promise.resolve().then(function(){l&&_this44.state==l.startState&&_this44.dispatch(l),u&&!Pr(_this44,u)&&o.force&&ve(_this44.contentDOM,o.key,o.keyCode);});}},{key:"setState",value:function 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;var e=this.hasFocus;try{var _iterator81=_createForOfIteratorHelper(this.plugins),_step81;try{for(_iterator81.s();!(_step81=_iterator81.n()).done;){var _t151=_step81.value;_t151.destroy(this);}}catch(err){_iterator81.e(err);}finally{_iterator81.f();}this.viewState=new br(t),this.plugins=t.facet(Ki).map(function(t){return new Xi(t);}),this.pluginMap.clear();var _iterator82=_createForOfIteratorHelper(this.plugins),_step82;try{for(_iterator82.s();!(_step82=_iterator82.n()).done;){var _t152=_step82.value;_t152.update(this);}}catch(err){_iterator82.e(err);}finally{_iterator82.f();}this.docView.destroy(),this.docView=new us(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[];}finally{this.updateState=0;}e&&this.focus(),this.requestMeasure();}},{key:"updatePlugins",value:function updatePlugins(t){var e=t.startState.facet(Ki),i=t.state.facet(Ki);if(e!=i){var _s101=[];var _iterator83=_createForOfIteratorHelper(i),_step83;try{for(_iterator83.s();!(_step83=_iterator83.n()).done;){var _r85=_step83.value;var _i121=e.indexOf(_r85);if(_i121<0)_s101.push(new Xi(_r85));else{var _e123=this.plugins[_i121];_e123.mustUpdate=t,_s101.push(_e123);}}}catch(err){_iterator83.e(err);}finally{_iterator83.f();}var _iterator84=_createForOfIteratorHelper(this.plugins),_step84;try{for(_iterator84.s();!(_step84=_iterator84.n()).done;){var _e124=_step84.value;_e124.mustUpdate!=t&&_e124.destroy(this);}}catch(err){_iterator84.e(err);}finally{_iterator84.f();}this.plugins=_s101,this.pluginMap.clear();}else{var _iterator85=_createForOfIteratorHelper(this.plugins),_step85;try{for(_iterator85.s();!(_step85=_iterator85.n()).done;){var _e125=_step85.value;_e125.mustUpdate=t;}}catch(err){_iterator85.e(err);}finally{_iterator85.f();}}for(var _t153=0;_t153<this.plugins.length;_t153++)this.plugins[_t153].update(this);e!=i&&this.inputState.ensureHandlers(this.plugins);}},{key:"docViewUpdate",value:function docViewUpdate(){var _iterator86=_createForOfIteratorHelper(this.plugins),_step86;try{for(_iterator86.s();!(_step86=_iterator86.n()).done;){var _t154=_step86.value;var _e126=_t154.value;if(_e126&&_e126.docViewUpdate)try{_e126.docViewUpdate(this);}catch(t){Ui(this.state,t,"doc view update listener");}}}catch(err){_iterator86.e(err);}finally{_iterator86.f();}}},{key:"measure",value:function measure(){var _this45=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();var e=null,i=this.scrollDOM,s=i.scrollTop*this.scaleY,_this$viewState=this.viewState,r=_this$viewState.scrollAnchorPos,n=_this$viewState.scrollAnchorHeight;Math.abs(s-this.viewState.scrollTop)>1&&(n=-1),this.viewState.scrollAnchorHeight=-1;try{for(var _t155=0;;_t155++){var _ref13;if(n<0)if(ye(i))r=-1,n=this.viewState.heightMap.height;else{var _t156=this.viewState.scrollAnchorAt(s);r=_t156.from,n=_t156.top;}this.updateState=1;var _h43=this.viewState.measure(this);if(!_h43&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(_t155>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break;}var _l42=[];4&_h43||(_ref13=[_l42,this.measureRequests],this.measureRequests=_ref13[0],_l42=_ref13[1],_ref13);var _o32=_l42.map(function(t){try{return t.read(_this45);}catch(t){return Ui(_this45.state,t),Gr;}}),_u35=os.create(this,this.state,[]),_f19=!1;_u35.flags|=_h43,e?e.flags|=_h43:e=_u35,this.updateState=2,_u35.empty||(this.updatePlugins(_u35),this.inputState.update(_u35),this.updateAttrs(),_f19=this.docView.update(_u35),_f19&&this.docViewUpdate());for(var _t157=0;_t157<_l42.length;_t157++)if(_o32[_t157]!=Gr)try{var _e127=_l42[_t157];_e127.write&&_e127.write(_o32[_t157],this);}catch(t){Ui(this.state,t);}if(_f19&&this.docView.updateSelection(!0),!_u35.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,n=-1;continue;}{var _t158=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-n;if(_t158>1||_t158<-1){s+=_t158,i.scrollTop=s/this.scaleY,n=-1;continue;}}}break;}}}finally{this.updateState=0,this.measureScheduled=-1;}if(e&&!e.empty){var _iterator87=_createForOfIteratorHelper(this.state.facet(ji)),_step87;try{for(_iterator87.s();!(_step87=_iterator87.n()).done;){var _t159=_step87.value;_t159(e);}}catch(err){_iterator87.e(err);}finally{_iterator87.f();}}}},{key:"themeClasses",get:function get(){return Or+" "+(this.state.facet(Dr)?Ir:Er)+" "+this.state.facet(Cr);}},{key:"updateAttrs",value:function updateAttrs(){var _this46=this;var t=_r(this,Yi,{"class":"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Ji)?"true":"false","class":"cm-content",style:"".concat(Ve.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),_r(this,Qi,e);var i=this.observer.ignore(function(){var i=Ze(_this46.contentDOM,_this46.contentAttrs,e),s=Ze(_this46.dom,_this46.editorAttrs,t);return i||s;});return this.editorAttrs=t,this.contentAttrs=e,i;}},{key:"showAnnouncements",value:function showAnnouncements(t){var e=!0;var _iterator88=_createForOfIteratorHelper(t),_step88;try{for(_iterator88.s();!(_step88=_iterator88.n()).done;){var _i122=_step88.value;var _iterator89=_createForOfIteratorHelper(_i122.effects),_step89;try{for(_iterator89.s();!(_step89=_iterator89.n()).done;){var _t160=_step89.value;if(_t160.is(Ur.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=_t160.value;}}}catch(err){_iterator89.e(err);}finally{_iterator89.f();}}}catch(err){_iterator88.e(err);}finally{_iterator88.f();}}},{key:"mountStyles",value:function mountStyles(){this.styleModules=this.state.facet(hs);var t=this.state.facet(Ur.cspNonce);Gt.mount(this.root,this.styleModules.concat(Br).reverse(),t?{nonce:t}:void 0);}},{key:"readMeasured",value:function 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);}},{key:"requestMeasure",value:function requestMeasure(t){var _this47=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(function(){return _this47.measure();})),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(var _e128=0;_e128<this.measureRequests.length;_e128++)if(this.measureRequests[_e128].key===t.key)return void(this.measureRequests[_e128]=t);this.measureRequests.push(t);}}},{key:"plugin",value:function plugin(t){var e=this.pluginMap.get(t);return(void 0===e||e&&e.spec!=t)&&this.pluginMap.set(t,e=this.plugins.find(function(e){return e.spec==t;})||null),e&&e.update(this).value;}},{key:"documentTop",get:function get(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop;}},{key:"documentPadding",get:function get(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom};}},{key:"scaleX",get:function get(){return this.viewState.scaleX;}},{key:"scaleY",get:function get(){return this.viewState.scaleY;}},{key:"elementAtHeight",value:function elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t);}},{key:"lineBlockAtHeight",value:function lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t);}},{key:"viewportLineBlocks",get:function get(){return this.viewState.viewportLines;}},{key:"lineBlockAt",value:function lineBlockAt(t){return this.viewState.lineBlockAt(t);}},{key:"contentHeight",get:function get(){return this.viewState.contentHeight;}},{key:"moveByChar",value:function moveByChar(t,e,i){return As(this,t,xs(this,t,e,i));}},{key:"moveByGroup",value:function moveByGroup(t,e){var _this48=this;return As(this,t,xs(this,t,e,function(e){return function(t,e,i){var s=t.state.charCategorizer(e),r=s(i);return function(t){var e=s(t);return r==kt.Space&&(r=e),r==e;};}(_this48,t.head,e);}));}},{key:"visualLineSide",value:function visualLineSide(t,e){var i=this.bidiSpans(t),s=this.textDirectionAt(t.from),r=i[e?i.length-1:0];return B.cursor(r.side(e,s)+t.from,r.forward(!e,s)?1:-1);}},{key:"moveToLineBoundary",value:function moveToLineBoundary(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;return function(t,e,i,s){var r=Ms(t,e.head),n=s&&r.type==ri.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(n){var _e129=t.dom.getBoundingClientRect(),_s102=t.textDirectionAt(r.from),_h44=t.posAtCoords({x:i==(_s102==pi.LTR)?_e129.right-1:_e129.left+1,y:(n.top+n.bottom)/2});if(null!=_h44)return B.cursor(_h44,i?-1:1);}return B.cursor(i?r.to:r.from,i?-1:1);}(this,t,e,i);}},{key:"moveVertically",value:function moveVertically(t,e,i){return As(this,t,function(t,e,i,s){var r=e.head,n=i?1:-1;if(r==(i?t.state.doc.length:0))return B.cursor(r,e.assoc);var h,l=e.goalColumn,o=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(r,e.assoc||-1),f=t.documentTop;if(u)null==l&&(l=u.left-o.left),h=n<0?u.top:u.bottom;else{var _e130=t.viewState.lineBlockAt(r);null==l&&(l=Math.min(o.right-o.left,t.defaultCharacterWidth*(r-_e130.from))),h=(n<0?_e130.top:_e130.bottom)+f;}var a=o.left+l,c=null!=s?s:t.viewState.heightOracle.textHeight>>1;for(var _e131=0;;_e131+=10){var _i123=h+(c+_e131)*n,_s103=ks(t,{x:a,y:_i123},!1,n);if(_i123<o.top||_i123>o.bottom||(n<0?_s103<r:_s103>r)){var _e132=t.docView.coordsForChar(_s103),_r86=!_e132||_i123<_e132.top?-1:1;return B.cursor(_s103,_r86,void 0,l);}}}(this,t,e,i));}},{key:"domAtPos",value:function domAtPos(t){return this.docView.domAtPos(t);}},{key:"posAtDOM",value:function posAtDOM(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return this.docView.posFromDOM(t,e);}},{key:"posAtCoords",value:function posAtCoords(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;return this.readMeasured(),ks(this,t,e);}},{key:"coordsAtPos",value:function coordsAtPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;this.readMeasured();var i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;var s=this.state.doc.lineAt(t),r=this.bidiSpans(s);return ae(i,r[Si.find(r,t-s.from,-1,e)].dir==pi.LTR==e>0);}},{key:"coordsForChar",value:function coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t);}},{key:"defaultCharacterWidth",get:function get(){return this.viewState.heightOracle.charWidth;}},{key:"defaultLineHeight",get:function get(){return this.viewState.heightOracle.lineHeight;}},{key:"textDirection",get:function get(){return this.viewState.defaultTextDirection;}},{key:"textDirectionAt",value:function textDirectionAt(t){return!this.state.facet(Hi)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t));}},{key:"lineWrapping",get:function get(){return this.viewState.heightOracle.lineWrapping;}},{key:"bidiSpans",value:function bidiSpans(t){if(t.length>Jr)return Ei(t.length);var e,i=this.textDirectionAt(t.from);var _iterator90=_createForOfIteratorHelper(this.bidiCache),_step90;try{for(_iterator90.s();!(_step90=_iterator90.n()).done;){var _s104=_step90.value;if(_s104.from==t.from&&_s104.dir==i&&(_s104.fresh||Ai(_s104.isolates,e=ss(this,t))))return _s104.order;}}catch(err){_iterator90.e(err);}finally{_iterator90.f();}e||(e=ss(this,t));var s=function(t,e,i){if(!t)return[new Si(0,0,e==gi?1:0)];if(e==mi&&!i.length&&!xi.test(t))return Ei(t.length);if(i.length)for(;t.length>Ci.length;)Ci[Ci.length]=256;var s=[],r=e==mi?0:1;return Oi(t,r,r,i,0,t.length,s),s;}(t.text,i,e);return this.bidiCache.push(new Kr(t.from,t.to,i,e,!0,s)),s;}},{key:"hasFocus",get:function get(){var t;return(this.dom.ownerDocument.hasFocus()||Ve.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM;}},{key:"focus",value:function focus(){var _this49=this;this.observer.ignore(function(){we(_this49.contentDOM),_this49.docView.updateSelection();});}},{key:"setRoot",value:function setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles());}},{key:"destroy",value:function destroy(){var _iterator91=_createForOfIteratorHelper(this.plugins),_step91;try{for(_iterator91.s();!(_step91=_iterator91.n()).done;){var _t161=_step91.value;_t161.destroy(this);}}catch(err){_iterator91.e(err);}finally{_iterator91.f();}this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0;}},{key:"scrollSnapshot",value:function scrollSnapshot(){var _this$scrollDOM=this.scrollDOM,t=_this$scrollDOM.scrollTop,e=_this$scrollDOM.scrollLeft,i=this.viewState.scrollAnchorAt(t);return qi.of(new Fi(B.cursor(i.from),"start","start",i.top-t,e,!0));}}],[{key:"scrollIntoView",value:function scrollIntoView(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return qi.of(new Fi("number"==typeof t?B.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin));}},{key:"domEventHandlers",value:function domEventHandlers(t){return _i.define(function(){return{};},{eventHandlers:t});}},{key:"domEventObservers",value:function domEventObservers(t){return _i.define(function(){return{};},{eventObservers:t});}},{key:"theme",value:function theme(t,e){var i=Gt.newName(),s=[Cr.of(i),hs.of(Tr(".".concat(i),t))];return e&&e.dark&&s.push(Dr.of(!0)),s;}},{key:"baseTheme",value:function baseTheme(t){return _.lowest(hs.of(Tr("."+Or,t,Rr)));}},{key:"findFromDOM",value:function findFromDOM(t){var e;var i=t.querySelector(".cm-content"),s=i&&Ce.get(i)||Ce.get(t);return(null===(e=null==s?void 0:s.rootView)||void 0===e?void 0:e.view)||null;}}]);}());Ur.styleModule=hs,Ur.inputHandler=zi,Ur.scrollHandler=Vi,Ur.focusChangeEffect=Pi,Ur.perLineTextDirection=Hi,Ur.exceptionSink=$i,Ur.updateListener=ji,Ur.editable=Ji,Ur.mouseSelectionStyle=Ni,Ur.dragMovesSelection=Li,Ur.clickAddsSelectionRange=Bi,Ur.decorations=Zi,Ur.outerDecorations=ts,Ur.atomicRanges=es,Ur.bidiIsolatedRanges=is,Ur.scrollMargins=rs,Ur.darkTheme=Dr,Ur.cspNonce=$.define({combine:function combine(t){return t.length?t[0]:"";}}),Ur.contentAttributes=Qi,Ur.editorAttributes=Yi,Ur.lineWrapping=Ur.contentAttributes.of({"class":"cm-lineWrapping"}),Ur.announce=ct.define();Jr=4096;Gr={};Kr=/*#__PURE__*/function(){function Kr(t,e,i,s,r,n){_classCallCheck(this,Kr);this.from=t,this.to=e,this.dir=i,this.isolates=s,this.fresh=r,this.order=n;}return _createClass(Kr,null,[{key:"update",value:function update(t,e){if(e.empty&&!t.some(function(t){return t.fresh;}))return t;var i=[],s=t.length?t[t.length-1].dir:pi.LTR;for(var _r87=Math.max(0,t.length-10);_r87<t.length;_r87++){var _n73=t[_r87];_n73.dir!=s||e.touchesRange(_n73.from,_n73.to)||i.push(new Kr(e.mapPos(_n73.from,1),e.mapPos(_n73.to,-1),_n73.dir,_n73.isolates,!1,_n73.order));}return i;}}]);}();Xr=Ve.mac?"mac":Ve.windows?"win":Ve.linux?"linux":"key";Qr=_["default"](Ur.domEventHandlers({keydown:function keydown(t,e){return nn(en(e.state),t,e,"editor");}}));Zr=$.define({enables:Qr});tn=new WeakMap();sn=null;rn=4e3;hn=/*#__PURE__*/function(){function hn(t,e,i,s,r){_classCallCheck(this,hn);this.className=t,this.left=e,this.top=i,this.width=s,this.height=r;}return _createClass(hn,[{key:"draw",value:function draw(){var t=document.createElement("div");return t.className=this.className,this.adjust(t),t;}},{key:"update",value:function update(t,e){return e.className==this.className&&(this.adjust(t),!0);}},{key:"adjust",value:function 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";}},{key:"eq",value:function eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className;}}],[{key:"forRange",value:function forRange(t,e,i){if(i.empty){var _s108=t.coordsAtPos(i.head,i.assoc||1);if(!_s108)return[];var _r90=ln(t);return[new hn(e,_s108.left-_r90.left,_s108.top-_r90.top,null,_s108.bottom-_s108.top)];}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];var s=Math.max(i.from,t.viewport.from),r=Math.min(i.to,t.viewport.to),n=t.textDirection==pi.LTR,h=t.contentDOM,l=h.getBoundingClientRect(),o=ln(t),u=h.querySelector(".cm-line"),f=u&&window.getComputedStyle(u),a=l.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),c=l.right-(f?parseInt(f.paddingRight):0),d=Ms(t,s),p=Ms(t,r),m=d.type==ri.Text?d:null,g=p.type==ri.Text?p:null;m&&(t.lineWrapping||d.widgetLineBreaks)&&(m=on(t,s,m));g&&(t.lineWrapping||p.widgetLineBreaks)&&(g=on(t,r,g));if(m&&g&&m.from==g.from)return b(v(i.from,i.to,m));{var _e138=m?v(i.from,null,m):k(d,!1),_s109=g?v(null,i.to,g):k(p,!0),_r91=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&_e138.bottom+t.defaultLineHeight/2<_s109.top?_r91.push(w(a,_e138.bottom,c,_s109.top)):_e138.bottom<_s109.top&&t.elementAtHeight((_e138.bottom+_s109.top)/2).type==ri.Text&&(_e138.bottom=_s109.top=(_e138.bottom+_s109.top)/2),b(_e138).concat(_r91).concat(b(_s109));}function w(t,i,s,r){return new hn(e,t-o.left,i-o.top-.01,s-t,r-i+.01);}function b(_ref14){var t=_ref14.top,e=_ref14.bottom,i=_ref14.horizontal;var s=[];for(var _r92=0;_r92<i.length;_r92+=2)s.push(w(i[_r92],t,i[_r92+1],e));return s;}function v(e,i,s){var r=1e9,h=-1e9,l=[];function o(e,i,o,u,f){var d=t.coordsAtPos(e,e==s.to?-2:2),p=t.coordsAtPos(o,o==s.from?2:-2);d&&p&&(r=Math.min(d.top,p.top,r),h=Math.max(d.bottom,p.bottom,h),f==pi.LTR?l.push(n&&i?a:d.left,n&&u?c:p.right):l.push(!n&&u?a:p.left,!n&&i?c:d.right));}var u=null!=e?e:s.from,f=null!=i?i:s.to;var _iterator96=_createForOfIteratorHelper(t.visibleRanges),_step96;try{for(_iterator96.s();!(_step96=_iterator96.n()).done;){var _s110=_step96.value;if(_s110.to>u&&_s110.from<f)for(var _r93=Math.max(_s110.from,u),_n76=Math.min(_s110.to,f);;){var _s111=t.state.doc.lineAt(_r93);var _iterator97=_createForOfIteratorHelper(t.bidiSpans(_s111)),_step97;try{for(_iterator97.s();!(_step97=_iterator97.n()).done;){var _h45=_step97.value;var _t165=_h45.from+_s111.from,_l44=_h45.to+_s111.from;if(_t165>=_n76)break;_l44>_r93&&o(Math.max(_t165,_r93),null==e&&_t165<=u,Math.min(_l44,_n76),null==i&&_l44>=f,_h45.dir);}}catch(err){_iterator97.e(err);}finally{_iterator97.f();}if(_r93=_s111.to+1,_r93>=_n76)break;}}}catch(err){_iterator96.e(err);}finally{_iterator96.f();}return 0==l.length&&o(u,null==e,f,null==i,t.textDirection),{top:r,bottom:h,horizontal:l};}function k(t,e){var i=l.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]};}}(t,e,i);}}]);}();un=/*#__PURE__*/function(){function un(t,e){_classCallCheck(this,un);this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e["class"]&&this.dom.classList.add(e["class"]),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t);}return _createClass(un,[{key:"update",value:function update(t){t.startState.facet(fn)!=t.state.facet(fn)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq));}},{key:"docViewUpdate",value:function docViewUpdate(t){!1!==this.layer.updateOnDocViewUpdate&&t.requestMeasure(this.measureReq);}},{key:"setOrder",value:function setOrder(t){var e=0,i=t.facet(fn);for(;e<i.length&&i[e]!=this.layer;)e++;this.dom.style.zIndex=String((this.layer.above?150:-1)-e);}},{key:"measure",value:function measure(){return this.layer.markers(this.view);}},{key:"scale",value:function scale(){var _this$view=this.view,t=_this$view.scaleX,e=_this$view.scaleY;t==this.scaleX&&e==this.scaleY||(this.scaleX=t,this.scaleY=e,this.dom.style.transform="scale(".concat(1/t,", ").concat(1/e,")"));}},{key:"draw",value:function draw(t){var _this50=this;if(t.length!=this.drawn.length||t.some(function(t,e){return i=t,s=_this50.drawn[e],!(i.constructor==s.constructor&&i.eq(s));var i,s;})){var _e139=this.dom.firstChild,_i124=0;var _iterator98=_createForOfIteratorHelper(t),_step98;try{for(_iterator98.s();!(_step98=_iterator98.n()).done;){var _s112=_step98.value;_s112.update&&_e139&&_s112.constructor&&this.drawn[_i124].constructor&&_s112.update(_e139,this.drawn[_i124])?(_e139=_e139.nextSibling,_i124++):this.dom.insertBefore(_s112.draw(),_e139);}}catch(err){_iterator98.e(err);}finally{_iterator98.f();}for(;_e139;){var _t166=_e139.nextSibling;_e139.remove(),_e139=_t166;}this.drawn=t;}}},{key:"destroy",value:function destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove();}}]);}();fn=$.define();cn=!Ve.ios;dn=$.define({combine:function combine(t){return At(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:function cursorBlinkRate(t,e){return Math.min(t,e);},drawRangeCursor:function drawRangeCursor(t,e){return t||e;}});}});mn=an({above:!0,markers:function markers(t){var e=t.state,i=e.facet(dn),s=[];var _iterator99=_createForOfIteratorHelper(e.selection.ranges),_step99;try{for(_iterator99.s();!(_step99=_iterator99.n()).done;){var _r94=_step99.value;var _n77=_r94==e.selection.main;if(_r94.empty?!_n77||cn:i.drawRangeCursor){var _e140=_n77?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",_i125=_r94.empty?_r94:B.cursor(_r94.head,_r94.head>_r94.anchor?-1:1);var _iterator100=_createForOfIteratorHelper(hn.forRange(t,_e140,_i125)),_step100;try{for(_iterator100.s();!(_step100=_iterator100.n()).done;){var _r95=_step100.value;s.push(_r95);}}catch(err){_iterator100.e(err);}finally{_iterator100.f();}}}}catch(err){_iterator99.e(err);}finally{_iterator99.f();}return s;},update:function update(t,e){t.transactions.some(function(t){return t.selection;})&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");var i=pn(t);return i&&gn(t.state,e),t.docChanged||t.selectionSet||i;},mount:function mount(t,e){gn(e.state,t);},"class":"cm-cursorLayer"});wn=an({above:!1,markers:function markers(t){return t.state.selection.ranges.map(function(e){return e.empty?[]:hn.forRange(t,"cm-selectionBackground",e);}).reduce(function(t,e){return t.concat(e);});},update:function update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||pn(t);},"class":"cm-selectionLayer"});bn={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};cn&&(bn[".cm-line"].caretColor="transparent !important",bn[".cm-content"]={caretColor:"transparent !important"});vn=_.highest(Ur.theme(bn));kn=ct.define({map:function map(t,e){return null==t?null:e.mapPos(t);}});yn=F.define({create:function create(){return null;},update:function update(t,e){return null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(function(t,e){return e.is(kn)?e.value:t;},t);}});Mn=_i.fromClass(/*#__PURE__*/function(){function _class(t){_classCallCheck(this,_class);this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)};}return _createClass(_class,[{key:"update",value:function update(t){var e;var i=t.state.field(yn);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(yn)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq));}},{key:"readPos",value:function readPos(){var t=this.view,e=t.state.field(yn),i=null!=e&&t.coordsAtPos(e);if(!i)return null;var s=t.scrollDOM.getBoundingClientRect();return{left:i.left-s.left+t.scrollDOM.scrollLeft*t.scaleX,top:i.top-s.top+t.scrollDOM.scrollTop*t.scaleY,height:i.bottom-i.top};}},{key:"drawCursor",value:function drawCursor(t){if(this.cursor){var _this$view2=this.view,_e141=_this$view2.scaleX,_i126=_this$view2.scaleY;t?(this.cursor.style.left=t.left/_e141+"px",this.cursor.style.top=t.top/_i126+"px",this.cursor.style.height=t.height/_i126+"px"):this.cursor.style.left="-100000px";}}},{key:"destroy",value:function destroy(){this.cursor&&this.cursor.remove();}},{key:"setDropPos",value:function setDropPos(t){this.view.state.field(yn)!=t&&this.view.dispatch({effects:kn.of(t)});}}]);}(),{eventObservers:{dragover:function dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}));},dragleave:function dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null);},dragend:function dragend(){this.setDropPos(null);},drop:function drop(){this.setDropPos(null);}}});Sn=/*#__PURE__*/function(){function Sn(t){_classCallCheck(this,Sn);var e=t.regexp,i=t.decoration,s=t.decorate,r=t.boundary,_t$maxLength=t.maxLength,n=_t$maxLength===void 0?1e3:_t$maxLength;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=function(t,e,i,r){return s(r,i,i+t[0].length,t,e);};else if("function"==typeof i)this.addMatch=function(t,e,s,r){var n=i(t,e,s);n&&r(s,s+t[0].length,n);};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,s,r){return r(s,s+t[0].length,i);};}this.boundary=r,this.maxLength=n;}return _createClass(Sn,[{key:"createDeco",value:function createDeco(t){var _this51=this;var e=new Rt(),i=e.add.bind(e);var _iterator101=_createForOfIteratorHelper(function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;var s=[];var _iterator102=_createForOfIteratorHelper(i),_step102;try{for(_iterator102.s();!(_step102=_iterator102.n()).done;){var _step102$value=_step102.value,_r96=_step102$value.from,_n79=_step102$value.to;_r96=Math.max(t.state.doc.lineAt(_r96).from,_r96-e),_n79=Math.min(t.state.doc.lineAt(_n79).to,_n79+e),s.length&&s[s.length-1].to>=_r96?s[s.length-1].to=_n79:s.push({from:_r96,to:_n79});}}catch(err){_iterator102.e(err);}finally{_iterator102.f();}return s;}(t,this.maxLength)),_step101;try{for(_iterator101.s();!(_step101=_iterator101.n()).done;){var _step101$value=_step101.value,_e142=_step101$value.from,_s113=_step101$value.to;xn(t.state.doc,this.regexp,_e142,_s113,function(e,s){return _this51.addMatch(s,t,e,i);});}}catch(err){_iterator101.e(err);}finally{_iterator101.f();}return e.finish();}},{key:"updateDeco",value:function updateDeco(t,e){var i=1e9,s=-1;return t.docChanged&&t.changes.iterChanges(function(e,r,n,h){h>t.view.viewport.from&&n<t.view.viewport.to&&(i=Math.min(n,i),s=Math.max(h,s));}),t.viewportChanged||s-i>1e3?this.createDeco(t.view):s>-1?this.updateRange(t.view,e.map(t.changes),i,s):e;}},{key:"updateRange",value:function updateRange(t,e,i,s){var _this52=this;var _iterator103=_createForOfIteratorHelper(t.visibleRanges),_step103;try{var _loop9=function _loop9(){var r=_step103.value;var n=Math.max(r.from,i),h=Math.min(r.to,s);if(h>n){var _i127=t.state.doc.lineAt(n),_s114=_i127.to<h?t.state.doc.lineAt(h):_i127,_l46=Math.max(r.from,_i127.from),_o33=Math.min(r.to,_s114.to);if(_this52.boundary){for(;n>_i127.from;n--)if(_this52.boundary.test(_i127.text[n-1-_i127.from])){_l46=n;break;}for(;h<_s114.to;h++)if(_this52.boundary.test(_s114.text[h-_s114.from])){_o33=h;break;}}var _u36,_f20=[],_a13=function _a13(t,e,i){return _f20.push(i.range(t,e));};if(_i127==_s114)for(_this52.regexp.lastIndex=_l46-_i127.from;(_u36=_this52.regexp.exec(_i127.text))&&_u36.index<_o33-_i127.from;)_this52.addMatch(_u36,t,_u36.index+_i127.from,_a13);else xn(t.state.doc,_this52.regexp,_l46,_o33,function(e,i){return _this52.addMatch(i,t,e,_a13);});e=e.update({filterFrom:_l46,filterTo:_o33,filter:function filter(t,e){return t<_l46||e>_o33;},add:_f20});}};for(_iterator103.s();!(_step103=_iterator103.n()).done;){_loop9();}}catch(err){_iterator103.e(err);}finally{_iterator103.f();}return e;}}]);}();An=null!=/x/.unicode?"gu":"g";Cn=new RegExp("[\0-\b\n-\x1F\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]",An);Dn={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"};On=null;En=$.define({combine:function combine(t){var e=At(t,{render:null,specialChars:Cn,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==On&&"undefined"!=typeof document&&document.body){var _e143=document.body.style;On=null!=(null!==(t=_e143.tabSize)&&void 0!==t?t:_e143.MozTabSize);}return On||!1;}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,An)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,An)),e;}});In=null;Rn=/*#__PURE__*/function(_si4){function Rn(t,e){var _this53;_classCallCheck(this,Rn);_this53=_callSuper(this,Rn),_this53.options=t,_this53.code=e;return _this53;}_inherits(Rn,_si4);return _createClass(Rn,[{key:"eq",value:function eq(t){return t.code==this.code;}},{key:"toDOM",value:function toDOM(t){var e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t);}(this.code),i=t.state.phrase("Control character")+" "+(Dn[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,e);if(s)return s;var r=document.createElement("span");return r.textContent=e,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);Tn=/*#__PURE__*/function(_si5){function Tn(t){var _this54;_classCallCheck(this,Tn);_this54=_callSuper(this,Tn),_this54.width=t;return _this54;}_inherits(Tn,_si5);return _createClass(Tn,[{key:"eq",value:function eq(t){return t.width==this.width;}},{key:"toDOM",value:function toDOM(){var t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);Bn=ni.line({"class":"cm-activeLine"});Ln=_i.fromClass(/*#__PURE__*/function(){function _class2(t){_classCallCheck(this,_class2);this.decorations=this.getDeco(t);}return _createClass(_class2,[{key:"update",value:function update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view));}},{key:"getDeco",value:function getDeco(t){var e=-1,i=[];var _iterator104=_createForOfIteratorHelper(t.state.selection.ranges),_step104;try{for(_iterator104.s();!(_step104=_iterator104.n()).done;){var _s115=_step104.value;var _r97=t.lineBlockAt(_s115.head);_r97.from>e&&(i.push(Bn.range(_r97.from)),e=_r97.from);}}catch(err){_iterator104.e(err);}finally{_iterator104.f();}return ni.set(i);}}]);}(),{decorations:function decorations(t){return t.decorations;}});Nn=2e3;zn={Alt:[18,function(t){return!!t.altKey;}],Control:[17,function(t){return!!t.ctrlKey;}],Shift:[16,function(t){return!!t.shiftKey;}],Meta:[91,function(t){return!!t.metaKey;}]};Pn={style:"cursor: crosshair"};Hn="-10000px";Wn=/*#__PURE__*/function(){function Wn(t,e,i,s){_classCallCheck(this,Wn);this.facet=e,this.createTooltipView=i,this.removeTooltipView=s,this.input=t.state.facet(e),this.tooltips=this.input.filter(function(t){return t;});var r=null;this.tooltipViews=this.tooltips.map(function(t){return r=i(t,r);});}return _createClass(Wn,[{key:"update",value:function update(t,e){var i;var s=t.state.facet(this.facet),r=s.filter(function(t){return t;});if(s===this.input){var _iterator105=_createForOfIteratorHelper(this.tooltipViews),_step105;try{for(_iterator105.s();!(_step105=_iterator105.n()).done;){var _e148=_step105.value;_e148.update&&_e148.update(t);}}catch(err){_iterator105.e(err);}finally{_iterator105.f();}return!1;}var n=[],h=e?[]:null;for(var _i130=0;_i130<r.length;_i130++){var _s117=r[_i130],_l49=-1;if(_s117){for(var _t167=0;_t167<this.tooltips.length;_t167++){var _e149=this.tooltips[_t167];_e149&&_e149.create==_s117.create&&(_l49=_t167);}if(_l49<0)n[_i130]=this.createTooltipView(_s117,_i130?n[_i130-1]:null),h&&(h[_i130]=!!_s117.above);else{var _s118=n[_i130]=this.tooltipViews[_l49];h&&(h[_i130]=e[_l49]),_s118.update&&_s118.update(t);}}}var _iterator106=_createForOfIteratorHelper(this.tooltipViews),_step106;try{for(_iterator106.s();!(_step106=_iterator106.n()).done;){var _t168=_step106.value;n.indexOf(_t168)<0&&(this.removeTooltipView(_t168),null===(i=_t168.destroy)||void 0===i||i.call(_t168));}}catch(err){_iterator106.e(err);}finally{_iterator106.f();}return e&&(h.forEach(function(t,i){return e[i]=t;}),e.length=h.length),this.input=s,this.tooltips=r,this.tooltipViews=n,!0;}}]);}();Fn=$.define({combine:function combine(t){var e,i,s;return{position:Ve.ios?"absolute":(null===(e=t.find(function(t){return t.position;}))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find(function(t){return t.parent;}))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(s=t.find(function(t){return t.tooltipSpace;}))||void 0===s?void 0:s.tooltipSpace)||Vn};}});qn=new WeakMap();Un=_i.fromClass(/*#__PURE__*/function(){function _class3(t){var _this55=this;_classCallCheck(this,_class3);this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;var e=t.state.facet(Fn);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(function(){return _this55.measureSoon();}):null,this.manager=new Wn(t,Kn,function(t,e){return _this55.createTooltip(t,e);},function(t){_this55.resizeObserver&&_this55.resizeObserver.unobserve(t.dom),t.dom.remove();}),this.above=this.manager.tooltips.map(function(t){return!!t.above;}),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(function(t){Date.now()>_this55.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&_this55.measureSoon();},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure();}return _createClass(_class3,[{key:"createContainer",value:function 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;}},{key:"observeIntersection",value:function observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();var _iterator107=_createForOfIteratorHelper(this.manager.tooltipViews),_step107;try{for(_iterator107.s();!(_step107=_iterator107.n()).done;){var _t169=_step107.value;this.intersectionObserver.observe(_t169.dom);}}catch(err){_iterator107.e(err);}finally{_iterator107.f();}}}},{key:"measureSoon",value:function measureSoon(){var _this56=this;this.measureTimeout<0&&(this.measureTimeout=setTimeout(function(){_this56.measureTimeout=-1,_this56.maybeMeasure();},50));}},{key:"update",value:function update(t){t.transactions.length&&(this.lastTransaction=Date.now());var e=this.manager.update(t,this.above);e&&this.observeIntersection();var i=e||t.geometryChanged,s=t.state.facet(Fn);if(s.position!=this.position&&!this.madeAbsolute){this.position=s.position;var _iterator108=_createForOfIteratorHelper(this.manager.tooltipViews),_step108;try{for(_iterator108.s();!(_step108=_iterator108.n()).done;){var _t170=_step108.value;_t170.dom.style.position=this.position;}}catch(err){_iterator108.e(err);}finally{_iterator108.f();}i=!0;}if(s.parent!=this.parent){this.parent&&this.container.remove(),this.parent=s.parent,this.createContainer();var _iterator109=_createForOfIteratorHelper(this.manager.tooltipViews),_step109;try{for(_iterator109.s();!(_step109=_iterator109.n()).done;){var _t171=_step109.value;this.container.appendChild(_t171.dom);}}catch(err){_iterator109.e(err);}finally{_iterator109.f();}i=!0;}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure();}},{key:"createTooltip",value:function createTooltip(t,e){var i=t.create(this.view),s=e?e.dom:null;if(i.dom.classList.add("cm-tooltip"),t.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){var _t172=document.createElement("div");_t172.className="cm-tooltip-arrow",i.dom.appendChild(_t172);}return i.dom.style.position=this.position,i.dom.style.top=Hn,i.dom.style.left="0px",this.container.insertBefore(i.dom,s),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i;}},{key:"destroy",value:function destroy(){var t,e,i;this.view.win.removeEventListener("resize",this.measureSoon);var _iterator110=_createForOfIteratorHelper(this.manager.tooltipViews),_step110;try{for(_iterator110.s();!(_step110=_iterator110.n()).done;){var _e150=_step110.value;_e150.dom.remove(),null===(t=_e150.destroy)||void 0===t||t.call(_e150);}}catch(err){_iterator110.e(err);}finally{_iterator110.f();}this.parent&&this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(i=this.intersectionObserver)||void 0===i||i.disconnect(),clearTimeout(this.measureTimeout);}},{key:"readMeasure",value:function readMeasure(){var _this57=this;var t=this.view.dom.getBoundingClientRect(),e=1,i=1,s=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){var _t173=this.manager.tooltipViews[0].dom;if(Ve.gecko)s=_t173.offsetParent!=this.container.ownerDocument.body;else if(_t173.style.top==Hn&&"0px"==_t173.style.left){var _e151=_t173.getBoundingClientRect();s=Math.abs(_e151.top+1e4)>1||Math.abs(_e151.left)>1;}}if(s||"absolute"==this.position)if(this.parent){var _t174=this.parent.getBoundingClientRect();_t174.width&&_t174.height&&(e=_t174.width/this.parent.offsetWidth,i=_t174.height/this.parent.offsetHeight);}else{var _this$view$viewState=this.view.viewState;e=_this$view$viewState.scaleX;i=_this$view$viewState.scaleY;}return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(function(t,e){var i=_this57.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):_this57.view.coordsAtPos(t.pos);}),size:this.manager.tooltipViews.map(function(_ref15){var t=_ref15.dom;return t.getBoundingClientRect();}),space:this.view.state.facet(Fn).tooltipSpace(this.view),scaleX:e,scaleY:i,makeAbsolute:s};}},{key:"writeMeasure",value:function writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";var _iterator111=_createForOfIteratorHelper(this.manager.tooltipViews),_step111;try{for(_iterator111.s();!(_step111=_iterator111.n()).done;){var _t175=_step111.value;_t175.dom.style.position="absolute";}}catch(err){_iterator111.e(err);}finally{_iterator111.f();}}var i=t.editor,s=t.space,r=t.scaleX,n=t.scaleY,h=[];for(var _l50=0;_l50<this.manager.tooltips.length;_l50++){var _o34=this.manager.tooltips[_l50],_u37=this.manager.tooltipViews[_l50],_f21=_u37.dom,_a14=t.pos[_l50],_c12=t.size[_l50];if(!_a14||_a14.bottom<=Math.max(i.top,s.top)||_a14.top>=Math.min(i.bottom,s.bottom)||_a14.right<Math.max(i.left,s.left)-.1||_a14.left>Math.min(i.right,s.right)+.1){_f21.style.top=Hn;continue;}var _d7=_o34.arrow?_u37.dom.querySelector(".cm-tooltip-arrow"):null,_p6=_d7?7:0,_m4=_c12.right-_c12.left,_g4=null!==(e=qn.get(_u37))&&void 0!==e?e:_c12.bottom-_c12.top,_w=_u37.offset||Gn,_b=this.view.textDirection==pi.LTR,_v=_c12.width>s.right-s.left?_b?s.left:s.right-_c12.width:_b?Math.min(_a14.left-(_d7?14:0)+_w.x,s.right-_m4):Math.max(s.left,_a14.left-_m4+(_d7?14:0)-_w.x),_k=this.above[_l50];!_o34.strictSide&&(_k?_a14.top-(_c12.bottom-_c12.top)-_w.y<s.top:_a14.bottom+(_c12.bottom-_c12.top)+_w.y>s.bottom)&&_k==s.bottom-_a14.bottom>_a14.top-s.top&&(_k=this.above[_l50]=!_k);var _y=(_k?_a14.top-s.top:s.bottom-_a14.bottom)-_p6;if(_y<_g4&&!1!==_u37.resize){if(_y<this.view.defaultLineHeight){_f21.style.top=Hn;continue;}qn.set(_u37,_g4),_f21.style.height=(_g4=_y)/n+"px";}else _f21.style.height&&(_f21.style.height="");var _M=_k?_a14.top-_g4-_p6-_w.y:_a14.bottom+_p6+_w.y,_x=_v+_m4;if(!0!==_u37.overlap){var _iterator112=_createForOfIteratorHelper(h),_step112;try{for(_iterator112.s();!(_step112=_iterator112.n()).done;){var _t176=_step112.value;_t176.left<_x&&_t176.right>_v&&_t176.top<_M+_g4&&_t176.bottom>_M&&(_M=_k?_t176.top-_g4-2-_p6:_t176.bottom+_p6+2);}}catch(err){_iterator112.e(err);}finally{_iterator112.f();}}if("absolute"==this.position?(_f21.style.top=(_M-t.parent.top)/n+"px",_f21.style.left=(_v-t.parent.left)/r+"px"):(_f21.style.top=_M/n+"px",_f21.style.left=_v/r+"px"),_d7){var _t177=_a14.left+(_b?_w.x:-_w.x)-(_v+14-7);_d7.style.left=_t177/r+"px";}!0!==_u37.overlap&&h.push({left:_v,top:_M,right:_x,bottom:_M+_g4}),_f21.classList.toggle("cm-tooltip-above",_k),_f21.classList.toggle("cm-tooltip-below",!_k),_u37.positioned&&_u37.positioned(t.space);}}},{key:"maybeMeasure",value:function 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))){var _iterator113=_createForOfIteratorHelper(this.manager.tooltipViews),_step113;try{for(_iterator113.s();!(_step113=_iterator113.n()).done;){var _t178=_step113.value;_t178.dom.style.top=Hn;}}catch(err){_iterator113.e(err);}finally{_iterator113.f();}}}}]);}(),{eventObservers:{scroll:function scroll(){this.maybeMeasure();}}});Jn=Ur.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"}}});Gn={x:0,y:0};Kn=$.define({enables:[Un,Jn]});_n=$.define({combine:function combine(t){return t.reduce(function(t,e){return t.concat(e);},[]);}});Xn=/*#__PURE__*/function(){function Xn(t){var _this58=this;_classCallCheck(this,Xn);this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Wn(t,_n,function(t,e){return _this58.createHostedView(t,e);},function(t){return t.dom.remove();});}return _createClass(Xn,[{key:"createHostedView",value:function createHostedView(t,e){var i=t.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i;}},{key:"mount",value:function mount(t){var _iterator114=_createForOfIteratorHelper(this.manager.tooltipViews),_step114;try{for(_iterator114.s();!(_step114=_iterator114.n()).done;){var _e152=_step114.value;_e152.mount&&_e152.mount(t);}}catch(err){_iterator114.e(err);}finally{_iterator114.f();}this.mounted=!0;}},{key:"positioned",value:function positioned(t){var _iterator115=_createForOfIteratorHelper(this.manager.tooltipViews),_step115;try{for(_iterator115.s();!(_step115=_iterator115.n()).done;){var _e153=_step115.value;_e153.positioned&&_e153.positioned(t);}}catch(err){_iterator115.e(err);}finally{_iterator115.f();}}},{key:"update",value:function update(t){this.manager.update(t);}},{key:"destroy",value:function destroy(){var t;var _iterator116=_createForOfIteratorHelper(this.manager.tooltipViews),_step116;try{for(_iterator116.s();!(_step116=_iterator116.n()).done;){var _e154=_step116.value;null===(t=_e154.destroy)||void 0===t||t.call(_e154);}}catch(err){_iterator116.e(err);}finally{_iterator116.f();}}},{key:"passProp",value:function passProp(t){var e;var _iterator117=_createForOfIteratorHelper(this.manager.tooltipViews),_step117;try{for(_iterator117.s();!(_step117=_iterator117.n()).done;){var _i131=_step117.value;var _s119=_i131[t];if(void 0!==_s119)if(void 0===e)e=_s119;else if(e!==_s119)return;}}catch(err){_iterator117.e(err);}finally{_iterator117.f();}return e;}},{key:"offset",get:function get(){return this.passProp("offset");}},{key:"getCoords",get:function get(){return this.passProp("getCoords");}},{key:"overlap",get:function get(){return this.passProp("overlap");}},{key:"resize",get:function get(){return this.passProp("resize");}}],[{key:"create",value:function create(t){return new Xn(t);}}]);}();Yn=Kn.compute([_n],function(t){var e=t.facet(_n);return 0===e.length?null:{pos:Math.min.apply(Math,_toConsumableArray(e.map(function(t){return t.pos;}))),end:Math.max.apply(Math,_toConsumableArray(e.map(function(t){var e;return null!==(e=t.end)&&void 0!==e?e:t.pos;}))),create:Xn.create,above:e[0].above,arrow:e.some(function(t){return t.arrow;})};});Qn=/*#__PURE__*/function(){function Qn(t,e,i,s,r){_classCallCheck(this,Qn);this.view=t,this.source=e,this.field=i,this.setHover=s,this.hoverTime=r,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));}return _createClass(Qn,[{key:"update",value:function update(){var _this59=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(function(){return _this59.startHover();},20));}},{key:"active",get:function get(){return this.view.state.field(this.field);}},{key:"checkHover",value:function checkHover(){if(this.hoverTimeout=-1,this.active.length)return;var t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover();}},{key:"startHover",value:function startHover(){var _this60=this;clearTimeout(this.restartTimeout);var t=this.view,e=this.lastMove,i=t.docView.nearest(e.target);if(!i)return;var s,r=1;if(i instanceof Ue)s=i.posAtStart;else{if(s=t.posAtCoords(e),null==s)return;var _i132=t.coordsAtPos(s);if(!_i132||e.y<_i132.top||e.y>_i132.bottom||e.x<_i132.left-t.defaultCharacterWidth||e.x>_i132.right+t.defaultCharacterWidth)return;var _n80=t.bidiSpans(t.state.doc.lineAt(s)).find(function(t){return t.from<=s&&t.to>=s;}),_h49=_n80&&_n80.dir==pi.RTL?-1:1;r=e.x<_i132.left?-_h49:_h49;}var n=this.source(t,s,r);if(null==n?void 0:n.then){var _e155=this.pending={pos:s};n.then(function(i){_this60.pending==_e155&&(_this60.pending=null,!i||Array.isArray(i)&&!i.length||t.dispatch({effects:_this60.setHover.of(Array.isArray(i)?i:[i])}));},function(e){return Ui(t.state,e,"hover tooltip");});}else!n||Array.isArray(n)&&!n.length||t.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])});}},{key:"tooltip",get:function get(){var t=this.view.plugin(Un),e=t?t.manager.tooltips.findIndex(function(t){return t.create==Xn.create;}):-1;return e>-1?t.manager.tooltipViews[e]:null;}},{key:"mousemove",value:function mousemove(t){var e,i;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));var s=this.active,r=this.tooltip;if(s.length&&r&&!function(t,e){var i=t.getBoundingClientRect();return e.clientX>=i.left-Zn&&e.clientX<=i.right+Zn&&e.clientY>=i.top-Zn&&e.clientY<=i.bottom+Zn;}(r.dom,t)||this.pending){var _ref16=s[0]||this.pending,_r99=_ref16.pos,_n81=null!==(i=null===(e=s[0])||void 0===e?void 0:e.end)&&void 0!==i?i:_r99;(_r99==_n81?this.view.posAtCoords(this.lastMove)==_r99:function(t,e,i,s,r,n){var h=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(h.left>s||h.right<s||h.top>r||Math.min(h.bottom,l)<r)return!1;var o=t.posAtCoords({x:s,y:r},!1);return o>=e&&o<=i;}(this.view,_r99,_n81,t.clientX,t.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null);}}},{key:"mouseleave",value:function mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;var e=this.active;if(e.length){var _e156=this.tooltip;_e156&&_e156.dom.contains(t.relatedTarget)?this.watchTooltipLeave(_e156.dom):this.view.dispatch({effects:this.setHover.of([])});}}},{key:"watchTooltipLeave",value:function watchTooltipLeave(t){var _this61=this;var e=function e(i){t.removeEventListener("mouseleave",e),_this61.active.length&&!_this61.view.dom.contains(i.relatedTarget)&&_this61.view.dispatch({effects:_this61.setHover.of([])});};t.addEventListener("mouseleave",e);}},{key:"destroy",value:function destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove);}}]);}();Zn=4;ih=ct.define();sh=$.define({combine:function combine(t){var e,i;var _iterator120=_createForOfIteratorHelper(t),_step120;try{for(_iterator120.s();!(_step120=_iterator120.n()).done;){var _s120=_step120.value;e=e||_s120.topContainer,i=i||_s120.bottomContainer;}}catch(err){_iterator120.e(err);}finally{_iterator120.f();}return{topContainer:e,bottomContainer:i};}});nh=_i.fromClass(/*#__PURE__*/function(){function _class4(t){_classCallCheck(this,_class4);this.input=t.state.facet(oh),this.specs=this.input.filter(function(t){return t;}),this.panels=this.specs.map(function(e){return e(t);});var e=t.state.facet(sh);this.top=new hh(t,!0,e.topContainer),this.bottom=new hh(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(function(t){return t.top;})),this.bottom.sync(this.panels.filter(function(t){return!t.top;}));var _iterator121=_createForOfIteratorHelper(this.panels),_step121;try{for(_iterator121.s();!(_step121=_iterator121.n()).done;){var _t180=_step121.value;_t180.dom.classList.add("cm-panel"),_t180.mount&&_t180.mount();}}catch(err){_iterator121.e(err);}finally{_iterator121.f();}}return _createClass(_class4,[{key:"update",value:function update(t){var e=t.state.facet(sh);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new hh(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new hh(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();var i=t.state.facet(oh);if(i!=this.input){var _e159=i.filter(function(t){return t;}),_s121=[],_r101=[],_n82=[],_h50=[];var _iterator122=_createForOfIteratorHelper(_e159),_step122;try{for(_iterator122.s();!(_step122=_iterator122.n()).done;){var _i135=_step122.value;var _e160=void 0,_l51=this.specs.indexOf(_i135);_l51<0?(_e160=_i135(t.view),_h50.push(_e160)):(_e160=this.panels[_l51],_e160.update&&_e160.update(t)),_s121.push(_e160),(_e160.top?_r101:_n82).push(_e160);}}catch(err){_iterator122.e(err);}finally{_iterator122.f();}this.specs=_e159,this.panels=_s121,this.top.sync(_r101),this.bottom.sync(_n82);for(var _i134=0,_h51=_h50;_i134<_h51.length;_i134++){var _t181=_h51[_i134];_t181.dom.classList.add("cm-panel"),_t181.mount&&_t181.mount();}}else{var _iterator123=_createForOfIteratorHelper(this.panels),_step123;try{for(_iterator123.s();!(_step123=_iterator123.n()).done;){var _e161=_step123.value;_e161.update&&_e161.update(t);}}catch(err){_iterator123.e(err);}finally{_iterator123.f();}}}},{key:"destroy",value:function destroy(){this.top.sync([]),this.bottom.sync([]);}}]);}(),{provide:function provide(t){return Ur.scrollMargins.of(function(e){var i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()};});}});hh=/*#__PURE__*/function(){function hh(t,e,i){_classCallCheck(this,hh);this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses();}return _createClass(hh,[{key:"sync",value:function sync(t){var _iterator124=_createForOfIteratorHelper(this.panels),_step124;try{for(_iterator124.s();!(_step124=_iterator124.n()).done;){var _e162=_step124.value;_e162.destroy&&t.indexOf(_e162)<0&&_e162.destroy();}}catch(err){_iterator124.e(err);}finally{_iterator124.f();}this.panels=t,this.syncDOM();}},{key:"syncDOM",value:function 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";var _t182=this.container||this.view.dom;_t182.insertBefore(this.dom,this.top?_t182.firstChild:null);}var t=this.dom.firstChild;var _iterator125=_createForOfIteratorHelper(this.panels),_step125;try{for(_iterator125.s();!(_step125=_iterator125.n()).done;){var _e163=_step125.value;if(_e163.dom.parentNode==this.dom){for(;t!=_e163.dom;)t=lh(t);t=t.nextSibling;}else this.dom.insertBefore(_e163.dom,t);}}catch(err){_iterator125.e(err);}finally{_iterator125.f();}for(;t;)t=lh(t);}},{key:"scrollMargin",value:function 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);}},{key:"syncClasses",value:function syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){var _iterator126=_createForOfIteratorHelper(this.classes.split(" ")),_step126;try{for(_iterator126.s();!(_step126=_iterator126.n()).done;){var _t183=_step126.value;_t183&&this.container.classList.remove(_t183);}}catch(err){_iterator126.e(err);}finally{_iterator126.f();}var _iterator127=_createForOfIteratorHelper((this.classes=this.view.themeClasses).split(" ")),_step127;try{for(_iterator127.s();!(_step127=_iterator127.n()).done;){var _t184=_step127.value;_t184&&this.container.classList.add(_t184);}}catch(err){_iterator127.e(err);}finally{_iterator127.f();}}}}]);}();oh=$.define({enables:nh});uh=/*#__PURE__*/function(_Ct2){function uh(){_classCallCheck(this,uh);return _callSuper(this,uh,arguments);}_inherits(uh,_Ct2);return _createClass(uh,[{key:"compare",value:function compare(t){return this==t||this.constructor==t.constructor&&this.eq(t);}},{key:"eq",value:function eq(t){return!1;}},{key:"destroy",value:function destroy(t){}}]);}(Ct);uh.prototype.elementClass="",uh.prototype.toDOM=void 0,uh.prototype.mapMode=x.TrackBefore,uh.prototype.startSide=uh.prototype.endSide=-1,uh.prototype.point=!0;fh=$.define();ah={"class":"",renderEmptyElements:!1,elementStyle:"",markers:function markers(){return It.empty;},lineMarker:function lineMarker(){return null;},widgetMarker:function widgetMarker(){return null;},lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}};ch=$.define();ph=$.define({combine:function combine(t){return t.some(function(t){return t;});}});gh=_i.fromClass(/*#__PURE__*/function(){function _class5(t){_classCallCheck(this,_class5);this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(ch).map(function(e){return new kh(t,e);});var _iterator128=_createForOfIteratorHelper(this.gutters),_step128;try{for(_iterator128.s();!(_step128=_iterator128.n()).done;){var _t185=_step128.value;this.dom.appendChild(_t185.dom);}}catch(err){_iterator128.e(err);}finally{_iterator128.f();}this.fixed=!t.state.facet(ph),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM);}return _createClass(_class5,[{key:"update",value:function update(t){if(this.updateGutters(t)){var _e164=this.prevViewport,_i136=t.view.viewport,_s122=Math.min(_e164.to,_i136.to)-Math.max(_e164.from,_i136.from);this.syncGutters(_s122<.8*(_i136.to-_i136.from));}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(ph)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport;}},{key:"syncGutters",value:function syncGutters(t){var _this62=this;var e=this.dom.nextSibling;t&&this.dom.remove();var i=It.iter(this.view.state.facet(fh),this.view.viewport.from),s=[],r=this.gutters.map(function(t){return new vh(t,_this62.view.viewport,-_this62.view.documentPadding.top);});var _iterator129=_createForOfIteratorHelper(this.view.viewportLineBlocks),_step129;try{for(_iterator129.s();!(_step129=_iterator129.n()).done;){var _t186=_step129.value;if(s.length&&(s=[]),Array.isArray(_t186.type)){var _e165=!0;var _iterator131=_createForOfIteratorHelper(_t186.type),_step131;try{for(_iterator131.s();!(_step131=_iterator131.n()).done;){var _n83=_step131.value;if(_n83.type==ri.Text&&_e165){bh(i,s,_n83.from);var _iterator132=_createForOfIteratorHelper(r),_step132;try{for(_iterator132.s();!(_step132=_iterator132.n()).done;){var _t187=_step132.value;_t187.line(this.view,_n83,s);}}catch(err){_iterator132.e(err);}finally{_iterator132.f();}_e165=!1;}else if(_n83.widget){var _iterator133=_createForOfIteratorHelper(r),_step133;try{for(_iterator133.s();!(_step133=_iterator133.n()).done;){var _t188=_step133.value;_t188.widget(this.view,_n83);}}catch(err){_iterator133.e(err);}finally{_iterator133.f();}}}}catch(err){_iterator131.e(err);}finally{_iterator131.f();}}else if(_t186.type==ri.Text){bh(i,s,_t186.from);var _iterator134=_createForOfIteratorHelper(r),_step134;try{for(_iterator134.s();!(_step134=_iterator134.n()).done;){var _e166=_step134.value;_e166.line(this.view,_t186,s);}}catch(err){_iterator134.e(err);}finally{_iterator134.f();}}else if(_t186.widget){var _iterator135=_createForOfIteratorHelper(r),_step135;try{for(_iterator135.s();!(_step135=_iterator135.n()).done;){var _e167=_step135.value;_e167.widget(this.view,_t186);}}catch(err){_iterator135.e(err);}finally{_iterator135.f();}}}}catch(err){_iterator129.e(err);}finally{_iterator129.f();}var _iterator130=_createForOfIteratorHelper(r),_step130;try{for(_iterator130.s();!(_step130=_iterator130.n()).done;){var _t189=_step130.value;_t189.finish();}}catch(err){_iterator130.e(err);}finally{_iterator130.f();}t&&this.view.scrollDOM.insertBefore(this.dom,e);}},{key:"updateGutters",value:function updateGutters(t){var e=t.startState.facet(ch),i=t.state.facet(ch),s=t.docChanged||t.heightChanged||t.viewportChanged||!It.eq(t.startState.facet(fh),t.state.facet(fh),t.view.viewport.from,t.view.viewport.to);if(e==i){var _iterator136=_createForOfIteratorHelper(this.gutters),_step136;try{for(_iterator136.s();!(_step136=_iterator136.n()).done;){var _e168=_step136.value;_e168.update(t)&&(s=!0);}}catch(err){_iterator136.e(err);}finally{_iterator136.f();}}else{s=!0;var _r102=[];var _iterator137=_createForOfIteratorHelper(i),_step137;try{for(_iterator137.s();!(_step137=_iterator137.n()).done;){var _s123=_step137.value;var _i138=e.indexOf(_s123);_i138<0?_r102.push(new kh(this.view,_s123)):(this.gutters[_i138].update(t),_r102.push(this.gutters[_i138]));}}catch(err){_iterator137.e(err);}finally{_iterator137.f();}var _iterator138=_createForOfIteratorHelper(this.gutters),_step138;try{for(_iterator138.s();!(_step138=_iterator138.n()).done;){var _t191=_step138.value;_t191.dom.remove(),_r102.indexOf(_t191)<0&&_t191.destroy();}}catch(err){_iterator138.e(err);}finally{_iterator138.f();}for(var _i137=0,_r103=_r102;_i137<_r103.length;_i137++){var _t190=_r103[_i137];this.dom.appendChild(_t190.dom);}this.gutters=_r102;}return s;}},{key:"destroy",value:function destroy(){var _iterator139=_createForOfIteratorHelper(this.gutters),_step139;try{for(_iterator139.s();!(_step139=_iterator139.n()).done;){var _t192=_step139.value;_t192.destroy();}}catch(err){_iterator139.e(err);}finally{_iterator139.f();}this.dom.remove();}}]);}(),{provide:function provide(t){return Ur.scrollMargins.of(function(e){var i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==pi.LTR?{left:i.dom.offsetWidth*e.scaleX}:{right:i.dom.offsetWidth*e.scaleX}:null;});}});vh=/*#__PURE__*/function(){function vh(t,e,i){_classCallCheck(this,vh);this.gutter=t,this.height=i,this.i=0,this.cursor=It.iter(t.markers,e.from);}return _createClass(vh,[{key:"addElement",value:function addElement(t,e,i){var s=this.gutter,r=(e.top-this.height)/t.scaleY,n=e.height/t.scaleY;if(this.i==s.elements.length){var _e169=new yh(t,n,r,i);s.elements.push(_e169),s.dom.appendChild(_e169.dom);}else s.elements[this.i].update(t,n,r,i);this.height=e.bottom,this.i++;}},{key:"line",value:function line(t,e,i){var s=[];bh(this.cursor,s,e.from),i.length&&(s=s.concat(i));var r=this.gutter.config.lineMarker(t,e,s);r&&s.unshift(r);var n=this.gutter;(0!=s.length||n.config.renderEmptyElements)&&this.addElement(t,e,s);}},{key:"widget",value:function widget(t,e){var i=this.gutter.config.widgetMarker(t,e.widget,e);i&&this.addElement(t,e,[i]);}},{key:"finish",value:function finish(){var t=this.gutter;for(;t.elements.length>this.i;){var _e170=t.elements.pop();t.dom.removeChild(_e170.dom),_e170.destroy();}}}]);}();kh=/*#__PURE__*/function(){function kh(t,e){var _this63=this;_classCallCheck(this,kh);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"]:"");var _loop10=function _loop10(_i139){_this63.dom.addEventListener(_i139,function(s){var r,n=s.target;if(n!=_this63.dom&&_this63.dom.contains(n)){for(;n.parentNode!=_this63.dom;)n=n.parentNode;var _t193=n.getBoundingClientRect();r=(_t193.top+_t193.bottom)/2;}else r=s.clientY;var h=t.lineBlockAtHeight(r-t.documentTop);e.domEventHandlers[_i139](t,h,s)&&s.preventDefault();});};for(var _i139 in e.domEventHandlers){_loop10(_i139);}this.markers=wh(e.markers(t)),e.initialSpacer&&(this.spacer=new yh(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none");}return _createClass(kh,[{key:"update",value:function update(t){var e=this.markers;if(this.markers=wh(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){var _e171=this.config.updateSpacer(this.spacer.markers[0],t);_e171!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[_e171]);}var i=t.view.viewport;return!It.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t);}},{key:"destroy",value:function destroy(){var _iterator140=_createForOfIteratorHelper(this.elements),_step140;try{for(_iterator140.s();!(_step140=_iterator140.n()).done;){var _t194=_step140.value;_t194.destroy();}}catch(err){_iterator140.e(err);}finally{_iterator140.f();}}}]);}();yh=/*#__PURE__*/function(){function yh(t,e,i,s){_classCallCheck(this,yh);this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,s);}return _createClass(yh,[{key:"update",value:function update(t,e,i,s){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(var _i140=0;_i140<t.length;_i140++)if(!t[_i140].compare(e[_i140]))return!1;return!0;}(this.markers,s)||this.setMarkers(t,s);}},{key:"setMarkers",value:function setMarkers(t,e){var i="cm-gutterElement",s=this.dom.firstChild;for(var _r104=0,_n84=0;;){var _h52=_n84,_l52=_r104<e.length?e[_r104++]:null,_o35=!1;if(_l52){var _t195=_l52.elementClass;_t195&&(i+=" "+_t195);for(var _t196=_n84;_t196<this.markers.length;_t196++)if(this.markers[_t196].compare(_l52)){_h52=_t196,_o35=!0;break;}}else _h52=this.markers.length;for(;_n84<_h52;){var _t197=this.markers[_n84++];if(_t197.toDOM){_t197.destroy(s);var _e172=s.nextSibling;s.remove(),s=_e172;}}if(!_l52)break;_l52.toDOM&&(_o35?s=s.nextSibling:this.dom.insertBefore(_l52.toDOM(t),s)),_o35&&_n84++;}this.dom.className=i,this.markers=e;}},{key:"destroy",value:function destroy(){this.setMarkers(null,[]);}}]);}();Mh=$.define();xh=$.define({combine:function combine(t){return At(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers:function domEventHandlers(t,e){var i=Object.assign({},t);var _loop11=function _loop11(){var s=i[_t198],r=e[_t198];i[_t198]=s?function(t,e,i){return s(t,e,i)||r(t,e,i);}:r;};for(var _t198 in e){_loop11();}return i;}});}});Sh=/*#__PURE__*/function(_uh){function Sh(t){var _this64;_classCallCheck(this,Sh);_this64=_callSuper(this,Sh),_this64.number=t;return _this64;}_inherits(Sh,_uh);return _createClass(Sh,[{key:"eq",value:function eq(t){return this.number==t.number;}},{key:"toDOM",value:function toDOM(){return document.createTextNode(this.number);}}]);}(uh);Ch=ch.compute([xh],function(t){return{"class":"cm-lineNumbers",renderEmptyElements:!1,markers:function markers(t){return t.state.facet(Mh);},lineMarker:function lineMarker(t,e,i){return i.some(function(t){return t.toDOM;})?null:new Sh(Ah(t,t.state.doc.lineAt(e.from).number));},widgetMarker:function widgetMarker(){return null;},lineMarkerChange:function lineMarkerChange(t){return t.startState.facet(xh)!=t.state.facet(xh);},initialSpacer:function initialSpacer(t){return new Sh(Ah(t,Oh(t.state.doc.lines)));},updateSpacer:function updateSpacer(t,e){var i=Ah(e.view,Oh(e.view.state.doc.lines));return i==t.number?t:new Sh(i);},domEventHandlers:t.facet(xh).domEventHandlers};});Eh=new(/*#__PURE__*/function(_uh2){function _class6(){var _this65;_classCallCheck(this,_class6);_this65=_callSuper(this,_class6,arguments),_this65.elementClass="cm-activeLineGutter";return _this65;}_inherits(_class6,_uh2);return _createClass(_class6);}(uh))();Ih=fh.compute(["selection"],function(t){var e=[],i=-1;var _iterator141=_createForOfIteratorHelper(t.selection.ranges),_step141;try{for(_iterator141.s();!(_step141=_iterator141.n()).done;){var _s124=_step141.value;var _r105=t.doc.lineAt(_s124.head).from;_r105>i&&(i=_r105,e.push(Eh.range(_r105)));}}catch(err){_iterator141.e(err);}finally{_iterator141.f();}return It.of(e);});_export("D",Rh=1024);Th=0;Bh=/*#__PURE__*/_createClass(function Bh(t,e){_classCallCheck(this,Bh);this.from=t,this.to=e;});_export("b",Lh=/*#__PURE__*/function(){function Lh(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,Lh);this.id=Th++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||function(){throw new Error("This node type doesn't define a deserialize function");};}return _createClass(Lh,[{key:"add",value:function add(t){var _this66=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=jh.match(t)),function(e){var i=t(e);return void 0===i?null:[_this66,i];};}}]);}());Lh.closedBy=new Lh({deserialize:function deserialize(t){return t.split(" ");}}),Lh.openedBy=new Lh({deserialize:function deserialize(t){return t.split(" ");}}),Lh.group=new Lh({deserialize:function deserialize(t){return t.split(" ");}}),Lh.isolate=new Lh({deserialize:function deserialize(t){if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto";}}),Lh.contextHash=new Lh({perNode:!0}),Lh.lookAhead=new Lh({perNode:!0}),Lh.mounted=new Lh({perNode:!0});Nh=/*#__PURE__*/function(){function Nh(t,e,i){_classCallCheck(this,Nh);this.tree=t,this.overlay=e,this.parser=i;}return _createClass(Nh,null,[{key:"get",value:function get(t){return t&&t.props&&t.props[Lh.mounted.id];}}]);}();$h=Object.create(null);_export("a",jh=/*#__PURE__*/function(){function jh(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;_classCallCheck(this,jh);this.name=t,this.props=e,this.id=i,this.flags=s;}return _createClass(jh,[{key:"prop",value:function prop(t){return this.props[t.id];}},{key:"isTop",get:function get(){return(1&this.flags)>0;}},{key:"isSkipped",get:function get(){return(2&this.flags)>0;}},{key:"isError",get:function get(){return(4&this.flags)>0;}},{key:"isAnonymous",get:function get(){return(8&this.flags)>0;}},{key:"is",value:function is(t){if("string"==typeof t){if(this.name==t)return!0;var _e173=this.prop(Lh.group);return!!_e173&&_e173.indexOf(t)>-1;}return this.id==t;}}],[{key:"define",value:function define(t){var e=t.props&&t.props.length?Object.create(null):$h,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),s=new jh(t.name||"",e,t.id,i);if(t.props){var _iterator142=_createForOfIteratorHelper(t.props),_step142;try{for(_iterator142.s();!(_step142=_iterator142.n()).done;){var _i141=_step142.value;if(Array.isArray(_i141)||(_i141=_i141(s)),_i141){if(_i141[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[_i141[0].id]=_i141[1];}}}catch(err){_iterator142.e(err);}finally{_iterator142.f();}}return s;}},{key:"match",value:function match(t){var e=Object.create(null);for(var _i142 in t){var _iterator143=_createForOfIteratorHelper(_i142.split(" ")),_step143;try{for(_iterator143.s();!(_step143=_iterator143.n()).done;){var _s125=_step143.value;e[_s125]=t[_i142];}}catch(err){_iterator143.e(err);}finally{_iterator143.f();}}return function(t){for(var _i143=t.prop(Lh.group),_s126=-1;_s126<(_i143?_i143.length:0);_s126++){var _r106=e[_s126<0?t.name:_i143[_s126]];if(_r106)return _r106;}};}}]);}());jh.none=new jh("",Object.create(null),0,8);_export("N",zh=/*#__PURE__*/function(){function zh(t){_classCallCheck(this,zh);this.types=t;for(var _e174=0;_e174<t.length;_e174++)if(t[_e174].id!=_e174)throw new RangeError("Node type ids should correspond to array positions when creating a node set");}return _createClass(zh,[{key:"extend",value:function extend(){var e=[];for(var _len4=arguments.length,t=new Array(_len4),_key4=0;_key4<_len4;_key4++){t[_key4]=arguments[_key4];}var _iterator144=_createForOfIteratorHelper(this.types),_step144;try{for(_iterator144.s();!(_step144=_iterator144.n()).done;){var _i144=_step144.value;var _s127=null;var _iterator145=_createForOfIteratorHelper(t),_step145;try{for(_iterator145.s();!(_step145=_iterator145.n()).done;){var _e175=_step145.value;var _t199=_e175(_i144);_t199&&(_s127||(_s127=Object.assign({},_i144.props)),_s127[_t199[0].id]=_t199[1]);}}catch(err){_iterator145.e(err);}finally{_iterator145.f();}e.push(_s127?new jh(_i144.name,_s127,_i144.id,_i144.flags):_i144);}}catch(err){_iterator144.e(err);}finally{_iterator144.f();}return new zh(e);}}]);}());Ph=new WeakMap();Hh=new WeakMap();!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays";}(Wh||_export("I",Wh={}));_export("T",Vh=/*#__PURE__*/function(){function Vh(t,e,i,s,r){_classCallCheck(this,Vh);if(this.type=t,this.children=e,this.positions=i,this.length=s,this.props=null,r&&r.length){this.props=Object.create(null);var _iterator146=_createForOfIteratorHelper(r),_step146;try{for(_iterator146.s();!(_step146=_iterator146.n()).done;){var _step146$value=_slicedToArray(_step146.value,2),_t200=_step146$value[0],_e176=_step146$value[1];this.props["number"==typeof _t200?_t200:_t200.id]=_e176;}}catch(err){_iterator146.e(err);}finally{_iterator146.f();}}}return _createClass(Vh,[{key:"toString",value:function toString(){var t=Nh.get(this);if(t&&!t.overlay)return t.tree.toString();var e="";var _iterator147=_createForOfIteratorHelper(this.children),_step147;try{for(_iterator147.s();!(_step147=_iterator147.n()).done;){var _t201=_step147.value;var _i145=_t201.toString();_i145&&(e&&(e+=","),e+=_i145);}}catch(err){_iterator147.e(err);}finally{_iterator147.f();}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e;}},{key:"cursor",value:function cursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return new el(this.topNode,t);}},{key:"cursorAt",value:function cursorAt(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=Ph.get(this)||this.topNode,r=new el(s);return r.moveTo(t,e),Ph.set(this,r._tree),r;}},{key:"topNode",get:function get(){return new Kh(this,0,0,null);}},{key:"resolve",value:function resolve(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=Jh(Ph.get(this)||this.topNode,t,e,!1);return Ph.set(this,i),i;}},{key:"resolveInner",value:function resolveInner(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=Jh(Hh.get(this)||this.topNode,t,e,!0);return Hh.set(this,i),i;}},{key:"resolveStack",value:function resolveStack(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return function(t,e,i){var s=t.resolveInner(e,i),r=null;for(var _t202=s instanceof Kh?s:s.context.parent;_t202;_t202=_t202.parent)if(_t202.index<0){var _n85=_t202.parent;(r||(r=[s])).push(_n85.resolve(e,i)),_t202=_n85;}else{var _n86=Nh.get(_t202.tree);if(_n86&&_n86.overlay&&_n86.overlay[0].from<=e&&_n86.overlay[_n86.overlay.length-1].to>=e){var _h53=new Kh(_n86.tree,_n86.overlay[0].from+_t202.from,-1,_t202);(r||(r=[s])).push(Jh(_h53,e,i,!1));}}return r?Zh(r):s;}(this,t,e);}},{key:"iterate",value:function iterate(t){var e=t.enter,i=t.leave,_t$from=t.from,s=_t$from===void 0?0:_t$from,_t$to=t.to,r=_t$to===void 0?this.length:_t$to,n=t.mode||0,h=(n&Wh.IncludeAnonymous)>0;for(var _t203=this.cursor(n|Wh.IncludeAnonymous);;){var _n87=!1;if(_t203.from<=r&&_t203.to>=s&&(!h&&_t203.type.isAnonymous||!1!==e(_t203))){if(_t203.firstChild())continue;_n87=!0;}for(;_n87&&i&&(h||!_t203.type.isAnonymous)&&i(_t203),!_t203.nextSibling();){if(!_t203.parent())return;_n87=!0;}}}},{key:"prop",value:function prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t);}},{key:"propValues",get:function get(){var t=[];if(this.props)for(var _e177 in this.props)t.push([+_e177,this.props[_e177]]);return t;}},{key:"balance",value:function balance(){var _this67=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return this.children.length<=8?this:nl(jh.none,this.children,this.positions,0,this.children.length,0,this.length,function(t,e,i){return new Vh(_this67.type,t,e,i,_this67.propValues);},t.makeTree||function(t,e,i){return new Vh(jh.none,t,e,i);});}}],[{key:"build",value:function build(t){return function(t){var e;var i=t.buffer,s=t.nodeSet,_t$maxBufferLength=t.maxBufferLength,r=_t$maxBufferLength===void 0?Rh:_t$maxBufferLength,_t$reused=t.reused,n=_t$reused===void 0?[]:_t$reused,_t$minRepeatType=t.minRepeatType,h=_t$minRepeatType===void 0?s.types.length:_t$minRepeatType,l=Array.isArray(i)?new Fh(i,i.length):i,o=s.types,u=0,f=0;function a(t,e,i,b,v,k){var y=l.id,M=l.start,x=l.end,S=l.size,A=f;for(;S<0;){if(l.next(),-1==S){var _e178=n[y];return i.push(_e178),void b.push(M-t);}if(-3==S)return void(u=y);if(-4==S)return void(f=y);throw new RangeError("Unrecognized record size: ".concat(S));}var C,D,O=o[y],E=M-t;if(x-M<=r&&(D=g(l.pos-e,v))){var _e179=new Uint16Array(D.size-D.skip),_i146=l.pos-D.size,_r107=_e179.length;for(;l.pos>_i146;)_r107=w(D.start,_e179,_r107);C=new qh(_e179,x-D.start,s),E=D.start-t;}else{var _t204=l.pos-S;l.next();var _e180=[],_i147=[],_s128=y>=h?y:-1,_n88=0,_o36=x;for(;l.pos>_t204;)_s128>=0&&l.id==_s128&&l.size>=0?(l.end<=_o36-r&&(p(_e180,_i147,M,_n88,l.end,_o36,_s128,A),_n88=_e180.length,_o36=l.end),l.next()):k>2500?c(M,_t204,_e180,_i147):a(M,_t204,_e180,_i147,_s128,k+1);if(_s128>=0&&_n88>0&&_n88<_e180.length&&p(_e180,_i147,M,_n88,M,_o36,_s128,A),_e180.reverse(),_i147.reverse(),_s128>-1&&_n88>0){var _t205=d(O);C=nl(O,_e180,_i147,0,_e180.length,0,x-M,_t205,_t205);}else C=m(O,_e180,_i147,x-M,A-x);}i.push(C),b.push(E);}function c(t,e,i,n){var h=[],o=0,u=-1;for(;l.pos>e;){var _t206=l.id,_e181=l.start,_i148=l.end,_s129=l.size;if(_s129>4)l.next();else{if(u>-1&&_e181<u)break;u<0&&(u=_i148-r),h.push(_t206,_e181,_i148),o++,l.next();}}if(o){var _e182=new Uint16Array(4*o),_r108=h[h.length-2];for(var _t207=h.length-3,_i149=0;_t207>=0;_t207-=3)_e182[_i149++]=h[_t207],_e182[_i149++]=h[_t207+1]-_r108,_e182[_i149++]=h[_t207+2]-_r108,_e182[_i149++]=_i149;i.push(new qh(_e182,h[2]-_r108,s)),n.push(_r108-t);}}function d(t){return function(e,i,s){var r,n,h=0,l=e.length-1;if(l>=0&&(r=e[l])instanceof Vh){if(!l&&r.type==t&&r.length==s)return r;(n=r.prop(Lh.lookAhead))&&(h=i[l]+r.length+n);}return m(t,e,i,s,h);};}function p(t,e,i,r,n,h,l,o){var u=[],f=[];for(;t.length>r;)u.push(t.pop()),f.push(e.pop()+i-n);t.push(m(s.types[l],u,f,h-n,o-h)),e.push(n-i);}function m(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var n=arguments.length>5?arguments[5]:undefined;if(u){var _t208=[Lh.contextHash,u];n=n?[_t208].concat(n):[_t208];}if(r>25){var _t209=[Lh.lookAhead,r];n=n?[_t209].concat(n):[_t209];}return new Vh(t,e,i,s,n);}function g(t,e){var i=l.fork(),s=0,n=0,o=0,u=i.end-r,f={size:0,start:0,skip:0};t:for(var _r109=i.pos-t;i.pos>_r109;){var _t210=i.size;if(i.id==e&&_t210>=0){f.size=s,f.start=n,f.skip=o,o+=4,s+=4,i.next();continue;}var _l53=i.pos-_t210;if(_t210<0||_l53<_r109||i.start<u)break;var _a15=i.id>=h?4:0,_c13=i.start;for(i.next();i.pos>_l53;){if(i.size<0){if(-3!=i.size)break t;_a15+=4;}else i.id>=h&&(_a15+=4);i.next();}n=_c13,s+=_t210,o+=_a15;}return(e<0||s==t)&&(f.size=s,f.start=n,f.skip=o),f.size>4?f:void 0;}function w(t,e,i){var s=l.id,r=l.start,n=l.end,o=l.size;if(l.next(),o>=0&&s<h){var _h54=i;if(o>4){var _s130=l.pos-(o-4);for(;l.pos>_s130;)i=w(t,e,i);}e[--i]=_h54,e[--i]=n-t,e[--i]=r-t,e[--i]=s;}else-3==o?u=s:-4==o&&(f=s);return i;}var b=[],v=[];for(;l.pos>0;)a(t.start||0,t.bufferStart||0,b,v,-1,0);var k=null!==(e=t.length)&&void 0!==e?e:b.length?v[0]+b[0].length:0;return new Vh(o[t.topID],b.reverse(),v.reverse(),k);}(t);}}]);}());Vh.empty=new Vh(jh.none,[],[],0);Fh=/*#__PURE__*/function(){function Fh(t,e){_classCallCheck(this,Fh);this.buffer=t,this.index=e;}return _createClass(Fh,[{key:"id",get:function get(){return this.buffer[this.index-4];}},{key:"start",get:function get(){return this.buffer[this.index-3];}},{key:"end",get:function get(){return this.buffer[this.index-2];}},{key:"size",get:function get(){return this.buffer[this.index-1];}},{key:"pos",get:function get(){return this.index;}},{key:"next",value:function next(){this.index-=4;}},{key:"fork",value:function fork(){return new Fh(this.buffer,this.index);}}]);}();qh=/*#__PURE__*/function(){function qh(t,e,i){_classCallCheck(this,qh);this.buffer=t,this.length=e,this.set=i;}return _createClass(qh,[{key:"type",get:function get(){return jh.none;}},{key:"toString",value:function toString(){var t=[];for(var _e183=0;_e183<this.buffer.length;)t.push(this.childString(_e183)),_e183=this.buffer[_e183+3];return t.join(",");}},{key:"childString",value:function childString(t){var e=this.buffer[t],i=this.buffer[t+3],s=this.set.types[e],r=s.name;if(/\W/.test(r)&&!s.isError&&(r=JSON.stringify(r)),i==(t+=4))return r;var n=[];for(;t<i;)n.push(this.childString(t)),t=this.buffer[t+3];return r+"("+n.join(",")+")";}},{key:"findChild",value:function findChild(t,e,i,s,r){var n=this.buffer,h=-1;for(var _l54=t;_l54!=e&&!(Uh(r,s,n[_l54+1],n[_l54+2])&&(h=_l54,i>0));_l54=n[_l54+3]);return h;}},{key:"slice",value:function slice(t,e,i){var s=this.buffer,r=new Uint16Array(e-t),n=0;for(var _h55=t,_l55=0;_h55<e;){r[_l55++]=s[_h55++],r[_l55++]=s[_h55++]-i;var _e184=r[_l55++]=s[_h55++]-i;r[_l55++]=s[_h55++]-t,n=Math.max(n,_e184);}return new qh(r,n,this.set);}}]);}();Gh=/*#__PURE__*/function(){function Gh(){_classCallCheck(this,Gh);}return _createClass(Gh,[{key:"cursor",value:function cursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return new el(this,t);}},{key:"getChild",value:function getChild(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var s=_h(this,t,e,i);return s.length?s[0]:null;}},{key:"getChildren",value:function getChildren(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return _h(this,t,e,i);}},{key:"resolve",value:function resolve(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Jh(this,t,e,!1);}},{key:"resolveInner",value:function resolveInner(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Jh(this,t,e,!0);}},{key:"matchContext",value:function matchContext(t){return Xh(this,t);}},{key:"enterUnfinishedNodesBefore",value:function enterUnfinishedNodesBefore(t){var e=this.childBefore(t),i=this;for(;e;){var _t211=e.lastChild;if(!_t211||_t211.to!=e.to)break;_t211.type.isError&&_t211.from==_t211.to?(i=e,e=_t211.prevSibling):e=_t211;}return i;}},{key:"node",get:function get(){return this;}},{key:"next",get:function get(){return this.parent;}}]);}();Kh=/*#__PURE__*/function(_Gh){function Kh(t,e,i,s){var _this68;_classCallCheck(this,Kh);_this68=_callSuper(this,Kh),_this68._tree=t,_this68.from=e,_this68.index=i,_this68._parent=s;return _this68;}_inherits(Kh,_Gh);return _createClass(Kh,[{key:"type",get:function get(){return this._tree.type;}},{key:"name",get:function get(){return this._tree.type.name;}},{key:"to",get:function get(){return this.from+this._tree.length;}},{key:"nextChild",value:function nextChild(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;for(var _n89=this;;){for(var _n89$_tree=_n89._tree,_h57=_n89$_tree.children,_l56=_n89$_tree.positions,_o37=e>0?_h57.length:-1;t!=_o37;t+=e){var _o38=_h57[t],_u38=_l56[t]+_n89.from;if(Uh(s,i,_u38,_u38+_o38.length))if(_o38 instanceof qh){if(r&Wh.ExcludeBuffers)continue;var _h58=_o38.findChild(0,_o38.buffer.length,e,i-_u38,s);if(_h58>-1)return new Qh(new Yh(_n89,_o38,t,_u38),null,_h58);}else if(r&Wh.IncludeAnonymous||!_o38.type.isAnonymous||il(_o38)){var _h59=void 0;if(!(r&Wh.IgnoreMounts)&&(_h59=Nh.get(_o38))&&!_h59.overlay)return new Kh(_h59.tree,_u38,t,_n89);var _l57=new Kh(_o38,_u38,t,_n89);return r&Wh.IncludeAnonymous||!_l57.type.isAnonymous?_l57:_l57.nextChild(e<0?_o38.children.length-1:0,e,i,s);}}if(r&Wh.IncludeAnonymous||!_n89.type.isAnonymous)return null;if(t=_n89.index>=0?_n89.index+e:e<0?-1:_n89._parent._tree.children.length,_n89=_n89._parent,!_n89)return null;}}},{key:"firstChild",get:function get(){return this.nextChild(0,1,0,4);}},{key:"lastChild",get:function get(){return this.nextChild(this._tree.children.length-1,-1,0,4);}},{key:"childAfter",value:function childAfter(t){return this.nextChild(0,1,t,2);}},{key:"childBefore",value:function childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2);}},{key:"enter",value:function enter(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s;if(!(i&Wh.IgnoreOverlays)&&(s=Nh.get(this._tree))&&s.overlay){var _i150=t-this.from;var _iterator148=_createForOfIteratorHelper(s.overlay),_step148;try{for(_iterator148.s();!(_step148=_iterator148.n()).done;){var _step148$value=_step148.value,_t212=_step148$value.from,_r110=_step148$value.to;if((e>0?_t212<=_i150:_t212<_i150)&&(e<0?_r110>=_i150:_r110>_i150))return new Kh(s.tree,s.overlay[0].from+this.from,-1,this);}}catch(err){_iterator148.e(err);}finally{_iterator148.f();}}return this.nextChild(0,1,t,e,i);}},{key:"nextSignificantParent",value:function nextSignificantParent(){var t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t;}},{key:"parent",get:function get(){return this._parent?this._parent.nextSignificantParent():null;}},{key:"nextSibling",get:function get(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null;}},{key:"prevSibling",get:function get(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null;}},{key:"tree",get:function get(){return this._tree;}},{key:"toTree",value:function toTree(){return this._tree;}},{key:"toString",value:function toString(){return this._tree.toString();}}]);}(Gh);Yh=/*#__PURE__*/_createClass(function Yh(t,e,i,s){_classCallCheck(this,Yh);this.parent=t,this.buffer=e,this.index=i,this.start=s;});Qh=/*#__PURE__*/function(_Gh2){function Qh(t,e,i){var _this69;_classCallCheck(this,Qh);_this69=_callSuper(this,Qh),_this69.context=t,_this69._parent=e,_this69.index=i,_this69.type=t.buffer.set.types[t.buffer.buffer[i]];return _this69;}_inherits(Qh,_Gh2);return _createClass(Qh,[{key:"name",get:function get(){return this.type.name;}},{key:"from",get:function get(){return this.context.start+this.context.buffer.buffer[this.index+1];}},{key:"to",get:function get(){return this.context.start+this.context.buffer.buffer[this.index+2];}},{key:"child",value:function child(t,e,i){var s=this.context.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],t,e-this.context.start,i);return r<0?null:new Qh(this.context,this,r);}},{key:"firstChild",get:function get(){return this.child(1,0,4);}},{key:"lastChild",get:function get(){return this.child(-1,0,4);}},{key:"childAfter",value:function childAfter(t){return this.child(1,t,2);}},{key:"childBefore",value:function childBefore(t){return this.child(-1,t,-2);}},{key:"enter",value:function enter(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;if(i&Wh.ExcludeBuffers)return null;var s=this.context.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new Qh(this.context,this,r);}},{key:"parent",get:function get(){return this._parent||this.context.parent.nextSignificantParent();}},{key:"externalSibling",value:function externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4);}},{key:"nextSibling",get:function get(){var t=this.context.buffer,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Qh(this.context,this._parent,e):this.externalSibling(1);}},{key:"prevSibling",get:function get(){var t=this.context.buffer,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new Qh(this.context,this._parent,t.findChild(e,this.index,-1,0,4));}},{key:"tree",get:function get(){return null;}},{key:"toTree",value:function toTree(){var t=[],e=[],i=this.context.buffer,s=this.index+4,r=i.buffer[this.index+3];if(r>s){var _n90=i.buffer[this.index+1];t.push(i.slice(s,r,_n90)),e.push(0);}return new Vh(this.type,t,e,this.to-this.from);}},{key:"toString",value:function toString(){return this.context.buffer.childString(this.index);}}]);}(Gh);tl=/*#__PURE__*/function(){function tl(t,e){_classCallCheck(this,tl);this.heads=t,this.node=e;}return _createClass(tl,[{key:"next",get:function get(){return Zh(this.heads);}}]);}();el=/*#__PURE__*/function(){function el(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;_classCallCheck(this,el);if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Kh)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(var _e186=t._parent;_e186;_e186=_e186._parent)this.stack.unshift(_e186.index);this.bufferNode=t,this.yieldBuf(t.index);}}return _createClass(el,[{key:"name",get:function get(){return this.type.name;}},{key:"yieldNode",value:function yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0);}},{key:"yieldBuf",value:function yieldBuf(t,e){this.index=t;var _this$buffer=this.buffer,i=_this$buffer.start,s=_this$buffer.buffer;return this.type=e||s.set.types[s.buffer[t]],this.from=i+s.buffer[t+1],this.to=i+s.buffer[t+2],!0;}},{key:"yield",value:function _yield(t){return!!t&&(t instanceof Kh?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)));}},{key:"toString",value:function toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString();}},{key:"enterChild",value:function enterChild(t,e,i){if(!this.buffer)return this["yield"](this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));var s=this.buffer.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],t,e-this.buffer.start,i);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r));}},{key:"firstChild",value:function firstChild(){return this.enterChild(1,0,4);}},{key:"lastChild",value:function lastChild(){return this.enterChild(-1,0,4);}},{key:"childAfter",value:function childAfter(t){return this.enterChild(1,t,2);}},{key:"childBefore",value:function childBefore(t){return this.enterChild(-1,t,-2);}},{key:"enter",value:function enter(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.mode;return this.buffer?!(i&Wh.ExcludeBuffers)&&this.enterChild(1,t,e):this["yield"](this._tree.enter(t,e,i));}},{key:"parent",value:function parent(){if(!this.buffer)return this.yieldNode(this.mode&Wh.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&Wh.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t);}},{key:"sibling",value:function sibling(t){if(!this.buffer)return!!this._tree._parent&&this["yield"](this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));var e=this.buffer.buffer,i=this.stack.length-1;if(t<0){var _t214=i<0?0:this.stack[i]+4;if(this.index!=_t214)return this.yieldBuf(e.findChild(_t214,this.index,-1,0,4));}else{var _t215=e.buffer[this.index+3];if(_t215<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(_t215);}return i<0&&this["yield"](this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode));}},{key:"nextSibling",value:function nextSibling(){return this.sibling(1);}},{key:"prevSibling",value:function prevSibling(){return this.sibling(-1);}},{key:"atLastNode",value:function atLastNode(t){var e,i,s=this.buffer;if(s){if(t>0){if(this.index<s.buffer.buffer.length)return!1;}else for(var _t216=0;_t216<this.index;_t216++)if(s.buffer.buffer[_t216+3]<this.index)return!1;e=s.index;i=s.parent;}else{var _this$_tree=this._tree;e=_this$_tree.index;i=_this$_tree._parent;}for(;i;_i151=i,e=_i151.index,i=_i151._parent,_i151){var _i151;if(e>-1)for(var _s135=e+t,_r112=t<0?-1:i._tree.children.length;_s135!=_r112;_s135+=t){var _t217=i._tree.children[_s135];if(this.mode&Wh.IncludeAnonymous||_t217 instanceof qh||!_t217.type.isAnonymous||il(_t217))return!1;}}return!0;}},{key:"move",value:function move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1;}}},{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;return this.move(1,t);}},{key:"prev",value:function prev(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;return this.move(-1,t);}},{key:"moveTo",value:function moveTo(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this;}},{key:"node",get:function get(){if(!this.buffer)return this._tree;var t=this.bufferNode,e=null,i=0;if(t&&t.context==this.buffer)t:for(var _s136=this.index,_r113=this.stack.length;_r113>=0;){for(var _n91=t;_n91;_n91=_n91._parent)if(_n91.index==_s136){if(_s136==this.index)return _n91;e=_n91,i=_r113+1;break t;}_s136=this.stack[--_r113];}for(var _t218=i;_t218<this.stack.length;_t218++)e=new Qh(this.buffer,e,this.stack[_t218]);return this.bufferNode=new Qh(this.buffer,e,this.index);}},{key:"tree",get:function get(){return this.buffer?null:this._tree._tree;}},{key:"iterate",value:function iterate(t,e){for(var _i152=0;;){var _s137=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){_i152++;continue;}this.type.isAnonymous||(_s137=!0);}for(;_s137&&e&&e(this),_s137=this.type.isAnonymous,!this.nextSibling();){if(!_i152)return;this.parent(),_i152--,_s137=!0;}}}},{key:"matchContext",value:function matchContext(t){if(!this.buffer)return Xh(this.node,t);var e=this.buffer.buffer,i=e.set.types;for(var _s138=t.length-1,_r114=this.stack.length-1;_s138>=0;_r114--){if(_r114<0)return Xh(this.node,t,_s138);var _n92=i[e.buffer[this.stack[_r114]]];if(!_n92.isAnonymous){if(t[_s138]&&t[_s138]!=_n92.name)return!1;_s138--;}}return!0;}}]);}();sl=new WeakMap();_export("q",hl=/*#__PURE__*/function(){function hl(){_classCallCheck(this,hl);this.map=new WeakMap();}return _createClass(hl,[{key:"setBuffer",value:function setBuffer(t,e,i){var s=this.map.get(t);s||this.map.set(t,s=new Map()),s.set(e,i);}},{key:"getBuffer",value:function getBuffer(t,e){var i=this.map.get(t);return i&&i.get(e);}},{key:"set",value:function set(t,e){t instanceof Qh?this.setBuffer(t.context.buffer,t.index,e):t instanceof Kh&&this.map.set(t.tree,e);}},{key:"get",value:function get(t){return t instanceof Qh?this.getBuffer(t.context.buffer,t.index):t instanceof Kh?this.map.get(t.tree):void 0;}},{key:"cursorSet",value:function cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e);}},{key:"cursorGet",value:function cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree);}}]);}());ll=/*#__PURE__*/function(){function ll(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:!1;var n=arguments.length>5&&arguments[5]!==undefined?arguments[5]:!1;_classCallCheck(this,ll);this.from=t,this.to=e,this.tree=i,this.offset=s,this.open=(r?1:0)|(n?2:0);}return _createClass(ll,[{key:"openStart",get:function get(){return(1&this.open)>0;}},{key:"openEnd",get:function get(){return(2&this.open)>0;}}],[{key:"addTree",value:function addTree(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=[new ll(0,t.length,t,0,!1,i)];var _iterator150=_createForOfIteratorHelper(e),_step150;try{for(_iterator150.s();!(_step150=_iterator150.n()).done;){var _i154=_step150.value;_i154.to>t.length&&s.push(_i154);}}catch(err){_iterator150.e(err);}finally{_iterator150.f();}return s;}},{key:"applyChanges",value:function applyChanges(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:128;if(!e.length)return t;var s=[],r=1,n=t.length?t[0]:null;for(var _h60=0,_l58=0,_o39=0;;_h60++){var _u40=_h60<e.length?e[_h60]:null,_f22=_u40?_u40.fromA:1e9;if(_f22-_l58>=i)for(;n&&n.from<_f22;){var _e189=n;if(_l58>=_e189.from||_f22<=_e189.to||_o39){var _t220=Math.max(_e189.from,_l58)-_o39,_i155=Math.min(_e189.to,_f22)-_o39;_e189=_t220>=_i155?null:new ll(_t220,_i155,_e189.tree,_e189.offset+_o39,_h60>0,!!_u40);}if(_e189&&s.push(_e189),n.to>_f22)break;n=r<t.length?t[r++]:null;}if(!_u40)break;_l58=_u40.toA,_o39=_u40.toA-_u40.toB;}return s;}}]);}();_export("P",ol=/*#__PURE__*/function(){function ol(){_classCallCheck(this,ol);}return _createClass(ol,[{key:"startParse",value:function startParse(t,e,i){return"string"==typeof t&&(t=new ul(t)),i=i?i.length?i.map(function(t){return new Bh(t.from,t.to);}):[new Bh(0,0)]:[new Bh(0,t.length)],this.createParse(t,e||[],i);}},{key:"parse",value:function parse(t,e,i){var s=this.startParse(t,e,i);for(;;){var _t221=s.advance();if(_t221)return _t221;}}}]);}());ul=/*#__PURE__*/function(){function ul(t){_classCallCheck(this,ul);this.string=t;}return _createClass(ul,[{key:"length",get:function get(){return this.string.length;}},{key:"chunk",value:function chunk(t){return this.string.slice(t);}},{key:"lineChunks",get:function get(){return!1;}},{key:"read",value:function read(t,e){return this.string.slice(t,e);}}]);}();new Lh({perNode:!0});fl=0;al=/*#__PURE__*/function(){function al(t,e,i){_classCallCheck(this,al);this.set=t,this.base=e,this.modified=i,this.id=fl++;}return _createClass(al,null,[{key:"define",value:function define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");var e=new al([],null,[]);if(e.set.push(e),t){var _iterator151=_createForOfIteratorHelper(t.set),_step151;try{for(_iterator151.s();!(_step151=_iterator151.n()).done;){var _i156=_step151.value;e.set.push(_i156);}}catch(err){_iterator151.e(err);}finally{_iterator151.f();}}return e;}},{key:"defineModifier",value:function defineModifier(){var t=new dl();return function(e){return e.modified.indexOf(t)>-1?e:dl.get(e.base||e,e.modified.concat(t).sort(function(t,e){return t.id-e.id;}));};}}]);}();cl=0;dl=/*#__PURE__*/function(){function dl(){_classCallCheck(this,dl);this.instances=[],this.id=cl++;}return _createClass(dl,null,[{key:"get",value:function get(t,e){if(!e.length)return t;var i=e[0].instances.find(function(i){return i.base==t&&(s=e,r=i.modified,s.length==r.length&&s.every(function(t,e){return t==r[e];}));var s,r;});if(i)return i;var s=[],r=new al(s,t,e);var _iterator152=_createForOfIteratorHelper(e),_step152;try{for(_iterator152.s();!(_step152=_iterator152.n()).done;){var _t222=_step152.value;_t222.instances.push(r);}}catch(err){_iterator152.e(err);}finally{_iterator152.f();}var n=function(t){var e=[[]];for(var _i157=0;_i157<t.length;_i157++)for(var _s140=0,_r116=e.length;_s140<_r116;_s140++)e.push(e[_s140].concat(t[_i157]));return e.sort(function(t,e){return e.length-t.length;});}(e);var _iterator153=_createForOfIteratorHelper(t.set),_step153;try{for(_iterator153.s();!(_step153=_iterator153.n()).done;){var _e190=_step153.value;if(!_e190.modified.length){var _iterator154=_createForOfIteratorHelper(n),_step154;try{for(_iterator154.s();!(_step154=_iterator154.n()).done;){var _t223=_step154.value;s.push(dl.get(_e190,_t223));}}catch(err){_iterator154.e(err);}finally{_iterator154.f();}}}}catch(err){_iterator153.e(err);}finally{_iterator153.f();}return r;}}]);}();ml=new Lh();gl=/*#__PURE__*/function(){function gl(t,e,i,s){_classCallCheck(this,gl);this.tags=t,this.mode=e,this.context=i,this.next=s;}return _createClass(gl,[{key:"opaque",get:function get(){return 0==this.mode;}},{key:"inherit",get:function get(){return 1==this.mode;}},{key:"sort",value:function sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t);}},{key:"depth",get:function get(){return this.context?this.context.length:0;}}]);}();gl.empty=new gl([],2,null);vl=/*#__PURE__*/function(){function vl(t,e,i){_classCallCheck(this,vl);this.at=t,this.highlighters=e,this.span=i,this["class"]="";}return _createClass(vl,[{key:"startSpan",value:function startSpan(t,e){e!=this["class"]&&(this.flush(t),t>this.at&&(this.at=t),this["class"]=e);}},{key:"flush",value:function flush(t){t>this.at&&this["class"]&&this.span(this.at,t,this["class"]);}},{key:"highlightRange",value:function highlightRange(t,e,i,s,r){var n=t.type,h=t.from,l=t.to;if(h>=i||l<=e)return;n.isTop&&(r=this.highlighters.filter(function(t){return!t.scope||t.scope(n);}));var o=s,u=function(t){var e=t.type.prop(ml);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null;}(t)||gl.empty,f=function(t,e){var i=null;var _iterator160=_createForOfIteratorHelper(t),_step160;try{for(_iterator160.s();!(_step160=_iterator160.n()).done;){var _s145=_step160.value;var _t227=_s145.style(e);_t227&&(i=i?i+" "+_t227:_t227);}}catch(err){_iterator160.e(err);}finally{_iterator160.f();}return i;}(r,u.tags);if(f&&(o&&(o+=" "),o+=f,1==u.mode&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(e,h),o),u.opaque)return;var a=t.tree&&t.tree.prop(Lh.mounted);if(a&&a.overlay){var _n94=t.node.enter(a.overlay[0].from+h,1),_u41=this.highlighters.filter(function(t){return!t.scope||t.scope(a.tree.type);}),_f23=t.firstChild();for(var _c14=0,_d9=h;;_c14++){var _p8=_c14<a.overlay.length?a.overlay[_c14]:null,_m5=_p8?_p8.from+h:l,_g5=Math.max(e,_d9),_w2=Math.min(i,_m5);if(_g5<_w2&&_f23)for(;t.from<_w2&&(this.highlightRange(t,_g5,_w2,s,r),this.startSpan(Math.min(_w2,t.to),o),!(t.to>=_m5)&&t.nextSibling()););if(!_p8||_m5>i)break;_d9=_p8.to+h,_d9>e&&(this.highlightRange(_n94.cursor(),Math.max(e,_p8.from+h),Math.min(i,_d9),"",_u41),this.startSpan(Math.min(i,_d9),o));}_f23&&t.parent();}else if(t.firstChild()){a&&(s="");do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,s,r),this.startSpan(Math.min(i,t.to),o);}}while(t.nextSibling());t.parent();}}}]);}();kl=al.define;yl=kl();Ml=kl();xl=kl(Ml);Sl=kl(Ml);Al=kl();Cl=kl(Al);Dl=kl(Al);Ol=kl();El=kl(Ol);Il=kl();Rl=kl();Tl=kl();Bl=kl(Tl);Ll=kl();_export("t",Nl={comment:yl,lineComment:kl(yl),blockComment:kl(yl),docComment:kl(yl),name:Ml,variableName:kl(Ml),typeName:xl,tagName:kl(xl),propertyName:Sl,attributeName:kl(Sl),className:kl(Ml),labelName:kl(Ml),namespace:kl(Ml),macroName:kl(Ml),literal:Al,string:Cl,docString:kl(Cl),character:kl(Cl),attributeValue:kl(Cl),number:Dl,integer:kl(Dl),"float":kl(Dl),bool:kl(Al),regexp:kl(Al),escape:kl(Al),color:kl(Al),url:kl(Al),keyword:Il,self:kl(Il),"null":kl(Il),atom:kl(Il),unit:kl(Il),modifier:kl(Il),operatorKeyword:kl(Il),controlKeyword:kl(Il),definitionKeyword:kl(Il),moduleKeyword:kl(Il),operator:Rl,derefOperator:kl(Rl),arithmeticOperator:kl(Rl),logicOperator:kl(Rl),bitwiseOperator:kl(Rl),compareOperator:kl(Rl),updateOperator:kl(Rl),definitionOperator:kl(Rl),typeOperator:kl(Rl),controlOperator:kl(Rl),punctuation:Tl,separator:kl(Tl),bracket:Bl,angleBracket:kl(Bl),squareBracket:kl(Bl),paren:kl(Bl),brace:kl(Bl),content:Ol,heading:El,heading1:kl(El),heading2:kl(El),heading3:kl(El),heading4:kl(El),heading5:kl(El),heading6:kl(El),contentSeparator:kl(Ol),list:kl(Ol),quote:kl(Ol),emphasis:kl(Ol),strong:kl(Ol),link:kl(Ol),monospace:kl(Ol),strikethrough:kl(Ol),inserted:kl(),deleted:kl(),changed:kl(),invalid:kl(),meta:Ll,documentMeta:kl(Ll),annotation:kl(Ll),processingInstruction:kl(Ll),definition:al.defineModifier(),constant:al.defineModifier(),"function":al.defineModifier(),standard:al.defineModifier(),local:al.defineModifier(),special:al.defineModifier()});wl([{tag:Nl.link,"class":"tok-link"},{tag:Nl.heading,"class":"tok-heading"},{tag:Nl.emphasis,"class":"tok-emphasis"},{tag:Nl.strong,"class":"tok-strong"},{tag:Nl.keyword,"class":"tok-keyword"},{tag:Nl.atom,"class":"tok-atom"},{tag:Nl.bool,"class":"tok-bool"},{tag:Nl.url,"class":"tok-url"},{tag:Nl.labelName,"class":"tok-labelName"},{tag:Nl.inserted,"class":"tok-inserted"},{tag:Nl.deleted,"class":"tok-deleted"},{tag:Nl.literal,"class":"tok-literal"},{tag:Nl.string,"class":"tok-string"},{tag:Nl.number,"class":"tok-number"},{tag:[Nl.regexp,Nl.escape,Nl.special(Nl.string)],"class":"tok-string2"},{tag:Nl.variableName,"class":"tok-variableName"},{tag:Nl.local(Nl.variableName),"class":"tok-variableName tok-local"},{tag:Nl.definition(Nl.variableName),"class":"tok-variableName tok-definition"},{tag:Nl.special(Nl.variableName),"class":"tok-variableName2"},{tag:Nl.definition(Nl.propertyName),"class":"tok-propertyName tok-definition"},{tag:Nl.typeName,"class":"tok-typeName"},{tag:Nl.namespace,"class":"tok-namespace"},{tag:Nl.className,"class":"tok-className"},{tag:Nl.macroName,"class":"tok-macroName"},{tag:Nl.propertyName,"class":"tok-propertyName"},{tag:Nl.operator,"class":"tok-operator"},{tag:Nl.comment,"class":"tok-comment"},{tag:Nl.meta,"class":"tok-meta"},{tag:Nl.invalid,"class":"tok-invalid"},{tag:Nl.punctuation,"class":"tok-punctuation"}]);jl=new Lh();_export("o",Pl=new Lh());Hl=/*#__PURE__*/function(){function Hl(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";_classCallCheck(this,Hl);this.data=t,this.name=s,St.prototype.hasOwnProperty("tree")||Object.defineProperty(St.prototype,"tree",{get:function get(){return Fl(this);}}),this.parser=e,this.extension=[Ql.of(this),St.languageData.of(function(t,e,i){var s=Wl(t,e,i),r=s.type.prop(jl);if(!r)return[];var n=t.facet(r),h=s.type.prop(Pl);if(h){var _r118=s.resolve(e-s.from,i);var _iterator161=_createForOfIteratorHelper(h),_step161;try{for(_iterator161.s();!(_step161=_iterator161.n()).done;){var _e193=_step161.value;if(_e193.test(_r118,t)){var _i160=t.facet(_e193.facet);return"replace"==_e193.type?_i160:_i160.concat(n);}}}catch(err){_iterator161.e(err);}finally{_iterator161.f();}}return n;})].concat(i);}return _createClass(Hl,[{key:"isActiveAt",value:function isActiveAt(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;return Wl(t,e,i).type.prop(jl)==this.data;}},{key:"findRegions",value:function findRegions(t){var _this70=this;var e=t.facet(Ql);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];var i=[],s=function s(t,e){if(t.prop(jl)==_this70.data)return void i.push({from:e,to:e+t.length});var r=t.prop(Lh.mounted);if(r){if(r.tree.prop(jl)==_this70.data){if(r.overlay){var _iterator162=_createForOfIteratorHelper(r.overlay),_step162;try{for(_iterator162.s();!(_step162=_iterator162.n()).done;){var _t228=_step162.value;i.push({from:_t228.from+e,to:_t228.to+e});}}catch(err){_iterator162.e(err);}finally{_iterator162.f();}}else i.push({from:e,to:e+t.length});return;}if(r.overlay){var _t229=i.length;if(s(r.tree,r.overlay[0].from+e),i.length>_t229)return;}}for(var _i161=0;_i161<t.children.length;_i161++){var _r119=t.children[_i161];_r119 instanceof Vh&&s(_r119,t.positions[_i161]+e);}};return s(Fl(t),0),i;}},{key:"allowsNesting",get:function get(){return!0;}}]);}();Hl.setState=ct.define();_export("L",Vl=/*#__PURE__*/function(_Hl){function Vl(t,e,i){var _this71;_classCallCheck(this,Vl);_this71=_callSuper(this,Vl,[t,e,[],i]),_this71.parser=e;return _this71;}_inherits(Vl,_Hl);return _createClass(Vl,[{key:"configure",value:function configure(t,e){return new Vl(this.data,this.parser.configure(t),e||this.name);}},{key:"allowsNesting",get:function get(){return this.parser.hasWrappers();}}],[{key:"define",value:function define(t){var e=zl(t.languageData);return new Vl(e,t.parser.configure({props:[jl.add(function(t){return t.isTop?e:void 0;})]}),t.name);}}]);}(Hl));ql=/*#__PURE__*/function(){function ql(t){_classCallCheck(this,ql);this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter();}return _createClass(ql,[{key:"length",get:function get(){return this.doc.length;}},{key:"syncTo",value:function syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length;}},{key:"chunk",value:function chunk(t){return this.syncTo(t),this.string;}},{key:"lineChunks",get:function get(){return!0;}},{key:"read",value:function read(t,e){var i=this.cursorPos-this.string.length;return t<i||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i);}}]);}();Ul=null;Jl=/*#__PURE__*/function(){function Jl(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var s=arguments.length>3?arguments[3]:undefined;var r=arguments.length>4?arguments[4]:undefined;var n=arguments.length>5?arguments[5]:undefined;var h=arguments.length>6?arguments[6]:undefined;var l=arguments.length>7?arguments[7]:undefined;_classCallCheck(this,Jl);this.parser=t,this.state=e,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=n,this.skipped=h,this.scheduleOn=l,this.parse=null,this.tempSkipped=[];}return _createClass(Jl,[{key:"startParse",value:function startParse(){return this.parser.startParse(new ql(this.state.doc),this.fragments);}},{key:"work",value:function work(t,e){var _this72=this;return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=Vh.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext(function(){var i;if("number"==typeof t){var _e194=Date.now()+t;t=function t(){return Date.now()>_e194;};}for(_this72.parse||(_this72.parse=_this72.startParse()),null!=e&&(null==_this72.parse.stoppedAt||_this72.parse.stoppedAt>e)&&e<_this72.state.doc.length&&_this72.parse.stopAt(e);;){var _s146=_this72.parse.advance();if(_s146){if(_this72.fragments=_this72.withoutTempSkipped(ll.addTree(_s146,_this72.fragments,null!=_this72.parse.stoppedAt)),_this72.treeLen=null!==(i=_this72.parse.stoppedAt)&&void 0!==i?i:_this72.state.doc.length,_this72.tree=_s146,_this72.parse=null,!(_this72.treeLen<(null!=e?e:_this72.state.doc.length)))return!0;_this72.parse=_this72.startParse();}if(t())return!1;}});}},{key:"takeTree",value:function takeTree(){var _this73=this;var t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(function(){for(;!(e=_this73.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(ll.addTree(this.tree,this.fragments,!0)),this.parse=null);}},{key:"withContext",value:function withContext(t){var e=Ul;Ul=this;try{return t();}finally{Ul=e;}}},{key:"withoutTempSkipped",value:function withoutTempSkipped(t){for(var _e195;_e195=this.tempSkipped.pop();)t=Gl(t,_e195.from,_e195.to);return t;}},{key:"changes",value:function changes(t,e){var i=this.fragments,s=this.tree,r=this.treeLen,n=this.viewport,h=this.skipped;if(this.takeTree(),!t.empty){var _e196=[];if(t.iterChangedRanges(function(t,i,s,r){return _e196.push({fromA:t,toA:i,fromB:s,toB:r});}),i=ll.applyChanges(i,_e196),s=Vh.empty,r=0,n={from:t.mapPos(n.from,-1),to:t.mapPos(n.to,1)},this.skipped.length){h=[];var _iterator163=_createForOfIteratorHelper(this.skipped),_step163;try{for(_iterator163.s();!(_step163=_iterator163.n()).done;){var _e197=_step163.value;var _i162=t.mapPos(_e197.from,1),_s147=t.mapPos(_e197.to,-1);_i162<_s147&&h.push({from:_i162,to:_s147});}}catch(err){_iterator163.e(err);}finally{_iterator163.f();}}}return new Jl(this.parser,e,i,s,r,n,h,this.scheduleOn);}},{key:"updateViewport",value:function updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;var e=this.skipped.length;for(var _e198=0;_e198<this.skipped.length;_e198++){var _this$skipped$_e=this.skipped[_e198],_i163=_this$skipped$_e.from,_s148=_this$skipped$_e.to;_i163<t.to&&_s148>t.from&&(this.fragments=Gl(this.fragments,_i163,_s148),this.skipped.splice(_e198--,1));}return!(this.skipped.length>=e)&&(this.reset(),!0);}},{key:"reset",value:function reset(){this.parse&&(this.takeTree(),this.parse=null);}},{key:"skipUntilInView",value:function skipUntilInView(t,e){this.skipped.push({from:t,to:e});}},{key:"isDone",value:function isDone(t){t=Math.min(t,this.state.doc.length);var e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t;}}],[{key:"create",value:function create(t,e,i){return new Jl(t,e,[],Vh.empty,0,i,[],null);}},{key:"getSkippingParser",value:function getSkippingParser(t){return new(/*#__PURE__*/function(_ol){function _class7(){_classCallCheck(this,_class7);return _callSuper(this,_class7,arguments);}_inherits(_class7,_ol);return _createClass(_class7,[{key:"createParse",value:function createParse(e,i,s){var r=s[0].from,n=s[s.length-1].to;return{parsedPos:r,advance:function advance(){var e=Ul;if(e){var _iterator164=_createForOfIteratorHelper(s),_step164;try{for(_iterator164.s();!(_step164=_iterator164.n()).done;){var _t231=_step164.value;e.tempSkipped.push(_t231);}}catch(err){_iterator164.e(err);}finally{_iterator164.f();}t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t);}return this.parsedPos=n,new Vh(jh.none,[],[],n-r);},stoppedAt:null,stopAt:function stopAt(){}};}}]);}(ol))();}},{key:"get",value:function get(){return Ul;}}]);}();Kl=/*#__PURE__*/function(){function Kl(t){_classCallCheck(this,Kl);this.context=t,this.tree=t.tree;}return _createClass(Kl,[{key:"apply",value:function apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;var e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new Kl(e);}}],[{key:"init",value:function init(t){var e=Math.min(3e3,t.doc.length),i=Jl.create(t.facet(Ql).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Kl(i);}}]);}();Hl.state=F.define({create:Kl.init,update:function update(t,e){var _iterator165=_createForOfIteratorHelper(e.effects),_step165;try{for(_iterator165.s();!(_step165=_iterator165.n()).done;){var _t232=_step165.value;if(_t232.is(Hl.setState))return _t232.value;}}catch(err){_iterator165.e(err);}finally{_iterator165.f();}return e.startState.facet(Ql)!=e.state.facet(Ql)?Kl.init(e.state):t.apply(e);}});_l=function _l(t){var e=setTimeout(function(){return t();},500);return function(){return clearTimeout(e);};};"undefined"!=typeof requestIdleCallback&&(_l=function _l(t){var e=-1,i=setTimeout(function(){e=requestIdleCallback(t,{timeout:400});},100);return function(){return e<0?clearTimeout(i):cancelIdleCallback(e);};});Xl="undefined"!=typeof navigator&&(null===($l=navigator.scheduling)||void 0===$l?void 0:$l.isInputPending)?function(){return navigator.scheduling.isInputPending();}:null;Yl=_i.fromClass(/*#__PURE__*/function(){function _class8(t){_classCallCheck(this,_class8);this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork();}return _createClass(_class8,[{key:"update",value:function update(t){var e=this.view.state.field(Hl.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e);}},{key:"scheduleWork",value:function scheduleWork(){if(this.working)return;var t=this.view.state,e=t.field(Hl.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=_l(this.work));}},{key:"work",value:function work(t){this.working=null;var e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;var _this$view3=this.view,i=_this$view3.state,s=_this$view3.viewport.to,r=i.field(Hl.state);if(r.tree==r.context.tree&&r.context.isDone(s+1e5))return;var n=Date.now()+Math.min(this.chunkBudget,100,t&&!Xl?Math.max(25,t.timeRemaining()-5):1e9),h=r.context.treeLen<s&&i.doc.length>s+1e3,l=r.context.work(function(){return Xl&&Xl()||Date.now()>n;},s+(h?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Hl.setState.of(new Kl(r.context))})),this.chunkBudget>0&&(!l||h)&&this.scheduleWork(),this.checkAsyncSchedule(r.context);}},{key:"checkAsyncSchedule",value:function checkAsyncSchedule(t){var _this74=this;t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(function(){return _this74.scheduleWork();})["catch"](function(t){return Ui(_this74.view.state,t);}).then(function(){return _this74.workScheduled--;}),t.scheduleOn=null);}},{key:"destroy",value:function destroy(){this.working&&this.working();}},{key:"isWorking",value:function isWorking(){return!!(this.working||this.workScheduled>0);}}]);}(),{eventHandlers:{focus:function focus(){this.scheduleWork();}}});Ql=$.define({combine:function combine(t){return t.length?t[0]:null;},enables:function enables(t){return[Hl.state,Yl,Ur.contentAttributes.compute([t],function(e){var i=e.facet(t);return i&&i.name?{"data-language":i.name}:{};})];}});_export("h",Zl=/*#__PURE__*/_createClass(function Zl(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];_classCallCheck(this,Zl);this.language=t,this.support=e,this.extension=[t,e];}));to=$.define();eo=$.define({combine:function combine(t){if(!t.length)return" ";var e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(function(t){return t!=e[0];}))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e;}});no=/*#__PURE__*/function(){function no(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,no);this.state=t,this.options=e,this.unit=io(t);}return _createClass(no,[{key:"lineAt",value:function lineAt(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var i=this.state.doc.lineAt(t),_this$options=this.options,s=_this$options.simulateBreak,r=_this$options.simulateDoubleBreak;return null!=s&&s>=i.from&&s<=i.to?r&&s==t?{text:"",from:t}:(e<0?s<t:s<=t)?{text:i.text.slice(s-i.from),from:s}:{text:i.text.slice(0,s-i.from),from:i.from}:i;}},{key:"textAfterPos",value:function textAfterPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";var _this$lineAt=this.lineAt(t,e),i=_this$lineAt.text,s=_this$lineAt.from;return i.slice(t-s,Math.min(i.length,t+100-s));}},{key:"column",value:function column(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var _this$lineAt2=this.lineAt(t,e),i=_this$lineAt2.text,s=_this$lineAt2.from,r=this.countColumn(i,t-s),n=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return n>-1&&(r+=n-this.countColumn(i,i.search(/\S|$/))),r;}},{key:"countColumn",value:function countColumn(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t.length;return Vt(t,this.state.tabSize,e);}},{key:"lineIndent",value:function lineIndent(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var _this$lineAt3=this.lineAt(t,e),i=_this$lineAt3.text,s=_this$lineAt3.from,r=this.options.overrideIndentation;if(r){var _t235=r(s);if(_t235>-1)return _t235;}return this.countColumn(i,i.search(/\S|$/));}},{key:"simulatedBreak",get:function get(){return this.options.simulateBreak||null;}}]);}();_export("i",ho=new Lh());fo=/*#__PURE__*/function(_no){function fo(t,e,i){var _this75;_classCallCheck(this,fo);_this75=_callSuper(this,fo,[t.state,t.options]),_this75.base=t,_this75.pos=e,_this75.context=i;return _this75;}_inherits(fo,_no);return _createClass(fo,[{key:"node",get:function get(){return this.context.node;}},{key:"textAfter",get:function get(){return this.textAfterPos(this.pos);}},{key:"baseIndent",get:function get(){return this.baseIndentFor(this.node);}},{key:"baseIndentFor",value:function baseIndentFor(t){var e=this.state.doc.lineAt(t.from);for(;;){var _i165=t.resolve(e.from);for(;_i165.parent&&_i165.parent.from==_i165.from;)_i165=_i165.parent;if(ao(_i165,t))break;e=this.state.doc.lineAt(_i165.from);}return this.lineIndent(e.from);}},{key:"continue",value:function _continue(){return lo(this.context.next,this.base,this.pos);}}],[{key:"create",value:function create(t,e,i){return new fo(t,e,i);}}]);}(no);_export("f",mo=function mo(t){return t.baseIndent;});wo=$.define();_export("e",bo=new Lh());xo=ct.define({map:Mo});So=ct.define({map:Mo});Co=F.define({create:function create(){return ni.none;},update:function update(t,e){t=t.map(e.changes);var _iterator169=_createForOfIteratorHelper(e.effects),_step169;try{var _loop13=function _loop13(){var i=_step169.value;if(i.is(xo)&&!Oo(t,i.value.from,i.value.to)){var _e$state$facet=e.state.facet(Bo),_s155=_e$state$facet.preparePlaceholder,_r122=_s155?ni.replace({widget:new jo(_s155(e.state,i.value))}):$o;t=t.update({add:[_r122.range(i.value.from,i.value.to)]});}else i.is(So)&&(t=t.update({filter:function filter(t,e){return i.value.from!=t||i.value.to!=e;},filterFrom:i.value.from,filterTo:i.value.to}));};for(_iterator169.s();!(_step169=_iterator169.n()).done;){_loop13();}}catch(err){_iterator169.e(err);}finally{_iterator169.f();}if(e.selection){var _i167=!1,_s154=e.selection.main.head;t.between(_s154,_s154,function(t,e){t<_s154&&e>_s154&&(_i167=!0);}),_i167&&(t=t.update({filterFrom:_s154,filterTo:_s154,filter:function filter(t,e){return e<=_s154||t>=_s154;}}));}return t;},provide:function provide(t){return Ur.decorations.from(t);},toJSON:function toJSON(t,e){var i=[];return t.between(0,e.doc.length,function(t,e){i.push(t,e);}),i;},fromJSON:function fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");var e=[];for(var _i168=0;_i168<t.length;){var _s156=t[_i168++],_r123=t[_i168++];if("number"!=typeof _s156||"number"!=typeof _r123)throw new RangeError("Invalid JSON for fold state");e.push($o.range(_s156,_r123));}return ni.set(e,!0);}});Ro=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:function run(t){var _iterator170=_createForOfIteratorHelper(Ao(t)),_step170;try{for(_iterator170.s();!(_step170=_iterator170.n()).done;){var _e202=_step170.value;var _i169=yo(t.state,_e202.from,_e202.to);if(_i169)return t.dispatch({effects:Eo(t.state,[xo.of(_i169),Io(t,_i169)])}),!0;}}catch(err){_iterator170.e(err);}finally{_iterator170.f();}return!1;}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:function run(t){if(!t.state.field(Co,!1))return!1;var e=[];var _iterator171=_createForOfIteratorHelper(Ao(t)),_step171;try{for(_iterator171.s();!(_step171=_iterator171.n()).done;){var _i170=_step171.value;var _s157=Do(t.state,_i170.from,_i170.to);_s157&&e.push(So.of(_s157),Io(t,_s157,!1));}}catch(err){_iterator171.e(err);}finally{_iterator171.f();}return e.length&&t.dispatch({effects:e}),e.length>0;}},{key:"Ctrl-Alt-[",run:function run(t){var e=t.state,i=[];for(var _s158=0;_s158<e.doc.length;){var _r124=t.lineBlockAt(_s158),_n96=yo(e,_r124.from,_r124.to);_n96&&i.push(xo.of(_n96)),_s158=(_n96?t.lineBlockAt(_n96.to):_r124).to+1;}return i.length&&t.dispatch({effects:Eo(t.state,i)}),!!i.length;}},{key:"Ctrl-Alt-]",run:function run(t){var e=t.state.field(Co,!1);if(!e||!e.size)return!1;var i=[];return e.between(0,t.state.doc.length,function(t,e){i.push(So.of({from:t,to:e}));}),t.dispatch({effects:i}),!0;}}];To={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"};Bo=$.define({combine:function combine(t){return At(t,To);}});$o=ni.replace({widget:new(/*#__PURE__*/function(_si6){function _class9(){_classCallCheck(this,_class9);return _callSuper(this,_class9,arguments);}_inherits(_class9,_si6);return _createClass(_class9,[{key:"toDOM",value:function toDOM(t){return No(t,null);}}]);}(si))()});jo=/*#__PURE__*/function(_si7){function jo(t){var _this76;_classCallCheck(this,jo);_this76=_callSuper(this,jo),_this76.value=t;return _this76;}_inherits(jo,_si7);return _createClass(jo,[{key:"eq",value:function eq(t){return this.value==t.value;}},{key:"toDOM",value:function toDOM(t){return No(t,this.value);}}]);}(si);zo={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:function foldingChanged(){return!1;}};Po=/*#__PURE__*/function(_uh3){function Po(t,e){var _this77;_classCallCheck(this,Po);_this77=_callSuper(this,Po),_this77.config=t,_this77.open=e;return _this77;}_inherits(Po,_uh3);return _createClass(Po,[{key:"eq",value:function eq(t){return this.config==t.config&&this.open==t.open;}},{key:"toDOM",value:function toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);var e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e;}}]);}(uh);Ho=Ur.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});Wo=/*#__PURE__*/function(){function Wo(t,e){_classCallCheck(this,Wo);var i;function s(t){var e=Gt.newName();return(i||(i=Object.create(null)))["."+e]=t,e;}this.specs=t;var r="string"==typeof e.all?e.all:e.all?s(e.all):void 0,n=e.scope;this.scope=n instanceof Hl?function(t){return t.prop(jl)==n.data;}:n?function(t){return t==n;}:void 0,this.style=wl(t.map(function(t){return{tag:t.tag,"class":t["class"]||s(Object.assign({},t,{tag:null}))};}),{all:r}).style,this.module=i?new Gt(i):null,this.themeType=e.themeType;}return _createClass(Wo,null,[{key:"define",value:function define(t,e){return new Wo(t,e||{});}}]);}();Vo=$.define();Fo=$.define({combine:function combine(t){return t.length?[t[0]]:null;}});Uo=/*#__PURE__*/function(){function Uo(t){_classCallCheck(this,Uo);this.markCache=Object.create(null),this.tree=Fl(t.state),this.decorations=this.buildDeco(t,qo(t.state)),this.decoratedTo=t.viewport.to;}return _createClass(Uo,[{key:"update",value:function update(t){var e=Fl(t.state),i=qo(t.state),s=i!=qo(t.startState),r=t.view.viewport,n=t.changes.mapPos(this.decoratedTo,1);e.length<r.to&&!s&&e.type==this.tree.type&&n>=r.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=n):(e!=this.tree||t.viewportChanged||s)&&(this.tree=e,this.decorations=this.buildDeco(t.view,i),this.decoratedTo=r.to);}},{key:"buildDeco",value:function buildDeco(t,e){var _this78=this;if(!e||!this.tree.length)return ni.none;var i=new Rt();var _iterator172=_createForOfIteratorHelper(t.visibleRanges),_step172;try{for(_iterator172.s();!(_step172=_iterator172.n()).done;){var _step172$value=_step172.value,_s159=_step172$value.from,_r125=_step172$value.to;bl(this.tree,e,function(t,e,s){i.add(t,e,_this78.markCache[s]||(_this78.markCache[s]=ni.mark({"class":s})));},_s159,_r125);}}catch(err){_iterator172.e(err);}finally{_iterator172.f();}return i.finish();}}]);}();Jo=_.high(_i.fromClass(Uo,{decorations:function decorations(t){return t.decorations;}}));Go=Wo.define([{tag:Nl.meta,color:"#404740"},{tag:Nl.link,textDecoration:"underline"},{tag:Nl.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Nl.emphasis,fontStyle:"italic"},{tag:Nl.strong,fontWeight:"bold"},{tag:Nl.strikethrough,textDecoration:"line-through"},{tag:Nl.keyword,color:"#708"},{tag:[Nl.atom,Nl.bool,Nl.url,Nl.contentSeparator,Nl.labelName],color:"#219"},{tag:[Nl.literal,Nl.inserted],color:"#164"},{tag:[Nl.string,Nl.deleted],color:"#a11"},{tag:[Nl.regexp,Nl.escape,Nl.special(Nl.string)],color:"#e40"},{tag:Nl.definition(Nl.variableName),color:"#00f"},{tag:Nl.local(Nl.variableName),color:"#30a"},{tag:[Nl.typeName,Nl.namespace],color:"#085"},{tag:Nl.className,color:"#167"},{tag:[Nl.special(Nl.variableName),Nl.macroName],color:"#256"},{tag:Nl.definition(Nl.propertyName),color:"#00c"},{tag:Nl.comment,color:"#940"},{tag:Nl.invalid,color:"#f00"}]);Ko=Ur.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}});_o=1e4;Xo="()[]{}";Yo=$.define({combine:function combine(t){return At(t,{afterCursor:!0,brackets:Xo,maxScanDistance:_o,renderMatch:tu});}});Qo=ni.mark({"class":"cm-matchingBracket"});Zo=ni.mark({"class":"cm-nonmatchingBracket"});eu=F.define({create:function create(){return ni.none;},update:function update(t,e){if(!e.docChanged&&!e.selection)return t;var i=[],s=e.state.facet(Yo);var _iterator173=_createForOfIteratorHelper(e.state.selection.ranges),_step173;try{for(_iterator173.s();!(_step173=_iterator173.n()).done;){var _t238=_step173.value;if(!_t238.empty)continue;var _r126=hu(e.state,_t238.head,-1,s)||_t238.head>0&&hu(e.state,_t238.head-1,1,s)||s.afterCursor&&(hu(e.state,_t238.head,1,s)||_t238.head<e.state.doc.length&&hu(e.state,_t238.head+1,-1,s));_r126&&(i=i.concat(s.renderMatch(_r126,e.state)));}}catch(err){_iterator173.e(err);}finally{_iterator173.f();}return ni.set(i,!0);},provide:function provide(t){return Ur.decorations.from(t);}});iu=[eu,Ko];su=new Lh();ou=Object.create(null);uu=[jh.none];fu=[];au=Object.create(null);cu=Object.create(null);for(_i171=0,_arr2=[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]];_i171<_arr2.length;_i171++){_arr2$_i=_slicedToArray(_arr2[_i171],2);_t243=_arr2$_i[0];_e205=_arr2$_i[1];cu[_t243]=pu(ou,_e205);}pi.RTL,pi.LTR;gu=mu(Mu,0);wu=mu(yu,0);bu=mu(function(t,e){return yu(t,e,function(t){var e=[];var _iterator177=_createForOfIteratorHelper(t.selection.ranges),_step177;try{for(_iterator177.s();!(_step177=_iterator177.n()).done;){var _i173=_step177.value;var _s164=t.doc.lineAt(_i173.from),_r128=_i173.to<=_s164.to?_s164:t.doc.lineAt(_i173.to),_n98=e.length-1;_n98>=0&&e[_n98].to>_s164.from?e[_n98].to=_r128.to:e.push({from:_s164.from+/^\s*/.exec(_s164.text)[0].length,to:_r128.to});}}catch(err){_iterator177.e(err);}finally{_iterator177.f();}return e;}(e));},0);ku=50;xu=ut.define();Su=ut.define();Au=$.define();Cu=$.define({combine:function combine(t){return At(t,{minDepth:100,newGroupDelay:500,joinToEvent:function joinToEvent(t,e){return e;}},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:function joinToEvent(t,e){return function(i,s){return t(i,s)||e(i,s);};}});}});Du=F.define({create:function create(){return Fu.empty;},update:function update(t,e){var i=e.state.facet(Cu),s=e.annotation(xu);if(s){var _r132=Bu.fromTransaction(e,s.selection),_n103=s.side,_h68=0==_n103?t.undone:t.done;return _h68=_r132?Lu(_h68,_h68.length,i.minDepth,_r132):zu(_h68,e.startState.selection),new Fu(0==_n103?s.rest:_h68,0==_n103?_h68:s.rest);}var r=e.annotation(Su);if("full"!=r&&"before"!=r||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);var n=Bu.fromTransaction(e),h=e.annotation(dt.time),l=e.annotation(dt.userEvent);return n?t=t.addChanges(n,h,l,i,e):e.selection&&(t=t.addSelection(e.startState.selection,h,l,i.newGroupDelay)),"full"!=r&&"after"!=r||(t=t.isolate()),t;},toJSON:function toJSON(t){return{done:t.done.map(function(t){return t.toJSON();}),undone:t.undone.map(function(t){return t.toJSON();})};},fromJSON:function fromJSON(t){return new Fu(t.done.map(Bu.fromJSON),t.undone.map(Bu.fromJSON));}});Eu=Ou(0,!1);Iu=Ou(1,!1);Ru=Ou(0,!0);Tu=Ou(1,!0);Bu=/*#__PURE__*/function(){function Bu(t,e,i,s,r){_classCallCheck(this,Bu);this.changes=t,this.effects=e,this.mapped=i,this.startSelection=s,this.selectionsAfter=r;}return _createClass(Bu,[{key:"setSelAfter",value:function setSelAfter(t){return new Bu(this.changes,this.effects,this.mapped,this.startSelection,t);}},{key:"toJSON",value:function toJSON(){var t,e,i;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(function(t){return t.toJSON();})};}}],[{key:"fromJSON",value:function fromJSON(t){return new Bu(t.changes&&A.fromJSON(t.changes),[],t.mapped&&S.fromJSON(t.mapped),t.startSelection&&B.fromJSON(t.startSelection),t.selectionsAfter.map(B.fromJSON));}},{key:"fromTransaction",value:function fromTransaction(t,e){var i=$u;var _iterator181=_createForOfIteratorHelper(t.startState.facet(Au)),_step181;try{for(_iterator181.s();!(_step181=_iterator181.n()).done;){var _e212=_step181.value;var _s166=_e212(t);_s166.length&&(i=i.concat(_s166));}}catch(err){_iterator181.e(err);}finally{_iterator181.f();}return!i.length&&t.changes.empty?null:new Bu(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,$u);}},{key:"selection",value:function selection(t){return new Bu(void 0,$u,void 0,void 0,t);}}]);}();$u=[];ju=200;Vu=/^(input\.type|delete)($|\.)/;Fu=/*#__PURE__*/function(){function Fu(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:void 0;_classCallCheck(this,Fu);this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=s;}return _createClass(Fu,[{key:"isolate",value:function isolate(){return this.prevTime?new Fu(this.done,this.undone):this;}},{key:"addChanges",value:function addChanges(t,e,i,s,r){var n=this.done,h=n[n.length-1];return n=h&&h.changes&&!h.changes.empty&&t.changes&&(!i||Vu.test(i))&&(!h.selectionsAfter.length&&e-this.prevTime<s.newGroupDelay&&s.joinToEvent(r,function(t,e){var i=[],s=!1;return t.iterChangedRanges(function(t,e){return i.push(t,e);}),e.iterChangedRanges(function(t,e,r,n){for(var _t251=0;_t251<i.length;){var _e214=i[_t251++],_h69=i[_t251++];n>=_e214&&r<=_h69&&(s=!0);}}),s;}(h.changes,t.changes))||"input.type.compose"==i)?Lu(n,n.length-1,s.minDepth,new Bu(t.changes.compose(h.changes),Nu(t.effects,h.effects),h.mapped,h.startSelection,$u)):Lu(n,n.length,s.minDepth,t),new Fu(n,$u,e,i);}},{key:"addSelection",value:function addSelection(t,e,i,s){var r=this.done.length?this.done[this.done.length-1].selectionsAfter:$u;return r.length>0&&e-this.prevTime<s&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&(n=r[r.length-1],h=t,n.ranges.length==h.ranges.length&&0===n.ranges.filter(function(t,e){return t.empty!=h.ranges[e].empty;}).length)?this:new Fu(zu(this.done,t),this.undone,e,i);var n,h;}},{key:"addMapping",value:function addMapping(t){return new Fu(Hu(this.done,t),Hu(this.undone,t),this.prevTime,this.prevUserEvent);}},{key:"pop",value:function pop(t,e,i){var s=0==t?this.done:this.undone;if(0==s.length)return null;var r=s[s.length-1],n=r.selectionsAfter[0]||e.selection;if(i&&r.selectionsAfter.length)return e.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:xu.of({side:t,rest:Pu(s),selection:n}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){var _i182=1==s.length?$u:s.slice(0,s.length-1);return r.mapped&&(_i182=Hu(_i182,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:xu.of({side:t,rest:_i182,selection:n}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0});}return null;}}]);}();Fu.empty=new Fu($u,$u);qu=[{key:"Mod-z",run:Eu,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Iu,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Iu,preventDefault:!0},{key:"Mod-u",run:Ru,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Tu,preventDefault:!0}];Yu=function Yu(t){return _u(t,!Xu(t));};Qu=function Qu(t){return _u(t,Xu(t));};rf=function rf(t){return sf(t,!1);};nf=function nf(t){return sf(t,!0);};of=function of(t){return lf(t,!1);};uf=function uf(t){return lf(t,!0);};df=function df(t){return cf(t,!Xu(t));};pf=function pf(t){return cf(t,Xu(t));};wf=function wf(t){return gf(t,!1);};bf=function bf(t){return gf(t,!0);};kf=function kf(t){return vf(t,!1);};yf=function yf(t){return vf(t,!0);};Mf=function Mf(_ref24){var t=_ref24.state,e=_ref24.dispatch;return e(Ju(t,{anchor:0})),!0;};xf=function xf(_ref25){var t=_ref25.state,e=_ref25.dispatch;return e(Ju(t,{anchor:t.doc.length})),!0;};Sf=function Sf(_ref26){var t=_ref26.state,e=_ref26.dispatch;return e(Ju(t,{anchor:t.selection.main.anchor,head:0})),!0;};Af=function Af(_ref27){var t=_ref27.state,e=_ref27.dispatch;return e(Ju(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0;};Of=function Of(t,e,i){return Cf(t,function(s){var r,n,h=s.from,l=t.state,o=l.doc.lineAt(h);if(i&&!e&&h>o.from&&h<o.from+200&&!/[^ \t]/.test(r=o.text.slice(0,h-o.from))){if("\t"==r[r.length-1])return h-1;var _t252=Vt(r,l.tabSize)%io(l)||io(l);for(var _e218=0;_e218<_t252&&" "==r[r.length-1-_e218];_e218++)h--;n=h;}else n=p(o.text,h-o.from,e,e)+o.from,n==h&&o.number!=(e?l.doc.lines:1)?n+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(n-o.from,h-o.from))&&(n=p(o.text,n-o.from,!1,!1)+o.from);return n;});};Ef=function Ef(t){return Of(t,!1,!0);};If=function If(t){return Of(t,!0,!1);};Rf=function Rf(t,e){return Cf(t,function(i){var s=i.head,r=t.state,n=r.doc.lineAt(s),h=r.charCategorizer(s);for(var _t253=null;;){if(s==(e?n.to:n.from)){s==i.head&&n.number!=(e?r.doc.lines:1)&&(s+=e?1:-1);break;}var _l64=p(n.text,s-n.from,e)+n.from,_o43=n.text.slice(Math.min(s,_l64)-n.from,Math.max(s,_l64)-n.from),_u42=h(_o43);if(null!=_t253&&_u42!=_t253)break;" "==_o43&&s==i.head||(_t253=_u42),s=_l64;}return s;});};Tf=function Tf(t){return Rf(t,!1);};$f=jf(!1);Pf=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:function run(t){return Gu(t,function(e){return ef(t.state,e,!Xu(t));});},shift:function shift(t){return af(t,function(e){return ef(t.state,e,!Xu(t));});}},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:function run(t){return Gu(t,function(e){return ef(t.state,e,Xu(t));});},shift:function shift(t){return af(t,function(e){return ef(t.state,e,Xu(t));});}},{key:"Alt-ArrowUp",run:function run(_ref29){var t=_ref29.state,e=_ref29.dispatch;return Lf(t,e,!1);}},{key:"Shift-Alt-ArrowUp",run:function run(_ref30){var t=_ref30.state,e=_ref30.dispatch;return Nf(t,e,!1);}},{key:"Alt-ArrowDown",run:function run(_ref31){var t=_ref31.state,e=_ref31.dispatch;return Lf(t,e,!0);}},{key:"Shift-Alt-ArrowDown",run:function run(_ref32){var t=_ref32.state,e=_ref32.dispatch;return Nf(t,e,!0);}},{key:"Escape",run:function run(_ref33){var t=_ref33.state,e=_ref33.dispatch;var i=t.selection,s=null;return i.ranges.length>1?s=B.create([i.main]):i.main.empty||(s=B.create([B.cursor(i.main.head)])),!!s&&(e(Ju(t,s)),!0);}},{key:"Mod-Enter",run:jf(!0)},{key:"Alt-l",mac:"Ctrl-l",run:function run(_ref34){var t=_ref34.state,e=_ref34.dispatch;var i=Bf(t).map(function(_ref35){var e=_ref35.from,i=_ref35.to;return B.range(e,Math.min(i+1,t.doc.length));});return e(t.update({selection:B.create(i),userEvent:"select"})),!0;}},{key:"Mod-i",run:function run(_ref36){var t=_ref36.state,e=_ref36.dispatch;var i=Uu(t.selection,function(e){var i;for(var _s171=Fl(t).resolveStack(e.from,1);_s171;_s171=_s171.next){var _s172=_s171,_t256=_s172.node;if((_t256.from<e.from&&_t256.to>=e.to||_t256.to>e.to&&_t256.from<=e.from)&&(null===(i=_t256.parent)||void 0===i?void 0:i.parent))return B.range(_t256.to,_t256.from);}return e;});return e(Ju(t,i)),!0;},preventDefault:!0},{key:"Mod-[",run:function run(_ref37){var t=_ref37.state,e=_ref37.dispatch;return!t.readOnly&&(e(t.update(zf(t,function(e,i){var s=/^\s*/.exec(e.text)[0];if(!s)return;var r=Vt(s,t.tabSize),n=0,h=so(t,Math.max(0,r-io(t)));for(;n<s.length&&n<h.length&&s.charCodeAt(n)==h.charCodeAt(n);)n++;i.push({from:e.from+n,to:e.from+s.length,insert:h.slice(n)});}),{userEvent:"delete.dedent"})),!0);}},{key:"Mod-]",run:function run(_ref38){var t=_ref38.state,e=_ref38.dispatch;return!t.readOnly&&(e(t.update(zf(t,function(e,i){i.push({from:e.from,insert:t.facet(eo)});}),{userEvent:"input.indent"})),!0);}},{key:"Mod-Alt-\\",run:function run(_ref39){var t=_ref39.state,e=_ref39.dispatch;if(t.readOnly)return!1;var i=Object.create(null),s=new no(t,{overrideIndentation:function overrideIndentation(t){var e=i[t];return null==e?-1:e;}}),r=zf(t,function(e,r,n){var h=ro(s,e.from);if(null==h)return;/\S/.test(e.text)||(h=0);var l=/^\s*/.exec(e.text)[0],o=so(t,h);(l!=o||n.from<e.from+l.length)&&(i[e.from]=h,r.push({from:e.from,to:e.from+l.length,insert:o}));});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0;}},{key:"Shift-Mod-k",run:function run(t){if(t.state.readOnly)return!1;var e=t.state,i=e.changes(Bf(e).map(function(_ref40){var t=_ref40.from,i=_ref40.to;return t>0?t--:i<e.doc.length&&i++,{from:t,to:i};})),s=Uu(e.selection,function(e){var i;if(t.lineWrapping){var _s173=t.lineBlockAt(e.head),_r135=t.coordsAtPos(e.head,e.assoc||1);_r135&&(i=_s173.bottom+t.documentTop-_r135.bottom+t.defaultLineHeight/2);}return t.moveVertically(e,!0,i);}).map(i);return t.dispatch({changes:i,selection:s,scrollIntoView:!0,userEvent:"delete.line"}),!0;}},{key:"Shift-Mod-\\",run:function run(_ref41){var t=_ref41.state,e=_ref41.dispatch;return function(t,e,i){var s=!1,r=Uu(t.selection,function(e){var r=hu(t,e.head,-1)||hu(t,e.head,1)||e.head>0&&hu(t,e.head-1,1)||e.head<t.doc.length&&hu(t,e.head+1,-1);if(!r||!r.end)return e;s=!0;var n=r.start.from==e.head?r.end.to:r.end.from;return i?B.range(e.anchor,n):B.cursor(n);});return!!s&&(e(Ju(t,r)),!0);}(t,e,!1);}},{key:"Mod-/",run:function run(t){var e=t.state,i=e.doc.lineAt(e.selection.main.from),s=vu(t.state,i.from);return s.line?gu(t):!!s.block&&bu(t);}},{key:"Alt-A",run:wu}].concat([{key:"ArrowLeft",run:Yu,shift:df,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:function run(t){return Zu(t,!Xu(t));},shift:function shift(t){return mf(t,!Xu(t));},preventDefault:!0},{mac:"Cmd-ArrowLeft",run:function run(t){return Gu(t,function(e){return ff(t,e,!Xu(t));});},shift:function shift(t){return af(t,function(e){return ff(t,e,!Xu(t));});},preventDefault:!0},{key:"ArrowRight",run:Qu,shift:pf,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:function run(t){return Zu(t,Xu(t));},shift:function shift(t){return mf(t,Xu(t));},preventDefault:!0},{mac:"Cmd-ArrowRight",run:function run(t){return Gu(t,function(e){return ff(t,e,Xu(t));});},shift:function shift(t){return af(t,function(e){return ff(t,e,Xu(t));});},preventDefault:!0},{key:"ArrowUp",run:rf,shift:wf,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Mf,shift:Sf},{mac:"Ctrl-ArrowUp",run:of,shift:kf},{key:"ArrowDown",run:nf,shift:bf,preventDefault:!0},{mac:"Cmd-ArrowDown",run:xf,shift:Af},{mac:"Ctrl-ArrowDown",run:uf,shift:yf},{key:"PageUp",run:of,shift:kf},{key:"PageDown",run:uf,shift:yf},{key:"Home",run:function run(t){return Gu(t,function(e){return ff(t,e,!1);});},shift:function shift(t){return af(t,function(e){return ff(t,e,!1);});},preventDefault:!0},{key:"Mod-Home",run:Mf,shift:Sf},{key:"End",run:function run(t){return Gu(t,function(e){return ff(t,e,!0);});},shift:function shift(t){return af(t,function(e){return ff(t,e,!0);});},preventDefault:!0},{key:"Mod-End",run:xf,shift:Af},{key:"Enter",run:$f},{key:"Mod-a",run:function run(_ref42){var t=_ref42.state,e=_ref42.dispatch;return e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0;}},{key:"Backspace",run:Ef,shift:Ef},{key:"Delete",run:If},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Tf},{key:"Mod-Delete",mac:"Alt-Delete",run:function run(t){return Rf(t,!0);}},{mac:"Mod-Backspace",run:function run(t){return Cf(t,function(e){var i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1);});}},{mac:"Mod-Delete",run:function run(t){return Cf(t,function(e){var i=t.moveToLineBoundary(e,!0).head;return e.head<i?i:Math.min(t.state.doc.length,e.head+1);});}}].concat([{key:"Ctrl-b",run:Yu,shift:df,preventDefault:!0},{key:"Ctrl-f",run:Qu,shift:pf},{key:"Ctrl-p",run:rf,shift:wf},{key:"Ctrl-n",run:nf,shift:bf},{key:"Ctrl-a",run:function run(t){return Gu(t,function(e){return B.cursor(t.lineBlockAt(e.head).from,1);});},shift:function shift(t){return af(t,function(e){return B.cursor(t.lineBlockAt(e.head).from);});}},{key:"Ctrl-e",run:function run(t){return Gu(t,function(e){return B.cursor(t.lineBlockAt(e.head).to,-1);});},shift:function shift(t){return af(t,function(e){return B.cursor(t.lineBlockAt(e.head).to);});}},{key:"Ctrl-d",run:If},{key:"Ctrl-h",run:Ef},{key:"Ctrl-k",run:function run(t){return Cf(t,function(e){var i=t.lineBlockAt(e.head).to;return e.head<i?i:Math.min(t.state.doc.length,e.head+1);});}},{key:"Ctrl-Alt-h",run:Tf},{key:"Ctrl-o",run:function run(_ref43){var e=_ref43.state,i=_ref43.dispatch;if(e.readOnly)return!1;var s=e.changeByRange(function(e){return{changes:{from:e.from,to:e.to,insert:t.of(["",""])},range:B.cursor(e.from)};});return i(e.update(s,{scrollIntoView:!0,userEvent:"input"})),!0;}},{key:"Ctrl-t",run:function run(_ref44){var t=_ref44.state,e=_ref44.dispatch;if(t.readOnly)return!1;var i=t.changeByRange(function(e){if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};var i=e.from,s=t.doc.lineAt(i),r=i==s.from?i-1:p(s.text,i-s.from,!1)+s.from,n=i==s.to?i+1:p(s.text,i-s.from,!0)+s.from;return{changes:{from:r,to:n,insert:t.doc.slice(i,n).append(t.doc.slice(r,i))},range:B.cursor(n)};});return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0);}},{key:"Ctrl-v",run:uf}].map(function(t){return{mac:t.key,run:t.run,shift:t.shift};})));Vf="function"==typeof String.prototype.normalize?function(t){return t.normalize("NFKD");}:function(t){return t;};Ff=/*#__PURE__*/function(){function Ff(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:t.length;var r=arguments.length>4?arguments[4]:undefined;var n=arguments.length>5?arguments[5]:undefined;_classCallCheck(this,Ff);this.test=n,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,s),this.bufferStart=i,this.normalize=r?function(t){return r(Vf(t));}:Vf,this.query=this.normalize(e);}return _createClass(Ff,[{key:"peek",value:function peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value;}return v(this.buffer,this.bufferPos);}},{key:"next",value:function next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping();}},{key:"nextOverlapping",value:function nextOverlapping(){for(;;){var _t257=this.peek();if(_t257<0)return this.done=!0,this;var _e221=k(_t257),_i186=this.bufferStart+this.bufferPos;this.bufferPos+=y(_t257);var _s174=this.normalize(_e221);for(var _t258=0,_r136=_i186;;_t258++){var _n107=_s174.charCodeAt(_t258),_h74=this.match(_n107,_r136,this.bufferPos+this.bufferStart);if(_t258==_s174.length-1){if(_h74)return this.value=_h74,this;break;}_r136==_i186&&_t258<_e221.length&&_e221.charCodeAt(_t258)==_n107&&_r136++;}}}},{key:"match",value:function match(t,e,i){var s=null;for(var _e222=0;_e222<this.matches.length;_e222+=2){var _r137=this.matches[_e222],_n108=!1;this.query.charCodeAt(_r137)==t&&(_r137==this.query.length-1?s={from:this.matches[_e222+1],to:i}:(this.matches[_e222]++,_n108=!0)),_n108||(this.matches.splice(_e222,2),_e222-=2);}return this.query.charCodeAt(0)==t&&(1==this.query.length?s={from:e,to:i}:this.matches.push(1,e)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s;}}]);}();"undefined"!=typeof Symbol&&(Ff.prototype[Symbol.iterator]=function(){return this;});qf={from:-1,to:-1,match:/.*/.exec("")};Uf="gm"+(null==/x/.unicode?"":"u");Jf=/*#__PURE__*/function(){function Jf(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:t.length;_classCallCheck(this,Jf);if(this.text=t,this.to=r,this.curLine="",this.done=!1,this.value=qf,/\\[sWDnr]|\n|\r|\[\^/.test(e))return new _f(t,e,i,s,r);this.re=new RegExp(e,Uf+((null==i?void 0:i.ignoreCase)?"i":"")),this.test=null==i?void 0:i.test,this.iter=t.iter();var n=t.lineAt(s);this.curLineStart=n.from,this.matchPos=Xf(t,s),this.getLine(this.curLineStart);}return _createClass(Jf,[{key:"getLine",value:function getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next());}},{key:"nextLine",value:function nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0);}},{key:"next",value:function next(){for(var _t259=this.matchPos-this.curLineStart;;){this.re.lastIndex=_t259;var _e223=this.matchPos<=this.to&&this.re.exec(this.curLine);if(_e223){var _i187=this.curLineStart+_e223.index,_s175=_i187+_e223[0].length;if(this.matchPos=Xf(this.text,_s175+(_i187==_s175?1:0)),_i187==this.curLineStart+this.curLine.length&&this.nextLine(),(_i187<_s175||_i187>this.value.to)&&(!this.test||this.test(_i187,_s175,_e223)))return this.value={from:_i187,to:_s175,match:_e223},this;_t259=this.matchPos-this.curLineStart;}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),_t259=0;}}}}]);}();Gf=new WeakMap();Kf=/*#__PURE__*/function(){function Kf(t,e){_classCallCheck(this,Kf);this.from=t,this.text=e;}return _createClass(Kf,[{key:"to",get:function get(){return this.from+this.text.length;}}],[{key:"get",value:function get(t,e,i){var s=Gf.get(t);if(!s||s.from>=i||s.to<=e){var _s176=new Kf(e,t.sliceString(e,i));return Gf.set(t,_s176),_s176;}if(s.from==e&&s.to==i)return s;var r=s.text,n=s.from;return n>e&&(r=t.sliceString(e,n)+r,n=e),s.to<i&&(r+=t.sliceString(s.to,i)),Gf.set(t,new Kf(n,r)),new Kf(e,r.slice(e-n,i-n));}}]);}();_f=/*#__PURE__*/function(){function _f(t,e,i,s,r){_classCallCheck(this,_f);this.text=t,this.to=r,this.done=!1,this.value=qf,this.matchPos=Xf(t,s),this.re=new RegExp(e,Uf+((null==i?void 0:i.ignoreCase)?"i":"")),this.test=null==i?void 0:i.test,this.flat=Kf.get(t,s,this.chunkEnd(s+5e3));}return _createClass(_f,[{key:"chunkEnd",value:function chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to;}},{key:"next",value:function next(){for(;;){var _t260=this.re.lastIndex=this.matchPos-this.flat.from,_e224=this.re.exec(this.flat.text);if(_e224&&!_e224[0]&&_e224.index==_t260&&(this.re.lastIndex=_t260+1,_e224=this.re.exec(this.flat.text)),_e224){var _t261=this.flat.from+_e224.index,_i188=_t261+_e224[0].length;if((this.flat.to>=this.to||_e224.index+_e224[0].length<=this.flat.text.length-10)&&(!this.test||this.test(_t261,_i188,_e224)))return this.value={from:_t261,to:_i188,match:_e224},this.matchPos=Xf(this.text,_i188+(_t261==_i188?1:0)),this;}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Kf.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length));}}}]);}();"undefined"!=typeof Symbol&&(Jf.prototype[Symbol.iterator]=_f.prototype[Symbol.iterator]=function(){return this;});Qf=ct.define();Zf=F.define({create:function create(){return!0;},update:function update(t,e){var _iterator189=_createForOfIteratorHelper(e.effects),_step189;try{for(_iterator189.s();!(_step189=_iterator189.n()).done;){var _i190=_step189.value;_i190.is(Qf)&&(t=_i190.value);}}catch(err){_iterator189.e(err);}finally{_iterator189.f();}return t;},provide:function provide(t){return oh.from(t,function(t){return t?Yf:null;});}});ta=Ur.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}});ea={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1};ia=$.define({combine:function combine(t){return At(t,ea,{highlightWordAroundCursor:function highlightWordAroundCursor(t,e){return t||e;},minSelectionLength:Math.min,maxMatches:Math.min});}});sa=ni.mark({"class":"cm-selectionMatch"});ra=ni.mark({"class":"cm-selectionMatch cm-selectionMatch-main"});ha=_i.fromClass(/*#__PURE__*/function(){function _class10(t){_classCallCheck(this,_class10);this.decorations=this.getDeco(t);}return _createClass(_class10,[{key:"update",value:function update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view));}},{key:"getDeco",value:function getDeco(t){var e=t.state.facet(ia),i=t.state,s=i.selection;if(s.ranges.length>1)return ni.none;var r,n=s.main,h=null;if(n.empty){if(!e.highlightWordAroundCursor)return ni.none;var _t263=i.wordAt(n.head);if(!_t263)return ni.none;h=i.charCategorizer(n.head),r=i.sliceDoc(_t263.from,_t263.to);}else{var _t264=n.to-n.from;if(_t264<e.minSelectionLength||_t264>200)return ni.none;if(e.wholeWords){if(r=i.sliceDoc(n.from,n.to),h=i.charCategorizer(n.head),!na(h,i,n.from,n.to)||!function(t,e,i,s){return t(e.sliceDoc(i,i+1))==kt.Word&&t(e.sliceDoc(s-1,s))==kt.Word;}(h,i,n.from,n.to))return ni.none;}else if(r=i.sliceDoc(n.from,n.to),!r)return ni.none;}var l=[];var _iterator190=_createForOfIteratorHelper(t.visibleRanges),_step190;try{for(_iterator190.s();!(_step190=_iterator190.n()).done;){var _s177=_step190.value;var _t265=new Ff(i.doc,r,_s177.from,_s177.to);for(;!_t265.next().done;){var _t265$value=_t265.value,_s178=_t265$value.from,_r138=_t265$value.to;if((!h||na(h,i,_s178,_r138))&&(n.empty&&_s178<=n.from&&_r138>=n.to?l.push(ra.range(_s178,_r138)):(_s178>=n.to||_r138<=n.from)&&l.push(sa.range(_s178,_r138)),l.length>e.maxMatches))return ni.none;}}}catch(err){_iterator190.e(err);}finally{_iterator190.f();}return ni.set(l);}}]);}(),{decorations:function decorations(t){return t.decorations;}});la=Ur.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});oa=$.define({combine:function combine(t){return At(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:function createPanel(t){return new ja(t);},scrollToMatch:function scrollToMatch(t){return Ur.scrollIntoView(t);}});}});ua=/*#__PURE__*/function(){function ua(t){_classCallCheck(this,ua);this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,Uf),!0;}catch(t){return!1;}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord;}return _createClass(ua,[{key:"unquote",value:function unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,function(t,e){return"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\";});}},{key:"eq",value:function eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord;}},{key:"create",value:function create(){return this.regexp?new ga(this):new ca(this);}},{key:"getCursor",value:function getCursor(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2?arguments[2]:undefined;var s=t.doc?t:St.create({doc:t});return null==i&&(i=s.doc.length),this.regexp?da(this,s,e,i):aa(this,s,e,i);}}]);}();fa=/*#__PURE__*/_createClass(function fa(t){_classCallCheck(this,fa);this.spec=t;});ca=/*#__PURE__*/function(_fa){function ca(t){_classCallCheck(this,ca);return _callSuper(this,ca,[t]);}_inherits(ca,_fa);return _createClass(ca,[{key:"nextMatch",value:function nextMatch(t,e,i){var s=aa(this.spec,t,i,t.doc.length).nextOverlapping();return s.done&&(s=aa(this.spec,t,0,e).nextOverlapping()),s.done?null:s.value;}},{key:"prevMatchInRange",value:function prevMatchInRange(t,e,i){for(var _s179=i;;){var _i191=Math.max(e,_s179-1e4-this.spec.unquoted.length),_r139=aa(this.spec,t,_i191,_s179),_n109=null;for(;!_r139.nextOverlapping().done;)_n109=_r139.value;if(_n109)return _n109;if(_i191==e)return null;_s179-=1e4;}}},{key:"prevMatch",value:function prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length);}},{key:"getReplacement",value:function getReplacement(t){return this.spec.unquote(this.spec.replace);}},{key:"matchAll",value:function matchAll(t,e){var i=aa(this.spec,t,0,t.doc.length),s=[];for(;!i.next().done;){if(s.length>=e)return null;s.push(i.value);}return s;}},{key:"highlight",value:function highlight(t,e,i,s){var r=aa(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to);}}]);}(fa);ga=/*#__PURE__*/function(_fa2){function ga(){_classCallCheck(this,ga);return _callSuper(this,ga,arguments);}_inherits(ga,_fa2);return _createClass(ga,[{key:"nextMatch",value:function nextMatch(t,e,i){var s=da(this.spec,t,i,t.doc.length).next();return s.done&&(s=da(this.spec,t,0,e).next()),s.done?null:s.value;}},{key:"prevMatchInRange",value:function prevMatchInRange(t,e,i){for(var _s180=1;;_s180++){var _r140=Math.max(e,i-1e4*_s180),_n110=da(this.spec,t,_r140,i),_h75=null;for(;!_n110.next().done;)_h75=_n110.value;if(_h75&&(_r140==e||_h75.from>_r140+10))return _h75;if(_r140==e)return null;}}},{key:"prevMatch",value:function prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length);}},{key:"getReplacement",value:function getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,function(e,i){return"$"==i?"$":"&"==i?t.match[0]:"0"!=i&&+i<t.match.length?t.match[i]:e;});}},{key:"matchAll",value:function matchAll(t,e){var i=da(this.spec,t,0,t.doc.length),s=[];for(;!i.next().done;){if(s.length>=e)return null;s.push(i.value);}return s;}},{key:"highlight",value:function highlight(t,e,i,s){var r=da(this.spec,t,Math.max(0,e-250),Math.min(i+250,t.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to);}}]);}(fa);wa=ct.define();ba=ct.define();va=F.define({create:function create(t){return new ka(Ra(t).create(),null);},update:function update(t,e){var _iterator191=_createForOfIteratorHelper(e.effects),_step191;try{for(_iterator191.s();!(_step191=_iterator191.n()).done;){var _i192=_step191.value;_i192.is(wa)?t=new ka(_i192.value.create(),t.panel):_i192.is(ba)&&(t=new ka(t.query,_i192.value?Ia:null));}}catch(err){_iterator191.e(err);}finally{_iterator191.f();}return t;},provide:function provide(t){return oh.from(t,function(t){return t.panel;});}});ka=/*#__PURE__*/_createClass(function ka(t,e){_classCallCheck(this,ka);this.query=t,this.panel=e;});ya=ni.mark({"class":"cm-searchMatch"});Ma=ni.mark({"class":"cm-searchMatch cm-searchMatch-selected"});xa=_i.fromClass(/*#__PURE__*/function(){function _class11(t){_classCallCheck(this,_class11);this.view=t,this.decorations=this.highlight(t.state.field(va));}return _createClass(_class11,[{key:"update",value:function update(t){var e=t.state.field(va);(e!=t.startState.field(va)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e));}},{key:"highlight",value:function highlight(_ref45){var t=_ref45.query,e=_ref45.panel;if(!e||!t.spec.valid)return ni.none;var i=this.view,s=new Rt();for(var _e225=0,_r141=i.visibleRanges,_n111=_r141.length;_e225<_n111;_e225++){var _r141$_e=_r141[_e225],_h76=_r141$_e.from,_l66=_r141$_e.to;for(;_e225<_n111-1&&_l66>_r141[_e225+1].from-500;)_l66=_r141[++_e225].to;t.highlight(i.state,_h76,_l66,function(t,e){var r=i.state.selection.ranges.some(function(i){return i.from==t&&i.to==e;});s.add(t,e,r?Ma:ya);});}return s.finish();}}]);}(),{decorations:function decorations(t){return t.decorations;}});Aa=Sa(function(t,_ref46){var e=_ref46.query;var i=t.state.selection.main.to,s=e.nextMatch(t.state,i,i);if(!s)return!1;var r=B.single(s.from,s.to),n=t.state.facet(oa);return t.dispatch({selection:r,effects:[Wa(t,s),n.scrollToMatch(r.main,t)],userEvent:"select.search"}),Ba(t),!0;});Ca=Sa(function(t,_ref47){var e=_ref47.query;var i=t.state,s=i.selection.main.from,r=e.prevMatch(i,s,s);if(!r)return!1;var n=B.single(r.from,r.to),h=t.state.facet(oa);return t.dispatch({selection:n,effects:[Wa(t,r),h.scrollToMatch(n.main,t)],userEvent:"select.search"}),Ba(t),!0;});Da=Sa(function(t,_ref48){var e=_ref48.query;var i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:B.create(i.map(function(t){return B.range(t.from,t.to);})),userEvent:"select.search.matches"}),!0);});Oa=Sa(function(t,_ref49){var e=_ref49.query;var i=t.state,_i$selection$main=i.selection.main,s=_i$selection$main.from,r=_i$selection$main.to;if(i.readOnly)return!1;var n=e.nextMatch(i,s,s);if(!n)return!1;var h,l,o=[],u=[];if(n.from==s&&n.to==r&&(l=i.toText(e.getReplacement(n)),o.push({from:n.from,to:n.to,insert:l}),n=e.nextMatch(i,n.from,n.to),u.push(Ur.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(s).number)+"."))),n){var _e226=0==o.length||o[0].from>=n.to?0:n.to-n.from-l.length;h=B.single(n.from-_e226,n.to-_e226),u.push(Wa(t,n)),u.push(i.facet(oa).scrollToMatch(h.main,t));}return t.dispatch({changes:o,selection:h,effects:u,userEvent:"input.replace"}),!0;});Ea=Sa(function(t,_ref50){var e=_ref50.query;if(t.state.readOnly)return!1;var i=e.matchAll(t.state,1e9).map(function(t){var i=t.from,s=t.to;return{from:i,to:s,insert:e.getReplacement(t)};});if(!i.length)return!1;var s=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:Ur.announce.of(s),userEvent:"input.replace.all"}),!0;});La=function La(t){var e=t.state.field(va,!1);if(e&&e.panel){var _i193=Ta(t);if(_i193&&_i193!=t.root.activeElement){var _s181=Ra(t.state,e.query.spec);_s181.valid&&t.dispatch({effects:wa.of(_s181)}),_i193.focus(),_i193.select();}}else t.dispatch({effects:[ba.of(!0),e?wa.of(Ra(t.state,e.query.spec)):ct.appendConfig.of(Fa)]});return!0;};Na=function Na(t){var e=t.state.field(va,!1);if(!e||!e.panel)return!1;var i=rh(t,Ia);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:ba.of(!1)}),!0;};$a=[{key:"Mod-f",run:La,scope:"editor search-panel"},{key:"F3",run:Aa,shift:Ca,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Aa,shift:Ca,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Na,scope:"editor search-panel"},{key:"Mod-Shift-l",run:function run(_ref51){var t=_ref51.state,e=_ref51.dispatch;var i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;var _i$main=i.main,s=_i$main.from,r=_i$main.to,n=[],h=0;for(var _e227=new Ff(t.doc,t.sliceDoc(s,r));!_e227.next().done;){if(n.length>1e3)return!1;_e227.value.from==s&&(h=n.length),n.push(B.range(_e227.value.from,_e227.value.to));}return e(t.update({selection:B.create(n,h),userEvent:"select.search.matches"})),!0;}},{key:"Mod-Alt-g",run:function run(t){var e=rh(t,Yf);if(!e){var _i194=[Qf.of(!0)];null==t.state.field(Zf,!1)&&_i194.push(ct.appendConfig.of([Zf,ta])),t.dispatch({effects:_i194}),e=rh(t,Yf);}return e&&e.dom.querySelector("input").select(),!0;}},{key:"Mod-d",run:function run(_ref52){var t=_ref52.state,e=_ref52.dispatch;var i=t.selection.ranges;if(i.some(function(t){return t.from===t.to;}))return function(_ref53){var t=_ref53.state,e=_ref53.dispatch;var i=t.selection,s=B.create(i.ranges.map(function(e){return t.wordAt(e.head)||B.cursor(e.head);}),i.mainIndex);return!s.eq(i)&&(e(t.update({selection:s})),!0);}({state:t,dispatch:e});var s=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(function(e){return t.sliceDoc(e.from,e.to)!=s;}))return!1;var r=function(t,e){var _t$selection=t.selection,i=_t$selection.main,s=_t$selection.ranges,r=t.wordAt(i.head),n=r&&r.from==i.from&&r.to==i.to;var _loop14=function _loop14(_i196,_r143){if(_r143.next(),!_r143.done){if(_i196&&s.some(function(t){return t.from==_r143.value.from;})){_i195=_i196,_r142=_r143;return 0;}// continue
2
+ }};for(var _t292=0;_t292<_i217.length;_t292++){if(_loop17())continue t;}e.push("");}}catch(err){_iterator225.e(err);}finally{_iterator225.f();}}return e;}function Dd(t,e,i){var s;var r=i?Cd(e.actions):[];return Hf("li",{"class":"cm-diagnostic cm-diagnostic-"+e.severity},Hf("span",{"class":"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),null===(s=e.actions)||void 0===s?void 0:s.map(function(i,s){var n=!1,h=function h(s){if(s.preventDefault(),n)return;n=!0;var r=md(t.state.field(vd).diagnostics,e);r&&i.apply(t,r.from,r.to);},l=i.name,o=r[s]?l.indexOf(r[s]):-1,u=o<0?l:[l.slice(0,o),Hf("u",l.slice(o,o+1)),l.slice(o+1)];return Hf("button",{type:"button","class":"cm-diagnosticAction",onclick:h,onmousedown:h,"aria-label":" Action: ".concat(l).concat(o<0?"":" (access key \"".concat(r[s],")\""),".")},u);}),e.source&&Hf("div",{"class":"cm-diagnosticSource"},e.source));}function Rd(t){return function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'viewBox="0 0 40 40"';return"url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" ".concat(e,">").concat(encodeURIComponent(t),"</svg>')");}("<path d=\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\" stroke=\"".concat(t,"\" fill=\"none\" stroke-width=\".7\"/>"),'width="6" height="3"');}_export({c:go,d:co,g:vo,j:Ga,k:Ja,l:Fl,n:Uc,p:zl,s:pl,v:fd,w:Dh,I:void 0});return{setters:[],execute:function execute(){t=/*#__PURE__*/function(){function t(){_classCallCheck(this,t);}return _createClass(t,[{key:"lineAt",value:function lineAt(_t2){if(_t2<0||_t2>this.length)throw new RangeError("Invalid position ".concat(_t2," in document of length ").concat(this.length));return this.lineInner(_t2,!1,1,0);}},{key:"line",value:function line(_t3){if(_t3<1||_t3>this.lines)throw new RangeError("Invalid line number ".concat(_t3," in ").concat(this.lines,"-line document"));return this.lineInner(_t3,!0,1,0);}},{key:"replace",value:function replace(_t4,e,s){var _u2=u(this,_t4,e);var _u3=_slicedToArray(_u2,2);_t4=_u3[0];e=_u3[1];var r=[];return this.decompose(0,_t4,r,2),s.length&&s.decompose(0,s.length,r,3),this.decompose(e,this.length,r,1),i.from(r,this.length-(e-_t4)+s.length);}},{key:"append",value:function append(_t5){return this.replace(this.length,this.length,_t5);}},{key:"slice",value:function slice(_t6){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;var _u4=u(this,_t6,e);var _u5=_slicedToArray(_u4,2);_t6=_u5[0];e=_u5[1];var s=[];return this.decompose(_t6,e,s,0),i.from(s,e-_t6);}},{key:"eq",value:function eq(_t7){if(_t7==this)return!0;if(_t7.length!=this.length||_t7.lines!=this.lines)return!1;var e=this.scanIdentical(_t7,1),i=this.length-this.scanIdentical(_t7,-1),s=new n(this),r=new n(_t7);for(var _t13=e,_n2=e;;){if(s.next(_t13),r.next(_t13),_t13=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(_n2+=s.value.length,s.done||_n2>=i)return!0;}}},{key:"iter",value:function iter(){var _t9=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;return new n(this,_t9);}},{key:"iterRange",value:function iterRange(_t10){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;return new h(this,_t10,e);}},{key:"iterLines",value:function iterLines(_t11,e){var i;if(null==_t11)i=this.iter();else{null==e&&(e=this.lines+1);var _s2=this.line(_t11).from;i=this.iterRange(_s2,Math.max(_s2,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to));}return new l(i);}},{key:"toString",value:function toString(){return this.sliceString(0);}},{key:"toJSON",value:function toJSON(){var _t12=[];return this.flatten(_t12),_t12;}}],[{key:"of",value:function of(s){if(0==s.length)throw new RangeError("A document must have at least one line");return 1!=s.length||s[0]?s.length<=32?new e(s):i.from(e.split(s,[])):t.empty;}}]);}();e=/*#__PURE__*/function(_t14){function e(t){var _this;var _e2=arguments.length>1&&arguments[1]!==undefined?arguments[1]:function(t){var e=-1;var _iterator=_createForOfIteratorHelper(t),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _i2=_step.value;e+=_i2.length+1;}}catch(err){_iterator.e(err);}finally{_iterator.f();}return e;}(t);_classCallCheck(this,e);_this=_callSuper(this,e),_this.text=t,_this.length=_e2;return _this;}_inherits(e,_t14);return _createClass(e,[{key:"lines",get:function get(){return this.text.length;}},{key:"children",get:function get(){return null;}},{key:"lineInner",value:function lineInner(t,_e3,i,s){for(var _r2=0;;_r2++){var _n3=this.text[_r2],_h2=s+_n3.length;if((_e3?i:_h2)>=t)return new o(s,_h2,i,_n3);s=_h2+1,i++;}}},{key:"decompose",value:function decompose(t,i,n,h){var l=t<=0&&i>=this.length?this:new e(r(this.text,t,i),Math.min(i,this.length)-Math.max(0,t));if(1&h){var _t15=n.pop(),_i3=s(l.text,_t15.text.slice(),0,l.length);if(_i3.length<=32)n.push(new e(_i3,_t15.length+l.length));else{var _t16=_i3.length>>1;n.push(new e(_i3.slice(0,_t16)),new e(_i3.slice(_t16)));}}else n.push(l);}},{key:"replace",value:function replace(t,n,h){if(!(h instanceof e))return _get(_getPrototypeOf(e.prototype),"replace",this).call(this,t,n,h);var _u6=u(this,t,n);var _u7=_slicedToArray(_u6,2);t=_u7[0];n=_u7[1];var l=s(this.text,s(h.text,r(this.text,0,t)),n),o=this.length+h.length-(n-t);return l.length<=32?new e(l,o):i.from(e.split(l,[]),o);}},{key:"sliceString",value:function sliceString(t){var _e4=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"\n";var _u8=u(this,t,_e4);var _u9=_slicedToArray(_u8,2);t=_u9[0];_e4=_u9[1];var s="";for(var _r3=0,_n4=0;_r3<=_e4&&_n4<this.text.length;_n4++){var _h3=this.text[_n4],_l2=_r3+_h3.length;_r3>t&&_n4&&(s+=i),t<_l2&&_e4>_r3&&(s+=_h3.slice(Math.max(0,t-_r3),_e4-_r3)),_r3=_l2+1;}return s;}},{key:"flatten",value:function flatten(t){var _iterator2=_createForOfIteratorHelper(this.text),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _e5=_step2.value;t.push(_e5);}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}},{key:"scanIdentical",value:function scanIdentical(){return 0;}}],[{key:"split",value:function split(t,i){var s=[],r=-1;var _iterator3=_createForOfIteratorHelper(t),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _n5=_step3.value;s.push(_n5),r+=_n5.length+1,32==s.length&&(i.push(new e(s,r)),s=[],r=-1);}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}return r>-1&&i.push(new e(s,r)),i;}}]);}(t);i=/*#__PURE__*/function(_t17){function i(t,e){var _this2;_classCallCheck(this,i);_this2=_callSuper(this,i),_this2.children=t,_this2.length=e,_this2.lines=0;var _iterator4=_createForOfIteratorHelper(t),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _e6=_step4.value;_this2.lines+=_e6.lines;}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}return _this2;}_inherits(i,_t17);return _createClass(i,[{key:"lineInner",value:function lineInner(t,e,_i4,s){for(var _r4=0;;_r4++){var _n6=this.children[_r4],_h4=s+_n6.length,_l3=_i4+_n6.lines-1;if((e?_l3:_h4)>=t)return _n6.lineInner(t,e,_i4,s);s=_h4+1,_i4=_l3+1;}}},{key:"decompose",value:function decompose(t,e,_i5,s){for(var _r5=0,_n7=0;_n7<=e&&_r5<this.children.length;_r5++){var _h5=this.children[_r5],_l4=_n7+_h5.length;if(t<=_l4&&e>=_n7){var _r6=s&((_n7<=t?1:0)|(_l4>=e?2:0));_n7>=t&&_l4<=e&&!_r6?_i5.push(_h5):_h5.decompose(t-_n7,e-_n7,_i5,_r6);}_n7=_l4+1;}}},{key:"replace",value:function replace(t,e,s){var _u10,_u11;if((_u10=u(this,t,e),_u11=_slicedToArray(_u10,2),t=_u11[0],e=_u11[1]),s.lines<this.lines)for(var _r7=0,_n8=0;_r7<this.children.length;_r7++){var _h6=this.children[_r7],_l5=_n8+_h6.length;if(t>=_n8&&e<=_l5){var _o2=_h6.replace(t-_n8,e-_n8,s),_u12=this.lines-_h6.lines+_o2.lines;if(_o2.lines<_u12>>4&&_o2.lines>_u12>>6){var _n9=this.children.slice();return _n9[_r7]=_o2,new i(_n9,this.length-(e-t)+s.length);}return _get(_getPrototypeOf(i.prototype),"replace",this).call(this,_n8,_l5,_o2);}_n8=_l5+1;}return _get(_getPrototypeOf(i.prototype),"replace",this).call(this,t,e,s);}},{key:"sliceString",value:function sliceString(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;var _i6=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"\n";var _u13=u(this,t,e);var _u14=_slicedToArray(_u13,2);t=_u14[0];e=_u14[1];var s="";for(var _r8=0,_n10=0;_r8<this.children.length&&_n10<=e;_r8++){var _h7=this.children[_r8],_l6=_n10+_h7.length;_n10>t&&_r8&&(s+=_i6),t<_l6&&e>_n10&&(s+=_h7.sliceString(t-_n10,e-_n10,_i6)),_n10=_l6+1;}return s;}},{key:"flatten",value:function flatten(t){var _iterator5=_createForOfIteratorHelper(this.children),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _e7=_step5.value;_e7.flatten(t);}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}},{key:"scanIdentical",value:function scanIdentical(t,e){if(!(t instanceof i))return 0;var s=0,_ref=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1],_ref2=_slicedToArray(_ref,4),r=_ref2[0],n=_ref2[1],h=_ref2[2],l=_ref2[3];for(;;r+=e,n+=e){if(r==h||n==l)return s;var _i7=this.children[r],_o3=t.children[n];if(_i7!=_o3)return s+_i7.scanIdentical(_o3,e);s+=_i7.length+1;}}}],[{key:"from",value:function from(t){var s=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t.reduce(function(t,e){return t+e.length+1;},-1);var r=0;var _iterator6=_createForOfIteratorHelper(t),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _e10=_step6.value;r+=_e10.lines;}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}if(r<32){var _i8=[];var _iterator7=_createForOfIteratorHelper(t),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _e8=_step7.value;_e8.flatten(_i8);}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}return new e(_i8,s);}var n=Math.max(32,r>>5),h=n<<1,l=n>>1,o=[],u=0,f=-1,a=[];function c(t){var s;if(t.lines>h&&t instanceof i){var _iterator8=_createForOfIteratorHelper(t.children),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _e9=_step8.value;c(_e9);}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}else t.lines>l&&(u>l||!u)?(d(),o.push(t)):t instanceof e&&u&&(s=a[a.length-1])instanceof e&&t.lines+s.lines<=32?(u+=t.lines,f+=t.length+1,a[a.length-1]=new e(s.text.concat(t.text),s.length+1+t.length)):(u+t.lines>n&&d(),u+=t.lines,f+=t.length+1,a.push(t));}function d(){0!=u&&(o.push(1==a.length?a[0]:i.from(a,f)),f=-1,u=a.length=0);}var _iterator9=_createForOfIteratorHelper(t),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _e11=_step9.value;c(_e11);}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}return d(),1==o.length?o[0]:new i(o,s);}}]);}(t);t.empty=new e([""],0);n=/*#__PURE__*/function(){function n(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;_classCallCheck(this,n);this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[i>0?1:(t instanceof e?t.text.length:t.children.length)<<1];}return _createClass(n,[{key:"nextInner",value:function nextInner(t,i){for(this.done=this.lineBreak=!1;;){var _s3=this.nodes.length-1,_r10=this.nodes[_s3],_n12=this.offsets[_s3],_h9=_n12>>1,_l8=_r10 instanceof e?_r10.text.length:_r10.children.length;if(_h9==(i>0?_l8:0)){if(0==_s3)return this.done=!0,this.value="",this;i>0&&this.offsets[_s3-1]++,this.nodes.pop(),this.offsets.pop();}else if((1&_n12)==(i>0?0:1)){if(this.offsets[_s3]+=i,0==t)return this.lineBreak=!0,this.value="\n",this;t--;}else if(_r10 instanceof e){var _e12=_r10.text[_h9+(i<0?-1:0)];if(this.offsets[_s3]+=i,_e12.length>Math.max(0,t))return this.value=0==t?_e12:i>0?_e12.slice(t):_e12.slice(0,_e12.length-t),this;t-=_e12.length;}else{var _n13=_r10.children[_h9+(i<0?-1:0)];t>_n13.length?(t-=_n13.length,this.offsets[_s3]+=i):(i<0&&this.offsets[_s3]--,this.nodes.push(_n13),this.offsets.push(i>0?1:(_n13 instanceof e?_n13.text.length:_n13.children.length)<<1));}}}},{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir);}}]);}();h=/*#__PURE__*/function(){function h(t,e,i){_classCallCheck(this,h);this.value="",this.done=!1,this.cursor=new n(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i);}return _createClass(h,[{key:"nextInner",value:function nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);var i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;var _this$cursor$next=this.cursor.next(t),s=_this$cursor$next.value;return this.pos+=(s.length+t)*e,this.value=s.length<=i?s:e<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this;}},{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir);}},{key:"lineBreak",get:function get(){return this.cursor.lineBreak&&""!=this.value;}}]);}();l=/*#__PURE__*/function(){function l(t){_classCallCheck(this,l);this.inner=t,this.afterBreak=!0,this.value="",this.done=!1;}return _createClass(l,[{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var _this$inner$next=this.inner.next(t),e=_this$inner$next.done,i=_this$inner$next.lineBreak,s=_this$inner$next.value;return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this;}},{key:"lineBreak",get:function get(){return!1;}}]);}();"undefined"!=typeof Symbol&&(t.prototype[Symbol.iterator]=function(){return this.iter();},n.prototype[Symbol.iterator]=h.prototype[Symbol.iterator]=l.prototype[Symbol.iterator]=function(){return this;});o=/*#__PURE__*/function(){function o(t,e,i,s){_classCallCheck(this,o);this.from=t,this.to=e,this.number=i,this.text=s;}return _createClass(o,[{key:"length",get:function get(){return this.to-this.from;}}]);}();f="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(function(t){return t?parseInt(t,36):1;});for(_t18=1;_t18<f.length;_t18++)f[_t18]+=f[_t18-1];d=8205;M=/\r\n?|\n/;x=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t;}(x||(x={}));S=/*#__PURE__*/function(){function S(t){_classCallCheck(this,S);this.sections=t;}return _createClass(S,[{key:"length",get:function get(){var t=0;for(var _e14=0;_e14<this.sections.length;_e14+=2)t+=this.sections[_e14];return t;}},{key:"newLength",get:function get(){var t=0;for(var _e15=0;_e15<this.sections.length;_e15+=2){var _i10=this.sections[_e15+1];t+=_i10<0?this.sections[_e15]:_i10;}return t;}},{key:"empty",get:function get(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0;}},{key:"iterGaps",value:function iterGaps(t){for(var _e16=0,_i11=0,_s6=0;_e16<this.sections.length;){var _r12=this.sections[_e16++],_n14=this.sections[_e16++];_n14<0?(t(_i11,_s6,_r12),_s6+=_r12):_s6+=_n14,_i11+=_r12;}}},{key:"iterChangedRanges",value:function iterChangedRanges(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;O(this,t,e);}},{key:"invertedDesc",get:function get(){var t=[];for(var _e17=0;_e17<this.sections.length;){var _i12=this.sections[_e17++],_s7=this.sections[_e17++];_s7<0?t.push(_i12,_s7):t.push(_s7,_i12);}return new S(t);}},{key:"composeDesc",value:function composeDesc(t){return this.empty?t:t.empty?this:I(this,t);}},{key:"mapDesc",value:function mapDesc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return t.empty?this:E(this,t,e);}},{key:"mapPos",value:function mapPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:x.Simple;var s=0,r=0;for(var _n15=0;_n15<this.sections.length;){var _h10=this.sections[_n15++],_l9=this.sections[_n15++],_o5=s+_h10;if(_l9<0){if(_o5>t)return r+(t-s);r+=_h10;}else{if(i!=x.Simple&&_o5>=t&&(i==x.TrackDel&&s<t&&_o5>t||i==x.TrackBefore&&s<t||i==x.TrackAfter&&_o5>t))return null;if(_o5>t||_o5==t&&e<0&&!_h10)return t==s||e<0?r:r+_l9;r+=_l9;}s=_o5;}if(t>s)throw new RangeError("Position ".concat(t," is out of range for changeset of length ").concat(s));return r;}},{key:"touchesRange",value:function touchesRange(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;for(var _i13=0,_s8=0;_i13<this.sections.length&&_s8<=e;){var _r13=_s8+this.sections[_i13++];if(this.sections[_i13++]>=0&&_s8<=e&&_r13>=t)return!(_s8<t&&_r13>e)||"cover";_s8=_r13;}return!1;}},{key:"toString",value:function toString(){var t="";for(var _e18=0;_e18<this.sections.length;){var _i14=this.sections[_e18++],_s9=this.sections[_e18++];t+=(t?" ":"")+_i14+(_s9>=0?":"+_s9:"");}return t;}},{key:"toJSON",value:function toJSON(){return this.sections;}}],[{key:"fromJSON",value:function fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(function(t){return"number"!=typeof t;}))throw new RangeError("Invalid JSON representation of ChangeDesc");return new S(t);}},{key:"create",value:function create(t){return new S(t);}}]);}();A=/*#__PURE__*/function(_S){function A(t,e){var _this3;_classCallCheck(this,A);_this3=_callSuper(this,A,[t]),_this3.inserted=e;return _this3;}_inherits(A,_S);return _createClass(A,[{key:"apply",value:function apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return O(this,function(e,i,s,r,n){return t=t.replace(s,s+(i-e),n);},!1),t;}},{key:"mapDesc",value:function mapDesc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return E(this,t,e,!0);}},{key:"invert",value:function invert(e){var i=this.sections.slice(),s=[];for(var _r14=0,_n16=0;_r14<i.length;_r14+=2){var _h11=i[_r14],_l10=i[_r14+1];if(_l10>=0){i[_r14]=_l10,i[_r14+1]=_h11;var _o6=_r14>>1;for(;s.length<_o6;)s.push(t.empty);s.push(_h11?e.slice(_n16,_n16+_h11):t.empty);}_n16+=_h11;}return new A(i,s);}},{key:"compose",value:function compose(t){return this.empty?t:t.empty?this:I(this,t,!0);}},{key:"map",value:function map(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return t.empty?this:E(this,t,e,!0);}},{key:"iterChanges",value:function iterChanges(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;O(this,t,e);}},{key:"desc",get:function get(){return S.create(this.sections);}},{key:"filter",value:function filter(t){var e=[],i=[],s=[],r=new R(this);t:for(var _n17=0,_h12=0;;){var _l11=_n17==t.length?1e9:t[_n17++];for(;_h12<_l11||_h12==_l11&&0==r.len;){if(r.done)break t;var _t19=Math.min(r.len,_l11-_h12);C(s,_t19,-1);var _n18=-1==r.ins?-1:0==r.off?r.ins:0;C(e,_t19,_n18),_n18>0&&D(i,e,r.text),r.forward(_t19),_h12+=_t19;}var _o7=t[_n17++];for(;_h12<_o7;){if(r.done)break t;var _t20=Math.min(r.len,_o7-_h12);C(e,_t20,-1),C(s,_t20,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(_t20),_h12+=_t20;}}return{changes:new A(e,i),filtered:S.create(s)};}},{key:"toJSON",value:function toJSON(){var t=[];for(var _e19=0;_e19<this.sections.length;_e19+=2){var _i15=this.sections[_e19],_s10=this.sections[_e19+1];_s10<0?t.push(_i15):0==_s10?t.push([_i15]):t.push([_i15].concat(this.inserted[_e19>>1].toJSON()));}return t;}}],[{key:"of",value:function of(e,i,s){var r=[],n=[],h=0,l=null;function o(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;if(!t&&!r.length)return;h<i&&C(r,i-h,-1);var e=new A(r,n);l=l?l.compose(e.map(l)):e,r=[],n=[],h=0;}return function e(u){if(Array.isArray(u)){var _iterator10=_createForOfIteratorHelper(u),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var _t21=_step10.value;e(_t21);}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}else if(u instanceof A){if(u.length!=i)throw new RangeError("Mismatched change set length (got ".concat(u.length,", expected ").concat(i,")"));o(),l=l?l.compose(u.map(l)):u;}else{var _e20=u.from,_u$to=u.to,_l12=_u$to===void 0?_e20:_u$to,_f2=u.insert;if(_e20>_l12||_e20<0||_l12>i)throw new RangeError("Invalid change range ".concat(_e20," to ").concat(_l12," (in doc of length ").concat(i,")"));var _a2=_f2?"string"==typeof _f2?t.of(_f2.split(s||M)):_f2:t.empty,_c2=_a2.length;if(_e20==_l12&&0==_c2)return;_e20<h&&o(),_e20>h&&C(r,_e20-h,-1),C(r,_l12-_e20,_c2),D(n,r,_a2),h=_l12;}}(e),o(!l),l;}},{key:"empty",value:function empty(t){return new A(t?[t,-1]:[],[]);}},{key:"fromJSON",value:function fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");var i=[],s=[];for(var _r15=0;_r15<e.length;_r15++){var _n19=e[_r15];if("number"==typeof _n19)i.push(_n19,-1);else{if(!Array.isArray(_n19)||"number"!=typeof _n19[0]||_n19.some(function(t,e){return e&&"string"!=typeof t;}))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==_n19.length)i.push(_n19[0],0);else{for(;s.length<_r15;)s.push(t.empty);s[_r15]=t.of(_n19.slice(1)),i.push(_n19[0],s[_r15].length);}}}return new A(i,s);}},{key:"createSet",value:function createSet(t,e){return new A(t,e);}}]);}(S);R=/*#__PURE__*/function(){function R(t){_classCallCheck(this,R);this.set=t,this.i=0,this.next();}return _createClass(R,[{key:"next",value:function next(){var t=this.set.sections;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0;}},{key:"done",get:function get(){return-2==this.ins;}},{key:"len2",get:function get(){return this.ins<0?this.len:this.ins;}},{key:"text",get:function get(){var e=this.set.inserted,i=this.i-2>>1;return i>=e.length?t.empty:e[i];}},{key:"textBit",value:function textBit(e){var i=this.set.inserted,s=this.i-2>>1;return s>=i.length&&!e?t.empty:i[s].slice(this.off,null==e?void 0:this.off+e);}},{key:"forward",value:function forward(t){t==this.len?this.next():(this.len-=t,this.off+=t);}},{key:"forward2",value:function forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t);}}]);}();T=/*#__PURE__*/function(){function T(t,e,i){_classCallCheck(this,T);this.from=t,this.to=e,this.flags=i;}return _createClass(T,[{key:"anchor",get:function get(){return 32&this.flags?this.to:this.from;}},{key:"head",get:function get(){return 32&this.flags?this.from:this.to;}},{key:"empty",get:function get(){return this.from==this.to;}},{key:"assoc",get:function get(){return 8&this.flags?-1:16&this.flags?1:0;}},{key:"bidiLevel",get:function get(){var t=7&this.flags;return 7==t?null:t;}},{key:"goalColumn",get:function get(){var t=this.flags>>6;return 16777215==t?void 0:t;}},{key:"map",value:function map(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;var i,s;return this.empty?i=s=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),s=t.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new T(i,s,this.flags);}},{key:"extend",value:function extend(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(t<=this.anchor&&e>=this.anchor)return B.range(t,e);var i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return B.range(this.anchor,i);}},{key:"eq",value:function eq(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return!(this.anchor!=t.anchor||this.head!=t.head||e&&this.empty&&this.assoc!=t.assoc);}},{key:"toJSON",value:function toJSON(){return{anchor:this.anchor,head:this.head};}}],[{key:"fromJSON",value:function fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return B.range(t.anchor,t.head);}},{key:"create",value:function create(t,e,i){return new T(t,e,i);}}]);}();_export("m",B=/*#__PURE__*/function(){function B(t,e){_classCallCheck(this,B);this.ranges=t,this.mainIndex=e;}return _createClass(B,[{key:"map",value:function map(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;return t.empty?this:B.create(this.ranges.map(function(i){return i.map(t,e);}),this.mainIndex);}},{key:"eq",value:function eq(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(var _i20=0;_i20<this.ranges.length;_i20++)if(!this.ranges[_i20].eq(t.ranges[_i20],e))return!1;return!0;}},{key:"main",get:function get(){return this.ranges[this.mainIndex];}},{key:"asSingle",value:function asSingle(){return 1==this.ranges.length?this:new B([this.main],0);}},{key:"addRange",value:function addRange(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;return B.create([t].concat(this.ranges),e?0:this.mainIndex+1);}},{key:"replaceRange",value:function replaceRange(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.mainIndex;var i=this.ranges.slice();return i[e]=t,B.create(i,this.mainIndex);}},{key:"toJSON",value:function toJSON(){return{ranges:this.ranges.map(function(t){return t.toJSON();}),main:this.mainIndex};}}],[{key:"fromJSON",value:function fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new B(t.ranges.map(function(t){return T.fromJSON(t);}),t.main);}},{key:"single",value:function single(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;return new B([B.range(t,e)],0);}},{key:"create",value:function create(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(0==t.length)throw new RangeError("A selection needs at least one range");for(var _i21=0,_s11=0;_s11<t.length;_s11++){var _r16=t[_s11];if(_r16.empty?_r16.from<=_i21:_r16.from<_i21)return B.normalized(t.slice(),e);_i21=_r16.to;}return new B(t,e);}},{key:"cursor",value:function cursor(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2?arguments[2]:undefined;var s=arguments.length>3?arguments[3]:undefined;return T.create(t,t,(0==e?0:e<0?8:16)|(null==i?7:Math.min(6,i))|(null!=s?s:16777215)<<6);}},{key:"range",value:function range(t,e,i,s){var r=(null!=i?i:16777215)<<6|(null==s?7:Math.min(6,s));return e<t?T.create(e,t,48|r):T.create(t,e,(e>t?8:0)|r);}},{key:"normalized",value:function normalized(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=t[e];t.sort(function(t,e){return t.from-e.from;}),e=t.indexOf(i);for(var _i22=1;_i22<t.length;_i22++){var _s12=t[_i22],_r17=t[_i22-1];if(_s12.empty?_s12.from<=_r17.to:_s12.from<_r17.to){var _n21=_r17.from,_h14=Math.max(_s12.to,_r17.to);_i22<=e&&e--,t.splice(--_i22,2,_s12.anchor>_s12.head?B.range(_h14,_n21):B.range(_n21,_h14));}}return new B(t,e);}}]);}());N=0;$=/*#__PURE__*/function(){function $(t,e,i,s,r){_classCallCheck(this,$);this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=s,this.id=N++,this["default"]=t([]),this.extensions="function"==typeof r?r(this):r;}return _createClass($,[{key:"reader",get:function get(){return this;}},{key:"of",value:function of(t){return new z([],this,0,t);}},{key:"compute",value:function compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new z(t,this,1,e);}},{key:"computeN",value:function computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new z(t,this,2,e);}},{key:"from",value:function from(t,e){return e||(e=function e(t){return t;}),this.compute([t],function(i){return e(i.field(t));});}}],[{key:"define",value:function define(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new $(t.combine||function(t){return t;},t.compareInput||function(t,e){return t===e;},t.compare||(t.combine?function(t,e){return t===e;}:j),!!t["static"],t.enables);}}]);}();z=/*#__PURE__*/function(){function z(t,e,i,s){_classCallCheck(this,z);this.dependencies=t,this.facet=e,this.type=i,this.value=s,this.id=N++;}return _createClass(z,[{key:"dynamicSlot",value:function dynamicSlot(t){var _this4=this;var e;var i=this.value,s=this.facet.compareInput,r=this.id,n=t[r]>>1,h=2==this.type,l=!1,o=!1,u=[];var _iterator12=_createForOfIteratorHelper(this.dependencies),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var _i24=_step12.value;"doc"==_i24?l=!0:"selection"==_i24?o=!0:1&(null!==(e=t[_i24.id])&&void 0!==e?e:1)||u.push(t[_i24.id]);}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}return{create:function create(t){return t.values[n]=i(t),1;},update:function update(t,e){if(l&&e.docChanged||o&&(e.docChanged||e.selection)||H(t,u)){var _e24=i(t);if(h?!P(_e24,t.values[n],s):!s(_e24,t.values[n]))return t.values[n]=_e24,1;}return 0;},reconfigure:function reconfigure(t,e){var l,o=e.config.address[r];if(null!=o){var _r18=et(e,o);if(_this4.dependencies.every(function(i){return i instanceof $?e.facet(i)===t.facet(i):!(i instanceof F)||e.field(i,!1)==t.field(i,!1);})||(h?P(l=i(t),_r18,s):s(l=i(t),_r18)))return t.values[n]=_r18,0;}else l=i(t);return t.values[n]=l,1;}};}}]);}();V=$.define({"static":!0});F=/*#__PURE__*/function(){function F(t,e,i,s,r){_classCallCheck(this,F);this.id=t,this.createF=e,this.updateF=i,this.compareF=s,this.spec=r,this.provides=void 0;}return _createClass(F,[{key:"create",value:function create(t){var _this5=this;var e=t.facet(V).find(function(t){return t.field==_this5;});return((null==e?void 0:e.create)||this.createF)(t);}},{key:"slot",value:function slot(t){var _this6=this;var e=t[this.id]>>1;return{create:function create(t){return t.values[e]=_this6.create(t),1;},update:function update(t,i){var s=t.values[e],r=_this6.updateF(s,i);return _this6.compareF(s,r)?0:(t.values[e]=r,1);},reconfigure:function reconfigure(t,i){return null!=i.config.address[_this6.id]?(t.values[e]=i.field(_this6),0):(t.values[e]=_this6.create(t),1);}};}},{key:"init",value:function init(t){return[this,V.of({field:this,create:t})];}},{key:"extension",get:function get(){return this;}}],[{key:"define",value:function define(t){var e=new F(N++,t.create,t.update,t.compare||function(t,e){return t===e;},t);return t.provide&&(e.provides=t.provide(e)),e;}}]);}();q=4;U=3;J=2;G=1;_={highest:K(0),high:K(G),"default":K(J),low:K(U),lowest:K(q)};X=/*#__PURE__*/_createClass(function X(t,e){_classCallCheck(this,X);this.inner=t,this.prec=e;});_export("C",Y=/*#__PURE__*/function(){function Y(){_classCallCheck(this,Y);}return _createClass(Y,[{key:"of",value:function of(t){return new Q(this,t);}},{key:"reconfigure",value:function reconfigure(t){return Y.reconfigure.of({compartment:this,extension:t});}},{key:"get",value:function get(t){return t.config.compartments.get(this);}}]);}());Q=/*#__PURE__*/_createClass(function Q(t,e){_classCallCheck(this,Q);this.compartment=t,this.inner=e;});Z=/*#__PURE__*/function(){function Z(t,e,i,s,r,n){_classCallCheck(this,Z);for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=n,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0);}return _createClass(Z,[{key:"staticFacet",value:function staticFacet(t){var e=this.address[t.id];return null==e?t["default"]:this.staticValues[e>>1];}}],[{key:"resolve",value:function resolve(t,e,i){var s=[],r=Object.create(null),n=new Map();var _iterator16=_createForOfIteratorHelper(function(t,e,i){var s=[[],[],[],[],[]],r=new Map();function n(t,h){var l=r.get(t);if(null!=l){if(l<=h)return;var _e27=s[l].indexOf(t);_e27>-1&&s[l].splice(_e27,1),t instanceof Q&&i["delete"](t.compartment);}if(r.set(t,h),Array.isArray(t)){var _iterator17=_createForOfIteratorHelper(t),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var _e28=_step17.value;n(_e28,h);}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}}else if(t instanceof Q){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");var _s16=e.get(t.compartment)||t.inner;i.set(t.compartment,_s16),n(_s16,h);}else if(t instanceof X)n(t.inner,t.prec);else if(t instanceof F)s[h].push(t),t.provides&&n(t.provides,h);else if(t instanceof z)s[h].push(t),t.facet.extensions&&n(t.facet.extensions,J);else{var _e29=t.extension;if(!_e29)throw new Error("Unrecognized extension value in extension set (".concat(t,"). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks."));n(_e29,h);}}return n(t,J),s.reduce(function(t,e){return t.concat(e);});}(t,e,n)),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var _i26=_step16.value;_i26 instanceof F?s.push(_i26):(r[_i26.facet.id]||(r[_i26.facet.id]=[])).push(_i26);}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}var h=Object.create(null),l=[],o=[];var _loop=function _loop(){var t=_s15[_i25];h[t.id]=o.length<<1,o.push(function(e){return t.slot(e);});};for(var _i25=0,_s15=s;_i25<_s15.length;_i25++){_loop();}var u=null==i?void 0:i.config.facets;var _loop2=function _loop2(){var e=r[_t27],s=e[0].facet,n=u&&u[_t27]||[];if(e.every(function(t){return 0==t.type;})){if(h[s.id]=l.length<<1|1,j(n,e))l.push(i.facet(s));else{var _t28=s.combine(e.map(function(t){return t.value;}));l.push(i&&s.compare(_t28,i.facet(s))?i.facet(s):_t28);}}else{var _iterator18=_createForOfIteratorHelper(e),_step18;try{var _loop3=function _loop3(){var t=_step18.value;0==t.type?(h[t.id]=l.length<<1|1,l.push(t.value)):(h[t.id]=o.length<<1,o.push(function(e){return t.dynamicSlot(e);}));};for(_iterator18.s();!(_step18=_iterator18.n()).done;){_loop3();}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}h[s.id]=o.length<<1,o.push(function(t){return W(t,s,e);});}};for(var _t27 in r){_loop2();}var f=o.map(function(t){return t(h);});return new Z(t,n,f,h,l,r);}}]);}();it=$.define();st=$.define({combine:function combine(t){return t.some(function(t){return t;});},"static":!0});rt=$.define({combine:function combine(t){return t.length?t[0]:void 0;},"static":!0});nt=$.define();ht=$.define();lt=$.define();ot=$.define({combine:function combine(t){return!!t.length&&t[0];}});ut=/*#__PURE__*/function(){function ut(t,e){_classCallCheck(this,ut);this.type=t,this.value=e;}return _createClass(ut,null,[{key:"define",value:function define(){return new ft();}}]);}();ft=/*#__PURE__*/function(){function ft(){_classCallCheck(this,ft);}return _createClass(ft,[{key:"of",value:function of(t){return new ut(this,t);}}]);}();at=/*#__PURE__*/function(){function at(t){_classCallCheck(this,at);this.map=t;}return _createClass(at,[{key:"of",value:function of(t){return new ct(this,t);}}]);}();ct=/*#__PURE__*/function(){function ct(t,e){_classCallCheck(this,ct);this.type=t,this.value=e;}return _createClass(ct,[{key:"map",value:function map(t){var e=this.type.map(this.value,t);return void 0===e?void 0:e==this.value?this:new ct(this.type,e);}},{key:"is",value:function is(t){return this.type==t;}}],[{key:"define",value:function define(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new at(t.map||function(t){return t;});}},{key:"mapEffects",value:function mapEffects(t,e){if(!t.length)return t;var i=[];var _iterator19=_createForOfIteratorHelper(t),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var _s17=_step19.value;var _t29=_s17.map(e);_t29&&i.push(_t29);}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}return i;}}]);}();ct.reconfigure=ct.define(),ct.appendConfig=ct.define();dt=/*#__PURE__*/function(){function dt(t,e,i,s,r,n){_classCallCheck(this,dt);this.startState=t,this.changes=e,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=n,this._doc=null,this._state=null,i&&L(i,e.newLength),r.some(function(t){return t.type==dt.time;})||(this.annotations=r.concat(dt.time.of(Date.now())));}return _createClass(dt,[{key:"newDoc",get:function get(){return this._doc||(this._doc=this.changes.apply(this.startState.doc));}},{key:"newSelection",get:function get(){return this.selection||this.startState.selection.map(this.changes);}},{key:"state",get:function get(){return this._state||this.startState.applyTransaction(this),this._state;}},{key:"annotation",value:function annotation(t){var _iterator20=_createForOfIteratorHelper(this.annotations),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var _e30=_step20.value;if(_e30.type==t)return _e30.value;}}catch(err){_iterator20.e(err);}finally{_iterator20.f();}}},{key:"docChanged",get:function get(){return!this.changes.empty;}},{key:"reconfigured",get:function get(){return this.startState.config!=this.state.config;}},{key:"isUserEvent",value:function isUserEvent(t){var e=this.annotation(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]));}}],[{key:"create",value:function create(t,e,i,s,r,n){return new dt(t,e,i,s,r,n);}}]);}();dt.time=ut.define(),dt.userEvent=ut.define(),dt.addToHistory=ut.define(),dt.remote=ut.define();bt=[];kt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t;}(kt||(kt={}));yt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{Mt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u");}catch(t){}_export("r",St=/*#__PURE__*/function(){function St(t,e,i,s,r,n){_classCallCheck(this,St);this.config=t,this.doc=e,this.selection=i,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=r,n&&(n._state=this);for(var _t30=0;_t30<this.config.dynamicSlots.length;_t30++)tt(this,_t30<<1);this.computeSlot=null;}return _createClass(St,[{key:"field",value:function field(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var i=this.config.address[t.id];if(null!=i)return tt(this,i),et(this,i);if(e)throw new RangeError("Field is not present in this state");}},{key:"update",value:function update(){for(var _len=arguments.length,t=new Array(_len),_key=0;_key<_len;_key++){t[_key]=arguments[_key];}return wt(this,t,!0);}},{key:"applyTransaction",value:function applyTransaction(t){var _this7=this;var e,i=this.config,_i30=i,s=_i30.base,r=_i30.compartments;var _iterator22=_createForOfIteratorHelper(t.effects),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var _e34=_step22.value;_e34.is(Y.reconfigure)?(i&&(r=new Map(),i.compartments.forEach(function(t,e){return r.set(e,t);}),i=null),r.set(_e34.value.compartment,_e34.value.extension)):_e34.is(ct.reconfigure)?(i=null,s=_e34.value):_e34.is(ct.appendConfig)&&(i=null,s=vt(s).concat(_e34.value));}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}if(i)e=t.startState.values.slice();else{i=Z.resolve(s,r,this),e=new St(i,this.doc,this.selection,i.dynamicSlots.map(function(){return null;}),function(t,e){return e.reconfigure(t,_this7);},null).values;}var n=t.startState.facet(st)?t.newSelection:t.newSelection.asSingle();new St(i,t.newDoc,n,e,function(e,i){return i.update(e,t);},t);}},{key:"replaceSelection",value:function replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange(function(e){return{changes:{from:e.from,to:e.to,insert:t},range:B.cursor(e.from+t.length)};});}},{key:"changeByRange",value:function changeByRange(t){var e=this.selection,i=t(e.ranges[0]),s=this.changes(i.changes),r=[i.range],n=vt(i.effects);for(var _i31=1;_i31<e.ranges.length;_i31++){var _h16=t(e.ranges[_i31]),_l14=this.changes(_h16.changes),_o9=_l14.map(s);for(var _t31=0;_t31<_i31;_t31++)r[_t31]=r[_t31].map(_o9);var _u16=s.mapDesc(_l14,!0);r.push(_h16.range.map(_u16)),s=s.compose(_o9),n=ct.mapEffects(n,_o9).concat(ct.mapEffects(vt(_h16.effects),_u16));}return{changes:s,selection:B.create(r,e.mainIndex),effects:n};}},{key:"changes",value:function changes(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];return t instanceof A?t:A.of(t,this.doc.length,this.facet(St.lineSeparator));}},{key:"toText",value:function toText(e){return t.of(e.split(this.facet(St.lineSeparator)||M));}},{key:"sliceDoc",value:function sliceDoc(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.doc.length;return this.doc.sliceString(t,e,this.lineBreak);}},{key:"facet",value:function facet(t){var e=this.config.address[t.id];return null==e?t["default"]:(tt(this,e),et(this,e));}},{key:"toJSON",value:function toJSON(t){var e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(var _i32 in t){var _s21=t[_i32];_s21 instanceof F&&null!=this.config.address[_s21.id]&&(e[_i32]=_s21.spec.toJSON(this.field(t[_i32]),this));}return e;}},{key:"tabSize",get:function get(){return this.facet(St.tabSize);}},{key:"lineBreak",get:function get(){return this.facet(St.lineSeparator)||"\n";}},{key:"readOnly",get:function get(){return this.facet(ot);}},{key:"phrase",value:function phrase(t){for(var _len2=arguments.length,e=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){e[_key2-1]=arguments[_key2];}var _iterator23=_createForOfIteratorHelper(this.facet(St.phrases)),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var _e35=_step23.value;if(Object.prototype.hasOwnProperty.call(_e35,t)){t=_e35[t];break;}}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}return e.length&&(t=t.replace(/\$(\$|\d*)/g,function(t,i){if("$"==i)return"$";var s=+(i||1);return!s||s>e.length?t:e[s-1];})),t;}},{key:"languageDataAt",value:function languageDataAt(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;var s=[];var _iterator24=_createForOfIteratorHelper(this.facet(it)),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var _r24=_step24.value;var _iterator25=_createForOfIteratorHelper(_r24(this,e,i)),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _n26=_step25.value;Object.prototype.hasOwnProperty.call(_n26,t)&&s.push(_n26[t]);}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}return s;}},{key:"charCategorizer",value:function charCategorizer(t){return xt(this.languageDataAt("wordChars",t).join(""));}},{key:"wordAt",value:function wordAt(t){var _this$doc$lineAt=this.doc.lineAt(t),e=_this$doc$lineAt.text,i=_this$doc$lineAt.from,s=_this$doc$lineAt.length,r=this.charCategorizer(t),n=t-i,h=t-i;for(;n>0;){var _t32=p(e,n,!1);if(r(e.slice(_t32,n))!=kt.Word)break;n=_t32;}for(;h<s;){var _t33=p(e,h);if(r(e.slice(h,_t33))!=kt.Word)break;h=_t33;}return n==h?null:B.range(n+i,h+i);}}],[{key:"fromJSON",value:function fromJSON(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var i=arguments.length>2?arguments[2]:undefined;if(!t||"string"!=typeof t.doc)throw new RangeError("Invalid JSON representation for EditorState");var s=[];if(i){var _loop4=function _loop4(){if(Object.prototype.hasOwnProperty.call(t,_e36)){var _r25=i[_e36],_n27=t[_e36];s.push(_r25.init(function(t){return _r25.spec.fromJSON(_n27,t);}));}};for(var _e36 in i){_loop4();}}return St.create({doc:t.doc,selection:B.fromJSON(t.selection),extensions:e.extensions?s.concat([e.extensions]):s});}},{key:"create",value:function create(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var i=Z.resolve(e.extensions||[],new Map()),s=e.doc instanceof t?e.doc:t.of((e.doc||"").split(i.staticFacet(St.lineSeparator)||M)),r=e.selection?e.selection instanceof B?e.selection:B.single(e.selection.anchor,e.selection.head):B.single(0);return L(r,s.length),i.staticFacet(st)||(r=r.asSingle()),new St(i,s,r,i.dynamicSlots.map(function(){return null;}),function(t,e){return e.create(t);},null);}}]);}());St.allowMultipleSelections=st,St.tabSize=$.define({combine:function combine(t){return t.length?t[0]:4;}}),St.lineSeparator=rt,St.readOnly=ot,St.phrases=$.define({compare:function compare(t,e){var i=Object.keys(t),s=Object.keys(e);return i.length==s.length&&i.every(function(i){return t[i]==e[i];});}}),St.languageData=it,St.changeFilter=nt,St.transactionFilter=ht,St.transactionExtender=lt,Y.reconfigure=ct.define();Ct=/*#__PURE__*/function(){function Ct(){_classCallCheck(this,Ct);}return _createClass(Ct,[{key:"eq",value:function eq(t){return this==t;}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;return Dt.create(t,e,this);}}]);}();Ct.prototype.startSide=Ct.prototype.endSide=0,Ct.prototype.point=!1,Ct.prototype.mapMode=x.TrackDel;Dt=/*#__PURE__*/function(){function t(_t36,e,i){_classCallCheck(this,t);this.from=_t36,this.to=e,this.value=i;}return _createClass(t,null,[{key:"create",value:function create(e,i,s){return new t(e,i,s);}}]);}();Et=/*#__PURE__*/function(){function Et(t,e,i,s){_classCallCheck(this,Et);this.from=t,this.to=e,this.value=i,this.maxPoint=s;}return _createClass(Et,[{key:"length",get:function get(){return this.to[this.to.length-1];}},{key:"findIndex",value:function findIndex(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=i?this.to:this.from;for(var _n29=s,_h17=r.length;;){if(_n29==_h17)return _n29;var _s22=_n29+_h17>>1,_l15=r[_s22]-t||(i?this.value[_s22].endSide:this.value[_s22].startSide)-e;if(_s22==_n29)return _l15>=0?_n29:_h17;_l15>=0?_h17=_s22:_n29=_s22+1;}}},{key:"between",value:function between(t,e,i,s){for(var _r27=this.findIndex(e,-1e9,!0),_n30=this.findIndex(i,1e9,!1,_r27);_r27<_n30;_r27++)if(!1===s(this.from[_r27]+t,this.to[_r27]+t,this.value[_r27]))return!1;}},{key:"map",value:function map(t,e){var i=[],s=[],r=[],n=-1,h=-1;for(var _l16=0;_l16<this.value.length;_l16++){var _o10=void 0,_u17=void 0,_f4=this.value[_l16],_a4=this.from[_l16]+t,_c4=this.to[_l16]+t;if(_a4==_c4){var _t37=e.mapPos(_a4,_f4.startSide,_f4.mapMode);if(null==_t37)continue;if(_o10=_u17=_t37,_f4.startSide!=_f4.endSide&&(_u17=e.mapPos(_a4,_f4.endSide),_u17<_o10))continue;}else if(_o10=e.mapPos(_a4,_f4.startSide),_u17=e.mapPos(_c4,_f4.endSide),_o10>_u17||_o10==_u17&&_f4.startSide>0&&_f4.endSide<=0)continue;(_u17-_o10||_f4.endSide-_f4.startSide)<0||(n<0&&(n=_o10),_f4.point&&(h=Math.max(h,_u17-_o10)),i.push(_f4),s.push(_o10-n),r.push(_u17-n));}return{mapped:i.length?new Et(s,r,i,h):null,pos:n};}}]);}();It=/*#__PURE__*/function(){function It(t,e,i,s){_classCallCheck(this,It);this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=s;}return _createClass(It,[{key:"length",get:function get(){var t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length);}},{key:"size",get:function get(){if(this.isEmpty)return 0;var t=this.nextLayer.size;var _iterator27=_createForOfIteratorHelper(this.chunk),_step27;try{for(_iterator27.s();!(_step27=_iterator27.n()).done;){var _e38=_step27.value;t+=_e38.value.length;}}catch(err){_iterator27.e(err);}finally{_iterator27.f();}return t;}},{key:"chunkEnd",value:function chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length;}},{key:"update",value:function update(t){var _t$add=t.add,e=_t$add===void 0?[]:_t$add,_t$sort=t.sort,i=_t$sort===void 0?!1:_t$sort,_t$filterFrom=t.filterFrom,s=_t$filterFrom===void 0?0:_t$filterFrom,_t$filterTo=t.filterTo,r=_t$filterTo===void 0?this.length:_t$filterTo,n=t.filter;if(0==e.length&&!n)return this;if(i&&(e=e.slice().sort(Ot)),this.isEmpty)return e.length?It.of(e):this;var h=new Bt(this,null,-1)["goto"](0),l=0,o=[],u=new Rt();for(;h.value||l<e.length;)if(l<e.length&&(h.from-e[l].from||h.startSide-e[l].value.startSide)>=0){var _t38=e[l++];u.addInner(_t38.from,_t38.to,_t38.value)||o.push(_t38);}else 1==h.rangeIndex&&h.chunkIndex<this.chunk.length&&(l==e.length||this.chunkEnd(h.chunkIndex)<e[l].from)&&(!n||s>this.chunkEnd(h.chunkIndex)||r<this.chunkPos[h.chunkIndex])&&u.addChunk(this.chunkPos[h.chunkIndex],this.chunk[h.chunkIndex])?h.nextChunk():((!n||s>h.to||r<h.from||n(h.from,h.to,h.value))&&(u.addInner(h.from,h.to,h.value)||o.push(Dt.create(h.from,h.to,h.value))),h.next());return u.finishInner(this.nextLayer.isEmpty&&!o.length?It.empty:this.nextLayer.update({add:o,filter:n,filterFrom:s,filterTo:r}));}},{key:"map",value:function map(t){if(t.empty||this.isEmpty)return this;var e=[],i=[],s=-1;for(var _r28=0;_r28<this.chunk.length;_r28++){var _n31=this.chunkPos[_r28],_h18=this.chunk[_r28],_l17=t.touchesRange(_n31,_n31+_h18.length);if(!1===_l17)s=Math.max(s,_h18.maxPoint),e.push(_h18),i.push(t.mapPos(_n31));else if(!0===_l17){var _h18$map=_h18.map(_n31,t),_r29=_h18$map.mapped,_l18=_h18$map.pos;_r29&&(s=Math.max(s,_r29.maxPoint),e.push(_r29),i.push(_l18));}}var r=this.nextLayer.map(t);return 0==e.length?r:new It(i,e,r||It.empty,s);}},{key:"between",value:function between(t,e,i){if(!this.isEmpty){for(var _s23=0;_s23<this.chunk.length;_s23++){var _r30=this.chunkPos[_s23],_n32=this.chunk[_s23];if(e>=_r30&&t<=_r30+_n32.length&&!1===_n32.between(_r30,t-_r30,e-_r30,i))return;}this.nextLayer.between(t,e,i);}}},{key:"iter",value:function iter(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return Lt.from([this])["goto"](t);}},{key:"isEmpty",get:function get(){return this.nextLayer==this;}}],[{key:"create",value:function create(t,e,i,s){return new It(t,e,i,s);}},{key:"iter",value:function iter(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Lt.from(t)["goto"](e);}},{key:"compare",value:function compare(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:-1;var n=t.filter(function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r;}),h=e.filter(function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r;}),l=Tt(n,h,i),o=new $t(n,l,r),u=new $t(h,l,r);i.iterGaps(function(t,e,i){return jt(o,t,u,e,i,s);}),i.empty&&0==i.length&&jt(o,0,u,0,0,s);}},{key:"eq",value:function eq(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3?arguments[3]:undefined;null==s&&(s=999999999);var r=t.filter(function(t){return!t.isEmpty&&e.indexOf(t)<0;}),n=e.filter(function(e){return!e.isEmpty&&t.indexOf(e)<0;});if(r.length!=n.length)return!1;if(!r.length)return!0;var h=Tt(r,n),l=new $t(r,h,0)["goto"](i),o=new $t(n,h,0)["goto"](i);for(;;){if(l.to!=o.to||!zt(l.active,o.active)||l.point&&(!o.point||!l.point.eq(o.point)))return!1;if(l.to>s)return!0;l.next(),o.next();}}},{key:"spans",value:function spans(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:-1;var n=new $t(t,null,r)["goto"](e),h=e,l=n.openStart;for(;;){var _t39=Math.min(n.to,i);if(n.point){var _i34=n.activeForPoint(n.to),_r31=n.pointFrom<e?_i34.length+1:n.point.startSide<0?_i34.length:Math.min(_i34.length,l);s.point(h,_t39,n.point,_i34,_r31,n.pointRank),l=Math.min(n.openEnd(_t39),_i34.length);}else _t39>h&&(s.span(h,_t39,n.active,l),l=n.openEnd(_t39));if(n.to>i)return l+(n.point&&n.to>i?1:0);h=n.to,n.next();}}},{key:"of",value:function of(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;var i=new Rt();var _iterator28=_createForOfIteratorHelper(t instanceof Dt?[t]:e?function(t){if(t.length>1)for(var _e39=t[0],_i35=1;_i35<t.length;_i35++){var _s24=t[_i35];if(Ot(_e39,_s24)>0)return t.slice().sort(Ot);_e39=_s24;}return t;}(t):t),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var _s25=_step28.value;i.add(_s25.from,_s25.to,_s25.value);}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}return i.finish();}},{key:"join",value:function join(t){if(!t.length)return It.empty;var e=t[t.length-1];for(var _i36=t.length-2;_i36>=0;_i36--)for(var _s26=t[_i36];_s26!=It.empty;_s26=_s26.nextLayer)e=new It(_s26.chunkPos,_s26.chunk,e,Math.max(_s26.maxPoint,e.maxPoint));return e;}}]);}();It.empty=new It([],[],null,-1),It.empty.nextLayer=It.empty;Rt=/*#__PURE__*/function(){function Rt(){_classCallCheck(this,Rt);this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null;}return _createClass(Rt,[{key:"finishChunk",value:function finishChunk(t){this.chunks.push(new Et(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[]);}},{key:"add",value:function add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Rt())).add(t,e,i);}},{key:"addInner",value:function addInner(t,e,i){var s=t-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(s<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0);}},{key:"addChunk",value:function addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);var i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0;}},{key:"finish",value:function finish(){return this.finishInner(It.empty);}},{key:"finishInner",value:function finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;var e=It.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e;}}]);}();Bt=/*#__PURE__*/function(){function Bt(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;_classCallCheck(this,Bt);this.layer=t,this.skip=e,this.minPoint=i,this.rank=s;}return _createClass(Bt,[{key:"startSide",get:function get(){return this.value?this.value.startSide:0;}},{key:"endSide",get:function get(){return this.value?this.value.endSide:0;}},{key:"goto",value:function goto(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this;}},{key:"gotoInner",value:function gotoInner(t,e,i){for(;this.chunkIndex<this.layer.chunk.length;){var _e42=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(_e42)||this.layer.chunkEnd(this.chunkIndex)<t||_e42.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1;}if(this.chunkIndex<this.layer.chunk.length){var _s27=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!i||this.rangeIndex<_s27)&&this.setRangeIndex(_s27);}this.next();}},{key:"forward",value:function forward(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0);}},{key:"next",value:function next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break;}{var _t42=this.layer.chunkPos[this.chunkIndex],_e43=this.layer.chunk[this.chunkIndex],_i37=_t42+_e43.from[this.rangeIndex];if(this.from=_i37,this.to=_t42+_e43.to[this.rangeIndex],this.value=_e43.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break;}}}},{key:"setRangeIndex",value:function setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0;}else this.rangeIndex=t;}},{key:"nextChunk",value:function nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next();}},{key:"compare",value:function compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide;}}]);}();Lt=/*#__PURE__*/function(){function Lt(t){_classCallCheck(this,Lt);this.heap=t;}return _createClass(Lt,[{key:"startSide",get:function get(){return this.value?this.value.startSide:0;}},{key:"goto",value:function goto(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1e9;var _iterator31=_createForOfIteratorHelper(this.heap),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var _i38=_step31.value;_i38["goto"](t,e);}}catch(err){_iterator31.e(err);}finally{_iterator31.f();}for(var _t43=this.heap.length>>1;_t43>=0;_t43--)Nt(this.heap,_t43);return this.next(),this;}},{key:"forward",value:function forward(t,e){var _iterator32=_createForOfIteratorHelper(this.heap),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var _i39=_step32.value;_i39.forward(t,e);}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}for(var _t44=this.heap.length>>1;_t44>=0;_t44--)Nt(this.heap,_t44);(this.to-t||this.value.endSide-e)<0&&this.next();}},{key:"next",value:function next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var _t45=this.heap[0];this.from=_t45.from,this.to=_t45.to,this.value=_t45.value,this.rank=_t45.rank,_t45.value&&_t45.next(),Nt(this.heap,0);}}}],[{key:"from",value:function from(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;var s=[];for(var _r32=0;_r32<t.length;_r32++)for(var _n34=t[_r32];!_n34.isEmpty;_n34=_n34.nextLayer)_n34.maxPoint>=i&&s.push(new Bt(_n34,e,i,_r32));return 1==s.length?s[0]:new Lt(s);}}]);}();$t=/*#__PURE__*/function(){function $t(t,e,i){_classCallCheck(this,$t);this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Lt.from(t,e,i);}return _createClass($t,[{key:"goto",value:function goto(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1e9;return this.cursor["goto"](t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this;}},{key:"forward",value:function forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e);}},{key:"removeActive",value:function removeActive(t){Pt(this.active,t),Pt(this.activeTo,t),Pt(this.activeRank,t),this.minActive=Wt(this.active,this.activeTo);}},{key:"addActive",value:function addActive(t){var e=0,_this$cursor=this.cursor,i=_this$cursor.value,s=_this$cursor.to,r=_this$cursor.rank;for(;e<this.activeRank.length&&(r-this.activeRank[e]||s-this.activeTo[e])>0;)e++;Ht(this.active,e,i),Ht(this.activeTo,e,s),Ht(this.activeRank,e,r),t&&Ht(t,e,this.cursor.from),this.minActive=Wt(this.active,this.activeTo);}},{key:"next",value:function next(){var t=this.to,e=this.point;this.point=null;var i=this.openStart<0?[]:null;for(;;){var _s29=this.minActive;if(_s29>-1&&(this.activeTo[_s29]-this.cursor.from||this.active[_s29].endSide-this.cursor.startSide)<0){if(this.activeTo[_s29]>t){this.to=this.activeTo[_s29],this.endSide=this.active[_s29].endSide;break;}this.removeActive(_s29),i&&Pt(i,_s29);}else{if(!this.cursor.value){this.to=this.endSide=1e9;break;}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break;}{var _t46=this.cursor.value;if(_t46.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=_t46,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=_t46.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break;}this.cursor.next();}else this.addActive(i),this.cursor.next();}}}if(i){this.openStart=0;for(var _e44=i.length-1;_e44>=0&&i[_e44]<t;_e44--)this.openStart++;}}},{key:"activeForPoint",value:function activeForPoint(t){if(!this.active.length)return this.active;var e=[];for(var _i41=this.active.length-1;_i41>=0&&!(this.activeRank[_i41]<this.pointRank);_i41--)(this.activeTo[_i41]>t||this.activeTo[_i41]==t&&this.active[_i41].endSide>=this.point.endSide)&&e.push(this.active[_i41]);return e.reverse();}},{key:"openEnd",value:function openEnd(t){var e=0;for(var _i42=this.activeTo.length-1;_i42>=0&&this.activeTo[_i42]>t;_i42--)e++;return e;}}]);}();qt="undefined"==typeof Symbol?"__ͼ":Symbol["for"]("ͼ");Ut="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet");Jt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};Gt=/*#__PURE__*/function(){function Gt(t,e){_classCallCheck(this,Gt);this.rules=[];var _ref3=e||{},i=_ref3.finish;function s(t){return /^@/.test(t)?[t]:t.split(/,\s*/);}function r(t,e,n,h){var l=[],o=/^@(\w+)\b/.exec(t[0]),u=o&&"keyframes"==o[1];if(o&&null==e)return n.push(t[0]+";");for(var _i46 in e){var _h19=e[_i46];if(/&/.test(_i46))r(_i46.split(/,\s*/).map(function(e){return t.map(function(t){return e.replace(/&/,t);});}).reduce(function(t,e){return t.concat(e);}),_h19,n);else if(_h19&&"object"==_typeof(_h19)){if(!o)throw new RangeError("The value of a property ("+_i46+") should be a primitive value.");r(s(_i46),_h19,l,u);}else null!=_h19&&l.push(_i46.replace(/_.*/,"").replace(/[A-Z]/g,function(t){return"-"+t.toLowerCase();})+": "+_h19+";");}(l.length||u)&&n.push((!i||o||h?t:t.map(i)).join(", ")+" {"+l.join(" ")+"}");}for(var _e46 in t)r(s(_e46),t[_e46],this.rules);}return _createClass(Gt,[{key:"getRules",value:function getRules(){return this.rules.join("\n");}}],[{key:"newName",value:function newName(){var t=Jt[qt]||1;return Jt[qt]=t+1,"ͼ"+t.toString(36);}},{key:"mount",value:function mount(t,e,i){var s=t[Ut],r=i&&i.nonce;s?r&&s.setNonce(r):s=new _t(t,r),s.mount(Array.isArray(e)?e:[e],t);}}]);}();Kt=new Map();_t=/*#__PURE__*/function(){function _t(t,e){_classCallCheck(this,_t);var i=t.ownerDocument||t,s=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){var _e47=Kt.get(i);if(_e47)return t[Ut]=_e47;this.sheet=new s.CSSStyleSheet(),Kt.set(i,this);}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[Ut]=this;}return _createClass(_t,[{key:"mount",value:function mount(t,e){var i=this.sheet,s=0,r=0;for(var _e48=0;_e48<t.length;_e48++){var _n35=t[_e48],_h20=this.modules.indexOf(_n35);if(_h20<r&&_h20>-1&&(this.modules.splice(_h20,1),r--,_h20=-1),-1==_h20){if(this.modules.splice(r++,0,_n35),i)for(var _t47=0;_t47<_n35.rules.length;_t47++)i.insertRule(_n35.rules[_t47],s++);}else{for(;r<_h20;)s+=this.modules[r++].rules.length;s+=_n35.rules.length,r++;}}if(i)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet].concat(_toConsumableArray(e.adoptedStyleSheets)));else{var _t48="";for(var _e49=0;_e49<this.modules.length;_e49++)_t48+=this.modules[_e49].getRules()+"\n";this.styleTag.textContent=_t48;var _i47=e.head||e;this.styleTag.parentNode!=_i47&&_i47.insertBefore(this.styleTag,_i47.firstChild);}}},{key:"setNonce",value:function setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t);}}]);}();for(Xt={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:"'"},Yt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Qt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Zt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),te=0;te<10;te++)Xt[48+te]=Xt[96+te]=String(te);for(te=1;te<=24;te++)Xt[te+111]="F"+te;for(te=65;te<=90;te++)Xt[te]=String.fromCharCode(te+32),Yt[te]=String.fromCharCode(te);for(ee in Xt)Yt.hasOwnProperty(ee)||(Yt[ee]=Xt[ee]);pe=/*#__PURE__*/function(){function pe(){_classCallCheck(this,pe);this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0;}return _createClass(pe,[{key:"eq",value:function eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset;}},{key:"setRange",value:function setRange(t){var e=t.anchorNode,i=t.focusNode;this.set(e,Math.min(t.anchorOffset,e?fe(e):0),i,Math.min(t.focusOffset,i?fe(i):0));}},{key:"set",value:function set(t,e,i,s){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=s;}}]);}();ge=null;Se=/*#__PURE__*/function(){function Se(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;_classCallCheck(this,Se);this.node=t,this.offset=e,this.precise=i;}return _createClass(Se,null,[{key:"before",value:function before(t,e){return new Se(t.parentNode,le(t),e);}},{key:"after",value:function after(t,e){return new Se(t.parentNode,le(t)+1,e);}}]);}();Ae=[];Ce=/*#__PURE__*/function(){function Ce(){_classCallCheck(this,Ce);this.parent=null,this.dom=null,this.flags=2;}return _createClass(Ce,[{key:"overrideDOMText",get:function get(){return null;}},{key:"posAtStart",get:function get(){return this.parent?this.parent.posBefore(this):0;}},{key:"posAtEnd",get:function get(){return this.posAtStart+this.length;}},{key:"posBefore",value:function posBefore(t){var e=this.posAtStart;var _iterator33=_createForOfIteratorHelper(this.children),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var _i53=_step33.value;if(_i53==t)return e;e+=_i53.length+_i53.breakAfter;}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}throw new RangeError("Invalid child in posBefore");}},{key:"posAfter",value:function posAfter(t){return this.posBefore(t)+t.length;}},{key:"sync",value:function sync(t,e){if(2&this.flags){var _i54,_s37=this.dom,_r39=null;var _iterator34=_createForOfIteratorHelper(this.children),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _n36=_step34.value;if(7&_n36.flags){if(!_n36.dom&&(_i54=_r39?_r39.nextSibling:_s37.firstChild)){var _t50=Ce.get(_i54);(!_t50||!_t50.parent&&_t50.canReuseDOM(_n36))&&_n36.reuseDOM(_i54);}_n36.sync(t,e),_n36.flags&=-8;}if(_i54=_r39?_r39.nextSibling:_s37.firstChild,e&&!e.written&&e.node==_s37&&_i54!=_n36.dom&&(e.written=!0),_n36.dom.parentNode==_s37)for(;_i54&&_i54!=_n36.dom;)_i54=De(_i54);else _s37.insertBefore(_n36.dom,_i54);_r39=_n36.dom;}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}for(_i54=_r39?_r39.nextSibling:_s37.firstChild,_i54&&e&&e.node==_s37&&(e.written=!0);_i54;)_i54=De(_i54);}else if(1&this.flags){var _iterator35=_createForOfIteratorHelper(this.children),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _i55=_step35.value;7&_i55.flags&&(_i55.sync(t,e),_i55.flags&=-8);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}}}},{key:"reuseDOM",value:function reuseDOM(t){}},{key:"localPosFromDOM",value:function localPosFromDOM(t,e){var i;if(t==this.dom)i=this.dom.childNodes[e];else{var _s38=0==fe(t)?0:0==e?-1:1;for(;;){var _e50=t.parentNode;if(_e50==this.dom)break;0==_s38&&_e50.firstChild!=_e50.lastChild&&(_s38=t==_e50.firstChild?-1:1),t=_e50;}i=_s38<0?t:t.nextSibling;}if(i==this.dom.firstChild)return 0;for(;i&&!Ce.get(i);)i=i.nextSibling;if(!i)return this.length;for(var _t51=0,_e51=0;;_t51++){var _s39=this.children[_t51];if(_s39.dom==i)return _e51;_e51+=_s39.length+_s39.breakAfter;}}},{key:"domBoundsAround",value:function domBoundsAround(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=-1,r=-1,n=-1,h=-1;for(var _l19=0,_o11=i,_u18=i;_l19<this.children.length;_l19++){var _i56=this.children[_l19],_f5=_o11+_i56.length;if(_o11<t&&_f5>e)return _i56.domBoundsAround(t,e,_o11);if(_f5>=t&&-1==s&&(s=_l19,r=_o11),_o11>e&&_i56.dom.parentNode==this.dom){n=_l19,h=_u18;break;}_u18=_f5,_o11=_f5+_i56.breakAfter;}return{from:r,to:h<0?i+this.length:h,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:n<this.children.length&&n>=0?this.children[n].dom:null};}},{key:"markDirty",value:function markDirty(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;this.flags|=2,this.markParentsDirty(t);}},{key:"markParentsDirty",value:function markParentsDirty(t){for(var _e52=this.parent;_e52;_e52=_e52.parent){if(t&&(_e52.flags|=2),1&_e52.flags)return;_e52.flags|=1,t=!1;}}},{key:"setParent",value:function setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0));}},{key:"setDOM",value:function setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this);}},{key:"rootView",get:function get(){for(var _t52=this;;){var _e53=_t52.parent;if(!_e53)return _t52;_t52=_e53;}}},{key:"replaceChildren",value:function replaceChildren(t,e){var _this$children;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:Ae;this.markDirty();for(var _s40=t;_s40<e;_s40++){var _t53=this.children[_s40];_t53.parent==this&&i.indexOf(_t53)<0&&_t53.destroy();}(_this$children=this.children).splice.apply(_this$children,[t,e-t].concat(_toConsumableArray(i)));for(var _t54=0;_t54<i.length;_t54++)i[_t54].setParent(this);}},{key:"ignoreMutation",value:function ignoreMutation(t){return!1;}},{key:"ignoreEvent",value:function ignoreEvent(t){return!1;}},{key:"childCursor",value:function childCursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.length;return new Oe(this.children,t,this.children.length);}},{key:"childPos",value:function childPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;return this.childCursor().findPos(t,e);}},{key:"toString",value:function toString(){var t=this.constructor.name.replace("View","");return t+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==t?this.text:this.length)+"]":"")+(this.breakAfter?"#":"");}},{key:"isEditable",get:function get(){return!0;}},{key:"isWidget",get:function get(){return!1;}},{key:"isHidden",get:function get(){return!1;}},{key:"merge",value:function merge(t,e,i,s,r,n){return!1;}},{key:"become",value:function become(t){return!1;}},{key:"canReuseDOM",value:function canReuseDOM(t){return t.constructor==this.constructor&&!(8&(this.flags|t.flags));}},{key:"getSide",value:function getSide(){return 0;}},{key:"destroy",value:function destroy(){var _iterator36=_createForOfIteratorHelper(this.children),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _t55=_step36.value;_t55.parent==this&&_t55.destroy();}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}this.parent=null;}}],[{key:"get",value:function get(t){return t.cmView;}}]);}();Ce.prototype.breakAfter=0;Oe=/*#__PURE__*/function(){function Oe(t,e,i){_classCallCheck(this,Oe);this.children=t,this.pos=e,this.i=i,this.off=0;}return _createClass(Oe,[{key:"findPos",value:function findPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]: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;var _i57=this.children[--this.i];this.pos-=_i57.length+_i57.breakAfter;}}}]);}();Re="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""};Te="undefined"!=typeof document?document:{documentElement:{style:{}}};Be=/Edge\/(\d+)/.exec(Re.userAgent);Le=/MSIE \d/.test(Re.userAgent);Ne=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Re.userAgent);$e=!!(Le||Ne||Be);je=!$e&&/gecko\/(\d+)/i.test(Re.userAgent);ze=!$e&&/Chrome\/(\d+)/.exec(Re.userAgent);Pe="webkitFontSmoothing"in Te.documentElement.style;He=!$e&&/Apple Computer/.test(Re.vendor);We=He&&(/Mobile\/\w+/.test(Re.userAgent)||Re.maxTouchPoints>2);Ve={mac:We||/Mac/.test(Re.platform),windows:/Win/.test(Re.platform),linux:/Linux|X11/.test(Re.platform),ie:$e,ie_version:Le?Te.documentMode||6:Ne?+Ne[1]:Be?+Be[1]:0,gecko:je,gecko_version:je?+(/Firefox\/(\d+)/.exec(Re.userAgent)||[0,0])[1]:0,chrome:!!ze,chrome_version:ze?+ze[1]:0,ios:We,android:/Android\b/.test(Re.userAgent),webkit:Pe,safari:He,webkit_version:Pe?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Te.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};Fe=/*#__PURE__*/function(_Ce){function Fe(t){var _this8;_classCallCheck(this,Fe);_this8=_callSuper(this,Fe),_this8.text=t;return _this8;}_inherits(Fe,_Ce);return _createClass(Fe,[{key:"length",get:function get(){return this.text.length;}},{key:"createDOM",value:function createDOM(t){this.setDOM(t||document.createTextNode(this.text));}},{key:"sync",value:function 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);}},{key:"reuseDOM",value:function reuseDOM(t){3==t.nodeType&&this.createDOM(t);}},{key:"merge",value:function merge(t,e,i){return!(8&this.flags||i&&(!(i instanceof Fe)||this.length-(e-t)+i.length>256||8&i.flags))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0);}},{key:"split",value:function split(t){var e=new Fe(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e;}},{key:"localPosFromDOM",value:function localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0;}},{key:"domAtPos",value:function domAtPos(t){return new Se(this.dom,t);}},{key:"domBoundsAround",value:function domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling};}},{key:"coordsAt",value:function coordsAt(t,e){return function(t,e,i){var s=t.nodeValue.length;e>s&&(e=s);var r=e,n=e,h=0;0==e&&i<0||e==s&&i>=0?Ve.chrome||Ve.gecko||(e?(r--,h=1):n<s&&(n++,h=-1)):i<0?r--:n<s&&n++;var l=be(t,r,n).getClientRects();if(!l.length)return null;var o=l[(h?h<0:i>=0)?0:l.length-1];Ve.safari&&!h&&0==o.width&&(o=Array.prototype.find.call(l,function(t){return t.width;})||o);return h?ae(o,h<0):o||null;}(this.dom,t,e);}}]);}(Ce);qe=/*#__PURE__*/function(_Ce2){function qe(t){var _this9;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_classCallCheck(this,qe);_this9=_callSuper(this,qe),_this9.mark=t,_this9.children=e,_this9.length=i;var _iterator38=_createForOfIteratorHelper(e),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var _t58=_step38.value;_t58.setParent(_this9);}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}return _this9;}_inherits(qe,_Ce2);return _createClass(qe,[{key:"setAttrs",value:function setAttrs(t){if(ke(t),this.mark["class"]&&(t.className=this.mark["class"]),this.mark.attrs)for(var _e54 in this.mark.attrs)t.setAttribute(_e54,this.mark.attrs[_e54]);return t;}},{key:"canReuseDOM",value:function canReuseDOM(t){return _get(_getPrototypeOf(qe.prototype),"canReuseDOM",this).call(this,t)&&!(8&(this.flags|t.flags));}},{key:"reuseDOM",value:function reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6);}},{key:"sync",value:function sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),_get(_getPrototypeOf(qe.prototype),"sync",this).call(this,t,e);}},{key:"merge",value:function merge(t,e,i,s,r,n){return(!i||!(!(i instanceof qe&&i.mark.eq(this.mark))||t&&r<=0||e<this.length&&n<=0))&&(Ie(this,t,e,i?i.children.slice():[],r-1,n-1),this.markDirty(),!0);}},{key:"split",value:function split(t){var e=[],i=0,s=-1,r=0;var _iterator39=_createForOfIteratorHelper(this.children),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var _n37=_step39.value;var _h21=i+_n37.length;_h21>t&&e.push(i<t?_n37.split(t-i):_n37),s<0&&i>=t&&(s=r),i=_h21,r++;}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}var n=this.length-t;return this.length=t,s>-1&&(this.children.length=s,this.markDirty()),new qe(this.mark,e,n);}},{key:"domAtPos",value:function domAtPos(t){return Ge(this,t);}},{key:"coordsAt",value:function coordsAt(t,e){return _e(this,t,e);}}]);}(Ce);Ue=/*#__PURE__*/function(_Ce3){function Ue(t,e,i){var _this10;_classCallCheck(this,Ue);_this10=_callSuper(this,Ue),_this10.widget=t,_this10.length=e,_this10.side=i,_this10.prevWidget=null;return _this10;}_inherits(Ue,_Ce3);return _createClass(Ue,[{key:"split",value:function split(t){var e=Ue.create(this.widget,this.length-t,this.side);return this.length-=t,e;}},{key:"sync",value:function sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"));}},{key:"getSide",value:function getSide(){return this.side;}},{key:"merge",value:function merge(t,e,i,s,r,n){return!(i&&(!(i instanceof Ue&&this.widget.compare(i.widget))||t>0&&r<=0||e<this.length&&n<=0))&&(this.length=t+(i?i.length:0)+(this.length-e),!0);}},{key:"become",value:function become(t){return t instanceof Ue&&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);}},{key:"ignoreMutation",value:function ignoreMutation(){return!0;}},{key:"ignoreEvent",value:function ignoreEvent(t){return this.widget.ignoreEvent(t);}},{key:"overrideDOMText",get:function get(){if(0==this.length)return t.empty;var e=this;for(;e.parent;)e=e.parent;var _e55=e,i=_e55.view,s=i&&i.state.doc,r=this.posAtStart;return s?s.slice(r,r+this.length):t.empty;}},{key:"domAtPos",value:function domAtPos(t){return(this.length?0==t:this.side>0)?Se.before(this.dom):Se.after(this.dom,t==this.length);}},{key:"domBoundsAround",value:function domBoundsAround(){return null;}},{key:"coordsAt",value:function coordsAt(t,e){var i=this.widget.coordsAt(this.dom,t,e);if(i)return i;var s=this.dom.getClientRects(),r=null;if(!s.length)return null;var n=this.side?this.side<0:t>0;for(var _e56=n?s.length-1:0;r=s[_e56],!(t>0?0==_e56:_e56==s.length-1||r.top<r.bottom);_e56+=n?-1:1);return ae(r,!n);}},{key:"isEditable",get:function get(){return!1;}},{key:"isWidget",get:function get(){return!0;}},{key:"isHidden",get:function get(){return this.widget.isHidden;}},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(Ue.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom);}}],[{key:"create",value:function create(t,e,i){return new Ue(t,e,i);}}]);}(Ce);Je=/*#__PURE__*/function(_Ce4){function Je(t){var _this11;_classCallCheck(this,Je);_this11=_callSuper(this,Je),_this11.side=t;return _this11;}_inherits(Je,_Ce4);return _createClass(Je,[{key:"length",get:function get(){return 0;}},{key:"merge",value:function merge(){return!1;}},{key:"become",value:function become(t){return t instanceof Je&&t.side==this.side;}},{key:"split",value:function split(){return new Je(this.side);}},{key:"sync",value:function sync(){if(!this.dom){var _t59=document.createElement("img");_t59.className="cm-widgetBuffer",_t59.setAttribute("aria-hidden","true"),this.setDOM(_t59);}}},{key:"getSide",value:function getSide(){return this.side;}},{key:"domAtPos",value:function domAtPos(t){return this.side>0?Se.before(this.dom):Se.after(this.dom);}},{key:"localPosFromDOM",value:function localPosFromDOM(){return 0;}},{key:"domBoundsAround",value:function domBoundsAround(){return null;}},{key:"coordsAt",value:function coordsAt(t){return this.dom.getBoundingClientRect();}},{key:"overrideDOMText",get:function get(){return t.empty;}},{key:"isHidden",get:function get(){return!0;}}]);}(Ce);Fe.prototype.children=Ue.prototype.children=Je.prototype.children=Ae;Ye=Object.create(null);ei=/*#__PURE__*/function(_Ce5){function ei(){var _this12;_classCallCheck(this,ei);_this12=_callSuper(this,ei,arguments),_this12.children=[],_this12.length=0,_this12.prevAttrs=void 0,_this12.attrs=null,_this12.breakAfter=0;return _this12;}_inherits(ei,_Ce5);return _createClass(ei,[{key:"merge",value:function merge(t,e,i,s,r,n){if(i){if(!(i instanceof ei))return!1;this.dom||i.transferDOM(this);}return s&&this.setDeco(i?i.attrs:null),Ie(this,t,e,i?i.children.slice():[],r,n),!0;}},{key:"split",value:function split(t){var e=new ei();if(e.breakAfter=this.breakAfter,0==this.length)return e;var _this$childPos=this.childPos(t),i=_this$childPos.i,s=_this$childPos.off;s&&(e.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(var _t63=i;_t63<this.children.length;_t63++)e.append(this.children[_t63],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;}},{key:"transferDOM",value:function 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);}},{key:"setDeco",value:function setDeco(t){Qe(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t);}},{key:"append",value:function append(t,e){Ke(this,t,e);}},{key:"addLineDeco",value:function addLineDeco(t){var e=t.spec.attributes,i=t.spec["class"];e&&(this.attrs=Xe(e,this.attrs||{})),i&&(this.attrs=Xe({"class":i},this.attrs||{}));}},{key:"domAtPos",value:function domAtPos(t){return Ge(this,t);}},{key:"reuseDOM",value:function reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6);}},{key:"sync",value:function sync(t,e){var i;this.dom?4&this.flags&&(ke(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&&(Ze(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),_get(_getPrototypeOf(ei.prototype),"sync",this).call(this,t,e);var s=this.dom.lastChild;for(;s&&Ce.get(s)instanceof qe;)s=s.lastChild;if(!(s&&this.length&&("BR"==s.nodeName||0!=(null===(i=Ce.get(s))||void 0===i?void 0:i.isEditable)||Ve.ios&&this.children.some(function(t){return t instanceof Fe;})))){var _t64=document.createElement("BR");_t64.cmIgnore=!0,this.dom.appendChild(_t64);}}},{key:"measureTextSize",value:function measureTextSize(){if(0==this.children.length||this.length>20)return null;var t,e=0;var _iterator40=_createForOfIteratorHelper(this.children),_step40;try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var _i61=_step40.value;if(!(_i61 instanceof Fe)||/[^ -~]/.test(_i61.text))return null;var _s43=ne(_i61.dom);if(1!=_s43.length)return null;e+=_s43[0].width,t=_s43[0].height;}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null;}},{key:"coordsAt",value:function coordsAt(t,e){var i=_e(this,t,e);if(!this.children.length&&i&&this.parent){var _t65=this.parent.view.viewState.heightOracle,_e59=i.bottom-i.top;if(Math.abs(_e59-_t65.lineHeight)<2&&_t65.textHeight<_e59){var _s44=(_e59-_t65.textHeight)/2;return{top:i.top+_s44,bottom:i.bottom-_s44,left:i.left,right:i.left};}}return i;}},{key:"become",value:function become(t){return!1;}},{key:"covers",value:function covers(){return!0;}}],[{key:"find",value:function find(t,e){for(var _i62=0,_s45=0;_i62<t.children.length;_i62++){var _r42=t.children[_i62],_n40=_s45+_r42.length;if(_n40>=e){if(_r42 instanceof ei)return _r42;if(_n40>e)break;}_s45=_n40+_r42.breakAfter;}return null;}}]);}(Ce);ii=/*#__PURE__*/function(_Ce6){function ii(t,e,i){var _this13;_classCallCheck(this,ii);_this13=_callSuper(this,ii),_this13.widget=t,_this13.length=e,_this13.deco=i,_this13.breakAfter=0,_this13.prevWidget=null;return _this13;}_inherits(ii,_Ce6);return _createClass(ii,[{key:"merge",value:function merge(t,e,i,s,r,n){return!(i&&(!(i instanceof ii&&this.widget.compare(i.widget))||t>0&&r<=0||e<this.length&&n<=0))&&(this.length=t+(i?i.length:0)+(this.length-e),!0);}},{key:"domAtPos",value:function domAtPos(t){return 0==t?Se.before(this.dom):Se.after(this.dom,t==this.length);}},{key:"split",value:function split(t){var e=this.length-t;this.length=t;var i=new ii(this.widget,e,this.deco);return i.breakAfter=this.breakAfter,i;}},{key:"children",get:function get(){return Ae;}},{key:"sync",value:function sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"));}},{key:"overrideDOMText",get:function get(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):t.empty;}},{key:"domBoundsAround",value:function domBoundsAround(){return null;}},{key:"become",value:function become(t){return t instanceof ii&&t.widget.constructor==this.widget.constructor&&(t.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,this.deco=t.deco,this.breakAfter=t.breakAfter,!0);}},{key:"ignoreMutation",value:function ignoreMutation(){return!0;}},{key:"ignoreEvent",value:function ignoreEvent(t){return this.widget.ignoreEvent(t);}},{key:"isEditable",get:function get(){return!1;}},{key:"isWidget",get:function get(){return!0;}},{key:"coordsAt",value:function coordsAt(t,e){return this.widget.coordsAt(this.dom,t,e);}},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(ii.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom);}},{key:"covers",value:function covers(t){var _this$deco=this.deco,e=_this$deco.startSide,i=_this$deco.endSide;return e!=i&&(t<0?e<0:i>0);}}]);}(Ce);si=/*#__PURE__*/function(){function si(){_classCallCheck(this,si);}return _createClass(si,[{key:"eq",value:function eq(t){return!1;}},{key:"updateDOM",value:function updateDOM(t,e){return!1;}},{key:"compare",value:function compare(t){return this==t||this.constructor==t.constructor&&this.eq(t);}},{key:"estimatedHeight",get:function get(){return-1;}},{key:"lineBreaks",get:function get(){return 0;}},{key:"ignoreEvent",value:function ignoreEvent(t){return!0;}},{key:"coordsAt",value:function coordsAt(t,e,i){return null;}},{key:"isHidden",get:function get(){return!1;}},{key:"editable",get:function get(){return!1;}},{key:"destroy",value:function destroy(t){}}]);}();ri=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t;}(ri||(ri={}));ni=/*#__PURE__*/function(_Ct){function ni(t,e,i,s){var _this14;_classCallCheck(this,ni);_this14=_callSuper(this,ni),_this14.startSide=t,_this14.endSide=e,_this14.widget=i,_this14.spec=s;return _this14;}_inherits(ni,_Ct);return _createClass(ni,[{key:"heightRelevant",get:function get(){return!1;}},{key:"hasHeight",value:function hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1;}}],[{key:"mark",value:function mark(t){return new hi(t);}},{key:"widget",value:function widget(t){var e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new oi(t,e,e,i,t.widget||null,!1);}},{key:"replace",value:function replace(t){var e,i,s=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{var _ui=ui(t,s),_r43=_ui.start,_n41=_ui.end;e=(_r43?s?-3e8:-1:5e8)-1,i=1+(_n41?s?2e8:1:-6e8);}return new oi(t,e,i,s,t.widget||null,!0);}},{key:"line",value:function line(t){return new li(t);}},{key:"set",value:function set(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return It.of(t,e);}}]);}(Ct);ni.none=It.empty;hi=/*#__PURE__*/function(_ni){function hi(t){var _this15;_classCallCheck(this,hi);var _ui2=ui(t),e=_ui2.start,i=_ui2.end;_this15=_callSuper(this,hi,[e?-1:5e8,i?1:-6e8,null,t]),_this15.tagName=t.tagName||"span",_this15["class"]=t["class"]||"",_this15.attrs=t.attributes||null;return _this15;}_inherits(hi,_ni);return _createClass(hi,[{key:"eq",value:function eq(t){var e,i;return this==t||t instanceof hi&&this.tagName==t.tagName&&(this["class"]||(null===(e=this.attrs)||void 0===e?void 0:e["class"]))==(t["class"]||(null===(i=t.attrs)||void 0===i?void 0:i["class"]))&&Qe(this.attrs,t.attrs,"class");}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(t>=e)throw new RangeError("Mark decorations may not be empty");return _get(_getPrototypeOf(hi.prototype),"range",this).call(this,t,e);}}]);}(ni);hi.prototype.point=!1;li=/*#__PURE__*/function(_ni2){function li(t){_classCallCheck(this,li);return _callSuper(this,li,[-2e8,-2e8,null,t]);}_inherits(li,_ni2);return _createClass(li,[{key:"eq",value:function eq(t){return t instanceof li&&this.spec["class"]==t.spec["class"]&&Qe(this.spec.attributes,t.spec.attributes);}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return _get(_getPrototypeOf(li.prototype),"range",this).call(this,t,e);}}]);}(ni);li.prototype.mapMode=x.TrackBefore,li.prototype.point=!0;oi=/*#__PURE__*/function(_ni3){function oi(t,e,i,s,r,n){var _this16;_classCallCheck(this,oi);_this16=_callSuper(this,oi,[e,i,r,t]),_this16.block=s,_this16.isReplace=n,_this16.mapMode=s?e<=0?x.TrackBefore:x.TrackAfter:x.TrackDel;return _this16;}_inherits(oi,_ni3);return _createClass(oi,[{key:"type",get:function get(){return this.startSide!=this.endSide?ri.WidgetRange:this.startSide<=0?ri.WidgetBefore:ri.WidgetAfter;}},{key:"heightRelevant",get:function get(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0);}},{key:"eq",value:function eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i;}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]: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 _get(_getPrototypeOf(oi.prototype),"range",this).call(this,t,e);}}]);}(ni);oi.prototype.point=!0;ai=/*#__PURE__*/function(){function ai(t,e,i,s){_classCallCheck(this,ai);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;}return _createClass(ai,[{key:"posCovered",value:function posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;var t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof ii&&t.deco.endSide<0);}},{key:"getLine",value:function getLine(){return this.curLine||(this.content.push(this.curLine=new ei()),this.atCursorPos=!0),this.curLine;}},{key:"flushBuffer",value:function flushBuffer(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(ci(new Je(-1),t),t.length),this.pendingBuffer=0);}},{key:"addBlockWidget",value:function addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t);}},{key:"finish",value:function finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||t&&this.content.length&&this.content[this.content.length-1]instanceof ii||this.getLine();}},{key:"buildText",value:function buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){var _this$cursor$next2=this.cursor.next(this.skip),_e60=_this$cursor$next2.value,_i63=_this$cursor$next2.lineBreak,_s46=_this$cursor$next2.done;if(this.skip=0,_s46)throw new Error("Ran out of text content when drawing inline views");if(_i63){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=_e60,this.textOff=0;}var _s47=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(ci(new Fe(this.text.slice(this.textOff,this.textOff+_s47)),e),i),this.atCursorPos=!0,this.textOff+=_s47,t-=_s47,i=0;}}},{key:"span",value:function span(t,e,i,s){this.buildText(e-t,i,s),this.pos=e,this.openStart<0&&(this.openStart=s);}},{key:"point",value:function point(t,e,i,s,r,n){if(this.disallowBlockEffectsFor[n]&&i instanceof oi){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");}var h=e-t;if(i instanceof oi){if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ii(i.widget||di.block,h,i));else{var _n42=Ue.create(i.widget||di.inline,h,h?0:i.startSide),_l20=this.atCursorPos&&!_n42.isEditable&&r<=s.length&&(t<e||i.startSide>0),_o13=!_n42.isEditable&&(t<e||r>s.length||i.startSide<=0),_u20=this.getLine();2!=this.pendingBuffer||_l20||_n42.isEditable||(this.pendingBuffer=0),this.flushBuffer(s),_l20&&(_u20.append(ci(new Je(1),s),r),r=s.length+Math.max(0,r-s.length)),_u20.append(ci(_n42,s),r),this.atCursorPos=_o13,this.pendingBuffer=_o13?t<e||r>s.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice());}}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);h&&(this.textOff+h<=this.text.length?this.textOff+=h:(this.skip+=h-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r);}}],[{key:"build",value:function build(t,e,i,s,r){var n=new ai(t,e,i,r);return n.openEnd=It.spans(s,e,i,n),n.openStart<0&&(n.openStart=n.openEnd),n.finish(n.openEnd),n;}}]);}();di=/*#__PURE__*/function(_si){function di(t){var _this17;_classCallCheck(this,di);_this17=_callSuper(this,di),_this17.tag=t;return _this17;}_inherits(di,_si);return _createClass(di,[{key:"eq",value:function eq(t){return t.tag==this.tag;}},{key:"toDOM",value:function toDOM(){return document.createElement(this.tag);}},{key:"updateDOM",value:function updateDOM(t){return t.nodeName.toLowerCase()==this.tag;}},{key:"isHidden",get:function get(){return!0;}}]);}(si);di.inline=new di("span"),di.block=new di("div");pi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t;}(pi||(pi={}));mi=pi.LTR;gi=pi.RTL;bi=wi("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008");vi=wi("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333");ki=Object.create(null);yi=[];for(_i66=0,_arr=["()","[]","{}"];_i66<_arr.length;_i66++){_t66=_arr[_i66];_e61=_t66.charCodeAt(0);_i67=_t66.charCodeAt(1);ki[_e61]=_i67,ki[_i67]=-_e61;}xi=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;Si=/*#__PURE__*/function(){function Si(t,e,i){_classCallCheck(this,Si);this.from=t,this.to=e,this.level=i;}return _createClass(Si,[{key:"dir",get:function get(){return this.level%2?gi:mi;}},{key:"side",value:function side(t,e){return this.dir==e==t?this.to:this.from;}},{key:"forward",value:function forward(t,e){return t==(this.dir==e);}}],[{key:"find",value:function find(t,e,i,s){var r=-1;for(var _n43=0;_n43<t.length;_n43++){var _h23=t[_n43];if(_h23.from<=e&&_h23.to>=e){if(_h23.level==i)return _n43;(r<0||(0!=s?s<0?_h23.from<e:_h23.to>e:t[r].level>_h23.level))&&(r=_n43);}}if(r<0)throw new RangeError("Index out of range");return r;}}]);}();Ci=[];Ii="";Bi=$.define();Li=$.define();Ni=$.define();$i=$.define();ji=$.define();zi=$.define();Pi=$.define();Hi=$.define({combine:function combine(t){return t.some(function(t){return t;});}});Wi=$.define({combine:function combine(t){return t.some(function(t){return t;});}});Vi=$.define();Fi=/*#__PURE__*/function(){function Fi(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"nearest";var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"nearest";var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:5;var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:5;var n=arguments.length>5&&arguments[5]!==undefined?arguments[5]:!1;_classCallCheck(this,Fi);this.range=t,this.y=e,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=n;}return _createClass(Fi,[{key:"map",value:function map(t){return t.empty?this:new Fi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot);}},{key:"clip",value:function clip(t){return this.range.to<=t.doc.length?this:new Fi(B.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot);}}]);}();qi=ct.define({map:function map(t,e){return t.map(e);}});Ji=$.define({combine:function combine(t){return!t.length||t[0];}});Gi=0;Ki=$.define();_i=/*#__PURE__*/function(){function _i(t,e,i,s,r){_classCallCheck(this,_i);this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=s,this.extension=r(this);}return _createClass(_i,null,[{key:"define",value:function define(t,e){var _ref4=e||{},i=_ref4.eventHandlers,s=_ref4.eventObservers,r=_ref4.provide,n=_ref4.decorations;return new _i(Gi++,t,i,s,function(t){var e=[Ki.of(t)];return n&&e.push(Zi.of(function(e){var i=e.plugin(t);return i?n(i):ni.none;})),r&&e.push(r(t)),e;});}},{key:"fromClass",value:function fromClass(t,e){return _i.define(function(e){return new t(e);},e);}}]);}();Xi=/*#__PURE__*/function(){function Xi(t){_classCallCheck(this,Xi);this.spec=t,this.mustUpdate=null,this.value=null;}return _createClass(Xi,[{key:"update",value:function update(t){if(this.value){if(this.mustUpdate){var _t75=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(_t75);}catch(e){if(Ui(_t75.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){Ui(t.state,e,"CodeMirror plugin crashed"),this.deactivate();}return this;}},{key:"destroy",value:function destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy();}catch(e){Ui(t.state,e,"CodeMirror plugin crashed");}}},{key:"deactivate",value:function deactivate(){this.spec=this.value=null;}}]);}();Yi=$.define();Qi=$.define();Zi=$.define();ts=$.define();es=$.define();is=$.define();rs=$.define();hs=$.define();ls=/*#__PURE__*/function(){function ls(t,e,i,s){_classCallCheck(this,ls);this.fromA=t,this.toA=e,this.fromB=i,this.toB=s;}return _createClass(ls,[{key:"join",value:function join(t){return new ls(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB));}},{key:"addToSet",value:function addToSet(t){var e=t.length,i=this;for(;e>0;e--){var _s54=t[e-1];if(!(_s54.fromA>i.toA)){if(_s54.toA<i.fromA)break;i=i.join(_s54),t.splice(e-1,1);}}return t.splice(e,0,i),t;}}],[{key:"extendWithRanges",value:function extendWithRanges(t,e){if(0==e.length)return t;var i=[];for(var _s55=0,_r50=0,_n49=0,_h31=0;;_s55++){var _l24=_s55==t.length?null:t[_s55],_o19=_n49-_h31,_u25=_l24?_l24.fromB:1e9;for(;_r50<e.length&&e[_r50]<_u25;){var _t78=e[_r50],_s56=e[_r50+1],_n50=Math.max(_h31,_t78),_l25=Math.min(_u25,_s56);if(_n50<=_l25&&new ls(_n50+_o19,_l25+_o19,_n50,_l25).addToSet(i),_s56>_u25)break;_r50+=2;}if(!_l24)return i;new ls(_l24.fromA,_l24.toA,_l24.fromB,_l24.toB).addToSet(i),_n49=_l24.toA,_h31=_l24.toB;}}}]);}();os=/*#__PURE__*/function(){function os(t,e,i){_classCallCheck(this,os);this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=A.empty(this.startState.doc.length);var _iterator43=_createForOfIteratorHelper(i),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var _t79=_step43.value;this.changes=this.changes.compose(_t79.changes);}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}var s=[];this.changes.iterChangedRanges(function(t,e,i,r){return s.push(new ls(t,e,i,r));}),this.changedRanges=s;}return _createClass(os,[{key:"viewportChanged",get:function get(){return(4&this.flags)>0;}},{key:"heightChanged",get:function get(){return(2&this.flags)>0;}},{key:"geometryChanged",get:function get(){return this.docChanged||(10&this.flags)>0;}},{key:"focusChanged",get:function get(){return(1&this.flags)>0;}},{key:"docChanged",get:function get(){return!this.changes.empty;}},{key:"selectionSet",get:function get(){return this.transactions.some(function(t){return t.selection;});}},{key:"empty",get:function get(){return 0==this.flags&&0==this.transactions.length;}}],[{key:"create",value:function create(t,e,i){return new os(t,e,i);}}]);}();us=/*#__PURE__*/function(_Ce7){function us(t){var _this18;_classCallCheck(this,us);_this18=_callSuper(this,us),_this18.view=t,_this18.decorations=[],_this18.dynamicDecorationMap=[],_this18.domChanged=null,_this18.hasComposition=null,_this18.markedForComposition=new Set(),_this18.lastCompositionAfterCursor=!1,_this18.minWidth=0,_this18.minWidthFrom=0,_this18.minWidthTo=0,_this18.impreciseAnchor=null,_this18.impreciseHead=null,_this18.forceSelection=!1,_this18.lastUpdate=Date.now(),_this18.setDOM(t.contentDOM),_this18.children=[new ei()],_this18.children[0].setParent(_assertThisInitialized(_this18)),_this18.updateDeco(),_this18.updateInner([new ls(0,0,0,t.state.doc.length)],0,null);return _this18;}_inherits(us,_Ce7);return _createClass(us,[{key:"length",get:function get(){return this.view.state.doc.length;}},{key:"update",value:function update(t){var _this19=this;var e;var i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(function(_ref5){var t=_ref5.fromA,e=_ref5.toA;return e<_this19.minWidthFrom||t>_this19.minWidthTo;})?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);var s=-1;this.view.inputState.composing>=0&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?s=this.domChanged.newSel.head:function(t,e){var i=!1;e&&t.iterChangedRanges(function(t,s){t<e.to&&s>e.from&&(i=!0);});return i;}(t.changes,this.hasComposition)||t.selectionSet||(s=t.state.selection.main.head));var r=s>-1?function(t,e,i){var s=as(t,i);if(!s)return null;var r=s.node,n=s.from,h=s.to,l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(t.state.doc.sliceString(s.from,s.to)!=l)return null;var o=e.invertedDesc,u=new ls(o.mapPos(n),o.mapPos(h),n,h),f=[];for(var _e72=r.parentNode;;_e72=_e72.parentNode){var _i76=Ce.get(_e72);if(_i76 instanceof qe)f.push({node:_e72,deco:_i76.mark});else{if(_i76 instanceof ei||"DIV"==_e72.nodeName&&_e72.parentNode==t.contentDOM)return{range:u,text:r,marks:f,line:_e72};if(_e72==t.contentDOM)return null;f.push({node:_e72,deco:new hi({inclusive:!0,attributes:ti(_e72),tagName:_e72.tagName.toLowerCase()})});}}}(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();var _this$hasComposition=this.hasComposition,_e73=_this$hasComposition.from,_s57=_this$hasComposition.to;i=new ls(_e73,_s57,t.changes.mapPos(_e73,-1),t.changes.mapPos(_s57,1)).addToSet(i.slice());}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Ve.ie||Ve.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);var n=function(t,e,i){var s=new cs();return It.compare(t,e,i,s),s.changes;}(this.decorations,this.updateDeco(),t.changes);return i=ls.extendWithRanges(i,n),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,t.startState.doc.length,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0);}},{key:"updateInner",value:function updateInner(t,e,i){var _this20=this;this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,i);var s=this.view.observer;s.ignore(function(){_this20.dom.style.height=_this20.view.viewState.contentHeight/_this20.view.scaleY+"px",_this20.dom.style.flexBasis=_this20.minWidth?_this20.minWidth+"px":"";var t=Ve.chrome||Ve.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;_this20.sync(_this20.view,t),_this20.flags&=-8,t&&(t.written||s.selectionRange.focusNode!=t.node)&&(_this20.forceSelection=!0),_this20.dom.style.height="";}),this.markedForComposition.forEach(function(t){return t.flags&=-9;});var r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){var _iterator44=_createForOfIteratorHelper(this.children),_step44;try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var _t80=_step44.value;_t80 instanceof ii&&_t80.widget instanceof fs&&r.push(_t80.dom);}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}}s.updateGaps(r);}},{key:"updateChildren",value:function updateChildren(t,e,i){var s=i?i.range.addToSet(t.slice()):t,r=this.childCursor(e);for(var _t81=s.length-1;;_t81--){var _e74=_t81>=0?s[_t81]:null;if(!_e74)break;var _n51=void 0,_h32=void 0,_l26=void 0,_o20=void 0,_u26=_e74.fromA,_f11=_e74.toA,_a8=_e74.fromB,_c7=_e74.toB;if(i&&i.range.fromB<_c7&&i.range.toB>_a8){var _t82=ai.build(this.view.state.doc,_a8,i.range.fromB,this.decorations,this.dynamicDecorationMap),_e75=ai.build(this.view.state.doc,i.range.toB,_c7,this.decorations,this.dynamicDecorationMap);_h32=_t82.breakAtStart,_l26=_t82.openStart,_o20=_e75.openEnd;var _s58=this.compositionView(i);_e75.breakAtStart?_s58.breakAfter=1:_e75.content.length&&_s58.merge(_s58.length,_s58.length,_e75.content[0],!1,_e75.openStart,0)&&(_s58.breakAfter=_e75.content[0].breakAfter,_e75.content.shift()),_t82.content.length&&_s58.merge(0,0,_t82.content[_t82.content.length-1],!0,0,_t82.openEnd)&&_t82.content.pop(),_n51=_t82.content.concat(_s58).concat(_e75.content);}else{var _ai$build=ai.build(this.view.state.doc,_a8,_c7,this.decorations,this.dynamicDecorationMap);_n51=_ai$build.content;_h32=_ai$build.breakAtStart;_l26=_ai$build.openStart;_o20=_ai$build.openEnd;}var _r$findPos=r.findPos(_f11,1),_d3=_r$findPos.i,_p3=_r$findPos.off,_r$findPos2=r.findPos(_u26,-1),_m=_r$findPos2.i,_g=_r$findPos2.off;Ee(this,_m,_g,_d3,_p3,_n51,_h32,_l26,_o20);}i&&this.fixCompositionDOM(i);}},{key:"compositionView",value:function compositionView(t){var e=new Fe(t.text.nodeValue);e.flags|=8;var _iterator45=_createForOfIteratorHelper(t.marks),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var _i77=_step45.value.deco;e=new qe(_i77,[e],e.length);}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}var i=new ei();return i.append(e,0),i;}},{key:"fixCompositionDOM",value:function fixCompositionDOM(t){var _this21=this;var e=function e(t,_e76){_e76.flags|=8|(_e76.children.some(function(t){return 7&t.flags;})?1:0),_this21.markedForComposition.add(_e76);var i=Ce.get(t);i&&i!=_e76&&(i.dom=null),_e76.setDOM(t);},i=this.childPos(t.range.fromB,1),s=this.children[i.i];e(t.line,s);for(var _r51=t.marks.length-1;_r51>=-1;_r51--)i=s.childPos(i.off,1),s=s.children[i.i],e(_r51>=0?t.marks[_r51].node:t.text,s);}},{key:"updateSelection",value:function updateSelection(){var _this22=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();var i=this.view.root.activeElement,s=i==this.dom,r=!s&&re(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||e||r))return;var n=this.forceSelection;this.forceSelection=!1;var h=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(h.anchor)),o=h.empty?l:this.moveToLine(this.domAtPos(h.head));if(Ve.gecko&&h.empty&&!this.hasComposition&&1==(u=l).node.nodeType&&u.node.firstChild&&(0==u.offset||"false"==u.node.childNodes[u.offset-1].contentEditable)&&(u.offset==u.node.childNodes.length||"false"==u.node.childNodes[u.offset].contentEditable)){var _t83=document.createTextNode("");this.view.observer.ignore(function(){return l.node.insertBefore(_t83,l.node.childNodes[l.offset]||null);}),l=o=new Se(_t83,0),n=!0;}var u;var f=this.view.observer.selectionRange;!n&&f.focusNode&&(he(l.node,l.offset,f.anchorNode,f.anchorOffset)&&he(o.node,o.offset,f.focusNode,f.focusOffset)||this.suppressWidgetCursorChange(f,h))||(this.view.observer.ignore(function(){Ve.android&&Ve.chrome&&_this22.dom.contains(f.focusNode)&&function(t,e){for(var _i78=t;_i78&&_i78!=e;_i78=_i78.assignedSlot||_i78.parentNode)if(1==_i78.nodeType&&"false"==_i78.contentEditable)return!0;return!1;}(f.focusNode,_this22.dom)&&(_this22.dom.blur(),_this22.dom.focus({preventScroll:!0}));var t=ie(_this22.view.root);if(t){if(h.empty){if(Ve.gecko){var _t84=(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(_t84&&3!=_t84){var _e77=(1==_t84?Me:xe)(l.node,l.offset);_e77&&(l=new Se(_e77.node,_e77.offset));}}t.collapse(l.node,l.offset),null!=h.bidiLevel&&void 0!==t.caretBidiLevel&&(t.caretBidiLevel=h.bidiLevel);}else if(t.extend){t.collapse(l.node,l.offset);try{t.extend(o.node,o.offset);}catch(t){}}else{var _ref6;var _e78=document.createRange();h.anchor>h.head&&(_ref6=[o,l],l=_ref6[0],o=_ref6[1],_ref6),_e78.setEnd(o.node,o.offset),_e78.setStart(l.node,l.offset),t.removeAllRanges(),t.addRange(_e78);}}else;var e,s;r&&_this22.view.root.activeElement==_this22.dom&&(_this22.dom.blur(),i&&i.focus());}),this.view.observer.setSelectionRange(l,o)),this.impreciseAnchor=l.precise?null:new Se(f.anchorNode,f.anchorOffset),this.impreciseHead=o.precise?null:new Se(f.focusNode,f.focusOffset);}},{key:"suppressWidgetCursorChange",value:function suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&he(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head;}},{key:"enforceCursorAssoc",value:function enforceCursorAssoc(){if(this.hasComposition)return;var t=this.view,e=t.state.selection.main,i=ie(t.root),_t$observer$selection=t.observer.selectionRange,s=_t$observer$selection.anchorNode,r=_t$observer$selection.anchorOffset;if(!(i&&e.empty&&e.assoc&&i.modify))return;var n=ei.find(this,e.head);if(!n)return;var h=n.posAtStart;if(e.head==h||e.head==h+n.length)return;var l=this.coordsAt(e.head,-1),o=this.coordsAt(e.head,1);if(!l||!o||l.bottom>o.top)return;var u=this.domAtPos(e.head+e.assoc);i.collapse(u.node,u.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();var f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=e.from&&i.collapse(s,r);}},{key:"moveToLine",value:function moveToLine(t){var e,i=this.dom;if(t.node!=i)return t;for(var _s59=t.offset;!e&&_s59<i.childNodes.length;_s59++){var _t85=Ce.get(i.childNodes[_s59]);_t85 instanceof ei&&(e=_t85.domAtPos(0));}for(var _s60=t.offset-1;!e&&_s60>=0;_s60--){var _t86=Ce.get(i.childNodes[_s60]);_t86 instanceof ei&&(e=_t86.domAtPos(_t86.length));}return e?new Se(e.node,e.offset,!0):t;}},{key:"nearest",value:function nearest(t){for(var _e79=t;_e79;){var _t87=Ce.get(_e79);if(_t87&&_t87.rootView==this)return _t87;_e79=_e79.parentNode;}return null;}},{key:"posFromDOM",value:function posFromDOM(t,e){var 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;}},{key:"domAtPos",value:function domAtPos(t){var _this$childCursor$fin=this.childCursor().findPos(t,-1),e=_this$childCursor$fin.i,i=_this$childCursor$fin.off;for(;e<this.children.length-1;){var _t88=this.children[e];if(i<_t88.length||_t88 instanceof ei)break;e++,i=0;}return this.children[e].domAtPos(i);}},{key:"coordsAt",value:function coordsAt(t,e){var i=null,s=0;for(var _r52=this.length,_n52=this.children.length-1;_n52>=0;_n52--){var _h33=this.children[_n52],_l27=_r52-_h33.breakAfter,_o21=_l27-_h33.length;if(_l27<t)break;_o21<=t&&(_o21<t||_h33.covers(-1))&&(_l27>t||_h33.covers(1))&&(!i||_h33 instanceof ei&&!(i instanceof ei&&e>=0))&&(i=_h33,s=_o21),_r52=_o21;}return i?i.coordsAt(t-s,e):null;}},{key:"coordsForChar",value:function coordsForChar(t){var _this$childPos2=this.childPos(t,1),e=_this$childPos2.i,i=_this$childPos2.off,s=this.children[e];if(!(s instanceof ei))return null;for(;s.children.length;){var _s$childPos=s.childPos(i,1),_t89=_s$childPos.i,_e80=_s$childPos.off;for(;;_t89++){if(_t89==s.children.length)return null;if((s=s.children[_t89]).length)break;}i=_e80;}if(!(s instanceof Fe))return null;var r=p(s.text,i);if(r==i)return null;var n=be(s.dom,i,r).getClientRects();for(var _t90=0;_t90<n.length;_t90++){var _e81=n[_t90];if(_t90==n.length-1||_e81.top<_e81.bottom&&_e81.left<_e81.right)return _e81;}return null;}},{key:"measureVisibleLineHeights",value:function measureVisibleLineHeights(t){var e=[],i=t.from,s=t.to,r=this.view.contentDOM.clientWidth,n=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,h=-1,l=this.view.textDirection==pi.LTR;for(var _t91=0,_o22=0;_o22<this.children.length;_o22++){var _u27=this.children[_o22],_f12=_t91+_u27.length;if(_f12>s)break;if(_t91>=i){var _i79=_u27.dom.getBoundingClientRect();if(e.push(_i79.height),n){var _e82=_u27.dom.lastChild,_s61=_e82?ne(_e82):[];if(_s61.length){var _e83=_s61[_s61.length-1],_n53=l?_e83.right-_i79.left:_i79.right-_e83.left;_n53>h&&(h=_n53,this.minWidth=r,this.minWidthFrom=_t91,this.minWidthTo=_f12);}}}_t91=_f12+_u27.breakAfter;}return e;}},{key:"textDirectionAt",value:function textDirectionAt(t){var _this$childPos3=this.childPos(t,1),e=_this$childPos3.i;return"rtl"==getComputedStyle(this.children[e].dom).direction?pi.RTL:pi.LTR;}},{key:"measureTextSize",value:function measureTextSize(){var _this23=this;var _iterator46=_createForOfIteratorHelper(this.children),_step46;try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){var _t92=_step46.value;if(_t92 instanceof ei){var _e84=_t92.measureTextSize();if(_e84)return _e84;}}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}var t,e,i,s=document.createElement("div");return s.className="cm-line",s.style.width="99999px",s.style.position="absolute",s.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(function(){_this23.dom.appendChild(s);var r=ne(s.firstChild)[0];t=s.getBoundingClientRect().height,e=r?r.width/27:7,i=r?r.height:t,s.remove();}),{lineHeight:t,charWidth:e,textHeight:i};}},{key:"childCursor",value:function childCursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.length;var e=this.children.length;return e&&(t-=this.children[--e].length),new Oe(this.children,t,e);}},{key:"computeBlockGapDeco",value:function computeBlockGapDeco(){var t=[],e=this.view.viewState;for(var _i80=0,_s62=0;;_s62++){var _r53=_s62==e.viewports.length?null:e.viewports[_s62],_n54=_r53?_r53.from-1:this.length;if(_n54>_i80){var _s63=(e.lineBlockAt(_n54).bottom-e.lineBlockAt(_i80).top)/this.view.scaleY;t.push(ni.replace({widget:new fs(_s63),block:!0,inclusive:!0,isBlockGap:!0}).range(_i80,_n54));}if(!_r53)break;_i80=_r53.to+1;}return ni.set(t);}},{key:"updateDeco",value:function updateDeco(){var _this24=this;var t=0,e=this.view.state.facet(Zi).map(function(e){return(_this24.dynamicDecorationMap[t++]="function"==typeof e)?e(_this24.view):e;}),i=!1,s=this.view.state.facet(ts).map(function(t,e){var s="function"==typeof t;return s&&(i=!0),s?t(_this24.view):t;});for(s.length&&(this.dynamicDecorationMap[t++]=i,e.push(It.join(s))),this.decorations=[].concat(_toConsumableArray(e),[this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]);t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;return this.decorations;}},{key:"scrollIntoView",value:function scrollIntoView(t){if(t.isSnapshot){var _e85=this.view.viewState.lineBlockAt(t.range.head);return this.view.scrollDOM.scrollTop=_e85.top-t.yMargin,void(this.view.scrollDOM.scrollLeft=t.xMargin);}var _iterator47=_createForOfIteratorHelper(this.view.state.facet(Vi)),_step47;try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){var _e88=_step47.value;try{if(_e88(this.view,t.range,t))return!0;}catch(t){Ui(this.view.state,t,"scroll handler");}}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}var e,i=t.range,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)});var r=ns(this.view),n={left:s.left-r.left,top:s.top-r.top,right:s.right+r.right,bottom:s.bottom+r.bottom},_this$view$scrollDOM=this.view.scrollDOM,h=_this$view$scrollDOM.offsetWidth,l=_this$view$scrollDOM.offsetHeight;!function(t,e,i,s,r,n,h,l){var o=t.ownerDocument,u=o.defaultView||window;for(var _f13=t,_a9=!1;_f13&&!_a9;)if(1==_f13.nodeType){var _t93=void 0,_c8=_f13==o.body,_d4=1,_p4=1;if(_c8)_t93=ce(u);else{var _de;if(/^(fixed|sticky)$/.test(getComputedStyle(_f13).position)&&(_a9=!0),_f13.scrollHeight<=_f13.clientHeight&&_f13.scrollWidth<=_f13.clientWidth){_f13=_f13.assignedSlot||_f13.parentNode;continue;}var _e86=_f13.getBoundingClientRect();(_de=de(_f13,_e86),_d4=_de.scaleX,_p4=_de.scaleY),_t93={left:_e86.left,right:_e86.left+_f13.clientWidth*_d4,top:_e86.top,bottom:_e86.top+_f13.clientHeight*_p4};}var _m2=0,_g2=0;if("nearest"==r)e.top<_t93.top?(_g2=-(_t93.top-e.top+h),i>0&&e.bottom>_t93.bottom+_g2&&(_g2=e.bottom-_t93.bottom+_g2+h)):e.bottom>_t93.bottom&&(_g2=e.bottom-_t93.bottom+h,i<0&&e.top-_g2<_t93.top&&(_g2=-(_t93.top+_g2-e.top+h)));else{var _s64=e.bottom-e.top,_n55=_t93.bottom-_t93.top;_g2=("center"==r&&_s64<=_n55?e.top+_s64/2-_n55/2:"start"==r||"center"==r&&i<0?e.top-h:e.bottom-_n55+h)-_t93.top;}if("nearest"==s?e.left<_t93.left?(_m2=-(_t93.left-e.left+n),i>0&&e.right>_t93.right+_m2&&(_m2=e.right-_t93.right+_m2+n)):e.right>_t93.right&&(_m2=e.right-_t93.right+n,i<0&&e.left<_t93.left+_m2&&(_m2=-(_t93.left+_m2-e.left+n))):_m2=("center"==s?e.left+(e.right-e.left)/2-(_t93.right-_t93.left)/2:"start"==s==l?e.left-n:e.right-(_t93.right-_t93.left)+n)-_t93.left,_m2||_g2)if(_c8)u.scrollBy(_m2,_g2);else{var _t94=0,_i81=0;if(_g2){var _t95=_f13.scrollTop;_f13.scrollTop+=_g2/_p4,_i81=(_f13.scrollTop-_t95)*_p4;}if(_m2){var _e87=_f13.scrollLeft;_f13.scrollLeft+=_m2/_d4,_t94=(_f13.scrollLeft-_e87)*_d4;}e={left:e.left-_t94,top:e.top-_i81,right:e.right-_t94,bottom:e.bottom-_i81},_t94&&Math.abs(_t94-_m2)<1&&(s="nearest"),_i81&&Math.abs(_i81-_g2)<1&&(r="nearest");}if(_c8)break;_f13=_f13.assignedSlot||_f13.parentNode;}else{if(11!=_f13.nodeType)break;_f13=_f13.host;}}(this.view.scrollDOM,n,i.head<i.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,h),-h),Math.max(Math.min(t.yMargin,l),-l),this.view.textDirection==pi.LTR);}}]);}(Ce);fs=/*#__PURE__*/function(_si2){function fs(t){var _this25;_classCallCheck(this,fs);_this25=_callSuper(this,fs),_this25.height=t;return _this25;}_inherits(fs,_si2);return _createClass(fs,[{key:"toDOM",value:function toDOM(){var t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t;}},{key:"eq",value:function eq(t){return t.height==this.height;}},{key:"updateDOM",value:function updateDOM(t){return t.style.height=this.height+"px",!0;}},{key:"editable",get:function get(){return!0;}},{key:"estimatedHeight",get:function get(){return this.height;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);cs=/*#__PURE__*/function(){function cs(){_classCallCheck(this,cs);this.changes=[];}return _createClass(cs,[{key:"compareRange",value:function compareRange(t,e){fi(t,e,this.changes);}},{key:"comparePoint",value:function comparePoint(t,e){fi(t,e,this.changes);}}]);}();Cs=/*#__PURE__*/function(){function Cs(t){_classCallCheck(this,Cs);this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,Ve.safari&&t.contentDOM.addEventListener("input",function(){return null;}),Ve.gecko&&function(t){Zs.has(t)||(Zs.add(t),t.addEventListener("copy",function(){}),t.addEventListener("cut",function(){}));}(t.contentDOM.ownerDocument);}return _createClass(Cs,[{key:"setSelectionOrigin",value:function setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now();}},{key:"handleEvent",value:function handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var _i83,_s67=e.target;_s67!=t.contentDOM;_s67=_s67.parentNode)if(!_s67||11==_s67.nodeType||(_i83=Ce.get(_s67))&&_i83.ignoreEvent(e))return!1;return!0;})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||this.runHandlers(t.type,t));}},{key:"runHandlers",value:function runHandlers(t,e){var i=this.handlers[t];if(i){var _iterator50=_createForOfIteratorHelper(i.observers),_step50;try{for(_iterator50.s();!(_step50=_iterator50.n()).done;){var _t103=_step50.value;_t103(this.view,e);}}catch(err){_iterator50.e(err);}finally{_iterator50.f();}var _iterator51=_createForOfIteratorHelper(i.handlers),_step51;try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){var _t104=_step51.value;if(e.defaultPrevented)break;if(_t104(this.view,e)){e.preventDefault();break;}}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}}}},{key:"ensureHandlers",value:function ensureHandlers(t){var e=Os(t),i=this.handlers,s=this.view.contentDOM;for(var _t105 in e)if("scroll"!=_t105){var _r56=!e[_t105].handlers.length,_n57=i[_t105];_n57&&_r56!=!_n57.handlers.length&&(s.removeEventListener(_t105,this.handleEvent),_n57=null),_n57||s.addEventListener(_t105,this.handleEvent,{passive:_r56});}for(var _t106 in i)"scroll"==_t106||e[_t106]||s.removeEventListener(_t106,this.handleEvent);this.handlers=e;}},{key:"keydown",value:function keydown(t){var _this26=this;if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&Date.now()<this.lastEscPress+2e3)return!0;if(27!=t.keyCode&&Rs.indexOf(t.keyCode)<0&&(this.view.inputState.lastEscPress=0),Ve.android&&Ve.chrome&&!t.synthetic&&(13==t.keyCode||8==t.keyCode))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;var e;return!Ve.ios||t.synthetic||t.altKey||t.metaKey||!((e=Es.find(function(e){return e.keyCode==t.keyCode;}))&&!t.ctrlKey||Is.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout(function(){return _this26.flushIOSKey();},250),!0);}},{key:"flushIOSKey",value:function flushIOSKey(t){var e=this.pendingIOSKey;return!!e&&!("Enter"==e.key&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString()))&&(this.pendingIOSKey=void 0,ve(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0));}},{key:"ignoreDuringComposition",value:function ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Ve.safari&&!Ve.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0));}},{key:"startMouseSelection",value:function startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t;}},{key:"update",value:function update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0);}},{key:"destroy",value:function destroy(){this.mouseSelection&&this.mouseSelection.destroy();}}]);}();Es=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}];Is="dthko";Rs=[16,17,18,20,91,92,224,225];Bs=/*#__PURE__*/function(){function Bs(t,e,i,s){_classCallCheck(this,Bs);this.view=t,this.startEvent=e,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=function(t){var e=t.ownerDocument;for(var _i84=t.parentNode;_i84&&_i84!=e.body;)if(1==_i84.nodeType){if(_i84.scrollHeight>_i84.clientHeight||_i84.scrollWidth>_i84.clientWidth)return _i84;_i84=_i84.assignedSlot||_i84.parentNode;}else{if(11!=_i84.nodeType)break;_i84=_i84.host;}return null;}(t.contentDOM),this.atoms=t.state.facet(es).map(function(e){return e(t);});var r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(St.allowMultipleSelections)&&function(t,e){var i=t.state.facet(Bi);return i.length?i[0](e):Ve.mac?e.metaKey:e.ctrlKey;}(t,e),this.dragging=!(!function(t,e){var i=t.state.selection.main;if(i.empty)return!1;var s=ie(t.root);if(!s||0==s.rangeCount)return!0;var r=s.getRangeAt(0).getClientRects();for(var _t110=0;_t110<r.length;_t110++){var _i85=r[_t110];if(_i85.left<=e.clientX&&_i85.right>=e.clientX&&_i85.top<=e.clientY&&_i85.bottom>=e.clientY)return!0;}return!1;}(t,e)||1!=Gs(e))&&null;}return _createClass(Bs,[{key:"start",value:function start(t){!1===this.dragging&&this.select(t);}},{key:"move",value:function move(t){var e,i,s;if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(i=this.startEvent,s=t,Math.max(Math.abs(i.clientX-s.clientX),Math.abs(i.clientY-s.clientY))<10))return;this.select(this.lastEvent=t);var r=0,n=0,h=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},l=ns(this.view);t.clientX-l.left<=h.left+6?r=-Ts(h.left-t.clientX):t.clientX+l.right>=h.right-6&&(r=Ts(t.clientX-h.right)),t.clientY-l.top<=h.top+6?n=-Ts(h.top-t.clientY):t.clientY+l.bottom>=h.bottom-6&&(n=Ts(t.clientY-h.bottom)),this.setScrollSpeed(r,n);}},{key:"up",value:function up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy();}},{key:"destroy",value:function destroy(){this.setScrollSpeed(0,0);var t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null;}},{key:"setScrollSpeed",value:function setScrollSpeed(t,e){var _this27=this;this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(function(){return _this27.scroll();},50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1);}},{key:"scroll",value:function 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);}},{key:"skipAtoms",value:function skipAtoms(t){var e=null;for(var _i86=0;_i86<t.ranges.length;_i86++){var _s70=t.ranges[_i86],_r59=null;if(_s70.empty){var _t111=Ss(this.atoms,_s70.from,0);_t111!=_s70.from&&(_r59=B.cursor(_t111,-1));}else{var _t112=Ss(this.atoms,_s70.from,-1),_e98=Ss(this.atoms,_s70.to,1);_t112==_s70.from&&_e98==_s70.to||(_r59=B.range(_s70.from==_s70.anchor?_t112:_e98,_s70.from==_s70.head?_t112:_e98));}_r59&&(e||(e=t.ranges.slice()),e[_i86]=_r59);}return e?B.create(e,t.mainIndex):t;}},{key:"select",value:function select(t){var e=this.view,i=this.skipAtoms(this.style.get(t,this.extend,this.multiple));!this.mustSelect&&i.eq(e.state.selection,!1===this.dragging)||this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1;}},{key:"update",value:function update(t){var _this28=this;this.style.update(t)&&setTimeout(function(){return _this28.select(_this28.lastEvent);},20);}}]);}();Ls=Object.create(null);Ns=Object.create(null);$s=Ve.ie&&Ve.ie_version<15||Ve.ios&&Ve.webkit_version<604;Ns.scroll=function(t){t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft;},Ls.keydown=function(t,e){return t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now()),!1;},Ns.touchstart=function(t,e){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer");},Ns.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer");},Ls.mousedown=function(t,e){if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;var i=null;var _iterator53=_createForOfIteratorHelper(t.state.facet(Ni)),_step53;try{for(_iterator53.s();!(_step53=_iterator53.n()).done;){var _s74=_step53.value;if(i=_s74(t,e),i)break;}}catch(err){_iterator53.e(err);}finally{_iterator53.f();}if(i||0!=e.button||(i=function(t,e){var i=Vs(t,e),s=Gs(e),r=t.state.selection;return{update:function update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),r=r.map(t.changes));},get:function get(e,n,h){var l,o=Vs(t,e),u=zs(t,o.pos,o.bias,s);if(i.pos!=o.pos&&!n){var _e99=zs(t,i.pos,i.bias,s),_r61=Math.min(_e99.from,u.from),_n59=Math.max(_e99.to,u.to);u=_r61<u.from?B.range(_r61,_n59):B.range(_n59,_r61);}return n?r.replaceRange(r.main.extend(u.from,u.to)):h&&1==s&&r.ranges.length>1&&(l=function(t,e){for(var _i88=0;_i88<t.ranges.length;_i88++){var _t$ranges$_i=t.ranges[_i88],_s72=_t$ranges$_i.from,_r62=_t$ranges$_i.to;if(_s72<=e&&_r62>=e)return B.create(t.ranges.slice(0,_i88).concat(t.ranges.slice(_i88+1)),t.mainIndex==_i88?0:t.mainIndex-(t.mainIndex>_i88?1:0));}return null;}(r,o.pos))?l:h?r.addRange(u):B.create([u]);}};}(t,e)),i){var _s73=!t.hasFocus;t.inputState.startMouseSelection(new Bs(t,e,i,_s73)),_s73&&t.observer.ignore(function(){return we(t.contentDOM);});var _r63=t.inputState.mouseSelection;if(_r63)return _r63.start(e),!1===_r63.dragging;}return!1;};Ps=function Ps(t,e){return t>=e.top&&t<=e.bottom;};Hs=function Hs(t,e,i){return Ps(e,i)&&t>=i.left&&t<=i.right;};Fs=Ve.ie&&Ve.ie_version<=11;qs=null;Us=0;Js=0;Ls.dragstart=function(t,e){var i=t.state.selection.main;if(e.target.draggable){var _s75=t.docView.nearest(e.target);if(_s75&&_s75.isWidget){var _t116=_s75.posAtStart,_e100=_t116+_s75.length;(_t116>=i.to||_e100<=i.from)&&(i=B.range(_t116,_e100));}}var s=t.inputState;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove"),!1;},Ls.dragend=function(t){return t.inputState.draggedContent=null,!1;},Ls.drop=function(t,e){if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;var i=e.dataTransfer.files;if(i&&i.length){var _s76=Array(i.length),_r64=0,_n60=function _n60(){++_r64==i.length&&Ks(t,e,_s76.filter(function(t){return null!=t;}).join(t.state.lineBreak),!1);};var _loop6=function _loop6(_t117){var e=new FileReader();e.onerror=_n60,e.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(_s76[_t117]=e.result),_n60();},e.readAsText(i[_t117]);};for(var _t117=0;_t117<i.length;_t117++){_loop6(_t117);}return!0;}{var _i89=e.dataTransfer.getData("Text");if(_i89)return Ks(t,e,_i89,!0),!0;}return!1;},Ls.paste=function(t,e){if(t.state.readOnly)return!0;t.observer.flush();var i=$s?null:e.clipboardData;return i?(js(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(function(t){var e=t.dom.parentNode;if(!e)return;var i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(function(){t.focus(),i.remove(),js(t,i.value);},50);}(t),!1);};_s=null;Ls.copy=Ls.cut=function(t,e){var _ref7=function(t){var e=[],i=[],s=!1;var _iterator54=_createForOfIteratorHelper(t.selection.ranges),_step54;try{for(_iterator54.s();!(_step54=_iterator54.n()).done;){var _s78=_step54.value;_s78.empty||(e.push(t.sliceDoc(_s78.from,_s78.to)),i.push(_s78));}}catch(err){_iterator54.e(err);}finally{_iterator54.f();}if(!e.length){var _r65=-1;var _iterator55=_createForOfIteratorHelper(t.selection.ranges),_step55;try{for(_iterator55.s();!(_step55=_iterator55.n()).done;){var _s77=_step55.value.from;var _n61=t.doc.lineAt(_s77);_n61.number>_r65&&(e.push(_n61.text),i.push({from:_n61.from,to:Math.min(t.doc.length,_n61.to+1)})),_r65=_n61.number;}}catch(err){_iterator55.e(err);}finally{_iterator55.f();}s=!0;}return{text:e.join(t.lineBreak),ranges:i,linewise:s};}(t.state),i=_ref7.text,s=_ref7.ranges,r=_ref7.linewise;if(!i&&!r)return!1;_s=r?i:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});var n=$s?null:e.clipboardData;return n?(n.clearData(),n.setData("text/plain",i),!0):(function(t,e){var i=t.dom.parentNode;if(!i)return;var 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(function(){s.remove(),t.focus();},50);}(t,i),!1);};Xs=ut.define();Ns.focus=function(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),Qs(t);},Ns.blur=function(t){t.observer.clearSelectionRange(),Qs(t);},Ns.compositionstart=Ns.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0);},Ns.compositionend=function(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,Ve.chrome&&Ve.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(function(){return t.observer.flush();}):setTimeout(function(){t.inputState.composing<0&&t.docView.hasComposition&&t.update([]);},50);},Ns.contextmenu=function(t){t.inputState.lastContextMenu=Date.now();},Ls.beforeinput=function(t,e){var i;var s;if(Ve.chrome&&Ve.android&&(s=Es.find(function(t){return t.inputType==e.inputType;}))&&(t.observer.delayAndroidKey(s.key,s.keyCode),"Backspace"==s.key||"Delete"==s.key)){var _e101=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout(function(){var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>_e101+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus());},100);}return Ve.ios&&"deleteContentForward"==e.inputType&&t.observer.flushSoon(),Ve.safari&&"insertText"==e.inputType&&t.inputState.composing>=0&&setTimeout(function(){return Ns.compositionend(t,e);},20),!1;};Zs=new Set();tr=["pre-wrap","normal","pre-line","break-spaces"];er=/*#__PURE__*/function(){function er(e){_classCallCheck(this,er);this.lineWrapping=e,this.doc=t.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1;}return _createClass(er,[{key:"heightForGap",value:function heightForGap(t,e){var 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;}},{key:"heightForLine",value:function heightForLine(t){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight;}},{key:"setDoc",value:function setDoc(t){return this.doc=t,this;}},{key:"mustRefreshForWrapping",value:function mustRefreshForWrapping(t){return tr.indexOf(t)>-1!=this.lineWrapping;}},{key:"mustRefreshForHeights",value:function mustRefreshForHeights(t){var e=!1;for(var _i91=0;_i91<t.length;_i91++){var _s80=t[_i91];_s80<0?_i91++:this.heightSamples[Math.floor(10*_s80)]||(e=!0,this.heightSamples[Math.floor(10*_s80)]=!0);}return e;}},{key:"refresh",value:function refresh(t,e,i,s,r,n){var h=tr.indexOf(t)>-1,l=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=h;if(this.lineWrapping=h,this.lineHeight=e,this.charWidth=i,this.textHeight=s,this.lineLength=r,l){this.heightSamples={};for(var _t118=0;_t118<n.length;_t118++){var _e102=n[_t118];_e102<0?_t118++:this.heightSamples[Math.floor(10*_e102)]=!0;}}return l;}}]);}();ir=/*#__PURE__*/function(){function ir(t,e){_classCallCheck(this,ir);this.from=t,this.heights=e,this.index=0;}return _createClass(ir,[{key:"more",get:function get(){return this.index<this.heights.length;}}]);}();sr=/*#__PURE__*/function(){function sr(t,e,i,s,r){_classCallCheck(this,sr);this.from=t,this.length=e,this.top=i,this.height=s,this._content=r;}return _createClass(sr,[{key:"type",get:function get(){return"number"==typeof this._content?ri.Text:Array.isArray(this._content)?this._content:this._content.type;}},{key:"to",get:function get(){return this.from+this.length;}},{key:"bottom",get:function get(){return this.top+this.height;}},{key:"widget",get:function get(){return this._content instanceof oi?this._content.widget:null;}},{key:"widgetLineBreaks",get:function get(){return"number"==typeof this._content?this._content:0;}},{key:"join",value:function join(t){var e=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new sr(this.from,this.length+t.length,this.top,this.height+t.height,e);}}]);}();rr=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t;}(rr||(rr={}));nr=.001;hr=/*#__PURE__*/function(){function hr(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:2;_classCallCheck(this,hr);this.length=t,this.height=e,this.flags=i;}return _createClass(hr,[{key:"outdated",get:function get(){return(2&this.flags)>0;},set:function set(t){this.flags=(t?2:0)|-3&this.flags;}},{key:"setHeight",value:function setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>nr&&(t.heightChanged=!0),this.height=e);}},{key:"replace",value:function replace(t,e,i){return hr.of(i);}},{key:"decomposeLeft",value:function decomposeLeft(t,e){e.push(this);}},{key:"decomposeRight",value:function decomposeRight(t,e){e.push(this);}},{key:"applyChanges",value:function applyChanges(t,e,i,s){var r=this,n=i.doc;for(var _h34=s.length-1;_h34>=0;_h34--){var _s$_h=s[_h34],_l31=_s$_h.fromA,_o25=_s$_h.toA,_u30=_s$_h.fromB,_f15=_s$_h.toB,_a10=r.lineAt(_l31,rr.ByPosNoHeight,i.setDoc(e),0,0),_c10=_a10.to>=_o25?_a10:r.lineAt(_o25,rr.ByPosNoHeight,i,0,0);for(_f15+=_c10.to-_o25,_o25=_c10.to;_h34>0&&_a10.from<=s[_h34-1].toA;)_l31=s[_h34-1].fromA,_u30=s[_h34-1].fromB,_h34--,_l31<_a10.from&&(_a10=r.lineAt(_l31,rr.ByPosNoHeight,i,0,0));_u30+=_a10.from-_l31,_l31=_a10.from;var _d6=cr.build(i.setDoc(n),t,_u30,_f15);r=r.replace(_l31,_o25,_d6);}return r.updateHeight(i,0);}}],[{key:"empty",value:function empty(){return new or(0,0);}},{key:"of",value:function of(t){if(1==t.length)return t[0];var e=0,i=t.length,s=0,r=0;for(;;)if(e==i){if(s>2*r){var _r67=t[e-1];_r67["break"]?t.splice(--e,1,_r67.left,null,_r67.right):t.splice(--e,1,_r67.left,_r67.right),i+=1+_r67["break"],s-=_r67.size;}else{if(!(r>2*s))break;{var _e103=t[i];_e103["break"]?t.splice(i,1,_e103.left,null,_e103.right):t.splice(i,1,_e103.left,_e103.right),i+=2+_e103["break"],r-=_e103.size;}}}else if(s<r){var _i92=t[e++];_i92&&(s+=_i92.size);}else{var _e104=t[--i];_e104&&(r+=_e104.size);}var n=0;return null==t[e-1]?(n=1,e--):null==t[e]&&(n=1,i++),new fr(hr.of(t.slice(0,e)),n,hr.of(t.slice(i)));}}]);}();hr.prototype.size=1;lr=/*#__PURE__*/function(_hr){function lr(t,e,i){var _this29;_classCallCheck(this,lr);_this29=_callSuper(this,lr,[t,e]),_this29.deco=i;return _this29;}_inherits(lr,_hr);return _createClass(lr,[{key:"blockAt",value:function blockAt(t,e,i,s){return new sr(s,this.length,i,this.height,this.deco||0);}},{key:"lineAt",value:function lineAt(t,e,i,s,r){return this.blockAt(0,i,s,r);}},{key:"forEachLine",value:function forEachLine(t,e,i,s,r,n){t<=r+this.length&&e>=r&&n(this.blockAt(0,i,s,r));}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;return s&&s.from<=e&&s.more&&this.setHeight(t,s.heights[s.index++]),this.outdated=!1,this;}},{key:"toString",value:function toString(){return"block(".concat(this.length,")");}}]);}(hr);or=/*#__PURE__*/function(_lr){function or(t,e){var _this30;_classCallCheck(this,or);_this30=_callSuper(this,or,[t,e,null]),_this30.collapsed=0,_this30.widgetHeight=0,_this30.breaks=0;return _this30;}_inherits(or,_lr);return _createClass(or,[{key:"blockAt",value:function blockAt(t,e,i,s){return new sr(s,this.length,i,this.height,this.breaks);}},{key:"replace",value:function replace(t,e,i){var s=i[0];return 1==i.length&&(s instanceof or||s instanceof ur&&4&s.flags)&&Math.abs(this.length-s.length)<10?(s instanceof ur?s=new or(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):hr.of(i);}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;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.breaks*t.lineHeight),this.outdated=!1,this;}},{key:"toString",value:function toString(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")");}}]);}(lr);ur=/*#__PURE__*/function(_hr2){function ur(t){_classCallCheck(this,ur);return _callSuper(this,ur,[t,0]);}_inherits(ur,_hr2);return _createClass(ur,[{key:"heightMetrics",value:function heightMetrics(t,e){var i,s=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,n=r-s+1,h=0;if(t.lineWrapping){var _e105=Math.min(this.height,t.lineHeight*n);i=_e105/n,this.length>n+1&&(h=(this.height-_e105)/(this.length-n-1));}else i=this.height/n;return{firstLine:s,lastLine:r,perLine:i,perChar:h};}},{key:"blockAt",value:function blockAt(t,e,i,s){var _this$heightMetrics=this.heightMetrics(e,s),r=_this$heightMetrics.firstLine,n=_this$heightMetrics.lastLine,h=_this$heightMetrics.perLine,l=_this$heightMetrics.perChar;if(e.lineWrapping){var _r68=s+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length)),_n62=e.doc.lineAt(_r68),_o26=h+_n62.length*l,_u31=Math.max(i,t-_o26/2);return new sr(_n62.from,_n62.length,_u31,_o26,0);}{var _s81=Math.max(0,Math.min(n-r,Math.floor((t-i)/h))),_e$doc$line=e.doc.line(r+_s81),_l32=_e$doc$line.from,_o27=_e$doc$line.length;return new sr(_l32,_o27,i+h*_s81,h,0);}}},{key:"lineAt",value:function lineAt(t,e,i,s,r){if(e==rr.ByHeight)return this.blockAt(t,i,s,r);if(e==rr.ByPosNoHeight){var _i$doc$lineAt=i.doc.lineAt(t),_e106=_i$doc$lineAt.from,_s82=_i$doc$lineAt.to;return new sr(_e106,_s82-_e106,0,0,0);}var _this$heightMetrics2=this.heightMetrics(i,r),n=_this$heightMetrics2.firstLine,h=_this$heightMetrics2.perLine,l=_this$heightMetrics2.perChar,o=i.doc.lineAt(t),u=h+o.length*l,f=o.number-n,a=s+h*f+l*(o.from-r-f);return new sr(o.from,o.length,Math.max(s,Math.min(a,s+this.height-u)),u,0);}},{key:"forEachLine",value:function forEachLine(t,e,i,s,r,n){t=Math.max(t,r),e=Math.min(e,r+this.length);var _this$heightMetrics3=this.heightMetrics(i,r),h=_this$heightMetrics3.firstLine,l=_this$heightMetrics3.perLine,o=_this$heightMetrics3.perChar;for(var _u32=t,_f16=s;_u32<=e;){var _e107=i.doc.lineAt(_u32);if(_u32==t){var _i93=_e107.number-h;_f16+=l*_i93+o*(t-r-_i93);}var _s83=l+o*_e107.length;n(new sr(_e107.from,_e107.length,_f16,_s83,0)),_f16+=_s83,_u32=_e107.to+1;}}},{key:"replace",value:function replace(t,e,i){var s=this.length-e;if(s>0){var _t119=i[i.length-1];_t119 instanceof ur?i[i.length-1]=new ur(_t119.length+s):i.push(null,new ur(s-1));}if(t>0){var _e108=i[0];_e108 instanceof ur?i[0]=new ur(t+_e108.length):i.unshift(new ur(t-1),null);}return hr.of(i);}},{key:"decomposeLeft",value:function decomposeLeft(t,e){e.push(new ur(t-1),null);}},{key:"decomposeRight",value:function decomposeRight(t,e){e.push(null,new ur(this.length-t-1));}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;var r=e+this.length;if(s&&s.from<=e+this.length&&s.more){var _i94=[],_n63=Math.max(e,s.from),_h35=-1;for(s.from>e&&_i94.push(new ur(s.from-e-1).updateHeight(t,e));_n63<=r&&s.more;){var _e109=t.doc.lineAt(_n63).length;_i94.length&&_i94.push(null);var _r69=s.heights[s.index++];-1==_h35?_h35=_r69:Math.abs(_r69-_h35)>=nr&&(_h35=-2);var _l33=new or(_e109,_r69);_l33.outdated=!1,_i94.push(_l33),_n63+=_e109+1;}_n63<=r&&_i94.push(null,new ur(r-_n63).updateHeight(t,_n63));var _l34=hr.of(_i94);return(_h35<0||Math.abs(_l34.height-this.height)>=nr||Math.abs(_h35-this.heightMetrics(t,e).perLine)>=nr)&&(t.heightChanged=!0),_l34;}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this;}},{key:"toString",value:function toString(){return"gap(".concat(this.length,")");}}]);}(hr);fr=/*#__PURE__*/function(_hr3){function fr(t,e,i){var _this31;_classCallCheck(this,fr);_this31=_callSuper(this,fr,[t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)]),_this31.left=t,_this31.right=i,_this31.size=t.size+i.size;return _this31;}_inherits(fr,_hr3);return _createClass(fr,[{key:"break",get:function get(){return 1&this.flags;}},{key:"blockAt",value:function blockAt(t,e,i,s){var r=i+this.left.height;return t<r?this.left.blockAt(t,e,i,s):this.right.blockAt(t,e,r,s+this.left.length+this["break"]);}},{key:"lineAt",value:function lineAt(t,e,i,s,r){var n=s+this.left.height,h=r+this.left.length+this["break"],l=e==rr.ByHeight?t<n:t<h,o=l?this.left.lineAt(t,e,i,s,r):this.right.lineAt(t,e,i,n,h);if(this["break"]||(l?o.to<h:o.from>h))return o;var u=e==rr.ByPosNoHeight?rr.ByPosNoHeight:rr.ByPos;return l?o.join(this.right.lineAt(h,u,i,n,h)):this.left.lineAt(h,u,i,s,r).join(o);}},{key:"forEachLine",value:function forEachLine(t,e,i,s,r,n){var h=s+this.left.height,l=r+this.left.length+this["break"];if(this["break"])t<l&&this.left.forEachLine(t,e,i,s,r,n),e>=l&&this.right.forEachLine(t,e,i,h,l,n);else{var _o28=this.lineAt(l,rr.ByPos,i,s,r);t<_o28.from&&this.left.forEachLine(t,_o28.from-1,i,s,r,n),_o28.to>=t&&_o28.from<=e&&n(_o28),e>_o28.to&&this.right.forEachLine(_o28.to+1,e,i,h,l,n);}}},{key:"replace",value:function replace(t,e,i){var 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));var r=[];t>0&&this.decomposeLeft(t,r);var n=r.length;var _iterator57=_createForOfIteratorHelper(i),_step57;try{for(_iterator57.s();!(_step57=_iterator57.n()).done;){var _t121=_step57.value;r.push(_t121);}}catch(err){_iterator57.e(err);}finally{_iterator57.f();}if(t>0&&ar(r,n-1),e<this.length){var _t120=r.length;this.decomposeRight(e,r),ar(r,_t120);}return hr.of(r);}},{key:"decomposeLeft",value:function decomposeLeft(t,e){var 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);}},{key:"decomposeRight",value:function decomposeRight(t,e){var 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);}},{key:"balanced",value:function balanced(t,e){return t.size>2*e.size||e.size>2*t.size?hr.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);}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;var r=this.left,n=this.right,h=e+r.length+this["break"],l=null;return s&&s.from<=e+r.length&&s.more?l=r=r.updateHeight(t,e,i,s):r.updateHeight(t,e,i),s&&s.from<=h+n.length&&s.more?l=n=n.updateHeight(t,h,i,s):n.updateHeight(t,h,i),l?this.balanced(r,n):(this.height=this.left.height+this.right.height,this.outdated=!1,this);}},{key:"toString",value:function toString(){return this.left+(this["break"]?" ":"-")+this.right;}}]);}(hr);cr=/*#__PURE__*/function(){function cr(t,e){_classCallCheck(this,cr);this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t;}return _createClass(cr,[{key:"isCovered",get:function get(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering;}},{key:"span",value:function span(t,e){if(this.lineStart>-1){var _t122=Math.min(e,this.lineEnd),_i95=this.nodes[this.nodes.length-1];_i95 instanceof or?_i95.length+=_t122-this.pos:(_t122>this.pos||!this.isCovered)&&this.nodes.push(new or(_t122-this.pos,-1)),this.writtenTo=_t122,e>_t122&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1);}this.pos=e;}},{key:"point",value:function point(t,e,i){if(t<e||i.heightRelevant){var _s84=i.widget?i.widget.estimatedHeight:0,_r70=i.widget?i.widget.lineBreaks:0;_s84<0&&(_s84=this.oracle.lineHeight);var _n64=e-t;i.block?this.addBlock(new lr(_n64,_s84,i)):(_n64||_r70||_s84>=5)&&this.addLineDeco(_s84,_r70,_n64);}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to);}},{key:"enterLine",value:function enterLine(){if(this.lineStart>-1)return;var _this$oracle$doc$line=this.oracle.doc.lineAt(this.pos),t=_this$oracle$doc$line.from,e=_this$oracle$doc$line.to;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 or(this.pos-t,-1)),this.writtenTo=this.pos;}},{key:"blankContent",value:function blankContent(t,e){var i=new ur(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i;}},{key:"ensureLine",value:function ensureLine(){this.enterLine();var t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof or)return t;var e=new or(0,-1);return this.nodes.push(e),e;}},{key:"addBlock",value:function addBlock(t){this.enterLine();var e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t);}},{key:"addLineDeco",value:function addLineDeco(t,e,i){var s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,t),s.breaks+=e,this.writtenTo=this.pos=this.pos+i;}},{key:"finish",value:function finish(t){var e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof or||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new or(0,-1));var i=t;var _iterator58=_createForOfIteratorHelper(this.nodes),_step58;try{for(_iterator58.s();!(_step58=_iterator58.n()).done;){var _t123=_step58.value;_t123 instanceof or&&_t123.updateHeight(this.oracle,i),i+=_t123?_t123.length:1;}}catch(err){_iterator58.e(err);}finally{_iterator58.f();}return this.nodes;}}],[{key:"build",value:function build(t,e,i,s){var r=new cr(i,t);return It.spans(e,i,s,r,0),r.finish(i);}}]);}();dr=/*#__PURE__*/function(){function dr(){_classCallCheck(this,dr);this.changes=[];}return _createClass(dr,[{key:"compareRange",value:function compareRange(){}},{key:"comparePoint",value:function comparePoint(t,e,i,s){(t<e||i&&i.heightRelevant||s&&s.heightRelevant)&&fi(t,e,this.changes,5);}}]);}();gr=/*#__PURE__*/function(){function gr(t,e,i){_classCallCheck(this,gr);this.from=t,this.to=e,this.size=i;}return _createClass(gr,[{key:"draw",value:function draw(t,e){return ni.replace({widget:new wr(this.size*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to);}}],[{key:"same",value:function same(t,e){if(t.length!=e.length)return!1;for(var _i97=0;_i97<t.length;_i97++){var _s87=t[_i97],_r71=e[_i97];if(_s87.from!=_r71.from||_s87.to!=_r71.to||_s87.size!=_r71.size)return!1;}return!0;}}]);}();wr=/*#__PURE__*/function(_si3){function wr(t,e){var _this32;_classCallCheck(this,wr);_this32=_callSuper(this,wr),_this32.size=t,_this32.vertical=e;return _this32;}_inherits(wr,_si3);return _createClass(wr,[{key:"eq",value:function eq(t){return t.size==this.size&&t.vertical==this.vertical;}},{key:"toDOM",value:function toDOM(){var 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;}},{key:"estimatedHeight",get:function get(){return this.vertical?this.size:-1;}}]);}(si);br=/*#__PURE__*/function(){function br(e){var _this33=this;_classCallCheck(this,br);this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=xr,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=pi.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;var i=e.facet(Qi).some(function(t){return"function"!=typeof t&&"cm-lineWrapping"==t["class"];});this.heightOracle=new er(i),this.stateDeco=e.facet(Zi).filter(function(t){return"function"!=typeof t;}),this.heightMap=hr.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new ls(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map(function(t){return t.draw(_this33,!1);})),this.computeVisibleRanges();}return _createClass(br,[{key:"updateForViewport",value:function updateForViewport(){var _this34=this;var t=[this.viewport],e=this.state.selection.main;var _loop7=function _loop7(){var s=_i98?e.head:e.anchor;if(!t.some(function(_ref8){var t=_ref8.from,e=_ref8.to;return s>=t&&s<=e;})){var _this34$lineBlockAt=_this34.lineBlockAt(s),_e111=_this34$lineBlockAt.from,_i99=_this34$lineBlockAt.to;t.push(new vr(_e111,_i99));}};for(var _i98=0;_i98<=1;_i98++){_loop7();}this.viewports=t.sort(function(t,e){return t.from-e.from;}),this.scaler=this.heightMap.height<=7e6?xr:new Sr(this.heightOracle,this.heightMap,this.viewports);}},{key:"updateViewportLines",value:function updateViewportLines(){var _this35=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,function(t){_this35.viewportLines.push(1==_this35.scaler.scale?t:Ar(t,_this35.scaler));});}},{key:"update",value:function update(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;this.state=t.state;var i=this.stateDeco;this.stateDeco=this.state.facet(Zi).filter(function(t){return"function"!=typeof t;});var s=t.changedRanges,r=ls.extendWithRanges(s,function(t,e,i){var s=new dr();return It.compare(t,e,i,s,0),s.changes;}(i,this.stateDeco,t?t.changes:A.empty(this.state.doc.length))),n=this.heightMap.height,h=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=n&&(t.flags|=2),h?(this.scrollAnchorPos=t.changes.mapPos(h.from,-1),this.scrollAnchorHeight=h.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);var l=r.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));var o=!t.changes.empty||2&t.flags||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),o&&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(Wi)&&(this.mustEnforceCursorAssoc=!0);}},{key:"measure",value:function measure(e){var i=e.contentDOM,s=window.getComputedStyle(i),r=this.heightOracle,n=s.whiteSpace;this.defaultTextDirection="rtl"==s.direction?pi.RTL:pi.LTR;var h=this.heightOracle.mustRefreshForWrapping(n),l=i.getBoundingClientRect(),o=h||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;var u=0,f=0;if(l.width&&l.height){var _de2=de(i,l),_t124=_de2.scaleX,_e112=_de2.scaleY;(_t124>.005&&Math.abs(this.scaleX-_t124)>.005||_e112>.005&&Math.abs(this.scaleY-_e112)>.005)&&(this.scaleX=_t124,this.scaleY=_e112,u|=8,h=o=!0);}var a=(parseInt(s.paddingTop)||0)*this.scaleY,c=(parseInt(s.paddingBottom)||0)*this.scaleY;this.paddingTop==a&&this.paddingBottom==c||(this.paddingTop=a,this.paddingBottom=c,u|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(o=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=8);var d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=ye(e.scrollDOM);var p=(this.printing?mr:pr)(i,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;var w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(o=!0)),!this.inView&&!this.scrollTarget)return 0;var b=l.width;if(this.contentDOMWidth==b&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,u|=8),o){var _i100=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(_i100)&&(h=!0),h||r.lineWrapping&&Math.abs(b-this.contentDOMWidth)>r.charWidth){var _e$docView$measureTex=e.docView.measureTextSize(),_t125=_e$docView$measureTex.lineHeight,_s88=_e$docView$measureTex.charWidth,_l35=_e$docView$measureTex.textHeight;h=_t125>0&&r.refresh(n,_t125,_s88,_l35,b/_s88,_i100),h&&(e.docView.minWidth=0,u|=8);}m>0&&g>0?f=Math.max(m,g):m<0&&g<0&&(f=Math.min(m,g)),r.heightChanged=!1;var _iterator59=_createForOfIteratorHelper(this.viewports),_step59;try{for(_iterator59.s();!(_step59=_iterator59.n()).done;){var _s89=_step59.value;var _n65=_s89.from==this.viewport.from?_i100:e.docView.measureVisibleLineHeights(_s89);this.heightMap=(h?hr.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle,[new ls(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,h,new ir(_s89.from,_n65));}}catch(err){_iterator59.e(err);}finally{_iterator59.f();}r.heightChanged&&(u|=2);}var v=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return v&&(this.viewport=this.getViewport(f,this.scrollTarget)),this.updateForViewport(),(2&u||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(h?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u;}},{key:"visibleTop",get:function get(){return this.scaler.fromDOM(this.pixelViewport.top);}},{key:"visibleBottom",get:function get(){return this.scaler.fromDOM(this.pixelViewport.bottom);}},{key:"getViewport",value:function getViewport(t,e){var i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,r=this.heightOracle,n=this.visibleTop,h=this.visibleBottom,l=new vr(s.lineAt(n-1e3*i,rr.ByHeight,r,0,0).from,s.lineAt(h+1e3*(1-i),rr.ByHeight,r,0,0).to);if(e){var _t126=e.range.head;if(_t126<l.from||_t126>l.to){var _i101,_n66=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),_h36=s.lineAt(_t126,rr.ByPos,r,0,0);_i101="center"==e.y?(_h36.top+_h36.bottom)/2-_n66/2:"start"==e.y||"nearest"==e.y&&_t126<l.from?_h36.top:_h36.bottom-_n66,l=new vr(s.lineAt(_i101-500,rr.ByHeight,r,0,0).from,s.lineAt(_i101+_n66+500,rr.ByHeight,r,0,0).to);}}return l;}},{key:"mapViewport",value:function mapViewport(t,e){var i=e.mapPos(t.from,-1),s=e.mapPos(t.to,1);return new vr(this.heightMap.lineAt(i,rr.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,rr.ByPos,this.heightOracle,0,0).to);}},{key:"viewportIsAppropriate",value:function viewportIsAppropriate(_ref9){var t=_ref9.from,e=_ref9.to;var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(!this.inView)return!0;var _this$heightMap$lineA=this.heightMap.lineAt(t,rr.ByPos,this.heightOracle,0,0),s=_this$heightMap$lineA.top,_this$heightMap$lineA2=this.heightMap.lineAt(e,rr.ByPos,this.heightOracle,0,0),r=_this$heightMap$lineA2.bottom,n=this.visibleTop,h=this.visibleBottom;return(0==t||s<=n-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||r>=h+Math.max(10,Math.min(i,250)))&&s>n-2e3&&r<h+2e3;}},{key:"mapLineGaps",value:function mapLineGaps(t,e){if(!t.length||e.empty)return t;var i=[];var _iterator60=_createForOfIteratorHelper(t),_step60;try{for(_iterator60.s();!(_step60=_iterator60.n()).done;){var _s90=_step60.value;e.touchesRange(_s90.from,_s90.to)||i.push(new gr(e.mapPos(_s90.from),e.mapPos(_s90.to),_s90.size));}}catch(err){_iterator60.e(err);}finally{_iterator60.f();}return i;}},{key:"ensureLineGaps",value:function ensureLineGaps(t,e){var _this36=this;var i=this.heightOracle.lineWrapping,s=i?1e4:2e3,r=s>>1,n=s<<1;if(this.defaultTextDirection!=pi.LTR&&!i)return[];var h=[],l=function l(s,n,o,u){if(n-s<r)return;var f=_this36.state.selection.main,a=[f.from];f.empty||a.push(f.to);for(var _i102=0,_a11=a;_i102<_a11.length;_i102++){var _t127=_a11[_i102];if(_t127>s&&_t127<n)return l(s,_t127-10,o,u),void l(_t127+10,n,o,u);}var c=function(t,e){var _iterator61=_createForOfIteratorHelper(t),_step61;try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){var _i103=_step61.value;if(e(_i103))return _i103;}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}return;}(t,function(t){return t.from>=o.from&&t.to<=o.to&&Math.abs(t.from-s)<r&&Math.abs(t.to-n)<r&&!a.some(function(e){return t.from<e&&t.to>e;});});if(!c){if(n<o.to&&e&&i&&e.visibleRanges.some(function(t){return t.from<=n&&t.to>=n;})){var _t128=e.moveToLineBoundary(B.cursor(n),!1,!0).head;_t128>s&&(n=_t128);}c=new gr(s,n,_this36.gapSize(o,s,n,u));}h.push(c);};var _iterator62=_createForOfIteratorHelper(this.viewportLines),_step62;try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){var _t129=_step62.value;if(_t129.length<n)continue;var _e113=kr(_t129.from,_t129.to,this.stateDeco);if(_e113.total<n)continue;var _r72=void 0,_h37=void 0,_o29=this.scrollTarget?this.scrollTarget.range.head:null;if(i){var _i104=void 0,_n67=void 0,_l36=s/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=_o29){var _s91=Mr(_e113,_o29),_r73=((this.visibleBottom-this.visibleTop)/2+_l36)/_t129.height;_i104=_s91-_r73,_n67=_s91+_r73;}else _i104=(this.visibleTop-_t129.top-_l36)/_t129.height,_n67=(this.visibleBottom-_t129.top+_l36)/_t129.height;_r72=yr(_e113,_i104),_h37=yr(_e113,_n67);}else{var _t130=void 0,_i105=void 0,_n68=_e113.total*this.heightOracle.charWidth,_l37=s*this.heightOracle.charWidth;if(null!=_o29){var _s92=Mr(_e113,_o29),_r74=((this.pixelViewport.right-this.pixelViewport.left)/2+_l37)/_n68;_t130=_s92-_r74,_i105=_s92+_r74;}else _t130=(this.pixelViewport.left-_l37)/_n68,_i105=(this.pixelViewport.right+_l37)/_n68;_r72=yr(_e113,_t130),_h37=yr(_e113,_i105);}_r72>_t129.from&&l(_t129.from,_r72,_t129,_e113),_h37<_t129.to&&l(_h37,_t129.to,_t129,_e113);}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}return h;}},{key:"gapSize",value:function gapSize(t,e,i,s){var r=Mr(s,i)-Mr(s,e);return this.heightOracle.lineWrapping?t.height*r:s.total*this.heightOracle.charWidth*r;}},{key:"updateLineGaps",value:function updateLineGaps(t){var _this37=this;gr.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=ni.set(t.map(function(t){return t.draw(_this37,_this37.heightOracle.lineWrapping);})));}},{key:"computeVisibleRanges",value:function computeVisibleRanges(){var t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));var e=[];It.spans(t,this.viewport.from,this.viewport.to,{span:function span(t,i){e.push({from:t,to:i});},point:function point(){}},20);var i=e.length!=this.visibleRanges.length||this.visibleRanges.some(function(t,i){return t.from!=e[i].from||t.to!=e[i].to;});return this.visibleRanges=e,i?4:0;}},{key:"lineBlockAt",value:function lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(function(e){return e.from<=t&&e.to>=t;})||Ar(this.heightMap.lineAt(t,rr.ByPos,this.heightOracle,0,0),this.scaler);}},{key:"lineBlockAtHeight",value:function lineBlockAtHeight(t){return Ar(this.heightMap.lineAt(this.scaler.fromDOM(t),rr.ByHeight,this.heightOracle,0,0),this.scaler);}},{key:"scrollAnchorAt",value:function scrollAnchorAt(t){var e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0];}},{key:"elementAtHeight",value:function elementAtHeight(t){return Ar(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler);}},{key:"docHeight",get:function get(){return this.scaler.toDOM(this.heightMap.height);}},{key:"contentHeight",get:function get(){return this.docHeight+this.paddingTop+this.paddingBottom;}}]);}();vr=/*#__PURE__*/_createClass(function vr(t,e){_classCallCheck(this,vr);this.from=t,this.to=e;});xr={toDOM:function toDOM(t){return t;},fromDOM:function fromDOM(t){return t;},scale:1};Sr=/*#__PURE__*/function(){function Sr(t,e,i){_classCallCheck(this,Sr);var s=0,r=0,n=0;this.viewports=i.map(function(_ref11){var i=_ref11.from,r=_ref11.to;var n=e.lineAt(i,rr.ByPos,t,0,0).top,h=e.lineAt(r,rr.ByPos,t,0,0).bottom;return s+=h-n,{from:i,to:r,top:n,bottom:h,domTop:0,domBottom:0};}),this.scale=(7e6-s)/(e.height-s);var _iterator64=_createForOfIteratorHelper(this.viewports),_step64;try{for(_iterator64.s();!(_step64=_iterator64.n()).done;){var _t132=_step64.value;_t132.domTop=n+(_t132.top-r)*this.scale,n=_t132.domBottom=_t132.domTop+(_t132.bottom-_t132.top),r=_t132.bottom;}}catch(err){_iterator64.e(err);}finally{_iterator64.f();}}return _createClass(Sr,[{key:"toDOM",value:function toDOM(t){for(var _e114=0,_i107=0,_s94=0;;_e114++){var _r77=_e114<this.viewports.length?this.viewports[_e114]:null;if(!_r77||t<_r77.top)return _s94+(t-_i107)*this.scale;if(t<=_r77.bottom)return _r77.domTop+(t-_r77.top);_i107=_r77.bottom,_s94=_r77.domBottom;}}},{key:"fromDOM",value:function fromDOM(t){for(var _e115=0,_i108=0,_s95=0;;_e115++){var _r78=_e115<this.viewports.length?this.viewports[_e115]:null;if(!_r78||t<_r78.domTop)return _i108+(t-_s95)/this.scale;if(t<=_r78.domBottom)return _r78.top+(t-_r78.domTop);_i108=_r78.bottom,_s95=_r78.domBottom;}}}]);}();Cr=$.define({combine:function combine(t){return t.join(" ");}});Dr=$.define({combine:function combine(t){return t.indexOf(!0)>-1;}});Or=Gt.newName();Er=Gt.newName();Ir=Gt.newName();Rr={"&light":"."+Er,"&dark":"."+Ir};Br=Tr("."+Or,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Rr);Lr="￿";Nr=/*#__PURE__*/function(){function Nr(t,e){_classCallCheck(this,Nr);this.points=t,this.text="",this.lineSeparator=e.facet(St.lineSeparator);}return _createClass(Nr,[{key:"append",value:function append(t){this.text+=t;}},{key:"lineBreak",value:function lineBreak(){this.text+=Lr;}},{key:"readRange",value:function readRange(t,e){if(!t)return this;var i=t.parentNode;for(var _s96=t;;){this.findPointBefore(i,_s96);var _t133=this.text.length;this.readNode(_s96);var _r79=_s96.nextSibling;if(_r79==e)break;var _n70=Ce.get(_s96),_h38=Ce.get(_r79);(_n70&&_h38?_n70.breakAfter:(_n70?_n70.breakAfter:oe(_s96))||oe(_r79)&&("BR"!=_s96.nodeName||_s96.cmIgnore)&&this.text.length>_t133)&&this.lineBreak(),_s96=_r79;}return this.findPointBefore(i,e),this;}},{key:"readTextNode",value:function readTextNode(t){var e=t.nodeValue;var _iterator65=_createForOfIteratorHelper(this.points),_step65;try{for(_iterator65.s();!(_step65=_iterator65.n()).done;){var _i110=_step65.value;_i110.node==t&&(_i110.pos=this.text.length+Math.min(_i110.offset,e.length));}}catch(err){_iterator65.e(err);}finally{_iterator65.f();}for(var _i109=0,_s97=this.lineSeparator?null:/\r\n?|\n/g;;){var _r80=void 0,_n71=-1,_h39=1;if(this.lineSeparator?(_n71=e.indexOf(this.lineSeparator,_i109),_h39=this.lineSeparator.length):(_r80=_s97.exec(e))&&(_n71=_r80.index,_h39=_r80[0].length),this.append(e.slice(_i109,_n71<0?e.length:_n71)),_n71<0)break;if(this.lineBreak(),_h39>1){var _iterator66=_createForOfIteratorHelper(this.points),_step66;try{for(_iterator66.s();!(_step66=_iterator66.n()).done;){var _e116=_step66.value;_e116.node==t&&_e116.pos>this.text.length&&(_e116.pos-=_h39-1);}}catch(err){_iterator66.e(err);}finally{_iterator66.f();}}_i109=_n71+_h39;}}},{key:"readNode",value:function readNode(t){if(t.cmIgnore)return;var e=Ce.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(var _t134=i.iter();!_t134.next().done;)_t134.lineBreak?this.lineBreak():this.append(_t134.value);}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null);}},{key:"findPointBefore",value:function findPointBefore(t,e){var _iterator67=_createForOfIteratorHelper(this.points),_step67;try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){var _i111=_step67.value;_i111.node==t&&t.childNodes[_i111.offset]==e&&(_i111.pos=this.text.length);}}catch(err){_iterator67.e(err);}finally{_iterator67.f();}}},{key:"findPointInside",value:function findPointInside(t,e){var _iterator68=_createForOfIteratorHelper(this.points),_step68;try{for(_iterator68.s();!(_step68=_iterator68.n()).done;){var _i112=_step68.value;(3==t.nodeType?_i112.node==t:t.contains(_i112.node))&&(_i112.pos=this.text.length+($r(t,_i112.node,_i112.offset)?e:0));}}catch(err){_iterator68.e(err);}finally{_iterator68.f();}}}]);}();jr=/*#__PURE__*/_createClass(function jr(t,e){_classCallCheck(this,jr);this.node=t,this.offset=e,this.pos=-1;});zr=/*#__PURE__*/_createClass(function zr(t,e,i,s){_classCallCheck(this,zr);this.typeOver=s,this.bounds=null,this.text="";var _t$docView=t.docView,r=_t$docView.impreciseHead,n=_t$docView.impreciseAnchor;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){var _e117=r||n?[]:function(t){var e=[];if(t.root.activeElement!=t.contentDOM)return e;var _t$observer$selection2=t.observer.selectionRange,i=_t$observer$selection2.anchorNode,s=_t$observer$selection2.anchorOffset,r=_t$observer$selection2.focusNode,n=_t$observer$selection2.focusOffset;i&&(e.push(new jr(i,s)),r==i&&n==s||e.push(new jr(r,n)));return e;}(t),_i113=new Nr(_e117,t.state);_i113.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=_i113.text,this.newSel=function(t,e){if(0==t.length)return null;var i=t[0].pos,s=2==t.length?t[1].pos:i;return i>-1&&s>-1?B.single(i+e,s+e):null;}(_e117,this.bounds.from);}else{var _e118=t.observer.selectionRange,_i114=r&&r.node==_e118.focusNode&&r.offset==_e118.focusOffset||!se(t.contentDOM,_e118.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(_e118.focusNode,_e118.focusOffset),_s98=n&&n.node==_e118.anchorNode&&n.offset==_e118.anchorOffset||!se(t.contentDOM,_e118.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(_e118.anchorNode,_e118.anchorOffset),_h40=t.viewport;if((Ve.ios||Ve.chrome)&&t.state.selection.main.empty&&_i114!=_s98&&(_h40.from>0||_h40.to<t.state.doc.length)){var _e119=Math.min(_i114,_s98),_r81=Math.max(_i114,_s98),_n72=_h40.from-_e119,_l38=_h40.to-_r81;0!=_n72&&1!=_n72&&0!=_e119||0!=_l38&&-1!=_l38&&_r81!=t.state.doc.length||(_i114=0,_s98=t.state.doc.length);}this.newSel=B.single(_s98,_i114);}});Hr={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0};Wr=Ve.ie&&Ve.ie_version<=11;Vr=/*#__PURE__*/function(){function Vr(t){var _this38=this;_classCallCheck(this,Vr);this.view=t,this.active=!1,this.selectionRange=new pe(),this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(function(e){var _iterator69=_createForOfIteratorHelper(e),_step69;try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){var _t138=_step69.value;_this38.queue.push(_t138);}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}(Ve.ie&&Ve.ie_version<=11||Ve.ios&&t.composing)&&e.some(function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length;})?_this38.flushSoon():_this38.flush();}),Wr&&(this.onCharData=function(t){_this38.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),_this38.flushSoon();}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(function(){var t;(null===(t=_this38.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&_this38.onResize();}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(function(t){_this38.parentCheck<0&&(_this38.parentCheck=setTimeout(_this38.listenForScroll.bind(_this38),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=_this38.intersecting&&(_this38.intersecting=!_this38.intersecting,_this38.intersecting!=_this38.view.inView&&_this38.onScrollChanged(document.createEvent("Event")));},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(function(t){t.length>0&&t[t.length-1].intersectionRatio>0&&_this38.onScrollChanged(document.createEvent("Event"));},{})),this.listenForScroll(),this.readSelectionRange();}return _createClass(Vr,[{key:"onScrollChanged",value:function onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure();}},{key:"onScroll",value:function onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t);}},{key:"onResize",value:function onResize(){var _this39=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(function(){_this39.resizeTimeout=-1,_this39.view.requestMeasure();},50));}},{key:"onPrint",value:function onPrint(t){var _this40=this;("change"!=t.type||t.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(function(){_this40.view.viewState.printing=!1,_this40.view.requestMeasure();},500));}},{key:"updateGaps",value:function updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some(function(e,i){return e!=t[i];}))){this.gapIntersection.disconnect();var _iterator70=_createForOfIteratorHelper(t),_step70;try{for(_iterator70.s();!(_step70=_iterator70.n()).done;){var _e120=_step70.value;this.gapIntersection.observe(_e120);}}catch(err){_iterator70.e(err);}finally{_iterator70.f();}this.gaps=t;}}},{key:"onSelectionChange",value:function onSelectionChange(t){var e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;var i=this.view,s=this.selectionRange;if(i.state.facet(Ji)?i.root.activeElement!=this.dom:!re(i.dom,s))return;var r=s.anchorNode&&i.docView.nearest(s.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(Ve.ie&&Ve.ie_version<=11||Ve.android&&Ve.chrome)&&!i.state.selection.main.empty&&s.focusNode&&he(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1);}},{key:"readSelectionRange",value:function readSelectionRange(){var t=this.view,e=ie(t.root);if(!e)return!1;var i=Ve.safari&&11==t.root.nodeType&&function(t){var e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e;}(this.dom.ownerDocument)==this.dom&&function(t,e){if(e.getComposedRanges){var _i118=e.getComposedRanges(t.root)[0];if(_i118)return qr(t,_i118);}var i=null;function s(t){t.preventDefault(),t.stopImmediatePropagation(),i=t.getTargetRanges()[0];}return t.contentDOM.addEventListener("beforeinput",s,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",s,!0),i?qr(t,i):null;}(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;var s=re(this.dom,i);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){var i=e.focusNode,s=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=s)return!1;for(s=Math.min(s,fe(i));;)if(s){if(1!=i.nodeType)return!1;var _t139=i.childNodes[s-1];"false"==_t139.contentEditable?s--:(i=_t139,s=fe(i));}else{if(i==t)return!0;s=le(i),i=i.parentNode;}}(this.dom,i)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(i),s&&(this.selectionChanged=!0),!0);}},{key:"setSelectionRange",value:function setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1;}},{key:"clearSelectionRange",value:function clearSelectionRange(){this.selectionRange.set(null,0,null,0);}},{key:"listenForScroll",value:function listenForScroll(){this.parentCheck=-1;var t=0,e=null;for(var _i119=this.dom;_i119;)if(1==_i119.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==_i119?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(_i119),_i119=_i119.assignedSlot||_i119.parentNode;else{if(11!=_i119.nodeType)break;_i119=_i119.host;}if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){var _iterator71=_createForOfIteratorHelper(this.scrollTargets),_step71;try{for(_iterator71.s();!(_step71=_iterator71.n()).done;){var _t140=_step71.value;_t140.removeEventListener("scroll",this.onScroll);}}catch(err){_iterator71.e(err);}finally{_iterator71.f();}var _iterator72=_createForOfIteratorHelper(this.scrollTargets=e),_step72;try{for(_iterator72.s();!(_step72=_iterator72.n()).done;){var _t141=_step72.value;_t141.addEventListener("scroll",this.onScroll);}}catch(err){_iterator72.e(err);}finally{_iterator72.f();}}}},{key:"ignore",value:function ignore(t){if(!this.active)return t();try{return this.stop(),t();}finally{this.start(),this.clear();}}},{key:"start",value:function start(){this.active||(this.observer.observe(this.dom,Hr),Wr&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0);}},{key:"stop",value:function stop(){this.active&&(this.active=!1,this.observer.disconnect(),Wr&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData));}},{key:"clear",value:function clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1;}},{key:"delayAndroidKey",value:function delayAndroidKey(t,e){var _this41=this;var i;if(!this.delayedAndroidKey){var _t142=function _t142(){var t=_this41.delayedAndroidKey;if(t){_this41.clearDelayedAndroidKey(),_this41.view.inputState.lastKeyCode=t.keyCode,_this41.view.inputState.lastKeyTime=Date.now(),!_this41.flush()&&t.force&&ve(_this41.dom,t.key,t.keyCode);}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(_t142);}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)});}},{key:"clearDelayedAndroidKey",value:function clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1;}},{key:"flushSoon",value:function flushSoon(){var _this42=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(function(){_this42.delayedFlush=-1,_this42.flush();}));}},{key:"forceFlush",value:function forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush();}},{key:"pendingRecords",value:function pendingRecords(){var _iterator73=_createForOfIteratorHelper(this.observer.takeRecords()),_step73;try{for(_iterator73.s();!(_step73=_iterator73.n()).done;){var _t143=_step73.value;this.queue.push(_t143);}}catch(err){_iterator73.e(err);}finally{_iterator73.f();}return this.queue;}},{key:"processRecords",value:function processRecords(){var t=this.pendingRecords();t.length&&(this.queue=[]);var e=-1,i=-1,s=!1;var _iterator74=_createForOfIteratorHelper(t),_step74;try{for(_iterator74.s();!(_step74=_iterator74.n()).done;){var _t145;var _r83=_step74.value;var _t144=this.readMutation(_r83);_t144&&(_t144.typeOver&&(s=!0),-1==e?(_t145=_t144,e=_t145.from,i=_t145.to,_t145):(e=Math.min(_t144.from,e),i=Math.max(_t144.to,i)));}}catch(err){_iterator74.e(err);}finally{_iterator74.f();}return{from:e,to:i,typeOver:s};}},{key:"readChange",value:function readChange(){var _this$processRecords=this.processRecords(),t=_this$processRecords.from,e=_this$processRecords.to,i=_this$processRecords.typeOver,s=this.selectionChanged&&re(this.dom,this.selectionRange);if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;var r=new zr(this.view,t,e,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r;}},{key:"flush",value:function flush(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();var e=this.readChange();if(!e)return this.view.requestMeasure(),!1;var i=this.view.state,s=Pr(this.view,e);return this.view.state==i&&this.view.update([]),s;}},{key:"readMutation",value:function readMutation(t){var e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){var _i120=Fr(e,t.previousSibling||t.target.previousSibling,-1),_s99=Fr(e,t.nextSibling||t.target.nextSibling,1);return{from:_i120?e.posAfter(_i120):e.posAtStart,to:_s99?e.posBefore(_s99):e.posAtEnd,typeOver:!1};}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null;}},{key:"setWindow",value:function setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win));}},{key:"addWindowListeners",value:function addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange);}},{key:"removeWindowListeners",value:function removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange);}},{key:"destroy",value:function destroy(){var t,e,i;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect();var _iterator75=_createForOfIteratorHelper(this.scrollTargets),_step75;try{for(_iterator75.s();!(_step75=_iterator75.n()).done;){var _t146=_step75.value;_t146.removeEventListener("scroll",this.onScroll);}}catch(err){_iterator75.e(err);}finally{_iterator75.f();}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey);}}]);}();_export("E",Ur=/*#__PURE__*/function(){function Ur(){var _this43=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,Ur);this.plugins=[],this.pluginMap=new Map(),this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);var e=t.dispatch;this.dispatchTransactions=t.dispatchTransactions||e&&function(t){return t.forEach(function(t){return e(t,_this43);});}||function(t){return _this43.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 br(t.state||St.create(t)),t.scrollTo&&t.scrollTo.is(qi)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ki).map(function(t){return new Xi(t);});var _iterator76=_createForOfIteratorHelper(this.plugins),_step76;try{for(_iterator76.s();!(_step76=_iterator76.n()).done;){var _t147=_step76.value;_t147.update(this);}}catch(err){_iterator76.e(err);}finally{_iterator76.f();}this.observer=new Vr(this),this.inputState=new Cs(this),this.inputState.ensureHandlers(this.plugins),this.docView=new us(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure();}return _createClass(Ur,[{key:"state",get:function get(){return this.viewState.state;}},{key:"viewport",get:function get(){return this.viewState.viewport;}},{key:"visibleRanges",get:function get(){return this.viewState.visibleRanges;}},{key:"inView",get:function get(){return this.viewState.inView;}},{key:"composing",get:function get(){return this.inputState.composing>0;}},{key:"compositionStarted",get:function get(){return this.inputState.composing>=0;}},{key:"root",get:function get(){return this._root;}},{key:"win",get:function get(){return this.dom.ownerDocument.defaultView||window;}},{key:"dispatch",value:function dispatch(){var _this$state;for(var _len3=arguments.length,t=new Array(_len3),_key3=0;_key3<_len3;_key3++){t[_key3]=arguments[_key3];}var e=1==t.length&&t[0]instanceof dt?t:1==t.length&&Array.isArray(t[0])?t[0]:[(_this$state=this.state).update.apply(_this$state,t)];this.dispatchTransactions(e,this);}},{key:"update",value:function update(t){var _this44=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");var e,i=!1,s=!1,r=this.state;var _iterator77=_createForOfIteratorHelper(t),_step77;try{for(_iterator77.s();!(_step77=_iterator77.n()).done;){var _e122=_step77.value;if(_e122.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=_e122.state;}}catch(err){_iterator77.e(err);}finally{_iterator77.f();}if(this.destroyed)return void(this.viewState.state=r);var n=this.hasFocus,h=0,l=null;t.some(function(t){return t.annotation(Xs);})?(this.inputState.notifiedFocused=n,h=1):n!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=n,l=Ys(r,n),l||(h=1));var o=this.observer.delayedAndroidKey,u=null;if(o?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(u=null)):this.observer.clear(),r.facet(St.phrases)!=this.state.facet(St.phrases))return this.setState(r);e=os.create(this,r,t),e.flags|=h;var f=this.viewState.scrollTarget;try{this.updateState=2;var _iterator78=_createForOfIteratorHelper(t),_step78;try{for(_iterator78.s();!(_step78=_iterator78.n()).done;){var _e121=_step78.value;if(f&&(f=f.map(_e121.changes)),_e121.scrollIntoView){var _t148=_e121.state.selection.main;f=new Fi(_t148.empty?_t148:B.cursor(_t148.head,_t148.head>_t148.anchor?-1:1));}var _iterator79=_createForOfIteratorHelper(_e121.effects),_step79;try{for(_iterator79.s();!(_step79=_iterator79.n()).done;){var _t149=_step79.value;_t149.is(qi)&&(f=_t149.value.clip(this.state));}}catch(err){_iterator79.e(err);}finally{_iterator79.f();}}}catch(err){_iterator78.e(err);}finally{_iterator78.f();}this.viewState.update(e,f),this.bidiCache=Kr.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(hs)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(i,t.some(function(t){return t.isUserEvent("select.pointer");}));}finally{this.updateState=0;}if(e.startState.facet(Cr)!=e.state.facet(Cr)&&(this.viewState.mustMeasureContent=!0),(i||s||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!e.empty){var _iterator80=_createForOfIteratorHelper(this.state.facet(ji)),_step80;try{for(_iterator80.s();!(_step80=_iterator80.n()).done;){var _t150=_step80.value;try{_t150(e);}catch(t){Ui(this.state,t,"update listener");}}}catch(err){_iterator80.e(err);}finally{_iterator80.f();}}(l||u)&&Promise.resolve().then(function(){l&&_this44.state==l.startState&&_this44.dispatch(l),u&&!Pr(_this44,u)&&o.force&&ve(_this44.contentDOM,o.key,o.keyCode);});}},{key:"setState",value:function 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;var e=this.hasFocus;try{var _iterator81=_createForOfIteratorHelper(this.plugins),_step81;try{for(_iterator81.s();!(_step81=_iterator81.n()).done;){var _t151=_step81.value;_t151.destroy(this);}}catch(err){_iterator81.e(err);}finally{_iterator81.f();}this.viewState=new br(t),this.plugins=t.facet(Ki).map(function(t){return new Xi(t);}),this.pluginMap.clear();var _iterator82=_createForOfIteratorHelper(this.plugins),_step82;try{for(_iterator82.s();!(_step82=_iterator82.n()).done;){var _t152=_step82.value;_t152.update(this);}}catch(err){_iterator82.e(err);}finally{_iterator82.f();}this.docView.destroy(),this.docView=new us(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[];}finally{this.updateState=0;}e&&this.focus(),this.requestMeasure();}},{key:"updatePlugins",value:function updatePlugins(t){var e=t.startState.facet(Ki),i=t.state.facet(Ki);if(e!=i){var _s101=[];var _iterator83=_createForOfIteratorHelper(i),_step83;try{for(_iterator83.s();!(_step83=_iterator83.n()).done;){var _r85=_step83.value;var _i121=e.indexOf(_r85);if(_i121<0)_s101.push(new Xi(_r85));else{var _e123=this.plugins[_i121];_e123.mustUpdate=t,_s101.push(_e123);}}}catch(err){_iterator83.e(err);}finally{_iterator83.f();}var _iterator84=_createForOfIteratorHelper(this.plugins),_step84;try{for(_iterator84.s();!(_step84=_iterator84.n()).done;){var _e124=_step84.value;_e124.mustUpdate!=t&&_e124.destroy(this);}}catch(err){_iterator84.e(err);}finally{_iterator84.f();}this.plugins=_s101,this.pluginMap.clear();}else{var _iterator85=_createForOfIteratorHelper(this.plugins),_step85;try{for(_iterator85.s();!(_step85=_iterator85.n()).done;){var _e125=_step85.value;_e125.mustUpdate=t;}}catch(err){_iterator85.e(err);}finally{_iterator85.f();}}for(var _t153=0;_t153<this.plugins.length;_t153++)this.plugins[_t153].update(this);e!=i&&this.inputState.ensureHandlers(this.plugins);}},{key:"docViewUpdate",value:function docViewUpdate(){var _iterator86=_createForOfIteratorHelper(this.plugins),_step86;try{for(_iterator86.s();!(_step86=_iterator86.n()).done;){var _t154=_step86.value;var _e126=_t154.value;if(_e126&&_e126.docViewUpdate)try{_e126.docViewUpdate(this);}catch(t){Ui(this.state,t,"doc view update listener");}}}catch(err){_iterator86.e(err);}finally{_iterator86.f();}}},{key:"measure",value:function measure(){var _this45=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();var e=null,i=this.scrollDOM,s=i.scrollTop*this.scaleY,_this$viewState=this.viewState,r=_this$viewState.scrollAnchorPos,n=_this$viewState.scrollAnchorHeight;Math.abs(s-this.viewState.scrollTop)>1&&(n=-1),this.viewState.scrollAnchorHeight=-1;try{for(var _t155=0;;_t155++){var _ref13;if(n<0)if(ye(i))r=-1,n=this.viewState.heightMap.height;else{var _t156=this.viewState.scrollAnchorAt(s);r=_t156.from,n=_t156.top;}this.updateState=1;var _h43=this.viewState.measure(this);if(!_h43&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(_t155>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break;}var _l42=[];4&_h43||(_ref13=[_l42,this.measureRequests],this.measureRequests=_ref13[0],_l42=_ref13[1],_ref13);var _o32=_l42.map(function(t){try{return t.read(_this45);}catch(t){return Ui(_this45.state,t),Gr;}}),_u35=os.create(this,this.state,[]),_f19=!1;_u35.flags|=_h43,e?e.flags|=_h43:e=_u35,this.updateState=2,_u35.empty||(this.updatePlugins(_u35),this.inputState.update(_u35),this.updateAttrs(),_f19=this.docView.update(_u35),_f19&&this.docViewUpdate());for(var _t157=0;_t157<_l42.length;_t157++)if(_o32[_t157]!=Gr)try{var _e127=_l42[_t157];_e127.write&&_e127.write(_o32[_t157],this);}catch(t){Ui(this.state,t);}if(_f19&&this.docView.updateSelection(!0),!_u35.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,n=-1;continue;}{var _t158=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-n;if(_t158>1||_t158<-1){s+=_t158,i.scrollTop=s/this.scaleY,n=-1;continue;}}}break;}}}finally{this.updateState=0,this.measureScheduled=-1;}if(e&&!e.empty){var _iterator87=_createForOfIteratorHelper(this.state.facet(ji)),_step87;try{for(_iterator87.s();!(_step87=_iterator87.n()).done;){var _t159=_step87.value;_t159(e);}}catch(err){_iterator87.e(err);}finally{_iterator87.f();}}}},{key:"themeClasses",get:function get(){return Or+" "+(this.state.facet(Dr)?Ir:Er)+" "+this.state.facet(Cr);}},{key:"updateAttrs",value:function updateAttrs(){var _this46=this;var t=_r(this,Yi,{"class":"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Ji)?"true":"false","class":"cm-content",style:"".concat(Ve.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),_r(this,Qi,e);var i=this.observer.ignore(function(){var i=Ze(_this46.contentDOM,_this46.contentAttrs,e),s=Ze(_this46.dom,_this46.editorAttrs,t);return i||s;});return this.editorAttrs=t,this.contentAttrs=e,i;}},{key:"showAnnouncements",value:function showAnnouncements(t){var e=!0;var _iterator88=_createForOfIteratorHelper(t),_step88;try{for(_iterator88.s();!(_step88=_iterator88.n()).done;){var _i122=_step88.value;var _iterator89=_createForOfIteratorHelper(_i122.effects),_step89;try{for(_iterator89.s();!(_step89=_iterator89.n()).done;){var _t160=_step89.value;if(_t160.is(Ur.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=_t160.value;}}}catch(err){_iterator89.e(err);}finally{_iterator89.f();}}}catch(err){_iterator88.e(err);}finally{_iterator88.f();}}},{key:"mountStyles",value:function mountStyles(){this.styleModules=this.state.facet(hs);var t=this.state.facet(Ur.cspNonce);Gt.mount(this.root,this.styleModules.concat(Br).reverse(),t?{nonce:t}:void 0);}},{key:"readMeasured",value:function 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);}},{key:"requestMeasure",value:function requestMeasure(t){var _this47=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(function(){return _this47.measure();})),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(var _e128=0;_e128<this.measureRequests.length;_e128++)if(this.measureRequests[_e128].key===t.key)return void(this.measureRequests[_e128]=t);this.measureRequests.push(t);}}},{key:"plugin",value:function plugin(t){var e=this.pluginMap.get(t);return(void 0===e||e&&e.spec!=t)&&this.pluginMap.set(t,e=this.plugins.find(function(e){return e.spec==t;})||null),e&&e.update(this).value;}},{key:"documentTop",get:function get(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop;}},{key:"documentPadding",get:function get(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom};}},{key:"scaleX",get:function get(){return this.viewState.scaleX;}},{key:"scaleY",get:function get(){return this.viewState.scaleY;}},{key:"elementAtHeight",value:function elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t);}},{key:"lineBlockAtHeight",value:function lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t);}},{key:"viewportLineBlocks",get:function get(){return this.viewState.viewportLines;}},{key:"lineBlockAt",value:function lineBlockAt(t){return this.viewState.lineBlockAt(t);}},{key:"contentHeight",get:function get(){return this.viewState.contentHeight;}},{key:"moveByChar",value:function moveByChar(t,e,i){return As(this,t,xs(this,t,e,i));}},{key:"moveByGroup",value:function moveByGroup(t,e){var _this48=this;return As(this,t,xs(this,t,e,function(e){return function(t,e,i){var s=t.state.charCategorizer(e),r=s(i);return function(t){var e=s(t);return r==kt.Space&&(r=e),r==e;};}(_this48,t.head,e);}));}},{key:"visualLineSide",value:function visualLineSide(t,e){var i=this.bidiSpans(t),s=this.textDirectionAt(t.from),r=i[e?i.length-1:0];return B.cursor(r.side(e,s)+t.from,r.forward(!e,s)?1:-1);}},{key:"moveToLineBoundary",value:function moveToLineBoundary(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;return function(t,e,i,s){var r=Ms(t,e.head),n=s&&r.type==ri.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(n){var _e129=t.dom.getBoundingClientRect(),_s102=t.textDirectionAt(r.from),_h44=t.posAtCoords({x:i==(_s102==pi.LTR)?_e129.right-1:_e129.left+1,y:(n.top+n.bottom)/2});if(null!=_h44)return B.cursor(_h44,i?-1:1);}return B.cursor(i?r.to:r.from,i?-1:1);}(this,t,e,i);}},{key:"moveVertically",value:function moveVertically(t,e,i){return As(this,t,function(t,e,i,s){var r=e.head,n=i?1:-1;if(r==(i?t.state.doc.length:0))return B.cursor(r,e.assoc);var h,l=e.goalColumn,o=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(r,e.assoc||-1),f=t.documentTop;if(u)null==l&&(l=u.left-o.left),h=n<0?u.top:u.bottom;else{var _e130=t.viewState.lineBlockAt(r);null==l&&(l=Math.min(o.right-o.left,t.defaultCharacterWidth*(r-_e130.from))),h=(n<0?_e130.top:_e130.bottom)+f;}var a=o.left+l,c=null!=s?s:t.viewState.heightOracle.textHeight>>1;for(var _e131=0;;_e131+=10){var _i123=h+(c+_e131)*n,_s103=ks(t,{x:a,y:_i123},!1,n);if(_i123<o.top||_i123>o.bottom||(n<0?_s103<r:_s103>r)){var _e132=t.docView.coordsForChar(_s103),_r86=!_e132||_i123<_e132.top?-1:1;return B.cursor(_s103,_r86,void 0,l);}}}(this,t,e,i));}},{key:"domAtPos",value:function domAtPos(t){return this.docView.domAtPos(t);}},{key:"posAtDOM",value:function posAtDOM(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return this.docView.posFromDOM(t,e);}},{key:"posAtCoords",value:function posAtCoords(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;return this.readMeasured(),ks(this,t,e);}},{key:"coordsAtPos",value:function coordsAtPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;this.readMeasured();var i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;var s=this.state.doc.lineAt(t),r=this.bidiSpans(s);return ae(i,r[Si.find(r,t-s.from,-1,e)].dir==pi.LTR==e>0);}},{key:"coordsForChar",value:function coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t);}},{key:"defaultCharacterWidth",get:function get(){return this.viewState.heightOracle.charWidth;}},{key:"defaultLineHeight",get:function get(){return this.viewState.heightOracle.lineHeight;}},{key:"textDirection",get:function get(){return this.viewState.defaultTextDirection;}},{key:"textDirectionAt",value:function textDirectionAt(t){return!this.state.facet(Hi)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t));}},{key:"lineWrapping",get:function get(){return this.viewState.heightOracle.lineWrapping;}},{key:"bidiSpans",value:function bidiSpans(t){if(t.length>Jr)return Ei(t.length);var e,i=this.textDirectionAt(t.from);var _iterator90=_createForOfIteratorHelper(this.bidiCache),_step90;try{for(_iterator90.s();!(_step90=_iterator90.n()).done;){var _s104=_step90.value;if(_s104.from==t.from&&_s104.dir==i&&(_s104.fresh||Ai(_s104.isolates,e=ss(this,t))))return _s104.order;}}catch(err){_iterator90.e(err);}finally{_iterator90.f();}e||(e=ss(this,t));var s=function(t,e,i){if(!t)return[new Si(0,0,e==gi?1:0)];if(e==mi&&!i.length&&!xi.test(t))return Ei(t.length);if(i.length)for(;t.length>Ci.length;)Ci[Ci.length]=256;var s=[],r=e==mi?0:1;return Oi(t,r,r,i,0,t.length,s),s;}(t.text,i,e);return this.bidiCache.push(new Kr(t.from,t.to,i,e,!0,s)),s;}},{key:"hasFocus",get:function get(){var t;return(this.dom.ownerDocument.hasFocus()||Ve.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM;}},{key:"focus",value:function focus(){var _this49=this;this.observer.ignore(function(){we(_this49.contentDOM),_this49.docView.updateSelection();});}},{key:"setRoot",value:function setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles());}},{key:"destroy",value:function destroy(){var _iterator91=_createForOfIteratorHelper(this.plugins),_step91;try{for(_iterator91.s();!(_step91=_iterator91.n()).done;){var _t161=_step91.value;_t161.destroy(this);}}catch(err){_iterator91.e(err);}finally{_iterator91.f();}this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0;}},{key:"scrollSnapshot",value:function scrollSnapshot(){var _this$scrollDOM=this.scrollDOM,t=_this$scrollDOM.scrollTop,e=_this$scrollDOM.scrollLeft,i=this.viewState.scrollAnchorAt(t);return qi.of(new Fi(B.cursor(i.from),"start","start",i.top-t,e,!0));}}],[{key:"scrollIntoView",value:function scrollIntoView(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return qi.of(new Fi("number"==typeof t?B.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin));}},{key:"domEventHandlers",value:function domEventHandlers(t){return _i.define(function(){return{};},{eventHandlers:t});}},{key:"domEventObservers",value:function domEventObservers(t){return _i.define(function(){return{};},{eventObservers:t});}},{key:"theme",value:function theme(t,e){var i=Gt.newName(),s=[Cr.of(i),hs.of(Tr(".".concat(i),t))];return e&&e.dark&&s.push(Dr.of(!0)),s;}},{key:"baseTheme",value:function baseTheme(t){return _.lowest(hs.of(Tr("."+Or,t,Rr)));}},{key:"findFromDOM",value:function findFromDOM(t){var e;var i=t.querySelector(".cm-content"),s=i&&Ce.get(i)||Ce.get(t);return(null===(e=null==s?void 0:s.rootView)||void 0===e?void 0:e.view)||null;}}]);}());Ur.styleModule=hs,Ur.inputHandler=zi,Ur.scrollHandler=Vi,Ur.focusChangeEffect=Pi,Ur.perLineTextDirection=Hi,Ur.exceptionSink=$i,Ur.updateListener=ji,Ur.editable=Ji,Ur.mouseSelectionStyle=Ni,Ur.dragMovesSelection=Li,Ur.clickAddsSelectionRange=Bi,Ur.decorations=Zi,Ur.outerDecorations=ts,Ur.atomicRanges=es,Ur.bidiIsolatedRanges=is,Ur.scrollMargins=rs,Ur.darkTheme=Dr,Ur.cspNonce=$.define({combine:function combine(t){return t.length?t[0]:"";}}),Ur.contentAttributes=Qi,Ur.editorAttributes=Yi,Ur.lineWrapping=Ur.contentAttributes.of({"class":"cm-lineWrapping"}),Ur.announce=ct.define();Jr=4096;Gr={};Kr=/*#__PURE__*/function(){function Kr(t,e,i,s,r,n){_classCallCheck(this,Kr);this.from=t,this.to=e,this.dir=i,this.isolates=s,this.fresh=r,this.order=n;}return _createClass(Kr,null,[{key:"update",value:function update(t,e){if(e.empty&&!t.some(function(t){return t.fresh;}))return t;var i=[],s=t.length?t[t.length-1].dir:pi.LTR;for(var _r87=Math.max(0,t.length-10);_r87<t.length;_r87++){var _n73=t[_r87];_n73.dir!=s||e.touchesRange(_n73.from,_n73.to)||i.push(new Kr(e.mapPos(_n73.from,1),e.mapPos(_n73.to,-1),_n73.dir,_n73.isolates,!1,_n73.order));}return i;}}]);}();Xr=Ve.mac?"mac":Ve.windows?"win":Ve.linux?"linux":"key";Qr=_["default"](Ur.domEventHandlers({keydown:function keydown(t,e){return nn(en(e.state),t,e,"editor");}}));Zr=$.define({enables:Qr});tn=new WeakMap();sn=null;rn=4e3;hn=/*#__PURE__*/function(){function hn(t,e,i,s,r){_classCallCheck(this,hn);this.className=t,this.left=e,this.top=i,this.width=s,this.height=r;}return _createClass(hn,[{key:"draw",value:function draw(){var t=document.createElement("div");return t.className=this.className,this.adjust(t),t;}},{key:"update",value:function update(t,e){return e.className==this.className&&(this.adjust(t),!0);}},{key:"adjust",value:function 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";}},{key:"eq",value:function eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className;}}],[{key:"forRange",value:function forRange(t,e,i){if(i.empty){var _s108=t.coordsAtPos(i.head,i.assoc||1);if(!_s108)return[];var _r90=ln(t);return[new hn(e,_s108.left-_r90.left,_s108.top-_r90.top,null,_s108.bottom-_s108.top)];}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];var s=Math.max(i.from,t.viewport.from),r=Math.min(i.to,t.viewport.to),n=t.textDirection==pi.LTR,h=t.contentDOM,l=h.getBoundingClientRect(),o=ln(t),u=h.querySelector(".cm-line"),f=u&&window.getComputedStyle(u),a=l.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),c=l.right-(f?parseInt(f.paddingRight):0),d=Ms(t,s),p=Ms(t,r),m=d.type==ri.Text?d:null,g=p.type==ri.Text?p:null;m&&(t.lineWrapping||d.widgetLineBreaks)&&(m=on(t,s,m));g&&(t.lineWrapping||p.widgetLineBreaks)&&(g=on(t,r,g));if(m&&g&&m.from==g.from)return b(v(i.from,i.to,m));{var _e138=m?v(i.from,null,m):k(d,!1),_s109=g?v(null,i.to,g):k(p,!0),_r91=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&_e138.bottom+t.defaultLineHeight/2<_s109.top?_r91.push(w(a,_e138.bottom,c,_s109.top)):_e138.bottom<_s109.top&&t.elementAtHeight((_e138.bottom+_s109.top)/2).type==ri.Text&&(_e138.bottom=_s109.top=(_e138.bottom+_s109.top)/2),b(_e138).concat(_r91).concat(b(_s109));}function w(t,i,s,r){return new hn(e,t-o.left,i-o.top-.01,s-t,r-i+.01);}function b(_ref14){var t=_ref14.top,e=_ref14.bottom,i=_ref14.horizontal;var s=[];for(var _r92=0;_r92<i.length;_r92+=2)s.push(w(i[_r92],t,i[_r92+1],e));return s;}function v(e,i,s){var r=1e9,h=-1e9,l=[];function o(e,i,o,u,f){var d=t.coordsAtPos(e,e==s.to?-2:2),p=t.coordsAtPos(o,o==s.from?2:-2);d&&p&&(r=Math.min(d.top,p.top,r),h=Math.max(d.bottom,p.bottom,h),f==pi.LTR?l.push(n&&i?a:d.left,n&&u?c:p.right):l.push(!n&&u?a:p.left,!n&&i?c:d.right));}var u=null!=e?e:s.from,f=null!=i?i:s.to;var _iterator96=_createForOfIteratorHelper(t.visibleRanges),_step96;try{for(_iterator96.s();!(_step96=_iterator96.n()).done;){var _s110=_step96.value;if(_s110.to>u&&_s110.from<f)for(var _r93=Math.max(_s110.from,u),_n76=Math.min(_s110.to,f);;){var _s111=t.state.doc.lineAt(_r93);var _iterator97=_createForOfIteratorHelper(t.bidiSpans(_s111)),_step97;try{for(_iterator97.s();!(_step97=_iterator97.n()).done;){var _h45=_step97.value;var _t165=_h45.from+_s111.from,_l44=_h45.to+_s111.from;if(_t165>=_n76)break;_l44>_r93&&o(Math.max(_t165,_r93),null==e&&_t165<=u,Math.min(_l44,_n76),null==i&&_l44>=f,_h45.dir);}}catch(err){_iterator97.e(err);}finally{_iterator97.f();}if(_r93=_s111.to+1,_r93>=_n76)break;}}}catch(err){_iterator96.e(err);}finally{_iterator96.f();}return 0==l.length&&o(u,null==e,f,null==i,t.textDirection),{top:r,bottom:h,horizontal:l};}function k(t,e){var i=l.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]};}}(t,e,i);}}]);}();un=/*#__PURE__*/function(){function un(t,e){_classCallCheck(this,un);this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e["class"]&&this.dom.classList.add(e["class"]),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t);}return _createClass(un,[{key:"update",value:function update(t){t.startState.facet(fn)!=t.state.facet(fn)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq));}},{key:"docViewUpdate",value:function docViewUpdate(t){!1!==this.layer.updateOnDocViewUpdate&&t.requestMeasure(this.measureReq);}},{key:"setOrder",value:function setOrder(t){var e=0,i=t.facet(fn);for(;e<i.length&&i[e]!=this.layer;)e++;this.dom.style.zIndex=String((this.layer.above?150:-1)-e);}},{key:"measure",value:function measure(){return this.layer.markers(this.view);}},{key:"scale",value:function scale(){var _this$view=this.view,t=_this$view.scaleX,e=_this$view.scaleY;t==this.scaleX&&e==this.scaleY||(this.scaleX=t,this.scaleY=e,this.dom.style.transform="scale(".concat(1/t,", ").concat(1/e,")"));}},{key:"draw",value:function draw(t){var _this50=this;if(t.length!=this.drawn.length||t.some(function(t,e){return i=t,s=_this50.drawn[e],!(i.constructor==s.constructor&&i.eq(s));var i,s;})){var _e139=this.dom.firstChild,_i124=0;var _iterator98=_createForOfIteratorHelper(t),_step98;try{for(_iterator98.s();!(_step98=_iterator98.n()).done;){var _s112=_step98.value;_s112.update&&_e139&&_s112.constructor&&this.drawn[_i124].constructor&&_s112.update(_e139,this.drawn[_i124])?(_e139=_e139.nextSibling,_i124++):this.dom.insertBefore(_s112.draw(),_e139);}}catch(err){_iterator98.e(err);}finally{_iterator98.f();}for(;_e139;){var _t166=_e139.nextSibling;_e139.remove(),_e139=_t166;}this.drawn=t;}}},{key:"destroy",value:function destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove();}}]);}();fn=$.define();cn=!Ve.ios;dn=$.define({combine:function combine(t){return At(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:function cursorBlinkRate(t,e){return Math.min(t,e);},drawRangeCursor:function drawRangeCursor(t,e){return t||e;}});}});mn=an({above:!0,markers:function markers(t){var e=t.state,i=e.facet(dn),s=[];var _iterator99=_createForOfIteratorHelper(e.selection.ranges),_step99;try{for(_iterator99.s();!(_step99=_iterator99.n()).done;){var _r94=_step99.value;var _n77=_r94==e.selection.main;if(_r94.empty?!_n77||cn:i.drawRangeCursor){var _e140=_n77?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",_i125=_r94.empty?_r94:B.cursor(_r94.head,_r94.head>_r94.anchor?-1:1);var _iterator100=_createForOfIteratorHelper(hn.forRange(t,_e140,_i125)),_step100;try{for(_iterator100.s();!(_step100=_iterator100.n()).done;){var _r95=_step100.value;s.push(_r95);}}catch(err){_iterator100.e(err);}finally{_iterator100.f();}}}}catch(err){_iterator99.e(err);}finally{_iterator99.f();}return s;},update:function update(t,e){t.transactions.some(function(t){return t.selection;})&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");var i=pn(t);return i&&gn(t.state,e),t.docChanged||t.selectionSet||i;},mount:function mount(t,e){gn(e.state,t);},"class":"cm-cursorLayer"});wn=an({above:!1,markers:function markers(t){return t.state.selection.ranges.map(function(e){return e.empty?[]:hn.forRange(t,"cm-selectionBackground",e);}).reduce(function(t,e){return t.concat(e);});},update:function update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||pn(t);},"class":"cm-selectionLayer"});bn={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};cn&&(bn[".cm-line"].caretColor="transparent !important",bn[".cm-content"]={caretColor:"transparent !important"});vn=_.highest(Ur.theme(bn));kn=ct.define({map:function map(t,e){return null==t?null:e.mapPos(t);}});yn=F.define({create:function create(){return null;},update:function update(t,e){return null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(function(t,e){return e.is(kn)?e.value:t;},t);}});Mn=_i.fromClass(/*#__PURE__*/function(){function _class(t){_classCallCheck(this,_class);this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)};}return _createClass(_class,[{key:"update",value:function update(t){var e;var i=t.state.field(yn);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(yn)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq));}},{key:"readPos",value:function readPos(){var t=this.view,e=t.state.field(yn),i=null!=e&&t.coordsAtPos(e);if(!i)return null;var s=t.scrollDOM.getBoundingClientRect();return{left:i.left-s.left+t.scrollDOM.scrollLeft*t.scaleX,top:i.top-s.top+t.scrollDOM.scrollTop*t.scaleY,height:i.bottom-i.top};}},{key:"drawCursor",value:function drawCursor(t){if(this.cursor){var _this$view2=this.view,_e141=_this$view2.scaleX,_i126=_this$view2.scaleY;t?(this.cursor.style.left=t.left/_e141+"px",this.cursor.style.top=t.top/_i126+"px",this.cursor.style.height=t.height/_i126+"px"):this.cursor.style.left="-100000px";}}},{key:"destroy",value:function destroy(){this.cursor&&this.cursor.remove();}},{key:"setDropPos",value:function setDropPos(t){this.view.state.field(yn)!=t&&this.view.dispatch({effects:kn.of(t)});}}]);}(),{eventObservers:{dragover:function dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}));},dragleave:function dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null);},dragend:function dragend(){this.setDropPos(null);},drop:function drop(){this.setDropPos(null);}}});Sn=/*#__PURE__*/function(){function Sn(t){_classCallCheck(this,Sn);var e=t.regexp,i=t.decoration,s=t.decorate,r=t.boundary,_t$maxLength=t.maxLength,n=_t$maxLength===void 0?1e3:_t$maxLength;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=function(t,e,i,r){return s(r,i,i+t[0].length,t,e);};else if("function"==typeof i)this.addMatch=function(t,e,s,r){var n=i(t,e,s);n&&r(s,s+t[0].length,n);};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,s,r){return r(s,s+t[0].length,i);};}this.boundary=r,this.maxLength=n;}return _createClass(Sn,[{key:"createDeco",value:function createDeco(t){var _this51=this;var e=new Rt(),i=e.add.bind(e);var _iterator101=_createForOfIteratorHelper(function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;var s=[];var _iterator102=_createForOfIteratorHelper(i),_step102;try{for(_iterator102.s();!(_step102=_iterator102.n()).done;){var _step102$value=_step102.value,_r96=_step102$value.from,_n79=_step102$value.to;_r96=Math.max(t.state.doc.lineAt(_r96).from,_r96-e),_n79=Math.min(t.state.doc.lineAt(_n79).to,_n79+e),s.length&&s[s.length-1].to>=_r96?s[s.length-1].to=_n79:s.push({from:_r96,to:_n79});}}catch(err){_iterator102.e(err);}finally{_iterator102.f();}return s;}(t,this.maxLength)),_step101;try{for(_iterator101.s();!(_step101=_iterator101.n()).done;){var _step101$value=_step101.value,_e142=_step101$value.from,_s113=_step101$value.to;xn(t.state.doc,this.regexp,_e142,_s113,function(e,s){return _this51.addMatch(s,t,e,i);});}}catch(err){_iterator101.e(err);}finally{_iterator101.f();}return e.finish();}},{key:"updateDeco",value:function updateDeco(t,e){var i=1e9,s=-1;return t.docChanged&&t.changes.iterChanges(function(e,r,n,h){h>t.view.viewport.from&&n<t.view.viewport.to&&(i=Math.min(n,i),s=Math.max(h,s));}),t.viewportChanged||s-i>1e3?this.createDeco(t.view):s>-1?this.updateRange(t.view,e.map(t.changes),i,s):e;}},{key:"updateRange",value:function updateRange(t,e,i,s){var _this52=this;var _iterator103=_createForOfIteratorHelper(t.visibleRanges),_step103;try{var _loop9=function _loop9(){var r=_step103.value;var n=Math.max(r.from,i),h=Math.min(r.to,s);if(h>n){var _i127=t.state.doc.lineAt(n),_s114=_i127.to<h?t.state.doc.lineAt(h):_i127,_l46=Math.max(r.from,_i127.from),_o33=Math.min(r.to,_s114.to);if(_this52.boundary){for(;n>_i127.from;n--)if(_this52.boundary.test(_i127.text[n-1-_i127.from])){_l46=n;break;}for(;h<_s114.to;h++)if(_this52.boundary.test(_s114.text[h-_s114.from])){_o33=h;break;}}var _u36,_f20=[],_a13=function _a13(t,e,i){return _f20.push(i.range(t,e));};if(_i127==_s114)for(_this52.regexp.lastIndex=_l46-_i127.from;(_u36=_this52.regexp.exec(_i127.text))&&_u36.index<_o33-_i127.from;)_this52.addMatch(_u36,t,_u36.index+_i127.from,_a13);else xn(t.state.doc,_this52.regexp,_l46,_o33,function(e,i){return _this52.addMatch(i,t,e,_a13);});e=e.update({filterFrom:_l46,filterTo:_o33,filter:function filter(t,e){return t<_l46||e>_o33;},add:_f20});}};for(_iterator103.s();!(_step103=_iterator103.n()).done;){_loop9();}}catch(err){_iterator103.e(err);}finally{_iterator103.f();}return e;}}]);}();An=null!=/x/.unicode?"gu":"g";Cn=new RegExp("[\0-\b\n-\x1F\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]",An);Dn={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"};On=null;En=$.define({combine:function combine(t){var e=At(t,{render:null,specialChars:Cn,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==On&&"undefined"!=typeof document&&document.body){var _e143=document.body.style;On=null!=(null!==(t=_e143.tabSize)&&void 0!==t?t:_e143.MozTabSize);}return On||!1;}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,An)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,An)),e;}});In=null;Rn=/*#__PURE__*/function(_si4){function Rn(t,e){var _this53;_classCallCheck(this,Rn);_this53=_callSuper(this,Rn),_this53.options=t,_this53.code=e;return _this53;}_inherits(Rn,_si4);return _createClass(Rn,[{key:"eq",value:function eq(t){return t.code==this.code;}},{key:"toDOM",value:function toDOM(t){var e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t);}(this.code),i=t.state.phrase("Control character")+" "+(Dn[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,e);if(s)return s;var r=document.createElement("span");return r.textContent=e,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);Tn=/*#__PURE__*/function(_si5){function Tn(t){var _this54;_classCallCheck(this,Tn);_this54=_callSuper(this,Tn),_this54.width=t;return _this54;}_inherits(Tn,_si5);return _createClass(Tn,[{key:"eq",value:function eq(t){return t.width==this.width;}},{key:"toDOM",value:function toDOM(){var t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);Bn=ni.line({"class":"cm-activeLine"});Ln=_i.fromClass(/*#__PURE__*/function(){function _class2(t){_classCallCheck(this,_class2);this.decorations=this.getDeco(t);}return _createClass(_class2,[{key:"update",value:function update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view));}},{key:"getDeco",value:function getDeco(t){var e=-1,i=[];var _iterator104=_createForOfIteratorHelper(t.state.selection.ranges),_step104;try{for(_iterator104.s();!(_step104=_iterator104.n()).done;){var _s115=_step104.value;var _r97=t.lineBlockAt(_s115.head);_r97.from>e&&(i.push(Bn.range(_r97.from)),e=_r97.from);}}catch(err){_iterator104.e(err);}finally{_iterator104.f();}return ni.set(i);}}]);}(),{decorations:function decorations(t){return t.decorations;}});Nn=2e3;zn={Alt:[18,function(t){return!!t.altKey;}],Control:[17,function(t){return!!t.ctrlKey;}],Shift:[16,function(t){return!!t.shiftKey;}],Meta:[91,function(t){return!!t.metaKey;}]};Pn={style:"cursor: crosshair"};Hn="-10000px";Wn=/*#__PURE__*/function(){function Wn(t,e,i,s){_classCallCheck(this,Wn);this.facet=e,this.createTooltipView=i,this.removeTooltipView=s,this.input=t.state.facet(e),this.tooltips=this.input.filter(function(t){return t;});var r=null;this.tooltipViews=this.tooltips.map(function(t){return r=i(t,r);});}return _createClass(Wn,[{key:"update",value:function update(t,e){var i;var s=t.state.facet(this.facet),r=s.filter(function(t){return t;});if(s===this.input){var _iterator105=_createForOfIteratorHelper(this.tooltipViews),_step105;try{for(_iterator105.s();!(_step105=_iterator105.n()).done;){var _e148=_step105.value;_e148.update&&_e148.update(t);}}catch(err){_iterator105.e(err);}finally{_iterator105.f();}return!1;}var n=[],h=e?[]:null;for(var _i130=0;_i130<r.length;_i130++){var _s117=r[_i130],_l49=-1;if(_s117){for(var _t167=0;_t167<this.tooltips.length;_t167++){var _e149=this.tooltips[_t167];_e149&&_e149.create==_s117.create&&(_l49=_t167);}if(_l49<0)n[_i130]=this.createTooltipView(_s117,_i130?n[_i130-1]:null),h&&(h[_i130]=!!_s117.above);else{var _s118=n[_i130]=this.tooltipViews[_l49];h&&(h[_i130]=e[_l49]),_s118.update&&_s118.update(t);}}}var _iterator106=_createForOfIteratorHelper(this.tooltipViews),_step106;try{for(_iterator106.s();!(_step106=_iterator106.n()).done;){var _t168=_step106.value;n.indexOf(_t168)<0&&(this.removeTooltipView(_t168),null===(i=_t168.destroy)||void 0===i||i.call(_t168));}}catch(err){_iterator106.e(err);}finally{_iterator106.f();}return e&&(h.forEach(function(t,i){return e[i]=t;}),e.length=h.length),this.input=s,this.tooltips=r,this.tooltipViews=n,!0;}}]);}();Fn=$.define({combine:function combine(t){var e,i,s;return{position:Ve.ios?"absolute":(null===(e=t.find(function(t){return t.position;}))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find(function(t){return t.parent;}))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(s=t.find(function(t){return t.tooltipSpace;}))||void 0===s?void 0:s.tooltipSpace)||Vn};}});qn=new WeakMap();Un=_i.fromClass(/*#__PURE__*/function(){function _class3(t){var _this55=this;_classCallCheck(this,_class3);this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;var e=t.state.facet(Fn);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(function(){return _this55.measureSoon();}):null,this.manager=new Wn(t,Kn,function(t,e){return _this55.createTooltip(t,e);},function(t){_this55.resizeObserver&&_this55.resizeObserver.unobserve(t.dom),t.dom.remove();}),this.above=this.manager.tooltips.map(function(t){return!!t.above;}),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(function(t){Date.now()>_this55.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&_this55.measureSoon();},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure();}return _createClass(_class3,[{key:"createContainer",value:function 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;}},{key:"observeIntersection",value:function observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();var _iterator107=_createForOfIteratorHelper(this.manager.tooltipViews),_step107;try{for(_iterator107.s();!(_step107=_iterator107.n()).done;){var _t169=_step107.value;this.intersectionObserver.observe(_t169.dom);}}catch(err){_iterator107.e(err);}finally{_iterator107.f();}}}},{key:"measureSoon",value:function measureSoon(){var _this56=this;this.measureTimeout<0&&(this.measureTimeout=setTimeout(function(){_this56.measureTimeout=-1,_this56.maybeMeasure();},50));}},{key:"update",value:function update(t){t.transactions.length&&(this.lastTransaction=Date.now());var e=this.manager.update(t,this.above);e&&this.observeIntersection();var i=e||t.geometryChanged,s=t.state.facet(Fn);if(s.position!=this.position&&!this.madeAbsolute){this.position=s.position;var _iterator108=_createForOfIteratorHelper(this.manager.tooltipViews),_step108;try{for(_iterator108.s();!(_step108=_iterator108.n()).done;){var _t170=_step108.value;_t170.dom.style.position=this.position;}}catch(err){_iterator108.e(err);}finally{_iterator108.f();}i=!0;}if(s.parent!=this.parent){this.parent&&this.container.remove(),this.parent=s.parent,this.createContainer();var _iterator109=_createForOfIteratorHelper(this.manager.tooltipViews),_step109;try{for(_iterator109.s();!(_step109=_iterator109.n()).done;){var _t171=_step109.value;this.container.appendChild(_t171.dom);}}catch(err){_iterator109.e(err);}finally{_iterator109.f();}i=!0;}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure();}},{key:"createTooltip",value:function createTooltip(t,e){var i=t.create(this.view),s=e?e.dom:null;if(i.dom.classList.add("cm-tooltip"),t.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){var _t172=document.createElement("div");_t172.className="cm-tooltip-arrow",i.dom.appendChild(_t172);}return i.dom.style.position=this.position,i.dom.style.top=Hn,i.dom.style.left="0px",this.container.insertBefore(i.dom,s),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i;}},{key:"destroy",value:function destroy(){var t,e,i;this.view.win.removeEventListener("resize",this.measureSoon);var _iterator110=_createForOfIteratorHelper(this.manager.tooltipViews),_step110;try{for(_iterator110.s();!(_step110=_iterator110.n()).done;){var _e150=_step110.value;_e150.dom.remove(),null===(t=_e150.destroy)||void 0===t||t.call(_e150);}}catch(err){_iterator110.e(err);}finally{_iterator110.f();}this.parent&&this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(i=this.intersectionObserver)||void 0===i||i.disconnect(),clearTimeout(this.measureTimeout);}},{key:"readMeasure",value:function readMeasure(){var _this57=this;var t=this.view.dom.getBoundingClientRect(),e=1,i=1,s=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){var _t173=this.manager.tooltipViews[0].dom;if(Ve.gecko)s=_t173.offsetParent!=this.container.ownerDocument.body;else if(_t173.style.top==Hn&&"0px"==_t173.style.left){var _e151=_t173.getBoundingClientRect();s=Math.abs(_e151.top+1e4)>1||Math.abs(_e151.left)>1;}}if(s||"absolute"==this.position)if(this.parent){var _t174=this.parent.getBoundingClientRect();_t174.width&&_t174.height&&(e=_t174.width/this.parent.offsetWidth,i=_t174.height/this.parent.offsetHeight);}else{var _this$view$viewState=this.view.viewState;e=_this$view$viewState.scaleX;i=_this$view$viewState.scaleY;}return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(function(t,e){var i=_this57.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):_this57.view.coordsAtPos(t.pos);}),size:this.manager.tooltipViews.map(function(_ref15){var t=_ref15.dom;return t.getBoundingClientRect();}),space:this.view.state.facet(Fn).tooltipSpace(this.view),scaleX:e,scaleY:i,makeAbsolute:s};}},{key:"writeMeasure",value:function writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";var _iterator111=_createForOfIteratorHelper(this.manager.tooltipViews),_step111;try{for(_iterator111.s();!(_step111=_iterator111.n()).done;){var _t175=_step111.value;_t175.dom.style.position="absolute";}}catch(err){_iterator111.e(err);}finally{_iterator111.f();}}var i=t.editor,s=t.space,r=t.scaleX,n=t.scaleY,h=[];for(var _l50=0;_l50<this.manager.tooltips.length;_l50++){var _o34=this.manager.tooltips[_l50],_u37=this.manager.tooltipViews[_l50],_f21=_u37.dom,_a14=t.pos[_l50],_c12=t.size[_l50];if(!_a14||_a14.bottom<=Math.max(i.top,s.top)||_a14.top>=Math.min(i.bottom,s.bottom)||_a14.right<Math.max(i.left,s.left)-.1||_a14.left>Math.min(i.right,s.right)+.1){_f21.style.top=Hn;continue;}var _d7=_o34.arrow?_u37.dom.querySelector(".cm-tooltip-arrow"):null,_p6=_d7?7:0,_m4=_c12.right-_c12.left,_g4=null!==(e=qn.get(_u37))&&void 0!==e?e:_c12.bottom-_c12.top,_w=_u37.offset||Gn,_b=this.view.textDirection==pi.LTR,_v=_c12.width>s.right-s.left?_b?s.left:s.right-_c12.width:_b?Math.min(_a14.left-(_d7?14:0)+_w.x,s.right-_m4):Math.max(s.left,_a14.left-_m4+(_d7?14:0)-_w.x),_k=this.above[_l50];!_o34.strictSide&&(_k?_a14.top-(_c12.bottom-_c12.top)-_w.y<s.top:_a14.bottom+(_c12.bottom-_c12.top)+_w.y>s.bottom)&&_k==s.bottom-_a14.bottom>_a14.top-s.top&&(_k=this.above[_l50]=!_k);var _y=(_k?_a14.top-s.top:s.bottom-_a14.bottom)-_p6;if(_y<_g4&&!1!==_u37.resize){if(_y<this.view.defaultLineHeight){_f21.style.top=Hn;continue;}qn.set(_u37,_g4),_f21.style.height=(_g4=_y)/n+"px";}else _f21.style.height&&(_f21.style.height="");var _M=_k?_a14.top-_g4-_p6-_w.y:_a14.bottom+_p6+_w.y,_x=_v+_m4;if(!0!==_u37.overlap){var _iterator112=_createForOfIteratorHelper(h),_step112;try{for(_iterator112.s();!(_step112=_iterator112.n()).done;){var _t176=_step112.value;_t176.left<_x&&_t176.right>_v&&_t176.top<_M+_g4&&_t176.bottom>_M&&(_M=_k?_t176.top-_g4-2-_p6:_t176.bottom+_p6+2);}}catch(err){_iterator112.e(err);}finally{_iterator112.f();}}if("absolute"==this.position?(_f21.style.top=(_M-t.parent.top)/n+"px",_f21.style.left=(_v-t.parent.left)/r+"px"):(_f21.style.top=_M/n+"px",_f21.style.left=_v/r+"px"),_d7){var _t177=_a14.left+(_b?_w.x:-_w.x)-(_v+14-7);_d7.style.left=_t177/r+"px";}!0!==_u37.overlap&&h.push({left:_v,top:_M,right:_x,bottom:_M+_g4}),_f21.classList.toggle("cm-tooltip-above",_k),_f21.classList.toggle("cm-tooltip-below",!_k),_u37.positioned&&_u37.positioned(t.space);}}},{key:"maybeMeasure",value:function 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))){var _iterator113=_createForOfIteratorHelper(this.manager.tooltipViews),_step113;try{for(_iterator113.s();!(_step113=_iterator113.n()).done;){var _t178=_step113.value;_t178.dom.style.top=Hn;}}catch(err){_iterator113.e(err);}finally{_iterator113.f();}}}}]);}(),{eventObservers:{scroll:function scroll(){this.maybeMeasure();}}});Jn=Ur.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"}}});Gn={x:0,y:0};Kn=$.define({enables:[Un,Jn]});_n=$.define({combine:function combine(t){return t.reduce(function(t,e){return t.concat(e);},[]);}});Xn=/*#__PURE__*/function(){function Xn(t){var _this58=this;_classCallCheck(this,Xn);this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Wn(t,_n,function(t,e){return _this58.createHostedView(t,e);},function(t){return t.dom.remove();});}return _createClass(Xn,[{key:"createHostedView",value:function createHostedView(t,e){var i=t.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i;}},{key:"mount",value:function mount(t){var _iterator114=_createForOfIteratorHelper(this.manager.tooltipViews),_step114;try{for(_iterator114.s();!(_step114=_iterator114.n()).done;){var _e152=_step114.value;_e152.mount&&_e152.mount(t);}}catch(err){_iterator114.e(err);}finally{_iterator114.f();}this.mounted=!0;}},{key:"positioned",value:function positioned(t){var _iterator115=_createForOfIteratorHelper(this.manager.tooltipViews),_step115;try{for(_iterator115.s();!(_step115=_iterator115.n()).done;){var _e153=_step115.value;_e153.positioned&&_e153.positioned(t);}}catch(err){_iterator115.e(err);}finally{_iterator115.f();}}},{key:"update",value:function update(t){this.manager.update(t);}},{key:"destroy",value:function destroy(){var t;var _iterator116=_createForOfIteratorHelper(this.manager.tooltipViews),_step116;try{for(_iterator116.s();!(_step116=_iterator116.n()).done;){var _e154=_step116.value;null===(t=_e154.destroy)||void 0===t||t.call(_e154);}}catch(err){_iterator116.e(err);}finally{_iterator116.f();}}},{key:"passProp",value:function passProp(t){var e;var _iterator117=_createForOfIteratorHelper(this.manager.tooltipViews),_step117;try{for(_iterator117.s();!(_step117=_iterator117.n()).done;){var _i131=_step117.value;var _s119=_i131[t];if(void 0!==_s119)if(void 0===e)e=_s119;else if(e!==_s119)return;}}catch(err){_iterator117.e(err);}finally{_iterator117.f();}return e;}},{key:"offset",get:function get(){return this.passProp("offset");}},{key:"getCoords",get:function get(){return this.passProp("getCoords");}},{key:"overlap",get:function get(){return this.passProp("overlap");}},{key:"resize",get:function get(){return this.passProp("resize");}}],[{key:"create",value:function create(t){return new Xn(t);}}]);}();Yn=Kn.compute([_n],function(t){var e=t.facet(_n);return 0===e.length?null:{pos:Math.min.apply(Math,_toConsumableArray(e.map(function(t){return t.pos;}))),end:Math.max.apply(Math,_toConsumableArray(e.map(function(t){var e;return null!==(e=t.end)&&void 0!==e?e:t.pos;}))),create:Xn.create,above:e[0].above,arrow:e.some(function(t){return t.arrow;})};});Qn=/*#__PURE__*/function(){function Qn(t,e,i,s,r){_classCallCheck(this,Qn);this.view=t,this.source=e,this.field=i,this.setHover=s,this.hoverTime=r,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));}return _createClass(Qn,[{key:"update",value:function update(){var _this59=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(function(){return _this59.startHover();},20));}},{key:"active",get:function get(){return this.view.state.field(this.field);}},{key:"checkHover",value:function checkHover(){if(this.hoverTimeout=-1,this.active.length)return;var t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover();}},{key:"startHover",value:function startHover(){var _this60=this;clearTimeout(this.restartTimeout);var t=this.view,e=this.lastMove,i=t.docView.nearest(e.target);if(!i)return;var s,r=1;if(i instanceof Ue)s=i.posAtStart;else{if(s=t.posAtCoords(e),null==s)return;var _i132=t.coordsAtPos(s);if(!_i132||e.y<_i132.top||e.y>_i132.bottom||e.x<_i132.left-t.defaultCharacterWidth||e.x>_i132.right+t.defaultCharacterWidth)return;var _n80=t.bidiSpans(t.state.doc.lineAt(s)).find(function(t){return t.from<=s&&t.to>=s;}),_h49=_n80&&_n80.dir==pi.RTL?-1:1;r=e.x<_i132.left?-_h49:_h49;}var n=this.source(t,s,r);if(null==n?void 0:n.then){var _e155=this.pending={pos:s};n.then(function(i){_this60.pending==_e155&&(_this60.pending=null,!i||Array.isArray(i)&&!i.length||t.dispatch({effects:_this60.setHover.of(Array.isArray(i)?i:[i])}));},function(e){return Ui(t.state,e,"hover tooltip");});}else!n||Array.isArray(n)&&!n.length||t.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])});}},{key:"tooltip",get:function get(){var t=this.view.plugin(Un),e=t?t.manager.tooltips.findIndex(function(t){return t.create==Xn.create;}):-1;return e>-1?t.manager.tooltipViews[e]:null;}},{key:"mousemove",value:function mousemove(t){var e,i;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));var s=this.active,r=this.tooltip;if(s.length&&r&&!function(t,e){var i=t.getBoundingClientRect();return e.clientX>=i.left-Zn&&e.clientX<=i.right+Zn&&e.clientY>=i.top-Zn&&e.clientY<=i.bottom+Zn;}(r.dom,t)||this.pending){var _ref16=s[0]||this.pending,_r99=_ref16.pos,_n81=null!==(i=null===(e=s[0])||void 0===e?void 0:e.end)&&void 0!==i?i:_r99;(_r99==_n81?this.view.posAtCoords(this.lastMove)==_r99:function(t,e,i,s,r,n){var h=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(h.left>s||h.right<s||h.top>r||Math.min(h.bottom,l)<r)return!1;var o=t.posAtCoords({x:s,y:r},!1);return o>=e&&o<=i;}(this.view,_r99,_n81,t.clientX,t.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null);}}},{key:"mouseleave",value:function mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;var e=this.active;if(e.length){var _e156=this.tooltip;_e156&&_e156.dom.contains(t.relatedTarget)?this.watchTooltipLeave(_e156.dom):this.view.dispatch({effects:this.setHover.of([])});}}},{key:"watchTooltipLeave",value:function watchTooltipLeave(t){var _this61=this;var e=function e(i){t.removeEventListener("mouseleave",e),_this61.active.length&&!_this61.view.dom.contains(i.relatedTarget)&&_this61.view.dispatch({effects:_this61.setHover.of([])});};t.addEventListener("mouseleave",e);}},{key:"destroy",value:function destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove);}}]);}();Zn=4;ih=ct.define();sh=$.define({combine:function combine(t){var e,i;var _iterator120=_createForOfIteratorHelper(t),_step120;try{for(_iterator120.s();!(_step120=_iterator120.n()).done;){var _s120=_step120.value;e=e||_s120.topContainer,i=i||_s120.bottomContainer;}}catch(err){_iterator120.e(err);}finally{_iterator120.f();}return{topContainer:e,bottomContainer:i};}});nh=_i.fromClass(/*#__PURE__*/function(){function _class4(t){_classCallCheck(this,_class4);this.input=t.state.facet(oh),this.specs=this.input.filter(function(t){return t;}),this.panels=this.specs.map(function(e){return e(t);});var e=t.state.facet(sh);this.top=new hh(t,!0,e.topContainer),this.bottom=new hh(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(function(t){return t.top;})),this.bottom.sync(this.panels.filter(function(t){return!t.top;}));var _iterator121=_createForOfIteratorHelper(this.panels),_step121;try{for(_iterator121.s();!(_step121=_iterator121.n()).done;){var _t180=_step121.value;_t180.dom.classList.add("cm-panel"),_t180.mount&&_t180.mount();}}catch(err){_iterator121.e(err);}finally{_iterator121.f();}}return _createClass(_class4,[{key:"update",value:function update(t){var e=t.state.facet(sh);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new hh(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new hh(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();var i=t.state.facet(oh);if(i!=this.input){var _e159=i.filter(function(t){return t;}),_s121=[],_r101=[],_n82=[],_h50=[];var _iterator122=_createForOfIteratorHelper(_e159),_step122;try{for(_iterator122.s();!(_step122=_iterator122.n()).done;){var _i135=_step122.value;var _e160=void 0,_l51=this.specs.indexOf(_i135);_l51<0?(_e160=_i135(t.view),_h50.push(_e160)):(_e160=this.panels[_l51],_e160.update&&_e160.update(t)),_s121.push(_e160),(_e160.top?_r101:_n82).push(_e160);}}catch(err){_iterator122.e(err);}finally{_iterator122.f();}this.specs=_e159,this.panels=_s121,this.top.sync(_r101),this.bottom.sync(_n82);for(var _i134=0,_h51=_h50;_i134<_h51.length;_i134++){var _t181=_h51[_i134];_t181.dom.classList.add("cm-panel"),_t181.mount&&_t181.mount();}}else{var _iterator123=_createForOfIteratorHelper(this.panels),_step123;try{for(_iterator123.s();!(_step123=_iterator123.n()).done;){var _e161=_step123.value;_e161.update&&_e161.update(t);}}catch(err){_iterator123.e(err);}finally{_iterator123.f();}}}},{key:"destroy",value:function destroy(){this.top.sync([]),this.bottom.sync([]);}}]);}(),{provide:function provide(t){return Ur.scrollMargins.of(function(e){var i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()};});}});hh=/*#__PURE__*/function(){function hh(t,e,i){_classCallCheck(this,hh);this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses();}return _createClass(hh,[{key:"sync",value:function sync(t){var _iterator124=_createForOfIteratorHelper(this.panels),_step124;try{for(_iterator124.s();!(_step124=_iterator124.n()).done;){var _e162=_step124.value;_e162.destroy&&t.indexOf(_e162)<0&&_e162.destroy();}}catch(err){_iterator124.e(err);}finally{_iterator124.f();}this.panels=t,this.syncDOM();}},{key:"syncDOM",value:function 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";var _t182=this.container||this.view.dom;_t182.insertBefore(this.dom,this.top?_t182.firstChild:null);}var t=this.dom.firstChild;var _iterator125=_createForOfIteratorHelper(this.panels),_step125;try{for(_iterator125.s();!(_step125=_iterator125.n()).done;){var _e163=_step125.value;if(_e163.dom.parentNode==this.dom){for(;t!=_e163.dom;)t=lh(t);t=t.nextSibling;}else this.dom.insertBefore(_e163.dom,t);}}catch(err){_iterator125.e(err);}finally{_iterator125.f();}for(;t;)t=lh(t);}},{key:"scrollMargin",value:function 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);}},{key:"syncClasses",value:function syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){var _iterator126=_createForOfIteratorHelper(this.classes.split(" ")),_step126;try{for(_iterator126.s();!(_step126=_iterator126.n()).done;){var _t183=_step126.value;_t183&&this.container.classList.remove(_t183);}}catch(err){_iterator126.e(err);}finally{_iterator126.f();}var _iterator127=_createForOfIteratorHelper((this.classes=this.view.themeClasses).split(" ")),_step127;try{for(_iterator127.s();!(_step127=_iterator127.n()).done;){var _t184=_step127.value;_t184&&this.container.classList.add(_t184);}}catch(err){_iterator127.e(err);}finally{_iterator127.f();}}}}]);}();oh=$.define({enables:nh});uh=/*#__PURE__*/function(_Ct2){function uh(){_classCallCheck(this,uh);return _callSuper(this,uh,arguments);}_inherits(uh,_Ct2);return _createClass(uh,[{key:"compare",value:function compare(t){return this==t||this.constructor==t.constructor&&this.eq(t);}},{key:"eq",value:function eq(t){return!1;}},{key:"destroy",value:function destroy(t){}}]);}(Ct);uh.prototype.elementClass="",uh.prototype.toDOM=void 0,uh.prototype.mapMode=x.TrackBefore,uh.prototype.startSide=uh.prototype.endSide=-1,uh.prototype.point=!0;fh=$.define();ah={"class":"",renderEmptyElements:!1,elementStyle:"",markers:function markers(){return It.empty;},lineMarker:function lineMarker(){return null;},widgetMarker:function widgetMarker(){return null;},lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}};ch=$.define();ph=$.define({combine:function combine(t){return t.some(function(t){return t;});}});gh=_i.fromClass(/*#__PURE__*/function(){function _class5(t){_classCallCheck(this,_class5);this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(ch).map(function(e){return new kh(t,e);});var _iterator128=_createForOfIteratorHelper(this.gutters),_step128;try{for(_iterator128.s();!(_step128=_iterator128.n()).done;){var _t185=_step128.value;this.dom.appendChild(_t185.dom);}}catch(err){_iterator128.e(err);}finally{_iterator128.f();}this.fixed=!t.state.facet(ph),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM);}return _createClass(_class5,[{key:"update",value:function update(t){if(this.updateGutters(t)){var _e164=this.prevViewport,_i136=t.view.viewport,_s122=Math.min(_e164.to,_i136.to)-Math.max(_e164.from,_i136.from);this.syncGutters(_s122<.8*(_i136.to-_i136.from));}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(ph)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport;}},{key:"syncGutters",value:function syncGutters(t){var _this62=this;var e=this.dom.nextSibling;t&&this.dom.remove();var i=It.iter(this.view.state.facet(fh),this.view.viewport.from),s=[],r=this.gutters.map(function(t){return new vh(t,_this62.view.viewport,-_this62.view.documentPadding.top);});var _iterator129=_createForOfIteratorHelper(this.view.viewportLineBlocks),_step129;try{for(_iterator129.s();!(_step129=_iterator129.n()).done;){var _t186=_step129.value;if(s.length&&(s=[]),Array.isArray(_t186.type)){var _e165=!0;var _iterator131=_createForOfIteratorHelper(_t186.type),_step131;try{for(_iterator131.s();!(_step131=_iterator131.n()).done;){var _n83=_step131.value;if(_n83.type==ri.Text&&_e165){bh(i,s,_n83.from);var _iterator132=_createForOfIteratorHelper(r),_step132;try{for(_iterator132.s();!(_step132=_iterator132.n()).done;){var _t187=_step132.value;_t187.line(this.view,_n83,s);}}catch(err){_iterator132.e(err);}finally{_iterator132.f();}_e165=!1;}else if(_n83.widget){var _iterator133=_createForOfIteratorHelper(r),_step133;try{for(_iterator133.s();!(_step133=_iterator133.n()).done;){var _t188=_step133.value;_t188.widget(this.view,_n83);}}catch(err){_iterator133.e(err);}finally{_iterator133.f();}}}}catch(err){_iterator131.e(err);}finally{_iterator131.f();}}else if(_t186.type==ri.Text){bh(i,s,_t186.from);var _iterator134=_createForOfIteratorHelper(r),_step134;try{for(_iterator134.s();!(_step134=_iterator134.n()).done;){var _e166=_step134.value;_e166.line(this.view,_t186,s);}}catch(err){_iterator134.e(err);}finally{_iterator134.f();}}else if(_t186.widget){var _iterator135=_createForOfIteratorHelper(r),_step135;try{for(_iterator135.s();!(_step135=_iterator135.n()).done;){var _e167=_step135.value;_e167.widget(this.view,_t186);}}catch(err){_iterator135.e(err);}finally{_iterator135.f();}}}}catch(err){_iterator129.e(err);}finally{_iterator129.f();}var _iterator130=_createForOfIteratorHelper(r),_step130;try{for(_iterator130.s();!(_step130=_iterator130.n()).done;){var _t189=_step130.value;_t189.finish();}}catch(err){_iterator130.e(err);}finally{_iterator130.f();}t&&this.view.scrollDOM.insertBefore(this.dom,e);}},{key:"updateGutters",value:function updateGutters(t){var e=t.startState.facet(ch),i=t.state.facet(ch),s=t.docChanged||t.heightChanged||t.viewportChanged||!It.eq(t.startState.facet(fh),t.state.facet(fh),t.view.viewport.from,t.view.viewport.to);if(e==i){var _iterator136=_createForOfIteratorHelper(this.gutters),_step136;try{for(_iterator136.s();!(_step136=_iterator136.n()).done;){var _e168=_step136.value;_e168.update(t)&&(s=!0);}}catch(err){_iterator136.e(err);}finally{_iterator136.f();}}else{s=!0;var _r102=[];var _iterator137=_createForOfIteratorHelper(i),_step137;try{for(_iterator137.s();!(_step137=_iterator137.n()).done;){var _s123=_step137.value;var _i138=e.indexOf(_s123);_i138<0?_r102.push(new kh(this.view,_s123)):(this.gutters[_i138].update(t),_r102.push(this.gutters[_i138]));}}catch(err){_iterator137.e(err);}finally{_iterator137.f();}var _iterator138=_createForOfIteratorHelper(this.gutters),_step138;try{for(_iterator138.s();!(_step138=_iterator138.n()).done;){var _t191=_step138.value;_t191.dom.remove(),_r102.indexOf(_t191)<0&&_t191.destroy();}}catch(err){_iterator138.e(err);}finally{_iterator138.f();}for(var _i137=0,_r103=_r102;_i137<_r103.length;_i137++){var _t190=_r103[_i137];this.dom.appendChild(_t190.dom);}this.gutters=_r102;}return s;}},{key:"destroy",value:function destroy(){var _iterator139=_createForOfIteratorHelper(this.gutters),_step139;try{for(_iterator139.s();!(_step139=_iterator139.n()).done;){var _t192=_step139.value;_t192.destroy();}}catch(err){_iterator139.e(err);}finally{_iterator139.f();}this.dom.remove();}}]);}(),{provide:function provide(t){return Ur.scrollMargins.of(function(e){var i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==pi.LTR?{left:i.dom.offsetWidth*e.scaleX}:{right:i.dom.offsetWidth*e.scaleX}:null;});}});vh=/*#__PURE__*/function(){function vh(t,e,i){_classCallCheck(this,vh);this.gutter=t,this.height=i,this.i=0,this.cursor=It.iter(t.markers,e.from);}return _createClass(vh,[{key:"addElement",value:function addElement(t,e,i){var s=this.gutter,r=(e.top-this.height)/t.scaleY,n=e.height/t.scaleY;if(this.i==s.elements.length){var _e169=new yh(t,n,r,i);s.elements.push(_e169),s.dom.appendChild(_e169.dom);}else s.elements[this.i].update(t,n,r,i);this.height=e.bottom,this.i++;}},{key:"line",value:function line(t,e,i){var s=[];bh(this.cursor,s,e.from),i.length&&(s=s.concat(i));var r=this.gutter.config.lineMarker(t,e,s);r&&s.unshift(r);var n=this.gutter;(0!=s.length||n.config.renderEmptyElements)&&this.addElement(t,e,s);}},{key:"widget",value:function widget(t,e){var i=this.gutter.config.widgetMarker(t,e.widget,e);i&&this.addElement(t,e,[i]);}},{key:"finish",value:function finish(){var t=this.gutter;for(;t.elements.length>this.i;){var _e170=t.elements.pop();t.dom.removeChild(_e170.dom),_e170.destroy();}}}]);}();kh=/*#__PURE__*/function(){function kh(t,e){var _this63=this;_classCallCheck(this,kh);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"]:"");var _loop10=function _loop10(_i139){_this63.dom.addEventListener(_i139,function(s){var r,n=s.target;if(n!=_this63.dom&&_this63.dom.contains(n)){for(;n.parentNode!=_this63.dom;)n=n.parentNode;var _t193=n.getBoundingClientRect();r=(_t193.top+_t193.bottom)/2;}else r=s.clientY;var h=t.lineBlockAtHeight(r-t.documentTop);e.domEventHandlers[_i139](t,h,s)&&s.preventDefault();});};for(var _i139 in e.domEventHandlers){_loop10(_i139);}this.markers=wh(e.markers(t)),e.initialSpacer&&(this.spacer=new yh(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none");}return _createClass(kh,[{key:"update",value:function update(t){var e=this.markers;if(this.markers=wh(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){var _e171=this.config.updateSpacer(this.spacer.markers[0],t);_e171!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[_e171]);}var i=t.view.viewport;return!It.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t);}},{key:"destroy",value:function destroy(){var _iterator140=_createForOfIteratorHelper(this.elements),_step140;try{for(_iterator140.s();!(_step140=_iterator140.n()).done;){var _t194=_step140.value;_t194.destroy();}}catch(err){_iterator140.e(err);}finally{_iterator140.f();}}}]);}();yh=/*#__PURE__*/function(){function yh(t,e,i,s){_classCallCheck(this,yh);this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,s);}return _createClass(yh,[{key:"update",value:function update(t,e,i,s){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(var _i140=0;_i140<t.length;_i140++)if(!t[_i140].compare(e[_i140]))return!1;return!0;}(this.markers,s)||this.setMarkers(t,s);}},{key:"setMarkers",value:function setMarkers(t,e){var i="cm-gutterElement",s=this.dom.firstChild;for(var _r104=0,_n84=0;;){var _h52=_n84,_l52=_r104<e.length?e[_r104++]:null,_o35=!1;if(_l52){var _t195=_l52.elementClass;_t195&&(i+=" "+_t195);for(var _t196=_n84;_t196<this.markers.length;_t196++)if(this.markers[_t196].compare(_l52)){_h52=_t196,_o35=!0;break;}}else _h52=this.markers.length;for(;_n84<_h52;){var _t197=this.markers[_n84++];if(_t197.toDOM){_t197.destroy(s);var _e172=s.nextSibling;s.remove(),s=_e172;}}if(!_l52)break;_l52.toDOM&&(_o35?s=s.nextSibling:this.dom.insertBefore(_l52.toDOM(t),s)),_o35&&_n84++;}this.dom.className=i,this.markers=e;}},{key:"destroy",value:function destroy(){this.setMarkers(null,[]);}}]);}();Mh=$.define();xh=$.define({combine:function combine(t){return At(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers:function domEventHandlers(t,e){var i=Object.assign({},t);var _loop11=function _loop11(){var s=i[_t198],r=e[_t198];i[_t198]=s?function(t,e,i){return s(t,e,i)||r(t,e,i);}:r;};for(var _t198 in e){_loop11();}return i;}});}});Sh=/*#__PURE__*/function(_uh){function Sh(t){var _this64;_classCallCheck(this,Sh);_this64=_callSuper(this,Sh),_this64.number=t;return _this64;}_inherits(Sh,_uh);return _createClass(Sh,[{key:"eq",value:function eq(t){return this.number==t.number;}},{key:"toDOM",value:function toDOM(){return document.createTextNode(this.number);}}]);}(uh);Ch=ch.compute([xh],function(t){return{"class":"cm-lineNumbers",renderEmptyElements:!1,markers:function markers(t){return t.state.facet(Mh);},lineMarker:function lineMarker(t,e,i){return i.some(function(t){return t.toDOM;})?null:new Sh(Ah(t,t.state.doc.lineAt(e.from).number));},widgetMarker:function widgetMarker(){return null;},lineMarkerChange:function lineMarkerChange(t){return t.startState.facet(xh)!=t.state.facet(xh);},initialSpacer:function initialSpacer(t){return new Sh(Ah(t,Oh(t.state.doc.lines)));},updateSpacer:function updateSpacer(t,e){var i=Ah(e.view,Oh(e.view.state.doc.lines));return i==t.number?t:new Sh(i);},domEventHandlers:t.facet(xh).domEventHandlers};});Eh=new(/*#__PURE__*/function(_uh2){function _class6(){var _this65;_classCallCheck(this,_class6);_this65=_callSuper(this,_class6,arguments),_this65.elementClass="cm-activeLineGutter";return _this65;}_inherits(_class6,_uh2);return _createClass(_class6);}(uh))();Ih=fh.compute(["selection"],function(t){var e=[],i=-1;var _iterator141=_createForOfIteratorHelper(t.selection.ranges),_step141;try{for(_iterator141.s();!(_step141=_iterator141.n()).done;){var _s124=_step141.value;var _r105=t.doc.lineAt(_s124.head).from;_r105>i&&(i=_r105,e.push(Eh.range(_r105)));}}catch(err){_iterator141.e(err);}finally{_iterator141.f();}return It.of(e);});_export("D",Rh=1024);Th=0;Bh=/*#__PURE__*/_createClass(function Bh(t,e){_classCallCheck(this,Bh);this.from=t,this.to=e;});_export("b",Lh=/*#__PURE__*/function(){function Lh(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,Lh);this.id=Th++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||function(){throw new Error("This node type doesn't define a deserialize function");};}return _createClass(Lh,[{key:"add",value:function add(t){var _this66=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=jh.match(t)),function(e){var i=t(e);return void 0===i?null:[_this66,i];};}}]);}());Lh.closedBy=new Lh({deserialize:function deserialize(t){return t.split(" ");}}),Lh.openedBy=new Lh({deserialize:function deserialize(t){return t.split(" ");}}),Lh.group=new Lh({deserialize:function deserialize(t){return t.split(" ");}}),Lh.isolate=new Lh({deserialize:function deserialize(t){if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto";}}),Lh.contextHash=new Lh({perNode:!0}),Lh.lookAhead=new Lh({perNode:!0}),Lh.mounted=new Lh({perNode:!0});Nh=/*#__PURE__*/function(){function Nh(t,e,i){_classCallCheck(this,Nh);this.tree=t,this.overlay=e,this.parser=i;}return _createClass(Nh,null,[{key:"get",value:function get(t){return t&&t.props&&t.props[Lh.mounted.id];}}]);}();$h=Object.create(null);_export("a",jh=/*#__PURE__*/function(){function jh(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;_classCallCheck(this,jh);this.name=t,this.props=e,this.id=i,this.flags=s;}return _createClass(jh,[{key:"prop",value:function prop(t){return this.props[t.id];}},{key:"isTop",get:function get(){return(1&this.flags)>0;}},{key:"isSkipped",get:function get(){return(2&this.flags)>0;}},{key:"isError",get:function get(){return(4&this.flags)>0;}},{key:"isAnonymous",get:function get(){return(8&this.flags)>0;}},{key:"is",value:function is(t){if("string"==typeof t){if(this.name==t)return!0;var _e173=this.prop(Lh.group);return!!_e173&&_e173.indexOf(t)>-1;}return this.id==t;}}],[{key:"define",value:function define(t){var e=t.props&&t.props.length?Object.create(null):$h,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),s=new jh(t.name||"",e,t.id,i);if(t.props){var _iterator142=_createForOfIteratorHelper(t.props),_step142;try{for(_iterator142.s();!(_step142=_iterator142.n()).done;){var _i141=_step142.value;if(Array.isArray(_i141)||(_i141=_i141(s)),_i141){if(_i141[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[_i141[0].id]=_i141[1];}}}catch(err){_iterator142.e(err);}finally{_iterator142.f();}}return s;}},{key:"match",value:function match(t){var e=Object.create(null);for(var _i142 in t){var _iterator143=_createForOfIteratorHelper(_i142.split(" ")),_step143;try{for(_iterator143.s();!(_step143=_iterator143.n()).done;){var _s125=_step143.value;e[_s125]=t[_i142];}}catch(err){_iterator143.e(err);}finally{_iterator143.f();}}return function(t){for(var _i143=t.prop(Lh.group),_s126=-1;_s126<(_i143?_i143.length:0);_s126++){var _r106=e[_s126<0?t.name:_i143[_s126]];if(_r106)return _r106;}};}}]);}());jh.none=new jh("",Object.create(null),0,8);_export("N",zh=/*#__PURE__*/function(){function zh(t){_classCallCheck(this,zh);this.types=t;for(var _e174=0;_e174<t.length;_e174++)if(t[_e174].id!=_e174)throw new RangeError("Node type ids should correspond to array positions when creating a node set");}return _createClass(zh,[{key:"extend",value:function extend(){var e=[];for(var _len4=arguments.length,t=new Array(_len4),_key4=0;_key4<_len4;_key4++){t[_key4]=arguments[_key4];}var _iterator144=_createForOfIteratorHelper(this.types),_step144;try{for(_iterator144.s();!(_step144=_iterator144.n()).done;){var _i144=_step144.value;var _s127=null;var _iterator145=_createForOfIteratorHelper(t),_step145;try{for(_iterator145.s();!(_step145=_iterator145.n()).done;){var _e175=_step145.value;var _t199=_e175(_i144);_t199&&(_s127||(_s127=Object.assign({},_i144.props)),_s127[_t199[0].id]=_t199[1]);}}catch(err){_iterator145.e(err);}finally{_iterator145.f();}e.push(_s127?new jh(_i144.name,_s127,_i144.id,_i144.flags):_i144);}}catch(err){_iterator144.e(err);}finally{_iterator144.f();}return new zh(e);}}]);}());Ph=new WeakMap();Hh=new WeakMap();!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays";}(Wh||_export("I",Wh={}));_export("T",Vh=/*#__PURE__*/function(){function Vh(t,e,i,s,r){_classCallCheck(this,Vh);if(this.type=t,this.children=e,this.positions=i,this.length=s,this.props=null,r&&r.length){this.props=Object.create(null);var _iterator146=_createForOfIteratorHelper(r),_step146;try{for(_iterator146.s();!(_step146=_iterator146.n()).done;){var _step146$value=_slicedToArray(_step146.value,2),_t200=_step146$value[0],_e176=_step146$value[1];this.props["number"==typeof _t200?_t200:_t200.id]=_e176;}}catch(err){_iterator146.e(err);}finally{_iterator146.f();}}}return _createClass(Vh,[{key:"toString",value:function toString(){var t=Nh.get(this);if(t&&!t.overlay)return t.tree.toString();var e="";var _iterator147=_createForOfIteratorHelper(this.children),_step147;try{for(_iterator147.s();!(_step147=_iterator147.n()).done;){var _t201=_step147.value;var _i145=_t201.toString();_i145&&(e&&(e+=","),e+=_i145);}}catch(err){_iterator147.e(err);}finally{_iterator147.f();}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e;}},{key:"cursor",value:function cursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return new el(this.topNode,t);}},{key:"cursorAt",value:function cursorAt(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=Ph.get(this)||this.topNode,r=new el(s);return r.moveTo(t,e),Ph.set(this,r._tree),r;}},{key:"topNode",get:function get(){return new Kh(this,0,0,null);}},{key:"resolve",value:function resolve(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=Jh(Ph.get(this)||this.topNode,t,e,!1);return Ph.set(this,i),i;}},{key:"resolveInner",value:function resolveInner(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=Jh(Hh.get(this)||this.topNode,t,e,!0);return Hh.set(this,i),i;}},{key:"resolveStack",value:function resolveStack(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return function(t,e,i){var s=t.resolveInner(e,i),r=null;for(var _t202=s instanceof Kh?s:s.context.parent;_t202;_t202=_t202.parent)if(_t202.index<0){var _n85=_t202.parent;(r||(r=[s])).push(_n85.resolve(e,i)),_t202=_n85;}else{var _n86=Nh.get(_t202.tree);if(_n86&&_n86.overlay&&_n86.overlay[0].from<=e&&_n86.overlay[_n86.overlay.length-1].to>=e){var _h53=new Kh(_n86.tree,_n86.overlay[0].from+_t202.from,-1,_t202);(r||(r=[s])).push(Jh(_h53,e,i,!1));}}return r?Zh(r):s;}(this,t,e);}},{key:"iterate",value:function iterate(t){var e=t.enter,i=t.leave,_t$from=t.from,s=_t$from===void 0?0:_t$from,_t$to=t.to,r=_t$to===void 0?this.length:_t$to,n=t.mode||0,h=(n&Wh.IncludeAnonymous)>0;for(var _t203=this.cursor(n|Wh.IncludeAnonymous);;){var _n87=!1;if(_t203.from<=r&&_t203.to>=s&&(!h&&_t203.type.isAnonymous||!1!==e(_t203))){if(_t203.firstChild())continue;_n87=!0;}for(;_n87&&i&&(h||!_t203.type.isAnonymous)&&i(_t203),!_t203.nextSibling();){if(!_t203.parent())return;_n87=!0;}}}},{key:"prop",value:function prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t);}},{key:"propValues",get:function get(){var t=[];if(this.props)for(var _e177 in this.props)t.push([+_e177,this.props[_e177]]);return t;}},{key:"balance",value:function balance(){var _this67=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return this.children.length<=8?this:nl(jh.none,this.children,this.positions,0,this.children.length,0,this.length,function(t,e,i){return new Vh(_this67.type,t,e,i,_this67.propValues);},t.makeTree||function(t,e,i){return new Vh(jh.none,t,e,i);});}}],[{key:"build",value:function build(t){return function(t){var e;var i=t.buffer,s=t.nodeSet,_t$maxBufferLength=t.maxBufferLength,r=_t$maxBufferLength===void 0?Rh:_t$maxBufferLength,_t$reused=t.reused,n=_t$reused===void 0?[]:_t$reused,_t$minRepeatType=t.minRepeatType,h=_t$minRepeatType===void 0?s.types.length:_t$minRepeatType,l=Array.isArray(i)?new Fh(i,i.length):i,o=s.types,u=0,f=0;function a(t,e,i,b,v,k){var y=l.id,M=l.start,x=l.end,S=l.size,A=f;for(;S<0;){if(l.next(),-1==S){var _e178=n[y];return i.push(_e178),void b.push(M-t);}if(-3==S)return void(u=y);if(-4==S)return void(f=y);throw new RangeError("Unrecognized record size: ".concat(S));}var C,D,O=o[y],E=M-t;if(x-M<=r&&(D=g(l.pos-e,v))){var _e179=new Uint16Array(D.size-D.skip),_i146=l.pos-D.size,_r107=_e179.length;for(;l.pos>_i146;)_r107=w(D.start,_e179,_r107);C=new qh(_e179,x-D.start,s),E=D.start-t;}else{var _t204=l.pos-S;l.next();var _e180=[],_i147=[],_s128=y>=h?y:-1,_n88=0,_o36=x;for(;l.pos>_t204;)_s128>=0&&l.id==_s128&&l.size>=0?(l.end<=_o36-r&&(p(_e180,_i147,M,_n88,l.end,_o36,_s128,A),_n88=_e180.length,_o36=l.end),l.next()):k>2500?c(M,_t204,_e180,_i147):a(M,_t204,_e180,_i147,_s128,k+1);if(_s128>=0&&_n88>0&&_n88<_e180.length&&p(_e180,_i147,M,_n88,M,_o36,_s128,A),_e180.reverse(),_i147.reverse(),_s128>-1&&_n88>0){var _t205=d(O);C=nl(O,_e180,_i147,0,_e180.length,0,x-M,_t205,_t205);}else C=m(O,_e180,_i147,x-M,A-x);}i.push(C),b.push(E);}function c(t,e,i,n){var h=[],o=0,u=-1;for(;l.pos>e;){var _t206=l.id,_e181=l.start,_i148=l.end,_s129=l.size;if(_s129>4)l.next();else{if(u>-1&&_e181<u)break;u<0&&(u=_i148-r),h.push(_t206,_e181,_i148),o++,l.next();}}if(o){var _e182=new Uint16Array(4*o),_r108=h[h.length-2];for(var _t207=h.length-3,_i149=0;_t207>=0;_t207-=3)_e182[_i149++]=h[_t207],_e182[_i149++]=h[_t207+1]-_r108,_e182[_i149++]=h[_t207+2]-_r108,_e182[_i149++]=_i149;i.push(new qh(_e182,h[2]-_r108,s)),n.push(_r108-t);}}function d(t){return function(e,i,s){var r,n,h=0,l=e.length-1;if(l>=0&&(r=e[l])instanceof Vh){if(!l&&r.type==t&&r.length==s)return r;(n=r.prop(Lh.lookAhead))&&(h=i[l]+r.length+n);}return m(t,e,i,s,h);};}function p(t,e,i,r,n,h,l,o){var u=[],f=[];for(;t.length>r;)u.push(t.pop()),f.push(e.pop()+i-n);t.push(m(s.types[l],u,f,h-n,o-h)),e.push(n-i);}function m(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var n=arguments.length>5?arguments[5]:undefined;if(u){var _t208=[Lh.contextHash,u];n=n?[_t208].concat(n):[_t208];}if(r>25){var _t209=[Lh.lookAhead,r];n=n?[_t209].concat(n):[_t209];}return new Vh(t,e,i,s,n);}function g(t,e){var i=l.fork(),s=0,n=0,o=0,u=i.end-r,f={size:0,start:0,skip:0};t:for(var _r109=i.pos-t;i.pos>_r109;){var _t210=i.size;if(i.id==e&&_t210>=0){f.size=s,f.start=n,f.skip=o,o+=4,s+=4,i.next();continue;}var _l53=i.pos-_t210;if(_t210<0||_l53<_r109||i.start<u)break;var _a15=i.id>=h?4:0,_c13=i.start;for(i.next();i.pos>_l53;){if(i.size<0){if(-3!=i.size)break t;_a15+=4;}else i.id>=h&&(_a15+=4);i.next();}n=_c13,s+=_t210,o+=_a15;}return(e<0||s==t)&&(f.size=s,f.start=n,f.skip=o),f.size>4?f:void 0;}function w(t,e,i){var s=l.id,r=l.start,n=l.end,o=l.size;if(l.next(),o>=0&&s<h){var _h54=i;if(o>4){var _s130=l.pos-(o-4);for(;l.pos>_s130;)i=w(t,e,i);}e[--i]=_h54,e[--i]=n-t,e[--i]=r-t,e[--i]=s;}else-3==o?u=s:-4==o&&(f=s);return i;}var b=[],v=[];for(;l.pos>0;)a(t.start||0,t.bufferStart||0,b,v,-1,0);var k=null!==(e=t.length)&&void 0!==e?e:b.length?v[0]+b[0].length:0;return new Vh(o[t.topID],b.reverse(),v.reverse(),k);}(t);}}]);}());Vh.empty=new Vh(jh.none,[],[],0);Fh=/*#__PURE__*/function(){function Fh(t,e){_classCallCheck(this,Fh);this.buffer=t,this.index=e;}return _createClass(Fh,[{key:"id",get:function get(){return this.buffer[this.index-4];}},{key:"start",get:function get(){return this.buffer[this.index-3];}},{key:"end",get:function get(){return this.buffer[this.index-2];}},{key:"size",get:function get(){return this.buffer[this.index-1];}},{key:"pos",get:function get(){return this.index;}},{key:"next",value:function next(){this.index-=4;}},{key:"fork",value:function fork(){return new Fh(this.buffer,this.index);}}]);}();qh=/*#__PURE__*/function(){function qh(t,e,i){_classCallCheck(this,qh);this.buffer=t,this.length=e,this.set=i;}return _createClass(qh,[{key:"type",get:function get(){return jh.none;}},{key:"toString",value:function toString(){var t=[];for(var _e183=0;_e183<this.buffer.length;)t.push(this.childString(_e183)),_e183=this.buffer[_e183+3];return t.join(",");}},{key:"childString",value:function childString(t){var e=this.buffer[t],i=this.buffer[t+3],s=this.set.types[e],r=s.name;if(/\W/.test(r)&&!s.isError&&(r=JSON.stringify(r)),i==(t+=4))return r;var n=[];for(;t<i;)n.push(this.childString(t)),t=this.buffer[t+3];return r+"("+n.join(",")+")";}},{key:"findChild",value:function findChild(t,e,i,s,r){var n=this.buffer,h=-1;for(var _l54=t;_l54!=e&&!(Uh(r,s,n[_l54+1],n[_l54+2])&&(h=_l54,i>0));_l54=n[_l54+3]);return h;}},{key:"slice",value:function slice(t,e,i){var s=this.buffer,r=new Uint16Array(e-t),n=0;for(var _h55=t,_l55=0;_h55<e;){r[_l55++]=s[_h55++],r[_l55++]=s[_h55++]-i;var _e184=r[_l55++]=s[_h55++]-i;r[_l55++]=s[_h55++]-t,n=Math.max(n,_e184);}return new qh(r,n,this.set);}}]);}();Gh=/*#__PURE__*/function(){function Gh(){_classCallCheck(this,Gh);}return _createClass(Gh,[{key:"cursor",value:function cursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return new el(this,t);}},{key:"getChild",value:function getChild(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var s=_h(this,t,e,i);return s.length?s[0]:null;}},{key:"getChildren",value:function getChildren(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return _h(this,t,e,i);}},{key:"resolve",value:function resolve(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Jh(this,t,e,!1);}},{key:"resolveInner",value:function resolveInner(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Jh(this,t,e,!0);}},{key:"matchContext",value:function matchContext(t){return Xh(this,t);}},{key:"enterUnfinishedNodesBefore",value:function enterUnfinishedNodesBefore(t){var e=this.childBefore(t),i=this;for(;e;){var _t211=e.lastChild;if(!_t211||_t211.to!=e.to)break;_t211.type.isError&&_t211.from==_t211.to?(i=e,e=_t211.prevSibling):e=_t211;}return i;}},{key:"node",get:function get(){return this;}},{key:"next",get:function get(){return this.parent;}}]);}();Kh=/*#__PURE__*/function(_Gh){function Kh(t,e,i,s){var _this68;_classCallCheck(this,Kh);_this68=_callSuper(this,Kh),_this68._tree=t,_this68.from=e,_this68.index=i,_this68._parent=s;return _this68;}_inherits(Kh,_Gh);return _createClass(Kh,[{key:"type",get:function get(){return this._tree.type;}},{key:"name",get:function get(){return this._tree.type.name;}},{key:"to",get:function get(){return this.from+this._tree.length;}},{key:"nextChild",value:function nextChild(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;for(var _n89=this;;){for(var _n89$_tree=_n89._tree,_h57=_n89$_tree.children,_l56=_n89$_tree.positions,_o37=e>0?_h57.length:-1;t!=_o37;t+=e){var _o38=_h57[t],_u38=_l56[t]+_n89.from;if(Uh(s,i,_u38,_u38+_o38.length))if(_o38 instanceof qh){if(r&Wh.ExcludeBuffers)continue;var _h58=_o38.findChild(0,_o38.buffer.length,e,i-_u38,s);if(_h58>-1)return new Qh(new Yh(_n89,_o38,t,_u38),null,_h58);}else if(r&Wh.IncludeAnonymous||!_o38.type.isAnonymous||il(_o38)){var _h59=void 0;if(!(r&Wh.IgnoreMounts)&&(_h59=Nh.get(_o38))&&!_h59.overlay)return new Kh(_h59.tree,_u38,t,_n89);var _l57=new Kh(_o38,_u38,t,_n89);return r&Wh.IncludeAnonymous||!_l57.type.isAnonymous?_l57:_l57.nextChild(e<0?_o38.children.length-1:0,e,i,s);}}if(r&Wh.IncludeAnonymous||!_n89.type.isAnonymous)return null;if(t=_n89.index>=0?_n89.index+e:e<0?-1:_n89._parent._tree.children.length,_n89=_n89._parent,!_n89)return null;}}},{key:"firstChild",get:function get(){return this.nextChild(0,1,0,4);}},{key:"lastChild",get:function get(){return this.nextChild(this._tree.children.length-1,-1,0,4);}},{key:"childAfter",value:function childAfter(t){return this.nextChild(0,1,t,2);}},{key:"childBefore",value:function childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2);}},{key:"enter",value:function enter(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s;if(!(i&Wh.IgnoreOverlays)&&(s=Nh.get(this._tree))&&s.overlay){var _i150=t-this.from;var _iterator148=_createForOfIteratorHelper(s.overlay),_step148;try{for(_iterator148.s();!(_step148=_iterator148.n()).done;){var _step148$value=_step148.value,_t212=_step148$value.from,_r110=_step148$value.to;if((e>0?_t212<=_i150:_t212<_i150)&&(e<0?_r110>=_i150:_r110>_i150))return new Kh(s.tree,s.overlay[0].from+this.from,-1,this);}}catch(err){_iterator148.e(err);}finally{_iterator148.f();}}return this.nextChild(0,1,t,e,i);}},{key:"nextSignificantParent",value:function nextSignificantParent(){var t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t;}},{key:"parent",get:function get(){return this._parent?this._parent.nextSignificantParent():null;}},{key:"nextSibling",get:function get(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null;}},{key:"prevSibling",get:function get(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null;}},{key:"tree",get:function get(){return this._tree;}},{key:"toTree",value:function toTree(){return this._tree;}},{key:"toString",value:function toString(){return this._tree.toString();}}]);}(Gh);Yh=/*#__PURE__*/_createClass(function Yh(t,e,i,s){_classCallCheck(this,Yh);this.parent=t,this.buffer=e,this.index=i,this.start=s;});Qh=/*#__PURE__*/function(_Gh2){function Qh(t,e,i){var _this69;_classCallCheck(this,Qh);_this69=_callSuper(this,Qh),_this69.context=t,_this69._parent=e,_this69.index=i,_this69.type=t.buffer.set.types[t.buffer.buffer[i]];return _this69;}_inherits(Qh,_Gh2);return _createClass(Qh,[{key:"name",get:function get(){return this.type.name;}},{key:"from",get:function get(){return this.context.start+this.context.buffer.buffer[this.index+1];}},{key:"to",get:function get(){return this.context.start+this.context.buffer.buffer[this.index+2];}},{key:"child",value:function child(t,e,i){var s=this.context.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],t,e-this.context.start,i);return r<0?null:new Qh(this.context,this,r);}},{key:"firstChild",get:function get(){return this.child(1,0,4);}},{key:"lastChild",get:function get(){return this.child(-1,0,4);}},{key:"childAfter",value:function childAfter(t){return this.child(1,t,2);}},{key:"childBefore",value:function childBefore(t){return this.child(-1,t,-2);}},{key:"enter",value:function enter(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;if(i&Wh.ExcludeBuffers)return null;var s=this.context.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new Qh(this.context,this,r);}},{key:"parent",get:function get(){return this._parent||this.context.parent.nextSignificantParent();}},{key:"externalSibling",value:function externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4);}},{key:"nextSibling",get:function get(){var t=this.context.buffer,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Qh(this.context,this._parent,e):this.externalSibling(1);}},{key:"prevSibling",get:function get(){var t=this.context.buffer,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new Qh(this.context,this._parent,t.findChild(e,this.index,-1,0,4));}},{key:"tree",get:function get(){return null;}},{key:"toTree",value:function toTree(){var t=[],e=[],i=this.context.buffer,s=this.index+4,r=i.buffer[this.index+3];if(r>s){var _n90=i.buffer[this.index+1];t.push(i.slice(s,r,_n90)),e.push(0);}return new Vh(this.type,t,e,this.to-this.from);}},{key:"toString",value:function toString(){return this.context.buffer.childString(this.index);}}]);}(Gh);tl=/*#__PURE__*/function(){function tl(t,e){_classCallCheck(this,tl);this.heads=t,this.node=e;}return _createClass(tl,[{key:"next",get:function get(){return Zh(this.heads);}}]);}();el=/*#__PURE__*/function(){function el(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;_classCallCheck(this,el);if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Kh)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(var _e186=t._parent;_e186;_e186=_e186._parent)this.stack.unshift(_e186.index);this.bufferNode=t,this.yieldBuf(t.index);}}return _createClass(el,[{key:"name",get:function get(){return this.type.name;}},{key:"yieldNode",value:function yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0);}},{key:"yieldBuf",value:function yieldBuf(t,e){this.index=t;var _this$buffer=this.buffer,i=_this$buffer.start,s=_this$buffer.buffer;return this.type=e||s.set.types[s.buffer[t]],this.from=i+s.buffer[t+1],this.to=i+s.buffer[t+2],!0;}},{key:"yield",value:function _yield(t){return!!t&&(t instanceof Kh?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)));}},{key:"toString",value:function toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString();}},{key:"enterChild",value:function enterChild(t,e,i){if(!this.buffer)return this["yield"](this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));var s=this.buffer.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],t,e-this.buffer.start,i);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r));}},{key:"firstChild",value:function firstChild(){return this.enterChild(1,0,4);}},{key:"lastChild",value:function lastChild(){return this.enterChild(-1,0,4);}},{key:"childAfter",value:function childAfter(t){return this.enterChild(1,t,2);}},{key:"childBefore",value:function childBefore(t){return this.enterChild(-1,t,-2);}},{key:"enter",value:function enter(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.mode;return this.buffer?!(i&Wh.ExcludeBuffers)&&this.enterChild(1,t,e):this["yield"](this._tree.enter(t,e,i));}},{key:"parent",value:function parent(){if(!this.buffer)return this.yieldNode(this.mode&Wh.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&Wh.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t);}},{key:"sibling",value:function sibling(t){if(!this.buffer)return!!this._tree._parent&&this["yield"](this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));var e=this.buffer.buffer,i=this.stack.length-1;if(t<0){var _t214=i<0?0:this.stack[i]+4;if(this.index!=_t214)return this.yieldBuf(e.findChild(_t214,this.index,-1,0,4));}else{var _t215=e.buffer[this.index+3];if(_t215<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(_t215);}return i<0&&this["yield"](this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode));}},{key:"nextSibling",value:function nextSibling(){return this.sibling(1);}},{key:"prevSibling",value:function prevSibling(){return this.sibling(-1);}},{key:"atLastNode",value:function atLastNode(t){var e,i,s=this.buffer;if(s){if(t>0){if(this.index<s.buffer.buffer.length)return!1;}else for(var _t216=0;_t216<this.index;_t216++)if(s.buffer.buffer[_t216+3]<this.index)return!1;e=s.index;i=s.parent;}else{var _this$_tree=this._tree;e=_this$_tree.index;i=_this$_tree._parent;}for(;i;_i151=i,e=_i151.index,i=_i151._parent,_i151){var _i151;if(e>-1)for(var _s135=e+t,_r112=t<0?-1:i._tree.children.length;_s135!=_r112;_s135+=t){var _t217=i._tree.children[_s135];if(this.mode&Wh.IncludeAnonymous||_t217 instanceof qh||!_t217.type.isAnonymous||il(_t217))return!1;}}return!0;}},{key:"move",value:function move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1;}}},{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;return this.move(1,t);}},{key:"prev",value:function prev(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;return this.move(-1,t);}},{key:"moveTo",value:function moveTo(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this;}},{key:"node",get:function get(){if(!this.buffer)return this._tree;var t=this.bufferNode,e=null,i=0;if(t&&t.context==this.buffer)t:for(var _s136=this.index,_r113=this.stack.length;_r113>=0;){for(var _n91=t;_n91;_n91=_n91._parent)if(_n91.index==_s136){if(_s136==this.index)return _n91;e=_n91,i=_r113+1;break t;}_s136=this.stack[--_r113];}for(var _t218=i;_t218<this.stack.length;_t218++)e=new Qh(this.buffer,e,this.stack[_t218]);return this.bufferNode=new Qh(this.buffer,e,this.index);}},{key:"tree",get:function get(){return this.buffer?null:this._tree._tree;}},{key:"iterate",value:function iterate(t,e){for(var _i152=0;;){var _s137=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){_i152++;continue;}this.type.isAnonymous||(_s137=!0);}for(;_s137&&e&&e(this),_s137=this.type.isAnonymous,!this.nextSibling();){if(!_i152)return;this.parent(),_i152--,_s137=!0;}}}},{key:"matchContext",value:function matchContext(t){if(!this.buffer)return Xh(this.node,t);var e=this.buffer.buffer,i=e.set.types;for(var _s138=t.length-1,_r114=this.stack.length-1;_s138>=0;_r114--){if(_r114<0)return Xh(this.node,t,_s138);var _n92=i[e.buffer[this.stack[_r114]]];if(!_n92.isAnonymous){if(t[_s138]&&t[_s138]!=_n92.name)return!1;_s138--;}}return!0;}}]);}();sl=new WeakMap();_export("q",hl=/*#__PURE__*/function(){function hl(){_classCallCheck(this,hl);this.map=new WeakMap();}return _createClass(hl,[{key:"setBuffer",value:function setBuffer(t,e,i){var s=this.map.get(t);s||this.map.set(t,s=new Map()),s.set(e,i);}},{key:"getBuffer",value:function getBuffer(t,e){var i=this.map.get(t);return i&&i.get(e);}},{key:"set",value:function set(t,e){t instanceof Qh?this.setBuffer(t.context.buffer,t.index,e):t instanceof Kh&&this.map.set(t.tree,e);}},{key:"get",value:function get(t){return t instanceof Qh?this.getBuffer(t.context.buffer,t.index):t instanceof Kh?this.map.get(t.tree):void 0;}},{key:"cursorSet",value:function cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e);}},{key:"cursorGet",value:function cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree);}}]);}());ll=/*#__PURE__*/function(){function ll(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:!1;var n=arguments.length>5&&arguments[5]!==undefined?arguments[5]:!1;_classCallCheck(this,ll);this.from=t,this.to=e,this.tree=i,this.offset=s,this.open=(r?1:0)|(n?2:0);}return _createClass(ll,[{key:"openStart",get:function get(){return(1&this.open)>0;}},{key:"openEnd",get:function get(){return(2&this.open)>0;}}],[{key:"addTree",value:function addTree(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=[new ll(0,t.length,t,0,!1,i)];var _iterator150=_createForOfIteratorHelper(e),_step150;try{for(_iterator150.s();!(_step150=_iterator150.n()).done;){var _i154=_step150.value;_i154.to>t.length&&s.push(_i154);}}catch(err){_iterator150.e(err);}finally{_iterator150.f();}return s;}},{key:"applyChanges",value:function applyChanges(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:128;if(!e.length)return t;var s=[],r=1,n=t.length?t[0]:null;for(var _h60=0,_l58=0,_o39=0;;_h60++){var _u40=_h60<e.length?e[_h60]:null,_f22=_u40?_u40.fromA:1e9;if(_f22-_l58>=i)for(;n&&n.from<_f22;){var _e189=n;if(_l58>=_e189.from||_f22<=_e189.to||_o39){var _t220=Math.max(_e189.from,_l58)-_o39,_i155=Math.min(_e189.to,_f22)-_o39;_e189=_t220>=_i155?null:new ll(_t220,_i155,_e189.tree,_e189.offset+_o39,_h60>0,!!_u40);}if(_e189&&s.push(_e189),n.to>_f22)break;n=r<t.length?t[r++]:null;}if(!_u40)break;_l58=_u40.toA,_o39=_u40.toA-_u40.toB;}return s;}}]);}();_export("P",ol=/*#__PURE__*/function(){function ol(){_classCallCheck(this,ol);}return _createClass(ol,[{key:"startParse",value:function startParse(t,e,i){return"string"==typeof t&&(t=new ul(t)),i=i?i.length?i.map(function(t){return new Bh(t.from,t.to);}):[new Bh(0,0)]:[new Bh(0,t.length)],this.createParse(t,e||[],i);}},{key:"parse",value:function parse(t,e,i){var s=this.startParse(t,e,i);for(;;){var _t221=s.advance();if(_t221)return _t221;}}}]);}());ul=/*#__PURE__*/function(){function ul(t){_classCallCheck(this,ul);this.string=t;}return _createClass(ul,[{key:"length",get:function get(){return this.string.length;}},{key:"chunk",value:function chunk(t){return this.string.slice(t);}},{key:"lineChunks",get:function get(){return!1;}},{key:"read",value:function read(t,e){return this.string.slice(t,e);}}]);}();new Lh({perNode:!0});fl=0;al=/*#__PURE__*/function(){function al(t,e,i){_classCallCheck(this,al);this.set=t,this.base=e,this.modified=i,this.id=fl++;}return _createClass(al,null,[{key:"define",value:function define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");var e=new al([],null,[]);if(e.set.push(e),t){var _iterator151=_createForOfIteratorHelper(t.set),_step151;try{for(_iterator151.s();!(_step151=_iterator151.n()).done;){var _i156=_step151.value;e.set.push(_i156);}}catch(err){_iterator151.e(err);}finally{_iterator151.f();}}return e;}},{key:"defineModifier",value:function defineModifier(){var t=new dl();return function(e){return e.modified.indexOf(t)>-1?e:dl.get(e.base||e,e.modified.concat(t).sort(function(t,e){return t.id-e.id;}));};}}]);}();cl=0;dl=/*#__PURE__*/function(){function dl(){_classCallCheck(this,dl);this.instances=[],this.id=cl++;}return _createClass(dl,null,[{key:"get",value:function get(t,e){if(!e.length)return t;var i=e[0].instances.find(function(i){return i.base==t&&(s=e,r=i.modified,s.length==r.length&&s.every(function(t,e){return t==r[e];}));var s,r;});if(i)return i;var s=[],r=new al(s,t,e);var _iterator152=_createForOfIteratorHelper(e),_step152;try{for(_iterator152.s();!(_step152=_iterator152.n()).done;){var _t222=_step152.value;_t222.instances.push(r);}}catch(err){_iterator152.e(err);}finally{_iterator152.f();}var n=function(t){var e=[[]];for(var _i157=0;_i157<t.length;_i157++)for(var _s140=0,_r116=e.length;_s140<_r116;_s140++)e.push(e[_s140].concat(t[_i157]));return e.sort(function(t,e){return e.length-t.length;});}(e);var _iterator153=_createForOfIteratorHelper(t.set),_step153;try{for(_iterator153.s();!(_step153=_iterator153.n()).done;){var _e190=_step153.value;if(!_e190.modified.length){var _iterator154=_createForOfIteratorHelper(n),_step154;try{for(_iterator154.s();!(_step154=_iterator154.n()).done;){var _t223=_step154.value;s.push(dl.get(_e190,_t223));}}catch(err){_iterator154.e(err);}finally{_iterator154.f();}}}}catch(err){_iterator153.e(err);}finally{_iterator153.f();}return r;}}]);}();ml=new Lh();gl=/*#__PURE__*/function(){function gl(t,e,i,s){_classCallCheck(this,gl);this.tags=t,this.mode=e,this.context=i,this.next=s;}return _createClass(gl,[{key:"opaque",get:function get(){return 0==this.mode;}},{key:"inherit",get:function get(){return 1==this.mode;}},{key:"sort",value:function sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t);}},{key:"depth",get:function get(){return this.context?this.context.length:0;}}]);}();gl.empty=new gl([],2,null);vl=/*#__PURE__*/function(){function vl(t,e,i){_classCallCheck(this,vl);this.at=t,this.highlighters=e,this.span=i,this["class"]="";}return _createClass(vl,[{key:"startSpan",value:function startSpan(t,e){e!=this["class"]&&(this.flush(t),t>this.at&&(this.at=t),this["class"]=e);}},{key:"flush",value:function flush(t){t>this.at&&this["class"]&&this.span(this.at,t,this["class"]);}},{key:"highlightRange",value:function highlightRange(t,e,i,s,r){var n=t.type,h=t.from,l=t.to;if(h>=i||l<=e)return;n.isTop&&(r=this.highlighters.filter(function(t){return!t.scope||t.scope(n);}));var o=s,u=function(t){var e=t.type.prop(ml);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null;}(t)||gl.empty,f=function(t,e){var i=null;var _iterator160=_createForOfIteratorHelper(t),_step160;try{for(_iterator160.s();!(_step160=_iterator160.n()).done;){var _s145=_step160.value;var _t227=_s145.style(e);_t227&&(i=i?i+" "+_t227:_t227);}}catch(err){_iterator160.e(err);}finally{_iterator160.f();}return i;}(r,u.tags);if(f&&(o&&(o+=" "),o+=f,1==u.mode&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(e,h),o),u.opaque)return;var a=t.tree&&t.tree.prop(Lh.mounted);if(a&&a.overlay){var _n94=t.node.enter(a.overlay[0].from+h,1),_u41=this.highlighters.filter(function(t){return!t.scope||t.scope(a.tree.type);}),_f23=t.firstChild();for(var _c14=0,_d9=h;;_c14++){var _p8=_c14<a.overlay.length?a.overlay[_c14]:null,_m5=_p8?_p8.from+h:l,_g5=Math.max(e,_d9),_w2=Math.min(i,_m5);if(_g5<_w2&&_f23)for(;t.from<_w2&&(this.highlightRange(t,_g5,_w2,s,r),this.startSpan(Math.min(_w2,t.to),o),!(t.to>=_m5)&&t.nextSibling()););if(!_p8||_m5>i)break;_d9=_p8.to+h,_d9>e&&(this.highlightRange(_n94.cursor(),Math.max(e,_p8.from+h),Math.min(i,_d9),"",_u41),this.startSpan(Math.min(i,_d9),o));}_f23&&t.parent();}else if(t.firstChild()){a&&(s="");do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,s,r),this.startSpan(Math.min(i,t.to),o);}}while(t.nextSibling());t.parent();}}}]);}();kl=al.define;yl=kl();Ml=kl();xl=kl(Ml);Sl=kl(Ml);Al=kl();Cl=kl(Al);Dl=kl(Al);Ol=kl();El=kl(Ol);Il=kl();Rl=kl();Tl=kl();Bl=kl(Tl);Ll=kl();_export("t",Nl={comment:yl,lineComment:kl(yl),blockComment:kl(yl),docComment:kl(yl),name:Ml,variableName:kl(Ml),typeName:xl,tagName:kl(xl),propertyName:Sl,attributeName:kl(Sl),className:kl(Ml),labelName:kl(Ml),namespace:kl(Ml),macroName:kl(Ml),literal:Al,string:Cl,docString:kl(Cl),character:kl(Cl),attributeValue:kl(Cl),number:Dl,integer:kl(Dl),"float":kl(Dl),bool:kl(Al),regexp:kl(Al),escape:kl(Al),color:kl(Al),url:kl(Al),keyword:Il,self:kl(Il),"null":kl(Il),atom:kl(Il),unit:kl(Il),modifier:kl(Il),operatorKeyword:kl(Il),controlKeyword:kl(Il),definitionKeyword:kl(Il),moduleKeyword:kl(Il),operator:Rl,derefOperator:kl(Rl),arithmeticOperator:kl(Rl),logicOperator:kl(Rl),bitwiseOperator:kl(Rl),compareOperator:kl(Rl),updateOperator:kl(Rl),definitionOperator:kl(Rl),typeOperator:kl(Rl),controlOperator:kl(Rl),punctuation:Tl,separator:kl(Tl),bracket:Bl,angleBracket:kl(Bl),squareBracket:kl(Bl),paren:kl(Bl),brace:kl(Bl),content:Ol,heading:El,heading1:kl(El),heading2:kl(El),heading3:kl(El),heading4:kl(El),heading5:kl(El),heading6:kl(El),contentSeparator:kl(Ol),list:kl(Ol),quote:kl(Ol),emphasis:kl(Ol),strong:kl(Ol),link:kl(Ol),monospace:kl(Ol),strikethrough:kl(Ol),inserted:kl(),deleted:kl(),changed:kl(),invalid:kl(),meta:Ll,documentMeta:kl(Ll),annotation:kl(Ll),processingInstruction:kl(Ll),definition:al.defineModifier(),constant:al.defineModifier(),"function":al.defineModifier(),standard:al.defineModifier(),local:al.defineModifier(),special:al.defineModifier()});wl([{tag:Nl.link,"class":"tok-link"},{tag:Nl.heading,"class":"tok-heading"},{tag:Nl.emphasis,"class":"tok-emphasis"},{tag:Nl.strong,"class":"tok-strong"},{tag:Nl.keyword,"class":"tok-keyword"},{tag:Nl.atom,"class":"tok-atom"},{tag:Nl.bool,"class":"tok-bool"},{tag:Nl.url,"class":"tok-url"},{tag:Nl.labelName,"class":"tok-labelName"},{tag:Nl.inserted,"class":"tok-inserted"},{tag:Nl.deleted,"class":"tok-deleted"},{tag:Nl.literal,"class":"tok-literal"},{tag:Nl.string,"class":"tok-string"},{tag:Nl.number,"class":"tok-number"},{tag:[Nl.regexp,Nl.escape,Nl.special(Nl.string)],"class":"tok-string2"},{tag:Nl.variableName,"class":"tok-variableName"},{tag:Nl.local(Nl.variableName),"class":"tok-variableName tok-local"},{tag:Nl.definition(Nl.variableName),"class":"tok-variableName tok-definition"},{tag:Nl.special(Nl.variableName),"class":"tok-variableName2"},{tag:Nl.definition(Nl.propertyName),"class":"tok-propertyName tok-definition"},{tag:Nl.typeName,"class":"tok-typeName"},{tag:Nl.namespace,"class":"tok-namespace"},{tag:Nl.className,"class":"tok-className"},{tag:Nl.macroName,"class":"tok-macroName"},{tag:Nl.propertyName,"class":"tok-propertyName"},{tag:Nl.operator,"class":"tok-operator"},{tag:Nl.comment,"class":"tok-comment"},{tag:Nl.meta,"class":"tok-meta"},{tag:Nl.invalid,"class":"tok-invalid"},{tag:Nl.punctuation,"class":"tok-punctuation"}]);jl=new Lh();_export("o",Pl=new Lh());Hl=/*#__PURE__*/function(){function Hl(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";_classCallCheck(this,Hl);this.data=t,this.name=s,St.prototype.hasOwnProperty("tree")||Object.defineProperty(St.prototype,"tree",{get:function get(){return Fl(this);}}),this.parser=e,this.extension=[Ql.of(this),St.languageData.of(function(t,e,i){var s=Wl(t,e,i),r=s.type.prop(jl);if(!r)return[];var n=t.facet(r),h=s.type.prop(Pl);if(h){var _r118=s.resolve(e-s.from,i);var _iterator161=_createForOfIteratorHelper(h),_step161;try{for(_iterator161.s();!(_step161=_iterator161.n()).done;){var _e193=_step161.value;if(_e193.test(_r118,t)){var _i160=t.facet(_e193.facet);return"replace"==_e193.type?_i160:_i160.concat(n);}}}catch(err){_iterator161.e(err);}finally{_iterator161.f();}}return n;})].concat(i);}return _createClass(Hl,[{key:"isActiveAt",value:function isActiveAt(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;return Wl(t,e,i).type.prop(jl)==this.data;}},{key:"findRegions",value:function findRegions(t){var _this70=this;var e=t.facet(Ql);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];var i=[],s=function s(t,e){if(t.prop(jl)==_this70.data)return void i.push({from:e,to:e+t.length});var r=t.prop(Lh.mounted);if(r){if(r.tree.prop(jl)==_this70.data){if(r.overlay){var _iterator162=_createForOfIteratorHelper(r.overlay),_step162;try{for(_iterator162.s();!(_step162=_iterator162.n()).done;){var _t228=_step162.value;i.push({from:_t228.from+e,to:_t228.to+e});}}catch(err){_iterator162.e(err);}finally{_iterator162.f();}}else i.push({from:e,to:e+t.length});return;}if(r.overlay){var _t229=i.length;if(s(r.tree,r.overlay[0].from+e),i.length>_t229)return;}}for(var _i161=0;_i161<t.children.length;_i161++){var _r119=t.children[_i161];_r119 instanceof Vh&&s(_r119,t.positions[_i161]+e);}};return s(Fl(t),0),i;}},{key:"allowsNesting",get:function get(){return!0;}}]);}();Hl.setState=ct.define();_export("L",Vl=/*#__PURE__*/function(_Hl){function Vl(t,e,i){var _this71;_classCallCheck(this,Vl);_this71=_callSuper(this,Vl,[t,e,[],i]),_this71.parser=e;return _this71;}_inherits(Vl,_Hl);return _createClass(Vl,[{key:"configure",value:function configure(t,e){return new Vl(this.data,this.parser.configure(t),e||this.name);}},{key:"allowsNesting",get:function get(){return this.parser.hasWrappers();}}],[{key:"define",value:function define(t){var e=zl(t.languageData);return new Vl(e,t.parser.configure({props:[jl.add(function(t){return t.isTop?e:void 0;})]}),t.name);}}]);}(Hl));ql=/*#__PURE__*/function(){function ql(t){_classCallCheck(this,ql);this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter();}return _createClass(ql,[{key:"length",get:function get(){return this.doc.length;}},{key:"syncTo",value:function syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length;}},{key:"chunk",value:function chunk(t){return this.syncTo(t),this.string;}},{key:"lineChunks",get:function get(){return!0;}},{key:"read",value:function read(t,e){var i=this.cursorPos-this.string.length;return t<i||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i);}}]);}();Ul=null;Jl=/*#__PURE__*/function(){function Jl(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var s=arguments.length>3?arguments[3]:undefined;var r=arguments.length>4?arguments[4]:undefined;var n=arguments.length>5?arguments[5]:undefined;var h=arguments.length>6?arguments[6]:undefined;var l=arguments.length>7?arguments[7]:undefined;_classCallCheck(this,Jl);this.parser=t,this.state=e,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=n,this.skipped=h,this.scheduleOn=l,this.parse=null,this.tempSkipped=[];}return _createClass(Jl,[{key:"startParse",value:function startParse(){return this.parser.startParse(new ql(this.state.doc),this.fragments);}},{key:"work",value:function work(t,e){var _this72=this;return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=Vh.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext(function(){var i;if("number"==typeof t){var _e194=Date.now()+t;t=function t(){return Date.now()>_e194;};}for(_this72.parse||(_this72.parse=_this72.startParse()),null!=e&&(null==_this72.parse.stoppedAt||_this72.parse.stoppedAt>e)&&e<_this72.state.doc.length&&_this72.parse.stopAt(e);;){var _s146=_this72.parse.advance();if(_s146){if(_this72.fragments=_this72.withoutTempSkipped(ll.addTree(_s146,_this72.fragments,null!=_this72.parse.stoppedAt)),_this72.treeLen=null!==(i=_this72.parse.stoppedAt)&&void 0!==i?i:_this72.state.doc.length,_this72.tree=_s146,_this72.parse=null,!(_this72.treeLen<(null!=e?e:_this72.state.doc.length)))return!0;_this72.parse=_this72.startParse();}if(t())return!1;}});}},{key:"takeTree",value:function takeTree(){var _this73=this;var t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(function(){for(;!(e=_this73.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(ll.addTree(this.tree,this.fragments,!0)),this.parse=null);}},{key:"withContext",value:function withContext(t){var e=Ul;Ul=this;try{return t();}finally{Ul=e;}}},{key:"withoutTempSkipped",value:function withoutTempSkipped(t){for(var _e195;_e195=this.tempSkipped.pop();)t=Gl(t,_e195.from,_e195.to);return t;}},{key:"changes",value:function changes(t,e){var i=this.fragments,s=this.tree,r=this.treeLen,n=this.viewport,h=this.skipped;if(this.takeTree(),!t.empty){var _e196=[];if(t.iterChangedRanges(function(t,i,s,r){return _e196.push({fromA:t,toA:i,fromB:s,toB:r});}),i=ll.applyChanges(i,_e196),s=Vh.empty,r=0,n={from:t.mapPos(n.from,-1),to:t.mapPos(n.to,1)},this.skipped.length){h=[];var _iterator163=_createForOfIteratorHelper(this.skipped),_step163;try{for(_iterator163.s();!(_step163=_iterator163.n()).done;){var _e197=_step163.value;var _i162=t.mapPos(_e197.from,1),_s147=t.mapPos(_e197.to,-1);_i162<_s147&&h.push({from:_i162,to:_s147});}}catch(err){_iterator163.e(err);}finally{_iterator163.f();}}}return new Jl(this.parser,e,i,s,r,n,h,this.scheduleOn);}},{key:"updateViewport",value:function updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;var e=this.skipped.length;for(var _e198=0;_e198<this.skipped.length;_e198++){var _this$skipped$_e=this.skipped[_e198],_i163=_this$skipped$_e.from,_s148=_this$skipped$_e.to;_i163<t.to&&_s148>t.from&&(this.fragments=Gl(this.fragments,_i163,_s148),this.skipped.splice(_e198--,1));}return!(this.skipped.length>=e)&&(this.reset(),!0);}},{key:"reset",value:function reset(){this.parse&&(this.takeTree(),this.parse=null);}},{key:"skipUntilInView",value:function skipUntilInView(t,e){this.skipped.push({from:t,to:e});}},{key:"isDone",value:function isDone(t){t=Math.min(t,this.state.doc.length);var e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t;}}],[{key:"create",value:function create(t,e,i){return new Jl(t,e,[],Vh.empty,0,i,[],null);}},{key:"getSkippingParser",value:function getSkippingParser(t){return new(/*#__PURE__*/function(_ol){function _class7(){_classCallCheck(this,_class7);return _callSuper(this,_class7,arguments);}_inherits(_class7,_ol);return _createClass(_class7,[{key:"createParse",value:function createParse(e,i,s){var r=s[0].from,n=s[s.length-1].to;return{parsedPos:r,advance:function advance(){var e=Ul;if(e){var _iterator164=_createForOfIteratorHelper(s),_step164;try{for(_iterator164.s();!(_step164=_iterator164.n()).done;){var _t231=_step164.value;e.tempSkipped.push(_t231);}}catch(err){_iterator164.e(err);}finally{_iterator164.f();}t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t);}return this.parsedPos=n,new Vh(jh.none,[],[],n-r);},stoppedAt:null,stopAt:function stopAt(){}};}}]);}(ol))();}},{key:"get",value:function get(){return Ul;}}]);}();Kl=/*#__PURE__*/function(){function Kl(t){_classCallCheck(this,Kl);this.context=t,this.tree=t.tree;}return _createClass(Kl,[{key:"apply",value:function apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;var e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new Kl(e);}}],[{key:"init",value:function init(t){var e=Math.min(3e3,t.doc.length),i=Jl.create(t.facet(Ql).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Kl(i);}}]);}();Hl.state=F.define({create:Kl.init,update:function update(t,e){var _iterator165=_createForOfIteratorHelper(e.effects),_step165;try{for(_iterator165.s();!(_step165=_iterator165.n()).done;){var _t232=_step165.value;if(_t232.is(Hl.setState))return _t232.value;}}catch(err){_iterator165.e(err);}finally{_iterator165.f();}return e.startState.facet(Ql)!=e.state.facet(Ql)?Kl.init(e.state):t.apply(e);}});_l=function _l(t){var e=setTimeout(function(){return t();},500);return function(){return clearTimeout(e);};};"undefined"!=typeof requestIdleCallback&&(_l=function _l(t){var e=-1,i=setTimeout(function(){e=requestIdleCallback(t,{timeout:400});},100);return function(){return e<0?clearTimeout(i):cancelIdleCallback(e);};});Xl="undefined"!=typeof navigator&&(null===($l=navigator.scheduling)||void 0===$l?void 0:$l.isInputPending)?function(){return navigator.scheduling.isInputPending();}:null;Yl=_i.fromClass(/*#__PURE__*/function(){function _class8(t){_classCallCheck(this,_class8);this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork();}return _createClass(_class8,[{key:"update",value:function update(t){var e=this.view.state.field(Hl.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e);}},{key:"scheduleWork",value:function scheduleWork(){if(this.working)return;var t=this.view.state,e=t.field(Hl.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=_l(this.work));}},{key:"work",value:function work(t){this.working=null;var e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;var _this$view3=this.view,i=_this$view3.state,s=_this$view3.viewport.to,r=i.field(Hl.state);if(r.tree==r.context.tree&&r.context.isDone(s+1e5))return;var n=Date.now()+Math.min(this.chunkBudget,100,t&&!Xl?Math.max(25,t.timeRemaining()-5):1e9),h=r.context.treeLen<s&&i.doc.length>s+1e3,l=r.context.work(function(){return Xl&&Xl()||Date.now()>n;},s+(h?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:Hl.setState.of(new Kl(r.context))})),this.chunkBudget>0&&(!l||h)&&this.scheduleWork(),this.checkAsyncSchedule(r.context);}},{key:"checkAsyncSchedule",value:function checkAsyncSchedule(t){var _this74=this;t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(function(){return _this74.scheduleWork();})["catch"](function(t){return Ui(_this74.view.state,t);}).then(function(){return _this74.workScheduled--;}),t.scheduleOn=null);}},{key:"destroy",value:function destroy(){this.working&&this.working();}},{key:"isWorking",value:function isWorking(){return!!(this.working||this.workScheduled>0);}}]);}(),{eventHandlers:{focus:function focus(){this.scheduleWork();}}});Ql=$.define({combine:function combine(t){return t.length?t[0]:null;},enables:function enables(t){return[Hl.state,Yl,Ur.contentAttributes.compute([t],function(e){var i=e.facet(t);return i&&i.name?{"data-language":i.name}:{};})];}});_export("h",Zl=/*#__PURE__*/_createClass(function Zl(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];_classCallCheck(this,Zl);this.language=t,this.support=e,this.extension=[t,e];}));to=$.define();eo=$.define({combine:function combine(t){if(!t.length)return" ";var e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(function(t){return t!=e[0];}))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e;}});no=/*#__PURE__*/function(){function no(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,no);this.state=t,this.options=e,this.unit=io(t);}return _createClass(no,[{key:"lineAt",value:function lineAt(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var i=this.state.doc.lineAt(t),_this$options=this.options,s=_this$options.simulateBreak,r=_this$options.simulateDoubleBreak;return null!=s&&s>=i.from&&s<=i.to?r&&s==t?{text:"",from:t}:(e<0?s<t:s<=t)?{text:i.text.slice(s-i.from),from:s}:{text:i.text.slice(0,s-i.from),from:i.from}:i;}},{key:"textAfterPos",value:function textAfterPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";var _this$lineAt=this.lineAt(t,e),i=_this$lineAt.text,s=_this$lineAt.from;return i.slice(t-s,Math.min(i.length,t+100-s));}},{key:"column",value:function column(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var _this$lineAt2=this.lineAt(t,e),i=_this$lineAt2.text,s=_this$lineAt2.from,r=this.countColumn(i,t-s),n=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return n>-1&&(r+=n-this.countColumn(i,i.search(/\S|$/))),r;}},{key:"countColumn",value:function countColumn(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t.length;return Vt(t,this.state.tabSize,e);}},{key:"lineIndent",value:function lineIndent(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var _this$lineAt3=this.lineAt(t,e),i=_this$lineAt3.text,s=_this$lineAt3.from,r=this.options.overrideIndentation;if(r){var _t235=r(s);if(_t235>-1)return _t235;}return this.countColumn(i,i.search(/\S|$/));}},{key:"simulatedBreak",get:function get(){return this.options.simulateBreak||null;}}]);}();_export("i",ho=new Lh());fo=/*#__PURE__*/function(_no){function fo(t,e,i){var _this75;_classCallCheck(this,fo);_this75=_callSuper(this,fo,[t.state,t.options]),_this75.base=t,_this75.pos=e,_this75.context=i;return _this75;}_inherits(fo,_no);return _createClass(fo,[{key:"node",get:function get(){return this.context.node;}},{key:"textAfter",get:function get(){return this.textAfterPos(this.pos);}},{key:"baseIndent",get:function get(){return this.baseIndentFor(this.node);}},{key:"baseIndentFor",value:function baseIndentFor(t){var e=this.state.doc.lineAt(t.from);for(;;){var _i165=t.resolve(e.from);for(;_i165.parent&&_i165.parent.from==_i165.from;)_i165=_i165.parent;if(ao(_i165,t))break;e=this.state.doc.lineAt(_i165.from);}return this.lineIndent(e.from);}},{key:"continue",value:function _continue(){return lo(this.context.next,this.base,this.pos);}}],[{key:"create",value:function create(t,e,i){return new fo(t,e,i);}}]);}(no);_export("f",mo=function mo(t){return t.baseIndent;});wo=$.define();_export("e",bo=new Lh());xo=ct.define({map:Mo});So=ct.define({map:Mo});Co=F.define({create:function create(){return ni.none;},update:function update(t,e){t=t.map(e.changes);var _iterator169=_createForOfIteratorHelper(e.effects),_step169;try{var _loop13=function _loop13(){var i=_step169.value;if(i.is(xo)&&!Oo(t,i.value.from,i.value.to)){var _e$state$facet=e.state.facet(Bo),_s155=_e$state$facet.preparePlaceholder,_r122=_s155?ni.replace({widget:new jo(_s155(e.state,i.value))}):$o;t=t.update({add:[_r122.range(i.value.from,i.value.to)]});}else i.is(So)&&(t=t.update({filter:function filter(t,e){return i.value.from!=t||i.value.to!=e;},filterFrom:i.value.from,filterTo:i.value.to}));};for(_iterator169.s();!(_step169=_iterator169.n()).done;){_loop13();}}catch(err){_iterator169.e(err);}finally{_iterator169.f();}if(e.selection){var _i167=!1,_s154=e.selection.main.head;t.between(_s154,_s154,function(t,e){t<_s154&&e>_s154&&(_i167=!0);}),_i167&&(t=t.update({filterFrom:_s154,filterTo:_s154,filter:function filter(t,e){return e<=_s154||t>=_s154;}}));}return t;},provide:function provide(t){return Ur.decorations.from(t);},toJSON:function toJSON(t,e){var i=[];return t.between(0,e.doc.length,function(t,e){i.push(t,e);}),i;},fromJSON:function fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");var e=[];for(var _i168=0;_i168<t.length;){var _s156=t[_i168++],_r123=t[_i168++];if("number"!=typeof _s156||"number"!=typeof _r123)throw new RangeError("Invalid JSON for fold state");e.push($o.range(_s156,_r123));}return ni.set(e,!0);}});Ro=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:function run(t){var _iterator170=_createForOfIteratorHelper(Ao(t)),_step170;try{for(_iterator170.s();!(_step170=_iterator170.n()).done;){var _e202=_step170.value;var _i169=yo(t.state,_e202.from,_e202.to);if(_i169)return t.dispatch({effects:Eo(t.state,[xo.of(_i169),Io(t,_i169)])}),!0;}}catch(err){_iterator170.e(err);}finally{_iterator170.f();}return!1;}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:function run(t){if(!t.state.field(Co,!1))return!1;var e=[];var _iterator171=_createForOfIteratorHelper(Ao(t)),_step171;try{for(_iterator171.s();!(_step171=_iterator171.n()).done;){var _i170=_step171.value;var _s157=Do(t.state,_i170.from,_i170.to);_s157&&e.push(So.of(_s157),Io(t,_s157,!1));}}catch(err){_iterator171.e(err);}finally{_iterator171.f();}return e.length&&t.dispatch({effects:e}),e.length>0;}},{key:"Ctrl-Alt-[",run:function run(t){var e=t.state,i=[];for(var _s158=0;_s158<e.doc.length;){var _r124=t.lineBlockAt(_s158),_n96=yo(e,_r124.from,_r124.to);_n96&&i.push(xo.of(_n96)),_s158=(_n96?t.lineBlockAt(_n96.to):_r124).to+1;}return i.length&&t.dispatch({effects:Eo(t.state,i)}),!!i.length;}},{key:"Ctrl-Alt-]",run:function run(t){var e=t.state.field(Co,!1);if(!e||!e.size)return!1;var i=[];return e.between(0,t.state.doc.length,function(t,e){i.push(So.of({from:t,to:e}));}),t.dispatch({effects:i}),!0;}}];To={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"};Bo=$.define({combine:function combine(t){return At(t,To);}});$o=ni.replace({widget:new(/*#__PURE__*/function(_si6){function _class9(){_classCallCheck(this,_class9);return _callSuper(this,_class9,arguments);}_inherits(_class9,_si6);return _createClass(_class9,[{key:"toDOM",value:function toDOM(t){return No(t,null);}}]);}(si))()});jo=/*#__PURE__*/function(_si7){function jo(t){var _this76;_classCallCheck(this,jo);_this76=_callSuper(this,jo),_this76.value=t;return _this76;}_inherits(jo,_si7);return _createClass(jo,[{key:"eq",value:function eq(t){return this.value==t.value;}},{key:"toDOM",value:function toDOM(t){return No(t,this.value);}}]);}(si);zo={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:function foldingChanged(){return!1;}};Po=/*#__PURE__*/function(_uh3){function Po(t,e){var _this77;_classCallCheck(this,Po);_this77=_callSuper(this,Po),_this77.config=t,_this77.open=e;return _this77;}_inherits(Po,_uh3);return _createClass(Po,[{key:"eq",value:function eq(t){return this.config==t.config&&this.open==t.open;}},{key:"toDOM",value:function toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);var e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e;}}]);}(uh);Ho=Ur.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});Wo=/*#__PURE__*/function(){function Wo(t,e){_classCallCheck(this,Wo);var i;function s(t){var e=Gt.newName();return(i||(i=Object.create(null)))["."+e]=t,e;}this.specs=t;var r="string"==typeof e.all?e.all:e.all?s(e.all):void 0,n=e.scope;this.scope=n instanceof Hl?function(t){return t.prop(jl)==n.data;}:n?function(t){return t==n;}:void 0,this.style=wl(t.map(function(t){return{tag:t.tag,"class":t["class"]||s(Object.assign({},t,{tag:null}))};}),{all:r}).style,this.module=i?new Gt(i):null,this.themeType=e.themeType;}return _createClass(Wo,null,[{key:"define",value:function define(t,e){return new Wo(t,e||{});}}]);}();Vo=$.define();Fo=$.define({combine:function combine(t){return t.length?[t[0]]:null;}});Uo=/*#__PURE__*/function(){function Uo(t){_classCallCheck(this,Uo);this.markCache=Object.create(null),this.tree=Fl(t.state),this.decorations=this.buildDeco(t,qo(t.state)),this.decoratedTo=t.viewport.to;}return _createClass(Uo,[{key:"update",value:function update(t){var e=Fl(t.state),i=qo(t.state),s=i!=qo(t.startState),r=t.view.viewport,n=t.changes.mapPos(this.decoratedTo,1);e.length<r.to&&!s&&e.type==this.tree.type&&n>=r.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=n):(e!=this.tree||t.viewportChanged||s)&&(this.tree=e,this.decorations=this.buildDeco(t.view,i),this.decoratedTo=r.to);}},{key:"buildDeco",value:function buildDeco(t,e){var _this78=this;if(!e||!this.tree.length)return ni.none;var i=new Rt();var _iterator172=_createForOfIteratorHelper(t.visibleRanges),_step172;try{for(_iterator172.s();!(_step172=_iterator172.n()).done;){var _step172$value=_step172.value,_s159=_step172$value.from,_r125=_step172$value.to;bl(this.tree,e,function(t,e,s){i.add(t,e,_this78.markCache[s]||(_this78.markCache[s]=ni.mark({"class":s})));},_s159,_r125);}}catch(err){_iterator172.e(err);}finally{_iterator172.f();}return i.finish();}}]);}();Jo=_.high(_i.fromClass(Uo,{decorations:function decorations(t){return t.decorations;}}));Go=Wo.define([{tag:Nl.meta,color:"#404740"},{tag:Nl.link,textDecoration:"underline"},{tag:Nl.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Nl.emphasis,fontStyle:"italic"},{tag:Nl.strong,fontWeight:"bold"},{tag:Nl.strikethrough,textDecoration:"line-through"},{tag:Nl.keyword,color:"#708"},{tag:[Nl.atom,Nl.bool,Nl.url,Nl.contentSeparator,Nl.labelName],color:"#219"},{tag:[Nl.literal,Nl.inserted],color:"#164"},{tag:[Nl.string,Nl.deleted],color:"#a11"},{tag:[Nl.regexp,Nl.escape,Nl.special(Nl.string)],color:"#e40"},{tag:Nl.definition(Nl.variableName),color:"#00f"},{tag:Nl.local(Nl.variableName),color:"#30a"},{tag:[Nl.typeName,Nl.namespace],color:"#085"},{tag:Nl.className,color:"#167"},{tag:[Nl.special(Nl.variableName),Nl.macroName],color:"#256"},{tag:Nl.definition(Nl.propertyName),color:"#00c"},{tag:Nl.comment,color:"#940"},{tag:Nl.invalid,color:"#f00"}]);Ko=Ur.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}});_o=1e4;Xo="()[]{}";Yo=$.define({combine:function combine(t){return At(t,{afterCursor:!0,brackets:Xo,maxScanDistance:_o,renderMatch:tu});}});Qo=ni.mark({"class":"cm-matchingBracket"});Zo=ni.mark({"class":"cm-nonmatchingBracket"});eu=F.define({create:function create(){return ni.none;},update:function update(t,e){if(!e.docChanged&&!e.selection)return t;var i=[],s=e.state.facet(Yo);var _iterator173=_createForOfIteratorHelper(e.state.selection.ranges),_step173;try{for(_iterator173.s();!(_step173=_iterator173.n()).done;){var _t238=_step173.value;if(!_t238.empty)continue;var _r126=hu(e.state,_t238.head,-1,s)||_t238.head>0&&hu(e.state,_t238.head-1,1,s)||s.afterCursor&&(hu(e.state,_t238.head,1,s)||_t238.head<e.state.doc.length&&hu(e.state,_t238.head+1,-1,s));_r126&&(i=i.concat(s.renderMatch(_r126,e.state)));}}catch(err){_iterator173.e(err);}finally{_iterator173.f();}return ni.set(i,!0);},provide:function provide(t){return Ur.decorations.from(t);}});iu=[eu,Ko];su=new Lh();ou=Object.create(null);uu=[jh.none];fu=[];au=Object.create(null);cu=Object.create(null);for(_i171=0,_arr2=[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]];_i171<_arr2.length;_i171++){_arr2$_i=_slicedToArray(_arr2[_i171],2);_t243=_arr2$_i[0];_e205=_arr2$_i[1];cu[_t243]=pu(ou,_e205);}pi.RTL,pi.LTR;gu=mu(Mu,0);wu=mu(yu,0);bu=mu(function(t,e){return yu(t,e,function(t){var e=[];var _iterator177=_createForOfIteratorHelper(t.selection.ranges),_step177;try{for(_iterator177.s();!(_step177=_iterator177.n()).done;){var _i173=_step177.value;var _s164=t.doc.lineAt(_i173.from),_r128=_i173.to<=_s164.to?_s164:t.doc.lineAt(_i173.to),_n98=e.length-1;_n98>=0&&e[_n98].to>_s164.from?e[_n98].to=_r128.to:e.push({from:_s164.from+/^\s*/.exec(_s164.text)[0].length,to:_r128.to});}}catch(err){_iterator177.e(err);}finally{_iterator177.f();}return e;}(e));},0);ku=50;xu=ut.define();Su=ut.define();Au=$.define();Cu=$.define({combine:function combine(t){return At(t,{minDepth:100,newGroupDelay:500,joinToEvent:function joinToEvent(t,e){return e;}},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:function joinToEvent(t,e){return function(i,s){return t(i,s)||e(i,s);};}});}});Du=F.define({create:function create(){return Fu.empty;},update:function update(t,e){var i=e.state.facet(Cu),s=e.annotation(xu);if(s){var _r132=Bu.fromTransaction(e,s.selection),_n103=s.side,_h68=0==_n103?t.undone:t.done;return _h68=_r132?Lu(_h68,_h68.length,i.minDepth,_r132):zu(_h68,e.startState.selection),new Fu(0==_n103?s.rest:_h68,0==_n103?_h68:s.rest);}var r=e.annotation(Su);if("full"!=r&&"before"!=r||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);var n=Bu.fromTransaction(e),h=e.annotation(dt.time),l=e.annotation(dt.userEvent);return n?t=t.addChanges(n,h,l,i,e):e.selection&&(t=t.addSelection(e.startState.selection,h,l,i.newGroupDelay)),"full"!=r&&"after"!=r||(t=t.isolate()),t;},toJSON:function toJSON(t){return{done:t.done.map(function(t){return t.toJSON();}),undone:t.undone.map(function(t){return t.toJSON();})};},fromJSON:function fromJSON(t){return new Fu(t.done.map(Bu.fromJSON),t.undone.map(Bu.fromJSON));}});Eu=Ou(0,!1);Iu=Ou(1,!1);Ru=Ou(0,!0);Tu=Ou(1,!0);Bu=/*#__PURE__*/function(){function Bu(t,e,i,s,r){_classCallCheck(this,Bu);this.changes=t,this.effects=e,this.mapped=i,this.startSelection=s,this.selectionsAfter=r;}return _createClass(Bu,[{key:"setSelAfter",value:function setSelAfter(t){return new Bu(this.changes,this.effects,this.mapped,this.startSelection,t);}},{key:"toJSON",value:function toJSON(){var t,e,i;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(function(t){return t.toJSON();})};}}],[{key:"fromJSON",value:function fromJSON(t){return new Bu(t.changes&&A.fromJSON(t.changes),[],t.mapped&&S.fromJSON(t.mapped),t.startSelection&&B.fromJSON(t.startSelection),t.selectionsAfter.map(B.fromJSON));}},{key:"fromTransaction",value:function fromTransaction(t,e){var i=$u;var _iterator181=_createForOfIteratorHelper(t.startState.facet(Au)),_step181;try{for(_iterator181.s();!(_step181=_iterator181.n()).done;){var _e212=_step181.value;var _s166=_e212(t);_s166.length&&(i=i.concat(_s166));}}catch(err){_iterator181.e(err);}finally{_iterator181.f();}return!i.length&&t.changes.empty?null:new Bu(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,$u);}},{key:"selection",value:function selection(t){return new Bu(void 0,$u,void 0,void 0,t);}}]);}();$u=[];ju=200;Vu=/^(input\.type|delete)($|\.)/;Fu=/*#__PURE__*/function(){function Fu(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:void 0;_classCallCheck(this,Fu);this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=s;}return _createClass(Fu,[{key:"isolate",value:function isolate(){return this.prevTime?new Fu(this.done,this.undone):this;}},{key:"addChanges",value:function addChanges(t,e,i,s,r){var n=this.done,h=n[n.length-1];return n=h&&h.changes&&!h.changes.empty&&t.changes&&(!i||Vu.test(i))&&(!h.selectionsAfter.length&&e-this.prevTime<s.newGroupDelay&&s.joinToEvent(r,function(t,e){var i=[],s=!1;return t.iterChangedRanges(function(t,e){return i.push(t,e);}),e.iterChangedRanges(function(t,e,r,n){for(var _t251=0;_t251<i.length;){var _e214=i[_t251++],_h69=i[_t251++];n>=_e214&&r<=_h69&&(s=!0);}}),s;}(h.changes,t.changes))||"input.type.compose"==i)?Lu(n,n.length-1,s.minDepth,new Bu(t.changes.compose(h.changes),Nu(t.effects,h.effects),h.mapped,h.startSelection,$u)):Lu(n,n.length,s.minDepth,t),new Fu(n,$u,e,i);}},{key:"addSelection",value:function addSelection(t,e,i,s){var r=this.done.length?this.done[this.done.length-1].selectionsAfter:$u;return r.length>0&&e-this.prevTime<s&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&(n=r[r.length-1],h=t,n.ranges.length==h.ranges.length&&0===n.ranges.filter(function(t,e){return t.empty!=h.ranges[e].empty;}).length)?this:new Fu(zu(this.done,t),this.undone,e,i);var n,h;}},{key:"addMapping",value:function addMapping(t){return new Fu(Hu(this.done,t),Hu(this.undone,t),this.prevTime,this.prevUserEvent);}},{key:"pop",value:function pop(t,e,i){var s=0==t?this.done:this.undone;if(0==s.length)return null;var r=s[s.length-1],n=r.selectionsAfter[0]||e.selection;if(i&&r.selectionsAfter.length)return e.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:xu.of({side:t,rest:Pu(s),selection:n}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){var _i182=1==s.length?$u:s.slice(0,s.length-1);return r.mapped&&(_i182=Hu(_i182,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:xu.of({side:t,rest:_i182,selection:n}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0});}return null;}}]);}();Fu.empty=new Fu($u,$u);qu=[{key:"Mod-z",run:Eu,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Iu,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Iu,preventDefault:!0},{key:"Mod-u",run:Ru,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Tu,preventDefault:!0}];Yu=function Yu(t){return _u(t,!Xu(t));};Qu=function Qu(t){return _u(t,Xu(t));};rf=function rf(t){return sf(t,!1);};nf=function nf(t){return sf(t,!0);};of=function of(t){return lf(t,!1);};uf=function uf(t){return lf(t,!0);};df=function df(t){return cf(t,!Xu(t));};pf=function pf(t){return cf(t,Xu(t));};wf=function wf(t){return gf(t,!1);};bf=function bf(t){return gf(t,!0);};kf=function kf(t){return vf(t,!1);};yf=function yf(t){return vf(t,!0);};Mf=function Mf(_ref24){var t=_ref24.state,e=_ref24.dispatch;return e(Ju(t,{anchor:0})),!0;};xf=function xf(_ref25){var t=_ref25.state,e=_ref25.dispatch;return e(Ju(t,{anchor:t.doc.length})),!0;};Sf=function Sf(_ref26){var t=_ref26.state,e=_ref26.dispatch;return e(Ju(t,{anchor:t.selection.main.anchor,head:0})),!0;};Af=function Af(_ref27){var t=_ref27.state,e=_ref27.dispatch;return e(Ju(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0;};Of=function Of(t,e,i){return Cf(t,function(s){var r,n,h=s.from,l=t.state,o=l.doc.lineAt(h);if(i&&!e&&h>o.from&&h<o.from+200&&!/[^ \t]/.test(r=o.text.slice(0,h-o.from))){if("\t"==r[r.length-1])return h-1;var _t252=Vt(r,l.tabSize)%io(l)||io(l);for(var _e218=0;_e218<_t252&&" "==r[r.length-1-_e218];_e218++)h--;n=h;}else n=p(o.text,h-o.from,e,e)+o.from,n==h&&o.number!=(e?l.doc.lines:1)?n+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(n-o.from,h-o.from))&&(n=p(o.text,n-o.from,!1,!1)+o.from);return n;});};Ef=function Ef(t){return Of(t,!1,!0);};If=function If(t){return Of(t,!0,!1);};Rf=function Rf(t,e){return Cf(t,function(i){var s=i.head,r=t.state,n=r.doc.lineAt(s),h=r.charCategorizer(s);for(var _t253=null;;){if(s==(e?n.to:n.from)){s==i.head&&n.number!=(e?r.doc.lines:1)&&(s+=e?1:-1);break;}var _l64=p(n.text,s-n.from,e)+n.from,_o43=n.text.slice(Math.min(s,_l64)-n.from,Math.max(s,_l64)-n.from),_u42=h(_o43);if(null!=_t253&&_u42!=_t253)break;" "==_o43&&s==i.head||(_t253=_u42),s=_l64;}return s;});};Tf=function Tf(t){return Rf(t,!1);};$f=jf(!1);Pf=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:function run(t){return Gu(t,function(e){return ef(t.state,e,!Xu(t));});},shift:function shift(t){return af(t,function(e){return ef(t.state,e,!Xu(t));});}},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:function run(t){return Gu(t,function(e){return ef(t.state,e,Xu(t));});},shift:function shift(t){return af(t,function(e){return ef(t.state,e,Xu(t));});}},{key:"Alt-ArrowUp",run:function run(_ref29){var t=_ref29.state,e=_ref29.dispatch;return Lf(t,e,!1);}},{key:"Shift-Alt-ArrowUp",run:function run(_ref30){var t=_ref30.state,e=_ref30.dispatch;return Nf(t,e,!1);}},{key:"Alt-ArrowDown",run:function run(_ref31){var t=_ref31.state,e=_ref31.dispatch;return Lf(t,e,!0);}},{key:"Shift-Alt-ArrowDown",run:function run(_ref32){var t=_ref32.state,e=_ref32.dispatch;return Nf(t,e,!0);}},{key:"Escape",run:function run(_ref33){var t=_ref33.state,e=_ref33.dispatch;var i=t.selection,s=null;return i.ranges.length>1?s=B.create([i.main]):i.main.empty||(s=B.create([B.cursor(i.main.head)])),!!s&&(e(Ju(t,s)),!0);}},{key:"Mod-Enter",run:jf(!0)},{key:"Alt-l",mac:"Ctrl-l",run:function run(_ref34){var t=_ref34.state,e=_ref34.dispatch;var i=Bf(t).map(function(_ref35){var e=_ref35.from,i=_ref35.to;return B.range(e,Math.min(i+1,t.doc.length));});return e(t.update({selection:B.create(i),userEvent:"select"})),!0;}},{key:"Mod-i",run:function run(_ref36){var t=_ref36.state,e=_ref36.dispatch;var i=Uu(t.selection,function(e){var i;for(var _s171=Fl(t).resolveStack(e.from,1);_s171;_s171=_s171.next){var _s172=_s171,_t256=_s172.node;if((_t256.from<e.from&&_t256.to>=e.to||_t256.to>e.to&&_t256.from<=e.from)&&(null===(i=_t256.parent)||void 0===i?void 0:i.parent))return B.range(_t256.to,_t256.from);}return e;});return e(Ju(t,i)),!0;},preventDefault:!0},{key:"Mod-[",run:function run(_ref37){var t=_ref37.state,e=_ref37.dispatch;return!t.readOnly&&(e(t.update(zf(t,function(e,i){var s=/^\s*/.exec(e.text)[0];if(!s)return;var r=Vt(s,t.tabSize),n=0,h=so(t,Math.max(0,r-io(t)));for(;n<s.length&&n<h.length&&s.charCodeAt(n)==h.charCodeAt(n);)n++;i.push({from:e.from+n,to:e.from+s.length,insert:h.slice(n)});}),{userEvent:"delete.dedent"})),!0);}},{key:"Mod-]",run:function run(_ref38){var t=_ref38.state,e=_ref38.dispatch;return!t.readOnly&&(e(t.update(zf(t,function(e,i){i.push({from:e.from,insert:t.facet(eo)});}),{userEvent:"input.indent"})),!0);}},{key:"Mod-Alt-\\",run:function run(_ref39){var t=_ref39.state,e=_ref39.dispatch;if(t.readOnly)return!1;var i=Object.create(null),s=new no(t,{overrideIndentation:function overrideIndentation(t){var e=i[t];return null==e?-1:e;}}),r=zf(t,function(e,r,n){var h=ro(s,e.from);if(null==h)return;/\S/.test(e.text)||(h=0);var l=/^\s*/.exec(e.text)[0],o=so(t,h);(l!=o||n.from<e.from+l.length)&&(i[e.from]=h,r.push({from:e.from,to:e.from+l.length,insert:o}));});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0;}},{key:"Shift-Mod-k",run:function run(t){if(t.state.readOnly)return!1;var e=t.state,i=e.changes(Bf(e).map(function(_ref40){var t=_ref40.from,i=_ref40.to;return t>0?t--:i<e.doc.length&&i++,{from:t,to:i};})),s=Uu(e.selection,function(e){var i;if(t.lineWrapping){var _s173=t.lineBlockAt(e.head),_r135=t.coordsAtPos(e.head,e.assoc||1);_r135&&(i=_s173.bottom+t.documentTop-_r135.bottom+t.defaultLineHeight/2);}return t.moveVertically(e,!0,i);}).map(i);return t.dispatch({changes:i,selection:s,scrollIntoView:!0,userEvent:"delete.line"}),!0;}},{key:"Shift-Mod-\\",run:function run(_ref41){var t=_ref41.state,e=_ref41.dispatch;return function(t,e,i){var s=!1,r=Uu(t.selection,function(e){var r=hu(t,e.head,-1)||hu(t,e.head,1)||e.head>0&&hu(t,e.head-1,1)||e.head<t.doc.length&&hu(t,e.head+1,-1);if(!r||!r.end)return e;s=!0;var n=r.start.from==e.head?r.end.to:r.end.from;return i?B.range(e.anchor,n):B.cursor(n);});return!!s&&(e(Ju(t,r)),!0);}(t,e,!1);}},{key:"Mod-/",run:function run(t){var e=t.state,i=e.doc.lineAt(e.selection.main.from),s=vu(t.state,i.from);return s.line?gu(t):!!s.block&&bu(t);}},{key:"Alt-A",run:wu}].concat([{key:"ArrowLeft",run:Yu,shift:df,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:function run(t){return Zu(t,!Xu(t));},shift:function shift(t){return mf(t,!Xu(t));},preventDefault:!0},{mac:"Cmd-ArrowLeft",run:function run(t){return Gu(t,function(e){return ff(t,e,!Xu(t));});},shift:function shift(t){return af(t,function(e){return ff(t,e,!Xu(t));});},preventDefault:!0},{key:"ArrowRight",run:Qu,shift:pf,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:function run(t){return Zu(t,Xu(t));},shift:function shift(t){return mf(t,Xu(t));},preventDefault:!0},{mac:"Cmd-ArrowRight",run:function run(t){return Gu(t,function(e){return ff(t,e,Xu(t));});},shift:function shift(t){return af(t,function(e){return ff(t,e,Xu(t));});},preventDefault:!0},{key:"ArrowUp",run:rf,shift:wf,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Mf,shift:Sf},{mac:"Ctrl-ArrowUp",run:of,shift:kf},{key:"ArrowDown",run:nf,shift:bf,preventDefault:!0},{mac:"Cmd-ArrowDown",run:xf,shift:Af},{mac:"Ctrl-ArrowDown",run:uf,shift:yf},{key:"PageUp",run:of,shift:kf},{key:"PageDown",run:uf,shift:yf},{key:"Home",run:function run(t){return Gu(t,function(e){return ff(t,e,!1);});},shift:function shift(t){return af(t,function(e){return ff(t,e,!1);});},preventDefault:!0},{key:"Mod-Home",run:Mf,shift:Sf},{key:"End",run:function run(t){return Gu(t,function(e){return ff(t,e,!0);});},shift:function shift(t){return af(t,function(e){return ff(t,e,!0);});},preventDefault:!0},{key:"Mod-End",run:xf,shift:Af},{key:"Enter",run:$f},{key:"Mod-a",run:function run(_ref42){var t=_ref42.state,e=_ref42.dispatch;return e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0;}},{key:"Backspace",run:Ef,shift:Ef},{key:"Delete",run:If},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Tf},{key:"Mod-Delete",mac:"Alt-Delete",run:function run(t){return Rf(t,!0);}},{mac:"Mod-Backspace",run:function run(t){return Cf(t,function(e){var i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1);});}},{mac:"Mod-Delete",run:function run(t){return Cf(t,function(e){var i=t.moveToLineBoundary(e,!0).head;return e.head<i?i:Math.min(t.state.doc.length,e.head+1);});}}].concat([{key:"Ctrl-b",run:Yu,shift:df,preventDefault:!0},{key:"Ctrl-f",run:Qu,shift:pf},{key:"Ctrl-p",run:rf,shift:wf},{key:"Ctrl-n",run:nf,shift:bf},{key:"Ctrl-a",run:function run(t){return Gu(t,function(e){return B.cursor(t.lineBlockAt(e.head).from,1);});},shift:function shift(t){return af(t,function(e){return B.cursor(t.lineBlockAt(e.head).from);});}},{key:"Ctrl-e",run:function run(t){return Gu(t,function(e){return B.cursor(t.lineBlockAt(e.head).to,-1);});},shift:function shift(t){return af(t,function(e){return B.cursor(t.lineBlockAt(e.head).to);});}},{key:"Ctrl-d",run:If},{key:"Ctrl-h",run:Ef},{key:"Ctrl-k",run:function run(t){return Cf(t,function(e){var i=t.lineBlockAt(e.head).to;return e.head<i?i:Math.min(t.state.doc.length,e.head+1);});}},{key:"Ctrl-Alt-h",run:Tf},{key:"Ctrl-o",run:function run(_ref43){var e=_ref43.state,i=_ref43.dispatch;if(e.readOnly)return!1;var s=e.changeByRange(function(e){return{changes:{from:e.from,to:e.to,insert:t.of(["",""])},range:B.cursor(e.from)};});return i(e.update(s,{scrollIntoView:!0,userEvent:"input"})),!0;}},{key:"Ctrl-t",run:function run(_ref44){var t=_ref44.state,e=_ref44.dispatch;if(t.readOnly)return!1;var i=t.changeByRange(function(e){if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};var i=e.from,s=t.doc.lineAt(i),r=i==s.from?i-1:p(s.text,i-s.from,!1)+s.from,n=i==s.to?i+1:p(s.text,i-s.from,!0)+s.from;return{changes:{from:r,to:n,insert:t.doc.slice(i,n).append(t.doc.slice(r,i))},range:B.cursor(n)};});return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0);}},{key:"Ctrl-v",run:uf}].map(function(t){return{mac:t.key,run:t.run,shift:t.shift};})));Vf="function"==typeof String.prototype.normalize?function(t){return t.normalize("NFKD");}:function(t){return t;};Ff=/*#__PURE__*/function(){function Ff(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:t.length;var r=arguments.length>4?arguments[4]:undefined;var n=arguments.length>5?arguments[5]:undefined;_classCallCheck(this,Ff);this.test=n,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,s),this.bufferStart=i,this.normalize=r?function(t){return r(Vf(t));}:Vf,this.query=this.normalize(e);}return _createClass(Ff,[{key:"peek",value:function peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value;}return v(this.buffer,this.bufferPos);}},{key:"next",value:function next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping();}},{key:"nextOverlapping",value:function nextOverlapping(){for(;;){var _t257=this.peek();if(_t257<0)return this.done=!0,this;var _e221=k(_t257),_i186=this.bufferStart+this.bufferPos;this.bufferPos+=y(_t257);var _s174=this.normalize(_e221);for(var _t258=0,_r136=_i186;;_t258++){var _n107=_s174.charCodeAt(_t258),_h74=this.match(_n107,_r136,this.bufferPos+this.bufferStart);if(_t258==_s174.length-1){if(_h74)return this.value=_h74,this;break;}_r136==_i186&&_t258<_e221.length&&_e221.charCodeAt(_t258)==_n107&&_r136++;}}}},{key:"match",value:function match(t,e,i){var s=null;for(var _e222=0;_e222<this.matches.length;_e222+=2){var _r137=this.matches[_e222],_n108=!1;this.query.charCodeAt(_r137)==t&&(_r137==this.query.length-1?s={from:this.matches[_e222+1],to:i}:(this.matches[_e222]++,_n108=!0)),_n108||(this.matches.splice(_e222,2),_e222-=2);}return this.query.charCodeAt(0)==t&&(1==this.query.length?s={from:e,to:i}:this.matches.push(1,e)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s;}}]);}();"undefined"!=typeof Symbol&&(Ff.prototype[Symbol.iterator]=function(){return this;});qf={from:-1,to:-1,match:/.*/.exec("")};Uf="gm"+(null==/x/.unicode?"":"u");Jf=/*#__PURE__*/function(){function Jf(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:t.length;_classCallCheck(this,Jf);if(this.text=t,this.to=r,this.curLine="",this.done=!1,this.value=qf,/\\[sWDnr]|\n|\r|\[\^/.test(e))return new _f(t,e,i,s,r);this.re=new RegExp(e,Uf+((null==i?void 0:i.ignoreCase)?"i":"")),this.test=null==i?void 0:i.test,this.iter=t.iter();var n=t.lineAt(s);this.curLineStart=n.from,this.matchPos=Xf(t,s),this.getLine(this.curLineStart);}return _createClass(Jf,[{key:"getLine",value:function getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next());}},{key:"nextLine",value:function nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0);}},{key:"next",value:function next(){for(var _t259=this.matchPos-this.curLineStart;;){this.re.lastIndex=_t259;var _e223=this.matchPos<=this.to&&this.re.exec(this.curLine);if(_e223){var _i187=this.curLineStart+_e223.index,_s175=_i187+_e223[0].length;if(this.matchPos=Xf(this.text,_s175+(_i187==_s175?1:0)),_i187==this.curLineStart+this.curLine.length&&this.nextLine(),(_i187<_s175||_i187>this.value.to)&&(!this.test||this.test(_i187,_s175,_e223)))return this.value={from:_i187,to:_s175,match:_e223},this;_t259=this.matchPos-this.curLineStart;}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),_t259=0;}}}}]);}();Gf=new WeakMap();Kf=/*#__PURE__*/function(){function Kf(t,e){_classCallCheck(this,Kf);this.from=t,this.text=e;}return _createClass(Kf,[{key:"to",get:function get(){return this.from+this.text.length;}}],[{key:"get",value:function get(t,e,i){var s=Gf.get(t);if(!s||s.from>=i||s.to<=e){var _s176=new Kf(e,t.sliceString(e,i));return Gf.set(t,_s176),_s176;}if(s.from==e&&s.to==i)return s;var r=s.text,n=s.from;return n>e&&(r=t.sliceString(e,n)+r,n=e),s.to<i&&(r+=t.sliceString(s.to,i)),Gf.set(t,new Kf(n,r)),new Kf(e,r.slice(e-n,i-n));}}]);}();_f=/*#__PURE__*/function(){function _f(t,e,i,s,r){_classCallCheck(this,_f);this.text=t,this.to=r,this.done=!1,this.value=qf,this.matchPos=Xf(t,s),this.re=new RegExp(e,Uf+((null==i?void 0:i.ignoreCase)?"i":"")),this.test=null==i?void 0:i.test,this.flat=Kf.get(t,s,this.chunkEnd(s+5e3));}return _createClass(_f,[{key:"chunkEnd",value:function chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to;}},{key:"next",value:function next(){for(;;){var _t260=this.re.lastIndex=this.matchPos-this.flat.from,_e224=this.re.exec(this.flat.text);if(_e224&&!_e224[0]&&_e224.index==_t260&&(this.re.lastIndex=_t260+1,_e224=this.re.exec(this.flat.text)),_e224){var _t261=this.flat.from+_e224.index,_i188=_t261+_e224[0].length;if((this.flat.to>=this.to||_e224.index+_e224[0].length<=this.flat.text.length-10)&&(!this.test||this.test(_t261,_i188,_e224)))return this.value={from:_t261,to:_i188,match:_e224},this.matchPos=Xf(this.text,_i188+(_t261==_i188?1:0)),this;}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Kf.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length));}}}]);}();"undefined"!=typeof Symbol&&(Jf.prototype[Symbol.iterator]=_f.prototype[Symbol.iterator]=function(){return this;});Qf=ct.define();Zf=F.define({create:function create(){return!0;},update:function update(t,e){var _iterator189=_createForOfIteratorHelper(e.effects),_step189;try{for(_iterator189.s();!(_step189=_iterator189.n()).done;){var _i190=_step189.value;_i190.is(Qf)&&(t=_i190.value);}}catch(err){_iterator189.e(err);}finally{_iterator189.f();}return t;},provide:function provide(t){return oh.from(t,function(t){return t?Yf:null;});}});ta=Ur.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}});ea={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1};ia=$.define({combine:function combine(t){return At(t,ea,{highlightWordAroundCursor:function highlightWordAroundCursor(t,e){return t||e;},minSelectionLength:Math.min,maxMatches:Math.min});}});sa=ni.mark({"class":"cm-selectionMatch"});ra=ni.mark({"class":"cm-selectionMatch cm-selectionMatch-main"});ha=_i.fromClass(/*#__PURE__*/function(){function _class10(t){_classCallCheck(this,_class10);this.decorations=this.getDeco(t);}return _createClass(_class10,[{key:"update",value:function update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view));}},{key:"getDeco",value:function getDeco(t){var e=t.state.facet(ia),i=t.state,s=i.selection;if(s.ranges.length>1)return ni.none;var r,n=s.main,h=null;if(n.empty){if(!e.highlightWordAroundCursor)return ni.none;var _t263=i.wordAt(n.head);if(!_t263)return ni.none;h=i.charCategorizer(n.head),r=i.sliceDoc(_t263.from,_t263.to);}else{var _t264=n.to-n.from;if(_t264<e.minSelectionLength||_t264>200)return ni.none;if(e.wholeWords){if(r=i.sliceDoc(n.from,n.to),h=i.charCategorizer(n.head),!na(h,i,n.from,n.to)||!function(t,e,i,s){return t(e.sliceDoc(i,i+1))==kt.Word&&t(e.sliceDoc(s-1,s))==kt.Word;}(h,i,n.from,n.to))return ni.none;}else if(r=i.sliceDoc(n.from,n.to),!r)return ni.none;}var l=[];var _iterator190=_createForOfIteratorHelper(t.visibleRanges),_step190;try{for(_iterator190.s();!(_step190=_iterator190.n()).done;){var _s177=_step190.value;var _t265=new Ff(i.doc,r,_s177.from,_s177.to);for(;!_t265.next().done;){var _t265$value=_t265.value,_s178=_t265$value.from,_r138=_t265$value.to;if((!h||na(h,i,_s178,_r138))&&(n.empty&&_s178<=n.from&&_r138>=n.to?l.push(ra.range(_s178,_r138)):(_s178>=n.to||_r138<=n.from)&&l.push(sa.range(_s178,_r138)),l.length>e.maxMatches))return ni.none;}}}catch(err){_iterator190.e(err);}finally{_iterator190.f();}return ni.set(l);}}]);}(),{decorations:function decorations(t){return t.decorations;}});la=Ur.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});oa=$.define({combine:function combine(t){return At(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:function createPanel(t){return new ja(t);},scrollToMatch:function scrollToMatch(t){return Ur.scrollIntoView(t);}});}});ua=/*#__PURE__*/function(){function ua(t){_classCallCheck(this,ua);this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,Uf),!0;}catch(t){return!1;}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord;}return _createClass(ua,[{key:"unquote",value:function unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,function(t,e){return"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\";});}},{key:"eq",value:function eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord;}},{key:"create",value:function create(){return this.regexp?new ga(this):new ca(this);}},{key:"getCursor",value:function getCursor(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2?arguments[2]:undefined;var s=t.doc?t:St.create({doc:t});return null==i&&(i=s.doc.length),this.regexp?da(this,s,e,i):aa(this,s,e,i);}}]);}();fa=/*#__PURE__*/_createClass(function fa(t){_classCallCheck(this,fa);this.spec=t;});ca=/*#__PURE__*/function(_fa){function ca(t){_classCallCheck(this,ca);return _callSuper(this,ca,[t]);}_inherits(ca,_fa);return _createClass(ca,[{key:"nextMatch",value:function nextMatch(t,e,i){var s=aa(this.spec,t,i,t.doc.length).nextOverlapping();return s.done&&(s=aa(this.spec,t,0,e).nextOverlapping()),s.done?null:s.value;}},{key:"prevMatchInRange",value:function prevMatchInRange(t,e,i){for(var _s179=i;;){var _i191=Math.max(e,_s179-1e4-this.spec.unquoted.length),_r139=aa(this.spec,t,_i191,_s179),_n109=null;for(;!_r139.nextOverlapping().done;)_n109=_r139.value;if(_n109)return _n109;if(_i191==e)return null;_s179-=1e4;}}},{key:"prevMatch",value:function prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length);}},{key:"getReplacement",value:function getReplacement(t){return this.spec.unquote(this.spec.replace);}},{key:"matchAll",value:function matchAll(t,e){var i=aa(this.spec,t,0,t.doc.length),s=[];for(;!i.next().done;){if(s.length>=e)return null;s.push(i.value);}return s;}},{key:"highlight",value:function highlight(t,e,i,s){var r=aa(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to);}}]);}(fa);ga=/*#__PURE__*/function(_fa2){function ga(){_classCallCheck(this,ga);return _callSuper(this,ga,arguments);}_inherits(ga,_fa2);return _createClass(ga,[{key:"nextMatch",value:function nextMatch(t,e,i){var s=da(this.spec,t,i,t.doc.length).next();return s.done&&(s=da(this.spec,t,0,e).next()),s.done?null:s.value;}},{key:"prevMatchInRange",value:function prevMatchInRange(t,e,i){for(var _s180=1;;_s180++){var _r140=Math.max(e,i-1e4*_s180),_n110=da(this.spec,t,_r140,i),_h75=null;for(;!_n110.next().done;)_h75=_n110.value;if(_h75&&(_r140==e||_h75.from>_r140+10))return _h75;if(_r140==e)return null;}}},{key:"prevMatch",value:function prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length);}},{key:"getReplacement",value:function getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,function(e,i){return"$"==i?"$":"&"==i?t.match[0]:"0"!=i&&+i<t.match.length?t.match[i]:e;});}},{key:"matchAll",value:function matchAll(t,e){var i=da(this.spec,t,0,t.doc.length),s=[];for(;!i.next().done;){if(s.length>=e)return null;s.push(i.value);}return s;}},{key:"highlight",value:function highlight(t,e,i,s){var r=da(this.spec,t,Math.max(0,e-250),Math.min(i+250,t.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to);}}]);}(fa);wa=ct.define();ba=ct.define();va=F.define({create:function create(t){return new ka(Ra(t).create(),null);},update:function update(t,e){var _iterator191=_createForOfIteratorHelper(e.effects),_step191;try{for(_iterator191.s();!(_step191=_iterator191.n()).done;){var _i192=_step191.value;_i192.is(wa)?t=new ka(_i192.value.create(),t.panel):_i192.is(ba)&&(t=new ka(t.query,_i192.value?Ia:null));}}catch(err){_iterator191.e(err);}finally{_iterator191.f();}return t;},provide:function provide(t){return oh.from(t,function(t){return t.panel;});}});ka=/*#__PURE__*/_createClass(function ka(t,e){_classCallCheck(this,ka);this.query=t,this.panel=e;});ya=ni.mark({"class":"cm-searchMatch"});Ma=ni.mark({"class":"cm-searchMatch cm-searchMatch-selected"});xa=_i.fromClass(/*#__PURE__*/function(){function _class11(t){_classCallCheck(this,_class11);this.view=t,this.decorations=this.highlight(t.state.field(va));}return _createClass(_class11,[{key:"update",value:function update(t){var e=t.state.field(va);(e!=t.startState.field(va)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e));}},{key:"highlight",value:function highlight(_ref45){var t=_ref45.query,e=_ref45.panel;if(!e||!t.spec.valid)return ni.none;var i=this.view,s=new Rt();for(var _e225=0,_r141=i.visibleRanges,_n111=_r141.length;_e225<_n111;_e225++){var _r141$_e=_r141[_e225],_h76=_r141$_e.from,_l66=_r141$_e.to;for(;_e225<_n111-1&&_l66>_r141[_e225+1].from-500;)_l66=_r141[++_e225].to;t.highlight(i.state,_h76,_l66,function(t,e){var r=i.state.selection.ranges.some(function(i){return i.from==t&&i.to==e;});s.add(t,e,r?Ma:ya);});}return s.finish();}}]);}(),{decorations:function decorations(t){return t.decorations;}});Aa=Sa(function(t,_ref46){var e=_ref46.query;var i=t.state.selection.main.to,s=e.nextMatch(t.state,i,i);if(!s)return!1;var r=B.single(s.from,s.to),n=t.state.facet(oa);return t.dispatch({selection:r,effects:[Wa(t,s),n.scrollToMatch(r.main,t)],userEvent:"select.search"}),Ba(t),!0;});Ca=Sa(function(t,_ref47){var e=_ref47.query;var i=t.state,s=i.selection.main.from,r=e.prevMatch(i,s,s);if(!r)return!1;var n=B.single(r.from,r.to),h=t.state.facet(oa);return t.dispatch({selection:n,effects:[Wa(t,r),h.scrollToMatch(n.main,t)],userEvent:"select.search"}),Ba(t),!0;});Da=Sa(function(t,_ref48){var e=_ref48.query;var i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:B.create(i.map(function(t){return B.range(t.from,t.to);})),userEvent:"select.search.matches"}),!0);});Oa=Sa(function(t,_ref49){var e=_ref49.query;var i=t.state,_i$selection$main=i.selection.main,s=_i$selection$main.from,r=_i$selection$main.to;if(i.readOnly)return!1;var n=e.nextMatch(i,s,s);if(!n)return!1;var h,l,o=[],u=[];if(n.from==s&&n.to==r&&(l=i.toText(e.getReplacement(n)),o.push({from:n.from,to:n.to,insert:l}),n=e.nextMatch(i,n.from,n.to),u.push(Ur.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(s).number)+"."))),n){var _e226=0==o.length||o[0].from>=n.to?0:n.to-n.from-l.length;h=B.single(n.from-_e226,n.to-_e226),u.push(Wa(t,n)),u.push(i.facet(oa).scrollToMatch(h.main,t));}return t.dispatch({changes:o,selection:h,effects:u,userEvent:"input.replace"}),!0;});Ea=Sa(function(t,_ref50){var e=_ref50.query;if(t.state.readOnly)return!1;var i=e.matchAll(t.state,1e9).map(function(t){var i=t.from,s=t.to;return{from:i,to:s,insert:e.getReplacement(t)};});if(!i.length)return!1;var s=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:Ur.announce.of(s),userEvent:"input.replace.all"}),!0;});La=function La(t){var e=t.state.field(va,!1);if(e&&e.panel){var _i193=Ta(t);if(_i193&&_i193!=t.root.activeElement){var _s181=Ra(t.state,e.query.spec);_s181.valid&&t.dispatch({effects:wa.of(_s181)}),_i193.focus(),_i193.select();}}else t.dispatch({effects:[ba.of(!0),e?wa.of(Ra(t.state,e.query.spec)):ct.appendConfig.of(Fa)]});return!0;};Na=function Na(t){var e=t.state.field(va,!1);if(!e||!e.panel)return!1;var i=rh(t,Ia);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:ba.of(!1)}),!0;};$a=[{key:"Mod-f",run:La,scope:"editor search-panel"},{key:"F3",run:Aa,shift:Ca,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Aa,shift:Ca,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Na,scope:"editor search-panel"},{key:"Mod-Shift-l",run:function run(_ref51){var t=_ref51.state,e=_ref51.dispatch;var i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;var _i$main=i.main,s=_i$main.from,r=_i$main.to,n=[],h=0;for(var _e227=new Ff(t.doc,t.sliceDoc(s,r));!_e227.next().done;){if(n.length>1e3)return!1;_e227.value.from==s&&(h=n.length),n.push(B.range(_e227.value.from,_e227.value.to));}return e(t.update({selection:B.create(n,h),userEvent:"select.search.matches"})),!0;}},{key:"Mod-Alt-g",run:function run(t){var e=rh(t,Yf);if(!e){var _i194=[Qf.of(!0)];null==t.state.field(Zf,!1)&&_i194.push(ct.appendConfig.of([Zf,ta])),t.dispatch({effects:_i194}),e=rh(t,Yf);}return e&&e.dom.querySelector("input").select(),!0;}},{key:"Mod-d",run:function run(_ref52){var t=_ref52.state,e=_ref52.dispatch;var i=t.selection.ranges;if(i.some(function(t){return t.from===t.to;}))return function(_ref53){var t=_ref53.state,e=_ref53.dispatch;var i=t.selection,s=B.create(i.ranges.map(function(e){return t.wordAt(e.head)||B.cursor(e.head);}),i.mainIndex);return!s.eq(i)&&(e(t.update({selection:s})),!0);}({state:t,dispatch:e});var s=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(function(e){return t.sliceDoc(e.from,e.to)!=s;}))return!1;var r=function(t,e){var _t$selection=t.selection,i=_t$selection.main,s=_t$selection.ranges,r=t.wordAt(i.head),n=r&&r.from==i.from&&r.to==i.to;var _loop14=function _loop14(_i196,_r143){if(_r143.next(),!_r143.done){if(_i196&&s.some(function(t){return t.from==_r143.value.from;})){_i195=_i196,_r142=_r143;return 0;}// continue
3
3
  if(n){var _e228=t.wordAt(_r143.value.from);if(!_e228||_e228.from!=_r143.value.from||_e228.to!=_r143.value.to){_i195=_i196,_r142=_r143;return 0;}// continue
4
4
  }return{v:_r143.value};}if(_i196)return{v:null};_r143=new Ff(t.doc,e,0,Math.max(0,s[s.length-1].from-1)),_i196=!0;_i195=_i196,_r142=_r143;},_ret2;for(var _i195=!1,_r142=new Ff(t.doc,e,s[s.length-1].to);;){_ret2=_loop14(_i195,_r142);if(_ret2===0)continue;if(_ret2)return _ret2.v;}}(t,s);return!!r&&(e(t.update({selection:t.selection.addRange(B.range(r.from,r.to),!1),effects:Ur.scrollIntoView(r.to)})),!0);},preventDefault:!0}];ja=/*#__PURE__*/function(){function ja(t){var _this79=this;_classCallCheck(this,ja);this.view=t;var e=this.query=t.state.field(va).query.spec;function i(t,e,i){return Hf("button",{"class":"cm-button",name:t,onclick:e,type:"button"},i);}this.commit=this.commit.bind(this),this.searchField=Hf("input",{value:e.search,placeholder:za(t,"Find"),"aria-label":za(t,"Find"),"class":"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Hf("input",{value:e.replace,placeholder:za(t,"Replace"),"aria-label":za(t,"Replace"),"class":"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Hf("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=Hf("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=Hf("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=Hf("div",{onkeydown:function onkeydown(t){return _this79.keydown(t);},"class":"cm-search"},[this.searchField,i("next",function(){return Aa(t);},[za(t,"next")]),i("prev",function(){return Ca(t);},[za(t,"previous")]),i("select",function(){return Da(t);},[za(t,"all")]),Hf("label",null,[this.caseField,za(t,"match case")]),Hf("label",null,[this.reField,za(t,"regexp")]),Hf("label",null,[this.wordField,za(t,"by word")])].concat(_toConsumableArray(t.state.readOnly?[]:[Hf("br"),this.replaceField,i("replace",function(){return Oa(t);},[za(t,"replace")]),i("replaceAll",function(){return Ea(t);},[za(t,"replace all")])]),[Hf("button",{name:"close",onclick:function onclick(){return Na(t);},"aria-label":za(t,"close"),type:"button"},["×"])]));}return _createClass(ja,[{key:"commit",value:function commit(){var t=new ua({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:wa.of(t)}));}},{key:"keydown",value:function keydown(t){var e,i,s;e=this.view,i=t,s="search-panel",nn(en(e.state),i,e,s)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?Ca:Aa)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),Oa(this.view));}},{key:"update",value:function update(t){var _iterator192=_createForOfIteratorHelper(t.transactions),_step192;try{for(_iterator192.s();!(_step192=_iterator192.n()).done;){var _e229=_step192.value;var _iterator193=_createForOfIteratorHelper(_e229.effects),_step193;try{for(_iterator193.s();!(_step193=_iterator193.n()).done;){var _t266=_step193.value;_t266.is(wa)&&!_t266.value.eq(this.query)&&this.setQuery(_t266.value);}}catch(err){_iterator193.e(err);}finally{_iterator193.f();}}}catch(err){_iterator192.e(err);}finally{_iterator192.f();}}},{key:"setQuery",value:function setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord;}},{key:"mount",value:function mount(){this.searchField.select();}},{key:"pos",get:function get(){return 80;}},{key:"top",get:function get(){return this.view.state.facet(oa).top;}}]);}();Pa=30;Ha=/[\s\.,:;?!]/;Va=Ur.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}});Fa=[va,_.low(xa),Va];qa=/*#__PURE__*/function(){function qa(t,e,i){_classCallCheck(this,qa);this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[];}return _createClass(qa,[{key:"tokenBefore",value:function tokenBefore(t){var e=Fl(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null;}},{key:"matchBefore",value:function matchBefore(t){var e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),s=e.text.slice(i-e.from,this.pos-e.from),r=s.search(Xa(t,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)};}},{key:"aborted",get:function get(){return null==this.abortListeners;}},{key:"addEventListener",value:function addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e);}}]);}();Ka=/*#__PURE__*/_createClass(function Ka(t,e,i,s){_classCallCheck(this,Ka);this.completion=t,this.source=e,this.match=i,this.score=s;});Ya=ut.define();Qa=new WeakMap();tc=ct.define();ec=ct.define();ic=/*#__PURE__*/function(){function ic(t){_classCallCheck(this,ic);this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(var _e231=0;_e231<t.length;){var _i197=v(t,_e231),_s183=y(_i197);this.chars.push(_i197);var _r144=t.slice(_e231,_e231+_s183),_n112=_r144.toUpperCase();this.folded.push(v(_n112==_r144?_r144.toLowerCase():_n112,0)),_e231+=_s183;}this.astral=t.length!=this.chars.length;}return _createClass(ic,[{key:"ret",value:function ret(t,e){return this.score=t,this.matched=e,this;}},{key:"match",value:function match(t){if(0==this.pattern.length)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;var e=this.chars,i=this.folded,s=this.any,r=this.precise,n=this.byWord;if(1==e.length){var _s184=v(t,0),_r145=y(_s184),_n113=_r145==t.length?0:-100;if(_s184==e[0]);else{if(_s184!=i[0])return null;_n113+=-200;}return this.ret(_n113,[0,_r145]);}var h=t.indexOf(this.pattern);if(0==h)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);var l=e.length,o=0;if(h<0){for(var _r146=0,_n114=Math.min(t.length,200);_r146<_n114&&o<l;){var _n115=v(t,_r146);_n115!=e[o]&&_n115!=i[o]||(s[o++]=_r146),_r146+=y(_n115);}if(o<l)return null;}var u=0,f=0,a=!1,c=0,d=-1,p=-1,m=/[a-z]/.test(t),g=!0;for(var _s185=0,_o44=Math.min(t.length,200),_w3=0;_s185<_o44&&f<l;){var _o45=v(t,_s185);h<0&&(u<l&&_o45==e[u]&&(r[u++]=_s185),c<l&&(_o45==e[c]||_o45==i[c]?(0==c&&(d=_s185),p=_s185+1,c++):c=0));var _b2=void 0,_M2=_o45<255?_o45>=48&&_o45<=57||_o45>=97&&_o45<=122?2:_o45>=65&&_o45<=90?1:0:(_b2=k(_o45))!=_b2.toLowerCase()?1:_b2!=_b2.toUpperCase()?2:0;(!_s185||1==_M2&&m||0==_w3&&0!=_M2)&&(e[f]==_o45||i[f]==_o45&&(a=!0)?n[f++]=_s185:n.length&&(g=!1)),_w3=_M2,_s185+=y(_o45);}return f==l&&0==n[0]&&g?this.result((a?-200:0)-100,n,t):c==l&&0==d?this.ret(-200-t.length+(p==t.length?0:-100),[0,p]):h>-1?this.ret(-700-t.length,[h,h+this.pattern.length]):c==l?this.ret(-900-t.length,[d,p]):f==l?this.result((a?-200:0)-100-700+(g?0:-1100),n,t):2==e.length?null:this.result((s[0]?-700:0)-200-1100,s,t);}},{key:"result",value:function result(t,e,i){var s=[],r=0;var _iterator195=_createForOfIteratorHelper(e),_step195;try{for(_iterator195.s();!(_step195=_iterator195.n()).done;){var _t270=_step195.value;var _e232=_t270+(this.astral?y(v(i,_t270)):1);r&&s[r-1]==_t270?s[r-1]=_e232:(s[r++]=_t270,s[r++]=_e232);}}catch(err){_iterator195.e(err);}finally{_iterator195.f();}return this.ret(t-i.length,s);}}]);}();sc=/*#__PURE__*/function(){function sc(t){_classCallCheck(this,sc);this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase();}return _createClass(sc,[{key:"match",value:function match(t){if(t.length<this.pattern.length)return null;var e=t.slice(0,this.pattern.length),i=e==this.pattern?0:e.toLowerCase()==this.folded?-200:null;return null==i?null:(this.matched=[0,e.length],this.score=i+(t.length==this.pattern.length?0:-100),this);}}]);}();rc=$.define({combine:function combine(t){return At(t,{activateOnTyping:!0,activateOnCompletion:function activateOnCompletion(){return!1;},activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:function tooltipClass(){return"";},optionClass:function optionClass(){return"";},aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:hc,filterStrict:!1,compareCompletions:function compareCompletions(t,e){return t.label.localeCompare(e.label);},interactionDelay:75,updateSyncTime:100},{defaultKeymap:function defaultKeymap(t,e){return t&&e;},closeOnBlur:function closeOnBlur(t,e){return t&&e;},icons:function icons(t,e){return t&&e;},tooltipClass:function tooltipClass(t,e){return function(i){return nc(t(i),e(i));};},optionClass:function optionClass(t,e){return function(i){return nc(t(i),e(i));};},addToOptions:function addToOptions(t,e){return t.concat(e);},filterStrict:function filterStrict(t,e){return t||e;}});}});oc=/*#__PURE__*/function(){function oc(t,e,i){var _this80=this;_classCallCheck(this,oc);this.view=t,this.stateField=e,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:function read(){return _this80.measureInfo();},write:function write(t){return _this80.placeInfo(t);},key:this},this.space=null,this.currentClass="";var s=t.state.field(e),_s$open=s.open,r=_s$open.options,n=_s$open.selected,h=t.state.facet(rc);this.optionContent=function(t){var e=t.addToOptions.slice();return t.icons&&e.push({render:function render(t){var _e$classList;var e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&(_e$classList=e.classList).add.apply(_e$classList,_toConsumableArray(t.type.split(/\s+/g).map(function(t){return"cm-completionIcon-"+t;}))),e.setAttribute("aria-hidden","true"),e;},position:20}),e.push({render:function render(t,e,i,s){var r=document.createElement("span");r.className="cm-completionLabel";var n=t.displayLabel||t.label,h=0;for(var _t273=0;_t273<s.length;){var _e233=s[_t273++],_i198=s[_t273++];_e233>h&&r.appendChild(document.createTextNode(n.slice(h,_e233)));var _l67=r.appendChild(document.createElement("span"));_l67.appendChild(document.createTextNode(n.slice(_e233,_i198))),_l67.className="cm-completionMatchedText",h=_i198;}return h<n.length&&r.appendChild(document.createTextNode(n.slice(h))),r;},position:50},{render:function render(t){if(!t.detail)return null;var e=document.createElement("span");return e.className="cm-completionDetail",e.textContent=t.detail,e;},position:80}),e.sort(function(t,e){return t.position-e.position;}).map(function(t){return t.render;});}(h),this.optionClass=h.optionClass,this.tooltipClass=h.tooltipClass,this.range=lc(r.length,n,h.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",function(i){var s=t.state.field(e).open.options;for(var _e234,_r147=i.target;_r147&&_r147!=_this80.dom;_r147=_r147.parentNode)if("LI"==_r147.nodeName&&(_e234=/-(\d+)$/.exec(_r147.id))&&+_e234[1]<s.length)return _this80.applyCompletion(t,s[+_e234[1]]),void i.preventDefault();}),this.dom.addEventListener("focusout",function(e){var i=t.state.field(_this80.stateField,!1);i&&i.tooltip&&t.state.facet(rc).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:ec.of(null)});}),this.showOptions(r,s.id);}return _createClass(oc,[{key:"mount",value:function mount(){this.updateSel();}},{key:"showOptions",value:function showOptions(t,e){var _this81=this;this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener("scroll",function(){_this81.info&&_this81.view.requestMeasure(_this81.placeInfoReq);});}},{key:"update",value:function update(t){var e;var i=t.state.field(this.stateField),s=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),i!=s){var _i$open=i.open,_r148=_i$open.options,_n116=_i$open.selected,_h77=_i$open.disabled;s.open&&s.open.options==_r148||(this.range=lc(_r148.length,_n116,t.state.facet(rc).maxRenderedOptions),this.showOptions(_r148,i.id)),this.updateSel(),_h77!=(null===(e=s.open)||void 0===e?void 0:e.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!_h77);}}},{key:"updateTooltipClass",value:function updateTooltipClass(t){var e=this.tooltipClass(t);if(e!=this.currentClass){var _iterator196=_createForOfIteratorHelper(this.currentClass.split(" ")),_step196;try{for(_iterator196.s();!(_step196=_iterator196.n()).done;){var _t274=_step196.value;_t274&&this.dom.classList.remove(_t274);}}catch(err){_iterator196.e(err);}finally{_iterator196.f();}var _iterator197=_createForOfIteratorHelper(e.split(" ")),_step197;try{for(_iterator197.s();!(_step197=_iterator197.n()).done;){var _t275=_step197.value;_t275&&this.dom.classList.add(_t275);}}catch(err){_iterator197.e(err);}finally{_iterator197.f();}this.currentClass=e;}}},{key:"positioned",value:function positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq);}},{key:"updateSel",value:function updateSel(){var _this82=this;var t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected<this.range.from||e.selected>=this.range.to)&&(this.range=lc(e.options.length,e.selected,this.view.state.facet(rc).maxRenderedOptions),this.showOptions(e.options,t.id)),this.updateSelectedOption(e.selected)){this.destroyInfo();var _i199=e.options[e.selected].completion,_s186=_i199.info;if(!_s186)return;var _r149="string"==typeof _s186?document.createTextNode(_s186):_s186(_i199);if(!_r149)return;"then"in _r149?_r149.then(function(e){e&&_this82.view.state.field(_this82.stateField,!1)==t&&_this82.addInfoPane(e,_i199);})["catch"](function(t){return Ui(_this82.view.state,t,"completion info");}):this.addInfoPane(_r149,_i199);}}},{key:"addInfoPane",value:function addInfoPane(t,e){this.destroyInfo();var i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",null!=t.nodeType)i.appendChild(t),this.infoDestroy=null;else{var _e235=t.dom,_s187=t.destroy;i.appendChild(_e235),this.infoDestroy=_s187||null;}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq);}},{key:"updateSelectedOption",value:function updateSelectedOption(t){var e=null;for(var _i200=this.list.firstChild,_s188=this.range.from;_i200;_i200=_i200.nextSibling,_s188++)"LI"==_i200.nodeName&&_i200.id?_s188==t?_i200.hasAttribute("aria-selected")||(_i200.setAttribute("aria-selected","true"),e=_i200):_i200.hasAttribute("aria-selected")&&_i200.removeAttribute("aria-selected"):_s188--;return e&&function(t,e){var i=t.getBoundingClientRect(),s=e.getBoundingClientRect(),r=i.height/t.offsetHeight;s.top<i.top?t.scrollTop-=(i.top-s.top)/r:s.bottom>i.bottom&&(t.scrollTop+=(s.bottom-i.bottom)/r);}(this.list,e),e;}},{key:"measureInfo",value:function measureInfo(){var t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;var e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=t.getBoundingClientRect(),r=this.space;if(!r){var _t276=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:_t276.innerWidth,bottom:_t276.innerHeight};}return s.top>Math.min(r.bottom,e.bottom)-10||s.bottom<Math.max(r.top,e.top)+10?null:this.view.state.facet(rc).positionInfo(this.view,e,s,i,r,this.dom);}},{key:"placeInfo",value:function placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t["class"]||"")):this.info.style.cssText="top: -1e6px");}},{key:"createListBox",value:function createListBox(t,e,i){var s=document.createElement("ul");s.id=e,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions"));var r=null;for(var _n117=i.from;_n117<i.to;_n117++){var _t$_n=t[_n117],_h78=_t$_n.completion,_l68=_t$_n.match,_o46=_h78.section;if(_o46){var _t277="string"==typeof _o46?_o46:_o46.name;if(_t277!=r&&(_n117>i.from||0==i.from))if(r=_t277,"string"!=typeof _o46&&_o46.header)s.appendChild(_o46.header(_o46));else{s.appendChild(document.createElement("completion-section")).textContent=_t277;}}var _u43=s.appendChild(document.createElement("li"));_u43.id=e+"-"+_n117,_u43.setAttribute("role","option");var _f24=this.optionClass(_h78);_f24&&(_u43.className=_f24);var _iterator198=_createForOfIteratorHelper(this.optionContent),_step198;try{for(_iterator198.s();!(_step198=_iterator198.n()).done;){var _t278=_step198.value;var _e236=_t278(_h78,this.view.state,this.view,_l68);_e236&&_u43.appendChild(_e236);}}catch(err){_iterator198.e(err);}finally{_iterator198.f();}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.to<t.length&&s.classList.add("cm-completionListIncompleteBottom"),s;}},{key:"destroyInfo",value:function destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null);}},{key:"destroy",value:function destroy(){this.destroyInfo();}}]);}();ac=/*#__PURE__*/function(){function ac(t,e,i,s,r,n){_classCallCheck(this,ac);this.options=t,this.attrs=e,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=n;}return _createClass(ac,[{key:"setSelected",value:function setSelected(t,e){return t==this.selected||t>=this.options.length?this:new ac(this.options,pc(e,t),this.tooltip,this.timestamp,t,this.disabled);}},{key:"map",value:function map(t){return new ac(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled);}}],[{key:"build",value:function build(t,e,i,s,r){var n=function(t,e){var i=[],s=null,r=function r(t){i.push(t);var e=t.completion.section;if(e){s||(s=[]);var _t279="string"==typeof e?e:e.name;s.some(function(e){return e.name==_t279;})||s.push("string"==typeof e?{name:_t279}:e);}},n=e.facet(rc);var _iterator199=_createForOfIteratorHelper(t),_step199;try{for(_iterator199.s();!(_step199=_iterator199.n()).done;){var _s189=_step199.value;if(_s189.hasResult()){var _t281=_s189.result.getMatch;if(!1===_s189.result.filter){var _iterator203=_createForOfIteratorHelper(_s189.result.options),_step203;try{for(_iterator203.s();!(_step203=_iterator203.n()).done;){var _e239=_step203.value;r(new Ka(_e239,_s189.source,_t281?_t281(_e239):[],1e9-i.length));}}catch(err){_iterator203.e(err);}finally{_iterator203.f();}}else{var _i203=void 0,_h79=e.sliceDoc(_s189.from,_s189.to),_l69=n.filterStrict?new sc(_h79):new ic(_h79);var _iterator204=_createForOfIteratorHelper(_s189.result.options),_step204;try{for(_iterator204.s();!(_step204=_iterator204.n()).done;){var _e240=_step204.value;if(_i203=_l69.match(_e240.label)){var _n118=_e240.displayLabel?_t281?_t281(_e240,_i203.matched):[]:_i203.matched;r(new Ka(_e240,_s189.source,_n118,_i203.score+(_e240.boost||0)));}}}catch(err){_iterator204.e(err);}finally{_iterator204.f();}}}}}catch(err){_iterator199.e(err);}finally{_iterator199.f();}if(s){var _t280=Object.create(null),_e237=0,_r150=function _r150(t,e){var i,s;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(s=e.rank)&&void 0!==s?s:1e9)||(t.name<e.name?-1:1);};var _iterator200=_createForOfIteratorHelper(s.sort(_r150)),_step200;try{for(_iterator200.s();!(_step200=_iterator200.n()).done;){var _i201=_step200.value;_e237-=1e5,_t280[_i201.name]=_e237;}}catch(err){_iterator200.e(err);}finally{_iterator200.f();}var _iterator201=_createForOfIteratorHelper(i),_step201;try{for(_iterator201.s();!(_step201=_iterator201.n()).done;){var _e238=_step201.value;var _i202=_e238.completion.section;_i202&&(_e238.score+=_t280["string"==typeof _i202?_i202:_i202.name]);}}catch(err){_iterator201.e(err);}finally{_iterator201.f();}}var h=[],l=null,o=n.compareCompletions;var _iterator202=_createForOfIteratorHelper(i.sort(function(t,e){return e.score-t.score||o(t.completion,e.completion);})),_step202;try{for(_iterator202.s();!(_step202=_iterator202.n()).done;){var _t282=_step202.value;var _e241=_t282.completion;!l||l.label!=_e241.label||l.detail!=_e241.detail||null!=l.type&&null!=_e241.type&&l.type!=_e241.type||l.apply!=_e241.apply||l.boost!=_e241.boost?h.push(_t282):fc(_t282.completion)>fc(l)&&(h[h.length-1]=_t282),l=_t282.completion;}}catch(err){_iterator202.e(err);}finally{_iterator202.f();}return h;}(t,e);if(!n.length)return s&&t.some(function(t){return 1==t.state;})?new ac(s.options,s.attrs,s.tooltip,s.timestamp,s.selected,!0):null;var h=e.facet(rc).selectOnOpen?0:-1;if(s&&s.selected!=h&&-1!=s.selected){var _t283=s.options[s.selected].completion;for(var _e242=0;_e242<n.length;_e242++)if(n[_e242].completion==_t283){h=_e242;break;}}return new ac(n,pc(i,h),{pos:t.reduce(function(t,e){return e.hasResult()?Math.min(t,e.from):t;},1e8),create:xc,above:r.aboveCursor},s?s.timestamp:Date.now(),h,!1);}}]);}();cc=/*#__PURE__*/function(){function cc(t,e,i){_classCallCheck(this,cc);this.active=t,this.id=e,this.open=i;}return _createClass(cc,[{key:"update",value:function update(t){var _this83=this;var e=t.state,i=e.facet(rc),s=(i.override||e.languageDataAt("autocomplete",_a(e)).map(Za)).map(function(e){return(_this83.active.find(function(t){return t.source==e;})||new wc(e,_this83.active.some(function(t){return 0!=t.state;})?1:0)).update(t,i);});s.length==this.active.length&&s.every(function(t,e){return t==_this83.active[e];})&&(s=this.active);var r=this.open;r&&t.docChanged&&(r=r.map(t.changes)),t.selection||s.some(function(e){return e.hasResult()&&t.changes.touchesRange(e.from,e.to);})||!function(t,e){if(t==e)return!0;for(var _i204=0,_s190=0;;){for(;_i204<t.length&&!t[_i204].hasResult;)_i204++;for(;_s190<e.length&&!e[_s190].hasResult;)_s190++;var _r151=_i204==t.length,_n119=_s190==e.length;if(_r151||_n119)return _r151==_n119;if(t[_i204++].result!=e[_s190++].result)return!1;}}(s,this.active)?r=ac.build(s,e,this.id,r,i):r&&r.disabled&&!s.some(function(t){return 1==t.state;})&&(r=null),!r&&s.every(function(t){return 1!=t.state;})&&s.some(function(t){return t.hasResult();})&&(s=s.map(function(t){return t.hasResult()?new wc(t.source,0):t;}));var _iterator205=_createForOfIteratorHelper(t.effects),_step205;try{for(_iterator205.s();!(_step205=_iterator205.n()).done;){var _e243=_step205.value;_e243.is(kc)&&(r=r&&r.setSelected(_e243.value,this.id));}}catch(err){_iterator205.e(err);}finally{_iterator205.f();}return s==this.active&&r==this.open?this:new cc(s,this.id,r);}},{key:"tooltip",get:function get(){return this.open?this.open.tooltip:null;}},{key:"attrs",get:function get(){return this.open?this.open.attrs:dc;}}],[{key:"start",value:function start(){return new cc(mc,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null);}}]);}();dc={"aria-autocomplete":"list"};mc=[];wc=/*#__PURE__*/function(){function wc(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;_classCallCheck(this,wc);this.source=t,this.state=e,this.explicitPos=i;}return _createClass(wc,[{key:"hasResult",value:function hasResult(){return!1;}},{key:"update",value:function update(t,e){var i=gc(t,e),s=this;i?s=s.handleUserEvent(t,i,e):t.docChanged?s=s.handleChange(t):t.selection&&0!=s.state&&(s=new wc(s.source,0));var _iterator206=_createForOfIteratorHelper(t.effects),_step206;try{for(_iterator206.s();!(_step206=_iterator206.n()).done;){var _e244=_step206.value;if(_e244.is(tc))s=new wc(s.source,1,_e244.value?_a(t.state):-1);else if(_e244.is(ec))s=new wc(s.source,0);else if(_e244.is(vc)){var _iterator207=_createForOfIteratorHelper(_e244.value),_step207;try{for(_iterator207.s();!(_step207=_iterator207.n()).done;){var _t284=_step207.value;_t284.source==s.source&&(s=_t284);}}catch(err){_iterator207.e(err);}finally{_iterator207.f();}}}}catch(err){_iterator206.e(err);}finally{_iterator206.f();}return s;}},{key:"handleUserEvent",value:function handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new wc(this.source,1):this.map(t.changes);}},{key:"handleChange",value:function handleChange(t){return t.changes.touchesRange(_a(t.startState))?new wc(this.source,0):this.map(t.changes);}},{key:"map",value:function map(t){return t.empty||this.explicitPos<0?this:new wc(this.source,this.state,t.mapPos(this.explicitPos));}}]);}();bc=/*#__PURE__*/function(_wc){function bc(t,e,i,s,r){var _this84;_classCallCheck(this,bc);_this84=_callSuper(this,bc,[t,2,e]),_this84.result=i,_this84.from=s,_this84.to=r;return _this84;}_inherits(bc,_wc);return _createClass(bc,[{key:"hasResult",value:function hasResult(){return!0;}},{key:"handleUserEvent",value:function handleUserEvent(t,e,i){var s;var r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));var n=t.changes.mapPos(this.from),h=t.changes.mapPos(this.to,1),l=_a(t.state);if((this.explicitPos<0?l<=n:l<this.from)||l>h||!r||"delete"==e&&_a(t.startState)==this.from)return new wc(this.source,"input"==e&&i.activateOnTyping?1:0);var o=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,s){if(!t)return!1;var r=e.sliceDoc(i,s);return"function"==typeof t?t(r,i,s,e):Xa(t,!0).test(r);}(r.validFor,t.state,n,h)?new bc(this.source,o,r,n,h):r.update&&(r=r.update(r,n,h,new qa(t.state,l,o>=0)))?new bc(this.source,o,r,r.from,null!==(s=r.to)&&void 0!==s?s:_a(t.state)):new wc(this.source,1,o);}},{key:"handleChange",value:function handleChange(t){return t.changes.touchesRange(this.from,this.to)?new wc(this.source,0):this.map(t.changes);}},{key:"map",value:function map(t){if(t.empty)return this;return(this.result.map?this.result.map(this.result,t):this.result)?new bc(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new wc(this.source,0);}}]);}(wc);vc=ct.define({map:function map(t,e){return t.map(function(t){return t.map(e);});}});kc=ct.define();yc=F.define({create:function create(){return cc.start();},update:function update(t,e){return t.update(e);},provide:function provide(t){return[Kn.from(t,function(t){return t.tooltip;}),Ur.contentAttributes.from(t,function(t){return t.attrs;})];}});xc=uc(yc,Mc);Ac=/*#__PURE__*/_createClass(function Ac(t,e){_classCallCheck(this,Ac);this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0;});Cc=_i.fromClass(/*#__PURE__*/function(){function _class12(t){_classCallCheck(this,_class12);this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;var _iterator208=_createForOfIteratorHelper(t.state.field(yc).active),_step208;try{for(_iterator208.s();!(_step208=_iterator208.n()).done;){var _e245=_step208.value;1==_e245.state&&this.startQuery(_e245);}}catch(err){_iterator208.e(err);}finally{_iterator208.f();}}return _createClass(_class12,[{key:"update",value:function update(t){var _this85=this;var e=t.state.field(yc),i=t.state.facet(rc);if(!t.selectionSet&&!t.docChanged&&t.startState.field(yc)==e)return;var s=t.transactions.some(function(t){return(t.selection||t.docChanged)&&!gc(t,i);});for(var _e246=0;_e246<this.running.length;_e246++){var _i206$updates;var _i206=this.running[_e246];if(s||_i206.updates.length+t.transactions.length>50&&Date.now()-_i206.time>1e3){var _iterator209=_createForOfIteratorHelper(_i206.context.abortListeners),_step209;try{for(_iterator209.s();!(_step209=_iterator209.n()).done;){var _t285=_step209.value;try{_t285();}catch(t){Ui(this.view.state,t);}}}catch(err){_iterator209.e(err);}finally{_iterator209.f();}_i206.context.abortListeners=null,this.running.splice(_e246--,1);}else(_i206$updates=_i206.updates).push.apply(_i206$updates,_toConsumableArray(t.transactions));}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(function(t){return t.effects.some(function(t){return t.is(tc);});})&&(this.pendingStart=!0);var r=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(function(t){return 1==t.state&&!_this85.running.some(function(e){return e.active.source==t.source;});})?setTimeout(function(){return _this85.startUpdate();},r):-1,0!=this.composing){var _iterator210=_createForOfIteratorHelper(t.transactions),_step210;try{for(_iterator210.s();!(_step210=_iterator210.n()).done;){var _e247=_step210.value;"input"==gc(_e247,i)?this.composing=2:2==this.composing&&_e247.selection&&(this.composing=3);}}catch(err){_iterator210.e(err);}finally{_iterator210.f();}}}},{key:"startUpdate",value:function startUpdate(){var _this86=this;this.debounceUpdate=-1,this.pendingStart=!1;var t=this.view.state,e=t.field(yc);var _iterator211=_createForOfIteratorHelper(e.active),_step211;try{var _loop15=function _loop15(){var t=_step211.value;1!=t.state||_this86.running.some(function(e){return e.active.source==t.source;})||_this86.startQuery(t);};for(_iterator211.s();!(_step211=_iterator211.n()).done;){_loop15();}}catch(err){_iterator211.e(err);}finally{_iterator211.f();}}},{key:"startQuery",value:function startQuery(t){var _this87=this;var e=this.view.state,i=_a(e),s=new qa(e,i,t.explicitPos==i),r=new Ac(t,s);this.running.push(r),Promise.resolve(t.source(s)).then(function(t){r.context.aborted||(r.done=t||null,_this87.scheduleAccept());},function(t){_this87.view.dispatch({effects:ec.of(null)}),Ui(_this87.view.state,t);});}},{key:"scheduleAccept",value:function scheduleAccept(){var _this88=this;this.running.every(function(t){return void 0!==t.done;})?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(function(){return _this88.accept();},this.view.state.facet(rc).updateSyncTime));}},{key:"accept",value:function accept(){var _this89=this;var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;var e=[],i=this.view.state.facet(rc);var _loop16=function _loop16(_s192){var r=_this89.running[_s192];if(void 0===r.done){_s191=_s192;return 0;}// continue
5
5
  if(_this89.running.splice(_s192--,1),r.done){var _s193=new bc(r.active.source,r.active.explicitPos,r.done,r.done.from,null!==(t=r.done.to)&&void 0!==t?t:_a(r.updates.length?r.updates[0].startState:_this89.view.state));var _iterator212=_createForOfIteratorHelper(r.updates),_step212;try{for(_iterator212.s();!(_step212=_iterator212.n()).done;){var _t286=_step212.value;_s193=_s193.update(_t286,i);}}catch(err){_iterator212.e(err);}finally{_iterator212.f();}if(_s193.hasResult()){e.push(_s193);_s191=_s192;return 0;// continue
6
- }}var n=_this89.view.state.field(yc).active.find(function(t){return t.source==r.active.source;});if(n&&1==n.state)if(null==r.done){var _t287=new wc(r.active.source,0);var _iterator213=_createForOfIteratorHelper(r.updates),_step213;try{for(_iterator213.s();!(_step213=_iterator213.n()).done;){var _e248=_step213.value;_t287=_t287.update(_e248,i);}}catch(err){_iterator213.e(err);}finally{_iterator213.f();}1!=_t287.state&&e.push(_t287);}else _this89.startQuery(n);_s191=_s192;},_ret3;for(var _s191=0;_s191<this.running.length;_s191++){_ret3=_loop16(_s191);if(_ret3===0)continue;}e.length&&this.view.dispatch({effects:vc.of(e)});}}]);}(),{eventHandlers:{blur:function blur(t){var _this90=this;var e=this.view.state.field(yc,!1);if(e&&e.tooltip&&this.view.state.facet(rc).closeOnBlur){var _i207=e.open&&eh(this.view,e.open.tooltip);_i207&&_i207.dom.contains(t.relatedTarget)||setTimeout(function(){return _this90.view.dispatch({effects:ec.of(null)});},10);}},compositionstart:function compositionstart(){this.composing=1;},compositionend:function compositionend(){var _this91=this;3==this.composing&&setTimeout(function(){return _this91.view.dispatch({effects:tc.of(!1)});},20),this.composing=0;}}});Dc="object"==(typeof navigator==="undefined"?"undefined":_typeof(navigator))&&/Win/.test(navigator.platform);Oc=_.highest(Ur.domEventHandlers({keydown:function keydown(t,e){var i=e.state.field(yc,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||t.key.length>1||t.ctrlKey&&(!Dc||!t.altKey)||t.metaKey)return!1;var s=i.open.options[i.open.selected],r=i.active.find(function(t){return t.source==s.source;}),n=s.completion.commitCharacters||r.result.commitCharacters;return n&&n.indexOf(t.key)>-1&&Mc(e,s),!1;}}));Ec=Ur.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});Ic=/*#__PURE__*/_createClass(function Ic(t,e,i,s){_classCallCheck(this,Ic);this.field=t,this.line=e,this.from=i,this.to=s;});Rc=/*#__PURE__*/function(){function Rc(t,e,i){_classCallCheck(this,Rc);this.field=t,this.from=e,this.to=i;}return _createClass(Rc,[{key:"map",value:function map(t){var e=t.mapPos(this.from,-1,x.TrackDel),i=t.mapPos(this.to,1,x.TrackDel);return null==e||null==i?null:new Rc(this.field,e,i);}}]);}();Tc=/*#__PURE__*/function(){function Tc(t,e){_classCallCheck(this,Tc);this.lines=t,this.fieldPositions=e;}return _createClass(Tc,[{key:"instantiate",value:function instantiate(t,e){var i=[],s=[e],r=t.doc.lineAt(e),n=/^\s*/.exec(r.text)[0];var _iterator214=_createForOfIteratorHelper(this.lines),_step214;try{for(_iterator214.s();!(_step214=_iterator214.n()).done;){var _r152=_step214.value;if(i.length){var _i208=n,_h80=/^\t*/.exec(_r152)[0].length;for(var _e249=0;_e249<_h80;_e249++)_i208+=t.facet(eo);s.push(e+_i208.length-_h80),_r152=_i208+_r152.slice(_h80);}i.push(_r152),e+=_r152.length+1;}}catch(err){_iterator214.e(err);}finally{_iterator214.f();}var h=this.fieldPositions.map(function(t){return new Rc(t.field,s[t.line]+t.from,s[t.line]+t.to);});return{text:i,ranges:h};}}],[{key:"parse",value:function parse(t){var e,i=[],s=[],r=[];var _iterator215=_createForOfIteratorHelper(t.split(/\r\n?|\n/)),_step215;try{for(_iterator215.s();!(_step215=_iterator215.n()).done;){var _n120=_step215.value;for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(_n120);){var _t288=e[1]?+e[1]:null,_h81=e[2]||e[3]||"",_l70=-1;for(var _e250=0;_e250<i.length;_e250++)(null!=_t288?i[_e250].seq==_t288:_h81&&i[_e250].name==_h81)&&(_l70=_e250);if(_l70<0){var _e251=0;for(;_e251<i.length&&(null==_t288||null!=i[_e251].seq&&i[_e251].seq<_t288);)_e251++;i.splice(_e251,0,{seq:_t288,name:_h81}),_l70=_e251;var _iterator216=_createForOfIteratorHelper(r),_step216;try{for(_iterator216.s();!(_step216=_iterator216.n()).done;){var _t289=_step216.value;_t289.field>=_l70&&_t289.field++;}}catch(err){_iterator216.e(err);}finally{_iterator216.f();}}r.push(new Ic(_l70,s.length,e.index,e.index+_h81.length)),_n120=_n120.slice(0,e.index)+_h81+_n120.slice(e.index+e[0].length);}for(var _t290;_t290=/\\([{}])/.exec(_n120);){_n120=_n120.slice(0,_t290.index)+_t290[1]+_n120.slice(_t290.index+_t290[0].length);var _iterator217=_createForOfIteratorHelper(r),_step217;try{for(_iterator217.s();!(_step217=_iterator217.n()).done;){var _e252=_step217.value;_e252.line==s.length&&_e252.from>_t290.index&&(_e252.from--,_e252.to--);}}catch(err){_iterator217.e(err);}finally{_iterator217.f();}}s.push(_n120);}}catch(err){_iterator215.e(err);}finally{_iterator215.f();}return new Tc(s,r);}}]);}();Bc=ni.widget({widget:new(/*#__PURE__*/function(_si8){function _class13(){_classCallCheck(this,_class13);return _callSuper(this,_class13,arguments);}_inherits(_class13,_si8);return _createClass(_class13,[{key:"toDOM",value:function toDOM(){var t=document.createElement("span");return t.className="cm-snippetFieldPosition",t;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si))()});Lc=ni.mark({"class":"cm-snippetField"});Nc=/*#__PURE__*/function(){function Nc(t,e){_classCallCheck(this,Nc);this.ranges=t,this.active=e,this.deco=ni.set(t.map(function(t){return(t.from==t.to?Bc:Lc).range(t.from,t.to);}));}return _createClass(Nc,[{key:"map",value:function map(t){var e=[];var _iterator218=_createForOfIteratorHelper(this.ranges),_step218;try{for(_iterator218.s();!(_step218=_iterator218.n()).done;){var _i209=_step218.value;var _s194=_i209.map(t);if(!_s194)return null;e.push(_s194);}}catch(err){_iterator218.e(err);}finally{_iterator218.f();}return new Nc(e,this.active);}},{key:"selectionInsideField",value:function selectionInsideField(t){var _this92=this;return t.ranges.every(function(t){return _this92.ranges.some(function(e){return e.field==_this92.active&&e.from<=t.from&&e.to>=t.to;});});}}]);}();$c=ct.define({map:function map(t,e){return t&&t.map(e);}});jc=ct.define();zc=F.define({create:function create(){return null;},update:function update(t,e){var _iterator219=_createForOfIteratorHelper(e.effects),_step219;try{for(_iterator219.s();!(_step219=_iterator219.n()).done;){var _i210=_step219.value;if(_i210.is($c))return _i210.value;if(_i210.is(jc)&&t)return new Nc(t.ranges,_i210.value);}}catch(err){_iterator219.e(err);}finally{_iterator219.f();}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t;},provide:function provide(t){return Ur.decorations.from(t,function(t){return t?t.deco:ni.none;});}});Vc=[{key:"Tab",run:Wc(1),shift:Wc(-1)},{key:"Escape",run:function run(_ref58){var t=_ref58.state,e=_ref58.dispatch;return!!t.field(zc,!1)&&(e(t.update({effects:$c.of(null)})),!0);}}];Fc=$.define({combine:function combine(t){return t.length?t[0]:Vc;}});qc=_.highest(Zr.compute([Fc],function(t){return t.facet(Fc);}));Jc=Ur.domEventHandlers({mousedown:function mousedown(t,e){var i,s=e.state.field(zc,!1);if(!s||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;var r=s.ranges.find(function(t){return t.from<=i&&t.to>=i;});return!(!r||r.field==s.active)&&(e.dispatch({selection:Pc(s.ranges,r.field),effects:$c.of(s.ranges.some(function(t){return t.field>r.field;})?new Nc(s.ranges,r.field):null),scrollIntoView:!0}),!0);}});Gc={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]};Kc=ct.define({map:function map(t,e){var i=e.mapPos(t,-1,x.TrackAfter);return null==i?void 0:i;}});_c=new(/*#__PURE__*/function(_Ct3){function _class14(){_classCallCheck(this,_class14);return _callSuper(this,_class14,arguments);}_inherits(_class14,_Ct3);return _createClass(_class14);}(Ct))();_c.startSide=1,_c.endSide=-1;Xc=F.define({create:function create(){return It.empty;},update:function update(t,e){if(t=t.map(e.changes),e.selection){var _i212=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:function filter(t){return t>=_i212.from&&t<=_i212.to;}});}var _iterator220=_createForOfIteratorHelper(e.effects),_step220;try{for(_iterator220.s();!(_step220=_iterator220.n()).done;){var _i213=_step220.value;_i213.is(Kc)&&(t=t.update({add:[_c.range(_i213.value,_i213.value+1)]}));}}catch(err){_iterator220.e(err);}finally{_iterator220.f();}return t;}});Yc="()[]{}<>";td="object"==(typeof navigator==="undefined"?"undefined":_typeof(navigator))&&/Android\b/.test(navigator.userAgent);ed=Ur.inputHandler.of(function(t,e,i,s){if((td?t.composing:t.compositionStarted)||t.state.readOnly)return!1;var r=t.state.selection.main;if(s.length>2||2==s.length&&1==y(v(s,0))||e!=r.from||i!=r.to)return!1;var n=function(t,e){var i=Zc(t,t.selection.main.head),s=i.brackets||Gc.brackets;var _iterator221=_createForOfIteratorHelper(s),_step221;try{for(_iterator221.s();!(_step221=_iterator221.n()).done;){var _r153=_step221.value;var _n121=Qc(v(_r153,0));if(e==_r153)return _n121==_r153?ld(t,_r153,s.indexOf(_r153+_r153+_r153)>-1,i):nd(t,_r153,_n121,i.before||Gc.before);if(e==_n121&&sd(t,t.selection.main.from))return hd(t,_r153,_n121);}}catch(err){_iterator221.e(err);}finally{_iterator221.f();}return null;}(t.state,s);return!!n&&(t.dispatch(n),!0);});id=[{key:"Backspace",run:function run(_ref59){var t=_ref59.state,e=_ref59.dispatch;if(t.readOnly)return!1;var i=Zc(t,t.selection.main.head).brackets||Gc.brackets,s=null,r=t.changeByRange(function(e){if(e.empty){var _s195=function(t,e){var i=t.sliceString(e-2,e);return y(v(i,0))==i.length?i:i.slice(1);}(t.doc,e.head);var _iterator222=_createForOfIteratorHelper(i),_step222;try{for(_iterator222.s();!(_step222=_iterator222.n()).done;){var _r154=_step222.value;if(_r154==_s195&&rd(t.doc,e.head)==Qc(v(_r154,0)))return{changes:{from:e.head-_r154.length,to:e.head+_r154.length},range:B.cursor(e.head-_r154.length)};}}catch(err){_iterator222.e(err);}finally{_iterator222.f();}}return{range:s=e};});return s||e(t.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s;}}];ad=[{key:"Ctrl-Space",run:function run(t){return!!t.state.field(yc,!1)&&(t.dispatch({effects:tc.of(!0)}),!0);}},{key:"Escape",run:function run(t){var e=t.state.field(yc,!1);return!(!e||!e.active.some(function(t){return 0!=t.state;}))&&(t.dispatch({effects:ec.of(null)}),!0);}},{key:"ArrowDown",run:Sc(!0)},{key:"ArrowUp",run:Sc(!1)},{key:"PageDown",run:Sc(!0,"page")},{key:"PageUp",run:Sc(!1,"page")},{key:"Enter",run:function run(t){var e=t.state.field(yc,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(rc).interactionDelay)&&Mc(t,e.open.options[e.open.selected]);}}];cd=_.highest(Zr.computeN([rc],function(t){return t.facet(rc).defaultKeymap?[ad]:[];}));dd=/*#__PURE__*/_createClass(function dd(t,e,i){_classCallCheck(this,dd);this.from=t,this.to=e,this.diagnostic=i;});pd=/*#__PURE__*/function(){function pd(t,e,i){_classCallCheck(this,pd);this.diagnostics=t,this.panel=e,this.selected=i;}return _createClass(pd,null,[{key:"init",value:function init(t,e,i){var s=t,r=i.facet(Ad).markerFilter;r&&(s=r(s,i));var n=ni.set(s.map(function(t){return t.from==t.to||t.from==t.to-1&&i.doc.lineAt(t.from).to==t.from?ni.widget({widget:new Od(t),diagnostic:t}).range(t.from):ni.mark({attributes:{"class":"cm-lintRange cm-lintRange-"+t.severity+(t.markClass?" "+t.markClass:"")},diagnostic:t,inclusive:!0}).range(t.from,t.to);}),!0);return new pd(n,e,md(n));}}]);}();gd=ct.define();wd=ct.define();bd=ct.define();vd=F.define({create:function create(){return new pd(ni.none,null,null);},update:function update(t,e){if(e.docChanged){var _i215=t.diagnostics.map(e.changes),_s197=null;if(t.selected){var _r156=e.changes.mapPos(t.selected.from,1);_s197=md(_i215,t.selected.diagnostic,_r156)||md(_i215,null,_r156);}t=new pd(_i215,t.panel,_s197);}var _iterator224=_createForOfIteratorHelper(e.effects),_step224;try{for(_iterator224.s();!(_step224=_iterator224.n()).done;){var _i216=_step224.value;_i216.is(gd)?t=pd.init(_i216.value,t.panel,e.state):_i216.is(wd)?t=new pd(t.diagnostics,_i216.value?Id.open:null,t.selected):_i216.is(bd)&&(t=new pd(t.diagnostics,t.panel,_i216.value));}}catch(err){_iterator224.e(err);}finally{_iterator224.f();}return t;},provide:function provide(t){return[oh.from(t,function(t){return t.panel;}),Ur.decorations.from(t,function(t){return t.diagnostics;})];}});kd=ni.mark({"class":"cm-lintRange cm-lintRange-active",inclusive:!0});xd=function xd(t){var e=t.state.field(vd,!1);return!(!e||!e.panel)&&(t.dispatch({effects:wd.of(!1)}),!0);};Sd=[{key:"Mod-Shift-m",run:function run(t){var e=t.state.field(vd,!1);var i,s;e&&e.panel||t.dispatch({effects:(i=t.state,s=[wd.of(!0)],i.field(vd,!1)?s:s.concat(ct.appendConfig.of(Bd)))});var r=rh(t,Id.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0;},preventDefault:!0},{key:"F8",run:function run(t){var e=t.state.field(vd,!1);if(!e)return!1;var i=t.state.selection.main,s=e.diagnostics.iter(i.to+1);return!(!s.value&&(s=e.diagnostics.iter(0),!s.value||s.from==i.from&&s.to==i.to))&&(t.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0}),!0);}}];Ad=$.define({combine:function combine(t){return Object.assign({sources:t.map(function(t){return t.source;}).filter(function(t){return null!=t;})},At(t.map(function(t){return t.config;}),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:function hideOn(){return null;}},{needsRefresh:function needsRefresh(t,e){return t?e?function(i){return t(i)||e(i);}:t:e;}}));}});Od=/*#__PURE__*/function(_si9){function Od(t){var _this93;_classCallCheck(this,Od);_this93=_callSuper(this,Od),_this93.diagnostic=t;return _this93;}_inherits(Od,_si9);return _createClass(Od,[{key:"eq",value:function eq(t){return t.diagnostic==this.diagnostic;}},{key:"toDOM",value:function toDOM(){return Hf("span",{"class":"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity});}}]);}(si);Ed=/*#__PURE__*/_createClass(function Ed(t,e){_classCallCheck(this,Ed);this.diagnostic=e,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=Dd(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option");});Id=/*#__PURE__*/function(){function Id(t){var _this94=this;_classCallCheck(this,Id);this.view=t,this.items=[];this.list=Hf("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:function onkeydown(e){if(27==e.keyCode)xd(_this94.view),_this94.view.focus();else if(38==e.keyCode||33==e.keyCode)_this94.moveSelection((_this94.selectedIndex-1+_this94.items.length)%_this94.items.length);else if(40==e.keyCode||34==e.keyCode)_this94.moveSelection((_this94.selectedIndex+1)%_this94.items.length);else if(36==e.keyCode)_this94.moveSelection(0);else if(35==e.keyCode)_this94.moveSelection(_this94.items.length-1);else if(13==e.keyCode)_this94.view.focus();else{if(!(e.keyCode>=65&&e.keyCode<=90&&_this94.selectedIndex>=0))return;{var _i218=_this94.items[_this94.selectedIndex].diagnostic,_s198=Cd(_i218.actions);for(var _r157=0;_r157<_s198.length;_r157++)if(_s198[_r157].toUpperCase().charCodeAt(0)==e.keyCode){var _e255=md(_this94.view.state.field(vd).diagnostics,_i218);_e255&&_i218.actions[_r157].apply(t,_e255.from,_e255.to);}}}e.preventDefault();},onclick:function onclick(t){for(var _e256=0;_e256<_this94.items.length;_e256++)_this94.items[_e256].dom.contains(t.target)&&_this94.moveSelection(_e256);}}),this.dom=Hf("div",{"class":"cm-panel-lint"},this.list,Hf("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:function onclick(){return xd(_this94.view);}},"×")),this.update();}return _createClass(Id,[{key:"selectedIndex",get:function get(){var t=this.view.state.field(vd).selected;if(!t)return-1;for(var _e257=0;_e257<this.items.length;_e257++)if(this.items[_e257].diagnostic==t.diagnostic)return _e257;return-1;}},{key:"update",value:function update(){var _this95=this;var _this$view$state$fiel=this.view.state.field(vd),t=_this$view$state$fiel.diagnostics,e=_this$view$state$fiel.selected,i=0,s=!1,r=null;for(t.between(0,this.view.state.doc.length,function(t,n,_ref62){var h=_ref62.spec;var l,o=-1;for(var _t293=i;_t293<_this95.items.length;_t293++)if(_this95.items[_t293].diagnostic==h.diagnostic){o=_t293;break;}o<0?(l=new Ed(_this95.view,h.diagnostic),_this95.items.splice(i,0,l),s=!0):(l=_this95.items[o],o>i&&(_this95.items.splice(i,o-i),s=!0)),e&&l.diagnostic==e.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),r=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),i++;});i<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();0==this.items.length&&(this.items.push(new Ed(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:function read(){return{sel:r.dom.getBoundingClientRect(),panel:_this95.list.getBoundingClientRect()};},write:function write(_ref63){var t=_ref63.sel,e=_ref63.panel;var i=e.height/_this95.list.offsetHeight;t.top<e.top?_this95.list.scrollTop-=(e.top-t.top)/i:t.bottom>e.bottom&&(_this95.list.scrollTop+=(t.bottom-e.bottom)/i);}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync();}},{key:"sync",value:function sync(){var t=this.list.firstChild;function e(){var e=t;t=e.nextSibling,e.remove();}var _iterator226=_createForOfIteratorHelper(this.items),_step226;try{for(_iterator226.s();!(_step226=_iterator226.n()).done;){var _i219=_step226.value;if(_i219.dom.parentNode==this.list){for(;t!=_i219.dom;)e();t=_i219.dom.nextSibling;}else this.list.insertBefore(_i219.dom,t);}}catch(err){_iterator226.e(err);}finally{_iterator226.f();}for(;t;)e();}},{key:"moveSelection",value:function moveSelection(t){if(this.selectedIndex<0)return;var e=md(this.view.state.field(vd).diagnostics,this.items[t].diagnostic);e&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:bd.of(e)});}}],[{key:"open",value:function open(t){return new Id(t);}}]);}();Td=Ur.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Rd("#d11")},".cm-lintRange-warning":{backgroundImage:Rd("orange")},".cm-lintRange-info":{backgroundImage:Rd("#999")},".cm-lintRange-hint":{backgroundImage:Rd("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});Bd=[vd,Ur.decorations.compute([vd],function(t){var _t$field=t.field(vd),e=_t$field.selected,i=_t$field.panel;return e&&i&&e.from!=e.to?ni.set([kd.range(e.from,e.to)]):ni.none;}),th(yd,{hideOn:function hideOn(t,e){var i=e.pos,s=e.end||i,r=t.state.facet(Ad).hideOn(t,i,s);if(null!=r)return r;var n=t.startState.doc.lineAt(e.pos);return!(!t.effects.some(function(t){return t.is(gd);})&&!t.changes.touchesRange(n.from,Math.max(n.to,s)));}}),Td];Ld=function Ld(t){return void 0===t||t;};_export("v",Nd=function Nd(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=[];Ld(t.defaultKeymap)&&e.push.apply(e,_toConsumableArray(Pf)),Ld(t.closeBracketsKeymap)&&e.push.apply(e,id),Ld(t.searchKeymap)&&e.push.apply(e,$a),Ld(t.historyKeymap)&&e.push.apply(e,qu),Ld(t.foldKeymap)&&e.push.apply(e,Ro),Ld(t.lintKeymap)&&e.push.apply(e,Sd);var i=[];return Ld(t.lineNumbers)&&i.push(Dh()),Ld(t.highlightActiveLineGutter)&&i.push(Ih),Ld(t.highlightSpecialChars)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[En.of(t),In||(In=_i.fromClass(/*#__PURE__*/function(){function _class15(t){_classCallCheck(this,_class15);this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(En)),this.decorations=this.decorator.createDeco(t);}return _createClass(_class15,[{key:"makeDecorator",value:function makeDecorator(t){var _this96=this;return new Sn({regexp:t.specialChars,decoration:function decoration(e,i,s){var r=i.state.doc,n=v(e[0],0);if(9==n){var _t294=r.lineAt(s),_e258=i.state.tabSize,_n122=Vt(_t294.text,_e258,s-_t294.from);return ni.replace({widget:new Tn((_e258-_n122%_e258)*_this96.view.defaultCharacterWidth/_this96.view.scaleX)});}return _this96.decorationCache[n]||(_this96.decorationCache[n]=ni.replace({widget:new Rn(t,n)}));},boundary:t.replaceTabs?void 0:/[^]/});}},{key:"update",value:function update(t){var e=t.state.facet(En);t.startState.facet(En)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations);}}]);}(),{decorations:function decorations(t){return t.decorations;}}))];}()),Ld(t.history)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[Du,Cu.of(t),Ur.domEventHandlers({beforeinput:function beforeinput(t,e){var i="historyUndo"==t.inputType?Eu:"historyRedo"==t.inputType?Iu:null;return!!i&&(t.preventDefault(),i(e));}})];}()),Ld(t.foldGutter)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=Object.assign(Object.assign({},zo),t),i=new Po(e,!0),s=new Po(e,!1),r=_i.fromClass(/*#__PURE__*/function(){function _class16(t){_classCallCheck(this,_class16);this.from=t.viewport.from,this.markers=this.buildMarkers(t);}return _createClass(_class16,[{key:"update",value:function update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Ql)!=t.state.facet(Ql)||t.startState.field(Co,!1)!=t.state.field(Co,!1)||Fl(t.startState)!=Fl(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view));}},{key:"buildMarkers",value:function buildMarkers(t){var e=new Rt();var _iterator227=_createForOfIteratorHelper(t.viewportLineBlocks),_step227;try{for(_iterator227.s();!(_step227=_iterator227.n()).done;){var _r158=_step227.value;var _n123=Do(t.state,_r158.from,_r158.to)?s:yo(t.state,_r158.from,_r158.to)?i:null;_n123&&e.add(_r158.from,_r158.from,_n123);}}catch(err){_iterator227.e(err);}finally{_iterator227.f();}return e.finish();}}]);}()),n=e.domEventHandlers;return[r,dh({"class":"cm-foldGutter",markers:function markers(t){var e;return(null===(e=t.plugin(r))||void 0===e?void 0:e.markers)||It.empty;},initialSpacer:function initialSpacer(){return new Po(e,!1);},domEventHandlers:Object.assign(Object.assign({},n),{click:function click(t,e,i){if(n.click&&n.click(t,e,i))return!0;var s=Do(t.state,e.from,e.to);if(s)return t.dispatch({effects:So.of(s)}),!0;var r=yo(t.state,e.from,e.to);return!!r&&(t.dispatch({effects:xo.of(r)}),!0);}})}),Lo()];}()),Ld(t.drawSelection)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[dn.of(t),mn,wn,vn,Wi.of(!0)];}()),Ld(t.dropCursor)&&i.push([yn,Mn]),Ld(t.allowMultipleSelections)&&i.push(St.allowMultipleSelections.of(!0)),Ld(t.indentOnInput)&&i.push(St.transactionFilter.of(function(t){if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;var e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;var i=t.newDoc,s=t.newSelection.main.head,r=i.lineAt(s);if(s>r.from+200)return t;var n=i.sliceString(r.from,s);if(!e.some(function(t){return t.test(n);}))return t;var h=t.state,l=-1,o=[];var _iterator228=_createForOfIteratorHelper(h.selection.ranges),_step228;try{for(_iterator228.s();!(_step228=_iterator228.n()).done;){var _t295=_step228.value.head;var _e259=h.doc.lineAt(_t295);if(_e259.from==l)continue;l=_e259.from;var _i220=ro(h,_e259.from);if(null==_i220)continue;var _s199=/^\s*/.exec(_e259.text)[0],_r159=so(h,_i220);_s199!=_r159&&o.push({from:_e259.from,to:_e259.from+_s199.length,insert:_r159});}}catch(err){_iterator228.e(err);}finally{_iterator228.f();}return o.length?[t,{changes:o,sequential:!0}]:t;})),Ld(t.syntaxHighlighting)&&i.push(function(t,e){var i,s=[Jo];return t instanceof Wo&&(t.module&&s.push(Ur.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?s.push(Fo.of(t)):i?s.push(Vo.computeN([Ur.darkTheme],function(e){return e.facet(Ur.darkTheme)==("dark"==i)?[t]:[];})):s.push(Vo.of(t)),s;}(Go,{fallback:!0})),Ld(t.bracketMatching)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[Yo.of(t),iu];}()),Ld(t.closeBrackets)&&i.push([ed,Xc]),Ld(t.autocompletion)&&i.push(fd()),Ld(t.rectangularSelection)&&i.push(function(t){var e=(null==t?void 0:t.eventFilter)||function(t){return t.altKey&&0==t.button;};return Ur.mouseSelectionStyle.of(function(t,i){return e(i)?jn(t,i):null;});}()),Ld(t.crosshairCursor)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var _zn=_slicedToArray(zn[t.key||"Alt"],2),e=_zn[0],i=_zn[1],s=_i.fromClass(/*#__PURE__*/function(){function _class17(t){_classCallCheck(this,_class17);this.view=t,this.isDown=!1;}return _createClass(_class17,[{key:"set",value:function set(t){this.isDown!=t&&(this.isDown=t,this.view.update([]));}}]);}(),{eventObservers:{keydown:function keydown(t){this.set(t.keyCode==e||i(t));},keyup:function keyup(t){t.keyCode!=e&&i(t)||this.set(!1);},mousemove:function mousemove(t){this.set(i(t));}}});return[s,Ur.contentAttributes.of(function(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.isDown)?Pn:null;})];}()),Ld(t.highlightActiveLine)&&i.push(Ln),Ld(t.highlightSelectionMatches)&&i.push(function(t){var e=[la,ha];return t&&e.push(ia.of(t)),e;}()),t.tabSize&&"number"==typeof t.tabSize&&i.push(eo.of(" ".repeat(t.tabSize))),i.concat([Zr.of(e.flat())]).filter(Boolean);});}};});
6
+ }}var n=_this89.view.state.field(yc).active.find(function(t){return t.source==r.active.source;});if(n&&1==n.state)if(null==r.done){var _t287=new wc(r.active.source,0);var _iterator213=_createForOfIteratorHelper(r.updates),_step213;try{for(_iterator213.s();!(_step213=_iterator213.n()).done;){var _e248=_step213.value;_t287=_t287.update(_e248,i);}}catch(err){_iterator213.e(err);}finally{_iterator213.f();}1!=_t287.state&&e.push(_t287);}else _this89.startQuery(n);_s191=_s192;},_ret3;for(var _s191=0;_s191<this.running.length;_s191++){_ret3=_loop16(_s191);if(_ret3===0)continue;}e.length&&this.view.dispatch({effects:vc.of(e)});}}]);}(),{eventHandlers:{blur:function blur(t){var _this90=this;var e=this.view.state.field(yc,!1);if(e&&e.tooltip&&this.view.state.facet(rc).closeOnBlur){var _i207=e.open&&eh(this.view,e.open.tooltip);_i207&&_i207.dom.contains(t.relatedTarget)||setTimeout(function(){return _this90.view.dispatch({effects:ec.of(null)});},10);}},compositionstart:function compositionstart(){this.composing=1;},compositionend:function compositionend(){var _this91=this;3==this.composing&&setTimeout(function(){return _this91.view.dispatch({effects:tc.of(!1)});},20),this.composing=0;}}});Dc="object"==(typeof navigator==="undefined"?"undefined":_typeof(navigator))&&/Win/.test(navigator.platform);Oc=_.highest(Ur.domEventHandlers({keydown:function keydown(t,e){var i=e.state.field(yc,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||t.key.length>1||t.ctrlKey&&(!Dc||!t.altKey)||t.metaKey)return!1;var s=i.open.options[i.open.selected],r=i.active.find(function(t){return t.source==s.source;}),n=s.completion.commitCharacters||r.result.commitCharacters;return n&&n.indexOf(t.key)>-1&&Mc(e,s),!1;}}));Ec=Ur.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});Ic=/*#__PURE__*/_createClass(function Ic(t,e,i,s){_classCallCheck(this,Ic);this.field=t,this.line=e,this.from=i,this.to=s;});Rc=/*#__PURE__*/function(){function Rc(t,e,i){_classCallCheck(this,Rc);this.field=t,this.from=e,this.to=i;}return _createClass(Rc,[{key:"map",value:function map(t){var e=t.mapPos(this.from,-1,x.TrackDel),i=t.mapPos(this.to,1,x.TrackDel);return null==e||null==i?null:new Rc(this.field,e,i);}}]);}();Tc=/*#__PURE__*/function(){function Tc(t,e){_classCallCheck(this,Tc);this.lines=t,this.fieldPositions=e;}return _createClass(Tc,[{key:"instantiate",value:function instantiate(t,e){var i=[],s=[e],r=t.doc.lineAt(e),n=/^\s*/.exec(r.text)[0];var _iterator214=_createForOfIteratorHelper(this.lines),_step214;try{for(_iterator214.s();!(_step214=_iterator214.n()).done;){var _r152=_step214.value;if(i.length){var _i208=n,_h80=/^\t*/.exec(_r152)[0].length;for(var _e249=0;_e249<_h80;_e249++)_i208+=t.facet(eo);s.push(e+_i208.length-_h80),_r152=_i208+_r152.slice(_h80);}i.push(_r152),e+=_r152.length+1;}}catch(err){_iterator214.e(err);}finally{_iterator214.f();}var h=this.fieldPositions.map(function(t){return new Rc(t.field,s[t.line]+t.from,s[t.line]+t.to);});return{text:i,ranges:h};}}],[{key:"parse",value:function parse(t){var e,i=[],s=[],r=[];var _iterator215=_createForOfIteratorHelper(t.split(/\r\n?|\n/)),_step215;try{for(_iterator215.s();!(_step215=_iterator215.n()).done;){var _n120=_step215.value;for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(_n120);){var _t288=e[1]?+e[1]:null,_h81=e[2]||e[3]||"",_l70=-1;for(var _e250=0;_e250<i.length;_e250++)(null!=_t288?i[_e250].seq==_t288:_h81&&i[_e250].name==_h81)&&(_l70=_e250);if(_l70<0){var _e251=0;for(;_e251<i.length&&(null==_t288||null!=i[_e251].seq&&i[_e251].seq<_t288);)_e251++;i.splice(_e251,0,{seq:_t288,name:_h81}),_l70=_e251;var _iterator216=_createForOfIteratorHelper(r),_step216;try{for(_iterator216.s();!(_step216=_iterator216.n()).done;){var _t289=_step216.value;_t289.field>=_l70&&_t289.field++;}}catch(err){_iterator216.e(err);}finally{_iterator216.f();}}r.push(new Ic(_l70,s.length,e.index,e.index+_h81.length)),_n120=_n120.slice(0,e.index)+_h81+_n120.slice(e.index+e[0].length);}for(var _t290;_t290=/\\([{}])/.exec(_n120);){_n120=_n120.slice(0,_t290.index)+_t290[1]+_n120.slice(_t290.index+_t290[0].length);var _iterator217=_createForOfIteratorHelper(r),_step217;try{for(_iterator217.s();!(_step217=_iterator217.n()).done;){var _e252=_step217.value;_e252.line==s.length&&_e252.from>_t290.index&&(_e252.from--,_e252.to--);}}catch(err){_iterator217.e(err);}finally{_iterator217.f();}}s.push(_n120);}}catch(err){_iterator215.e(err);}finally{_iterator215.f();}return new Tc(s,r);}}]);}();Bc=ni.widget({widget:new(/*#__PURE__*/function(_si8){function _class13(){_classCallCheck(this,_class13);return _callSuper(this,_class13,arguments);}_inherits(_class13,_si8);return _createClass(_class13,[{key:"toDOM",value:function toDOM(){var t=document.createElement("span");return t.className="cm-snippetFieldPosition",t;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si))()});Lc=ni.mark({"class":"cm-snippetField"});Nc=/*#__PURE__*/function(){function Nc(t,e){_classCallCheck(this,Nc);this.ranges=t,this.active=e,this.deco=ni.set(t.map(function(t){return(t.from==t.to?Bc:Lc).range(t.from,t.to);}));}return _createClass(Nc,[{key:"map",value:function map(t){var e=[];var _iterator218=_createForOfIteratorHelper(this.ranges),_step218;try{for(_iterator218.s();!(_step218=_iterator218.n()).done;){var _i209=_step218.value;var _s194=_i209.map(t);if(!_s194)return null;e.push(_s194);}}catch(err){_iterator218.e(err);}finally{_iterator218.f();}return new Nc(e,this.active);}},{key:"selectionInsideField",value:function selectionInsideField(t){var _this92=this;return t.ranges.every(function(t){return _this92.ranges.some(function(e){return e.field==_this92.active&&e.from<=t.from&&e.to>=t.to;});});}}]);}();$c=ct.define({map:function map(t,e){return t&&t.map(e);}});jc=ct.define();zc=F.define({create:function create(){return null;},update:function update(t,e){var _iterator219=_createForOfIteratorHelper(e.effects),_step219;try{for(_iterator219.s();!(_step219=_iterator219.n()).done;){var _i210=_step219.value;if(_i210.is($c))return _i210.value;if(_i210.is(jc)&&t)return new Nc(t.ranges,_i210.value);}}catch(err){_iterator219.e(err);}finally{_iterator219.f();}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t;},provide:function provide(t){return Ur.decorations.from(t,function(t){return t?t.deco:ni.none;});}});Vc=[{key:"Tab",run:Wc(1),shift:Wc(-1)},{key:"Escape",run:function run(_ref58){var t=_ref58.state,e=_ref58.dispatch;return!!t.field(zc,!1)&&(e(t.update({effects:$c.of(null)})),!0);}}];Fc=$.define({combine:function combine(t){return t.length?t[0]:Vc;}});qc=_.highest(Zr.compute([Fc],function(t){return t.facet(Fc);}));Jc=Ur.domEventHandlers({mousedown:function mousedown(t,e){var i,s=e.state.field(zc,!1);if(!s||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;var r=s.ranges.find(function(t){return t.from<=i&&t.to>=i;});return!(!r||r.field==s.active)&&(e.dispatch({selection:Pc(s.ranges,r.field),effects:$c.of(s.ranges.some(function(t){return t.field>r.field;})?new Nc(s.ranges,r.field):null),scrollIntoView:!0}),!0);}});Gc={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]};Kc=ct.define({map:function map(t,e){var i=e.mapPos(t,-1,x.TrackAfter);return null==i?void 0:i;}});_c=new(/*#__PURE__*/function(_Ct3){function _class14(){_classCallCheck(this,_class14);return _callSuper(this,_class14,arguments);}_inherits(_class14,_Ct3);return _createClass(_class14);}(Ct))();_c.startSide=1,_c.endSide=-1;Xc=F.define({create:function create(){return It.empty;},update:function update(t,e){if(t=t.map(e.changes),e.selection){var _i212=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:function filter(t){return t>=_i212.from&&t<=_i212.to;}});}var _iterator220=_createForOfIteratorHelper(e.effects),_step220;try{for(_iterator220.s();!(_step220=_iterator220.n()).done;){var _i213=_step220.value;_i213.is(Kc)&&(t=t.update({add:[_c.range(_i213.value,_i213.value+1)]}));}}catch(err){_iterator220.e(err);}finally{_iterator220.f();}return t;}});Yc="()[]{}<>";td="object"==(typeof navigator==="undefined"?"undefined":_typeof(navigator))&&/Android\b/.test(navigator.userAgent);ed=Ur.inputHandler.of(function(t,e,i,s){if((td?t.composing:t.compositionStarted)||t.state.readOnly)return!1;var r=t.state.selection.main;if(s.length>2||2==s.length&&1==y(v(s,0))||e!=r.from||i!=r.to)return!1;var n=function(t,e){var i=Zc(t,t.selection.main.head),s=i.brackets||Gc.brackets;var _iterator221=_createForOfIteratorHelper(s),_step221;try{for(_iterator221.s();!(_step221=_iterator221.n()).done;){var _r153=_step221.value;var _n121=Qc(v(_r153,0));if(e==_r153)return _n121==_r153?ld(t,_r153,s.indexOf(_r153+_r153+_r153)>-1,i):nd(t,_r153,_n121,i.before||Gc.before);if(e==_n121&&sd(t,t.selection.main.from))return hd(t,_r153,_n121);}}catch(err){_iterator221.e(err);}finally{_iterator221.f();}return null;}(t.state,s);return!!n&&(t.dispatch(n),!0);});id=[{key:"Backspace",run:function run(_ref59){var t=_ref59.state,e=_ref59.dispatch;if(t.readOnly)return!1;var i=Zc(t,t.selection.main.head).brackets||Gc.brackets,s=null,r=t.changeByRange(function(e){if(e.empty){var _s195=function(t,e){var i=t.sliceString(e-2,e);return y(v(i,0))==i.length?i:i.slice(1);}(t.doc,e.head);var _iterator222=_createForOfIteratorHelper(i),_step222;try{for(_iterator222.s();!(_step222=_iterator222.n()).done;){var _r154=_step222.value;if(_r154==_s195&&rd(t.doc,e.head)==Qc(v(_r154,0)))return{changes:{from:e.head-_r154.length,to:e.head+_r154.length},range:B.cursor(e.head-_r154.length)};}}catch(err){_iterator222.e(err);}finally{_iterator222.f();}}return{range:s=e};});return s||e(t.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s;}}];ad=[{key:"Ctrl-Space",run:function run(t){return!!t.state.field(yc,!1)&&(t.dispatch({effects:tc.of(!0)}),!0);}},{key:"Escape",run:function run(t){var e=t.state.field(yc,!1);return!(!e||!e.active.some(function(t){return 0!=t.state;}))&&(t.dispatch({effects:ec.of(null)}),!0);}},{key:"ArrowDown",run:Sc(!0)},{key:"ArrowUp",run:Sc(!1)},{key:"PageDown",run:Sc(!0,"page")},{key:"PageUp",run:Sc(!1,"page")},{key:"Enter",run:function run(t){var e=t.state.field(yc,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(rc).interactionDelay)&&Mc(t,e.open.options[e.open.selected]);}}];cd=_.highest(Zr.computeN([rc],function(t){return t.facet(rc).defaultKeymap?[ad]:[];}));dd=/*#__PURE__*/_createClass(function dd(t,e,i){_classCallCheck(this,dd);this.from=t,this.to=e,this.diagnostic=i;});pd=/*#__PURE__*/function(){function pd(t,e,i){_classCallCheck(this,pd);this.diagnostics=t,this.panel=e,this.selected=i;}return _createClass(pd,null,[{key:"init",value:function init(t,e,i){var s=t,r=i.facet(Ad).markerFilter;r&&(s=r(s,i));var n=ni.set(s.map(function(t){return t.from==t.to||t.from==t.to-1&&i.doc.lineAt(t.from).to==t.from?ni.widget({widget:new Od(t),diagnostic:t}).range(t.from):ni.mark({attributes:{"class":"cm-lintRange cm-lintRange-"+t.severity+(t.markClass?" "+t.markClass:"")},diagnostic:t,inclusive:!0}).range(t.from,t.to);}),!0);return new pd(n,e,md(n));}}]);}();gd=ct.define();wd=ct.define();bd=ct.define();vd=F.define({create:function create(){return new pd(ni.none,null,null);},update:function update(t,e){if(e.docChanged){var _i215=t.diagnostics.map(e.changes),_s197=null;if(t.selected){var _r156=e.changes.mapPos(t.selected.from,1);_s197=md(_i215,t.selected.diagnostic,_r156)||md(_i215,null,_r156);}t=new pd(_i215,t.panel,_s197);}var _iterator224=_createForOfIteratorHelper(e.effects),_step224;try{for(_iterator224.s();!(_step224=_iterator224.n()).done;){var _i216=_step224.value;_i216.is(gd)?t=pd.init(_i216.value,t.panel,e.state):_i216.is(wd)?t=new pd(t.diagnostics,_i216.value?Id.open:null,t.selected):_i216.is(bd)&&(t=new pd(t.diagnostics,t.panel,_i216.value));}}catch(err){_iterator224.e(err);}finally{_iterator224.f();}return t;},provide:function provide(t){return[oh.from(t,function(t){return t.panel;}),Ur.decorations.from(t,function(t){return t.diagnostics;})];}});kd=ni.mark({"class":"cm-lintRange cm-lintRange-active",inclusive:!0});xd=function xd(t){var e=t.state.field(vd,!1);return!(!e||!e.panel)&&(t.dispatch({effects:wd.of(!1)}),!0);};Sd=[{key:"Mod-Shift-m",run:function run(t){var e=t.state.field(vd,!1);var i,s;e&&e.panel||t.dispatch({effects:(i=t.state,s=[wd.of(!0)],i.field(vd,!1)?s:s.concat(ct.appendConfig.of(Bd)))});var r=rh(t,Id.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0;},preventDefault:!0},{key:"F8",run:function run(t){var e=t.state.field(vd,!1);if(!e)return!1;var i=t.state.selection.main,s=e.diagnostics.iter(i.to+1);return!(!s.value&&(s=e.diagnostics.iter(0),!s.value||s.from==i.from&&s.to==i.to))&&(t.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0}),!0);}}];Ad=$.define({combine:function combine(t){return Object.assign({sources:t.map(function(t){return t.source;}).filter(function(t){return null!=t;})},At(t.map(function(t){return t.config;}),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:function hideOn(){return null;}},{needsRefresh:function needsRefresh(t,e){return t?e?function(i){return t(i)||e(i);}:t:e;}}));}});Od=/*#__PURE__*/function(_si9){function Od(t){var _this93;_classCallCheck(this,Od);_this93=_callSuper(this,Od),_this93.diagnostic=t;return _this93;}_inherits(Od,_si9);return _createClass(Od,[{key:"eq",value:function eq(t){return t.diagnostic==this.diagnostic;}},{key:"toDOM",value:function toDOM(){return Hf("span",{"class":"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity});}}]);}(si);Ed=/*#__PURE__*/_createClass(function Ed(t,e){_classCallCheck(this,Ed);this.diagnostic=e,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=Dd(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option");});Id=/*#__PURE__*/function(){function Id(t){var _this94=this;_classCallCheck(this,Id);this.view=t,this.items=[];this.list=Hf("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:function onkeydown(e){if(27==e.keyCode)xd(_this94.view),_this94.view.focus();else if(38==e.keyCode||33==e.keyCode)_this94.moveSelection((_this94.selectedIndex-1+_this94.items.length)%_this94.items.length);else if(40==e.keyCode||34==e.keyCode)_this94.moveSelection((_this94.selectedIndex+1)%_this94.items.length);else if(36==e.keyCode)_this94.moveSelection(0);else if(35==e.keyCode)_this94.moveSelection(_this94.items.length-1);else if(13==e.keyCode)_this94.view.focus();else{if(!(e.keyCode>=65&&e.keyCode<=90&&_this94.selectedIndex>=0))return;{var _i218=_this94.items[_this94.selectedIndex].diagnostic,_s198=Cd(_i218.actions);for(var _r157=0;_r157<_s198.length;_r157++)if(_s198[_r157].toUpperCase().charCodeAt(0)==e.keyCode){var _e255=md(_this94.view.state.field(vd).diagnostics,_i218);_e255&&_i218.actions[_r157].apply(t,_e255.from,_e255.to);}}}e.preventDefault();},onclick:function onclick(t){for(var _e256=0;_e256<_this94.items.length;_e256++)_this94.items[_e256].dom.contains(t.target)&&_this94.moveSelection(_e256);}}),this.dom=Hf("div",{"class":"cm-panel-lint"},this.list,Hf("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:function onclick(){return xd(_this94.view);}},"×")),this.update();}return _createClass(Id,[{key:"selectedIndex",get:function get(){var t=this.view.state.field(vd).selected;if(!t)return-1;for(var _e257=0;_e257<this.items.length;_e257++)if(this.items[_e257].diagnostic==t.diagnostic)return _e257;return-1;}},{key:"update",value:function update(){var _this95=this;var _this$view$state$fiel=this.view.state.field(vd),t=_this$view$state$fiel.diagnostics,e=_this$view$state$fiel.selected,i=0,s=!1,r=null;for(t.between(0,this.view.state.doc.length,function(t,n,_ref62){var h=_ref62.spec;var l,o=-1;for(var _t293=i;_t293<_this95.items.length;_t293++)if(_this95.items[_t293].diagnostic==h.diagnostic){o=_t293;break;}o<0?(l=new Ed(_this95.view,h.diagnostic),_this95.items.splice(i,0,l),s=!0):(l=_this95.items[o],o>i&&(_this95.items.splice(i,o-i),s=!0)),e&&l.diagnostic==e.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),r=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),i++;});i<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();0==this.items.length&&(this.items.push(new Ed(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:function read(){return{sel:r.dom.getBoundingClientRect(),panel:_this95.list.getBoundingClientRect()};},write:function write(_ref63){var t=_ref63.sel,e=_ref63.panel;var i=e.height/_this95.list.offsetHeight;t.top<e.top?_this95.list.scrollTop-=(e.top-t.top)/i:t.bottom>e.bottom&&(_this95.list.scrollTop+=(t.bottom-e.bottom)/i);}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync();}},{key:"sync",value:function sync(){var t=this.list.firstChild;function e(){var e=t;t=e.nextSibling,e.remove();}var _iterator226=_createForOfIteratorHelper(this.items),_step226;try{for(_iterator226.s();!(_step226=_iterator226.n()).done;){var _i219=_step226.value;if(_i219.dom.parentNode==this.list){for(;t!=_i219.dom;)e();t=_i219.dom.nextSibling;}else this.list.insertBefore(_i219.dom,t);}}catch(err){_iterator226.e(err);}finally{_iterator226.f();}for(;t;)e();}},{key:"moveSelection",value:function moveSelection(t){if(this.selectedIndex<0)return;var e=md(this.view.state.field(vd).diagnostics,this.items[t].diagnostic);e&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:bd.of(e)});}}],[{key:"open",value:function open(t){return new Id(t);}}]);}();Td=Ur.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Rd("#d11")},".cm-lintRange-warning":{backgroundImage:Rd("orange")},".cm-lintRange-info":{backgroundImage:Rd("#999")},".cm-lintRange-hint":{backgroundImage:Rd("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});Bd=[vd,Ur.decorations.compute([vd],function(t){var _t$field=t.field(vd),e=_t$field.selected,i=_t$field.panel;return e&&i&&e.from!=e.to?ni.set([kd.range(e.from,e.to)]):ni.none;}),th(yd,{hideOn:function hideOn(t,e){var i=e.pos,s=e.end||i,r=t.state.facet(Ad).hideOn(t,i,s);if(null!=r)return r;var n=t.startState.doc.lineAt(e.pos);return!(!t.effects.some(function(t){return t.is(gd);})&&!t.changes.touchesRange(n.from,Math.max(n.to,s)));}}),Td];Ld=function Ld(t){return void 0===t||t;};_export("u",Nd=function Nd(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=[];Ld(t.defaultKeymap)&&e.push.apply(e,_toConsumableArray(Pf)),Ld(t.closeBracketsKeymap)&&e.push.apply(e,id),Ld(t.searchKeymap)&&e.push.apply(e,$a),Ld(t.historyKeymap)&&e.push.apply(e,qu),Ld(t.foldKeymap)&&e.push.apply(e,Ro),Ld(t.lintKeymap)&&e.push.apply(e,Sd);var i=[];return Ld(t.lineNumbers)&&i.push(Dh()),Ld(t.highlightActiveLineGutter)&&i.push(Ih),Ld(t.highlightSpecialChars)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[En.of(t),In||(In=_i.fromClass(/*#__PURE__*/function(){function _class15(t){_classCallCheck(this,_class15);this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(En)),this.decorations=this.decorator.createDeco(t);}return _createClass(_class15,[{key:"makeDecorator",value:function makeDecorator(t){var _this96=this;return new Sn({regexp:t.specialChars,decoration:function decoration(e,i,s){var r=i.state.doc,n=v(e[0],0);if(9==n){var _t294=r.lineAt(s),_e258=i.state.tabSize,_n122=Vt(_t294.text,_e258,s-_t294.from);return ni.replace({widget:new Tn((_e258-_n122%_e258)*_this96.view.defaultCharacterWidth/_this96.view.scaleX)});}return _this96.decorationCache[n]||(_this96.decorationCache[n]=ni.replace({widget:new Rn(t,n)}));},boundary:t.replaceTabs?void 0:/[^]/});}},{key:"update",value:function update(t){var e=t.state.facet(En);t.startState.facet(En)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations);}}]);}(),{decorations:function decorations(t){return t.decorations;}}))];}()),Ld(t.history)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[Du,Cu.of(t),Ur.domEventHandlers({beforeinput:function beforeinput(t,e){var i="historyUndo"==t.inputType?Eu:"historyRedo"==t.inputType?Iu:null;return!!i&&(t.preventDefault(),i(e));}})];}()),Ld(t.foldGutter)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=Object.assign(Object.assign({},zo),t),i=new Po(e,!0),s=new Po(e,!1),r=_i.fromClass(/*#__PURE__*/function(){function _class16(t){_classCallCheck(this,_class16);this.from=t.viewport.from,this.markers=this.buildMarkers(t);}return _createClass(_class16,[{key:"update",value:function update(t){(t.docChanged||t.viewportChanged||t.startState.facet(Ql)!=t.state.facet(Ql)||t.startState.field(Co,!1)!=t.state.field(Co,!1)||Fl(t.startState)!=Fl(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view));}},{key:"buildMarkers",value:function buildMarkers(t){var e=new Rt();var _iterator227=_createForOfIteratorHelper(t.viewportLineBlocks),_step227;try{for(_iterator227.s();!(_step227=_iterator227.n()).done;){var _r158=_step227.value;var _n123=Do(t.state,_r158.from,_r158.to)?s:yo(t.state,_r158.from,_r158.to)?i:null;_n123&&e.add(_r158.from,_r158.from,_n123);}}catch(err){_iterator227.e(err);}finally{_iterator227.f();}return e.finish();}}]);}()),n=e.domEventHandlers;return[r,dh({"class":"cm-foldGutter",markers:function markers(t){var e;return(null===(e=t.plugin(r))||void 0===e?void 0:e.markers)||It.empty;},initialSpacer:function initialSpacer(){return new Po(e,!1);},domEventHandlers:Object.assign(Object.assign({},n),{click:function click(t,e,i){if(n.click&&n.click(t,e,i))return!0;var s=Do(t.state,e.from,e.to);if(s)return t.dispatch({effects:So.of(s)}),!0;var r=yo(t.state,e.from,e.to);return!!r&&(t.dispatch({effects:xo.of(r)}),!0);}})}),Lo()];}()),Ld(t.drawSelection)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[dn.of(t),mn,wn,vn,Wi.of(!0)];}()),Ld(t.dropCursor)&&i.push([yn,Mn]),Ld(t.allowMultipleSelections)&&i.push(St.allowMultipleSelections.of(!0)),Ld(t.indentOnInput)&&i.push(St.transactionFilter.of(function(t){if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;var e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;var i=t.newDoc,s=t.newSelection.main.head,r=i.lineAt(s);if(s>r.from+200)return t;var n=i.sliceString(r.from,s);if(!e.some(function(t){return t.test(n);}))return t;var h=t.state,l=-1,o=[];var _iterator228=_createForOfIteratorHelper(h.selection.ranges),_step228;try{for(_iterator228.s();!(_step228=_iterator228.n()).done;){var _t295=_step228.value.head;var _e259=h.doc.lineAt(_t295);if(_e259.from==l)continue;l=_e259.from;var _i220=ro(h,_e259.from);if(null==_i220)continue;var _s199=/^\s*/.exec(_e259.text)[0],_r159=so(h,_i220);_s199!=_r159&&o.push({from:_e259.from,to:_e259.from+_s199.length,insert:_r159});}}catch(err){_iterator228.e(err);}finally{_iterator228.f();}return o.length?[t,{changes:o,sequential:!0}]:t;})),Ld(t.syntaxHighlighting)&&i.push(function(t,e){var i,s=[Jo];return t instanceof Wo&&(t.module&&s.push(Ur.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?s.push(Fo.of(t)):i?s.push(Vo.computeN([Ur.darkTheme],function(e){return e.facet(Ur.darkTheme)==("dark"==i)?[t]:[];})):s.push(Vo.of(t)),s;}(Go,{fallback:!0})),Ld(t.bracketMatching)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[Yo.of(t),iu];}()),Ld(t.closeBrackets)&&i.push([ed,Xc]),Ld(t.autocompletion)&&i.push(fd()),Ld(t.rectangularSelection)&&i.push(function(t){var e=(null==t?void 0:t.eventFilter)||function(t){return t.altKey&&0==t.button;};return Ur.mouseSelectionStyle.of(function(t,i){return e(i)?jn(t,i):null;});}()),Ld(t.crosshairCursor)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var _zn=_slicedToArray(zn[t.key||"Alt"],2),e=_zn[0],i=_zn[1],s=_i.fromClass(/*#__PURE__*/function(){function _class17(t){_classCallCheck(this,_class17);this.view=t,this.isDown=!1;}return _createClass(_class17,[{key:"set",value:function set(t){this.isDown!=t&&(this.isDown=t,this.view.update([]));}}]);}(),{eventObservers:{keydown:function keydown(t){this.set(t.keyCode==e||i(t));},keyup:function keyup(t){t.keyCode!=e&&i(t)||this.set(!1);},mousemove:function mousemove(t){this.set(i(t));}}});return[s,Ur.contentAttributes.of(function(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.isDown)?Pn:null;})];}()),Ld(t.highlightActiveLine)&&i.push(Ln),Ld(t.highlightSelectionMatches)&&i.push(function(t){var e=[la,ha];return t&&e.push(ia.of(t)),e;}()),t.tabSize&&"number"==typeof t.tabSize&&i.push(eo.of(" ".repeat(t.tabSize))),i.concat([Zr.of(e.flat())]).filter(Boolean);});}};});
7
7
  //# sourceMappingURL=extensionSetup.cjs.js.map