@grapecity-software/spread-sheets-formula-panel 18.0.7 → 18.1.0
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* SpreadJS Library 18.0
|
|
3
|
+
* SpreadJS Library 18.1.0
|
|
4
4
|
*
|
|
5
5
|
* Copyright(c) GrapeCity Software inc. All rights reserved.
|
|
6
6
|
*
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
* https://www.grapecity.com.cn/developer/spreadjs
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
|
-
!function(t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("@grapecity-software/spread-sheets")):"function"==typeof define&&define.amd?define(["@grapecity-software/spread-sheets"],t):"object"==typeof exports?exports.Spread=t(require("@grapecity-software/spread-sheets")):t(GC)}(function(n){!function(){"use strict";var i,e,t;function r(t){var n,n,n=e[t];return void 0!==n||(n=e[t]={exports:{}},i[t].call(n.exports,n,n.exports,r)),n.exports}i={"./dist/plugins/formulaPanel/editor/codemirror/index.js":function(T,L){var k,B,_,N,U,H,W,V,$,q,G,h,J,K,Q,X,O,Z,y,Y,tt,b,nt,it,et,rt,ot,ut,st,at,ft,ht,ct,lt,vt,dt,yt,mt,pt,kt,gt,wt,bt,v,Mt,xt,l,St,Ct,C,jt,Pt,Ot,j,Et,At,Dt,Rt,It,Tt,Lt,Bt,_t,Ft,Nt,Ut,Ht,zt,t,n,Wt,Vt,i,$t,qt,Gt,Jt,Kt,Qt,c,Xt,n,t,Zt,e,Yt,tn,nn,en,r,o,u,g,rn,on,un,sn,an,fn,tn,P,m,hn,cn,ln,vn,dn,yn,mn,pn,kn,gn,wn,bn,Mn,xn,Sn,Cn,jn,Pn,On,En,An,d,Dn,Rn,In,Tn,Ln,Bn,_n,Fn,Nn,E,Un,Hn,zn,Wn,Vn,$n,qn,Gn,Jn,Kn,Jn,Qn,Xn,z,Zn,Yn,ti,ni,ii,ei,ri,oi,ui,si,ai,fi,hi,ci,s,li,vi,di,yi,mi,pi,ki,gi,wi,bi,Mi,xi,Si,Ci,p,ji,Pi,Oi,Ei,Ai,Di,Ri,Ii,Ti,Li,Bi,_i,Fi,Ni,Ui,Hi,zi,Wi,Vi,$i,qi,Gi,Ji,Ki,Qi,Xi,w,Zi,Yi,te,ne,e,ie,ee,re,oe,ue,se,ae,fe,he,ce,le,Yt,ve,de,ye,me,pe,ke,ge,we,be,Me,xe,Se,Ce,je,Pe,Oe,Ee,Ae,De,Re,Ie,Te,Le,Be,_e,Fe,Zt,Ne,Ue,He,ze,We,Ve,$e,nn,qe,Ge,Je,Ke,en,Qe,Xe,Ze,Ye,tr,nr,ir,er,rr,or,ur,sr,ar,fr,hr,cr,lr,u,vr,dr,yr,mr,M,pr,kr,n,gr,wr,br,x,Mr,xr,Sr,Cr,jr,Pr,Or,Er,Ar,Dr,Rr,Ir,Tr,Lr,Br,_r,Fr,r,t,e,Yt,Zt,u,nn,o,Nr,Ur,Hr,zr,Wr,Vr,$r,a,Yt,qr,Gr,Jr,t,Kr,Qr,Xr,Zr,Yr,to,no,io,Zt,e,eo,ro,oo,uo,so,nn,ao,fo,ho,co,lo,vo,u,Hr,zr,Wr,o,yo,mo,po,ko,go,wo,bo,Mo,xo,So,Vr,Co,jo,Ur,Po,Oo,Eo,Ao,Do,Ro,Io,To,Lo,Bo,Nr,_o,Fo,No,Uo,Ho,zo,Wo,Vo,$o,qo,$o,Go,Jo,Ko,Qo,Xo,Zo,Yo,tu,nu,iu,eu,r,$r,Yt,ru,ou,uu,su,au,fu,hu,cu,lu,vu,du,yu,mu,pu,ku,gu,wu,bu,Mu,xu,Su,Cu,ju,Pu,Ou,n,Vr,Ur,Eu,Au,Du,Ru,Iu,t,Tu,Lu,Bu,_u,Fu,Nu,Uu,e,Hu,zu,Wu,Vu,$u,Wr,qu,Zt,Nr,nn,zr,u,Gu,Ju,Ku,Qu,Xu,Zu,Yu,o,ts,ns,Hr,jt,r,n,is,es,rs,os,us,ss,as,fs,hs,cs,ls,vs,ds,ys,ms,ps,Yt,e,ks,gs,ws,bs,Ms,xs,Ss,Cs,js,Ps,Os,Es,As,Ds,Rs,Is,Ts,Ls,Bs,_s,Fs,Ns,t,Vr,Us,Hs,zs,Ws,Vs,$s,qs,Gs,Js,Ks,Qs,Xs,Zs,Ys,ta,na,ia,ea,ra,oa,ua,sa,aa,fa,ha,ca,la,va,da,Ur,ya,$r,ma,pa,ka,ga,wa,ba,Ma,xa,Sa,Ca,ja,Pa,Oa,Ea,Aa,Da,Ra,Ia,Ta,La,Ba,zr,_a,u,Fa,Na,Ua,Ha,za,Wa,ma,Va,$a,qa,Ga,Ja,Ka,Qa,Xa,Za,Ya,tf,nf,ef,rf,of,uf,sf,af,ff,$r,hf,cf,lf,vf,df,yf,mf,pf,as,kf,gf,fs,wf,bf,Mf,xf,Sf,Cf,jf,Pf,Xs,Of,Ef,Af,Qs,Df,Rf,If,Tf,Lf,Bf,_f,Ff,ls,Nf,Uf,Hf,o;function zf(t,n,i){return(n=ah(n))in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}function Wf(t){return qf(t)||$f(t)||Xf(t)||Vf()}function Vf(){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 $f(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function qf(t){if(Array.isArray(t))return Zf(t)}function Gf(t,n){return Qf(t)||Kf(t,n)||Xf(t,n)||Jf()}function Jf(){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 Kf(t,n){var i,e,r,o,u,s,a,f,i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){s=[],f=!(a=!0);try{if(o=(i=i.call(t)).next,0===n){if(Object(i)!==i)return;a=!1}else for(;!(a=(e=o.call(i)).done)&&(s.push(e.value),s.length!==n);a=!0);}catch(t){f=!0,r=t}finally{try{if(!a&&null!=i.return&&(u=i.return(),Object(u)!==u))return}finally{if(f)throw r}}return s}}function Qf(t){if(Array.isArray(t))return t}function F(n,t){var i,e,t,r,o,u,i="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(i)return o=!(r=!0),{s:function t(){i=i.call(n)},n:function t(){var n=i.next();return r=n.done,n},e:function t(n){o=!0,u=n},f:function t(){try{r||null==i.return||i.return()}finally{if(o)throw u}}};if(Array.isArray(n)||(i=Xf(n))||t&&n&&"number"==typeof n.length)return i&&(n=i),e=0,{s:t=function t(){},n:function t(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function t(n){throw n},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Xf(t,n){var i;if(t)return"string"==typeof t?Zf(t,n):"Map"===(i="Object"===(i=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:i)||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Zf(t,n):void 0}function Zf(t,n){(null==n||n>t.length)&&(n=t.length);for(var i=0,e=new Array(n);i<n;i++)e[i]=t[i];return e}function Yf(){return(Yf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function t(n,i,e){var r,r,r=th(n,i);if(r)return(r=Object.getOwnPropertyDescriptor(r,i)).get?r.get.call(arguments.length<3?n:e):r.value}).apply(this,arguments)}function th(t,n){for(;!Object.prototype.hasOwnProperty.call(t,n)&&null!==(t=oh(t)););return t}function f(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&nh(t,n)}function nh(t,n){return(nh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function t(n,i){return n.__proto__=i,n})(t,n)}function S(e){var r=rh();return function t(){var n,i,i,n=oh(e),i=r?(i=oh(this).constructor,Reflect.construct(n,arguments,i)):n.apply(this,arguments);return ih(this,i)}}function ih(t,n){if(n&&("object"===uh(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return eh(t)}function eh(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rh(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function oh(t){return(oh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function t(n){return n.__proto__||Object.getPrototypeOf(n)})(t)}function uh(t){return(uh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function A(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function sh(t,n){for(var i,e,i=0;i<n.length;i++)(e=n[i]).enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,ah(e.key),e)}function D(t,n,i){return n&&sh(t.prototype,n),i&&sh(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function ah(t){var t=fh(t,"string");return"symbol"===uh(t)?t:String(t)}function fh(t,n){var i,i;if("object"!==uh(t)||null===t)return t;if(void 0===(i=t[Symbol.toPrimitive]))return("string"===n?String:Number)(t);if("object"!==uh(i=i.call(t,n||"default")))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}function hh(t){var n,i,e,r,n=-1,i=F(t);try{for(i.s();!(e=i.n()).done;)n+=(r=e.value).length+1}catch(t){i.e(t)}finally{i.f()}return n}function ch(t,n,i,e){for(var r,o,u,s,a,f,h,r=2<arguments.length&&void 0!==i?i:0,o=3<arguments.length&&void 0!==e?e:1e9,u=0,s=0,a=!0;s<t.length&&u<=o;s++)r<=(h=u+(f=t[s]).length)&&(o<h&&(f=f.slice(0,o-u)),u<r&&(f=f.slice(r-u)),a?(n[n.length-1]+=f,a=!1):n.push(f)),u=h+1;return n}function lh(t,n,i){return ch(t,[""],n,i)}for(Object.defineProperty(L,"__esModule",{value:!0}),L.basicSetup=L.View=L.State=L.Search=L.Lint=L.Language=L.Commands=L.Autocomplete=void 0,B=function(t){f(a,t);var e=S(a);function a(t){var n,i,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:hh(t);return A(this,a),(n=e.call(this)).text=t,n.length=i,n}return D(a,[{key:"lines",get:function t(){return this.text.length}},{key:"children",get:function t(){return null}},{key:"lineInner",value:function t(n,i,e,r){for(var o,u,s,o=0;;o++){if(s=r+(u=this.text[o]).length,n<=(i?e:s))return new W(r,s,e,u);r=s+1,e++}}},{key:"decompose",value:function t(n,i,e,r){var i,n,r,n,i=n<=0&&i>=this.length?this:new a(lh(this.text,n,i),Math.min(i,this.length)-Math.max(0,n));1&r?(n=e.pop(),(r=ch(i.text,n.text.slice(),0,i.length)).length<=32?e.push(new a(r,n.length+i.length)):(n=r.length>>1,e.push(new a(r.slice(0,n)),new a(r.slice(n))))):e.push(i)}},{key:"replace",value:function t(n,i,e){var r,o;return e instanceof a?(r=ch(this.text,ch(e.text,lh(this.text,0,n)),i),o=this.length+e.length-(i-n),r.length<=32?new a(r,o):_.from(a.split(r,[]),o)):Yf(oh(a.prototype),"replace",this).call(this,n,i,e)}},{key:"sliceString",value:function t(n){for(var i,e,r,o,u,s,a,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.length,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"\n",r="",o=0,u=0;o<=i&&u<this.text.length;u++)n<o&&u&&(r+=e),n<(a=o+(s=this.text[u]).length)&&o<i&&(r+=s.slice(Math.max(0,n-o),i-o)),o=a+1;return r}},{key:"flatten",value:function t(n){var i,e,r,i=F(this.text);try{for(i.s();!(e=i.n()).done;)r=e.value,n.push(r)}catch(t){i.e(t)}finally{i.f()}}},{key:"scanIdentical",value:function t(){return 0}}],[{key:"split",value:function t(n,i){var e,r,o,u,s,e=[],r=-1,o=F(n);try{for(o.s();!(u=o.n()).done;)s=u.value,e.push(s),r+=s.length+1,32==e.length&&(i.push(new a(e,r)),e=[],r=-1)}catch(t){o.e(t)}finally{o.f()}return-1<r&&i.push(new a(e,r)),i}}]),a}(k=function(){function i(){A(this,i)}return D(i,[{key:"lineAt",value:function t(n){if(n<0||n>this.length)throw new RangeError("Invalid position ".concat(n," in document of length ").concat(this.length));return this.lineInner(n,!1,1,0)}},{key:"line",value:function t(n){if(n<1||n>this.lines)throw new RangeError("Invalid line number ".concat(n," in ").concat(this.lines,"-line document"));return this.lineInner(n,!0,1,0)}},{key:"replace",value:function t(n,i,e){var r=[];return this.decompose(0,n,r,2),e.length&&e.decompose(0,e.length,r,3),this.decompose(i,this.length,r,1),_.from(r,this.length-(i-n)+e.length)}},{key:"append",value:function t(n){return this.replace(this.length,this.length,n)}},{key:"slice",value:function t(n){var i,e,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.length,e=[];return this.decompose(n,i,e,0),_.from(e,i-n)}},{key:"eq",value:function t(n){var i,e,r,o,u,s;if(n==this)return!0;if(n.length!=this.length||n.lines!=this.lines)return!1;for(i=this.scanIdentical(n,1),e=this.length-this.scanIdentical(n,-1),r=new N(this),o=new N(n),s=u=i;;){if(r.next(u),o.next(u),u=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(s+=r.value.length,r.done||e<=s)return!0}}},{key:"iter",value:function t(){var n;return new N(this,0<arguments.length&&void 0!==arguments[0]?arguments[0]:1)}},{key:"iterRange",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.length;return new U(this,n,i)}},{key:"iterLines",value:function t(n,i){var n,n,n=null==n?this.iter():(null==i&&(i=this.lines+1),n=this.line(n).from,this.iterRange(n,Math.max(n,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to)));return new H(n)}},{key:"toString",value:function t(){return this.sliceString(0)}},{key:"toJSON",value:function t(){var n=[];return this.flatten(n),n}}],[{key:"of",value:function t(n){if(0==n.length)throw new RangeError("A document must have at least one line");return 1!=n.length||n[0]?n.length<=32?new B(n):_.from(B.split(n,[])):i.empty}}]),i}()),_=function(t){f(x,t);var u=S(x);function x(t,n){var i,e,r,o;A(this,x),(i=u.call(this)).children=t,i.length=n,i.lines=0,e=F(t);try{for(e.s();!(r=e.n()).done;)o=r.value,i.lines+=o.lines}catch(t){e.e(t)}finally{e.f()}return i}return D(x,[{key:"lineInner",value:function t(n,i,e,r){for(var o,u,s,a,o=0;;o++){if(s=r+(u=this.children[o]).length,a=e+u.lines-1,n<=(i?a:s))return u.lineInner(n,i,e,r);r=s+1,e=1+a}}},{key:"decompose",value:function t(n,i,e,r){for(var o,u,s,a,f,o=0,u=0;u<=i&&o<this.children.length;o++)n<=(a=u+(s=this.children[o]).length)&&u<=i&&(f=r&((u<=n?1:0)|(i<=a?2:0)),n<=u&&a<=i&&!f?e.push(s):s.decompose(n-u,i-u,e,f)),u=a+1}},{key:"replace",value:function t(n,i,e){var r,o,u,s,a,u,u;if(e.lines<this.lines)for(o=r=0;r<this.children.length;r++){if(s=o+(u=this.children[r]).length,o<=n&&i<=s)return a=u.replace(n-o,i-o,e),u=this.lines-u.lines+a.lines,a.lines<u>>4&&a.lines>u>>6?((u=this.children.slice())[r]=a,new x(u,this.length-(i-n)+e.length)):Yf(oh(x.prototype),"replace",this).call(this,o,s,a);o=s+1}return Yf(oh(x.prototype),"replace",this).call(this,n,i,e)}},{key:"sliceString",value:function t(n){for(var i,e,r,o,u,s,a,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.length,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"\n",r="",o=0,u=0;o<this.children.length&&u<=i;o++)n<u&&o&&(r+=e),n<(a=u+(s=this.children[o]).length)&&u<i&&(r+=s.sliceString(n-u,i-u,e)),u=a+1;return r}},{key:"flatten",value:function t(n){var i,e,r,i=F(this.children);try{for(i.s();!(e=i.n()).done;)(r=e.value).flatten(n)}catch(t){i.e(t)}finally{i.f()}}},{key:"scanIdentical",value:function t(n,i){var e,r,o,u,s,a,f,h,c;if(!(n instanceof x))return 0;for(u=(o=Gf(r=(e=0)<i?[0,0,this.children.length,n.children.length]:[this.children.length-1,n.children.length-1,-1,-1],4))[0],s=o[1],a=o[2],f=o[3];;u+=i,s+=i){if(u==a||s==f)return e;if((h=this.children[u])!=(c=n.children[s]))return e+h.scanIdentical(c,i);e+=h.length+1}}}],[{key:"from",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n.reduce(function(t,n){return t+n.length+1},-1),e=0,r=F(n);try{for(r.s();!(o=r.n()).done;)e+=(u=o.value).lines}catch(t){r.e(t)}finally{r.f()}if(e<32){s=[],a=F(n);try{for(a.s();!(f=a.n()).done;)(h=f.value).flatten(s)}catch(t){a.e(t)}finally{a.f()}return new B(s,i)}function b(t){var n,i,e,r;if(t.lines>l&&t instanceof x){i=F(t.children);try{for(i.s();!(e=i.n()).done;)b(r=e.value)}catch(t){i.e(t)}finally{i.f()}}else t.lines>v&&(v<y||!y)?(M(),d.push(t)):t instanceof B&&y&&(n=p[p.length-1])instanceof B&&t.lines+n.lines<=32?(y+=t.lines,m+=t.length+1,p[p.length-1]=new B(n.text.concat(t.text),n.length+1+t.length)):(y+t.lines>c&&M(),y+=t.lines,m+=t.length+1,p.push(t))}function M(){0!=y&&(d.push(1==p.length?p[0]:x.from(p,m)),m=-1,y=p.length=0)}c=Math.max(32,e>>5),l=c<<1,v=c>>1,d=[],y=0,m=-1,p=[],k=F(n);try{for(k.s();!(g=k.n()).done;)b(w=g.value)}catch(t){k.e(t)}finally{k.f()}return M(),1==d.length?d[0]:new x(d,i)}}]),x}(k),k.empty=new B([""],0),N=function(){function i(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;A(this,i),this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[0<n?1:(t instanceof B?t.text:t.children).length<<1]}return D(i,[{key:"nextInner",value:function t(n,i){var e,r,o,u,s,s,o;for(this.done=this.lineBreak=!1;;)if(e=this.nodes.length-1,r=this.nodes[e],u=(o=this.offsets[e])>>1,s=(r instanceof B?r.text:r.children).length,u==(0<i?s:0)){if(0==e)return this.done=!0,this.value="",this;0<i&&this.offsets[e-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&o)==(0<i?0:1)){if(this.offsets[e]+=i,0==n)return this.lineBreak=!0,this.value="\n",this;n--}else if(r instanceof B){if(s=r.text[u+(i<0?-1:0)],this.offsets[e]+=i,s.length>Math.max(0,n))return this.value=0==n?s:0<i?s.slice(n):s.slice(0,s.length-n),this;n-=s.length}else n>(o=r.children[u+(i<0?-1:0)]).length?(n-=o.length,this.offsets[e]+=i):(i<0&&this.offsets[e]--,this.nodes.push(o),this.offsets.push(0<i?1:(o instanceof B?o.text:o.children).length<<1))}},{key:"next",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return n<0&&(this.nextInner(-n,-this.dir),n=this.value.length),this.nextInner(n,this.dir)}}]),i}(),U=function(){function e(t,n,i){A(this,e),this.value="",this.done=!1,this.cursor=new N(t,i<n?-1:1),this.pos=i<n?t.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}return D(e,[{key:"nextInner",value:function t(n,i){var e,r,o;return(i<0?this.pos<=this.from:this.pos>=this.to)?(this.value="",this.done=!0):(n+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos),e=i<0?this.pos-this.from:this.to-this.pos,e-=n=e<n?e:n,o=(r=this.cursor.next(n)).value,this.pos+=(o.length+n)*i,this.value=o.length<=e?o:i<0?o.slice(o.length-e):o.slice(0,e),this.done=!this.value),this}},{key:"next",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return n<0?n=Math.max(n,this.from-this.pos):0<n&&(n=Math.min(n,this.to-this.pos)),this.nextInner(n,this.cursor.dir)}},{key:"lineBreak",get:function t(){return this.cursor.lineBreak&&""!=this.value}}]),e}(),H=function(){function n(t){A(this,n),this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}return D(n,[{key:"next",value:function t(){var n,i,e,r,i,n,i=this.inner.next(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0),e=i.done,r=i.lineBreak,i=i.value;return e?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}},{key:"lineBreak",get:function t(){return!1}}]),n}(),"undefined"!=typeof Symbol&&(k.prototype[Symbol.iterator]=function(){return this.iter()},N.prototype[Symbol.iterator]=U.prototype[Symbol.iterator]=H.prototype[Symbol.iterator]=function(){return this}),W=function(){function r(t,n,i,e){A(this,r),this.from=t,this.to=n,this.number=i,this.text=e}return D(r,[{key:"length",get:function t(){return this.to-this.from}}]),r}(),V="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}),$=1;$<V.length;$++)V[$]+=V[$-1];function vh(t){for(var n=1;n<V.length;n+=2)if(V[n]>t)return V[n-1]<=t}function dh(t){return 127462<=t&&t<=127487}function yh(t,n){var i,e,i,e;return(!(2<arguments.length&&void 0!==arguments[2])||arguments[2]?mh:ph)(t,n,!(3<arguments.length&&void 0!==arguments[3])||arguments[3])}function mh(t,n,i){var e,r,o,u;if(n!=t.length)for(n&&kh(t.charCodeAt(n))&&gh(t.charCodeAt(n-1))&&n--,n+=Mh(e=wh(t,n));n<t.length;)if(r=wh(t,n),e==q||r==q||i&&vh(r))n+=Mh(r),e=r;else{if(!dh(r))break;for(o=0,u=n-2;0<=u&&dh(wh(t,u));)o++,u-=2;if(o%2==0)break;n+=2}return n}function ph(t,n,i){for(;0<n;){var e=mh(t,n-2,i);if(e<n)return e;n--}return 0}function kh(t){return 56320<=t&&t<57344}function gh(t){return 55296<=t&&t<56320}function wh(t,n){var i,t,i=t.charCodeAt(n);return gh(i)&&n+1!=t.length&&kh(t=t.charCodeAt(n+1))?t-56320+(i-55296<<10)+65536:i}function bh(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function Mh(t){return t<65536?1:2}function xh(t,n,i,e){var e,r,e=3<arguments.length&&void 0!==e&&e;0==n&&i<=0||(0<=(r=t.length-2)&&i<=0&&i==t[1+r]?t[r]+=n:0==n&&0==t[r]?t[1+r]+=i:e?(t[r]+=n,t[1+r]+=i):t.push(n,i))}function Sh(t,n,i){if(0!=i.length){var e=n.length-2>>1;if(e<t.length)t[t.length-1]=t[t.length-1].append(i);else{for(;t.length<e;)t.push(k.empty);t.push(i)}}}function Ch(t,n,i){for(var e,r,o,u,s,a,f,h,c,e=t.inserted,r=0,o=0,u=0;u<t.sections.length;)if(s=t.sections[u++],(a=t.sections[u++])<0)r+=s,o+=s;else{for(f=r,h=o,c=k.empty;f+=s,h+=a,a&&e&&(c=c.append(e[u-2>>1])),!(i||u==t.sections.length||t.sections[u+1]<0);)s=t.sections[u++],a=t.sections[u++];n(r,f,o,h,c),r=f,o=h}}function jh(t,n,i,e){for(var r,o,u,s,a,f,h,c,l,v,d,y,r,o=[],u=3<arguments.length&&void 0!==e&&e?[]:null,s=new Q(t),a=new Q(n),f=-1;;)if(-1==s.ins&&-1==a.ins)xh(o,h=Math.min(s.len,a.len),-1),s.forward(h),a.forward(h);else if(0<=a.ins&&(s.ins<0||f==s.i||0==s.off&&(a.len<s.len||a.len==s.len&&!i))){for(c=a.len,xh(o,a.ins,-1);c;)l=Math.min(s.len,c),0<=s.ins&&f<s.i&&s.len<=l&&(xh(o,0,s.ins),u&&Sh(u,o,s.text),f=s.i),s.forward(l),c-=l;a.next()}else{if(!(0<=s.ins)){if(s.done&&a.done)return u?K.createSet(o,u):J.create(o);throw new Error("Mismatched change set lengths")}for(v=0,d=s.len;d;)if(-1==a.ins)v+=y=Math.min(d,a.len),d-=y,a.forward(y);else{if(!(0==a.ins&&a.len<d))break;d-=a.len,a.next()}xh(o,v,f<s.i?s.ins:0),u&&f<s.i&&Sh(u,o,s.text),f=s.i,s.forward(s.len-d)}}function Ph(t,n,i){for(var e,r,o,u,s,a,f,h,c,e,r=[],o=2<arguments.length&&void 0!==i&&i?[]:null,u=new Q(t),s=new Q(n),a=!1;;){if(u.done&&s.done)return o?K.createSet(r,o):J.create(r);if(0==u.ins)xh(r,u.len,0,a),u.next();else if(0!=s.len||s.done){if(u.done||s.done)throw new Error("Mismatched change set lengths");f=Math.min(u.len2,s.len),h=r.length,-1==u.ins?(xh(r,f,c=-1==s.ins?-1:s.off?0:s.ins,a),o&&c&&Sh(o,r,s.text)):-1==s.ins?(xh(r,u.off?0:u.len,f,a),o&&Sh(o,r,u.textBit(f))):(xh(r,u.off?0:u.len,s.off?0:s.ins,a),o&&!s.off&&Sh(o,r,s.text)),a=(u.ins>f||0<=s.ins&&s.len>f)&&(a||h<r.length),u.forward2(f),s.forward(f)}else xh(r,0,s.ins,a),o&&Sh(o,r,s.text),s.next()}}function Oh(t,n){var i,e,r,i=F(t.ranges);try{for(i.s();!(e=i.n()).done;)if((r=e.value).to>n)throw new RangeError("Selection points outside of document")}catch(t){i.e(t)}finally{i.f()}}function Eh(t,i){return t==i||t.length==i.length&&t.every(function(t,n){return t===i[n]})}function Ah(t,n,i){if(t.length==n.length){for(var e=0;e<t.length;e++)if(!i(t[e],n[e]))return;return 1}}function Dh(t,n){var i,e,r,o,i=!1,e=F(n);try{for(e.s();!(r=e.n()).done;)1&Lh(t,o=r.value)&&(i=!0)}catch(t){e.e(t)}finally{e.f()}return i}function Rh(n,s,o){var a,f,r,u;function h(t){for(var n,i,e,r,o,u,n=[],i=0;i<a.length;i++)if(e=Bh(t,a[i]),2==f[i]){r=F(e);try{for(r.s();!(o=r.n()).done;)u=o.value,n.push(u)}catch(t){r.e(t)}finally{r.f()}}else n.push(e);return s.combine(n)}return a=o.map(function(t){return n[t.id]}),f=o.map(function(t){return t.type}),r=a.filter(function(t){return!(1&t)}),u=n[s.id]>>1,{create:function t(n){var i,e,r,i=F(a);try{for(i.s();!(e=i.n()).done;)Lh(n,r=e.value)}catch(t){i.e(t)}finally{i.f()}return n.values[u]=h(n),1},update:function t(n,i){var e;return!Dh(n,r)||(e=h(n),s.compare(e,n.values[u]))?0:(n.values[u]=e,1)},reconfigure:function t(n,i){var e,r,i,e,e=Dh(n,a),r=i.config.facets[s.id],i=i.facet(s);return r&&!e&&Eh(o,r)||(e=h(n),s.compare(e,i))?(n.values[u]=i,0):(n.values[u]=e,1)}}}function Ih(n){return function(t){return new at(t,n)}}function Th(t,s,a){var f,h;function c(t,n){var i,e,r,o,u,i,e,i=h.get(t);if(null!=i){if(i<=n)return;-1<(e=f[i].indexOf(t))&&f[i].splice(e,1),t instanceof ht&&a.delete(t.compartment)}if(h.set(t,n),Array.isArray(t)){r=F(t);try{for(r.s();!(o=r.n()).done;)c(u=o.value,n)}catch(t){r.e(t)}finally{r.f()}}else if(t instanceof ht){if(a.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");i=s.get(t.compartment)||t.inner,a.set(t.compartment,i),c(i,n)}else if(t instanceof at)c(t.inner,t.prec);else if(t instanceof b)f[n].push(t),t.provides&&c(t.provides,n);else if(t instanceof Y)f[n].push(t),t.facet.extensions&&c(t.facet.extensions,rt);else{if(!(e=t.extension))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."));c(e,n)}}return f=[[],[],[],[],[]],h=new Map,c(t,rt),f.reduce(function(t,n){return t.concat(n)})}function Lh(t,n){var n,i,i;if(1&n)return 2;if(4==(i=t.status[n=n>>1]))throw new Error("Cyclic dependency between fields and/or facets");return 2&i?i:(t.status[n]=4,i=t.computeSlot(t,t.config.dynamicSlots[n]),t.status[n]=2|i)}function Bh(t,n){return(1&n?t.config.staticValues:t.values)[n>>1]}function _h(t,n){for(var i,e,r,o,u,i=[],e=0,r=0;;){if(u=o=void 0,e<t.length&&(r==n.length||n[r]>=t[e]))o=t[e++],u=t[e++];else{if(!(r<n.length))return i;o=n[r++],u=n[r++]}!i.length||i[i.length-1]<o?i.push(o,u):i[i.length-1]<u&&(i[i.length-1]=u)}}function Fh(t,n,i){var i,e,r,i,i=i?(e=n.changes,r=K.empty(n.changes.length),t.changes.compose(n.changes)):(e=n.changes.map(t.changes),r=t.changes.mapDesc(n.changes,!0),t.changes.compose(e));return{changes:i,selection:n.selection?n.selection.map(r):null==(i=t.selection)?void 0:i.map(e),effects:v.mapEffects(t.effects,e).concat(v.mapEffects(n.effects,r)),annotations:t.annotations.length?t.annotations.concat(n.annotations):n.annotations,scrollIntoView:t.scrollIntoView||n.scrollIntoView}}function Nh(t,n,i){var e=n.selection,r=Wh(n.annotations);return n.userEvent&&(r=r.concat(Mt.userEvent.of(n.userEvent))),{changes:n.changes instanceof K?n.changes:K.of(n.changes||[],i,t.facet(dt)),selection:e&&(e instanceof O?e:O.single(e.anchor,e.head)),effects:Wh(n.effects),annotations:r,scrollIntoView:!!n.scrollIntoView}}function Uh(t,n,i){var e,r,o,u,e=Nh(t,n.length?n[0]:{},t.doc.length);for(n.length&&!1===n[0].filter&&(i=!1),r=1;r<n.length;r++)!1===n[r].filter&&(i=!1),o=!!n[r].sequential,e=Fh(e,Nh(t,n[r],o?e.changes.newLength:t.doc.length),o);return u=Mt.create(t,e.changes,e.selection,e.effects,e.annotations,e.scrollIntoView),zh(i?Hh(u):u)}function Hh(t){var n,i,e,r,o,u,s,a,f,h,c,l,n=t.startState,i=!0,e=F(n.facet(yt));try{for(e.s();!(r=e.n()).done;){if(!1===(u=(o=r.value)(t))){i=!1;break}Array.isArray(u)&&(i=!0===i?u:_h(i,u))}}catch(t){e.e(t)}finally{e.f()}for(!0!==i&&(!1===i?(a=t.changes.invertedDesc,s=K.empty(n.doc.length)):(s=(f=t.changes.filter(i)).changes,a=f.filtered.mapDesc(f.changes).invertedDesc),t=Mt.create(n,s,t.selection&&t.selection.map(a),v.mapEffects(t.effects,a),t.annotations,t.scrollIntoView)),c=(h=n.facet(mt)).length-1;0<=c;c--)t=(l=h[c](t))instanceof Mt?l:Array.isArray(l)&&1==l.length&&l[0]instanceof Mt?l[0]:Uh(n,Wh(l),!1);return t}function zh(t){for(var n,i,e,r,o,n=t.startState,i=n.facet(pt),e=t,r=i.length-1;0<=r;r--)(o=i[r](t))&&Object.keys(o).length&&(e=Fh(e,Nh(n,o,t.changes.newLength),!0));return e==t?t:Mt.create(n,t.changes,t.selection,e.effects,e.annotations,e.scrollIntoView)}function Wh(t){return null==t?xt:Array.isArray(t)?t:[t]}q=8205,G=/\r\n?|\n/,h=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(h=h||{}),K=function(t){f(y,t);var i=S(y);function y(t,n){var t;return A(this,y),(t=i.call(this,t)).inserted=n,t}return D(y,[{key:"apply",value:function t(o){if(this.length!=o.length)throw new RangeError("Applying change set to a document with the wrong length");return Ch(this,function(t,n,i,e,r){o=o.replace(i,i+(n-t),r)},!1),o}},{key:"mapDesc",value:function t(n){var i;return jh(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"invert",value:function t(n){for(var i,e,r,o,u,s,a,i=this.sections.slice(),e=[],r=0,o=0;r<i.length;r+=2){if(u=i[r],0<=(s=i[r+1])){for(i[r]=s,i[r+1]=u,a=r>>1;e.length<a;)e.push(k.empty);e.push(u?n.slice(o,o+u):k.empty)}o+=u}return new y(i,e)}},{key:"compose",value:function t(n){return this.empty?n:n.empty?this:Ph(this,n,!0)}},{key:"map",value:function t(n){var i;return n.empty?this:jh(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"iterChanges",value:function t(n){var i;Ch(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1])}},{key:"desc",get:function t(){return J.create(this.sections)}},{key:"filter",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,i=[],e=[],r=[],o=new Q(this);t:for(u=0,s=0;;){for(a=u==n.length?1e9:n[u++];s<a||s==a&&0==o.len;){if(o.done)break t;xh(r,f=Math.min(o.len,a-s),-1),xh(i,f,h=-1==o.ins?-1:0==o.off?o.ins:0),0<h&&Sh(e,i,o.text),o.forward(f),s+=f}for(c=n[u++];s<c;){if(o.done)break t;xh(i,l=Math.min(o.len,c-s),-1),xh(r,l,-1==o.ins?-1:0==o.off?o.ins:0),o.forward(l),s+=l}}return{changes:new y(i,e),filtered:J.create(r)}}},{key:"toJSON",value:function t(){for(var n,i,e,r,n=[],i=0;i<this.sections.length;i+=2)e=this.sections[i],r=this.sections[i+1],n.push(r<0?e:0==r?[e]:[e].concat(this.inserted[i>>1].toJSON()));return n}}],[{key:"of",value:function t(n,s,a){var f,h,c,l;function v(t){var n,t,n;(0<arguments.length&&void 0!==t&&t||f.length)&&(c<s&&xh(f,s-c,-1),t=new y(f,h),l=l?l.compose(t.map(l)):t,f=[],h=[],c=0)}function d(t){var n,i,e,r,o,o,t,t,u;if(Array.isArray(t)){n=F(t);try{for(n.s();!(i=n.n()).done;)d(e=i.value)}catch(t){n.e(t)}finally{n.f()}}else if(t instanceof y){if(t.length!=s)throw new RangeError("Mismatched change set length (got ".concat(t.length,", expected ").concat(s,")"));v(),l=l?l.compose(t.map(l)):t}else{if(r=t.from,o=t.to,t=t.insert,(o=void 0===o?r:o)<r||r<0||s<o)throw new RangeError("Invalid change range ".concat(r," to ").concat(o," (in doc of length ").concat(s,")"));u=(t=t?"string"==typeof t?k.of(t.split(a||G)):t:k.empty).length,r==o&&0==u||(r<c&&v(),c<r&&xh(f,r-c,-1),xh(f,o-r,u),Sh(h,f,t),c=o)}}return f=[],h=[],c=0,l=null,d(n),v(!l),l}},{key:"empty",value:function t(n){return new y(n?[n,-1]:[],[])}},{key:"fromJSON",value:function t(n){var i,e,r,o;if(!Array.isArray(n))throw new RangeError("Invalid JSON representation of ChangeSet");for(i=[],e=[],r=0;r<n.length;r++)if("number"==typeof(o=n[r]))i.push(o,-1);else{if(!Array.isArray(o)||"number"!=typeof o[0]||o.some(function(t,n){return n&&"string"!=typeof t}))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==o.length)i.push(o[0],0);else{for(;e.length<r;)e.push(k.empty);e[r]=k.of(o.slice(1)),i.push(o[0],e[r].length)}}return new y(i,e)}},{key:"createSet",value:function t(n,i){return new y(n,i)}}]),y}(J=function(){function o(t){A(this,o),this.sections=t}return D(o,[{key:"length",get:function t(){for(var n,i,n=0,i=0;i<this.sections.length;i+=2)n+=this.sections[i];return n}},{key:"newLength",get:function t(){for(var n,i,e,n=0,i=0;i<this.sections.length;i+=2)n+=(e=this.sections[i+1])<0?this.sections[i]:e;return n}},{key:"empty",get:function t(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}},{key:"iterGaps",value:function t(n){for(var i,e,r,o,u,i=0,e=0,r=0;i<this.sections.length;)o=this.sections[i++],(u=this.sections[i++])<0?(n(e,r,o),r+=o):r+=u,e+=o}},{key:"iterChangedRanges",value:function t(n){var i;Ch(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1])}},{key:"invertedDesc",get:function t(){for(var n,i,e,r,n=[],i=0;i<this.sections.length;)e=this.sections[i++],(r=this.sections[i++])<0?n.push(e,r):n.push(r,e);return new o(n)}},{key:"composeDesc",value:function t(n){return this.empty?n:n.empty?this:Ph(this,n)}},{key:"mapDesc",value:function t(n){var i;return n.empty?this:jh(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1])}},{key:"mapPos",value:function t(n){for(var i,e,r,o,u,s,a,f,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:h.Simple,r=0,o=0,u=0;u<this.sections.length;){if(f=r+(s=this.sections[u++]),(a=this.sections[u++])<0){if(n<f)return o+(n-r);o+=s}else{if(e!=h.Simple&&n<=f&&(e==h.TrackDel&&r<n&&n<f||e==h.TrackBefore&&r<n||e==h.TrackAfter&&n<f))return null;if(n<f||f==n&&i<0&&!s)return n==r||i<0?o:o+a;o+=a}r=f}if(r<n)throw new RangeError("Position ".concat(n," is out of range for changeset of length ").concat(r));return o}},{key:"touchesRange",value:function t(n){for(var i,e,r,o,u,s,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n,e=0,r=0;e<this.sections.length&&r<=i;){if(s=r+(o=this.sections[e++]),0<=(u=this.sections[e++])&&r<=i&&n<=s)return!(r<n&&i<s)||"cover";r=s}return!1}},{key:"toString",value:function t(){for(var n,i,e,r,n="",i=0;i<this.sections.length;)n+=(n?" ":"")+(e=this.sections[i++])+(0<=(r=this.sections[i++])?":"+r:"");return n}},{key:"toJSON",value:function t(){return this.sections}}],[{key:"fromJSON",value:function t(n){if(!Array.isArray(n)||n.length%2||n.some(function(t){return"number"!=typeof t}))throw new RangeError("Invalid JSON representation of ChangeDesc");return new o(n)}},{key:"create",value:function t(n){return new o(n)}}]),o}()),Q=function(){function n(t){A(this,n),this.set=t,this.i=0,this.next()}return D(n,[{key:"next",value:function t(){var n=this.set.sections;this.i<n.length?(this.len=n[this.i++],this.ins=n[this.i++]):(this.len=0,this.ins=-2),this.off=0}},{key:"done",get:function t(){return-2==this.ins}},{key:"len2",get:function t(){return this.ins<0?this.len:this.ins}},{key:"text",get:function t(){var n=this.set.inserted,i=this.i-2>>1;return i>=n.length?k.empty:n[i]}},{key:"textBit",value:function t(n){var i=this.set.inserted,e=this.i-2>>1;return e>=i.length&&!n?k.empty:i[e].slice(this.off,null==n?void 0:this.off+n)}},{key:"forward",value:function t(n){n==this.len?this.next():(this.len-=n,this.off+=n)}},{key:"forward2",value:function t(n){-1==this.ins?this.forward(n):n==this.ins?this.next():(this.ins-=n,this.off+=n)}}]),n}(),X=function(){function o(t,n,i){A(this,o),this.from=t,this.to=n,this.flags=i}return D(o,[{key:"anchor",get:function t(){return 16&this.flags?this.to:this.from}},{key:"head",get:function t(){return 16&this.flags?this.from:this.to}},{key:"empty",get:function t(){return this.from==this.to}},{key:"assoc",get:function t(){return 4&this.flags?-1:8&this.flags?1:0}},{key:"bidiLevel",get:function t(){var n=3&this.flags;return 3==n?null:n}},{key:"goalColumn",get:function t(){var n=this.flags>>5;return 33554431==n?void 0:n}},{key:"map",value:function t(n){var i,e,r,i;return this.empty?e=r=n.mapPos(this.from,1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1):(e=n.mapPos(this.from,1),r=n.mapPos(this.to,-1)),e==this.from&&r==this.to?this:new o(e,r,this.flags)}},{key:"extend",value:function t(n){var i,n,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;return n<=this.anchor&&i>=this.anchor?O.range(n,i):(n=Math.abs(n-this.anchor)>Math.abs(i-this.anchor)?n:i,O.range(this.anchor,n))}},{key:"eq",value:function t(n){return this.anchor==n.anchor&&this.head==n.head}},{key:"toJSON",value:function t(){return{anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function t(n){if(n&&"number"==typeof n.anchor&&"number"==typeof n.head)return O.range(n.anchor,n.head);throw new RangeError("Invalid JSON representation for SelectionRange")}},{key:"create",value:function t(n,i,e){return new o(n,i,e)}}]),o}(),O=function(){function a(t,n){A(this,a),this.ranges=t,this.mainIndex=n}return D(a,[{key:"map",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1;return n.empty?this:a.create(this.ranges.map(function(t){return t.map(n,i)}),this.mainIndex)}},{key:"eq",value:function t(n){if(this.ranges.length!=n.ranges.length||this.mainIndex!=n.mainIndex)return!1;for(var i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(n.ranges[i]))return!1;return!0}},{key:"main",get:function t(){return this.ranges[this.mainIndex]}},{key:"asSingle",value:function t(){return 1==this.ranges.length?this:new a([this.main],0)}},{key:"addRange",value:function t(n){var i=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];return a.create([n].concat(this.ranges),i?0:this.mainIndex+1)}},{key:"replaceRange",value:function t(n){var i,e,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.mainIndex,e=this.ranges.slice();return e[i]=n,a.create(e,this.mainIndex)}},{key:"toJSON",value:function t(){return{ranges:this.ranges.map(function(t){return t.toJSON()}),main:this.mainIndex}}}],[{key:"fromJSON",value:function t(n){if(!n||!Array.isArray(n.ranges)||"number"!=typeof n.main||n.main>=n.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new a(n.ranges.map(function(t){return X.fromJSON(t)}),n.main)}},{key:"single",value:function t(n){var i;return new a([a.range(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:n)],0)}},{key:"create",value:function t(n){var i,e,r,o,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;if(0==n.length)throw new RangeError("A selection needs at least one range");for(r=e=0;r<n.length;r++){if((o=n[r]).empty?o.from<=e:o.from<e)return a.normalized(n.slice(),i);e=o.to}return new a(n,i)}},{key:"cursor",value:function t(n){var i,e,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length?arguments[2]:void 0,r=3<arguments.length?arguments[3]:void 0;return X.create(n,n,(0==i?0:i<0?4:8)|(null==e?3:Math.min(2,e))|(null!=r?r:33554431)<<5)}},{key:"range",value:function t(n,i,e,r){var e=(null!=e?e:33554431)<<5|(null==r?3:Math.min(2,r));return i<n?X.create(i,n,24|e):X.create(n,i,(n<i?4:0)|e)}},{key:"normalized",value:function t(n){var i,e,r,o,u,s,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=n[i];for(n.sort(function(t,n){return t.from-n.from}),i=n.indexOf(e),r=1;r<n.length;r++)o=n[r],u=n[r-1],(o.empty?o.from<=u.to:o.from<u.to)&&(s=u.from,u=Math.max(o.to,u.to),r<=i&&i--,n.splice(--r,2,o.anchor>o.head?a.range(u,s):a.range(s,u)));return new a(n,i)}}]),a}(),Z=0,y=function(){function o(t,n,i,e,r){A(this,o),this.combine=t,this.compareInput=n,this.compare=i,this.isStatic=e,this.id=Z++,this.default=t([]),this.extensions="function"==typeof r?r(this):r}return D(o,[{key:"of",value:function t(n){return new Y([],this,0,n)}},{key:"compute",value:function t(n,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Y(n,this,1,i)}},{key:"computeN",value:function t(n,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Y(n,this,2,i)}},{key:"from",value:function t(n,i){return i=i||function t(n){return n},this.compute([n],function(t){return i(t.field(n))})}}],[{key:"define",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return new o(n.combine||function(t){return t},n.compareInput||function(t,n){return t===n},n.compare||(n.combine?function(t,n){return t===n}:Eh),!!n.static,n.enables)}}]),o}(),Y=function(){function r(t,n,i,e){A(this,r),this.dependencies=t,this.facet=n,this.type=i,this.value=e,this.id=Z++}return D(r,[{key:"dynamicSlot",value:function t(n){var o,i,u,s,a,f,h,e,r,c,l,v,d,o=this,u=this.value,s=this.facet.compareInput,a=this.id,f=n[a]>>1,h=2==this.type,e=!1,r=!1,c=[],l=F(this.dependencies);try{for(l.s();!(v=l.n()).done;)"doc"==(d=v.value)?e=!0:"selection"==d?r=!0:0==(1&(null!=(i=n[d.id])?i:1))&&c.push(n[d.id])}catch(t){l.e(t)}finally{l.f()}return{create:function t(n){return n.values[f]=u(n),1},update:function t(n,i){if(e&&i.docChanged||r&&(i.docChanged||i.selection)||Dh(n,c)){var i=u(n);if(h?!Ah(i,n.values[f],s):!s(i,n.values[f]))return n.values[f]=i,1}return 0},reconfigure:function t(n,i){var e,r,r,r=i.config.address[a];if(null!=r){if(r=Bh(i,r),o.dependencies.every(function(t){return t instanceof y?i.facet(t)===n.facet(t):!(t instanceof b)||i.field(t,!1)==n.field(t,!1)})||(h?Ah(e=u(n),r,s):s(e=u(n),r)))return n.values[f]=r,0}else e=u(n);return n.values[f]=e,1}}}}]),r}(),tt=y.define({static:!0}),b=function(){function o(t,n,i,e,r){A(this,o),this.id=t,this.createF=n,this.updateF=i,this.compareF=e,this.spec=r,this.provides=void 0}return D(o,[{key:"create",value:function t(n){var i,e,i=this,e=n.facet(tt).find(function(t){return t.field==i});return((null==e?void 0:e.create)||this.createF)(n)}},{key:"slot",value:function t(n){var r,o,r=this,o=n[this.id]>>1;return{create:function t(n){return n.values[o]=r.create(n),1},update:function t(n,i){var e,i,e=n.values[o],i=r.updateF(e,i);return r.compareF(e,i)?0:(n.values[o]=i,1)},reconfigure:function t(n,i){return null!=i.config.address[r.id]?(n.values[o]=i.field(r),0):(n.values[o]=r.create(n),1)}}}},{key:"init",value:function t(n){return[this,tt.of({field:this,create:n})]}},{key:"extension",get:function t(){return this}}],[{key:"define",value:function t(n){var i=new o(Z++,n.create,n.update,n.compare||function(t,n){return t===n},n);return n.provide&&(i.provides=n.provide(i)),i}}]),o}(),st={highest:Ih(ut=0),high:Ih(ot=1),default:Ih(rt=2),low:Ih(et=3),lowest:Ih(it=4)},at=D(function t(n,i){A(this,t),this.inner=n,this.prec=i}),ft=function(){function i(){A(this,i)}return D(i,[{key:"of",value:function t(n){return new ht(this,n)}},{key:"reconfigure",value:function t(n){return i.reconfigure.of({compartment:this,extension:n})}},{key:"get",value:function t(n){return n.config.compartments.get(this)}}]),i}(),ht=D(function t(n,i){A(this,t),this.compartment=n,this.inner=i}),ct=function(){function w(t,n,i,e,r,o){for(A(this,w),this.base=t,this.compartments=n,this.dynamicSlots=i,this.address=e,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}return D(w,[{key:"staticFacet",value:function t(n){var i=this.address[n.id];return null==i?n.default:this.staticValues[i>>1]}}],[{key:"resolve",value:function t(n,i,s){var e,a,r,o,u,f,h,c,l,v,d,y,m,p,k,g,e=[],a=Object.create(null),r=new Map,o=F(Th(n,i,r));try{for(o.s();!(u=o.n()).done;)((f=u.value)instanceof b?e:a[f.facet.id]||(a[f.facet.id]=[])).push(f)}catch(t){o.e(t)}finally{o.f()}for(h=Object.create(null),c=[],l=[],v=function t(){var n=y[d];h[n.id]=l.length<<1,l.push(function(t){return n.slot(t)})},d=0,y=e;d<y.length;d++)v();for(k in m=null==s?void 0:s.config.facets,p=function t(){var n,i,e,e,r,o,u,n=a[k],i=n[0].facet,e=m&&m[k]||[];if(n.every(function(t){return 0==t.type}))h[i.id]=c.length<<1|1,Eh(e,n)?c.push(s.facet(i)):(e=i.combine(n.map(function(t){return t.value})),c.push(s&&i.compare(e,s.facet(i))?s.facet(i):e));else{r=F(n);try{for(u=function t(){var n=o.value;0==n.type?(h[n.id]=c.length<<1|1,c.push(n.value)):(h[n.id]=l.length<<1,l.push(function(t){return n.dynamicSlot(t)}))},r.s();!(o=r.n()).done;)u()}catch(t){r.e(t)}finally{r.f()}h[i.id]=l.length<<1,l.push(function(t){return Rh(t,i,n)})}},a)p();return new w(n,r,g=l.map(function(t){return t(h)}),h,c,a)}}]),w}(),lt=y.define(),vt=y.define({combine:function t(n){return n.some(function(t){return t})},static:!0}),dt=y.define({combine:function t(n){return n.length?n[0]:void 0},static:!0}),yt=y.define(),mt=y.define(),pt=y.define(),kt=y.define({combine:function t(n){return!!n.length&&n[0]}}),gt=function(){function i(t,n){A(this,i),this.type=t,this.value=n}return D(i,null,[{key:"define",value:function t(){return new wt}}]),i}(),wt=function(){function t(){A(this,t)}return D(t,[{key:"of",value:function t(n){return new gt(this,n)}}]),t}(),bt=function(){function n(t){A(this,n),this.map=t}return D(n,[{key:"of",value:function t(n){return new v(this,n)}}]),n}(),(v=function(){function i(t,n){A(this,i),this.type=t,this.value=n}return D(i,[{key:"map",value:function t(n){var n=this.type.map(this.value,n);return void 0===n?void 0:n==this.value?this:new i(this.type,n)}},{key:"is",value:function t(n){return this.type==n}}],[{key:"define",value:function t(){var n;return new bt((0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).map||function(t){return t})}},{key:"mapEffects",value:function t(n,i){var e,r,o,u,s;if(!n.length)return n;e=[],r=F(n);try{for(r.s();!(o=r.n()).done;)(s=(u=o.value).map(i))&&e.push(s)}catch(t){r.e(t)}finally{r.f()}return e}}]),i}()).reconfigure=v.define(),v.appendConfig=v.define(),(Mt=function(){function s(t,n,i,e,r,o){A(this,s),this.startState=t,this.changes=n,this.selection=i,this.effects=e,this.annotations=r,this.scrollIntoView=o,this.Qae=null,this.Kh=null,i&&Oh(i,n.newLength),r.some(function(t){return t.type==s.time})||(this.annotations=r.concat(s.time.of(Date.now())))}return D(s,[{key:"newDoc",get:function t(){return this.Qae||(this.Qae=this.changes.apply(this.startState.doc))}},{key:"newSelection",get:function t(){return this.selection||this.startState.selection.map(this.changes)}},{key:"state",get:function t(){return this.Kh||this.startState.applyTransaction(this),this.Kh}},{key:"annotation",value:function t(n){var i,e,r,i=F(this.annotations);try{for(i.s();!(e=i.n()).done;)if((r=e.value).type==n)return r.value}catch(t){i.e(t)}finally{i.f()}}},{key:"docChanged",get:function t(){return!this.changes.empty}},{key:"reconfigured",get:function t(){return this.startState.config!=this.state.config}},{key:"isUserEvent",value:function t(n){var i=this.annotation(s.userEvent);return!(!i||!(i==n||i.length>n.length&&i.slice(0,n.length)==n&&"."==i[n.length]))}}],[{key:"create",value:function t(n,i,e,r,o,u){return new s(n,i,e,r,o,u)}}]),s}()).time=gt.define(),Mt.userEvent=gt.define(),Mt.addToHistory=gt.define(),Mt.remote=gt.define(),xt=[],l=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(l=l||{}),St=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{Ct=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}function Vh(t){var n,i;if(Ct)return Ct.test(t);for(n=0;n<t.length;n++)if(i=t[n],/\w/.test(i)||"\x80"<i&&(i.toUpperCase()!=i.toLowerCase()||St.test(i)))return 1}function $h(i){return function(t){if(!/\S/.test(t))return l.Space;if(Vh(t))return l.Word;for(var n=0;n<i.length;n++)if(-1<t.indexOf(i[n]))return l.Word;return l.Other}}function qh(t,n){var i,e,r,o,u,s,a,f,h,c,l,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},e={},r=F(t);try{for(r.s();!(o=r.n()).done;)for(u=o.value,s=0,a=Object.keys(u);s<a.length;s++)if(h=u[f=a[s]],void 0===(c=e[f]))e[f]=h;else if(c!==h&&void 0!==h){if(!Object.hasOwnProperty.call(i,f))throw new Error("Config merge conflict for field "+f);e[f]=i[f](c,h)}}catch(t){r.e(t)}finally{r.f()}for(l in n)void 0===e[l]&&(e[l]=n[l]);return e}function Gh(t,n){return t.from-n.from||t.value.startSide-n.value.startSide}function Jh(t){var n,i,e;if(1<t.length)for(n=t[0],i=1;i<t.length;i++){if(0<Gh(n,e=t[i]))return t.slice().sort(Gh);n=e}return t}function Kh(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,e=new Map,r=F(t);try{for(r.s();!(o=r.n()).done;)for(u=o.value,s=0;s<u.chunk.length;s++)u.chunk[s].maxPoint<=0&&e.set(u.chunk[s],u.chunkPos[s])}catch(t){r.e(t)}finally{r.f()}a=new Set,f=F(n);try{for(f.s();!(h=f.n()).done;)for(c=h.value,l=0;l<c.chunk.length;l++)null==(v=e.get(c.chunk[l]))||(i?i.mapPos(v):v)!=c.chunkPos[l]||null!=i&&i.touchesRange(v,v+c.chunk[l].length)||a.add(c.chunk[l])}catch(t){f.e(t)}finally{f.f()}return a}function Qh(t,n){for(var i,e,r,i=t[n];!((e=1+(n<<1))>=t.length||(r=t[e],e+1<t.length&&0<=r.compare(t[e+1])&&(r=t[e+1],e++),i.compare(r)<0));)t[e]=i,t[n]=r,n=e}function Xh(t,n,i,e,r,o){var u,s,a,f,h,c;for(t.goto(n),i.goto(e),u=e+r,a=(s=e)-n;h=(f=t.to+a-i.to||t.endSide-i.endSide)<0?t.to+a:i.to,c=Math.min(h,u),t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&Zh(t.activeForPoint(t.to),i.activeForPoint(i.to))||o.comparePoint(s,c,t.point,i.point):s<c&&!Zh(t.active,i.active)&&o.compareRange(s,c,t.active,i.active),!(u<h);)s=h,f<=0&&t.next(),0<=f&&i.next()}function Zh(t,n){if(t.length==n.length){for(var i=0;i<t.length;i++)if(t[i]!=n[i]&&!t[i].eq(n[i]))return;return 1}}function Yh(t,n){for(var i=n,e=t.length-1;i<e;i++)t[i]=t[i+1];t.pop()}function tc(t,n,i){for(var e=t.length-1;n<=e;e--)t[e+1]=t[e];t[n]=i}function nc(t,n){for(var i,e,r,i=-1,e=1e9,r=0;r<n.length;r++)(n[r]-e||t[r].endSide-t[i].endSide)<0&&(e=n[i=r]);return i}function ic(t,n){for(var i,e,r,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:t.length,e=0,r=0;r<i;)9==t.charCodeAt(r)?(e+=n-e%n,r++):(e++,r=yh(t,r));return e}function ec(t,n,i,e){for(var r=0,o=0;;){if(n<=o)return r;if(r==t.length)break;o+=9==t.charCodeAt(r)?i-o%i:1,r=yh(t,r)}return!0===e?-1:t.length}for((C=function(){function c(t,n,i,e,r,o){A(this,c),this.config=t,this.doc=n,this.selection=i,this.values=e,this.status=t.statusTemplate.slice(),this.computeSlot=r,o&&(o.Kh=this);for(var u=0;u<this.config.dynamicSlots.length;u++)Lh(this,u<<1);this.computeSlot=null}return D(c,[{key:"field",value:function t(n){var i,n,i=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=this.config.address[n.id];if(null!=n)return Lh(this,n),Bh(this,n);if(i)throw new RangeError("Field is not present in this state")}},{key:"update",value:function t(){for(var n=arguments.length,i=new Array(n),e=0;e<n;e++)i[e]=arguments[e];return Uh(this,i,!0)}},{key:"applyTransaction",value:function t(i){var e,n,r,o,u,s,a,f,r,h,e=this,n=this.config,r=n,o=r.base,u=r.compartments,s=F(i.effects);try{for(s.s();!(a=s.n()).done;)(f=a.value).is(ft.reconfigure)?(n&&(u=new Map,n.compartments.forEach(function(t,n){return u.set(n,t)}),n=null),u.set(f.value.compartment,f.value.extension)):f.is(v.reconfigure)?(n=null,o=f.value):f.is(v.appendConfig)&&(n=null,o=Wh(o).concat(f.value))}catch(t){s.e(t)}finally{s.f()}r=n?i.startState.values.slice():(h=new c(n=ct.resolve(o,u,this),this.doc,this.selection,n.dynamicSlots.map(function(){return null}),function(t,n){return n.reconfigure(t,e)},null)).values,new c(n,i.newDoc,i.newSelection,r,function(t,n){return n.update(t,i)},i)}},{key:"replaceSelection",value:function t(n){return"string"==typeof n&&(n=this.toText(n)),this.changeByRange(function(t){return{changes:{from:t.from,to:t.to,insert:n},range:O.cursor(t.from+n.length)}})}},{key:"changeByRange",value:function t(n){for(var i,e,r,o,u,s,a,f,h,c,f,i=this.selection,e=n(i.ranges[0]),r=this.changes(e.changes),o=[e.range],u=Wh(e.effects),s=1;s<i.ranges.length;s++){for(a=n(i.ranges[s]),h=(f=this.changes(a.changes)).map(r),c=0;c<s;c++)o[c]=o[c].map(h);f=r.mapDesc(f,!0),o.push(a.range.map(f)),r=r.compose(h),u=v.mapEffects(u,h).concat(v.mapEffects(Wh(a.effects),f))}return{changes:r,selection:O.create(o,i.mainIndex),effects:u}}},{key:"changes",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return n instanceof K?n:K.of(n,this.doc.length,this.facet(c.lineSeparator))}},{key:"toText",value:function t(n){return k.of(n.split(this.facet(c.lineSeparator)||G))}},{key:"sliceDoc",value:function t(){var n,i,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.doc.length;return this.doc.sliceString(n,i,this.lineBreak)}},{key:"facet",value:function t(n){var i=this.config.address[n.id];return null==i?n.default:(Lh(this,i),Bh(this,i))}},{key:"toJSON",value:function t(n){var i,e,r,i={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(n)for(e in n)(r=n[e])instanceof b&&null!=this.config.address[r.id]&&(i[e]=r.spec.toJSON(this.field(n[e]),this));return i}},{key:"tabSize",get:function t(){return this.facet(c.tabSize)}},{key:"lineBreak",get:function t(){return this.facet(c.lineSeparator)||"\n"}},{key:"readOnly",get:function t(){return this.facet(kt)}},{key:"phrase",value:function t(n){for(var i,e,r,o,u,s,i=arguments.length,e=new Array(1<i?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];o=F(this.facet(c.phrases));try{for(o.s();!(u=o.n()).done;)if(s=u.value,Object.prototype.hasOwnProperty.call(s,n)){n=s[n];break}}catch(t){o.e(t)}finally{o.f()}return n=e.length?n.replace(/\$(\$|\d*)/g,function(t,n){var n;return"$"==n?"$":!(n=+(n||1))||n>e.length?t:e[n-1]}):n}},{key:"languageDataAt",value:function t(n,i){var e,r,o,u,s,a,f,h,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=F(this.facet(lt));try{for(o.s();!(u=o.n()).done;){a=F((s=u.value)(this,i,e));try{for(a.s();!(f=a.n()).done;)h=f.value,Object.prototype.hasOwnProperty.call(h,n)&&r.push(h[n])}catch(t){a.e(t)}finally{a.f()}}}catch(t){o.e(t)}finally{o.f()}return r}},{key:"charCategorizer",value:function t(n){return $h(this.languageDataAt("wordChars",n).join(""))}},{key:"wordAt",value:function t(n){for(var i,e,r,o,u,s,a,f,h,i=this.doc.lineAt(n),e=i.text,r=i.from,o=i.length,u=this.charCategorizer(n),s=n-r,a=n-r;0<s&&(f=yh(e,s,!1),u(e.slice(f,s))==l.Word);)s=f;for(;a<o&&(h=yh(e,a),u(e.slice(a,h))==l.Word);)a=h;return s==a?null:O.range(s+r,a+r)}}],[{key:"fromJSON",value:function t(e){var n,r,o,i,u,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length?arguments[2]:void 0;if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");if(o=[],r)for(u in i=function t(){var n,i;Object.prototype.hasOwnProperty.call(e,u)&&(n=r[u],i=e[u],o.push(n.init(function(t){return n.spec.fromJSON(i,t)})))},r)i();return c.create({doc:e.doc,selection:O.fromJSON(e.selection),extensions:n.extensions?o.concat([n.extensions]):o})}},{key:"create",value:function t(){var n,i,e,n,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=ct.resolve(n.extensions||[],new Map),e=n.doc instanceof k?n.doc:k.of((n.doc||"").split(i.staticFacet(c.lineSeparator)||G)),n=n.selection?n.selection instanceof O?n.selection:O.single(n.selection.anchor,n.selection.head):O.single(0);return Oh(n,e.length),i.staticFacet(vt)||(n=n.asSingle()),new c(i,e,n,i.dynamicSlots.map(function(){return null}),function(t,n){return n.create(t)},null)}}]),c}()).allowMultipleSelections=vt,C.tabSize=y.define({combine:function t(n){return n.length?n[0]:4}}),C.lineSeparator=dt,C.readOnly=kt,C.phrases=y.define({compare:function t(n,i){var e=Object.keys(n),r=Object.keys(i);return e.length==r.length&&e.every(function(t){return n[t]==i[t]})}}),C.languageData=lt,C.changeFilter=yt,C.transactionFilter=mt,C.transactionExtender=pt,ft.reconfigure=v.define(),(jt=function(){function t(){A(this,t)}return D(t,[{key:"eq",value:function t(n){return this==n}},{key:"range",value:function t(n){var i;return Pt.create(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:n,this)}}]),t}()).prototype.startSide=jt.prototype.endSide=0,jt.prototype.point=!1,jt.prototype.mapMode=h.TrackDel,Pt=function(){function r(t,n,i){A(this,r),this.from=t,this.to=n,this.value=i}return D(r,null,[{key:"create",value:function t(n,i,e){return new r(n,i,e)}}]),r}(),Ot=function(){function y(t,n,i,e){A(this,y),this.from=t,this.to=n,this.value=i,this.maxPoint=e}return D(y,[{key:"length",get:function t(){return this.to[this.to.length-1]}},{key:"findIndex",value:function t(n,i,e){for(var r,o,u,s,a,f,r,o=e?this.to:this.from,u=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,s=o.length;;){if(u==s)return u;if(f=o[a=u+s>>1]-n||(e?this.value[a].endSide:this.value[a].startSide)-i,a==u)return 0<=f?u:s;0<=f?s=a:u=1+a}}},{key:"between",value:function t(n,i,e,r){for(var o=this.findIndex(i,-1e9,!0),u=this.findIndex(e,1e9,!1,o);o<u;o++)if(!1===r(this.from[o]+n,this.to[o]+n,this.value[o]))return!1}},{key:"map",value:function t(n,i){for(var e,r,o,u,s,a,f,h,c,l,v,d,e=[],r=[],o=[],u=-1,s=-1,a=0;a<this.value.length;a++){if(f=this.value[a],v=l=void 0,(h=this.from[a]+n)==(c=this.to[a]+n)){if(null==(d=i.mapPos(h,f.startSide,f.mapMode)))continue;if(l=v=d,f.startSide!=f.endSide&&(v=i.mapPos(h,f.endSide))<l)continue}else if(l=i.mapPos(h,f.startSide),(v=i.mapPos(c,f.endSide))<l||l==v&&0<f.startSide&&f.endSide<=0)continue;(v-l||f.endSide-f.startSide)<0||(u<0&&(u=l),f.point&&(s=Math.max(s,v-l)),e.push(f),r.push(l-u),o.push(v-u))}return{mapped:e.length?new y(r,o,e,s):null,pos:u}}}]),y}(),(j=function(){function d(t,n,i,e){A(this,d),this.chunkPos=t,this.chunk=n,this.nextLayer=i,this.maxPoint=e}return D(d,[{key:"length",get:function t(){var n=this.chunk.length-1;return n<0?0:Math.max(this.chunkEnd(n),this.nextLayer.length)}},{key:"size",get:function t(){var n,i,e,r;if(this.isEmpty)return 0;n=this.nextLayer.size,i=F(this.chunk);try{for(i.s();!(e=i.n()).done;)n+=(r=e.value).value.length}catch(t){i.e(t)}finally{i.f()}return n}},{key:"chunkEnd",value:function t(n){return this.chunkPos[n]+this.chunk[n].length}},{key:"update",value:function t(n){var i,e,i,r,o,u,o,s,a,f,h,c,l,v,i=n.add,e=void 0===i?[]:i,i=n.sort,r,o=n.filterFrom,u=void 0===o?0:o,o=n.filterTo,s=void 0===o?this.length:o,a=n.filter;if(0==e.length&&!a)return this;if(void 0!==i&&i&&(e=e.slice().sort(Gh)),this.isEmpty)return e.length?d.of(e):this;for(f=new At(this,null,-1).goto(0),h=0,c=[],l=new Et;f.value||h<e.length;)h<e.length&&0<=(f.from-e[h].from||f.startSide-e[h].value.startSide)?(v=e[h++],l.addInner(v.from,v.to,v.value)||c.push(v)):1==f.rangeIndex&&f.chunkIndex<this.chunk.length&&(h==e.length||this.chunkEnd(f.chunkIndex)<e[h].from)&&(!a||u>this.chunkEnd(f.chunkIndex)||s<this.chunkPos[f.chunkIndex])&&l.addChunk(this.chunkPos[f.chunkIndex],this.chunk[f.chunkIndex])?f.nextChunk():((!a||u>f.to||s<f.from||a(f.from,f.to,f.value))&&!l.addInner(f.from,f.to,f.value)&&c.push(Pt.create(f.from,f.to,f.value)),f.next());return l.finishInner(this.nextLayer.isEmpty&&!c.length?d.empty:this.nextLayer.update({add:c,filter:a,filterFrom:u,filterTo:s}))}},{key:"map",value:function t(n){var i,e,r,o,u,s,a,a,s,u,f;if(n.empty||this.isEmpty)return this;for(i=[],e=[],r=-1,o=0;o<this.chunk.length;o++)u=this.chunkPos[o],s=this.chunk[o],!1===(a=n.touchesRange(u,u+s.length))?(r=Math.max(r,s.maxPoint),i.push(s),e.push(n.mapPos(u))):!0===a&&(s=(a=s.map(u,n)).mapped,u=a.pos,s)&&(r=Math.max(r,s.maxPoint),i.push(s),e.push(u));return f=this.nextLayer.map(n),0==i.length?f:new d(e,i,f||d.empty,r)}},{key:"between",value:function t(n,i,e){var r,o,u;if(!this.isEmpty){for(r=0;r<this.chunk.length;r++)if(o=this.chunkPos[r],u=this.chunk[r],o<=i&&n<=o+u.length&&!1===u.between(o,n-o,i-o,e))return;this.nextLayer.between(n,i,e)}}},{key:"iter",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return Dt.from([this]).goto(n)}},{key:"isEmpty",get:function t(){return this.nextLayer==this}}],[{key:"create",value:function t(n,i,e,r){return new d(n,i,e,r)}},{key:"iter",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return Dt.from(n).goto(i)}},{key:"compare",value:function t(n,i,e,r){var o,n,i,u,s,a,o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:-1,n=n.filter(function(t){return 0<t.maxPoint||!t.isEmpty&&t.maxPoint>=o}),i=i.filter(function(t){return 0<t.maxPoint||!t.isEmpty&&t.maxPoint>=o}),u=Kh(n,i,e),s=new Rt(n,u,o),a=new Rt(i,u,o);e.iterGaps(function(t,n,i){return Xh(s,t,a,n,i,r)}),e.empty&&0==e.length&&Xh(s,0,a,0,0,r)}},{key:"eq",value:function t(n,i){var e,r,o,u,s,a,f,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=3<arguments.length?arguments[3]:void 0;if(null==r&&(r=1e9-1),o=n.filter(function(t){return!t.isEmpty&&i.indexOf(t)<0}),u=i.filter(function(t){return!t.isEmpty&&n.indexOf(t)<0}),o.length!=u.length)return!1;if(!o.length)return!0;for(s=Kh(o,u),a=new Rt(o,s,0).goto(e),f=new Rt(u,s,0).goto(e);;){if(a.to!=f.to||!Zh(a.active,f.active)||a.point&&(!f.point||!a.point.eq(f.point)))return!1;if(a.to>r)return!0;a.next(),f.next()}}},{key:"spans",value:function t(n,i,e,r){for(var o,u,s,a,f,h,c,o,u=new Rt(n,null,4<arguments.length&&void 0!==arguments[4]?arguments[4]:-1).goto(i),s=i,a=u.openStart;;){if(f=Math.min(u.to,e),u.point?(h=u.activeForPoint(u.to),c=u.pointFrom<i?h.length+1:Math.min(h.length,a),r.point(s,f,u.point,h,c,u.pointRank),a=Math.min(u.openEnd(f),h.length)):s<f&&(r.span(s,f,u.active,a),a=u.openEnd(f)),u.to>e)return a+(u.point&&u.to>e?1:0);s=u.to,u.next()}}},{key:"of",value:function t(n){var i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],e=new Et,r=F(n instanceof Pt?[n]:i?Jh(n):n);try{for(r.s();!(o=r.n()).done;)u=o.value,e.add(u.from,u.to,u.value)}catch(t){r.e(t)}finally{r.f()}return e.finish()}}]),d}()).empty=new j([],[],null,-1),j.empty.nextLayer=j.empty,Et=function(){function r(){A(this,r),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 D(r,[{key:"finishChunk",value:function t(n){this.chunks.push(new Ot(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,n&&(this.from=[],this.to=[],this.value=[])}},{key:"add",value:function t(n,i,e){this.addInner(n,i,e)||(this.nextLayer||(this.nextLayer=new r)).add(n,i,e)}},{key:"addInner",value:function t(n,i,e){var r=n-this.lastTo||e.startSide-this.last.endSide;if(r<=0&&(n-this.lastFrom||e.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=n),this.from.push(n-this.chunkStart),this.to.push(i-this.chunkStart),this.last=e,this.lastFrom=n,this.lastTo=i,this.value.push(e),e.point&&(this.maxPoint=Math.max(this.maxPoint,i-n)),0))}},{key:"addChunk",value:function t(n,i){if((n-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(n);var e=i.value.length-1;return this.last=i.value[e],this.lastFrom=i.from[e]+n,this.lastTo=i.to[e]+n,!0}},{key:"finish",value:function t(){return this.finishInner(j.empty)}},{key:"finishInner",value:function t(n){var n;return this.from.length&&this.finishChunk(!1),0==this.chunks.length||(n=j.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(n):n,this.setMaxPoint),this.from=null),n}}]),r}(),At=function(){function r(t,n,i){var e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;A(this,r),this.layer=t,this.skip=n,this.minPoint=i,this.rank=e}return D(r,[{key:"startSide",get:function t(){return this.value?this.value.startSide:0}},{key:"endSide",get:function t(){return this.value?this.value.endSide:0}},{key:"goto",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(n,i,!1),this}},{key:"gotoInner",value:function t(n,i,e){for(var r,i;this.chunkIndex<this.layer.chunk.length&&(r=this.layer.chunk[this.chunkIndex],this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<n||r.maxPoint<this.minPoint);)this.chunkIndex++,e=!1;this.chunkIndex<this.layer.chunk.length&&(i=this.layer.chunk[this.chunkIndex].findIndex(n-this.layer.chunkPos[this.chunkIndex],i,!0),!e||this.rangeIndex<i)&&this.setRangeIndex(i),this.next()}},{key:"forward",value:function t(n,i){(this.to-n||this.endSide-i)<0&&this.gotoInner(n,i,!0)}},{key:"next",value:function t(){for(var n,i,e;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}if(e=(n=this.layer.chunkPos[this.chunkIndex])+(i=this.layer.chunk[this.chunkIndex]).from[this.rangeIndex],this.from=e,this.to=n+i.to[this.rangeIndex],this.value=i.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 t(n){if(n==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=n}},{key:"nextChunk",value:function t(){this.chunkIndex++,this.rangeIndex=0,this.next()}},{key:"compare",value:function t(n){return this.from-n.from||this.startSide-n.startSide||this.rank-n.rank||this.to-n.to||this.endSide-n.endSide}}]),r}(),Dt=function(){function s(t){A(this,s),this.heap=t}return D(s,[{key:"startSide",get:function t(){return this.value?this.value.startSide:0}},{key:"goto",value:function t(n){var i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1e9,e=F(this.heap);try{for(e.s();!(r=e.n()).done;)(o=r.value).goto(n,i)}catch(t){e.e(t)}finally{e.f()}for(u=this.heap.length>>1;0<=u;u--)Qh(this.heap,u);return this.next(),this}},{key:"forward",value:function t(n,i){var e,r,o,u,e=F(this.heap);try{for(e.s();!(r=e.n()).done;)(o=r.value).forward(n,i)}catch(t){e.e(t)}finally{e.f()}for(u=this.heap.length>>1;0<=u;u--)Qh(this.heap,u);(this.to-n||this.value.endSide-i)<0&&this.next()}},{key:"next",value:function t(){var n;0==this.heap.length?(this.from=this.to=1e9,this.value=null,this.rank=-1):(n=this.heap[0],this.from=n.from,this.to=n.to,this.value=n.value,this.rank=n.rank,n.value&&n.next(),Qh(this.heap,0))}}],[{key:"from",value:function t(n){for(var i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=0;o<n.length;o++)for(u=n[o];!u.isEmpty;u=u.nextLayer)u.maxPoint>=e&&r.push(new At(u,i,e,o));return 1==r.length?r[0]:new s(r)}}]),s}(),Rt=function(){function e(t,n,i){A(this,e),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=Dt.from(t,n,i)}return D(e,[{key:"goto",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1e9;return this.cursor.goto(n,i),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=n,this.endSide=i,this.openStart=-1,this.next(),this}},{key:"forward",value:function t(n,i){for(;-1<this.minActive&&(this.activeTo[this.minActive]-n||this.active[this.minActive].endSide-i)<0;)this.removeActive(this.minActive);this.cursor.forward(n,i)}},{key:"removeActive",value:function t(n){Yh(this.active,n),Yh(this.activeTo,n),Yh(this.activeRank,n),this.minActive=nc(this.active,this.activeTo)}},{key:"addActive",value:function t(n){for(var i=0,e=this.cursor,r=e.value,o=e.to,u=e.rank;i<this.activeRank.length&&this.activeRank[i]<=u;)i++;tc(this.active,i,r),tc(this.activeTo,i,o),tc(this.activeRank,i,u),n&&tc(n,i,this.cursor.from),this.minActive=nc(this.active,this.activeTo)}},{key:"next",value:function t(){var n,i,e,r,r,o,n=this.to,i=this.point;for(this.point=null,e=this.openStart<0?[]:null;;)if(-1<(r=this.minActive)&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>n){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),e&&Yh(e,r)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>n){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}if((r=this.cursor.value).point){if(!(i&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else this.addActive(e);this.cursor.next()}if(e)for(this.openStart=0,o=e.length-1;0<=o&&e[o]<n;o--)this.openStart++}},{key:"activeForPoint",value:function t(n){var i,e;if(!this.active.length)return this.active;for(i=[],e=this.active.length-1;0<=e&&!(this.activeRank[e]<this.pointRank);e--)(this.activeTo[e]>n||this.activeTo[e]==n&&this.active[e].endSide>=this.point.endSide)&&i.push(this.active[e]);return i.reverse()}},{key:"openEnd",value:function t(n){for(var i,e,i=0,e=this.activeTo.length-1;0<=e&&this.activeTo[e]>n;e--)i++;return i}}]),e}(),It=L.State=Object.freeze({__proto__:null,Annotation:gt,AnnotationType:wt,ChangeDesc:J,ChangeSet:K,get CharCategory(){return l},Compartment:ft,EditorSelection:O,EditorState:C,Facet:y,Line:W,get MapMode(){return h},Prec:st,Range:Pt,RangeSet:j,RangeSetBuilder:Et,RangeValue:jt,SelectionRange:X,StateEffect:v,StateEffectType:bt,StateField:b,Text:k,Transaction:Mt,codePointAt:wh,codePointSize:Mh,combineConfig:qh,countColumn:ic,findClusterBreak:yh,findColumn:ec,fromCodePoint:bh}),Tt="\u037c",Lt="undefined"==typeof Symbol?"__\u037c":Symbol.for(Tt),Bt="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),_t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{},Ft=function(){function r(t,n){var i,f,e;function h(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function c(t,n,i,e){var r,o,u,s,a,r=[],o=/^@(\w+)\b/.exec(t[0]),u=o&&"keyframes"==o[1];if(o&&null==n)return i.push(t[0]+";");for(s in n)if(a=n[s],/&/.test(s))c(s.split(/,\s*/).map(function(n){return t.map(function(t){return n.replace(/&/,t)})}).reduce(function(t,n){return t.concat(n)}),a,i);else if(a&&"object"==uh(a)){if(!o)throw new RangeError("The value of a property ("+s+") should be a primitive value.");c(h(s),a,r,u)}else null!=a&&r.push(s.replace(/_.*/,"").replace(/[A-Z]/g,function(t){return"-"+t.toLowerCase()})+": "+a+";");(r.length||u)&&i.push((!f||o||e?t:t.map(f)).join(", ")+" {"+r.join(" ")+"}")}for(e in A(this,r),this.rules=[],f=(i=n||{}).finish,t)c(h(e),t[e],this.rules)}return D(r,[{key:"getRules",value:function t(){return this.rules.join("\n")}}],[{key:"newName",value:function t(){var n=_t[Lt]||1;return _t[Lt]=n+1,Tt+n.toString(36)}},{key:"mount",value:function t(n,i){(n[Bt]||new Ut(n)).mount(Array.isArray(i)?i:[i])}}]),r}(),Nt=new Map,Ut=function(){function r(t){var n,i,e,e;if(A(this,r),i=(n=t.ownerDocument||t).defaultView,!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){if(e=Nt.get(n))return t.adoptedStyleSheets=[e.sheet].concat(Wf(t.adoptedStyleSheets)),t[Bt]=e;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet].concat(Wf(t.adoptedStyleSheets)),Nt.set(n,this)}else this.styleTag=n.createElement("style"),(e=t.head||t).insertBefore(this.styleTag,e.firstChild);this.modules=[],t[Bt]=this}return D(r,[{key:"mount",value:function t(n){for(var i,e,r,o,u,s,a,f,h,i=this.sheet,e=0,r=0,o=0;o<n.length;o++)if(u=n[o],(s=this.modules.indexOf(u))<r&&-1<s&&(this.modules.splice(s,1),r--,s=-1),-1==s){if(this.modules.splice(r++,0,u),i)for(a=0;a<u.rules.length;a++)i.insertRule(u.rules[a],e++)}else{for(;r<s;)e+=this.modules[r++].rules.length;e+=u.rules.length,r++}if(!i){for(f="",h=0;h<this.modules.length;h++)f+=this.modules[h].getRules()+"\n";this.styleTag.textContent=f}}}]),r}(),Ht={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:"'"},zt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},t="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),n="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Wt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Vt=n||t&&+t[1]<57,i=0;i<10;i++)Ht[48+i]=Ht[96+i]=String(i);for(i=1;i<=24;i++)Ht[i+111]="F"+i;for(i=65;i<=90;i++)Ht[i]=String.fromCharCode(i+32),zt[i]=String.fromCharCode(i);for($t in Ht)zt.hasOwnProperty($t)||(zt[$t]=Ht[$t]);function rc(t){var n,t,n,t=!(Vt&&(t.ctrlKey||t.altKey||t.metaKey)||Wt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?zt:Ht)[t.keyCode]||t.key||"Unidentified";return t="Down"==(t="Right"==(t="Up"==(t="Left"==(t="Del"==(t="Esc"==t?"Escape":t)?"Delete":t)?"ArrowLeft":t)?"ArrowUp":t)?"ArrowRight":t)?"ArrowDown":t}function oc(t){var t,t=11!=t.nodeType||t.getSelection?t:t.ownerDocument;return t.getSelection()}function uc(t,n){return!!n&&(t==n||t.contains(1!=n.nodeType?n.parentNode:n))}function sc(t){for(var n=t.activeElement;n&&n.shadowRoot;)n=n.shadowRoot.activeElement;return n}function ac(t,n){if(!n.anchorNode)return!1;try{return uc(t,n.anchorNode)}catch(t){return!1}}function fc(t){return 3==t.nodeType?gc(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function hc(t,n,i,e){return i&&(lc(t,n,i,e,-1)||lc(t,n,i,e,1))}function cc(t){for(var n=0;;n++)if(!(t=t.previousSibling))return n}function lc(t,n,i,e,r){for(;;){if(t==i&&n==e)return!0;if(n==(r<0?0:vc(t))){if("DIV"==t.nodeName)return!1;var o=t.parentNode;if(!o||1!=o.nodeType)return!1;n=cc(t)+(r<0?0:1),t=o}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[n+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;n=r<0?vc(t):0}}}function vc(t){return(3==t.nodeType?t.nodeValue:t.childNodes).length}function dc(t,n){var n=n?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function yc(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function mc(t,n,i,e,r,o,u,s){for(var a,f,h,c,l,v,v,d,y,m,p,k,y,m,c,c,a=t.ownerDocument,f=a.defaultView||window,h=t;h;)if(1==h.nodeType){if(c=void 0,l=h==a.body)c=yc(f);else{if(h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}c={left:(v=h.getBoundingClientRect()).left,right:v.left+h.clientWidth,top:v.top,bottom:v.top+h.clientHeight}}if(d=v=0,"nearest"==r?n.top<c.top?(d=-(c.top-n.top+u),0<i&&n.bottom>c.bottom+d&&(d=n.bottom-c.bottom+d+u)):n.bottom>c.bottom&&(d=n.bottom-c.bottom+u,i<0)&&n.top-d<c.top&&(d=-(c.top+d-n.top+u)):(y=n.bottom-n.top,m=c.bottom-c.top,d=(p="center"==r&&y<=m?n.top+y/2-m/2:"start"==r||"center"==r&&i<0?n.top-u:n.bottom-m+u)-c.top),"nearest"==e?n.left<c.left?(v=-(c.left-n.left+o),0<i&&n.right>c.right+v&&(v=n.right-c.right+v+o)):n.right>c.right&&(v=n.right-c.right+o,i<0)&&n.left<c.left+v&&(v=-(c.left+v-n.left+o)):v=(k="center"==e?n.left+(n.right-n.left)/2-(c.right-c.left)/2:"start"==e==s?n.left-o:n.right-(c.right-c.left)+o)-c.left,(v||d)&&(l?f.scrollBy(v,d):(m=y=0,d&&(c=h.scrollTop,h.scrollTop+=d,m=h.scrollTop-c),v&&(c=h.scrollLeft,h.scrollLeft+=v,y=h.scrollLeft-c),n={left:n.left-y,top:n.top-m,right:n.right-y,bottom:n.bottom-m},y&&Math.abs(y-v)<1&&(e="nearest"),m&&Math.abs(m-d)<1&&(r="nearest"))),l)break;h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}function pc(t){for(var n,i,n=t.ownerDocument,i=t.parentNode;i&&i!=n.body;)if(1==i.nodeType){if(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.assignedSlot||i.parentNode}else{if(11!=i.nodeType)break;i=i.host}return null}function kc(t){var n,i,e,r,o,u;if(t.setActive)return t.setActive();if(Gt)return t.focus(Gt);for(n=[],i=t;i&&(n.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Gt?{get preventScroll(){return Gt={preventScroll:!0},!0}}:void 0),!Gt)for(Gt=!1,e=0;e<n.length;)r=n[e++],o=n[e++],u=n[e++],r.scrollTop!=o&&(r.scrollTop=o),r.scrollLeft!=u&&(r.scrollLeft=u)}function gc(t,n,i){var i,e,i=2<arguments.length&&void 0!==i?i:n,e=Jt=Jt||document.createRange();return e.setEnd(t,i),e.setStart(t,n),e}function wc(t,n,i){var n,i,n,n={key:n,code:n,keyCode:i,which:i,cancelable:!0},i=new KeyboardEvent("keydown",n);return i.synthetic=!0,t.dispatchEvent(i),(n=new KeyboardEvent("keyup",n)).synthetic=!0,t.dispatchEvent(n),i.defaultPrevented||n.defaultPrevented}function bc(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function Mc(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function xc(t,n){var i,e,r,i=n.focusNode,e=n.focusOffset;if(i&&n.anchorNode==i&&n.anchorOffset==e)for(e=Math.min(e,vc(i));;)if(e){if(1!=i.nodeType)return;"false"==(r=i.childNodes[e-1]).contentEditable?e--:e=vc(i=r)}else{if(i==t)return 1;e=cc(i),i=i.parentNode}}function Sc(t){var n=t.nextSibling;return t.parentNode.removeChild(t),n}function Cc(t,n,i,e,r,o,u,s,a){var f,h,c,l,v,f=t.children,h=f.length?f[n]:null,c=o.length?o[o.length-1]:null,l=c?c.breakAfter:u;if(!(n==e&&h&&!u&&!l&&o.length<2&&h.merge(i,r,o.length?c:null,0==i,s,a))){for(e<f.length&&((v=f[e])&&r<v.length?(n==e&&(v=v.split(r),r=0),!l&&c&&v.merge(0,r,c,!0,0,a)?o[o.length-1]=v:(r&&v.merge(0,r,null,!1,0,a),o.push(v))):null!=v&&v.breakAfter&&(c?c.breakAfter=1:u=1),e++),h&&(h.breakAfter=u,0<i)&&(!u&&o.length&&h.merge(i,h.length,o[0],!1,s,0)?h.breakAfter=o.shift().breakAfter:(i<h.length||h.children.length&&0==h.children[h.children.length-1].length)&&h.merge(i,h.length,null,!1,s,0),n++);n<e&&o.length;)if(f[e-1].become(o[o.length-1]))e--,o.pop(),a=o.length?0:s;else{if(!f[n].become(o[0]))break;n++,o.shift(),s=o.length?0:a}!o.length&&n&&e<f.length&&!f[n-1].breakAfter&&f[e].merge(0,0,f[n-1],!1,s,a)&&n--,(n<e||o.length)&&t.replaceChildren(n,e,o)}}function jc(t,n,i,e,r,o){var u,s,a,s,u,f,u,h,c,l,v,u=t.childCursor(),s=u.findPos(i,1),a=s.i,s=s.off,u=u.findPos(n,-1),f=u.i,u=u.off,h=n-i,c=F(e);try{for(c.s();!(l=c.n()).done;)h+=(v=l.value).length}catch(t){c.e(t)}finally{c.f()}t.length+=h,Cc(t,f,u,a,s,e,0,r,o)}function Pc(t,n,i){var e,r,o,u,n,e,e=t.nodeValue.length;return(u=0)==(o=r=n=e<n?e:n)&&i<0||n==e&&0<=i?g.chrome||g.gecko||(n?(r--,u=1):o<e&&(o++,u=-1)):i<0?r--:o<e&&o++,(n=gc(t,r,o).getClientRects()).length?(e=n[(u?u<0:0<=i)?0:n.length-1],g.safari&&!u&&0==e.width&&(e=Array.prototype.find.call(n,function(t){return t.width})||e),u?dc(e,u<0):e||null):null}function Oc(t,n,i,e,r,o,u){var s,a,f,f,h;if(i instanceof un){for(s=i.dom.firstChild;s;s=s.nextSibling)if(a=c.get(s)){if(f=uc(s,e),t<(h=a.length+(f?r:0))||t==h&&a.getSide()<=0)return f?Oc(t,n,a,e,r,o,u):o(a,t,n);t-=h}else{if("number"!=typeof(f=Ec(t,n,s,u)))return f;t=f}return o(i,i.length,-1)}return i.dom==e?u(e,t,n):o(i,t,n)}function Ec(t,n,i,e){var r,o,u;if(3==i.nodeType){if(t<=(r=i.nodeValue.length))return e(i,t,n);t-=r}else if(1==i.nodeType&&"false"!=i.contentEditable)for(o=i.firstChild;o;o=o.nextSibling){if("number"!=typeof(u=Ec(t,n,o,e)))return u;t=u}return t}function Ac(t,n,i,e,r){var o,u,s,a,s;if(i instanceof un)for(o=0,u=i.dom.firstChild;u;u=u.nextSibling)if(s=c.get(u)){if(a=uc(u,e),uc(u,t))return o+(a?Ac(t,n,s,e,r):s.localPosFromDOM(t,n));o+=s.length+(a?r:0)}else{if(null!=(s=Dc(t,n,u)).result)return o+s.result;o+=s.size}else if(i.dom==e)return Math.min(n,e.nodeValue.length);return i.localPosFromDOM(t,n)}function Dc(t,n,i){var e,r,o,u;if(3==i.nodeType)return t==i?{result:n}:{size:i.nodeValue.length};if(1!=i.nodeType||"false"==i.contentEditable)return i.contains(t)?{result:0}:{size:0};for(r=i.firstChild,o=e=0;;r=r.nextSibling,o++){if(t==i&&o==n)return{result:e};if(!r)return{size:e};if(null!=(u=Dc(t,n,r)).result)return{result:n+u.result};e+=u.size}}function Rc(t,n){for(var i,e,r,o,u,s,a,f,h,c,i=t.dom,e=t.children,r=0,o=0;r<e.length;r++)if(!((s=o+(u=e[r]).length)==o&&u.getSide()<=0)){if(o<n&&n<s&&u.dom.parentNode==i)return u.domAtPos(n-o);if(n<=o)break;o=s}for(a=r;0<a;a--)if((f=e[a-1]).dom.parentNode==i)return f.domAtPos(f.length);for(h=r;h<e.length;h++)if((c=e[h]).dom.parentNode==i)return c.domAtPos(0);return new Kt(i,0)}function Ic(t,n,i){var e,r=t.children;0<i&&n instanceof un&&r.length&&(e=r[r.length-1])instanceof un&&e.mark.eq(n.mark)?Ic(e,n.children[0],i-1):(r.push(n),n.setParent(t)),t.length+=n.length}function Tc(t,n,u){var s,a,f,h,n;function c(t,n){for(var i,e,r,o,i=0,e=0;i<t.children.length&&e<=n;i++)n<=(o=e+(r=t.children[i]).length)&&(r.children.length?c(r,n-e):(!f||f.isHidden&&0<u)&&(n<o||e==o&&0<r.getSide())?(f=r,h=n-e):(e<n||e==o&&r.getSide()<0&&!r.isHidden)&&(s=r,a=n-e)),e=o}return f=s=null,h=a=-1,c(t,n),(n=(u<0?s:f)||s||f)?n.coordsAt(Math.max(0,n==s?a:h),u):Lc(t)}function Lc(t){var n,n,n=t.dom.lastChild;return n?(n=fc(n))[n.length-1]||null:t.dom.getBoundingClientRect()}function Bc(t,n){for(var i in t)"class"==i&&n.class?n.class+=" "+t.class:"style"==i&&n.style?n.style+=";"+t.style:n[i]=t[i];return n}function _c(t,n){var i,e,r,o,u;if(t!=n){if(!t||!n)return!1;if(i=Object.keys(t),e=Object.keys(n),i.length!=e.length)return!1;for(r=0,o=i;r<o.length;r++)if(u=o[r],-1==e.indexOf(u)||t[u]!==n[u])return!1}return!0}function Fc(t,n,i){var e,r,o,e=null;if(n)for(r in n)i&&r in i||t.removeAttribute(e=r);if(i)for(o in i)n&&n[o]==i[o]||t.setAttribute(e=o,i[o]);return!!e}function Nc(t,n){var n,i,e,n=1<arguments.length&&void 0!==n&&n,i=t.inclusiveStart,e=t.inclusiveEnd;return{start:null!=(i=null==i?t.inclusive:i)?i:n,end:null!=(e=null==e?t.inclusive:e)?e:n}}function Uc(t,n){return t==n||!!(t&&n&&t.compare(n))}function Hc(t,n,i,e){var r,o,r,o=i.length-1;0<=o&&i[o]+(3<arguments.length&&void 0!==e?e:0)>=t?i[o]=Math.max(i[o],n):i.push(t,n)}function zc(t,n){var i,e,r,i=F(n);try{for(i.s();!(e=i.n()).done;)r=e.value,t=new un(r,[t],t.length)}catch(t){i.e(t)}finally{i.f()}return t}function Wc(t,n,i){var t=t.facet(wn);t.length?t[0](n):window.onerror?window.onerror(String(n),i,void 0,void 0,n):i?console.error(i+":",n):console.error(n)}function Vc(t){var n,i,e,r,o,u,s,a,n=0,i=0,e=0,r=0,o=F(t.state.facet(Bn));try{for(o.s();!(u=o.n()).done;)(a=(s=u.value)(t))&&(null!=a.left&&(n=Math.max(n,a.left)),null!=a.right&&(i=Math.max(i,a.right)),null!=a.top&&(e=Math.max(e,a.top)),null!=a.bottom)&&(r=Math.max(r,a.bottom))}catch(t){o.e(t)}finally{o.f()}return{left:n,right:i,top:e,bottom:r}}function $c(t){for(var n,i,n=[],i=0;i<t.length;i++)n.push(1<<+t[i]);return n}qt=function(){function t(){A(this,t),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return D(t,[{key:"eq",value:function t(n){return this.anchorNode==n.anchorNode&&this.anchorOffset==n.anchorOffset&&this.focusNode==n.focusNode&&this.focusOffset==n.focusOffset}},{key:"setRange",value:function t(n){var i=n.anchorNode,e=n.focusNode;this.set(i,Math.min(n.anchorOffset,i?vc(i):0),e,Math.min(n.focusOffset,e?vc(e):0))}},{key:"set",value:function t(n,i,e,r){this.anchorNode=n,this.anchorOffset=i,this.focusNode=e,this.focusOffset=r}}]),t}(),Gt=null,Kt=function(){function e(t,n){var i=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];A(this,e),this.node=t,this.offset=n,this.precise=i}return D(e,null,[{key:"before",value:function t(n,i){return new e(n.parentNode,cc(n),i)}},{key:"after",value:function t(n,i){return new e(n.parentNode,cc(n)+1,i)}}]),e}(),Qt=[],(c=function(){function v(){A(this,v),this.parent=null,this.dom=null,this.dirty=2}return D(v,[{key:"overrideDOMText",get:function t(){return null}},{key:"posAtStart",get:function t(){return this.parent?this.parent.posBefore(this):0}},{key:"posAtEnd",get:function t(){return this.posAtStart+this.length}},{key:"posBefore",value:function t(n){var i,e,r,o,i=this.posAtStart,e=F(this.children);try{for(e.s();!(r=e.n()).done;){if((o=r.value)==n)return i;i+=o.length+o.breakAfter}}catch(t){e.e(t)}finally{e.f()}throw new RangeError("Invalid child in posBefore")}},{key:"posAfter",value:function t(n){return this.posBefore(n)+n.length}},{key:"sync",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l;if(2&this.dirty){e=this.dom,r=null,u=F(this.children);try{for(u.s();!(s=u.n()).done;){if((a=s.value).dirty&&(a.dom||!(o=r?r.nextSibling:e.firstChild)||(f=v.get(o))&&(f.parent||!f.canReuseDOM(a))||a.reuseDOM(o),a.sync(n,i),a.dirty=0),o=r?r.nextSibling:e.firstChild,i&&!i.written&&i.node==e&&o!=a.dom&&(i.written=!0),a.dom.parentNode==e)for(;o&&o!=a.dom;)o=Sc(o);else e.insertBefore(a.dom,o);r=a.dom}}catch(t){u.e(t)}finally{u.f()}for((o=r?r.nextSibling:e.firstChild)&&i&&i.node==e&&(i.written=!0);o;)o=Sc(o)}else if(1&this.dirty){h=F(this.children);try{for(h.s();!(c=h.n()).done;)(l=c.value).dirty&&(l.sync(n,i),l.dirty=0)}catch(t){h.e(t)}finally{h.f()}}}},{key:"reuseDOM",value:function t(n){}},{key:"localPosFromDOM",value:function t(n,i){var e,r,o,u,s,a;if(n==this.dom)e=this.dom.childNodes[i];else{for(r=0==vc(n)?0:0==i?-1:1;(o=n.parentNode)!=this.dom;)0==r&&o.firstChild!=o.lastChild&&(r=n==o.firstChild?-1:1),n=o;e=r<0?n:n.nextSibling}if(e==this.dom.firstChild)return 0;for(;e&&!v.get(e);)e=e.nextSibling;if(!e)return this.length;for(s=u=0;;u++){if((a=this.children[u]).dom==e)return s;s+=a.length+a.breakAfter}}},{key:"domBoundsAround",value:function t(n,i){for(var e,r,o,u,s,a,f,h,c,l,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=-1,o=-1,u=-1,s=-1,a=0,f=e,h=e;a<this.children.length;a++){if(l=f+(c=this.children[a]).length,f<n&&i<l)return c.domBoundsAround(n,i,f);if(n<=l&&-1==r&&(r=a,o=f),i<f&&c.dom.parentNode==this.dom){u=a,s=h;break}f=(h=l)+c.breakAfter}return{from:o,to:s<0?e+this.length:s,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:u<this.children.length&&0<=u?this.children[u].dom:null}}},{key:"markDirty",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this.dirty|=2,this.markParentsDirty(n)}},{key:"markParentsDirty",value:function t(n){for(var i=this.parent;i;i=i.parent){if(n&&(i.dirty|=2),1&i.dirty)return;i.dirty|=1,n=!1}}},{key:"setParent",value:function t(n){this.parent!=n&&(this.parent=n,this.dirty)&&this.markParentsDirty(!0)}},{key:"setDOM",value:function t(n){this.dom&&(this.dom.cmView=null),(this.dom=n).cmView=this}},{key:"rootView",get:function t(){for(var n,i,n=this;;){if(!(i=n.parent))return n;n=i}}},{key:"replaceChildren",value:function t(n,i){var e,r,o,u,s,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Qt;for(this.markDirty(),o=n;o<i;o++)(u=this.children[o]).parent==this&&u.destroy();for((e=this.children).splice.apply(e,[n,i-n].concat(Wf(r))),s=0;s<r.length;s++)r[s].setParent(this)}},{key:"ignoreMutation",value:function t(n){return!1}},{key:"ignoreEvent",value:function t(n){return!1}},{key:"childCursor",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.length;return new Xt(this.children,n,this.children.length)}},{key:"childPos",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return this.childCursor().findPos(n,i)}},{key:"toString",value:function t(){var n=this.constructor.name.replace("View","");return n+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==n?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}},{key:"isEditable",get:function t(){return!0}},{key:"isWidget",get:function t(){return!1}},{key:"isHidden",get:function t(){return!1}},{key:"merge",value:function t(n,i,e,r,o,u){return!1}},{key:"become",value:function t(n){return!1}},{key:"canReuseDOM",value:function t(n){return n.constructor==this.constructor}},{key:"getSide",value:function t(){return 0}},{key:"destroy",value:function t(){this.parent=null}}],[{key:"get",value:function t(n){return n.cmView}}]),v}()).prototype.breakAfter=0,Xt=function(){function e(t,n,i){A(this,e),this.children=t,this.pos=n,this.i=i,this.off=0}return D(e,[{key:"findPos",value:function t(n){for(var i,e,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;;){if(n>this.pos||n==this.pos&&(0<i||0==this.i||this.children[this.i-1].breakAfter))return this.off=n-this.pos,this;e=this.children[--this.i],this.pos-=e.length+e.breakAfter}}}]),e}(),n="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},t="undefined"!=typeof document?document:{documentElement:{style:{}}},Zt=/Edge\/(\d+)/.exec(n.userAgent),Yt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(n.userAgent),nn=!(tn=!!((e=/MSIE \d/.test(n.userAgent))||Yt||Zt))&&/gecko\/(\d+)/i.test(n.userAgent),en=!tn&&/Chrome\/(\d+)/.exec(n.userAgent),r="webkitFontSmoothing"in t.documentElement.style,g={mac:(u=(o=!tn&&/Apple Computer/.test(n.vendor))&&(/Mobile\/\w+/.test(n.userAgent)||2<n.maxTouchPoints))||/Mac/.test(n.platform),windows:/Win/.test(n.platform),linux:/Linux|X11/.test(n.platform),ie:tn,ie_version:e?t.documentMode||6:Yt?+Yt[1]:Zt?+Zt[1]:0,gecko:nn,gecko_version:nn?+(/Firefox\/(\d+)/.exec(n.userAgent)||[0,0])[1]:0,chrome:!!en,chrome_version:en?+en[1]:0,ios:u,android:/Android\b/.test(n.userAgent),webkit:r,safari:o,webkit_version:r?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=t.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},rn=256,on=function(t){f(r,t);var i=S(r);function r(t){var n;return A(this,r),(n=i.call(this)).text=t,n}return D(r,[{key:"length",get:function t(){return this.text.length}},{key:"createDOM",value:function t(n){this.setDOM(n||document.createTextNode(this.text))}},{key:"sync",value:function t(n,i){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(i&&i.node==this.dom&&(i.written=!0),this.dom.nodeValue=this.text)}},{key:"reuseDOM",value:function t(n){3==n.nodeType&&this.createDOM(n)}},{key:"merge",value:function t(n,i,e){return(!e||e instanceof r&&!(this.length-(i-n)+e.length>rn))&&(this.text=this.text.slice(0,n)+(e?e.text:"")+this.text.slice(i),this.markDirty(),!0)}},{key:"split",value:function t(n){var i=new r(this.text.slice(n));return this.text=this.text.slice(0,n),this.markDirty(),i}},{key:"localPosFromDOM",value:function t(n,i){return n==this.dom?i:i?this.text.length:0}},{key:"domAtPos",value:function t(n){return new Kt(this.dom,n)}},{key:"domBoundsAround",value:function t(n,i,e){return{from:e,to:e+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}},{key:"coordsAt",value:function t(n,i){return Pc(this.dom,n,i)}}]),r}(c),un=function(t){f(c,t);var s=S(c);function c(t){var n,i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;A(this,c),(n=s.call(this)).mark=t,n.children=i,n.length=e,r=F(i);try{for(r.s();!(o=r.n()).done;)(u=o.value).setParent(eh(n))}catch(t){r.e(t)}finally{r.f()}return n}return D(c,[{key:"setAttrs",value:function t(n){if(Mc(n),this.mark.class&&(n.className=this.mark.class),this.mark.attrs)for(var i in this.mark.attrs)n.setAttribute(i,this.mark.attrs[i]);return n}},{key:"reuseDOM",value:function t(n){n.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(n),this.dirty|=6)}},{key:"sync",value:function t(n,i){this.dom?4&this.dirty&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),Yf(oh(c.prototype),"sync",this).call(this,n,i)}},{key:"merge",value:function t(n,i,e,r,o,u){return!(e&&(!(e instanceof c&&e.mark.eq(this.mark))||n&&o<=0||i<this.length&&u<=0)||(jc(this,n,i,e?e.children:[],o-1,u-1),this.markDirty(),0))}},{key:"split",value:function t(n){var i,e,r,o,u,s,a,f,h,i=[],e=0,r=-1,o=0,u=F(this.children);try{for(u.s();!(s=u.n()).done;)n<(f=e+(a=s.value).length)&&i.push(e<n?a.split(n-e):a),r<0&&n<=e&&(r=o),e=f,o++}catch(t){u.e(t)}finally{u.f()}return h=this.length-n,this.length=n,-1<r&&(this.children.length=r,this.markDirty()),new c(this.mark,i,h)}},{key:"domAtPos",value:function t(n){return Rc(this,n)}},{key:"coordsAt",value:function t(n,i){return Tc(this,n,i)}}]),c}(c),an=function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"domAtPos",value:function t(n){var i=this.widget,e=i.topView,i=i.text;return e?Oc(n,0,e,i,this.length-e.length,function(t,n){return t.domAtPos(n)},function(t,n){return new Kt(t,Math.min(n,t.nodeValue.length))}):new Kt(i,Math.min(n,i.nodeValue.length))}},{key:"sync",value:function t(){this.setDOM(this.widget.toDOM())}},{key:"localPosFromDOM",value:function t(n,i){var e=this.widget,r=e.topView,e=e.text;return r?Ac(n,i,r,e,this.length-r.length):Math.min(i,this.length)}},{key:"ignoreMutation",value:function t(){return!1}},{key:"overrideDOMText",get:function t(){return null}},{key:"coordsAt",value:function t(n,i){var e=this.widget,r=e.topView,e=e.text;return r?Oc(n,i,r,e,this.length-r.length,function(t,n,i){return t.coordsAt(n,i)},Pc):Pc(e,n,i)}},{key:"destroy",value:function t(){var n;Yf(oh(i.prototype),"destroy",this).call(this),null!=(n=this.widget.topView)&&n.destroy()}},{key:"isEditable",get:function t(){return!0}},{key:"canReuseDOM",value:function t(){return!0}}]),i}(sn=function(t){f(s,t);var r=S(s);function s(t,n,i){var e;return A(this,s),(e=r.call(this)).widget=t,e.length=n,e.side=i,e.prevWidget=null,e}return D(s,[{key:"split",value:function t(n){var i=s.create(this.widget,this.length-n,this.side);return this.length-=n,i}},{key:"sync",value:function t(n){this.dom&&this.widget.updateDOM(this.dom,n)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(n)),this.dom.contentEditable="false")}},{key:"getSide",value:function t(){return this.side}},{key:"merge",value:function t(n,i,e,r,o,u){return!(e&&(!(e instanceof s&&this.widget.compare(e.widget))||0<n&&o<=0||i<this.length&&u<=0)||(this.length=n+(e?e.length:0)+(this.length-i),0))}},{key:"become",value:function t(n){return n instanceof s&&n.side==this.side&&this.widget.constructor==n.widget.constructor&&(this.widget.compare(n.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=n.widget,this.length=n.length,!0)}},{key:"ignoreMutation",value:function t(){return!0}},{key:"ignoreEvent",value:function t(n){return this.widget.ignoreEvent(n)}},{key:"overrideDOMText",get:function t(){var n,i,e,e,r;if(0==this.length)return k.empty;for(n=this;n.parent;)n=n.parent;return e=(e=n.view)&&e.state.doc,r=this.posAtStart,e?e.slice(r,r+this.length):k.empty}},{key:"domAtPos",value:function t(n){return(this.length?0==n:0<this.side)?Kt.before(this.dom):Kt.after(this.dom,n==this.length)}},{key:"domBoundsAround",value:function t(){return null}},{key:"coordsAt",value:function t(n,i){var i,e,r,o,i=this.widget.coordsAt(this.dom,n,i);if(i)return i;if(r=null,!(e=this.dom.getClientRects()).length)return null;for(o=0<n?e.length-1:0;r=e[o],!(0<n?0==o:o==e.length-1||r.top<r.bottom);o+=0<n?-1:1);return this.length?r:dc(r,0<this.side)}},{key:"isEditable",get:function t(){return!1}},{key:"isWidget",get:function t(){return!0}},{key:"isHidden",get:function t(){return this.widget.isHidden}},{key:"destroy",value:function t(){Yf(oh(s.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}],[{key:"create",value:function t(n,i,e){return new(n.customView||s)(n,i,e)}}]),s}(c)),fn=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).side=t,n}return D(e,[{key:"length",get:function t(){return 0}},{key:"merge",value:function t(){return!1}},{key:"become",value:function t(n){return n instanceof e&&n.side==this.side}},{key:"split",value:function t(){return new e(this.side)}},{key:"sync",value:function t(){var n;this.dom||((n=document.createElement("img")).className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),this.setDOM(n))}},{key:"getSide",value:function t(){return this.side}},{key:"domAtPos",value:function t(n){return 0<this.side?Kt.before(this.dom):Kt.after(this.dom)}},{key:"localPosFromDOM",value:function t(){return 0}},{key:"domBoundsAround",value:function t(){return null}},{key:"coordsAt",value:function t(n){return this.dom.getBoundingClientRect()}},{key:"overrideDOMText",get:function t(){return k.empty}},{key:"isHidden",get:function t(){return!0}}]),e}(c),on.prototype.children=sn.prototype.children=fn.prototype.children=Qt,tn=function(){function t(){A(this,t)}return D(t,[{key:"eq",value:function t(n){return!1}},{key:"updateDOM",value:function t(n,i){return!1}},{key:"compare",value:function t(n){return this==n||this.constructor==n.constructor&&this.eq(n)}},{key:"estimatedHeight",get:function t(){return-1}},{key:"ignoreEvent",value:function t(n){return!0}},{key:"coordsAt",value:function t(n,i,e){return null}},{key:"customView",get:function t(){return null}},{key:"isHidden",get:function t(){return!1}},{key:"destroy",value:function t(n){}}]),t}(),P=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(P=P||{}),(m=function(t){f(u,t);var o=S(u);function u(t,n,i,e){var r;return A(this,u),(r=o.call(this)).startSide=t,r.endSide=n,r.widget=i,r.spec=e,r}return D(u,[{key:"heightRelevant",get:function t(){return!1}},{key:"hasHeight",value:function t(){return!!this.widget&&-1<this.widget.estimatedHeight}}],[{key:"mark",value:function t(n){return new hn(n)}},{key:"widget",value:function t(n){var i=n.side||0,e=!!n.block;return new ln(n,i+=e?0<i?3e8:-4e8:0<i?1e8:-1e8,i,e,n.widget||null,!1)}},{key:"replace",value:function t(n){var i,e,r,r,o,u,i=!!n.block,r=n.isBlockGap?(e=-5e8,4e8):(e=((o=(r=Nc(n,i)).start)?i?-3e8:-1:5e8)-1,1+((u=r.end)?i?2e8:1:-6e8));return new ln(n,e,r,i,n.widget||null,!0)}},{key:"line",value:function t(n){return new cn(n)}},{key:"set",value:function t(n){var i;return j.of(n,1<arguments.length&&void 0!==arguments[1]&&arguments[1])}}]),u}(jt)).none=j.empty,(hn=function(t){f(r,t);var e=S(r);function r(t){var n,i,n,i;return A(this,r),n=(i=Nc(t)).start,i=i.end,(n=e.call(this,n?-1:5e8,i?1:-6e8,null,t)).tagName=t.tagName||"span",n.class=t.class||"",n.attrs=t.attributes||null,n}return D(r,[{key:"eq",value:function t(n){return this==n||n instanceof r&&this.tagName==n.tagName&&this.class==n.class&&_c(this.attrs,n.attrs)}},{key:"range",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;if(i<=n)throw new RangeError("Mark decorations may not be empty");return Yf(oh(r.prototype),"range",this).call(this,n,i)}}]),r}(m)).prototype.point=!1,(cn=function(t){f(e,t);var n=S(e);function e(t){return A(this,e),n.call(this,-2e8,-2e8,null,t)}return D(e,[{key:"eq",value:function t(n){return n instanceof e&&this.spec.class==n.spec.class&&_c(this.spec.attributes,n.spec.attributes)}},{key:"range",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;if(i!=n)throw new RangeError("Line decoration ranges must be zero-length");return Yf(oh(e.prototype),"range",this).call(this,n,i)}}]),e}(m)).prototype.mapMode=h.TrackBefore,cn.prototype.point=!0,(ln=function(t){f(s,t);var u=S(s);function s(t,n,i,e,r,o){var i;return A(this,s),(i=u.call(this,n,i,r,t)).block=e,i.isReplace=o,i.mapMode=e?n<=0?h.TrackBefore:h.TrackAfter:h.TrackDel,i}return D(s,[{key:"type",get:function t(){return this.startSide<this.endSide?P.WidgetRange:this.startSide<=0?P.WidgetBefore:P.WidgetAfter}},{key:"heightRelevant",get:function t(){return this.block||!!this.widget&&5<=this.widget.estimatedHeight}},{key:"eq",value:function t(n){return n instanceof s&&Uc(this.widget,n.widget)&&this.block==n.block&&this.startSide==n.startSide&&this.endSide==n.endSide}},{key:"range",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;if(this.isReplace&&(i<n||n==i&&0<this.startSide&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(this.isReplace||i==n)return Yf(oh(s.prototype),"range",this).call(this,n,i);throw new RangeError("Widget decorations can only have zero-length ranges")}}]),s}(m)).prototype.point=!0,vn=function(t){f(s,t);var n=S(s);function s(){var t;return A(this,s),(t=n.apply(this,arguments)).children=[],t.length=0,t.prevAttrs=void 0,t.attrs=null,t.breakAfter=0,t}return D(s,[{key:"merge",value:function t(n,i,e,r,o,u){if(e){if(!(e instanceof s))return!1;this.dom||e.transferDOM(this)}return r&&this.setDeco(e?e.attrs:null),jc(this,n,i,e?e.children:[],o,u),!0}},{key:"split",value:function t(n){var i,e,r,e,o,i=new s;if(i.breakAfter=this.breakAfter,0!=this.length){for(r=(e=this.childPos(n)).i,(e=e.off)&&(i.append(this.children[r].split(e),0),this.children[r].merge(e,this.children[r].length,null,!1,0,0),r++),o=r;o<this.children.length;o++)i.append(this.children[o],0);for(;0<r&&0==this.children[r-1].length;)this.children[--r].destroy();this.children.length=r,this.markDirty(),this.length=n}return i}},{key:"transferDOM",value:function t(n){this.dom&&(this.markDirty(),n.setDOM(this.dom),n.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}},{key:"setDeco",value:function t(n){_c(this.attrs,n)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=n)}},{key:"append",value:function t(n,i){Ic(this,n,i)}},{key:"addLineDeco",value:function t(n){var i=n.spec.attributes,n=n.spec.class;i&&(this.attrs=Bc(i,this.attrs||{})),n&&(this.attrs=Bc({class:n},this.attrs||{}))}},{key:"domAtPos",value:function t(n){return Rc(this,n)}},{key:"reuseDOM",value:function t(n){"DIV"==n.nodeName&&(this.setDOM(n),this.dirty|=6)}},{key:"sync",value:function t(n,i){var n,e,i;for(this.dom?4&this.dirty&&(Mc(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&&(Fc(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),Yf(oh(s.prototype),"sync",this).call(this,n,i),e=this.dom.lastChild;e&&c.get(e)instanceof un;)e=e.lastChild;e&&this.length&&("BR"==e.nodeName||0!=(null==(n=c.get(e))?void 0:n.isEditable)||g.ios&&this.children.some(function(t){return t instanceof on}))||((i=document.createElement("BR")).cmIgnore=!0,this.dom.appendChild(i))}},{key:"measureTextSize",value:function t(){var n,i,e,r,o,u;if(0==this.children.length||20<this.length)return null;n=0,e=F(this.children);try{for(e.s();!(r=e.n()).done;){if(!((o=r.value)instanceof on)||/[^ -~]/.test(o.text))return null;if(1!=(u=fc(o.dom)).length)return null;n+=u[0].width,i=u[0].height}}catch(t){e.e(t)}finally{e.f()}return n?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:n/this.length,textHeight:i}:null}},{key:"coordsAt",value:function t(n,i){var n,i,e,e,n=Tc(this,n,i);return!this.children.length&&n&&this.parent&&(i=this.parent.view.viewState.heightOracle,e=n.bottom-n.top,Math.abs(e-i.lineHeight)<2)&&i.textHeight<e?(e=(e-i.textHeight)/2,{top:n.top+e,bottom:n.bottom-e,left:n.left,right:n.left}):n}},{key:"become",value:function t(n){return!1}},{key:"type",get:function t(){return P.Text}}],[{key:"find",value:function t(n,i){for(var e,r,o,u,e=0,r=0;e<n.children.length;e++){if(i<=(u=r+(o=n.children[e]).length)){if(o instanceof s)return o;if(i<u)break}r=u+o.breakAfter}return null}}]),s}(c),dn=function(t){f(s,t);var r=S(s);function s(t,n,i){var e;return A(this,s),(e=r.call(this)).widget=t,e.length=n,e.type=i,e.breakAfter=0,e.prevWidget=null,e}return D(s,[{key:"merge",value:function t(n,i,e,r,o,u){return!(e&&(!(e instanceof s&&this.widget.compare(e.widget))||0<n&&o<=0||i<this.length&&u<=0)||(this.length=n+(e?e.length:0)+(this.length-i),0))}},{key:"domAtPos",value:function t(n){return 0==n?Kt.before(this.dom):Kt.after(this.dom,n==this.length)}},{key:"split",value:function t(n){var i,n,i=this.length-n;return this.length=n,(n=new s(this.widget,i,this.type)).breakAfter=this.breakAfter,n}},{key:"children",get:function t(){return Qt}},{key:"sync",value:function t(n){this.dom&&this.widget.updateDOM(this.dom,n)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(n)),this.dom.contentEditable="false")}},{key:"overrideDOMText",get:function t(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):k.empty}},{key:"domBoundsAround",value:function t(){return null}},{key:"become",value:function t(n){return n instanceof s&&n.widget.constructor==this.widget.constructor&&(n.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=n.widget,this.length=n.length,this.type=n.type,this.breakAfter=n.breakAfter,!0)}},{key:"ignoreMutation",value:function t(){return!0}},{key:"ignoreEvent",value:function t(n){return this.widget.ignoreEvent(n)}},{key:"isEditable",get:function t(){return!1}},{key:"isWidget",get:function t(){return!0}},{key:"coordsAt",value:function t(n,i){return this.widget.coordsAt(this.dom,n,i)}},{key:"destroy",value:function t(){Yf(oh(s.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}]),s}(c),yn=function(){function u(t,n,i,e){A(this,u),this.doc=t,this.pos=n,this.end=i,this.disallowBlockEffectsFor=e,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=n}return D(u,[{key:"posCovered",value:function t(){var n;return 0==this.content.length?!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos:!((n=this.content[this.content.length-1]).breakAfter||n instanceof dn&&n.type==P.WidgetBefore)}},{key:"getLine",value:function t(){return this.curLine||(this.content.push(this.curLine=new vn),this.atCursorPos=!0),this.curLine}},{key:"flushBuffer",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(zc(new fn(-1),n),n.length),this.pendingBuffer=0)}},{key:"addBlockWidget",value:function t(n){this.flushBuffer(),this.curLine=null,this.content.push(n)}},{key:"finish",value:function t(n){this.pendingBuffer&&n<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||this.getLine()}},{key:"buildText",value:function t(n,i,e){for(var r,o,u,r,r;0<n;){if(this.textOff==this.text.length){if(o=(r=this.cursor.next(this.skip)).value,u=r.lineBreak,r=r.done,this.skip=0,r)throw new Error("Ran out of text content when drawing inline views");if(u){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,n--;continue}this.text=o,this.textOff=0}r=Math.min(this.text.length-this.textOff,n,512),this.flushBuffer(i.slice(i.length-e)),this.getLine().append(zc(new on(this.text.slice(this.textOff,this.textOff+r)),i),e),this.atCursorPos=!0,this.textOff+=r,n-=r,e=0}}},{key:"span",value:function t(n,i,e,r){this.buildText(i-n,e,r),this.pos=i,this.openStart<0&&(this.openStart=r)}},{key:"point",value:function t(n,i,e,r,o,u){var u,s,s,a,f,h;if(this.disallowBlockEffectsFor[u]&&e instanceof ln){if(e.block)throw new RangeError("Block decorations may not be specified via plugins");if(i>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}u=i-n,e instanceof ln?e.block?((s=e.type)!=P.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new dn(e.widget||new mn("div"),u,s))):(s=sn.create(e.widget||new mn("span"),u,u?0:e.startSide),a=this.atCursorPos&&!s.isEditable&&o<=r.length&&(n<i||0<e.startSide),f=!s.isEditable&&(n<i||o>r.length||e.startSide<=0),h=this.getLine(),2!=this.pendingBuffer||a||s.isEditable||(this.pendingBuffer=0),this.flushBuffer(r),a&&(h.append(zc(new fn(1),r),o),o=r.length+Math.max(0,o-r.length)),h.append(zc(s,r),o),this.atCursorPos=f,this.pendingBuffer=f?n<i||o>r.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())):this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(e),u&&(this.textOff+u<=this.text.length?this.textOff+=u:(this.skip+=u-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=i),this.openStart<0&&(this.openStart=o)}}],[{key:"build",value:function t(n,i,e,r,o){var n=new u(n,i,e,o);return n.openEnd=j.spans(r,i,e,n),n.openStart<0&&(n.openStart=n.openEnd),n.finish(n.openEnd),n}}]),u}(),mn=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).tag=t,n}return D(e,[{key:"eq",value:function t(n){return n.tag==this.tag}},{key:"toDOM",value:function t(){return document.createElement(this.tag)}},{key:"updateDOM",value:function t(n){return n.nodeName.toLowerCase()==this.tag}},{key:"isHidden",get:function t(){return!0}}]),e}(tn),pn=y.define(),kn=y.define(),gn=y.define(),wn=y.define(),bn=y.define(),Mn=y.define(),xn=y.define(),Sn=y.define({combine:function t(n){return n.some(function(t){return t})}}),Cn=y.define({combine:function t(n){return n.some(function(t){return t})}}),jn=function(){function o(t){var n,i,e,r,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"nearest",i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"nearest",e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:5,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:5;A(this,o),this.range=t,this.y=n,this.x=i,this.yMargin=e,this.xMargin=r}return D(o,[{key:"map",value:function t(n){return n.empty?this:new o(this.range.map(n),this.y,this.x,this.yMargin,this.xMargin)}}]),o}(),Pn=v.define({map:function t(n,i){return n.map(i)}}),On=y.define({combine:function t(n){return!n.length||n[0]}}),En=0,An=y.define(),d=function(){function u(t,n,i,e){A(this,u),this.id=t,this.create=n,this.domEventHandlers=i,this.extension=e(this)}return D(u,null,[{key:"define",value:function t(n,i){var i=i||{},e=i.eventHandlers,r=i.provide,o=i.decorations;return new u(En++,n,e,function(n){var t=[An.of(n)];return o&&t.push(Tn.of(function(t){var t=t.plugin(n);return t?o(t):m.none})),r&&t.push(r(n)),t})}},{key:"fromClass",value:function t(n,i){return u.define(function(t){return new n(t)},i)}}]),u}(),Dn=function(){function n(t){A(this,n),this.spec=t,this.mustUpdate=null,this.value=null}return D(n,[{key:"update",value:function n(i){if(this.value){if(this.mustUpdate){var n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(t){if(Wc(n.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(i)}catch(t){Wc(i.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}},{key:"destroy",value:function t(n){var i;if(null!=(i=this.value)&&i.destroy)try{this.value.destroy()}catch(t){Wc(n.state,t,"CodeMirror plugin crashed")}}},{key:"deactivate",value:function t(){this.spec=this.value=null}}]),n}(),Rn=y.define(),In=y.define(),Tn=y.define(),Ln=y.define(),Bn=y.define(),_n=y.define(),Fn=function(){function d(t,n,i,e){A(this,d),this.fromA=t,this.toA=n,this.fromB=i,this.toB=e}return D(d,[{key:"join",value:function t(n){return new d(Math.min(this.fromA,n.fromA),Math.max(this.toA,n.toA),Math.min(this.fromB,n.fromB),Math.max(this.toB,n.toB))}},{key:"addToSet",value:function t(n){for(var i,e,r,i=n.length,e=this;0<i;i--)if(!((r=n[i-1]).fromA>e.toA)){if(r.toA<e.fromA)break;e=e.join(r),n.splice(i-1,1)}return n.splice(i,0,e),n}}],[{key:"extendWithRanges",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,c,v;if(0==i.length)return n;for(e=[],s=u=o=r=0;;r++){for(f=u-s,h=(a=r==n.length?null:n[r])?a.fromB:1e9;o<i.length&&i[o]<h&&(c=i[o],l=i[o+1],(c=Math.max(s,c))<=(v=Math.min(h,l))&&new d(c+f,v+f,c,v).addToSet(e),!(h<l));)o+=2;if(!a)return e;new d(a.fromA,a.toA,a.fromB,a.toB).addToSet(e),u=a.toA,s=a.toB}}}]),d}(),Nn=function(){function s(t,n,i){var e,r,o,u;A(this,s),this.view=t,this.state=n,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=K.empty(this.startState.doc.length),e=F(i);try{for(e.s();!(r=e.n()).done;)o=r.value,this.changes=this.changes.compose(o.changes)}catch(t){e.e(t)}finally{e.f()}u=[],this.changes.iterChangedRanges(function(t,n,i,e){return u.push(new Fn(t,n,i,e))}),this.changedRanges=u}return D(s,[{key:"viewportChanged",get:function t(){return 0<(4&this.flags)}},{key:"heightChanged",get:function t(){return 0<(2&this.flags)}},{key:"geometryChanged",get:function t(){return this.docChanged||0<(10&this.flags)}},{key:"focusChanged",get:function t(){return 0<(1&this.flags)}},{key:"docChanged",get:function t(){return!this.changes.empty}},{key:"selectionSet",get:function t(){return this.transactions.some(function(t){return t.selection})}},{key:"empty",get:function t(){return 0==this.flags&&0==this.transactions.length}}],[{key:"create",value:function t(n,i,e){return new s(n,i,e)}}]),s}(),E=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(E=E||{}),Un=E.LTR,Hn=E.RTL,zn=$c("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Wn=$c("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Vn=Object.create(null),$n=[];for(qn=0,Gn=["()","[]","{}"];qn<Gn.length;qn++)Vn[Kn=(Jn=Gn[qn]).charCodeAt(0)]=Jn=Jn.charCodeAt(1),Vn[Jn]=-Kn;function qc(t){return t<=247?zn[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Wn[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203?256:64336<=t&&t<=65023?4:8204==t?256:1}function Gc(t,n){var i,e,B,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,k,w,b,b,M,x,S,C,j,_,F,N,P,O,E,A,D,R,U,I,T,H,L,i=t.length,e=n==Un?1:2,B=n==Un?2:1;if(!t||1==e&&!Qn.test(t))return Jc(i);for(r=0,u=o=e;r<i;r++)512==(s=qc(t.charCodeAt(r)))?s=o:8==s&&4==u&&(s=16),z[r]=4==s?2:s,7&s&&(u=s),o=s;for(a=0,h=f=e;a<i;a++){if(128==(c=z[a]))a<i-1&&f==z[a+1]&&24&f?c=z[a]=f:z[a]=256;else if(64==c){for(l=a+1;l<i&&64==z[l];)l++;for(v=a&&8==f||l<i&&8==z[l]?1==h?1:8:256,d=a;d<l;d++)z[d]=v;a=l-1}else 8==c&&1==h&&(z[a]=1);7&(f=c)&&(h=c)}for(p=m=y=0;y<i;y++)if(g=Vn[k=t.charCodeAt(y)])if(g<0){for(w=m-3;0<=w;w-=3)if($n[w+1]==-g){(b=2&(b=$n[w+2])?e:4&b?1&b?B:e:0)&&(z[y]=z[$n[w]]=b),m=w;break}}else{if(189==$n.length)break;$n[m++]=y,$n[m++]=k,$n[m++]=p}else if(2==(k=z[y])||1==k)for(p=(M=k==e)?0:1,x=m-3;0<=x&&!(2&(S=$n[x+2]));x-=3)if(M)$n[x+2]|=2;else{if(4&S)break;$n[x+2]|=4}for(C=0;C<i;C++)if(256==z[C]){for(j=C+1;j<i&&256==z[j];)j++;for(N=(_=1==(C?z[C-1]:e))==(F=1==(j<i?z[j]:e))?_?1:2:e,P=C;P<j;P++)z[P]=N;C=j-1}if(O=[],1==e)for(E=0;E<i;){for(A=E,D=1!=z[E++];E<i&&D==(1!=z[E]);)E++;if(D)for(R=E;A<R;){for(U=R,I=2!=z[--R];A<R&&I==(2!=z[R-1]);)R--;O.push(new Xn(R,U,I?2:1))}else O.push(new Xn(A,E,0))}else for(T=0;T<i;){for(H=T,L=2==z[T++];T<i&&L==(2==z[T]);)T++;O.push(new Xn(H,T,L?1:2))}return O}function Jc(t){return[new Xn(0,t,0)]}function Kc(t,n,i,e,r){var o,u,s,o,o,e,a,u,u=e.head-t.from,s=-1;if(0==u){if(!r||!t.length)return null;n[0].level!=i&&(u=n[0].side(!1,i),s=0)}else if(u==t.length){if(r)return null;(o=n[n.length-1]).level!=i&&(u=o.side(!0,i),s=n.length-1)}return u==(o=n[s=s<0?Xn.find(n,u,null!=(o=e.bidiLevel)?o:-1,e.assoc):s]).side(r,i)&&(u=(o=n[s+=r?1:-1]).side(!r,i)),e=r==(o.dir==i),a=yh(t.text,u,e),Zn=t.text.slice(Math.min(u,a),Math.max(u,a)),a!=o.side(r,i)?O.cursor(a+t.from,e?-1:1,o.level):(u=s==(r?n.length-1:0)?null:n[s+(r?1:-1)])||o.level==i?u&&u.level<o.level?O.cursor(u.side(!r,i)+t.from,r?1:-1,u.level):O.cursor(a+t.from,r?-1:1,o.level):O.cursor(r?t.to:t.from,r?-1:1,i)}function Qc(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Xc(t){return 1==t.node.nodeType&&t.node.firstChild&&(0==t.offset||"false"==t.node.childNodes[t.offset-1].contentEditable)&&(t.offset==t.node.childNodes.length||"false"==t.node.childNodes[t.offset].contentEditable)}function Zc(t){var n,n,i,e,r,t,o,u,t,n=t.observer.selectionRange,n=n.focusNode&&tl(n.focusNode,n.focusOffset,0);if(!n)return null;if(!(i=t.docView.nearest(n)))return null;if(i instanceof vn){for(e=n;e.parentNode!=i.dom;)e=e.parentNode;for(r=e.previousSibling;r&&!c.get(r);)r=r.previousSibling;return{from:t=r?c.get(r).posAtEnd:i.posAtStart,to:t,node:e,text:n}}for(;;){if(!(u=i.parent))return null;if(u instanceof vn)break;i=u}return{from:t=i.posAtStart,to:t+i.length,node:i.dom,text:n}}function Yc(t,n){var i,e,r,o,i,e,n,r,t,r,i=Zc(t);if(!i)return m.none;if(e=i.from,r=i.to,o=i.node,i=i.text,e=n.mapPos(e,1),n=Math.max(e,n.mapPos(r,-1)),r=t.state,-1<(t=3==o.nodeType?o.nodeValue:new ti([],r).readRange(o.firstChild,null).text).indexOf(Yn))return m.none;if(n-e<t.length)if(r.doc.sliceString(e,Math.min(r.doc.length,e+t.length))==t)n=e+t.length;else{if(r.doc.sliceString(Math.max(0,n-t.length),n)!=t)return m.none;e=n-t.length}else if(r.doc.sliceString(e,n)!=t)return m.none;return(r=c.get(o))instanceof an?r=r.widget.topView:r&&(r.parent=null),m.set(m.replace({widget:new ri(o,i,r),inclusive:!0}).range(e,n))}function tl(t,n,i){var e,r,o,u;if(i<=0)for(e=t,r=n;;){if(3==e.nodeType)return e;if(!(1==e.nodeType&&0<r))break;r=vc(e=e.childNodes[r-1])}if(0<=i)for(o=t,u=n;;){if(3==o.nodeType)return o;if(!(1==o.nodeType&&u<o.childNodes.length&&0<=i))break;o=o.childNodes[u],u=0}return null}function nl(t,n){return 1!=t.nodeType?0:(n&&"false"==t.childNodes[n-1].contentEditable?1:0)|(n<t.childNodes.length&&"false"==t.childNodes[n].contentEditable?2:0)}function il(t,n,i){var e=new oi;return j.compare(t,n,i,e),e.changes}function el(t,n){for(var i=t;i&&i!=n;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return 1}function rl(t,n,i){var i,e,r,t,o,u,s,a,f,i=2<arguments.length&&void 0!==i?i:1,e=t.charCategorizer(n),r=t.doc.lineAt(n),t=n-r.from;if(0==r.length)return O.cursor(n);for(0==t?i=1:t==r.length&&(i=-1),u=o=t,i<0?o=yh(r.text,t,!1):u=yh(r.text,t),s=e(r.text.slice(o,u));0<o&&(a=yh(r.text,o,!1),e(r.text.slice(a,o))==s);)o=a;for(;u<r.length&&(f=yh(r.text,u),e(r.text.slice(u,f))==s);)u=f;return O.range(o+r.from,u+r.from)}function ol(t,n){return n.left>t?n.left-t:Math.max(0,t-n.right)}function ul(t,n){return n.top>t?n.top-t:Math.max(0,t-n.bottom)}function sl(t,n){return t.top<n.bottom-1&&t.bottom>n.top+1}function al(t,n){return n<t.top?{top:n,left:t.left,right:t.right,bottom:t.bottom}:t}function fl(t,n){return n>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:n}:t}function hl(t,n,i){for(var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,p,k,g,s=!1,l=t.firstChild;l;l=l.nextSibling)for(v=fc(l),d=0;d<v.length;d++){if(y=v[d],m=ol(n,y=r&&sl(r,y)?al(fl(y,r.bottom),r.top):y),p=ul(i,y),0==m&&0==p)return(3==l.nodeType?cl:hl)(l,n,i);(!e||p<u||u==p&&m<o)&&(e=l,r=y,o=m,s=!(p=(u=p)?i<y.top?-1:1:m?n<y.left?-1:1:0)||(0<p?d<v.length-1:0<d)),0==m?i>y.bottom&&(!h||h.bottom<y.bottom)?(a=l,h=y):i<y.top&&(!c||c.top>y.top)&&(f=l,c=y):h&&sl(h,y)?h=fl(h,y.bottom):c&&sl(c,y)&&(c=al(c,y.top))}return h&&h.bottom>=i?(e=a,r=h):c&&c.top<=i&&(e=f,r=c),e?(k=Math.max(r.left,Math.min(r.right,n)),3==e.nodeType?cl(e,k,i):s&&"false"!=e.contentEditable?hl(e,k,i):{node:t,offset:g=Array.prototype.indexOf.call(t.childNodes,e)+(n>=(r.left+r.right)/2?1:0)}):{node:t,offset:0}}function cl(t,n,i){for(var e,r,o,u,s,a,f,h,c,l,v,d,e=t.nodeValue.length,r=-1,o=1e9,u=0,s=0;s<e;s++)for(a=gc(t,s,s+1).getClientRects(),f=0;f<a.length;f++)if((h=a[f]).top!=h.bottom&&(u=u||n-h.left,c=(h.top>i?h.top-i:i-h.bottom)-1,h.left-1<=n)&&h.right+1>=n&&c<o){if(v=l=n>=(h.left+h.right)/2,(g.chrome||g.gecko)&&(d=gc(t,s).getBoundingClientRect()).left==h.right&&(v=!l),c<=0)return{node:t,offset:s+(v?1:0)};r=s+(v?1:0),o=c}return{node:t,offset:-1<r?r:0<u?t.nodeValue.length:0}}function ll(t,n,i,e){var r,o,u,e,u,s,a,f,h,c,l,v,u,d,o,y,m,e,y,o,y,d,o,y,r=3<arguments.length&&void 0!==e?e:-1,e=t.contentDOM.getBoundingClientRect(),u=e.top+t.viewState.paddingTop,a=t.viewState.docHeight,f=n.x,h=n.y,c=h-u;if(c<0)return 0;if(a<c)return t.state.doc.length;for(l=t.defaultLineHeight/2,v=!1;(s=t.elementAtHeight(c)).type!=P.Text;)for(;!(0<=(c=0<r?s.bottom+l:s.top-l)&&c<=a);){if(v)return i?null:0;v=!0,r=-r}if(h=u+c,(u=s.from)<t.viewport.from)return 0==t.viewport.from?0:i?null:vl(t,e,s,f,h);if(u>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:vl(t,e,s,f,h);if(d=t.dom.ownerDocument,(y=(y=(o=t.root.elementFromPoint?t.root:d).elementFromPoint(f,h))&&!t.contentDOM.contains(y)?null:y)||(f=Math.max(e.left+1,Math.min(e.right-1,f)),(y=o.elementFromPoint(f,h))&&!t.contentDOM.contains(y)&&(y=null)),e=-1,y&&0!=(null==(o=t.docView.nearest(y))?void 0:o.isEditable)&&(d.caretPositionFromPoint?(y=d.caretPositionFromPoint(f,h))&&(m=y.offsetNode,e=y.offset):d.caretRangeFromPoint&&(o=d.caretRangeFromPoint(f,h))&&(m=o.startContainer,e=o.startOffset,!t.contentDOM.contains(m)||g.safari&&dl(m,e,f)||g.chrome&&yl(m,e,f))&&(m=void 0)),!m||!t.docView.dom.contains(m)){if(!(y=vn.find(t.docView,u)))return c>s.top+s.height/2?s.to:s.from;m=(d=hl(y.dom,f,h)).node,e=d.offset}return(o=t.docView.nearest(m))?o.isWidget&&1==(null==(u=o.dom)?void 0:u.nodeType)?(y=o.dom.getBoundingClientRect(),n.y<y.top||n.y<=y.bottom&&n.x<=(y.left+y.right)/2?o.posAtStart:o.posAtEnd):o.localPosFromDOM(m,e)+o.posAtStart:null}function vl(t,n,i,e,r){var e,o,n,e=Math.round((e-n.left)*t.defaultCharacterWidth);return t.lineWrapping&&i.height>1.5*t.defaultLineHeight&&(e+=(o=Math.floor((r-i.top)/t.defaultLineHeight))*t.viewState.heightOracle.lineLength),n=t.state.sliceDoc(i.from,i.to),i.from+ec(n,e,t.state.tabSize)}function dl(t,n,i){var n,e;if(3==t.nodeType&&n==(n=t.nodeValue.length)){for(e=t.nextSibling;e;e=e.nextSibling)if(1!=e.nodeType||"BR"!=e.nodeName)return;return gc(t,n-1,n).getBoundingClientRect().left>i}}function yl(t,n,i){var e,r,o;if(0==n){for(e=t;;){if(!(r=e.parentNode)||1!=r.nodeType||r.firstChild!=e)return;if(r.classList.contains("cm-line"))break;e=r}return 5<i-(o=(1==t.nodeType?t:gc(t,0,Math.max(t.nodeValue.length,1))).getBoundingClientRect()).left}}function ml(t,n,i,e){var r,e,o,u,u,o,e,r=t.state.doc.lineAt(n.head),e=e&&t.lineWrapping?t.coordsAtPos(n.assoc<0&&n.head>r.from?n.head-1:n.head):null;return e&&(o=t.dom.getBoundingClientRect(),u=t.textDirectionAt(r.from),null!=(u=t.posAtCoords({x:i==(u==E.LTR)?o.right-1:o.left+1,y:(e.top+e.bottom)/2})))?O.cursor(u,i?-1:1):(e=(o=vn.find(t.docView,n.head))?i?o.posAtEnd:o.posAtStart:i?r.to:r.from,O.cursor(e,i?-1:1))}function pl(t,n,i,e){for(var r,o,u,s,a,f,h,r=t.state.doc.lineAt(n.head),o=t.bidiSpans(r),u=t.textDirectionAt(r.from),s=n,a=null;;){if(f=Kc(r,o,u,s,i),h=Zn,!f){if(r.number==(i?t.state.doc.lines:1))return s;h="\n",r=t.state.doc.line(r.number+(i?1:-1)),o=t.bidiSpans(r),f=O.cursor(i?r.from:r.to)}if(a){if(!a(h))return s}else{if(!e)return f;a=e(h)}s=f}}function kl(t,n,i){var e,r,e=t.state.charCategorizer(n),r=e(i);return function(t){var t=e(t);return(r=r==l.Space?t:r)==t}}function gl(t,n,i,e){var r,o,u,s,a,i,f,i,h,c,l,v,d,r=n.head,o=i?1:-1;if(r==(i?t.state.doc.length:0))return O.cursor(r,n.assoc);for(u=n.goalColumn,a=t.contentDOM.getBoundingClientRect(),i=t.coordsAtPos(r),f=t.documentTop,s=i?(null==u&&(u=i.left-a.left),o<0?i.top:i.bottom):(i=t.viewState.lineBlockAt(r),null==u&&(u=Math.min(a.right-a.left,t.defaultCharacterWidth*(r-i.from))),(o<0?i.top:i.bottom)+f),h=a.left+u,c=null!=e?e:t.defaultLineHeight>>1,l=0;;l+=10)if(d=ll(t,{x:h,y:v=s+(c+l)*o},!1,o),v<a.top||v>a.bottom||(o<0?d<r:r<d))return O.cursor(d,n.assoc,void 0,u)}function wl(o,u,s){for(var t=function t(){var r,n,i,e,r=0,n=F(o);try{for(n.s();!(i=n.n()).done;)(e=i.value).between(u-1,u+1,function(t,n,i){var e;t<u&&u<n&&(u=(e=r||s||(u-t<n-u?-1:1))<0?t:n,r=e)})}catch(t){n.e(t)}finally{n.f()}if(!r)return{v:u}},n;;)if(n=t())return n.v}function bl(n,t,i){var t=wl(n.state.facet(Ln).map(function(t){return t(n)}),i.from,t.head>i.from?-1:1);return t==i.from?i:O.cursor(t,t<i.from?1:-1)}function Ml(t){return.7*Math.max(0,t)+8}function xl(t,n){var t=t.state.facet(pn);return t.length?t[0](n):g.mac?n.metaKey:n.ctrlKey}function Sl(t,n){var t=t.state.facet(kn);return t.length?t[0](n):g.mac?!n.altKey:!n.ctrlKey}function Cl(t,n){var i,i,e,r,o,i=t.state.selection.main;if(!i.empty){if(!(i=oc(t.root))||0==i.rangeCount)return 1;for(e=i.getRangeAt(0).getClientRects(),r=0;r<e.length;r++)if((o=e[r]).left<=n.clientX&&o.right>=n.clientX&&o.top<=n.clientY&&o.bottom>=n.clientY)return 1}}function jl(t,n){if(!n.bubbles)return 1;if(!n.defaultPrevented){for(var i=n.target,e;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(e=c.get(i))&&e.ignoreEvent(n))return;return 1}}function Pl(t){var n,i,n=t.dom.parentNode;n&&((i=n.appendChild(document.createElement("textarea"))).style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(function(){t.focus(),i.remove(),Ol(t,i.value)},50))}function Ol(t,e){var r,n,o,u,s,i,a,r=t.state,o=1,u=r.toText(e),s=u.lines==r.selection.ranges.length,i,n=null!=wi&&r.selection.ranges.every(function(t){return t.empty})&&wi==u.toString()?(a=-1,r.changeByRange(function(t){var n,i,n=r.doc.lineAt(t.from);return n.from==a?{range:t}:(a=n.from,i=r.toText((s?u.line(o++).text:e)+r.lineBreak),{changes:{from:n.from,insert:i},range:O.cursor(t.from+i.length)})})):s?r.changeByRange(function(t){var n=u.line(o++);return{changes:{from:t.from,to:t.to,insert:n.text},range:O.cursor(t.from+n.length)}}):r.replaceSelection(u);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function El(t,n,i,e){var e,i,n,e;return 1==e?O.cursor(n,i):2==e?rl(t.state,n,i):(e=vn.find(t.docView,n),i=t.state.doc.lineAt(e?e.posAtEnd:n),n=e?e.posAtStart:i.from,(e=e?e.posAtEnd:i.to)<t.state.doc.length&&e==i.to&&e++,O.range(n,e))}function Al(t,n,i,e){var t,n,r,t,t=vn.find(t.docView,n);return t&&0!=(n=n-t.posAtStart)&&(n==t.length||(r=t.coordsAt(n,-1))&&yi(i,e,r)||(!(t=t.coordsAt(n,1))||!yi(i,e,t))&&r&&di(e,r))?-1:1}function Dl(t,n){var i=t.posAtCoords({x:n.clientX,y:n.clientY},!1);return{pos:i,bias:Al(t,i,n.clientX,n.clientY)}}function Rl(t){var n,i;return mi?(n=pi,i=gi,pi=t,gi=Date.now(),ki=!n||i>Date.now()-400&&Math.abs(n.clientX-t.clientX)<2&&Math.abs(n.clientY-t.clientY)<2?(ki+1)%3:1):t.detail}function Il(s,t){var a,f,h,a=Dl(s,t),f=Rl(t),h=s.state.selection;return{update:function t(n){n.docChanged&&(a.pos=n.changes.mapPos(a.pos),h=h.map(n.changes))},get:function t(n,i,e){var n,r,o,r,u,r,n=Dl(s,n),o=El(s,n.pos,n.bias,f);return a.pos==n.pos||i||(r=El(s,a.pos,a.bias,f),u=Math.min(r.from,o.from),r=Math.max(r.to,o.to),o=u<o.from?O.range(u,r):O.range(r,u)),i?h.replaceRange(h.main.extend(o.from,o.to)):e&&1==f&&1<h.ranges.length&&(r=Tl(h,n.pos))?r:e?h.addRange(o):O.create([o])}}}function Tl(t,n){for(var i,e,r,e,i=0;i<t.ranges.length;i++)if(r=(e=t.ranges[i]).from,e=e.to,r<=n&&n<=e)return O.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0));return null}function Ll(t,n,i,e){var r,n,e,n,i;i&&(r=t.posAtCoords({x:n.clientX,y:n.clientY},!1),n.preventDefault(),n=t.inputState.mouseSelection,e=e&&n&&n.dragging&&n.dragMove?{from:n.dragging.from,to:n.dragging.to}:null,n={from:r,insert:i},i=t.state.changes(e?[e,n]:n),t.focus(),t.dispatch({changes:i,selection:{anchor:i.mapPos(r,-1),head:i.mapPos(r,1)},userEvent:e?"move.drop":"input.drop"}))}function Bl(t,n){var i,e,i=t.dom.parentNode;i&&((e=i.appendChild(document.createElement("textarea"))).style.cssText="position: fixed; left: -10000px; top: 10px",e.value=n,e.focus(),e.selectionEnd=n.length,e.selectionStart=0,setTimeout(function(){e.remove(),t.focus()},50))}function _l(t){var n,i,e,r,o,u,s,a,f,h,c,n=[],i=[],e=!1,r=F(t.selection.ranges);try{for(r.s();!(o=r.n()).done;)(u=o.value).empty||(n.push(t.sliceDoc(u.from,u.to)),i.push(u))}catch(t){r.e(t)}finally{r.f()}if(!n.length){s=-1,a=F(t.selection.ranges);try{for(a.s();!(f=a.n()).done;)h=f.value.from,(c=t.doc.lineAt(h)).number>s&&(n.push(c.text),i.push({from:c.from,to:Math.min(t.doc.length,c.to+1)})),s=c.number}catch(t){a.e(t)}finally{a.f()}e=!0}return{text:n.join(t.lineBreak),ranges:i,linewise:e}}function Fl(t,n){var i,e,r,o,u,i=[],e=F(t.facet(xn));try{for(e.s();!(r=e.n()).done;)(u=(o=r.value)(t,n))&&i.push(u)}catch(t){e.e(t)}finally{e.f()}return i?t.update({effects:i,annotations:bi.of(!0)}):null}function Nl(n){setTimeout(function(){var t,t,t=n.hasFocus;t!=n.inputState.notifiedFocused&&((t=Fl(n.state,t))?n.dispatch(t):n.update([]))},10)}function Ul(t,n){var i,e;null==t[n]&&(i=t[n-1])instanceof Ai&&(e=t[n+1])instanceof Ai&&t.splice(n-1,3,new Ai(i.length+1+e.length))}function Hl(t,n,i){var e=new Ti;return j.compare(t,n,i,e,0),e.changes}function zl(t,n){for(var i,e,r,o,u,s,a,f,h,c,l,i=t.getBoundingClientRect(),e=t.ownerDocument,r=e.defaultView||window,o=Math.max(0,i.left),u=Math.min(r.innerWidth,i.right),s=Math.max(0,i.top),a=Math.min(r.innerHeight,i.bottom),f=t.parentNode;f&&f!=e.body;)if(1==f.nodeType)h=f,c=window.getComputedStyle(h),(h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&"visible"!=c.overflow&&(l=h.getBoundingClientRect(),o=Math.max(o,l.left),u=Math.min(u,l.right),s=Math.max(s,l.top),a=f==t.parentNode?l.bottom:Math.min(a,l.bottom)),f="absolute"==c.position||"fixed"==c.position?h.offsetParent:h.parentNode;else{if(11!=f.nodeType)break;f=f.host}return{left:o-i.left,right:Math.max(o,u)-i.left,top:s-(i.top+n),bottom:Math.max(s,a)-(i.top+n)}}function Wl(t,n){var t=t.getBoundingClientRect();return{left:0,right:t.right-t.left,top:n,bottom:t.bottom-(t.top+n)}}function Vl(t,n,i){var e=[],r=t,o=0;return j.spans(i,t,n,{span:function t(){},point:function t(n,i){r<n&&(e.push({from:r,to:n}),o+=n-r),r=i}},20),r<n&&(e.push({from:r,to:n}),o+=n-r),{total:o,ranges:e}}function $l(t,n){var i,e,r,o,u,s,a,u,i=t.total,e=t.ranges;if(n<=0)return e[0].from;if(1<=n)return e[e.length-1].to;for(r=Math.floor(i*n),o=0;;o++){if(s=(u=e[o]).from,r<=(u=(a=u.to)-s))return s+r;r-=u}}function ql(t,n){var i,e,r,o,u,s,i=0,e=F(t.ranges);try{for(e.s();!(r=e.n()).done;){if(u=(o=r.value).from,n<=(s=o.to)){i+=n-u;break}i+=s-u}}catch(t){e.e(t)}finally{e.f()}return i/t.total}function Gl(t,n){var i,e,r,i=F(t);try{for(i.s();!(e=i.n()).done;)if(n(r=e.value))return r}catch(t){i.e(t)}finally{i.f()}}function Jl(t,n){var i,e;return 1==n.scale?t:(i=n.toDOM(t.top),e=n.toDOM(t.bottom),new Ci(t.from,t.length,i,e-i,t.children&&t.children.map(function(t){return Jl(t,n)}),t.deco))}function Kl(i,t,e){return new Ft(t,{finish:function t(n){return/&/.test(n)?n.replace(/&\w*/,function(t){if("&"==t)return i;if(e&&e[t])return e[t];throw new RangeError("Unsupported selector: ".concat(t))}):i+" "+n}})}function Ql(e,t){var r,n,o,i,u,s,u,a,f,u,h,c,s,a,f,l,v,d,y,m,p,u,t,i,n=t.newSel,o=e.state.selection.main,i=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;return t.bounds?(s=(u=t.bounds).from,u=u.to,a=o.from,f=null,(8===i||g.android&&t.text.length<u-s)&&(a=o.to,f="end"),(u=Xl(e.state.doc.sliceString(s,u,Yn),t.text,a-s,f))&&(g.chrome&&13==i&&u.toB==u.from+2&&"\uffff\uffff"==t.text.slice(u.from,u.toB)&&u.toB--,r={from:s+u.from,to:s+u.toA,insert:k.of(t.text.slice(u.from,u.toB).split(Yn))})):n&&(!e.hasFocus&&e.state.facet(On)||n.main.eq(o))&&(n=null),!(!r&&!n||(!r&&t.typeOver&&!o.empty&&n&&n.main.empty?r={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,o.to)}:r&&r.from>=o.from&&r.to<=o.to&&(r.from!=o.from||r.to!=o.to)&&o.to-o.from-(r.to-r.from)<=4?r={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,r.from).append(r.insert).append(e.state.doc.slice(r.to,o.to))}:(g.mac||g.android)&&r&&r.from==r.to&&r.from==o.head-1&&/^\. ?$/.test(r.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(n&&2==r.insert.length&&(n=O.single(n.main.anchor-1,n.main.head-1)),r={from:o.from,to:o.to,insert:k.of([" "])}):g.chrome&&r&&r.from==r.to&&r.from==o.head&&"\n "==r.insert.toString()&&e.lineWrapping&&(n=n&&O.single(n.main.anchor-1,n.main.head-1),r={from:o.from,to:o.to,insert:k.of([" "])}),r?(h=e.state,g.ios&&e.inputState.flushIOSKey(e)||g.android&&(r.from==o.from&&r.to==o.to&&1==r.insert.length&&2==r.insert.lines&&wc(e.contentDOM,"Enter",13)||(r.from==o.from-1&&r.to==o.to&&0==r.insert.length||8==i&&r.insert.length<r.to-r.from)&&wc(e.contentDOM,"Backspace",8)||r.from==o.from&&r.to==o.to+1&&0==r.insert.length&&wc(e.contentDOM,"Delete",46))||(c=r.insert.toString(),e.state.facet(Mn).some(function(t){return t(e,r.from,r.to,c)}))||(0<=e.inputState.composing&&e.inputState.composing++,s=r.from>=o.from&&r.to<=o.to&&r.to-r.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==r.from+r.insert.length)&&e.inputState.composing<0?(a=o.from<r.from?h.sliceDoc(o.from,r.from):"",f=o.to>r.to?h.sliceDoc(r.to,o.to):"",h.replaceSelection(e.state.toText(a+r.insert.sliceString(0,void 0,e.state.lineBreak)+f))):(l=h.changes(r),v=n&&n.main.to<=l.newLength?n.main:void 0,1<h.selection.ranges.length&&0<=e.inputState.composing&&r.to<=o.to&&r.to>=o.to-10?(d=e.state.sliceDoc(r.from,r.to),y=Zc(e)||e.state.doc.lineAt(o.head),m=o.to-r.to,p=o.to-o.from,h.changeByRange(function(t){var n,i,i,n;return t.from==o.from&&t.to==o.to?{changes:l,range:v||t.map(l)}:(i=(n=t.to-m)-d.length,t.to-t.from!=p||e.state.sliceDoc(i,n)!=d||y&&t.to>=y.from&&t.from<=y.to?{range:t}:(i=h.changes({from:i,to:n,insert:r.insert}),n=t.to-o.to,{changes:i,range:v?O.range(Math.max(0,v.anchor+n),Math.max(0,v.head+n)):t.map(i)}))})):{changes:l,selection:v&&h.selection.replaceRange(v)}),u="input.type",(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,u+=".compose",e.inputState.compositionFirstChange)&&(u+=".start",e.inputState.compositionFirstChange=!1),e.dispatch(s,{scrollIntoView:!0,userEvent:u})),0):!n||n.main.eq(o)||(t=!1,i="select",e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),i=e.inputState.lastSelectionOrigin),e.dispatch({selection:n,scrollIntoView:t,userEvent:i}),0)))}function Xl(t,n,i,e){for(var r,o,u,s,a,f,h,r=Math.min(t.length,n.length),o=0;o<r&&t.charCodeAt(o)==n.charCodeAt(o);)o++;if(o==r&&t.length==n.length)return null;for(u=t.length,s=n.length;0<u&&0<s&&t.charCodeAt(u-1)==n.charCodeAt(s-1);)u--,s--;return"end"==e&&(i-=u+(a=Math.max(0,o-Math.min(u,s)))-o),u<o&&t.length<n.length?(s=(o-=f=i<=o&&u<=i?o-i:0)+(s-u),u=o):s<o&&(u=(o-=h=i<=o&&s<=i?o-i:0)+(u-s),s=o),{from:o,toA:u,toB:s}}function Zl(t){var n,t,i,e,r,t,n=[];return t.root.activeElement==t.contentDOM&&(i=(t=t.observer.selectionRange).anchorNode,e=t.anchorOffset,r=t.focusNode,t=t.focusOffset,i)&&(n.push(new ni(i,e)),r==i&&t==e||n.push(new ni(r,t))),n}function Yl(t,n){var i,t;return 0!=t.length&&(i=t[0].pos,t=2==t.length?t[1].pos:i,-1<i)&&-1<t?O.single(i+n,t+n):null}function t0(t,n,i){for(var e,e;n;){if((e=c.get(n))&&e.parent==t)return e;n=(e=n.parentNode)!=t.dom?e:0<i?n.nextSibling:n.previousSibling}return null}function n0(t){var n,i,e,r,o,t,t;function u(t){t.preventDefault(),t.stopImmediatePropagation(),n=t.getTargetRanges()[0]}return n=null,t.contentDOM.addEventListener("beforeinput",u,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",u,!0),n?(i=n.startContainer,e=n.startOffset,r=n.endContainer,o=n.endOffset,hc((t=t.docView.domAtPos(t.state.selection.main.anchor)).node,t.offset,r,o)&&(i=(t=[r,o,i,e])[0],e=t[1],r=t[2],o=t[3]),{anchorNode:i,anchorOffset:e,focusNode:r,focusOffset:o}):null}function i0(t,n,i){for(var e,r,o,o,e=t.state.facet(n),r=e.length-1;0<=r;r--)(o="function"==typeof(o=e[r])?o(t):o)&&Bc(o,i);return i}function e0(t,n){var i,t,e,r,o,u,s,a,i=t.split(/-(?!$)/),t=i[i.length-1];for("Space"==t&&(t=" "),s=0;s<i.length-1;++s)if(a=i[s],/^(cmd|meta|m)$/i.test(a))u=!0;else if(/^a(lt)?$/i.test(a))e=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))o=!0;else{if(!/^mod$/i.test(a))throw new Error("Unrecognized modifier name: "+a);"mac"==n?u=!0:r=!0}return e&&(t="Alt-"+t),r&&(t="Ctrl-"+t),u&&(t="Meta-"+t),t=o?"Shift-"+t:t}function r0(t,n,i){return n.altKey&&(t="Alt-"+t),n.ctrlKey&&(t="Ctrl-"+t),n.metaKey&&(t="Meta-"+t),t=!1!==i&&n.shiftKey?"Shift-"+t:t}function o0(t){var t,n,t=t.facet(ie),n=ee.get(t);return n||ee.set(t,n=s0(t.reduce(function(t,n){return t.concat(n)},[]))),n}function u0(t,n,i){return a0(o0(t.state),n,t,i)}function s0(t,n){var f,h,r,c,i,e,o,u,s,a,l,v,d,y,m,p,k,g,f=1<arguments.length&&void 0!==n?n:ne,h=Object.create(null),r=Object.create(null),c=function t(n,i){var e=r[n];if(null==e)r[n]=i;else if(e!=i)throw new Error("Key binding "+n+" is used both as a regular binding and as a multi-stroke prefix")},i=function t(e,n,i,r){for(var n,n,o,u,s,a,n,n,o=h[e]||(h[e]=Object.create(null)),u=n.split(/ (?!$)/).map(function(t){return e0(t,f)}),s=function t(){var i=u.slice(0,a).join(" ");c(i,!0),o[i]||(o[i]={preventDefault:!0,run:[function(t){var n=re={view:t,prefix:i,scope:e};return setTimeout(function(){re==n&&(re=null)},oe),!0}]})},a=1;a<u.length;a++)s();n=u.join(" "),c(n,!1),n=o[n]||(o[n]={preventDefault:!1,run:(null==(n=null==(n=o.Wde)?void 0:n.run)?void 0:n.slice())||[]}),i&&n.run.push(i),r&&(n.preventDefault=!0)},e=F(t);try{for(e.s();!(o=e.n()).done;){if(s=(u=o.value).scope?u.scope.split(" "):["editor"],u.any){a=F(s);try{for(a.s();!(l=a.n()).done;)for(y in v=l.value,(d=h[v]||(h[v]=Object.create(null))).Wde||(d.Wde={preventDefault:!1,run:[]}),d)d[y].run.push(u.any)}catch(t){a.e(t)}finally{a.f()}}if(m=u[f]||u.key){p=F(s);try{for(p.s();!(k=p.n()).done;)i(g=k.value,m,u.run,u.preventDefault),u.shift&&i(g,"Shift-"+m,u.shift,u.preventDefault)}catch(t){p.e(t)}finally{p.f()}}}}catch(t){e.e(t)}finally{e.f()}return h}function a0(t,o,u,n){var i,e,r,s,a,f,h,t,n,c,i=rc(o),e,r=Mh(wh(i,0))==i.length&&" "!=i,s="",a=!1;if(re&&re.view==u&&re.scope==n&&(s=re.prefix+" ",a=fi.indexOf(o.keyCode)<0)&&(re=null),f=new Set,h=function t(n){var i,e,r;if(n){i=F(n.run);try{for(i.s();!(e=i.n()).done;)if(r=e.value,!f.has(r)&&(f.add(r),r(u,o)))return!0}catch(t){i.e(t)}finally{i.f()}n.preventDefault&&(a=!0)}return!1},t=t[n]){if(h(t[s+r0(i,o,!r)]))return!0;if(r&&(o.altKey||o.metaKey||o.ctrlKey)&&!(g.windows&&o.ctrlKey&&o.altKey)&&(n=Ht[o.keyCode])&&n!=i){if(h(t[s+r0(n,o,!0)]))return!0;if(o.shiftKey&&(c=zt[o.keyCode])!=i&&c!=n&&h(t[s+r0(c,o,!1)]))return!0}else if(r&&o.shiftKey&&h(t[s+r0(i,o,!0)]))return!0;if(h(t.Wde))return!0}return a}function f0(t){var n,i,n=t.scrollDOM.getBoundingClientRect(),i;return{left:(t.textDirection==E.LTR?n.left:n.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:n.top-t.scrollDOM.scrollTop}}function h0(t,n,i){var n=O.cursor(n);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:P.Text}}function c0(t,n){var i,e,r,o,i=t.lineBlockAt(n);if(Array.isArray(i.type)){e=F(i.type);try{for(e.s();!(r=e.n()).done;)if((o=r.value).to>n||o.to==n&&(o.to==i.to||o.type==P.Text))return o}catch(t){e.e(t)}finally{e.f()}}return i}function l0(w,r,t){var n,i,b,e,o,u,e,e,M,x,e,s,a,f,n,i,t;return t.to<=w.viewport.from||t.from>=w.viewport.to?[]:(n=Math.max(t.from,w.viewport.from),i=Math.min(t.to,w.viewport.to),b=w.textDirection==E.LTR,e=w.contentDOM,o=e.getBoundingClientRect(),u=f0(w),e=(e=e.querySelector(".cm-line"))&&window.getComputedStyle(e),M=o.left+(e?parseInt(e.paddingLeft)+Math.min(0,parseInt(e.textIndent)):0),x=o.right-(e?parseInt(e.paddingRight):0),e=c0(w,n),s=c0(w,i),a=e.type==P.Text?e:null,f=s.type==P.Text?s:null,w.lineWrapping&&(a=a&&h0(w,n,a),f=f&&h0(w,i,f)),a&&f&&a.from==f.from?c(l(t.from,t.to,a)):(n=a?l(t.from,null,a):v(e,!1),i=f?l(null,t.to,f):v(s,!0),t=[],(a||e).to<(f||s).from-(a&&f?1:0)?t.push(h(M,n.bottom,x,i.top)):n.bottom<i.top&&w.elementAtHeight((n.bottom+i.top)/2).type==P.Text&&(n.bottom=i.top=(n.bottom+i.top)/2),c(n).concat(t).concat(c(i))));function h(t,n,i,e){return new ue(r,t-u.left,n-u.top-.01,i-t,e-n+.01)}function c(t){for(var n,i,e,r,o,n=t.top,i=t.bottom,e=t.horizontal,r=[],o=0;o<e.length;o+=2)r.push(h(e[o],n,e[o+1],i));return r}function l(t,n,o){var u,s,a,i,e,r,f,h,c,l,v,d,y,m,p,k;function g(t,n,i,e,r){var t,i,t=w.coordsAtPos(t,t==o.to?-2:2),i=w.coordsAtPos(i,i==o.from?2:-2);t&&i&&(u=Math.min(t.top,i.top,u),s=Math.max(t.bottom,i.bottom,s),r==E.LTR?a.push(b&&n?M:t.left,b&&e?x:i.right):a.push(!b&&e?M:i.left,!b&&n?x:t.right))}s=-(u=1e9),a=[],i=null!=t?t:o.from,e=null!=n?n:o.to,r=F(w.visibleRanges);try{for(r.s();!(f=r.n()).done;)if((h=f.value).to>i&&h.from<e)for(c=Math.max(h.from,i),l=Math.min(h.to,e);;){v=w.state.doc.lineAt(c),d=F(w.bidiSpans(v));try{for(d.s();!(y=d.n()).done&&(p=(m=y.value).from+v.from,k=m.to+v.from,!(l<=p));)c<k&&g(Math.max(p,c),null==t&&p<=i,Math.min(k,l),null==n&&e<=k,m.dir)}catch(t){d.e(t)}finally{d.f()}if(l<=(c=v.to+1))break}}catch(t){r.e(t)}finally{r.f()}return 0==a.length&&g(i,null==t,e,null==n,w.textDirection),{top:u,bottom:s,horizontal:a}}function v(t,n){var n=o.top+(n?t.top:t.bottom);return{top:n,bottom:n,horizontal:[]}}}function v0(t,n){return t.constructor==n.constructor&&t.eq(n)}function d0(n){return[d.define(function(t){return new se(t,n)}),ae.of(n)]}function y0(){var t;return[he.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),ce,le,ve,Cn.of(!0)]}function m0(t){return t.startState.facet(he)!=t.state.facet(he)}function p0(t,n){n.style.animationDuration=t.facet(he).cursorBlinkRate+"ms"}function k0(){return[ye,me]}function g0(t,n,i,e,r){n.lastIndex=0;for(var o=t.iterRange(i,e),u=i,s;!o.next().done;u+=o.value.length)if(!o.lineBreak)for(;s=n.exec(o.value);)r(u+s.index,s)}function w0(t,n){var i,e,r,o,u,s,a,i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;e=[],r=F(i);try{for(r.s();!(o=r.n()).done;)s=(u=o.value).from,a=u.to,s=Math.max(t.state.doc.lineAt(s).from,s-n),a=Math.min(t.state.doc.lineAt(a).to,a+n),e.length&&e[e.length-1].to>=s?e[e.length-1].to=a:e.push({from:s,to:a})}catch(t){r.e(t)}finally{r.f()}return e}function b0(){var t,n;return null==be&&"undefined"!=typeof document&&document.body&&(n=document.body.style,be=null!=(null!=(t=n.tabSize)?t:n.MozTabSize)),be}function M0(){var t;return[Me.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),x0()]}function x0(){return xe=xe||d.fromClass(function(){function n(t){A(this,n),this.view=t,this.decorations=m.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Me)),this.decorations=this.decorator.createDeco(t)}return D(n,[{key:"makeDecorator",value:function t(o){var u=this;return new pe({regexp:o.specialChars,decoration:function t(n,i,e){var r,n,r,i,e,r=i.state.doc,n=wh(n[0],0);return 9==n?(r=r.lineAt(e),i=i.state.tabSize,e=ic(r.text,i,e-r.from),m.replace({widget:new je((i-e%i)*u.view.defaultCharacterWidth)})):u.decorationCache[n]||(u.decorationCache[n]=m.replace({widget:new Ce(o,n)}))},boundary:o.replaceTabs?void 0:/[^]/})}},{key:"update",value:function t(n){var i=n.state.facet(Me);n.startState.facet(Me)!=i?(this.decorator=this.makeDecorator(i),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}}]),n}(),{decorations:function t(n){return n.decorations}})}function S0(t){return 32<=t?Se:10==t?"\u2424":String.fromCharCode(9216+t)}function C0(){return[Pe,In.of(function(t){var t;return(null==(t=t.plugin(Pe))?void 0:t.attrs)||null})]}function j0(){return Ee}function P0(i){return d.fromClass(function(){function n(t){A(this,n),this.view=t,this.placeholder=m.set([m.widget({widget:new Ae(i),side:1}).range(0)])}return D(n,[{key:"decorations",get:function t(){return this.view.state.doc.length?m.none:this.placeholder}}]),n}(),{decorations:function t(n){return n.decorations}})}function O0(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y,e=Math.min(n.line,i.line),r=Math.max(n.line,i.line),o=[];if(n.off>De||i.off>De||n.col<0||i.col<0)for(u=Math.min(n.off,i.off),s=Math.max(n.off,i.off),a=e;a<=r;a++)(f=t.doc.line(a)).length<=s&&o.push(O.range(f.from+u,f.to+s));else for(h=Math.min(n.col,i.col),c=Math.max(n.col,i.col),l=e;l<=r;l++)(d=ec((v=t.doc.line(l)).text,h,t.tabSize,!0))<0?o.push(O.cursor(v.to)):(y=ec(v.text,c,t.tabSize),o.push(O.range(v.from+d,v.from+y)));return o}function E0(t,n){var i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-n)/t.defaultCharacterWidth)):-1}function A0(t,n){var i,e,r,n,i=t.posAtCoords({x:n.clientX,y:n.clientY},!1),e=t.state.doc.lineAt(i),r=i-e.from,n=De<r?-1:r==e.length?E0(t,n.clientX):ic(e.text,t.state.tabSize,i-e.from);return{line:e.number,col:n,off:r}}function D0(r,t){var o=A0(r,t),u=r.state.selection;return o?{update:function t(n){var i,i;n.docChanged&&(i=n.changes.mapPos(n.startState.doc.line(o.line).from),i=n.state.doc.lineAt(i),o={line:i.number,col:o.col,off:Math.min(o.off,i.length)},u=u.map(n.changes))},get:function t(n,i,e){var n,n,n=A0(r,n);return n&&(n=O0(r.state,o,n)).length?e?O.create(n.concat(u.ranges)):O.create(n):u}}:null}function R0(t){var i=(null==t?void 0:t.eventFilter)||function(t){return t.altKey&&0==t.button};return w.mouseSelectionStyle.of(function(t,n){return i(n)?D0(t,n):null})}function I0(){var t,n,i,e,r,t,n=Gf(Re[(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).key||"Alt"],2),i=n[0],e=n[1],r=d.fromClass(function(){function n(t){A(this,n),this.view=t,this.isDown=!1}return D(n,[{key:"set",value:function t(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}}]),n}(),{eventHandlers:{keydown:function t(n){this.set(n.keyCode==i||e(n))},keyup:function t(n){n.keyCode!=i&&e(n)||this.set(!1)},mousemove:function t(n){this.set(e(n))}}});return[r,w.contentAttributes.of(function(t){var t;return null!=(t=t.plugin(r))&&t.isDown?Ie:null})]}function T0(){var t;return Be.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}function L0(t){var t=t.win;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}function B0(t){for(var n=t;n;n=n.parentNode)if(1==n.nodeType&&n.classList.contains("cm-tooltip"))return 1}function _0(t,n,i,e,r,o){var u,n,t,s,a,f,h,u=document.createRange(),n=t.domAtPos(n),t=t.domAtPos(i);for(u.setEnd(t.node,t.offset),u.setStart(n.node,n.offset),s=u.getClientRects(),u.detach(),a=0;a<s.length;a++)if(f=s[a],(h=Math.max(f.top-r,r-f.bottom,f.left-e,e-f.right))<=o)return 1}function F0(n){var a,f,i,a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},f=v.define(),i=b.define({create:function t(){return null},update:function t(n,i){var e,r,o,u,s;if(n&&(a.hideOnChange&&(i.docChanged||i.selection)||a.hideOn&&a.hideOn(i,n)))return null;if(n&&i.docChanged){if(null==(e=i.changes.mapPos(n.pos,-1,h.TrackDel)))return null;(r=Object.assign(Object.create(null),n)).pos=e,null!=n.end&&(r.end=i.changes.mapPos(n.end)),n=r}o=F(i.effects);try{for(o.s();!(u=o.n()).done;)(s=u.value).is(f)&&(n=s.value),s.is($e)&&(n=null)}catch(t){o.e(t)}finally{o.f()}return n},provide:function t(n){return He.from(n)}});return[i,d.define(function(t){return new Ve(t,n,i,f,a.hoverTime||300)}),We]}function N0(t,n){var t,n,t=t.plugin(Fe);return!t||(n=t.manager.tooltips.indexOf(n))<0?null:t.manager.tooltipViews[n]}function U0(t){return t.facet(He).some(function(t){return t})}function H0(t){var t;null!=(t=t.plugin(Fe))&&t.maybeMeasure()}function z0(t){return t?[qe.of(t)]:[]}function W0(t,n){var t,n,t=t.plugin(Ge),n=t?t.specs.indexOf(n):-1;return-1<n?t.panels[n]:null}function V0(t){var n=t.nextSibling;return t.remove(),n}function $0(t){return[q0(),Ze.of(Object.assign(Object.assign({},Xe),t))]}function q0(t){var n=[tr];return t&&!1===t.fixed&&n.push(Ye.of(!0)),n}function G0(t){return Array.isArray(t)?t:[t]}function J0(t,n,i){for(;t.value&&t.from<=i;)t.from==i&&n.push(t.value),t.next()}function K0(t,n){if(t.length==n.length){for(var i=0;i<t.length;i++)if(!t[i].compare(n[i]))return;return 1}}function Q0(t,n){return t.state.facet(or).formatNumber(n,t.state)}function X0(){var t;return[or.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),q0(),sr]}function Z0(t){for(var n=9;n<t;)n=10*n+9;return n}function Y0(){return fr}function tv(t){var n=hr.get(t);return n||hr.set(t,n=m.mark({attributes:"\t"===t?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":t.replace(/ /g,"\xb7")}})),n}function nv(i){return d.define(function(t){return{decorations:i.createDeco(t),update:function t(n){this.decorations=i.updateDeco(n,this.decorations)}}},{decorations:function t(n){return n.decorations}})}function iv(){return cr}function ev(){return lr}function rv(t,n,i,e){switch(t){case-2:return i<n;case-1:return n<=e&&i<n;case 0:return i<n&&n<e;case 1:return i<=n&&n<e;case 2:return n<e;case 4:return 1}}function ov(t,n){for(var i,e,i=t.childBefore(n);i&&(e=i.lastChild)&&e.to==i.to;)i=e.type.isError&&e.from==e.to?(t=i,e.prevSibling):e;return t}function uv(t,n,i,e){for(var r,o,u,s,a,f;t.from==t.to||(i<1?t.from>=n:t.from>n)||(-1<i?t.to<=n:t.to<n);){if(!(o=!e&&t instanceof Sr&&t.index<0?null:t.parent))return t;t=o}if(u=e?0:br.IgnoreOverlays,e)for(a=(s=t).parent;a;a=(s=a).parent)s instanceof Sr&&s.index<0&&(null==(r=a.enter(n,i,u))?void 0:r.from)!=s.from&&(t=a);for(;;){if(!(f=t.enter(n,i,u)))return t;t=f}}function sv(t,n,i,e){var r=t.cursor(),o=[];if(!r.firstChild())return o;if(null!=i)for(;!r.type.is(i);)if(!r.nextSibling())return o;for(;;){if(null!=e&&r.type.is(e))return o;if(r.type.is(n)&&o.push(r.node),!r.nextSibling())return null==e?o:[]}}function av(t,n,i){for(var e,r,e=2<arguments.length&&void 0!==i?i:n.length-1,r=t.parent;0<=e;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(n[e]&&n[e]!=r.name)return!1;e--}}return!0}function fv(t){return t.children.some(function(t){return t instanceof xr||!t.type.isAnonymous||fv(t)})}function hv(t){var n,i,S,n,C,n,j,n,P,O,E,A,D,e,r,i;function R(t,n,i,e,r){for(var o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,n,o=O.id,u=O.start,s=O.end,a=O.size,f=D;a<0;){if(O.next(),-1==a)return h=j[o],i.push(h),void e.push(u-t);if(-3==a)return void(A=o);if(-4==a)return void(D=o);throw new RangeError("Unrecognized record size: ".concat(a))}if(c=E[o],d=u-t,s-u<=C&&(v=B(O.pos-n,r))){for(y=new Uint16Array(v.size-v.skip),m=O.pos-v.size,p=y.length;O.pos>m;)p=_(v.start,y,p);l=new xr(y,s-v.start,S),d=v.start-t}else{for(k=O.pos-a,O.next(),g=[],w=[],b=P<=o?o:-1,M=0,x=s;O.pos>k;)0<=b&&O.id==b&&0<=O.size?(O.end<=x-C&&(T(g,w,u,M,O.end,x,b,f),M=g.length,x=O.end),O.next()):R(u,k,g,w,b);0<=b&&0<M&&M<g.length&&T(g,w,u,M,u,x,b,f),g.reverse(),w.reverse(),l=-1<b&&0<M?(n=I(c),lv(c,g,w,0,g.length,0,s-u,n,n)):L(c,g,w,s-u,f-s)}i.push(l),e.push(d)}function I(s){return function(t,n,i){var e=0,r=t.length-1,o,u;if(0<=r&&(o=t[r])instanceof x){if(!r&&o.type==s&&o.length==i)return o;(u=o.prop(M.lookAhead))&&(e=n[r]+o.length+u)}return L(s,t,n,i,e)}}function T(t,n,i,e,r,o,u,s){for(var a=[],f=[];t.length>e;)a.push(t.pop()),f.push(n.pop()+i-r);t.push(L(S.types[u],a,f,o-r,s-o)),n.push(r-i)}function L(t,n,i,e,r,o){var r,o,u,u,r=4<arguments.length&&void 0!==r?r:0,o=5<arguments.length?o:void 0;return A&&(u=[M.contextHash,A],o=o?[u].concat(o):[u]),25<r&&(u=[M.lookAhead,r],o=o?[u].concat(o):[u]),new x(t,n,i,e,o)}function B(t,n){var i,e,r,o,u,s,a,f,h,c,l,i=O.fork(),e=0,r=0,o=0,u=i.end-C,s={size:0,start:0,skip:0};t:for(a=i.pos-t;i.pos>a;)if(f=i.size,i.id==n&&0<=f)s.size=e,s.start=r,s.skip=o,o+=4,e+=4,i.next();else{if(h=i.pos-f,f<0||h<a||i.start<u)break;for(c=i.id>=P?4:0,l=i.start,i.next();i.pos>h;){if(i.size<0){if(-3!=i.size)break t;c+=4}else i.id>=P&&(c+=4);i.next()}r=l,e+=f,o+=c}return(n<0||e==t)&&(s.size=e,s.start=r,s.skip=o),4<s.size?s:void 0}function _(t,n,i){var e,r,o,u,s,a,e=O.id,r=O.start,o=O.end,u=O.size;if(O.next(),0<=u&&e<P){if(s=i,4<u)for(a=O.pos-(u-4);O.pos>a;)i=_(t,n,i);n[--i]=s,n[--i]=o-t,n[--i]=r-t,n[--i]=e}else-3==u?A=e:-4==u&&(D=e);return i}for(i=t.buffer,S=t.nodeSet,n=t.maxBufferLength,C=void 0===n?dr:n,n=t.reused,j=void 0===n?[]:n,n=t.minRepeatType,P=void 0===n?S.types.length:n,O=Array.isArray(i)?new Mr(i,i.length):i,E=S.types,D=A=0,e=[],r=[];0<O.pos;)R(t.start||0,t.bufferStart||0,e,r,-1);return i=null!=(n=t.length)?n:e.length?r[0]+e[0].length:0,new x(E[t.topID],e.reverse(),r.reverse(),i)}function cv(t,n){var i,e,r,o;if(!t.isAnonymous||n instanceof xr||n.type!=t)return 1;if(null==(i=Or.get(n))){i=1,e=F(n.children);try{for(e.s();!(r=e.n()).done;){if((o=r.value).type!=t||!(o instanceof x)){i=1;break}i+=cv(t,o)}}catch(t){e.e(t)}finally{e.f()}Or.set(n,i)}return i}function lv(c,t,n,i,e,l,r,o,v){for(var u,s,d,y,m,u=0,s=i;s<e;s++)u+=cv(c,t[s]);function p(t,n,i,e,r){for(var o,u,s,a,f,h,h,o=i;o<e;){for(s=n[u=o],a=cv(c,t[o]),o++;o<e&&(f=cv(c,t[o]),!(d<=a+f));o++)a+=f;if(o==u+1){if(d<a){p((h=t[u]).children,h.positions,0,h.children.length,n[u]+r);continue}y.push(t[u])}else h=n[o-1]+t[o-1].length-s,y.push(lv(c,t,n,u,o,s,h,null,v));m.push(s+r-l)}}return d=Math.ceil(1.5*u/8),y=[],m=[],p(t,n,i,e,0),(o||v)(y,m,r)}function vv(t,i){return t.length==i.length&&t.every(function(t,n){return t==i[n]})}function dv(t){for(var n,i,e,r,n=[[]],i=0;i<t.length;i++)for(e=0,r=n.length;e<r;e++)n.push(n[e].concat(t[i]));return n.sort(function(t,n){return n.length-t.length})}function yv(t){var n,i,e,r,o,u,s,a,f,h,c,l,v,d,y,n=Object.create(null);for(i in t){e=t[i],Array.isArray(e)||(e=[e]),r=F(i.split(" "));try{for(r.s();!(o=r.n()).done;)if(u=o.value){for(s=[],a=2,f=u,h=0;;){if("..."==f&&0<h&&h+3==u.length){a=1;break}if(!(c=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(f)))throw new RangeError("Invalid path: "+u);if(s.push("*"==c[0]?"":'"'==c[0][0]?JSON.parse(c[0]):c[0]),(h+=c[0].length)==u.length)break;if(l=u[h++],h==u.length&&"!"==l){a=0;break}if("/"!=l)throw new RangeError("Invalid path: "+u);f=u.slice(h)}if(!(d=s[v=s.length-1]))throw new RangeError("Invalid path: "+u);y=new _r(e,a,0<v?s.slice(0,v):null),n[d]=y.sort(n[d])}}catch(t){r.e(t)}finally{r.f()}}return Br.add(n)}function mv(t,n){var h,i,e,r,o,u,s,t,n,t,c,h=Object.create(null),i=F(t);try{for(i.s();!(e=i.n()).done;)if(r=e.value,Array.isArray(r.tag)){o=F(r.tag);try{for(o.s();!(u=o.n()).done;)s=u.value,h[s.id]=r.class}catch(t){o.e(t)}finally{o.f()}}else h[r.tag.id]=r.class}catch(t){i.e(t)}finally{i.f()}return n=(t=n||{}).scope,t=t.all,c=void 0===t?null:t,{style:function t(n){var i,e,r,o,u,s,a,f,i=c,e=F(n);try{for(e.s();!(r=e.n()).done;){u=F((o=r.value).set);try{for(u.s();!(s=u.n()).done;)if(a=s.value,f=h[a.id]){i=i?i+" "+f:f;break}}catch(t){u.e(t)}finally{u.f()}}}catch(t){e.e(t)}finally{e.f()}return i},scope:n}}function pv(t,n){var i,e,r,o,u,i=null,e=F(t);try{for(e.s();!(r=e.n()).done;)(u=(o=r.value).style(n))&&(i=i?i+" "+u:u)}catch(t){e.e(t)}finally{e.f()}return i}function kv(t,n,i,e,r){var e,r,n,e=3<arguments.length&&void 0!==e?e:0,r=4<arguments.length&&void 0!==r?r:t.length,n=new Fr(e,Array.isArray(n)?n:[n],i);n.highlightRange(t.cursor(),e,r,"",n.highlighters),n.flush(r)}function gv(t){for(var n=t.type.prop(Br);n&&n.context&&!t.matchContext(n.context);)n=n.next;return n||null}function wv(n){return y.define({combine:n?function(t){return t.concat(n)}:void 0})}function bv(t,n,i){var e,r,o,e=t.facet(io),r=R(t).topNode;if(!e||e.allowsNesting)for(o=r;o;o=o.enter(n,i,br.ExcludeBuffers))o.type.isTop&&(r=o);return r}function R(t){var t=t.field(Jr.state,!1);return t?t.tree:x.empty}function Mv(t,n){var i,t,t,e,i,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:50,t=null==(t=t.field(Jr.state,!1))?void 0:t.context;return t?(e=t.viewport,t.updateViewport({from:0,to:n}),i=t.isDone(n)||t.work(i,n)?t.tree:null,t.updateViewport(e),i):null}function xv(t){var n,t,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t.doc.length;return(null==(t=t.field(Jr.state,!1))?void 0:t.context.isDone(n))||!1}function Sv(t){var n,i,n,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t.viewport.to,i,n=Mv(t.state,n,2<arguments.length&&void 0!==arguments[2]?arguments[2]:100);return n!=R(t.state)&&t.dispatch({}),!!n}function Cv(t){var t;return(null==(t=t.plugin(no))?void 0:t.isWorking())||!1}function jv(t,n,i){return Er.applyChanges(t,[{fromA:n,toA:i,fromB:n,toB:i}])}function Pv(t){var n=t.facet(ro);return 9==n.charCodeAt(0)?t.tabSize*n.length:n.length}function Ov(t,n){var i,e,r,o,i="",e=t.tabSize,r=t.facet(ro)[0];if("\t"==r){for(;e<=n;)i+="\t",n-=e;r=" "}for(o=0;o<n;o++)i+=r;return i}function Ev(t,n){var i,e,r,o,u,i=F((t=t instanceof C?new oo(t):t).state.facet(eo));try{for(i.s();!(e=i.n()).done;)if(void 0!==(o=(r=e.value)(t,n)))return o}catch(t){i.e(t)}finally{i.f()}return(u=R(t.state))?Dv(t,u,n):null}function Av(t,n,i){for(var e,r,o,u,s,a,f,h,e=Object.create(null),r=new oo(t,{overrideIndentation:function t(n){var n;return null!=(n=e[n])?n:-1}}),o=[],u=n;u<=i;)u=(s=t.doc.lineAt(u)).to+1,null!=(a=Ev(r,s.from))&&(/\S/.test(s.text)||(a=0),(f=/^\s*/.exec(s.text)[0])!=(h=Ov(t,a)))&&(e[s.from]=a,o.push({from:s.from,to:s.from+f.length,insert:h}));return t.changes(o)}function Dv(t,n,i){return Tv(n.resolveInner(i).enterUnfinishedNodesBefore(i),i,t)}function Rv(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Iv(t){var n,n,n,i,e,n=t.type.prop(uo);return n||((n=t.firstChild)&&(n=n.type.prop(M.closedBy))?(i=t.lastChild,e=i&&-1<n.indexOf(i.name),function(t){return Nv(t,!0,1,void 0,e&&!Rv(t)?i.from:void 0)}):null==t.parent?Lv:null)}function Tv(t,n,i){for(;t;t=t.parent){var e=Iv(t);if(e)return e(so.create(i,n,t))}return null}function Lv(){return 0}function Bv(t,n){for(var i=n;i;i=i.parent)if(t==i)return 1}function _v(t){var n,i,e,r,t,o,u,s,n=t.node,i=n.childAfter(n.from),e=n.lastChild;if(!i)return null;for(r=t.options.simulateBreak,t=t.state.doc.lineAt(i.from),o=null==r||r<=t.from?t.to:Math.min(t.to,r),u=i.to;;){if(!(s=n.childAfter(u))||s==e)return null;if(!s.type.isSkipped)return s.from<o?i:null;u=s.to}}function Fv(t){var n=t.closing,i=t.align,e=void 0===i||i,i=t.units,r=void 0===i?1:i;return function(t){return Nv(t,e,r,n)}}function Nv(t,n,i,e,r){var o,u,o,e,o=t.textAfter,u=o.match(/^\s*/)[0].length,o=e&&o.slice(u,u+e.length)==e||r==t.pos+u,e=n?_v(t):null;return e?o?t.column(e.from):t.column(e.to):t.baseIndent+(o?0:t.unit*i)}function Uv(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=t.except,t=t.units,e=void 0===t?1:t;return function(t){var n=i&&i.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}function Hv(){return C.transactionFilter.of(function(t){var n,i,e,r,o,u,s,a,f,h,c,l,v,d,y;if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;if(!(n=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head)).length)return t;if(i=t.newDoc,(e=t.newSelection.main.head)>(r=i.lineAt(e)).from+ao)return t;if(o=i.sliceString(r.from,e),!n.some(function(t){return t.test(o)}))return t;s=-1,a=[],f=F((u=t.state).selection.ranges);try{for(f.s();!(h=f.n()).done;)c=h.value.head,(l=u.doc.lineAt(c)).from!=s&&(s=l.from,null!=(v=Ev(u,l.from)))&&(d=/^\s*/.exec(l.text)[0])!=(y=Ov(u,v))&&a.push({from:l.from,to:l.from+d.length,insert:y})}catch(t){f.e(t)}finally{f.f()}return a.length?[t,{changes:a,sequential:!0}]:t})}function zv(t){var n=t.firstChild,i=t.lastChild;return n&&n.to<i.from?{from:n.to,to:i.type.isError?t.to:i.from}:null}function Wv(t,n,i){var e,r,o,u,s,s,e=R(t);if(e.length<i)return null;for(o=null,u=r=e.resolveInner(i,1);u;u=u.parent)if(!(u.to<=i||u.from>i)){if(o&&u.from<n)break;(s=u.type.prop(ho))&&(u.to<e.length-50||e.length==t.doc.length||!Vv(u))&&(s=s(u,t))&&s.from<=i&&s.from>=n&&s.to>i&&(o=s)}return o}function Vv(t){var n=t.lastChild;return n&&n.to==t.to&&n.type.isError}function $v(t,n,i){var e,r,o,u,e=F(t.facet(fo));try{for(e.s();!(r=e.n()).done;)if(u=(o=r.value)(t,n,i))return u}catch(t){e.e(t)}finally{e.f()}return Wv(t,n,i)}function qv(t,n){var i=n.mapPos(t.from,1),n=n.mapPos(t.to,-1);return n<=i?void 0:{from:i,to:n}}function Gv(i){var e,n,r,t,e=[],n=F(i.state.selection.ranges);try{for(t=function t(){var n=r.value.head;if(e.some(function(t){return t.from<=n&&t.to>=n}))return 1;e.push(i.lineBlockAt(n))},n.s();!(r=n.n()).done;)t()}catch(t){n.e(t)}finally{n.f()}return e}function Jv(t){return t.field(vo,!1)||j.empty}function Kv(t,n,i){var t,e,e=null;return null!=(t=t.field(vo,!1))&&t.between(n,i,function(t,n){(!e||e.from>t)&&(e={from:t,to:n})}),e}function Qv(t,i,e){var r=!1;return t.between(i,i,function(t,n){t==i&&n==e&&(r=!0)}),r}function Xv(t,n){return t.field(vo,!1)?n:n.concat(v.appendConfig.of(td()))}function Zv(t,n,i){var i,e,n,i=!(2<arguments.length&&void 0!==i)||i,e=t.state.doc.lineAt(n.from).number,n=t.state.doc.lineAt(n.to).number;return w.announce.of("".concat(t.state.phrase(i?"Folded lines":"Unfolded lines")," ").concat(e," ").concat(t.state.phrase("to")," ").concat(n,"."))}function Yv(t,n){for(var i,e,i=n;;){if((e=$v(t.state,i.from,i.to))&&e.to>n.from)return e;if(!i.from)return null;i=t.lineBlockAt(i.from-1)}}function td(t){var n=[vo,bo];return t&&n.push(po.of(t)),n}function nd(){var t,i,s,a,e,r,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=Object.assign(Object.assign({},go),t),s=new wo(i,!0),a=new wo(i,!1),e=d.fromClass(function(){function n(t){A(this,n),this.from=t.viewport.from,this.markers=this.buildMarkers(t)}return D(n,[{key:"update",value:function t(n){(n.docChanged||n.viewportChanged||n.startState.facet(io)!=n.state.facet(io)||n.startState.field(vo,!1)!=n.state.field(vo,!1)||R(n.startState)!=R(n.state)||i.foldingChanged(n))&&(this.markers=this.buildMarkers(n.view))}},{key:"buildMarkers",value:function t(n){var i,e,r,o,u,i=new Et,e=F(n.viewportLineBlocks);try{for(e.s();!(r=e.n()).done;)o=r.value,(u=Kv(n.state,o.from,o.to)?a:$v(n.state,o.from,o.to)?s:null)&&i.add(o.from,o.from,u)}catch(t){e.e(t)}finally{e.f()}return i.finish()}}]),n}()),r=i.domEventHandlers;return[e,$0({class:"cm-foldGutter",markers:function t(n){var n;return(null==(n=n.plugin(e))?void 0:n.markers)||j.empty},initialSpacer:function t(){return new wo(i,!1)},domEventHandlers:Object.assign(Object.assign({},r),{click:function t(n,i,e){var e,e;return!((!r.click||!r.click(n,i,e))&&((e=Kv(n.state,i.from,i.to))?(n.dispatch({effects:lo.of(e)}),0):!(e=$v(n.state,i.from,i.to))||(n.dispatch({effects:co.of(e)}),0)))}})}),td()]}function id(t){var n=t.facet(xo);return n.length?n:t.facet(So)}function ed(n,t){var i=[Co],e;return n instanceof Mo&&(n.module&&i.push(w.styleModule.of(n.module)),e=n.themeType),null!=t&&t.fallback?i.push(So.of(n)):i.push(e?xo.computeN([w.darkTheme],function(t){return t.facet(w.darkTheme)==("dark"==e)?[n]:[]}):xo.of(n)),i}function rd(t,n,i){var t,e,r,o,u,s,t=id(t),e=null;if(t){r=F(t);try{for(r.s();!(o=r.n()).done;)(!(u=o.value).scope||i&&u.scope(i))&&(s=u.style(n))&&(e=e?e+" "+s:s)}catch(t){r.e(t)}finally{r.f()}}return e}function od(t){var n,i,n=[],i=t.matched?Ao:Do;return n.push(i.range(t.start.from,t.start.to)),t.end&&n.push(i.range(t.end.from,t.end.to)),n}function ud(){var t;return[Eo.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),Io]}function sd(t,n,i){var e,e,e=t.prop(n<0?M.openedBy:M.closedBy);return e||(1==t.name.length&&-1<(e=i.indexOf(t.name))&&e%2==(n<0?1:0)?[i[e+n]]:null)}function ad(t){var n=t.type.prop(To);return n?n(t.node):t}function fd(t,n,i){for(var e,r,o,e,u,s,a,f,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},r=e.maxScanDistance||Po,o=e.brackets||Oo,e=R(t),u=e.resolveInner(n,i),s=u;s;s=s.parent)if((a=sd(s.type,i,o))&&s.from<s.to&&(f=ad(s))&&(0<i?n>=f.from&&n<f.to:n>f.from&&n<=f.to))return hd(t,n,i,s,f,a,o);return cd(t,n,i,e,u.type,r,o)}function hd(t,n,i,e,r,o,u){var s,a,f,h,c,c,s=e.parent,a={from:r.from,to:r.to},f=0,h=null==s?void 0:s.cursor();if(h&&(i<0?h.childBefore(e.from):h.childAfter(e.to)))do{if(i<0?h.to<=e.from:h.from>=e.to){if(0==f&&-1<o.indexOf(h.type.name)&&h.from<h.to)return{start:a,end:(c=ad(h))?{from:c.from,to:c.to}:void 0,matched:!0};if(sd(h.type,i,u))f++;else if(sd(h.type,-i,u)){if(0==f)return{start:a,end:(c=ad(h))&&c.from<c.to?{from:c.from,to:c.to}:void 0,matched:!1};f--}}}while(i<0?h.prevSibling():h.nextSibling());return{start:a,matched:!1}}function cd(t,n,i,e,r,o,u){var s,a,f,h,c,l,v,d,y,m,p,s=i<0?t.sliceDoc(n-1,n):t.sliceDoc(n,n+1),a=u.indexOf(s);if(a<0||a%2==0!=0<i)return null;for(f={from:i<0?n-1:n,to:0<i?n+1:n},h=t.doc.iterRange(n,0<i?t.doc.length:0),l=c=0;!h.next().done&&l<=o;){for(v=h.value,i<0&&(l+=v.length),d=n+l*i,y=0<i?0:v.length-1,m=0<i?v.length:-1;y!=m;y+=i)if(!((p=u.indexOf(v[y]))<0||e.resolveInner(d+y,1).type!=r))if(p%2==0==0<i)c++;else{if(1==c)return{start:f,end:{from:d+y,to:d+y+1},matched:p>>1==a>>1};c--}0<i&&(l+=v.length)}return h.done?{start:f,matched:!1}:null}function ld(t,n,i,e,r){var e,r,o,u,e=3<arguments.length&&void 0!==e?e:0,r=4<arguments.length&&void 0!==r?r:0;for(null==n&&-1==(n=t.search(/[^\s\u00a0]/))&&(n=t.length),o=r,u=e;u<n;u++)9==t.charCodeAt(u)?o+=i-o%i:o++;return o}function vd(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||function(){},startState:t.startState||function(){return!0},copyState:t.copyState||dd,indent:t.indent||function(){return null},languageData:t.languageData||{},tokenTable:t.tokenTable||Fo}}function dd(t){var n,i,e;if("object"!=uh(t))return t;for(i in n={},t)e=t[i],n[i]=e instanceof Array?e.slice():e;return n}function yd(t,n,i,e,r){var o,u,s,a,s,o=e<=i&&i+n.length<=r&&n.prop(t.stateAfter);if(o)return{state:t.streamParser.copyState(o),pos:i+n.length};for(u=n.children.length-1;0<=u;u--)if(s=n.children[u],a=i+n.positions[u],s=s instanceof x&&a<r&&yd(t,s,a,e,r))return s;return null}function md(t,n,i,e,r){var o,u,s,a;if(r&&i<=0&&e>=n.length)return n;for(r||n.type!=t.topNode||(r=!0),o=n.children.length-1;0<=o;o--)if(u=n.positions[o],s=n.children[o],a=void 0,u<e&&s instanceof x){if(a=md(t,s,i-u,e-u,r))return r?new x(n.type,n.children.slice(0,o).concat(a),n.positions.slice(0,o+1),u+a.length):a;break}return null}function pd(t,n,i,e){var r,o,u,s,a,f,h,r=F(n);try{for(r.s();!(o=r.n()).done;)if(s=(u=o.value).from+(u.openStart?25:0),a=u.to-(u.openEnd?25:0),f=s<=i&&i<a&&yd(t,u.tree,0-u.offset,i,a),h=void 0,f&&(h=md(t,u.tree,i+u.offset,f.pos+u.offset,!1)))return{state:f.state,tree:h}}catch(t){r.e(t)}finally{r.f()}return{state:t.streamParser.startState(e?Pv(e):4),tree:x.empty}}function kd(t,n,i){var e,r;for(n.start=n.pos,e=0;e<10;e++)if(r=t(n,i),n.pos>n.start)return r;throw new Error("Stream parser failed to advance stream.")}for(Qn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Xn=function(){function e(t,n,i){A(this,e),this.from=t,this.to=n,this.level=i}return D(e,[{key:"dir",get:function t(){return this.level%2?Hn:Un}},{key:"side",value:function t(n,i){return this.dir==i==n?this.to:this.from}}],[{key:"find",value:function t(n,i,e,r){for(var o,u,s,o=-1,u=0;u<n.length;u++)if((s=n[u]).from<=i&&s.to>=i){if(s.level==e)return u;(o<0||(0!=r?r<0?s.from<i:s.to>i:n[o].level>s.level))&&(o=u)}if(o<0)throw new RangeError("Index out of range");return o}}]),e}(),z=[],Zn="",Yn="\uffff",ti=function(){function i(t,n){A(this,i),this.points=t,this.text="",this.lineSeparator=n.facet(C.lineSeparator)}return D(i,[{key:"append",value:function t(n){this.text+=n}},{key:"lineBreak",value:function t(){this.text+=Yn}},{key:"readRange",value:function t(n,i){var e,r,o,u,s,a;if(n){for(e=n.parentNode,r=n;this.findPointBefore(e,r),o=this.text.length,this.readNode(r),(u=r.nextSibling)!=i;)s=c.get(r),a=c.get(u),(s&&a?s.breakAfter:(s?s.breakAfter:Qc(r))||Qc(u)&&("BR"!=r.nodeName||r.cmIgnore)&&this.text.length>o)&&this.lineBreak(),r=u;this.findPointBefore(e,i)}return this}},{key:"readTextNode",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,i=n.nodeValue,e=F(this.points);try{for(e.s();!(r=e.n()).done;)(o=r.value).node==n&&(o.pos=this.text.length+Math.min(o.offset,i.length))}catch(t){e.e(t)}finally{e.f()}for(u=0,s=this.lineSeparator?null:/\r\n?|\n/g;a=-1,f=1,h=void 0,this.lineSeparator?(a=i.indexOf(this.lineSeparator,u),f=this.lineSeparator.length):(h=s.exec(i))&&(a=h.index,f=h[0].length),this.append(i.slice(u,a<0?i.length:a)),!(a<0);){if(this.lineBreak(),1<f){c=F(this.points);try{for(c.s();!(l=c.n()).done;)(v=l.value).node==n&&v.pos>this.text.length&&(v.pos-=f-1)}catch(t){c.e(t)}finally{c.f()}}u=a+f}}},{key:"readNode",value:function t(n){var i,i,e;if(!n.cmIgnore)if(null!=(i=(i=c.get(n))&&i.overrideDOMText))for(this.findPointInside(n,i.length),e=i.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value);else 3==n.nodeType?this.readTextNode(n):"BR"==n.nodeName?n.nextSibling&&this.lineBreak():1==n.nodeType&&this.readRange(n.firstChild,null)}},{key:"findPointBefore",value:function t(n,i){var e,r,o,e=F(this.points);try{for(e.s();!(r=e.n()).done;)(o=r.value).node==n&&n.childNodes[o.offset]==i&&(o.pos=this.text.length)}catch(t){e.e(t)}finally{e.f()}}},{key:"findPointInside",value:function t(n,i){var e,r,o,e=F(this.points);try{for(e.s();!(r=e.n()).done;)o=r.value,(3==n.nodeType?o.node==n:n.contains(o.node))&&(o.pos=this.text.length+Math.min(i,o.offset))}catch(t){e.e(t)}finally{e.f()}}}]),i}(),ni=D(function t(n,i){A(this,t),this.node=n,this.offset=i,this.pos=-1}),ii=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).view=t,n.compositionDeco=m.none,n.decorations=[],n.dynamicDecorationMap=[],n.minWidth=0,n.minWidthFrom=0,n.minWidthTo=0,n.impreciseAnchor=null,n.impreciseHead=null,n.forceSelection=!1,n.lastUpdate=Date.now(),n.setDOM(t.contentDOM),n.children=[new vn],n.children[0].setParent(eh(n)),n.updateDeco(),n.updateInner([new Fn(0,0,0,t.state.doc.length)],0),n}return D(e,[{key:"length",get:function t(){return this.view.state.doc.length}},{key:"update",value:function t(n){var e,i,r,o,u,e=this,i=n.changedRanges;return 0<this.minWidth&&i.length&&(i.every(function(t){var n=t.fromA,i;return t.toA<e.minWidthFrom||n>e.minWidthTo})?(this.minWidthFrom=n.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=n.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=m.none:(n.transactions.length||this.dirty)&&(this.compositionDeco=Yc(this.view,n.changes)),(g.ie||g.chrome)&&!this.compositionDeco.size&&n&&n.state.doc.lines!=n.startState.doc.lines&&(this.forceSelection=!0),u=il(r=this.decorations,o=this.updateDeco(),n.changes),i=Fn.extendWithRanges(i,u),(0!=this.dirty||0!=i.length)&&(this.updateInner(i,n.startState.doc.length),n.transactions.length&&(this.lastUpdate=Date.now()),!0)}},{key:"updateInner",value:function t(n,i){var e,r,o,u,s,a,e=this;if(this.view.viewState.mustMeasureContent=!0,this.updateChildren(n,i),(r=this.view.observer).ignore(function(){e.dom.style.height=e.view.viewState.contentHeight+"px",e.dom.style.flexBasis=e.minWidth?e.minWidth+"px":"";var t=g.chrome||g.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;e.sync(e.view,t),e.dirty=0,t&&(t.written||r.selectionRange.focusNode!=t.node)&&(e.forceSelection=!0),e.dom.style.height=""}),o=[],this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){u=F(this.children);try{for(u.s();!(s=u.n()).done;)(a=s.value)instanceof dn&&a.widget instanceof ei&&o.push(a.dom)}catch(t){u.e(t)}finally{u.f()}}r.updateGaps(o)}},{key:"updateChildren",value:function t(n,i){for(var e,r,o,u,s,a,o,a,o,f,h,a,s,c,s,u,l,v,e=this.childCursor(i),r=n.length-1;o=0<=r?n[r]:null;r--)u=o.fromA,s=o.toA,a=o.fromB,o=o.toB,o=(a=yn.build(this.view.state.doc,a,o,this.decorations,this.dynamicDecorationMap)).content,f=a.breakAtStart,h=a.openStart,a=a.openEnd,c=(s=e.findPos(s,1)).i,s=s.off,Cc(this,l=(u=e.findPos(u,-1)).i,v=u.off,c,s,o,f,h,a)}},{key:"updateSelection",value:function t(){var e,n,i,r,n,o,n,u,s,a,f,h,e=this,n=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=1<arguments.length&&void 0!==arguments[1]&&arguments[1];!n&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange(),n=(r=this.view.root.activeElement)==this.dom,o=!n&&ac(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r)),(n||i||o)&&(n=this.forceSelection,this.forceSelection=!1,u=this.view.state.selection.main,s=this.domAtPos(u.anchor),a=u.empty?s:this.domAtPos(u.head),g.gecko&&u.empty&&!this.compositionDeco.size&&Xc(s)&&(f=document.createTextNode(""),this.view.observer.ignore(function(){return s.node.insertBefore(f,s.node.childNodes[s.offset]||null)}),s=a=new Kt(f,0),n=!0),h=this.view.observer.selectionRange,!n&&h.focusNode&&hc(s.node,s.offset,h.anchorNode,h.anchorOffset)&&hc(a.node,a.offset,h.focusNode,h.focusOffset)||(this.view.observer.ignore(function(){var t,n,i,n,i;if(g.android&&g.chrome&&e.dom.contains(h.focusNode)&&el(h.focusNode,e.dom)&&(e.dom.blur(),e.dom.focus({preventScroll:!0})),t=oc(e.view.root))if(u.empty)g.gecko&&(n=nl(s.node,s.offset))&&3!=n&&(i=tl(s.node,s.offset,1==n?1:-1))&&(s=new Kt(i,1==n?0:i.nodeValue.length)),t.collapse(s.node,s.offset),null!=u.bidiLevel&&null!=h.cursorBidiLevel&&(h.cursorBidiLevel=u.bidiLevel);else if(t.extend){t.collapse(s.node,s.offset);try{t.extend(a.node,a.offset)}catch(t){}}else n=document.createRange(),u.anchor>u.head&&(s=(i=[a,s])[0],a=i[1]),n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),t.removeAllRanges(),t.addRange(n);o&&e.view.root.activeElement==e.dom&&(e.dom.blur(),r)&&r.focus()}),this.view.observer.setSelectionRange(s,a)),this.impreciseAnchor=s.precise?null:new Kt(h.anchorNode,h.anchorOffset),this.impreciseHead=a.precise?null:new Kt(h.focusNode,h.focusOffset))}},{key:"enforceCursorAssoc",value:function t(){var n,i,e,r,o,r,u,s,s,u,s,u;this.compositionDeco.size||(i=(n=this.view).state.selection.main,e=oc(n.root),o=(r=n.observer.selectionRange).anchorNode,r=r.anchorOffset,e&&i.empty&&i.assoc&&e.modify&&(u=vn.find(this,i.head))&&(s=u.posAtStart,i.head==s||i.head==s+u.length||(s=this.coordsAt(i.head,-1),u=this.coordsAt(i.head,1),!s)||!u||s.bottom>u.top||(s=this.domAtPos(i.head+i.assoc),e.collapse(s.node,s.offset),e.modify("move",i.assoc<0?"forward":"backward","lineboundary"),n.observer.readSelectionRange(),u=n.observer.selectionRange,n.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=i.from&&e.collapse(o,r))))}},{key:"nearest",value:function t(n){for(var i,e,i=n;i;){if((e=c.get(i))&&e.rootView==this)return e;i=i.parentNode}return null}},{key:"posFromDOM",value:function t(n,i){var e=this.nearest(n);if(e)return e.localPosFromDOM(n,i)+e.posAtStart;throw new RangeError("Trying to find position for a DOM position outside of the document")}},{key:"domAtPos",value:function t(n){for(var n,i,e,r,n=this.childCursor().findPos(n,-1),i=n.i,e=n.off;i<this.children.length-1&&!(e<(r=this.children[i]).length||r instanceof vn);)i++,e=0;return this.children[i].domAtPos(e)}},{key:"coordsAt",value:function t(n,i){for(var e,r,o,u,e=this.length,r=this.children.length-1;;r--){if((u=e-(o=this.children[r]).breakAfter-o.length)<n||n==u&&o.type!=P.WidgetBefore&&o.type!=P.WidgetAfter&&(!r||2==i||this.children[r-1].breakAfter||this.children[r-1].type==P.WidgetBefore&&-2<i))return o.coordsAt(n-u,i);e=u}}},{key:"measureVisibleLineHeights",value:function t(n){for(var i,e,r,o,u,s,a,f,h,c,l,v,d,d,d,v,i=[],e=n.from,r=n.to,o=this.view.contentDOM.clientWidth,u=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==E.LTR,f=0,h=0;h<this.children.length&&!(r<(l=f+(c=this.children[h]).length));h++)e<=f&&(v=c.dom.getBoundingClientRect(),i.push(v.height),u)&&(d=(d=c.dom.lastChild)?fc(d):[]).length&&(d=d[d.length-1],s<(v=a?d.right-v.left:v.right-d.left))&&(s=v,this.minWidth=o,this.minWidthFrom=f,this.minWidthTo=l),f=l+c.breakAfter;return i}},{key:"textDirectionAt",value:function t(n){var i,n=this.childPos(n,1).i;return"rtl"==getComputedStyle(this.children[n].dom).direction?E.RTL:E.LTR}},{key:"measureTextSize",value:function t(){var n,i,e,r,o,u,s,a,f,n=this,i=F(this.children);try{for(i.s();!(e=i.n()).done;)if((r=e.value)instanceof vn&&(o=r.measureTextSize()))return o}catch(t){i.e(t)}finally{i.f()}return(u=document.createElement("div")).className="cm-line",u.style.width="99999px",u.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(function(){n.dom.appendChild(u);var t=fc(u.firstChild)[0];s=u.getBoundingClientRect().height,a=t?t.width/27:7,f=t?t.height:s,u.remove()}),{lineHeight:s,charWidth:a,textHeight:f}}},{key:"childCursor",value:function t(){var n,i,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.length,i=this.children.length;return i&&(n-=this.children[--i].length),new Xt(this.children,n,i)}},{key:"computeBlockGapDeco",value:function t(){for(var n,i,e,r,o,u,s,n=[],i=this.view.viewState,e=0,r=0;e<(u=(o=r==i.viewports.length?null:i.viewports[r])?o.from-1:this.length)&&(s=i.lineBlockAt(u).bottom-i.lineBlockAt(e).top,n.push(m.replace({widget:new ei(s),block:!0,inclusive:!0,isBlockGap:!0}).range(e,u))),o;r++)e=o.to+1;return m.set(n)}},{key:"updateDeco",value:function t(){for(var e,n,i,e=this,n=this.view.state.facet(Tn).map(function(t,n){var i;return(e.dynamicDecorationMap[n]="function"==typeof t)?t(e.view):t}),i=n.length;i<n.length+3;i++)this.dynamicDecorationMap[i]=!1;return this.decorations=[].concat(Wf(n),[this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco])}},{key:"scrollIntoView",value:function t(n){var i,e,r,r,e,i=n.range,e=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1);e&&(!i.empty&&(r=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(e={left:Math.min(e.left,r.left),top:Math.min(e.top,r.top),right:Math.max(e.right,r.right),bottom:Math.max(e.bottom,r.bottom)}),r=Vc(this.view),e={left:e.left-r.left,top:e.top-r.top,right:e.right+r.right,bottom:e.bottom+r.bottom},mc(this.view.scrollDOM,e,i.head<i.anchor?-1:1,n.x,n.y,n.xMargin,n.yMargin,this.view.textDirection==E.LTR))}}]),e}(c),ei=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).height=t,n}return D(e,[{key:"toDOM",value:function t(){var n=document.createElement("div");return this.updateDOM(n),n}},{key:"eq",value:function t(n){return n.height==this.height}},{key:"updateDOM",value:function t(n){return n.style.height=this.height+"px",!0}},{key:"estimatedHeight",get:function t(){return this.height}}]),e}(tn),ri=function(t){f(o,t);var r=S(o);function o(t,n,i){var e;return A(this,o),(e=r.call(this)).top=t,e.text=n,e.topView=i,e}return D(o,[{key:"eq",value:function t(n){return this.top==n.top&&this.text==n.text}},{key:"toDOM",value:function t(){return this.top}},{key:"ignoreEvent",value:function t(){return!1}},{key:"customView",get:function t(){return an}}]),o}(tn),oi=function(){function t(){A(this,t),this.changes=[]}return D(t,[{key:"compareRange",value:function t(n,i){Hc(n,i,this.changes)}},{key:"comparePoint",value:function t(n,i){Hc(n,i,this.changes)}}]),t}(),ui=function(){function n(e){var r,i,t,o,r=this;for(o in A(this,n),this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,i=function t(n,i){r.ignoreDuringComposition(i)||"keydown"==i.type&&r.keydown(e,i)||(r.mustFlushObserver(i)&&e.observer.forceFlush(),r.runCustomHandlers(i.type,e,i)?i.preventDefault():n(e,i))},t=function t(){var n=s[o];e.contentDOM.addEventListener(o,function(t){jl(e,t)&&i(n,t)},li[o]),r.registeredEvents.push(o)},s)t();e.scrollDOM.addEventListener("mousedown",function(t){var n;t.target==e.scrollDOM&&t.clientY>e.contentDOM.getBoundingClientRect().bottom&&(i(s.mousedown,t),t.defaultPrevented||2!=t.button||(n=e.contentDOM.style.minHeight,e.contentDOM.style.minHeight="100%",setTimeout(function(){return e.contentDOM.style.minHeight=n},200)))}),e.scrollDOM.addEventListener("drop",function(t){t.target==e.scrollDOM&&t.clientY>e.contentDOM.getBoundingClientRect().bottom&&i(s.drop,t)}),g.chrome&&102==g.chrome_version&&e.scrollDOM.addEventListener("wheel",function(){r.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(r.chromeScrollHack),r.chromeScrollHack=setTimeout(function(){r.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,g.safari&&e.contentDOM.addEventListener("input",function(){return null})}return D(n,[{key:"setSelectionOrigin",value:function t(n){this.lastSelectionOrigin=n,this.lastSelectionTime=Date.now()}},{key:"ensureHandlers",value:function t(i,n){var e,r,o,u,s,a,f,h,e=this;this.customHandlers=[],u=F(n);try{for(u.s();!(s=u.n()).done;)if(o=null==(r=(a=s.value).update(i).spec)?void 0:r.domEventHandlers)for(h in this.customHandlers.push({plugin:a.value,handlers:o}),f=function t(n){e.registeredEvents.indexOf(n)<0&&"scroll"!=n&&(e.registeredEvents.push(n),i.contentDOM.addEventListener(n,function(t){jl(i,t)&&e.runCustomHandlers(n,i,t)&&t.preventDefault()}))},o)f(h)}catch(t){u.e(t)}finally{u.f()}}},{key:"runCustomHandlers",value:function t(n,i,e){var r,o,u,s,r=F(this.customHandlers);try{for(r.s();!(o=r.n()).done;)if(s=(u=o.value).handlers[n])try{if(s.call(u.plugin,e,i)||e.defaultPrevented)return!0}catch(t){Wc(i.state,t)}}catch(t){r.e(t)}finally{r.f()}return!1}},{key:"runScrollHandlers",value:function t(n,i){var e,r,o,u;this.lastScrollTop=n.scrollDOM.scrollTop,this.lastScrollLeft=n.scrollDOM.scrollLeft,e=F(this.customHandlers);try{for(e.s();!(r=e.n()).done;)if(u=(o=r.value).handlers.scroll)try{u.call(o.plugin,i,n)}catch(t){Wc(n.state,t)}}catch(t){e.e(t)}finally{e.f()}}},{key:"keydown",value:function t(n,i){var e,r,e=this;return this.lastKeyCode=i.keyCode,this.lastKeyTime=Date.now(),9==i.keyCode&&Date.now()<this.lastEscPress+2e3||(27!=i.keyCode&&fi.indexOf(i.keyCode)<0&&(n.inputState.lastEscPress=0),!g.android||!g.chrome||i.synthetic||13!=i.keyCode&&8!=i.keyCode?!(!g.ios||i.synthetic||i.altKey||i.metaKey||!((r=si.find(function(t){return t.keyCode==i.keyCode}))&&!i.ctrlKey||-1<ai.indexOf(i.key)&&i.ctrlKey&&!i.shiftKey)||(this.pendingIOSKey=r||i,setTimeout(function(){return e.flushIOSKey(n)},250),0)):(n.observer.delayAndroidKey(i.key,i.keyCode),!0))}},{key:"flushIOSKey",value:function t(n){var i=this.pendingIOSKey;return!!i&&(this.pendingIOSKey=void 0,wc(n.contentDOM,i.key,i.keyCode))}},{key:"ignoreDuringComposition",value:function t(n){return!!/^key/.test(n.type)&&(0<this.composing||!!(g.safari&&!g.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&!(this.compositionPendingKey=!1))}},{key:"mustFlushObserver",value:function t(n){return"keydown"==n.type&&229!=n.keyCode}},{key:"startMouseSelection",value:function t(n){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=n}},{key:"update",value:function t(n){this.mouseSelection&&this.mouseSelection.update(n),n.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}},{key:"destroy",value:function t(){this.mouseSelection&&this.mouseSelection.destroy()}}]),n}(),si=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],ai="dthko",fi=[16,17,18,20,91,92,224,225],hi=6,ci=function(){function r(n,t,i,e){A(this,r),this.view=n,this.style=i,this.mustSelect=e,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=pc(n.contentDOM),this.atoms=n.state.facet(Ln).map(function(t){return t(n)});var i=n.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=n.state.facet(C.allowMultipleSelections)&&xl(n,t),this.dragMove=Sl(n,t),this.dragging=!(!Cl(n,t)||1!=Rl(t))&&null}return D(r,[{key:"start",value:function t(n){!1===this.dragging&&(n.preventDefault(),this.select(n))}},{key:"move",value:function t(n){var i,e,r,i,o;if(0==n.buttons)return this.destroy();!1===this.dragging&&(this.select(this.lastEvent=n),r=e=0,i=(null==(i=this.scrollParent)?void 0:i.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=Vc(this.view),n.clientX-o.left<=i.left+6?e=-Ml(i.left-n.clientX):n.clientX+o.right>=i.right-6&&(e=Ml(n.clientX-i.right)),n.clientY-o.top<=i.top+6?r=-Ml(i.top-n.clientY):n.clientY+o.bottom>=i.bottom-6&&(r=Ml(n.clientY-i.bottom)),this.setScrollSpeed(e,r))}},{key:"up",value:function t(n){null==this.dragging&&this.select(this.lastEvent),this.dragging||n.preventDefault(),this.destroy()}},{key:"destroy",value:function t(){this.setScrollSpeed(0,0);var n=this.view.contentDOM.ownerDocument;n.removeEventListener("mousemove",this.move),n.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}},{key:"setScrollSpeed",value:function t(n,i){var e=this;this.scrollSpeed={x:n,y:i},n||i?this.scrolling<0&&(this.scrolling=setInterval(function(){return e.scroll()},50)):-1<this.scrolling&&(clearInterval(this.scrolling),this.scrolling=-1)}},{key:"scroll",value:function t(){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 t(n){for(var i,e,r,o,u,u,s,i=null,e=0;e<n.ranges.length;e++)o=null,(r=n.ranges[e]).empty?(u=wl(this.atoms,r.from,0))!=r.from&&(o=O.cursor(u,-1)):(u=wl(this.atoms,r.from,-1),s=wl(this.atoms,r.to,1),u==r.from&&s==r.to||(o=O.range(r.from==r.anchor?u:s,r.from==r.head?u:s))),o&&((i=i||n.ranges.slice())[e]=o);return i?O.create(i,n.mainIndex):n}},{key:"select",value:function t(n){var i=this.view,n=this.skipAtoms(this.style.get(n,this.extend,this.multiple));!this.mustSelect&&n.eq(i.state.selection)&&n.main.assoc==i.state.selection.main.assoc||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}},{key:"update",value:function t(n){var i=this;n.docChanged&&this.dragging&&(this.dragging=this.dragging.map(n.changes)),this.style.update(n)&&setTimeout(function(){return i.select(i.lastEvent)},20)}}]),r}(),s=Object.create(null),li=Object.create(null),vi=g.ie&&g.ie_version<15||g.ios&&g.webkit_version<604,s.keydown=function(t,n){t.inputState.setSelectionOrigin("select"),27==n.keyCode&&(t.inputState.lastEscPress=Date.now())},s.touchstart=function(t,n){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},s.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer")},li.touchstart=li.touchmove={passive:!0},s.mousedown=function(t,n){var i,e,r,o,u;if(t.observer.flush(),!(t.inputState.lastTouchTime>Date.now()-2e3)){i=null,e=F(t.state.facet(gn));try{for(e.s();!(r=e.n()).done&&!(i=(o=r.value)(t,n)););}catch(t){e.e(t)}finally{e.f()}(i=i||0!=n.button?i:Il(t,n))&&(u=t.root.activeElement!=t.contentDOM,t.inputState.startMouseSelection(new ci(t,n,i,u)),u&&t.observer.ignore(function(){return kc(t.contentDOM)}),t.inputState.mouseSelection)&&t.inputState.mouseSelection.start(n)}},di=function t(n,i){return n>=i.top&&n<=i.bottom},yi=function t(n,i,e){return di(i,e)&&n>=e.left&&n<=e.right},mi=g.ie&&g.ie_version<=11,pi=null,gi=ki=0,s.dragstart=function(t,n){var i,e,i=t.state.selection.main,e=t.inputState.mouseSelection;e&&(e.dragging=i),n.dataTransfer&&(n.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),n.dataTransfer.effectAllowed="copyMove")},s.drop=function(n,i){var e,r,o,u,t,s;if(i.dataTransfer){if(n.state.readOnly)return i.preventDefault();if((e=i.dataTransfer.files)&&e.length)for(i.preventDefault(),r=Array(e.length),u=function t(){++o==e.length&&Ll(n,i,r.filter(function(t){return null!=t}).join(n.state.lineBreak),!1)},t=function t(n){var i=new FileReader;i.onerror=u,i.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(i.result)||(r[n]=i.result),u()},i.readAsText(e[n])},s=o=0;s<e.length;s++)t(s);else Ll(n,i,i.dataTransfer.getData("Text"),!0)}},s.paste=function(t,n){if(t.state.readOnly)return n.preventDefault();t.observer.flush();var i=vi?null:n.clipboardData;i?(Ol(t,i.getData("text/plain")||i.getData("text/uri-text")),n.preventDefault()):Pl(t)},wi=null,s.copy=s.cut=function(t,n){var i,e,r,i,i,i=_l(t.state),e=i.text,r=i.ranges,i=i.linewise;(e||i)&&(wi=i?e:null,(i=vi?null:n.clipboardData)?(n.preventDefault(),i.clearData(),i.setData("text/plain",e)):Bl(t,e),"cut"!=n.type||t.state.readOnly||t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"}))},bi=gt.define(),s.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),Nl(t)},s.blur=function(t){t.observer.clearSelectionRange(),Nl(t)},s.compositionstart=s.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},s.compositionend=function(t){t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=0<t.observer.pendingRecords().length,t.inputState.compositionFirstChange=null,g.chrome&&g.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(function(){return t.observer.flush()}):setTimeout(function(){t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])},50)},s.contextmenu=function(t){t.inputState.lastContextMenu=Date.now()},s.beforeinput=function(n,i){var t,t,e;g.chrome&&g.android&&(t=si.find(function(t){return t.inputType==i.inputType}))&&(n.observer.delayAndroidKey(t.key,t.keyCode),"Backspace"!=t.key&&"Delete"!=t.key||(e=(null==(t=window.visualViewport)?void 0:t.height)||0,setTimeout(function(){var t;((null==(t=window.visualViewport)?void 0:t.height)||0)>e+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)))},Mi=["pre-wrap","normal","pre-line","break-spaces"],xi=function(){function n(t){A(this,n),this.lineWrapping=t,this.doc=k.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}return D(n,[{key:"heightForGap",value:function t(n,i){var e=this.doc.lineAt(i).number-this.doc.lineAt(n).number+1;return this.lineWrapping&&(e+=Math.max(0,Math.ceil((i-n-e*this.lineLength*.5)/this.lineLength))),this.lineHeight*e}},{key:"heightForLine",value:function t(n){var i;return this.lineWrapping?(1+Math.max(0,Math.ceil((n-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}},{key:"setDoc",value:function t(n){return this.doc=n,this}},{key:"mustRefreshForWrapping",value:function t(n){return-1<Mi.indexOf(n)!=this.lineWrapping}},{key:"mustRefreshForHeights",value:function t(n){for(var i,e,r,i=!1,e=0;e<n.length;e++)(r=n[e])<0?e++:this.heightSamples[Math.floor(10*r)]||(i=!0,this.heightSamples[Math.floor(10*r)]=!0);return i}},{key:"refresh",value:function t(n,i,e,r,o,u){var n,s,a,f,n=-1<Mi.indexOf(n),s=Math.round(i)!=Math.round(this.lineHeight)||this.lineWrapping!=n;if(this.lineWrapping=n,this.lineHeight=i,this.charWidth=e,this.textHeight=r,this.lineLength=o,s)for(this.heightSamples={},a=0;a<u.length;a++)(f=u[a])<0?a++:this.heightSamples[Math.floor(10*f)]=!0;return s}}]),n}(),Si=function(){function i(t,n){A(this,i),this.from=t,this.heights=n,this.index=0}return D(i,[{key:"more",get:function t(){return this.index<this.heights.length}}]),i}(),Ci=function(){function u(t,n,i,e,r,o){A(this,u),this.from=t,this.length=n,this.top=i,this.height=e,this.children=r,this.deco=o}return D(u,[{key:"type",get:function t(){var n,n,n;return null!=(n=null!=(n=this.children)?n:null==(n=this.deco)?void 0:n.type)?n:P.Text}},{key:"widget",get:function t(){return this.deco&&this.deco.widget}},{key:"to",get:function t(){return this.from+this.length}},{key:"bottom",get:function t(){return this.top+this.height}},{key:"join",value:function t(n){var i=(this.children||[this]).concat(n.children||[n]);return new u(this.from,this.length+n.length,this.top,this.height+n.height,i,null)}}]),u}(),p=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(p=p||{}),ji=.001,(Pi=function(){function f(t,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:2;A(this,f),this.length=t,this.height=n,this.flags=i}return D(f,[{key:"outdated",get:function t(){return 0<(2&this.flags)},set:function t(n){this.flags=(n?2:0)|-3&this.flags}},{key:"setHeight",value:function t(n,i){this.height!=i&&(Math.abs(this.height-i)>ji&&(n.heightChanged=!0),this.height=i)}},{key:"replace",value:function t(n,i,e){return f.of(e)}},{key:"decomposeLeft",value:function t(n,i){i.push(this)}},{key:"decomposeRight",value:function t(n,i){i.push(this)}},{key:"applyChanges",value:function t(n,i,e,r){for(var o,u,s,a,f,h,c,a,l,v,v,o=this,u=e.doc,s=r.length-1;0<=s;s--){for(f=(a=r[s]).fromA,h=a.toA,c=a.fromB,a=a.toB,a+=(v=(l=o.lineAt(f,p.ByPosNoHeight,e.setDoc(i),0,0)).to>=h?l:o.lineAt(h,p.ByPosNoHeight,e,0,0)).to-h,h=v.to;0<s&&l.from<=r[s-1].toA;)f=r[s-1].fromA,c=r[s-1].fromB,s--,f<l.from&&(l=o.lineAt(f,p.ByPosNoHeight,e,0,0));c+=l.from-f,f=l.from,v=Ii.build(e.setDoc(u),n,c,a),o=o.replace(f,h,v)}return o.updateHeight(e,0)}}],[{key:"empty",value:function t(){return new Ei(0,0)}},{key:"of",value:function t(n){var i,e,r,o,u,u,s,s,a;if(1==n.length)return n[0];for(e=n.length,o=r=i=0;;)if(i==e)if(2*o<r)(u=n[i-1]).break?n.splice(--i,1,u.left,null,u.right):n.splice(--i,1,u.left,u.right),e+=1+u.break,r-=u.size;else{if(!(2*r<o))break;(u=n[e]).break?n.splice(e,1,u.left,null,u.right):n.splice(e,1,u.left,u.right),e+=2+u.break,o-=u.size}else r<o?(s=n[i++])&&(r+=s.size):(s=n[--e])&&(o+=s.size);return a=0,null==n[i-1]?(a=1,i--):null==n[i]&&(a=1,e++),new Di(f.of(n.slice(0,i)),a,f.of(n.slice(e)))}}]),f}()).prototype.size=1,Ei=function(t){f(o,t);var i=S(o);function o(t,n){var t;return A(this,o),(t=i.call(this,t,n,null)).collapsed=0,t.widgetHeight=0,t}return D(o,[{key:"replace",value:function t(n,i,e){var r=e[0];return 1==e.length&&(r instanceof o||r instanceof Ai&&4&r.flags)&&Math.abs(this.length-r.length)<10?(r instanceof Ai?r=new o(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):Pi.of(e)}},{key:"updateHeight",value:function t(n){var i,e,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length?arguments[3]:void 0;return r&&r.from<=i&&r.more?this.setHeight(n,r.heights[r.index++]):(e||this.outdated)&&this.setHeight(n,Math.max(this.widgetHeight,n.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}},{key:"toString",value:function t(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}]),o}(Oi=function(t){f(r,t);var e=S(r);function r(t,n,i){var t;return A(this,r),(t=e.call(this,t,n)).deco=i,t}return D(r,[{key:"blockAt",value:function t(n,i,e,r){return new Ci(r,this.length,e,this.height,null,this.deco)}},{key:"lineAt",value:function t(n,i,e,r,o){return this.blockAt(0,e,r,o)}},{key:"forEachLine",value:function t(n,i,e,r,o,u){n<=o+this.length&&o<=i&&u(this.blockAt(0,e,r,o))}},{key:"updateHeight",value:function t(n){var i,e,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length?arguments[3]:void 0;return r&&r.from<=i&&r.more&&this.setHeight(n,r.heights[r.index++]),this.outdated=!1,this}},{key:"toString",value:function t(){return"block(".concat(this.length,")")}}]),r}(Pi)),Ai=function(t){f(l,t);var n=S(l);function l(t){return A(this,l),n.call(this,t,0)}return D(l,[{key:"heightMetrics",value:function t(n,i){var e,i,r,o,u,n,e=n.doc.lineAt(i).number,i=n.doc.lineAt(i+this.length).number,r=i-e+1,u=0;return n.lineWrapping?(o=(n=Math.min(this.height,n.lineHeight*r))/r,this.length>1+r&&(u=(this.height-n)/(this.length-r-1))):o=this.height/r,{firstLine:e,lastLine:i,perLine:o,perChar:u}}},{key:"blockAt",value:function t(n,i,e,r){var o,u,s,a,o,r,r,o,f,r,f,o,s,o=this.heightMetrics(i,r),u=o.firstLine,s=o.lastLine,a=o.perLine,o=o.perChar;return i.lineWrapping?(r=r+Math.round(Math.max(0,Math.min(1,(n-e)/this.height))*this.length),o=a+(r=i.doc.lineAt(r)).length*o,f=Math.max(e,n-o/2),new Ci(r.from,r.length,f,o,null,null)):(r=Math.max(0,Math.min(s-u,Math.floor((n-e)/a))),o=(f=i.doc.line(u+r)).from,s=f.length,new Ci(o,s,e+a*r,a,null,null))}},{key:"lineAt",value:function t(n,i,e,r,o){var i,u,i,i,u,s,i,e,n,s,u;return i==p.ByHeight?this.blockAt(n,e,r,o):i==p.ByPosNoHeight?(u=(i=e.doc.lineAt(n)).from,i=i.to,new Ci(u,i-u,0,0,null,null)):(u=(i=this.heightMetrics(e,o)).firstLine,s=i.perLine,i=i.perChar,n=s+(e=e.doc.lineAt(n)).length*i,u=r+s*(s=e.number-u)+i*(e.from-o-s),new Ci(e.from,e.length,Math.max(r,Math.min(u,r+this.height-n)),n,null,null))}},{key:"forEachLine",value:function t(n,i,e,r,o,u){var s,a,f,h,c,l,v,d,d;for(n=Math.max(n,o),i=Math.min(i,o+this.length),a=(s=this.heightMetrics(e,o)).firstLine,f=s.perLine,h=s.perChar,c=n,l=r;c<=i;)v=e.doc.lineAt(c),c==n&&(l+=f*(d=v.number-a)+h*(n-o-d)),d=f+h*v.length,u(new Ci(v.from,v.length,l,d,null,null)),l+=d,c=v.to+1}},{key:"replace",value:function t(n,i,e){var i,r,r,i=this.length-i;return 0<i&&((r=e[e.length-1])instanceof l?e[e.length-1]=new l(r.length+i):e.push(null,new l(i-1))),0<n&&((r=e[0])instanceof l?e[0]=new l(n+r.length):e.unshift(new l(n-1),null)),Pi.of(e)}},{key:"decomposeLeft",value:function t(n,i){i.push(new l(n-1),null)}},{key:"decomposeRight",value:function t(n,i){i.push(null,new l(this.length-n-1))}},{key:"updateHeight",value:function t(n){var i,e,r,o,u,s,a,f,h,h,c,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length?arguments[3]:void 0,o=i+this.length;if(r&&r.from<=i+this.length&&r.more){for(u=[],s=Math.max(i,r.from),a=-1,r.from>i&&u.push(new l(r.from-i-1).updateHeight(n,i));s<=o&&r.more;)f=n.doc.lineAt(s).length,u.length&&u.push(null),h=r.heights[r.index++],-1==a?a=h:Math.abs(h-a)>=ji&&(a=-2),(h=new Ei(f,h)).outdated=!1,u.push(h),s+=f+1;return s<=o&&u.push(null,new l(o-s).updateHeight(n,s)),c=Pi.of(u),(a<0||Math.abs(c.height-this.height)>=ji||Math.abs(a-this.heightMetrics(n,i).perLine)>=ji)&&(n.heightChanged=!0),c}return(e||this.outdated)&&(this.setHeight(n,n.heightForGap(i,i+this.length)),this.outdated=!1),this}},{key:"toString",value:function t(){return"gap(".concat(this.length,")")}}]),l}(Pi),Di=function(t){f(r,t);var e=S(r);function r(t,n,i){var n;return A(this,r),(n=e.call(this,t.length+n+i.length,t.height+i.height,n|(t.outdated||i.outdated?2:0))).left=t,n.right=i,n.size=t.size+i.size,n}return D(r,[{key:"break",get:function t(){return 1&this.flags}},{key:"blockAt",value:function t(n,i,e,r){var o=e+this.left.height;return n<o?this.left.blockAt(n,i,e,r):this.right.blockAt(n,i,o,r+this.left.length+this.break)}},{key:"lineAt",value:function t(n,i,e,r,o){var u,s,a,n,i,u=r+this.left.height,s=o+this.left.length+this.break,a=i==p.ByHeight?n<u:n<s,n=a?this.left.lineAt(n,i,e,r,o):this.right.lineAt(n,i,e,u,s);return this.break||(a?n.to<s:n.from>s)?n:(i=i==p.ByPosNoHeight?p.ByPosNoHeight:p.ByPos,a?n.join(this.right.lineAt(s,i,e,u,s)):this.left.lineAt(s,i,e,r,o).join(n))}},{key:"forEachLine",value:function t(n,i,e,r,o,u){var s,a,f,s=r+this.left.height,a=o+this.left.length+this.break;this.break?(n<a&&this.left.forEachLine(n,i,e,r,o,u),a<=i&&this.right.forEachLine(n,i,e,s,a,u)):(n<(f=this.lineAt(a,p.ByPos,e,r,o)).from&&this.left.forEachLine(n,f.from-1,e,r,o,u),f.to>=n&&f.from<=i&&u(f),i>f.to&&this.right.forEachLine(f.to+1,i,e,s,a,u))}},{key:"replace",value:function t(n,i,e){var r,o,r,u,s,a,e,r=this.left.length+this.break;if(i<r)return this.balanced(this.left.replace(n,i,e),this.right);if(n>this.left.length)return this.balanced(this.left,this.right.replace(n-r,i-r,e));o=[],0<n&&this.decomposeLeft(n,o),r=o.length,u=F(e);try{for(u.s();!(s=u.n()).done;)a=s.value,o.push(a)}catch(t){u.e(t)}finally{u.f()}return 0<n&&Ul(o,r-1),i<this.length&&(e=o.length,this.decomposeRight(i,o),Ul(o,e)),Pi.of(o)}},{key:"decomposeLeft",value:function t(n,i){var e=this.left.length;if(n<=e)return this.left.decomposeLeft(n,i);i.push(this.left),this.break&&++e<=n&&i.push(null),e<n&&this.right.decomposeLeft(n-e,i)}},{key:"decomposeRight",value:function t(n,i){var e=this.left.length,r=e+this.break;if(r<=n)return this.right.decomposeRight(n-r,i);n<e&&this.left.decomposeRight(n,i),this.break&&n<r&&i.push(null),i.push(this.right)}},{key:"balanced",value:function t(n,i){return n.size>2*i.size||i.size>2*n.size?Pi.of(this.break?[n,null,i]:[n,i]):(this.left=n,this.right=i,this.height=n.height+i.height,this.outdated=n.outdated||i.outdated,this.size=n.size+i.size,this.length=n.length+this.break+i.length,this)}},{key:"updateHeight",value:function t(n){var i,e,r,o,u,s,a,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length?arguments[3]:void 0,o=this.left,u=this.right,s=i+o.length+this.break,a=null;return r&&r.from<=i+o.length&&r.more?a=o=o.updateHeight(n,i,e,r):o.updateHeight(n,i,e),r&&r.from<=s+u.length&&r.more?a=u=u.updateHeight(n,s,e,r):u.updateHeight(n,s,e),a?this.balanced(o,u):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}},{key:"toString",value:function t(){return this.left+(this.break?" ":"-")+this.right}}]),r}(Pi),Ri=5,Ii=function(){function o(t,n){A(this,o),this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}return D(o,[{key:"isCovered",get:function t(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}},{key:"span",value:function t(n,i){var e,r;-1<this.lineStart&&(e=Math.min(i,this.lineEnd),(r=this.nodes[this.nodes.length-1])instanceof Ei?r.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Ei(e-this.pos,-1)),(this.writtenTo=e)<i)&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1),this.pos=i}},{key:"point",value:function t(n,i,e){var r,o;n<i||e.heightRelevant?((r=e.widget?e.widget.estimatedHeight:0)<0&&(r=this.oracle.lineHeight),o=i-n,e.block?this.addBlock(new Oi(o,r,e)):(o||5<=r)&&this.addLineDeco(r,o)):n<i&&this.span(n,i),-1<this.lineEnd&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}},{key:"enterLine",value:function t(){var n,i,n;-1<this.lineStart||(i=(n=this.oracle.doc.lineAt(this.pos)).from,n=n.to,this.lineStart=i,this.lineEnd=n,this.writtenTo<i&&((this.writtenTo<i-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,i-1)),this.nodes.push(null)),this.pos>i&&this.nodes.push(new Ei(this.pos-i,-1)),this.writtenTo=this.pos)}},{key:"blankContent",value:function t(n,i){var e=new Ai(i-n);return this.oracle.doc.lineAt(n).to==i&&(e.flags|=4),e}},{key:"ensureLine",value:function t(){var n,n;return this.enterLine(),(n=this.nodes.length?this.nodes[this.nodes.length-1]:null)instanceof Ei||(n=new Ei(0,-1),this.nodes.push(n)),n}},{key:"addBlock",value:function t(n){var i,i;this.enterLine(),(i=null==(i=n.deco)?void 0:i.type)!=P.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(n),this.writtenTo=this.pos=this.pos+n.length,i!=P.WidgetBefore&&(this.covering=n)}},{key:"addLineDeco",value:function t(n,i){var e=this.ensureLine();e.length+=i,e.collapsed+=i,e.widgetHeight=Math.max(e.widgetHeight,n),this.writtenTo=this.pos=this.pos+i}},{key:"finish",value:function t(n){var i,e,r,o,u,i=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(-1<this.lineStart)||i instanceof Ei||this.isCovered?(this.writtenTo<this.pos||null==i)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Ei(0,-1)),e=n,r=F(this.nodes);try{for(r.s();!(o=r.n()).done;)(u=o.value)instanceof Ei&&u.updateHeight(this.oracle,e),e+=u?u.length:1}catch(t){r.e(t)}finally{r.f()}return this.nodes}}],[{key:"build",value:function t(n,i,e,r){var n=new o(e,n);return j.spans(i,e,r,n,0),n.finish(e)}}]),o}(),Ti=function(){function t(){A(this,t),this.changes=[]}return D(t,[{key:"compareRange",value:function t(){}},{key:"comparePoint",value:function t(n,i,e,r){(n<i||e&&e.heightRelevant||r&&r.heightRelevant)&&Hc(n,i,this.changes,5)}}]),t}(),Li=function(){function e(t,n,i){A(this,e),this.from=t,this.to=n,this.size=i}return D(e,[{key:"draw",value:function t(n){return m.replace({widget:new Bi(this.size,n)}).range(this.from,this.to)}}],[{key:"same",value:function t(n,i){var e,r,o;if(n.length!=i.length)return!1;for(e=0;e<n.length;e++)if(r=n[e],o=i[e],r.from!=o.from||r.to!=o.to||r.size!=o.size)return!1;return!0}}]),e}(),Bi=function(t){f(r,t);var e=S(r);function r(t,n){var i;return A(this,r),(i=e.call(this)).size=t,i.vertical=n,i}return D(r,[{key:"eq",value:function t(n){return n.size==this.size&&n.vertical==this.vertical}},{key:"toDOM",value:function t(){var n=document.createElement("div");return this.vertical?n.style.height=this.size+"px":(n.style.width=this.size+"px",n.style.height="2px",n.style.display="inline-block"),n}},{key:"estimatedHeight",get:function t(){return this.vertical?this.size:-1}}]),r}(tn),_i=function(){function i(t){A(this,i),this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaler=Ni,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=E.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;var n=t.facet(In).some(function(t){return"function"!=typeof t&&"cm-lineWrapping"==t.class});this.heightOracle=new xi(n),this.stateDeco=t.facet(Tn).filter(function(t){return"function"!=typeof t}),this.heightMap=Pi.empty().applyChanges(this.stateDeco,k.empty,this.heightOracle.setDoc(t.doc),[new Fn(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=m.set(this.lineGaps.map(function(t){return t.draw(!1)})),this.computeVisibleRanges()}return D(i,[{key:"updateForViewport",value:function t(){for(var r,o,u,n,s,r=this,o=[this.viewport],u=this.state.selection.main,n=function t(){var i,n,e,n,i=s?u.head:u.anchor;o.some(function(t){var n=t.from,t=t.to;return n<=i&&i<=t})||(e=(n=r.lineBlockAt(i)).from,n=n.to,o.push(new Fi(e,n)))},s=0;s<=1;s++)n();this.viewports=o.sort(function(t,n){return t.from-n.from}),this.scaler=this.heightMap.height<=7e6?Ni:new Ui(this.heightOracle,this.heightMap,this.viewports)}},{key:"updateViewportLines",value:function t(){var n=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,function(t){n.viewportLines.push(1==n.scaler.scale?t:Jl(t,n.scaler))})}},{key:"update",value:function t(n){var i,e,r,r,e,e,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;this.state=n.state,e=this.stateDeco,this.stateDeco=this.state.facet(Tn).filter(function(t){return"function"!=typeof t}),r=n.changedRanges,r=Fn.extendWithRanges(r,Hl(e,this.stateDeco,n?n.changes:K.empty(this.state.doc.length))),e=this.heightMap.height,this.heightMap=this.heightMap.applyChanges(this.stateDeco,n.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=e&&(n.flags|=2),e=r.length?this.mapViewport(this.viewport,n.changes):this.viewport,(i&&(i.range.head<e.from||i.range.head>e.to)||!this.viewportIsAppropriate(e))&&(e=this.getViewport(0,i)),r=!n.changes.empty||2&n.flags||e.from!=this.viewport.from||e.to!=this.viewport.to,this.viewport=e,this.updateForViewport(),r&&this.updateViewportLines(),(this.lineGaps.length||4e3<this.viewport.to-this.viewport.from)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,n.changes))),n.flags|=this.computeVisibleRanges(),i&&(this.scrollTarget=i),!this.mustEnforceCursorAssoc&&n.selectionSet&&n.view.lineWrapping&&n.state.selection.main.empty&&n.state.selection.main.assoc&&!n.state.facet(Cn)&&(this.mustEnforceCursorAssoc=!0)}},{key:"measure",value:function t(n){var i,e,r,o,u,s,a,f,h,c,e,c,e,i,c,c,l,s,a,v,s,d,y,m,p,o,i=n.contentDOM,e=window.getComputedStyle(i),r=this.heightOracle,o=e.whiteSpace;if(this.defaultTextDirection="rtl"==e.direction?E.RTL:E.LTR,u=this.heightOracle.mustRefreshForWrapping(o),s=i.getBoundingClientRect(),a=u||this.mustMeasureContent||this.contentDOMHeight!=s.height,this.contentDOMHeight=s.height,this.mustMeasureContent=!1,h=f=0,c=parseInt(e.paddingTop)||0,e=parseInt(e.paddingBottom)||0,this.paddingTop==c&&this.paddingBottom==e||(this.paddingTop=c,this.paddingBottom=e,f|=10),this.editorWidth!=n.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=n.scrollDOM.clientWidth,f|=8),e=(c=(this.printing?Wl:zl)(i,this.paddingTop)).top-this.pixelViewport.top,i=c.bottom-this.pixelViewport.bottom,this.pixelViewport=c,(c=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left)!=this.inView&&(this.inView=c)&&(a=!0),!this.inView&&!this.scrollTarget)return 0;if(c=s.width,this.contentDOMWidth==c&&this.editorHeight==n.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=n.scrollDOM.clientHeight,f|=8),a){l=n.docView.measureVisibleLineHeights(this.viewport),((u=r.mustRefreshForHeights(l)?!0:u)||r.lineWrapping&&Math.abs(c-this.contentDOMWidth)>r.charWidth)&&(a=(s=n.docView.measureTextSize()).lineHeight,v=s.charWidth,s=s.textHeight,u=0<a&&r.refresh(o,a,v,s,c/v,l))&&(n.docView.minWidth=0,f|=8),0<e&&0<i?h=Math.max(e,i):e<0&&i<0&&(h=Math.min(e,i)),r.heightChanged=!1,d=F(this.viewports);try{for(d.s();!(y=d.n()).done;)p=(m=y.value).from==this.viewport.from?l:n.docView.measureVisibleLineHeights(m),this.heightMap=(u?Pi.empty().applyChanges(this.stateDeco,k.empty,this.heightOracle,[new Fn(0,0,0,n.state.doc.length)]):this.heightMap).updateHeight(r,0,u,new Si(m.from,p))}catch(t){d.e(t)}finally{d.f()}r.heightChanged&&(f|=2)}return(o=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to))&&(this.viewport=this.getViewport(h,this.scrollTarget)),this.updateForViewport(),(2&f||o)&&this.updateViewportLines(),(this.lineGaps.length||4e3<this.viewport.to-this.viewport.from)&&this.updateLineGaps(this.ensureLineGaps(u?[]:this.lineGaps,n)),f|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,n.docView.enforceCursorAssoc()),f}},{key:"visibleTop",get:function t(){return this.scaler.fromDOM(this.pixelViewport.top)}},{key:"visibleBottom",get:function t(){return this.scaler.fromDOM(this.pixelViewport.bottom)}},{key:"getViewport",value:function t(n,i){var n,e,r,o,u,o,u,n,s,i,n=.5-Math.max(-.5,Math.min(.5,n/1e3/2)),e=this.heightMap,r=this.heightOracle,o=this.visibleTop,u=this.visibleBottom,o=new Fi(e.lineAt(o-1e3*n,p.ByHeight,r,0,0).from,e.lineAt(u+1e3*(1-n),p.ByHeight,r,0,0).to);return i&&((u=i.range.head)<o.from||u>o.to)&&(n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=e.lineAt(u,p.ByPos,r,0,0),i="center"==i.y?(s.top+s.bottom)/2-n/2:"start"==i.y||"nearest"==i.y&&u<o.from?s.top:s.bottom-n,o=new Fi(e.lineAt(i-500,p.ByHeight,r,0,0).from,e.lineAt(i+n+500,p.ByHeight,r,0,0).to)),o}},{key:"mapViewport",value:function t(n,i){var e=i.mapPos(n.from,-1),i=i.mapPos(n.to,1);return new Fi(this.heightMap.lineAt(e,p.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,p.ByPos,this.heightOracle,0,0).to)}},{key:"viewportIsAppropriate",value:function t(n){var i,n,e,r,o,u,s,a,f,i=n.from,n=n.to,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return!this.inView||(o=(r=this.heightMap.lineAt(i,p.ByPos,this.heightOracle,0,0)).top,s=(u=this.heightMap.lineAt(n,p.ByPos,this.heightOracle,0,0)).bottom,a=this.visibleTop,f=this.visibleBottom,(0==i||o<=a-Math.max(10,Math.min(-e,250)))&&(n==this.state.doc.length||s>=f+Math.max(10,Math.min(e,250)))&&a-2e3<o&&s<f+2e3)}},{key:"mapLineGaps",value:function t(n,i){var e,r,o,u;if(!n.length||i.empty)return n;e=[],r=F(n);try{for(r.s();!(o=r.n()).done;)u=o.value,i.touchesRange(u.from,u.to)||e.push(new Li(i.mapPos(u.from),i.mapPos(u.to),u.size))}catch(t){r.e(t)}finally{r.f()}return e}},{key:"ensureLineGaps",value:function t(c,l){var v,d,n,y,i,m,e,r,o,u,s,a,f,h,p,k,g,w,b,M,x,S,C,j,P,v=this,d=this.heightOracle.lineWrapping,n=d?1e4:2e3,y=n>>1,i=n<<1;if(this.defaultTextDirection!=E.LTR&&!d)return[];m=[],e=function t(i,e,r,n){var o,u,s,a,f,o,h;if(!(e-i<y)){for(o=v.state.selection.main,u=[o.from],o.empty||u.push(o.to),s=0,a=u;s<a.length;s++)if(i<(f=a[s])&&f<e)return t(i,f-10,r,n),void t(f+10,e,r,n);(o=Gl(c,function(n){return n.from>=r.from&&n.to<=r.to&&Math.abs(n.from-i)<y&&Math.abs(n.to-e)<y&&!u.some(function(t){return n.from<t&&n.to>t})}))||(e<r.to&&l&&d&&l.visibleRanges.some(function(t){return t.from<=e&&t.to>=e})&&(h=l.moveToLineBoundary(O.cursor(e),!1,!0).head,i<h)&&(e=h),o=new Li(i,e,v.gapSize(r,i,e,n))),m.push(o)}},r=F(this.viewportLines);try{for(r.s();!(o=r.n()).done;)(u=o.value).length<i||(s=Vl(u.from,u.to,this.stateDeco)).total<i||(a=this.scrollTarget?this.scrollTarget.range.head:null,h=f=void 0,h=d?(p=n/this.heightOracle.lineLength*this.heightOracle.lineHeight,g=k=void 0,g=null!=a?(k=(w=ql(s,a))-(b=((this.visibleBottom-this.visibleTop)/2+p)/u.height),w+b):(k=(this.visibleTop-u.top-p)/u.height,(this.visibleBottom-u.top+p)/u.height),f=$l(s,k),$l(s,g)):(M=s.total*this.heightOracle.charWidth,x=n*this.heightOracle.charWidth,C=S=void 0,C=null!=a?(S=(j=ql(s,a))-(P=((this.pixelViewport.right-this.pixelViewport.left)/2+x)/M),j+P):(S=(this.pixelViewport.left-x)/M,(this.pixelViewport.right+x)/M),f=$l(s,S),$l(s,C)),f>u.from&&e(u.from,f,u,s),h<u.to&&e(h,u.to,u,s))}catch(t){r.e(t)}finally{r.f()}return m}},{key:"gapSize",value:function t(n,i,e,r){var e=ql(r,e)-ql(r,i);return this.heightOracle.lineWrapping?n.height*e:r.total*this.heightOracle.charWidth*e}},{key:"updateLineGaps",value:function t(n){var i=this;Li.same(n,this.lineGaps)||(this.lineGaps=n,this.lineGapDeco=m.set(n.map(function(t){return t.draw(i.heightOracle.lineWrapping)})))}},{key:"computeVisibleRanges",value:function t(){var n,e,n,n=this.stateDeco;return this.lineGaps.length&&(n=n.concat(this.lineGapDeco)),e=[],j.spans(n,this.viewport.from,this.viewport.to,{span:function t(n,i){e.push({from:n,to:i})},point:function t(){}},20),n=e.length!=this.visibleRanges.length||this.visibleRanges.some(function(t,n){return t.from!=e[n].from||t.to!=e[n].to}),this.visibleRanges=e,n?4:0}},{key:"lineBlockAt",value:function t(n){return n>=this.viewport.from&&n<=this.viewport.to&&this.viewportLines.find(function(t){return t.from<=n&&t.to>=n})||Jl(this.heightMap.lineAt(n,p.ByPos,this.heightOracle,0,0),this.scaler)}},{key:"lineBlockAtHeight",value:function t(n){return Jl(this.heightMap.lineAt(this.scaler.fromDOM(n),p.ByHeight,this.heightOracle,0,0),this.scaler)}},{key:"elementAtHeight",value:function t(n){return Jl(this.heightMap.blockAt(this.scaler.fromDOM(n),this.heightOracle,0,0),this.scaler)}},{key:"docHeight",get:function t(){return this.scaler.toDOM(this.heightMap.height)}},{key:"contentHeight",get:function t(){return this.docHeight+this.paddingTop+this.paddingBottom}}]),i}(),Fi=D(function t(n,i){A(this,t),this.from=n,this.to=i}),Ni={toDOM:function t(n){return n},fromDOM:function t(n){return n},scale:1},Ui=function(){function f(r,o,t){var u,n,i,e,s,a;A(this,f),i=n=u=0,this.viewports=t.map(function(t){var n,t,i,e,n=t.from,t=t.to,i=o.lineAt(n,p.ByPos,r,0,0).top,e=o.lineAt(t,p.ByPos,r,0,0).bottom;return u+=e-i,{from:n,to:t,top:i,bottom:e,domTop:0,domBottom:0}}),this.scale=(7e6-u)/(o.height-u),e=F(this.viewports);try{for(e.s();!(s=e.n()).done;)(a=s.value).domTop=i+(a.top-n)*this.scale,i=a.domBottom=a.domTop+(a.bottom-a.top),n=a.bottom}catch(t){e.e(t)}finally{e.f()}}return D(f,[{key:"toDOM",value:function t(n){for(var i,e,r,o,i=0,e=0,r=0;;i++){if(!(o=i<this.viewports.length?this.viewports[i]:null)||n<o.top)return r+(n-e)*this.scale;if(n<=o.bottom)return o.domTop+(n-o.top);e=o.bottom,r=o.domBottom}}},{key:"fromDOM",value:function t(n){for(var i,e,r,o,i=0,e=0,r=0;;i++){if(!(o=i<this.viewports.length?this.viewports[i]:null)||n<o.domTop)return e+(n-r)/this.scale;if(n<=o.domBottom)return o.top+(n-o.domTop);e=o.bottom,r=o.domBottom}}}]),f}(),Hi=y.define({combine:function t(n){return n.join(" ")}}),zi=y.define({combine:function t(n){return-1<n.indexOf(!0)}}),Gi=Kl("."+(Wi=Ft.newName()),{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},qi={"&light":"."+(Vi=Ft.newName()),"&dark":"."+($i=Ft.newName())}),Ji=D(function t(n,i,e,r){var r,o,r,i,e,e,i,o;A(this,t),this.typeOver=r,this.bounds=null,this.text="",o=(r=n.docView).impreciseHead,r=r.impreciseAnchor,n.state.readOnly&&-1<i?this.newSel=null:-1<i&&(this.bounds=n.docView.domBoundsAround(i,e,0))?(i=o||r?[]:Zl(n),(e=new ti(i,n.state)).readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=e.text,this.newSel=Yl(i,this.bounds.from)):(e=n.observer.selectionRange,i=o&&o.node==e.focusNode&&o.offset==e.focusOffset||!uc(n.contentDOM,e.focusNode)?n.state.selection.main.head:n.docView.posFromDOM(e.focusNode,e.focusOffset),o=r&&r.node==e.anchorNode&&r.offset==e.anchorOffset||!uc(n.contentDOM,e.anchorNode)?n.state.selection.main.anchor:n.docView.posFromDOM(e.anchorNode,e.anchorOffset),this.newSel=O.single(o,i))}),Ki={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Qi=g.ie&&g.ie_version<=11,Xi=function(){function t(r){var o=this;A(this,t),this.view=r,this.active=!1,this.selectionRange=new qt,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=r.contentDOM,this.observer=new MutationObserver(function(t){var n,i,e,n=F(t);try{for(n.s();!(i=n.n()).done;)e=i.value,o.queue.push(e)}catch(t){n.e(t)}finally{n.f()}(g.ie&&g.ie_version<=11||g.ios&&r.composing)&&t.some(function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length})?o.flushSoon():o.flush()}),Qi&&(this.onCharData=function(t){o.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),o.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(function(){var t;(null==(t=o.view.docView)?void 0:t.lastUpdate)<Date.now()-75&&o.onResize()}),this.resizeScroll.observe(r.scrollDOM),this.resizeContent=new ResizeObserver(function(){return o.view.requestMeasure()}),this.resizeContent.observe(r.contentDOM)),this.addWindowListeners(this.win=r.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(function(t){o.parentCheck<0&&(o.parentCheck=setTimeout(o.listenForScroll.bind(o),1e3)),0<t.length&&0<t[t.length-1].intersectionRatio!=o.intersecting&&(o.intersecting=!o.intersecting,o.intersecting!=o.view.inView)&&o.onScrollChanged(document.createEvent("Event"))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(function(t){0<t.length&&0<t[t.length-1].intersectionRatio&&o.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}return D(t,[{key:"onScrollChanged",value:function t(n){this.view.inputState.runScrollHandlers(this.view,n),this.intersecting&&this.view.measure()}},{key:"onScroll",value:function t(n){this.intersecting&&this.flush(!1),this.onScrollChanged(n)}},{key:"onResize",value:function t(){var n=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(function(){n.resizeTimeout=-1,n.view.requestMeasure()},50))}},{key:"onPrint",value:function t(){var n=this;this.view.viewState.printing=!0,this.view.measure(),setTimeout(function(){n.view.viewState.printing=!1,n.view.requestMeasure()},500)}},{key:"updateGaps",value:function t(i){var n,e,r;if(this.gapIntersection&&(i.length!=this.gaps.length||this.gaps.some(function(t,n){return t!=i[n]}))){this.gapIntersection.disconnect(),n=F(i);try{for(n.s();!(e=n.n()).done;)r=e.value,this.gapIntersection.observe(r)}catch(t){n.e(t)}finally{n.f()}this.gaps=i}}},{key:"onSelectionChange",value:function t(n){var i,e,r,o,i=this.selectionChanged;this.readSelectionRange()&&!this.delayedAndroidKey&&(e=this.view,r=this.selectionRange,e.state.facet(On)?e.root.activeElement==this.dom:ac(e.dom,r))&&((o=r.anchorNode&&e.docView.nearest(r.anchorNode))&&o.ignoreEvent(n)?i||(this.selectionChanged=!1):(g.ie&&g.ie_version<=11||g.android&&g.chrome)&&!e.state.selection.main.empty&&r.focusNode&&hc(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1))}},{key:"readSelectionRange",value:function t(){var n,i,e,n=this.view,i=g.safari&&11==n.root.nodeType&&sc(this.dom.ownerDocument)==this.dom&&n0(this.view)||oc(n.root);return!(!i||this.selectionRange.eq(i)||((e=ac(this.dom,i))&&!this.selectionChanged&&n.inputState.lastFocusTime>Date.now()-200&&n.inputState.lastTouchTime<Date.now()-300&&xc(this.dom,i)?(this.view.inputState.lastFocusTime=0,n.docView.updateSelection(),1):(this.selectionRange.setRange(i),e&&(this.selectionChanged=!0),0)))}},{key:"setSelectionRange",value:function t(n,i){this.selectionRange.set(n.node,n.offset,i.node,i.offset),this.selectionChanged=!1}},{key:"clearSelectionRange",value:function t(){this.selectionRange.set(null,0,null,0)}},{key:"listenForScroll",value:function t(){var n,i,e,r,o,u,s,a,f;for(this.parentCheck=-1,n=0,i=null,e=this.dom;e;)if(1==e.nodeType)!i&&n<this.scrollTargets.length&&this.scrollTargets[n]==e?n++:i=i||this.scrollTargets.slice(0,n),i&&i.push(e),e=e.assignedSlot||e.parentNode;else{if(11!=e.nodeType)break;e=e.host}if(i=n<this.scrollTargets.length&&!i?this.scrollTargets.slice(0,n):i){r=F(this.scrollTargets);try{for(r.s();!(o=r.n()).done;)(u=o.value).removeEventListener("scroll",this.onScroll)}catch(t){r.e(t)}finally{r.f()}s=F(this.scrollTargets=i);try{for(s.s();!(a=s.n()).done;)(f=a.value).addEventListener("scroll",this.onScroll)}catch(t){s.e(t)}finally{s.f()}}}},{key:"ignore",value:function t(n){if(!this.active)return n();try{return this.stop(),n()}finally{this.start(),this.clear()}}},{key:"start",value:function t(){this.active||(this.observer.observe(this.dom,Ki),Qi&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}},{key:"stop",value:function t(){this.active&&(this.active=!1,this.observer.disconnect(),Qi)&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData)}},{key:"clear",value:function t(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}},{key:"delayAndroidKey",value:function t(n,i){var e,n,r,e=this;this.delayedAndroidKey||(this.flushingAndroidKey=this.view.win.requestAnimationFrame(r=function t(){var n,i,n=e.delayedAndroidKey;!n||(e.clearDelayedAndroidKey(),e.view.inputState.lastKeyCode=n.keyCode,e.view.inputState.lastKeyTime=Date.now(),i=e.flush())||!n.force||wc(e.dom,n.key,n.keyCode)})),this.delayedAndroidKey&&"Enter"!=n||(this.delayedAndroidKey={key:n,keyCode:i,force:this.lastChange<Date.now()-50||!(null==(n=this.delayedAndroidKey)||!n.force)})}},{key:"clearDelayedAndroidKey",value:function t(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}},{key:"flushSoon",value:function t(){var n=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(function(){n.delayedFlush=-1,n.flush()}))}},{key:"forceFlush",value:function t(){0<=this.delayedFlush&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}},{key:"pendingRecords",value:function t(){var n,i,e,n=F(this.observer.takeRecords());try{for(n.s();!(i=n.n()).done;)e=i.value,this.queue.push(e)}catch(t){n.e(t)}finally{n.f()}return this.queue}},{key:"processRecords",value:function t(){var n,i,e,r,o,u,s,a,n=this.pendingRecords();n.length&&(this.queue=[]),r=!(e=i=-1),o=F(n);try{for(o.s();!(u=o.n()).done;)s=u.value,(a=this.readMutation(s))&&(a.typeOver&&(r=!0),e=-1==i?(i=a.from,a.to):(i=Math.min(a.from,i),Math.max(a.to,e)))}catch(t){o.e(t)}finally{o.f()}return{from:i,to:e,typeOver:r}}},{key:"readChange",value:function t(){var n,i,e,n,r,n=this.processRecords(),i=n.from,e=n.to,n=n.typeOver,r=this.selectionChanged&&ac(this.dom,this.selectionRange);return i<0&&!r?null:(-1<i&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ji(this.view,i,e,n))}},{key:"flush",value:function t(){var n,i,e,i,n;return!(0<=this.delayedFlush||this.delayedAndroidKey||(0<arguments.length&&void 0!==arguments[0]&&!arguments[0]||this.readSelectionRange(),!(i=this.readChange())))&&(e=this.view.state,i=Ql(this.view,i),this.view.state==e&&this.view.update([]),i)}},{key:"readMutation",value:function t(n){var i,e,r,i=this.view.docView.nearest(n.target);return!i||i.ignoreMutation(n)?null:(i.markDirty("attributes"==n.type),"attributes"==n.type&&(i.dirty|=4),"childList"==n.type?(e=t0(i,n.previousSibling||n.target.previousSibling,-1),r=t0(i,n.nextSibling||n.target.nextSibling,1),{from:e?i.posAfter(e):i.posAtStart,to:r?i.posBefore(r):i.posAtEnd,typeOver:!1}):"characterData"==n.type?{from:i.posAtStart,to:i.posAtEnd,typeOver:n.target.nodeValue==n.oldValue}:null)}},{key:"setWindow",value:function t(n){n!=this.win&&(this.removeWindowListeners(this.win),this.win=n,this.addWindowListeners(this.win))}},{key:"addWindowListeners",value:function t(n){n.addEventListener("resize",this.onResize),n.addEventListener("beforeprint",this.onPrint),n.addEventListener("scroll",this.onScroll),n.document.addEventListener("selectionchange",this.onSelectionChange)}},{key:"removeWindowListeners",value:function t(n){n.removeEventListener("scroll",this.onScroll),n.removeEventListener("resize",this.onResize),n.removeEventListener("beforeprint",this.onPrint),n.document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"destroy",value:function t(){var n,n,n,n,i,e,r;this.stop(),null!=(n=this.intersection)&&n.disconnect(),null!=(n=this.gapIntersection)&&n.disconnect(),null!=(n=this.resizeScroll)&&n.disconnect(),null!=(n=this.resizeContent)&&n.disconnect(),i=F(this.scrollTargets);try{for(i.s();!(e=i.n()).done;)(r=e.value).removeEventListener("scroll",this.onScroll)}catch(t){i.e(t)}finally{i.f()}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}]),t}(),(w=function(){function h(){var n,t,i,e,r,n=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};A(this,h),this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this.$de=t.dispatch||function(t){return n.update([t])},this.dispatch=this.dispatch.bind(this),this.Nkt=t.root||bc(t.parent)||document,this.viewState=new _i(t.state||C.create(t)),this.plugins=this.state.facet(An).map(function(t){return new Dn(t)}),i=F(this.plugins);try{for(i.s();!(e=i.n()).done;)(r=e.value).update(this)}catch(t){i.e(t)}finally{i.f()}this.observer=new Xi(this),this.inputState=new ui(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new ii(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}return D(h,[{key:"state",get:function t(){return this.viewState.state}},{key:"viewport",get:function t(){return this.viewState.viewport}},{key:"visibleRanges",get:function t(){return this.viewState.visibleRanges}},{key:"inView",get:function t(){return this.viewState.inView}},{key:"composing",get:function t(){return 0<this.inputState.composing}},{key:"compositionStarted",get:function t(){return 0<=this.inputState.composing}},{key:"root",get:function t(){return this.Nkt}},{key:"win",get:function t(){return this.dom.ownerDocument.defaultView||window}},{key:"dispatch",value:function t(){var n,n,n=1==arguments.length&&(arguments.length<=0?void 0:arguments[0])instanceof Mt?arguments.length<=0?void 0:arguments[0]:(n=this.state).update.apply(n,arguments);this.$de(n,this)}},{key:"update",value:function t(n){var i,e,r,t,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,i=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");r=e=!1,o=this.state,u=F(n);try{for(u.s();!(s=u.n()).done;){if((a=s.value).startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=a.state}}catch(t){u.e(t)}finally{u.f()}if(this.destroyed)this.viewState.state=o;else{if(f=this.hasFocus,h=0,c=null,n.some(function(t){return t.annotation(bi)})?(this.inputState.notifiedFocused=f,h=1):f==this.inputState.notifiedFocused||(this.inputState.notifiedFocused=f,c=Fl(o,f))||(h=1),l=this.observer.delayedAndroidKey,v=null,l?(this.observer.clearDelayedAndroidKey(),(!(v=this.observer.readChange())||this.state.doc.eq(o.doc))&&this.state.selection.eq(o.selection)||(v=null)):this.observer.clear(),o.facet(C.phrases)!=this.state.facet(C.phrases))return this.setState(o);(t=Nn.create(this,o,n)).flags|=h,d=this.viewState.scrollTarget;try{this.updateState=2,y=F(n);try{for(y.s();!(m=y.n()).done;){p=m.value,d=d&&d.map(p.changes),p.scrollIntoView&&(k=p.state.selection.main,d=new jn(k.empty?k:O.cursor(k.head,k.head>k.anchor?-1:1))),g=F(p.effects);try{for(g.s();!(w=g.n()).done;)(b=w.value).is(Pn)&&(d=b.value)}catch(t){g.e(t)}finally{g.f()}}}catch(t){y.e(t)}finally{y.f()}this.viewState.update(t,d),this.bidiCache=te.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),e=this.docView.update(t),this.state.facet(_n)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(n),this.docView.updateSelection(e,n.some(function(t){return t.isUserEvent("select.pointer")}))}finally{this.updateState=0}if(t.startState.facet(Hi)!=t.state.facet(Hi)&&(this.viewState.mustMeasureContent=!0),(e||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!t.empty){M=F(this.state.facet(bn));try{for(M.s();!(x=M.n()).done;)(S=x.value)(t)}catch(t){M.e(t)}finally{M.f()}}(c||v)&&Promise.resolve().then(function(){c&&i.state==c.startState&&i.dispatch(c),v&&!Ql(i,v)&&l.force&&wc(i.contentDOM,l.key,l.keyCode)})}}},{key:"setState",value:function t(n){var i,e,r,o,u,s,a;if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)this.viewState.state=n;else{this.updateState=2,i=this.hasFocus;try{e=F(this.plugins);try{for(e.s();!(r=e.n()).done;)(o=r.value).destroy(this)}catch(t){e.e(t)}finally{e.f()}this.viewState=new _i(n),this.plugins=n.facet(An).map(function(t){return new Dn(t)}),this.pluginMap.clear(),u=F(this.plugins);try{for(u.s();!(s=u.n()).done;)(a=s.value).update(this)}catch(t){u.e(t)}finally{u.f()}this.docView=new ii(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}}},{key:"updatePlugins",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,i=n.startState.facet(An),e=n.state.facet(An);if(i!=e){r=[],o=F(e);try{for(o.s();!(u=o.n()).done;)s=u.value,(a=i.indexOf(s))<0?r.push(new Dn(s)):((f=this.plugins[a]).mustUpdate=n,r.push(f))}catch(t){o.e(t)}finally{o.f()}h=F(this.plugins);try{for(h.s();!(c=h.n()).done;)(l=c.value).mustUpdate!=n&&l.destroy(this)}catch(t){h.e(t)}finally{h.f()}this.plugins=r,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else{v=F(this.plugins);try{for(v.s();!(d=v.n()).done;)(y=d.value).mustUpdate=n}catch(t){v.e(t)}finally{v.f()}}for(m=0;m<this.plugins.length;m++)this.plugins[m].update(this)}},{key:"measure",value:function t(){var n,i,e,i,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,n=this,i=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];if(!this.destroyed){-1<this.measureScheduled&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,i&&this.observer.forceFlush(),e=null,r=(i=this.scrollDOM).scrollHeight,o=i.scrollTop,s=r-(u=i.clientHeight)-4<o?r:o;try{for(a=0;this.updateState=1,f=this.viewport,h=this.viewState.lineBlockAtHeight(s),(c=this.viewState.measure(this))||this.measureRequests.length||null!=this.viewState.scrollTarget;a++){if(5<a){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}for(l=[],4&c||(v=[l,this.measureRequests],this.measureRequests=v[0],l=v[1]),d=l.map(function(t){try{return t.read(n)}catch(t){return Wc(n.state,t),Yi}}),y=Nn.create(this,this.state,[]),p=m=!1,y.flags|=c,e?e.flags|=c:e=y,this.updateState=2,y.empty||(this.updatePlugins(y),this.inputState.update(y),this.updateAttrs(),m=this.docView.update(y)),k=0;k<l.length;k++)if(d[k]!=Yi)try{(g=l[k]).write&&g.write(d[k],this)}catch(t){Wc(this.state,t)}if(this.viewState.editorHeight&&(this.viewState.scrollTarget?(this.docView.scrollIntoView(this.viewState.scrollTarget),p=!(this.viewState.scrollTarget=null)):(1<(w=this.viewState.lineBlockAt(h.from).top-h.top)||w<-1)&&(this.scrollDOM.scrollTop+=w,p=!0)),m&&this.docView.updateSelection(!0),this.viewport.from==f.from&&this.viewport.to==f.to&&!p&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty){b=F(this.state.facet(bn));try{for(b.s();!(M=b.n()).done;)(x=M.value)(e)}catch(t){b.e(t)}finally{b.f()}}}}},{key:"themeClasses",get:function t(){return Wi+" "+(this.state.facet(zi)?$i:Vi)+" "+this.state.facet(Hi)}},{key:"updateAttrs",value:function t(){var i,e,r,n,i=this,e=i0(this,Rn,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),r={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(On)?"true":"false",class:"cm-content",style:"".concat(g.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};return this.state.readOnly&&(r["aria-readonly"]="true"),i0(this,In,r),n=this.observer.ignore(function(){var t,n,t=Fc(i.contentDOM,i.contentAttrs,r),n=Fc(i.dom,i.editorAttrs,e);return t||n}),this.editorAttrs=e,this.contentAttrs=r,n}},{key:"showAnnouncements",value:function t(n){var i,e,r,o,u,s,a,f,i=!0,e=F(n);try{for(e.s();!(r=e.n()).done;){u=F((o=r.value).effects);try{for(u.s();!(s=u.n()).done;)(a=s.value).is(h.announce)&&(i&&(this.announceDOM.textContent=""),i=!1,(f=this.announceDOM.appendChild(document.createElement("div"))).textContent=a.value)}catch(t){u.e(t)}finally{u.f()}}}catch(t){e.e(t)}finally{e.f()}}},{key:"mountStyles",value:function t(){this.styleModules=this.state.facet(_n),Ft.mount(this.root,this.styleModules.concat(Gi).reverse())}},{key:"readMeasured",value:function t(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&-1<this.measureScheduled&&this.measure(!1)}},{key:"requestMeasure",value:function t(n){var i,e,i=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(function(){return i.measure()})),n&&!(-1<this.measureRequests.indexOf(n))){if(null!=n.key)for(e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===n.key)return void(this.measureRequests[e]=n);this.measureRequests.push(n)}}},{key:"plugin",value:function t(n){var i=this.pluginMap.get(n);return(void 0===i||i&&i.spec!=n)&&this.pluginMap.set(n,i=this.plugins.find(function(t){return t.spec==n})||null),i&&i.update(this).value}},{key:"documentTop",get:function t(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}},{key:"documentPadding",get:function t(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}},{key:"elementAtHeight",value:function t(n){return this.readMeasured(),this.viewState.elementAtHeight(n)}},{key:"lineBlockAtHeight",value:function t(n){return this.readMeasured(),this.viewState.lineBlockAtHeight(n)}},{key:"viewportLineBlocks",get:function t(){return this.viewState.viewportLines}},{key:"lineBlockAt",value:function t(n){return this.viewState.lineBlockAt(n)}},{key:"contentHeight",get:function t(){return this.viewState.contentHeight}},{key:"moveByChar",value:function t(n,i,e){return bl(this,n,pl(this,n,i,e))}},{key:"moveByGroup",value:function t(n,i){var e=this;return bl(this,n,pl(this,n,i,function(t){return kl(e,n.head,t)}))}},{key:"moveToLineBoundary",value:function t(n,i){var e;return ml(this,n,i,!(2<arguments.length&&void 0!==arguments[2])||arguments[2])}},{key:"moveVertically",value:function t(n,i,e){return bl(this,n,gl(this,n,i,e))}},{key:"domAtPos",value:function t(n){return this.docView.domAtPos(n)}},{key:"posAtDOM",value:function t(n){var i;return this.docView.posFromDOM(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0)}},{key:"posAtCoords",value:function t(n){var i=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];return this.readMeasured(),ll(this,n,i)}},{key:"coordsAtPos",value:function t(n){var i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return this.readMeasured(),(e=this.docView.coordsAt(n,i))&&e.left!=e.right?(r=this.state.doc.lineAt(n),dc(e,(u=(o=this.bidiSpans(r))[Xn.find(o,n-r.from,-1,i)]).dir==E.LTR==0<i)):e}},{key:"defaultCharacterWidth",get:function t(){return this.viewState.heightOracle.charWidth}},{key:"defaultLineHeight",get:function t(){return this.viewState.heightOracle.lineHeight}},{key:"textDirection",get:function t(){return this.viewState.defaultTextDirection}},{key:"textDirectionAt",value:function t(n){var i;return!this.state.facet(Sn)||n<this.viewport.from||n>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(n))}},{key:"lineWrapping",get:function t(){return this.viewState.heightOracle.lineWrapping}},{key:"bidiSpans",value:function t(n){var i,e,r,o,u;if(n.length>Zi)return Jc(n.length);i=this.textDirectionAt(n.from),e=F(this.bidiCache);try{for(e.s();!(r=e.n()).done;)if((o=r.value).from==n.from&&o.dir==i)return o.order}catch(t){e.e(t)}finally{e.f()}return u=Gc(n.text,i),this.bidiCache.push(new te(n.from,n.to,i,u)),u}},{key:"hasFocus",get:function t(){var n;return(this.dom.ownerDocument.hasFocus()||g.safari&&(null==(n=this.inputState)?void 0:n.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}},{key:"focus",value:function t(){var n=this;this.observer.ignore(function(){kc(n.contentDOM),n.docView.updateSelection()})}},{key:"setRoot",value:function t(n){this.Nkt!=n&&(this.Nkt=n,this.observer.setWindow((9==n.nodeType?n:n.ownerDocument).defaultView||window),this.mountStyles())}},{key:"destroy",value:function t(){var n,i,e,n=F(this.plugins);try{for(n.s();!(i=n.n()).done;)(e=i.value).destroy(this)}catch(t){n.e(t)}finally{n.f()}this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),-1<this.measureScheduled&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}}],[{key:"scrollIntoView",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return Pn.of(new jn("number"==typeof n?O.cursor(n):n,i.y,i.x,i.yMargin,i.xMargin))}},{key:"domEventHandlers",value:function t(n){return d.define(function(){return{}},{eventHandlers:n})}},{key:"theme",value:function t(n,i){var e,e,e=Ft.newName(),e=[Hi.of(e),_n.of(Kl(".".concat(e),n))];return i&&i.dark&&e.push(zi.of(!0)),e}},{key:"baseTheme",value:function t(n){return st.lowest(_n.of(Kl("."+Wi,n,qi)))}},{key:"findFromDOM",value:function t(n){var n,i,i,i=n.querySelector(".cm-content"),i=i&&c.get(i)||c.get(n);return(null==(n=null==i?void 0:i.rootView)?void 0:n.view)||null}}]),h}()).styleModule=_n,w.inputHandler=Mn,w.focusChangeEffect=xn,w.perLineTextDirection=Sn,w.exceptionSink=wn,w.updateListener=bn,w.editable=On,w.mouseSelectionStyle=gn,w.dragMovesSelection=kn,w.clickAddsSelectionRange=pn,w.decorations=Tn,w.atomicRanges=Ln,w.scrollMargins=Bn,w.darkTheme=zi,w.contentAttributes=In,w.editorAttributes=Rn,w.lineWrapping=w.contentAttributes.of({class:"cm-lineWrapping"}),w.announce=v.define(),Zi=4096,Yi={},te=function(){function s(t,n,i,e){A(this,s),this.from=t,this.to=n,this.dir=i,this.order=e}return D(s,null,[{key:"update",value:function t(n,i){var e,r,o,u;if(i.empty)return n;for(e=[],r=n.length?n[n.length-1].dir:E.LTR,o=Math.max(0,n.length-10);o<n.length;o++)(u=n[o]).dir!=r||i.touchesRange(u.from,u.to)||e.push(new s(i.mapPos(u.from,1),i.mapPos(u.to,-1),u.dir,u.order));return e}}]),s}(),ne=g.mac?"mac":g.windows?"win":g.linux?"linux":"key",e=st.default(w.domEventHandlers({keydown:function t(n,i){return a0(o0(i.state),n,i,"editor")}})),ie=y.define({enables:e}),ee=new WeakMap,re=null,oe=4e3,ue=function(){function u(t,n,i,e,r){A(this,u),this.className=t,this.left=n,this.top=i,this.width=e,this.height=r}return D(u,[{key:"draw",value:function t(){var n=document.createElement("div");return n.className=this.className,this.adjust(n),n}},{key:"update",value:function t(n,i){return i.className==this.className&&(this.adjust(n),!0)}},{key:"adjust",value:function t(n){n.style.left=this.left+"px",n.style.top=this.top+"px",null!=this.width&&(n.style.width=this.width+"px"),n.style.height=this.height+"px"}},{key:"eq",value:function t(n){return this.left==n.left&&this.top==n.top&&this.width==n.width&&this.height==n.height&&this.className==n.className}}],[{key:"forRange",value:function t(n,i,e){var r,o;return e.empty?(r=n.coordsAtPos(e.head,e.assoc||1))?(o=f0(n),[new u(i,r.left-o.left,r.top-o.top,null,r.bottom-r.top)]):[]:l0(n,i,e)}}]),u}(),se=function(){function i(t,n){A(this,i),this.view=t,this.layer=n,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,t)}return D(i,[{key:"update",value:function t(n){n.startState.facet(ae)!=n.state.facet(ae)&&this.setOrder(n.state),(this.layer.update(n,this.dom)||n.geometryChanged)&&n.view.requestMeasure(this.measureReq)}},{key:"setOrder",value:function t(n){for(var i=0,e=n.facet(ae);i<e.length&&e[i]!=this.layer;)i++;this.dom.style.zIndex=String((this.layer.above?150:-1)-i)}},{key:"measure",value:function t(){return this.layer.markers(this.view)}},{key:"draw",value:function t(n){var i,e,r,o,u,s,a,i=this;if(n.length!=this.drawn.length||n.some(function(t,n){return!v0(t,i.drawn[n])})){e=this.dom.firstChild,r=0,o=F(n);try{for(o.s();!(u=o.n()).done;)(s=u.value).update&&e&&s.constructor&&this.drawn[r].constructor&&s.update(e,this.drawn[r])?(e=e.nextSibling,r++):this.dom.insertBefore(s.draw(),e)}catch(t){o.e(t)}finally{o.f()}for(;e;)a=e.nextSibling,e.remove(),e=a;this.drawn=n}}},{key:"destroy",value:function t(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}]),i}(),ae=y.define(),fe=!g.ios,he=y.define({combine:function t(n){return qh(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:function t(n,i){return Math.min(n,i)},drawRangeCursor:function t(n,i){return n||i}})}}),ce=d0({above:!0,markers:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,i=n.state,e=i.facet(he),r=[],o=F(i.selection.ranges);try{for(o.s();!(u=o.n()).done;)if(a=(s=u.value)==i.selection.main,s.empty?!a||fe:e.drawRangeCursor){f=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",h=s.empty?s:O.cursor(s.head,s.head>s.anchor?-1:1),c=F(ue.forRange(n,f,h));try{for(c.s();!(l=c.n()).done;)v=l.value,r.push(v)}catch(t){c.e(t)}finally{c.f()}}}catch(t){o.e(t)}finally{o.f()}return r},update:function t(n,i){n.transactions.some(function(t){return t.selection})&&(i.style.animationName="cm-blink"==i.style.animationName?"cm-blink2":"cm-blink");var e=m0(n);return e&&p0(n.state,i),n.docChanged||n.selectionSet||e},mount:function t(n,i){p0(i.state,n)},class:"cm-cursorLayer"}),le=d0({above:!1,markers:function t(n){return n.state.selection.ranges.map(function(t){return t.empty?[]:ue.forRange(n,"cm-selectionBackground",t)}).reduce(function(t,n){return t.concat(n)})},update:function t(n,i){return n.docChanged||n.selectionSet||n.viewportChanged||m0(n)},class:"cm-selectionLayer"}),Yt={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}},fe&&(Yt[".cm-line"].caretColor="transparent !important"),ve=st.highest(w.theme(Yt)),de=v.define({map:function t(n,i){return null==n?null:i.mapPos(n)}}),ye=b.define({create:function t(){return null},update:function t(n,i){return null!=n&&(n=i.changes.mapPos(n)),i.effects.reduce(function(t,n){return n.is(de)?n.value:t},n)}}),me=d.fromClass(function(){function n(t){A(this,n),this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}return D(n,[{key:"update",value:function t(n){var i,e,e=n.state.field(ye);null==e?null!=this.cursor&&(null!=(i=this.cursor)&&i.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(ye)!=e||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}},{key:"readPos",value:function t(){var n,n,i,n=this.view.state.field(ye),n=null!=n&&this.view.coordsAtPos(n);return n?(i=this.view.scrollDOM.getBoundingClientRect(),{left:n.left-i.left+this.view.scrollDOM.scrollLeft,top:n.top-i.top+this.view.scrollDOM.scrollTop,height:n.bottom-n.top}):null}},{key:"drawCursor",value:function t(n){this.cursor&&(n?(this.cursor.style.left=n.left+"px",this.cursor.style.top=n.top+"px",this.cursor.style.height=n.height+"px"):this.cursor.style.left="-100000px")}},{key:"destroy",value:function t(){this.cursor&&this.cursor.remove()}},{key:"setDropPos",value:function t(n){this.view.state.field(ye)!=n&&this.view.dispatch({effects:de.of(n)})}}]),n}(),{eventHandlers:{dragover:function t(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave:function t(n){n.target!=this.view.contentDOM&&this.view.contentDOM.contains(n.relatedTarget)||this.setDropPos(null)},dragend:function t(){this.setDropPos(null)},drop:function t(){this.setDropPos(null)}}}),pe=function(){function e(t){A(this,e);var n=t.regexp,r=t.decoration,o=t.decorate,i=t.boundary,t=t.maxLength,t=void 0===t?1e3:t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,o)this.addMatch=function(t,n,i,e){return o(e,i,i+t[0].length,t,n)};else if("function"==typeof r)this.addMatch=function(t,n,i,e){var n=r(t,n,i);n&&e(i,i+t[0].length,n)};else{if(!r)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,n,i,e){return e(i,i+t[0].length,r)}}this.boundary=i,this.maxLength=t}return D(e,[{key:"createDeco",value:function t(i){var e,n,r,o,u,s,a,f,e=this,n=new Et,r=n.add.bind(n),o=F(w0(i,this.maxLength));try{for(o.s();!(u=o.n()).done;)a=(s=u.value).from,f=s.to,g0(i.state.doc,this.regexp,a,f,function(t,n){e.addMatch(n,i,t,r)})}catch(t){o.e(t)}finally{o.f()}return n.finish()}},{key:"updateDeco",value:function t(r,n){var o=1e9,u=-1;return r.docChanged&&r.changes.iterChanges(function(t,n,i,e){e>r.view.viewport.from&&i<r.view.viewport.to&&(o=Math.min(i,o),u=Math.max(e,u))}),r.viewportChanged||1e3<u-o?this.createDeco(r.view):-1<u?this.updateRange(r.view,n.map(r.changes),o,u):n}},{key:"updateRange",value:function t(c,l,v,d){var y,n,m,i,y=this,n=F(c.visibleRanges);try{for(i=function t(){var n,i,e,r,o,u,s,a,f,h,n=m.value,i=Math.max(n.from,v),e=Math.min(n.to,d);if(i<e){if(o=(r=c.state.doc.lineAt(i)).to<e?c.state.doc.lineAt(e):r,u=Math.max(n.from,r.from),s=Math.min(n.to,o.to),y.boundary){for(;i>r.from;i--)if(y.boundary.test(r.text[i-1-r.from])){u=i;break}for(;e<o.to;e++)if(y.boundary.test(o.text[e-o.from])){s=e;break}}if(a=[],h=function t(n,i,e){return a.push(e.range(n,i))},r==o)for(y.regexp.lastIndex=u-r.from;(f=y.regexp.exec(r.text))&&f.index<s-r.from;)y.addMatch(f,c,f.index+r.from,h);else g0(c.state.doc,y.regexp,u,s,function(t,n){y.addMatch(n,c,t,h)});l=l.update({filterFrom:u,filterTo:s,filter:function t(n,i){return n<u||s<i},add:a})}},n.s();!(m=n.n()).done;)i()}catch(t){n.e(t)}finally{n.f()}return l}}]),e}(),ke=null!=/x/.unicode?"gu":"g",ge=new RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]",ke),we={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"},be=null,Me=y.define({combine:function t(n){var n=qh(n,{render:null,specialChars:ge,addSpecialChars:null});return(n.replaceTabs=!b0())&&(n.specialChars=new RegExp("\t|"+n.specialChars.source,ke)),n.addSpecialChars&&(n.specialChars=new RegExp(n.specialChars.source+"|"+n.addSpecialChars.source,ke)),n}}),xe=null,Se="\u2022",Ce=function(t){f(r,t);var e=S(r);function r(t,n){var i;return A(this,r),(i=e.call(this)).options=t,i.code=n,i}return D(r,[{key:"eq",value:function t(n){return n.code==this.code}},{key:"toDOM",value:function t(n){var i,n,e,e,i=S0(this.code),n=n.state.phrase("Control character")+" "+(we[this.code]||"0x"+this.code.toString(16)),e=this.options.render&&this.options.render(this.code,n,i);return e||((e=document.createElement("span")).textContent=i,e.title=n,e.setAttribute("aria-label",n),e.className="cm-specialChar",e)}},{key:"ignoreEvent",value:function t(){return!1}}]),r}(tn),je=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).width=t,n}return D(e,[{key:"eq",value:function t(n){return n.width==this.width}},{key:"toDOM",value:function t(){var n=document.createElement("span");return n.textContent="\t",n.className="cm-tab",n.style.width=this.width+"px",n}},{key:"ignoreEvent",value:function t(){return!1}}]),e}(tn),Pe=d.fromClass(function(){function t(){A(this,t),this.height=1e3,this.attrs={style:"padding-bottom: 1000px"}}return D(t,[{key:"update",value:function t(n){var n,n,n=n.view,n=n.viewState.editorHeight-n.defaultLineHeight-n.documentPadding.top-.5;n!=this.height&&(this.height=n,this.attrs={style:"padding-bottom: ".concat(n,"px")})}}]),t}()),Oe=m.line({class:"cm-activeLine"}),Ee=d.fromClass(function(){function n(t){A(this,n),this.decorations=this.getDeco(t)}return D(n,[{key:"update",value:function t(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}},{key:"getDeco",value:function t(n){var i,e,r,o,u,s,i=-1,e=[],r=F(n.state.selection.ranges);try{for(r.s();!(o=r.n()).done;)u=o.value,(s=n.lineBlockAt(u.head)).from>i&&(e.push(Oe.range(s.from)),i=s.from)}catch(t){r.e(t)}finally{r.f()}return m.set(e)}}]),n}(),{decorations:function t(n){return n.decorations}}),Ae=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).content=t,n}return D(e,[{key:"toDOM",value:function t(){var n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?n.setAttribute("aria-label","placeholder "+this.content):n.setAttribute("aria-hidden","true"),n}},{key:"coordsAt",value:function t(n){var i,n,i,n,i=n.firstChild?fc(n.firstChild):[];return i.length?(n=window.getComputedStyle(n.parentNode),i=dc(i[0],"rtl"!=n.direction),n=parseInt(n.lineHeight),i.bottom-i.top>1.5*n?{left:i.left,right:i.right,top:i.top,bottom:i.top+n}:i):null}},{key:"ignoreEvent",value:function t(){return!1}}]),e}(tn),De=2e3,Re={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}]},Ie={style:"cursor: crosshair"},Te="-10000px",Le=function(){function e(t,n,i){A(this,e),this.facet=n,this.createTooltipView=i,this.input=t.state.facet(n),this.tooltips=this.input.filter(function(t){return t}),this.tooltipViews=this.tooltips.map(i)}return D(e,[{key:"update",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,e=n.state.facet(this.facet),r=e.filter(function(t){return t});if(e===this.input){o=F(this.tooltipViews);try{for(o.s();!(u=o.n()).done;)(s=u.value).update&&s.update(n)}catch(t){o.e(t)}finally{o.f()}return!1}for(a=[],f=0;f<r.length;f++)if(c=-1,h=r[f]){for(l=0;l<this.tooltips.length;l++)(v=this.tooltips[l])&&v.create==h.create&&(c=l);c<0?a[f]=this.createTooltipView(h):(d=a[f]=this.tooltipViews[c]).update&&d.update(n)}y=F(this.tooltipViews);try{for(y.s();!(m=y.n()).done;)p=m.value,a.indexOf(p)<0&&(p.dom.remove(),null!=(i=p.destroy))&&i.call(p)}catch(t){y.e(t)}finally{y.f()}return this.input=e,this.tooltips=r,this.tooltipViews=a,!0}}]),e}(),Be=y.define({combine:function t(n){var i,i,i;return{position:g.ios?"absolute":(null==(i=n.find(function(t){return t.position}))?void 0:i.position)||"fixed",parent:(null==(i=n.find(function(t){return t.parent}))?void 0:i.parent)||null,tooltipSpace:(null==(i=n.find(function(t){return t.tooltipSpace}))?void 0:i.tooltipSpace)||L0}}}),_e=new WeakMap,Fe=d.fromClass(function(){function e(t){var n,i,n=this;A(this,e),this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1,i=t.state.facet(Be),this.position=i.position,this.parent=i.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Le(t,Ue,function(t){return n.createTooltip(t)}),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(function(t){Date.now()>n.lastTransaction-50&&0<t.length&&t[t.length-1].intersectionRatio<1&&n.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}return D(e,[{key:"createContainer",value:function t(){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 t(){var n,i,e;if(this.intersectionObserver){this.intersectionObserver.disconnect(),n=F(this.manager.tooltipViews);try{for(n.s();!(i=n.n()).done;)e=i.value,this.intersectionObserver.observe(e.dom)}catch(t){n.e(t)}finally{n.f()}}}},{key:"measureSoon",value:function t(){var n=this;this.measureTimeout<0&&(this.measureTimeout=setTimeout(function(){n.measureTimeout=-1,n.maybeMeasure()},50))}},{key:"update",value:function t(n){var i,i,n,e,r,o,u,s,a;if(n.transactions.length&&(this.lastTransaction=Date.now()),(i=this.manager.update(n))&&this.observeIntersection(),i=i||n.geometryChanged,(n=n.state.facet(Be)).position!=this.position){this.position=n.position,e=F(this.manager.tooltipViews);try{for(e.s();!(r=e.n()).done;)(o=r.value).dom.style.position=this.position}catch(t){e.e(t)}finally{e.f()}i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer(),u=F(this.manager.tooltipViews);try{for(u.s();!(s=u.n()).done;)a=s.value,this.container.appendChild(a.dom)}catch(t){u.e(t)}finally{u.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 t(n){var i,n,i=n.create(this.view);return i.dom.classList.add("cm-tooltip"),n.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")&&((n=document.createElement("div")).className="cm-tooltip-arrow",i.dom.appendChild(n)),i.dom.style.position=this.position,i.dom.style.top=Te,this.container.appendChild(i.dom),i.mount&&i.mount(this.view),i}},{key:"destroy",value:function t(){var n,i,e,r,o;this.view.win.removeEventListener("resize",this.measureSoon),e=F(this.manager.tooltipViews);try{for(e.s();!(r=e.n()).done;)(o=r.value).dom.remove(),null!=(n=o.destroy)&&n.call(o)}catch(t){e.e(t)}finally{e.f()}null!=(i=this.intersectionObserver)&&i.disconnect(),clearTimeout(this.measureTimeout)}},{key:"readMeasure",value:function t(){var i,n,i=this,n=this.view.dom.getBoundingClientRect();return{editor:n,parent:this.parent?this.container.getBoundingClientRect():n,pos:this.manager.tooltips.map(function(t,n){var n=i.manager.tooltipViews[n];return n.getCoords?n.getCoords(t.pos):i.view.coordsAtPos(t.pos)}),size:this.manager.tooltipViews.map(function(t){var n;return t.dom.getBoundingClientRect()}),space:this.view.state.facet(Be).tooltipSpace(this.view)}}},{key:"writeMeasure",value:function t(n){for(var i,e,r,o,u,s,a,f,h,c,l,v,d,y,i,m,p,k,s,g,w,b,M,x,e=n.editor,r=n.space,o=[],u=0;u<this.manager.tooltips.length;u++)if(s=this.manager.tooltips[u],f=(a=this.manager.tooltipViews[u]).dom,h=n.pos[u],c=n.size[u],!h||h.bottom<=Math.max(e.top,r.top)||h.top>=Math.min(e.bottom,r.bottom)||h.right<Math.max(e.left,r.left)-.1||h.left>Math.min(e.right,r.right)+.1)f.style.top=Te;else{if(v=(l=s.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null)?7:0,d=c.right-c.left,y=null!=(i=_e.get(a))?i:c.bottom-c.top,i=a.offset||Ne,m=this.view.textDirection==E.LTR,p=c.width>r.right-r.left?m?r.left:r.right-c.width:m?Math.min(h.left-(l?14:0)+i.x,r.right-d):Math.max(r.left,h.left-d+(l?14:0)-i.x),k=!!s.above,(s=((k=!s.strictSide&&(k?h.top-(c.bottom-c.top)-i.y<r.top:h.bottom+(c.bottom-c.top)+i.y>r.bottom)&&k==r.bottom-h.bottom>h.top-r.top?!k:k)?h.top-r.top:r.bottom-h.bottom)-v)<y&&!1!==a.resize){if(s<this.view.defaultLineHeight){f.style.top=Te;continue}_e.set(a,y),f.style.height=(y=s)+"px"}else f.style.height&&(f.style.height="");if(g=k?h.top-y-v-i.y:h.bottom+v+i.y,w=p+d,!0!==a.overlap){b=F(o);try{for(b.s();!(M=b.n()).done;)(x=M.value).left<w&&x.right>p&&x.top<g+y&&x.bottom>g&&(g=k?x.top-y-2-v:x.bottom+v+2)}catch(t){b.e(t)}finally{b.f()}}"absolute"==this.position?(f.style.top=g-n.parent.top+"px",f.style.left=p-n.parent.left+"px"):(f.style.top=g+"px",f.style.left=p+"px"),l&&(l.style.left="".concat(h.left+(m?i.x:-i.x)-(p+14-7),"px")),!0!==a.overlap&&o.push({left:p,top:g,right:w,bottom:g+y}),f.classList.toggle("cm-tooltip-above",k),f.classList.toggle("cm-tooltip-below",!k),a.positioned&&a.positioned(n.space)}}},{key:"maybeMeasure",value:function t(){var n,i,e;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)){n=F(this.manager.tooltipViews);try{for(n.s();!(i=n.n()).done;)(e=i.value).dom.style.top=Te}catch(t){n.e(t)}finally{n.f()}}}}]),e}(),{eventHandlers:{scroll:function t(){this.maybeMeasure()}}}),Zt=w.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:"".concat(7,"px"),width:"".concat(14,"px"),position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"".concat(7,"px solid transparent"),borderRight:"".concat(7,"px solid transparent")},".cm-tooltip-above &":{bottom:"-".concat(7,"px"),"&:before":{borderTop:"".concat(7,"px solid #bbb")},"&:after":{borderTop:"".concat(7,"px solid #f5f5f5"),bottom:"1px"}},".cm-tooltip-below &":{top:"-".concat(7,"px"),"&:before":{borderBottom:"".concat(7,"px solid #bbb")},"&:after":{borderBottom:"".concat(7,"px solid #f5f5f5"),top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ne={x:0,y:0},Ue=y.define({enables:[Fe,Zt]}),He=y.define(),ze=function(){function i(t){var n=this;A(this,i),this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Le(t,He,function(t){return n.createHostedView(t)})}return D(i,[{key:"createHostedView",value:function t(n){var n=n.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(n.dom),this.mounted&&n.mount&&n.mount(this.view),n}},{key:"mount",value:function t(n){var i,e,r,i=F(this.manager.tooltipViews);try{for(i.s();!(e=i.n()).done;)(r=e.value).mount&&r.mount(n)}catch(t){i.e(t)}finally{i.f()}this.mounted=!0}},{key:"positioned",value:function t(n){var i,e,r,i=F(this.manager.tooltipViews);try{for(i.s();!(e=i.n()).done;)(r=e.value).positioned&&r.positioned(n)}catch(t){i.e(t)}finally{i.f()}}},{key:"update",value:function t(n){this.manager.update(n)}},{key:"destroy",value:function t(){var n,i,e,r,i=F(this.manager.tooltipViews);try{for(i.s();!(e=i.n()).done;)null!=(n=(r=e.value).destroy)&&n.call(r)}catch(t){i.e(t)}finally{i.f()}}}],[{key:"create",value:function t(n){return new i(n)}}]),i}(),We=Ue.compute([He],function(t){var t=t.facet(He).filter(function(t){return t});return 0===t.length?null:{pos:Math.min.apply(Math,Wf(t.map(function(t){return t.pos}))),end:Math.max.apply(Math,Wf(t.filter(function(t){return null!=t.end}).map(function(t){return t.end}))),create:ze.create,above:t[0].above,arrow:t.some(function(t){return t.arrow})}}),Ve=function(){function o(t,n,i,e,r){A(this,o),this.view=t,this.source=n,this.field=i,this.setHover=e,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 D(o,[{key:"update",value:function t(){var n=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(function(){return n.startHover()},20))}},{key:"active",get:function t(){return this.view.state.field(this.field)}},{key:"checkHover",value:function t(){var n;this.hoverTimeout=-1,this.active||((n=Date.now()-this.lastMove.time)<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-n):this.startHover())}},{key:"startHover",value:function t(){var n,i,e,r,o,o,i,u,n=this;clearTimeout(this.restartTimeout),i=this.lastMove,null==(e=this.view.contentDOM.contains(i.target)?this.view.posAtCoords(i):null)||null==(r=this.view.coordsAtPos(e))||i.y<r.top||i.y>r.bottom||i.x<r.left-this.view.defaultCharacterWidth||i.x>r.right+this.view.defaultCharacterWidth||(o=(o=this.view.bidiSpans(this.view.state.doc.lineAt(e)).find(function(t){return t.from<=e&&t.to>=e}))&&o.dir==E.RTL?-1:1,null!=(i=this.source(this.view,e,i.x<r.left?-o:o))&&i.then?(u=this.pending={pos:e},i.then(function(t){n.pending==u&&(n.pending=null,t)&&n.view.dispatch({effects:n.setHover.of(t)})},function(t){return Wc(n.view.state,t,"hover tooltip")})):i&&this.view.dispatch({effects:this.setHover.of(i)}))}},{key:"mousemove",value:function t(n){var i,i,e,r,i;this.lastMove={x:n.clientX,y:n.clientY,target:n.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime)),((i=this.active)&&!B0(this.lastMove.target)||this.pending)&&((r=(e=i||this.pending).pos)==(i=null!=(i=null==i?void 0:i.end)?i:r)?this.view.posAtCoords(this.lastMove)!=r:!_0(this.view,r,i,n.clientX,n.clientY,6))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}},{key:"mouseleave",value:function t(n){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!B0(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}},{key:"destroy",value:function t(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}]),o}(),nn=($e=v.define()).of(null),qe=y.define({combine:function t(n){var i,e,r,o,u,r=F(n);try{for(r.s();!(o=r.n()).done;)u=o.value,i=i||u.topContainer,e=e||u.bottomContainer}catch(t){r.e(t)}finally{r.f()}return{topContainer:i,bottomContainer:e}}}),Ge=d.fromClass(function(){function o(n){var t,i,e,r;A(this,o),this.input=n.state.facet(Ke),this.specs=this.input.filter(function(t){return t}),this.panels=this.specs.map(function(t){return t(n)}),t=n.state.facet(qe),this.top=new Je(n,!0,t.topContainer),this.bottom=new Je(n,!1,t.bottomContainer),this.top.sync(this.panels.filter(function(t){return t.top})),this.bottom.sync(this.panels.filter(function(t){return!t.top})),i=F(this.panels);try{for(i.s();!(e=i.n()).done;)(r=e.value).dom.classList.add("cm-panel"),r.mount&&r.mount()}catch(t){i.e(t)}finally{i.f()}}return D(o,[{key:"update",value:function t(n){var i,i,i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,i=n.state.facet(qe);if(this.top.container!=i.topContainer&&(this.top.sync([]),this.top=new Je(n.view,!0,i.topContainer)),this.bottom.container!=i.bottomContainer&&(this.bottom.sync([]),this.bottom=new Je(n.view,!1,i.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses(),(i=n.state.facet(Ke))!=this.input){e=[],r=[],o=[],u=[],s=F(i=i.filter(function(t){return t}));try{for(s.s();!(a=s.n()).done;)f=a.value,h=this.specs.indexOf(f),c=void 0,h<0?(c=f(n.view),u.push(c)):(c=this.panels[h]).update&&c.update(n),e.push(c),(c.top?r:o).push(c)}catch(t){s.e(t)}finally{s.f()}for(this.specs=i,this.panels=e,this.top.sync(r),this.bottom.sync(o),l=0,v=u;l<v.length;l++)(d=v[l]).dom.classList.add("cm-panel"),d.mount&&d.mount()}else{y=F(this.panels);try{for(y.s();!(m=y.n()).done;)(p=m.value).update&&p.update(n)}catch(t){y.e(t)}finally{y.f()}}}},{key:"destroy",value:function t(){this.top.sync([]),this.bottom.sync([])}}]),o}(),{provide:function t(n){return w.scrollMargins.of(function(t){var t=t.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})}}),Je=function(){function e(t,n,i){A(this,e),this.view=t,this.top=n,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}return D(e,[{key:"sync",value:function t(n){var i,e,r,i=F(this.panels);try{for(i.s();!(e=i.n()).done;)(r=e.value).destroy&&n.indexOf(r)<0&&r.destroy()}catch(t){i.e(t)}finally{i.f()}this.panels=n,this.syncDOM()}},{key:"syncDOM",value:function t(){var n,i,e,r,o;if(0==this.panels.length)this.dom&&(this.dom.remove(),this.dom=void 0);else{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",(n=this.container||this.view.dom).insertBefore(this.dom,this.top?n.firstChild:null)),i=this.dom.firstChild,e=F(this.panels);try{for(e.s();!(r=e.n()).done;)if((o=r.value).dom.parentNode==this.dom){for(;i!=o.dom;)i=V0(i);i=i.nextSibling}else this.dom.insertBefore(o.dom,i)}catch(t){e.e(t)}finally{e.f()}for(;i;)i=V0(i)}}},{key:"scrollMargin",value:function t(){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 t(){var n,i,e,r,o,u;if(this.container&&this.classes!=this.view.themeClasses){n=F(this.classes.split(" "));try{for(n.s();!(i=n.n()).done;)(e=i.value)&&this.container.classList.remove(e)}catch(t){n.e(t)}finally{n.f()}r=F((this.classes=this.view.themeClasses).split(" "));try{for(r.s();!(o=r.n()).done;)(u=o.value)&&this.container.classList.add(u)}catch(t){r.e(t)}finally{r.f()}}}}]),e}(),Ke=y.define({enables:Ge}),(en=function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"compare",value:function t(n){return this==n||this.constructor==n.constructor&&this.eq(n)}},{key:"eq",value:function t(n){return!1}},{key:"destroy",value:function t(n){}}]),i}(jt)).prototype.elementClass="",en.prototype.toDOM=void 0,en.prototype.mapMode=h.TrackBefore,en.prototype.startSide=en.prototype.endSide=-1,en.prototype.point=!0,Qe=y.define(),Xe={class:"",renderEmptyElements:!1,elementStyle:"",markers:function t(){return j.empty},lineMarker:function t(){return null},widgetMarker:function t(){return null},lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Ze=y.define(),Ye=y.define({combine:function t(n){return n.some(function(t){return t})}}),tr=d.fromClass(function(){function r(n){var i,t,e;A(this,r),this.view=n,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=n.state.facet(Ze).map(function(t){return new ir(n,t)}),i=F(this.gutters);try{for(i.s();!(t=i.n()).done;)e=t.value,this.dom.appendChild(e.dom)}catch(t){i.e(t)}finally{i.f()}this.fixed=!n.state.facet(Ye),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}return D(r,[{key:"update",value:function t(n){var i,e,i;this.updateGutters(n)&&(i=this.prevViewport,e=n.view.viewport,i=Math.min(i.to,e.to)-Math.max(i.from,e.from),this.syncGutters(i<.8*(e.to-e.from))),n.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Ye)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=n.view.viewport}},{key:"syncGutters",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,i=this,e=this.dom.nextSibling;n&&this.dom.remove(),r=j.iter(this.view.state.facet(Qe),this.view.viewport.from),o=[],u=this.gutters.map(function(t){return new nr(t,i.view.viewport,-i.view.documentPadding.top)}),s=F(this.view.viewportLineBlocks);try{for(s.s();!(a=s.n()).done;)if(f=a.value,o.length&&(o=[]),Array.isArray(f.type)){h=!0,c=F(f.type);try{for(c.s();!(l=c.n()).done;)if((v=l.value).type==P.Text&&h){J0(r,o,v.from),d=F(u);try{for(d.s();!(y=d.n()).done;)(m=y.value).line(this.view,v,o)}catch(t){d.e(t)}finally{d.f()}h=!1}else if(v.widget){p=F(u);try{for(p.s();!(k=p.n()).done;)(g=k.value).widget(this.view,v)}catch(t){p.e(t)}finally{p.f()}}}catch(t){c.e(t)}finally{c.f()}}else if(f.type==P.Text){J0(r,o,f.from),w=F(u);try{for(w.s();!(b=w.n()).done;)(M=b.value).line(this.view,f,o)}catch(t){w.e(t)}finally{w.f()}}}catch(t){s.e(t)}finally{s.f()}x=F(u);try{for(x.s();!(S=x.n()).done;)(C=S.value).finish()}catch(t){x.e(t)}finally{x.f()}n&&this.view.scrollDOM.insertBefore(this.dom,e)}},{key:"updateGutters",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,i=n.startState.facet(Ze),e=n.state.facet(Ze),r=n.docChanged||n.heightChanged||n.viewportChanged||!j.eq(n.startState.facet(Qe),n.state.facet(Qe),n.view.viewport.from,n.view.viewport.to);if(i==e){o=F(this.gutters);try{for(o.s();!(u=o.n()).done;)(s=u.value).update(n)&&(r=!0)}catch(t){o.e(t)}finally{o.f()}}else{r=!0,a=[],f=F(e);try{for(f.s();!(h=f.n()).done;)c=h.value,(l=i.indexOf(c))<0?a.push(new ir(this.view,c)):(this.gutters[l].update(n),a.push(this.gutters[l]))}catch(t){f.e(t)}finally{f.f()}v=F(this.gutters);try{for(v.s();!(d=v.n()).done;)(y=d.value).dom.remove(),a.indexOf(y)<0&&y.destroy()}catch(t){v.e(t)}finally{v.f()}for(m=0,p=a;m<p.length;m++)this.dom.appendChild((k=p[m]).dom);this.gutters=a}return r}},{key:"destroy",value:function t(){var n,i,e,n=F(this.gutters);try{for(n.s();!(i=n.n()).done;)(e=i.value).destroy()}catch(t){n.e(t)}finally{n.f()}this.dom.remove()}}]),r}(),{provide:function t(i){return w.scrollMargins.of(function(t){var n=t.plugin(i);return n&&0!=n.gutters.length&&n.fixed?t.textDirection==E.LTR?{left:n.dom.offsetWidth}:{right:n.dom.offsetWidth}:null})}}),nr=function(){function e(t,n,i){A(this,e),this.gutter=t,this.height=i,this.i=0,this.cursor=j.iter(t.markers,n.from)}return D(e,[{key:"addElement",value:function t(n,i,e){var r,o,u,r=this.gutter,o=i.top-this.height;this.i==r.elements.length?(u=new er(n,i.height,o,e),r.elements.push(u),r.dom.appendChild(u.dom)):r.elements[this.i].update(n,i.height,o,e),this.height=i.bottom,this.i++}},{key:"line",value:function t(n,i,e){var r,e,e,r=[];J0(this.cursor,r,i.from),e.length&&(r=r.concat(e)),(e=this.gutter.config.lineMarker(n,i,r))&&r.unshift(e),e=this.gutter,0==r.length&&!e.config.renderEmptyElements||this.addElement(n,i,r)}},{key:"widget",value:function t(n,i){var e=this.gutter.config.widgetMarker(n,i.widget,i);e&&this.addElement(n,i,[e])}},{key:"finish",value:function t(){for(var n,i,n=this.gutter;n.elements.length>this.i;)i=n.elements.pop(),n.dom.removeChild(i.dom),i.destroy()}}]),e}(),ir=function(){function i(r,o){var u,t,n,u=this;for(n in A(this,i),this.view=r,this.config=o,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:""),t=function t(e){u.dom.addEventListener(e,function(t){var n,i,i,i,n=t.target;if(n!=u.dom&&u.dom.contains(n)){for(;n.parentNode!=u.dom;)n=n.parentNode;i=((i=n.getBoundingClientRect()).top+i.bottom)/2}else i=t.clientY;i=r.lineBlockAtHeight(i-r.documentTop),o.domEventHandlers[e](r,i,t)&&t.preventDefault()})},o.domEventHandlers)t(n);this.markers=G0(o.markers(r)),o.initialSpacer&&(this.spacer=new er(r,0,0,[o.initialSpacer(r)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}return D(i,[{key:"update",value:function t(n){var i,e,e,i=this.markers;return this.markers=G0(this.config.markers(n.view)),this.spacer&&this.config.updateSpacer&&(e=this.config.updateSpacer(this.spacer.markers[0],n))!=this.spacer.markers[0]&&this.spacer.update(n.view,0,0,[e]),e=n.view.viewport,!j.eq(this.markers,i,e.from,e.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(n)}},{key:"destroy",value:function t(){var n,i,e,n=F(this.elements);try{for(n.s();!(i=n.n()).done;)(e=i.value).destroy()}catch(t){n.e(t)}finally{n.f()}}}]),i}(),er=function(){function r(t,n,i,e){A(this,r),this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,i,e)}return D(r,[{key:"update",value:function t(n,i,e,r){this.height!=i&&(this.dom.style.height=(this.height=i)+"px"),this.above!=e&&(this.dom.style.marginTop=(this.above=e)?e+"px":""),K0(this.markers,r)||this.setMarkers(n,r)}},{key:"setMarkers",value:function t(n,i){for(var e,r,o,u,s,a,f,h,c,l,l,e="cm-gutterElement",r=this.dom.firstChild,o=0,u=0;;){if(s=u,f=!1,a=o<i.length?i[o++]:null){for((h=a.elementClass)&&(e+=" "+h),c=u;c<this.markers.length;c++)if(this.markers[c].compare(a)){s=c,f=!0;break}}else s=this.markers.length;for(;u<s;)(l=this.markers[u++]).toDOM&&(l.destroy(r),l=r.nextSibling,r.remove(),r=l);if(!a)break;a.toDOM&&(f?r=r.nextSibling:this.dom.insertBefore(a.toDOM(n),r)),f&&u++}this.dom.className=e,this.markers=i}},{key:"destroy",value:function t(){this.setMarkers(null,[])}}]),r}(),rr=y.define(),or=y.define({combine:function t(n){return qh(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers:function t(n,i){var o,e,u,o=Object.assign({},n),e=function t(){var e=o[u],r=i[u];o[u]=e?function(t,n,i){return e(t,n,i)||r(t,n,i)}:r};for(u in i)e();return o}})}}),ur=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).number=t,n}return D(e,[{key:"eq",value:function t(n){return this.number==n.number}},{key:"toDOM",value:function t(){return document.createTextNode(this.number)}}]),e}(en),sr=Ze.compute([or],function(t){return{class:"cm-lineNumbers",renderEmptyElements:!1,markers:function t(n){return n.state.facet(rr)},lineMarker:function t(n,i,e){return e.some(function(t){return t.toDOM})?null:new ur(Q0(n,n.state.doc.lineAt(i.from).number))},widgetMarker:function t(){return null},lineMarkerChange:function t(n){return n.startState.facet(or)!=n.state.facet(or)},initialSpacer:function t(n){return new ur(Q0(n,Z0(n.state.doc.lines)))},updateSpacer:function t(n,i){var i=Q0(i.view,Z0(i.view.state.doc.lines));return i==n.number?n:new ur(i)},domEventHandlers:t.facet(or).domEventHandlers}}),ar=new(function(t){f(i,t);var n=S(i);function i(){var t;return A(this,i),(t=n.apply(this,arguments)).elementClass="cm-activeLineGutter",t}return D(i)}(en)),fr=Qe.compute(["selection"],function(t){var n,i,e,r,o,u,n=[],i=-1,e=F(t.selection.ranges);try{for(e.s();!(r=e.n()).done;)o=r.value,i<(u=t.doc.lineAt(o.head).from)&&(i=u,n.push(ar.range(u)))}catch(t){e.e(t)}finally{e.f()}return j.of(n)}),hr=new Map,cr=nv(new pe({regexp:/\t| +/g,decoration:function t(n){return tv(n[0])},boundary:/\S/})),lr=nv(new pe({regexp:/\s+$/g,decoration:m.mark({class:"cm-trailingSpace"}),boundary:/\S/})),u={HeightMap:Pi,HeightOracle:xi,MeasuredHeights:Si,QueryType:p,ChangedRange:Fn,computeOrder:Gc,moveVisually:Kc},vr=L.View=Object.freeze({__proto__:null,BidiSpan:Xn,BlockInfo:Ci,get BlockType(){return P},Decoration:m,get Direction(){return E},EditorView:w,GutterMarker:en,MatchDecorator:pe,RectangleMarker:ue,ViewPlugin:d,ViewUpdate:Nn,WidgetType:tn,qde:u,closeHoverTooltips:nn,crosshairCursor:I0,drawSelection:y0,dropCursor:k0,getPanel:W0,getTooltip:N0,gutter:$0,gutterLineClass:Qe,gutters:q0,hasHoverTooltips:U0,highlightActiveLine:j0,highlightActiveLineGutter:Y0,highlightSpecialChars:M0,highlightTrailingWhitespace:ev,highlightWhitespace:iv,hoverTooltip:F0,keymap:ie,layer:d0,lineNumberMarkers:rr,lineNumbers:X0,logException:Wc,panels:z0,placeholder:P0,rectangularSelection:R0,repositionTooltips:H0,runScopeHandlers:u0,scrollPastEnd:C0,showPanel:Ke,showTooltip:Ue,tooltips:T0}),dr=1024,yr=0,mr=D(function t(n,i){A(this,t),this.from=n,this.to=i}),(M=function(){function n(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};A(this,n),this.id=yr++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return D(n,[{key:"add",value:function t(n){var i=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof n&&(n=kr.match(n)),function(t){var t=n(t);return void 0===t?null:[i,t]}}}]),n}()).closedBy=new M({deserialize:function t(n){return n.split(" ")}}),M.openedBy=new M({deserialize:function t(n){return n.split(" ")}}),M.group=new M({deserialize:function t(n){return n.split(" ")}}),M.contextHash=new M({perNode:!0}),M.lookAhead=new M({perNode:!0}),M.mounted=new M({perNode:!0}),pr=Object.create(null),(kr=function(){function a(t,n,i){var e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;A(this,a),this.name=t,this.props=n,this.id=i,this.flags=e}return D(a,[{key:"prop",value:function t(n){return this.props[n.id]}},{key:"isTop",get:function t(){return 0<(1&this.flags)}},{key:"isSkipped",get:function t(){return 0<(2&this.flags)}},{key:"isError",get:function t(){return 0<(4&this.flags)}},{key:"isAnonymous",get:function t(){return 0<(8&this.flags)}},{key:"is",value:function t(n){var i;return"string"==typeof n?this.name==n||!!(i=this.prop(M.group))&&-1<i.indexOf(n):this.id==n}}],[{key:"define",value:function t(n){var i,e,r,o,u,s,i=n.props&&n.props.length?Object.create(null):pr,e=(n.top?1:0)|(n.skipped?2:0)|(n.error?4:0)|(null==n.name?8:0),r=new a(n.name||"",i,n.id,e);if(n.props){o=F(n.props);try{for(o.s();!(u=o.n()).done;)if(s=u.value,s=Array.isArray(s)?s:s(r)){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[s[0].id]=s[1]}}catch(t){o.e(t)}finally{o.f()}}return r}},{key:"match",value:function t(n){var r,i,e,o,u,r=Object.create(null);for(i in n){e=F(i.split(" "));try{for(e.s();!(o=e.n()).done;)u=o.value,r[u]=n[i]}catch(t){e.e(t)}finally{e.f()}}return function(t){for(var n,i,e,n=t.prop(M.group),i=-1;i<(n?n.length:0);i++)if(e=r[i<0?t.name:n[i]])return e}}}]),a}()).none=new kr("",Object.create(null),0,8),n=function(){function v(t){A(this,v),this.types=t;for(var n=0;n<t.length;n++)if(t[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}return D(v,[{key:"extend",value:function t(){for(var n,i,e,r,o,u,s,a,f,h,c,l,n=[],i=arguments.length,e=new Array(i),r=0;r<i;r++)e[r]=arguments[r];o=F(this.types);try{for(o.s();!(u=o.n()).done;){s=u.value,a=null,f=F(e);try{for(f.s();!(h=f.n()).done;)(l=(c=h.value)(s))&&((a=a||Object.assign({},s.props))[l[0].id]=l[1])}catch(t){f.e(t)}finally{f.f()}n.push(a?new kr(s.name,a,s.id,s.flags):s)}}catch(t){o.e(t)}finally{o.f()}return new v(n)}}]),v}(),gr=new WeakMap,wr=new WeakMap,(o=br=br||{})[o.ExcludeBuffers=1]="ExcludeBuffers",o[o.IncludeAnonymous=2]="IncludeAnonymous",o[o.IgnoreMounts=4]="IgnoreMounts",o[o.IgnoreOverlays=8]="IgnoreOverlays",(x=function(){function h(t,n,i,e,r){var o,u,s,a,f;if(A(this,h),this.type=t,this.children=n,this.positions=i,this.length=e,this.props=null,r&&r.length){this.props=Object.create(null),o=F(r);try{for(o.s();!(u=o.n()).done;)a=(s=Gf(u.value,2))[0],f=s[1],this.props["number"==typeof a?a:a.id]=f}catch(t){o.e(t)}finally{o.f()}}}return D(h,[{key:"toString",value:function t(){var n,i,e,r,o,u,n=this.prop(M.mounted);if(n&&!n.overlay)return n.tree.toString();i="",e=F(this.children);try{for(e.s();!(r=e.n()).done;)(u=(o=r.value).toString())&&(i&&(i+=","),i+=u)}catch(t){e.e(t)}finally{e.f()}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(i.length?"("+i+")":""):i}},{key:"cursor",value:function t(){var n;return new Pr(this.topNode,0<arguments.length&&void 0!==arguments[0]?arguments[0]:0)}},{key:"cursorAt",value:function t(n){var i,e,r,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=gr.get(this)||this.topNode,r=new Pr(r);return r.moveTo(n,i),gr.set(this,r.oMi),r}},{key:"topNode",get:function t(){return new Sr(this,0,0,null)}},{key:"resolve",value:function t(n){var i,n,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=uv(gr.get(this)||this.topNode,n,i,!1);return gr.set(this,n),n}},{key:"resolveInner",value:function t(n){var i,n,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=uv(wr.get(this)||this.topNode,n,i,!0);return wr.set(this,n),n}},{key:"iterate",value:function t(n){for(var i,e,r,o,r,u,r,s,a,f,i=n.enter,e=n.leave,r=n.from,o=void 0===r?0:r,r=n.to,u=void 0===r?this.length:r,r=n.mode||0,s=0<(r&br.IncludeAnonymous),a=this.cursor(r|br.IncludeAnonymous);;){if(f=!1,a.from<=u&&a.to>=o&&(!s&&a.type.isAnonymous||!1!==i(a))){if(a.firstChild())continue;f=!0}for(;f&&e&&(s||!a.type.isAnonymous)&&e(a),!a.nextSibling();){if(!a.parent())return;f=!0}}}},{key:"prop",value:function t(n){return n.perNode?this.props?this.props[n.id]:void 0:this.type.prop(n)}},{key:"propValues",get:function t(){var n,i,n=[];if(this.props)for(i in this.props)n.push([+i,this.props[i]]);return n}},{key:"balance",value:function t(){var e,n,e=this,n;return this.children.length<=8?this:lv(kr.none,this.children,this.positions,0,this.children.length,0,this.length,function(t,n,i){return new h(e.type,t,n,i,e.propValues)},(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).makeTree||function(t,n,i){return new h(kr.none,t,n,i)})}}],[{key:"build",value:hv}]),h}()).empty=new x(kr.none,[],[],0),Mr=function(){function i(t,n){A(this,i),this.buffer=t,this.index=n}return D(i,[{key:"id",get:function t(){return this.buffer[this.index-4]}},{key:"start",get:function t(){return this.buffer[this.index-3]}},{key:"end",get:function t(){return this.buffer[this.index-2]}},{key:"size",get:function t(){return this.buffer[this.index-1]}},{key:"pos",get:function t(){return this.index}},{key:"next",value:function t(){this.index-=4}},{key:"fork",value:function t(){return new i(this.buffer,this.index)}}]),i}(),xr=function(){function h(t,n,i){A(this,h),this.buffer=t,this.length=n,this.set=i}return D(h,[{key:"type",get:function t(){return kr.none}},{key:"toString",value:function t(){for(var n,i,n=[],i=0;i<this.buffer.length;)n.push(this.childString(i)),i=this.buffer[i+3];return n.join(",")}},{key:"childString",value:function t(n){var i,e,i,r,o,i=this.buffer[n],e=this.buffer[n+3],i=this.set.types[i],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),e==(n+=4))return r;for(o=[];n<e;)o.push(this.childString(n)),n=this.buffer[n+3];return r+"("+o.join(",")+")"}},{key:"findChild",value:function t(n,i,e,r,o){for(var u,s,a,u=this.buffer,s=-1,a=n;a!=i&&!(rv(o,r,u[a+1],u[a+2])&&(s=a,0<e));a=u[a+3]);return s}},{key:"slice",value:function t(n,i,e){for(var r,o,u,s,a,f,r=this.buffer,o=new Uint16Array(i-n),u=0,s=n,a=0;s<i;)o[a++]=r[s++],o[a++]=r[s++]-e,f=o[a++]=r[s++]-e,o[a++]=r[s++]-n,u=Math.max(u,f);return new h(o,u,this.set)}}]),h}(),Sr=function(){function y(t,n,i,e){A(this,y),this.oMi=t,this.from=n,this.index=i,this.sft=e}return D(y,[{key:"type",get:function t(){return this.oMi.type}},{key:"name",get:function t(){return this.oMi.type.name}},{key:"to",get:function t(){return this.from+this.oMi.length}},{key:"nextChild",value:function t(n,i,e,r){for(var o,u,s,a,f,h,c,l,v,v,d,o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,u=this;;){for(a=(s=u.oMi).children,f=s.positions,h=0<i?a.length:-1;n!=h;n+=i)if(c=a[n],rv(r,e,l=f[n]+u.from,l+c.length))if(c instanceof xr){if(!(o&br.ExcludeBuffers)&&-1<(v=c.findChild(0,c.buffer.length,i,e-l,r)))return new jr(new Cr(u,c,n,l),null,v)}else if(o&br.IncludeAnonymous||!c.type.isAnonymous||fv(c))return v=void 0,o&br.IgnoreMounts||!c.props||!(v=c.prop(M.mounted))||v.overlay?(d=new y(c,l,n,u),o&br.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(i<0?c.children.length-1:0,i,e,r)):new y(v.tree,l,n,u);if(o&br.IncludeAnonymous||!u.type.isAnonymous)return null;if(n=0<=u.index?u.index+i:i<0?-1:u.sft.oMi.children.length,!(u=u.sft))return null}}},{key:"firstChild",get:function t(){return this.nextChild(0,1,0,4)}},{key:"lastChild",get:function t(){return this.nextChild(this.oMi.children.length-1,-1,0,4)}},{key:"childAfter",value:function t(n){return this.nextChild(0,1,n,2)}},{key:"childBefore",value:function t(n){return this.nextChild(this.oMi.children.length-1,-1,n,-2)}},{key:"enter",value:function t(n,i){var e,r,o,u,s,a,f,h,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;if(!(e&br.IgnoreOverlays)&&(r=this.oMi.prop(M.mounted))&&r.overlay){o=n-this.from,u=F(r.overlay);try{for(u.s();!(s=u.n()).done;)if(f=(a=s.value).from,h=a.to,(0<i?f<=o:f<o)&&(i<0?o<=h:o<h))return new y(r.tree,r.overlay[0].from+this.from,-1,this)}catch(t){u.e(t)}finally{u.f()}}return this.nextChild(0,1,n,i,e)}},{key:"nextSignificantParent",value:function t(){for(var n=this;n.type.isAnonymous&&n.sft;)n=n.sft;return n}},{key:"parent",get:function t(){return this.sft?this.sft.nextSignificantParent():null}},{key:"nextSibling",get:function t(){return this.sft&&0<=this.index?this.sft.nextChild(this.index+1,1,0,4):null}},{key:"prevSibling",get:function t(){return this.sft&&0<=this.index?this.sft.nextChild(this.index-1,-1,0,4):null}},{key:"cursor",value:function t(){var n;return new Pr(this,0<arguments.length&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function t(){return this.oMi}},{key:"toTree",value:function t(){return this.oMi}},{key:"resolve",value:function t(n){var i;return uv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function t(n){var i;return uv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function t(n){return ov(this,n)}},{key:"getChild",value:function t(n){var i,e,n,i,e,n=sv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null);return n.length?n[0]:null}},{key:"getChildren",value:function t(n){var i,e,i,e;return sv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null)}},{key:"toString",value:function t(){return this.oMi.toString()}},{key:"node",get:function t(){return this}},{key:"matchContext",value:function t(n){return av(this,n)}}]),y}(),Cr=D(function t(n,i,e,r){A(this,t),this.parent=n,this.buffer=i,this.index=e,this.start=r}),jr=function(){function o(t,n,i){A(this,o),this.context=t,this.sft=n,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}return D(o,[{key:"name",get:function t(){return this.type.name}},{key:"from",get:function t(){return this.context.start+this.context.buffer.buffer[this.index+1]}},{key:"to",get:function t(){return this.context.start+this.context.buffer.buffer[this.index+2]}},{key:"child",value:function t(n,i,e){var r,r,r=this.context.buffer,r=r.findChild(this.index+4,r.buffer[this.index+3],n,i-this.context.start,e);return r<0?null:new o(this.context,this,r)}},{key:"firstChild",get:function t(){return this.child(1,0,4)}},{key:"lastChild",get:function t(){return this.child(-1,0,4)}},{key:"childAfter",value:function t(n){return this.child(1,n,2)}},{key:"childBefore",value:function t(n){return this.child(-1,n,-2)}},{key:"enter",value:function t(n,i){var e,r,r,e;return(2<arguments.length&&void 0!==arguments[2]?arguments[2]:0)&br.ExcludeBuffers||(r=(r=this.context.buffer).findChild(this.index+4,r.buffer[this.index+3],0<i?1:-1,n-this.context.start,i))<0?null:new o(this.context,this,r)}},{key:"parent",get:function t(){return this.sft||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function t(n){return this.sft?null:this.context.parent.nextChild(this.context.index+n,n,0,4)}},{key:"nextSibling",get:function t(){var n,i,n=this.context.buffer,i=n.buffer[this.index+3];return i<(this.sft?n.buffer[this.sft.index+3]:n.buffer.length)?new o(this.context,this.sft,i):this.externalSibling(1)}},{key:"prevSibling",get:function t(){var n,i,n=this.context.buffer,i=this.sft?this.sft.index+4:0;return this.index==i?this.externalSibling(-1):new o(this.context,this.sft,n.findChild(i,this.index,-1,0,4))}},{key:"cursor",value:function t(){var n;return new Pr(this,0<arguments.length&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function t(){return null}},{key:"toTree",value:function t(){var n,i,e,r,o,u,n=[],i=[],e=this.context.buffer,r=this.index+4,o=e.buffer[this.index+3];return r<o&&(u=e.buffer[this.index+1],n.push(e.slice(r,o,u)),i.push(0)),new x(this.type,n,i,this.to-this.from)}},{key:"resolve",value:function t(n){var i;return uv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function t(n){var i;return uv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function t(n){return ov(this,n)}},{key:"toString",value:function t(){return this.context.buffer.childString(this.index)}},{key:"getChild",value:function t(n){var i,e,n,i,e,n=sv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null);return n.length?n[0]:null}},{key:"getChildren",value:function t(n){var i,e,i,e;return sv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null)}},{key:"node",get:function t(){return this}},{key:"matchContext",value:function t(n){return av(this,n)}}]),o}(),Pr=function(){function e(t){var n,i,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;if(A(this,e),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Sr)this.yieldNode(t);else{for(this.oMi=t.context.parent,this.buffer=t.context,i=t.sft;i;i=i.sft)this.stack.unshift(i.index);this.bufferNode=t,this.yieldBuf(t.index)}}return D(e,[{key:"name",get:function t(){return this.type.name}},{key:"yieldNode",value:function t(n){return!!n&&(this.oMi=n,this.type=n.type,this.from=n.from,this.to=n.to,!0)}},{key:"yieldBuf",value:function t(n,i){this.index=n;var e=this.buffer,r=e.start,e=e.buffer;return this.type=i||e.set.types[e.buffer[n]],this.from=r+e.buffer[n+1],this.to=r+e.buffer[n+2],!0}},{key:"yield",value:function t(n){return!!n&&(n instanceof Sr?(this.buffer=null,this.yieldNode(n)):(this.buffer=n.context,this.yieldBuf(n.index,n.type)))}},{key:"toString",value:function t(){return this.buffer?this.buffer.buffer.childString(this.index):this.oMi.toString()}},{key:"enterChild",value:function t(n,i,e){var r,r;return this.buffer?!((r=(r=this.buffer.buffer).findChild(this.index+4,r.buffer[this.index+3],n,i-this.buffer.start,e))<0)&&(this.stack.push(this.index),this.yieldBuf(r)):this.yield(this.oMi.nextChild(n<0?this.oMi.oMi.children.length-1:0,n,i,e,this.mode))}},{key:"firstChild",value:function t(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function t(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function t(n){return this.enterChild(1,n,2)}},{key:"childBefore",value:function t(n){return this.enterChild(-1,n,-2)}},{key:"enter",value:function t(n,i){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(e&br.ExcludeBuffers)&&this.enterChild(1,n,i):this.yield(this.oMi.enter(n,i,e))}},{key:"parent",value:function t(){var t;return this.buffer?this.stack.length?this.yieldBuf(this.stack.pop()):(t=this.mode&br.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent(),this.buffer=null,this.yieldNode(t)):this.yieldNode(this.mode&br.IncludeAnonymous?this.oMi.sft:this.oMi.parent)}},{key:"sibling",value:function t(n){var i,e,r,r;if(!this.buffer)return!!this.oMi.sft&&this.yield(this.oMi.index<0?null:this.oMi.sft.nextChild(this.oMi.index+n,n,0,4,this.mode));if(i=this.buffer.buffer,e=this.stack.length-1,n<0){if(r=e<0?0:this.stack[e]+4,this.index!=r)return this.yieldBuf(i.findChild(r,this.index,-1,0,4))}else if((r=i.buffer[this.index+3])<(e<0?i.buffer.length:i.buffer[this.stack[e]+3]))return this.yieldBuf(r);return e<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+n,n,0,4,this.mode))}},{key:"nextSibling",value:function t(){return this.sibling(1)}},{key:"prevSibling",value:function t(){return this.sibling(-1)}},{key:"atLastNode",value:function t(n){var i,e,r,o,u,s,a,f,h,r=this.buffer;if(r){if(0<n){if(this.index<r.buffer.buffer.length)return!1}else for(o=0;o<this.index;o++)if(r.buffer.buffer[o+3]<this.index)return!1;i=r.index,e=r.parent}else i=(u=this.oMi).index,e=u.sft;for(;e;i=(s=e).index,e=s.sft)if(-1<i)for(a=i+n,f=n<0?-1:e.oMi.children.length;a!=f;a+=n)if(h=e.oMi.children[a],this.mode&br.IncludeAnonymous||h instanceof xr||!h.type.isAnonymous||fv(h))return!1;return!0}},{key:"move",value:function t(n,i){if(i&&this.enterChild(n,0,4))return!0;for(;;){if(this.sibling(n))return!0;if(this.atLastNode(n)||!this.parent())return!1}}},{key:"next",value:function t(){var n;return this.move(1,!(0<arguments.length&&void 0!==arguments[0])||arguments[0])}},{key:"prev",value:function t(){var n;return this.move(-1,!(0<arguments.length&&void 0!==arguments[0])||arguments[0])}},{key:"moveTo",value:function t(n){for(var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;(this.from==this.to||(i<1?this.from>=n:this.from>n)||(-1<i?this.to<=n:this.to<n))&&this.parent(););for(;this.enterChild(1,n,i););return this}},{key:"node",get:function t(){var n,i,e,r,o,u,s;if(!this.buffer)return this.oMi;if(i=null,e=0,(n=this.bufferNode)&&n.context==this.buffer)t:for(r=this.index,o=this.stack.length;0<=o;){for(u=n;u;u=u.sft)if(u.index==r){if(r==this.index)return u;i=u,e=o+1;break t}r=this.stack[--o]}for(s=e;s<this.stack.length;s++)i=new jr(this.buffer,i,this.stack[s]);return this.bufferNode=new jr(this.buffer,i,this.index)}},{key:"tree",get:function t(){return this.buffer?null:this.oMi.oMi}},{key:"iterate",value:function t(n,i){for(var e,r,e=0;;){if(r=!1,this.type.isAnonymous||!1!==n(this)){if(this.firstChild()){e++;continue}this.type.isAnonymous||(r=!0)}for(;r&&i&&i(this),r=this.type.isAnonymous,!this.nextSibling();){if(!e)return;this.parent(),e--,r=!0}}}},{key:"matchContext",value:function t(n){var i,e,r,o,u;if(!this.buffer)return av(this.node,n);for(e=(i=this.buffer.buffer).set.types,r=n.length-1,o=this.stack.length-1;0<=r;o--){if(o<0)return av(this.node,n,r);if(!(u=e[i.buffer[this.stack[o]]]).isAnonymous){if(n[r]&&n[r]!=u.name)return!1;r--}}return!0}}]),e}(),Or=new WeakMap,Er=function(){function y(t,n,i,e){var r,o,r=4<arguments.length&&void 0!==arguments[4]&&arguments[4],o=5<arguments.length&&void 0!==arguments[5]&&arguments[5];A(this,y),this.from=t,this.to=n,this.tree=i,this.offset=e,this.open=(r?1:0)|(o?2:0)}return D(y,[{key:"openStart",get:function t(){return 0<(1&this.open)}},{key:"openEnd",get:function t(){return 0<(2&this.open)}}],[{key:"addTree",value:function t(n){var i,e,r,o,u,s,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],e,r=[new y(0,n.length,n,0,!1,2<arguments.length&&void 0!==arguments[2]&&arguments[2])],o=F(i);try{for(o.s();!(u=o.n()).done;)(s=u.value).to>n.length&&r.push(s)}catch(t){o.e(t)}finally{o.f()}return r}},{key:"applyChanges",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,d,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:128;if(!i.length)return n;for(r=[],o=1,u=n.length?n[0]:null,f=a=s=0;;s++){if(e<=(c=(h=s<i.length?i[s]:null)?h.fromA:1e9)-a)for(;u&&u.from<c&&((a>=(l=u).from||c<=l.to||f)&&(v=Math.max(l.from,a)-f,l=(d=Math.min(l.to,c)-f)<=v?null:new y(v,d,l.tree,l.offset+f,0<s,!!h)),l&&r.push(l),!(u.to>c));)u=o<n.length?n[o++]:null;if(!h)break;a=h.toA,f=h.toA-h.toB}return r}}]),y}(),Ar=function(){function t(){A(this,t)}return D(t,[{key:"startParse",value:function t(n,i,e){return"string"==typeof n&&(n=new Dr(n)),e=e?e.length?e.map(function(t){return new mr(t.from,t.to)}):[new mr(0,0)]:[new mr(0,n.length)],this.createParse(n,i||[],e)}},{key:"parse",value:function t(n,i,e){var t,r;for(t=this.startParse(n,i,e);;)if(r=t.advance())return r}}]),t}(),Dr=function(){function n(t){A(this,n),this.string=t}return D(n,[{key:"length",get:function t(){return this.string.length}},{key:"chunk",value:function t(n){return this.string.slice(n)}},{key:"lineChunks",get:function t(){return!1}},{key:"read",value:function t(n,i){return this.string.slice(n,i)}}]),n}(),new M({perNode:!0}),Rr=0,Ir=function(){function u(t,n,i){A(this,u),this.set=t,this.base=n,this.modified=i,this.id=Rr++}return D(u,null,[{key:"define",value:function t(n){var i,e,r,o;if(null!=n&&n.base)throw new Error("Can not derive from a modified tag");if((i=new u([],null,[])).set.push(i),n){e=F(n.set);try{for(e.s();!(r=e.n()).done;)o=r.value,i.set.push(o)}catch(t){e.e(t)}finally{e.f()}}return i}},{key:"defineModifier",value:function t(){var n=new Lr;return function(t){return-1<t.modified.indexOf(n)?t:Lr.get(t.base||t,t.modified.concat(n).sort(function(t,n){return t.id-n.id}))}}}]),u}(),Tr=0,Lr=function(){function m(){A(this,m),this.instances=[],this.id=Tr++}return D(m,null,[{key:"get",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y;if(!i.length)return n;if(e=i[0].instances.find(function(t){return t.base==n&&vv(i,t.modified)}))return e;o=new Ir(r=[],n,i),u=F(i);try{for(u.s();!(s=u.n()).done;)(a=s.value).instances.push(o)}catch(t){u.e(t)}finally{u.f()}f=dv(i),h=F(n.set);try{for(h.s();!(c=h.n()).done;)if(!(l=c.value).modified.length){v=F(f);try{for(v.s();!(d=v.n()).done;)y=d.value,r.push(m.get(l,y))}catch(t){v.e(t)}finally{v.f()}}}catch(t){h.e(t)}finally{h.f()}return o}}]),m}(),Br=new M,(_r=function(){function r(t,n,i,e){A(this,r),this.tags=t,this.mode=n,this.context=i,this.next=e}return D(r,[{key:"opaque",get:function t(){return 0==this.mode}},{key:"inherit",get:function t(){return 1==this.mode}},{key:"sort",value:function t(n){return!n||n.depth<this.depth?(this.next=n,this):(n.next=this.sort(n.next),n)}},{key:"depth",get:function t(){return this.context?this.context.length:0}}]),r}()).empty=new _r([],2,null),Fr=function(){function e(t,n,i){A(this,e),this.at=t,this.highlighters=n,this.span=i,this.class=""}return D(e,[{key:"startSpan",value:function t(n,i){i!=this.class&&(this.flush(n),n>this.at&&(this.at=n),this.class=i)}},{key:"flush",value:function t(n){n>this.at&&this.class&&this.span(this.at,n,this.class)}},{key:"highlightRange",value:function t(n,i,e,r,o){var u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,u=n.type,s=n.from,a=n.to;if(!(e<=s||a<=i||(f=r,(c=pv(o=u.isTop?this.highlighters.filter(function(t){return!t.scope||t.scope(u)}):o,(h=gv(n)||_r.empty).tags))&&(f&&(f+=" "),f+=c,1==h.mode)&&(r+=(r?" ":"")+c),this.startSpan(Math.max(i,s),f),h.opaque)))if((l=n.tree&&n.tree.prop(M.mounted))&&l.overlay){for(v=n.node.enter(l.overlay[0].from+s,1),d=this.highlighters.filter(function(t){return!t.scope||t.scope(l.tree.type)}),y=n.firstChild(),m=0,p=s;;m++){if(g=(k=m<l.overlay.length?l.overlay[m]:null)?k.from+s:a,(w=Math.max(i,p))<(b=Math.min(e,g))&&y)for(;n.from<b&&(this.highlightRange(n,w,b,r,o),this.startSpan(Math.min(b,n.to),f),!(n.to>=g))&&n.nextSibling(););if(!k||e<g)break;i<(p=k.to+s)&&(this.highlightRange(v.cursor(),Math.max(i,k.from+s),Math.min(e,p),"",d),this.startSpan(Math.min(e,p),f))}y&&n.parent()}else if(n.firstChild()){l&&(r="");do{if(!(n.to<=i)){if(n.from>=e)break;this.highlightRange(n,i,e,r,o),this.startSpan(Math.min(e,n.to),f)}}while(n.nextSibling());n.parent()}}}]),e}(),t=(r=Ir.define)(),e=r(),Yt=r(e),Zt=r(e),u=r(),nn=r(u),o=r(u),Nr=r(),Ur=r(Nr),Hr=r(),zr=r(),Wr=r(),Vr=r(Wr),$r=r(),mv([{tag:(a={comment:t,lineComment:r(t),blockComment:r(t),docComment:r(t),name:e,variableName:r(e),typeName:Yt,tagName:r(Yt),propertyName:Zt,attributeName:r(Zt),className:r(e),labelName:r(e),namespace:r(e),macroName:r(e),literal:u,string:nn,docString:r(nn),character:r(nn),attributeValue:r(nn),number:o,integer:r(o),float:r(o),bool:r(u),regexp:r(u),escape:r(u),color:r(u),url:r(u),keyword:Hr,self:r(Hr),null:r(Hr),atom:r(Hr),unit:r(Hr),modifier:r(Hr),operatorKeyword:r(Hr),controlKeyword:r(Hr),definitionKeyword:r(Hr),moduleKeyword:r(Hr),operator:zr,derefOperator:r(zr),arithmeticOperator:r(zr),logicOperator:r(zr),bitwiseOperator:r(zr),compareOperator:r(zr),updateOperator:r(zr),definitionOperator:r(zr),typeOperator:r(zr),controlOperator:r(zr),punctuation:Wr,separator:r(Wr),bracket:Vr,angleBracket:r(Vr),squareBracket:r(Vr),paren:r(Vr),brace:r(Vr),content:Nr,heading:Ur,heading1:r(Ur),heading2:r(Ur),heading3:r(Ur),heading4:r(Ur),heading5:r(Ur),heading6:r(Ur),contentSeparator:r(Nr),list:r(Nr),quote:r(Nr),emphasis:r(Nr),strong:r(Nr),link:r(Nr),monospace:r(Nr),strikethrough:r(Nr),inserted:r(),deleted:r(),changed:r(),invalid:r(),meta:$r,documentMeta:r($r),annotation:r($r),processingInstruction:r($r),definition:Ir.defineModifier(),constant:Ir.defineModifier(),function:Ir.defineModifier(),standard:Ir.defineModifier(),local:Ir.defineModifier(),special:Ir.defineModifier()}).link,class:"tok-link"},{tag:a.heading,class:"tok-heading"},{tag:a.emphasis,class:"tok-emphasis"},{tag:a.strong,class:"tok-strong"},{tag:a.keyword,class:"tok-keyword"},{tag:a.atom,class:"tok-atom"},{tag:a.bool,class:"tok-bool"},{tag:a.url,class:"tok-url"},{tag:a.labelName,class:"tok-labelName"},{tag:a.inserted,class:"tok-inserted"},{tag:a.deleted,class:"tok-deleted"},{tag:a.literal,class:"tok-literal"},{tag:a.string,class:"tok-string"},{tag:a.number,class:"tok-number"},{tag:[a.regexp,a.escape,a.special(a.string)],class:"tok-string2"},{tag:a.variableName,class:"tok-variableName"},{tag:a.local(a.variableName),class:"tok-variableName tok-local"},{tag:a.definition(a.variableName),class:"tok-variableName tok-definition"},{tag:a.special(a.variableName),class:"tok-variableName2"},{tag:a.definition(a.propertyName),class:"tok-propertyName tok-definition"},{tag:a.typeName,class:"tok-typeName"},{tag:a.namespace,class:"tok-namespace"},{tag:a.className,class:"tok-className"},{tag:a.macroName,class:"tok-macroName"},{tag:a.propertyName,class:"tok-propertyName"},{tag:a.operator,class:"tok-operator"},{tag:a.comment,class:"tok-comment"},{tag:a.meta,class:"tok-meta"},{tag:a.invalid,class:"tok-invalid"},{tag:a.punctuation,class:"tok-punctuation"}]),qr=new M,Gr=new M,(Jr=function(){function r(t,n){var i,e,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[],e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"";A(this,r),this.data=t,this.name=e,C.prototype.hasOwnProperty("tree")||Object.defineProperty(C.prototype,"tree",{get:function t(){return R(this)}}),this.parser=n,this.extension=[io.of(this),C.languageData.of(function(t,n,i){var e,r,o,r,u,s,a,f,h,e=bv(t,n,i),r=e.type.prop(qr);if(!r)return[];if(o=t.facet(r),r=e.type.prop(Gr)){u=e.resolve(n-e.from,i),s=F(r);try{for(s.s();!(a=s.n()).done;)if((f=a.value).test(u,t))return h=t.facet(f.facet),"replace"==f.type?h:h.concat(o)}catch(t){s.e(t)}finally{s.f()}}return o})].concat(i)}return D(r,[{key:"isActiveAt",value:function t(n,i){var e;return bv(n,i,2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1).type.prop(qr)==this.data}},{key:"findRegions",value:function t(n){var h,i,c,e,h=this,i=n.facet(io);return(null==i?void 0:i.data)==this.data?[{from:0,to:n.doc.length}]:i&&i.allowsNesting?(c=[],(e=function t(n,i){var e,r,o,u,s,a,f;if(n.prop(qr)==h.data)c.push({from:i,to:i+n.length});else{if(e=n.prop(M.mounted)){if(e.tree.prop(qr)==h.data){if(e.overlay){r=F(e.overlay);try{for(r.s();!(o=r.n()).done;)u=o.value,c.push({from:u.from+i,to:u.to+i})}catch(t){r.e(t)}finally{r.f()}}else c.push({from:i,to:i+n.length});return}if(e.overlay&&(s=c.length,t(e.tree,e.overlay[0].from+i),c.length>s))return}for(a=0;a<n.children.length;a++)(f=n.children[a])instanceof x&&t(f,n.positions[a]+i)}})(R(n),0),c):[]}},{key:"allowsNesting",get:function t(){return!0}}]),r}()).setState=v.define(),t=function(t){f(r,t);var e=S(r);function r(t,n,i){var t;return A(this,r),(t=e.call(this,t,n,[],i)).parser=n,t}return D(r,[{key:"configure",value:function t(n,i){return new r(this.data,this.parser.configure(n),i||this.name)}},{key:"allowsNesting",get:function t(){return this.parser.hasWrappers()}}],[{key:"define",value:function t(n){var i=wv(n.languageData);return new r(i,n.parser.configure({props:[qr.add(function(t){return t.isTop?i:void 0})]}),n.name)}}]),r}(Jr),Kr=function(){function n(t){A(this,n),this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}return D(n,[{key:"length",get:function t(){return this.doc.length}},{key:"syncTo",value:function t(n){return this.string=this.cursor.next(n-this.cursorPos).value,this.cursorPos=n+this.string.length,this.cursorPos-this.string.length}},{key:"chunk",value:function t(n){return this.syncTo(n),this.string}},{key:"lineChunks",get:function t(){return!0}},{key:"read",value:function t(n,i){var e=this.cursorPos-this.string.length;return n<e||i>=this.cursorPos?this.doc.sliceString(n,i):this.string.slice(n-e,i-e)}}]),n}(),Qr=null,Xr=function(){function d(t,n){var i,e,r,o,u,s,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[],e=3<arguments.length?arguments[3]:void 0,r=4<arguments.length?arguments[4]:void 0,o=5<arguments.length?arguments[5]:void 0,u=6<arguments.length?arguments[6]:void 0,s=7<arguments.length?arguments[7]:void 0;A(this,d),this.parser=t,this.state=n,this.fragments=i,this.tree=e,this.treeLen=r,this.viewport=o,this.skipped=u,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}return D(d,[{key:"startParse",value:function t(){return this.parser.startParse(new Kr(this.state.doc),this.fragments)}},{key:"work",value:function t(e,r){var o=this;return null!=r&&r>=this.state.doc.length&&(r=void 0),this.tree!=x.empty&&this.isDone(null!=r?r:this.state.doc.length)?(this.takeTree(),!0):this.withContext(function(){var t,n,i;for("number"==typeof e&&(n=Date.now()+e,e=function t(){return Date.now()>n}),o.parse||(o.parse=o.startParse()),null!=r&&(null==o.parse.stoppedAt||o.parse.stoppedAt>r)&&r<o.state.doc.length&&o.parse.stopAt(r);;){if(i=o.parse.advance()){if(o.fragments=o.withoutTempSkipped(Er.addTree(i,o.fragments,null!=o.parse.stoppedAt)),o.treeLen=null!=(t=o.parse.stoppedAt)?t:o.state.doc.length,o.tree=i,o.parse=null,!(o.treeLen<(null!=r?r:o.state.doc.length)))return!0;o.parse=o.startParse()}if(e())return!1}})}},{key:"takeTree",value:function t(){var n,i,e,n=this;this.parse&&(i=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>i)&&this.parse.stopAt(i),this.withContext(function(){for(;!(e=n.parse.advance()););}),this.treeLen=i,this.tree=e,this.fragments=this.withoutTempSkipped(Er.addTree(this.tree,this.fragments,!0)),this.parse=null)}},{key:"withContext",value:function t(n){var i=Qr;Qr=this;try{return n()}finally{Qr=i}}},{key:"withoutTempSkipped",value:function t(n){for(var i;i=this.tempSkipped.pop();)n=jv(n,i.from,i.to);return n}},{key:"changes",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,e=this.fragments,r=this.tree,o=this.treeLen,u=this.viewport,s=this.skipped;if(this.takeTree(),!n.empty&&(a=[],n.iterChangedRanges(function(t,n,i,e){return a.push({fromA:t,toA:n,fromB:i,toB:e})}),e=Er.applyChanges(e,a),r=x.empty,o=0,u={from:n.mapPos(u.from,-1),to:n.mapPos(u.to,1)},this.skipped.length)){s=[],f=F(this.skipped);try{for(f.s();!(h=f.n()).done;)c=h.value,(l=n.mapPos(c.from,1))<(v=n.mapPos(c.to,-1))&&s.push({from:l,to:v})}catch(t){f.e(t)}finally{f.f()}}return new d(this.parser,i,e,r,o,u,s,this.scheduleOn)}},{key:"updateViewport",value:function t(n){var i,e,r,o,r;if(this.viewport.from==n.from&&this.viewport.to==n.to)return!1;for(this.viewport=n,i=this.skipped.length,e=0;e<this.skipped.length;e++)o=(r=this.skipped[e]).from,r=r.to,o<n.to&&r>n.from&&(this.fragments=jv(this.fragments,o,r),this.skipped.splice(e--,1));return!(this.skipped.length>=i||(this.reset(),0))}},{key:"reset",value:function t(){this.parse&&(this.takeTree(),this.parse=null)}},{key:"skipUntilInView",value:function t(n,i){this.skipped.push({from:n,to:i})}},{key:"isDone",value:function t(n){n=Math.min(n,this.state.doc.length);var i=this.fragments;return this.treeLen>=n&&i.length&&0==i[0].from&&i[0].to>=n}}],[{key:"create",value:function t(n,i,e){return new d(n,i,[],x.empty,0,e,[],null)}},{key:"getSkippingParser",value:function t(a){return new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"createParse",value:function t(n,i,o){var u,s,e,u=o[0].from,s=o[o.length-1].to,e;return{parsedPos:u,advance:function t(){var n,i,e,r,n=Qr;if(n){i=F(o);try{for(i.s();!(e=i.n()).done;)r=e.value,n.tempSkipped.push(r)}catch(t){i.e(t)}finally{i.f()}a&&(n.scheduleOn=n.scheduleOn?Promise.all([n.scheduleOn,a]):a)}return this.parsedPos=s,new x(kr.none,[],[],s-u)},stoppedAt:null,stopAt:function t(){}}}}]),i}(Ar))}},{key:"get",value:function t(){return Qr}}]),d}(),Zr=function(){function e(t){A(this,e),this.context=t,this.tree=t.tree}return D(e,[{key:"apply",value:function t(n){var i,n;return n.docChanged||this.tree!=this.context.tree?(i=this.context.changes(n.changes,n.state),n=this.context.treeLen==n.startState.doc.length?void 0:Math.max(n.changes.mapPos(this.context.treeLen),i.viewport.to),i.work(20,n)||i.takeTree(),new e(i)):this}}],[{key:"init",value:function t(n){var i,n,i=Math.min(3e3,n.doc.length),n=Xr.create(n.facet(io).parser,n,{from:0,to:i});return n.work(20,i)||n.takeTree(),new e(n)}}]),e}(),Jr.state=b.define({create:Zr.init,update:function t(n,i){var e,r,o,e=F(i.effects);try{for(e.s();!(r=e.n()).done;)if((o=r.value).is(Jr.setState))return o.value}catch(t){e.e(t)}finally{e.f()}return i.startState.facet(io)!=i.state.facet(io)?Zr.init(i.state):n.apply(i)}}),Yr=function t(n){var i=setTimeout(function(){return n()},500);return function(){return clearTimeout(i)}},"undefined"!=typeof requestIdleCallback&&(Yr=function t(n){var i=-1,e=setTimeout(function(){i=requestIdleCallback(n,{timeout:400})},100);return function(){return i<0?clearTimeout(e):cancelIdleCallback(i)}}),to="undefined"!=typeof navigator&&null!=(Yt=navigator.scheduling)&&Yt.isInputPending?function(){return navigator.scheduling.isInputPending()}:null,no=d.fromClass(function(){function n(t){A(this,n),this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}return D(n,[{key:"update",value:function t(n){var i=this.view.state.field(Jr.state).context;(i.updateViewport(n.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),n.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}},{key:"scheduleWork",value:function t(){var n,i;this.working||(i=(n=this.view.state).field(Jr.state)).tree==i.context.tree&&i.context.isDone(n.doc.length)||(this.working=Yr(this.work))}},{key:"work",value:function t(n){var i,e,r,e,o,u,n,r;this.working=null,i=Date.now(),this.chunkEnd<i&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=i+3e4,this.chunkBudget=3e3),this.chunkBudget<=0||(r=(e=this.view).state,e=e.viewport.to,(o=r.field(Jr.state)).tree==o.context.tree&&o.context.isDone(e+1e5))||(u=Date.now()+Math.min(this.chunkBudget,100,n&&!to?Math.max(25,n.timeRemaining()-5):1e9),n=o.context.treeLen<e&&r.doc.length>e+1e3,r=o.context.work(function(){return to&&to()||Date.now()>u},e+(n?0:1e5)),this.chunkBudget-=Date.now()-i,(r||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Jr.setState.of(new Zr(o.context))})),0<this.chunkBudget&&(!r||n)&&this.scheduleWork(),this.checkAsyncSchedule(o.context))}},{key:"checkAsyncSchedule",value:function t(n){var i=this;n.scheduleOn&&(this.workScheduled++,n.scheduleOn.then(function(){return i.scheduleWork()}).catch(function(t){return Wc(i.view.state,t)}).then(function(){return i.workScheduled--}),n.scheduleOn=null)}},{key:"destroy",value:function t(){this.working&&this.working()}},{key:"isWorking",value:function t(){return!!(this.working||0<this.workScheduled)}}]),n}(),{eventHandlers:{focus:function t(){this.scheduleWork()}}}),io=y.define({combine:function t(n){return n.length?n[0]:null},enables:function t(n){return[Jr.state,no,w.contentAttributes.compute([n],function(t){var t=t.facet(n);return t&&t.name?{"data-language":t.name}:{}})]}}),Zt=D(function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];A(this,t),this.language=n,this.support=i,this.extension=[n,i]}),e=function(){function u(t,n,i,e,r){var o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:void 0;A(this,u),this.name=t,this.alias=n,this.extensions=i,this.filename=e,this.loadFunc=r,this.support=o,this.loading=null}return D(u,[{key:"load",value:function t(){var n=this;return this.loading||(this.loading=this.loadFunc().then(function(t){return n.support=t},function(t){throw n.loading=null,t}))}}],[{key:"of",value:function t(n){var i=n.load,e=n.support;if(!i){if(!e)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");i=function t(){return Promise.resolve(e)}}return new u(n.name,(n.alias||[]).concat(n.name).map(function(t){return t.toLowerCase()}),n.extensions||[],n.filename,i,e)}},{key:"matchFilename",value:function t(n,i){var e,r,o,u,s,a,f,e=F(n);try{for(e.s();!(r=e.n()).done;)if((o=r.value).filename&&o.filename.test(i))return o}catch(t){e.e(t)}finally{e.f()}if(u=/\.([^.]+)$/.exec(i)){s=F(n);try{for(s.s();!(a=s.n()).done;)if(-1<(f=a.value).extensions.indexOf(u[1]))return f}catch(t){s.e(t)}finally{s.f()}}return null}},{key:"matchLanguageName",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,e=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];i=i.toLowerCase(),r=F(n);try{for(r.s();!(o=r.n()).done;)if((u=o.value).alias.some(function(t){return t==i}))return u}catch(t){r.e(t)}finally{r.f()}if(e){s=F(n);try{for(s.s();!(a=s.n()).done;){h=F((f=a.value).alias);try{for(h.s();!(c=h.n()).done;)if(l=c.value,-1<(v=i.indexOf(l))&&(2<l.length||!/\w/.test(i[v-1])&&!/\w/.test(i[v+l.length])))return f}catch(t){h.e(t)}finally{h.f()}}}catch(t){s.e(t)}finally{s.f()}}return null}}]),u}(),eo=y.define(),ro=y.define({combine:function t(n){if(!n.length)return" ";var i=n[0];if(!i||/\S/.test(i)||Array.from(i).some(function(t){return t!=i[0]}))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return i}}),uo=new M,so=function(t){f(o,t);var r=S(o);function o(t,n,i){var e;return A(this,o),(e=r.call(this,t.state,t.options)).base=t,e.pos=n,e.node=i,e}return D(o,[{key:"textAfter",get:function t(){return this.textAfterPos(this.pos)}},{key:"baseIndent",get:function t(){for(var n,i,n=this.state.doc.lineAt(this.node.from);;){for(i=this.node.resolve(n.from);i.parent&&i.parent.from==i.from;)i=i.parent;if(Bv(i,this.node))break;n=this.state.doc.lineAt(i.from)}return this.lineIndent(n.from)}},{key:"continue",value:function t(){var n=this.node.parent;return n?Tv(n,this.pos,this.base):0}}],[{key:"create",value:function t(n,i,e){return new o(n,i,e)}}]),o}(oo=function(){function i(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};A(this,i),this.state=t,this.options=n,this.unit=Pv(t)}return D(i,[{key:"lineAt",value:function t(n){var i,e,r,o,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,e=this.state.doc.lineAt(n),r=this.options,o=r.simulateBreak,r=r.simulateDoubleBreak;return null!=o&&o>=e.from&&o<=e.to?r&&o==n?{text:"",from:n}:(i<0?o<n:o<=n)?{text:e.text.slice(o-e.from),from:o}:{text:e.text.slice(0,o-e.from),from:e.from}:e}},{key:"textAfterPos",value:function t(n){var i,e,r,e,i;return this.options.simulateDoubleBreak&&n==this.options.simulateBreak?"":(r=(e=this.lineAt(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1)).text,e=e.from,r.slice(n-e,Math.min(r.length,n+100-e)))}},{key:"column",value:function t(n){var i,e,r,e,n,e,i,e=this.lineAt(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1),r=e.text,e=e.from,n=this.countColumn(r,n-e),e=this.options.overrideIndentation?this.options.overrideIndentation(e):-1;return-1<e&&(n+=e-this.countColumn(r,r.search(/\S|$/))),n}},{key:"countColumn",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n.length;return ic(n,this.state.tabSize,i)}},{key:"lineIndent",value:function t(n){var i,n,e,n,r,r,i,n=this.lineAt(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1),e=n.text,n=n.from,r=this.options.overrideIndentation;return r&&-1<(r=r(n))?r:this.countColumn(e,e.search(/\S|$/))}},{key:"simulatedBreak",get:function t(){return this.options.simulateBreak||null}}]),i}()),nn=function t(n){return n.baseIndent},ao=200,fo=y.define(),ho=new M,co=v.define({map:qv}),lo=v.define({map:qv}),vo=b.define({create:function t(){return m.none},update:function t(n,i){var e,r,o,u,s;n=n.map(i.changes),e=F(i.effects);try{for(o=function t(){var e=r.value;e.is(co)&&!Qv(n,e.value.from,e.value.to)?n=n.update({add:[ko.range(e.value.from,e.value.to)]}):e.is(lo)&&(n=n.update({filter:function t(n,i){return e.value.from!=n||e.value.to!=i},filterFrom:e.value.from,filterTo:e.value.to}))},e.s();!(r=e.n()).done;)o()}catch(t){e.e(t)}finally{e.f()}return n=i.selection&&(u=!1,s=i.selection.main.head,n.between(s,s,function(t,n){t<s&&s<n&&(u=!0)}),u)?n.update({filterFrom:s,filterTo:s,filter:function t(n,i){return i<=s||s<=n}}):n},provide:function t(n){return w.decorations.from(n)},toJSON:function t(n,i){var e=[];return n.between(0,i.doc.length,function(t,n){e.push(t,n)}),e},fromJSON:function t(n){var i,e,r,o;if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");for(i=[],e=0;e<n.length;){if(r=n[e++],o=n[e++],"number"!=typeof r||"number"!=typeof o)throw new RangeError("Invalid JSON for fold state");i.push(ko.range(r,o))}return m.set(i,!0)}}),o=function t(n){var i,e,r,o,u,s,i=[],e=F(Gv(n));try{for(e.s();!(r=e.n()).done;)o=r.value,(u=Kv(n.state,o.from,o.to))?i.push(lo.of(u),Zv(n,u,!1)):(s=Yv(n,o))&&i.push(co.of(s),Zv(n,s))}catch(t){e.e(t)}finally{e.f()}return 0<i.length&&n.dispatch({effects:Xv(n.state,i)}),!!i.length},yo=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:u=function t(n){var i,e,r,o,i=F(Gv(n));try{for(i.s();!(e=i.n()).done;)if(r=e.value,o=$v(n.state,r.from,r.to))return n.dispatch({effects:Xv(n.state,[co.of(o),Zv(n,o)])}),!0}catch(t){i.e(t)}finally{i.f()}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Hr=function t(n){var i,e,r,o,u;if(!n.state.field(vo,!1))return!1;i=[],e=F(Gv(n));try{for(e.s();!(r=e.n()).done;)o=r.value,(u=Kv(n.state,o.from,o.to))&&i.push(lo.of(u),Zv(n,u,!1))}catch(t){e.e(t)}finally{e.f()}return i.length&&n.dispatch({effects:i}),0<i.length}},{key:"Ctrl-Alt-[",run:zr=function t(n){for(var i,e,r,o,u,i=n.state,e=[],r=0;r<i.doc.length;)(u=$v(i,(o=n.lineBlockAt(r)).from,o.to))&&e.push(co.of(u)),r=(u?n.lineBlockAt(u.to):o).to+1;return e.length&&n.dispatch({effects:Xv(n.state,e)}),!!e.length}},{key:"Ctrl-Alt-]",run:Wr=function t(n){var i,e,i=n.state.field(vo,!1);return!(!i||!i.size||(e=[],i.between(0,n.state.doc.length,function(t,n){e.push(lo.of({from:t,to:n}))}),n.dispatch({effects:e}),0))}}],mo={placeholderDOM:null,placeholderText:"\u2026"},po=y.define({combine:function t(n){return qh(n,mo)}}),ko=m.replace({widget:new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"toDOM",value:function t(e){var n,i,r,o,n=e.state,i=n.facet(po),r=function t(n){var i,i,i=e.lineBlockAt(e.posAtDOM(n.target)),i=Kv(e.state,i.from,i.to);i&&e.dispatch({effects:lo.of(i)}),n.preventDefault()};return i.placeholderDOM?i.placeholderDOM(e,r):((o=document.createElement("span")).textContent=i.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=r,o)}}]),i}(tn))}),go={openText:"\u2304",closedText:"\u203a",markerDOM:null,domEventHandlers:{},foldingChanged:function t(){return!1}},wo=function(t){f(r,t);var e=S(r);function r(t,n){var i;return A(this,r),(i=e.call(this)).config=t,i.open=n,i}return D(r,[{key:"eq",value:function t(n){return this.config==n.config&&this.open==n.open}},{key:"toDOM",value:function t(n){var i;return this.config.markerDOM?this.config.markerDOM(this.open):((i=document.createElement("span")).textContent=this.open?this.config.openText:this.config.closedText,i.title=n.state.phrase(this.open?"Fold line":"Unfold line"),i)}}]),r}(en),bo=w.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"}}),Mo=function(){function u(t,n){var i,e,r;function o(t){var n=Ft.newName();return(i=i||Object.create(null))["."+n]=t,n}A(this,u),this.specs=t,e="string"==typeof n.all?n.all:n.all?o(n.all):void 0,r=n.scope,this.scope=r instanceof Jr?function(t){return t.prop(qr)==r.data}:r?function(t){return t==r}:void 0,this.style=mv(t.map(function(t){return{tag:t.tag,class:t.class||o(Object.assign({},t,{tag:null}))}}),{all:e}).style,this.module=i?new Ft(i):null,this.themeType=n.themeType}return D(u,null,[{key:"define",value:function t(n,i){return new u(n,i||{})}}]),u}(),xo=y.define(),So=y.define({combine:function t(n){return n.length?[n[0]]:null}}),Vr=function(){function n(t){A(this,n),this.markCache=Object.create(null),this.tree=R(t.state),this.decorations=this.buildDeco(t,id(t.state))}return D(n,[{key:"update",value:function t(n){var i,e,r,i=R(n.state),e=id(n.state),r=e!=id(n.startState);i.length<n.view.viewport.to&&!r&&i.type==this.tree.type?this.decorations=this.decorations.map(n.changes):(i!=this.tree||n.viewportChanged||r)&&(this.tree=i,this.decorations=this.buildDeco(n.view,e))}},{key:"buildDeco",value:function t(n,i){var e,r,o,u,s,a,f,e=this;if(!i||!this.tree.length)return m.none;r=new Et,o=F(n.visibleRanges);try{for(o.s();!(u=o.n()).done;)a=(s=u.value).from,f=s.to,kv(this.tree,i,function(t,n,i){r.add(t,n,e.markCache[i]||(e.markCache[i]=m.mark({class:i})))},a,f)}catch(t){o.e(t)}finally{o.f()}return r.finish()}}]),n}(),Co=st.high(d.fromClass(Vr,{decorations:function t(n){return n.decorations}})),jo=Mo.define([{tag:a.meta,color:"#404740"},{tag:a.link,textDecoration:"underline"},{tag:a.heading,textDecoration:"underline",fontWeight:"bold"},{tag:a.emphasis,fontStyle:"italic"},{tag:a.strong,fontWeight:"bold"},{tag:a.strikethrough,textDecoration:"line-through"},{tag:a.keyword,color:"#708"},{tag:[a.atom,a.bool,a.url,a.contentSeparator,a.labelName],color:"#219"},{tag:[a.literal,a.inserted],color:"#164"},{tag:[a.string,a.deleted],color:"#a11"},{tag:[a.regexp,a.escape,a.special(a.string)],color:"#e40"},{tag:a.definition(a.variableName),color:"#00f"},{tag:a.local(a.variableName),color:"#30a"},{tag:[a.typeName,a.namespace],color:"#085"},{tag:a.className,color:"#167"},{tag:[a.special(a.variableName),a.macroName],color:"#256"},{tag:a.definition(a.propertyName),color:"#00c"},{tag:a.comment,color:"#940"},{tag:a.invalid,color:"#f00"}]),Ur=w.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Po=1e4,Oo="()[]{}",Eo=y.define({combine:function t(n){return qh(n,{afterCursor:!0,brackets:Oo,maxScanDistance:Po,renderMatch:od})}}),Ao=m.mark({class:"cm-matchingBracket"}),Do=m.mark({class:"cm-nonmatchingBracket"}),Io=[Ro=b.define({create:function t(){return m.none},update:function t(n,i){var e,r,o,u,s,a;if(!i.docChanged&&!i.selection)return n;e=[],r=i.state.facet(Eo),o=F(i.state.selection.ranges);try{for(o.s();!(u=o.n()).done;)(s=u.value).empty&&(a=fd(i.state,s.head,-1,r)||0<s.head&&fd(i.state,s.head-1,1,r)||r.afterCursor&&(fd(i.state,s.head,1,r)||s.head<i.state.doc.length&&fd(i.state,s.head+1,-1,r)))&&(e=e.concat(r.renderMatch(a,i.state)))}catch(t){o.e(t)}finally{o.f()}return m.set(e,!0)},provide:function t(n){return w.decorations.from(n)}}),Ur],To=new M,Lo=function(){function r(t,n,i,e){A(this,r),this.string=t,this.tabSize=n,this.indentUnit=i,this.overrideIndent=e,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}return D(r,[{key:"eol",value:function t(){return this.pos>=this.string.length}},{key:"sol",value:function t(){return 0==this.pos}},{key:"peek",value:function t(){return this.string.charAt(this.pos)||void 0}},{key:"next",value:function t(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}},{key:"eat",value:function t(n){var i,n,i=this.string.charAt(this.pos),n="string"==typeof n?i==n:i&&(n instanceof RegExp?n.test(i):n(i));if(n)return++this.pos,i}},{key:"eatWhile",value:function t(n){for(var i=this.pos;this.eat(n););return this.pos>i}},{key:"eatSpace",value:function t(){for(var n=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>n}},{key:"skipToEnd",value:function t(){this.pos=this.string.length}},{key:"skipTo",value:function t(n){var n=this.string.indexOf(n,this.pos);if(-1<n)return this.pos=n,!0}},{key:"backUp",value:function t(n){this.pos-=n}},{key:"column",value:function t(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ld(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}},{key:"indentation",value:function t(){var n;return null!=(n=this.overrideIndent)?n:ld(this.string,null,this.tabSize)}},{key:"match",value:function t(n,i,e){var r,o,t;return"string"==typeof n?(r=function t(n){return e?n.toLowerCase():n})(o=this.string.substr(this.pos,n.length))==r(n)?(!1!==i&&(this.pos+=n.length),!0):null:(t=this.string.slice(this.pos).match(n))&&0<t.index?null:(t&&!1!==i&&(this.pos+=t[0].length),t)}},{key:"current",value:function t(){return this.string.slice(this.start,this.pos)}}]),r}(),Bo=new WeakMap,Nr=function(t){f(s,t);var u=S(s);function s(t){var i,n,e,r,o;return A(this,s),n=wv(t.languageData),e=vd(t),o=new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"createParse",value:function t(n,i,e){return new _o(r,n,i,e)}}]),i}(Ar)),(i=u.call(this,n,o,[eo.of(function(t,n){return i.getIndent(t,n)})],t.name)).topNode=bd(n),r=eh(i),i.streamParser=e,i.stateAfter=new M({perNode:!0}),i.tokenTable=t.tokenTable?new Go(e.tokenTable):Jo,i}return D(s,[{key:"getIndent",value:function t(n,i){for(var e,r,o,u,e,s,a,f,h,c,l,e,e=R(n.state),r=e.resolve(i);r&&r.type!=this.topNode;)r=r.parent;if(!r)return null;if(o=void 0,(u=n.options.overrideIndentation)&&null!=(o=Bo.get(n.state))&&o<i-1e4&&(o=void 0),1e4<i-(s=(e=yd(this,e,0,r.from,null!=o?o:i))?(a=e.state,e.pos+1):(a=this.streamParser.startState(n.unit),0)))return null;for(;s<i;){if(f=n.state.doc.lineAt(s),h=Math.min(i,f.to),f.length)for(c=u?u(f.from):-1,l=new Lo(f.text,n.state.tabSize,n.unit,c<0?void 0:c);l.pos<h-f.from;)kd(this.streamParser.token,l,a);else this.streamParser.blankLine(a,n.unit);if(h==i)break;s=f.to+1}return e=n.lineAt(i),u&&null==o&&Bo.set(n.state,e.from),this.streamParser.indent(a,/^\s*(.*)/.exec(e.text)[1],n)}},{key:"allowsNesting",get:function t(){return!1}}],[{key:"define",value:function t(n){return new s(n)}}]),s}(Jr),_o=function(){function u(t,n,i,e){var n,t,i,e,r,o;for(A(this,u),this.lang=t,this.input=n,this.fragments=i,this.ranges=e,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=e[e.length-1].to,n=Xr.get(),e=(i=pd(t,i,t=e[0].from,null==n?void 0:n.state)).state,r=i.tree,this.state=e,this.parsedPos=this.chunkStart=t+r.length,o=0;o<r.children.length;o++)this.chunks.push(r.children[o]),this.chunkPos.push(r.positions[o]);n&&this.parsedPos<n.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Pv(n.state)),n.skipUntilInView(this.parsedPos,n.viewport.from),this.parsedPos=n.viewport.from),this.moveRangeIndex()}return D(u,[{key:"advance",value:function t(){var n,i,e,n=Xr.get(),i=null==this.stoppedAt?this.to:Math.min(this.to,this.stoppedAt),e=Math.min(i,this.chunkStart+2048);for(n&&(e=Math.min(e,n.viewport.to));this.parsedPos<e;)this.parseLine(n);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=i?this.finish():n&&this.parsedPos>=n.viewport.to?(n.skipUntilInView(this.parsedPos,i),this.finish()):null}},{key:"stopAt",value:function t(n){this.stoppedAt=n}},{key:"lineAfter",value:function t(n){var i,e,i=this.input.chunk(n);return this.input.lineChunks?"\n"==i&&(i=""):-1<(e=i.indexOf("\n"))&&(i=i.slice(0,e)),n+i.length<=this.to?i:i.slice(0,this.to-n)}},{key:"nextLine",value:function t(){for(var n,i,e,r,o,o,u,n=this.parsedPos,i=this.lineAfter(n),e=n+i.length,r=this.rangeIndex;!(e<=(o=this.ranges[r].to))&&(i=i.slice(0,o-(e-i.length)),++r!=this.ranges.length);)o=this.ranges[r].from,i+=u=this.lineAfter(o),e=o+u.length;return{line:i,end:e}}},{key:"skipGapsTo",value:function t(n,i,e){for(var r,o,u;r=this.ranges[this.rangeIndex].to,o=n+i,!(0<e?o<r:o<=r);)i+=(u=this.ranges[++this.rangeIndex].from)-r;return i}},{key:"moveRangeIndex",value:function t(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}},{key:"emitToken",value:function t(n,i,e,r,o){var u;return 1<this.ranges.length&&(i+=o=this.skipGapsTo(i,o,1),u=this.chunk.length,e+=o=this.skipGapsTo(e,o,-1),r+=this.chunk.length-u),this.chunk.push(n,i,e,r),o}},{key:"parseLine",value:function t(n){var i,e,i,r,o,u,s,i=this.nextLine(),e=i.line,i=i.end,r=0,o=this.lang.streamParser,u=new Lo(e,n?n.state.tabSize:4,n?Pv(n.state):2);if(u.eol())o.blankLine(this.state,u.indentUnit);else for(;!(u.eol()||((s=kd(o.token,u,this.state))&&(r=this.emitToken(this.lang.tokenTable.resolve(s),this.parsedPos+u.start,this.parsedPos+u.pos,4,r)),1e4<u.start)););this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}},{key:"finishChunk",value:function t(){var n=x.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Uo,topID:0,maxBufferLength:2048,reused:this.chunkReused}),n=new x(n.type,n.children,n.positions,n.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]);this.chunks.push(n),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}},{key:"finish",value:function t(){return new x(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}]),u}(),Fo=Object.create(null),No=[kr.none],Uo=new n(No),Ho=[],zo=Object.create(null),Wo=0,Vo=[["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"]];Wo<Vo.length;Wo++)qo=($o=Gf(Vo[Wo],2))[0],$o=$o[1],zo[qo]=wd(Fo,$o);function gd(t,n){-1<Ho.indexOf(t)||(Ho.push(t),console.warn(n))}function wd(t,n){var i,e,r,o,u,n,n,i=null,e=F(n.split("."));try{for(e.s();!(r=e.n()).done;)(u=t[o=r.value]||a[o])?"function"==typeof u?i?i=u(i):gd(o,"Modifier ".concat(o," used at start of tag")):i?gd(o,"Tag ".concat(o," used as modifier")):i=u:gd(o,"Unknown highlighting tag ".concat(o))}catch(t){e.e(t)}finally{e.f()}return i?(n=n.replace(/ /g,"_"),n=kr.define({id:No.length,name:n,props:[yv(zf({},n,i))]}),No.push(n),n.id):0}function bd(t){var n=kr.define({id:No.length,name:"Document",props:[qr.add(function(){return t})]});return No.push(n),n}function Md(t){var t,n,t=Object.keys(t).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),"[".concat(n?"\\w":"").concat(t.replace(/[^\w\s]/g,"\\$&"),"]")}function xd(t){var n,i,e,r,o,u,t,n=Object.create(null),i=Object.create(null),e=F(t);try{for(e.s();!(r=e.n()).done;)for(n[(o=r.value.label)[0]]=!0,u=1;u<o.length;u++)i[o[u]]=!0}catch(t){e.e(t)}finally{e.f()}return t=Md(n)+Md(i)+"*$",[new RegExp("^"+t),new RegExp(t)]}function Sd(t){var i,n,t,e,r,i=t.map(function(t){return"string"==typeof t?{label:t}:t}),n,t=Gf(i.every(function(t){return/^\w+$/.test(t.label)})?[/\w*$/,/\w+$/]:xd(i),2),e=t[0],r=t[1];return function(t){var n=t.matchBefore(r);return n||t.explicit?{from:n?n.from:t.pos,options:i,validFor:e}:null}}function Cd(i,e){return function(t){for(var n=R(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(-1<i.indexOf(n.name))return e(t);if(n.type.isTop)break}return null}}function jd(i,e){return function(t){for(var n=R(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(-1<i.indexOf(n.name))return null;if(n.type.isTop)break}return e(t)}}function Pd(t){return t.selection.main.from}function Od(t,n){var n,i,n,e,i=t.source,n=n&&"^"!=i[0],e="$"!=i[i.length-1];return n||e?new RegExp("".concat(n?"^":"","(?:").concat(i,")").concat(e?"$":""),null!=(n=t.flags)?n:t.ignoreCase?"i":""):t}function Ed(n,i,e,r){var o=n.selection.main,u=e-o.from,s=r-o.from;return Object.assign(Object.assign({},n.changeByRange(function(t){return t!=o&&e!=r&&n.sliceDoc(t.from+u,t.from+s)!=n.sliceDoc(e,r)?{range:t}:{changes:{from:t.from+u,to:r==o.from?t.to:t.from+s,insert:i},range:O.cursor(t.from+u+i.length)}})),{userEvent:"input.complete"})}function Ad(t){var n;return Array.isArray(t)?((n=Yo.get(t))||Yo.set(t,n=Sd(t)),n):t}function Dd(t,n){return t?n?t+" "+n:t:n}function Rd(t,n,i,e,r){var t,o,u,s,a,f,h,c,l,e,l,t=t.textDirection==E.RTL,o=t,u=!1,s="top",h=n.left-r.left,c=r.right-n.right,l=e.right-e.left,e=e.bottom-e.top;return o&&h<Math.min(l,c)?o=!1:!o&&c<Math.min(l,h)&&(o=!0),l<=(o?h:c)?(a=Math.max(r.top,Math.min(i.top,r.bottom-e))-n.top,f=Math.min(400,o?h:c)):(u=!0,f=Math.min(400,(t?n.right:r.right-n.left)-30),a=e<=(l=r.bottom-n.bottom)||l>n.top?i.bottom-n.top:(s="bottom",n.bottom-i.top)),{style:"".concat(s,": ").concat(a,"px; max-width: ").concat(f,"px"),class:"cm-completionInfo-"+(u?t?"left-narrow":"right-narrow":o?"left":"right")}}function Id(r){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"option";return function(t){var n,i,e,e,n,n=t.state.field(ku,!1);return!(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(eu).interactionDelay||(i=1,"page"==o&&(e=N0(t,n.open.tooltip))&&(i=Math.max(2,Math.floor(e.dom.offsetHeight/e.dom.querySelector("li").offsetHeight)-1)),e=n.open.options.length,(n=-1<n.open.selected?n.open.selected+i*(r?1:-1):r?0:e-1)<0?n="page"==o?0:e-1:e<=n&&(n="page"==o?e-1:0),t.dispatch({effects:pu.of(n)}),0))}}function Td(t,n){var i,e,i=n.completion.apply||n.completion.label,e=t.state.field(ku).active.find(function(t){return t.source==n.source});return e instanceof yu&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},Ed(t.state,i,e.from,e.to)),{annotations:Zo.of(n.completion)})):i(t,n.completion,e.from,e.to),!0)}function Ld(t){var n=t.addToOptions.slice();return t.icons&&n.push({render:function t(n){var i,e,e=document.createElement("div");return e.classList.add("cm-completionIcon"),n.type&&(i=e.classList).add.apply(i,Wf(n.type.split(/\s+/g).map(function(t){return"cm-completionIcon-"+t}))),e.setAttribute("aria-hidden","true"),e},position:20}),n.push({render:function t(n,i,e){var r,o,u,s,a,f,h,r=document.createElement("span");for(r.className="cm-completionLabel",o=n.label,u=0,s=1;s<e.length;)a=e[s++],f=e[s++],u<a&&r.appendChild(document.createTextNode(o.slice(u,a))),(h=r.appendChild(document.createElement("span"))).appendChild(document.createTextNode(o.slice(a,f))),h.className="cm-completionMatchedText",u=f;return u<o.length&&r.appendChild(document.createTextNode(o.slice(u))),r},position:50},{render:function t(n){var i;return n.detail?((i=document.createElement("span")).className="cm-completionDetail",i.textContent=n.detail,i):null},position:80}),n.sort(function(t,n){return t.position-n.position}).map(function(t){return t.render})}function Bd(t,n,i){var e,e;return t<=i?{from:0,to:t}:(n=n<0?0:n)<=t>>1?{from:(e=Math.floor(n/i))*i,to:(e+1)*i}:{from:t-((e=Math.floor((t-n)/i))+1)*i,to:t-e*i}}function _d(n){return function(t){return new fu(t,n)}}function Fd(t,n){var i,n,i=t.getBoundingClientRect(),n=n.getBoundingClientRect();n.top<i.top?t.scrollTop-=i.top-n.top:n.bottom>i.bottom&&(t.scrollTop+=n.bottom-i.bottom)}function Nd(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Ud(t,n){var e,r,i,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,B,x,S,C,j,P,O,E,A,D,R,I,T,L,e=[],r=null,i=function t(n){var n,i;e.push(n),(n=n.completion.section)&&(r=r||[],i="string"==typeof n?n:n.name,r.some(function(t){return t.name==i})||r.push("string"==typeof n?{name:i}:n))},o=F(t);try{for(o.s();!(u=o.n()).done;)if((s=u.value).hasResult())if(!1===s.result.filter){a=s.result.getMatch,f=F(s.result.options);try{for(f.s();!(h=f.n()).done;){if(c=h.value,l=[1e9-e.length],a){v=F(a(c));try{for(v.s();!(d=v.n()).done;)y=d.value,l.push(y)}catch(t){v.e(t)}finally{v.f()}}i(new Xo(c,s.source,l,l[0]))}}catch(t){f.e(t)}finally{f.f()}}else{m=new iu(n.sliceDoc(s.from,s.to)),p=void 0,k=F(s.result.options);try{for(k.s();!(g=k.n()).done;)w=g.value,(p=m.match(w.label))&&i(new Xo(w,s.source,p,p[0]+(w.boost||0)))}catch(t){k.e(t)}finally{k.f()}}}catch(t){o.e(t)}finally{o.f()}if(r){b=Object.create(null),M=0,x=F(r.sort(B=function t(n,i){var e,e;return(null!=(e=n.rank)?e:1e9)-(null!=(e=i.rank)?e:1e9)||(n.name<i.name?-1:1)}));try{for(x.s();!(S=x.n()).done;)C=S.value,M-=1e5,b[C.name]=M}catch(t){x.e(t)}finally{x.f()}j=F(e);try{for(j.s();!(P=j.n()).done;)(E=(O=P.value).completion.section)&&(O.score+=b["string"==typeof E?E:E.name])}catch(t){j.e(t)}finally{j.f()}}A=[],D=null,R=n.facet(eu).compareCompletions,I=F(e.sort(function(t,n){return n.score-t.score||R(t.completion,n.completion)}));try{for(I.s();!(T=I.n()).done;)L=T.value,!D||D.label!=L.completion.label||D.detail!=L.completion.detail||null!=D.type&&null!=L.completion.type&&D.type!=L.completion.type||D.apply!=L.completion.apply?A.push(L):Nd(L.completion)>Nd(D)&&(A[A.length-1]=L),D=L.completion}catch(t){I.e(t)}finally{I.f()}return A}function Hd(t,n){var i,e,r,o;if(t==n)return 1;for(e=i=0;;){for(;i<t.length&&!t[i].hasResult;)i++;for(;e<n.length&&!n[e].hasResult;)e++;if(r=i==t.length,o=e==n.length,r||o)return r==o;if(t[i++].result!=n[e++].result)return}}function zd(t,n){var i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return-1<n&&(i["aria-activedescendant"]=t+"-"+n),i}function Wd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}function Vd(t,n,i,e){var r;if(t)return r=n.sliceDoc(i,e),"function"==typeof t?t(r,i,e,n):Od(t,!0).test(r)}function $d(t,n){return O.create(t.filter(function(t){return t.field==n}).map(function(t){return O.range(t.from,t.to)}))}function qd(t){var u=Mu.parse(t);return function(t,n,i,e){var r,o,r,i,e,o,r=u.instantiate(t.state,i),o=r.text,r=r.ranges,i={changes:{from:i,to:e,insert:k.of(o)},scrollIntoView:!0,annotations:n?Zo.of(n):void 0};r.length&&(i.selection=$d(r,0)),1<r.length&&(e=new Cu(r,0),o=i.effects=[ju.of(e)],void 0===t.state.field(Ou,!1))&&o.push(v.appendConfig.of([Ou,Du,Ru,gu])),t.dispatch(t.state.update(i))}}function Gd(o){return function(t){var n,t,i,e,r,n=t.state,t=t.dispatch,i=n.field(Ou,!1);return!(!i||o<0&&0==i.active||(e=i.active+o,r=0<o&&!i.ranges.some(function(t){return t.field==e+o}),t(n.update({selection:$d(i.ranges,e),effects:ju.of(r?null:new Cu(i.ranges,e))})),0))}}function Jd(t){var n=t.field(Ou,!1);return!(!n||!n.ranges.some(function(t){return t.field==n.active+1}))}function Kd(t){var t=t.field(Ou,!1);return!!(t&&0<t.active)}function Qd(t,n){return Object.assign(Object.assign({},n),{apply:qd(t)})}function Xd(n){var n=n.replace(/[\\[.+*?(){|^$]/g,"\\$&");try{return new RegExp("[\\p{Alphabetic}\\p{Number}_".concat(n,"]+"),"ug")}catch(t){return new RegExp("[w".concat(n,"]"),"g")}}function Zd(t,n){return new RegExp(n(t.source),t.unicode?"u":"")}function Yd(t){return Iu[t]||(Iu[t]=new WeakMap)}function t1(t,n,i,e,r){for(var o,u,s,a,o=t.iterLines(),u=0;!o.next().done;){for(s=o.value,a=void 0,n.lastIndex=0;a=n.exec(s);)if(!e[a[0]]&&u+a.index!=r&&(i.push({type:"text",label:a[0]}),e[a[0]]=!0,2e3<=i.length))return;u+=s.length+1}}function n1(t,n,i,e,r){var o,u,s,a,f,h,c,l,v,d,y,o=1e3<=t.length,u=o&&n.get(t);if(u)return u;if(s=[],a=Object.create(null),t.children){f=0,h=F(t.children);try{for(h.s();!(c=h.n()).done;){if(1e3<=(l=c.value).length){v=F(n1(l,n,i,e-f,r-f));try{for(v.s();!(d=v.n()).done;)a[(y=d.value).label]||(a[y.label]=!0,s.push(y))}catch(t){v.e(t)}finally{v.f()}}else t1(l,i,s,a,r-f);f+=l.length+1}}catch(t){h.e(t)}finally{h.f()}}else t1(t,i,s,a,r);return o&&s.length<2e3&&n.set(t,s),s}function i1(){return[Uu,_u]}function e1(t){for(var n=0;n<Fu.length;n+=2)if(Fu.charCodeAt(n)==t)return Fu.charAt(n+1);return bh(t<128?t:t+1)}function r1(t,n){return t.languageDataAt("closeBrackets",n)[0]||Tu}function o1(t,n){var i,e,r,o,u,s,i=r1(t,t.selection.main.head),e=i.brackets||Tu.brackets,r=F(e);try{for(r.s();!(o=r.n()).done;){if(s=e1(wh(u=o.value,0)),n==u)return s==u?c1(t,u,-1<e.indexOf(u+u+u),i):f1(t,u,s,i.before||Tu.before);if(n==s&&u1(t,t.selection.main.from))return h1(t,u,s)}}catch(t){r.e(t)}finally{r.f()}return null}function u1(t,n){var i=!1;return t.field(_u).between(0,t.doc.length,function(t){t==n&&(i=!0)}),i}function s1(t,n){var t=t.sliceString(n,n+2);return t.slice(0,Mh(wh(t,0)))}function a1(t,n){var t=t.sliceString(n-2,n);return Mh(wh(t,0))==t.length?t:t.slice(1)}function f1(i,e,r,o){var u=null,t=i.changeByRange(function(t){var n;return t.empty?!(n=s1(i.doc,t.head))||/\s/.test(n)||-1<o.indexOf(n)?{changes:{insert:e+r,from:t.head},effects:Lu.of(t.head+e.length),range:O.cursor(t.head+e.length)}:{range:u=t}:{changes:[{insert:e,from:t.from},{insert:r,from:t.to}],effects:Lu.of(t.to+e.length),range:O.range(t.anchor+e.length,t.head+e.length)}});return u?null:i.update(t,{scrollIntoView:!0,userEvent:"input.type"})}function h1(n,t,i){var e=null,r=n.changeByRange(function(t){return t.empty&&s1(n.doc,t.head)==i?{changes:{from:t.head,to:t.head+i.length,insert:i},range:O.cursor(t.head+i.length)}:e={range:t}});return e?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function c1(o,u,s,t){var a,f,t,a=t.stringPrefixes||Tu.stringPrefixes,f=null,t=o.changeByRange(function(t){var n,i,e,r,e;if(!t.empty)return{changes:[{insert:u,from:t.from},{insert:u,from:t.to}],effects:Lu.of(t.to+u.length),range:O.range(t.anchor+u.length,t.head+u.length)};if(n=t.head,(i=s1(o.doc,n))==u){if(l1(o,n))return{changes:{insert:u+u,from:n},effects:Lu.of(n+u.length),range:O.cursor(n+u.length)};if(u1(o,n))return{changes:{from:n,to:n+(e=(r=s&&o.sliceDoc(n,n+3*u.length)==u+u+u)?u+u+u:u).length,insert:e},range:O.cursor(n+e.length)}}else{if(s&&o.sliceDoc(n-2*u.length,n)==u+u&&-1<(e=d1(o,n-2*u.length,a))&&l1(o,e))return{changes:{insert:u+u+u+u,from:n},effects:Lu.of(n+u.length),range:O.cursor(n+u.length)};if(o.charCategorizer(n)(i)!=l.Word&&-1<d1(o,n,a)&&!v1(o,n,u,a))return{changes:{insert:u+u,from:n},effects:Lu.of(n+u.length),range:O.cursor(n+u.length)}}return{range:f=t}});return f?null:o.update(t,{scrollIntoView:!0,userEvent:"input.type"})}function l1(t,n){var t=R(t).resolveInner(n+1);return t.parent&&t.from==n}function v1(t,n,i,e){for(var r,o,u,s,a,f,s,r=R(t).resolveInner(n,-1),o=e.reduce(function(t,n){return Math.max(t,n.length)},0),u=0;u<5;u++){if(!(a=(s=t.sliceDoc(r.from,Math.min(r.to,r.from+i.length+o))).indexOf(i))||-1<a&&-1<e.indexOf(s.slice(0,a))){for(f=r.firstChild;f&&f.from==r.from&&f.to-f.from>i.length+a;){if(t.sliceDoc(f.to-i.length,f.to)==i)return;f=f.firstChild}return 1}if(!(s=r.to==n&&r.parent))break;r=s}}function d1(t,n,i){var e,r,o,u,s,e=t.charCategorizer(n);if(e(t.sliceDoc(n-1,n))!=l.Word)return n;r=F(i);try{for(r.s();!(o=r.n()).done;)if(s=n-(u=o.value).length,t.sliceDoc(s,n)==u&&e(t.sliceDoc(s-1,s))!=l.Word)return s}catch(t){r.e(t)}finally{r.f()}return-1}function y1(){var t;return[ku,eu.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),au,Wu,gu]}function m1(t){var t=t.field(ku,!1);return t&&t.active.some(function(t){return 1==t.state})?"pending":t&&t.active.some(function(t){return 0!=t.state})?"active":null}function p1(t){var t,t,n,t=null==(t=t.field(ku,!1))?void 0:t.open;return!t||t.disabled?[]:((n=Vu.get(t.options))||Vu.set(t.options,n=t.options.map(function(t){return t.completion})),n)}function k1(t){var t,t,t=null==(t=t.field(ku,!1))?void 0:t.open;return t&&!t.disabled&&0<=t.selected?t.options[t.selected].completion:null}function g1(t){var t,t,t=null==(t=t.field(ku,!1))?void 0:t.open;return t&&!t.disabled&&0<=t.selected?t.selected:null}function w1(t){return pu.of(t)}function b1(e,r){return function(t){var n,t,i,n=t.state,t=t.dispatch;return!n.readOnly&&!!(i=e(r,n))&&(t(n.update(i)),!0)}}function M1(t,n){var t=t.languageDataAt("commentTokens",n);return t.length?t[0]:{}}function x1(t,n,i,e){var r,n,o,u,s,a,f,h,c,o,f,u,r=n.open,n=n.close,o=t.sliceDoc(i-Ju,i),u=t.sliceDoc(e,e+Ju),s=/\s*$/.exec(o)[0].length,a=/^\s*/.exec(u)[0].length,f=o.length-s;return o.slice(f-r.length,f)==r&&u.slice(a,a+n.length)==n?{open:{pos:i-s,margin:s&&1},close:{pos:e+a,margin:a&&1}}:(e-i<=2*Ju?h=c=t.sliceDoc(i,e):(h=t.sliceDoc(i,i+Ju),c=t.sliceDoc(e-Ju,e)),o=/^\s*/.exec(h)[0].length,f=/\s*$/.exec(c)[0].length,u=c.length-f-n.length,h.slice(o,o+r.length)==r&&c.slice(u,u+n.length)==n?{open:{pos:i+o+r.length,margin:/\s/.test(h.charAt(o+r.length))?1:0},close:{pos:e-f-n.length,margin:/\s/.test(c.charAt(u-1))?1:0}}:null)}function S1(t){var n,i,e,r,o,u,s,n=[],i=F(t.selection.ranges);try{for(i.s();!(e=i.n()).done;)r=e.value,o=t.doc.lineAt(r.from),u=r.to<=o.to?o:t.doc.lineAt(r.to),0<=(s=n.length-1)&&n[s].to>o.from?n[s].to=u.to:n.push({from:o.from+/^\s*/.exec(o.text)[0].length,to:u.to})}catch(t){i.e(t)}finally{i.f()}return n}function C1(t,i){var n,e,r,o,u,s,a,f,h,s,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:i.selection.ranges,e=n.map(function(t){return M1(i,t.from).block});if(e.every(function(t){return t})){if(r=n.map(function(t,n){return x1(i,e[n],t.from,t.to)}),2!=t&&!r.every(function(t){return t}))return{changes:i.changes(n.map(function(t,n){return r[n]?[]:[{from:t.from,insert:e[n].open+" "},{from:t.to,insert:" "+e[n].close}]}))};if(1!=t&&r.some(function(t){return t})){for(o=[],u=0;u<r.length;u++)(s=r[u])&&(a=e[u],h=s.open,s=s.close,o.push({from:h.pos-a.open.length,to:h.pos+h.margin},{from:s.pos-s.margin,to:s.pos+a.close.length}));return{changes:o}}}return null}function j1(t,n){var L,i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,B,j,P,O,E,A,D,R,I,_,T,L,i=[],e=-1,r=F(2<arguments.length&&void 0!==arguments[2]?arguments[2]:n.selection.ranges);try{for(r.s();!(o=r.n()).done;)if(s=(u=o.value).from,a=u.to,f=i.length,h=1e9,c=M1(n,s).line){for(l=s;l<=a;)(v=n.doc.lineAt(l)).from>e&&(s==a||a>v.from)&&(e=v.from,y=(d=/^\s*/.exec(v.text)[0].length)==v.length,m=v.text.slice(d,d+c.length)==c?d:-1,d<v.text.length&&d<h&&(h=d),i.push({line:v,comment:m,token:c,indent:d,empty:y,single:!1})),l=v.to+1;if(h<1e9)for(p=f;p<i.length;p++)i[p].indent<i[p].line.text.length&&(i[p].indent=h);i.length==f+1&&(i[f].single=!0)}}catch(t){r.e(t)}finally{r.f()}if(2!=t&&i.some(function(t){return t.comment<0&&(!t.empty||t.single)})){k=[],g=F(i);try{for(g.s();!(w=g.n()).done;)M=(b=w.value).line,x=b.token,S=b.indent,C=b.empty,!(B=b.single)&&C||k.push({from:M.from+S,insert:x+" "})}catch(t){g.e(t)}finally{g.f()}return{changes:j=n.changes(k),selection:n.selection.map(j,1)}}if(1!=t&&i.some(function(t){return 0<=t.comment})){P=[],O=F(i);try{for(O.s();!(E=O.n()).done;)D=(A=E.value).line,R=A.comment,I=A.token,0<=R&&(T=(_=D.from+R)+I.length," "==D.text[T-D.from]&&T++,P.push({from:_,to:T}))}catch(t){O.e(t)}finally{O.f()}return{changes:P}}return null}function P1(t){var i=0;return t.iterChangedRanges(function(t,n){return i=n}),i}function O1(){var t;return[Yu,Zu.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),w.domEventHandlers({beforeinput:function t(n,i){var e="historyUndo"==n.inputType?ts:"historyRedo"==n.inputType?ns:null;return!!e&&(n.preventDefault(),e(i))}})]}function E1(e,r){return function(t){var n,t,i,i,n=t.state,t=t.dispatch;return!(!r&&n.readOnly||!(i=n.field(Yu,!1))||!(i=i.pop(e,n,r))||(t(i),0))}}function A1(n){return function(t){var t,t,t=t.field(Yu,!1);return t?(t=0==n?t.done:t.undone).length-(t.length&&!t[0].changes?1:0):0}}function D1(t,n,i,e){var r,t,r,t=t.slice(i+20<n+1?n-i-1:0,n);return t.push(e),t}function R1(t,n){var s=[],a=!1;return t.iterChangedRanges(function(t,n){return s.push(t,n)}),n.iterChangedRanges(function(t,n,i,e){for(var r,o,u,r=0;r<s.length;)o=s[r++],u=s[r++],o<=e&&i<=u&&(a=!0)}),a}function I1(t,i){return t.ranges.length==i.ranges.length&&0===t.ranges.filter(function(t,n){return t.empty!=i.ranges[n].empty}).length}function T1(t,n){return t.length?n.length?t.concat(n):t:n}function L1(t,n){var i,e;return t.length?(e=(i=t[t.length-1]).selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-rs))).length&&e[e.length-1].eq(n)?t:(e.push(n),D1(t,t.length-1,1e9,i.setSelAfter(e))):[is.selection([n])]}function B1(t){var n,i,n=t[t.length-1],i=t.slice();return i[t.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),i}function _1(t,n){var i,e,r,o;if(!t.length)return t;for(i=t.length,e=es;i;){if((r=F1(t[i-1],n,e)).changes&&!r.changes.empty||r.effects.length)return(o=t.slice(0,i))[i-1]=r,o;n=r.mapped,i--,e=r.selectionsAfter}return e.length?[is.selection(e)]:es}function F1(t,n,i){var i,e,r,o,i=T1(t.selectionsAfter.length?t.selectionsAfter.map(function(t){return t.map(n)}):es,i);return t.changes?(e=t.changes.map(n),r=n.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r,new is(e,v.mapEffects(t.effects,n),o,t.startSelection.map(r),i)):is.selection(i)}function N1(t,n){return O.create(t.ranges.map(n),t.mainIndex)}function U1(t,n){return t.update({selection:n,scrollIntoView:!0,userEvent:"select"})}function H1(t,n){var i,t,n,i=t.state,t=t.dispatch,n=N1(i.selection,n);return!n.eq(i.selection)&&(t(U1(i,n)),!0)}function z1(t,n){return O.cursor(n?t.to:t.from)}function W1(n,i){return H1(n,function(t){return t.empty?n.moveByChar(t,i):z1(t,i)})}function V1(t){return t.textDirectionAt(t.state.selection.main.head)==E.LTR}function $1(n,i){return H1(n,function(t){return t.empty?n.moveByGroup(t,i):z1(t,i)})}function q1(a,i,f){var h=a.state.charCategorizer(i.from);return a.moveByChar(i,f,function(t){var e,r,o,u,s,n,e=l.Space,r=i.from,o=!1,u=!1,s=!1,n=function t(n){if(o)return!1;r+=f?n.length:-n.length;var i=h(n),i;if(i==l.Word&&n.charCodeAt(0)<128&&/[\W_]/.test(n)&&(i=-1),(e=e==l.Space?i:e)!=i)return!1;if(e==l.Word)if(n.toLowerCase()==n){if(!f&&u)return!1;s=!0}else if(s){if(f)return!1;o=!0}else{if(u&&f&&h(i=a.state.sliceDoc(r,r+1))==l.Word&&i.toLowerCase()==i)return!1;u=!0}return!0};return n(t),n})}function G1(n,i){return H1(n,function(t){return t.empty?q1(n,t,i):z1(t,i)})}function J1(t,n,i){var i;return n.type.prop(i)||(i=n.to-n.from)&&(2<i||/[^\s,.;:]/.test(t.sliceDoc(n.from,n.to)))||n.firstChild}function K1(t,n,i){for(var e,r,o,u,s,n,n,e=R(t).resolveInner(n.head),r=i?M.closedBy:M.openedBy,o=n.head;u=i?e.childAfter(o):e.childBefore(o);)J1(t,u,r)?e=u:o=i?u.to:u.from;return n=(s=e.type.prop(r))&&(n=i?fd(t,e.from,1):fd(t,e.to,-1))&&n.matched?i?n.end.to:n.end.from:i?e.to:e.from,O.cursor(n,i?-1:1)}function Q1(i,e){return H1(i,function(t){var n;return t.empty?(n=i.moveVertically(t,e)).head!=t.head?n:i.moveToLineBoundary(t,e):z1(t,e)})}function X1(t){var n,i,e,r,o,u,s,a,n=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,i=0,e=0;if(n){o=F(t.state.facet(w.scrollMargins));try{for(o.s();!(u=o.n()).done;)null!=(a=(s=u.value)(t))&&a.top&&(i=Math.max(null==a?void 0:a.top,i)),null!=a&&a.bottom&&(e=Math.max(null==a?void 0:a.bottom,e))}catch(t){o.e(t)}finally{o.f()}r=t.scrollDOM.clientHeight-i-e}else r=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:e,selfScroll:n,height:Math.max(t.defaultLineHeight,r-5)}}function Z1(n,i){var e,t,r,o,u,s,a,s,e=X1(n),t=n.state,r=N1(t.selection,function(t){return t.empty?n.moveVertically(t,i,e.height):z1(t,i)});return!r.eq(t.selection)&&(e.selfScroll&&(u=n.coordsAtPos(t.selection.main.head),a=(s=n.scrollDOM.getBoundingClientRect()).top+e.marginTop,s=s.bottom-e.marginBottom,u)&&u.top>a&&u.bottom<s&&(o=w.scrollIntoView(r.main.head,{y:"start",yMargin:u.top-a})),n.dispatch(U1(t,r),{effects:o}),!0)}function Y1(t,n,i){var e,r,i,e=t.lineBlockAt(n.head),r=t.moveToLineBoundary(n,i);return r.head==n.head&&r.head!=(i?e.to:e.from)&&(r=t.moveToLineBoundary(n,i,!1)),r=!i&&r.head==e.from&&e.length&&(i=/^\s*/.exec(t.state.sliceDoc(e.from,Math.min(e.from+100,e.to)))[0].length)&&n.head!=e.from+i?O.cursor(e.from+i):r}function ty(i,t,e){var r=!1,n=N1(i.selection,function(t){var n,n,n=fd(i,t.head,-1)||fd(i,t.head,1)||0<t.head&&fd(i,t.head-1,1)||t.head<i.doc.length&&fd(i,t.head+1,-1);return n&&n.end?(r=!0,n=n.start.from==t.head?n.end.to:n.end.from,e?O.range(t.anchor,n):O.cursor(n)):t});return!!r&&(t(U1(i,n)),!0)}function ny(t,i){var n=N1(t.state.selection,function(t){var n=i(t);return O.range(t.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(t.state.selection)&&(t.dispatch(U1(t.state,n)),!0)}function iy(n,i){return ny(n,function(t){return n.moveByChar(t,i)})}function ey(n,i){return ny(n,function(t){return n.moveByGroup(t,i)})}function ry(n,i){return ny(n,function(t){return q1(n,t,i)})}function oy(n,i){return ny(n,function(t){return n.moveVertically(t,i)})}function uy(n,i){return ny(n,function(t){return n.moveVertically(t,i,X1(n).height)})}function sy(r,o){var u,t,n;return!r.state.readOnly&&(u="delete.selection",!(n=(t=r.state).changeByRange(function(t){var n,i,e,n=t.from,i=t.to;return i=n==i?((e=o(n))<n?e=ay(r,e,!(u="delete.backward")):n<e&&(u="delete.forward",e=ay(r,e,!0)),n=Math.min(n,e),Math.max(i,e)):(n=ay(r,n,!1),ay(r,i,!0)),n==i?{range:t}:{changes:{from:n,to:i},range:O.cursor(n)}})).changes.empty)&&(r.dispatch(t.update(n,{scrollIntoView:!0,userEvent:u,effects:"delete.selection"==u?w.announce.of(t.phrase("Selection deleted")):void 0})),!0)}function ay(n,i,e){var r,t,o;if(n instanceof w){r=F(n.state.facet(w.atomicRanges).map(function(t){return t(n)}));try{for(r.s();!(t=r.n()).done;)(o=t.value).between(i,i,function(t,n){t<i&&i<n&&(i=e?n:t)})}catch(t){r.e(t)}finally{r.f()}}return i}function fy(t){var n,i,e,r,o,u,s,a,n=[],i=-1,e=F(t.selection.ranges);try{for(e.s();!(r=e.n()).done;)o=r.value,u=t.doc.lineAt(o.from),s=t.doc.lineAt(o.to),o.empty||o.to!=s.from||(s=t.doc.lineAt(o.to-1)),i>=u.number?((a=n[n.length-1]).to=s.to,a.ranges.push(o)):n.push({from:u.from,to:s.to,ranges:[o]}),i=s.number+1}catch(t){e.e(t)}finally{e.f()}return n}function hy(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y;if(t.readOnly)return!1;e=[],r=[],o=F(fy(t));try{for(o.s();!(u=o.n()).done;)if(s=u.value,i?s.to!=t.doc.length:0!=s.from)if(f=(a=t.doc.lineAt(i?s.to+1:s.from-1)).length+1,i){e.push({from:s.to,to:a.to},{from:s.from,insert:a.text+t.lineBreak}),h=F(s.ranges);try{for(h.s();!(c=h.n()).done;)l=c.value,r.push(O.range(Math.min(t.doc.length,l.anchor+f),Math.min(t.doc.length,l.head+f)))}catch(t){h.e(t)}finally{h.f()}}else{e.push({from:a.from,to:s.from},{from:s.to,insert:t.lineBreak+a.text}),v=F(s.ranges);try{for(v.s();!(d=v.n()).done;)y=d.value,r.push(O.range(y.anchor-f,y.head-f))}catch(t){v.e(t)}finally{v.f()}}}catch(t){o.e(t)}finally{o.f()}return!!e.length&&(n(t.update({changes:e,scrollIntoView:!0,selection:O.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function cy(t,n,i){var e,r,o,u;if(t.readOnly)return!1;e=[],r=F(fy(t));try{for(r.s();!(o=r.n()).done;)u=o.value,e.push(i?{from:u.from,insert:t.doc.slice(u.from,u.to)+t.lineBreak}:{from:u.to,insert:t.lineBreak+t.doc.slice(u.from,u.to)})}catch(t){r.e(t)}finally{r.f()}return n(t.update({changes:e,scrollIntoView:!0,userEvent:"input.copyline"})),!0}function ly(t,n){var i,e,i,n;return/\(\)|\[\]|\{\}/.test(t.sliceDoc(n-1,n+1))?{from:n,to:n}:(e=(i=R(t).resolveInner(n)).childBefore(n),i=i.childAfter(n),e&&i&&e.to<=n&&i.from>=n&&(n=e.type.prop(M.closedBy))&&-1<n.indexOf(i.name)&&t.doc.lineAt(e.to).from==t.doc.lineAt(i.from).from?{from:e.to,to:i.from}:null)}function vy(s){return function(t){var u,t,n,u=t.state,t=t.dispatch;return!u.readOnly&&(n=u.changeByRange(function(t){var n,i,e,t,r,o,o,n=t.from,i=t.to,e=u.doc.lineAt(n),t=!s&&n==i&&ly(u,n);for(s&&(n=i=(i<=e.to?e:u.doc.lineAt(i)).to),null==(o=Ev(r=new oo(u,{simulateBreak:n,simulateDoubleBreak:!!t}),n))&&(o=/^\s*/.exec(u.doc.lineAt(n).text)[0].length);i<e.to&&/\s/.test(e.text[i-e.from]);)i++;return t?(n=t.from,i=t.to):n>e.from&&n<e.from+100&&!/\S/.test(e.text.slice(0,n))&&(n=e.from),o=["",Ov(u,o)],t&&o.push(Ov(u,r.lineIndent(e.from,-1))),{changes:{from:n,to:i,insert:k.of(o)},range:O.cursor(n+1+o[1].length)}}),t(u.update(n,{scrollIntoView:!0,userEvent:"input"})),!0)}}function dy(o,u){var s=-1;return o.changeByRange(function(t){for(var n,i,e,r,n=[],i=t.from;i<=t.to;)(e=o.doc.lineAt(i)).number>s&&(t.empty||t.to>e.from)&&(u(e,n,t),s=e.number),i=e.to+1;return r=o.changes(n),{changes:n,range:O.range(r.mapPos(t.anchor,1),r.mapPos(t.head,1))}})}function I(t,n){var i,e,r,o,u,i=t;if("string"==typeof i&&(i=document.createElement(i)),e=1,(r=n)&&"object"==uh(r)&&null==r.nodeType&&!Array.isArray(r)){for(o in r)Object.prototype.hasOwnProperty.call(r,o)&&("string"==typeof(u=r[o])?i.setAttribute(o,u):null!=u&&(i[o]=u));e++}for(;e<arguments.length;e++)yy(i,arguments[e]);return i}function yy(t,n){if("string"==typeof n)t.appendChild(document.createTextNode(n));else if(null!=n)if(null!=n.nodeType)t.appendChild(n);else{if(!Array.isArray(n))throw new RangeError("Unsupported child node: "+n);for(var i=0;i<n.length;i++)yy(t,n[i])}}function my(t,n,i){var e,r,o,e=1<arguments.length&&void 0!==n?n:null,r,o=null;return t.between(2<arguments.length&&void 0!==i?i:0,1e9,function(t,n,i){var i=i.spec;if(!e||i.diagnostic==e)return o=new Aa(t,n,i.diagnostic),!1}),o}function py(t,n){return!(!t.effects.some(function(t){return t.is(Ra)})&&!t.changes.touchesRange(n.pos))}function ky(t,n){return t.field(La,!1)?n:n.concat(v.appendConfig.of(Qa))}function gy(t,n){return{effects:ky(t,[Ra.of(n)])}}function wy(t){var t=t.field(La,!1);return t?t.diagnostics.size:0}function by(n,e,r){var t,i,o,u,s,i,t,i=n.state.field(La).diagnostics,o=[],u=2e8,s=0;return i.between(e-(r<0?1:0),e+(0<r?1:0),function(t,n,i){var i=i.spec;t<=e&&e<=n&&(t==n||(t<e||0<r)&&(e<n||r<0))&&(o.push(i.diagnostic),u=Math.min(t,u),s=Math.max(n,s))}),i=n.state.facet(Ua).tooltipFilter,(o=i?i(o):o).length?{pos:u,end:s,above:n.state.doc.lineAt(u).to<s,create:function t(){return{dom:My(n,o)}}}:null}function My(n,t){return I("ul",{class:"cm-tooltip-lint"},t.map(function(t){return jy(n,t,!1)}))}function xy(t){var n;return[Ua.of({source:t,config:1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}}),Na,Qa]}function Sy(t){var t=t.plugin(Na);t&&t.force()}function Cy(t){var i,n,e,r,o,u,i=[];if(t){n=F(t);try{t:for(n.s();!(e=n.n()).done;){for(r=e.value.name,o=function t(){var n=r[u];if(/[a-zA-Z]/.test(n)&&!i.some(function(t){return t.toLowerCase()==n.toLowerCase()}))return i.push(n),1},u=0;u<r.length;u++)if(o())continue t;i.push("")}}catch(t){n.e(t)}finally{n.f()}}return i}function jy(s,a,t){var t,f,f=t?Cy(a.actions):[];return I("li",{class:"cm-diagnostic cm-diagnostic-"+a.severity},I("span",{class:"cm-diagnosticText"},a.renderMessage?a.renderMessage():a.message),null==(t=a.actions)?void 0:t.map(function(i,t){var e,n,r,o,u,e=!1,n=function t(n){var n;n.preventDefault(),!e&&(e=!0,n=my(s.state.field(La).diagnostics,a))&&i.apply(s,n.from,n.to)},r=i.name,o=f[t]?r.indexOf(f[t]):-1,u=o<0?r:[r.slice(0,o),I("u",r.slice(o,o+1)),r.slice(o+1)];return I("button",{type:"button",class:"cm-diagnosticAction",onclick:n,onmousedown:n,"aria-label":" Action: ".concat(r).concat(o<0?"":' (access key "'.concat(f[t],')"'),".")},u)}),a.source&&I("div",{class:"cm-diagnosticSource"},a.source))}function Py(t,n){var i;return'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" '.concat(1<arguments.length&&void 0!==n?n:'viewBox="0 0 40 40"',">").concat(encodeURIComponent(t),"</svg>')")}function Oy(t){return Py('<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"')}function Ey(r,o){var t;window.addEventListener("mousemove",function t(n){var i,e,i=o.getBoundingClientRect();if(!(n.clientX>i.left-10&&n.clientX<i.right+10&&n.clientY>i.top-10&&n.clientY<i.bottom+10)){for(e=n.target;e;e=e.parentNode)if(1==e.nodeType&&e.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",t),r.state.field(Ja)&&r.dispatch({effects:Ga.of(null)})}})}function Ay(i,e,r){var t,n,o;function u(){var t,n,t=i.elementAtHeight(e.getBoundingClientRect().top+5-i.documentTop),n;i.coordsAtPos(t.from)&&i.dispatch({effects:Ga.of({pos:t.from,above:!1,create:function t(){return{dom:My(i,r),getCoords:function t(){return e.getBoundingClientRect()}}}})}),e.onmouseout=e.onmousemove=null,Ey(i,e)}t=i.state.facet(Xa),n=t.hoverTime,o=setTimeout(u,n),e.onmouseout=function(){clearTimeout(o),e.onmouseout=e.onmousemove=null},e.onmousemove=function(){clearTimeout(o),o=setTimeout(u,n)}}function Dy(t,n){var i,e,r,o,u,s,a,i=Object.create(null),e=F(n);try{for(e.s();!(r=e.n()).done;)o=r.value,(i[(u=t.lineAt(o.from)).from]||(i[u.from]=[])).push(o)}catch(t){e.e(t)}finally{e.f()}for(a in s=[],i)s.push(new Va(i[a]).range(+a));return j.of(s,!0)}function Ry(){var t;return[Xa.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),qa,$a,Ka,Ja]}function Iy(t,n){var t,i,t=t.field(La,!1);if(t&&t.diagnostics.size)for(i=j.iter([t.diagnostics]);i.value;i.next())n(i.value.spec.diagnostic,i.from,i.to)}function Ty(t){try{return new RegExp(t,ef),!0}catch(t){return!1}}function Ly(t,n){if(!(n>=t.length))for(var i=t.lineAt(n),e;n<i.to&&56320<=(e=i.text.charCodeAt(n-i.from))&&e<57344;)n++;return n}function By(s){var a,t;function i(){var t,n,i,t,e,r,o,t,o,u,t,t,t=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.value);t&&(i=(n=s.state).doc.lineAt(n.selection.main.head),e=(t=Gf(t,5))[1],r=t[2],o=t[3],t=t[4],o=o?+o.slice(1):0,u=r?+r:i.number,r&&t?(t=u/100,e&&(t=t*("-"==e?-1:1)+i.number/n.doc.lines),u=Math.round(n.doc.lines*t)):r&&e&&(u=u*("-"==e?-1:1)+i.number),t=n.doc.line(Math.max(1,Math.min(n.doc.lines,u))),s.dispatch({effects:af.of(!1),selection:O.cursor(t.from+Math.max(0,Math.min(o,t.length))),scrollIntoView:!0}),s.focus())}return a=I("input",{class:"cm-textfield",name:"line"}),{dom:t=I("form",{class:"cm-gotoLine",onkeydown:function t(n){27==n.keyCode?(n.preventDefault(),s.dispatch({effects:af.of(!1)}),s.focus()):13==n.keyCode&&(n.preventDefault(),i())},onsubmit:function t(n){n.preventDefault(),i()}},I("label",s.state.phrase("Go to line"),": ",a)," ",I("button",{class:"cm-button",type:"submit"},s.state.phrase("go")))}}function _y(t){var n=[mf,yf];return t&&n.push(lf.of(t)),n}function Fy(t,n,i,e){return!(0!=i&&t(n.sliceDoc(i-1,i))==l.Word||e!=n.doc.length&&t(n.sliceDoc(e,e+1))==l.Word)}function Ny(t,n,i,e){return t(n.sliceDoc(i,i+1))==l.Word&&t(n.sliceDoc(e-1,e))==l.Word}function Uy(r,o){for(var t,n,u,t,s,i,e,a,f,t=r.selection,n=t.main,u=t.ranges,t=r.wordAt(n.head),s=t&&t.from==n.from&&t.to==n.to,i=function t(n,i){if(i.next(),!i.done){if(n&&u.some(function(t){return t.from==i.value.from}))return a=n,f=i,0;if(s){var e=r.wordAt(i.value.from);if(!e||e.from!=i.value.from||e.to!=i.value.to)return a=n,f=i,0}return{v:i.value}}if(n)return{v:null};i=new tf(r.doc,o,0,Math.max(0,u[u.length-1].from-1)),a=n=!0,f=i},a=!1,f=new tf(r.doc,o,u[u.length-1].to);;)if(0!==(e=i(a,f))&&e)return e.v}function Hy(t){return t?[kf.of(t),Nf]:Nf}function zy(t,n,i,e){return new tf(n.doc,t.unquoted,i,e,t.caseSensitive?void 0:function(t){return t.toLowerCase()},t.wholeWord?Wy(n.doc,n.charCategorizer(n.selection.main.head)):void 0)}function Wy(r,o){return function(t,n,i,e){return(t<e||e+i.length<n)&&(e=Math.max(0,t-2),i=r.sliceString(e,Math.min(r.length,n+2))),!(o($y(i,t-e))==l.Word&&o(qy(i,t-e))==l.Word||o(qy(i,n-e))==l.Word&&o($y(i,n-e))==l.Word)}}function Vy(t,n,i,e){return new rf(n.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?Gy(n.charCategorizer(n.selection.main.head)):void 0},i,e)}function $y(t,n){return t.slice(yh(t,n,!1),n)}function qy(t,n){return t.slice(n,yh(t,n))}function Gy(e){return function(t,n,i){return!i[0].length||(e($y(i.input,i.index))!=l.Word||e(qy(i.input,i.index))!=l.Word)&&(e(qy(i.input,i.index+i[0].length))!=l.Word||e($y(i.input,i.index+i[0].length))!=l.Word)}}function Jy(t){var n=t.field(Sf,!1);return n?n.query.spec:Zy(t)}function Ky(t){var t;return null!=(null==(t=t.field(Sf,!1))?void 0:t.panel)}function Qy(i){return function(t){var n=t.state.field(Sf,!1);return n&&n.query.spec.valid?i(t,n):If(t)}}function Xy(t){return t.state.facet(kf).createPanel(t)}function Zy(t,n){var i,i,e,i,e,e,t,e=t.selection.main,e=e.empty||e.to>e.from+100?"":t.sliceDoc(e.from,e.to);return n&&!e?n:(t=t.facet(kf),new gf({search:(null!=(i=null==n?void 0:n.literal)?i:t.literal)?e:e.replace(/\n/g,"\\n"),caseSensitive:null!=(i=null==n?void 0:n.caseSensitive)?i:t.caseSensitive,literal:null!=(e=null==n?void 0:n.literal)?e:t.literal,wholeWord:null!=(i=null==n?void 0:n.wholeWord)?i:t.wholeWord}))}function Yy(t){var t=W0(t,Xy);return t&&t.dom.querySelector("[main-field]")}function tm(t){var n=Yy(t);n&&n==t.root.activeElement&&n.select()}function nm(t,n){return t.state.phrase(n)}function im(t,n){var i,n,e,r,i,n,o,u,s,i=n.from,n=n.to,e=t.state.doc.lineAt(i),r=t.state.doc.lineAt(n).to,i=Math.max(e.from,i-_f),n=Math.min(r,n+_f),o=t.state.sliceDoc(i,n);if(i!=e.from)for(u=0;u<_f;u++)if(!Ff.test(o[u+1])&&Ff.test(o[u])){o=o.slice(u);break}if(n!=r)for(s=o.length-1;s>o.length-_f;s--)if(!Ff.test(o[s-1])&&Ff.test(o[s])){o=o.slice(0,s);break}return w.announce.of("".concat(t.state.phrase("current match"),". ").concat(o," ").concat(t.state.phrase("on line")," ").concat(e.number,"."))}Jo=new(Go=function(){function n(t){A(this,n),this.extra=t,this.table=Object.assign(Object.create(null),zo)}return D(n,[{key:"resolve",value:function t(n){return n?this.table[n]||(this.table[n]=wd(this.extra,n)):0}}]),n}())(Fo),Ko=L.Language=Object.freeze({__proto__:null,DocInput:Kr,HighlightStyle:Mo,IndentContext:oo,LRLanguage:t,Language:Jr,LanguageDescription:e,LanguageSupport:Zt,ParseContext:Xr,StreamLanguage:Nr,StringStream:Lo,TreeIndentContext:so,bracketMatching:ud,bracketMatchingHandle:To,codeFolding:td,continuedIndent:Uv,defaultHighlightStyle:jo,defineLanguageFacet:wv,delimitedIndent:Fv,ensureSyntaxTree:Mv,flatIndent:nn,foldAll:zr,foldCode:u,foldEffect:co,foldGutter:nd,foldInside:zv,foldKeymap:yo,foldNodeProp:ho,foldService:fo,foldState:vo,foldable:$v,foldedRanges:Jv,forceParsing:Sv,getIndentUnit:Pv,getIndentation:Ev,highlightingFor:rd,indentNodeProp:uo,indentOnInput:Hv,indentRange:Av,indentService:eo,indentString:Ov,indentUnit:ro,language:io,languageDataProp:qr,matchBrackets:fd,sublanguageProp:Gr,syntaxHighlighting:ed,syntaxParserRunning:Cv,syntaxTree:R,syntaxTreeAvailable:xv,toggleFold:o,unfoldAll:Wr,unfoldCode:Hr,unfoldEffect:lo}),Qo=function(){function e(t,n,i){A(this,e),this.state=t,this.pos=n,this.explicit=i,this.abortListeners=[]}return D(e,[{key:"tokenBefore",value:function t(n){for(var i=R(this.state).resolveInner(this.pos,-1);i&&n.indexOf(i.name)<0;)i=i.parent;return i?{from:i.from,to:this.pos,text:this.state.sliceDoc(i.from,this.pos),type:i.type}:null}},{key:"matchBefore",value:function t(n){var i,e,i,n,i=this.state.doc.lineAt(this.pos),e=Math.max(i.from,this.pos-250),i=i.text.slice(e-i.from,this.pos-i.from),n=i.search(Od(n,!1));return n<0?null:{from:e+n,to:this.pos,text:i.slice(n)}}},{key:"aborted",get:function t(){return null==this.abortListeners}},{key:"addEventListener",value:function t(n,i){"abort"==n&&this.abortListeners&&this.abortListeners.push(i)}}]),e}(),Xo=D(function t(n,i,e,r){A(this,t),this.completion=n,this.source=i,this.match=e,this.score=r}),Zo=gt.define(),Yo=new WeakMap,tu=v.define(),nu=v.define(),iu=function(){function o(t){var n,i,e,i,r;for(A(this,o),this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],n=0;n<t.length;)e=Mh(i=wh(t,n)),this.chars.push(i),r=(i=t.slice(n,n+e)).toUpperCase(),this.folded.push(wh(r==i?i.toLowerCase():r,0)),n+=e;this.astral=t.length!=this.chars.length}return D(o,[{key:"match",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,j,P,O,O;if(0==this.pattern.length)return[-100];if(n.length<this.pattern.length)return null;if(i=this.chars,e=this.folded,r=this.any,o=this.precise,u=this.byWord,1==i.length){if(f=(a=Mh(s=wh(n,0)))==n.length?0:-100,s!=i[0]){if(s!=e[0])return null;f+=-200}return[f,0,a]}if(0==(h=n.indexOf(this.pattern)))return[n.length==this.pattern.length?0:-100,0,this.pattern.length];if(c=i.length,h<(l=0)){for(v=0,d=Math.min(n.length,200);v<d&&l<c;)(y=wh(n,v))!=i[l]&&y!=e[l]||(r[l++]=v),v+=Mh(y);if(l<c)return null}for(k=!1,g=p=m=0,b=w=-1,M=/[a-z]/.test(n),x=!0,S=0,C=Math.min(n.length,200),j=0;S<C&&p<c;)P=wh(n,S),h<0&&(m<c&&P==i[m]&&(o[m++]=S),g<c)&&(P==i[g]||P==e[g]?(0==g&&(w=S),b=S+1,g++):g=0),O=void 0,O=P<255?48<=P&&P<=57||97<=P&&P<=122?2:65<=P&&P<=90?1:0:(O=bh(P))!=O.toLowerCase()?1:O!=O.toUpperCase()?2:0,(!S||1==O&&M||0==j&&0!=O)&&(i[p]==P||e[p]==P&&(k=!0)?u[p++]=S:u.length&&(x=!1)),j=O,S+=Mh(P);return p==c&&0==u[0]&&x?this.result((k?-200:0)-100,u,n):g==c&&0==w?[-200-n.length+(b==n.length?0:-100),0,b]:-1<h?[-700-n.length,h,h+this.pattern.length]:g==c?[-900-n.length,w,b]:p==c?this.result((k?-200:0)-100-700+(x?0:-1100),u,n):2==i.length?null:this.result((r[0]?-700:0)-200-1100,r,n)}},{key:"result",value:function t(n,i,e){var t,r,o,u,s,a;t=[n-e.length],r=1,o=F(i);try{for(o.s();!(u=o.n()).done;)a=(s=u.value)+(this.astral?Mh(wh(e,s)):1),1<r&&t[r-1]==s?t[r-1]=a:(t[r++]=s,t[r++]=a)}catch(t){o.e(t)}finally{o.f()}return t}}]),o}(),eu=y.define({combine:function t(n){return qh(n,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:function t(){return""},optionClass:function t(){return""},aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Rd,compareCompletions:function t(n,i){return n.label.localeCompare(i.label)},interactionDelay:75},{defaultKeymap:function t(n,i){return n&&i},closeOnBlur:function t(n,i){return n&&i},icons:function t(n,i){return n&&i},tooltipClass:function t(n,i){return function(t){return Dd(n(t),i(t))}},optionClass:function t(n,i){return function(t){return Dd(n(t),i(t))}},addToOptions:function t(n,i){return n.concat(i)}})}}),r=function t(n){var i=n.state.field(ku,!1);return!(n.state.readOnly||!i||!i.open||i.open.selected<0||Date.now()-i.open.timestamp<n.state.facet(eu).interactionDelay)&&(!!i.open.disabled||Td(n,i.open.options[i.open.selected]))},$r=function t(n){var i;return!!n.state.field(ku,!1)&&(n.dispatch({effects:tu.of(!0)}),!0)},Yt=function t(n){var i=n.state.field(ku,!1);return!(!i||!i.active.some(function(t){return 0!=t.state})||(n.dispatch({effects:nu.of(null)}),0))},ru=D(function t(n,i){A(this,t),this.active=n,this.context=i,this.time=Date.now(),this.updates=[],this.done=void 0}),uu=ou=50,su=1e3,au=d.fromClass(function(){function r(t){var n,i,e;A(this,r),this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0,n=F(t.state.field(ku).active);try{for(n.s();!(i=n.n()).done;)1==(e=i.value).state&&this.startQuery(e)}catch(t){n.e(t)}finally{n.f()}}return D(r,[{key:"update",value:function t(n){var i,e,r,o,u,s,a,f,u,h,c,l,i=this,e=n.state.field(ku);if(n.selectionSet||n.docChanged||n.startState.field(ku)!=e){for(r=n.transactions.some(function(t){return(t.selection||t.docChanged)&&!Wd(t)}),o=0;o<this.running.length;o++)if(u=this.running[o],r||50<u.updates.length+n.transactions.length&&Date.now()-u.time>su){s=F(u.context.abortListeners);try{for(s.s();!(a=s.n()).done;){f=a.value;try{f()}catch(t){Wc(this.view.state,t)}}}catch(t){s.e(t)}finally{s.f()}u.context.abortListeners=null,this.running.splice(o--,1)}else(u=u.updates).push.apply(u,Wf(n.transactions));if(-1<this.debounceUpdate&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(function(n){return 1==n.state&&!i.running.some(function(t){return t.active.source==n.source})})?setTimeout(function(){return i.startUpdate()},50):-1,0!=this.composing){h=F(n.transactions);try{for(h.s();!(c=h.n()).done;)"input"==Wd(l=c.value)?this.composing=2:2==this.composing&&l.selection&&(this.composing=3)}catch(t){h.e(t)}finally{h.f()}}}}},{key:"startUpdate",value:function t(){var i,n,e,r,o,u,i=this;this.debounceUpdate=-1,r=F((e=(n=this.view.state).field(ku)).active);try{for(u=function t(){var n=o.value;1!=n.state||i.running.some(function(t){return t.active.source==n.source})||i.startQuery(n)},r.s();!(o=r.n()).done;)u()}catch(t){r.e(t)}finally{r.f()}}},{key:"startQuery",value:function t(n){var i,e,r,e,o,i=this,e=this.view.state,r=Pd(e),e=new Qo(e,r,n.explicitPos==r),o=new ru(n,e);this.running.push(o),Promise.resolve(n.source(e)).then(function(t){o.context.aborted||(o.done=t||null,i.scheduleAccept())},function(t){i.view.dispatch({effects:nu.of(null)}),Wc(i.view.state,t)})}},{key:"scheduleAccept",value:function t(){var n=this;this.running.every(function(t){return void 0!==t.done})?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(function(){return n.accept()},50))}},{key:"accept",value:function t(){var l,v,d,y,n,i,m,l=this;for(-1<this.debounceAccept&&clearTimeout(this.debounceAccept),this.debounceAccept=-1,d=[],y=this.view.state.facet(eu),n=function t(n){var i,e,r,o,u,s,a,f,h,c,i=l.running[n];if(void 0===i.done)return m=n,0;if(l.running.splice(n--,1),i.done){e=new yu(i.active.source,i.active.explicitPos,i.done,i.done.from,null!=(v=i.done.to)?v:Pd(i.updates.length?i.updates[0].startState:l.view.state)),r=F(i.updates);try{for(r.s();!(o=r.n()).done;)u=o.value,e=e.update(u,y)}catch(t){r.e(t)}finally{r.f()}if(e.hasResult())return d.push(e),m=n,0}if((s=l.view.state.field(ku).active.find(function(t){return t.source==i.active.source}))&&1==s.state)if(null==i.done){a=new du(i.active.source,0),f=F(i.updates);try{for(f.s();!(h=f.n()).done;)c=h.value,a=a.update(c,y)}catch(t){f.e(t)}finally{f.f()}1!=a.state&&d.push(a)}else l.startQuery(s);m=n},m=0;m<this.running.length;m++)i=n(m);d.length&&this.view.dispatch({effects:mu.of(d)})}}]),r}(),{eventHandlers:{blur:function t(n){var i,i,i=this.view.state.field(ku,!1);i&&i.tooltip&&this.view.state.facet(eu).closeOnBlur&&((i=i.open&&N0(this.view,i.open.tooltip))&&i.dom.contains(n.relatedTarget)||this.view.dispatch({effects:nu.of(null)}))},compositionstart:function t(){this.composing=1},compositionend:function t(){var n=this;3==this.composing&&setTimeout(function(){return n.view.dispatch({effects:tu.of(!1)})},20),this.composing=0}}}),fu=function(){function u(e,t){var r,t,n,o,n,i,r=this;A(this,u),this.view=e,this.stateField=t,this.info=null,this.placeInfoReq={read:function t(){return r.measureInfo()},write:function t(n){return r.placeInfo(n)},key:this},this.space=null,this.currentClass="",n=(t=e.state.field(t)).open,o=n.options,n=n.selected,i=e.state.facet(eu),this.optionContent=Ld(i),this.optionClass=i.optionClass,this.tooltipClass=i.tooltipClass,this.range=Bd(o.length,n,i.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",function(t){for(var n=t.target,i;n&&n!=r.dom;n=n.parentNode)if("LI"==n.nodeName&&(i=/-(\d+)$/.exec(n.id))&&+i[1]<o.length)return Td(e,o[+i[1]]),void t.preventDefault()}),this.dom.addEventListener("focusout",function(t){var n=e.state.field(r.stateField,!1);n&&n.tooltip&&e.state.facet(eu).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:nu.of(null)})}),this.list=this.dom.appendChild(this.createListBox(o,t.id,this.range)),this.list.addEventListener("scroll",function(){r.info&&r.view.requestMeasure(r.placeInfoReq)})}return D(u,[{key:"mount",value:function t(){this.updateSel()}},{key:"update",value:function t(n){var n,n,i,e,i,e=n.state.field(this.stateField),i=n.startState.field(this.stateField);this.updateTooltipClass(n.state),e!=i&&(this.updateSel(),(null==(n=e.open)?void 0:n.disabled)!=(null==(n=i.open)?void 0:n.disabled))&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!(null==(i=e.open)||!i.disabled))}},{key:"updateTooltipClass",value:function t(n){var n,i,e,r,o,u,s,n=this.tooltipClass(n);if(n!=this.currentClass){i=F(this.currentClass.split(" "));try{for(i.s();!(e=i.n()).done;)(r=e.value)&&this.dom.classList.remove(r)}catch(t){i.e(t)}finally{i.f()}o=F(n.split(" "));try{for(o.s();!(u=o.n()).done;)(s=u.value)&&this.dom.classList.add(s)}catch(t){o.e(t)}finally{o.f()}this.currentClass=n}}},{key:"positioned",value:function t(n){this.space=n,this.info&&this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSel",value:function t(){var n,i,e,e,r,r,n=this,i=this.view.state.field(this.stateField),e=i.open;(-1<e.selected&&e.selected<this.range.from||e.selected>=this.range.to)&&(this.range=Bd(e.options.length,e.selected,this.view.state.facet(eu).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,i.id,this.range)),this.list.addEventListener("scroll",function(){n.info&&n.view.requestMeasure(n.placeInfoReq)})),this.updateSelectedOption(e.selected)&&(this.info&&(this.info.remove(),this.info=null),r=(e=e.options[e.selected].completion).info)&&(r="string"==typeof r?document.createTextNode(r):r(e))&&("then"in r?r.then(function(t){t&&n.view.state.field(n.stateField,!1)==i&&n.addInfoPane(t)}).catch(function(t){return Wc(n.view.state,t,"completion info")}):this.addInfoPane(r))}},{key:"addInfoPane",value:function t(n){var i=this.info=document.createElement("div");i.className="cm-tooltip cm-completionInfo",i.appendChild(n),this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSelectedOption",value:function t(n){for(var i,e,r,i=null,e=this.list.firstChild,r=this.range.from;e;e=e.nextSibling,r++)"LI"==e.nodeName&&e.id?r==n?e.hasAttribute("aria-selected")||(e.setAttribute("aria-selected","true"),i=e):e.hasAttribute("aria-selected")&&e.removeAttribute("aria-selected"):r--;return i&&Fd(this.list,i),i}},{key:"measureInfo",value:function t(){var n,i,e,n,r,o,n=this.dom.querySelector("[aria-selected]");return!n||!this.info||(i=this.dom.getBoundingClientRect(),e=this.info.getBoundingClientRect(),n=n.getBoundingClientRect(),r=(r=this.space)||{left:0,top:0,right:(o=this.dom.ownerDocument.defaultView||window).innerWidth,bottom:o.innerHeight},n.top>Math.min(r.bottom,i.bottom)-10)||n.bottom<Math.max(r.top,i.top)+10?null:this.view.state.facet(eu).positionInfo(this.view,i,n,e,r)}},{key:"placeInfo",value:function t(n){this.info&&(n?(n.style&&(this.info.style.cssText=n.style),this.info.className="cm-tooltip cm-completionInfo "+(n.class||"")):this.info.style.cssText="top: -1e6px")}},{key:"createListBox",value:function t(n,i,e){var r,o,u,s,a,f,s,h,c,l,s,v,d,y,m,r=document.createElement("ul");for(r.id=i,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),o=null,u=e.from;u<e.to;u++){a=(s=n[u]).completion,f=s.match,(s=a.section)&&(h="string"==typeof s?s:s.name)!=o&&(u>e.from||0==e.from)&&(o=h,"string"!=typeof s&&s.header?r.appendChild(s.header(s)):(c=r.appendChild(document.createElement("completion-section"))).textContent=h),(l=r.appendChild(document.createElement("li"))).id=i+"-"+u,l.setAttribute("role","option"),(s=this.optionClass(a))&&(l.className=s),v=F(this.optionContent);try{for(v.s();!(d=v.n()).done;)(m=(y=d.value)(a,this.view.state,f))&&l.appendChild(m)}catch(t){v.e(t)}finally{v.f()}}return e.from&&r.classList.add("cm-completionListIncompleteTop"),e.to<n.length&&r.classList.add("cm-completionListIncompleteBottom"),r}}]),u}(),hu=function(){function h(t,n,i,e,r,o){A(this,h),this.options=t,this.attrs=n,this.tooltip=i,this.timestamp=e,this.selected=r,this.disabled=o}return D(h,[{key:"setSelected",value:function t(n,i){return n==this.selected||n>=this.options.length?this:new h(this.options,zd(i,n),this.tooltip,this.timestamp,n,this.disabled)}},{key:"map",value:function t(n){return new h(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:n.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}],[{key:"build",value:function t(n,i,e,r,o){var u,s,a,f,u=Ud(n,i);if(!u.length)return r&&n.some(function(t){return 1==t.state})?new h(r.options,r.attrs,r.tooltip,r.timestamp,r.selected,!0):null;if(s=i.facet(eu).selectOnOpen?0:-1,r&&r.selected!=s&&-1!=r.selected)for(a=r.options[r.selected].completion,f=0;f<u.length;f++)if(u[f].completion==a){s=f;break}return new h(u,zd(e,s),{pos:n.reduce(function(t,n){return n.hasResult()?Math.min(t,n.from):t},1e8),create:_d(ku),above:o.aboveCursor},r?r.timestamp:Date.now(),s,!1)}}]),h}(),cu=function(){function c(t,n,i){A(this,c),this.active=t,this.id=n,this.open=i}return D(c,[{key:"update",value:function t(i){var e,n,r,o,u,s,a,f,h,e=this,n=i.state,r=n.facet(eu),o,u=(r.override||n.languageDataAt("autocomplete",Pd(n)).map(Ad)).map(function(n){var t;return(e.active.find(function(t){return t.source==n})||new du(n,e.active.some(function(t){return 0!=t.state})?1:0)).update(i,r)});u.length==this.active.length&&u.every(function(t,n){return t==e.active[n]})&&(u=this.active),(s=this.open)&&i.docChanged&&(s=s.map(i.changes)),i.selection||u.some(function(t){return t.hasResult()&&i.changes.touchesRange(t.from,t.to)})||!Hd(u,this.active)?s=hu.build(u,n,this.id,s,r):s&&s.disabled&&!u.some(function(t){return 1==t.state})&&(s=null),!s&&u.every(function(t){return 1!=t.state})&&u.some(function(t){return t.hasResult()})&&(u=u.map(function(t){return t.hasResult()?new du(t.source,0):t})),a=F(i.effects);try{for(a.s();!(f=a.n()).done;)(h=f.value).is(pu)&&(s=s&&s.setSelected(h.value,this.id))}catch(t){a.e(t)}finally{a.f()}return u==this.active&&s==this.open?this:new c(u,this.id,s)}},{key:"tooltip",get:function t(){return this.open?this.open.tooltip:null}},{key:"attrs",get:function t(){return this.open?this.open.attrs:lu}}],[{key:"start",value:function t(){return new c(vu,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}}]),c}(),lu={"aria-autocomplete":"list"},vu=[],yu=function(t){f(s,t);var o=S(s);function s(t,n,i,e,r){var t;return A(this,s),(t=o.call(this,t,2,n)).result=i,t.from=e,t.to=r,t}return D(s,[{key:"hasResult",value:function t(){return!0}},{key:"handleUserEvent",value:function t(n,i,e){var r,r,o,u,i,e,r=n.changes.mapPos(this.from),o=n.changes.mapPos(this.to,1),u=Pd(n.state);return(this.explicitPos<0?u<=r:u<this.from)||o<u||"delete"==i&&Pd(n.startState)==this.from?new du(this.source,"input"==i&&e.activateOnTyping?1:0):(i=this.explicitPos<0?-1:n.changes.mapPos(this.explicitPos),Vd(this.result.validFor,n.state,r,o)?new s(this.source,i,this.result,r,o):this.result.update&&(e=this.result.update(this.result,r,o,new Qo(n.state,u,0<=i)))?new s(this.source,i,e,e.from,null!=(r=e.to)?r:Pd(n.state)):new du(this.source,1,i))}},{key:"handleChange",value:function t(n){return n.changes.touchesRange(this.from,this.to)?new du(this.source,0):this.map(n.changes)}},{key:"map",value:function t(n){return n.empty?this:new s(this.source,this.explicitPos<0?-1:n.mapPos(this.explicitPos),this.result,n.mapPos(this.from),n.mapPos(this.to,1))}}]),s}(du=function(){function c(t,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1;A(this,c),this.source=t,this.state=n,this.explicitPos=i}return D(c,[{key:"hasResult",value:function t(){return!1}},{key:"update",value:function t(n,i){var e,r,o,u,s,a,f,h,e=Wd(n),r=this;e?r=r.handleUserEvent(n,e,i):n.docChanged?r=r.handleChange(n):n.selection&&0!=r.state&&(r=new c(r.source,0)),o=F(n.effects);try{for(o.s();!(u=o.n()).done;)if((s=u.value).is(tu))r=new c(r.source,1,s.value?Pd(n.state):-1);else if(s.is(nu))r=new c(r.source,0);else if(s.is(mu)){a=F(s.value);try{for(a.s();!(f=a.n()).done;)(h=f.value).source==r.source&&(r=h)}catch(t){a.e(t)}finally{a.f()}}}catch(t){o.e(t)}finally{o.f()}return r}},{key:"handleUserEvent",value:function t(n,i,e){return"delete"!=i&&e.activateOnTyping?new c(this.source,1):this.map(n.changes)}},{key:"handleChange",value:function t(n){return n.changes.touchesRange(Pd(n.startState))?new c(this.source,0):this.map(n.changes)}},{key:"map",value:function t(n){return n.empty||this.explicitPos<0?this:new c(this.source,this.state,n.mapPos(this.explicitPos))}}]),c}()),mu=v.define({map:function t(n,i){return n.map(function(t){return t.map(i)})}}),pu=v.define(),ku=b.define({create:function t(){return cu.start()},update:function t(n,i){return n.update(i)},provide:function t(n){return[Ue.from(n,function(t){return t.tooltip}),w.contentAttributes.from(n,function(t){return t.attrs})]}}),gu=w.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:'"\xb7\xb7\xb7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"".concat(400,"px"),boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"".concat(30,"px")},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"".concat(30,"px")},"&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:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25cb'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25cc'"}},".cm-completionIcon-variable":{"&:after":{content:"'\ud835\udc65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\ud835\udc36'"}},".cm-completionIcon-type":{"&:after":{content:"'\ud835\udc61'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222a'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25a1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\ud83d\udd11\ufe0e'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25a2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),wu=D(function t(n,i,e,r){A(this,t),this.field=n,this.line=i,this.from=e,this.to=r}),bu=function(){function e(t,n,i){A(this,e),this.field=t,this.from=n,this.to=i}return D(e,[{key:"map",value:function t(n){var i,n,i=n.mapPos(this.from,-1,h.TrackDel),n=n.mapPos(this.to,1,h.TrackDel);return null==i||null==n?null:new e(this.field,i,n)}}]),e}(),Mu=function(){function b(t,n){A(this,b),this.lines=t,this.fieldPositions=n}return D(b,[{key:"instantiate",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,e=[],r=[i],o=n.doc.lineAt(i),u=/^\s*/.exec(o.text)[0],s=F(this.lines);try{for(s.s();!(a=s.n()).done;){if(f=a.value,e.length){for(h=u,c=/^\t*/.exec(f)[0].length,l=0;l<c;l++)h+=n.facet(ro);r.push(i+h.length-c),f=h+f.slice(c)}e.push(f),i+=f.length+1}}catch(t){s.e(t)}finally{s.f()}return{text:e,ranges:v=this.fieldPositions.map(function(t){return new bu(t.field,r[t.line]+t.from,r[t.line]+t.to)})}}}],[{key:"parse",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,i=[],e=[],r=[],u=F(n.split(/\r\n?|\n/));try{for(u.s();!(s=u.n()).done;){for(a=s.value;o=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(a);){for(f=o[1]?+o[1]:null,h=o[2]||o[3]||"",c=-1,l=0;l<i.length;l++)(null!=f?i[l].seq==f:h&&i[l].name==h)&&(c=l);if(c<0){for(v=0;v<i.length&&(null==f||null!=i[v].seq&&i[v].seq<f);)v++;i.splice(v,0,{seq:f,name:h}),c=v,d=F(r);try{for(d.s();!(y=d.n()).done;)(m=y.value).field>=c&&m.field++}catch(t){d.e(t)}finally{d.f()}}r.push(new wu(c,e.length,o.index,o.index+h.length)),a=a.slice(0,o.index)+h+a.slice(o.index+o[0].length)}for(;p=/\\([{}])/.exec(a);){a=a.slice(0,p.index)+p[1]+a.slice(p.index+p[0].length),k=F(r);try{for(k.s();!(g=k.n()).done;)(w=g.value).line==e.length&&w.from>p.index&&(w.from--,w.to--)}catch(t){k.e(t)}finally{k.f()}}e.push(a)}}catch(t){u.e(t)}finally{u.f()}return new b(e,r)}}]),b}(),xu=m.widget({widget:new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"toDOM",value:function t(){var n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(tn))}),Su=m.mark({class:"cm-snippetField"}),Cu=function(){function s(t,n){A(this,s),this.ranges=t,this.active=n,this.deco=m.set(t.map(function(t){return(t.from==t.to?xu:Su).range(t.from,t.to)}))}return D(s,[{key:"map",value:function t(n){var i,e,r,o,u,i=[],e=F(this.ranges);try{for(e.s();!(r=e.n()).done;){if(!(u=(o=r.value).map(n)))return null;i.push(u)}}catch(t){e.e(t)}finally{e.f()}return new s(i,this.active)}},{key:"selectionInsideField",value:function t(n){var i=this;return n.ranges.every(function(n){return i.ranges.some(function(t){return t.field==i.active&&t.from<=n.from&&t.to>=n.to})})}}]),s}(),ju=v.define({map:function t(n,i){return n&&n.map(i)}}),Pu=v.define(),Ou=b.define({create:function t(){return null},update:function t(n,i){var e,r,o,e=F(i.effects);try{for(e.s();!(r=e.n()).done;){if((o=r.value).is(ju))return o.value;if(o.is(Pu)&&n)return new Cu(n.ranges,o.value)}}catch(t){e.e(t)}finally{e.f()}return n=(n=n&&i.docChanged?n.map(i.changes):n)&&i.selection&&!n.selectionInsideField(i.selection)?null:n},provide:function t(n){return w.decorations.from(n,function(t){return t?t.deco:m.none})}}),Eu=[{key:"Tab",run:Vr=Gd(1),shift:Ur=Gd(-1)},{key:"Escape",run:n=function t(n){var i,n,e,i=n.state,n=n.dispatch,e;return!!i.field(Ou,!1)&&(n(i.update({effects:ju.of(null)})),!0)}}],Au=y.define({combine:function t(n){return n.length?n[0]:Eu}}),Du=st.highest(ie.compute([Au],function(t){return t.facet(Au)})),Ru=w.domEventHandlers({mousedown:function t(n,i){var e,r,o,e=i.state.field(Ou,!1);return!(!e||null==(r=i.posAtCoords({x:n.clientX,y:n.clientY}))||!(o=e.ranges.find(function(t){return t.from<=r&&t.to>=r}))||o.field==e.active||(i.dispatch({selection:$d(e.ranges,o.field),effects:ju.of(e.ranges.some(function(t){return t.field>o.field})?new Cu(e.ranges,o.field):null)}),0))}}),Iu=Object.create(null),t=function t(n){var i,e,r,r,o,i=n.state.languageDataAt("wordChars",n.pos).join(""),e=Xd(i),r=n.matchBefore(Zd(e,function(t){return t+"$"}));return r||n.explicit?{from:r=r?r.from:n.pos,options:o=n1(n.state.doc,Yd(i),e,5e4,r),validFor:Zd(e,function(t){return"^"+t})}:null},Tu={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Lu=v.define({map:function t(n,i){var i=i.mapPos(n,-1,h.TrackAfter);return null==i?void 0:i}}),(Bu=new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i)}(jt))).startSide=1,Bu.endSide=-1,_u=b.define({create:function t(){return j.empty},update:function t(n,i){var e,r,o,u,s;n=(n=i.selection&&(e=i.state.doc.lineAt(i.selection.main.head).from,r=i.startState.doc.lineAt(i.startState.selection.main.head).from,e!=i.changes.mapPos(r,-1))?j.empty:n).map(i.changes),o=F(i.effects);try{for(o.s();!(u=o.n()).done;)(s=u.value).is(Lu)&&(n=n.update({add:[Bu.range(s.value,s.value+1)]}))}catch(t){o.e(t)}finally{o.f()}return n}}),Fu="()[]{}<>",Nu="object"==("undefined"==typeof navigator?"undefined":uh(navigator))&&/Android\b/.test(navigator.userAgent),Uu=w.inputHandler.of(function(t,n,i,e){var r,n;return!((Nu?t.composing:t.compositionStarted)||t.state.readOnly||(r=t.state.selection.main,2<e.length)||2==e.length&&1==Mh(wh(e,0))||n!=r.from||i!=r.to||!(n=o1(t.state,e))||(t.dispatch(n),0))}),Hu=[{key:"Backspace",run:e=function t(n){var o,n,i,u,s,i,o=n.state,n=n.dispatch;return!o.readOnly&&(i=r1(o,o.selection.main.head),u=i.brackets||Tu.brackets,s=null,i=o.changeByRange(function(t){var n,i,e,r;if(t.empty){n=a1(o.doc,t.head),i=F(u);try{for(i.s();!(e=i.n()).done;)if((r=e.value)==n&&s1(o.doc,t.head)==e1(wh(r,0)))return{changes:{from:t.head-r.length,to:t.head+r.length},range:O.cursor(t.head-r.length)}}catch(t){i.e(t)}finally{i.f()}}return{range:s=t}}),s||n(o.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s)}}],zu=[{key:"Ctrl-Space",run:$r},{key:"Escape",run:Yt},{key:"ArrowDown",run:Id(!0)},{key:"ArrowUp",run:Id(!1)},{key:"PageDown",run:Id(!0,"page")},{key:"PageUp",run:Id(!1,"page")},{key:"Enter",run:r}],Wu=st.highest(ie.computeN([eu],function(t){return t.facet(eu).defaultKeymap?[zu]:[]})),Vu=new WeakMap,$u=L.Autocomplete=Object.freeze({__proto__:null,CompletionContext:Qo,acceptCompletion:r,autocompletion:y1,clearSnippet:n,closeBrackets:i1,closeBracketsKeymap:Hu,closeCompletion:Yt,completeAnyWord:t,completeFromList:Sd,completionKeymap:zu,completionStatus:m1,currentCompletions:p1,deleteBracketPair:e,hasNextSnippetField:Jd,hasPrevSnippetField:Kd,ifIn:Cd,ifNotIn:jd,insertBracket:o1,insertCompletionText:Ed,moveCompletionSelection:Id,nextSnippetField:Vr,pickedCompletion:Zo,prevSnippetField:Ur,selectedCompletion:k1,selectedCompletionIndex:g1,setSelectedCompletion:w1,snippet:qd,snippetCompletion:Qd,snippetKeymap:Au,startCompletion:$r}),qu=b1(j1,0),Zt=b1(j1,1),Nr=b1(j1,2),nn=b1(C1,0),zr=b1(C1,1),u=b1(C1,2),Gu=b1(function(t,n){return C1(t,n,S1(n))},0),Ju=50,Ku=gt.define(),Qu=gt.define(),Xu=y.define(),Zu=y.define({combine:function t(n){return qh(n,{minDepth:100,newGroupDelay:500,joinToEvent:function t(n,i){return i}},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:function t(i,e){return function(t,n){return i(t,n)||e(t,n)}}})}}),o=Yu=b.define({create:function t(){return us.empty},update:function t(n,i){var e,r,o,o,u,s,o,u,s,r,e=i.state.facet(Zu),r=i.annotation(Ku);return r?(o=i.docChanged?O.single(P1(i.changes)):void 0,o=is.fromTransaction(i,o),s=0==(u=r.side)?n.undone:n.done,s=o?D1(s,s.length,e.minDepth,o):L1(s,i.startState.selection),new us(0==u?r.rest:s,0==u?s:r.rest)):("full"!=(o=i.annotation(Qu))&&"before"!=o||(n=n.isolate()),!1===i.annotation(Mt.addToHistory)?i.changes.empty?n:n.addMapping(i.changes.desc):(u=is.fromTransaction(i),s=i.annotation(Mt.time),r=i.annotation(Mt.userEvent),u?n=n.addChanges(u,s,r,e,i):i.selection&&(n=n.addSelection(i.startState.selection,s,r,e.newGroupDelay)),"full"!=o&&"after"!=o?n:n.isolate()))},toJSON:function t(n){return{done:n.done.map(function(t){return t.toJSON()}),undone:n.undone.map(function(t){return t.toJSON()})}},fromJSON:function t(n){return new us(n.done.map(is.fromJSON),n.undone.map(is.fromJSON))}}),ts=E1(0,!(Wr=function t(n){var i=n.state,i=i.doc.lineAt(i.selection.main.from),i=M1(n.state,i.from);return i.line?qu(n):!!i.block&&Gu(n)})),ns=E1(1,!1),Hr=E1(0,!0),jt=E1(1,!0),r=A1(0),n=A1(1),is=function(){function a(t,n,i,e,r){A(this,a),this.changes=t,this.effects=n,this.mapped=i,this.startSelection=e,this.selectionsAfter=r}return D(a,[{key:"setSelAfter",value:function t(n){return new a(this.changes,this.effects,this.mapped,this.startSelection,n)}},{key:"toJSON",value:function t(){var n,n,n;return{changes:null==(n=this.changes)?void 0:n.toJSON(),mapped:null==(n=this.mapped)?void 0:n.toJSON(),startSelection:null==(n=this.startSelection)?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(function(t){return t.toJSON()})}}}],[{key:"fromJSON",value:function t(n){return new a(n.changes&&K.fromJSON(n.changes),[],n.mapped&&J.fromJSON(n.mapped),n.startSelection&&O.fromJSON(n.startSelection),n.selectionsAfter.map(O.fromJSON))}},{key:"fromTransaction",value:function t(n,i){var e,r,o,u,s,e=es,r=F(n.startState.facet(Xu));try{for(r.s();!(o=r.n()).done;)(s=(u=o.value)(n)).length&&(e=e.concat(s))}catch(t){r.e(t)}finally{r.f()}return!e.length&&n.changes.empty?null:new a(n.changes.invert(n.startState.doc),e,void 0,i||n.startState.selection,es)}},{key:"selection",value:function t(n){return new a(void 0,es,void 0,void 0,n)}}]),a}(),es=[],rs=200,os=/^(input\.type|delete)($|\.)/,(us=function(){function a(t,n){var i,e,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:void 0;A(this,a),this.done=t,this.undone=n,this.prevTime=i,this.prevUserEvent=e}return D(a,[{key:"isolate",value:function t(){return this.prevTime?new a(this.done,this.undone):this}},{key:"addChanges",value:function t(n,i,e,r,o){var u=this.done,s=u[u.length-1],u;return new a(u=s&&s.changes&&!s.changes.empty&&n.changes&&(!e||os.test(e))&&(!s.selectionsAfter.length&&i-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,R1(s.changes,n.changes))||"input.type.compose"==e)?D1(u,u.length-1,r.minDepth,new is(n.changes.compose(s.changes),T1(n.effects,s.effects),s.mapped,s.startSelection,es)):D1(u,u.length,r.minDepth,n),es,i,e)}},{key:"addSelection",value:function t(n,i,e,r){var o=this.done.length?this.done[this.done.length-1].selectionsAfter:es;return 0<o.length&&i-this.prevTime<r&&e==this.prevUserEvent&&e&&/^select($|\.)/.test(e)&&I1(o[o.length-1],n)?this:new a(L1(this.done,n),this.undone,i,e)}},{key:"addMapping",value:function t(n){return new a(_1(this.done,n),_1(this.undone,n),this.prevTime,this.prevUserEvent)}},{key:"pop",value:function t(n,i,e){var r,o,e,r=0==n?this.done:this.undone;return 0==r.length?null:(o=r[r.length-1],e&&o.selectionsAfter.length?i.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:Ku.of({side:n,rest:B1(r)}),userEvent:0==n?"select.undo":"select.redo",scrollIntoView:!0}):o.changes?(e=1==r.length?es:r.slice(0,r.length-1),o.mapped&&(e=_1(e,o.mapped)),i.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:Ku.of({side:n,rest:e}),filter:!1,userEvent:0==n?"undo":"redo",scrollIntoView:!0})):null)}}]),a}()).empty=new us(es,es),ss=[{key:"Mod-z",run:ts,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:ns,preventDefault:!0},{linux:"Ctrl-Shift-z",run:ns,preventDefault:!0},{key:"Mod-u",run:Hr,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:jt,preventDefault:!0}],ra=function t(a,f){return sy(a,function(t){var n,i,e,r,o,u,s,n=a.state,i=n.doc.lineAt(t);if(!f&&t>i.from&&t<i.from+200&&!/[^ \t]/.test(e=i.text.slice(0,t-i.from))){if("\t"==e[e.length-1])return t-1;for(u=(o=ic(e,n.tabSize))%Pv(n)||Pv(n),s=0;s<u&&" "==e[e.length-1-s];s++)t--;r=t}else(r=yh(i.text,t-i.from,f,f)+i.from)==t&&i.number!=(f?n.doc.lines:1)&&(r+=f?1:-1);return r})},sa=function t(f,h){return sy(f,function(t){for(var n,i,e,r,o,u,s,a,n=t,i=f.state,e=i.doc.lineAt(n),r=i.charCategorizer(n),o=null;;){if(n==(h?e.to:e.from)){n==t&&e.number!=(h?i.doc.lines:1)&&(n+=h?1:-1);break}if(u=yh(e.text,n-e.from,h)+e.from,a=r(s=e.text.slice(Math.min(n,u)-e.from,Math.max(n,u)-e.from)),null!=o&&a!=o)break;" "==s&&n==t||(o=a),n=u}return n})},Pa=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Yt=function t(n){return H1(n,function(t){return K1(n.state,t,!V1(n))})},shift:t=function t(n){return ny(n,function(t){return K1(n.state,t,!V1(n))})}},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=function t(n){return H1(n,function(t){return K1(n.state,t,V1(n))})},shift:Vr=function t(n){return ny(n,function(t){return K1(n.state,t,V1(n))})}},{key:"Alt-ArrowUp",run:Ur=function t(n){var i,e;return hy(n.state,n.dispatch,!1)}},{key:"Shift-Alt-ArrowUp",run:$r=function t(n){var i,e;return cy(n.state,n.dispatch,!1)}},{key:"Alt-ArrowDown",run:ya=function t(n){var i,e;return hy(n.state,n.dispatch,!0)}},{key:"Shift-Alt-ArrowDown",run:ma=function t(n){var i,e;return cy(n.state,n.dispatch,!0)}},{key:"Escape",run:ea=function t(n){var i,n,e,r,i=n.state,n=n.dispatch,e=i.selection,r=null;return 1<e.ranges.length?r=O.create([e.main]):e.main.empty||(r=O.create([O.cursor(e.main.head)])),!!r&&(n(U1(i,r)),!0)}},{key:"Mod-Enter",run:wa=vy(!0)},{key:"Alt-l",mac:"Ctrl-l",run:na=function t(n){var i,n,e,i=n.state,n=n.dispatch,e=fy(i).map(function(t){var n=t.from,t=t.to;return O.range(n,Math.min(t+1,i.doc.length))});return n(i.update({selection:O.create(e),userEvent:"select"})),!0}},{key:"Mod-i",run:ia=function t(n){var e,n,i,e=n.state,n=n.dispatch,i=N1(e.selection,function(t){for(var n,i,i=R(e).resolveInner(t.head,1);!(i.from<t.from&&i.to>=t.to||i.to>t.to&&i.from<=t.from||null==(n=i.parent))&&n.parent;)i=i.parent;return O.range(i.to,i.from)});return n(U1(e,i)),!0},preventDefault:!0},{key:"Mod-[",run:xa=function t(n){var u=n.state,n=n.dispatch;return!u.readOnly&&(n(u.update(dy(u,function(t,n){var i,e,r,o,i=/^\s*/.exec(t.text)[0];if(i){for(e=ic(i,u.tabSize),r=0,o=Ov(u,Math.max(0,e-Pv(u)));r<i.length&&r<o.length&&i.charCodeAt(r)==o.charCodeAt(r);)r++;n.push({from:t.from+r,to:t.from+i.length,insert:o.slice(r)})}}),{userEvent:"delete.dedent"})),!0)}},{key:"Mod-]",run:Ma=function t(n){var i=n.state,n=n.dispatch;return!i.readOnly&&(n(i.update(dy(i,function(t,n){n.push({from:t.from,insert:i.facet(ro)})}),{userEvent:"input.indent"})),!0)}},{key:"Mod-Alt-\\",run:ba=function t(n){var u,n,s,a,i,u=n.state,n=n.dispatch;return!u.readOnly&&(s=Object.create(null),a=new oo(u,{overrideIndentation:function t(n){var n=s[n];return null==n?-1:n}}),(i=dy(u,function(t,n,i){var e,r,o,e=Ev(a,t.from);null!=e&&(/\S/.test(t.text)||(e=0),(r=/^\s*/.exec(t.text)[0])!=(o=Ov(u,e))||i.from<t.from+r.length)&&(s[t.from]=e,n.push({from:t.from,to:t.from+r.length,insert:o}))})).changes.empty||n(u.update(i,{userEvent:"indent"})),!0)}},{key:"Shift-Mod-k",run:pa=function t(n){var i,e,r;return!n.state.readOnly&&(e=(i=n.state).changes(fy(i).map(function(t){var n=t.from,t=t.to;return 0<n?n--:t<i.doc.length&&t++,{from:n,to:t}})),r=N1(i.selection,function(t){return n.moveVertically(t,!0)}).map(e),n.dispatch({changes:e,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0)}},{key:"Shift-Mod-\\",run:Os=function t(n){var i,e;return ty(n.state,n.dispatch,!1)}},{key:"Mod-/",run:Wr},{key:"Alt-A",run:nn}].concat(ja=[{key:"ArrowLeft",run:as=function t(n){return W1(n,!V1(n))},shift:As=function t(n){return iy(n,!V1(n))},preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:ls=function t(n){return $1(n,!V1(n))},shift:Ts=function t(n){return ey(n,!V1(n))},preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Ss=function t(n){return H1(n,function(t){return Y1(n,t,!V1(n))})},shift:qs=function t(n){return ny(n,function(t){return Y1(n,t,!V1(n))})},preventDefault:!0},{key:"ArrowRight",run:fs=function t(n){return W1(n,V1(n))},shift:Ds=function t(n){return iy(n,V1(n))},preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:vs=function t(n){return $1(n,V1(n))},shift:Ls=function t(n){return ey(n,V1(n))},preventDefault:!0},{mac:"Cmd-ArrowRight",run:Cs=function t(n){return H1(n,function(t){return Y1(n,t,V1(n))})},shift:Gs=function t(n){return ny(n,function(t){return Y1(n,t,V1(n))})},preventDefault:!0},{key:"ArrowUp",run:ks=function t(n){return Q1(n,!1)},shift:Us=function t(n){return oy(n,!1)},preventDefault:!0},{mac:"Cmd-ArrowUp",run:Qs=function t(n){var i=n.state,e;return(0,n.dispatch)(U1(i,{anchor:0})),!0},shift:Zs=function t(n){var i=n.state,e;return(0,n.dispatch)(U1(i,{anchor:i.selection.main.anchor,head:0})),!0}},{mac:"Ctrl-ArrowUp",run:ws=function t(n){return Z1(n,!1)},shift:zs=function t(n){return uy(n,!1)}},{key:"ArrowDown",run:gs=function t(n){return Q1(n,!0)},shift:Hs=function t(n){return oy(n,!0)},preventDefault:!0},{mac:"Cmd-ArrowDown",run:Xs=function t(n){var i=n.state,e;return(0,n.dispatch)(U1(i,{anchor:i.doc.length})),!0},shift:Ys=function t(n){var i=n.state,e;return(0,n.dispatch)(U1(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0}},{mac:"Ctrl-ArrowDown",run:bs=function t(n){return Z1(n,!0)},shift:Ws=function t(n){return uy(n,!0)}},{key:"PageUp",run:ws,shift:zs},{key:"PageDown",run:bs,shift:Ws},{key:"Home",run:xs=function t(n){return H1(n,function(t){return Y1(n,t,!1)})},shift:$s=function t(n){return ny(n,function(t){return Y1(n,t,!1)})},preventDefault:!0},{key:"Mod-Home",run:Qs,shift:Zs},{key:"End",run:Ms=function t(n){return H1(n,function(t){return Y1(n,t,!0)})},shift:Vs=function t(n){return ny(n,function(t){return Y1(n,t,!0)})},preventDefault:!0},{key:"Mod-End",run:Xs,shift:Ys},{key:"Enter",run:ga=vy(!(ka=function t(n){var i=n.state,e;return(0,n.dispatch)(i.update(i.replaceSelection(i.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0}))},{key:"Mod-a",run:ta=function t(n){var i=n.state,e;return(0,n.dispatch)(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0}},{key:"Backspace",run:oa=function t(n){return ra(n,!1)},shift:oa},{key:"Delete",run:ua=function t(n){return ra(n,!0)}},{key:"Mod-Backspace",mac:"Alt-Backspace",run:aa=function t(n){return sa(n,!1)}},{key:"Mod-Delete",mac:"Alt-Delete",run:fa=function t(n){return sa(n,!0)}},{mac:"Mod-Backspace",run:ca=function t(i){return sy(i,function(t){var n=i.lineBlockAt(t).from;return n<t?n:Math.max(0,t-1)})}},{mac:"Mod-Delete",run:ha=function t(i){return sy(i,function(t){var n=i.lineBlockAt(t).to;return t<n?n:Math.min(i.state.doc.length,t+1)})}}].concat((Ca=[{key:"Ctrl-b",run:as,shift:As,preventDefault:!0},{key:"Ctrl-f",run:fs,shift:Ds},{key:"Ctrl-p",run:ks,shift:Us},{key:"Ctrl-n",run:gs,shift:Hs},{key:"Ctrl-a",run:js=function t(n){return H1(n,function(t){return O.cursor(n.lineBlockAt(t.head).from,1)})},shift:Js=function t(n){return ny(n,function(t){return O.cursor(n.lineBlockAt(t.head).from)})}},{key:"Ctrl-e",run:Ps=function t(n){return H1(n,function(t){return O.cursor(n.lineBlockAt(t.head).to,-1)})},shift:Ks=function t(n){return ny(n,function(t){return O.cursor(n.lineBlockAt(t.head).to)})}},{key:"Ctrl-d",run:ua},{key:"Ctrl-h",run:oa},{key:"Ctrl-k",run:ha},{key:"Ctrl-Alt-h",run:aa},{key:"Ctrl-o",run:va=function t(n){var i,n,e,i=n.state,n=n.dispatch;return!i.readOnly&&(e=i.changeByRange(function(t){return{changes:{from:t.from,to:t.to,insert:k.of(["",""])},range:O.cursor(t.from)}}),n(i.update(e,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Ctrl-t",run:da=function t(n){var r,n,i,r=n.state,n=n.dispatch;return!r.readOnly&&!(i=r.changeByRange(function(t){var n,i,e,i;return t.empty&&0!=t.from&&t.from!=r.doc.length?{changes:{from:e=(n=t.from)==(i=r.doc.lineAt(n)).from?n-1:yh(i.text,n-i.from,!1)+i.from,to:i=n==i.to?n+1:yh(i.text,n-i.from,!0)+i.from,insert:r.doc.slice(n,i).append(r.doc.slice(e,n))},range:O.cursor(i)}:{range:t}})).changes.empty&&(n(r.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:bs}]).map(function(t){return{mac:t.key,run:t.run,shift:t.shift}}))),Ea=L.Commands=Object.freeze({__proto__:null,blockComment:zr,blockUncomment:u,copyLineDown:ma,copyLineUp:$r,cursorCharBackward:cs=function t(n){return W1(n,!1)},cursorCharForward:hs=function t(n){return W1(n,!0)},cursorCharLeft:as,cursorCharRight:fs,cursorDocEnd:Xs,cursorDocStart:Qs,cursorGroupBackward:ys=function t(n){return $1(n,!1)},cursorGroupForward:ds=function t(n){return $1(n,!0)},cursorGroupLeft:ls,cursorGroupRight:vs,cursorLineBoundaryBackward:xs,cursorLineBoundaryForward:Ms,cursorLineBoundaryLeft:Ss,cursorLineBoundaryRight:Cs,cursorLineDown:gs,cursorLineEnd:Ps,cursorLineStart:js,cursorLineUp:ks,cursorMatchingBracket:Os,cursorPageDown:bs,cursorPageUp:ws,cursorSubwordBackward:ps=function t(n){return G1(n,!1)},cursorSubwordForward:ms=function t(n){return G1(n,!0)},cursorSyntaxLeft:Yt,cursorSyntaxRight:e,defaultKeymap:Pa,deleteCharBackward:oa,deleteCharForward:ua,deleteGroupBackward:aa,deleteGroupForward:fa,deleteLine:pa,deleteToLineEnd:ha,deleteToLineStart:ca,deleteTrailingWhitespace:la=function t(n){var i,n,e,r,o,u,s,i=n.state,n=n.dispatch;if(i.readOnly)return!1;for(e=[],r=0,o="",u=i.doc.iter();;){if(u.next(),u.lineBreak||u.done){if(-1<(s=o.search(/\s+$/))&&e.push({from:r-(o.length-s),to:r}),u.done)break;o=""}else o=u.value;r+=u.value.length}return!!e.length&&(n(i.update({changes:e,userEvent:"delete"})),!0)},emacsStyleKeymap:Ca,history:O1,historyField:o,historyKeymap:ss,indentLess:xa,indentMore:Ma,indentSelection:ba,indentWithTab:Oa={key:"Tab",run:Ma,shift:xa},insertBlankLine:wa,insertNewline:ka,insertNewlineAndIndent:ga,insertTab:Sa=function t(n){var i=n.state,n=n.dispatch;return i.selection.ranges.some(function(t){return!t.empty})?Ma({state:i,dispatch:n}):(n(i.update(i.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0)},invertedEffects:Xu,isolateHistory:Qu,lineComment:Zt,lineUncomment:Nr,moveLineDown:ya,moveLineUp:Ur,redo:ns,redoDepth:n,redoSelection:jt,selectAll:ta,selectCharBackward:Is=function t(n){return iy(n,!1)},selectCharForward:Rs=function t(n){return iy(n,!0)},selectCharLeft:As,selectCharRight:Ds,selectDocEnd:Ys,selectDocStart:Zs,selectGroupBackward:_s=function t(n){return ey(n,!1)},selectGroupForward:Bs=function t(n){return ey(n,!0)},selectGroupLeft:Ts,selectGroupRight:Ls,selectLine:na,selectLineBoundaryBackward:$s,selectLineBoundaryForward:Vs,selectLineBoundaryLeft:qs,selectLineBoundaryRight:Gs,selectLineDown:Hs,selectLineEnd:Ks,selectLineStart:Js,selectLineUp:Us,selectMatchingBracket:Es=function t(n){var i,e;return ty(n.state,n.dispatch,!0)},selectPageDown:Ws,selectPageUp:zs,selectParentSyntax:ia,selectSubwordBackward:Ns=function t(n){return ry(n,!1)},selectSubwordForward:Fs=function t(n){return ry(n,!0)},selectSyntaxLeft:t,selectSyntaxRight:Vr,simplifySelection:ea,splitLine:va,standardKeymap:ja,toggleBlockComment:nn,toggleBlockCommentByLine:Gu,toggleComment:Wr,toggleLineComment:qu,transposeChars:da,undo:ts,undoDepth:r,undoSelection:Hr}),Aa=D(function t(n,i,e){A(this,t),this.from=n,this.to=i,this.diagnostic=e}),Da=function(){function o(t,n,i){A(this,o),this.diagnostics=t,this.panel=n,this.selected=i}return D(o,null,[{key:"init",value:function t(n,i,e){var n,r,r,n=n,r=e.facet(Ua).markerFilter;return r&&(n=r(n)),new o(r=m.set(n.map(function(t){return t.from==t.to||t.from==t.to-1&&e.doc.lineAt(t.from).to==t.from?m.widget({widget:new Ha(t),diagnostic:t}).range(t.from):m.mark({attributes:{class:"cm-lintRange cm-lintRange-"+t.severity},diagnostic:t}).range(t.from,t.to)}),!0),i,my(r))}}]),o}(),Ra=v.define(),Ia=v.define(),Ta=v.define(),La=b.define({create:function t(){return new Da(m.none,null,null)},update:function t(n,i){var e,r,o,u,s,a;i.docChanged&&(e=n.diagnostics.map(i.changes),r=null,n.selected&&(o=i.changes.mapPos(n.selected.from,1),r=my(e,n.selected.diagnostic,o)||my(e,null,o)),n=new Da(e,n.panel,r)),u=F(i.effects);try{for(u.s();!(s=u.n()).done;)(a=s.value).is(Ra)?n=Da.init(a.value,n.panel,i.state):a.is(Ia)?n=new Da(n.diagnostics,a.value?Wa.open:null,n.selected):a.is(Ta)&&(n=new Da(n.diagnostics,n.panel,a.value))}catch(t){u.e(t)}finally{u.f()}return n},provide:function t(n){return[Ke.from(n,function(t){return t.panel}),w.decorations.from(n,function(t){return t.diagnostics})]}}),Ba=m.mark({class:"cm-lintRange cm-lintRange-active"}),_a=function t(n){var i=n.state.field(La,!1);return!(!i||!i.panel||(n.dispatch({effects:Ia.of(!1)}),0))},Fa=[{key:"Mod-Shift-m",run:zr=function t(n){var i,i,i=n.state.field(La,!1);return i&&i.panel||n.dispatch({effects:ky(n.state,[Ia.of(!0)])}),(i=W0(n,Wa.open))&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:u=function t(n){var i,e,r,i=n.state.field(La,!1);return!(!i||(e=n.state.selection.main,!(r=i.diagnostics.iter(e.to+1)).value&&(!(r=i.diagnostics.iter(0)).value||r.from==e.from&&r.to==e.to))||(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),0))}}],Na=d.fromClass(function(){function i(t){A(this,i),this.view=t,this.timeout=-1,this.set=!0;var n,t=t.state.facet(Ua).delay;this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}return D(i,[{key:"run",value:function t(){var n,i,e,r,i,n=this,i=Date.now();i<this.lintTime-10?setTimeout(this.run,this.lintTime-i):(this.set=!1,i=(r=(e=this.view.state).facet(Ua)).sources,Promise.all(i.map(function(t){return Promise.resolve(t(n.view))})).then(function(t){var t=t.reduce(function(t,n){return t.concat(n)});n.view.state.doc==e.doc&&n.view.dispatch(gy(n.view.state,t))},function(t){Wc(n.view.state,t)}))}},{key:"update",value:function t(n){var i=n.state.facet(Ua);(n.docChanged||i!=n.startState.facet(Ua)||i.needsRefresh&&i.needsRefresh(n))&&(this.lintTime=Date.now()+i.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,i.delay)))}},{key:"force",value:function t(){this.set&&(this.lintTime=Date.now(),this.run())}},{key:"destroy",value:function t(){clearTimeout(this.timeout)}}]),i}()),Ua=y.define({combine:function t(n){return Object.assign({sources:n.map(function(t){return t.source})},qh(n.map(function(t){return t.config}),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:function t(n,i){return n?i?function(t){return n(t)||i(t)}:n:i}}))}}),Ha=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).diagnostic=t,n}return D(e,[{key:"eq",value:function t(n){return n.diagnostic==this.diagnostic}},{key:"toDOM",value:function t(){return I("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}]),e}(tn),za=D(function t(n,i){A(this,t),this.diagnostic=i,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=jy(n,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}),Wa=function(){function i(u){var s,t,n,s=this;A(this,i),this.view=u,this.items=[],t=function t(n){var i,e,r,o;if(27==n.keyCode)_a(s.view),s.view.focus();else if(38==n.keyCode||33==n.keyCode)s.moveSelection((s.selectedIndex-1+s.items.length)%s.items.length);else if(40==n.keyCode||34==n.keyCode)s.moveSelection((s.selectedIndex+1)%s.items.length);else if(36==n.keyCode)s.moveSelection(0);else if(35==n.keyCode)s.moveSelection(s.items.length-1);else if(13==n.keyCode)s.view.focus();else{if(!(65<=n.keyCode&&n.keyCode<=90&&0<=s.selectedIndex))return;for(e=Cy((i=s.items[s.selectedIndex].diagnostic).actions),r=0;r<e.length;r++)e[r].toUpperCase().charCodeAt(0)==n.keyCode&&(o=my(s.view.state.field(La).diagnostics,i))&&i.actions[r].apply(u,o.from,o.to)}n.preventDefault()},n=function t(n){for(var i=0;i<s.items.length;i++)s.items[i].dom.contains(n.target)&&s.moveSelection(i)},this.list=I("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=I("div",{class:"cm-panel-lint"},this.list,I("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:function t(){return _a(s.view)}},"\xd7")),this.update()}return D(i,[{key:"selectedIndex",get:function t(){var n,i,n=this.view.state.field(La).selected;if(n)for(i=0;i<this.items.length;i++)if(this.items[i].diagnostic==n.diagnostic)return i;return-1}},{key:"update",value:function t(){var s,n,i,a,f,h,c,s=this,n=this.view.state.field(La),i=n.diagnostics,a=n.selected,f=0,h=!1,c=null;for(i.between(0,this.view.state.doc.length,function(t,n,i){for(var e,r,o,u,e=i.spec,r=-1,u=f;u<s.items.length;u++)if(s.items[u].diagnostic==e.diagnostic){r=u;break}r<0?(o=new za(s.view,e.diagnostic),s.items.splice(f,0,o),h=!0):(o=s.items[r],f<r&&(s.items.splice(f,r-f),h=!0)),a&&o.diagnostic==a.diagnostic?o.dom.hasAttribute("aria-selected")||(o.dom.setAttribute("aria-selected","true"),c=o):o.dom.hasAttribute("aria-selected")&&o.dom.removeAttribute("aria-selected"),f++});f<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)h=!0,this.items.pop();0==this.items.length&&(this.items.push(new za(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),h=!0),c?(this.list.setAttribute("aria-activedescendant",c.id),this.view.requestMeasure({key:this,read:function t(){return{sel:c.dom.getBoundingClientRect(),panel:s.list.getBoundingClientRect()}},write:function t(n){var i=n.sel,n=n.panel;i.top<n.top?s.list.scrollTop-=n.top-i.top:i.bottom>n.bottom&&(s.list.scrollTop+=i.bottom-n.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),h&&this.sync()}},{key:"sync",value:function t(){var n,i,e,r;function o(){var t=n;n=t.nextSibling,t.remove()}n=this.list.firstChild,i=F(this.items);try{for(i.s();!(e=i.n()).done;)if((r=e.value).dom.parentNode==this.list){for(;n!=r.dom;)o();n=r.dom.nextSibling}else this.list.insertBefore(r.dom,n)}catch(t){i.e(t)}finally{i.f()}for(;n;)o()}},{key:"moveSelection",value:function t(n){var i,n;this.selectedIndex<0||(n=my((i=this.view.state.field(La)).diagnostics,this.items[n].diagnostic))&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Ta.of(n)})}}],[{key:"open",value:function t(n){return new i(n)}}]),i}(),ma=w.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-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:Oy("#d11")},".cm-lintRange-warning":{backgroundImage:Oy("orange")},".cm-lintRange-info":{backgroundImage:Oy("#999")},".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-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}}}),Va=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).diagnostics=t,n.severity=t.reduce(function(t,n){var n=n.severity;return"error"==n||"warning"==n&&"info"==t?n:t},"info"),n}return D(e,[{key:"toDOM",value:function t(n){var i,e,r,i=document.createElement("div");return i.className="cm-lint-marker cm-lint-marker-"+this.severity,e=this.diagnostics,r=n.state.facet(Xa).tooltipFilter,(e=r?r(e):e).length&&(i.onmouseover=function(){return Ay(n,i,e)}),i}}]),e}(en),$a=$0({class:"cm-gutter-lint",markers:function t(n){return n.state.field(qa)}}),qa=b.define({create:function t(){return j.empty},update:function t(n,i){var e,r,o,u,s;n=n.map(i.changes),e=i.state.facet(Xa).markerFilter,r=F(i.effects);try{for(r.s();!(o=r.n()).done;)(u=o.value).is(Ra)&&(s=u.value,e&&(s=e(s||[])),n=Dy(i.state.doc,s.slice(0)))}catch(t){r.e(t)}finally{r.f()}return n}}),Ga=v.define(),Ja=b.define({create:function t(){return null},update:function t(n,i){return n&&i.docChanged&&(n=py(i,n)?null:Object.assign(Object.assign({},n),{pos:i.changes.mapPos(n.pos)})),i.effects.reduce(function(t,n){return n.is(Ga)?n.value:t},n)},provide:function t(n){return Ue.from(n)}}),Ka=w.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Py('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Py('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Py('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Qa=[La,w.decorations.compute([La],function(t){var t=t.field(La),n=t.selected,t=t.panel;return n&&t&&n.from!=n.to?m.set([Ba.range(n.from,n.to)]):m.none}),F0(by,{hideOn:py}),ma],Xa=y.define({combine:function t(n){return qh(n,{hoverTime:300,markerFilter:null,tooltipFilter:null})}}),Za=L.Lint=Object.freeze({__proto__:null,closeLintPanel:_a,diagnosticCount:wy,forEachDiagnostic:Iy,forceLinting:Sy,lintGutter:Ry,lintKeymap:Fa,linter:xy,nextDiagnostic:u,openLintPanel:zr,setDiagnostics:gy,setDiagnosticsEffect:Ra}),Ya="function"==typeof String.prototype.normalize?function(t){return t.normalize("NFKD")}:function(t){return t},tf=function(){function u(t,n){var i,e,r,o,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:t.length,r=4<arguments.length?arguments[4]:void 0,o=5<arguments.length?arguments[5]:void 0;A(this,u),this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,e),this.bufferStart=i,this.normalize=r?function(t){return r(Ya(t))}:Ya,this.query=this.normalize(n)}return D(u,[{key:"peek",value:function t(){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 wh(this.buffer,this.bufferPos)}},{key:"next",value:function t(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}},{key:"nextOverlapping",value:function t(){for(var n,i,e,r,o,u,s,a;;){if((n=this.peek())<0)return this.done=!0,this;for(i=bh(n),e=this.bufferStart+this.bufferPos,this.bufferPos+=Mh(n),r=this.normalize(i),o=0,u=e;;o++){if(s=r.charCodeAt(o),a=this.match(s,u))return this.value=a,this;if(o==r.length-1)break;u==e&&o<i.length&&i.charCodeAt(o)==s&&u++}}}},{key:"match",value:function t(n,i){var t,e,r,o;for(t=null,e=0;e<this.matches.length;e+=2)r=this.matches[e],o=!1,this.query.charCodeAt(r)==n&&(r==this.query.length-1?t={from:this.matches[e+1],to:i+1}:(this.matches[e]++,o=!0)),o||(this.matches.splice(e,2),e-=2);return this.query.charCodeAt(0)==n&&(1==this.query.length?t={from:i,to:i+1}:this.matches.push(1,i)),t=t&&this.test&&!this.test(t.from,t.to,this.buffer,this.bufferPos)?null:t}}]),u}(),"undefined"!=typeof Symbol&&(tf.prototype[Symbol.iterator]=function(){return this}),nf={from:-1,to:-1,match:/.*/.exec("")},ef="gm"+(null==/x/.unicode?"":"u"),rf=function(){function o(t,n,i){var e,r,r,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:t.length;if(A(this,o),this.text=t,this.to=r,this.curLine="",this.done=!1,this.value=nf,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new sf(t,n,i,e,r);this.re=new RegExp(n,ef+(null!=i&&i.ignoreCase?"i":"")),this.test=null==i?void 0:i.test,this.iter=t.iter(),r=t.lineAt(e),this.curLineStart=r.from,this.matchPos=Ly(t,e),this.getLine(this.curLineStart)}return D(o,[{key:"getLine",value:function t(n){this.iter.next(n),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 t(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}},{key:"next",value:function t(){for(var n,i,e,r,n=this.matchPos-this.curLineStart;;)if(this.re.lastIndex=n,i=this.matchPos<=this.to&&this.re.exec(this.curLine)){if(r=(e=this.curLineStart+i.index)+i[0].length,this.matchPos=Ly(this.text,r+(e==r?1:0)),e==this.curLineStart+this.curLine.length&&this.nextLine(),(e<r||e>this.value.to)&&(!this.test||this.test(e,r,i)))return this.value={from:e,to:r,match:i},this;n=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),n=0}}}]),o}(),of=new WeakMap,uf=function(){function s(t,n){A(this,s),this.from=t,this.text=n}return D(s,[{key:"to",get:function t(){return this.from+this.text.length}}],[{key:"get",value:function t(n,i,e){var r,o,o,u,r=of.get(n);return!r||r.from>=e||r.to<=i?(o=new s(i,n.sliceString(i,e)),of.set(n,o),o):r.from==i&&r.to==e?r:(o=r.text,i<(u=r.from)&&(o=n.sliceString(i,u)+o,u=i),r.to<e&&(o+=n.sliceString(r.to,e)),of.set(n,new s(u,o)),new s(i,o.slice(i-u,e-u)))}}]),s}(),sf=function(){function o(t,n,i,e,r){A(this,o),this.text=t,this.to=r,this.done=!1,this.value=nf,this.matchPos=Ly(t,e),this.re=new RegExp(n,ef+(null!=i&&i.ignoreCase?"i":"")),this.test=null==i?void 0:i.test,this.flat=uf.get(t,e,this.chunkEnd(e+5e3))}return D(o,[{key:"chunkEnd",value:function t(n){return(n>=this.to?this:this.text.lineAt(n)).to}},{key:"next",value:function t(){for(var n,i,e,r;;){if(n=this.re.lastIndex=this.matchPos-this.flat.from,(i=this.re.exec(this.flat.text))&&!i[0]&&i.index==n&&(this.re.lastIndex=1+n,i=this.re.exec(this.flat.text)),i&&(r=(e=this.flat.from+i.index)+i[0].length,this.flat.to>=this.to||i.index+i[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,r,i)))return this.value={from:e,to:r,match:i},this.matchPos=Ly(this.text,r+(e==r?1:0)),this;if(this.flat.to==this.to)return this.done=!0,this;this.flat=uf.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}]),o}(),"undefined"!=typeof Symbol&&(rf.prototype[Symbol.iterator]=sf.prototype[Symbol.iterator]=function(){return this}),af=v.define(),ff=b.define({create:function t(){return!0},update:function t(n,i){var e,r,o,e=F(i.effects);try{for(e.s();!(r=e.n()).done;)(o=r.value).is(af)&&(n=o.value)}catch(t){e.e(t)}finally{e.f()}return n},provide:function t(n){return Ke.from(n,function(t){return t?By:null})}}),hf=w.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),cf={highlightWordAroundCursor:!($r=function t(n){var i,e,i=W0(n,By);return i||(e=[af.of(!0)],null==n.state.field(ff,!1)&&e.push(v.appendConfig.of([ff,hf])),n.dispatch({effects:e}),i=W0(n,By)),i&&i.dom.querySelector("input").focus(),!0}),minSelectionLength:1,maxMatches:100,wholeWords:!1},lf=y.define({combine:function t(n){return qh(n,cf,{highlightWordAroundCursor:function t(n,i){return n||i},minSelectionLength:Math.min,maxMatches:Math.min})}}),vf=m.mark({class:"cm-selectionMatch"}),df=m.mark({class:"cm-selectionMatch cm-selectionMatch-main"}),yf=d.fromClass(function(){function n(t){A(this,n),this.decorations=this.getDeco(t)}return D(n,[{key:"update",value:function t(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}},{key:"getDeco",value:function t(n){var i,e,r,o,u,s,r,r,a,f,h,c,l,v,d,y,i=n.state.facet(lf),e=n.state,r=e.selection;if(1<r.ranges.length)return m.none;if(s=null,(o=r.main).empty){if(!i.highlightWordAroundCursor)return m.none;if(!(r=e.wordAt(o.head)))return m.none;s=e.charCategorizer(o.head),u=e.sliceDoc(r.from,r.to)}else{if((r=o.to-o.from)<i.minSelectionLength||200<r)return m.none;if(i.wholeWords){if(u=e.sliceDoc(o.from,o.to),!Fy(s=e.charCategorizer(o.head),e,o.from,o.to)||!Ny(s,e,o.from,o.to))return m.none}else if(!(u=e.sliceDoc(o.from,o.to).trim()))return m.none}a=[],f=F(n.visibleRanges);try{for(f.s();!(h=f.n()).done;)for(c=h.value,l=new tf(e.doc,u,c.from,c.to);!l.next().done;)if(d=(v=l.value).from,y=v.to,(!s||Fy(s,e,d,y))&&(o.empty&&d<=o.from&&y>=o.to?a.push(df.range(d,y)):(d>=o.to||y<=o.from)&&a.push(vf.range(d,y)),a.length>i.maxMatches))return m.none}catch(t){f.e(t)}finally{f.f()}return m.set(a)}}]),n}(),{decorations:function t(n){return n.decorations}}),mf=w.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),pf=function t(n){var i,n,e,r,i=n.state,n=n.dispatch,e=i.selection,r=O.create(e.ranges.map(function(t){return i.wordAt(t.head)||O.cursor(t.head)}),e.mainIndex);return!r.eq(e)&&(n(i.update({selection:r})),!0)},as=function t(n){var i,n,e,r,e,i=n.state,n=n.dispatch,e=i.selection.ranges;return e.some(function(t){return t.from===t.to})?pf({state:i,dispatch:n}):(r=i.sliceDoc(e[0].from,e[0].to),!i.selection.ranges.some(function(t){return i.sliceDoc(t.from,t.to)!=r})&&!!(e=Uy(i,r))&&(n(i.update({selection:i.selection.addRange(O.range(e.from,e.to),!1),effects:w.scrollIntoView(e.to)})),!0))},kf=y.define({combine:function t(n){return qh(n,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:function t(n){return new Bf(n)},scrollToMatch:function t(n){return w.scrollIntoView(n)}})}}),gf=function(){function n(t){A(this,n),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||Ty(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}return D(n,[{key:"unquote",value:function t(n){return this.literal?n:n.replace(/\\([nrt\\])/g,function(t,n){return"n"==n?"\n":"r"==n?"\r":"t"==n?"\t":"\\"})}},{key:"eq",value:function t(n){return this.search==n.search&&this.replace==n.replace&&this.caseSensitive==n.caseSensitive&&this.regexp==n.regexp&&this.wholeWord==n.wholeWord}},{key:"create",value:function t(){return new(this.regexp?bf:wf)(this)}},{key:"getCursor",value:function t(n){var i,e,n,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length?arguments[2]:void 0,n=n.doc?n:C.create({doc:n});return null==e&&(e=n.doc.length),(this.regexp?Vy:zy)(this,n,i,e)}}]),n}(),wf=function(t){f(i,t);var n=S(i);function i(t){return A(this,i),n.call(this,t)}return D(i,[{key:"nextMatch",value:function t(n,i,e){var e=zy(this.spec,n,e,n.doc.length).nextOverlapping();return(e=e.done?zy(this.spec,n,0,i).nextOverlapping():e).done?null:e.value}},{key:"prevMatchInRange",value:function t(n,i,e){for(var r,o,u,s,r=e;;){for(o=Math.max(i,r-1e4-this.spec.unquoted.length),u=zy(this.spec,n,o,r),s=null;!u.nextOverlapping().done;)s=u.value;if(s)return s;if(o==i)return null;r-=1e4}}},{key:"prevMatch",value:function t(n,i,e){return this.prevMatchInRange(n,0,i)||this.prevMatchInRange(n,e,n.doc.length)}},{key:"getReplacement",value:function t(n){return this.spec.unquote(this.spec.replace)}},{key:"matchAll",value:function t(n,i){for(var e=zy(this.spec,n,0,n.doc.length),r=[];!e.next().done;){if(i<=r.length)return null;r.push(e.value)}return r}},{key:"highlight",value:function t(n,i,e,r){for(var o=zy(this.spec,n,Math.max(0,i-this.spec.unquoted.length),Math.min(e+this.spec.unquoted.length,n.doc.length));!o.next().done;)r(o.value.from,o.value.to)}}]),i}(fs=D(function t(n){A(this,t),this.spec=n})),bf=function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"nextMatch",value:function t(n,i,e){var e=Vy(this.spec,n,e,n.doc.length).next();return(e=e.done?Vy(this.spec,n,0,i).next():e).done?null:e.value}},{key:"prevMatchInRange",value:function t(n,i,e){for(var r,o,u,s,r=1;;r++){for(o=Math.max(i,e-1e4*r),u=Vy(this.spec,n,o,e),s=null;!u.next().done;)s=u.value;if(s&&(o==i||s.from>o+10))return s;if(o==i)return null}}},{key:"prevMatch",value:function t(n,i,e){return this.prevMatchInRange(n,0,i)||this.prevMatchInRange(n,e,n.doc.length)}},{key:"getReplacement",value:function t(i){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,function(t,n){return"$"==n?"$":"&"==n?i.match[0]:"0"!=n&&+n<i.match.length?i.match[n]:t}))}},{key:"matchAll",value:function t(n,i){for(var e=Vy(this.spec,n,0,n.doc.length),r=[];!e.next().done;){if(i<=r.length)return null;r.push(e.value)}return r}},{key:"highlight",value:function t(n,i,e,r){for(var o=Vy(this.spec,n,Math.max(0,i-250),Math.min(e+250,n.doc.length));!o.next().done;)r(o.value.from,o.value.to)}}]),i}(fs),Mf=v.define(),xf=v.define(),Sf=b.define({create:function t(n){return new Cf(Zy(n).create(),null)},update:function t(n,i){var e,r,o,e=F(i.effects);try{for(e.s();!(r=e.n()).done;)(o=r.value).is(Mf)?n=new Cf(o.value.create(),n.panel):o.is(xf)&&(n=new Cf(n.query,o.value?Xy:null))}catch(t){e.e(t)}finally{e.f()}return n},provide:function t(n){return Ke.from(n,function(t){return t.panel})}}),Cf=D(function t(n,i){A(this,t),this.query=n,this.panel=i}),jf=m.mark({class:"cm-searchMatch"}),Pf=m.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Xs=d.fromClass(function(){function n(t){A(this,n),this.view=t,this.decorations=this.highlight(t.state.field(Sf))}return D(n,[{key:"update",value:function t(n){var i=n.state.field(Sf);(i!=n.startState.field(Sf)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(i))}},{key:"highlight",value:function t(n){var i,e,r,o,u,s,a,f,h,c,i=n.query,e;if(!n.panel||!i.spec.valid)return m.none;for(r=this.view,o=new Et,u=0,a=(s=r.visibleRanges).length;u<a;u++){for(h=(f=s[u]).from,c=f.to;u<a-1&&c>s[u+1].from-500;)c=s[++u].to;i.highlight(r.state,h,c,function(n,i){var t=r.state.selection.ranges.some(function(t){return t.from==n&&t.to==i});o.add(n,i,t?Pf:jf)})}return o.finish()}}]),n}(),{decorations:function t(n){return n.decorations}}),Af=Qy(function(t,n){var i,n,i,n=n.query.matchAll(t.state,1e3);return!(!n||!n.length||(t.dispatch({selection:O.create(n.map(function(t){return O.range(t.from,t.to)})),userEvent:"select.search.matches"}),0))}),Df=Qy(function(t,n){var n,i,e,r,e,o,u,s,a,f,e,n=n.query,i=t.state,e=i.selection.main,r=e.from,e=e.to;return!i.readOnly&&!!(o=n.nextMatch(i,r,r))&&(u=[],f=[],o.from==r&&o.to==e&&(a=i.toText(n.getReplacement(o)),u.push({from:o.from,to:o.to,insert:a}),o=n.nextMatch(i,o.from,o.to),f.push(w.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(r).number)+"."))),o&&(e=0==u.length||u[0].from>=o.to?0:o.to-o.from-a.length,s=O.single(o.from-e,o.to-e),f.push(im(t,o)),f.push(i.facet(kf).scrollToMatch(s.main,t))),t.dispatch({changes:u,selection:s,effects:f,userEvent:"input.replace"}),!0)}),Rf=Qy(function(t,n){var e,n,i,e=n.query;return!t.state.readOnly&&!!(n=e.matchAll(t.state,1e9).map(function(t){var n,i;return{from:t.from,to:t.to,insert:e.getReplacement(t)}})).length&&(i=t.state.phrase("replaced $ matches",n.length)+".",t.dispatch({changes:n,effects:w.announce.of(i),userEvent:"input.replace.all"}),!0)}),Lf=[{key:"Mod-f",run:If=function t(n){var i,e,r,i=n.state.field(Sf,!1);return i&&i.panel?(e=Yy(n))&&e!=n.root.activeElement&&((r=Zy(n.state,i.query.spec)).valid&&n.dispatch({effects:Mf.of(r)}),e.focus(),e.select()):n.dispatch({effects:[xf.of(!0),i?Mf.of(Zy(n.state,i.query.spec)):v.appendConfig.of(Nf)]}),!0},scope:"editor search-panel"},{key:"F3",run:Of=Qy(function(t,n){var n,i,n,i,e,n=n.query,i=t.state.selection.main.to,n=n.nextMatch(t.state,i,i);return!!n&&(i=O.single(n.from,n.to),e=t.state.facet(kf),t.dispatch({selection:i,effects:[im(t,n),e.scrollToMatch(i.main,t)],userEvent:"select.search"}),tm(t),!0)}),shift:Ef=Qy(function(t,n){var n,i,e,n,i,e,n=n.query,i=t.state,e=i.selection.main.from,n=n.prevMatch(i,e,e);return!!n&&(i=O.single(n.from,n.to),e=t.state.facet(kf),t.dispatch({selection:i,effects:[im(t,n),e.scrollToMatch(i.main,t)],userEvent:"select.search"}),tm(t),!0)}),scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Of,shift:Ef,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tf=function t(n){var i,i,i=n.state.field(Sf,!1);return!(!i||!i.panel||((i=W0(n,Xy))&&i.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:xf.of(!1)}),0))},scope:"editor search-panel"},{key:"Mod-Shift-l",run:Qs=function t(n){var i,n,e,e,r,e,o,u,s,i=n.state,n=n.dispatch,e=i.selection;if(1<e.ranges.length||e.main.empty)return!1;for(r=(e=e.main).from,e=e.to,o=[],u=0,s=new tf(i.doc,i.sliceDoc(r,e));!s.next().done;){if(1e3<o.length)return!1;s.value.from==r&&(u=o.length),o.push(O.range(s.value.from,s.value.to))}return n(i.update({selection:O.create(o,u),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:$r},{key:"Mod-d",run:as,preventDefault:!0}],Bf=function(){function r(n){var i,t;function e(t,n,i){return I("button",{class:"cm-button",name:t,onclick:n,type:"button"},i)}A(i=this,r),this.view=n,t=this.query=n.state.field(Sf).query.spec,this.commit=this.commit.bind(this),this.searchField=I("input",{value:t.search,placeholder:nm(n,"Find"),"aria-label":nm(n,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=I("input",{value:t.replace,placeholder:nm(n,"Replace"),"aria-label":nm(n,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=I("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=I("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=I("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=I("div",{onkeydown:function t(n){return i.keydown(n)},class:"cm-search"},[this.searchField,e("next",function(){return Of(n)},[nm(n,"next")]),e("prev",function(){return Ef(n)},[nm(n,"previous")]),e("select",function(){return Af(n)},[nm(n,"all")]),I("label",null,[this.caseField,nm(n,"match case")]),I("label",null,[this.reField,nm(n,"regexp")]),I("label",null,[this.wordField,nm(n,"by word")])].concat(Wf(n.state.readOnly?[]:[I("br"),this.replaceField,e("replace",function(){return Df(n)},[nm(n,"replace")]),e("replaceAll",function(){return Rf(n)},[nm(n,"replace all")])]),[I("button",{name:"close",onclick:function t(){return Tf(n)},"aria-label":nm(n,"close"),type:"button"},["\xd7"])]))}return D(r,[{key:"commit",value:function t(){var n=new gf({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});n.eq(this.query)||(this.query=n,this.view.dispatch({effects:Mf.of(n)}))}},{key:"keydown",value:function t(n){u0(this.view,n,"search-panel")?n.preventDefault():13==n.keyCode&&n.target==this.searchField?(n.preventDefault(),(n.shiftKey?Ef:Of)(this.view)):13==n.keyCode&&n.target==this.replaceField&&(n.preventDefault(),Df(this.view))}},{key:"update",value:function t(n){var i,e,r,o,u,s,i=F(n.transactions);try{for(i.s();!(e=i.n()).done;){o=F((r=e.value).effects);try{for(o.s();!(u=o.n()).done;)(s=u.value).is(Mf)&&!s.value.eq(this.query)&&this.setQuery(s.value)}catch(t){o.e(t)}finally{o.f()}}}catch(t){i.e(t)}finally{i.f()}}},{key:"setQuery",value:function t(n){this.query=n,this.searchField.value=n.search,this.replaceField.value=n.replace,this.caseField.checked=n.caseSensitive,this.reField.checked=n.regexp,this.wordField.checked=n.wholeWord}},{key:"mount",value:function t(){this.searchField.select()}},{key:"pos",get:function t(){return 80}},{key:"top",get:function t(){return this.view.state.facet(kf).top}}]),r}(),_f=30,Ff=/[\s\.,:;?!]/,ls=w.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"}}),Nf=[Sf,st.lowest(Xs),ls],Uf=L.Search=Object.freeze({__proto__:null,RegExpCursor:rf,SearchCursor:tf,SearchQuery:gf,closeSearchPanel:Tf,findNext:Of,findPrevious:Ef,getSearchQuery:Jy,gotoLine:$r,highlightSelectionMatches:_y,openSearchPanel:If,replaceAll:Rf,replaceNext:Df,search:Hy,searchKeymap:Lf,searchPanelOpen:Ky,selectMatches:Af,selectNextOccurrence:as,selectSelectionMatches:Qs,setSearchQuery:Mf}),L.basicSetup=function(){return[X0(),fr,M0(),O1(),nd(),y0(),k0(),C.allowMultipleSelections.of(!0),Hv(),ed(jo,{fallback:!0}),ud(),i1(),y1(),R0(),I0(),Ee,_y(),ie.of([].concat(Hu,Wf(Pa),Lf,ss,yo,zu,Fa))]}()},"./dist/plugins/formulaPanel/editor/common/calcUtil.js":function(B,t,n){var a,u,f,h,c;function i(t,n,i,e,r){var o,u,s,a,f;void 0===r&&(r=!0),o=i.culture,u=i.ignoreError,s=i.Wve,a=i.Jde,i.ignoreError=e,i.culture=!0,i.Wve=r,i.Jde=!0;try{f=n.parse(i,t)}catch(t){}return i.culture=o,i.ignoreError=u,i.Wve=s,i.Jde=a,f}function e(t,n,i){if(t){var e;try{e=n.unparse(i,t)}catch(t){}return e}}function r(t,n,i,e,r){var o,u,o,t,s,o=new a.Parser,u=!0,o=n.Mf?(0,f.Vgt)(o,t,n.Mf,i,e,!0):(o.setParserOption(!0),r.ignoreError=!0,t=t.split(""),s=o.parseToTokens(r,t,!1),s=(0,f.fillBlankToTokens)(s,t),(0,f.getExpressTokenImp)(o,n,r,null,s,t,i,e));return H(o,n)}function l(){return{arrayListSeparator:a.Parser.arrayListSeparator||c.COMMA,arrayGroupSeparator:a.Parser.arrayGroupSeparator||c.SEMICOLON,listSeparator:a.Parser.listSeparator||c.COMMA,numberDecimalSeparator:a.Parser.numberDecimalSeparator||c.FULL_STOP}}function o(t,n){var i,e,r,o,u;for(t=t.filter(function(t){return t.endIndex<n}),i=[],e=[],r="",o=0;o<t.length;o++)g(u=t[o])?r=u.text:w(u)?(i.push(r),e.push(0)):b(u)&&(r="",i.pop(),e.pop()),0<i.length&&k(u)&&e[e.length-1]++;if(0<i.length)return{functionName:i.pop(),activeParameter:e.pop()}}function s(t,n){for(var i,n,e,r,o,u,s,i=n.parameters||[],n=i.length||0,o=0;o<i.length;o++)if(i[o].repeatable)void 0===e&&(e=o);else if(void 0!==e){r=o-1;break}return t=void 0!==e&&(void 0===r&&(r=i.length-1),e<=t)?r+(s=(t-e)%(u=r-e+1))+1<n?r+s+1:e+s:t}function v(t,n){t=s(t,n);var n=n.parameters?n.parameters.length:0;return Math.min(t,n-1)}function d(t,n,i,e){return void 0===i&&(i=!0),void 0===e&&(e=!1),t.find(function(t){return y(t,n,i,e)})}function y(t,n,i,e){return void 0===e&&(e=!1),((i=void 0===i?!0:i)?n>=t.index:n>t.index)&&(e?n<=t.endIndex+1:n<t.endIndex+1)}function m(t,n,i){return n<=t.index&&i>=t.endIndex+1}function p(t,n){var i,e,r,o,u,u,s,a,f;for(t=t.filter(function(t){return t.endIndex<n}),i=[],e=[],r=[],o=0;o<t.length;o++)g(u=t[o])?(i.push(u.text.toUpperCase()),e.push([]),r.push(0)):b(u)?(i.pop(),e.pop(),r.pop()):k(u)&&(u=(0,c.lastItem)(i),s=(0,c.lastItem)(r),a=(0,c.lastItem)(e),f=t[o-1],("LAMBDA"===u||"LET"===u&&s%2==0)&&E(f)&&a.push(f.text),r[r.length-1]=s+1);return e.filter(function(t){return 0<t.length}).reduce(function(t,n){return t.concat(n)},[])}function k(t){return t.type===h.TokenType.FunctionArgumentSeparator}function g(t){return t.type===h.TokenType.FunctionName}function w(t){return t.type===h.TokenType.FunctionCallStart}function b(t){return t.type===h.TokenType.FunctionCallEnd}function M(t){return t.type===h.TokenType.SubExpressionStart}function x(t){return t.type===h.TokenType.SubExpressionEnd}function S(t){return t.type===h.TokenType.FormulaStart}function C(t){return t.type===h.TokenType.Unknown}function j(t){return C(t)&&T(t.text)===c.LEFT_PARENTHESES}function P(t){return C(t)&&T(t.text)===c.RIGHT_PARENTHESES}function O(t){return E(t)||D(t)}function _(t){return t.type===h.TokenType.OperatorInfix}function F(t){return t.type===h.TokenType.OperatorPrefix}function N(t){return t.type===h.TokenType.Whitespace}function E(t){return t.type===h.TokenType.Name}function A(t){return t.type===h.TokenType.OperatorPostfix&&"#"===t.text}function D(t){return t.type===h.TokenType.CellReference}function R(t){return O(t)&&t.ranges&&0<t.ranges.length}function I(t){for(var n,i,n=0,i=0;i<t.length&&t[i]===c.WHITESPACE;i++)n++;return n}function U(t,n,i){var t,e,r,o,u,s;for(void 0===i&&(i=4),t=I(t),e=[],r=function(){return 0===e.length},o=function(){return e[e.length-1]},u=0;u<n.length;u++)w(s=n[u])||M(s)?e.push(s):b(s)?!r()&&w(o())&&e.pop():x(s)&&!r()&&M(o())&&e.pop();return 0<e.length&&(t+=i),t}function T(t){return t.replace(/\s+/g,"")}function H(t,n){for(var i,e,r,o,u,s,a,i=[],e=[],r=l(),o=!1,u=0;u<t.length;u++)(a=z(s=t[u],o,r))===h.TokenType.ArrayConstStart?(e.push(a),o=!0):a===h.TokenType.FunctionCallStart?(e.push(a),o=!1):a!==h.TokenType.FunctionCallEnd&&a!==h.TokenType.ArrayConstEnd||(e.pop(),o=(0,c.lastItem)(e)===h.TokenType.ArrayConstStart),i.push({type:a,index:s.index,endIndex:s.endIndex,text:s.text,ranges:s.ranges,canDrag:s.canDrag,colorIndex:s.colorIndex});return W(V(i),n)}function z(t,n,i){var e,r,o,e=t.type,r=t.subType,o=t.text.trim();return 1===e?1===r?"ARRAY"===o?h.TokenType.ArrayConstStart:"@"===o||o===c.LEFT_PARENTHESES?h.TokenType.FunctionCallStart:h.TokenType.FunctionName:2===r?o!==c.RIGHT_PARENTHESES&&n?h.TokenType.ArrayConstEnd:h.TokenType.FunctionCallEnd:(0,u.Df)(o)?h.TokenType.FormulaStart:void 0:3!==e?4===e?h.TokenType.OperatorPrefix:5===e?h.TokenType.OperatorInfix:6===e?h.TokenType.OperatorPostfix:0===e?5===r?h.TokenType.LogicalConst:4===r?h.TokenType.NumberConst:3===r?h.TokenType.StringConst:6===r?h.TokenType.ErrorConst:7===r||12===r?t.isName?h.TokenType.Name:h.TokenType.CellReference:h.TokenType.StringConst:2===e?1===r?h.TokenType.SubExpressionStart:2===r?h.TokenType.SubExpressionEnd:void 0:7===e?h.TokenType.Whitespace:h.TokenType.Unknown:0===r?n&&o===i.arrayListSeparator?h.TokenType.ArrayConstItemSeparator:n&&o===i.arrayGroupSeparator?h.TokenType.ArrayConstRowSeparator:h.TokenType.FunctionArgumentSeparator:void 0}function W(t,n){for(var i,e,r,o,i=t.length-2;0<i;i--)e=t[i],A(r=t[i+1])&&D(e)&&R(e)&&(o=new a.CalcReference(n,e.ranges).getSpillRef())&&o.$gt&&(e.text+=r.text,e.endIndex=r.endIndex,e.ranges=o.$gt,t.splice(i+1,1));return t}function V(t){for(var n,i,e,r,o,u,s,r,n=[],i=0;i<t.length;i++)$((e=t[i]).type)&&(r=e.text.match(/^(\s*)(\S+)(\s*)$/))&&4===r.length&&(o=r[0],u=r[1],s=r[2],r=r[3],u||r)?(u&&(e.index+=u.length,e.text=e.text.substring(u.length),n.push(L(e.index,u))),n.push(e),r&&(e.endIndex-=r.length,e.text=e.text.substring(0,s.length),n.push(L(e.endIndex+1,r)))):n.push(e);return n}function $(t){return t===h.TokenType.FunctionCallStart||t===h.TokenType.FunctionCallEnd||t===h.TokenType.ArrayConstStart||t===h.TokenType.ArrayConstEnd}function L(t,n){return{type:h.TokenType.Whitespace,index:t,endIndex:t+n.length-1,text:n}}function q(){return a.Functions.findGlobalFunctions()}Object.defineProperty(t,"__esModule",{value:!0}),t.getGlobalFunctions=t.removeWhiteSpace=t.getIndentByPreviousText=t.getLineIndent=t.hasReferenceRanges=t.isReferenceToken=t.isAnchorOperatorToken=t.isNameToken=t.isWhitespaceToken=t.isPrefixOperatorToken=t.isInfixOperatorToken=t.isReferenceOrNameToken=t.isRightParenthesesToken=t.isLeftParenthesesToken=t.isNothingOperandToken=t.isFormulaStartToken=t.isSubExpressionEndToken=t.isSubExpressionStartToken=t.isFunctionCallEndToken=t.isFunctionCallStartToken=t.isFunctionCallToken=t.isFunctionArgumentSeparator=t.getLocalSymbol=t.includeToken=t.isInToken=t.getTokenByPos=t.getActiveParameterInSignatureTip=t.getActiveParameterInParameterResources=t.getSignatureStatus=t.getCultureInfo=t.parseToTokens=t.unparse=t.parse=void 0,a=n("CalcEngine"),u=n("Core"),f=n("SheetsCalc"),h=n("./dist/plugins/formulaPanel/editor/interface.js"),c=n("./dist/plugins/formulaPanel/editor/common/util.js"),t.parse=i,t.unparse=e,t.parseToTokens=r,t.getCultureInfo=l,t.getSignatureStatus=o,t.getActiveParameterInParameterResources=s,t.getActiveParameterInSignatureTip=v,t.getTokenByPos=d,t.isInToken=y,t.includeToken=m,t.getLocalSymbol=p,t.isFunctionArgumentSeparator=k,t.isFunctionCallToken=g,t.isFunctionCallStartToken=w,t.isFunctionCallEndToken=b,t.isSubExpressionStartToken=M,t.isSubExpressionEndToken=x,t.isFormulaStartToken=S,t.isNothingOperandToken=C,t.isLeftParenthesesToken=j,t.isRightParenthesesToken=P,t.isReferenceOrNameToken=O,t.isInfixOperatorToken=_,t.isPrefixOperatorToken=F,t.isWhitespaceToken=N,t.isNameToken=E,t.isAnchorOperatorToken=A,t.isReferenceToken=D,t.hasReferenceRanges=R,t.getLineIndent=I,t.getIndentByPreviousText=U,t.removeWhiteSpace=T,t.getGlobalFunctions=q},"./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js":function(L,t,n){var i,r,e,o,u,s,a,f,h,c;function l(t){return t.field(o.tokenField)}function v(t){return t.doc.toJSON().join("\n")}function d(t){return t.field(o.providerField).getFunctions()}function y(t,n){return(0,u.findFunction)(d(t),n)}function m(t){return d(t).map(u.convertToFunctionResource)}function p(t,n){return(0,u.findFunctionResource)(m(t),n)}function k(t){return t.field(o.customNamesField)}function g(t,n){return n=n.toUpperCase(),k(t).find(function(t){return t.getName().toUpperCase()===n})}function w(t){var n,t,t,n,t=t.field(o.themeField).rules.find(function(t){return t.token===e.SyntaxHighlightingTokenType.reference}),t=t?t.color:"black";return Array.isArray(t)?t:[t]}function b(t,n,i){return t.find(function(t){return(0,s.isInToken)(t,n,!0,!0)&&M(t,i)})}function M(t,n){var t=C(t.text,n);return t&&t.type===r.ExpressionType.reference}function x(t){var n,i,t,n,n=t.field(o.calcServiceField),i=t.field(o.calcSourceField),t=t.field(o.activeCellField),n=n.getParserContext(i);return n.row=t.row,n.column=t.col,n}function S(t,n){var i,e,r,e;return t.field(o.isFormulaField)?(i=t.field(o.calcSourceField),r=(e=t.field(o.activeCellField)).row,e=e.col,(0,s.parseToTokens)(n,i,r,e,x(t))):[]}function C(t,n,i){void 0===i&&(i=!1);var n=x(n);return(0,s.parse)(t,new r.Parser,n,!i)}function j(t,n){var n=x(n);return(0,s.unparse)(t,new r.Parser,n)}function P(t){return t.field(o.optionsField)}function O(t){var t=P(t);return c(t.tabSize)?h.DEFAULT_TAB_SIZE:t.tabSize}function E(t){var t=P(t);return c(t.formatWidthLimit)?h.DEFAULT_FORMAT_WIDTH_LIMIT:t.formatWidthLimit}function A(t){return u.WHITESPACE.repeat(O(t))}function D(t){var t=t.field(o.calcSourceField).Mf;if(t)return(0,a.Kde)(t.parent)||t}function R(t){return t.selection.main}function I(t){return t.field(o.providerField).getStructReferences()}function T(t,n,i){var e,t,n,i;return n===i||!!((0,f.kf)(n)&&(0,f.kf)(i)&&(e=new r.Parser,t=x(t),n=(0,s.unparse)((0,s.parse)(n,e,t,!1,!1),e,t),i=(0,s.unparse)((0,s.parse)(i,e,t,!1,!1),e,t),n)&&i&&n===i)}Object.defineProperty(t,"__esModule",{value:!0}),t.isSameFormula=t.getStructReferencesByState=t.getSelection=t.getActiveSheetByState=t.getOneIndentSpaceByState=t.getFormatWidthLimitByState=t.getTabSizeByState=t.getOptionsByState=t.unparseToText=t.parseToExpressionTree=t.parseToTokens=t.getParseContextByState=t.isValidReferenceToken=t.getValidReferenceTokenByPos=t.getReferenceTokenColors=t.getCustomNameByState=t.getCustomNamesByState=t.getFunctionResourceByState=t.getFunctionResourcesByState=t.getFunctionByState=t.getFunctionsByState=t.getTextByState=t.getTokensByState=void 0,i=n("Common"),r=n("CalcEngine"),e=n("./dist/plugins/formulaPanel/editor/interface.js"),o=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),u=n("./dist/plugins/formulaPanel/editor/common/util.js"),s=n("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),a=n("./dist/plugins/formulaPanel/editor/common/spreadUtil.js"),f=n("Core"),h=n("./dist/plugins/formulaPanel/editor/common/const.js"),c=i.Common.lt.ht,t.getTokensByState=l,t.getTextByState=v,t.getFunctionsByState=d,t.getFunctionByState=y,t.getFunctionResourcesByState=m,t.getFunctionResourceByState=p,t.getCustomNamesByState=k,t.getCustomNameByState=g,t.getReferenceTokenColors=w,t.getValidReferenceTokenByPos=b,t.isValidReferenceToken=M,t.getParseContextByState=x,t.parseToTokens=S,t.parseToExpressionTree=C,t.unparseToText=j,t.getOptionsByState=P,t.getTabSizeByState=O,t.getFormatWidthLimitByState=E,t.getOneIndentSpaceByState=A,t.getActiveSheetByState=D,t.getSelection=R,t.getStructReferencesByState=I,t.isSameFormula=T},"./dist/plugins/formulaPanel/editor/common/const.js":function(t,n,i){var e,r,o,i;function u(){var t=new e.CalcService;return t.addResolver(new r.SheetReferenceResolver),t.addResolver(new r.StructureReferenceResolver),t}Object.defineProperty(n,"__esModule",{value:!0}),n.defaultTheme=n.defaultSyntaxHighlighRules=n.DEFAULT_ACTIVE_CELL_INFO=n.DEFAULT_FORMULA_EDITOR_OPTIONS=n.defaultCalcSource=n.defaultCalcService=n.DEFAULT_PROVIDER=n.DEFAULT_FORMAT_WIDTH_LIMIT=n.DEFAULT_TAB_SIZE=void 0,e=i("CalcEngine"),r=i("SheetsCalc"),o=i("./dist/plugins/formulaPanel/editor/interface.js"),i=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n.DEFAULT_TAB_SIZE=4,n.DEFAULT_FORMAT_WIDTH_LIMIT="auto",n.DEFAULT_PROVIDER={getStructReferences:function(){return[]},getFunctions:i.getGlobalFunctions},n.defaultCalcService=u(),n.defaultCalcSource=new e.CalcSource(n.defaultCalcService),n.DEFAULT_FORMULA_EDITOR_OPTIONS={formatWidthLimit:n.DEFAULT_FORMAT_WIDTH_LIMIT,tabSize:n.DEFAULT_TAB_SIZE},n.DEFAULT_ACTIVE_CELL_INFO={row:0,col:0},n.defaultSyntaxHighlighRules=[{token:o.SyntaxHighlightingTokenType.stringConst,color:"#CC1C1C"},{token:o.SyntaxHighlightingTokenType.errorConst,color:"#CC1C1C"},{token:o.SyntaxHighlightingTokenType.numberConst,color:"#088000"},{token:o.SyntaxHighlightingTokenType.booleanConst,color:"#088000"},{token:o.SyntaxHighlightingTokenType.function,color:"#1C1CFF"},{token:o.SyntaxHighlightingTokenType.argumentSeparator,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.operatorPrefix,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.operatorInfix,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.operatorPostfix,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.reference,color:["#0000ff","#008000","#9900cc","#800000","#00cc33","#cc6600","#cc0099"]}],n.defaultTheme={rules:n.defaultSyntaxHighlighRules}},"./dist/plugins/formulaPanel/editor/common/formatter.js":function(t,n,i){var r,v,o,d,y,m;function e(t,n){var i,e,t,e,i=new v.Parser,e=n.parseContext,t=(0,o.parse)(t,i,e,!1,!1);if(t)return e=r(r({parser:i,oneIndentTab:d.WHITESPACE.repeat(n.tabSize)},n),(0,o.getCultureInfo)()),d.EQUAL+p(t,0,e,d.EQUAL)}function p(t,n,i,e,r,o){var u,u,s;return void 0===e&&(e=""),void 0===r&&(r=""),void 0===o&&(o=!0),t?(u=h(t,i),S(u=x(n,i,o)+u,i,e,r)&&((s=t.type)===v.ExpressionType.operator?u=a(t,n,i,e,r,o):s===v.ExpressionType.function?u=f(t,n,i,e,r,o):s===v.ExpressionType.parentheses?u=w(t,n,i,o):s===v.ExpressionType.array&&(u=k(t,n,i,o))),u):""}function h(t,n){var i,e;return t?(i=t.type)===v.ExpressionType.operator?u(t,n):i===v.ExpressionType.function?l(t,n):i===v.ExpressionType.parentheses?d.LEFT_PARENTHESES+h(t.value,n)+d.RIGHT_PARENTHESES:(i===v.ExpressionType.array?g:b)(t,n):""}function a(t,n,i,e,r,o){var u,s,u,a,o,f,u=t.operatorType,s=E(u),u=P(u)?x(n,i,o)+s+p(t.value,n,i,e,r,!1):2===u?p(t.value,n,i,e,s+r,o)+s:18===u?c(t,n,i,o):A(u)?(o=e+(a=p(t.value,n,i,e,d.WHITESPACE+s+m+r))+d.WHITESPACE+s,S(f=h(t.value2,i),i,o+d.WHITESPACE,r)?(f=p(t.value2,n+1,i,o+m,r),a+d.WHITESPACE+s+m+f):a+d.WHITESPACE+s+d.WHITESPACE+f):(a=p(t.value,n,i,e,r))+s+(f=p(t.value2,n,i,e+a+s,r,!1));return u}function u(t,n){var i,e,t,r,o,i=t.operatorType,e=E(i),t=P(i)?e+h(t.value,n):2===i?h(t.value,n)+e:(r=h(t.value,n),o=h(t.value2,n),18===i?s(t,n):A(i)?r+d.WHITESPACE+e+d.WHITESPACE+o:r+e+o);return t}function c(t,n,i,e){return x(n,i,e)+b(t,i)}function s(t,n){return b(t,n)}function f(t,n,i,e,r,o){var u,s,a,f,h,c,l,u=x(n,i,o),s=(0,v.isFunction)(t.function)&&t.function.name||t.functionName;if(s===y)return p(t.arguments[0],n,i,e,"#"+r,o)+"#";if("@"===s)return u+"@"+p(t.arguments[0],n,i,e+u+"@",r,!1);if(a=!s&&t.function instanceof v.Expression?p(t.function,n,i,e,r,o)+d.LEFT_PARENTHESES:u+s+d.LEFT_PARENTHESES,0===(h=(f=t.arguments||[]).length))return a+d.RIGHT_PARENTHESES;for(a+=m,c=0;c<h;c++)a+=p(l=f[c],n+1,i),c!==h-1&&(a+=i.listSeparator),a+=m;return a+x(n,i)+d.RIGHT_PARENTHESES}function l(t,n){var i,e,r,o,u,s,i=(0,v.isFunction)(t.function)&&t.function.name||t.functionName;if(i===y)return h(t.arguments[0],n)+"#";if("@"===i)return"@"+h(t.arguments[0],n);for(e=!i&&t.function instanceof v.Expression?h(t.function,n)+d.LEFT_PARENTHESES:D(i)+d.LEFT_PARENTHESES,o=(r=t.arguments||[]).length,u=0;u<o;u++)e+=h(s=r[u],n),u!==o-1&&(e+=n.listSeparator+d.WHITESPACE);return e+d.RIGHT_PARENTHESES}function k(t,n,i,e){for(var r,o,u,t,s,a,f,h,r=t.value,o=r.getRowCount(),u=r.getColumnCount(),t=x(n,i,e),s=x(n+1,i),a=t+d.LEFT_CURLY_BRACKETS+m,f=0;f<o;f++){for(a+=s,h=0;h<u;h++)a+=M(r.getValue(f,h),i),h!==u-1&&(a+=i.arrayListSeparator+d.WHITESPACE);f!==o-1&&(a+=i.arrayGroupSeparator),a+=m}return a+x(n,i)+d.RIGHT_CURLY_BRACKETS}function g(t,n){for(var i,e,r,o,u,s,i=t.value,e=i.getRowCount(),r=i.getColumnCount(),o=d.LEFT_CURLY_BRACKETS,u=0;u<e;u++){for(s=0;s<r;s++)o+=M(i.getValue(u,s),n),s!==r-1&&(o+=n.arrayListSeparator+d.WHITESPACE);u!==e-1&&(o+=n.arrayGroupSeparator+d.WHITESPACE)}return o+d.RIGHT_CURLY_BRACKETS}function w(t,n,i,e){var t,r,t=p(t.value,n+1,i),r;return x(n,i,e)+d.LEFT_PARENTHESES+m+t+m+x(n,i)+d.RIGHT_PARENTHESES}function b(t,n){var i=[];return n.parser.unparse(n.parseContext,t,i),i.join("")}function M(t,n){var i,i;return"string"==typeof t?i=v.ExpressionType.string:"boolean"==typeof t?i=v.ExpressionType.boolean:"number"==typeof t&&(i=v.ExpressionType.number),void 0===i?t.toString():((i=new v.Expression(i)).value=t,b(i,n))}function x(t,n,i){return(i=void 0===i?!0:i)?n.oneIndentTab.repeat(t):""}function S(t,n,i,e){var i;return t.trim().length>n.widthLimit||(i=C(i)+t+j(e),n.measureTextFunc(i)>n.lineWidthLimit)}function C(t){var n=t.lastIndexOf(m);return-1===n?t:t.substring(n+1)}function j(t){var n=t.indexOf(m);return-1===n?t:t.substring(0,n)}function P(t){return 0===t||1===t}function O(t){return 2===t}function E(t){return v.Z9t[t]}function A(t){return 15!==t&&16!==t&&17!==t&&18!==t}function D(t){var n,n,n=(0,v.getMapping)()&&(0,v.getMapping)().builtInFunctionsMapping,n=n&&n[t];return t=n&&n.alias?n.alias:t}r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var n,i,e,r,i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},Object.defineProperty(n,"__esModule",{value:!0}),n.format=void 0,v=i("CalcEngine"),o=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),d=i("./dist/plugins/formulaPanel/editor/common/util.js"),y="ANCHORARRAY",m="\n",n.format=e},"./dist/plugins/formulaPanel/editor/common/spreadUtil.js":function(t,n,i){var e,r;function o(t){if(t)return(0,e.jf)(t)}function u(t){var i,n,e,i=(0,r.getGlobalFunctions)(),n=function(n){Object.keys(n).forEach(function(t){i.push(n[t])})};return t&&(n(t.Amt),(e=o(t))&&n(e.Amt),t.options.allowDynamicArray||(i=i.filter(function(t){return!t.isDynamicArrayFunction}))),i}Object.defineProperty(n,"__esModule",{value:!0}),n.getFunctionsByWorkbook=n.Kde=void 0,e=i("Core"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n.Kde=o,n.getFunctionsByWorkbook=u},"./dist/plugins/formulaPanel/editor/common/util.js":function(t,n,i){var u,e,i,e,r;function o(t){var n,n=(n=t.description())&&s(n);return{name:t.name,description:null==n?void 0:n.description,parameters:null==n?void 0:n.parameters}}function s(t){for(var n,i,e,r,o,n=[],i=t.parameters||[],e=0;e<i.length;e++)(o=2<(r=u({},i[e])).name.length&&r.name.startsWith("[")&&r.name.endsWith("]"))&&(r.optional=!0,r.name=r.name.substring(1,r.name.length-1)),r.repeatable&&(r.optional=!0),n.push(r);return u(u({},t),{parameters:n})}function a(t,n){return n=n.toUpperCase(),(t||[]).find(function(t){return t.name.toUpperCase()===n})}function f(t,n){return n=n.toUpperCase(),(t||[]).find(function(t){return t.name.toUpperCase()===n})}function h(t){return t&&0!==t.length?t.map(c).join(", "):""}function c(t){var n=t.name;return t.optional&&(n="["+n+"]"),n=t.repeatable?"..."+n:n}function l(t){var n=t.name;return t.repeatable&&(n+=", ..."),n=t.optional?"["+n+"]":n}function v(t){return"".concat(t.name,"(").concat(h(t.parameters),")")}function d(t){return"(".concat(r().FORMULA," ").concat(v(t))}function y(t){return t[t.length-1]}function m(t){return"gc-formula-editor-tooltip-help-function-"+t}function p(t,n){var e,i,r,o,u,s,e=document.createElement("p");for(e.className=m("title"),(i=function(t,n){var i=document.createElement("span");return i.className=n,i.textContent=t,e.appendChild(i),i})(t.name,(r=function(t){return m("title-"+t)})("function-name")),i("(",r("parentheses")),o=t.parameters||[],u=0;u<o.length;u++)s=r("parameter"),void 0!==n&&n===u&&(s+=" "+r("active-parameter")),i(l(o[u]),s),u!==o.length-1&&i(",",r("parameter-separator"));return i(")",r("parentheses")),e}function k(t){var n=document.createElement("p");return n.textContent=t,n.className=m("description"),n}u=this&&this.__assign||function(){return(u=Object.assign||function(t){for(var n,i,e,r,i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},Object.defineProperty(n,"__esModule",{value:!0}),n.createHelpFunctionDescriptionDom=n.createHelpFunctionTitleDom=n.lastItem=n.getFunctionHoverTitle=n.getFunctionSignatureString=n.getParameterString=n.getParameterListString=n.findFunctionResource=n.findFunction=n.normalizeFunctionDescription=n.convertToFunctionResource=n.END_OF_LINE=n.WHITESPACE=n.RIGHT_CURLY_BRACKETS=n.LEFT_CURLY_BRACKETS=n.RIGHT_PARENTHESES=n.LEFT_PARENTHESES=n.SEMICOLON=n.COMMA=n.FULL_STOP=n.EQUAL=void 0,e=i("Common"),i=i("./dist/plugins/formulaPanel/editor/editor.ns.js"),e=new e.Common.ResourceManager(i.SR,"formulaEditor"),r=e.getResource.bind(e),n.EQUAL="=",n.FULL_STOP=".",n.COMMA=",",n.SEMICOLON=";",n.LEFT_PARENTHESES="(",n.RIGHT_PARENTHESES=")",n.LEFT_CURLY_BRACKETS="{",n.RIGHT_CURLY_BRACKETS="}",n.WHITESPACE=" ",n.END_OF_LINE="\r\n",n.convertToFunctionResource=o,n.normalizeFunctionDescription=s,n.findFunction=a,n.findFunctionResource=f,n.getParameterListString=h,n.getParameterString=c,n.getFunctionSignatureString=v,n.getFunctionHoverTitle=d,n.lastItem=y,n.createHelpFunctionTitleDom=p,n.createHelpFunctionDescriptionDom=k},"./dist/plugins/formulaPanel/editor/editor.ns.js":function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SR=void 0;var i=i("./dist/plugins/formulaPanel/editor/editor.res.en.js");n.SR={en:i}},"./dist/plugins/formulaPanel/editor/editor.res.en.js":function(t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.FORMULA=n.INVALID_FORMULA=n.INVALID_EXPRESSION=n.DUPLICATE_IDENTIFIER=n.INVALID_IDENTIFIER_ARGUMENT=n.NO_MATCHED_ARGUMENTS=n.UNKNOWN_SHEET=n.UNKNOWN_NAME=n.MISS_LET_FUNCTION_BODY=n.MISS_RIGHT_PARENTHESES=n.NO_MATH_PARENTHESES=void 0,n.NO_MATH_PARENTHESES="No match parentheses",n.MISS_RIGHT_PARENTHESES="')' is expected.",n.MISS_LET_FUNCTION_BODY="Missing body of LET expression.",n.UNKNOWN_NAME="Unknown name",n.UNKNOWN_SHEET='Unknown sheet "$1"',n.NO_MATCHED_ARGUMENTS="Expected $1 arguments, but got $2",n.INVALID_IDENTIFIER_ARGUMENT="This argument must be an identifier to bind.",n.DUPLICATE_IDENTIFIER="Duplicate identifier $1",n.INVALID_EXPRESSION="Invalid EXPRESSION",n.INVALID_FORMULA="Invalid Formula",n.FORMULA="Formula"},"./dist/plugins/formulaPanel/editor/featureProvider/completion.js":function(t,n,i){var h,c,r,o,l,u,s,i;function a(n,t){var i,t,i,t,i=(0,r.getSignatureStatus)((0,o.getTokensByState)(t.state),t.pos);i&&(t=(0,o.getFunctionResourceByState)(t.state,i.functionName))&&(i=(0,r.getActiveParameterInSignatureTip)(i.activeParameter,t),t=t.parameters&&t.parameters[i])&&t.enum&&t.enum.forEach(function(t){n.push({label:t.value,detail:t.description,type:"enum",apply:t.value})})}function f(n,t){var i,t,e,i=t.state,t=t.pos,e;(0,r.getLocalSymbol)((0,o.getTokensByState)(i),t).forEach(function(t){n.push({label:t,type:"variable",apply:t})})}function v(n,t){var i;(0,o.getCustomNamesByState)(t.state).forEach(function(t){n.push({label:t.getName(),detail:t.getComment()||"",type:"constant",apply:t.getName()})})}function d(n,t){var i;(0,o.getFunctionResourcesByState)(t.state).forEach(function(t){n.push({label:t.name,detail:t.description,type:"function",apply:e})})}function e(t,n,e,r){var o,u,s,a,f,n,o=t.state,u=o.selection.main,s=e-u.from,a=r-u.from,f=n.label,n=o.changeByRange(function(t){var n,i,n=t.from+s,i=t.from+a;return t!==u&&e!==r&&o.sliceDoc(n,i)!==o.sliceDoc(e,r)?{range:t}:{changes:{from:n,to:r===u.from?t.to:i,insert:f+"()"},range:c.State.EditorSelection.cursor(n+f.length+1)}});t.dispatch(h(h({},n),{userEvent:"input.complete",effects:l.triggerSignatureTooltip.of(null)}))}function y(t){return(0,o.getStructReferencesByState)(t.state).map(p)}function m(t,n){var i,i,e,n,i=t.selection.main.head,i=n.text.substring(0,i-n.index);return i&&"["===i[i.length-1]&&(e=i.substring(0,i.length-1),n=(0,o.getStructReferencesByState)(t).find(function(t){return t.name===e}))?n.getColumns().map(p):[]}function p(t){return{label:t.name,detail:t.description,type:"variable"}}function k(t){var n,t,n=t.state.selection.main.head,t=(0,o.getTokensByState)(t.state);return(0,r.getTokenByPos)(t,n,!1,!0)}function g(t){var n,i,e,r,n;return!t.state.field(u.isFormulaField)||(i=k(t))&&i.type===s.TokenType.StringConst?null:(e=t.matchBefore(/\w*/),(r=[]).push.apply(r,m(t.state,i)),a(r,t),e&&e.from===e.to||(f(r,t),d(r,t),v(r,t),r.push.apply(r,y(t))),{from:e?e.from:t.pos,options:r})}h=this&&this.__assign||function(){return(h=Object.assign||function(t){for(var n,i,e,r,i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},Object.defineProperty(n,"__esModule",{value:!0}),n.autoCompletionExtensions=void 0,c=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),l=i("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),u=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),s=i("./dist/plugins/formulaPanel/editor/interface.js"),i=c.Autocomplete.autocompletion,n.autoCompletionExtensions=i({override:[g]})},"./dist/plugins/formulaPanel/editor/featureProvider/customField.js":function(t,n,i){var e,r,o,u,s,a,i;function f(t,o){return a.define({create:t,update:function(t,n){for(var i,e,r,i=0,e=n.effects;i<e.length;i++)if((r=e[i]).is(o))return r.value;return t}})}function h(t){return!!t.docChanged||t.effects.some(function(t){return t.is(n.setCalcServiceField)||t.is(n.setCalcSourceField)||t.is(n.setCustomNamesField)||t.is(n.setProviderField)||t.is(n.setActiveCellField)||t.is(n.rebuildFormulaEffect)})}Object.defineProperty(n,"__esModule",{value:!0}),n.needRebuildToken=n.customFields=n.isFormattedFormulaField=n.isFormulaField=n.themeField=n.setThemeField=n.optionsField=n.setOptionsField=n.tokenField=n.rebuildFormulaEffect=n.providerField=n.setProviderField=n.customNamesField=n.setCustomNamesField=n.activeCellField=n.setActiveCellField=n.calcSourceField=n.setCalcSourceField=n.calcServiceField=n.setCalcServiceField=void 0,e=i("Core"),r=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=i("./dist/plugins/formulaPanel/editor/common/const.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/formatter.js"),a=r.State.StateField,i=r.State.StateEffect,n.setCalcServiceField=i.define(),n.calcServiceField=f(function(){return u.defaultCalcService},n.setCalcServiceField),n.setCalcSourceField=i.define(),n.calcSourceField=f(function(){return u.defaultCalcSource},n.setCalcSourceField),n.setActiveCellField=i.define(),n.activeCellField=f(function(){return u.DEFAULT_ACTIVE_CELL_INFO},n.setActiveCellField),n.setCustomNamesField=i.define(),n.customNamesField=f(function(){return[]},n.setCustomNamesField),n.setProviderField=i.define(),n.providerField=f(function(){return u.DEFAULT_PROVIDER},n.setProviderField),n.rebuildFormulaEffect=i.define(),n.tokenField=a.define({create:function(t){return(0,o.parseToTokens)(t,(0,o.getTextByState)(t))},update:function(t,n){return h(n)?(0,o.parseToTokens)(n.state,(0,o.getTextByState)(n.state)):t}}),n.setOptionsField=i.define(),n.optionsField=f(function(){return u.DEFAULT_FORMULA_EDITOR_OPTIONS},n.setOptionsField),n.setThemeField=i.define(),n.themeField=f(function(){return u.defaultTheme},n.setThemeField),n.isFormulaField=a.define({create:function(t){return(0,e.kf)((0,o.getTextByState)(t))},update:function(t,n){return n.docChanged?(0,e.kf)((0,o.getTextByState)(n.state)):t}}),n.isFormattedFormulaField=a.define({create:function(){return!0},update:function(t,n){return n.docChanged?!!n.annotation(s.formatDocumentAnnotation):t}}),n.customFields=[n.optionsField,n.themeField,n.isFormulaField,n.isFormattedFormulaField,n.activeCellField,n.calcServiceField,n.calcSourceField,n.customNamesField,n.providerField,n.tokenField],n.needRebuildToken=h},"./dist/plugins/formulaPanel/editor/featureProvider/dbClickRangeSelector.js":function(t,n,i){var e,o,u,s,a;Object.defineProperty(n,"__esModule",{value:!0}),n.doubleClickSelectRangeExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),u=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),a=e.State.EditorSelection,n.doubleClickSelectRangeExtension=e.View.EditorView.mouseSelectionStyle.of(function(e,t){var n,i,r,n;return!e.state.field(s.isFormulaField)||2!==t.detail||0!==t.button||null===(i=e.posAtCoords(t))?null:(r=e.state.selection,{get:function(t,n,i){var t,t,t,t=e.posAtCoords(t);return null!==t&&(t=(0,o.getTokenByPos)((0,u.getTokensByState)(e.state),t))?(t=a.range(t.index,t.endIndex+1),i?r.addRange(t):a.create([t])):r},update:function(t){i=t.changes.mapPos(i),r=r.map(t.changes)}})})},"./dist/plugins/formulaPanel/editor/featureProvider/folding.js":function(t,n,i){var e,h;Object.defineProperty(n,"__esModule",{value:!0}),n.foldExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),h=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n.foldExtension=e.Language.foldService.of(function(t,n,i){for(var e,r,o,n,u,s,a,f,e=t.doc.lineAt(n),r=t.doc.lines,o=(0,h.getLineIndent)(e.text),n=n,u=i,s=e.number+1;s<r&&(a=t.doc.line(s),o<(f=(0,h.getLineIndent)(a.text)));s++)u=a.to;return t.doc.lineAt(n).number===t.doc.lineAt(u).number?null:{from:n=e.to,to:u}})},"./dist/plugins/formulaPanel/editor/featureProvider/formatter.js":function(t,a,n){var i,f,h,c,l,v,e;function d(t,n,i,e){var r,o,u,t,r=s(t),o=s(n),u=n.length,t=function(t,n){var i,e;for(t-=r[t],i=0;i<o.length;i++){if((e=i-o[i])===t&&!n){t=i;break}if(t<e){t=i-1;break}}return t<=u&&0<=t?t:0};return i===e?i=e=t(e,!1):(i=t(i,!0),e=t(e,!1)),[i,e]}function s(t){for(var n,i,e,r,n=function(t){return" "===t||"\n"===t},i=[0],e=1;e<=t.length;e++)r=i[e-1],i.push(r+(n(t[e-1])?1:0));return i}function y(t){var n,i,e,t,t,n,i,e=r(t.scrollDOM.getBoundingClientRect(),t.contentDOM.getBoundingClientRect()),t=t.contentDOM.querySelector(".cm-line");return t&&(t=window.getComputedStyle(t),e-=parseInt(t.paddingLeft,10)+parseInt(t.paddingRight,10)),e}function r(t,n){var i,e,t,i=Math.max(t.left,n.left),e,t=Math.min(t.right,n.right)-i;return 0<=t?t:0}function m(t){var n,t,i,e,n,t=window.getComputedStyle(t.contentDOM).font,i,e=document.createElement("canvas").getContext("2d");return e.font=t,function(t){return e.measureText(t).width}}Object.defineProperty(a,"__esModule",{value:!0}),a.formatDocumentCommand=a.formatDocumentAnnotation=void 0,i=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),f=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),h=n("./dist/plugins/formulaPanel/editor/common/formatter.js"),c=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),l=n("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),v=Number.MAX_SAFE_INTEGER,a.formatDocumentAnnotation=i.State.Annotation.define(),a.formatDocumentCommand=e=function(t){var n,i,e,r,o,u,s,i,e,r,o,n;return!!t.state.field(c.isFormulaField)&&(i=(0,f.getTabSizeByState)(t.state),e=(0,f.getFormatWidthLimitByState)(t.state),r=v,o=function(t){return 0},"auto"===e&&(r=y(t),e=v,o=m(t)),u=t.state.selection.main,i={absoluteReference:!1,parseContext:s=(0,f.getParseContextByState)(t.state),tabSize:i,widthLimit:e,lineWidthLimit:r,measureTextFunc:o},e=(0,f.getTextByState)(t.state),void 0!==(r=(0,h.format)(e,i)))&&(e!==r&&(o=d(e,r,u.from,u.to),t.dispatch({changes:{from:0,to:t.state.doc.length,insert:r},selection:{anchor:o[0],head:o[1]},annotations:[l.notTriggerSignatureTooltip.of(!0),a.formatDocumentAnnotation.of(!0)]})),!0)}},"./dist/plugins/formulaPanel/editor/featureProvider/hoverTooltips.js":function(t,n,i){var e,o,u,s,a;Object.defineProperty(n,"__esModule",{value:!0}),n.hoverTooltipExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),u=i("./dist/plugins/formulaPanel/editor/common/util.js"),s=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),a=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),n.hoverTooltipExtension=e.View.hoverTooltip(function(t,n){var i,e,e,n,r,i;return!t.state.field(a.isFormulaField)||(e=(0,s.getTokensByState)(t.state),!(e=(0,o.getTokenByPos)(e,n)))||(n=[],r=(0,s.getFunctionResourceByState)(t.state,e.text),(0,o.isFunctionCallToken)(e)&&r&&(n.push((0,u.getFunctionHoverTitle)(r)),r.description)&&n.push(r.description),0===n.length)?null:{pos:e.index,end:e.endIndex+1,above:!0,create:function(){var t=document.createElement("div");return t.className="gc-formula-editor-tooltip-help-function",t.appendChild((0,u.createHelpFunctionTitleDom)(r)),r.description&&t.appendChild((0,u.createHelpFunctionDescriptionDom)(r.description)),{dom:t}}}})},"./dist/plugins/formulaPanel/editor/featureProvider/indent.js":function(t,n,i){var e,r,o;Object.defineProperty(n,"__esModule",{value:!0}),n.indentExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),n.indentExtension=e.Language.indentService.of(function(t,n){var n;return!(n<=0)&&(n=t.lineAt(n-1))&&n.text?(0,r.getIndentByPreviousText)(n.text,(0,o.getTokensByState)(t.state)):0})},"./dist/plugins/formulaPanel/editor/featureProvider/lint.js":function(t,n,i){var e,r,o,s,h,c,a,u,f,i,l;function v(t,n){return l().NO_MATCHED_ARGUMENTS.replace("$1",t+"").replace("$2",n+"")}function d(t){return l().UNKNOWN_SHEET.replace("$1",t)}function y(t){return l().DUPLICATE_IDENTIFIER.replace("$1",t)}function m(t){var n,i,e,r,o,n=[],i;return t.field(f.isFormulaField)?(e=(0,a.getTextByState)(t),P(n,r=(0,a.getTokensByState)(t),t,e),A(n)||((o=(0,a.parseToExpressionTree)(e,t))?w(n,o,t):O(n,r,t,e),(0,a.parseToExpressionTree)(e,t,!0))||A(n)||p(n,0,e.length,l().INVALID_FORMULA),n):[]}function p(t,n,i,e,r){t.push({from:n,to:i,message:e,severity:r=void 0===r?"error":r})}function k(t,n,i,e){p(t,n.index,n.endIndex+1,i,e=void 0===e?"error":e)}function g(t,n,i,e){p(t,n.lit,n.ywt,i,e=void 0===e?"error":e)}function w(t,n,i){if(n){for(;n.type===s.ExpressionType.parentheses;){if(!n.value)return void g(t,n,l().INVALID_EXPRESSION);n=n.value}var e=n.type;e===s.ExpressionType.name?(0,a.getCustomNameByState)(i,n.value)||g(t,n,l().UNKNOWN_NAME,"warning"):e===s.ExpressionType.operator?(n.value&&w(t,n.value,i),n.value2&&w(t,n.value2,i)):e===s.ExpressionType.function?b(t,n,i):e===s.ExpressionType.reference&&j(t,n)}}function b(t,n,i){var e,r,o,u,e=n.functionName;if("LET"===e)M(t,n,i);else if("LAMBDA"===e)x(t,n,i);else for((0,s.isExpression)(n.function)?w(t,n.function,i):(r=(0,a.getFunctionByState)(i,e))?S(t,n,r):(0,a.getCustomNameByState)(i,e)||p(t,n.lit,n.lit+e.length,l().UNKNOWN_NAME,"warning"),o=n.arguments||[],u=0;u<o.length;u++)w(t,o[u],i)}function M(t,n,i){var e,r,o,u,s,e=n.lit,r=n.ywt,o=n.arguments||[];for(o.length<3&&p(t,e,r,v(3,o.length)),3<=o.length&&o.length%2==0&&p(t,e,r,l().MISS_LET_FUNCTION_BODY),u=[],s=0;s<o.length-1;s++)s%2==0?(C(t,o[s],u),u.push(o[s].value)):w(t,o[s],i);w(t,o[o.length-1],i)}function x(t,n,i){var e,r,o,u,s,e=n.lit,r=n.ywt,o=n.arguments||[];for(o.length<1&&p(t,e,r,v(1,o.length)),u=[],s=0;s<o.length-1;s++)C(t,o[s],u),u.push(o[s].value);w(t,o[o.length-1],i)}function S(t,n,i){var e,r,o,i,n,e=n.lit,r=n.ywt,o=i.minArgs||0,i=i.maxArgs!==u?i.maxArgs:Number.MAX_SAFE_INTEGER,n=n.arguments||[];n.length<o?p(t,e,r,v(o,n.length)):n.length>i&&p(t,e,r,v(i,n.length))}function C(t,n,i){var e,r,e=n.lit,r=n.ywt;!n||8!==n.type&&100!==n.type||-1<n.value.indexOf(".")?p(t,e,r,l().INVALID_IDENTIFIER_ARGUMENT):-1!==i.indexOf(n.value)&&p(t,e,r,y(n.value))}function j(t,n){var i,e,i=n.source,e=i&&i.getName();i instanceof s.ErrorSource&&e&&p(t,n.lit,n.lit+e.length,d(e),"warning")}function P(t,n,i,e){for(var r,o,u,s,a,r=[],o=function(t){return(0,h.isFunctionCallStartToken)(t)||(0,h.isSubExpressionStartToken)(t)||(0,h.isLeftParenthesesToken)(t)},u=function(t){return(0,h.isFunctionCallEndToken)(t)||(0,h.isSubExpressionEndToken)(t)||(0,h.isRightParenthesesToken)(t)},s=0;s<n.length;s++)o(a=n[s])?r.push(a):u(a)&&(0<r.length?r.pop():k(t,a,l().NO_MATH_PARENTHESES));0<r.length&&p(t,e.length,e.length,l().MISS_RIGHT_PARENTHESES)}function O(t,n,i,e){for(var r,o,u,s,a,f,f,r=[],o=[],u=[],s=0;s<n.length;s++)a=n[s],(0,h.isFunctionCallToken)(a)?(r.push({token:a}),u.push([])):(0,h.isSubExpressionStartToken)(a)?o.push({token:a}):(0,h.isFunctionCallEndToken)(a)?0===r.length?k(t,a,l().NO_MATH_PARENTHESES):(f=(0,c.lastItem)(r),r.pop(),u.pop(),f.hasError||(f=E(i,e,f.token,a),t.push.apply(t,f),A(f)&&(r.forEach(function(t){t.hasError=!0}),o.forEach(function(t){t.hasError=!0})))):(0,h.isSubExpressionEndToken)(a)?0===o.length?k(t,a,l().NO_MATH_PARENTHESES):o.pop():(0,h.isFunctionArgumentSeparator)(a)?0!==r.length&&(0,c.lastItem)(u).push(a):(0,h.isRightParenthesesToken)(a)&&k(t,a,l().NO_MATH_PARENTHESES);(0<r.length||0<o.length)&&p(t,e.length,e.length,l().MISS_RIGHT_PARENTHESES)}function E(t,n,i,e){var r,o,i,e,n,r=[],o=i.index,i=e.endIndex+1,e=n.substring(o,i),n=(0,a.parseToExpressionTree)(e,t);return n?(b(r,n,t),r.forEach(function(t){t.from+=o,t.to+=o}),(0,a.parseToExpressionTree)(e,t,!0)||A(r)||p(r,o,i,l().INVALID_EXPRESSION)):p(r,o,i,l().INVALID_EXPRESSION),r}function A(t){return t.some(function(t){return"error"===t.severity})}Object.defineProperty(n,"__esModule",{value:!0}),n.getDiagnostic=n.linterExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("Common"),o=i("./dist/plugins/formulaPanel/editor/editor.ns.js"),s=i("CalcEngine"),h=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),c=i("./dist/plugins/formulaPanel/editor/common/util.js"),a=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=void 0,f=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),i=new r.Common.ResourceManager(o.SR,"formulaEditor"),l=i.getResource.bind(i),n.linterExtension=e.Lint.linter(function(t){return m(t.state)},{needsRefresh:function(t){return t.transactions.some(f.needRebuildToken)}}),n.getDiagnostic=m},"./dist/plugins/formulaPanel/editor/featureProvider/readOnly.js":function(t,n,i){var e,r;function o(t,n){t.dispatch({effects:r.reconfigure(e.State.EditorState.readOnly.of(n))})}Object.defineProperty(n,"__esModule",{value:!0}),n.reconfigureReadOnly=n.readOnlyExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=new e.State.Compartment,n.readOnlyExtension=r.of(e.State.EditorState.readOnly.of(!1)),n.reconfigureReadOnly=o},"./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js":function(t,s,n){var i,o,u,a,f,n,e,r,h,c,n;function l(t){var n,n,i,t,e,r,n=t.selection.main;return n&&n.from===n.to&&(n=n.from,i=(0,o.getSignatureStatus)((0,u.getTokensByState)(t),n))&&(t=(0,u.getFunctionResourceByState)(t,i.functionName))?(r=(0,o.getActiveParameterInSignatureTip)(i.activeParameter,e=t),[{pos:n,above:!0,arrow:!0,create:function(){var t=document.createElement("div");return t.className="gc-formula-editor-tooltip-help-function",t.appendChild((0,f.createHelpFunctionTitleDom)(e,r)),e.description&&t.appendChild((0,f.createHelpFunctionDescriptionDom)(e.description)),{dom:t,overlap:!0}}}]):[]}Object.defineProperty(s,"__esModule",{value:!0}),s.signatureTooltipsExtensions=s.closeParameterHintsCommand=s.triggerParameterHintsCommand=s.hasParameterHints=s.notTriggerSignatureTooltip=s.closeSignatureTooltip=s.triggerSignatureTooltip=void 0,i=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=n("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),u=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),a=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),f=n("./dist/plugins/formulaPanel/editor/common/util.js"),n=i.State.StateField,s.triggerSignatureTooltip=i.State.StateEffect.define(),s.closeSignatureTooltip=i.State.StateEffect.define(),s.notTriggerSignatureTooltip=i.State.Annotation.define(),e=n.define({create:function(){return[]},update:function(t,n){var i,e,r,o,u,i;if(!n.state.field(a.isFormulaField))return[];if(e=t&&0<t.length,n.annotation(s.notTriggerSignatureTooltip)&&!e)return[];for(r=0,o=n.effects;r<o.length;r++){if((u=o[r]).is(s.closeSignatureTooltip))return[];if(u.is(s.triggerSignatureTooltip))return l(n.state)}return n.docChanged?l(n.state):e?n.selection?l(n.state):t:[]},provide:function(n){return i.View.showTooltip.computeN([n],function(t){return t.field(n)})}}),s.hasParameterHints=r=function(t){return 0<t.state.field(e).length},s.triggerParameterHintsCommand=h=function(t){return t.dispatch({effects:s.triggerSignatureTooltip.of(null)}),!0},s.closeParameterHintsCommand=c=function(t){return!!(0,s.hasParameterHints)(t)&&(t.dispatch({effects:s.closeSignatureTooltip.of(null)}),!0)},n=i.View.EditorView.updateListener.of(function(t){t.focusChanged&&!t.view.hasFocus&&(0,s.closeParameterHintsCommand)(t.view)}),s.signatureTooltipsExtensions=[e,n]},"./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js":function(t,e,n){var i,r,o,u,s,n,a;function f(t){return"gc-formula-editor-token_"+r.SyntaxHighlightingTokenType[t]}function h(t){var n;return t.field(u.isFormulaField)?a.of(l(t)):a.of([])}function c(t,n){var i={};return isNaN(n)||(i[e.TOKEN_INDEX_ATTRIBUTE_NAME]=n),{class:f(t),attributes:i}}function l(t){var n=(0,o.getTokensByState)(t);return v(n,t),n.map(function(t){var n=m(t);return i.View.Decoration.mark(c(n,t.colorIndex)).range(t.index,t.endIndex+1)})}function v(t,n){var i,e,i=[];t.forEach(function(n){var t;((0,s.isReferenceToken)(n)||(0,s.isNameToken)(n)&&(0,s.hasReferenceRanges)(n))&&(t=i.find(function(t){return d(t,n)}),n.colorIndex=t?t.colorIndex:y(i),i.push(n))}),e=(0,o.getReferenceTokenColors)(n).length,i.forEach(function(t){t.colorIndex=t.colorIndex%e})}function d(t,n){return(0,s.removeWhiteSpace)(t.text).toUpperCase()===(0,s.removeWhiteSpace)(n.text).toUpperCase()}function y(t){return t&&0!==t.length?Math.max.apply(Math,t.map(function(t){return t.colorIndex}))+1:0}function m(t){var n,i,n=t.type,i=r.SyntaxHighlightingTokenType.unknown;return n===r.TokenType.NumberConst?i=r.SyntaxHighlightingTokenType.numberConst:n===r.TokenType.StringConst?i=r.SyntaxHighlightingTokenType.stringConst:n===r.TokenType.LogicalConst?i=r.SyntaxHighlightingTokenType.booleanConst:n===r.TokenType.ErrorConst?i=r.SyntaxHighlightingTokenType.errorConst:n===r.TokenType.CellReference?i=r.SyntaxHighlightingTokenType.reference:n===r.TokenType.Name?i=(0,s.hasReferenceRanges)(t)?r.SyntaxHighlightingTokenType.reference:r.SyntaxHighlightingTokenType.name:n===r.TokenType.OperatorPrefix?i=r.SyntaxHighlightingTokenType.operatorPrefix:n===r.TokenType.OperatorInfix?i=r.SyntaxHighlightingTokenType.operatorInfix:n===r.TokenType.OperatorPostfix?i=r.SyntaxHighlightingTokenType.operatorPostfix:n===r.TokenType.Whitespace?i=r.SyntaxHighlightingTokenType.whitespace:n===r.TokenType.FunctionName||n===r.TokenType.FunctionCallStart||n===r.TokenType.FunctionCallEnd?i=r.SyntaxHighlightingTokenType.function:n===r.TokenType.FunctionArgumentSeparator||n===r.TokenType.ArrayConstRowSeparator||n===r.TokenType.ArrayConstItemSeparator?i=r.SyntaxHighlightingTokenType.argumentSeparator:n!==r.TokenType.SubExpressionStart&&n!==r.TokenType.SubExpressionEnd||(i=r.SyntaxHighlightingTokenType.subExpression),i}Object.defineProperty(e,"__esModule",{value:!0}),e.markReferenceTokenColorIndex=e.syntaxHighlightingTokenClassName=e.syntaxHighlightingField=e.TOKEN_INDEX_ATTRIBUTE_NAME=void 0,i=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=n("./dist/plugins/formulaPanel/editor/interface.js"),o=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),s=n("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n=i.State.StateField,a=i.State.RangeSet,e.TOKEN_INDEX_ATTRIBUTE_NAME="data-token-index",e.syntaxHighlightingField=n.define({create:h,update:function(t,n){return h(n.state)},provide:function(t){return i.View.EditorView.decorations.from(t)}}),e.syntaxHighlightingTokenClassName=f,e.markReferenceTokenColorIndex=v},"./dist/plugins/formulaPanel/editor/featureProvider/tab.js":function(t,n,i){var e,r;Object.defineProperty(n,"__esModule",{value:!0}),n.insertTab=void 0,e=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),n.insertTab=r=function(t){var n;return!t.state.readOnly&&!t.state.selection.ranges.some(function(t){return!t.empty})&&(n=(0,e.getOneIndentSpaceByState)(t.state),t.dispatch(t.state.update(t.state.replaceSelection(n),{scrollIntoView:!0,userEvent:"input"})),!0)}},"./dist/plugins/formulaPanel/editor/featureProvider/theme.js":function(t,n,i){var e,r,o,u,s;function a(t){var n=t.autocompletionStyle,t=t.errorStyle;return u.theme({"& .cm-tooltip-autocomplete":{color:n.color,font:n.font,background:n.backgroundColor,border:n.border,"margin-left":"1em"},"& .cm-tooltip-autocomplete ul li":{padding:"5px"},"& .cm-tooltip-autocomplete ul li .cm-completionIcon-function":{color:n.function_icon.color,font:n.function_icon.font},"& .cm-tooltip-autocomplete ul li .cm-completionLabel":{color:n.function_name.color,font:n.function_name.font},"& .cm-tooltip-autocomplete ul li .cm-completionDetail":{color:n.function_name.color,font:n.function_name.font},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionIcon-function":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionLabel":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionDetail":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected]":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip .cm-tooltip-lint .cm-diagnostic ":{color:t.color,font:t.font,background:t.backgroundColor}})}function f(t){var e,r,e={},r=function(t,n,i){var t,i,t=(0,o.syntaxHighlightingTokenClassName)(t),i=isNaN(i)?"":"[".concat(o.TOKEN_INDEX_ATTRIBUTE_NAME,'="').concat(i,'"]');e["& .".concat(t).concat(i)]=n};return t.forEach(function(i){Array.isArray(i.color)?(r(i.token,{color:i.color[0]}),i.color.forEach(function(t,n){r(i.token,{color:t},n)})):r(i.token,{color:i.color})}),u.theme(e)}function h(t,n){return u.theme({"& .cm-scroller":{"background-color":t.backgroundColor,color:t.color,font:t.font},".cm-cursor, .cm-dropCursor":{borderLeftColor:t.caretColor},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:t.selectionBackColor},"& .cm-activeLine":{"background-color":t.activeLineBackColor},"& .cm-gutters":{"background-color":n.backgroundColor,color:n.color,font:n.font,"user-select":"none"},"& .cm-lineNumbers ":{width:"30px"},'& .cm-foldGutter span[title="Fold line"] ':{"padding-bottom":"8px"},"& .cm-gutterElement":{display:"flex","align-items":"center","justify-content":"flex-end"},"& .cm-activeLineGutter":{"background-color":t.activeLineBackColor},"& .cm-tooltip":{border:"none"}})}function c(t){var n,i,t,e,n=t.rules,i=t.editorContentStyle,t=t.editorGuttersStyle,e=[s];return i&&t&&(e=e.concat([h(i,t),a(i)])),e=n?e.concat(f(n)):e}Object.defineProperty(n,"__esModule",{value:!0}),n.themeExtension=n.createThemeExtension=n.themeCompartment=n.createSyntaxHighlightingTheme=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/const.js"),o=i("./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js"),u=e.View.EditorView,s=u.theme({"&":{height:"100%"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-line":{"line-height":1.35}}),n.createSyntaxHighlightingTheme=f,n.themeCompartment=new e.State.Compartment,n.createThemeExtension=c,n.themeExtension=n.themeCompartment.of(c(r.defaultTheme))},"./dist/plugins/formulaPanel/editor/featureProvider/toggleAbsoluteRelativeReferences.js":function(t,n,i){var u,e,p,r,o;function k(t,n,i,e,r,o){var t=(0,p.parseToExpressionTree)(t,n);return t.isFullColumn||t.isFullRow?(0,u.lmt)(t,i,e,!0,!0):t.hmt()?(0,u.dmt)(t,i,e):(0,u.lmt)(t,i,e,r,o),(0,p.unparseToText)(t,n)}function g(t,n,i){return(0,e.includeToken)(t,n,i)||(0,e.isInToken)(t,n,!0,!0)||(0,e.isInToken)(t,i,!0,!0)}Object.defineProperty(n,"__esModule",{value:!0}),n.toggleAbsoluteRelativeReferencesCommand=void 0,u=i("FormulaTextBox"),e=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),p=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),r=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),n.toggleAbsoluteRelativeReferencesCommand=o=function(s){var t,a,n,i,f,h,i,c,l,v,d,y,m,e,t;return!!s.state.field(r.isFormulaField)&&(a=s.state,n=(0,p.getTokensByState)(a),i=a.selection.main,f=i.from,h=i.to,i=a.field(r.activeCellField),c=i.row,l=i.col,v=!1,d=0,y=f,m=h,(e=n.filter(function(t){return g(t,f,h)&&(0,p.isValidReferenceToken)(t,a)})).forEach(function(t){var n,i,e,r,o,o,u,n=t.text.indexOf(":"),i=-1!==n,e=!i||f<=t.index+n,r=!i||h>t.index+n,o=k(t.text,a,c,l,e,r);o&&(s.dispatch({changes:{from:t.index+d,to:t.endIndex+1+d,insert:o}}),d+=o.length-t.text.length,o=t.index,u=t.endIndex+1,!i||e&&r||(e?u=t.index+n:r&&(o=t.index+n+1)),y=Math.min(y,o),m=Math.max(m,u),s.dispatch({selection:{anchor:y,head:m+d}}),v=!0)}),v)}},"./dist/plugins/formulaPanel/editor/formulaEditor-action.js":function(t,r,n){var u,o,s,i,e,a,f,h,c,l,v,d,y,m,n,p;function k(t,n){return{canUndo:n=void 0===n?!1:n,execute:t}}function g(n,t){return k(function(t){return n(t.li.getView())},t=void 0===t?!1:t)}function w(t){var n=u.mt.Qf(),i=!n,n=n;t.register(y,r.Commands[y],27),t.register(h,r.Commands[h],32,i,!0,!1,n),t.register(c,r.Commands[c],27),t.register(l,r.Commands[l],115),t.register(v,r.Commands[v],70,!1,!0,!0),t.register(d,r.Commands[d],83,i,!1,!1,n)}Object.defineProperty(r,"__esModule",{value:!0}),r.registerDefaultCommands=r.Commands=r.executeCommitContextToCellCommand=void 0,u=n("Core"),o=n("FormulaTextBox"),s=n("./dist/plugins/formulaPanel/editor/common/spreadUtil.js"),i=n("./dist/plugins/formulaPanel/editor/featureProvider/formatter.js"),e=n("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),a=n("./dist/plugins/formulaPanel/editor/featureProvider/toggleAbsoluteRelativeReferences.js"),f=n("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js"),h="showHints",c="closeHints",l="toggleAbsoluteRelativeReferences",v="formatDocument",d="commitContentToActiveCell",y="exitEdit",r.executeCommitContextToCellCommand=m=function(t,n,i,e,r){var e,e,o,o;void 0===r&&(r=u.SheetArea.viewport),e=0<e.length?e:null,e={cmd:"editCell",sheetName:t.name(),row:n,col:i,sheetArea:r,newValue:e},t.dataRanges&&(o=t.dataRanges.getByPosition(n,i))&&(o=o.convertContext({sheet:t,row:n,col:i,sheetArea:r}))&&o.sheet!==t&&(e.sheetName=o.sheet.name(),e.row=o.row,e.col=o.col),t.Qy().execute(e)},n=k(function(t){var n,i,i,t,e,n=(0,s.Kde)(t.Vv);return!!n&&(i=o.Hde.Ude(),(0,f.isFormulaEditorReferencedRangesAcrossSheetContext)(i)?i.zde(n):(i=t.text(),t=n.getActiveRowIndex(),e=n.getActiveColumnIndex(),(0,r.executeCommitContextToCellCommand)(n,t,e,i)),!0)}),p=k(function(t){var n,i,n=t.workbook();return!(!t.Qde()||!n||((i=t.li.getView()).contentDOM.blur(),(0,f.closeFormulaReferencedRanges)(i.state),n.focus(!1),n.focus(),t.Xde(),0))}),r.Commands={},r.Commands[h]=g(e.triggerParameterHintsCommand),r.Commands[c]=g(e.closeParameterHintsCommand),r.Commands[v]=g(i.formatDocumentCommand),r.Commands[l]=g(a.toggleAbsoluteRelativeReferencesCommand),r.Commands[d]=n,r.Commands[y]=p,r.registerDefaultCommands=w},"./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js":function(t,n,i){var e,r,s,o,i,u;function a(t){t.Dn.Fde()}function f(t){var t=t.Bde;return!(!(0,o.isFormulaEditorReferencedRangesContext)(t)||!t.zQt.hasFocus)}function h(t,n,i){var e,r,r,o,o,u,e="";if(t)if(r=(r=t.parent)&&r.options,(o=t.getFormulaInformation(n,i,3))&&o.hasFormula&&!s.mt.HRe(n,i,t)){if(e="="+o.formulaWithCulture,o.isDynamicArray)return"";o.isArrayFormula&&(e="{"+e+"}")}else o=t.getActualStyle(n,i),e="string"==typeof(u=t.getValue(n,i))&&(o.quotePrefix||1<u.length&&"="===u[0]&&r&&r.allowUserEditFormula&&!r.allowInvalidFormula)?"'"+u:s.mt.mi(o,u,t,{sheet:t,row:n,col:i,sheetArea:3})||"";return e}Object.defineProperty(n,"__esModule",{value:!0}),n.getEditText=n.paintFormulaReferencedRanges=void 0,e=i("Common"),r=i("./dist/plugins/formulaPanel/editor/editor.ns.js"),s=i("Core"),o=i("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js"),n.paintFormulaReferencedRanges=a,i=new e.Common.ResourceManager(r.SR,"formulaEditor"),u=i.getResource.bind(i),s.Worksheet.ch("formulaEditor",{preProcessKeyDown:function(t){f(this)&&(t.r=!0)},processCompositionStart:function(t){f(this)&&(t.r=!0)}}),n.getEditText=h,s.Workbook.ch("formulaEditor",{onCultureChanged:function(){u()}})},"./dist/plugins/formulaPanel/editor/formulaEditor.js":function(t,e,n){var r,u,o,s,a,f,h,c,l,i,v,d,y,m,p,k,g;function w(t,n){"string"==typeof t&&(t=document.getElementById(t));var i=this;i.Wc=t,i.li=new o.FormulaEditorCore(t,k),i.li.initTheme(),i.Qy=new r.Commands.CommandManager(i),i.Zde=i.Zde.bind(i),i.spe=i.spe.bind(i),i.Yde=i.Yde.bind(i),i.$ve=i.$ve.bind(i),i.ove=i.ove.bind(i),i.tve=i.tve.bind(i),i.Rve=i.Rve.bind(i),i.hme=i.hme.bind(i),i.qve=i.qve.bind(i),i.yme=i.yme.bind(i),i.kme=i.kme.bind(i),i.LEt=y(s.DEFAULT_FORMULA_EDITOR_OPTIONS,i.kme),i.Zp(n),i.wme(),t.addEventListener("keydown",i.Zde),(0,a.registerDefaultCommands)(i.Qy),(0,u.GC$)(t).data(e.CONST_FORMULA_EDITOR,i)}function b(t,n,i){var n;return!(!x(t,n,i)&&!S(t,n,i)&&M(t,n,i)&&(u.Worksheet.et(t,"formulaPanelCheckIsReadOnly",n={r:d}),!n.r))}function M(t,n,i){var t=t.getActualStyle(n,i);return!t||!1!==t.allowEditInCell}function x(t,n,i){return t.isActualProtected()&&!1!==t.l0(n,i,"locked")}function S(t,n,i){var e,t,e=t.getCellType(n,i);return!(!e||(t={sheet:t,sheetName:t.name(),sheetArea:u.SheetArea.viewport,row:n,col:i},!(t=e.lfe(t,v)).readonly))}Object.defineProperty(e,"__esModule",{value:!0}),e.FormulaEditor=e.CONST_FORMULA_EDITOR=void 0,r=n("Common"),u=n("Core"),o=n("./dist/plugins/formulaPanel/editor/formulaEditorCore.js"),s=n("./dist/plugins/formulaPanel/editor/common/const.js"),a=n("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),f=n("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesExtension.js"),h=n("./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js"),c=n("./dist/plugins/formulaPanel/editor/common/spreadUtil.js"),l=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),i=n("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/structReferences.js"),e.CONST_FORMULA_EDITOR="formula-editor",v=void 0,d=null,y=u.mt.b0,m=u.GC$.extend,p=u.GC$.each,k=[f.formulaReferencedRangesExtension],Object.defineProperty(w.prototype,"options",{get:function(){return this.LEt},set:function(t){if(t&&"object"==typeof t)for(var n in t)t.hasOwnProperty(n)&&(this.LEt[n]=t[n])},enumerable:!1,configurable:!0}),w.prototype.text=function(t){if(0===arguments.length)return this.li.getText();this.li.setText(t+"")},w.prototype.workbook=function(){return this.Vv},w.prototype.attach=function(t){var n=this;n.Vv!==t&&(n.detach(),n.Vv=t,n._6(),n.Vv.D3(u.Events.EnterCellInternal,n.spe),n.Vv.D3(u.Events.CellChanged,n.Yde),n.Vv.D3(u.Events.RangeChangedInternal,n.$ve),n.Vv.D3(u.Events.RangeFiltered,n.yme),n.Vv.D3(u.Events.RangeFilterCleared,n.yme),n.Vv.D3(u.Events.ActiveSheetChangingInternal,n.ove),n.Vv.D3(u.Events.ActiveSheetChangedInternal,n.tve),n.Vv.D3(u.Events.SheetOptionsChangedInternal,n.Rve),n.Vv.D3(u.Events.WorkbookOptionsChangedInternal,n.hme),n.Vv.D3(u.Events.CustomNameChangedInternal,n.qve))},w.prototype.detach=function(){var t=this,n=t.Vv;n&&(n._3(u.Events.EnterCellInternal,t.spe),n._3(u.Events.CellChanged,t.Yde),n._3(u.Events.RangeChangedInternal,t.$ve),n._3(u.Events.RangeFiltered,t.yme),n._3(u.Events.RangeFilterCleared,t.yme),n._3(u.Events.ActiveSheetChangingInternal,t.ove),n._3(u.Events.ActiveSheetChangedInternal,t.tve),n._3(u.Events.SheetOptionsChangedInternal,t.Rve),n._3(u.Events.WorkbookOptionsChangedInternal,t.hme),n._3(u.Events.CustomNameChangedInternal,t.qve),t.Vv=v,t._6())},w.prototype.format=function(){this.li.format()},w.prototype.commandManager=function(){return this.Qy},w.prototype.destroy=function(){var t=this;t.detach(),t.li.destroy(),t.Wc.removeEventListener("keydown",t.Zde),(0,u.GC$)(t.Wc).data(e.CONST_FORMULA_EDITOR,d)},w.prototype.refresh=function(){this.li.initTheme(),this._6()},w.prototype.getActiveCellInfo=function(){var t,n,t,i,t=this.li.getActiveCellInfo(),n=t.row,t=t.col,i;return{sheet:this.li.getCalcSource().Mf,row:n,col:t}},w.prototype.isFormattedFormula=function(){return this.li.isFormattedFormula()},w.prototype.Qde=function(){return this.li.getView().hasFocus},w.prototype.Xde=function(){var t,n,i,t,e,r,t=this.getActiveCellInfo(),n=t.sheet,i=t.row,t=t.col;n&&(e=this.li,r=(0,h.getEditText)(n,i,t),n.options.showFormulas&&n.hasFormula(i,t)&&u.mt.HRe(i,t,n)&&(r=""),(0,l.isSameFormula)(e.getView().state,e.getText(),r)||e.setText(r),e.format())},w.prototype.Zp=function(t){var i,t,i=this.LEt,t=t||{};t=m(!0,{},s.DEFAULT_FORMULA_EDITOR_OPTIONS,t),p(t,function(t,n){i.hasOwnProperty(t)&&(i[t]=n)}),this.li.setOptions(i)},w.prototype.wme=function(){var t=this;t.li.setProvider({getStructReferences:function(){return(0,i.getStructReferencesByWorkbook)(t.Vv)},getFunctions:function(){return(0,c.getFunctionsByWorkbook)(t.Vv)}})},w.prototype.Zde=function(t){this.hve(t)},w.prototype.spe=function(){var t=this;t.tpe()?t.ope():(t.Xde(),t.Ove())},w.prototype.Yde=function(t,n){var i=this.getActiveCellInfo(),e=i.sheet,r=i.row,i=i.col;e===n.sheet&&r===n.row&&i===n.col&&("[styleinfo]"===n.propertyName&&this.Ove(),this.Xde())},w.prototype.$ve=function(t,n){var i,e,r,i;n&&(e=(i=this.getActiveCellInfo()).sheet,r=i.row,i=i.col,e===n.sheet)&&new u.Range(n.row,n.col,n.rowCount,n.colCount).contains(r,i)&&this.Xde()},w.prototype.ove=function(t,n){(0,f.ave)(t,n)},w.prototype.tve=function(t,n){var i;(0,f.uve)(t,n)||this._6()},w.prototype.Rve=function(t,n){var n=n.propertyName;"isProtected"===n&&this.Ove(),"showFormulas"===n&&this.Xde()},w.prototype.hme=function(t,n){var i;"allowDynamicArray"===n.propertyName&&this.li.rebuildFormula()},w.prototype.qve=function(){this.sve()},w.prototype.yme=function(t,n){var i,i,n,i=null==(i=this.Vv)?void 0:i.getSheetTab(n.sheetName),n=this.li.getCalcSource().Mf;i&&i.Mf===n&&this.Xde()},w.prototype.kme=function(t,n,i){var e;n!==i&&this.li.setOptions(this.LEt)},w.prototype._6=function(){var t=this;t.eve(),t.rve(),t.sve(),t.ope()},w.prototype.eve=function(){var t,t,t=(null==(t=this.Vv)?void 0:t.getCalcService())||s.defaultCalcService;this.li.setCalcService(t)},w.prototype.rve=function(){var t=(0,c.Kde)(this.Vv);t?this.li.setCalcSource(t.Uw()):this.li.setCalcSource(s.defaultCalcSource),this.epe()},w.prototype.sve=function(){var t,n,n,t=[],n=this.Vv;n&&(t.push.apply(t,n.getCustomNames()),n=(0,c.Kde)(n))&&t.push.apply(t,n.getCustomNames()),this.li.setCustomNames(t)},w.prototype.ope=function(){var t,n,t=this,n=t.rpe();t.li.setActiveCellInfo(n),t.Xde(),t.Ove(),t.li.clearHistory(),t.epe()},w.prototype.Ove=function(){var t=(0,c.Kde)(this.Vv);t?this.li.setReadOnly(b(t,t.getActiveRowIndex(),t.getActiveColumnIndex())):this.li.setReadOnly(!1)},w.prototype.tpe=function(){var t,n,t=this.li.getActiveCellInfo(),n=this.rpe();return t.row!==n.row||t.col!==n.col},w.prototype.rpe=function(){var t,n,i,t=(0,c.Kde)(this.Vv);return t?{row:n=t.getActiveRowIndex(),col:i=t.getActiveColumnIndex()}:s.DEFAULT_ACTIVE_CELL_INFO},w.prototype.epe=function(){this.options.onActiveCellChanged&&this.options.onActiveCellChanged()},w.prototype.hve=function(t){var n,i,e,i,r,o,n=this,i=n.Qy.getShortcutKey(t.keyCode,t.ctrlKey,t.shiftKey,t.altKey,t.metaKey),e=n.Qy.getCommands(i);if(e)for(i={cmds:e,r:d},u.Worksheet.et(this.Vv.getActiveSheet(),"beforeExecuteShortcut",i),e=i.cmds,r=0;r<e.length;r++)if(o=e[r].execute(n,{}))return o.ignoreCancelDefault||u.mt.vi(t),!0},e.FormulaEditor=w},"./dist/plugins/formulaPanel/editor/formulaEditorCore.js":function(B,t,n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,_,F,N,U,H,z,W,V,$,q,j,P,G,J,K,O,E,A,D,R,I,T,Q,n,i,X,Z,Y;function tt(){return[e.basicSetup,Z,o.customFields,p.readOnlyExtension,y.themeExtension,h.foldExtension,c.indentExtension,u.syntaxHighlightingField,s.autoCompletionExtensions,a.hoverTooltipExtension,f.signatureTooltipsExtensions,v.doubleClickSelectRangeExtension,d.linterExtension]}function L(t,n){this.ipe=n,this.zQt=new Q({state:this.npe(""),parent:t})}Object.defineProperty(t,"__esModule",{value:!0}),t.FormulaEditorCore=void 0,i=n("Core"),e=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=n("./dist/plugins/formulaPanel/editor/interface.js"),o=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),u=n("./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js"),s=n("./dist/plugins/formulaPanel/editor/featureProvider/completion.js"),a=n("./dist/plugins/formulaPanel/editor/featureProvider/hoverTooltips.js"),f=n("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),h=n("./dist/plugins/formulaPanel/editor/featureProvider/folding.js"),c=n("./dist/plugins/formulaPanel/editor/featureProvider/indent.js"),l=n("./dist/plugins/formulaPanel/editor/featureProvider/tab.js"),v=n("./dist/plugins/formulaPanel/editor/featureProvider/dbClickRangeSelector.js"),d=n("./dist/plugins/formulaPanel/editor/featureProvider/lint.js"),y=n("./dist/plugins/formulaPanel/editor/featureProvider/theme.js"),m=n("./dist/plugins/formulaPanel/editor/featureProvider/formatter.js"),p=n("./dist/plugins/formulaPanel/editor/featureProvider/readOnly.js"),k=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),g="gc-formula-editor-token-const-string",w="gc-formula-editor-token-const-number",b="gc-formula-editor-token-const-boolean",M="gc-formula-editor-token-const-error",x="gc-formula-editor-token-operator-prefix",S="gc-formula-editor-token-operator-infix",C="gc-formula-editor-token-operator-postfix",_="gc-formula-editor-token-function",F="gc-formula-editor-token-name",N="gc-formula-editor-token-reference-1",U="gc-formula-editor-token-reference-2",H="gc-formula-editor-token-reference-3",z="gc-formula-editor-token-reference-4",W="gc-formula-editor-token-reference-5",V="gc-formula-editor-token-reference-6",$="gc-formula-editor-token-reference-7",q="gc-formula-editor-token-argument-separator",j="gc-formula-editor-content",P="gc-formula-editor-gutters",G="gc-formula-editor-caret",J="gc-formula-editor-active-line",K="gc-formula-editor-selection",O="gc-formula-editor-tooltip-autocompletion-function",E="gc-formula-editor-tooltip-autocompletion-function-active-item",A="gc-formula-editor-tooltip-autocompletion-function-icon",D="gc-formula-editor-tooltip-autocompletion-function-name",R="gc-formula-editor-tooltip-autocompletion-function-description",I="gc-formula-editor-tooltip-error-message",T=i.I.fl,Q=e.View.EditorView,n=e.View.keymap,i=e.Commands.indentWithTab,X=e.Autocomplete.acceptCompletion,Z=n.of([{key:"Tab",run:X},{key:"Tab",run:l.insertTab},i]),L.prototype.getView=function(){return this.zQt},L.prototype.getText=function(){return this.zQt.state.doc.toJSON().join("\n")},L.prototype.setText=function(t){this.zQt.dispatch({changes:{from:0,to:this.zQt.state.doc.length,insert:t}})},L.prototype.getFunctions=function(){return(0,k.getFunctionsByState)(this.zQt.state)},L.prototype.getCustomNames=function(){return this.zQt.state.field(o.customNamesField)},L.prototype.setCustomNames=function(t){this.zQt.dispatch({effects:o.setCustomNamesField.of(t)})},L.prototype.getOptions=function(){return this.zQt.state.field(o.optionsField)},L.prototype.setOptions=function(t){this.zQt.dispatch({effects:o.setOptionsField.of(t)})},L.prototype.getReadOnly=function(){return this.zQt.state.readOnly},L.prototype.setReadOnly=function(t){t!==this.getReadOnly()&&(0,p.reconfigureReadOnly)(this.zQt,t)},L.prototype.getTheme=function(){return this.zQt.state.field(o.themeField)},L.prototype.setTheme=function(t){this.zQt.dispatch({effects:o.setThemeField.of(t)}),this.zQt.dispatch({effects:y.themeCompartment.reconfigure((0,y.createThemeExtension)(t))})},L.prototype.getCalcSource=function(){return this.zQt.state.field(o.calcSourceField)},L.prototype.setCalcSource=function(t){this.zQt.dispatch({effects:o.setCalcSourceField.of(t)})},L.prototype.getCalcService=function(){return this.zQt.state.field(o.calcServiceField)},L.prototype.setCalcService=function(t){this.zQt.dispatch({effects:o.setCalcServiceField.of(t)})},L.prototype.getActiveCellInfo=function(){return this.zQt.state.field(o.activeCellField)},L.prototype.setActiveCellInfo=function(t){this.zQt.dispatch({effects:o.setActiveCellField.of(t)})},L.prototype.getProvider=function(){return this.zQt.state.field(o.providerField)},L.prototype.setProvider=function(t){this.zQt.dispatch({effects:o.setProviderField.of(t)})},L.prototype.format=function(){(0,m.formatDocumentCommand)(this.zQt)},L.prototype.hasFocus=function(){return this.zQt.hasFocus},L.prototype.destroy=function(){this.zQt.destroy()},L.prototype.rebuildFormula=function(){this.zQt.dispatch({effects:o.rebuildFormulaEffect.of(!0)})},L.prototype.clearHistory=function(){var t,n,i,e,r,o,u,s,a,f,n,t=this,n=t.getText(),i=t.getTheme(),e=t.getOptions(),r=t.getCalcService(),o=t.getCalcSource(),u=t.getCustomNames(),s=t.getActiveCellInfo(),a=t.getProvider(),f=t.getReadOnly(),n=t.npe(n);t.zQt.setState(n),t.setTheme(i),t.setOptions(e),t.setCalcService(r),t.setCalcSource(o),t.setActiveCellInfo(s),t.setCustomNames(u),t.setProvider(a),t.setReadOnly(f)},L.prototype.initTheme=function(){var t,n,i,t=[{token:r.SyntaxHighlightingTokenType.stringConst,color:T(g).color},{token:r.SyntaxHighlightingTokenType.numberConst,color:T(w).color},{token:r.SyntaxHighlightingTokenType.booleanConst,color:T(b).color},{token:r.SyntaxHighlightingTokenType.errorConst,color:T(M).color},{token:r.SyntaxHighlightingTokenType.operatorPrefix,color:T(x).color},{token:r.SyntaxHighlightingTokenType.operatorInfix,color:T(S).color},{token:r.SyntaxHighlightingTokenType.operatorPostfix,color:T(C).color},{token:r.SyntaxHighlightingTokenType.function,color:T(_).color},{token:r.SyntaxHighlightingTokenType.name,color:T(F).color},{token:r.SyntaxHighlightingTokenType.argumentSeparator,color:T(q).color},{token:r.SyntaxHighlightingTokenType.reference,color:[T(N).color,T(U).color,T(H).color,T(z).color,T(W).color,T(V).color,T($).color]}],n={backgroundColor:T(j).backgroundColor,font:T(j).font,color:T(j).color,caretColor:T(G).color,selectionBackColor:T(K).backgroundColor,activeLineBackColor:T(J).backgroundColor,autocompletionStyle:{backgroundColor:T(O).backgroundColor,font:T(O).font,color:T(O).color,border:T(O).border,activeItem:{backgroundColor:T(E).backgroundColor,color:T(E).color},function_icon:{color:T(A).color,font:T(A).font},function_name:{color:T(D).color,font:T(D).font},function_description:{color:T(R).color,font:T(R).font}},errorStyle:{backgroundColor:T(I).backgroundColor,font:T(I).font,color:T(I).color}},i={backgroundColor:T(P).backgroundColor,font:T(P).font,color:T(P).color};this.setTheme({rules:t,editorContentStyle:n,editorGuttersStyle:i})},L.prototype.isFormattedFormula=function(){return this.zQt.state.field(o.isFormattedFormulaField)},L.prototype.npe=function(t){var n=tt().concat(this.ipe);return e.State.EditorState.create({extensions:n,doc:t})},t.FormulaEditorCore=L},"./dist/plugins/formulaPanel/editor/interface.js":function(t,n){var i,e,r,r;Object.defineProperty(n,"__esModule",{value:!0}),n.TokenType=n.SyntaxHighlightingTokenType=void 0,(r=i=n.SyntaxHighlightingTokenType||(n.SyntaxHighlightingTokenType={}))[r.subExpression=0]="subExpression",r[r.function=1]="function",r[r.argumentSeparator=2]="argumentSeparator",r[r.operatorPrefix=3]="operatorPrefix",r[r.operatorInfix=4]="operatorInfix",r[r.operatorPostfix=5]="operatorPostfix",r[r.stringConst=6]="stringConst",r[r.errorConst=7]="errorConst",r[r.numberConst=8]="numberConst",r[r.booleanConst=9]="booleanConst",r[r.name=10]="name",r[r.reference=11]="reference",r[r.whitespace=12]="whitespace",r[r.unknown=13]="unknown",(r=e=n.TokenType||(n.TokenType={}))[r.ErrorConst=0]="ErrorConst",r[r.LogicalConst=1]="LogicalConst",r[r.NumberConst=2]="NumberConst",r[r.StringConst=3]="StringConst",r[r.ArrayConstStart=4]="ArrayConstStart",r[r.ArrayConstEnd=5]="ArrayConstEnd",r[r.ArrayConstRowSeparator=6]="ArrayConstRowSeparator",r[r.ArrayConstItemSeparator=7]="ArrayConstItemSeparator",r[r.OperatorPrefix=8]="OperatorPrefix",r[r.OperatorInfix=9]="OperatorInfix",r[r.OperatorPostfix=10]="OperatorPostfix",r[r.FunctionName=11]="FunctionName",r[r.FunctionCallStart=12]="FunctionCallStart",r[r.FunctionCallEnd=13]="FunctionCallEnd",r[r.FunctionArgumentSeparator=14]="FunctionArgumentSeparator",r[r.SubExpressionStart=15]="SubExpressionStart",r[r.SubExpressionEnd=16]="SubExpressionEnd",r[r.CellReference=17]="CellReference",r[r.Name=18]="Name",r[r.FormulaStart=19]="FormulaStart",r[r.Whitespace=20]="Whitespace",r[r.Unknown=21]="Unknown"},"./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js":function(t,c,n){var i,l,e,r,o,v,u,s,d,a,f,h,y,m;function p(t){this.cmt=!0,this.rl=!1,this.Xvt=l.SelectionUnit.cell,this.Ivt=!1,this.xmt=!0,this.qMi=!1,this.XD=!1,this.umt=-1,this.zQt=t}function k(t){this.lve=t}function g(t){var n,i,i,n=(0,v.getActiveSheetByState)(t);n&&(b(i=e.Hde.Ude())&&(i.zde(n),n=(0,v.getActiveSheetByState)(t)),w(i=n.Bde))&&(i.dispose(),n.Bde=h,M(n.parent,!1))}function w(t){return t instanceof y}function b(t){return t instanceof m}function M(t,n){var i=function(t){t&&(t.rt.X6=n)};t.sheets.forEach(i),t.mp.forEach(function(t){i(t.Mf)})}function x(t,n){t.parent.e3(t,n=void 0===n?!0:n)}Object.defineProperty(c,"__esModule",{value:!0}),c.setWorkbookFocusStatus=c.isFormulaEditorReferencedRangesAcrossSheetContext=c.isFormulaEditorReferencedRangesContext=c.closeFormulaReferencedRanges=c.FormulaEditorReferencedRangesAcrossSheetContext=c.FormulaEditorReferencedRangesContext=c.appendingRangeAnnotation=void 0,i=n("Common"),l=n("Core"),e=n("FormulaTextBox"),r=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=n("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),v=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=n("./dist/plugins/formulaPanel/editor/common/util.js"),s=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),d=n("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),a=n("./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js"),f=n("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),h=void 0,c.appendingRangeAnnotation=r.State.Annotation.define(),p.prototype.smt=function(){var t,n,i,e,r,t;if(!this.isFormula())return[];for(t=this.zQt.state,n=(0,v.getTokensByState)(t),(0,a.markReferenceTokenColorIndex)(n,t),i=[],e=0;e<n.length;e++)r=n[e],((0,o.isReferenceToken)(r)||(0,o.isNameToken)(r)&&(0,o.hasReferenceRanges)(r))&&i.push({index:i.length,textOffset:r.index,text:r.text,ranges:r.ranges,allowDrag:r.canDrag,sheetArea:l.SheetArea.viewport,tag:{colorIndex:r.colorIndex}});return(t=this.Fvt)&&i.push({textOffset:-1,text:"",ranges:[t],index:i.length,allowDrag:!1,isPivotClickCell:!0,tag:{colorIndex:0}}),i},p.prototype.pmt=function(t){var n,n,t,n=(0,v.getReferenceTokenColors)(this.zQt.state),t=this.smt()[t];return n[(null==(n=null==t?void 0:t.tag)?void 0:n.colorIndex)||0]},p.prototype.ymt=function(t){var n=this.zQt.state.selection.main.head;return t.textOffset<=n&&t.textOffset+t.text.length>=n},p.prototype.bmt=function(t){var n,i;return!!this.XD&&(n=this.zQt.state.selection.main.head,i=this.umt,t.textOffset>=i)&&t.textOffset+t.text.length<=n},p.prototype.Qvt=function(){return l.SheetArea.viewport},p.prototype.Dvt=function(){var t,t,t=this.zQt.state;return!t.readOnly&&(!(!this.XD&&!(0,l.Df)(this.text()))||!!this.isFormula()&&!!(t=(0,o.getTokenByPos)((0,v.getTokensByState)(t),(0,v.getSelection)(t).from-1))&&((0,o.isFormulaStartToken)(t)||(0,o.isFunctionCallStartToken)(t)||(0,o.isSubExpressionStartToken)(t)||(0,o.isFunctionArgumentSeparator)(t)||(0,o.isLeftParenthesesToken)(t)||(0,o.isInfixOperatorToken)(t)||(0,o.isPrefixOperatorToken)(t)||(0,o.isWhitespaceToken)(t)))},p.prototype.text=function(){return(0,v.getTextByState)(this.zQt.state)},p.prototype.caret=function(){return this.zQt.state.selection.main.head},p.prototype.close=function(){},p.prototype.mmt=function(){},p.prototype.Vde=function(t,n){var i,e,t,r,t,o;n&&(i=this.zQt,t=(e=this.smt())[t])&&(t=(r=t.textOffset)+t.text.length,o=r+n.length,i.dispatch({changes:{from:r,to:t,insert:n},selection:{anchor:o,head:o},annotations:d.notTriggerSignatureTooltip.of(!0)}))},p.prototype.Gvt=function(t,n,i,e,r){var r,o,u,s,a,f,f,h;if(void 0===r&&(r=l.SheetArea.viewport),t){if(u=(o=(r=this).zQt).state,!r.XD){if(!r.Dvt())return;r.XD=!(n=!1),r.umt=(0,v.getSelection)(u).from}s=r.umt,a=(0,v.getSelection)(u).to,f=(0,v.getTokensByState)(u),f=(0,v.getValidReferenceTokenByPos)(f,a,u),i?(h=s+t.length,o.dispatch({changes:{from:s,to:a,insert:t},selection:{anchor:h,head:h},annotations:[c.appendingRangeAnnotation.of(!0),d.notTriggerSignatureTooltip.of(!0)]})):n?f&&f.index>=s&&a>=f.index&&(h=f.index+t.length,o.dispatch({changes:{from:f.index,to:a,insert:t},selection:{anchor:h,head:h},annotations:[c.appendingRangeAnnotation.of(!0),d.notTriggerSignatureTooltip.of(!0)]})):(h=a+(t=s<a?r.fgt()+t:t).length,o.dispatch({changes:{from:a,to:a,insert:t},selection:{anchor:h,head:h},annotations:[c.appendingRangeAnnotation.of(!0),d.notTriggerSignatureTooltip.of(!0)]}))}},p.prototype.qD=function(){var t=this;t.XD&&(t.XD=!1,t.umt=-1)},p.prototype.onRangeMoved=function(){},p.prototype.onRangeResized=function(){},p.prototype.onRangeAppend=function(){},p.prototype.fgt=function(){var t=i.Common.CultureManager.Fe().NumberFormat;return t&&t.listSeparator||u.COMMA},p.prototype.cve=function(){return this.zQt.state.field(s.calcSourceField).Mf},p.prototype.fve=function(){return this.zQt.state.field(s.activeCellField)},p.prototype.isFormula=function(){return this.zQt.state.field(s.isFormulaField)},p.prototype.Ak=function(t){t&&(this.Dmt=[t])},p.prototype.Hce=function(){this.Dmt=h},p.prototype.Ymt=function(){return this.Dmt},p.prototype.dispose=function(){this.zQt=h},p.prototype.dve=function(){var t=this.zQt;t&&(g(t.state),t.hasFocus&&t.contentDOM.blur(),this.dispose())},y=p,c.FormulaEditorReferencedRangesContext=y,Object.defineProperty(k.prototype,"Ivt",{get:function(){return this.lve.Ivt},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"Mf",{get:function(){return this.lve.cve()},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"_text",{get:function(){return this.lve.text()},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"bZ",{get:function(){return this.lve.fve().row},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"mvt",{get:function(){return this.lve.fve().col},enumerable:!1,configurable:!0}),k.prototype.zde=function(t){var n,i,e,r,o,n=!1,i=this.Mf,e=this.bZ,r=this.mvt,o=this._text;return i!==t&&(x(i),n=!0),(0,f.executeCommitContextToCellCommand)(i,e,r,o),this.d5(),n},k.prototype.d5=function(){this.lve=h,e.Hde.DJ=h},m=k,c.FormulaEditorReferencedRangesAcrossSheetContext=m,c.closeFormulaReferencedRanges=g,c.isFormulaEditorReferencedRangesContext=w,c.isFormulaEditorReferencedRangesAcrossSheetContext=b,c.setWorkbookFocusStatus=M},"./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesExtension.js":function(t,n,i){var o,e,u,s,a,f,i,e;function h(t,n,i){var e=i.parent;t&&t.zQt===n||(i.Bde=new a.FormulaEditorReferencedRangesContext(n),(0,a.setWorkbookFocusStatus)(e,i.Bde.Dvt()))}function c(t,n,i){var i;(0,a.isFormulaEditorReferencedRangesContext)(t)&&(i=i.parent,r(t,n,i)?(0,a.closeFormulaReferencedRanges)(n.state):document.activeElement!==n.contentDOM&&setTimeout(function(){n.focus()},10))}function r(t,n,i){var e=document.activeElement;return e!==n.contentDOM&&!(e.hasAttribute("data-gc-formula-editor-additional-element")||t.Dvt()&&i&&i.Ti&&i.Ti.contains(e))}function l(t,n){var n,i;v(t.keyCode)&&(i=(n=(0,u.getActiveSheetByState)(n.state))&&n.Bde,(0,a.isFormulaEditorReferencedRangesContext)(i))&&n.rt.yk(t)}function v(t){return 16===t||17===t||18===t}function d(t,n){var i,e,r,i=n.oldSheet,e=n.newSheet;i&&e&&i!==e&&(r=i.Bde,(0,a.isFormulaEditorReferencedRangesContext)(r))&&(r.Dvt()||o.Hde.DJ)&&(n.needTriggerSheetChange=!1,e.Bde=r,i.Bde=f)}function y(t,n){var i,n,i,i,i=n.oldSheet,n=n.newSheet;if(n&&!n.xT&&i!==n&&(i=n.Bde,(0,a.isFormulaEditorReferencedRangesContext)(i))&&(i.Dvt()||o.Hde.DJ))return i.cve()!==n?o.Hde.DJ=new a.FormulaEditorReferencedRangesAcrossSheetContext(i):(i=o.Hde.DJ,(0,a.isFormulaEditorReferencedRangesAcrossSheetContext)(i)&&(i.d5(),o.Hde.DJ=f)),(0,s.paintFormulaReferencedRanges)(n),!0}Object.defineProperty(n,"__esModule",{value:!0}),n.uve=n.ave=n.isMetaKeyForAppendingRange=n.formulaReferencedRangesExtension=void 0,o=i("FormulaTextBox"),e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),u=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),s=i("./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js"),a=i("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js"),f=void 0,i=e.View.EditorView.updateListener.of(function(t){var n,i,e,r,n=(0,u.getActiveSheetByState)(t.state);n&&(i=n.parent,e=n.Bde,r=o.Hde.Ude(),!e&&(0,a.isFormulaEditorReferencedRangesAcrossSheetContext)(r)&&(e=r.lve),t.focusChanged?((t.view.hasFocus?h:c)(e,t.view,n),(0,s.paintFormulaReferencedRanges)(n)):(t.selectionSet||t.docChanged)&&e&&(t.transactions.some(function(t){return!t.annotation(a.appendingRangeAnnotation)})&&e.qD(),(0,a.setWorkbookFocusStatus)(i,e.Dvt()),(0,s.paintFormulaReferencedRanges)(n)))}),e=e.View.ViewPlugin.define(function(){return null},{eventHandlers:{keydown:l,keyup:l}}),n.formulaReferencedRangesExtension=[i,e],n.isMetaKeyForAppendingRange=v,n.ave=d,n.uve=y},"./dist/plugins/formulaPanel/editor/spreadFeatureProvider/structReferences.js":function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.getStructReferencesByWorkbook=void 0;var u=i("CalcEngine");function e(t){return t?r(t).concat(s(t)):[]}function r(t){var i=[];return t.sheets.forEach(function(t){var n;(t.tables&&t.tables.all()||[]).forEach(function(t){i.push({name:t.name(),description:(0,u.sR)().Fbx_TableName_Description+t.name(),getColumns:function(){return o(t)}})})}),i}function o(t){for(var i,n,e,r,o,i=[],n=0,e="";null!==e;)e=t.getColumnName(n),n++,null!==e&&i.push({name:e,description:""});return r=(0,u.sR)().d2t,o=(0,u.getMapping)()&&(0,u.getMapping)().tableFunctionsMapping,Object.keys(r).forEach(function(t){var t=r[t],n=t.name,t=t.description,n=o&&o[n]||n;i.push({name:n,description:t})}),i}function s(t){var n=[];return t.mp.forEach(function(t){n.push({name:t.name(),description:(0,u.sR)().Fbx_TableSheetName_Description+t.name(),getColumns:function(){return a(t)}})}),n}function a(t){for(var n,i,e,n=[],i=t.getColumnCount(),e=0;e<i;e++)n.push({name:t.getColumnName(e),description:""});return n}n.getStructReferencesByWorkbook=e},"./dist/plugins/formulaPanel/formulaPanel.entry.js":function(t,n,i){var e,r,o,u,s,a,f,h,c,e=this&&this.__createBinding||(Object.create?function(t,n,i,e){void 0===e&&(e=i);var r=Object.getOwnPropertyDescriptor(n,i);r&&("get"in r?n.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(t,e,r)}:function(t,n,i,e){t[e=void 0===e?i:e]=n[i]}),r=this&&this.__exportStar||function(t,n){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||e(n,t,i)};Object.defineProperty(n,"__esModule",{value:!0}),n.findControl=n.vve=n.Commands=n.FormulaEditor=void 0,o=i("Core"),i("./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js"),i("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),u=i("./dist/plugins/formulaPanel/editor/formulaEditor.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/lint.js"),a=i("./dist/plugins/formulaPanel/editor/common/formatter.js"),f=i("./dist/plugins/formulaPanel/editor/formulaEditor.js"),Object.defineProperty(n,"FormulaEditor",{enumerable:!0,get:function(){return f.FormulaEditor}}),h=i("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),Object.defineProperty(n,"Commands",{enumerable:!0,get:function(){return h.Commands}}),n.vve={mve:s.getDiagnostic,I5:a.format},r(i("./dist/plugins/formulaPanel/editor/editor.ns.js"),n),n.findControl=c=function(t){return"string"==typeof t&&(t=document.getElementById(t)),(0,o.GC$)(t).data(u.CONST_FORMULA_EDITOR)}},Common:function(t){t.exports=n.Spread},CalcEngine:function(t){t.exports=n.Spread.CalcEngine},Core:function(t){t.exports=n.Spread.Sheets},SheetsCalc:function(t){t.exports=n.Spread.Sheets.CalcEngine},FormulaTextBox:function(t){t.exports=n.Spread.Sheets.FormulaTextBox}},e={},t=r("./dist/plugins/formulaPanel/formulaPanel.entry.js"),(((n=void 0===n?{}:n).Spread=n.Spread||{}).Sheets=n.Spread.Sheets||{}).FormulaPanel=t}(),n.Spread.Common.CultureManager.reloadResources&&n.Spread.Common.CultureManager.reloadResources("FormulaPanel")});
|
|
12
|
+
!function(t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("@grapecity-software/spread-sheets")):"function"==typeof define&&define.amd?define(["@grapecity-software/spread-sheets"],t):"object"==typeof exports?exports.Spread=t(require("@grapecity-software/spread-sheets")):t(GC)}(function(n){!function(){"use strict";var i,e,t;function r(t){var n,n,n=e[t];return void 0!==n||(n=e[t]={exports:{}},i[t].call(n.exports,n,n.exports,r)),n.exports}i={"./dist/plugins/formulaPanel/editor/codemirror/index.js":function(T,L){var k,B,_,N,U,H,W,V,$,q,G,h,J,K,Q,X,O,Z,y,Y,tt,b,nt,it,et,rt,ot,ut,st,at,ft,ht,ct,lt,vt,dt,yt,mt,pt,kt,gt,wt,bt,v,Mt,xt,l,St,Ct,C,jt,Pt,Ot,j,Et,At,Dt,Rt,It,Tt,Lt,Bt,_t,Ft,Nt,Ut,Ht,zt,t,n,Wt,Vt,i,$t,qt,Gt,Jt,Kt,Qt,c,Xt,n,t,Zt,e,Yt,tn,nn,en,r,o,u,g,rn,on,un,sn,an,fn,tn,P,m,hn,cn,ln,vn,dn,yn,mn,pn,kn,gn,wn,bn,Mn,xn,Sn,Cn,jn,Pn,On,En,An,d,Dn,Rn,In,Tn,Ln,Bn,_n,Fn,Nn,E,Un,Hn,zn,Wn,Vn,$n,qn,Gn,Jn,Kn,Jn,Qn,Xn,z,Zn,Yn,ti,ni,ii,ei,ri,oi,ui,si,ai,fi,hi,ci,s,li,vi,di,yi,mi,pi,ki,gi,wi,bi,Mi,xi,Si,Ci,p,ji,Pi,Oi,Ei,Ai,Di,Ri,Ii,Ti,Li,Bi,_i,Fi,Ni,Ui,Hi,zi,Wi,Vi,$i,qi,Gi,Ji,Ki,Qi,Xi,w,Zi,Yi,te,ne,e,ie,ee,re,oe,ue,se,ae,fe,he,ce,le,Yt,ve,de,ye,me,pe,ke,ge,we,be,Me,xe,Se,Ce,je,Pe,Oe,Ee,Ae,De,Re,Ie,Te,Le,Be,_e,Fe,Zt,Ne,Ue,He,ze,We,Ve,$e,nn,qe,Ge,Je,Ke,en,Qe,Xe,Ze,Ye,tr,nr,ir,er,rr,or,ur,sr,ar,fr,hr,cr,lr,u,vr,dr,yr,mr,M,pr,kr,n,gr,wr,br,x,Mr,xr,Sr,Cr,jr,Pr,Or,Er,Ar,Dr,Rr,Ir,Tr,Lr,Br,_r,Fr,r,t,e,Yt,Zt,u,nn,o,Nr,Ur,Hr,zr,Wr,Vr,$r,a,Yt,qr,Gr,Jr,t,Kr,Qr,Xr,Zr,Yr,to,no,io,Zt,e,eo,ro,oo,uo,so,nn,ao,fo,ho,co,lo,vo,u,Hr,zr,Wr,o,yo,mo,po,ko,go,wo,bo,Mo,xo,So,Vr,Co,jo,Ur,Po,Oo,Eo,Ao,Do,Ro,Io,To,Lo,Bo,Nr,_o,Fo,No,Uo,Ho,zo,Wo,Vo,$o,qo,$o,Go,Jo,Ko,Qo,Xo,Zo,Yo,tu,nu,iu,eu,r,$r,Yt,ru,ou,uu,su,au,fu,hu,cu,lu,vu,du,yu,mu,pu,ku,gu,wu,bu,Mu,xu,Su,Cu,ju,Pu,Ou,n,Vr,Ur,Eu,Au,Du,Ru,Iu,t,Tu,Lu,Bu,_u,Fu,Nu,Uu,e,Hu,zu,Wu,Vu,$u,Wr,qu,Zt,Nr,nn,zr,u,Gu,Ju,Ku,Qu,Xu,Zu,Yu,o,ts,ns,Hr,jt,r,n,is,es,rs,os,us,ss,as,fs,hs,cs,ls,vs,ds,ys,ms,ps,Yt,e,ks,gs,ws,bs,Ms,xs,Ss,Cs,js,Ps,Os,Es,As,Ds,Rs,Is,Ts,Ls,Bs,_s,Fs,Ns,t,Vr,Us,Hs,zs,Ws,Vs,$s,qs,Gs,Js,Ks,Qs,Xs,Zs,Ys,ta,na,ia,ea,ra,oa,ua,sa,aa,fa,ha,ca,la,va,da,Ur,ya,$r,ma,pa,ka,ga,wa,ba,Ma,xa,Sa,Ca,ja,Pa,Oa,Ea,Aa,Da,Ra,Ia,Ta,La,Ba,zr,_a,u,Fa,Na,Ua,Ha,za,Wa,ma,Va,$a,qa,Ga,Ja,Ka,Qa,Xa,Za,Ya,tf,nf,ef,rf,of,uf,sf,af,ff,$r,hf,cf,lf,vf,df,yf,mf,pf,as,kf,gf,fs,wf,bf,Mf,xf,Sf,Cf,jf,Pf,Xs,Of,Ef,Af,Qs,Df,Rf,If,Tf,Lf,Bf,_f,Ff,ls,Nf,Uf,Hf,o;function zf(t,n,i){return(n=ah(n))in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}function Wf(t){return qf(t)||$f(t)||Xf(t)||Vf()}function Vf(){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 $f(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function qf(t){if(Array.isArray(t))return Zf(t)}function Gf(t,n){return Qf(t)||Kf(t,n)||Xf(t,n)||Jf()}function Jf(){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 Kf(t,n){var i,e,r,o,u,s,a,f,i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){s=[],f=!(a=!0);try{if(o=(i=i.call(t)).next,0===n){if(Object(i)!==i)return;a=!1}else for(;!(a=(e=o.call(i)).done)&&(s.push(e.value),s.length!==n);a=!0);}catch(t){f=!0,r=t}finally{try{if(!a&&null!=i.return&&(u=i.return(),Object(u)!==u))return}finally{if(f)throw r}}return s}}function Qf(t){if(Array.isArray(t))return t}function F(n,t){var i,e,t,r,o,u,i="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(i)return o=!(r=!0),{s:function t(){i=i.call(n)},n:function t(){var n=i.next();return r=n.done,n},e:function t(n){o=!0,u=n},f:function t(){try{r||null==i.return||i.return()}finally{if(o)throw u}}};if(Array.isArray(n)||(i=Xf(n))||t&&n&&"number"==typeof n.length)return i&&(n=i),e=0,{s:t=function t(){},n:function t(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function t(n){throw n},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Xf(t,n){var i;if(t)return"string"==typeof t?Zf(t,n):"Map"===(i="Object"===(i=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:i)||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Zf(t,n):void 0}function Zf(t,n){(null==n||n>t.length)&&(n=t.length);for(var i=0,e=new Array(n);i<n;i++)e[i]=t[i];return e}function Yf(){return(Yf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function t(n,i,e){var r,r,r=th(n,i);if(r)return(r=Object.getOwnPropertyDescriptor(r,i)).get?r.get.call(arguments.length<3?n:e):r.value}).apply(this,arguments)}function th(t,n){for(;!Object.prototype.hasOwnProperty.call(t,n)&&null!==(t=oh(t)););return t}function f(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&nh(t,n)}function nh(t,n){return(nh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function t(n,i){return n.__proto__=i,n})(t,n)}function S(e){var r=rh();return function t(){var n,i,i,n=oh(e),i=r?(i=oh(this).constructor,Reflect.construct(n,arguments,i)):n.apply(this,arguments);return ih(this,i)}}function ih(t,n){if(n&&("object"===uh(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return eh(t)}function eh(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rh(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function oh(t){return(oh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function t(n){return n.__proto__||Object.getPrototypeOf(n)})(t)}function uh(t){return(uh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function A(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function sh(t,n){for(var i,e,i=0;i<n.length;i++)(e=n[i]).enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,ah(e.key),e)}function D(t,n,i){return n&&sh(t.prototype,n),i&&sh(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function ah(t){var t=fh(t,"string");return"symbol"===uh(t)?t:String(t)}function fh(t,n){var i,i;if("object"!==uh(t)||null===t)return t;if(void 0===(i=t[Symbol.toPrimitive]))return("string"===n?String:Number)(t);if("object"!==uh(i=i.call(t,n||"default")))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}function hh(t){var n,i,e,r,n=-1,i=F(t);try{for(i.s();!(e=i.n()).done;)n+=(r=e.value).length+1}catch(t){i.e(t)}finally{i.f()}return n}function ch(t,n,i,e){for(var r,o,u,s,a,f,h,r=2<arguments.length&&void 0!==i?i:0,o=3<arguments.length&&void 0!==e?e:1e9,u=0,s=0,a=!0;s<t.length&&u<=o;s++)r<=(h=u+(f=t[s]).length)&&(o<h&&(f=f.slice(0,o-u)),u<r&&(f=f.slice(r-u)),a?(n[n.length-1]+=f,a=!1):n.push(f)),u=h+1;return n}function lh(t,n,i){return ch(t,[""],n,i)}for(Object.defineProperty(L,"__esModule",{value:!0}),L.basicSetup=L.View=L.State=L.Search=L.Lint=L.Language=L.Commands=L.Autocomplete=void 0,B=function(t){f(a,t);var e=S(a);function a(t){var n,i,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:hh(t);return A(this,a),(n=e.call(this)).text=t,n.length=i,n}return D(a,[{key:"lines",get:function t(){return this.text.length}},{key:"children",get:function t(){return null}},{key:"lineInner",value:function t(n,i,e,r){for(var o,u,s,o=0;;o++){if(s=r+(u=this.text[o]).length,n<=(i?e:s))return new W(r,s,e,u);r=s+1,e++}}},{key:"decompose",value:function t(n,i,e,r){var i,n,r,n,i=n<=0&&i>=this.length?this:new a(lh(this.text,n,i),Math.min(i,this.length)-Math.max(0,n));1&r?(n=e.pop(),(r=ch(i.text,n.text.slice(),0,i.length)).length<=32?e.push(new a(r,n.length+i.length)):(n=r.length>>1,e.push(new a(r.slice(0,n)),new a(r.slice(n))))):e.push(i)}},{key:"replace",value:function t(n,i,e){var r,o;return e instanceof a?(r=ch(this.text,ch(e.text,lh(this.text,0,n)),i),o=this.length+e.length-(i-n),r.length<=32?new a(r,o):_.from(a.split(r,[]),o)):Yf(oh(a.prototype),"replace",this).call(this,n,i,e)}},{key:"sliceString",value:function t(n){for(var i,e,r,o,u,s,a,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.length,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"\n",r="",o=0,u=0;o<=i&&u<this.text.length;u++)n<o&&u&&(r+=e),n<(a=o+(s=this.text[u]).length)&&o<i&&(r+=s.slice(Math.max(0,n-o),i-o)),o=a+1;return r}},{key:"flatten",value:function t(n){var i,e,r,i=F(this.text);try{for(i.s();!(e=i.n()).done;)r=e.value,n.push(r)}catch(t){i.e(t)}finally{i.f()}}},{key:"scanIdentical",value:function t(){return 0}}],[{key:"split",value:function t(n,i){var e,r,o,u,s,e=[],r=-1,o=F(n);try{for(o.s();!(u=o.n()).done;)s=u.value,e.push(s),r+=s.length+1,32==e.length&&(i.push(new a(e,r)),e=[],r=-1)}catch(t){o.e(t)}finally{o.f()}return-1<r&&i.push(new a(e,r)),i}}]),a}(k=function(){function i(){A(this,i)}return D(i,[{key:"lineAt",value:function t(n){if(n<0||n>this.length)throw new RangeError("Invalid position ".concat(n," in document of length ").concat(this.length));return this.lineInner(n,!1,1,0)}},{key:"line",value:function t(n){if(n<1||n>this.lines)throw new RangeError("Invalid line number ".concat(n," in ").concat(this.lines,"-line document"));return this.lineInner(n,!0,1,0)}},{key:"replace",value:function t(n,i,e){var r=[];return this.decompose(0,n,r,2),e.length&&e.decompose(0,e.length,r,3),this.decompose(i,this.length,r,1),_.from(r,this.length-(i-n)+e.length)}},{key:"append",value:function t(n){return this.replace(this.length,this.length,n)}},{key:"slice",value:function t(n){var i,e,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.length,e=[];return this.decompose(n,i,e,0),_.from(e,i-n)}},{key:"eq",value:function t(n){var i,e,r,o,u,s;if(n==this)return!0;if(n.length!=this.length||n.lines!=this.lines)return!1;for(i=this.scanIdentical(n,1),e=this.length-this.scanIdentical(n,-1),r=new N(this),o=new N(n),s=u=i;;){if(r.next(u),o.next(u),u=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(s+=r.value.length,r.done||e<=s)return!0}}},{key:"iter",value:function t(){var n;return new N(this,0<arguments.length&&void 0!==arguments[0]?arguments[0]:1)}},{key:"iterRange",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.length;return new U(this,n,i)}},{key:"iterLines",value:function t(n,i){var n,n,n=null==n?this.iter():(null==i&&(i=this.lines+1),n=this.line(n).from,this.iterRange(n,Math.max(n,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to)));return new H(n)}},{key:"toString",value:function t(){return this.sliceString(0)}},{key:"toJSON",value:function t(){var n=[];return this.flatten(n),n}}],[{key:"of",value:function t(n){if(0==n.length)throw new RangeError("A document must have at least one line");return 1!=n.length||n[0]?n.length<=32?new B(n):_.from(B.split(n,[])):i.empty}}]),i}()),_=function(t){f(x,t);var u=S(x);function x(t,n){var i,e,r,o;A(this,x),(i=u.call(this)).children=t,i.length=n,i.lines=0,e=F(t);try{for(e.s();!(r=e.n()).done;)o=r.value,i.lines+=o.lines}catch(t){e.e(t)}finally{e.f()}return i}return D(x,[{key:"lineInner",value:function t(n,i,e,r){for(var o,u,s,a,o=0;;o++){if(s=r+(u=this.children[o]).length,a=e+u.lines-1,n<=(i?a:s))return u.lineInner(n,i,e,r);r=s+1,e=1+a}}},{key:"decompose",value:function t(n,i,e,r){for(var o,u,s,a,f,o=0,u=0;u<=i&&o<this.children.length;o++)n<=(a=u+(s=this.children[o]).length)&&u<=i&&(f=r&((u<=n?1:0)|(i<=a?2:0)),n<=u&&a<=i&&!f?e.push(s):s.decompose(n-u,i-u,e,f)),u=a+1}},{key:"replace",value:function t(n,i,e){var r,o,u,s,a,u,u;if(e.lines<this.lines)for(o=r=0;r<this.children.length;r++){if(s=o+(u=this.children[r]).length,o<=n&&i<=s)return a=u.replace(n-o,i-o,e),u=this.lines-u.lines+a.lines,a.lines<u>>4&&a.lines>u>>6?((u=this.children.slice())[r]=a,new x(u,this.length-(i-n)+e.length)):Yf(oh(x.prototype),"replace",this).call(this,o,s,a);o=s+1}return Yf(oh(x.prototype),"replace",this).call(this,n,i,e)}},{key:"sliceString",value:function t(n){for(var i,e,r,o,u,s,a,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.length,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"\n",r="",o=0,u=0;o<this.children.length&&u<=i;o++)n<u&&o&&(r+=e),n<(a=u+(s=this.children[o]).length)&&u<i&&(r+=s.sliceString(n-u,i-u,e)),u=a+1;return r}},{key:"flatten",value:function t(n){var i,e,r,i=F(this.children);try{for(i.s();!(e=i.n()).done;)(r=e.value).flatten(n)}catch(t){i.e(t)}finally{i.f()}}},{key:"scanIdentical",value:function t(n,i){var e,r,o,u,s,a,f,h,c;if(!(n instanceof x))return 0;for(u=(o=Gf(r=(e=0)<i?[0,0,this.children.length,n.children.length]:[this.children.length-1,n.children.length-1,-1,-1],4))[0],s=o[1],a=o[2],f=o[3];;u+=i,s+=i){if(u==a||s==f)return e;if((h=this.children[u])!=(c=n.children[s]))return e+h.scanIdentical(c,i);e+=h.length+1}}}],[{key:"from",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n.reduce(function(t,n){return t+n.length+1},-1),e=0,r=F(n);try{for(r.s();!(o=r.n()).done;)e+=(u=o.value).lines}catch(t){r.e(t)}finally{r.f()}if(e<32){s=[],a=F(n);try{for(a.s();!(f=a.n()).done;)(h=f.value).flatten(s)}catch(t){a.e(t)}finally{a.f()}return new B(s,i)}function b(t){var n,i,e,r;if(t.lines>l&&t instanceof x){i=F(t.children);try{for(i.s();!(e=i.n()).done;)b(r=e.value)}catch(t){i.e(t)}finally{i.f()}}else t.lines>v&&(v<y||!y)?(M(),d.push(t)):t instanceof B&&y&&(n=p[p.length-1])instanceof B&&t.lines+n.lines<=32?(y+=t.lines,m+=t.length+1,p[p.length-1]=new B(n.text.concat(t.text),n.length+1+t.length)):(y+t.lines>c&&M(),y+=t.lines,m+=t.length+1,p.push(t))}function M(){0!=y&&(d.push(1==p.length?p[0]:x.from(p,m)),m=-1,y=p.length=0)}c=Math.max(32,e>>5),l=c<<1,v=c>>1,d=[],y=0,m=-1,p=[],k=F(n);try{for(k.s();!(g=k.n()).done;)b(w=g.value)}catch(t){k.e(t)}finally{k.f()}return M(),1==d.length?d[0]:new x(d,i)}}]),x}(k),k.empty=new B([""],0),N=function(){function i(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;A(this,i),this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[0<n?1:(t instanceof B?t.text:t.children).length<<1]}return D(i,[{key:"nextInner",value:function t(n,i){var e,r,o,u,s,s,o;for(this.done=this.lineBreak=!1;;)if(e=this.nodes.length-1,r=this.nodes[e],u=(o=this.offsets[e])>>1,s=(r instanceof B?r.text:r.children).length,u==(0<i?s:0)){if(0==e)return this.done=!0,this.value="",this;0<i&&this.offsets[e-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&o)==(0<i?0:1)){if(this.offsets[e]+=i,0==n)return this.lineBreak=!0,this.value="\n",this;n--}else if(r instanceof B){if(s=r.text[u+(i<0?-1:0)],this.offsets[e]+=i,s.length>Math.max(0,n))return this.value=0==n?s:0<i?s.slice(n):s.slice(0,s.length-n),this;n-=s.length}else n>(o=r.children[u+(i<0?-1:0)]).length?(n-=o.length,this.offsets[e]+=i):(i<0&&this.offsets[e]--,this.nodes.push(o),this.offsets.push(0<i?1:(o instanceof B?o.text:o.children).length<<1))}},{key:"next",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return n<0&&(this.nextInner(-n,-this.dir),n=this.value.length),this.nextInner(n,this.dir)}}]),i}(),U=function(){function e(t,n,i){A(this,e),this.value="",this.done=!1,this.cursor=new N(t,i<n?-1:1),this.pos=i<n?t.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}return D(e,[{key:"nextInner",value:function t(n,i){var e,r,o;return(i<0?this.pos<=this.from:this.pos>=this.to)?(this.value="",this.done=!0):(n+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos),e=i<0?this.pos-this.from:this.to-this.pos,e-=n=e<n?e:n,o=(r=this.cursor.next(n)).value,this.pos+=(o.length+n)*i,this.value=o.length<=e?o:i<0?o.slice(o.length-e):o.slice(0,e),this.done=!this.value),this}},{key:"next",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return n<0?n=Math.max(n,this.from-this.pos):0<n&&(n=Math.min(n,this.to-this.pos)),this.nextInner(n,this.cursor.dir)}},{key:"lineBreak",get:function t(){return this.cursor.lineBreak&&""!=this.value}}]),e}(),H=function(){function n(t){A(this,n),this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}return D(n,[{key:"next",value:function t(){var n,i,e,r,i,n,i=this.inner.next(0<arguments.length&&void 0!==arguments[0]?arguments[0]:0),e=i.done,r=i.lineBreak,i=i.value;return e?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}},{key:"lineBreak",get:function t(){return!1}}]),n}(),"undefined"!=typeof Symbol&&(k.prototype[Symbol.iterator]=function(){return this.iter()},N.prototype[Symbol.iterator]=U.prototype[Symbol.iterator]=H.prototype[Symbol.iterator]=function(){return this}),W=function(){function r(t,n,i,e){A(this,r),this.from=t,this.to=n,this.number=i,this.text=e}return D(r,[{key:"length",get:function t(){return this.to-this.from}}]),r}(),V="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}),$=1;$<V.length;$++)V[$]+=V[$-1];function vh(t){for(var n=1;n<V.length;n+=2)if(V[n]>t)return V[n-1]<=t}function dh(t){return 127462<=t&&t<=127487}function yh(t,n){var i,e,i,e;return(!(2<arguments.length&&void 0!==arguments[2])||arguments[2]?mh:ph)(t,n,!(3<arguments.length&&void 0!==arguments[3])||arguments[3])}function mh(t,n,i){var e,r,o,u;if(n!=t.length)for(n&&kh(t.charCodeAt(n))&&gh(t.charCodeAt(n-1))&&n--,n+=Mh(e=wh(t,n));n<t.length;)if(r=wh(t,n),e==q||r==q||i&&vh(r))n+=Mh(r),e=r;else{if(!dh(r))break;for(o=0,u=n-2;0<=u&&dh(wh(t,u));)o++,u-=2;if(o%2==0)break;n+=2}return n}function ph(t,n,i){for(;0<n;){var e=mh(t,n-2,i);if(e<n)return e;n--}return 0}function kh(t){return 56320<=t&&t<57344}function gh(t){return 55296<=t&&t<56320}function wh(t,n){var i,t,i=t.charCodeAt(n);return gh(i)&&n+1!=t.length&&kh(t=t.charCodeAt(n+1))?t-56320+(i-55296<<10)+65536:i}function bh(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function Mh(t){return t<65536?1:2}function xh(t,n,i,e){var e,r,e=3<arguments.length&&void 0!==e&&e;0==n&&i<=0||(0<=(r=t.length-2)&&i<=0&&i==t[1+r]?t[r]+=n:0==n&&0==t[r]?t[1+r]+=i:e?(t[r]+=n,t[1+r]+=i):t.push(n,i))}function Sh(t,n,i){if(0!=i.length){var e=n.length-2>>1;if(e<t.length)t[t.length-1]=t[t.length-1].append(i);else{for(;t.length<e;)t.push(k.empty);t.push(i)}}}function Ch(t,n,i){for(var e,r,o,u,s,a,f,h,c,e=t.inserted,r=0,o=0,u=0;u<t.sections.length;)if(s=t.sections[u++],(a=t.sections[u++])<0)r+=s,o+=s;else{for(f=r,h=o,c=k.empty;f+=s,h+=a,a&&e&&(c=c.append(e[u-2>>1])),!(i||u==t.sections.length||t.sections[u+1]<0);)s=t.sections[u++],a=t.sections[u++];n(r,f,o,h,c),r=f,o=h}}function jh(t,n,i,e){for(var r,o,u,s,a,f,h,c,l,v,d,y,r,o=[],u=3<arguments.length&&void 0!==e&&e?[]:null,s=new Q(t),a=new Q(n),f=-1;;)if(-1==s.ins&&-1==a.ins)xh(o,h=Math.min(s.len,a.len),-1),s.forward(h),a.forward(h);else if(0<=a.ins&&(s.ins<0||f==s.i||0==s.off&&(a.len<s.len||a.len==s.len&&!i))){for(c=a.len,xh(o,a.ins,-1);c;)l=Math.min(s.len,c),0<=s.ins&&f<s.i&&s.len<=l&&(xh(o,0,s.ins),u&&Sh(u,o,s.text),f=s.i),s.forward(l),c-=l;a.next()}else{if(!(0<=s.ins)){if(s.done&&a.done)return u?K.createSet(o,u):J.create(o);throw new Error("Mismatched change set lengths")}for(v=0,d=s.len;d;)if(-1==a.ins)v+=y=Math.min(d,a.len),d-=y,a.forward(y);else{if(!(0==a.ins&&a.len<d))break;d-=a.len,a.next()}xh(o,v,f<s.i?s.ins:0),u&&f<s.i&&Sh(u,o,s.text),f=s.i,s.forward(s.len-d)}}function Ph(t,n,i){for(var e,r,o,u,s,a,f,h,c,e,r=[],o=2<arguments.length&&void 0!==i&&i?[]:null,u=new Q(t),s=new Q(n),a=!1;;){if(u.done&&s.done)return o?K.createSet(r,o):J.create(r);if(0==u.ins)xh(r,u.len,0,a),u.next();else if(0!=s.len||s.done){if(u.done||s.done)throw new Error("Mismatched change set lengths");f=Math.min(u.len2,s.len),h=r.length,-1==u.ins?(xh(r,f,c=-1==s.ins?-1:s.off?0:s.ins,a),o&&c&&Sh(o,r,s.text)):-1==s.ins?(xh(r,u.off?0:u.len,f,a),o&&Sh(o,r,u.textBit(f))):(xh(r,u.off?0:u.len,s.off?0:s.ins,a),o&&!s.off&&Sh(o,r,s.text)),a=(u.ins>f||0<=s.ins&&s.len>f)&&(a||h<r.length),u.forward2(f),s.forward(f)}else xh(r,0,s.ins,a),o&&Sh(o,r,s.text),s.next()}}function Oh(t,n){var i,e,r,i=F(t.ranges);try{for(i.s();!(e=i.n()).done;)if((r=e.value).to>n)throw new RangeError("Selection points outside of document")}catch(t){i.e(t)}finally{i.f()}}function Eh(t,i){return t==i||t.length==i.length&&t.every(function(t,n){return t===i[n]})}function Ah(t,n,i){if(t.length==n.length){for(var e=0;e<t.length;e++)if(!i(t[e],n[e]))return;return 1}}function Dh(t,n){var i,e,r,o,i=!1,e=F(n);try{for(e.s();!(r=e.n()).done;)1&Lh(t,o=r.value)&&(i=!0)}catch(t){e.e(t)}finally{e.f()}return i}function Rh(n,s,o){var a,f,r,u;function h(t){for(var n,i,e,r,o,u,n=[],i=0;i<a.length;i++)if(e=Bh(t,a[i]),2==f[i]){r=F(e);try{for(r.s();!(o=r.n()).done;)u=o.value,n.push(u)}catch(t){r.e(t)}finally{r.f()}}else n.push(e);return s.combine(n)}return a=o.map(function(t){return n[t.id]}),f=o.map(function(t){return t.type}),r=a.filter(function(t){return!(1&t)}),u=n[s.id]>>1,{create:function t(n){var i,e,r,i=F(a);try{for(i.s();!(e=i.n()).done;)Lh(n,r=e.value)}catch(t){i.e(t)}finally{i.f()}return n.values[u]=h(n),1},update:function t(n,i){var e;return!Dh(n,r)||(e=h(n),s.compare(e,n.values[u]))?0:(n.values[u]=e,1)},reconfigure:function t(n,i){var e,r,i,e,e=Dh(n,a),r=i.config.facets[s.id],i=i.facet(s);return r&&!e&&Eh(o,r)||(e=h(n),s.compare(e,i))?(n.values[u]=i,0):(n.values[u]=e,1)}}}function Ih(n){return function(t){return new at(t,n)}}function Th(t,s,a){var f,h;function c(t,n){var i,e,r,o,u,i,e,i=h.get(t);if(null!=i){if(i<=n)return;-1<(e=f[i].indexOf(t))&&f[i].splice(e,1),t instanceof ht&&a.delete(t.compartment)}if(h.set(t,n),Array.isArray(t)){r=F(t);try{for(r.s();!(o=r.n()).done;)c(u=o.value,n)}catch(t){r.e(t)}finally{r.f()}}else if(t instanceof ht){if(a.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");i=s.get(t.compartment)||t.inner,a.set(t.compartment,i),c(i,n)}else if(t instanceof at)c(t.inner,t.prec);else if(t instanceof b)f[n].push(t),t.provides&&c(t.provides,n);else if(t instanceof Y)f[n].push(t),t.facet.extensions&&c(t.facet.extensions,rt);else{if(!(e=t.extension))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."));c(e,n)}}return f=[[],[],[],[],[]],h=new Map,c(t,rt),f.reduce(function(t,n){return t.concat(n)})}function Lh(t,n){var n,i,i;if(1&n)return 2;if(4==(i=t.status[n=n>>1]))throw new Error("Cyclic dependency between fields and/or facets");return 2&i?i:(t.status[n]=4,i=t.computeSlot(t,t.config.dynamicSlots[n]),t.status[n]=2|i)}function Bh(t,n){return(1&n?t.config.staticValues:t.values)[n>>1]}function _h(t,n){for(var i,e,r,o,u,i=[],e=0,r=0;;){if(u=o=void 0,e<t.length&&(r==n.length||n[r]>=t[e]))o=t[e++],u=t[e++];else{if(!(r<n.length))return i;o=n[r++],u=n[r++]}!i.length||i[i.length-1]<o?i.push(o,u):i[i.length-1]<u&&(i[i.length-1]=u)}}function Fh(t,n,i){var i,e,r,i,i=i?(e=n.changes,r=K.empty(n.changes.length),t.changes.compose(n.changes)):(e=n.changes.map(t.changes),r=t.changes.mapDesc(n.changes,!0),t.changes.compose(e));return{changes:i,selection:n.selection?n.selection.map(r):null==(i=t.selection)?void 0:i.map(e),effects:v.mapEffects(t.effects,e).concat(v.mapEffects(n.effects,r)),annotations:t.annotations.length?t.annotations.concat(n.annotations):n.annotations,scrollIntoView:t.scrollIntoView||n.scrollIntoView}}function Nh(t,n,i){var e=n.selection,r=Wh(n.annotations);return n.userEvent&&(r=r.concat(Mt.userEvent.of(n.userEvent))),{changes:n.changes instanceof K?n.changes:K.of(n.changes||[],i,t.facet(dt)),selection:e&&(e instanceof O?e:O.single(e.anchor,e.head)),effects:Wh(n.effects),annotations:r,scrollIntoView:!!n.scrollIntoView}}function Uh(t,n,i){var e,r,o,u,e=Nh(t,n.length?n[0]:{},t.doc.length);for(n.length&&!1===n[0].filter&&(i=!1),r=1;r<n.length;r++)!1===n[r].filter&&(i=!1),o=!!n[r].sequential,e=Fh(e,Nh(t,n[r],o?e.changes.newLength:t.doc.length),o);return u=Mt.create(t,e.changes,e.selection,e.effects,e.annotations,e.scrollIntoView),zh(i?Hh(u):u)}function Hh(t){var n,i,e,r,o,u,s,a,f,h,c,l,n=t.startState,i=!0,e=F(n.facet(yt));try{for(e.s();!(r=e.n()).done;){if(!1===(u=(o=r.value)(t))){i=!1;break}Array.isArray(u)&&(i=!0===i?u:_h(i,u))}}catch(t){e.e(t)}finally{e.f()}for(!0!==i&&(!1===i?(a=t.changes.invertedDesc,s=K.empty(n.doc.length)):(s=(f=t.changes.filter(i)).changes,a=f.filtered.mapDesc(f.changes).invertedDesc),t=Mt.create(n,s,t.selection&&t.selection.map(a),v.mapEffects(t.effects,a),t.annotations,t.scrollIntoView)),c=(h=n.facet(mt)).length-1;0<=c;c--)t=(l=h[c](t))instanceof Mt?l:Array.isArray(l)&&1==l.length&&l[0]instanceof Mt?l[0]:Uh(n,Wh(l),!1);return t}function zh(t){for(var n,i,e,r,o,n=t.startState,i=n.facet(pt),e=t,r=i.length-1;0<=r;r--)(o=i[r](t))&&Object.keys(o).length&&(e=Fh(e,Nh(n,o,t.changes.newLength),!0));return e==t?t:Mt.create(n,t.changes,t.selection,e.effects,e.annotations,e.scrollIntoView)}function Wh(t){return null==t?xt:Array.isArray(t)?t:[t]}q=8205,G=/\r\n?|\n/,h=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(h=h||{}),K=function(t){f(y,t);var i=S(y);function y(t,n){var t;return A(this,y),(t=i.call(this,t)).inserted=n,t}return D(y,[{key:"apply",value:function t(o){if(this.length!=o.length)throw new RangeError("Applying change set to a document with the wrong length");return Ch(this,function(t,n,i,e,r){o=o.replace(i,i+(n-t),r)},!1),o}},{key:"mapDesc",value:function t(n){var i;return jh(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"invert",value:function t(n){for(var i,e,r,o,u,s,a,i=this.sections.slice(),e=[],r=0,o=0;r<i.length;r+=2){if(u=i[r],0<=(s=i[r+1])){for(i[r]=s,i[r+1]=u,a=r>>1;e.length<a;)e.push(k.empty);e.push(u?n.slice(o,o+u):k.empty)}o+=u}return new y(i,e)}},{key:"compose",value:function t(n){return this.empty?n:n.empty?this:Ph(this,n,!0)}},{key:"map",value:function t(n){var i;return n.empty?this:jh(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"iterChanges",value:function t(n){var i;Ch(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1])}},{key:"desc",get:function t(){return J.create(this.sections)}},{key:"filter",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,i=[],e=[],r=[],o=new Q(this);t:for(u=0,s=0;;){for(a=u==n.length?1e9:n[u++];s<a||s==a&&0==o.len;){if(o.done)break t;xh(r,f=Math.min(o.len,a-s),-1),xh(i,f,h=-1==o.ins?-1:0==o.off?o.ins:0),0<h&&Sh(e,i,o.text),o.forward(f),s+=f}for(c=n[u++];s<c;){if(o.done)break t;xh(i,l=Math.min(o.len,c-s),-1),xh(r,l,-1==o.ins?-1:0==o.off?o.ins:0),o.forward(l),s+=l}}return{changes:new y(i,e),filtered:J.create(r)}}},{key:"toJSON",value:function t(){for(var n,i,e,r,n=[],i=0;i<this.sections.length;i+=2)e=this.sections[i],r=this.sections[i+1],n.push(r<0?e:0==r?[e]:[e].concat(this.inserted[i>>1].toJSON()));return n}}],[{key:"of",value:function t(n,s,a){var f,h,c,l;function v(t){var n,t,n;(0<arguments.length&&void 0!==t&&t||f.length)&&(c<s&&xh(f,s-c,-1),t=new y(f,h),l=l?l.compose(t.map(l)):t,f=[],h=[],c=0)}function d(t){var n,i,e,r,o,o,t,t,u;if(Array.isArray(t)){n=F(t);try{for(n.s();!(i=n.n()).done;)d(e=i.value)}catch(t){n.e(t)}finally{n.f()}}else if(t instanceof y){if(t.length!=s)throw new RangeError("Mismatched change set length (got ".concat(t.length,", expected ").concat(s,")"));v(),l=l?l.compose(t.map(l)):t}else{if(r=t.from,o=t.to,t=t.insert,(o=void 0===o?r:o)<r||r<0||s<o)throw new RangeError("Invalid change range ".concat(r," to ").concat(o," (in doc of length ").concat(s,")"));u=(t=t?"string"==typeof t?k.of(t.split(a||G)):t:k.empty).length,r==o&&0==u||(r<c&&v(),c<r&&xh(f,r-c,-1),xh(f,o-r,u),Sh(h,f,t),c=o)}}return f=[],h=[],c=0,l=null,d(n),v(!l),l}},{key:"empty",value:function t(n){return new y(n?[n,-1]:[],[])}},{key:"fromJSON",value:function t(n){var i,e,r,o;if(!Array.isArray(n))throw new RangeError("Invalid JSON representation of ChangeSet");for(i=[],e=[],r=0;r<n.length;r++)if("number"==typeof(o=n[r]))i.push(o,-1);else{if(!Array.isArray(o)||"number"!=typeof o[0]||o.some(function(t,n){return n&&"string"!=typeof t}))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==o.length)i.push(o[0],0);else{for(;e.length<r;)e.push(k.empty);e[r]=k.of(o.slice(1)),i.push(o[0],e[r].length)}}return new y(i,e)}},{key:"createSet",value:function t(n,i){return new y(n,i)}}]),y}(J=function(){function o(t){A(this,o),this.sections=t}return D(o,[{key:"length",get:function t(){for(var n,i,n=0,i=0;i<this.sections.length;i+=2)n+=this.sections[i];return n}},{key:"newLength",get:function t(){for(var n,i,e,n=0,i=0;i<this.sections.length;i+=2)n+=(e=this.sections[i+1])<0?this.sections[i]:e;return n}},{key:"empty",get:function t(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}},{key:"iterGaps",value:function t(n){for(var i,e,r,o,u,i=0,e=0,r=0;i<this.sections.length;)o=this.sections[i++],(u=this.sections[i++])<0?(n(e,r,o),r+=o):r+=u,e+=o}},{key:"iterChangedRanges",value:function t(n){var i;Ch(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1])}},{key:"invertedDesc",get:function t(){for(var n,i,e,r,n=[],i=0;i<this.sections.length;)e=this.sections[i++],(r=this.sections[i++])<0?n.push(e,r):n.push(r,e);return new o(n)}},{key:"composeDesc",value:function t(n){return this.empty?n:n.empty?this:Ph(this,n)}},{key:"mapDesc",value:function t(n){var i;return n.empty?this:jh(this,n,1<arguments.length&&void 0!==arguments[1]&&arguments[1])}},{key:"mapPos",value:function t(n){for(var i,e,r,o,u,s,a,f,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:h.Simple,r=0,o=0,u=0;u<this.sections.length;){if(f=r+(s=this.sections[u++]),(a=this.sections[u++])<0){if(n<f)return o+(n-r);o+=s}else{if(e!=h.Simple&&n<=f&&(e==h.TrackDel&&r<n&&n<f||e==h.TrackBefore&&r<n||e==h.TrackAfter&&n<f))return null;if(n<f||f==n&&i<0&&!s)return n==r||i<0?o:o+a;o+=a}r=f}if(r<n)throw new RangeError("Position ".concat(n," is out of range for changeset of length ").concat(r));return o}},{key:"touchesRange",value:function t(n){for(var i,e,r,o,u,s,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n,e=0,r=0;e<this.sections.length&&r<=i;){if(s=r+(o=this.sections[e++]),0<=(u=this.sections[e++])&&r<=i&&n<=s)return!(r<n&&i<s)||"cover";r=s}return!1}},{key:"toString",value:function t(){for(var n,i,e,r,n="",i=0;i<this.sections.length;)n+=(n?" ":"")+(e=this.sections[i++])+(0<=(r=this.sections[i++])?":"+r:"");return n}},{key:"toJSON",value:function t(){return this.sections}}],[{key:"fromJSON",value:function t(n){if(!Array.isArray(n)||n.length%2||n.some(function(t){return"number"!=typeof t}))throw new RangeError("Invalid JSON representation of ChangeDesc");return new o(n)}},{key:"create",value:function t(n){return new o(n)}}]),o}()),Q=function(){function n(t){A(this,n),this.set=t,this.i=0,this.next()}return D(n,[{key:"next",value:function t(){var n=this.set.sections;this.i<n.length?(this.len=n[this.i++],this.ins=n[this.i++]):(this.len=0,this.ins=-2),this.off=0}},{key:"done",get:function t(){return-2==this.ins}},{key:"len2",get:function t(){return this.ins<0?this.len:this.ins}},{key:"text",get:function t(){var n=this.set.inserted,i=this.i-2>>1;return i>=n.length?k.empty:n[i]}},{key:"textBit",value:function t(n){var i=this.set.inserted,e=this.i-2>>1;return e>=i.length&&!n?k.empty:i[e].slice(this.off,null==n?void 0:this.off+n)}},{key:"forward",value:function t(n){n==this.len?this.next():(this.len-=n,this.off+=n)}},{key:"forward2",value:function t(n){-1==this.ins?this.forward(n):n==this.ins?this.next():(this.ins-=n,this.off+=n)}}]),n}(),X=function(){function o(t,n,i){A(this,o),this.from=t,this.to=n,this.flags=i}return D(o,[{key:"anchor",get:function t(){return 16&this.flags?this.to:this.from}},{key:"head",get:function t(){return 16&this.flags?this.from:this.to}},{key:"empty",get:function t(){return this.from==this.to}},{key:"assoc",get:function t(){return 4&this.flags?-1:8&this.flags?1:0}},{key:"bidiLevel",get:function t(){var n=3&this.flags;return 3==n?null:n}},{key:"goalColumn",get:function t(){var n=this.flags>>5;return 33554431==n?void 0:n}},{key:"map",value:function t(n){var i,e,r,i;return this.empty?e=r=n.mapPos(this.from,1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1):(e=n.mapPos(this.from,1),r=n.mapPos(this.to,-1)),e==this.from&&r==this.to?this:new o(e,r,this.flags)}},{key:"extend",value:function t(n){var i,n,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;return n<=this.anchor&&i>=this.anchor?O.range(n,i):(n=Math.abs(n-this.anchor)>Math.abs(i-this.anchor)?n:i,O.range(this.anchor,n))}},{key:"eq",value:function t(n){return this.anchor==n.anchor&&this.head==n.head}},{key:"toJSON",value:function t(){return{anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function t(n){if(n&&"number"==typeof n.anchor&&"number"==typeof n.head)return O.range(n.anchor,n.head);throw new RangeError("Invalid JSON representation for SelectionRange")}},{key:"create",value:function t(n,i,e){return new o(n,i,e)}}]),o}(),O=function(){function a(t,n){A(this,a),this.ranges=t,this.mainIndex=n}return D(a,[{key:"map",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1;return n.empty?this:a.create(this.ranges.map(function(t){return t.map(n,i)}),this.mainIndex)}},{key:"eq",value:function t(n){if(this.ranges.length!=n.ranges.length||this.mainIndex!=n.mainIndex)return!1;for(var i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(n.ranges[i]))return!1;return!0}},{key:"main",get:function t(){return this.ranges[this.mainIndex]}},{key:"asSingle",value:function t(){return 1==this.ranges.length?this:new a([this.main],0)}},{key:"addRange",value:function t(n){var i=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];return a.create([n].concat(this.ranges),i?0:this.mainIndex+1)}},{key:"replaceRange",value:function t(n){var i,e,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.mainIndex,e=this.ranges.slice();return e[i]=n,a.create(e,this.mainIndex)}},{key:"toJSON",value:function t(){return{ranges:this.ranges.map(function(t){return t.toJSON()}),main:this.mainIndex}}}],[{key:"fromJSON",value:function t(n){if(!n||!Array.isArray(n.ranges)||"number"!=typeof n.main||n.main>=n.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new a(n.ranges.map(function(t){return X.fromJSON(t)}),n.main)}},{key:"single",value:function t(n){var i;return new a([a.range(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:n)],0)}},{key:"create",value:function t(n){var i,e,r,o,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;if(0==n.length)throw new RangeError("A selection needs at least one range");for(r=e=0;r<n.length;r++){if((o=n[r]).empty?o.from<=e:o.from<e)return a.normalized(n.slice(),i);e=o.to}return new a(n,i)}},{key:"cursor",value:function t(n){var i,e,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length?arguments[2]:void 0,r=3<arguments.length?arguments[3]:void 0;return X.create(n,n,(0==i?0:i<0?4:8)|(null==e?3:Math.min(2,e))|(null!=r?r:33554431)<<5)}},{key:"range",value:function t(n,i,e,r){var e=(null!=e?e:33554431)<<5|(null==r?3:Math.min(2,r));return i<n?X.create(i,n,24|e):X.create(n,i,(n<i?4:0)|e)}},{key:"normalized",value:function t(n){var i,e,r,o,u,s,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=n[i];for(n.sort(function(t,n){return t.from-n.from}),i=n.indexOf(e),r=1;r<n.length;r++)o=n[r],u=n[r-1],(o.empty?o.from<=u.to:o.from<u.to)&&(s=u.from,u=Math.max(o.to,u.to),r<=i&&i--,n.splice(--r,2,o.anchor>o.head?a.range(u,s):a.range(s,u)));return new a(n,i)}}]),a}(),Z=0,y=function(){function o(t,n,i,e,r){A(this,o),this.combine=t,this.compareInput=n,this.compare=i,this.isStatic=e,this.id=Z++,this.default=t([]),this.extensions="function"==typeof r?r(this):r}return D(o,[{key:"of",value:function t(n){return new Y([],this,0,n)}},{key:"compute",value:function t(n,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Y(n,this,1,i)}},{key:"computeN",value:function t(n,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new Y(n,this,2,i)}},{key:"from",value:function t(n,i){return i=i||function t(n){return n},this.compute([n],function(t){return i(t.field(n))})}}],[{key:"define",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return new o(n.combine||function(t){return t},n.compareInput||function(t,n){return t===n},n.compare||(n.combine?function(t,n){return t===n}:Eh),!!n.static,n.enables)}}]),o}(),Y=function(){function r(t,n,i,e){A(this,r),this.dependencies=t,this.facet=n,this.type=i,this.value=e,this.id=Z++}return D(r,[{key:"dynamicSlot",value:function t(n){var o,i,u,s,a,f,h,e,r,c,l,v,d,o=this,u=this.value,s=this.facet.compareInput,a=this.id,f=n[a]>>1,h=2==this.type,e=!1,r=!1,c=[],l=F(this.dependencies);try{for(l.s();!(v=l.n()).done;)"doc"==(d=v.value)?e=!0:"selection"==d?r=!0:0==(1&(null!=(i=n[d.id])?i:1))&&c.push(n[d.id])}catch(t){l.e(t)}finally{l.f()}return{create:function t(n){return n.values[f]=u(n),1},update:function t(n,i){if(e&&i.docChanged||r&&(i.docChanged||i.selection)||Dh(n,c)){var i=u(n);if(h?!Ah(i,n.values[f],s):!s(i,n.values[f]))return n.values[f]=i,1}return 0},reconfigure:function t(n,i){var e,r,r,r=i.config.address[a];if(null!=r){if(r=Bh(i,r),o.dependencies.every(function(t){return t instanceof y?i.facet(t)===n.facet(t):!(t instanceof b)||i.field(t,!1)==n.field(t,!1)})||(h?Ah(e=u(n),r,s):s(e=u(n),r)))return n.values[f]=r,0}else e=u(n);return n.values[f]=e,1}}}}]),r}(),tt=y.define({static:!0}),b=function(){function o(t,n,i,e,r){A(this,o),this.id=t,this.createF=n,this.updateF=i,this.compareF=e,this.spec=r,this.provides=void 0}return D(o,[{key:"create",value:function t(n){var i,e,i=this,e=n.facet(tt).find(function(t){return t.field==i});return((null==e?void 0:e.create)||this.createF)(n)}},{key:"slot",value:function t(n){var r,o,r=this,o=n[this.id]>>1;return{create:function t(n){return n.values[o]=r.create(n),1},update:function t(n,i){var e,i,e=n.values[o],i=r.updateF(e,i);return r.compareF(e,i)?0:(n.values[o]=i,1)},reconfigure:function t(n,i){return null!=i.config.address[r.id]?(n.values[o]=i.field(r),0):(n.values[o]=r.create(n),1)}}}},{key:"init",value:function t(n){return[this,tt.of({field:this,create:n})]}},{key:"extension",get:function t(){return this}}],[{key:"define",value:function t(n){var i=new o(Z++,n.create,n.update,n.compare||function(t,n){return t===n},n);return n.provide&&(i.provides=n.provide(i)),i}}]),o}(),st={highest:Ih(ut=0),high:Ih(ot=1),default:Ih(rt=2),low:Ih(et=3),lowest:Ih(it=4)},at=D(function t(n,i){A(this,t),this.inner=n,this.prec=i}),ft=function(){function i(){A(this,i)}return D(i,[{key:"of",value:function t(n){return new ht(this,n)}},{key:"reconfigure",value:function t(n){return i.reconfigure.of({compartment:this,extension:n})}},{key:"get",value:function t(n){return n.config.compartments.get(this)}}]),i}(),ht=D(function t(n,i){A(this,t),this.compartment=n,this.inner=i}),ct=function(){function w(t,n,i,e,r,o){for(A(this,w),this.base=t,this.compartments=n,this.dynamicSlots=i,this.address=e,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}return D(w,[{key:"staticFacet",value:function t(n){var i=this.address[n.id];return null==i?n.default:this.staticValues[i>>1]}}],[{key:"resolve",value:function t(n,i,s){var e,a,r,o,u,f,h,c,l,v,d,y,m,p,k,g,e=[],a=Object.create(null),r=new Map,o=F(Th(n,i,r));try{for(o.s();!(u=o.n()).done;)((f=u.value)instanceof b?e:a[f.facet.id]||(a[f.facet.id]=[])).push(f)}catch(t){o.e(t)}finally{o.f()}for(h=Object.create(null),c=[],l=[],v=function t(){var n=y[d];h[n.id]=l.length<<1,l.push(function(t){return n.slot(t)})},d=0,y=e;d<y.length;d++)v();for(k in m=null==s?void 0:s.config.facets,p=function t(){var n,i,e,e,r,o,u,n=a[k],i=n[0].facet,e=m&&m[k]||[];if(n.every(function(t){return 0==t.type}))h[i.id]=c.length<<1|1,Eh(e,n)?c.push(s.facet(i)):(e=i.combine(n.map(function(t){return t.value})),c.push(s&&i.compare(e,s.facet(i))?s.facet(i):e));else{r=F(n);try{for(u=function t(){var n=o.value;0==n.type?(h[n.id]=c.length<<1|1,c.push(n.value)):(h[n.id]=l.length<<1,l.push(function(t){return n.dynamicSlot(t)}))},r.s();!(o=r.n()).done;)u()}catch(t){r.e(t)}finally{r.f()}h[i.id]=l.length<<1,l.push(function(t){return Rh(t,i,n)})}},a)p();return new w(n,r,g=l.map(function(t){return t(h)}),h,c,a)}}]),w}(),lt=y.define(),vt=y.define({combine:function t(n){return n.some(function(t){return t})},static:!0}),dt=y.define({combine:function t(n){return n.length?n[0]:void 0},static:!0}),yt=y.define(),mt=y.define(),pt=y.define(),kt=y.define({combine:function t(n){return!!n.length&&n[0]}}),gt=function(){function i(t,n){A(this,i),this.type=t,this.value=n}return D(i,null,[{key:"define",value:function t(){return new wt}}]),i}(),wt=function(){function t(){A(this,t)}return D(t,[{key:"of",value:function t(n){return new gt(this,n)}}]),t}(),bt=function(){function n(t){A(this,n),this.map=t}return D(n,[{key:"of",value:function t(n){return new v(this,n)}}]),n}(),(v=function(){function i(t,n){A(this,i),this.type=t,this.value=n}return D(i,[{key:"map",value:function t(n){var n=this.type.map(this.value,n);return void 0===n?void 0:n==this.value?this:new i(this.type,n)}},{key:"is",value:function t(n){return this.type==n}}],[{key:"define",value:function t(){var n;return new bt((0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).map||function(t){return t})}},{key:"mapEffects",value:function t(n,i){var e,r,o,u,s;if(!n.length)return n;e=[],r=F(n);try{for(r.s();!(o=r.n()).done;)(s=(u=o.value).map(i))&&e.push(s)}catch(t){r.e(t)}finally{r.f()}return e}}]),i}()).reconfigure=v.define(),v.appendConfig=v.define(),(Mt=function(){function s(t,n,i,e,r,o){A(this,s),this.startState=t,this.changes=n,this.selection=i,this.effects=e,this.annotations=r,this.scrollIntoView=o,this.Qae=null,this.Kh=null,i&&Oh(i,n.newLength),r.some(function(t){return t.type==s.time})||(this.annotations=r.concat(s.time.of(Date.now())))}return D(s,[{key:"newDoc",get:function t(){return this.Qae||(this.Qae=this.changes.apply(this.startState.doc))}},{key:"newSelection",get:function t(){return this.selection||this.startState.selection.map(this.changes)}},{key:"state",get:function t(){return this.Kh||this.startState.applyTransaction(this),this.Kh}},{key:"annotation",value:function t(n){var i,e,r,i=F(this.annotations);try{for(i.s();!(e=i.n()).done;)if((r=e.value).type==n)return r.value}catch(t){i.e(t)}finally{i.f()}}},{key:"docChanged",get:function t(){return!this.changes.empty}},{key:"reconfigured",get:function t(){return this.startState.config!=this.state.config}},{key:"isUserEvent",value:function t(n){var i=this.annotation(s.userEvent);return!(!i||!(i==n||i.length>n.length&&i.slice(0,n.length)==n&&"."==i[n.length]))}}],[{key:"create",value:function t(n,i,e,r,o,u){return new s(n,i,e,r,o,u)}}]),s}()).time=gt.define(),Mt.userEvent=gt.define(),Mt.addToHistory=gt.define(),Mt.remote=gt.define(),xt=[],l=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(l=l||{}),St=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{Ct=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}function Vh(t){var n,i;if(Ct)return Ct.test(t);for(n=0;n<t.length;n++)if(i=t[n],/\w/.test(i)||"\x80"<i&&(i.toUpperCase()!=i.toLowerCase()||St.test(i)))return 1}function $h(i){return function(t){if(!/\S/.test(t))return l.Space;if(Vh(t))return l.Word;for(var n=0;n<i.length;n++)if(-1<t.indexOf(i[n]))return l.Word;return l.Other}}function qh(t,n){var i,e,r,o,u,s,a,f,h,c,l,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},e={},r=F(t);try{for(r.s();!(o=r.n()).done;)for(u=o.value,s=0,a=Object.keys(u);s<a.length;s++)if(h=u[f=a[s]],void 0===(c=e[f]))e[f]=h;else if(c!==h&&void 0!==h){if(!Object.hasOwnProperty.call(i,f))throw new Error("Config merge conflict for field "+f);e[f]=i[f](c,h)}}catch(t){r.e(t)}finally{r.f()}for(l in n)void 0===e[l]&&(e[l]=n[l]);return e}function Gh(t,n){return t.from-n.from||t.value.startSide-n.value.startSide}function Jh(t){var n,i,e;if(1<t.length)for(n=t[0],i=1;i<t.length;i++){if(0<Gh(n,e=t[i]))return t.slice().sort(Gh);n=e}return t}function Kh(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,e=new Map,r=F(t);try{for(r.s();!(o=r.n()).done;)for(u=o.value,s=0;s<u.chunk.length;s++)u.chunk[s].maxPoint<=0&&e.set(u.chunk[s],u.chunkPos[s])}catch(t){r.e(t)}finally{r.f()}a=new Set,f=F(n);try{for(f.s();!(h=f.n()).done;)for(c=h.value,l=0;l<c.chunk.length;l++)null==(v=e.get(c.chunk[l]))||(i?i.mapPos(v):v)!=c.chunkPos[l]||null!=i&&i.touchesRange(v,v+c.chunk[l].length)||a.add(c.chunk[l])}catch(t){f.e(t)}finally{f.f()}return a}function Qh(t,n){for(var i,e,r,i=t[n];!((e=1+(n<<1))>=t.length||(r=t[e],e+1<t.length&&0<=r.compare(t[e+1])&&(r=t[e+1],e++),i.compare(r)<0));)t[e]=i,t[n]=r,n=e}function Xh(t,n,i,e,r,o){var u,s,a,f,h,c;for(t.goto(n),i.goto(e),u=e+r,a=(s=e)-n;h=(f=t.to+a-i.to||t.endSide-i.endSide)<0?t.to+a:i.to,c=Math.min(h,u),t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&Zh(t.activeForPoint(t.to),i.activeForPoint(i.to))||o.comparePoint(s,c,t.point,i.point):s<c&&!Zh(t.active,i.active)&&o.compareRange(s,c,t.active,i.active),!(u<h);)s=h,f<=0&&t.next(),0<=f&&i.next()}function Zh(t,n){if(t.length==n.length){for(var i=0;i<t.length;i++)if(t[i]!=n[i]&&!t[i].eq(n[i]))return;return 1}}function Yh(t,n){for(var i=n,e=t.length-1;i<e;i++)t[i]=t[i+1];t.pop()}function tc(t,n,i){for(var e=t.length-1;n<=e;e--)t[e+1]=t[e];t[n]=i}function nc(t,n){for(var i,e,r,i=-1,e=1e9,r=0;r<n.length;r++)(n[r]-e||t[r].endSide-t[i].endSide)<0&&(e=n[i=r]);return i}function ic(t,n){for(var i,e,r,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:t.length,e=0,r=0;r<i;)9==t.charCodeAt(r)?(e+=n-e%n,r++):(e++,r=yh(t,r));return e}function ec(t,n,i,e){for(var r=0,o=0;;){if(n<=o)return r;if(r==t.length)break;o+=9==t.charCodeAt(r)?i-o%i:1,r=yh(t,r)}return!0===e?-1:t.length}for((C=function(){function c(t,n,i,e,r,o){A(this,c),this.config=t,this.doc=n,this.selection=i,this.values=e,this.status=t.statusTemplate.slice(),this.computeSlot=r,o&&(o.Kh=this);for(var u=0;u<this.config.dynamicSlots.length;u++)Lh(this,u<<1);this.computeSlot=null}return D(c,[{key:"field",value:function t(n){var i,n,i=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=this.config.address[n.id];if(null!=n)return Lh(this,n),Bh(this,n);if(i)throw new RangeError("Field is not present in this state")}},{key:"update",value:function t(){for(var n=arguments.length,i=new Array(n),e=0;e<n;e++)i[e]=arguments[e];return Uh(this,i,!0)}},{key:"applyTransaction",value:function t(i){var e,n,r,o,u,s,a,f,r,h,e=this,n=this.config,r=n,o=r.base,u=r.compartments,s=F(i.effects);try{for(s.s();!(a=s.n()).done;)(f=a.value).is(ft.reconfigure)?(n&&(u=new Map,n.compartments.forEach(function(t,n){return u.set(n,t)}),n=null),u.set(f.value.compartment,f.value.extension)):f.is(v.reconfigure)?(n=null,o=f.value):f.is(v.appendConfig)&&(n=null,o=Wh(o).concat(f.value))}catch(t){s.e(t)}finally{s.f()}r=n?i.startState.values.slice():(h=new c(n=ct.resolve(o,u,this),this.doc,this.selection,n.dynamicSlots.map(function(){return null}),function(t,n){return n.reconfigure(t,e)},null)).values,new c(n,i.newDoc,i.newSelection,r,function(t,n){return n.update(t,i)},i)}},{key:"replaceSelection",value:function t(n){return"string"==typeof n&&(n=this.toText(n)),this.changeByRange(function(t){return{changes:{from:t.from,to:t.to,insert:n},range:O.cursor(t.from+n.length)}})}},{key:"changeByRange",value:function t(n){for(var i,e,r,o,u,s,a,f,h,c,f,i=this.selection,e=n(i.ranges[0]),r=this.changes(e.changes),o=[e.range],u=Wh(e.effects),s=1;s<i.ranges.length;s++){for(a=n(i.ranges[s]),h=(f=this.changes(a.changes)).map(r),c=0;c<s;c++)o[c]=o[c].map(h);f=r.mapDesc(f,!0),o.push(a.range.map(f)),r=r.compose(h),u=v.mapEffects(u,h).concat(v.mapEffects(Wh(a.effects),f))}return{changes:r,selection:O.create(o,i.mainIndex),effects:u}}},{key:"changes",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return n instanceof K?n:K.of(n,this.doc.length,this.facet(c.lineSeparator))}},{key:"toText",value:function t(n){return k.of(n.split(this.facet(c.lineSeparator)||G))}},{key:"sliceDoc",value:function t(){var n,i,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this.doc.length;return this.doc.sliceString(n,i,this.lineBreak)}},{key:"facet",value:function t(n){var i=this.config.address[n.id];return null==i?n.default:(Lh(this,i),Bh(this,i))}},{key:"toJSON",value:function t(n){var i,e,r,i={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(n)for(e in n)(r=n[e])instanceof b&&null!=this.config.address[r.id]&&(i[e]=r.spec.toJSON(this.field(n[e]),this));return i}},{key:"tabSize",get:function t(){return this.facet(c.tabSize)}},{key:"lineBreak",get:function t(){return this.facet(c.lineSeparator)||"\n"}},{key:"readOnly",get:function t(){return this.facet(kt)}},{key:"phrase",value:function t(n){for(var i,e,r,o,u,s,i=arguments.length,e=new Array(1<i?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];o=F(this.facet(c.phrases));try{for(o.s();!(u=o.n()).done;)if(s=u.value,Object.prototype.hasOwnProperty.call(s,n)){n=s[n];break}}catch(t){o.e(t)}finally{o.f()}return n=e.length?n.replace(/\$(\$|\d*)/g,function(t,n){var n;return"$"==n?"$":!(n=+(n||1))||n>e.length?t:e[n-1]}):n}},{key:"languageDataAt",value:function t(n,i){var e,r,o,u,s,a,f,h,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=F(this.facet(lt));try{for(o.s();!(u=o.n()).done;){a=F((s=u.value)(this,i,e));try{for(a.s();!(f=a.n()).done;)h=f.value,Object.prototype.hasOwnProperty.call(h,n)&&r.push(h[n])}catch(t){a.e(t)}finally{a.f()}}}catch(t){o.e(t)}finally{o.f()}return r}},{key:"charCategorizer",value:function t(n){return $h(this.languageDataAt("wordChars",n).join(""))}},{key:"wordAt",value:function t(n){for(var i,e,r,o,u,s,a,f,h,i=this.doc.lineAt(n),e=i.text,r=i.from,o=i.length,u=this.charCategorizer(n),s=n-r,a=n-r;0<s&&(f=yh(e,s,!1),u(e.slice(f,s))==l.Word);)s=f;for(;a<o&&(h=yh(e,a),u(e.slice(a,h))==l.Word);)a=h;return s==a?null:O.range(s+r,a+r)}}],[{key:"fromJSON",value:function t(e){var n,r,o,i,u,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length?arguments[2]:void 0;if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");if(o=[],r)for(u in i=function t(){var n,i;Object.prototype.hasOwnProperty.call(e,u)&&(n=r[u],i=e[u],o.push(n.init(function(t){return n.spec.fromJSON(i,t)})))},r)i();return c.create({doc:e.doc,selection:O.fromJSON(e.selection),extensions:n.extensions?o.concat([n.extensions]):o})}},{key:"create",value:function t(){var n,i,e,n,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=ct.resolve(n.extensions||[],new Map),e=n.doc instanceof k?n.doc:k.of((n.doc||"").split(i.staticFacet(c.lineSeparator)||G)),n=n.selection?n.selection instanceof O?n.selection:O.single(n.selection.anchor,n.selection.head):O.single(0);return Oh(n,e.length),i.staticFacet(vt)||(n=n.asSingle()),new c(i,e,n,i.dynamicSlots.map(function(){return null}),function(t,n){return n.create(t)},null)}}]),c}()).allowMultipleSelections=vt,C.tabSize=y.define({combine:function t(n){return n.length?n[0]:4}}),C.lineSeparator=dt,C.readOnly=kt,C.phrases=y.define({compare:function t(n,i){var e=Object.keys(n),r=Object.keys(i);return e.length==r.length&&e.every(function(t){return n[t]==i[t]})}}),C.languageData=lt,C.changeFilter=yt,C.transactionFilter=mt,C.transactionExtender=pt,ft.reconfigure=v.define(),(jt=function(){function t(){A(this,t)}return D(t,[{key:"eq",value:function t(n){return this==n}},{key:"range",value:function t(n){var i;return Pt.create(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:n,this)}}]),t}()).prototype.startSide=jt.prototype.endSide=0,jt.prototype.point=!1,jt.prototype.mapMode=h.TrackDel,Pt=function(){function r(t,n,i){A(this,r),this.from=t,this.to=n,this.value=i}return D(r,null,[{key:"create",value:function t(n,i,e){return new r(n,i,e)}}]),r}(),Ot=function(){function y(t,n,i,e){A(this,y),this.from=t,this.to=n,this.value=i,this.maxPoint=e}return D(y,[{key:"length",get:function t(){return this.to[this.to.length-1]}},{key:"findIndex",value:function t(n,i,e){for(var r,o,u,s,a,f,r,o=e?this.to:this.from,u=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,s=o.length;;){if(u==s)return u;if(f=o[a=u+s>>1]-n||(e?this.value[a].endSide:this.value[a].startSide)-i,a==u)return 0<=f?u:s;0<=f?s=a:u=1+a}}},{key:"between",value:function t(n,i,e,r){for(var o=this.findIndex(i,-1e9,!0),u=this.findIndex(e,1e9,!1,o);o<u;o++)if(!1===r(this.from[o]+n,this.to[o]+n,this.value[o]))return!1}},{key:"map",value:function t(n,i){for(var e,r,o,u,s,a,f,h,c,l,v,d,e=[],r=[],o=[],u=-1,s=-1,a=0;a<this.value.length;a++){if(f=this.value[a],v=l=void 0,(h=this.from[a]+n)==(c=this.to[a]+n)){if(null==(d=i.mapPos(h,f.startSide,f.mapMode)))continue;if(l=v=d,f.startSide!=f.endSide&&(v=i.mapPos(h,f.endSide))<l)continue}else if(l=i.mapPos(h,f.startSide),(v=i.mapPos(c,f.endSide))<l||l==v&&0<f.startSide&&f.endSide<=0)continue;(v-l||f.endSide-f.startSide)<0||(u<0&&(u=l),f.point&&(s=Math.max(s,v-l)),e.push(f),r.push(l-u),o.push(v-u))}return{mapped:e.length?new y(r,o,e,s):null,pos:u}}}]),y}(),(j=function(){function d(t,n,i,e){A(this,d),this.chunkPos=t,this.chunk=n,this.nextLayer=i,this.maxPoint=e}return D(d,[{key:"length",get:function t(){var n=this.chunk.length-1;return n<0?0:Math.max(this.chunkEnd(n),this.nextLayer.length)}},{key:"size",get:function t(){var n,i,e,r;if(this.isEmpty)return 0;n=this.nextLayer.size,i=F(this.chunk);try{for(i.s();!(e=i.n()).done;)n+=(r=e.value).value.length}catch(t){i.e(t)}finally{i.f()}return n}},{key:"chunkEnd",value:function t(n){return this.chunkPos[n]+this.chunk[n].length}},{key:"update",value:function t(n){var i,e,i,r,o,u,o,s,a,f,h,c,l,v,i=n.add,e=void 0===i?[]:i,i=n.sort,r,o=n.filterFrom,u=void 0===o?0:o,o=n.filterTo,s=void 0===o?this.length:o,a=n.filter;if(0==e.length&&!a)return this;if(void 0!==i&&i&&(e=e.slice().sort(Gh)),this.isEmpty)return e.length?d.of(e):this;for(f=new At(this,null,-1).goto(0),h=0,c=[],l=new Et;f.value||h<e.length;)h<e.length&&0<=(f.from-e[h].from||f.startSide-e[h].value.startSide)?(v=e[h++],l.addInner(v.from,v.to,v.value)||c.push(v)):1==f.rangeIndex&&f.chunkIndex<this.chunk.length&&(h==e.length||this.chunkEnd(f.chunkIndex)<e[h].from)&&(!a||u>this.chunkEnd(f.chunkIndex)||s<this.chunkPos[f.chunkIndex])&&l.addChunk(this.chunkPos[f.chunkIndex],this.chunk[f.chunkIndex])?f.nextChunk():((!a||u>f.to||s<f.from||a(f.from,f.to,f.value))&&!l.addInner(f.from,f.to,f.value)&&c.push(Pt.create(f.from,f.to,f.value)),f.next());return l.finishInner(this.nextLayer.isEmpty&&!c.length?d.empty:this.nextLayer.update({add:c,filter:a,filterFrom:u,filterTo:s}))}},{key:"map",value:function t(n){var i,e,r,o,u,s,a,a,s,u,f;if(n.empty||this.isEmpty)return this;for(i=[],e=[],r=-1,o=0;o<this.chunk.length;o++)u=this.chunkPos[o],s=this.chunk[o],!1===(a=n.touchesRange(u,u+s.length))?(r=Math.max(r,s.maxPoint),i.push(s),e.push(n.mapPos(u))):!0===a&&(s=(a=s.map(u,n)).mapped,u=a.pos,s)&&(r=Math.max(r,s.maxPoint),i.push(s),e.push(u));return f=this.nextLayer.map(n),0==i.length?f:new d(e,i,f||d.empty,r)}},{key:"between",value:function t(n,i,e){var r,o,u;if(!this.isEmpty){for(r=0;r<this.chunk.length;r++)if(o=this.chunkPos[r],u=this.chunk[r],o<=i&&n<=o+u.length&&!1===u.between(o,n-o,i-o,e))return;this.nextLayer.between(n,i,e)}}},{key:"iter",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return Dt.from([this]).goto(n)}},{key:"isEmpty",get:function t(){return this.nextLayer==this}}],[{key:"create",value:function t(n,i,e,r){return new d(n,i,e,r)}},{key:"iter",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return Dt.from(n).goto(i)}},{key:"compare",value:function t(n,i,e,r){var o,n,i,u,s,a,o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:-1,n=n.filter(function(t){return 0<t.maxPoint||!t.isEmpty&&t.maxPoint>=o}),i=i.filter(function(t){return 0<t.maxPoint||!t.isEmpty&&t.maxPoint>=o}),u=Kh(n,i,e),s=new Rt(n,u,o),a=new Rt(i,u,o);e.iterGaps(function(t,n,i){return Xh(s,t,a,n,i,r)}),e.empty&&0==e.length&&Xh(s,0,a,0,0,r)}},{key:"eq",value:function t(n,i){var e,r,o,u,s,a,f,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=3<arguments.length?arguments[3]:void 0;if(null==r&&(r=1e9-1),o=n.filter(function(t){return!t.isEmpty&&i.indexOf(t)<0}),u=i.filter(function(t){return!t.isEmpty&&n.indexOf(t)<0}),o.length!=u.length)return!1;if(!o.length)return!0;for(s=Kh(o,u),a=new Rt(o,s,0).goto(e),f=new Rt(u,s,0).goto(e);;){if(a.to!=f.to||!Zh(a.active,f.active)||a.point&&(!f.point||!a.point.eq(f.point)))return!1;if(a.to>r)return!0;a.next(),f.next()}}},{key:"spans",value:function t(n,i,e,r){for(var o,u,s,a,f,h,c,o,u=new Rt(n,null,4<arguments.length&&void 0!==arguments[4]?arguments[4]:-1).goto(i),s=i,a=u.openStart;;){if(f=Math.min(u.to,e),u.point?(h=u.activeForPoint(u.to),c=u.pointFrom<i?h.length+1:Math.min(h.length,a),r.point(s,f,u.point,h,c,u.pointRank),a=Math.min(u.openEnd(f),h.length)):s<f&&(r.span(s,f,u.active,a),a=u.openEnd(f)),u.to>e)return a+(u.point&&u.to>e?1:0);s=u.to,u.next()}}},{key:"of",value:function t(n){var i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],e=new Et,r=F(n instanceof Pt?[n]:i?Jh(n):n);try{for(r.s();!(o=r.n()).done;)u=o.value,e.add(u.from,u.to,u.value)}catch(t){r.e(t)}finally{r.f()}return e.finish()}}]),d}()).empty=new j([],[],null,-1),j.empty.nextLayer=j.empty,Et=function(){function r(){A(this,r),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 D(r,[{key:"finishChunk",value:function t(n){this.chunks.push(new Ot(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,n&&(this.from=[],this.to=[],this.value=[])}},{key:"add",value:function t(n,i,e){this.addInner(n,i,e)||(this.nextLayer||(this.nextLayer=new r)).add(n,i,e)}},{key:"addInner",value:function t(n,i,e){var r=n-this.lastTo||e.startSide-this.last.endSide;if(r<=0&&(n-this.lastFrom||e.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=n),this.from.push(n-this.chunkStart),this.to.push(i-this.chunkStart),this.last=e,this.lastFrom=n,this.lastTo=i,this.value.push(e),e.point&&(this.maxPoint=Math.max(this.maxPoint,i-n)),0))}},{key:"addChunk",value:function t(n,i){if((n-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(n);var e=i.value.length-1;return this.last=i.value[e],this.lastFrom=i.from[e]+n,this.lastTo=i.to[e]+n,!0}},{key:"finish",value:function t(){return this.finishInner(j.empty)}},{key:"finishInner",value:function t(n){var n;return this.from.length&&this.finishChunk(!1),0==this.chunks.length||(n=j.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(n):n,this.setMaxPoint),this.from=null),n}}]),r}(),At=function(){function r(t,n,i){var e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;A(this,r),this.layer=t,this.skip=n,this.minPoint=i,this.rank=e}return D(r,[{key:"startSide",get:function t(){return this.value?this.value.startSide:0}},{key:"endSide",get:function t(){return this.value?this.value.endSide:0}},{key:"goto",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(n,i,!1),this}},{key:"gotoInner",value:function t(n,i,e){for(var r,i;this.chunkIndex<this.layer.chunk.length&&(r=this.layer.chunk[this.chunkIndex],this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<n||r.maxPoint<this.minPoint);)this.chunkIndex++,e=!1;this.chunkIndex<this.layer.chunk.length&&(i=this.layer.chunk[this.chunkIndex].findIndex(n-this.layer.chunkPos[this.chunkIndex],i,!0),!e||this.rangeIndex<i)&&this.setRangeIndex(i),this.next()}},{key:"forward",value:function t(n,i){(this.to-n||this.endSide-i)<0&&this.gotoInner(n,i,!0)}},{key:"next",value:function t(){for(var n,i,e;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}if(e=(n=this.layer.chunkPos[this.chunkIndex])+(i=this.layer.chunk[this.chunkIndex]).from[this.rangeIndex],this.from=e,this.to=n+i.to[this.rangeIndex],this.value=i.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 t(n){if(n==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=n}},{key:"nextChunk",value:function t(){this.chunkIndex++,this.rangeIndex=0,this.next()}},{key:"compare",value:function t(n){return this.from-n.from||this.startSide-n.startSide||this.rank-n.rank||this.to-n.to||this.endSide-n.endSide}}]),r}(),Dt=function(){function s(t){A(this,s),this.heap=t}return D(s,[{key:"startSide",get:function t(){return this.value?this.value.startSide:0}},{key:"goto",value:function t(n){var i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1e9,e=F(this.heap);try{for(e.s();!(r=e.n()).done;)(o=r.value).goto(n,i)}catch(t){e.e(t)}finally{e.f()}for(u=this.heap.length>>1;0<=u;u--)Qh(this.heap,u);return this.next(),this}},{key:"forward",value:function t(n,i){var e,r,o,u,e=F(this.heap);try{for(e.s();!(r=e.n()).done;)(o=r.value).forward(n,i)}catch(t){e.e(t)}finally{e.f()}for(u=this.heap.length>>1;0<=u;u--)Qh(this.heap,u);(this.to-n||this.value.endSide-i)<0&&this.next()}},{key:"next",value:function t(){var n;0==this.heap.length?(this.from=this.to=1e9,this.value=null,this.rank=-1):(n=this.heap[0],this.from=n.from,this.to=n.to,this.value=n.value,this.rank=n.rank,n.value&&n.next(),Qh(this.heap,0))}}],[{key:"from",value:function t(n){for(var i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=0;o<n.length;o++)for(u=n[o];!u.isEmpty;u=u.nextLayer)u.maxPoint>=e&&r.push(new At(u,i,e,o));return 1==r.length?r[0]:new s(r)}}]),s}(),Rt=function(){function e(t,n,i){A(this,e),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=Dt.from(t,n,i)}return D(e,[{key:"goto",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1e9;return this.cursor.goto(n,i),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=n,this.endSide=i,this.openStart=-1,this.next(),this}},{key:"forward",value:function t(n,i){for(;-1<this.minActive&&(this.activeTo[this.minActive]-n||this.active[this.minActive].endSide-i)<0;)this.removeActive(this.minActive);this.cursor.forward(n,i)}},{key:"removeActive",value:function t(n){Yh(this.active,n),Yh(this.activeTo,n),Yh(this.activeRank,n),this.minActive=nc(this.active,this.activeTo)}},{key:"addActive",value:function t(n){for(var i=0,e=this.cursor,r=e.value,o=e.to,u=e.rank;i<this.activeRank.length&&this.activeRank[i]<=u;)i++;tc(this.active,i,r),tc(this.activeTo,i,o),tc(this.activeRank,i,u),n&&tc(n,i,this.cursor.from),this.minActive=nc(this.active,this.activeTo)}},{key:"next",value:function t(){var n,i,e,r,r,o,n=this.to,i=this.point;for(this.point=null,e=this.openStart<0?[]:null;;)if(-1<(r=this.minActive)&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>n){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),e&&Yh(e,r)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>n){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}if((r=this.cursor.value).point){if(!(i&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else this.addActive(e);this.cursor.next()}if(e)for(this.openStart=0,o=e.length-1;0<=o&&e[o]<n;o--)this.openStart++}},{key:"activeForPoint",value:function t(n){var i,e;if(!this.active.length)return this.active;for(i=[],e=this.active.length-1;0<=e&&!(this.activeRank[e]<this.pointRank);e--)(this.activeTo[e]>n||this.activeTo[e]==n&&this.active[e].endSide>=this.point.endSide)&&i.push(this.active[e]);return i.reverse()}},{key:"openEnd",value:function t(n){for(var i,e,i=0,e=this.activeTo.length-1;0<=e&&this.activeTo[e]>n;e--)i++;return i}}]),e}(),It=L.State=Object.freeze({__proto__:null,Annotation:gt,AnnotationType:wt,ChangeDesc:J,ChangeSet:K,get CharCategory(){return l},Compartment:ft,EditorSelection:O,EditorState:C,Facet:y,Line:W,get MapMode(){return h},Prec:st,Range:Pt,RangeSet:j,RangeSetBuilder:Et,RangeValue:jt,SelectionRange:X,StateEffect:v,StateEffectType:bt,StateField:b,Text:k,Transaction:Mt,codePointAt:wh,codePointSize:Mh,combineConfig:qh,countColumn:ic,findClusterBreak:yh,findColumn:ec,fromCodePoint:bh}),Tt="\u037c",Lt="undefined"==typeof Symbol?"__\u037c":Symbol.for(Tt),Bt="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),_t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{},Ft=function(){function r(t,n){var i,f,e;function h(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function c(t,n,i,e){var r,o,u,s,a,r=[],o=/^@(\w+)\b/.exec(t[0]),u=o&&"keyframes"==o[1];if(o&&null==n)return i.push(t[0]+";");for(s in n)if(a=n[s],/&/.test(s))c(s.split(/,\s*/).map(function(n){return t.map(function(t){return n.replace(/&/,t)})}).reduce(function(t,n){return t.concat(n)}),a,i);else if(a&&"object"==uh(a)){if(!o)throw new RangeError("The value of a property ("+s+") should be a primitive value.");c(h(s),a,r,u)}else null!=a&&r.push(s.replace(/_.*/,"").replace(/[A-Z]/g,function(t){return"-"+t.toLowerCase()})+": "+a+";");(r.length||u)&&i.push((!f||o||e?t:t.map(f)).join(", ")+" {"+r.join(" ")+"}")}for(e in A(this,r),this.rules=[],f=(i=n||{}).finish,t)c(h(e),t[e],this.rules)}return D(r,[{key:"getRules",value:function t(){return this.rules.join("\n")}}],[{key:"newName",value:function t(){var n=_t[Lt]||1;return _t[Lt]=n+1,Tt+n.toString(36)}},{key:"mount",value:function t(n,i){(n[Bt]||new Ut(n)).mount(Array.isArray(i)?i:[i])}}]),r}(),Nt=new Map,Ut=function(){function r(t){var n,i,e,e;if(A(this,r),i=(n=t.ownerDocument||t).defaultView,!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){if(e=Nt.get(n))return t.adoptedStyleSheets=[e.sheet].concat(Wf(t.adoptedStyleSheets)),t[Bt]=e;this.sheet=new i.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet].concat(Wf(t.adoptedStyleSheets)),Nt.set(n,this)}else this.styleTag=n.createElement("style"),(e=t.head||t).insertBefore(this.styleTag,e.firstChild);this.modules=[],t[Bt]=this}return D(r,[{key:"mount",value:function t(n){for(var i,e,r,o,u,s,a,f,h,i=this.sheet,e=0,r=0,o=0;o<n.length;o++)if(u=n[o],(s=this.modules.indexOf(u))<r&&-1<s&&(this.modules.splice(s,1),r--,s=-1),-1==s){if(this.modules.splice(r++,0,u),i)for(a=0;a<u.rules.length;a++)i.insertRule(u.rules[a],e++)}else{for(;r<s;)e+=this.modules[r++].rules.length;e+=u.rules.length,r++}if(!i){for(f="",h=0;h<this.modules.length;h++)f+=this.modules[h].getRules()+"\n";this.styleTag.textContent=f}}}]),r}(),Ht={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:"'"},zt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},t="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),n="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Wt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Vt=n||t&&+t[1]<57,i=0;i<10;i++)Ht[48+i]=Ht[96+i]=String(i);for(i=1;i<=24;i++)Ht[i+111]="F"+i;for(i=65;i<=90;i++)Ht[i]=String.fromCharCode(i+32),zt[i]=String.fromCharCode(i);for($t in Ht)zt.hasOwnProperty($t)||(zt[$t]=Ht[$t]);function rc(t){var n,t,n,t=!(Vt&&(t.ctrlKey||t.altKey||t.metaKey)||Wt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?zt:Ht)[t.keyCode]||t.key||"Unidentified";return t="Down"==(t="Right"==(t="Up"==(t="Left"==(t="Del"==(t="Esc"==t?"Escape":t)?"Delete":t)?"ArrowLeft":t)?"ArrowUp":t)?"ArrowRight":t)?"ArrowDown":t}function oc(t){var t,t=11!=t.nodeType||t.getSelection?t:t.ownerDocument;return t.getSelection()}function uc(t,n){return!!n&&(t==n||t.contains(1!=n.nodeType?n.parentNode:n))}function sc(t){for(var n=t.activeElement;n&&n.shadowRoot;)n=n.shadowRoot.activeElement;return n}function ac(t,n){if(!n.anchorNode)return!1;try{return uc(t,n.anchorNode)}catch(t){return!1}}function fc(t){return 3==t.nodeType?gc(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function hc(t,n,i,e){return i&&(lc(t,n,i,e,-1)||lc(t,n,i,e,1))}function cc(t){for(var n=0;;n++)if(!(t=t.previousSibling))return n}function lc(t,n,i,e,r){for(;;){if(t==i&&n==e)return!0;if(n==(r<0?0:vc(t))){if("DIV"==t.nodeName)return!1;var o=t.parentNode;if(!o||1!=o.nodeType)return!1;n=cc(t)+(r<0?0:1),t=o}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[n+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;n=r<0?vc(t):0}}}function vc(t){return(3==t.nodeType?t.nodeValue:t.childNodes).length}function dc(t,n){var n=n?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function yc(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function mc(t,n,i,e,r,o,u,s){for(var a,f,h,c,l,v,v,d,y,m,p,k,y,m,c,c,a=t.ownerDocument,f=a.defaultView||window,h=t;h;)if(1==h.nodeType){if(c=void 0,l=h==a.body)c=yc(f);else{if(h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}c={left:(v=h.getBoundingClientRect()).left,right:v.left+h.clientWidth,top:v.top,bottom:v.top+h.clientHeight}}if(d=v=0,"nearest"==r?n.top<c.top?(d=-(c.top-n.top+u),0<i&&n.bottom>c.bottom+d&&(d=n.bottom-c.bottom+d+u)):n.bottom>c.bottom&&(d=n.bottom-c.bottom+u,i<0)&&n.top-d<c.top&&(d=-(c.top+d-n.top+u)):(y=n.bottom-n.top,m=c.bottom-c.top,d=(p="center"==r&&y<=m?n.top+y/2-m/2:"start"==r||"center"==r&&i<0?n.top-u:n.bottom-m+u)-c.top),"nearest"==e?n.left<c.left?(v=-(c.left-n.left+o),0<i&&n.right>c.right+v&&(v=n.right-c.right+v+o)):n.right>c.right&&(v=n.right-c.right+o,i<0)&&n.left<c.left+v&&(v=-(c.left+v-n.left+o)):v=(k="center"==e?n.left+(n.right-n.left)/2-(c.right-c.left)/2:"start"==e==s?n.left-o:n.right-(c.right-c.left)+o)-c.left,(v||d)&&(l?f.scrollBy(v,d):(m=y=0,d&&(c=h.scrollTop,h.scrollTop+=d,m=h.scrollTop-c),v&&(c=h.scrollLeft,h.scrollLeft+=v,y=h.scrollLeft-c),n={left:n.left-y,top:n.top-m,right:n.right-y,bottom:n.bottom-m},y&&Math.abs(y-v)<1&&(e="nearest"),m&&Math.abs(m-d)<1&&(r="nearest"))),l)break;h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}function pc(t){for(var n,i,n=t.ownerDocument,i=t.parentNode;i&&i!=n.body;)if(1==i.nodeType){if(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.assignedSlot||i.parentNode}else{if(11!=i.nodeType)break;i=i.host}return null}function kc(t){var n,i,e,r,o,u;if(t.setActive)return t.setActive();if(Gt)return t.focus(Gt);for(n=[],i=t;i&&(n.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Gt?{get preventScroll(){return Gt={preventScroll:!0},!0}}:void 0),!Gt)for(Gt=!1,e=0;e<n.length;)r=n[e++],o=n[e++],u=n[e++],r.scrollTop!=o&&(r.scrollTop=o),r.scrollLeft!=u&&(r.scrollLeft=u)}function gc(t,n,i){var i,e,i=2<arguments.length&&void 0!==i?i:n,e=Jt=Jt||document.createRange();return e.setEnd(t,i),e.setStart(t,n),e}function wc(t,n,i){var n,i,n,n={key:n,code:n,keyCode:i,which:i,cancelable:!0},i=new KeyboardEvent("keydown",n);return i.synthetic=!0,t.dispatchEvent(i),(n=new KeyboardEvent("keyup",n)).synthetic=!0,t.dispatchEvent(n),i.defaultPrevented||n.defaultPrevented}function bc(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function Mc(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function xc(t,n){var i,e,r,i=n.focusNode,e=n.focusOffset;if(i&&n.anchorNode==i&&n.anchorOffset==e)for(e=Math.min(e,vc(i));;)if(e){if(1!=i.nodeType)return;"false"==(r=i.childNodes[e-1]).contentEditable?e--:e=vc(i=r)}else{if(i==t)return 1;e=cc(i),i=i.parentNode}}function Sc(t){var n=t.nextSibling;return t.parentNode.removeChild(t),n}function Cc(t,n,i,e,r,o,u,s,a){var f,h,c,l,v,f=t.children,h=f.length?f[n]:null,c=o.length?o[o.length-1]:null,l=c?c.breakAfter:u;if(!(n==e&&h&&!u&&!l&&o.length<2&&h.merge(i,r,o.length?c:null,0==i,s,a))){for(e<f.length&&((v=f[e])&&r<v.length?(n==e&&(v=v.split(r),r=0),!l&&c&&v.merge(0,r,c,!0,0,a)?o[o.length-1]=v:(r&&v.merge(0,r,null,!1,0,a),o.push(v))):null!=v&&v.breakAfter&&(c?c.breakAfter=1:u=1),e++),h&&(h.breakAfter=u,0<i)&&(!u&&o.length&&h.merge(i,h.length,o[0],!1,s,0)?h.breakAfter=o.shift().breakAfter:(i<h.length||h.children.length&&0==h.children[h.children.length-1].length)&&h.merge(i,h.length,null,!1,s,0),n++);n<e&&o.length;)if(f[e-1].become(o[o.length-1]))e--,o.pop(),a=o.length?0:s;else{if(!f[n].become(o[0]))break;n++,o.shift(),s=o.length?0:a}!o.length&&n&&e<f.length&&!f[n-1].breakAfter&&f[e].merge(0,0,f[n-1],!1,s,a)&&n--,(n<e||o.length)&&t.replaceChildren(n,e,o)}}function jc(t,n,i,e,r,o){var u,s,a,s,u,f,u,h,c,l,v,u=t.childCursor(),s=u.findPos(i,1),a=s.i,s=s.off,u=u.findPos(n,-1),f=u.i,u=u.off,h=n-i,c=F(e);try{for(c.s();!(l=c.n()).done;)h+=(v=l.value).length}catch(t){c.e(t)}finally{c.f()}t.length+=h,Cc(t,f,u,a,s,e,0,r,o)}function Pc(t,n,i){var e,r,o,u,n,e,e=t.nodeValue.length;return(u=0)==(o=r=n=e<n?e:n)&&i<0||n==e&&0<=i?g.chrome||g.gecko||(n?(r--,u=1):o<e&&(o++,u=-1)):i<0?r--:o<e&&o++,(n=gc(t,r,o).getClientRects()).length?(e=n[(u?u<0:0<=i)?0:n.length-1],g.safari&&!u&&0==e.width&&(e=Array.prototype.find.call(n,function(t){return t.width})||e),u?dc(e,u<0):e||null):null}function Oc(t,n,i,e,r,o,u){var s,a,f,f,h;if(i instanceof un){for(s=i.dom.firstChild;s;s=s.nextSibling)if(a=c.get(s)){if(f=uc(s,e),t<(h=a.length+(f?r:0))||t==h&&a.getSide()<=0)return f?Oc(t,n,a,e,r,o,u):o(a,t,n);t-=h}else{if("number"!=typeof(f=Ec(t,n,s,u)))return f;t=f}return o(i,i.length,-1)}return i.dom==e?u(e,t,n):o(i,t,n)}function Ec(t,n,i,e){var r,o,u;if(3==i.nodeType){if(t<=(r=i.nodeValue.length))return e(i,t,n);t-=r}else if(1==i.nodeType&&"false"!=i.contentEditable)for(o=i.firstChild;o;o=o.nextSibling){if("number"!=typeof(u=Ec(t,n,o,e)))return u;t=u}return t}function Ac(t,n,i,e,r){var o,u,s,a,s;if(i instanceof un)for(o=0,u=i.dom.firstChild;u;u=u.nextSibling)if(s=c.get(u)){if(a=uc(u,e),uc(u,t))return o+(a?Ac(t,n,s,e,r):s.localPosFromDOM(t,n));o+=s.length+(a?r:0)}else{if(null!=(s=Dc(t,n,u)).result)return o+s.result;o+=s.size}else if(i.dom==e)return Math.min(n,e.nodeValue.length);return i.localPosFromDOM(t,n)}function Dc(t,n,i){var e,r,o,u;if(3==i.nodeType)return t==i?{result:n}:{size:i.nodeValue.length};if(1!=i.nodeType||"false"==i.contentEditable)return i.contains(t)?{result:0}:{size:0};for(r=i.firstChild,o=e=0;;r=r.nextSibling,o++){if(t==i&&o==n)return{result:e};if(!r)return{size:e};if(null!=(u=Dc(t,n,r)).result)return{result:n+u.result};e+=u.size}}function Rc(t,n){for(var i,e,r,o,u,s,a,f,h,c,i=t.dom,e=t.children,r=0,o=0;r<e.length;r++)if(!((s=o+(u=e[r]).length)==o&&u.getSide()<=0)){if(o<n&&n<s&&u.dom.parentNode==i)return u.domAtPos(n-o);if(n<=o)break;o=s}for(a=r;0<a;a--)if((f=e[a-1]).dom.parentNode==i)return f.domAtPos(f.length);for(h=r;h<e.length;h++)if((c=e[h]).dom.parentNode==i)return c.domAtPos(0);return new Kt(i,0)}function Ic(t,n,i){var e,r=t.children;0<i&&n instanceof un&&r.length&&(e=r[r.length-1])instanceof un&&e.mark.eq(n.mark)?Ic(e,n.children[0],i-1):(r.push(n),n.setParent(t)),t.length+=n.length}function Tc(t,n,u){var s,a,f,h,n;function c(t,n){for(var i,e,r,o,i=0,e=0;i<t.children.length&&e<=n;i++)n<=(o=e+(r=t.children[i]).length)&&(r.children.length?c(r,n-e):(!f||f.isHidden&&0<u)&&(n<o||e==o&&0<r.getSide())?(f=r,h=n-e):(e<n||e==o&&r.getSide()<0&&!r.isHidden)&&(s=r,a=n-e)),e=o}return f=s=null,h=a=-1,c(t,n),(n=(u<0?s:f)||s||f)?n.coordsAt(Math.max(0,n==s?a:h),u):Lc(t)}function Lc(t){var n,n,n=t.dom.lastChild;return n?(n=fc(n))[n.length-1]||null:t.dom.getBoundingClientRect()}function Bc(t,n){for(var i in t)"class"==i&&n.class?n.class+=" "+t.class:"style"==i&&n.style?n.style+=";"+t.style:n[i]=t[i];return n}function _c(t,n){var i,e,r,o,u;if(t!=n){if(!t||!n)return!1;if(i=Object.keys(t),e=Object.keys(n),i.length!=e.length)return!1;for(r=0,o=i;r<o.length;r++)if(u=o[r],-1==e.indexOf(u)||t[u]!==n[u])return!1}return!0}function Fc(t,n,i){var e,r,o,e=null;if(n)for(r in n)i&&r in i||t.removeAttribute(e=r);if(i)for(o in i)n&&n[o]==i[o]||t.setAttribute(e=o,i[o]);return!!e}function Nc(t,n){var n,i,e,n=1<arguments.length&&void 0!==n&&n,i=t.inclusiveStart,e=t.inclusiveEnd;return{start:null!=(i=null==i?t.inclusive:i)?i:n,end:null!=(e=null==e?t.inclusive:e)?e:n}}function Uc(t,n){return t==n||!!(t&&n&&t.compare(n))}function Hc(t,n,i,e){var r,o,r,o=i.length-1;0<=o&&i[o]+(3<arguments.length&&void 0!==e?e:0)>=t?i[o]=Math.max(i[o],n):i.push(t,n)}function zc(t,n){var i,e,r,i=F(n);try{for(i.s();!(e=i.n()).done;)r=e.value,t=new un(r,[t],t.length)}catch(t){i.e(t)}finally{i.f()}return t}function Wc(t,n,i){var t=t.facet(wn);t.length?t[0](n):window.onerror?window.onerror(String(n),i,void 0,void 0,n):i?console.error(i+":",n):console.error(n)}function Vc(t){var n,i,e,r,o,u,s,a,n=0,i=0,e=0,r=0,o=F(t.state.facet(Bn));try{for(o.s();!(u=o.n()).done;)(a=(s=u.value)(t))&&(null!=a.left&&(n=Math.max(n,a.left)),null!=a.right&&(i=Math.max(i,a.right)),null!=a.top&&(e=Math.max(e,a.top)),null!=a.bottom)&&(r=Math.max(r,a.bottom))}catch(t){o.e(t)}finally{o.f()}return{left:n,right:i,top:e,bottom:r}}function $c(t){for(var n,i,n=[],i=0;i<t.length;i++)n.push(1<<+t[i]);return n}qt=function(){function t(){A(this,t),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return D(t,[{key:"eq",value:function t(n){return this.anchorNode==n.anchorNode&&this.anchorOffset==n.anchorOffset&&this.focusNode==n.focusNode&&this.focusOffset==n.focusOffset}},{key:"setRange",value:function t(n){var i=n.anchorNode,e=n.focusNode;this.set(i,Math.min(n.anchorOffset,i?vc(i):0),e,Math.min(n.focusOffset,e?vc(e):0))}},{key:"set",value:function t(n,i,e,r){this.anchorNode=n,this.anchorOffset=i,this.focusNode=e,this.focusOffset=r}}]),t}(),Gt=null,Kt=function(){function e(t,n){var i=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];A(this,e),this.node=t,this.offset=n,this.precise=i}return D(e,null,[{key:"before",value:function t(n,i){return new e(n.parentNode,cc(n),i)}},{key:"after",value:function t(n,i){return new e(n.parentNode,cc(n)+1,i)}}]),e}(),Qt=[],(c=function(){function v(){A(this,v),this.parent=null,this.dom=null,this.dirty=2}return D(v,[{key:"overrideDOMText",get:function t(){return null}},{key:"posAtStart",get:function t(){return this.parent?this.parent.posBefore(this):0}},{key:"posAtEnd",get:function t(){return this.posAtStart+this.length}},{key:"posBefore",value:function t(n){var i,e,r,o,i=this.posAtStart,e=F(this.children);try{for(e.s();!(r=e.n()).done;){if((o=r.value)==n)return i;i+=o.length+o.breakAfter}}catch(t){e.e(t)}finally{e.f()}throw new RangeError("Invalid child in posBefore")}},{key:"posAfter",value:function t(n){return this.posBefore(n)+n.length}},{key:"sync",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l;if(2&this.dirty){e=this.dom,r=null,u=F(this.children);try{for(u.s();!(s=u.n()).done;){if((a=s.value).dirty&&(a.dom||!(o=r?r.nextSibling:e.firstChild)||(f=v.get(o))&&(f.parent||!f.canReuseDOM(a))||a.reuseDOM(o),a.sync(n,i),a.dirty=0),o=r?r.nextSibling:e.firstChild,i&&!i.written&&i.node==e&&o!=a.dom&&(i.written=!0),a.dom.parentNode==e)for(;o&&o!=a.dom;)o=Sc(o);else e.insertBefore(a.dom,o);r=a.dom}}catch(t){u.e(t)}finally{u.f()}for((o=r?r.nextSibling:e.firstChild)&&i&&i.node==e&&(i.written=!0);o;)o=Sc(o)}else if(1&this.dirty){h=F(this.children);try{for(h.s();!(c=h.n()).done;)(l=c.value).dirty&&(l.sync(n,i),l.dirty=0)}catch(t){h.e(t)}finally{h.f()}}}},{key:"reuseDOM",value:function t(n){}},{key:"localPosFromDOM",value:function t(n,i){var e,r,o,u,s,a;if(n==this.dom)e=this.dom.childNodes[i];else{for(r=0==vc(n)?0:0==i?-1:1;(o=n.parentNode)!=this.dom;)0==r&&o.firstChild!=o.lastChild&&(r=n==o.firstChild?-1:1),n=o;e=r<0?n:n.nextSibling}if(e==this.dom.firstChild)return 0;for(;e&&!v.get(e);)e=e.nextSibling;if(!e)return this.length;for(s=u=0;;u++){if((a=this.children[u]).dom==e)return s;s+=a.length+a.breakAfter}}},{key:"domBoundsAround",value:function t(n,i){for(var e,r,o,u,s,a,f,h,c,l,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=-1,o=-1,u=-1,s=-1,a=0,f=e,h=e;a<this.children.length;a++){if(l=f+(c=this.children[a]).length,f<n&&i<l)return c.domBoundsAround(n,i,f);if(n<=l&&-1==r&&(r=a,o=f),i<f&&c.dom.parentNode==this.dom){u=a,s=h;break}f=(h=l)+c.breakAfter}return{from:o,to:s<0?e+this.length:s,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:u<this.children.length&&0<=u?this.children[u].dom:null}}},{key:"markDirty",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this.dirty|=2,this.markParentsDirty(n)}},{key:"markParentsDirty",value:function t(n){for(var i=this.parent;i;i=i.parent){if(n&&(i.dirty|=2),1&i.dirty)return;i.dirty|=1,n=!1}}},{key:"setParent",value:function t(n){this.parent!=n&&(this.parent=n,this.dirty)&&this.markParentsDirty(!0)}},{key:"setDOM",value:function t(n){this.dom&&(this.dom.cmView=null),(this.dom=n).cmView=this}},{key:"rootView",get:function t(){for(var n,i,n=this;;){if(!(i=n.parent))return n;n=i}}},{key:"replaceChildren",value:function t(n,i){var e,r,o,u,s,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Qt;for(this.markDirty(),o=n;o<i;o++)(u=this.children[o]).parent==this&&u.destroy();for((e=this.children).splice.apply(e,[n,i-n].concat(Wf(r))),s=0;s<r.length;s++)r[s].setParent(this)}},{key:"ignoreMutation",value:function t(n){return!1}},{key:"ignoreEvent",value:function t(n){return!1}},{key:"childCursor",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.length;return new Xt(this.children,n,this.children.length)}},{key:"childPos",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return this.childCursor().findPos(n,i)}},{key:"toString",value:function t(){var n=this.constructor.name.replace("View","");return n+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==n?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}},{key:"isEditable",get:function t(){return!0}},{key:"isWidget",get:function t(){return!1}},{key:"isHidden",get:function t(){return!1}},{key:"merge",value:function t(n,i,e,r,o,u){return!1}},{key:"become",value:function t(n){return!1}},{key:"canReuseDOM",value:function t(n){return n.constructor==this.constructor}},{key:"getSide",value:function t(){return 0}},{key:"destroy",value:function t(){this.parent=null}}],[{key:"get",value:function t(n){return n.cmView}}]),v}()).prototype.breakAfter=0,Xt=function(){function e(t,n,i){A(this,e),this.children=t,this.pos=n,this.i=i,this.off=0}return D(e,[{key:"findPos",value:function t(n){for(var i,e,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;;){if(n>this.pos||n==this.pos&&(0<i||0==this.i||this.children[this.i-1].breakAfter))return this.off=n-this.pos,this;e=this.children[--this.i],this.pos-=e.length+e.breakAfter}}}]),e}(),n="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},t="undefined"!=typeof document?document:{documentElement:{style:{}}},Zt=/Edge\/(\d+)/.exec(n.userAgent),Yt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(n.userAgent),nn=!(tn=!!((e=/MSIE \d/.test(n.userAgent))||Yt||Zt))&&/gecko\/(\d+)/i.test(n.userAgent),en=!tn&&/Chrome\/(\d+)/.exec(n.userAgent),r="webkitFontSmoothing"in t.documentElement.style,g={mac:(u=(o=!tn&&/Apple Computer/.test(n.vendor))&&(/Mobile\/\w+/.test(n.userAgent)||2<n.maxTouchPoints))||/Mac/.test(n.platform),windows:/Win/.test(n.platform),linux:/Linux|X11/.test(n.platform),ie:tn,ie_version:e?t.documentMode||6:Yt?+Yt[1]:Zt?+Zt[1]:0,gecko:nn,gecko_version:nn?+(/Firefox\/(\d+)/.exec(n.userAgent)||[0,0])[1]:0,chrome:!!en,chrome_version:en?+en[1]:0,ios:u,android:/Android\b/.test(n.userAgent),webkit:r,safari:o,webkit_version:r?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=t.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},rn=256,on=function(t){f(r,t);var i=S(r);function r(t){var n;return A(this,r),(n=i.call(this)).text=t,n}return D(r,[{key:"length",get:function t(){return this.text.length}},{key:"createDOM",value:function t(n){this.setDOM(n||document.createTextNode(this.text))}},{key:"sync",value:function t(n,i){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(i&&i.node==this.dom&&(i.written=!0),this.dom.nodeValue=this.text)}},{key:"reuseDOM",value:function t(n){3==n.nodeType&&this.createDOM(n)}},{key:"merge",value:function t(n,i,e){return(!e||e instanceof r&&!(this.length-(i-n)+e.length>rn))&&(this.text=this.text.slice(0,n)+(e?e.text:"")+this.text.slice(i),this.markDirty(),!0)}},{key:"split",value:function t(n){var i=new r(this.text.slice(n));return this.text=this.text.slice(0,n),this.markDirty(),i}},{key:"localPosFromDOM",value:function t(n,i){return n==this.dom?i:i?this.text.length:0}},{key:"domAtPos",value:function t(n){return new Kt(this.dom,n)}},{key:"domBoundsAround",value:function t(n,i,e){return{from:e,to:e+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}},{key:"coordsAt",value:function t(n,i){return Pc(this.dom,n,i)}}]),r}(c),un=function(t){f(c,t);var s=S(c);function c(t){var n,i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;A(this,c),(n=s.call(this)).mark=t,n.children=i,n.length=e,r=F(i);try{for(r.s();!(o=r.n()).done;)(u=o.value).setParent(eh(n))}catch(t){r.e(t)}finally{r.f()}return n}return D(c,[{key:"setAttrs",value:function t(n){if(Mc(n),this.mark.class&&(n.className=this.mark.class),this.mark.attrs)for(var i in this.mark.attrs)n.setAttribute(i,this.mark.attrs[i]);return n}},{key:"reuseDOM",value:function t(n){n.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(n),this.dirty|=6)}},{key:"sync",value:function t(n,i){this.dom?4&this.dirty&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),Yf(oh(c.prototype),"sync",this).call(this,n,i)}},{key:"merge",value:function t(n,i,e,r,o,u){return!(e&&(!(e instanceof c&&e.mark.eq(this.mark))||n&&o<=0||i<this.length&&u<=0)||(jc(this,n,i,e?e.children:[],o-1,u-1),this.markDirty(),0))}},{key:"split",value:function t(n){var i,e,r,o,u,s,a,f,h,i=[],e=0,r=-1,o=0,u=F(this.children);try{for(u.s();!(s=u.n()).done;)n<(f=e+(a=s.value).length)&&i.push(e<n?a.split(n-e):a),r<0&&n<=e&&(r=o),e=f,o++}catch(t){u.e(t)}finally{u.f()}return h=this.length-n,this.length=n,-1<r&&(this.children.length=r,this.markDirty()),new c(this.mark,i,h)}},{key:"domAtPos",value:function t(n){return Rc(this,n)}},{key:"coordsAt",value:function t(n,i){return Tc(this,n,i)}}]),c}(c),an=function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"domAtPos",value:function t(n){var i=this.widget,e=i.topView,i=i.text;return e?Oc(n,0,e,i,this.length-e.length,function(t,n){return t.domAtPos(n)},function(t,n){return new Kt(t,Math.min(n,t.nodeValue.length))}):new Kt(i,Math.min(n,i.nodeValue.length))}},{key:"sync",value:function t(){this.setDOM(this.widget.toDOM())}},{key:"localPosFromDOM",value:function t(n,i){var e=this.widget,r=e.topView,e=e.text;return r?Ac(n,i,r,e,this.length-r.length):Math.min(i,this.length)}},{key:"ignoreMutation",value:function t(){return!1}},{key:"overrideDOMText",get:function t(){return null}},{key:"coordsAt",value:function t(n,i){var e=this.widget,r=e.topView,e=e.text;return r?Oc(n,i,r,e,this.length-r.length,function(t,n,i){return t.coordsAt(n,i)},Pc):Pc(e,n,i)}},{key:"destroy",value:function t(){var n;Yf(oh(i.prototype),"destroy",this).call(this),null!=(n=this.widget.topView)&&n.destroy()}},{key:"isEditable",get:function t(){return!0}},{key:"canReuseDOM",value:function t(){return!0}}]),i}(sn=function(t){f(s,t);var r=S(s);function s(t,n,i){var e;return A(this,s),(e=r.call(this)).widget=t,e.length=n,e.side=i,e.prevWidget=null,e}return D(s,[{key:"split",value:function t(n){var i=s.create(this.widget,this.length-n,this.side);return this.length-=n,i}},{key:"sync",value:function t(n){this.dom&&this.widget.updateDOM(this.dom,n)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(n)),this.dom.contentEditable="false")}},{key:"getSide",value:function t(){return this.side}},{key:"merge",value:function t(n,i,e,r,o,u){return!(e&&(!(e instanceof s&&this.widget.compare(e.widget))||0<n&&o<=0||i<this.length&&u<=0)||(this.length=n+(e?e.length:0)+(this.length-i),0))}},{key:"become",value:function t(n){return n instanceof s&&n.side==this.side&&this.widget.constructor==n.widget.constructor&&(this.widget.compare(n.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=n.widget,this.length=n.length,!0)}},{key:"ignoreMutation",value:function t(){return!0}},{key:"ignoreEvent",value:function t(n){return this.widget.ignoreEvent(n)}},{key:"overrideDOMText",get:function t(){var n,i,e,e,r;if(0==this.length)return k.empty;for(n=this;n.parent;)n=n.parent;return e=(e=n.view)&&e.state.doc,r=this.posAtStart,e?e.slice(r,r+this.length):k.empty}},{key:"domAtPos",value:function t(n){return(this.length?0==n:0<this.side)?Kt.before(this.dom):Kt.after(this.dom,n==this.length)}},{key:"domBoundsAround",value:function t(){return null}},{key:"coordsAt",value:function t(n,i){var i,e,r,o,i=this.widget.coordsAt(this.dom,n,i);if(i)return i;if(r=null,!(e=this.dom.getClientRects()).length)return null;for(o=0<n?e.length-1:0;r=e[o],!(0<n?0==o:o==e.length-1||r.top<r.bottom);o+=0<n?-1:1);return this.length?r:dc(r,0<this.side)}},{key:"isEditable",get:function t(){return!1}},{key:"isWidget",get:function t(){return!0}},{key:"isHidden",get:function t(){return this.widget.isHidden}},{key:"destroy",value:function t(){Yf(oh(s.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}],[{key:"create",value:function t(n,i,e){return new(n.customView||s)(n,i,e)}}]),s}(c)),fn=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).side=t,n}return D(e,[{key:"length",get:function t(){return 0}},{key:"merge",value:function t(){return!1}},{key:"become",value:function t(n){return n instanceof e&&n.side==this.side}},{key:"split",value:function t(){return new e(this.side)}},{key:"sync",value:function t(){var n;this.dom||((n=document.createElement("img")).className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),this.setDOM(n))}},{key:"getSide",value:function t(){return this.side}},{key:"domAtPos",value:function t(n){return 0<this.side?Kt.before(this.dom):Kt.after(this.dom)}},{key:"localPosFromDOM",value:function t(){return 0}},{key:"domBoundsAround",value:function t(){return null}},{key:"coordsAt",value:function t(n){return this.dom.getBoundingClientRect()}},{key:"overrideDOMText",get:function t(){return k.empty}},{key:"isHidden",get:function t(){return!0}}]),e}(c),on.prototype.children=sn.prototype.children=fn.prototype.children=Qt,tn=function(){function t(){A(this,t)}return D(t,[{key:"eq",value:function t(n){return!1}},{key:"updateDOM",value:function t(n,i){return!1}},{key:"compare",value:function t(n){return this==n||this.constructor==n.constructor&&this.eq(n)}},{key:"estimatedHeight",get:function t(){return-1}},{key:"ignoreEvent",value:function t(n){return!0}},{key:"coordsAt",value:function t(n,i,e){return null}},{key:"customView",get:function t(){return null}},{key:"isHidden",get:function t(){return!1}},{key:"destroy",value:function t(n){}}]),t}(),P=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(P=P||{}),(m=function(t){f(u,t);var o=S(u);function u(t,n,i,e){var r;return A(this,u),(r=o.call(this)).startSide=t,r.endSide=n,r.widget=i,r.spec=e,r}return D(u,[{key:"heightRelevant",get:function t(){return!1}},{key:"hasHeight",value:function t(){return!!this.widget&&-1<this.widget.estimatedHeight}}],[{key:"mark",value:function t(n){return new hn(n)}},{key:"widget",value:function t(n){var i=n.side||0,e=!!n.block;return new ln(n,i+=e?0<i?3e8:-4e8:0<i?1e8:-1e8,i,e,n.widget||null,!1)}},{key:"replace",value:function t(n){var i,e,r,r,o,u,i=!!n.block,r=n.isBlockGap?(e=-5e8,4e8):(e=((o=(r=Nc(n,i)).start)?i?-3e8:-1:5e8)-1,1+((u=r.end)?i?2e8:1:-6e8));return new ln(n,e,r,i,n.widget||null,!0)}},{key:"line",value:function t(n){return new cn(n)}},{key:"set",value:function t(n){var i;return j.of(n,1<arguments.length&&void 0!==arguments[1]&&arguments[1])}}]),u}(jt)).none=j.empty,(hn=function(t){f(r,t);var e=S(r);function r(t){var n,i,n,i;return A(this,r),n=(i=Nc(t)).start,i=i.end,(n=e.call(this,n?-1:5e8,i?1:-6e8,null,t)).tagName=t.tagName||"span",n.class=t.class||"",n.attrs=t.attributes||null,n}return D(r,[{key:"eq",value:function t(n){return this==n||n instanceof r&&this.tagName==n.tagName&&this.class==n.class&&_c(this.attrs,n.attrs)}},{key:"range",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;if(i<=n)throw new RangeError("Mark decorations may not be empty");return Yf(oh(r.prototype),"range",this).call(this,n,i)}}]),r}(m)).prototype.point=!1,(cn=function(t){f(e,t);var n=S(e);function e(t){return A(this,e),n.call(this,-2e8,-2e8,null,t)}return D(e,[{key:"eq",value:function t(n){return n instanceof e&&this.spec.class==n.spec.class&&_c(this.spec.attributes,n.spec.attributes)}},{key:"range",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;if(i!=n)throw new RangeError("Line decoration ranges must be zero-length");return Yf(oh(e.prototype),"range",this).call(this,n,i)}}]),e}(m)).prototype.mapMode=h.TrackBefore,cn.prototype.point=!0,(ln=function(t){f(s,t);var u=S(s);function s(t,n,i,e,r,o){var i;return A(this,s),(i=u.call(this,n,i,r,t)).block=e,i.isReplace=o,i.mapMode=e?n<=0?h.TrackBefore:h.TrackAfter:h.TrackDel,i}return D(s,[{key:"type",get:function t(){return this.startSide<this.endSide?P.WidgetRange:this.startSide<=0?P.WidgetBefore:P.WidgetAfter}},{key:"heightRelevant",get:function t(){return this.block||!!this.widget&&5<=this.widget.estimatedHeight}},{key:"eq",value:function t(n){return n instanceof s&&Uc(this.widget,n.widget)&&this.block==n.block&&this.startSide==n.startSide&&this.endSide==n.endSide}},{key:"range",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n;if(this.isReplace&&(i<n||n==i&&0<this.startSide&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(this.isReplace||i==n)return Yf(oh(s.prototype),"range",this).call(this,n,i);throw new RangeError("Widget decorations can only have zero-length ranges")}}]),s}(m)).prototype.point=!0,vn=function(t){f(s,t);var n=S(s);function s(){var t;return A(this,s),(t=n.apply(this,arguments)).children=[],t.length=0,t.prevAttrs=void 0,t.attrs=null,t.breakAfter=0,t}return D(s,[{key:"merge",value:function t(n,i,e,r,o,u){if(e){if(!(e instanceof s))return!1;this.dom||e.transferDOM(this)}return r&&this.setDeco(e?e.attrs:null),jc(this,n,i,e?e.children:[],o,u),!0}},{key:"split",value:function t(n){var i,e,r,e,o,i=new s;if(i.breakAfter=this.breakAfter,0!=this.length){for(r=(e=this.childPos(n)).i,(e=e.off)&&(i.append(this.children[r].split(e),0),this.children[r].merge(e,this.children[r].length,null,!1,0,0),r++),o=r;o<this.children.length;o++)i.append(this.children[o],0);for(;0<r&&0==this.children[r-1].length;)this.children[--r].destroy();this.children.length=r,this.markDirty(),this.length=n}return i}},{key:"transferDOM",value:function t(n){this.dom&&(this.markDirty(),n.setDOM(this.dom),n.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}},{key:"setDeco",value:function t(n){_c(this.attrs,n)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=n)}},{key:"append",value:function t(n,i){Ic(this,n,i)}},{key:"addLineDeco",value:function t(n){var i=n.spec.attributes,n=n.spec.class;i&&(this.attrs=Bc(i,this.attrs||{})),n&&(this.attrs=Bc({class:n},this.attrs||{}))}},{key:"domAtPos",value:function t(n){return Rc(this,n)}},{key:"reuseDOM",value:function t(n){"DIV"==n.nodeName&&(this.setDOM(n),this.dirty|=6)}},{key:"sync",value:function t(n,i){var n,e,i;for(this.dom?4&this.dirty&&(Mc(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&&(Fc(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),Yf(oh(s.prototype),"sync",this).call(this,n,i),e=this.dom.lastChild;e&&c.get(e)instanceof un;)e=e.lastChild;e&&this.length&&("BR"==e.nodeName||0!=(null==(n=c.get(e))?void 0:n.isEditable)||g.ios&&this.children.some(function(t){return t instanceof on}))||((i=document.createElement("BR")).cmIgnore=!0,this.dom.appendChild(i))}},{key:"measureTextSize",value:function t(){var n,i,e,r,o,u;if(0==this.children.length||20<this.length)return null;n=0,e=F(this.children);try{for(e.s();!(r=e.n()).done;){if(!((o=r.value)instanceof on)||/[^ -~]/.test(o.text))return null;if(1!=(u=fc(o.dom)).length)return null;n+=u[0].width,i=u[0].height}}catch(t){e.e(t)}finally{e.f()}return n?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:n/this.length,textHeight:i}:null}},{key:"coordsAt",value:function t(n,i){var n,i,e,e,n=Tc(this,n,i);return!this.children.length&&n&&this.parent&&(i=this.parent.view.viewState.heightOracle,e=n.bottom-n.top,Math.abs(e-i.lineHeight)<2)&&i.textHeight<e?(e=(e-i.textHeight)/2,{top:n.top+e,bottom:n.bottom-e,left:n.left,right:n.left}):n}},{key:"become",value:function t(n){return!1}},{key:"type",get:function t(){return P.Text}}],[{key:"find",value:function t(n,i){for(var e,r,o,u,e=0,r=0;e<n.children.length;e++){if(i<=(u=r+(o=n.children[e]).length)){if(o instanceof s)return o;if(i<u)break}r=u+o.breakAfter}return null}}]),s}(c),dn=function(t){f(s,t);var r=S(s);function s(t,n,i){var e;return A(this,s),(e=r.call(this)).widget=t,e.length=n,e.type=i,e.breakAfter=0,e.prevWidget=null,e}return D(s,[{key:"merge",value:function t(n,i,e,r,o,u){return!(e&&(!(e instanceof s&&this.widget.compare(e.widget))||0<n&&o<=0||i<this.length&&u<=0)||(this.length=n+(e?e.length:0)+(this.length-i),0))}},{key:"domAtPos",value:function t(n){return 0==n?Kt.before(this.dom):Kt.after(this.dom,n==this.length)}},{key:"split",value:function t(n){var i,n,i=this.length-n;return this.length=n,(n=new s(this.widget,i,this.type)).breakAfter=this.breakAfter,n}},{key:"children",get:function t(){return Qt}},{key:"sync",value:function t(n){this.dom&&this.widget.updateDOM(this.dom,n)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(n)),this.dom.contentEditable="false")}},{key:"overrideDOMText",get:function t(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):k.empty}},{key:"domBoundsAround",value:function t(){return null}},{key:"become",value:function t(n){return n instanceof s&&n.widget.constructor==this.widget.constructor&&(n.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=n.widget,this.length=n.length,this.type=n.type,this.breakAfter=n.breakAfter,!0)}},{key:"ignoreMutation",value:function t(){return!0}},{key:"ignoreEvent",value:function t(n){return this.widget.ignoreEvent(n)}},{key:"isEditable",get:function t(){return!1}},{key:"isWidget",get:function t(){return!0}},{key:"coordsAt",value:function t(n,i){return this.widget.coordsAt(this.dom,n,i)}},{key:"destroy",value:function t(){Yf(oh(s.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}]),s}(c),yn=function(){function u(t,n,i,e){A(this,u),this.doc=t,this.pos=n,this.end=i,this.disallowBlockEffectsFor=e,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=n}return D(u,[{key:"posCovered",value:function t(){var n;return 0==this.content.length?!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos:!((n=this.content[this.content.length-1]).breakAfter||n instanceof dn&&n.type==P.WidgetBefore)}},{key:"getLine",value:function t(){return this.curLine||(this.content.push(this.curLine=new vn),this.atCursorPos=!0),this.curLine}},{key:"flushBuffer",value:function t(){var n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(zc(new fn(-1),n),n.length),this.pendingBuffer=0)}},{key:"addBlockWidget",value:function t(n){this.flushBuffer(),this.curLine=null,this.content.push(n)}},{key:"finish",value:function t(n){this.pendingBuffer&&n<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||this.getLine()}},{key:"buildText",value:function t(n,i,e){for(var r,o,u,r,r;0<n;){if(this.textOff==this.text.length){if(o=(r=this.cursor.next(this.skip)).value,u=r.lineBreak,r=r.done,this.skip=0,r)throw new Error("Ran out of text content when drawing inline views");if(u){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,n--;continue}this.text=o,this.textOff=0}r=Math.min(this.text.length-this.textOff,n,512),this.flushBuffer(i.slice(i.length-e)),this.getLine().append(zc(new on(this.text.slice(this.textOff,this.textOff+r)),i),e),this.atCursorPos=!0,this.textOff+=r,n-=r,e=0}}},{key:"span",value:function t(n,i,e,r){this.buildText(i-n,e,r),this.pos=i,this.openStart<0&&(this.openStart=r)}},{key:"point",value:function t(n,i,e,r,o,u){var u,s,s,a,f,h;if(this.disallowBlockEffectsFor[u]&&e instanceof ln){if(e.block)throw new RangeError("Block decorations may not be specified via plugins");if(i>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}u=i-n,e instanceof ln?e.block?((s=e.type)!=P.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new dn(e.widget||new mn("div"),u,s))):(s=sn.create(e.widget||new mn("span"),u,u?0:e.startSide),a=this.atCursorPos&&!s.isEditable&&o<=r.length&&(n<i||0<e.startSide),f=!s.isEditable&&(n<i||o>r.length||e.startSide<=0),h=this.getLine(),2!=this.pendingBuffer||a||s.isEditable||(this.pendingBuffer=0),this.flushBuffer(r),a&&(h.append(zc(new fn(1),r),o),o=r.length+Math.max(0,o-r.length)),h.append(zc(s,r),o),this.atCursorPos=f,this.pendingBuffer=f?n<i||o>r.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())):this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(e),u&&(this.textOff+u<=this.text.length?this.textOff+=u:(this.skip+=u-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=i),this.openStart<0&&(this.openStart=o)}}],[{key:"build",value:function t(n,i,e,r,o){var n=new u(n,i,e,o);return n.openEnd=j.spans(r,i,e,n),n.openStart<0&&(n.openStart=n.openEnd),n.finish(n.openEnd),n}}]),u}(),mn=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).tag=t,n}return D(e,[{key:"eq",value:function t(n){return n.tag==this.tag}},{key:"toDOM",value:function t(){return document.createElement(this.tag)}},{key:"updateDOM",value:function t(n){return n.nodeName.toLowerCase()==this.tag}},{key:"isHidden",get:function t(){return!0}}]),e}(tn),pn=y.define(),kn=y.define(),gn=y.define(),wn=y.define(),bn=y.define(),Mn=y.define(),xn=y.define(),Sn=y.define({combine:function t(n){return n.some(function(t){return t})}}),Cn=y.define({combine:function t(n){return n.some(function(t){return t})}}),jn=function(){function o(t){var n,i,e,r,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"nearest",i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"nearest",e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:5,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:5;A(this,o),this.range=t,this.y=n,this.x=i,this.yMargin=e,this.xMargin=r}return D(o,[{key:"map",value:function t(n){return n.empty?this:new o(this.range.map(n),this.y,this.x,this.yMargin,this.xMargin)}}]),o}(),Pn=v.define({map:function t(n,i){return n.map(i)}}),On=y.define({combine:function t(n){return!n.length||n[0]}}),En=0,An=y.define(),d=function(){function u(t,n,i,e){A(this,u),this.id=t,this.create=n,this.domEventHandlers=i,this.extension=e(this)}return D(u,null,[{key:"define",value:function t(n,i){var i=i||{},e=i.eventHandlers,r=i.provide,o=i.decorations;return new u(En++,n,e,function(n){var t=[An.of(n)];return o&&t.push(Tn.of(function(t){var t=t.plugin(n);return t?o(t):m.none})),r&&t.push(r(n)),t})}},{key:"fromClass",value:function t(n,i){return u.define(function(t){return new n(t)},i)}}]),u}(),Dn=function(){function n(t){A(this,n),this.spec=t,this.mustUpdate=null,this.value=null}return D(n,[{key:"update",value:function n(i){if(this.value){if(this.mustUpdate){var n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(t){if(Wc(n.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(i)}catch(t){Wc(i.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}},{key:"destroy",value:function t(n){var i;if(null!=(i=this.value)&&i.destroy)try{this.value.destroy()}catch(t){Wc(n.state,t,"CodeMirror plugin crashed")}}},{key:"deactivate",value:function t(){this.spec=this.value=null}}]),n}(),Rn=y.define(),In=y.define(),Tn=y.define(),Ln=y.define(),Bn=y.define(),_n=y.define(),Fn=function(){function d(t,n,i,e){A(this,d),this.fromA=t,this.toA=n,this.fromB=i,this.toB=e}return D(d,[{key:"join",value:function t(n){return new d(Math.min(this.fromA,n.fromA),Math.max(this.toA,n.toA),Math.min(this.fromB,n.fromB),Math.max(this.toB,n.toB))}},{key:"addToSet",value:function t(n){for(var i,e,r,i=n.length,e=this;0<i;i--)if(!((r=n[i-1]).fromA>e.toA)){if(r.toA<e.fromA)break;e=e.join(r),n.splice(i-1,1)}return n.splice(i,0,e),n}}],[{key:"extendWithRanges",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,c,v;if(0==i.length)return n;for(e=[],s=u=o=r=0;;r++){for(f=u-s,h=(a=r==n.length?null:n[r])?a.fromB:1e9;o<i.length&&i[o]<h&&(c=i[o],l=i[o+1],(c=Math.max(s,c))<=(v=Math.min(h,l))&&new d(c+f,v+f,c,v).addToSet(e),!(h<l));)o+=2;if(!a)return e;new d(a.fromA,a.toA,a.fromB,a.toB).addToSet(e),u=a.toA,s=a.toB}}}]),d}(),Nn=function(){function s(t,n,i){var e,r,o,u;A(this,s),this.view=t,this.state=n,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=K.empty(this.startState.doc.length),e=F(i);try{for(e.s();!(r=e.n()).done;)o=r.value,this.changes=this.changes.compose(o.changes)}catch(t){e.e(t)}finally{e.f()}u=[],this.changes.iterChangedRanges(function(t,n,i,e){return u.push(new Fn(t,n,i,e))}),this.changedRanges=u}return D(s,[{key:"viewportChanged",get:function t(){return 0<(4&this.flags)}},{key:"heightChanged",get:function t(){return 0<(2&this.flags)}},{key:"geometryChanged",get:function t(){return this.docChanged||0<(10&this.flags)}},{key:"focusChanged",get:function t(){return 0<(1&this.flags)}},{key:"docChanged",get:function t(){return!this.changes.empty}},{key:"selectionSet",get:function t(){return this.transactions.some(function(t){return t.selection})}},{key:"empty",get:function t(){return 0==this.flags&&0==this.transactions.length}}],[{key:"create",value:function t(n,i,e){return new s(n,i,e)}}]),s}(),E=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(E=E||{}),Un=E.LTR,Hn=E.RTL,zn=$c("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Wn=$c("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Vn=Object.create(null),$n=[];for(qn=0,Gn=["()","[]","{}"];qn<Gn.length;qn++)Vn[Kn=(Jn=Gn[qn]).charCodeAt(0)]=Jn=Jn.charCodeAt(1),Vn[Jn]=-Kn;function qc(t){return t<=247?zn[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Wn[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203?256:64336<=t&&t<=65023?4:8204==t?256:1}function Gc(t,n){var i,e,B,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,k,w,b,b,M,x,S,C,j,_,F,N,P,O,E,A,D,R,U,I,T,H,L,i=t.length,e=n==Un?1:2,B=n==Un?2:1;if(!t||1==e&&!Qn.test(t))return Jc(i);for(r=0,u=o=e;r<i;r++)512==(s=qc(t.charCodeAt(r)))?s=o:8==s&&4==u&&(s=16),z[r]=4==s?2:s,7&s&&(u=s),o=s;for(a=0,h=f=e;a<i;a++){if(128==(c=z[a]))a<i-1&&f==z[a+1]&&24&f?c=z[a]=f:z[a]=256;else if(64==c){for(l=a+1;l<i&&64==z[l];)l++;for(v=a&&8==f||l<i&&8==z[l]?1==h?1:8:256,d=a;d<l;d++)z[d]=v;a=l-1}else 8==c&&1==h&&(z[a]=1);7&(f=c)&&(h=c)}for(p=m=y=0;y<i;y++)if(g=Vn[k=t.charCodeAt(y)])if(g<0){for(w=m-3;0<=w;w-=3)if($n[w+1]==-g){(b=2&(b=$n[w+2])?e:4&b?1&b?B:e:0)&&(z[y]=z[$n[w]]=b),m=w;break}}else{if(189==$n.length)break;$n[m++]=y,$n[m++]=k,$n[m++]=p}else if(2==(k=z[y])||1==k)for(p=(M=k==e)?0:1,x=m-3;0<=x&&!(2&(S=$n[x+2]));x-=3)if(M)$n[x+2]|=2;else{if(4&S)break;$n[x+2]|=4}for(C=0;C<i;C++)if(256==z[C]){for(j=C+1;j<i&&256==z[j];)j++;for(N=(_=1==(C?z[C-1]:e))==(F=1==(j<i?z[j]:e))?_?1:2:e,P=C;P<j;P++)z[P]=N;C=j-1}if(O=[],1==e)for(E=0;E<i;){for(A=E,D=1!=z[E++];E<i&&D==(1!=z[E]);)E++;if(D)for(R=E;A<R;){for(U=R,I=2!=z[--R];A<R&&I==(2!=z[R-1]);)R--;O.push(new Xn(R,U,I?2:1))}else O.push(new Xn(A,E,0))}else for(T=0;T<i;){for(H=T,L=2==z[T++];T<i&&L==(2==z[T]);)T++;O.push(new Xn(H,T,L?1:2))}return O}function Jc(t){return[new Xn(0,t,0)]}function Kc(t,n,i,e,r){var o,u,s,o,o,e,a,u,u=e.head-t.from,s=-1;if(0==u){if(!r||!t.length)return null;n[0].level!=i&&(u=n[0].side(!1,i),s=0)}else if(u==t.length){if(r)return null;(o=n[n.length-1]).level!=i&&(u=o.side(!0,i),s=n.length-1)}return u==(o=n[s=s<0?Xn.find(n,u,null!=(o=e.bidiLevel)?o:-1,e.assoc):s]).side(r,i)&&(u=(o=n[s+=r?1:-1]).side(!r,i)),e=r==(o.dir==i),a=yh(t.text,u,e),Zn=t.text.slice(Math.min(u,a),Math.max(u,a)),a!=o.side(r,i)?O.cursor(a+t.from,e?-1:1,o.level):(u=s==(r?n.length-1:0)?null:n[s+(r?1:-1)])||o.level==i?u&&u.level<o.level?O.cursor(u.side(!r,i)+t.from,r?1:-1,u.level):O.cursor(a+t.from,r?-1:1,o.level):O.cursor(r?t.to:t.from,r?-1:1,i)}function Qc(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Xc(t){return 1==t.node.nodeType&&t.node.firstChild&&(0==t.offset||"false"==t.node.childNodes[t.offset-1].contentEditable)&&(t.offset==t.node.childNodes.length||"false"==t.node.childNodes[t.offset].contentEditable)}function Zc(t){var n,n,i,e,r,t,o,u,t,n=t.observer.selectionRange,n=n.focusNode&&tl(n.focusNode,n.focusOffset,0);if(!n)return null;if(!(i=t.docView.nearest(n)))return null;if(i instanceof vn){for(e=n;e.parentNode!=i.dom;)e=e.parentNode;for(r=e.previousSibling;r&&!c.get(r);)r=r.previousSibling;return{from:t=r?c.get(r).posAtEnd:i.posAtStart,to:t,node:e,text:n}}for(;;){if(!(u=i.parent))return null;if(u instanceof vn)break;i=u}return{from:t=i.posAtStart,to:t+i.length,node:i.dom,text:n}}function Yc(t,n){var i,e,r,o,i,e,n,r,t,r,i=Zc(t);if(!i)return m.none;if(e=i.from,r=i.to,o=i.node,i=i.text,e=n.mapPos(e,1),n=Math.max(e,n.mapPos(r,-1)),r=t.state,-1<(t=3==o.nodeType?o.nodeValue:new ti([],r).readRange(o.firstChild,null).text).indexOf(Yn))return m.none;if(n-e<t.length)if(r.doc.sliceString(e,Math.min(r.doc.length,e+t.length))==t)n=e+t.length;else{if(r.doc.sliceString(Math.max(0,n-t.length),n)!=t)return m.none;e=n-t.length}else if(r.doc.sliceString(e,n)!=t)return m.none;return(r=c.get(o))instanceof an?r=r.widget.topView:r&&(r.parent=null),m.set(m.replace({widget:new ri(o,i,r),inclusive:!0}).range(e,n))}function tl(t,n,i){var e,r,o,u;if(i<=0)for(e=t,r=n;;){if(3==e.nodeType)return e;if(!(1==e.nodeType&&0<r))break;r=vc(e=e.childNodes[r-1])}if(0<=i)for(o=t,u=n;;){if(3==o.nodeType)return o;if(!(1==o.nodeType&&u<o.childNodes.length&&0<=i))break;o=o.childNodes[u],u=0}return null}function nl(t,n){return 1!=t.nodeType?0:(n&&"false"==t.childNodes[n-1].contentEditable?1:0)|(n<t.childNodes.length&&"false"==t.childNodes[n].contentEditable?2:0)}function il(t,n,i){var e=new oi;return j.compare(t,n,i,e),e.changes}function el(t,n){for(var i=t;i&&i!=n;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return 1}function rl(t,n,i){var i,e,r,t,o,u,s,a,f,i=2<arguments.length&&void 0!==i?i:1,e=t.charCategorizer(n),r=t.doc.lineAt(n),t=n-r.from;if(0==r.length)return O.cursor(n);for(0==t?i=1:t==r.length&&(i=-1),u=o=t,i<0?o=yh(r.text,t,!1):u=yh(r.text,t),s=e(r.text.slice(o,u));0<o&&(a=yh(r.text,o,!1),e(r.text.slice(a,o))==s);)o=a;for(;u<r.length&&(f=yh(r.text,u),e(r.text.slice(u,f))==s);)u=f;return O.range(o+r.from,u+r.from)}function ol(t,n){return n.left>t?n.left-t:Math.max(0,t-n.right)}function ul(t,n){return n.top>t?n.top-t:Math.max(0,t-n.bottom)}function sl(t,n){return t.top<n.bottom-1&&t.bottom>n.top+1}function al(t,n){return n<t.top?{top:n,left:t.left,right:t.right,bottom:t.bottom}:t}function fl(t,n){return n>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:n}:t}function hl(t,n,i){for(var e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,p,k,g,s=!1,l=t.firstChild;l;l=l.nextSibling)for(v=fc(l),d=0;d<v.length;d++){if(y=v[d],m=ol(n,y=r&&sl(r,y)?al(fl(y,r.bottom),r.top):y),p=ul(i,y),0==m&&0==p)return(3==l.nodeType?cl:hl)(l,n,i);(!e||p<u||u==p&&m<o)&&(e=l,r=y,o=m,s=!(p=(u=p)?i<y.top?-1:1:m?n<y.left?-1:1:0)||(0<p?d<v.length-1:0<d)),0==m?i>y.bottom&&(!h||h.bottom<y.bottom)?(a=l,h=y):i<y.top&&(!c||c.top>y.top)&&(f=l,c=y):h&&sl(h,y)?h=fl(h,y.bottom):c&&sl(c,y)&&(c=al(c,y.top))}return h&&h.bottom>=i?(e=a,r=h):c&&c.top<=i&&(e=f,r=c),e?(k=Math.max(r.left,Math.min(r.right,n)),3==e.nodeType?cl(e,k,i):s&&"false"!=e.contentEditable?hl(e,k,i):{node:t,offset:g=Array.prototype.indexOf.call(t.childNodes,e)+(n>=(r.left+r.right)/2?1:0)}):{node:t,offset:0}}function cl(t,n,i){for(var e,r,o,u,s,a,f,h,c,l,v,d,e=t.nodeValue.length,r=-1,o=1e9,u=0,s=0;s<e;s++)for(a=gc(t,s,s+1).getClientRects(),f=0;f<a.length;f++)if((h=a[f]).top!=h.bottom&&(u=u||n-h.left,c=(h.top>i?h.top-i:i-h.bottom)-1,h.left-1<=n)&&h.right+1>=n&&c<o){if(v=l=n>=(h.left+h.right)/2,(g.chrome||g.gecko)&&(d=gc(t,s).getBoundingClientRect()).left==h.right&&(v=!l),c<=0)return{node:t,offset:s+(v?1:0)};r=s+(v?1:0),o=c}return{node:t,offset:-1<r?r:0<u?t.nodeValue.length:0}}function ll(t,n,i,e){var r,o,u,e,u,s,a,f,h,c,l,v,u,d,o,y,m,e,y,o,y,d,o,y,r=3<arguments.length&&void 0!==e?e:-1,e=t.contentDOM.getBoundingClientRect(),u=e.top+t.viewState.paddingTop,a=t.viewState.docHeight,f=n.x,h=n.y,c=h-u;if(c<0)return 0;if(a<c)return t.state.doc.length;for(l=t.defaultLineHeight/2,v=!1;(s=t.elementAtHeight(c)).type!=P.Text;)for(;!(0<=(c=0<r?s.bottom+l:s.top-l)&&c<=a);){if(v)return i?null:0;v=!0,r=-r}if(h=u+c,(u=s.from)<t.viewport.from)return 0==t.viewport.from?0:i?null:vl(t,e,s,f,h);if(u>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:vl(t,e,s,f,h);if(d=t.dom.ownerDocument,(y=(y=(o=t.root.elementFromPoint?t.root:d).elementFromPoint(f,h))&&!t.contentDOM.contains(y)?null:y)||(f=Math.max(e.left+1,Math.min(e.right-1,f)),(y=o.elementFromPoint(f,h))&&!t.contentDOM.contains(y)&&(y=null)),e=-1,y&&0!=(null==(o=t.docView.nearest(y))?void 0:o.isEditable)&&(d.caretPositionFromPoint?(y=d.caretPositionFromPoint(f,h))&&(m=y.offsetNode,e=y.offset):d.caretRangeFromPoint&&(o=d.caretRangeFromPoint(f,h))&&(m=o.startContainer,e=o.startOffset,!t.contentDOM.contains(m)||g.safari&&dl(m,e,f)||g.chrome&&yl(m,e,f))&&(m=void 0)),!m||!t.docView.dom.contains(m)){if(!(y=vn.find(t.docView,u)))return c>s.top+s.height/2?s.to:s.from;m=(d=hl(y.dom,f,h)).node,e=d.offset}return(o=t.docView.nearest(m))?o.isWidget&&1==(null==(u=o.dom)?void 0:u.nodeType)?(y=o.dom.getBoundingClientRect(),n.y<y.top||n.y<=y.bottom&&n.x<=(y.left+y.right)/2?o.posAtStart:o.posAtEnd):o.localPosFromDOM(m,e)+o.posAtStart:null}function vl(t,n,i,e,r){var e,o,n,e=Math.round((e-n.left)*t.defaultCharacterWidth);return t.lineWrapping&&i.height>1.5*t.defaultLineHeight&&(e+=(o=Math.floor((r-i.top)/t.defaultLineHeight))*t.viewState.heightOracle.lineLength),n=t.state.sliceDoc(i.from,i.to),i.from+ec(n,e,t.state.tabSize)}function dl(t,n,i){var n,e;if(3==t.nodeType&&n==(n=t.nodeValue.length)){for(e=t.nextSibling;e;e=e.nextSibling)if(1!=e.nodeType||"BR"!=e.nodeName)return;return gc(t,n-1,n).getBoundingClientRect().left>i}}function yl(t,n,i){var e,r,o;if(0==n){for(e=t;;){if(!(r=e.parentNode)||1!=r.nodeType||r.firstChild!=e)return;if(r.classList.contains("cm-line"))break;e=r}return 5<i-(o=(1==t.nodeType?t:gc(t,0,Math.max(t.nodeValue.length,1))).getBoundingClientRect()).left}}function ml(t,n,i,e){var r,e,o,u,u,o,e,r=t.state.doc.lineAt(n.head),e=e&&t.lineWrapping?t.coordsAtPos(n.assoc<0&&n.head>r.from?n.head-1:n.head):null;return e&&(o=t.dom.getBoundingClientRect(),u=t.textDirectionAt(r.from),null!=(u=t.posAtCoords({x:i==(u==E.LTR)?o.right-1:o.left+1,y:(e.top+e.bottom)/2})))?O.cursor(u,i?-1:1):(e=(o=vn.find(t.docView,n.head))?i?o.posAtEnd:o.posAtStart:i?r.to:r.from,O.cursor(e,i?-1:1))}function pl(t,n,i,e){for(var r,o,u,s,a,f,h,r=t.state.doc.lineAt(n.head),o=t.bidiSpans(r),u=t.textDirectionAt(r.from),s=n,a=null;;){if(f=Kc(r,o,u,s,i),h=Zn,!f){if(r.number==(i?t.state.doc.lines:1))return s;h="\n",r=t.state.doc.line(r.number+(i?1:-1)),o=t.bidiSpans(r),f=O.cursor(i?r.from:r.to)}if(a){if(!a(h))return s}else{if(!e)return f;a=e(h)}s=f}}function kl(t,n,i){var e,r,e=t.state.charCategorizer(n),r=e(i);return function(t){var t=e(t);return(r=r==l.Space?t:r)==t}}function gl(t,n,i,e){var r,o,u,s,a,i,f,i,h,c,l,v,d,r=n.head,o=i?1:-1;if(r==(i?t.state.doc.length:0))return O.cursor(r,n.assoc);for(u=n.goalColumn,a=t.contentDOM.getBoundingClientRect(),i=t.coordsAtPos(r),f=t.documentTop,s=i?(null==u&&(u=i.left-a.left),o<0?i.top:i.bottom):(i=t.viewState.lineBlockAt(r),null==u&&(u=Math.min(a.right-a.left,t.defaultCharacterWidth*(r-i.from))),(o<0?i.top:i.bottom)+f),h=a.left+u,c=null!=e?e:t.defaultLineHeight>>1,l=0;;l+=10)if(d=ll(t,{x:h,y:v=s+(c+l)*o},!1,o),v<a.top||v>a.bottom||(o<0?d<r:r<d))return O.cursor(d,n.assoc,void 0,u)}function wl(o,u,s){for(var t=function t(){var r,n,i,e,r=0,n=F(o);try{for(n.s();!(i=n.n()).done;)(e=i.value).between(u-1,u+1,function(t,n,i){var e;t<u&&u<n&&(u=(e=r||s||(u-t<n-u?-1:1))<0?t:n,r=e)})}catch(t){n.e(t)}finally{n.f()}if(!r)return{v:u}},n;;)if(n=t())return n.v}function bl(n,t,i){var t=wl(n.state.facet(Ln).map(function(t){return t(n)}),i.from,t.head>i.from?-1:1);return t==i.from?i:O.cursor(t,t<i.from?1:-1)}function Ml(t){return.7*Math.max(0,t)+8}function xl(t,n){var t=t.state.facet(pn);return t.length?t[0](n):g.mac?n.metaKey:n.ctrlKey}function Sl(t,n){var t=t.state.facet(kn);return t.length?t[0](n):g.mac?!n.altKey:!n.ctrlKey}function Cl(t,n){var i,i,e,r,o,i=t.state.selection.main;if(!i.empty){if(!(i=oc(t.root))||0==i.rangeCount)return 1;for(e=i.getRangeAt(0).getClientRects(),r=0;r<e.length;r++)if((o=e[r]).left<=n.clientX&&o.right>=n.clientX&&o.top<=n.clientY&&o.bottom>=n.clientY)return 1}}function jl(t,n){if(!n.bubbles)return 1;if(!n.defaultPrevented){for(var i=n.target,e;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(e=c.get(i))&&e.ignoreEvent(n))return;return 1}}function Pl(t){var n,i,n=t.dom.parentNode;n&&((i=n.appendChild(document.createElement("textarea"))).style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(function(){t.focus(),i.remove(),Ol(t,i.value)},50))}function Ol(t,e){var r,n,o,u,s,i,a,r=t.state,o=1,u=r.toText(e),s=u.lines==r.selection.ranges.length,i,n=null!=wi&&r.selection.ranges.every(function(t){return t.empty})&&wi==u.toString()?(a=-1,r.changeByRange(function(t){var n,i,n=r.doc.lineAt(t.from);return n.from==a?{range:t}:(a=n.from,i=r.toText((s?u.line(o++).text:e)+r.lineBreak),{changes:{from:n.from,insert:i},range:O.cursor(t.from+i.length)})})):s?r.changeByRange(function(t){var n=u.line(o++);return{changes:{from:t.from,to:t.to,insert:n.text},range:O.cursor(t.from+n.length)}}):r.replaceSelection(u);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function El(t,n,i,e){var e,i,n,e;return 1==e?O.cursor(n,i):2==e?rl(t.state,n,i):(e=vn.find(t.docView,n),i=t.state.doc.lineAt(e?e.posAtEnd:n),n=e?e.posAtStart:i.from,(e=e?e.posAtEnd:i.to)<t.state.doc.length&&e==i.to&&e++,O.range(n,e))}function Al(t,n,i,e){var t,n,r,t,t=vn.find(t.docView,n);return t&&0!=(n=n-t.posAtStart)&&(n==t.length||(r=t.coordsAt(n,-1))&&yi(i,e,r)||(!(t=t.coordsAt(n,1))||!yi(i,e,t))&&r&&di(e,r))?-1:1}function Dl(t,n){var i=t.posAtCoords({x:n.clientX,y:n.clientY},!1);return{pos:i,bias:Al(t,i,n.clientX,n.clientY)}}function Rl(t){var n,i;return mi?(n=pi,i=gi,pi=t,gi=Date.now(),ki=!n||i>Date.now()-400&&Math.abs(n.clientX-t.clientX)<2&&Math.abs(n.clientY-t.clientY)<2?(ki+1)%3:1):t.detail}function Il(s,t){var a,f,h,a=Dl(s,t),f=Rl(t),h=s.state.selection;return{update:function t(n){n.docChanged&&(a.pos=n.changes.mapPos(a.pos),h=h.map(n.changes))},get:function t(n,i,e){var n,r,o,r,u,r,n=Dl(s,n),o=El(s,n.pos,n.bias,f);return a.pos==n.pos||i||(r=El(s,a.pos,a.bias,f),u=Math.min(r.from,o.from),r=Math.max(r.to,o.to),o=u<o.from?O.range(u,r):O.range(r,u)),i?h.replaceRange(h.main.extend(o.from,o.to)):e&&1==f&&1<h.ranges.length&&(r=Tl(h,n.pos))?r:e?h.addRange(o):O.create([o])}}}function Tl(t,n){for(var i,e,r,e,i=0;i<t.ranges.length;i++)if(r=(e=t.ranges[i]).from,e=e.to,r<=n&&n<=e)return O.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0));return null}function Ll(t,n,i,e){var r,n,e,n,i;i&&(r=t.posAtCoords({x:n.clientX,y:n.clientY},!1),n.preventDefault(),n=t.inputState.mouseSelection,e=e&&n&&n.dragging&&n.dragMove?{from:n.dragging.from,to:n.dragging.to}:null,n={from:r,insert:i},i=t.state.changes(e?[e,n]:n),t.focus(),t.dispatch({changes:i,selection:{anchor:i.mapPos(r,-1),head:i.mapPos(r,1)},userEvent:e?"move.drop":"input.drop"}))}function Bl(t,n){var i,e,i=t.dom.parentNode;i&&((e=i.appendChild(document.createElement("textarea"))).style.cssText="position: fixed; left: -10000px; top: 10px",e.value=n,e.focus(),e.selectionEnd=n.length,e.selectionStart=0,setTimeout(function(){e.remove(),t.focus()},50))}function _l(t){var n,i,e,r,o,u,s,a,f,h,c,n=[],i=[],e=!1,r=F(t.selection.ranges);try{for(r.s();!(o=r.n()).done;)(u=o.value).empty||(n.push(t.sliceDoc(u.from,u.to)),i.push(u))}catch(t){r.e(t)}finally{r.f()}if(!n.length){s=-1,a=F(t.selection.ranges);try{for(a.s();!(f=a.n()).done;)h=f.value.from,(c=t.doc.lineAt(h)).number>s&&(n.push(c.text),i.push({from:c.from,to:Math.min(t.doc.length,c.to+1)})),s=c.number}catch(t){a.e(t)}finally{a.f()}e=!0}return{text:n.join(t.lineBreak),ranges:i,linewise:e}}function Fl(t,n){var i,e,r,o,u,i=[],e=F(t.facet(xn));try{for(e.s();!(r=e.n()).done;)(u=(o=r.value)(t,n))&&i.push(u)}catch(t){e.e(t)}finally{e.f()}return i?t.update({effects:i,annotations:bi.of(!0)}):null}function Nl(n){setTimeout(function(){var t,t,t=n.hasFocus;t!=n.inputState.notifiedFocused&&((t=Fl(n.state,t))?n.dispatch(t):n.update([]))},10)}function Ul(t,n){var i,e;null==t[n]&&(i=t[n-1])instanceof Ai&&(e=t[n+1])instanceof Ai&&t.splice(n-1,3,new Ai(i.length+1+e.length))}function Hl(t,n,i){var e=new Ti;return j.compare(t,n,i,e,0),e.changes}function zl(t,n){for(var i,e,r,o,u,s,a,f,h,c,l,i=t.getBoundingClientRect(),e=t.ownerDocument,r=e.defaultView||window,o=Math.max(0,i.left),u=Math.min(r.innerWidth,i.right),s=Math.max(0,i.top),a=Math.min(r.innerHeight,i.bottom),f=t.parentNode;f&&f!=e.body;)if(1==f.nodeType)h=f,c=window.getComputedStyle(h),(h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&"visible"!=c.overflow&&(l=h.getBoundingClientRect(),o=Math.max(o,l.left),u=Math.min(u,l.right),s=Math.max(s,l.top),a=f==t.parentNode?l.bottom:Math.min(a,l.bottom)),f="absolute"==c.position||"fixed"==c.position?h.offsetParent:h.parentNode;else{if(11!=f.nodeType)break;f=f.host}return{left:o-i.left,right:Math.max(o,u)-i.left,top:s-(i.top+n),bottom:Math.max(s,a)-(i.top+n)}}function Wl(t,n){var t=t.getBoundingClientRect();return{left:0,right:t.right-t.left,top:n,bottom:t.bottom-(t.top+n)}}function Vl(t,n,i){var e=[],r=t,o=0;return j.spans(i,t,n,{span:function t(){},point:function t(n,i){r<n&&(e.push({from:r,to:n}),o+=n-r),r=i}},20),r<n&&(e.push({from:r,to:n}),o+=n-r),{total:o,ranges:e}}function $l(t,n){var i,e,r,o,u,s,a,u,i=t.total,e=t.ranges;if(n<=0)return e[0].from;if(1<=n)return e[e.length-1].to;for(r=Math.floor(i*n),o=0;;o++){if(s=(u=e[o]).from,r<=(u=(a=u.to)-s))return s+r;r-=u}}function ql(t,n){var i,e,r,o,u,s,i=0,e=F(t.ranges);try{for(e.s();!(r=e.n()).done;){if(u=(o=r.value).from,n<=(s=o.to)){i+=n-u;break}i+=s-u}}catch(t){e.e(t)}finally{e.f()}return i/t.total}function Gl(t,n){var i,e,r,i=F(t);try{for(i.s();!(e=i.n()).done;)if(n(r=e.value))return r}catch(t){i.e(t)}finally{i.f()}}function Jl(t,n){var i,e;return 1==n.scale?t:(i=n.toDOM(t.top),e=n.toDOM(t.bottom),new Ci(t.from,t.length,i,e-i,t.children&&t.children.map(function(t){return Jl(t,n)}),t.deco))}function Kl(i,t,e){return new Ft(t,{finish:function t(n){return/&/.test(n)?n.replace(/&\w*/,function(t){if("&"==t)return i;if(e&&e[t])return e[t];throw new RangeError("Unsupported selector: ".concat(t))}):i+" "+n}})}function Ql(e,t){var r,n,o,i,u,s,u,a,f,u,h,c,s,a,f,l,v,d,y,m,p,u,t,i,n=t.newSel,o=e.state.selection.main,i=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;return t.bounds?(s=(u=t.bounds).from,u=u.to,a=o.from,f=null,(8===i||g.android&&t.text.length<u-s)&&(a=o.to,f="end"),(u=Xl(e.state.doc.sliceString(s,u,Yn),t.text,a-s,f))&&(g.chrome&&13==i&&u.toB==u.from+2&&"\uffff\uffff"==t.text.slice(u.from,u.toB)&&u.toB--,r={from:s+u.from,to:s+u.toA,insert:k.of(t.text.slice(u.from,u.toB).split(Yn))})):n&&(!e.hasFocus&&e.state.facet(On)||n.main.eq(o))&&(n=null),!(!r&&!n||(!r&&t.typeOver&&!o.empty&&n&&n.main.empty?r={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,o.to)}:r&&r.from>=o.from&&r.to<=o.to&&(r.from!=o.from||r.to!=o.to)&&o.to-o.from-(r.to-r.from)<=4?r={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,r.from).append(r.insert).append(e.state.doc.slice(r.to,o.to))}:(g.mac||g.android)&&r&&r.from==r.to&&r.from==o.head-1&&/^\. ?$/.test(r.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(n&&2==r.insert.length&&(n=O.single(n.main.anchor-1,n.main.head-1)),r={from:o.from,to:o.to,insert:k.of([" "])}):g.chrome&&r&&r.from==r.to&&r.from==o.head&&"\n "==r.insert.toString()&&e.lineWrapping&&(n=n&&O.single(n.main.anchor-1,n.main.head-1),r={from:o.from,to:o.to,insert:k.of([" "])}),r?(h=e.state,g.ios&&e.inputState.flushIOSKey(e)||g.android&&(r.from==o.from&&r.to==o.to&&1==r.insert.length&&2==r.insert.lines&&wc(e.contentDOM,"Enter",13)||(r.from==o.from-1&&r.to==o.to&&0==r.insert.length||8==i&&r.insert.length<r.to-r.from)&&wc(e.contentDOM,"Backspace",8)||r.from==o.from&&r.to==o.to+1&&0==r.insert.length&&wc(e.contentDOM,"Delete",46))||(c=r.insert.toString(),e.state.facet(Mn).some(function(t){return t(e,r.from,r.to,c)}))||(0<=e.inputState.composing&&e.inputState.composing++,s=r.from>=o.from&&r.to<=o.to&&r.to-r.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==r.from+r.insert.length)&&e.inputState.composing<0?(a=o.from<r.from?h.sliceDoc(o.from,r.from):"",f=o.to>r.to?h.sliceDoc(r.to,o.to):"",h.replaceSelection(e.state.toText(a+r.insert.sliceString(0,void 0,e.state.lineBreak)+f))):(l=h.changes(r),v=n&&n.main.to<=l.newLength?n.main:void 0,1<h.selection.ranges.length&&0<=e.inputState.composing&&r.to<=o.to&&r.to>=o.to-10?(d=e.state.sliceDoc(r.from,r.to),y=Zc(e)||e.state.doc.lineAt(o.head),m=o.to-r.to,p=o.to-o.from,h.changeByRange(function(t){var n,i,i,n;return t.from==o.from&&t.to==o.to?{changes:l,range:v||t.map(l)}:(i=(n=t.to-m)-d.length,t.to-t.from!=p||e.state.sliceDoc(i,n)!=d||y&&t.to>=y.from&&t.from<=y.to?{range:t}:(i=h.changes({from:i,to:n,insert:r.insert}),n=t.to-o.to,{changes:i,range:v?O.range(Math.max(0,v.anchor+n),Math.max(0,v.head+n)):t.map(i)}))})):{changes:l,selection:v&&h.selection.replaceRange(v)}),u="input.type",(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,u+=".compose",e.inputState.compositionFirstChange)&&(u+=".start",e.inputState.compositionFirstChange=!1),e.dispatch(s,{scrollIntoView:!0,userEvent:u})),0):!n||n.main.eq(o)||(t=!1,i="select",e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),i=e.inputState.lastSelectionOrigin),e.dispatch({selection:n,scrollIntoView:t,userEvent:i}),0)))}function Xl(t,n,i,e){for(var r,o,u,s,a,f,h,r=Math.min(t.length,n.length),o=0;o<r&&t.charCodeAt(o)==n.charCodeAt(o);)o++;if(o==r&&t.length==n.length)return null;for(u=t.length,s=n.length;0<u&&0<s&&t.charCodeAt(u-1)==n.charCodeAt(s-1);)u--,s--;return"end"==e&&(i-=u+(a=Math.max(0,o-Math.min(u,s)))-o),u<o&&t.length<n.length?(s=(o-=f=i<=o&&u<=i?o-i:0)+(s-u),u=o):s<o&&(u=(o-=h=i<=o&&s<=i?o-i:0)+(u-s),s=o),{from:o,toA:u,toB:s}}function Zl(t){var n,t,i,e,r,t,n=[];return t.root.activeElement==t.contentDOM&&(i=(t=t.observer.selectionRange).anchorNode,e=t.anchorOffset,r=t.focusNode,t=t.focusOffset,i)&&(n.push(new ni(i,e)),r==i&&t==e||n.push(new ni(r,t))),n}function Yl(t,n){var i,t;return 0!=t.length&&(i=t[0].pos,t=2==t.length?t[1].pos:i,-1<i)&&-1<t?O.single(i+n,t+n):null}function t0(t,n,i){for(var e,e;n;){if((e=c.get(n))&&e.parent==t)return e;n=(e=n.parentNode)!=t.dom?e:0<i?n.nextSibling:n.previousSibling}return null}function n0(t){var n,i,e,r,o,t,t;function u(t){t.preventDefault(),t.stopImmediatePropagation(),n=t.getTargetRanges()[0]}return n=null,t.contentDOM.addEventListener("beforeinput",u,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",u,!0),n?(i=n.startContainer,e=n.startOffset,r=n.endContainer,o=n.endOffset,hc((t=t.docView.domAtPos(t.state.selection.main.anchor)).node,t.offset,r,o)&&(i=(t=[r,o,i,e])[0],e=t[1],r=t[2],o=t[3]),{anchorNode:i,anchorOffset:e,focusNode:r,focusOffset:o}):null}function i0(t,n,i){for(var e,r,o,o,e=t.state.facet(n),r=e.length-1;0<=r;r--)(o="function"==typeof(o=e[r])?o(t):o)&&Bc(o,i);return i}function e0(t,n){var i,t,e,r,o,u,s,a,i=t.split(/-(?!$)/),t=i[i.length-1];for("Space"==t&&(t=" "),s=0;s<i.length-1;++s)if(a=i[s],/^(cmd|meta|m)$/i.test(a))u=!0;else if(/^a(lt)?$/i.test(a))e=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))o=!0;else{if(!/^mod$/i.test(a))throw new Error("Unrecognized modifier name: "+a);"mac"==n?u=!0:r=!0}return e&&(t="Alt-"+t),r&&(t="Ctrl-"+t),u&&(t="Meta-"+t),t=o?"Shift-"+t:t}function r0(t,n,i){return n.altKey&&(t="Alt-"+t),n.ctrlKey&&(t="Ctrl-"+t),n.metaKey&&(t="Meta-"+t),t=!1!==i&&n.shiftKey?"Shift-"+t:t}function o0(t){var t,n,t=t.facet(ie),n=ee.get(t);return n||ee.set(t,n=s0(t.reduce(function(t,n){return t.concat(n)},[]))),n}function u0(t,n,i){return a0(o0(t.state),n,t,i)}function s0(t,n){var f,h,r,c,i,e,o,u,s,a,l,v,d,y,m,p,k,g,f=1<arguments.length&&void 0!==n?n:ne,h=Object.create(null),r=Object.create(null),c=function t(n,i){var e=r[n];if(null==e)r[n]=i;else if(e!=i)throw new Error("Key binding "+n+" is used both as a regular binding and as a multi-stroke prefix")},i=function t(e,n,i,r){for(var n,n,o,u,s,a,n,n,o=h[e]||(h[e]=Object.create(null)),u=n.split(/ (?!$)/).map(function(t){return e0(t,f)}),s=function t(){var i=u.slice(0,a).join(" ");c(i,!0),o[i]||(o[i]={preventDefault:!0,run:[function(t){var n=re={view:t,prefix:i,scope:e};return setTimeout(function(){re==n&&(re=null)},oe),!0}]})},a=1;a<u.length;a++)s();n=u.join(" "),c(n,!1),n=o[n]||(o[n]={preventDefault:!1,run:(null==(n=null==(n=o.Wde)?void 0:n.run)?void 0:n.slice())||[]}),i&&n.run.push(i),r&&(n.preventDefault=!0)},e=F(t);try{for(e.s();!(o=e.n()).done;){if(s=(u=o.value).scope?u.scope.split(" "):["editor"],u.any){a=F(s);try{for(a.s();!(l=a.n()).done;)for(y in v=l.value,(d=h[v]||(h[v]=Object.create(null))).Wde||(d.Wde={preventDefault:!1,run:[]}),d)d[y].run.push(u.any)}catch(t){a.e(t)}finally{a.f()}}if(m=u[f]||u.key){p=F(s);try{for(p.s();!(k=p.n()).done;)i(g=k.value,m,u.run,u.preventDefault),u.shift&&i(g,"Shift-"+m,u.shift,u.preventDefault)}catch(t){p.e(t)}finally{p.f()}}}}catch(t){e.e(t)}finally{e.f()}return h}function a0(t,o,u,n){var i,e,r,s,a,f,h,t,n,c,i=rc(o),e,r=Mh(wh(i,0))==i.length&&" "!=i,s="",a=!1;if(re&&re.view==u&&re.scope==n&&(s=re.prefix+" ",a=fi.indexOf(o.keyCode)<0)&&(re=null),f=new Set,h=function t(n){var i,e,r;if(n){i=F(n.run);try{for(i.s();!(e=i.n()).done;)if(r=e.value,!f.has(r)&&(f.add(r),r(u,o)))return!0}catch(t){i.e(t)}finally{i.f()}n.preventDefault&&(a=!0)}return!1},t=t[n]){if(h(t[s+r0(i,o,!r)]))return!0;if(r&&(o.altKey||o.metaKey||o.ctrlKey)&&!(g.windows&&o.ctrlKey&&o.altKey)&&(n=Ht[o.keyCode])&&n!=i){if(h(t[s+r0(n,o,!0)]))return!0;if(o.shiftKey&&(c=zt[o.keyCode])!=i&&c!=n&&h(t[s+r0(c,o,!1)]))return!0}else if(r&&o.shiftKey&&h(t[s+r0(i,o,!0)]))return!0;if(h(t.Wde))return!0}return a}function f0(t){var n,i,n=t.scrollDOM.getBoundingClientRect(),i;return{left:(t.textDirection==E.LTR?n.left:n.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:n.top-t.scrollDOM.scrollTop}}function h0(t,n,i){var n=O.cursor(n);return{from:Math.max(i.from,t.moveToLineBoundary(n,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(n,!0,!0).from),type:P.Text}}function c0(t,n){var i,e,r,o,i=t.lineBlockAt(n);if(Array.isArray(i.type)){e=F(i.type);try{for(e.s();!(r=e.n()).done;)if((o=r.value).to>n||o.to==n&&(o.to==i.to||o.type==P.Text))return o}catch(t){e.e(t)}finally{e.f()}}return i}function l0(w,r,t){var n,i,b,e,o,u,e,e,M,x,e,s,a,f,n,i,t;return t.to<=w.viewport.from||t.from>=w.viewport.to?[]:(n=Math.max(t.from,w.viewport.from),i=Math.min(t.to,w.viewport.to),b=w.textDirection==E.LTR,e=w.contentDOM,o=e.getBoundingClientRect(),u=f0(w),e=(e=e.querySelector(".cm-line"))&&window.getComputedStyle(e),M=o.left+(e?parseInt(e.paddingLeft)+Math.min(0,parseInt(e.textIndent)):0),x=o.right-(e?parseInt(e.paddingRight):0),e=c0(w,n),s=c0(w,i),a=e.type==P.Text?e:null,f=s.type==P.Text?s:null,w.lineWrapping&&(a=a&&h0(w,n,a),f=f&&h0(w,i,f)),a&&f&&a.from==f.from?c(l(t.from,t.to,a)):(n=a?l(t.from,null,a):v(e,!1),i=f?l(null,t.to,f):v(s,!0),t=[],(a||e).to<(f||s).from-(a&&f?1:0)?t.push(h(M,n.bottom,x,i.top)):n.bottom<i.top&&w.elementAtHeight((n.bottom+i.top)/2).type==P.Text&&(n.bottom=i.top=(n.bottom+i.top)/2),c(n).concat(t).concat(c(i))));function h(t,n,i,e){return new ue(r,t-u.left,n-u.top-.01,i-t,e-n+.01)}function c(t){for(var n,i,e,r,o,n=t.top,i=t.bottom,e=t.horizontal,r=[],o=0;o<e.length;o+=2)r.push(h(e[o],n,e[o+1],i));return r}function l(t,n,o){var u,s,a,i,e,r,f,h,c,l,v,d,y,m,p,k;function g(t,n,i,e,r){var t,i,t=w.coordsAtPos(t,t==o.to?-2:2),i=w.coordsAtPos(i,i==o.from?2:-2);t&&i&&(u=Math.min(t.top,i.top,u),s=Math.max(t.bottom,i.bottom,s),r==E.LTR?a.push(b&&n?M:t.left,b&&e?x:i.right):a.push(!b&&e?M:i.left,!b&&n?x:t.right))}s=-(u=1e9),a=[],i=null!=t?t:o.from,e=null!=n?n:o.to,r=F(w.visibleRanges);try{for(r.s();!(f=r.n()).done;)if((h=f.value).to>i&&h.from<e)for(c=Math.max(h.from,i),l=Math.min(h.to,e);;){v=w.state.doc.lineAt(c),d=F(w.bidiSpans(v));try{for(d.s();!(y=d.n()).done&&(p=(m=y.value).from+v.from,k=m.to+v.from,!(l<=p));)c<k&&g(Math.max(p,c),null==t&&p<=i,Math.min(k,l),null==n&&e<=k,m.dir)}catch(t){d.e(t)}finally{d.f()}if(l<=(c=v.to+1))break}}catch(t){r.e(t)}finally{r.f()}return 0==a.length&&g(i,null==t,e,null==n,w.textDirection),{top:u,bottom:s,horizontal:a}}function v(t,n){var n=o.top+(n?t.top:t.bottom);return{top:n,bottom:n,horizontal:[]}}}function v0(t,n){return t.constructor==n.constructor&&t.eq(n)}function d0(n){return[d.define(function(t){return new se(t,n)}),ae.of(n)]}function y0(){var t;return[he.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),ce,le,ve,Cn.of(!0)]}function m0(t){return t.startState.facet(he)!=t.state.facet(he)}function p0(t,n){n.style.animationDuration=t.facet(he).cursorBlinkRate+"ms"}function k0(){return[ye,me]}function g0(t,n,i,e,r){n.lastIndex=0;for(var o=t.iterRange(i,e),u=i,s;!o.next().done;u+=o.value.length)if(!o.lineBreak)for(;s=n.exec(o.value);)r(u+s.index,s)}function w0(t,n){var i,e,r,o,u,s,a,i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;e=[],r=F(i);try{for(r.s();!(o=r.n()).done;)s=(u=o.value).from,a=u.to,s=Math.max(t.state.doc.lineAt(s).from,s-n),a=Math.min(t.state.doc.lineAt(a).to,a+n),e.length&&e[e.length-1].to>=s?e[e.length-1].to=a:e.push({from:s,to:a})}catch(t){r.e(t)}finally{r.f()}return e}function b0(){var t,n;return null==be&&"undefined"!=typeof document&&document.body&&(n=document.body.style,be=null!=(null!=(t=n.tabSize)?t:n.MozTabSize)),be}function M0(){var t;return[Me.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),x0()]}function x0(){return xe=xe||d.fromClass(function(){function n(t){A(this,n),this.view=t,this.decorations=m.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Me)),this.decorations=this.decorator.createDeco(t)}return D(n,[{key:"makeDecorator",value:function t(o){var u=this;return new pe({regexp:o.specialChars,decoration:function t(n,i,e){var r,n,r,i,e,r=i.state.doc,n=wh(n[0],0);return 9==n?(r=r.lineAt(e),i=i.state.tabSize,e=ic(r.text,i,e-r.from),m.replace({widget:new je((i-e%i)*u.view.defaultCharacterWidth)})):u.decorationCache[n]||(u.decorationCache[n]=m.replace({widget:new Ce(o,n)}))},boundary:o.replaceTabs?void 0:/[^]/})}},{key:"update",value:function t(n){var i=n.state.facet(Me);n.startState.facet(Me)!=i?(this.decorator=this.makeDecorator(i),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}}]),n}(),{decorations:function t(n){return n.decorations}})}function S0(t){return 32<=t?Se:10==t?"\u2424":String.fromCharCode(9216+t)}function C0(){return[Pe,In.of(function(t){var t;return(null==(t=t.plugin(Pe))?void 0:t.attrs)||null})]}function j0(){return Ee}function P0(i){return d.fromClass(function(){function n(t){A(this,n),this.view=t,this.placeholder=m.set([m.widget({widget:new Ae(i),side:1}).range(0)])}return D(n,[{key:"decorations",get:function t(){return this.view.state.doc.length?m.none:this.placeholder}}]),n}(),{decorations:function t(n){return n.decorations}})}function O0(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y,e=Math.min(n.line,i.line),r=Math.max(n.line,i.line),o=[];if(n.off>De||i.off>De||n.col<0||i.col<0)for(u=Math.min(n.off,i.off),s=Math.max(n.off,i.off),a=e;a<=r;a++)(f=t.doc.line(a)).length<=s&&o.push(O.range(f.from+u,f.to+s));else for(h=Math.min(n.col,i.col),c=Math.max(n.col,i.col),l=e;l<=r;l++)(d=ec((v=t.doc.line(l)).text,h,t.tabSize,!0))<0?o.push(O.cursor(v.to)):(y=ec(v.text,c,t.tabSize),o.push(O.range(v.from+d,v.from+y)));return o}function E0(t,n){var i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-n)/t.defaultCharacterWidth)):-1}function A0(t,n){var i,e,r,n,i=t.posAtCoords({x:n.clientX,y:n.clientY},!1),e=t.state.doc.lineAt(i),r=i-e.from,n=De<r?-1:r==e.length?E0(t,n.clientX):ic(e.text,t.state.tabSize,i-e.from);return{line:e.number,col:n,off:r}}function D0(r,t){var o=A0(r,t),u=r.state.selection;return o?{update:function t(n){var i,i;n.docChanged&&(i=n.changes.mapPos(n.startState.doc.line(o.line).from),i=n.state.doc.lineAt(i),o={line:i.number,col:o.col,off:Math.min(o.off,i.length)},u=u.map(n.changes))},get:function t(n,i,e){var n,n,n=A0(r,n);return n&&(n=O0(r.state,o,n)).length?e?O.create(n.concat(u.ranges)):O.create(n):u}}:null}function R0(t){var i=(null==t?void 0:t.eventFilter)||function(t){return t.altKey&&0==t.button};return w.mouseSelectionStyle.of(function(t,n){return i(n)?D0(t,n):null})}function I0(){var t,n,i,e,r,t,n=Gf(Re[(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).key||"Alt"],2),i=n[0],e=n[1],r=d.fromClass(function(){function n(t){A(this,n),this.view=t,this.isDown=!1}return D(n,[{key:"set",value:function t(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}}]),n}(),{eventHandlers:{keydown:function t(n){this.set(n.keyCode==i||e(n))},keyup:function t(n){n.keyCode!=i&&e(n)||this.set(!1)},mousemove:function t(n){this.set(e(n))}}});return[r,w.contentAttributes.of(function(t){var t;return null!=(t=t.plugin(r))&&t.isDown?Ie:null})]}function T0(){var t;return Be.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{})}function L0(t){var t=t.win;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}function B0(t){for(var n=t;n;n=n.parentNode)if(1==n.nodeType&&n.classList.contains("cm-tooltip"))return 1}function _0(t,n,i,e,r,o){var u,n,t,s,a,f,h,u=document.createRange(),n=t.domAtPos(n),t=t.domAtPos(i);for(u.setEnd(t.node,t.offset),u.setStart(n.node,n.offset),s=u.getClientRects(),u.detach(),a=0;a<s.length;a++)if(f=s[a],(h=Math.max(f.top-r,r-f.bottom,f.left-e,e-f.right))<=o)return 1}function F0(n){var a,f,i,a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},f=v.define(),i=b.define({create:function t(){return null},update:function t(n,i){var e,r,o,u,s;if(n&&(a.hideOnChange&&(i.docChanged||i.selection)||a.hideOn&&a.hideOn(i,n)))return null;if(n&&i.docChanged){if(null==(e=i.changes.mapPos(n.pos,-1,h.TrackDel)))return null;(r=Object.assign(Object.create(null),n)).pos=e,null!=n.end&&(r.end=i.changes.mapPos(n.end)),n=r}o=F(i.effects);try{for(o.s();!(u=o.n()).done;)(s=u.value).is(f)&&(n=s.value),s.is($e)&&(n=null)}catch(t){o.e(t)}finally{o.f()}return n},provide:function t(n){return He.from(n)}});return[i,d.define(function(t){return new Ve(t,n,i,f,a.hoverTime||300)}),We]}function N0(t,n){var t,n,t=t.plugin(Fe);return!t||(n=t.manager.tooltips.indexOf(n))<0?null:t.manager.tooltipViews[n]}function U0(t){return t.facet(He).some(function(t){return t})}function H0(t){var t;null!=(t=t.plugin(Fe))&&t.maybeMeasure()}function z0(t){return t?[qe.of(t)]:[]}function W0(t,n){var t,n,t=t.plugin(Ge),n=t?t.specs.indexOf(n):-1;return-1<n?t.panels[n]:null}function V0(t){var n=t.nextSibling;return t.remove(),n}function $0(t){return[q0(),Ze.of(Object.assign(Object.assign({},Xe),t))]}function q0(t){var n=[tr];return t&&!1===t.fixed&&n.push(Ye.of(!0)),n}function G0(t){return Array.isArray(t)?t:[t]}function J0(t,n,i){for(;t.value&&t.from<=i;)t.from==i&&n.push(t.value),t.next()}function K0(t,n){if(t.length==n.length){for(var i=0;i<t.length;i++)if(!t[i].compare(n[i]))return;return 1}}function Q0(t,n){return t.state.facet(or).formatNumber(n,t.state)}function X0(){var t;return[or.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),q0(),sr]}function Z0(t){for(var n=9;n<t;)n=10*n+9;return n}function Y0(){return fr}function tv(t){var n=hr.get(t);return n||hr.set(t,n=m.mark({attributes:"\t"===t?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":t.replace(/ /g,"\xb7")}})),n}function nv(i){return d.define(function(t){return{decorations:i.createDeco(t),update:function t(n){this.decorations=i.updateDeco(n,this.decorations)}}},{decorations:function t(n){return n.decorations}})}function iv(){return cr}function ev(){return lr}function rv(t,n,i,e){switch(t){case-2:return i<n;case-1:return n<=e&&i<n;case 0:return i<n&&n<e;case 1:return i<=n&&n<e;case 2:return n<e;case 4:return 1}}function ov(t,n){for(var i,e,i=t.childBefore(n);i&&(e=i.lastChild)&&e.to==i.to;)i=e.type.isError&&e.from==e.to?(t=i,e.prevSibling):e;return t}function uv(t,n,i,e){for(var r,o,u,s,a,f;t.from==t.to||(i<1?t.from>=n:t.from>n)||(-1<i?t.to<=n:t.to<n);){if(!(o=!e&&t instanceof Sr&&t.index<0?null:t.parent))return t;t=o}if(u=e?0:br.IgnoreOverlays,e)for(a=(s=t).parent;a;a=(s=a).parent)s instanceof Sr&&s.index<0&&(null==(r=a.enter(n,i,u))?void 0:r.from)!=s.from&&(t=a);for(;;){if(!(f=t.enter(n,i,u)))return t;t=f}}function sv(t,n,i,e){var r=t.cursor(),o=[];if(!r.firstChild())return o;if(null!=i)for(;!r.type.is(i);)if(!r.nextSibling())return o;for(;;){if(null!=e&&r.type.is(e))return o;if(r.type.is(n)&&o.push(r.node),!r.nextSibling())return null==e?o:[]}}function av(t,n,i){for(var e,r,e=2<arguments.length&&void 0!==i?i:n.length-1,r=t.parent;0<=e;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(n[e]&&n[e]!=r.name)return!1;e--}}return!0}function fv(t){return t.children.some(function(t){return t instanceof xr||!t.type.isAnonymous||fv(t)})}function hv(t){var n,i,S,n,C,n,j,n,P,O,E,A,D,e,r,i;function R(t,n,i,e,r){for(var o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,n,o=O.id,u=O.start,s=O.end,a=O.size,f=D;a<0;){if(O.next(),-1==a)return h=j[o],i.push(h),void e.push(u-t);if(-3==a)return void(A=o);if(-4==a)return void(D=o);throw new RangeError("Unrecognized record size: ".concat(a))}if(c=E[o],d=u-t,s-u<=C&&(v=B(O.pos-n,r))){for(y=new Uint16Array(v.size-v.skip),m=O.pos-v.size,p=y.length;O.pos>m;)p=_(v.start,y,p);l=new xr(y,s-v.start,S),d=v.start-t}else{for(k=O.pos-a,O.next(),g=[],w=[],b=P<=o?o:-1,M=0,x=s;O.pos>k;)0<=b&&O.id==b&&0<=O.size?(O.end<=x-C&&(T(g,w,u,M,O.end,x,b,f),M=g.length,x=O.end),O.next()):R(u,k,g,w,b);0<=b&&0<M&&M<g.length&&T(g,w,u,M,u,x,b,f),g.reverse(),w.reverse(),l=-1<b&&0<M?(n=I(c),lv(c,g,w,0,g.length,0,s-u,n,n)):L(c,g,w,s-u,f-s)}i.push(l),e.push(d)}function I(s){return function(t,n,i){var e=0,r=t.length-1,o,u;if(0<=r&&(o=t[r])instanceof x){if(!r&&o.type==s&&o.length==i)return o;(u=o.prop(M.lookAhead))&&(e=n[r]+o.length+u)}return L(s,t,n,i,e)}}function T(t,n,i,e,r,o,u,s){for(var a=[],f=[];t.length>e;)a.push(t.pop()),f.push(n.pop()+i-r);t.push(L(S.types[u],a,f,o-r,s-o)),n.push(r-i)}function L(t,n,i,e,r,o){var r,o,u,u,r=4<arguments.length&&void 0!==r?r:0,o=5<arguments.length?o:void 0;return A&&(u=[M.contextHash,A],o=o?[u].concat(o):[u]),25<r&&(u=[M.lookAhead,r],o=o?[u].concat(o):[u]),new x(t,n,i,e,o)}function B(t,n){var i,e,r,o,u,s,a,f,h,c,l,i=O.fork(),e=0,r=0,o=0,u=i.end-C,s={size:0,start:0,skip:0};t:for(a=i.pos-t;i.pos>a;)if(f=i.size,i.id==n&&0<=f)s.size=e,s.start=r,s.skip=o,o+=4,e+=4,i.next();else{if(h=i.pos-f,f<0||h<a||i.start<u)break;for(c=i.id>=P?4:0,l=i.start,i.next();i.pos>h;){if(i.size<0){if(-3!=i.size)break t;c+=4}else i.id>=P&&(c+=4);i.next()}r=l,e+=f,o+=c}return(n<0||e==t)&&(s.size=e,s.start=r,s.skip=o),4<s.size?s:void 0}function _(t,n,i){var e,r,o,u,s,a,e=O.id,r=O.start,o=O.end,u=O.size;if(O.next(),0<=u&&e<P){if(s=i,4<u)for(a=O.pos-(u-4);O.pos>a;)i=_(t,n,i);n[--i]=s,n[--i]=o-t,n[--i]=r-t,n[--i]=e}else-3==u?A=e:-4==u&&(D=e);return i}for(i=t.buffer,S=t.nodeSet,n=t.maxBufferLength,C=void 0===n?dr:n,n=t.reused,j=void 0===n?[]:n,n=t.minRepeatType,P=void 0===n?S.types.length:n,O=Array.isArray(i)?new Mr(i,i.length):i,E=S.types,D=A=0,e=[],r=[];0<O.pos;)R(t.start||0,t.bufferStart||0,e,r,-1);return i=null!=(n=t.length)?n:e.length?r[0]+e[0].length:0,new x(E[t.topID],e.reverse(),r.reverse(),i)}function cv(t,n){var i,e,r,o;if(!t.isAnonymous||n instanceof xr||n.type!=t)return 1;if(null==(i=Or.get(n))){i=1,e=F(n.children);try{for(e.s();!(r=e.n()).done;){if((o=r.value).type!=t||!(o instanceof x)){i=1;break}i+=cv(t,o)}}catch(t){e.e(t)}finally{e.f()}Or.set(n,i)}return i}function lv(c,t,n,i,e,l,r,o,v){for(var u,s,d,y,m,u=0,s=i;s<e;s++)u+=cv(c,t[s]);function p(t,n,i,e,r){for(var o,u,s,a,f,h,h,o=i;o<e;){for(s=n[u=o],a=cv(c,t[o]),o++;o<e&&(f=cv(c,t[o]),!(d<=a+f));o++)a+=f;if(o==u+1){if(d<a){p((h=t[u]).children,h.positions,0,h.children.length,n[u]+r);continue}y.push(t[u])}else h=n[o-1]+t[o-1].length-s,y.push(lv(c,t,n,u,o,s,h,null,v));m.push(s+r-l)}}return d=Math.ceil(1.5*u/8),y=[],m=[],p(t,n,i,e,0),(o||v)(y,m,r)}function vv(t,i){return t.length==i.length&&t.every(function(t,n){return t==i[n]})}function dv(t){for(var n,i,e,r,n=[[]],i=0;i<t.length;i++)for(e=0,r=n.length;e<r;e++)n.push(n[e].concat(t[i]));return n.sort(function(t,n){return n.length-t.length})}function yv(t){var n,i,e,r,o,u,s,a,f,h,c,l,v,d,y,n=Object.create(null);for(i in t){e=t[i],Array.isArray(e)||(e=[e]),r=F(i.split(" "));try{for(r.s();!(o=r.n()).done;)if(u=o.value){for(s=[],a=2,f=u,h=0;;){if("..."==f&&0<h&&h+3==u.length){a=1;break}if(!(c=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(f)))throw new RangeError("Invalid path: "+u);if(s.push("*"==c[0]?"":'"'==c[0][0]?JSON.parse(c[0]):c[0]),(h+=c[0].length)==u.length)break;if(l=u[h++],h==u.length&&"!"==l){a=0;break}if("/"!=l)throw new RangeError("Invalid path: "+u);f=u.slice(h)}if(!(d=s[v=s.length-1]))throw new RangeError("Invalid path: "+u);y=new _r(e,a,0<v?s.slice(0,v):null),n[d]=y.sort(n[d])}}catch(t){r.e(t)}finally{r.f()}}return Br.add(n)}function mv(t,n){var h,i,e,r,o,u,s,t,n,t,c,h=Object.create(null),i=F(t);try{for(i.s();!(e=i.n()).done;)if(r=e.value,Array.isArray(r.tag)){o=F(r.tag);try{for(o.s();!(u=o.n()).done;)s=u.value,h[s.id]=r.class}catch(t){o.e(t)}finally{o.f()}}else h[r.tag.id]=r.class}catch(t){i.e(t)}finally{i.f()}return n=(t=n||{}).scope,t=t.all,c=void 0===t?null:t,{style:function t(n){var i,e,r,o,u,s,a,f,i=c,e=F(n);try{for(e.s();!(r=e.n()).done;){u=F((o=r.value).set);try{for(u.s();!(s=u.n()).done;)if(a=s.value,f=h[a.id]){i=i?i+" "+f:f;break}}catch(t){u.e(t)}finally{u.f()}}}catch(t){e.e(t)}finally{e.f()}return i},scope:n}}function pv(t,n){var i,e,r,o,u,i=null,e=F(t);try{for(e.s();!(r=e.n()).done;)(u=(o=r.value).style(n))&&(i=i?i+" "+u:u)}catch(t){e.e(t)}finally{e.f()}return i}function kv(t,n,i,e,r){var e,r,n,e=3<arguments.length&&void 0!==e?e:0,r=4<arguments.length&&void 0!==r?r:t.length,n=new Fr(e,Array.isArray(n)?n:[n],i);n.highlightRange(t.cursor(),e,r,"",n.highlighters),n.flush(r)}function gv(t){for(var n=t.type.prop(Br);n&&n.context&&!t.matchContext(n.context);)n=n.next;return n||null}function wv(n){return y.define({combine:n?function(t){return t.concat(n)}:void 0})}function bv(t,n,i){var e,r,o,e=t.facet(io),r=R(t).topNode;if(!e||e.allowsNesting)for(o=r;o;o=o.enter(n,i,br.ExcludeBuffers))o.type.isTop&&(r=o);return r}function R(t){var t=t.field(Jr.state,!1);return t?t.tree:x.empty}function Mv(t,n){var i,t,t,e,i,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:50,t=null==(t=t.field(Jr.state,!1))?void 0:t.context;return t?(e=t.viewport,t.updateViewport({from:0,to:n}),i=t.isDone(n)||t.work(i,n)?t.tree:null,t.updateViewport(e),i):null}function xv(t){var n,t,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t.doc.length;return(null==(t=t.field(Jr.state,!1))?void 0:t.context.isDone(n))||!1}function Sv(t){var n,i,n,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t.viewport.to,i,n=Mv(t.state,n,2<arguments.length&&void 0!==arguments[2]?arguments[2]:100);return n!=R(t.state)&&t.dispatch({}),!!n}function Cv(t){var t;return(null==(t=t.plugin(no))?void 0:t.isWorking())||!1}function jv(t,n,i){return Er.applyChanges(t,[{fromA:n,toA:i,fromB:n,toB:i}])}function Pv(t){var n=t.facet(ro);return 9==n.charCodeAt(0)?t.tabSize*n.length:n.length}function Ov(t,n){var i,e,r,o,i="",e=t.tabSize,r=t.facet(ro)[0];if("\t"==r){for(;e<=n;)i+="\t",n-=e;r=" "}for(o=0;o<n;o++)i+=r;return i}function Ev(t,n){var i,e,r,o,u,i=F((t=t instanceof C?new oo(t):t).state.facet(eo));try{for(i.s();!(e=i.n()).done;)if(void 0!==(o=(r=e.value)(t,n)))return o}catch(t){i.e(t)}finally{i.f()}return(u=R(t.state))?Dv(t,u,n):null}function Av(t,n,i){for(var e,r,o,u,s,a,f,h,e=Object.create(null),r=new oo(t,{overrideIndentation:function t(n){var n;return null!=(n=e[n])?n:-1}}),o=[],u=n;u<=i;)u=(s=t.doc.lineAt(u)).to+1,null!=(a=Ev(r,s.from))&&(/\S/.test(s.text)||(a=0),(f=/^\s*/.exec(s.text)[0])!=(h=Ov(t,a)))&&(e[s.from]=a,o.push({from:s.from,to:s.from+f.length,insert:h}));return t.changes(o)}function Dv(t,n,i){return Tv(n.resolveInner(i).enterUnfinishedNodesBefore(i),i,t)}function Rv(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Iv(t){var n,n,n,i,e,n=t.type.prop(uo);return n||((n=t.firstChild)&&(n=n.type.prop(M.closedBy))?(i=t.lastChild,e=i&&-1<n.indexOf(i.name),function(t){return Nv(t,!0,1,void 0,e&&!Rv(t)?i.from:void 0)}):null==t.parent?Lv:null)}function Tv(t,n,i){for(;t;t=t.parent){var e=Iv(t);if(e)return e(so.create(i,n,t))}return null}function Lv(){return 0}function Bv(t,n){for(var i=n;i;i=i.parent)if(t==i)return 1}function _v(t){var n,i,e,r,t,o,u,s,n=t.node,i=n.childAfter(n.from),e=n.lastChild;if(!i)return null;for(r=t.options.simulateBreak,t=t.state.doc.lineAt(i.from),o=null==r||r<=t.from?t.to:Math.min(t.to,r),u=i.to;;){if(!(s=n.childAfter(u))||s==e)return null;if(!s.type.isSkipped)return s.from<o?i:null;u=s.to}}function Fv(t){var n=t.closing,i=t.align,e=void 0===i||i,i=t.units,r=void 0===i?1:i;return function(t){return Nv(t,e,r,n)}}function Nv(t,n,i,e,r){var o,u,o,e,o=t.textAfter,u=o.match(/^\s*/)[0].length,o=e&&o.slice(u,u+e.length)==e||r==t.pos+u,e=n?_v(t):null;return e?o?t.column(e.from):t.column(e.to):t.baseIndent+(o?0:t.unit*i)}function Uv(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=t.except,t=t.units,e=void 0===t?1:t;return function(t){var n=i&&i.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}function Hv(){return C.transactionFilter.of(function(t){var n,i,e,r,o,u,s,a,f,h,c,l,v,d,y;if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;if(!(n=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head)).length)return t;if(i=t.newDoc,(e=t.newSelection.main.head)>(r=i.lineAt(e)).from+ao)return t;if(o=i.sliceString(r.from,e),!n.some(function(t){return t.test(o)}))return t;s=-1,a=[],f=F((u=t.state).selection.ranges);try{for(f.s();!(h=f.n()).done;)c=h.value.head,(l=u.doc.lineAt(c)).from!=s&&(s=l.from,null!=(v=Ev(u,l.from)))&&(d=/^\s*/.exec(l.text)[0])!=(y=Ov(u,v))&&a.push({from:l.from,to:l.from+d.length,insert:y})}catch(t){f.e(t)}finally{f.f()}return a.length?[t,{changes:a,sequential:!0}]:t})}function zv(t){var n=t.firstChild,i=t.lastChild;return n&&n.to<i.from?{from:n.to,to:i.type.isError?t.to:i.from}:null}function Wv(t,n,i){var e,r,o,u,s,s,e=R(t);if(e.length<i)return null;for(o=null,u=r=e.resolveInner(i,1);u;u=u.parent)if(!(u.to<=i||u.from>i)){if(o&&u.from<n)break;(s=u.type.prop(ho))&&(u.to<e.length-50||e.length==t.doc.length||!Vv(u))&&(s=s(u,t))&&s.from<=i&&s.from>=n&&s.to>i&&(o=s)}return o}function Vv(t){var n=t.lastChild;return n&&n.to==t.to&&n.type.isError}function $v(t,n,i){var e,r,o,u,e=F(t.facet(fo));try{for(e.s();!(r=e.n()).done;)if(u=(o=r.value)(t,n,i))return u}catch(t){e.e(t)}finally{e.f()}return Wv(t,n,i)}function qv(t,n){var i=n.mapPos(t.from,1),n=n.mapPos(t.to,-1);return n<=i?void 0:{from:i,to:n}}function Gv(i){var e,n,r,t,e=[],n=F(i.state.selection.ranges);try{for(t=function t(){var n=r.value.head;if(e.some(function(t){return t.from<=n&&t.to>=n}))return 1;e.push(i.lineBlockAt(n))},n.s();!(r=n.n()).done;)t()}catch(t){n.e(t)}finally{n.f()}return e}function Jv(t){return t.field(vo,!1)||j.empty}function Kv(t,n,i){var t,e,e=null;return null!=(t=t.field(vo,!1))&&t.between(n,i,function(t,n){(!e||e.from>t)&&(e={from:t,to:n})}),e}function Qv(t,i,e){var r=!1;return t.between(i,i,function(t,n){t==i&&n==e&&(r=!0)}),r}function Xv(t,n){return t.field(vo,!1)?n:n.concat(v.appendConfig.of(td()))}function Zv(t,n,i){var i,e,n,i=!(2<arguments.length&&void 0!==i)||i,e=t.state.doc.lineAt(n.from).number,n=t.state.doc.lineAt(n.to).number;return w.announce.of("".concat(t.state.phrase(i?"Folded lines":"Unfolded lines")," ").concat(e," ").concat(t.state.phrase("to")," ").concat(n,"."))}function Yv(t,n){for(var i,e,i=n;;){if((e=$v(t.state,i.from,i.to))&&e.to>n.from)return e;if(!i.from)return null;i=t.lineBlockAt(i.from-1)}}function td(t){var n=[vo,bo];return t&&n.push(po.of(t)),n}function nd(){var t,i,s,a,e,r,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=Object.assign(Object.assign({},go),t),s=new wo(i,!0),a=new wo(i,!1),e=d.fromClass(function(){function n(t){A(this,n),this.from=t.viewport.from,this.markers=this.buildMarkers(t)}return D(n,[{key:"update",value:function t(n){(n.docChanged||n.viewportChanged||n.startState.facet(io)!=n.state.facet(io)||n.startState.field(vo,!1)!=n.state.field(vo,!1)||R(n.startState)!=R(n.state)||i.foldingChanged(n))&&(this.markers=this.buildMarkers(n.view))}},{key:"buildMarkers",value:function t(n){var i,e,r,o,u,i=new Et,e=F(n.viewportLineBlocks);try{for(e.s();!(r=e.n()).done;)o=r.value,(u=Kv(n.state,o.from,o.to)?a:$v(n.state,o.from,o.to)?s:null)&&i.add(o.from,o.from,u)}catch(t){e.e(t)}finally{e.f()}return i.finish()}}]),n}()),r=i.domEventHandlers;return[e,$0({class:"cm-foldGutter",markers:function t(n){var n;return(null==(n=n.plugin(e))?void 0:n.markers)||j.empty},initialSpacer:function t(){return new wo(i,!1)},domEventHandlers:Object.assign(Object.assign({},r),{click:function t(n,i,e){var e,e;return!((!r.click||!r.click(n,i,e))&&((e=Kv(n.state,i.from,i.to))?(n.dispatch({effects:lo.of(e)}),0):!(e=$v(n.state,i.from,i.to))||(n.dispatch({effects:co.of(e)}),0)))}})}),td()]}function id(t){var n=t.facet(xo);return n.length?n:t.facet(So)}function ed(n,t){var i=[Co],e;return n instanceof Mo&&(n.module&&i.push(w.styleModule.of(n.module)),e=n.themeType),null!=t&&t.fallback?i.push(So.of(n)):i.push(e?xo.computeN([w.darkTheme],function(t){return t.facet(w.darkTheme)==("dark"==e)?[n]:[]}):xo.of(n)),i}function rd(t,n,i){var t,e,r,o,u,s,t=id(t),e=null;if(t){r=F(t);try{for(r.s();!(o=r.n()).done;)(!(u=o.value).scope||i&&u.scope(i))&&(s=u.style(n))&&(e=e?e+" "+s:s)}catch(t){r.e(t)}finally{r.f()}}return e}function od(t){var n,i,n=[],i=t.matched?Ao:Do;return n.push(i.range(t.start.from,t.start.to)),t.end&&n.push(i.range(t.end.from,t.end.to)),n}function ud(){var t;return[Eo.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),Io]}function sd(t,n,i){var e,e,e=t.prop(n<0?M.openedBy:M.closedBy);return e||(1==t.name.length&&-1<(e=i.indexOf(t.name))&&e%2==(n<0?1:0)?[i[e+n]]:null)}function ad(t){var n=t.type.prop(To);return n?n(t.node):t}function fd(t,n,i){for(var e,r,o,e,u,s,a,f,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},r=e.maxScanDistance||Po,o=e.brackets||Oo,e=R(t),u=e.resolveInner(n,i),s=u;s;s=s.parent)if((a=sd(s.type,i,o))&&s.from<s.to&&(f=ad(s))&&(0<i?n>=f.from&&n<f.to:n>f.from&&n<=f.to))return hd(t,n,i,s,f,a,o);return cd(t,n,i,e,u.type,r,o)}function hd(t,n,i,e,r,o,u){var s,a,f,h,c,c,s=e.parent,a={from:r.from,to:r.to},f=0,h=null==s?void 0:s.cursor();if(h&&(i<0?h.childBefore(e.from):h.childAfter(e.to)))do{if(i<0?h.to<=e.from:h.from>=e.to){if(0==f&&-1<o.indexOf(h.type.name)&&h.from<h.to)return{start:a,end:(c=ad(h))?{from:c.from,to:c.to}:void 0,matched:!0};if(sd(h.type,i,u))f++;else if(sd(h.type,-i,u)){if(0==f)return{start:a,end:(c=ad(h))&&c.from<c.to?{from:c.from,to:c.to}:void 0,matched:!1};f--}}}while(i<0?h.prevSibling():h.nextSibling());return{start:a,matched:!1}}function cd(t,n,i,e,r,o,u){var s,a,f,h,c,l,v,d,y,m,p,s=i<0?t.sliceDoc(n-1,n):t.sliceDoc(n,n+1),a=u.indexOf(s);if(a<0||a%2==0!=0<i)return null;for(f={from:i<0?n-1:n,to:0<i?n+1:n},h=t.doc.iterRange(n,0<i?t.doc.length:0),l=c=0;!h.next().done&&l<=o;){for(v=h.value,i<0&&(l+=v.length),d=n+l*i,y=0<i?0:v.length-1,m=0<i?v.length:-1;y!=m;y+=i)if(!((p=u.indexOf(v[y]))<0||e.resolveInner(d+y,1).type!=r))if(p%2==0==0<i)c++;else{if(1==c)return{start:f,end:{from:d+y,to:d+y+1},matched:p>>1==a>>1};c--}0<i&&(l+=v.length)}return h.done?{start:f,matched:!1}:null}function ld(t,n,i,e,r){var e,r,o,u,e=3<arguments.length&&void 0!==e?e:0,r=4<arguments.length&&void 0!==r?r:0;for(null==n&&-1==(n=t.search(/[^\s\u00a0]/))&&(n=t.length),o=r,u=e;u<n;u++)9==t.charCodeAt(u)?o+=i-o%i:o++;return o}function vd(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||function(){},startState:t.startState||function(){return!0},copyState:t.copyState||dd,indent:t.indent||function(){return null},languageData:t.languageData||{},tokenTable:t.tokenTable||Fo}}function dd(t){var n,i,e;if("object"!=uh(t))return t;for(i in n={},t)e=t[i],n[i]=e instanceof Array?e.slice():e;return n}function yd(t,n,i,e,r){var o,u,s,a,s,o=e<=i&&i+n.length<=r&&n.prop(t.stateAfter);if(o)return{state:t.streamParser.copyState(o),pos:i+n.length};for(u=n.children.length-1;0<=u;u--)if(s=n.children[u],a=i+n.positions[u],s=s instanceof x&&a<r&&yd(t,s,a,e,r))return s;return null}function md(t,n,i,e,r){var o,u,s,a;if(r&&i<=0&&e>=n.length)return n;for(r||n.type!=t.topNode||(r=!0),o=n.children.length-1;0<=o;o--)if(u=n.positions[o],s=n.children[o],a=void 0,u<e&&s instanceof x){if(a=md(t,s,i-u,e-u,r))return r?new x(n.type,n.children.slice(0,o).concat(a),n.positions.slice(0,o+1),u+a.length):a;break}return null}function pd(t,n,i,e){var r,o,u,s,a,f,h,r=F(n);try{for(r.s();!(o=r.n()).done;)if(s=(u=o.value).from+(u.openStart?25:0),a=u.to-(u.openEnd?25:0),f=s<=i&&i<a&&yd(t,u.tree,0-u.offset,i,a),h=void 0,f&&(h=md(t,u.tree,i+u.offset,f.pos+u.offset,!1)))return{state:f.state,tree:h}}catch(t){r.e(t)}finally{r.f()}return{state:t.streamParser.startState(e?Pv(e):4),tree:x.empty}}function kd(t,n,i){var e,r;for(n.start=n.pos,e=0;e<10;e++)if(r=t(n,i),n.pos>n.start)return r;throw new Error("Stream parser failed to advance stream.")}for(Qn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Xn=function(){function e(t,n,i){A(this,e),this.from=t,this.to=n,this.level=i}return D(e,[{key:"dir",get:function t(){return this.level%2?Hn:Un}},{key:"side",value:function t(n,i){return this.dir==i==n?this.to:this.from}}],[{key:"find",value:function t(n,i,e,r){for(var o,u,s,o=-1,u=0;u<n.length;u++)if((s=n[u]).from<=i&&s.to>=i){if(s.level==e)return u;(o<0||(0!=r?r<0?s.from<i:s.to>i:n[o].level>s.level))&&(o=u)}if(o<0)throw new RangeError("Index out of range");return o}}]),e}(),z=[],Zn="",Yn="\uffff",ti=function(){function i(t,n){A(this,i),this.points=t,this.text="",this.lineSeparator=n.facet(C.lineSeparator)}return D(i,[{key:"append",value:function t(n){this.text+=n}},{key:"lineBreak",value:function t(){this.text+=Yn}},{key:"readRange",value:function t(n,i){var e,r,o,u,s,a;if(n){for(e=n.parentNode,r=n;this.findPointBefore(e,r),o=this.text.length,this.readNode(r),(u=r.nextSibling)!=i;)s=c.get(r),a=c.get(u),(s&&a?s.breakAfter:(s?s.breakAfter:Qc(r))||Qc(u)&&("BR"!=r.nodeName||r.cmIgnore)&&this.text.length>o)&&this.lineBreak(),r=u;this.findPointBefore(e,i)}return this}},{key:"readTextNode",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,i=n.nodeValue,e=F(this.points);try{for(e.s();!(r=e.n()).done;)(o=r.value).node==n&&(o.pos=this.text.length+Math.min(o.offset,i.length))}catch(t){e.e(t)}finally{e.f()}for(u=0,s=this.lineSeparator?null:/\r\n?|\n/g;a=-1,f=1,h=void 0,this.lineSeparator?(a=i.indexOf(this.lineSeparator,u),f=this.lineSeparator.length):(h=s.exec(i))&&(a=h.index,f=h[0].length),this.append(i.slice(u,a<0?i.length:a)),!(a<0);){if(this.lineBreak(),1<f){c=F(this.points);try{for(c.s();!(l=c.n()).done;)(v=l.value).node==n&&v.pos>this.text.length&&(v.pos-=f-1)}catch(t){c.e(t)}finally{c.f()}}u=a+f}}},{key:"readNode",value:function t(n){var i,i,e;if(!n.cmIgnore)if(null!=(i=(i=c.get(n))&&i.overrideDOMText))for(this.findPointInside(n,i.length),e=i.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value);else 3==n.nodeType?this.readTextNode(n):"BR"==n.nodeName?n.nextSibling&&this.lineBreak():1==n.nodeType&&this.readRange(n.firstChild,null)}},{key:"findPointBefore",value:function t(n,i){var e,r,o,e=F(this.points);try{for(e.s();!(r=e.n()).done;)(o=r.value).node==n&&n.childNodes[o.offset]==i&&(o.pos=this.text.length)}catch(t){e.e(t)}finally{e.f()}}},{key:"findPointInside",value:function t(n,i){var e,r,o,e=F(this.points);try{for(e.s();!(r=e.n()).done;)o=r.value,(3==n.nodeType?o.node==n:n.contains(o.node))&&(o.pos=this.text.length+Math.min(i,o.offset))}catch(t){e.e(t)}finally{e.f()}}}]),i}(),ni=D(function t(n,i){A(this,t),this.node=n,this.offset=i,this.pos=-1}),ii=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).view=t,n.compositionDeco=m.none,n.decorations=[],n.dynamicDecorationMap=[],n.minWidth=0,n.minWidthFrom=0,n.minWidthTo=0,n.impreciseAnchor=null,n.impreciseHead=null,n.forceSelection=!1,n.lastUpdate=Date.now(),n.setDOM(t.contentDOM),n.children=[new vn],n.children[0].setParent(eh(n)),n.updateDeco(),n.updateInner([new Fn(0,0,0,t.state.doc.length)],0),n}return D(e,[{key:"length",get:function t(){return this.view.state.doc.length}},{key:"update",value:function t(n){var e,i,r,o,u,e=this,i=n.changedRanges;return 0<this.minWidth&&i.length&&(i.every(function(t){var n=t.fromA,i;return t.toA<e.minWidthFrom||n>e.minWidthTo})?(this.minWidthFrom=n.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=n.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=m.none:(n.transactions.length||this.dirty)&&(this.compositionDeco=Yc(this.view,n.changes)),(g.ie||g.chrome)&&!this.compositionDeco.size&&n&&n.state.doc.lines!=n.startState.doc.lines&&(this.forceSelection=!0),u=il(r=this.decorations,o=this.updateDeco(),n.changes),i=Fn.extendWithRanges(i,u),(0!=this.dirty||0!=i.length)&&(this.updateInner(i,n.startState.doc.length),n.transactions.length&&(this.lastUpdate=Date.now()),!0)}},{key:"updateInner",value:function t(n,i){var e,r,o,u,s,a,e=this;if(this.view.viewState.mustMeasureContent=!0,this.updateChildren(n,i),(r=this.view.observer).ignore(function(){e.dom.style.height=e.view.viewState.contentHeight+"px",e.dom.style.flexBasis=e.minWidth?e.minWidth+"px":"";var t=g.chrome||g.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;e.sync(e.view,t),e.dirty=0,t&&(t.written||r.selectionRange.focusNode!=t.node)&&(e.forceSelection=!0),e.dom.style.height=""}),o=[],this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){u=F(this.children);try{for(u.s();!(s=u.n()).done;)(a=s.value)instanceof dn&&a.widget instanceof ei&&o.push(a.dom)}catch(t){u.e(t)}finally{u.f()}}r.updateGaps(o)}},{key:"updateChildren",value:function t(n,i){for(var e,r,o,u,s,a,o,a,o,f,h,a,s,c,s,u,l,v,e=this.childCursor(i),r=n.length-1;o=0<=r?n[r]:null;r--)u=o.fromA,s=o.toA,a=o.fromB,o=o.toB,o=(a=yn.build(this.view.state.doc,a,o,this.decorations,this.dynamicDecorationMap)).content,f=a.breakAtStart,h=a.openStart,a=a.openEnd,c=(s=e.findPos(s,1)).i,s=s.off,Cc(this,l=(u=e.findPos(u,-1)).i,v=u.off,c,s,o,f,h,a)}},{key:"updateSelection",value:function t(){var e,n,i,r,n,o,n,u,s,a,f,h,e=this,n=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=1<arguments.length&&void 0!==arguments[1]&&arguments[1];!n&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange(),n=(r=this.view.root.activeElement)==this.dom,o=!n&&ac(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r)),(n||i||o)&&(n=this.forceSelection,this.forceSelection=!1,u=this.view.state.selection.main,s=this.domAtPos(u.anchor),a=u.empty?s:this.domAtPos(u.head),g.gecko&&u.empty&&!this.compositionDeco.size&&Xc(s)&&(f=document.createTextNode(""),this.view.observer.ignore(function(){return s.node.insertBefore(f,s.node.childNodes[s.offset]||null)}),s=a=new Kt(f,0),n=!0),h=this.view.observer.selectionRange,!n&&h.focusNode&&hc(s.node,s.offset,h.anchorNode,h.anchorOffset)&&hc(a.node,a.offset,h.focusNode,h.focusOffset)||(this.view.observer.ignore(function(){var t,n,i,n,i;if(g.android&&g.chrome&&e.dom.contains(h.focusNode)&&el(h.focusNode,e.dom)&&(e.dom.blur(),e.dom.focus({preventScroll:!0})),t=oc(e.view.root))if(u.empty)g.gecko&&(n=nl(s.node,s.offset))&&3!=n&&(i=tl(s.node,s.offset,1==n?1:-1))&&(s=new Kt(i,1==n?0:i.nodeValue.length)),t.collapse(s.node,s.offset),null!=u.bidiLevel&&null!=h.cursorBidiLevel&&(h.cursorBidiLevel=u.bidiLevel);else if(t.extend){t.collapse(s.node,s.offset);try{t.extend(a.node,a.offset)}catch(t){}}else n=document.createRange(),u.anchor>u.head&&(s=(i=[a,s])[0],a=i[1]),n.setEnd(a.node,a.offset),n.setStart(s.node,s.offset),t.removeAllRanges(),t.addRange(n);o&&e.view.root.activeElement==e.dom&&(e.dom.blur(),r)&&r.focus()}),this.view.observer.setSelectionRange(s,a)),this.impreciseAnchor=s.precise?null:new Kt(h.anchorNode,h.anchorOffset),this.impreciseHead=a.precise?null:new Kt(h.focusNode,h.focusOffset))}},{key:"enforceCursorAssoc",value:function t(){var n,i,e,r,o,r,u,s,s,u,s,u;this.compositionDeco.size||(i=(n=this.view).state.selection.main,e=oc(n.root),o=(r=n.observer.selectionRange).anchorNode,r=r.anchorOffset,e&&i.empty&&i.assoc&&e.modify&&(u=vn.find(this,i.head))&&(s=u.posAtStart,i.head==s||i.head==s+u.length||(s=this.coordsAt(i.head,-1),u=this.coordsAt(i.head,1),!s)||!u||s.bottom>u.top||(s=this.domAtPos(i.head+i.assoc),e.collapse(s.node,s.offset),e.modify("move",i.assoc<0?"forward":"backward","lineboundary"),n.observer.readSelectionRange(),u=n.observer.selectionRange,n.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=i.from&&e.collapse(o,r))))}},{key:"nearest",value:function t(n){for(var i,e,i=n;i;){if((e=c.get(i))&&e.rootView==this)return e;i=i.parentNode}return null}},{key:"posFromDOM",value:function t(n,i){var e=this.nearest(n);if(e)return e.localPosFromDOM(n,i)+e.posAtStart;throw new RangeError("Trying to find position for a DOM position outside of the document")}},{key:"domAtPos",value:function t(n){for(var n,i,e,r,n=this.childCursor().findPos(n,-1),i=n.i,e=n.off;i<this.children.length-1&&!(e<(r=this.children[i]).length||r instanceof vn);)i++,e=0;return this.children[i].domAtPos(e)}},{key:"coordsAt",value:function t(n,i){for(var e,r,o,u,e=this.length,r=this.children.length-1;;r--){if((u=e-(o=this.children[r]).breakAfter-o.length)<n||n==u&&o.type!=P.WidgetBefore&&o.type!=P.WidgetAfter&&(!r||2==i||this.children[r-1].breakAfter||this.children[r-1].type==P.WidgetBefore&&-2<i))return o.coordsAt(n-u,i);e=u}}},{key:"measureVisibleLineHeights",value:function t(n){for(var i,e,r,o,u,s,a,f,h,c,l,v,d,d,d,v,i=[],e=n.from,r=n.to,o=this.view.contentDOM.clientWidth,u=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==E.LTR,f=0,h=0;h<this.children.length&&!(r<(l=f+(c=this.children[h]).length));h++)e<=f&&(v=c.dom.getBoundingClientRect(),i.push(v.height),u)&&(d=(d=c.dom.lastChild)?fc(d):[]).length&&(d=d[d.length-1],s<(v=a?d.right-v.left:v.right-d.left))&&(s=v,this.minWidth=o,this.minWidthFrom=f,this.minWidthTo=l),f=l+c.breakAfter;return i}},{key:"textDirectionAt",value:function t(n){var i,n=this.childPos(n,1).i;return"rtl"==getComputedStyle(this.children[n].dom).direction?E.RTL:E.LTR}},{key:"measureTextSize",value:function t(){var n,i,e,r,o,u,s,a,f,n=this,i=F(this.children);try{for(i.s();!(e=i.n()).done;)if((r=e.value)instanceof vn&&(o=r.measureTextSize()))return o}catch(t){i.e(t)}finally{i.f()}return(u=document.createElement("div")).className="cm-line",u.style.width="99999px",u.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(function(){n.dom.appendChild(u);var t=fc(u.firstChild)[0];s=u.getBoundingClientRect().height,a=t?t.width/27:7,f=t?t.height:s,u.remove()}),{lineHeight:s,charWidth:a,textHeight:f}}},{key:"childCursor",value:function t(){var n,i,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.length,i=this.children.length;return i&&(n-=this.children[--i].length),new Xt(this.children,n,i)}},{key:"computeBlockGapDeco",value:function t(){for(var n,i,e,r,o,u,s,n=[],i=this.view.viewState,e=0,r=0;e<(u=(o=r==i.viewports.length?null:i.viewports[r])?o.from-1:this.length)&&(s=i.lineBlockAt(u).bottom-i.lineBlockAt(e).top,n.push(m.replace({widget:new ei(s),block:!0,inclusive:!0,isBlockGap:!0}).range(e,u))),o;r++)e=o.to+1;return m.set(n)}},{key:"updateDeco",value:function t(){for(var e,n,i,e=this,n=this.view.state.facet(Tn).map(function(t,n){var i;return(e.dynamicDecorationMap[n]="function"==typeof t)?t(e.view):t}),i=n.length;i<n.length+3;i++)this.dynamicDecorationMap[i]=!1;return this.decorations=[].concat(Wf(n),[this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco])}},{key:"scrollIntoView",value:function t(n){var i,e,r,r,e,i=n.range,e=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1);e&&(!i.empty&&(r=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(e={left:Math.min(e.left,r.left),top:Math.min(e.top,r.top),right:Math.max(e.right,r.right),bottom:Math.max(e.bottom,r.bottom)}),r=Vc(this.view),e={left:e.left-r.left,top:e.top-r.top,right:e.right+r.right,bottom:e.bottom+r.bottom},mc(this.view.scrollDOM,e,i.head<i.anchor?-1:1,n.x,n.y,n.xMargin,n.yMargin,this.view.textDirection==E.LTR))}}]),e}(c),ei=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).height=t,n}return D(e,[{key:"toDOM",value:function t(){var n=document.createElement("div");return this.updateDOM(n),n}},{key:"eq",value:function t(n){return n.height==this.height}},{key:"updateDOM",value:function t(n){return n.style.height=this.height+"px",!0}},{key:"estimatedHeight",get:function t(){return this.height}}]),e}(tn),ri=function(t){f(o,t);var r=S(o);function o(t,n,i){var e;return A(this,o),(e=r.call(this)).top=t,e.text=n,e.topView=i,e}return D(o,[{key:"eq",value:function t(n){return this.top==n.top&&this.text==n.text}},{key:"toDOM",value:function t(){return this.top}},{key:"ignoreEvent",value:function t(){return!1}},{key:"customView",get:function t(){return an}}]),o}(tn),oi=function(){function t(){A(this,t),this.changes=[]}return D(t,[{key:"compareRange",value:function t(n,i){Hc(n,i,this.changes)}},{key:"comparePoint",value:function t(n,i){Hc(n,i,this.changes)}}]),t}(),ui=function(){function n(e){var r,i,t,o,r=this;for(o in A(this,n),this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,i=function t(n,i){r.ignoreDuringComposition(i)||"keydown"==i.type&&r.keydown(e,i)||(r.mustFlushObserver(i)&&e.observer.forceFlush(),r.runCustomHandlers(i.type,e,i)?i.preventDefault():n(e,i))},t=function t(){var n=s[o];e.contentDOM.addEventListener(o,function(t){jl(e,t)&&i(n,t)},li[o]),r.registeredEvents.push(o)},s)t();e.scrollDOM.addEventListener("mousedown",function(t){var n;t.target==e.scrollDOM&&t.clientY>e.contentDOM.getBoundingClientRect().bottom&&(i(s.mousedown,t),t.defaultPrevented||2!=t.button||(n=e.contentDOM.style.minHeight,e.contentDOM.style.minHeight="100%",setTimeout(function(){return e.contentDOM.style.minHeight=n},200)))}),e.scrollDOM.addEventListener("drop",function(t){t.target==e.scrollDOM&&t.clientY>e.contentDOM.getBoundingClientRect().bottom&&i(s.drop,t)}),g.chrome&&102==g.chrome_version&&e.scrollDOM.addEventListener("wheel",function(){r.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(r.chromeScrollHack),r.chromeScrollHack=setTimeout(function(){r.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,g.safari&&e.contentDOM.addEventListener("input",function(){return null})}return D(n,[{key:"setSelectionOrigin",value:function t(n){this.lastSelectionOrigin=n,this.lastSelectionTime=Date.now()}},{key:"ensureHandlers",value:function t(i,n){var e,r,o,u,s,a,f,h,e=this;this.customHandlers=[],u=F(n);try{for(u.s();!(s=u.n()).done;)if(o=null==(r=(a=s.value).update(i).spec)?void 0:r.domEventHandlers)for(h in this.customHandlers.push({plugin:a.value,handlers:o}),f=function t(n){e.registeredEvents.indexOf(n)<0&&"scroll"!=n&&(e.registeredEvents.push(n),i.contentDOM.addEventListener(n,function(t){jl(i,t)&&e.runCustomHandlers(n,i,t)&&t.preventDefault()}))},o)f(h)}catch(t){u.e(t)}finally{u.f()}}},{key:"runCustomHandlers",value:function t(n,i,e){var r,o,u,s,r=F(this.customHandlers);try{for(r.s();!(o=r.n()).done;)if(s=(u=o.value).handlers[n])try{if(s.call(u.plugin,e,i)||e.defaultPrevented)return!0}catch(t){Wc(i.state,t)}}catch(t){r.e(t)}finally{r.f()}return!1}},{key:"runScrollHandlers",value:function t(n,i){var e,r,o,u;this.lastScrollTop=n.scrollDOM.scrollTop,this.lastScrollLeft=n.scrollDOM.scrollLeft,e=F(this.customHandlers);try{for(e.s();!(r=e.n()).done;)if(u=(o=r.value).handlers.scroll)try{u.call(o.plugin,i,n)}catch(t){Wc(n.state,t)}}catch(t){e.e(t)}finally{e.f()}}},{key:"keydown",value:function t(n,i){var e,r,e=this;return this.lastKeyCode=i.keyCode,this.lastKeyTime=Date.now(),9==i.keyCode&&Date.now()<this.lastEscPress+2e3||(27!=i.keyCode&&fi.indexOf(i.keyCode)<0&&(n.inputState.lastEscPress=0),!g.android||!g.chrome||i.synthetic||13!=i.keyCode&&8!=i.keyCode?!(!g.ios||i.synthetic||i.altKey||i.metaKey||!((r=si.find(function(t){return t.keyCode==i.keyCode}))&&!i.ctrlKey||-1<ai.indexOf(i.key)&&i.ctrlKey&&!i.shiftKey)||(this.pendingIOSKey=r||i,setTimeout(function(){return e.flushIOSKey(n)},250),0)):(n.observer.delayAndroidKey(i.key,i.keyCode),!0))}},{key:"flushIOSKey",value:function t(n){var i=this.pendingIOSKey;return!!i&&(this.pendingIOSKey=void 0,wc(n.contentDOM,i.key,i.keyCode))}},{key:"ignoreDuringComposition",value:function t(n){return!!/^key/.test(n.type)&&(0<this.composing||!!(g.safari&&!g.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&!(this.compositionPendingKey=!1))}},{key:"mustFlushObserver",value:function t(n){return"keydown"==n.type&&229!=n.keyCode}},{key:"startMouseSelection",value:function t(n){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=n}},{key:"update",value:function t(n){this.mouseSelection&&this.mouseSelection.update(n),n.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}},{key:"destroy",value:function t(){this.mouseSelection&&this.mouseSelection.destroy()}}]),n}(),si=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],ai="dthko",fi=[16,17,18,20,91,92,224,225],hi=6,ci=function(){function r(n,t,i,e){A(this,r),this.view=n,this.style=i,this.mustSelect=e,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=pc(n.contentDOM),this.atoms=n.state.facet(Ln).map(function(t){return t(n)});var i=n.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=n.state.facet(C.allowMultipleSelections)&&xl(n,t),this.dragMove=Sl(n,t),this.dragging=!(!Cl(n,t)||1!=Rl(t))&&null}return D(r,[{key:"start",value:function t(n){!1===this.dragging&&(n.preventDefault(),this.select(n))}},{key:"move",value:function t(n){var i,e,r,i,o;if(0==n.buttons)return this.destroy();!1===this.dragging&&(this.select(this.lastEvent=n),r=e=0,i=(null==(i=this.scrollParent)?void 0:i.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=Vc(this.view),n.clientX-o.left<=i.left+6?e=-Ml(i.left-n.clientX):n.clientX+o.right>=i.right-6&&(e=Ml(n.clientX-i.right)),n.clientY-o.top<=i.top+6?r=-Ml(i.top-n.clientY):n.clientY+o.bottom>=i.bottom-6&&(r=Ml(n.clientY-i.bottom)),this.setScrollSpeed(e,r))}},{key:"up",value:function t(n){null==this.dragging&&this.select(this.lastEvent),this.dragging||n.preventDefault(),this.destroy()}},{key:"destroy",value:function t(){this.setScrollSpeed(0,0);var n=this.view.contentDOM.ownerDocument;n.removeEventListener("mousemove",this.move),n.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}},{key:"setScrollSpeed",value:function t(n,i){var e=this;this.scrollSpeed={x:n,y:i},n||i?this.scrolling<0&&(this.scrolling=setInterval(function(){return e.scroll()},50)):-1<this.scrolling&&(clearInterval(this.scrolling),this.scrolling=-1)}},{key:"scroll",value:function t(){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 t(n){for(var i,e,r,o,u,u,s,i=null,e=0;e<n.ranges.length;e++)o=null,(r=n.ranges[e]).empty?(u=wl(this.atoms,r.from,0))!=r.from&&(o=O.cursor(u,-1)):(u=wl(this.atoms,r.from,-1),s=wl(this.atoms,r.to,1),u==r.from&&s==r.to||(o=O.range(r.from==r.anchor?u:s,r.from==r.head?u:s))),o&&((i=i||n.ranges.slice())[e]=o);return i?O.create(i,n.mainIndex):n}},{key:"select",value:function t(n){var i=this.view,n=this.skipAtoms(this.style.get(n,this.extend,this.multiple));!this.mustSelect&&n.eq(i.state.selection)&&n.main.assoc==i.state.selection.main.assoc||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}},{key:"update",value:function t(n){var i=this;n.docChanged&&this.dragging&&(this.dragging=this.dragging.map(n.changes)),this.style.update(n)&&setTimeout(function(){return i.select(i.lastEvent)},20)}}]),r}(),s=Object.create(null),li=Object.create(null),vi=g.ie&&g.ie_version<15||g.ios&&g.webkit_version<604,s.keydown=function(t,n){t.inputState.setSelectionOrigin("select"),27==n.keyCode&&(t.inputState.lastEscPress=Date.now())},s.touchstart=function(t,n){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},s.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer")},li.touchstart=li.touchmove={passive:!0},s.mousedown=function(t,n){var i,e,r,o,u;if(t.observer.flush(),!(t.inputState.lastTouchTime>Date.now()-2e3)){i=null,e=F(t.state.facet(gn));try{for(e.s();!(r=e.n()).done&&!(i=(o=r.value)(t,n)););}catch(t){e.e(t)}finally{e.f()}(i=i||0!=n.button?i:Il(t,n))&&(u=t.root.activeElement!=t.contentDOM,t.inputState.startMouseSelection(new ci(t,n,i,u)),u&&t.observer.ignore(function(){return kc(t.contentDOM)}),t.inputState.mouseSelection)&&t.inputState.mouseSelection.start(n)}},di=function t(n,i){return n>=i.top&&n<=i.bottom},yi=function t(n,i,e){return di(i,e)&&n>=e.left&&n<=e.right},mi=g.ie&&g.ie_version<=11,pi=null,gi=ki=0,s.dragstart=function(t,n){var i,e,i=t.state.selection.main,e=t.inputState.mouseSelection;e&&(e.dragging=i),n.dataTransfer&&(n.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),n.dataTransfer.effectAllowed="copyMove")},s.drop=function(n,i){var e,r,o,u,t,s;if(i.dataTransfer){if(n.state.readOnly)return i.preventDefault();if((e=i.dataTransfer.files)&&e.length)for(i.preventDefault(),r=Array(e.length),u=function t(){++o==e.length&&Ll(n,i,r.filter(function(t){return null!=t}).join(n.state.lineBreak),!1)},t=function t(n){var i=new FileReader;i.onerror=u,i.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(i.result)||(r[n]=i.result),u()},i.readAsText(e[n])},s=o=0;s<e.length;s++)t(s);else Ll(n,i,i.dataTransfer.getData("Text"),!0)}},s.paste=function(t,n){if(t.state.readOnly)return n.preventDefault();t.observer.flush();var i=vi?null:n.clipboardData;i?(Ol(t,i.getData("text/plain")||i.getData("text/uri-text")),n.preventDefault()):Pl(t)},wi=null,s.copy=s.cut=function(t,n){var i,e,r,i,i,i=_l(t.state),e=i.text,r=i.ranges,i=i.linewise;(e||i)&&(wi=i?e:null,(i=vi?null:n.clipboardData)?(n.preventDefault(),i.clearData(),i.setData("text/plain",e)):Bl(t,e),"cut"!=n.type||t.state.readOnly||t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"}))},bi=gt.define(),s.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),Nl(t)},s.blur=function(t){t.observer.clearSelectionRange(),Nl(t)},s.compositionstart=s.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},s.compositionend=function(t){t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=0<t.observer.pendingRecords().length,t.inputState.compositionFirstChange=null,g.chrome&&g.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(function(){return t.observer.flush()}):setTimeout(function(){t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])},50)},s.contextmenu=function(t){t.inputState.lastContextMenu=Date.now()},s.beforeinput=function(n,i){var t,t,e;g.chrome&&g.android&&(t=si.find(function(t){return t.inputType==i.inputType}))&&(n.observer.delayAndroidKey(t.key,t.keyCode),"Backspace"!=t.key&&"Delete"!=t.key||(e=(null==(t=window.visualViewport)?void 0:t.height)||0,setTimeout(function(){var t;((null==(t=window.visualViewport)?void 0:t.height)||0)>e+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)))},Mi=["pre-wrap","normal","pre-line","break-spaces"],xi=function(){function n(t){A(this,n),this.lineWrapping=t,this.doc=k.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}return D(n,[{key:"heightForGap",value:function t(n,i){var e=this.doc.lineAt(i).number-this.doc.lineAt(n).number+1;return this.lineWrapping&&(e+=Math.max(0,Math.ceil((i-n-e*this.lineLength*.5)/this.lineLength))),this.lineHeight*e}},{key:"heightForLine",value:function t(n){var i;return this.lineWrapping?(1+Math.max(0,Math.ceil((n-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}},{key:"setDoc",value:function t(n){return this.doc=n,this}},{key:"mustRefreshForWrapping",value:function t(n){return-1<Mi.indexOf(n)!=this.lineWrapping}},{key:"mustRefreshForHeights",value:function t(n){for(var i,e,r,i=!1,e=0;e<n.length;e++)(r=n[e])<0?e++:this.heightSamples[Math.floor(10*r)]||(i=!0,this.heightSamples[Math.floor(10*r)]=!0);return i}},{key:"refresh",value:function t(n,i,e,r,o,u){var n,s,a,f,n=-1<Mi.indexOf(n),s=Math.round(i)!=Math.round(this.lineHeight)||this.lineWrapping!=n;if(this.lineWrapping=n,this.lineHeight=i,this.charWidth=e,this.textHeight=r,this.lineLength=o,s)for(this.heightSamples={},a=0;a<u.length;a++)(f=u[a])<0?a++:this.heightSamples[Math.floor(10*f)]=!0;return s}}]),n}(),Si=function(){function i(t,n){A(this,i),this.from=t,this.heights=n,this.index=0}return D(i,[{key:"more",get:function t(){return this.index<this.heights.length}}]),i}(),Ci=function(){function u(t,n,i,e,r,o){A(this,u),this.from=t,this.length=n,this.top=i,this.height=e,this.children=r,this.deco=o}return D(u,[{key:"type",get:function t(){var n,n,n;return null!=(n=null!=(n=this.children)?n:null==(n=this.deco)?void 0:n.type)?n:P.Text}},{key:"widget",get:function t(){return this.deco&&this.deco.widget}},{key:"to",get:function t(){return this.from+this.length}},{key:"bottom",get:function t(){return this.top+this.height}},{key:"join",value:function t(n){var i=(this.children||[this]).concat(n.children||[n]);return new u(this.from,this.length+n.length,this.top,this.height+n.height,i,null)}}]),u}(),p=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(p=p||{}),ji=.001,(Pi=function(){function f(t,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:2;A(this,f),this.length=t,this.height=n,this.flags=i}return D(f,[{key:"outdated",get:function t(){return 0<(2&this.flags)},set:function t(n){this.flags=(n?2:0)|-3&this.flags}},{key:"setHeight",value:function t(n,i){this.height!=i&&(Math.abs(this.height-i)>ji&&(n.heightChanged=!0),this.height=i)}},{key:"replace",value:function t(n,i,e){return f.of(e)}},{key:"decomposeLeft",value:function t(n,i){i.push(this)}},{key:"decomposeRight",value:function t(n,i){i.push(this)}},{key:"applyChanges",value:function t(n,i,e,r){for(var o,u,s,a,f,h,c,a,l,v,v,o=this,u=e.doc,s=r.length-1;0<=s;s--){for(f=(a=r[s]).fromA,h=a.toA,c=a.fromB,a=a.toB,a+=(v=(l=o.lineAt(f,p.ByPosNoHeight,e.setDoc(i),0,0)).to>=h?l:o.lineAt(h,p.ByPosNoHeight,e,0,0)).to-h,h=v.to;0<s&&l.from<=r[s-1].toA;)f=r[s-1].fromA,c=r[s-1].fromB,s--,f<l.from&&(l=o.lineAt(f,p.ByPosNoHeight,e,0,0));c+=l.from-f,f=l.from,v=Ii.build(e.setDoc(u),n,c,a),o=o.replace(f,h,v)}return o.updateHeight(e,0)}}],[{key:"empty",value:function t(){return new Ei(0,0)}},{key:"of",value:function t(n){var i,e,r,o,u,u,s,s,a;if(1==n.length)return n[0];for(e=n.length,o=r=i=0;;)if(i==e)if(2*o<r)(u=n[i-1]).break?n.splice(--i,1,u.left,null,u.right):n.splice(--i,1,u.left,u.right),e+=1+u.break,r-=u.size;else{if(!(2*r<o))break;(u=n[e]).break?n.splice(e,1,u.left,null,u.right):n.splice(e,1,u.left,u.right),e+=2+u.break,o-=u.size}else r<o?(s=n[i++])&&(r+=s.size):(s=n[--e])&&(o+=s.size);return a=0,null==n[i-1]?(a=1,i--):null==n[i]&&(a=1,e++),new Di(f.of(n.slice(0,i)),a,f.of(n.slice(e)))}}]),f}()).prototype.size=1,Ei=function(t){f(o,t);var i=S(o);function o(t,n){var t;return A(this,o),(t=i.call(this,t,n,null)).collapsed=0,t.widgetHeight=0,t}return D(o,[{key:"replace",value:function t(n,i,e){var r=e[0];return 1==e.length&&(r instanceof o||r instanceof Ai&&4&r.flags)&&Math.abs(this.length-r.length)<10?(r instanceof Ai?r=new o(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):Pi.of(e)}},{key:"updateHeight",value:function t(n){var i,e,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length?arguments[3]:void 0;return r&&r.from<=i&&r.more?this.setHeight(n,r.heights[r.index++]):(e||this.outdated)&&this.setHeight(n,Math.max(this.widgetHeight,n.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}},{key:"toString",value:function t(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}]),o}(Oi=function(t){f(r,t);var e=S(r);function r(t,n,i){var t;return A(this,r),(t=e.call(this,t,n)).deco=i,t}return D(r,[{key:"blockAt",value:function t(n,i,e,r){return new Ci(r,this.length,e,this.height,null,this.deco)}},{key:"lineAt",value:function t(n,i,e,r,o){return this.blockAt(0,e,r,o)}},{key:"forEachLine",value:function t(n,i,e,r,o,u){n<=o+this.length&&o<=i&&u(this.blockAt(0,e,r,o))}},{key:"updateHeight",value:function t(n){var i,e,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length?arguments[3]:void 0;return r&&r.from<=i&&r.more&&this.setHeight(n,r.heights[r.index++]),this.outdated=!1,this}},{key:"toString",value:function t(){return"block(".concat(this.length,")")}}]),r}(Pi)),Ai=function(t){f(l,t);var n=S(l);function l(t){return A(this,l),n.call(this,t,0)}return D(l,[{key:"heightMetrics",value:function t(n,i){var e,i,r,o,u,n,e=n.doc.lineAt(i).number,i=n.doc.lineAt(i+this.length).number,r=i-e+1,u=0;return n.lineWrapping?(o=(n=Math.min(this.height,n.lineHeight*r))/r,this.length>1+r&&(u=(this.height-n)/(this.length-r-1))):o=this.height/r,{firstLine:e,lastLine:i,perLine:o,perChar:u}}},{key:"blockAt",value:function t(n,i,e,r){var o,u,s,a,o,r,r,o,f,r,f,o,s,o=this.heightMetrics(i,r),u=o.firstLine,s=o.lastLine,a=o.perLine,o=o.perChar;return i.lineWrapping?(r=r+Math.round(Math.max(0,Math.min(1,(n-e)/this.height))*this.length),o=a+(r=i.doc.lineAt(r)).length*o,f=Math.max(e,n-o/2),new Ci(r.from,r.length,f,o,null,null)):(r=Math.max(0,Math.min(s-u,Math.floor((n-e)/a))),o=(f=i.doc.line(u+r)).from,s=f.length,new Ci(o,s,e+a*r,a,null,null))}},{key:"lineAt",value:function t(n,i,e,r,o){var i,u,i,i,u,s,i,e,n,s,u;return i==p.ByHeight?this.blockAt(n,e,r,o):i==p.ByPosNoHeight?(u=(i=e.doc.lineAt(n)).from,i=i.to,new Ci(u,i-u,0,0,null,null)):(u=(i=this.heightMetrics(e,o)).firstLine,s=i.perLine,i=i.perChar,n=s+(e=e.doc.lineAt(n)).length*i,u=r+s*(s=e.number-u)+i*(e.from-o-s),new Ci(e.from,e.length,Math.max(r,Math.min(u,r+this.height-n)),n,null,null))}},{key:"forEachLine",value:function t(n,i,e,r,o,u){var s,a,f,h,c,l,v,d,d;for(n=Math.max(n,o),i=Math.min(i,o+this.length),a=(s=this.heightMetrics(e,o)).firstLine,f=s.perLine,h=s.perChar,c=n,l=r;c<=i;)v=e.doc.lineAt(c),c==n&&(l+=f*(d=v.number-a)+h*(n-o-d)),d=f+h*v.length,u(new Ci(v.from,v.length,l,d,null,null)),l+=d,c=v.to+1}},{key:"replace",value:function t(n,i,e){var i,r,r,i=this.length-i;return 0<i&&((r=e[e.length-1])instanceof l?e[e.length-1]=new l(r.length+i):e.push(null,new l(i-1))),0<n&&((r=e[0])instanceof l?e[0]=new l(n+r.length):e.unshift(new l(n-1),null)),Pi.of(e)}},{key:"decomposeLeft",value:function t(n,i){i.push(new l(n-1),null)}},{key:"decomposeRight",value:function t(n,i){i.push(null,new l(this.length-n-1))}},{key:"updateHeight",value:function t(n){var i,e,r,o,u,s,a,f,h,h,c,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length?arguments[3]:void 0,o=i+this.length;if(r&&r.from<=i+this.length&&r.more){for(u=[],s=Math.max(i,r.from),a=-1,r.from>i&&u.push(new l(r.from-i-1).updateHeight(n,i));s<=o&&r.more;)f=n.doc.lineAt(s).length,u.length&&u.push(null),h=r.heights[r.index++],-1==a?a=h:Math.abs(h-a)>=ji&&(a=-2),(h=new Ei(f,h)).outdated=!1,u.push(h),s+=f+1;return s<=o&&u.push(null,new l(o-s).updateHeight(n,s)),c=Pi.of(u),(a<0||Math.abs(c.height-this.height)>=ji||Math.abs(a-this.heightMetrics(n,i).perLine)>=ji)&&(n.heightChanged=!0),c}return(e||this.outdated)&&(this.setHeight(n,n.heightForGap(i,i+this.length)),this.outdated=!1),this}},{key:"toString",value:function t(){return"gap(".concat(this.length,")")}}]),l}(Pi),Di=function(t){f(r,t);var e=S(r);function r(t,n,i){var n;return A(this,r),(n=e.call(this,t.length+n+i.length,t.height+i.height,n|(t.outdated||i.outdated?2:0))).left=t,n.right=i,n.size=t.size+i.size,n}return D(r,[{key:"break",get:function t(){return 1&this.flags}},{key:"blockAt",value:function t(n,i,e,r){var o=e+this.left.height;return n<o?this.left.blockAt(n,i,e,r):this.right.blockAt(n,i,o,r+this.left.length+this.break)}},{key:"lineAt",value:function t(n,i,e,r,o){var u,s,a,n,i,u=r+this.left.height,s=o+this.left.length+this.break,a=i==p.ByHeight?n<u:n<s,n=a?this.left.lineAt(n,i,e,r,o):this.right.lineAt(n,i,e,u,s);return this.break||(a?n.to<s:n.from>s)?n:(i=i==p.ByPosNoHeight?p.ByPosNoHeight:p.ByPos,a?n.join(this.right.lineAt(s,i,e,u,s)):this.left.lineAt(s,i,e,r,o).join(n))}},{key:"forEachLine",value:function t(n,i,e,r,o,u){var s,a,f,s=r+this.left.height,a=o+this.left.length+this.break;this.break?(n<a&&this.left.forEachLine(n,i,e,r,o,u),a<=i&&this.right.forEachLine(n,i,e,s,a,u)):(n<(f=this.lineAt(a,p.ByPos,e,r,o)).from&&this.left.forEachLine(n,f.from-1,e,r,o,u),f.to>=n&&f.from<=i&&u(f),i>f.to&&this.right.forEachLine(f.to+1,i,e,s,a,u))}},{key:"replace",value:function t(n,i,e){var r,o,r,u,s,a,e,r=this.left.length+this.break;if(i<r)return this.balanced(this.left.replace(n,i,e),this.right);if(n>this.left.length)return this.balanced(this.left,this.right.replace(n-r,i-r,e));o=[],0<n&&this.decomposeLeft(n,o),r=o.length,u=F(e);try{for(u.s();!(s=u.n()).done;)a=s.value,o.push(a)}catch(t){u.e(t)}finally{u.f()}return 0<n&&Ul(o,r-1),i<this.length&&(e=o.length,this.decomposeRight(i,o),Ul(o,e)),Pi.of(o)}},{key:"decomposeLeft",value:function t(n,i){var e=this.left.length;if(n<=e)return this.left.decomposeLeft(n,i);i.push(this.left),this.break&&++e<=n&&i.push(null),e<n&&this.right.decomposeLeft(n-e,i)}},{key:"decomposeRight",value:function t(n,i){var e=this.left.length,r=e+this.break;if(r<=n)return this.right.decomposeRight(n-r,i);n<e&&this.left.decomposeRight(n,i),this.break&&n<r&&i.push(null),i.push(this.right)}},{key:"balanced",value:function t(n,i){return n.size>2*i.size||i.size>2*n.size?Pi.of(this.break?[n,null,i]:[n,i]):(this.left=n,this.right=i,this.height=n.height+i.height,this.outdated=n.outdated||i.outdated,this.size=n.size+i.size,this.length=n.length+this.break+i.length,this)}},{key:"updateHeight",value:function t(n){var i,e,r,o,u,s,a,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]&&arguments[2],r=3<arguments.length?arguments[3]:void 0,o=this.left,u=this.right,s=i+o.length+this.break,a=null;return r&&r.from<=i+o.length&&r.more?a=o=o.updateHeight(n,i,e,r):o.updateHeight(n,i,e),r&&r.from<=s+u.length&&r.more?a=u=u.updateHeight(n,s,e,r):u.updateHeight(n,s,e),a?this.balanced(o,u):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}},{key:"toString",value:function t(){return this.left+(this.break?" ":"-")+this.right}}]),r}(Pi),Ri=5,Ii=function(){function o(t,n){A(this,o),this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}return D(o,[{key:"isCovered",get:function t(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}},{key:"span",value:function t(n,i){var e,r;-1<this.lineStart&&(e=Math.min(i,this.lineEnd),(r=this.nodes[this.nodes.length-1])instanceof Ei?r.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Ei(e-this.pos,-1)),(this.writtenTo=e)<i)&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1),this.pos=i}},{key:"point",value:function t(n,i,e){var r,o;n<i||e.heightRelevant?((r=e.widget?e.widget.estimatedHeight:0)<0&&(r=this.oracle.lineHeight),o=i-n,e.block?this.addBlock(new Oi(o,r,e)):(o||5<=r)&&this.addLineDeco(r,o)):n<i&&this.span(n,i),-1<this.lineEnd&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}},{key:"enterLine",value:function t(){var n,i,n;-1<this.lineStart||(i=(n=this.oracle.doc.lineAt(this.pos)).from,n=n.to,this.lineStart=i,this.lineEnd=n,this.writtenTo<i&&((this.writtenTo<i-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,i-1)),this.nodes.push(null)),this.pos>i&&this.nodes.push(new Ei(this.pos-i,-1)),this.writtenTo=this.pos)}},{key:"blankContent",value:function t(n,i){var e=new Ai(i-n);return this.oracle.doc.lineAt(n).to==i&&(e.flags|=4),e}},{key:"ensureLine",value:function t(){var n,n;return this.enterLine(),(n=this.nodes.length?this.nodes[this.nodes.length-1]:null)instanceof Ei||(n=new Ei(0,-1),this.nodes.push(n)),n}},{key:"addBlock",value:function t(n){var i,i;this.enterLine(),(i=null==(i=n.deco)?void 0:i.type)!=P.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(n),this.writtenTo=this.pos=this.pos+n.length,i!=P.WidgetBefore&&(this.covering=n)}},{key:"addLineDeco",value:function t(n,i){var e=this.ensureLine();e.length+=i,e.collapsed+=i,e.widgetHeight=Math.max(e.widgetHeight,n),this.writtenTo=this.pos=this.pos+i}},{key:"finish",value:function t(n){var i,e,r,o,u,i=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(-1<this.lineStart)||i instanceof Ei||this.isCovered?(this.writtenTo<this.pos||null==i)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Ei(0,-1)),e=n,r=F(this.nodes);try{for(r.s();!(o=r.n()).done;)(u=o.value)instanceof Ei&&u.updateHeight(this.oracle,e),e+=u?u.length:1}catch(t){r.e(t)}finally{r.f()}return this.nodes}}],[{key:"build",value:function t(n,i,e,r){var n=new o(e,n);return j.spans(i,e,r,n,0),n.finish(e)}}]),o}(),Ti=function(){function t(){A(this,t),this.changes=[]}return D(t,[{key:"compareRange",value:function t(){}},{key:"comparePoint",value:function t(n,i,e,r){(n<i||e&&e.heightRelevant||r&&r.heightRelevant)&&Hc(n,i,this.changes,5)}}]),t}(),Li=function(){function e(t,n,i){A(this,e),this.from=t,this.to=n,this.size=i}return D(e,[{key:"draw",value:function t(n){return m.replace({widget:new Bi(this.size,n)}).range(this.from,this.to)}}],[{key:"same",value:function t(n,i){var e,r,o;if(n.length!=i.length)return!1;for(e=0;e<n.length;e++)if(r=n[e],o=i[e],r.from!=o.from||r.to!=o.to||r.size!=o.size)return!1;return!0}}]),e}(),Bi=function(t){f(r,t);var e=S(r);function r(t,n){var i;return A(this,r),(i=e.call(this)).size=t,i.vertical=n,i}return D(r,[{key:"eq",value:function t(n){return n.size==this.size&&n.vertical==this.vertical}},{key:"toDOM",value:function t(){var n=document.createElement("div");return this.vertical?n.style.height=this.size+"px":(n.style.width=this.size+"px",n.style.height="2px",n.style.display="inline-block"),n}},{key:"estimatedHeight",get:function t(){return this.vertical?this.size:-1}}]),r}(tn),_i=function(){function i(t){A(this,i),this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaler=Ni,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=E.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;var n=t.facet(In).some(function(t){return"function"!=typeof t&&"cm-lineWrapping"==t.class});this.heightOracle=new xi(n),this.stateDeco=t.facet(Tn).filter(function(t){return"function"!=typeof t}),this.heightMap=Pi.empty().applyChanges(this.stateDeco,k.empty,this.heightOracle.setDoc(t.doc),[new Fn(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=m.set(this.lineGaps.map(function(t){return t.draw(!1)})),this.computeVisibleRanges()}return D(i,[{key:"updateForViewport",value:function t(){for(var r,o,u,n,s,r=this,o=[this.viewport],u=this.state.selection.main,n=function t(){var i,n,e,n,i=s?u.head:u.anchor;o.some(function(t){var n=t.from,t=t.to;return n<=i&&i<=t})||(e=(n=r.lineBlockAt(i)).from,n=n.to,o.push(new Fi(e,n)))},s=0;s<=1;s++)n();this.viewports=o.sort(function(t,n){return t.from-n.from}),this.scaler=this.heightMap.height<=7e6?Ni:new Ui(this.heightOracle,this.heightMap,this.viewports)}},{key:"updateViewportLines",value:function t(){var n=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,function(t){n.viewportLines.push(1==n.scaler.scale?t:Jl(t,n.scaler))})}},{key:"update",value:function t(n){var i,e,r,r,e,e,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;this.state=n.state,e=this.stateDeco,this.stateDeco=this.state.facet(Tn).filter(function(t){return"function"!=typeof t}),r=n.changedRanges,r=Fn.extendWithRanges(r,Hl(e,this.stateDeco,n?n.changes:K.empty(this.state.doc.length))),e=this.heightMap.height,this.heightMap=this.heightMap.applyChanges(this.stateDeco,n.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=e&&(n.flags|=2),e=r.length?this.mapViewport(this.viewport,n.changes):this.viewport,(i&&(i.range.head<e.from||i.range.head>e.to)||!this.viewportIsAppropriate(e))&&(e=this.getViewport(0,i)),r=!n.changes.empty||2&n.flags||e.from!=this.viewport.from||e.to!=this.viewport.to,this.viewport=e,this.updateForViewport(),r&&this.updateViewportLines(),(this.lineGaps.length||4e3<this.viewport.to-this.viewport.from)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,n.changes))),n.flags|=this.computeVisibleRanges(),i&&(this.scrollTarget=i),!this.mustEnforceCursorAssoc&&n.selectionSet&&n.view.lineWrapping&&n.state.selection.main.empty&&n.state.selection.main.assoc&&!n.state.facet(Cn)&&(this.mustEnforceCursorAssoc=!0)}},{key:"measure",value:function t(n){var i,e,r,o,u,s,a,f,h,c,e,c,e,i,c,c,l,s,a,v,s,d,y,m,p,o,i=n.contentDOM,e=window.getComputedStyle(i),r=this.heightOracle,o=e.whiteSpace;if(this.defaultTextDirection="rtl"==e.direction?E.RTL:E.LTR,u=this.heightOracle.mustRefreshForWrapping(o),s=i.getBoundingClientRect(),a=u||this.mustMeasureContent||this.contentDOMHeight!=s.height,this.contentDOMHeight=s.height,this.mustMeasureContent=!1,h=f=0,c=parseInt(e.paddingTop)||0,e=parseInt(e.paddingBottom)||0,this.paddingTop==c&&this.paddingBottom==e||(this.paddingTop=c,this.paddingBottom=e,f|=10),this.editorWidth!=n.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=n.scrollDOM.clientWidth,f|=8),e=(c=(this.printing?Wl:zl)(i,this.paddingTop)).top-this.pixelViewport.top,i=c.bottom-this.pixelViewport.bottom,this.pixelViewport=c,(c=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left)!=this.inView&&(this.inView=c)&&(a=!0),!this.inView&&!this.scrollTarget)return 0;if(c=s.width,this.contentDOMWidth==c&&this.editorHeight==n.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=n.scrollDOM.clientHeight,f|=8),a){l=n.docView.measureVisibleLineHeights(this.viewport),((u=r.mustRefreshForHeights(l)?!0:u)||r.lineWrapping&&Math.abs(c-this.contentDOMWidth)>r.charWidth)&&(a=(s=n.docView.measureTextSize()).lineHeight,v=s.charWidth,s=s.textHeight,u=0<a&&r.refresh(o,a,v,s,c/v,l))&&(n.docView.minWidth=0,f|=8),0<e&&0<i?h=Math.max(e,i):e<0&&i<0&&(h=Math.min(e,i)),r.heightChanged=!1,d=F(this.viewports);try{for(d.s();!(y=d.n()).done;)p=(m=y.value).from==this.viewport.from?l:n.docView.measureVisibleLineHeights(m),this.heightMap=(u?Pi.empty().applyChanges(this.stateDeco,k.empty,this.heightOracle,[new Fn(0,0,0,n.state.doc.length)]):this.heightMap).updateHeight(r,0,u,new Si(m.from,p))}catch(t){d.e(t)}finally{d.f()}r.heightChanged&&(f|=2)}return(o=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to))&&(this.viewport=this.getViewport(h,this.scrollTarget)),this.updateForViewport(),(2&f||o)&&this.updateViewportLines(),(this.lineGaps.length||4e3<this.viewport.to-this.viewport.from)&&this.updateLineGaps(this.ensureLineGaps(u?[]:this.lineGaps,n)),f|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,n.docView.enforceCursorAssoc()),f}},{key:"visibleTop",get:function t(){return this.scaler.fromDOM(this.pixelViewport.top)}},{key:"visibleBottom",get:function t(){return this.scaler.fromDOM(this.pixelViewport.bottom)}},{key:"getViewport",value:function t(n,i){var n,e,r,o,u,o,u,n,s,i,n=.5-Math.max(-.5,Math.min(.5,n/1e3/2)),e=this.heightMap,r=this.heightOracle,o=this.visibleTop,u=this.visibleBottom,o=new Fi(e.lineAt(o-1e3*n,p.ByHeight,r,0,0).from,e.lineAt(u+1e3*(1-n),p.ByHeight,r,0,0).to);return i&&((u=i.range.head)<o.from||u>o.to)&&(n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=e.lineAt(u,p.ByPos,r,0,0),i="center"==i.y?(s.top+s.bottom)/2-n/2:"start"==i.y||"nearest"==i.y&&u<o.from?s.top:s.bottom-n,o=new Fi(e.lineAt(i-500,p.ByHeight,r,0,0).from,e.lineAt(i+n+500,p.ByHeight,r,0,0).to)),o}},{key:"mapViewport",value:function t(n,i){var e=i.mapPos(n.from,-1),i=i.mapPos(n.to,1);return new Fi(this.heightMap.lineAt(e,p.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,p.ByPos,this.heightOracle,0,0).to)}},{key:"viewportIsAppropriate",value:function t(n){var i,n,e,r,o,u,s,a,f,i=n.from,n=n.to,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return!this.inView||(o=(r=this.heightMap.lineAt(i,p.ByPos,this.heightOracle,0,0)).top,s=(u=this.heightMap.lineAt(n,p.ByPos,this.heightOracle,0,0)).bottom,a=this.visibleTop,f=this.visibleBottom,(0==i||o<=a-Math.max(10,Math.min(-e,250)))&&(n==this.state.doc.length||s>=f+Math.max(10,Math.min(e,250)))&&a-2e3<o&&s<f+2e3)}},{key:"mapLineGaps",value:function t(n,i){var e,r,o,u;if(!n.length||i.empty)return n;e=[],r=F(n);try{for(r.s();!(o=r.n()).done;)u=o.value,i.touchesRange(u.from,u.to)||e.push(new Li(i.mapPos(u.from),i.mapPos(u.to),u.size))}catch(t){r.e(t)}finally{r.f()}return e}},{key:"ensureLineGaps",value:function t(c,l){var v,d,n,y,i,m,e,r,o,u,s,a,f,h,p,k,g,w,b,M,x,S,C,j,P,v=this,d=this.heightOracle.lineWrapping,n=d?1e4:2e3,y=n>>1,i=n<<1;if(this.defaultTextDirection!=E.LTR&&!d)return[];m=[],e=function t(i,e,r,n){var o,u,s,a,f,o,h;if(!(e-i<y)){for(o=v.state.selection.main,u=[o.from],o.empty||u.push(o.to),s=0,a=u;s<a.length;s++)if(i<(f=a[s])&&f<e)return t(i,f-10,r,n),void t(f+10,e,r,n);(o=Gl(c,function(n){return n.from>=r.from&&n.to<=r.to&&Math.abs(n.from-i)<y&&Math.abs(n.to-e)<y&&!u.some(function(t){return n.from<t&&n.to>t})}))||(e<r.to&&l&&d&&l.visibleRanges.some(function(t){return t.from<=e&&t.to>=e})&&(h=l.moveToLineBoundary(O.cursor(e),!1,!0).head,i<h)&&(e=h),o=new Li(i,e,v.gapSize(r,i,e,n))),m.push(o)}},r=F(this.viewportLines);try{for(r.s();!(o=r.n()).done;)(u=o.value).length<i||(s=Vl(u.from,u.to,this.stateDeco)).total<i||(a=this.scrollTarget?this.scrollTarget.range.head:null,h=f=void 0,h=d?(p=n/this.heightOracle.lineLength*this.heightOracle.lineHeight,g=k=void 0,g=null!=a?(k=(w=ql(s,a))-(b=((this.visibleBottom-this.visibleTop)/2+p)/u.height),w+b):(k=(this.visibleTop-u.top-p)/u.height,(this.visibleBottom-u.top+p)/u.height),f=$l(s,k),$l(s,g)):(M=s.total*this.heightOracle.charWidth,x=n*this.heightOracle.charWidth,C=S=void 0,C=null!=a?(S=(j=ql(s,a))-(P=((this.pixelViewport.right-this.pixelViewport.left)/2+x)/M),j+P):(S=(this.pixelViewport.left-x)/M,(this.pixelViewport.right+x)/M),f=$l(s,S),$l(s,C)),f>u.from&&e(u.from,f,u,s),h<u.to&&e(h,u.to,u,s))}catch(t){r.e(t)}finally{r.f()}return m}},{key:"gapSize",value:function t(n,i,e,r){var e=ql(r,e)-ql(r,i);return this.heightOracle.lineWrapping?n.height*e:r.total*this.heightOracle.charWidth*e}},{key:"updateLineGaps",value:function t(n){var i=this;Li.same(n,this.lineGaps)||(this.lineGaps=n,this.lineGapDeco=m.set(n.map(function(t){return t.draw(i.heightOracle.lineWrapping)})))}},{key:"computeVisibleRanges",value:function t(){var n,e,n,n=this.stateDeco;return this.lineGaps.length&&(n=n.concat(this.lineGapDeco)),e=[],j.spans(n,this.viewport.from,this.viewport.to,{span:function t(n,i){e.push({from:n,to:i})},point:function t(){}},20),n=e.length!=this.visibleRanges.length||this.visibleRanges.some(function(t,n){return t.from!=e[n].from||t.to!=e[n].to}),this.visibleRanges=e,n?4:0}},{key:"lineBlockAt",value:function t(n){return n>=this.viewport.from&&n<=this.viewport.to&&this.viewportLines.find(function(t){return t.from<=n&&t.to>=n})||Jl(this.heightMap.lineAt(n,p.ByPos,this.heightOracle,0,0),this.scaler)}},{key:"lineBlockAtHeight",value:function t(n){return Jl(this.heightMap.lineAt(this.scaler.fromDOM(n),p.ByHeight,this.heightOracle,0,0),this.scaler)}},{key:"elementAtHeight",value:function t(n){return Jl(this.heightMap.blockAt(this.scaler.fromDOM(n),this.heightOracle,0,0),this.scaler)}},{key:"docHeight",get:function t(){return this.scaler.toDOM(this.heightMap.height)}},{key:"contentHeight",get:function t(){return this.docHeight+this.paddingTop+this.paddingBottom}}]),i}(),Fi=D(function t(n,i){A(this,t),this.from=n,this.to=i}),Ni={toDOM:function t(n){return n},fromDOM:function t(n){return n},scale:1},Ui=function(){function f(r,o,t){var u,n,i,e,s,a;A(this,f),i=n=u=0,this.viewports=t.map(function(t){var n,t,i,e,n=t.from,t=t.to,i=o.lineAt(n,p.ByPos,r,0,0).top,e=o.lineAt(t,p.ByPos,r,0,0).bottom;return u+=e-i,{from:n,to:t,top:i,bottom:e,domTop:0,domBottom:0}}),this.scale=(7e6-u)/(o.height-u),e=F(this.viewports);try{for(e.s();!(s=e.n()).done;)(a=s.value).domTop=i+(a.top-n)*this.scale,i=a.domBottom=a.domTop+(a.bottom-a.top),n=a.bottom}catch(t){e.e(t)}finally{e.f()}}return D(f,[{key:"toDOM",value:function t(n){for(var i,e,r,o,i=0,e=0,r=0;;i++){if(!(o=i<this.viewports.length?this.viewports[i]:null)||n<o.top)return r+(n-e)*this.scale;if(n<=o.bottom)return o.domTop+(n-o.top);e=o.bottom,r=o.domBottom}}},{key:"fromDOM",value:function t(n){for(var i,e,r,o,i=0,e=0,r=0;;i++){if(!(o=i<this.viewports.length?this.viewports[i]:null)||n<o.domTop)return e+(n-r)/this.scale;if(n<=o.domBottom)return o.top+(n-o.domTop);e=o.bottom,r=o.domBottom}}}]),f}(),Hi=y.define({combine:function t(n){return n.join(" ")}}),zi=y.define({combine:function t(n){return-1<n.indexOf(!0)}}),Gi=Kl("."+(Wi=Ft.newName()),{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},qi={"&light":"."+(Vi=Ft.newName()),"&dark":"."+($i=Ft.newName())}),Ji=D(function t(n,i,e,r){var r,o,r,i,e,e,i,o;A(this,t),this.typeOver=r,this.bounds=null,this.text="",o=(r=n.docView).impreciseHead,r=r.impreciseAnchor,n.state.readOnly&&-1<i?this.newSel=null:-1<i&&(this.bounds=n.docView.domBoundsAround(i,e,0))?(i=o||r?[]:Zl(n),(e=new ti(i,n.state)).readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=e.text,this.newSel=Yl(i,this.bounds.from)):(e=n.observer.selectionRange,i=o&&o.node==e.focusNode&&o.offset==e.focusOffset||!uc(n.contentDOM,e.focusNode)?n.state.selection.main.head:n.docView.posFromDOM(e.focusNode,e.focusOffset),o=r&&r.node==e.anchorNode&&r.offset==e.anchorOffset||!uc(n.contentDOM,e.anchorNode)?n.state.selection.main.anchor:n.docView.posFromDOM(e.anchorNode,e.anchorOffset),this.newSel=O.single(o,i))}),Ki={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Qi=g.ie&&g.ie_version<=11,Xi=function(){function t(r){var o=this;A(this,t),this.view=r,this.active=!1,this.selectionRange=new qt,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=r.contentDOM,this.observer=new MutationObserver(function(t){var n,i,e,n=F(t);try{for(n.s();!(i=n.n()).done;)e=i.value,o.queue.push(e)}catch(t){n.e(t)}finally{n.f()}(g.ie&&g.ie_version<=11||g.ios&&r.composing)&&t.some(function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length})?o.flushSoon():o.flush()}),Qi&&(this.onCharData=function(t){o.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),o.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(function(){var t;(null==(t=o.view.docView)?void 0:t.lastUpdate)<Date.now()-75&&o.onResize()}),this.resizeScroll.observe(r.scrollDOM),this.resizeContent=new ResizeObserver(function(){return o.view.requestMeasure()}),this.resizeContent.observe(r.contentDOM)),this.addWindowListeners(this.win=r.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(function(t){o.parentCheck<0&&(o.parentCheck=setTimeout(o.listenForScroll.bind(o),1e3)),0<t.length&&0<t[t.length-1].intersectionRatio!=o.intersecting&&(o.intersecting=!o.intersecting,o.intersecting!=o.view.inView)&&o.onScrollChanged(document.createEvent("Event"))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(function(t){0<t.length&&0<t[t.length-1].intersectionRatio&&o.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}return D(t,[{key:"onScrollChanged",value:function t(n){this.view.inputState.runScrollHandlers(this.view,n),this.intersecting&&this.view.measure()}},{key:"onScroll",value:function t(n){this.intersecting&&this.flush(!1),this.onScrollChanged(n)}},{key:"onResize",value:function t(){var n=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(function(){n.resizeTimeout=-1,n.view.requestMeasure()},50))}},{key:"onPrint",value:function t(){var n=this;this.view.viewState.printing=!0,this.view.measure(),setTimeout(function(){n.view.viewState.printing=!1,n.view.requestMeasure()},500)}},{key:"updateGaps",value:function t(i){var n,e,r;if(this.gapIntersection&&(i.length!=this.gaps.length||this.gaps.some(function(t,n){return t!=i[n]}))){this.gapIntersection.disconnect(),n=F(i);try{for(n.s();!(e=n.n()).done;)r=e.value,this.gapIntersection.observe(r)}catch(t){n.e(t)}finally{n.f()}this.gaps=i}}},{key:"onSelectionChange",value:function t(n){var i,e,r,o,i=this.selectionChanged;this.readSelectionRange()&&!this.delayedAndroidKey&&(e=this.view,r=this.selectionRange,e.state.facet(On)?e.root.activeElement==this.dom:ac(e.dom,r))&&((o=r.anchorNode&&e.docView.nearest(r.anchorNode))&&o.ignoreEvent(n)?i||(this.selectionChanged=!1):(g.ie&&g.ie_version<=11||g.android&&g.chrome)&&!e.state.selection.main.empty&&r.focusNode&&hc(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1))}},{key:"readSelectionRange",value:function t(){var n,i,e,n=this.view,i=g.safari&&11==n.root.nodeType&&sc(this.dom.ownerDocument)==this.dom&&n0(this.view)||oc(n.root);return!(!i||this.selectionRange.eq(i)||((e=ac(this.dom,i))&&!this.selectionChanged&&n.inputState.lastFocusTime>Date.now()-200&&n.inputState.lastTouchTime<Date.now()-300&&xc(this.dom,i)?(this.view.inputState.lastFocusTime=0,n.docView.updateSelection(),1):(this.selectionRange.setRange(i),e&&(this.selectionChanged=!0),0)))}},{key:"setSelectionRange",value:function t(n,i){this.selectionRange.set(n.node,n.offset,i.node,i.offset),this.selectionChanged=!1}},{key:"clearSelectionRange",value:function t(){this.selectionRange.set(null,0,null,0)}},{key:"listenForScroll",value:function t(){var n,i,e,r,o,u,s,a,f;for(this.parentCheck=-1,n=0,i=null,e=this.dom;e;)if(1==e.nodeType)!i&&n<this.scrollTargets.length&&this.scrollTargets[n]==e?n++:i=i||this.scrollTargets.slice(0,n),i&&i.push(e),e=e.assignedSlot||e.parentNode;else{if(11!=e.nodeType)break;e=e.host}if(i=n<this.scrollTargets.length&&!i?this.scrollTargets.slice(0,n):i){r=F(this.scrollTargets);try{for(r.s();!(o=r.n()).done;)(u=o.value).removeEventListener("scroll",this.onScroll)}catch(t){r.e(t)}finally{r.f()}s=F(this.scrollTargets=i);try{for(s.s();!(a=s.n()).done;)(f=a.value).addEventListener("scroll",this.onScroll)}catch(t){s.e(t)}finally{s.f()}}}},{key:"ignore",value:function t(n){if(!this.active)return n();try{return this.stop(),n()}finally{this.start(),this.clear()}}},{key:"start",value:function t(){this.active||(this.observer.observe(this.dom,Ki),Qi&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}},{key:"stop",value:function t(){this.active&&(this.active=!1,this.observer.disconnect(),Qi)&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData)}},{key:"clear",value:function t(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}},{key:"delayAndroidKey",value:function t(n,i){var e,n,r,e=this;this.delayedAndroidKey||(this.flushingAndroidKey=this.view.win.requestAnimationFrame(r=function t(){var n,i,n=e.delayedAndroidKey;!n||(e.clearDelayedAndroidKey(),e.view.inputState.lastKeyCode=n.keyCode,e.view.inputState.lastKeyTime=Date.now(),i=e.flush())||!n.force||wc(e.dom,n.key,n.keyCode)})),this.delayedAndroidKey&&"Enter"!=n||(this.delayedAndroidKey={key:n,keyCode:i,force:this.lastChange<Date.now()-50||!(null==(n=this.delayedAndroidKey)||!n.force)})}},{key:"clearDelayedAndroidKey",value:function t(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}},{key:"flushSoon",value:function t(){var n=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(function(){n.delayedFlush=-1,n.flush()}))}},{key:"forceFlush",value:function t(){0<=this.delayedFlush&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}},{key:"pendingRecords",value:function t(){var n,i,e,n=F(this.observer.takeRecords());try{for(n.s();!(i=n.n()).done;)e=i.value,this.queue.push(e)}catch(t){n.e(t)}finally{n.f()}return this.queue}},{key:"processRecords",value:function t(){var n,i,e,r,o,u,s,a,n=this.pendingRecords();n.length&&(this.queue=[]),r=!(e=i=-1),o=F(n);try{for(o.s();!(u=o.n()).done;)s=u.value,(a=this.readMutation(s))&&(a.typeOver&&(r=!0),e=-1==i?(i=a.from,a.to):(i=Math.min(a.from,i),Math.max(a.to,e)))}catch(t){o.e(t)}finally{o.f()}return{from:i,to:e,typeOver:r}}},{key:"readChange",value:function t(){var n,i,e,n,r,n=this.processRecords(),i=n.from,e=n.to,n=n.typeOver,r=this.selectionChanged&&ac(this.dom,this.selectionRange);return i<0&&!r?null:(-1<i&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ji(this.view,i,e,n))}},{key:"flush",value:function t(){var n,i,e,i,n;return!(0<=this.delayedFlush||this.delayedAndroidKey||(0<arguments.length&&void 0!==arguments[0]&&!arguments[0]||this.readSelectionRange(),!(i=this.readChange())))&&(e=this.view.state,i=Ql(this.view,i),this.view.state==e&&this.view.update([]),i)}},{key:"readMutation",value:function t(n){var i,e,r,i=this.view.docView.nearest(n.target);return!i||i.ignoreMutation(n)?null:(i.markDirty("attributes"==n.type),"attributes"==n.type&&(i.dirty|=4),"childList"==n.type?(e=t0(i,n.previousSibling||n.target.previousSibling,-1),r=t0(i,n.nextSibling||n.target.nextSibling,1),{from:e?i.posAfter(e):i.posAtStart,to:r?i.posBefore(r):i.posAtEnd,typeOver:!1}):"characterData"==n.type?{from:i.posAtStart,to:i.posAtEnd,typeOver:n.target.nodeValue==n.oldValue}:null)}},{key:"setWindow",value:function t(n){n!=this.win&&(this.removeWindowListeners(this.win),this.win=n,this.addWindowListeners(this.win))}},{key:"addWindowListeners",value:function t(n){n.addEventListener("resize",this.onResize),n.addEventListener("beforeprint",this.onPrint),n.addEventListener("scroll",this.onScroll),n.document.addEventListener("selectionchange",this.onSelectionChange)}},{key:"removeWindowListeners",value:function t(n){n.removeEventListener("scroll",this.onScroll),n.removeEventListener("resize",this.onResize),n.removeEventListener("beforeprint",this.onPrint),n.document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"destroy",value:function t(){var n,n,n,n,i,e,r;this.stop(),null!=(n=this.intersection)&&n.disconnect(),null!=(n=this.gapIntersection)&&n.disconnect(),null!=(n=this.resizeScroll)&&n.disconnect(),null!=(n=this.resizeContent)&&n.disconnect(),i=F(this.scrollTargets);try{for(i.s();!(e=i.n()).done;)(r=e.value).removeEventListener("scroll",this.onScroll)}catch(t){i.e(t)}finally{i.f()}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}]),t}(),(w=function(){function h(){var n,t,i,e,r,n=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};A(this,h),this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this.$de=t.dispatch||function(t){return n.update([t])},this.dispatch=this.dispatch.bind(this),this.Nkt=t.root||bc(t.parent)||document,this.viewState=new _i(t.state||C.create(t)),this.plugins=this.state.facet(An).map(function(t){return new Dn(t)}),i=F(this.plugins);try{for(i.s();!(e=i.n()).done;)(r=e.value).update(this)}catch(t){i.e(t)}finally{i.f()}this.observer=new Xi(this),this.inputState=new ui(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new ii(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}return D(h,[{key:"state",get:function t(){return this.viewState.state}},{key:"viewport",get:function t(){return this.viewState.viewport}},{key:"visibleRanges",get:function t(){return this.viewState.visibleRanges}},{key:"inView",get:function t(){return this.viewState.inView}},{key:"composing",get:function t(){return 0<this.inputState.composing}},{key:"compositionStarted",get:function t(){return 0<=this.inputState.composing}},{key:"root",get:function t(){return this.Nkt}},{key:"win",get:function t(){return this.dom.ownerDocument.defaultView||window}},{key:"dispatch",value:function t(){var n,n,n=1==arguments.length&&(arguments.length<=0?void 0:arguments[0])instanceof Mt?arguments.length<=0?void 0:arguments[0]:(n=this.state).update.apply(n,arguments);this.$de(n,this)}},{key:"update",value:function t(n){var i,e,r,t,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,i=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");r=e=!1,o=this.state,u=F(n);try{for(u.s();!(s=u.n()).done;){if((a=s.value).startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=a.state}}catch(t){u.e(t)}finally{u.f()}if(this.destroyed)this.viewState.state=o;else{if(f=this.hasFocus,h=0,c=null,n.some(function(t){return t.annotation(bi)})?(this.inputState.notifiedFocused=f,h=1):f==this.inputState.notifiedFocused||(this.inputState.notifiedFocused=f,c=Fl(o,f))||(h=1),l=this.observer.delayedAndroidKey,v=null,l?(this.observer.clearDelayedAndroidKey(),(!(v=this.observer.readChange())||this.state.doc.eq(o.doc))&&this.state.selection.eq(o.selection)||(v=null)):this.observer.clear(),o.facet(C.phrases)!=this.state.facet(C.phrases))return this.setState(o);(t=Nn.create(this,o,n)).flags|=h,d=this.viewState.scrollTarget;try{this.updateState=2,y=F(n);try{for(y.s();!(m=y.n()).done;){p=m.value,d=d&&d.map(p.changes),p.scrollIntoView&&(k=p.state.selection.main,d=new jn(k.empty?k:O.cursor(k.head,k.head>k.anchor?-1:1))),g=F(p.effects);try{for(g.s();!(w=g.n()).done;)(b=w.value).is(Pn)&&(d=b.value)}catch(t){g.e(t)}finally{g.f()}}}catch(t){y.e(t)}finally{y.f()}this.viewState.update(t,d),this.bidiCache=te.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),e=this.docView.update(t),this.state.facet(_n)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(n),this.docView.updateSelection(e,n.some(function(t){return t.isUserEvent("select.pointer")}))}finally{this.updateState=0}if(t.startState.facet(Hi)!=t.state.facet(Hi)&&(this.viewState.mustMeasureContent=!0),(e||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!t.empty){M=F(this.state.facet(bn));try{for(M.s();!(x=M.n()).done;)(S=x.value)(t)}catch(t){M.e(t)}finally{M.f()}}(c||v)&&Promise.resolve().then(function(){c&&i.state==c.startState&&i.dispatch(c),v&&!Ql(i,v)&&l.force&&wc(i.contentDOM,l.key,l.keyCode)})}}},{key:"setState",value:function t(n){var i,e,r,o,u,s,a;if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)this.viewState.state=n;else{this.updateState=2,i=this.hasFocus;try{e=F(this.plugins);try{for(e.s();!(r=e.n()).done;)(o=r.value).destroy(this)}catch(t){e.e(t)}finally{e.f()}this.viewState=new _i(n),this.plugins=n.facet(An).map(function(t){return new Dn(t)}),this.pluginMap.clear(),u=F(this.plugins);try{for(u.s();!(s=u.n()).done;)(a=s.value).update(this)}catch(t){u.e(t)}finally{u.f()}this.docView=new ii(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}}},{key:"updatePlugins",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,i=n.startState.facet(An),e=n.state.facet(An);if(i!=e){r=[],o=F(e);try{for(o.s();!(u=o.n()).done;)s=u.value,(a=i.indexOf(s))<0?r.push(new Dn(s)):((f=this.plugins[a]).mustUpdate=n,r.push(f))}catch(t){o.e(t)}finally{o.f()}h=F(this.plugins);try{for(h.s();!(c=h.n()).done;)(l=c.value).mustUpdate!=n&&l.destroy(this)}catch(t){h.e(t)}finally{h.f()}this.plugins=r,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else{v=F(this.plugins);try{for(v.s();!(d=v.n()).done;)(y=d.value).mustUpdate=n}catch(t){v.e(t)}finally{v.f()}}for(m=0;m<this.plugins.length;m++)this.plugins[m].update(this)}},{key:"measure",value:function t(){var n,i,e,i,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,n=this,i=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];if(!this.destroyed){-1<this.measureScheduled&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,i&&this.observer.forceFlush(),e=null,r=(i=this.scrollDOM).scrollHeight,o=i.scrollTop,s=r-(u=i.clientHeight)-4<o?r:o;try{for(a=0;this.updateState=1,f=this.viewport,h=this.viewState.lineBlockAtHeight(s),(c=this.viewState.measure(this))||this.measureRequests.length||null!=this.viewState.scrollTarget;a++){if(5<a){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}for(l=[],4&c||(v=[l,this.measureRequests],this.measureRequests=v[0],l=v[1]),d=l.map(function(t){try{return t.read(n)}catch(t){return Wc(n.state,t),Yi}}),y=Nn.create(this,this.state,[]),p=m=!1,y.flags|=c,e?e.flags|=c:e=y,this.updateState=2,y.empty||(this.updatePlugins(y),this.inputState.update(y),this.updateAttrs(),m=this.docView.update(y)),k=0;k<l.length;k++)if(d[k]!=Yi)try{(g=l[k]).write&&g.write(d[k],this)}catch(t){Wc(this.state,t)}if(this.viewState.editorHeight&&(this.viewState.scrollTarget?(this.docView.scrollIntoView(this.viewState.scrollTarget),p=!(this.viewState.scrollTarget=null)):(1<(w=this.viewState.lineBlockAt(h.from).top-h.top)||w<-1)&&(this.scrollDOM.scrollTop+=w,p=!0)),m&&this.docView.updateSelection(!0),this.viewport.from==f.from&&this.viewport.to==f.to&&!p&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty){b=F(this.state.facet(bn));try{for(b.s();!(M=b.n()).done;)(x=M.value)(e)}catch(t){b.e(t)}finally{b.f()}}}}},{key:"themeClasses",get:function t(){return Wi+" "+(this.state.facet(zi)?$i:Vi)+" "+this.state.facet(Hi)}},{key:"updateAttrs",value:function t(){var i,e,r,n,i=this,e=i0(this,Rn,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),r={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(On)?"true":"false",class:"cm-content",style:"".concat(g.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};return this.state.readOnly&&(r["aria-readonly"]="true"),i0(this,In,r),n=this.observer.ignore(function(){var t,n,t=Fc(i.contentDOM,i.contentAttrs,r),n=Fc(i.dom,i.editorAttrs,e);return t||n}),this.editorAttrs=e,this.contentAttrs=r,n}},{key:"showAnnouncements",value:function t(n){var i,e,r,o,u,s,a,f,i=!0,e=F(n);try{for(e.s();!(r=e.n()).done;){u=F((o=r.value).effects);try{for(u.s();!(s=u.n()).done;)(a=s.value).is(h.announce)&&(i&&(this.announceDOM.textContent=""),i=!1,(f=this.announceDOM.appendChild(document.createElement("div"))).textContent=a.value)}catch(t){u.e(t)}finally{u.f()}}}catch(t){e.e(t)}finally{e.f()}}},{key:"mountStyles",value:function t(){this.styleModules=this.state.facet(_n),Ft.mount(this.root,this.styleModules.concat(Gi).reverse())}},{key:"readMeasured",value:function t(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&-1<this.measureScheduled&&this.measure(!1)}},{key:"requestMeasure",value:function t(n){var i,e,i=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(function(){return i.measure()})),n&&!(-1<this.measureRequests.indexOf(n))){if(null!=n.key)for(e=0;e<this.measureRequests.length;e++)if(this.measureRequests[e].key===n.key)return void(this.measureRequests[e]=n);this.measureRequests.push(n)}}},{key:"plugin",value:function t(n){var i=this.pluginMap.get(n);return(void 0===i||i&&i.spec!=n)&&this.pluginMap.set(n,i=this.plugins.find(function(t){return t.spec==n})||null),i&&i.update(this).value}},{key:"documentTop",get:function t(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}},{key:"documentPadding",get:function t(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}},{key:"elementAtHeight",value:function t(n){return this.readMeasured(),this.viewState.elementAtHeight(n)}},{key:"lineBlockAtHeight",value:function t(n){return this.readMeasured(),this.viewState.lineBlockAtHeight(n)}},{key:"viewportLineBlocks",get:function t(){return this.viewState.viewportLines}},{key:"lineBlockAt",value:function t(n){return this.viewState.lineBlockAt(n)}},{key:"contentHeight",get:function t(){return this.viewState.contentHeight}},{key:"moveByChar",value:function t(n,i,e){return bl(this,n,pl(this,n,i,e))}},{key:"moveByGroup",value:function t(n,i){var e=this;return bl(this,n,pl(this,n,i,function(t){return kl(e,n.head,t)}))}},{key:"moveToLineBoundary",value:function t(n,i){var e;return ml(this,n,i,!(2<arguments.length&&void 0!==arguments[2])||arguments[2])}},{key:"moveVertically",value:function t(n,i,e){return bl(this,n,gl(this,n,i,e))}},{key:"domAtPos",value:function t(n){return this.docView.domAtPos(n)}},{key:"posAtDOM",value:function t(n){var i;return this.docView.posFromDOM(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0)}},{key:"posAtCoords",value:function t(n){var i=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];return this.readMeasured(),ll(this,n,i)}},{key:"coordsAtPos",value:function t(n){var i,e,r,o,u,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return this.readMeasured(),(e=this.docView.coordsAt(n,i))&&e.left!=e.right?(r=this.state.doc.lineAt(n),dc(e,(u=(o=this.bidiSpans(r))[Xn.find(o,n-r.from,-1,i)]).dir==E.LTR==0<i)):e}},{key:"defaultCharacterWidth",get:function t(){return this.viewState.heightOracle.charWidth}},{key:"defaultLineHeight",get:function t(){return this.viewState.heightOracle.lineHeight}},{key:"textDirection",get:function t(){return this.viewState.defaultTextDirection}},{key:"textDirectionAt",value:function t(n){var i;return!this.state.facet(Sn)||n<this.viewport.from||n>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(n))}},{key:"lineWrapping",get:function t(){return this.viewState.heightOracle.lineWrapping}},{key:"bidiSpans",value:function t(n){var i,e,r,o,u;if(n.length>Zi)return Jc(n.length);i=this.textDirectionAt(n.from),e=F(this.bidiCache);try{for(e.s();!(r=e.n()).done;)if((o=r.value).from==n.from&&o.dir==i)return o.order}catch(t){e.e(t)}finally{e.f()}return u=Gc(n.text,i),this.bidiCache.push(new te(n.from,n.to,i,u)),u}},{key:"hasFocus",get:function t(){var n;return(this.dom.ownerDocument.hasFocus()||g.safari&&(null==(n=this.inputState)?void 0:n.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}},{key:"focus",value:function t(){var n=this;this.observer.ignore(function(){kc(n.contentDOM),n.docView.updateSelection()})}},{key:"setRoot",value:function t(n){this.Nkt!=n&&(this.Nkt=n,this.observer.setWindow((9==n.nodeType?n:n.ownerDocument).defaultView||window),this.mountStyles())}},{key:"destroy",value:function t(){var n,i,e,n=F(this.plugins);try{for(n.s();!(i=n.n()).done;)(e=i.value).destroy(this)}catch(t){n.e(t)}finally{n.f()}this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),-1<this.measureScheduled&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}}],[{key:"scrollIntoView",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return Pn.of(new jn("number"==typeof n?O.cursor(n):n,i.y,i.x,i.yMargin,i.xMargin))}},{key:"domEventHandlers",value:function t(n){return d.define(function(){return{}},{eventHandlers:n})}},{key:"theme",value:function t(n,i){var e,e,e=Ft.newName(),e=[Hi.of(e),_n.of(Kl(".".concat(e),n))];return i&&i.dark&&e.push(zi.of(!0)),e}},{key:"baseTheme",value:function t(n){return st.lowest(_n.of(Kl("."+Wi,n,qi)))}},{key:"findFromDOM",value:function t(n){var n,i,i,i=n.querySelector(".cm-content"),i=i&&c.get(i)||c.get(n);return(null==(n=null==i?void 0:i.rootView)?void 0:n.view)||null}}]),h}()).styleModule=_n,w.inputHandler=Mn,w.focusChangeEffect=xn,w.perLineTextDirection=Sn,w.exceptionSink=wn,w.updateListener=bn,w.editable=On,w.mouseSelectionStyle=gn,w.dragMovesSelection=kn,w.clickAddsSelectionRange=pn,w.decorations=Tn,w.atomicRanges=Ln,w.scrollMargins=Bn,w.darkTheme=zi,w.contentAttributes=In,w.editorAttributes=Rn,w.lineWrapping=w.contentAttributes.of({class:"cm-lineWrapping"}),w.announce=v.define(),Zi=4096,Yi={},te=function(){function s(t,n,i,e){A(this,s),this.from=t,this.to=n,this.dir=i,this.order=e}return D(s,null,[{key:"update",value:function t(n,i){var e,r,o,u;if(i.empty)return n;for(e=[],r=n.length?n[n.length-1].dir:E.LTR,o=Math.max(0,n.length-10);o<n.length;o++)(u=n[o]).dir!=r||i.touchesRange(u.from,u.to)||e.push(new s(i.mapPos(u.from,1),i.mapPos(u.to,-1),u.dir,u.order));return e}}]),s}(),ne=g.mac?"mac":g.windows?"win":g.linux?"linux":"key",e=st.default(w.domEventHandlers({keydown:function t(n,i){return a0(o0(i.state),n,i,"editor")}})),ie=y.define({enables:e}),ee=new WeakMap,re=null,oe=4e3,ue=function(){function u(t,n,i,e,r){A(this,u),this.className=t,this.left=n,this.top=i,this.width=e,this.height=r}return D(u,[{key:"draw",value:function t(){var n=document.createElement("div");return n.className=this.className,this.adjust(n),n}},{key:"update",value:function t(n,i){return i.className==this.className&&(this.adjust(n),!0)}},{key:"adjust",value:function t(n){n.style.left=this.left+"px",n.style.top=this.top+"px",null!=this.width&&(n.style.width=this.width+"px"),n.style.height=this.height+"px"}},{key:"eq",value:function t(n){return this.left==n.left&&this.top==n.top&&this.width==n.width&&this.height==n.height&&this.className==n.className}}],[{key:"forRange",value:function t(n,i,e){var r,o;return e.empty?(r=n.coordsAtPos(e.head,e.assoc||1))?(o=f0(n),[new u(i,r.left-o.left,r.top-o.top,null,r.bottom-r.top)]):[]:l0(n,i,e)}}]),u}(),se=function(){function i(t,n){A(this,i),this.view=t,this.layer=n,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,t)}return D(i,[{key:"update",value:function t(n){n.startState.facet(ae)!=n.state.facet(ae)&&this.setOrder(n.state),(this.layer.update(n,this.dom)||n.geometryChanged)&&n.view.requestMeasure(this.measureReq)}},{key:"setOrder",value:function t(n){for(var i=0,e=n.facet(ae);i<e.length&&e[i]!=this.layer;)i++;this.dom.style.zIndex=String((this.layer.above?150:-1)-i)}},{key:"measure",value:function t(){return this.layer.markers(this.view)}},{key:"draw",value:function t(n){var i,e,r,o,u,s,a,i=this;if(n.length!=this.drawn.length||n.some(function(t,n){return!v0(t,i.drawn[n])})){e=this.dom.firstChild,r=0,o=F(n);try{for(o.s();!(u=o.n()).done;)(s=u.value).update&&e&&s.constructor&&this.drawn[r].constructor&&s.update(e,this.drawn[r])?(e=e.nextSibling,r++):this.dom.insertBefore(s.draw(),e)}catch(t){o.e(t)}finally{o.f()}for(;e;)a=e.nextSibling,e.remove(),e=a;this.drawn=n}}},{key:"destroy",value:function t(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}]),i}(),ae=y.define(),fe=!g.ios,he=y.define({combine:function t(n){return qh(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:function t(n,i){return Math.min(n,i)},drawRangeCursor:function t(n,i){return n||i}})}}),ce=d0({above:!0,markers:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,i=n.state,e=i.facet(he),r=[],o=F(i.selection.ranges);try{for(o.s();!(u=o.n()).done;)if(a=(s=u.value)==i.selection.main,s.empty?!a||fe:e.drawRangeCursor){f=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",h=s.empty?s:O.cursor(s.head,s.head>s.anchor?-1:1),c=F(ue.forRange(n,f,h));try{for(c.s();!(l=c.n()).done;)v=l.value,r.push(v)}catch(t){c.e(t)}finally{c.f()}}}catch(t){o.e(t)}finally{o.f()}return r},update:function t(n,i){n.transactions.some(function(t){return t.selection})&&(i.style.animationName="cm-blink"==i.style.animationName?"cm-blink2":"cm-blink");var e=m0(n);return e&&p0(n.state,i),n.docChanged||n.selectionSet||e},mount:function t(n,i){p0(i.state,n)},class:"cm-cursorLayer"}),le=d0({above:!1,markers:function t(n){return n.state.selection.ranges.map(function(t){return t.empty?[]:ue.forRange(n,"cm-selectionBackground",t)}).reduce(function(t,n){return t.concat(n)})},update:function t(n,i){return n.docChanged||n.selectionSet||n.viewportChanged||m0(n)},class:"cm-selectionLayer"}),Yt={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}},fe&&(Yt[".cm-line"].caretColor="transparent !important"),ve=st.highest(w.theme(Yt)),de=v.define({map:function t(n,i){return null==n?null:i.mapPos(n)}}),ye=b.define({create:function t(){return null},update:function t(n,i){return null!=n&&(n=i.changes.mapPos(n)),i.effects.reduce(function(t,n){return n.is(de)?n.value:t},n)}}),me=d.fromClass(function(){function n(t){A(this,n),this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}return D(n,[{key:"update",value:function t(n){var i,e,e=n.state.field(ye);null==e?null!=this.cursor&&(null!=(i=this.cursor)&&i.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(ye)!=e||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}},{key:"readPos",value:function t(){var n,n,i,n=this.view.state.field(ye),n=null!=n&&this.view.coordsAtPos(n);return n?(i=this.view.scrollDOM.getBoundingClientRect(),{left:n.left-i.left+this.view.scrollDOM.scrollLeft,top:n.top-i.top+this.view.scrollDOM.scrollTop,height:n.bottom-n.top}):null}},{key:"drawCursor",value:function t(n){this.cursor&&(n?(this.cursor.style.left=n.left+"px",this.cursor.style.top=n.top+"px",this.cursor.style.height=n.height+"px"):this.cursor.style.left="-100000px")}},{key:"destroy",value:function t(){this.cursor&&this.cursor.remove()}},{key:"setDropPos",value:function t(n){this.view.state.field(ye)!=n&&this.view.dispatch({effects:de.of(n)})}}]),n}(),{eventHandlers:{dragover:function t(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave:function t(n){n.target!=this.view.contentDOM&&this.view.contentDOM.contains(n.relatedTarget)||this.setDropPos(null)},dragend:function t(){this.setDropPos(null)},drop:function t(){this.setDropPos(null)}}}),pe=function(){function e(t){A(this,e);var n=t.regexp,r=t.decoration,o=t.decorate,i=t.boundary,t=t.maxLength,t=void 0===t?1e3:t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,o)this.addMatch=function(t,n,i,e){return o(e,i,i+t[0].length,t,n)};else if("function"==typeof r)this.addMatch=function(t,n,i,e){var n=r(t,n,i);n&&e(i,i+t[0].length,n)};else{if(!r)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,n,i,e){return e(i,i+t[0].length,r)}}this.boundary=i,this.maxLength=t}return D(e,[{key:"createDeco",value:function t(i){var e,n,r,o,u,s,a,f,e=this,n=new Et,r=n.add.bind(n),o=F(w0(i,this.maxLength));try{for(o.s();!(u=o.n()).done;)a=(s=u.value).from,f=s.to,g0(i.state.doc,this.regexp,a,f,function(t,n){e.addMatch(n,i,t,r)})}catch(t){o.e(t)}finally{o.f()}return n.finish()}},{key:"updateDeco",value:function t(r,n){var o=1e9,u=-1;return r.docChanged&&r.changes.iterChanges(function(t,n,i,e){e>r.view.viewport.from&&i<r.view.viewport.to&&(o=Math.min(i,o),u=Math.max(e,u))}),r.viewportChanged||1e3<u-o?this.createDeco(r.view):-1<u?this.updateRange(r.view,n.map(r.changes),o,u):n}},{key:"updateRange",value:function t(c,l,v,d){var y,n,m,i,y=this,n=F(c.visibleRanges);try{for(i=function t(){var n,i,e,r,o,u,s,a,f,h,n=m.value,i=Math.max(n.from,v),e=Math.min(n.to,d);if(i<e){if(o=(r=c.state.doc.lineAt(i)).to<e?c.state.doc.lineAt(e):r,u=Math.max(n.from,r.from),s=Math.min(n.to,o.to),y.boundary){for(;i>r.from;i--)if(y.boundary.test(r.text[i-1-r.from])){u=i;break}for(;e<o.to;e++)if(y.boundary.test(o.text[e-o.from])){s=e;break}}if(a=[],h=function t(n,i,e){return a.push(e.range(n,i))},r==o)for(y.regexp.lastIndex=u-r.from;(f=y.regexp.exec(r.text))&&f.index<s-r.from;)y.addMatch(f,c,f.index+r.from,h);else g0(c.state.doc,y.regexp,u,s,function(t,n){y.addMatch(n,c,t,h)});l=l.update({filterFrom:u,filterTo:s,filter:function t(n,i){return n<u||s<i},add:a})}},n.s();!(m=n.n()).done;)i()}catch(t){n.e(t)}finally{n.f()}return l}}]),e}(),ke=null!=/x/.unicode?"gu":"g",ge=new RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]",ke),we={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"},be=null,Me=y.define({combine:function t(n){var n=qh(n,{render:null,specialChars:ge,addSpecialChars:null});return(n.replaceTabs=!b0())&&(n.specialChars=new RegExp("\t|"+n.specialChars.source,ke)),n.addSpecialChars&&(n.specialChars=new RegExp(n.specialChars.source+"|"+n.addSpecialChars.source,ke)),n}}),xe=null,Se="\u2022",Ce=function(t){f(r,t);var e=S(r);function r(t,n){var i;return A(this,r),(i=e.call(this)).options=t,i.code=n,i}return D(r,[{key:"eq",value:function t(n){return n.code==this.code}},{key:"toDOM",value:function t(n){var i,n,e,e,i=S0(this.code),n=n.state.phrase("Control character")+" "+(we[this.code]||"0x"+this.code.toString(16)),e=this.options.render&&this.options.render(this.code,n,i);return e||((e=document.createElement("span")).textContent=i,e.title=n,e.setAttribute("aria-label",n),e.className="cm-specialChar",e)}},{key:"ignoreEvent",value:function t(){return!1}}]),r}(tn),je=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).width=t,n}return D(e,[{key:"eq",value:function t(n){return n.width==this.width}},{key:"toDOM",value:function t(){var n=document.createElement("span");return n.textContent="\t",n.className="cm-tab",n.style.width=this.width+"px",n}},{key:"ignoreEvent",value:function t(){return!1}}]),e}(tn),Pe=d.fromClass(function(){function t(){A(this,t),this.height=1e3,this.attrs={style:"padding-bottom: 1000px"}}return D(t,[{key:"update",value:function t(n){var n,n,n=n.view,n=n.viewState.editorHeight-n.defaultLineHeight-n.documentPadding.top-.5;n!=this.height&&(this.height=n,this.attrs={style:"padding-bottom: ".concat(n,"px")})}}]),t}()),Oe=m.line({class:"cm-activeLine"}),Ee=d.fromClass(function(){function n(t){A(this,n),this.decorations=this.getDeco(t)}return D(n,[{key:"update",value:function t(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}},{key:"getDeco",value:function t(n){var i,e,r,o,u,s,i=-1,e=[],r=F(n.state.selection.ranges);try{for(r.s();!(o=r.n()).done;)u=o.value,(s=n.lineBlockAt(u.head)).from>i&&(e.push(Oe.range(s.from)),i=s.from)}catch(t){r.e(t)}finally{r.f()}return m.set(e)}}]),n}(),{decorations:function t(n){return n.decorations}}),Ae=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).content=t,n}return D(e,[{key:"toDOM",value:function t(){var n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?n.setAttribute("aria-label","placeholder "+this.content):n.setAttribute("aria-hidden","true"),n}},{key:"coordsAt",value:function t(n){var i,n,i,n,i=n.firstChild?fc(n.firstChild):[];return i.length?(n=window.getComputedStyle(n.parentNode),i=dc(i[0],"rtl"!=n.direction),n=parseInt(n.lineHeight),i.bottom-i.top>1.5*n?{left:i.left,right:i.right,top:i.top,bottom:i.top+n}:i):null}},{key:"ignoreEvent",value:function t(){return!1}}]),e}(tn),De=2e3,Re={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}]},Ie={style:"cursor: crosshair"},Te="-10000px",Le=function(){function e(t,n,i){A(this,e),this.facet=n,this.createTooltipView=i,this.input=t.state.facet(n),this.tooltips=this.input.filter(function(t){return t}),this.tooltipViews=this.tooltips.map(i)}return D(e,[{key:"update",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,e=n.state.facet(this.facet),r=e.filter(function(t){return t});if(e===this.input){o=F(this.tooltipViews);try{for(o.s();!(u=o.n()).done;)(s=u.value).update&&s.update(n)}catch(t){o.e(t)}finally{o.f()}return!1}for(a=[],f=0;f<r.length;f++)if(c=-1,h=r[f]){for(l=0;l<this.tooltips.length;l++)(v=this.tooltips[l])&&v.create==h.create&&(c=l);c<0?a[f]=this.createTooltipView(h):(d=a[f]=this.tooltipViews[c]).update&&d.update(n)}y=F(this.tooltipViews);try{for(y.s();!(m=y.n()).done;)p=m.value,a.indexOf(p)<0&&(p.dom.remove(),null!=(i=p.destroy))&&i.call(p)}catch(t){y.e(t)}finally{y.f()}return this.input=e,this.tooltips=r,this.tooltipViews=a,!0}}]),e}(),Be=y.define({combine:function t(n){var i,i,i;return{position:g.ios?"absolute":(null==(i=n.find(function(t){return t.position}))?void 0:i.position)||"fixed",parent:(null==(i=n.find(function(t){return t.parent}))?void 0:i.parent)||null,tooltipSpace:(null==(i=n.find(function(t){return t.tooltipSpace}))?void 0:i.tooltipSpace)||L0}}}),_e=new WeakMap,Fe=d.fromClass(function(){function e(t){var n,i,n=this;A(this,e),this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1,i=t.state.facet(Be),this.position=i.position,this.parent=i.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Le(t,Ue,function(t){return n.createTooltip(t)}),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(function(t){Date.now()>n.lastTransaction-50&&0<t.length&&t[t.length-1].intersectionRatio<1&&n.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}return D(e,[{key:"createContainer",value:function t(){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 t(){var n,i,e;if(this.intersectionObserver){this.intersectionObserver.disconnect(),n=F(this.manager.tooltipViews);try{for(n.s();!(i=n.n()).done;)e=i.value,this.intersectionObserver.observe(e.dom)}catch(t){n.e(t)}finally{n.f()}}}},{key:"measureSoon",value:function t(){var n=this;this.measureTimeout<0&&(this.measureTimeout=setTimeout(function(){n.measureTimeout=-1,n.maybeMeasure()},50))}},{key:"update",value:function t(n){var i,i,n,e,r,o,u,s,a;if(n.transactions.length&&(this.lastTransaction=Date.now()),(i=this.manager.update(n))&&this.observeIntersection(),i=i||n.geometryChanged,(n=n.state.facet(Be)).position!=this.position){this.position=n.position,e=F(this.manager.tooltipViews);try{for(e.s();!(r=e.n()).done;)(o=r.value).dom.style.position=this.position}catch(t){e.e(t)}finally{e.f()}i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer(),u=F(this.manager.tooltipViews);try{for(u.s();!(s=u.n()).done;)a=s.value,this.container.appendChild(a.dom)}catch(t){u.e(t)}finally{u.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 t(n){var i,n,i=n.create(this.view);return i.dom.classList.add("cm-tooltip"),n.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")&&((n=document.createElement("div")).className="cm-tooltip-arrow",i.dom.appendChild(n)),i.dom.style.position=this.position,i.dom.style.top=Te,this.container.appendChild(i.dom),i.mount&&i.mount(this.view),i}},{key:"destroy",value:function t(){var n,i,e,r,o;this.view.win.removeEventListener("resize",this.measureSoon),e=F(this.manager.tooltipViews);try{for(e.s();!(r=e.n()).done;)(o=r.value).dom.remove(),null!=(n=o.destroy)&&n.call(o)}catch(t){e.e(t)}finally{e.f()}null!=(i=this.intersectionObserver)&&i.disconnect(),clearTimeout(this.measureTimeout)}},{key:"readMeasure",value:function t(){var i,n,i=this,n=this.view.dom.getBoundingClientRect();return{editor:n,parent:this.parent?this.container.getBoundingClientRect():n,pos:this.manager.tooltips.map(function(t,n){var n=i.manager.tooltipViews[n];return n.getCoords?n.getCoords(t.pos):i.view.coordsAtPos(t.pos)}),size:this.manager.tooltipViews.map(function(t){var n;return t.dom.getBoundingClientRect()}),space:this.view.state.facet(Be).tooltipSpace(this.view)}}},{key:"writeMeasure",value:function t(n){for(var i,e,r,o,u,s,a,f,h,c,l,v,d,y,i,m,p,k,s,g,w,b,M,x,e=n.editor,r=n.space,o=[],u=0;u<this.manager.tooltips.length;u++)if(s=this.manager.tooltips[u],f=(a=this.manager.tooltipViews[u]).dom,h=n.pos[u],c=n.size[u],!h||h.bottom<=Math.max(e.top,r.top)||h.top>=Math.min(e.bottom,r.bottom)||h.right<Math.max(e.left,r.left)-.1||h.left>Math.min(e.right,r.right)+.1)f.style.top=Te;else{if(v=(l=s.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null)?7:0,d=c.right-c.left,y=null!=(i=_e.get(a))?i:c.bottom-c.top,i=a.offset||Ne,m=this.view.textDirection==E.LTR,p=c.width>r.right-r.left?m?r.left:r.right-c.width:m?Math.min(h.left-(l?14:0)+i.x,r.right-d):Math.max(r.left,h.left-d+(l?14:0)-i.x),k=!!s.above,(s=((k=!s.strictSide&&(k?h.top-(c.bottom-c.top)-i.y<r.top:h.bottom+(c.bottom-c.top)+i.y>r.bottom)&&k==r.bottom-h.bottom>h.top-r.top?!k:k)?h.top-r.top:r.bottom-h.bottom)-v)<y&&!1!==a.resize){if(s<this.view.defaultLineHeight){f.style.top=Te;continue}_e.set(a,y),f.style.height=(y=s)+"px"}else f.style.height&&(f.style.height="");if(g=k?h.top-y-v-i.y:h.bottom+v+i.y,w=p+d,!0!==a.overlap){b=F(o);try{for(b.s();!(M=b.n()).done;)(x=M.value).left<w&&x.right>p&&x.top<g+y&&x.bottom>g&&(g=k?x.top-y-2-v:x.bottom+v+2)}catch(t){b.e(t)}finally{b.f()}}"absolute"==this.position?(f.style.top=g-n.parent.top+"px",f.style.left=p-n.parent.left+"px"):(f.style.top=g+"px",f.style.left=p+"px"),l&&(l.style.left="".concat(h.left+(m?i.x:-i.x)-(p+14-7),"px")),!0!==a.overlap&&o.push({left:p,top:g,right:w,bottom:g+y}),f.classList.toggle("cm-tooltip-above",k),f.classList.toggle("cm-tooltip-below",!k),a.positioned&&a.positioned(n.space)}}},{key:"maybeMeasure",value:function t(){var n,i,e;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)){n=F(this.manager.tooltipViews);try{for(n.s();!(i=n.n()).done;)(e=i.value).dom.style.top=Te}catch(t){n.e(t)}finally{n.f()}}}}]),e}(),{eventHandlers:{scroll:function t(){this.maybeMeasure()}}}),Zt=w.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:"".concat(7,"px"),width:"".concat(14,"px"),position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"".concat(7,"px solid transparent"),borderRight:"".concat(7,"px solid transparent")},".cm-tooltip-above &":{bottom:"-".concat(7,"px"),"&:before":{borderTop:"".concat(7,"px solid #bbb")},"&:after":{borderTop:"".concat(7,"px solid #f5f5f5"),bottom:"1px"}},".cm-tooltip-below &":{top:"-".concat(7,"px"),"&:before":{borderBottom:"".concat(7,"px solid #bbb")},"&:after":{borderBottom:"".concat(7,"px solid #f5f5f5"),top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Ne={x:0,y:0},Ue=y.define({enables:[Fe,Zt]}),He=y.define(),ze=function(){function i(t){var n=this;A(this,i),this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Le(t,He,function(t){return n.createHostedView(t)})}return D(i,[{key:"createHostedView",value:function t(n){var n=n.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(n.dom),this.mounted&&n.mount&&n.mount(this.view),n}},{key:"mount",value:function t(n){var i,e,r,i=F(this.manager.tooltipViews);try{for(i.s();!(e=i.n()).done;)(r=e.value).mount&&r.mount(n)}catch(t){i.e(t)}finally{i.f()}this.mounted=!0}},{key:"positioned",value:function t(n){var i,e,r,i=F(this.manager.tooltipViews);try{for(i.s();!(e=i.n()).done;)(r=e.value).positioned&&r.positioned(n)}catch(t){i.e(t)}finally{i.f()}}},{key:"update",value:function t(n){this.manager.update(n)}},{key:"destroy",value:function t(){var n,i,e,r,i=F(this.manager.tooltipViews);try{for(i.s();!(e=i.n()).done;)null!=(n=(r=e.value).destroy)&&n.call(r)}catch(t){i.e(t)}finally{i.f()}}}],[{key:"create",value:function t(n){return new i(n)}}]),i}(),We=Ue.compute([He],function(t){var t=t.facet(He).filter(function(t){return t});return 0===t.length?null:{pos:Math.min.apply(Math,Wf(t.map(function(t){return t.pos}))),end:Math.max.apply(Math,Wf(t.filter(function(t){return null!=t.end}).map(function(t){return t.end}))),create:ze.create,above:t[0].above,arrow:t.some(function(t){return t.arrow})}}),Ve=function(){function o(t,n,i,e,r){A(this,o),this.view=t,this.source=n,this.field=i,this.setHover=e,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 D(o,[{key:"update",value:function t(){var n=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(function(){return n.startHover()},20))}},{key:"active",get:function t(){return this.view.state.field(this.field)}},{key:"checkHover",value:function t(){var n;this.hoverTimeout=-1,this.active||((n=Date.now()-this.lastMove.time)<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-n):this.startHover())}},{key:"startHover",value:function t(){var n,i,e,r,o,o,i,u,n=this;clearTimeout(this.restartTimeout),i=this.lastMove,null==(e=this.view.contentDOM.contains(i.target)?this.view.posAtCoords(i):null)||null==(r=this.view.coordsAtPos(e))||i.y<r.top||i.y>r.bottom||i.x<r.left-this.view.defaultCharacterWidth||i.x>r.right+this.view.defaultCharacterWidth||(o=(o=this.view.bidiSpans(this.view.state.doc.lineAt(e)).find(function(t){return t.from<=e&&t.to>=e}))&&o.dir==E.RTL?-1:1,null!=(i=this.source(this.view,e,i.x<r.left?-o:o))&&i.then?(u=this.pending={pos:e},i.then(function(t){n.pending==u&&(n.pending=null,t)&&n.view.dispatch({effects:n.setHover.of(t)})},function(t){return Wc(n.view.state,t,"hover tooltip")})):i&&this.view.dispatch({effects:this.setHover.of(i)}))}},{key:"mousemove",value:function t(n){var i,i,e,r,i;this.lastMove={x:n.clientX,y:n.clientY,target:n.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime)),((i=this.active)&&!B0(this.lastMove.target)||this.pending)&&((r=(e=i||this.pending).pos)==(i=null!=(i=null==i?void 0:i.end)?i:r)?this.view.posAtCoords(this.lastMove)!=r:!_0(this.view,r,i,n.clientX,n.clientY,6))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}},{key:"mouseleave",value:function t(n){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!B0(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}},{key:"destroy",value:function t(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}]),o}(),nn=($e=v.define()).of(null),qe=y.define({combine:function t(n){var i,e,r,o,u,r=F(n);try{for(r.s();!(o=r.n()).done;)u=o.value,i=i||u.topContainer,e=e||u.bottomContainer}catch(t){r.e(t)}finally{r.f()}return{topContainer:i,bottomContainer:e}}}),Ge=d.fromClass(function(){function o(n){var t,i,e,r;A(this,o),this.input=n.state.facet(Ke),this.specs=this.input.filter(function(t){return t}),this.panels=this.specs.map(function(t){return t(n)}),t=n.state.facet(qe),this.top=new Je(n,!0,t.topContainer),this.bottom=new Je(n,!1,t.bottomContainer),this.top.sync(this.panels.filter(function(t){return t.top})),this.bottom.sync(this.panels.filter(function(t){return!t.top})),i=F(this.panels);try{for(i.s();!(e=i.n()).done;)(r=e.value).dom.classList.add("cm-panel"),r.mount&&r.mount()}catch(t){i.e(t)}finally{i.f()}}return D(o,[{key:"update",value:function t(n){var i,i,i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,i=n.state.facet(qe);if(this.top.container!=i.topContainer&&(this.top.sync([]),this.top=new Je(n.view,!0,i.topContainer)),this.bottom.container!=i.bottomContainer&&(this.bottom.sync([]),this.bottom=new Je(n.view,!1,i.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses(),(i=n.state.facet(Ke))!=this.input){e=[],r=[],o=[],u=[],s=F(i=i.filter(function(t){return t}));try{for(s.s();!(a=s.n()).done;)f=a.value,h=this.specs.indexOf(f),c=void 0,h<0?(c=f(n.view),u.push(c)):(c=this.panels[h]).update&&c.update(n),e.push(c),(c.top?r:o).push(c)}catch(t){s.e(t)}finally{s.f()}for(this.specs=i,this.panels=e,this.top.sync(r),this.bottom.sync(o),l=0,v=u;l<v.length;l++)(d=v[l]).dom.classList.add("cm-panel"),d.mount&&d.mount()}else{y=F(this.panels);try{for(y.s();!(m=y.n()).done;)(p=m.value).update&&p.update(n)}catch(t){y.e(t)}finally{y.f()}}}},{key:"destroy",value:function t(){this.top.sync([]),this.bottom.sync([])}}]),o}(),{provide:function t(n){return w.scrollMargins.of(function(t){var t=t.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})}}),Je=function(){function e(t,n,i){A(this,e),this.view=t,this.top=n,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}return D(e,[{key:"sync",value:function t(n){var i,e,r,i=F(this.panels);try{for(i.s();!(e=i.n()).done;)(r=e.value).destroy&&n.indexOf(r)<0&&r.destroy()}catch(t){i.e(t)}finally{i.f()}this.panels=n,this.syncDOM()}},{key:"syncDOM",value:function t(){var n,i,e,r,o;if(0==this.panels.length)this.dom&&(this.dom.remove(),this.dom=void 0);else{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",(n=this.container||this.view.dom).insertBefore(this.dom,this.top?n.firstChild:null)),i=this.dom.firstChild,e=F(this.panels);try{for(e.s();!(r=e.n()).done;)if((o=r.value).dom.parentNode==this.dom){for(;i!=o.dom;)i=V0(i);i=i.nextSibling}else this.dom.insertBefore(o.dom,i)}catch(t){e.e(t)}finally{e.f()}for(;i;)i=V0(i)}}},{key:"scrollMargin",value:function t(){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 t(){var n,i,e,r,o,u;if(this.container&&this.classes!=this.view.themeClasses){n=F(this.classes.split(" "));try{for(n.s();!(i=n.n()).done;)(e=i.value)&&this.container.classList.remove(e)}catch(t){n.e(t)}finally{n.f()}r=F((this.classes=this.view.themeClasses).split(" "));try{for(r.s();!(o=r.n()).done;)(u=o.value)&&this.container.classList.add(u)}catch(t){r.e(t)}finally{r.f()}}}}]),e}(),Ke=y.define({enables:Ge}),(en=function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"compare",value:function t(n){return this==n||this.constructor==n.constructor&&this.eq(n)}},{key:"eq",value:function t(n){return!1}},{key:"destroy",value:function t(n){}}]),i}(jt)).prototype.elementClass="",en.prototype.toDOM=void 0,en.prototype.mapMode=h.TrackBefore,en.prototype.startSide=en.prototype.endSide=-1,en.prototype.point=!0,Qe=y.define(),Xe={class:"",renderEmptyElements:!1,elementStyle:"",markers:function t(){return j.empty},lineMarker:function t(){return null},widgetMarker:function t(){return null},lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Ze=y.define(),Ye=y.define({combine:function t(n){return n.some(function(t){return t})}}),tr=d.fromClass(function(){function r(n){var i,t,e;A(this,r),this.view=n,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=n.state.facet(Ze).map(function(t){return new ir(n,t)}),i=F(this.gutters);try{for(i.s();!(t=i.n()).done;)e=t.value,this.dom.appendChild(e.dom)}catch(t){i.e(t)}finally{i.f()}this.fixed=!n.state.facet(Ye),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}return D(r,[{key:"update",value:function t(n){var i,e,i;this.updateGutters(n)&&(i=this.prevViewport,e=n.view.viewport,i=Math.min(i.to,e.to)-Math.max(i.from,e.from),this.syncGutters(i<.8*(e.to-e.from))),n.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Ye)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=n.view.viewport}},{key:"syncGutters",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,i=this,e=this.dom.nextSibling;n&&this.dom.remove(),r=j.iter(this.view.state.facet(Qe),this.view.viewport.from),o=[],u=this.gutters.map(function(t){return new nr(t,i.view.viewport,-i.view.documentPadding.top)}),s=F(this.view.viewportLineBlocks);try{for(s.s();!(a=s.n()).done;)if(f=a.value,o.length&&(o=[]),Array.isArray(f.type)){h=!0,c=F(f.type);try{for(c.s();!(l=c.n()).done;)if((v=l.value).type==P.Text&&h){J0(r,o,v.from),d=F(u);try{for(d.s();!(y=d.n()).done;)(m=y.value).line(this.view,v,o)}catch(t){d.e(t)}finally{d.f()}h=!1}else if(v.widget){p=F(u);try{for(p.s();!(k=p.n()).done;)(g=k.value).widget(this.view,v)}catch(t){p.e(t)}finally{p.f()}}}catch(t){c.e(t)}finally{c.f()}}else if(f.type==P.Text){J0(r,o,f.from),w=F(u);try{for(w.s();!(b=w.n()).done;)(M=b.value).line(this.view,f,o)}catch(t){w.e(t)}finally{w.f()}}}catch(t){s.e(t)}finally{s.f()}x=F(u);try{for(x.s();!(S=x.n()).done;)(C=S.value).finish()}catch(t){x.e(t)}finally{x.f()}n&&this.view.scrollDOM.insertBefore(this.dom,e)}},{key:"updateGutters",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,i=n.startState.facet(Ze),e=n.state.facet(Ze),r=n.docChanged||n.heightChanged||n.viewportChanged||!j.eq(n.startState.facet(Qe),n.state.facet(Qe),n.view.viewport.from,n.view.viewport.to);if(i==e){o=F(this.gutters);try{for(o.s();!(u=o.n()).done;)(s=u.value).update(n)&&(r=!0)}catch(t){o.e(t)}finally{o.f()}}else{r=!0,a=[],f=F(e);try{for(f.s();!(h=f.n()).done;)c=h.value,(l=i.indexOf(c))<0?a.push(new ir(this.view,c)):(this.gutters[l].update(n),a.push(this.gutters[l]))}catch(t){f.e(t)}finally{f.f()}v=F(this.gutters);try{for(v.s();!(d=v.n()).done;)(y=d.value).dom.remove(),a.indexOf(y)<0&&y.destroy()}catch(t){v.e(t)}finally{v.f()}for(m=0,p=a;m<p.length;m++)this.dom.appendChild((k=p[m]).dom);this.gutters=a}return r}},{key:"destroy",value:function t(){var n,i,e,n=F(this.gutters);try{for(n.s();!(i=n.n()).done;)(e=i.value).destroy()}catch(t){n.e(t)}finally{n.f()}this.dom.remove()}}]),r}(),{provide:function t(i){return w.scrollMargins.of(function(t){var n=t.plugin(i);return n&&0!=n.gutters.length&&n.fixed?t.textDirection==E.LTR?{left:n.dom.offsetWidth}:{right:n.dom.offsetWidth}:null})}}),nr=function(){function e(t,n,i){A(this,e),this.gutter=t,this.height=i,this.i=0,this.cursor=j.iter(t.markers,n.from)}return D(e,[{key:"addElement",value:function t(n,i,e){var r,o,u,r=this.gutter,o=i.top-this.height;this.i==r.elements.length?(u=new er(n,i.height,o,e),r.elements.push(u),r.dom.appendChild(u.dom)):r.elements[this.i].update(n,i.height,o,e),this.height=i.bottom,this.i++}},{key:"line",value:function t(n,i,e){var r,e,e,r=[];J0(this.cursor,r,i.from),e.length&&(r=r.concat(e)),(e=this.gutter.config.lineMarker(n,i,r))&&r.unshift(e),e=this.gutter,0==r.length&&!e.config.renderEmptyElements||this.addElement(n,i,r)}},{key:"widget",value:function t(n,i){var e=this.gutter.config.widgetMarker(n,i.widget,i);e&&this.addElement(n,i,[e])}},{key:"finish",value:function t(){for(var n,i,n=this.gutter;n.elements.length>this.i;)i=n.elements.pop(),n.dom.removeChild(i.dom),i.destroy()}}]),e}(),ir=function(){function i(r,o){var u,t,n,u=this;for(n in A(this,i),this.view=r,this.config=o,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:""),t=function t(e){u.dom.addEventListener(e,function(t){var n,i,i,i,n=t.target;if(n!=u.dom&&u.dom.contains(n)){for(;n.parentNode!=u.dom;)n=n.parentNode;i=((i=n.getBoundingClientRect()).top+i.bottom)/2}else i=t.clientY;i=r.lineBlockAtHeight(i-r.documentTop),o.domEventHandlers[e](r,i,t)&&t.preventDefault()})},o.domEventHandlers)t(n);this.markers=G0(o.markers(r)),o.initialSpacer&&(this.spacer=new er(r,0,0,[o.initialSpacer(r)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}return D(i,[{key:"update",value:function t(n){var i,e,e,i=this.markers;return this.markers=G0(this.config.markers(n.view)),this.spacer&&this.config.updateSpacer&&(e=this.config.updateSpacer(this.spacer.markers[0],n))!=this.spacer.markers[0]&&this.spacer.update(n.view,0,0,[e]),e=n.view.viewport,!j.eq(this.markers,i,e.from,e.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(n)}},{key:"destroy",value:function t(){var n,i,e,n=F(this.elements);try{for(n.s();!(i=n.n()).done;)(e=i.value).destroy()}catch(t){n.e(t)}finally{n.f()}}}]),i}(),er=function(){function r(t,n,i,e){A(this,r),this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,i,e)}return D(r,[{key:"update",value:function t(n,i,e,r){this.height!=i&&(this.dom.style.height=(this.height=i)+"px"),this.above!=e&&(this.dom.style.marginTop=(this.above=e)?e+"px":""),K0(this.markers,r)||this.setMarkers(n,r)}},{key:"setMarkers",value:function t(n,i){for(var e,r,o,u,s,a,f,h,c,l,l,e="cm-gutterElement",r=this.dom.firstChild,o=0,u=0;;){if(s=u,f=!1,a=o<i.length?i[o++]:null){for((h=a.elementClass)&&(e+=" "+h),c=u;c<this.markers.length;c++)if(this.markers[c].compare(a)){s=c,f=!0;break}}else s=this.markers.length;for(;u<s;)(l=this.markers[u++]).toDOM&&(l.destroy(r),l=r.nextSibling,r.remove(),r=l);if(!a)break;a.toDOM&&(f?r=r.nextSibling:this.dom.insertBefore(a.toDOM(n),r)),f&&u++}this.dom.className=e,this.markers=i}},{key:"destroy",value:function t(){this.setMarkers(null,[])}}]),r}(),rr=y.define(),or=y.define({combine:function t(n){return qh(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers:function t(n,i){var o,e,u,o=Object.assign({},n),e=function t(){var e=o[u],r=i[u];o[u]=e?function(t,n,i){return e(t,n,i)||r(t,n,i)}:r};for(u in i)e();return o}})}}),ur=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).number=t,n}return D(e,[{key:"eq",value:function t(n){return this.number==n.number}},{key:"toDOM",value:function t(){return document.createTextNode(this.number)}}]),e}(en),sr=Ze.compute([or],function(t){return{class:"cm-lineNumbers",renderEmptyElements:!1,markers:function t(n){return n.state.facet(rr)},lineMarker:function t(n,i,e){return e.some(function(t){return t.toDOM})?null:new ur(Q0(n,n.state.doc.lineAt(i.from).number))},widgetMarker:function t(){return null},lineMarkerChange:function t(n){return n.startState.facet(or)!=n.state.facet(or)},initialSpacer:function t(n){return new ur(Q0(n,Z0(n.state.doc.lines)))},updateSpacer:function t(n,i){var i=Q0(i.view,Z0(i.view.state.doc.lines));return i==n.number?n:new ur(i)},domEventHandlers:t.facet(or).domEventHandlers}}),ar=new(function(t){f(i,t);var n=S(i);function i(){var t;return A(this,i),(t=n.apply(this,arguments)).elementClass="cm-activeLineGutter",t}return D(i)}(en)),fr=Qe.compute(["selection"],function(t){var n,i,e,r,o,u,n=[],i=-1,e=F(t.selection.ranges);try{for(e.s();!(r=e.n()).done;)o=r.value,i<(u=t.doc.lineAt(o.head).from)&&(i=u,n.push(ar.range(u)))}catch(t){e.e(t)}finally{e.f()}return j.of(n)}),hr=new Map,cr=nv(new pe({regexp:/\t| +/g,decoration:function t(n){return tv(n[0])},boundary:/\S/})),lr=nv(new pe({regexp:/\s+$/g,decoration:m.mark({class:"cm-trailingSpace"}),boundary:/\S/})),u={HeightMap:Pi,HeightOracle:xi,MeasuredHeights:Si,QueryType:p,ChangedRange:Fn,computeOrder:Gc,moveVisually:Kc},vr=L.View=Object.freeze({__proto__:null,BidiSpan:Xn,BlockInfo:Ci,get BlockType(){return P},Decoration:m,get Direction(){return E},EditorView:w,GutterMarker:en,MatchDecorator:pe,RectangleMarker:ue,ViewPlugin:d,ViewUpdate:Nn,WidgetType:tn,qde:u,closeHoverTooltips:nn,crosshairCursor:I0,drawSelection:y0,dropCursor:k0,getPanel:W0,getTooltip:N0,gutter:$0,gutterLineClass:Qe,gutters:q0,hasHoverTooltips:U0,highlightActiveLine:j0,highlightActiveLineGutter:Y0,highlightSpecialChars:M0,highlightTrailingWhitespace:ev,highlightWhitespace:iv,hoverTooltip:F0,keymap:ie,layer:d0,lineNumberMarkers:rr,lineNumbers:X0,logException:Wc,panels:z0,placeholder:P0,rectangularSelection:R0,repositionTooltips:H0,runScopeHandlers:u0,scrollPastEnd:C0,showPanel:Ke,showTooltip:Ue,tooltips:T0}),dr=1024,yr=0,mr=D(function t(n,i){A(this,t),this.from=n,this.to=i}),(M=function(){function n(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};A(this,n),this.id=yr++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return D(n,[{key:"add",value:function t(n){var i=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof n&&(n=kr.match(n)),function(t){var t=n(t);return void 0===t?null:[i,t]}}}]),n}()).closedBy=new M({deserialize:function t(n){return n.split(" ")}}),M.openedBy=new M({deserialize:function t(n){return n.split(" ")}}),M.group=new M({deserialize:function t(n){return n.split(" ")}}),M.contextHash=new M({perNode:!0}),M.lookAhead=new M({perNode:!0}),M.mounted=new M({perNode:!0}),pr=Object.create(null),(kr=function(){function a(t,n,i){var e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;A(this,a),this.name=t,this.props=n,this.id=i,this.flags=e}return D(a,[{key:"prop",value:function t(n){return this.props[n.id]}},{key:"isTop",get:function t(){return 0<(1&this.flags)}},{key:"isSkipped",get:function t(){return 0<(2&this.flags)}},{key:"isError",get:function t(){return 0<(4&this.flags)}},{key:"isAnonymous",get:function t(){return 0<(8&this.flags)}},{key:"is",value:function t(n){var i;return"string"==typeof n?this.name==n||!!(i=this.prop(M.group))&&-1<i.indexOf(n):this.id==n}}],[{key:"define",value:function t(n){var i,e,r,o,u,s,i=n.props&&n.props.length?Object.create(null):pr,e=(n.top?1:0)|(n.skipped?2:0)|(n.error?4:0)|(null==n.name?8:0),r=new a(n.name||"",i,n.id,e);if(n.props){o=F(n.props);try{for(o.s();!(u=o.n()).done;)if(s=u.value,s=Array.isArray(s)?s:s(r)){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");i[s[0].id]=s[1]}}catch(t){o.e(t)}finally{o.f()}}return r}},{key:"match",value:function t(n){var r,i,e,o,u,r=Object.create(null);for(i in n){e=F(i.split(" "));try{for(e.s();!(o=e.n()).done;)u=o.value,r[u]=n[i]}catch(t){e.e(t)}finally{e.f()}}return function(t){for(var n,i,e,n=t.prop(M.group),i=-1;i<(n?n.length:0);i++)if(e=r[i<0?t.name:n[i]])return e}}}]),a}()).none=new kr("",Object.create(null),0,8),n=function(){function v(t){A(this,v),this.types=t;for(var n=0;n<t.length;n++)if(t[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}return D(v,[{key:"extend",value:function t(){for(var n,i,e,r,o,u,s,a,f,h,c,l,n=[],i=arguments.length,e=new Array(i),r=0;r<i;r++)e[r]=arguments[r];o=F(this.types);try{for(o.s();!(u=o.n()).done;){s=u.value,a=null,f=F(e);try{for(f.s();!(h=f.n()).done;)(l=(c=h.value)(s))&&((a=a||Object.assign({},s.props))[l[0].id]=l[1])}catch(t){f.e(t)}finally{f.f()}n.push(a?new kr(s.name,a,s.id,s.flags):s)}}catch(t){o.e(t)}finally{o.f()}return new v(n)}}]),v}(),gr=new WeakMap,wr=new WeakMap,(o=br=br||{})[o.ExcludeBuffers=1]="ExcludeBuffers",o[o.IncludeAnonymous=2]="IncludeAnonymous",o[o.IgnoreMounts=4]="IgnoreMounts",o[o.IgnoreOverlays=8]="IgnoreOverlays",(x=function(){function h(t,n,i,e,r){var o,u,s,a,f;if(A(this,h),this.type=t,this.children=n,this.positions=i,this.length=e,this.props=null,r&&r.length){this.props=Object.create(null),o=F(r);try{for(o.s();!(u=o.n()).done;)a=(s=Gf(u.value,2))[0],f=s[1],this.props["number"==typeof a?a:a.id]=f}catch(t){o.e(t)}finally{o.f()}}}return D(h,[{key:"toString",value:function t(){var n,i,e,r,o,u,n=this.prop(M.mounted);if(n&&!n.overlay)return n.tree.toString();i="",e=F(this.children);try{for(e.s();!(r=e.n()).done;)(u=(o=r.value).toString())&&(i&&(i+=","),i+=u)}catch(t){e.e(t)}finally{e.f()}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(i.length?"("+i+")":""):i}},{key:"cursor",value:function t(){var n;return new Pr(this.topNode,0<arguments.length&&void 0!==arguments[0]?arguments[0]:0)}},{key:"cursorAt",value:function t(n){var i,e,r,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,r=gr.get(this)||this.topNode,r=new Pr(r);return r.moveTo(n,i),gr.set(this,r.oMi),r}},{key:"topNode",get:function t(){return new Sr(this,0,0,null)}},{key:"resolve",value:function t(n){var i,n,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=uv(gr.get(this)||this.topNode,n,i,!1);return gr.set(this,n),n}},{key:"resolveInner",value:function t(n){var i,n,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=uv(wr.get(this)||this.topNode,n,i,!0);return wr.set(this,n),n}},{key:"iterate",value:function t(n){for(var i,e,r,o,r,u,r,s,a,f,i=n.enter,e=n.leave,r=n.from,o=void 0===r?0:r,r=n.to,u=void 0===r?this.length:r,r=n.mode||0,s=0<(r&br.IncludeAnonymous),a=this.cursor(r|br.IncludeAnonymous);;){if(f=!1,a.from<=u&&a.to>=o&&(!s&&a.type.isAnonymous||!1!==i(a))){if(a.firstChild())continue;f=!0}for(;f&&e&&(s||!a.type.isAnonymous)&&e(a),!a.nextSibling();){if(!a.parent())return;f=!0}}}},{key:"prop",value:function t(n){return n.perNode?this.props?this.props[n.id]:void 0:this.type.prop(n)}},{key:"propValues",get:function t(){var n,i,n=[];if(this.props)for(i in this.props)n.push([+i,this.props[i]]);return n}},{key:"balance",value:function t(){var e,n,e=this,n;return this.children.length<=8?this:lv(kr.none,this.children,this.positions,0,this.children.length,0,this.length,function(t,n,i){return new h(e.type,t,n,i,e.propValues)},(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).makeTree||function(t,n,i){return new h(kr.none,t,n,i)})}}],[{key:"build",value:hv}]),h}()).empty=new x(kr.none,[],[],0),Mr=function(){function i(t,n){A(this,i),this.buffer=t,this.index=n}return D(i,[{key:"id",get:function t(){return this.buffer[this.index-4]}},{key:"start",get:function t(){return this.buffer[this.index-3]}},{key:"end",get:function t(){return this.buffer[this.index-2]}},{key:"size",get:function t(){return this.buffer[this.index-1]}},{key:"pos",get:function t(){return this.index}},{key:"next",value:function t(){this.index-=4}},{key:"fork",value:function t(){return new i(this.buffer,this.index)}}]),i}(),xr=function(){function h(t,n,i){A(this,h),this.buffer=t,this.length=n,this.set=i}return D(h,[{key:"type",get:function t(){return kr.none}},{key:"toString",value:function t(){for(var n,i,n=[],i=0;i<this.buffer.length;)n.push(this.childString(i)),i=this.buffer[i+3];return n.join(",")}},{key:"childString",value:function t(n){var i,e,i,r,o,i=this.buffer[n],e=this.buffer[n+3],i=this.set.types[i],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),e==(n+=4))return r;for(o=[];n<e;)o.push(this.childString(n)),n=this.buffer[n+3];return r+"("+o.join(",")+")"}},{key:"findChild",value:function t(n,i,e,r,o){for(var u,s,a,u=this.buffer,s=-1,a=n;a!=i&&!(rv(o,r,u[a+1],u[a+2])&&(s=a,0<e));a=u[a+3]);return s}},{key:"slice",value:function t(n,i,e){for(var r,o,u,s,a,f,r=this.buffer,o=new Uint16Array(i-n),u=0,s=n,a=0;s<i;)o[a++]=r[s++],o[a++]=r[s++]-e,f=o[a++]=r[s++]-e,o[a++]=r[s++]-n,u=Math.max(u,f);return new h(o,u,this.set)}}]),h}(),Sr=function(){function y(t,n,i,e){A(this,y),this.oMi=t,this.from=n,this.index=i,this.sft=e}return D(y,[{key:"type",get:function t(){return this.oMi.type}},{key:"name",get:function t(){return this.oMi.type.name}},{key:"to",get:function t(){return this.from+this.oMi.length}},{key:"nextChild",value:function t(n,i,e,r){for(var o,u,s,a,f,h,c,l,v,v,d,o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,u=this;;){for(a=(s=u.oMi).children,f=s.positions,h=0<i?a.length:-1;n!=h;n+=i)if(c=a[n],rv(r,e,l=f[n]+u.from,l+c.length))if(c instanceof xr){if(!(o&br.ExcludeBuffers)&&-1<(v=c.findChild(0,c.buffer.length,i,e-l,r)))return new jr(new Cr(u,c,n,l),null,v)}else if(o&br.IncludeAnonymous||!c.type.isAnonymous||fv(c))return v=void 0,o&br.IgnoreMounts||!c.props||!(v=c.prop(M.mounted))||v.overlay?(d=new y(c,l,n,u),o&br.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(i<0?c.children.length-1:0,i,e,r)):new y(v.tree,l,n,u);if(o&br.IncludeAnonymous||!u.type.isAnonymous)return null;if(n=0<=u.index?u.index+i:i<0?-1:u.sft.oMi.children.length,!(u=u.sft))return null}}},{key:"firstChild",get:function t(){return this.nextChild(0,1,0,4)}},{key:"lastChild",get:function t(){return this.nextChild(this.oMi.children.length-1,-1,0,4)}},{key:"childAfter",value:function t(n){return this.nextChild(0,1,n,2)}},{key:"childBefore",value:function t(n){return this.nextChild(this.oMi.children.length-1,-1,n,-2)}},{key:"enter",value:function t(n,i){var e,r,o,u,s,a,f,h,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;if(!(e&br.IgnoreOverlays)&&(r=this.oMi.prop(M.mounted))&&r.overlay){o=n-this.from,u=F(r.overlay);try{for(u.s();!(s=u.n()).done;)if(f=(a=s.value).from,h=a.to,(0<i?f<=o:f<o)&&(i<0?o<=h:o<h))return new y(r.tree,r.overlay[0].from+this.from,-1,this)}catch(t){u.e(t)}finally{u.f()}}return this.nextChild(0,1,n,i,e)}},{key:"nextSignificantParent",value:function t(){for(var n=this;n.type.isAnonymous&&n.sft;)n=n.sft;return n}},{key:"parent",get:function t(){return this.sft?this.sft.nextSignificantParent():null}},{key:"nextSibling",get:function t(){return this.sft&&0<=this.index?this.sft.nextChild(this.index+1,1,0,4):null}},{key:"prevSibling",get:function t(){return this.sft&&0<=this.index?this.sft.nextChild(this.index-1,-1,0,4):null}},{key:"cursor",value:function t(){var n;return new Pr(this,0<arguments.length&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function t(){return this.oMi}},{key:"toTree",value:function t(){return this.oMi}},{key:"resolve",value:function t(n){var i;return uv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function t(n){var i;return uv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function t(n){return ov(this,n)}},{key:"getChild",value:function t(n){var i,e,n,i,e,n=sv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null);return n.length?n[0]:null}},{key:"getChildren",value:function t(n){var i,e,i,e;return sv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null)}},{key:"toString",value:function t(){return this.oMi.toString()}},{key:"node",get:function t(){return this}},{key:"matchContext",value:function t(n){return av(this,n)}}]),y}(),Cr=D(function t(n,i,e,r){A(this,t),this.parent=n,this.buffer=i,this.index=e,this.start=r}),jr=function(){function o(t,n,i){A(this,o),this.context=t,this.sft=n,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}return D(o,[{key:"name",get:function t(){return this.type.name}},{key:"from",get:function t(){return this.context.start+this.context.buffer.buffer[this.index+1]}},{key:"to",get:function t(){return this.context.start+this.context.buffer.buffer[this.index+2]}},{key:"child",value:function t(n,i,e){var r,r,r=this.context.buffer,r=r.findChild(this.index+4,r.buffer[this.index+3],n,i-this.context.start,e);return r<0?null:new o(this.context,this,r)}},{key:"firstChild",get:function t(){return this.child(1,0,4)}},{key:"lastChild",get:function t(){return this.child(-1,0,4)}},{key:"childAfter",value:function t(n){return this.child(1,n,2)}},{key:"childBefore",value:function t(n){return this.child(-1,n,-2)}},{key:"enter",value:function t(n,i){var e,r,r,e;return(2<arguments.length&&void 0!==arguments[2]?arguments[2]:0)&br.ExcludeBuffers||(r=(r=this.context.buffer).findChild(this.index+4,r.buffer[this.index+3],0<i?1:-1,n-this.context.start,i))<0?null:new o(this.context,this,r)}},{key:"parent",get:function t(){return this.sft||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function t(n){return this.sft?null:this.context.parent.nextChild(this.context.index+n,n,0,4)}},{key:"nextSibling",get:function t(){var n,i,n=this.context.buffer,i=n.buffer[this.index+3];return i<(this.sft?n.buffer[this.sft.index+3]:n.buffer.length)?new o(this.context,this.sft,i):this.externalSibling(1)}},{key:"prevSibling",get:function t(){var n,i,n=this.context.buffer,i=this.sft?this.sft.index+4:0;return this.index==i?this.externalSibling(-1):new o(this.context,this.sft,n.findChild(i,this.index,-1,0,4))}},{key:"cursor",value:function t(){var n;return new Pr(this,0<arguments.length&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function t(){return null}},{key:"toTree",value:function t(){var n,i,e,r,o,u,n=[],i=[],e=this.context.buffer,r=this.index+4,o=e.buffer[this.index+3];return r<o&&(u=e.buffer[this.index+1],n.push(e.slice(r,o,u)),i.push(0)),new x(this.type,n,i,this.to-this.from)}},{key:"resolve",value:function t(n){var i;return uv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function t(n){var i;return uv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function t(n){return ov(this,n)}},{key:"toString",value:function t(){return this.context.buffer.childString(this.index)}},{key:"getChild",value:function t(n){var i,e,n,i,e,n=sv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null);return n.length?n[0]:null}},{key:"getChildren",value:function t(n){var i,e,i,e;return sv(this,n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null)}},{key:"node",get:function t(){return this}},{key:"matchContext",value:function t(n){return av(this,n)}}]),o}(),Pr=function(){function e(t){var n,i,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;if(A(this,e),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Sr)this.yieldNode(t);else{for(this.oMi=t.context.parent,this.buffer=t.context,i=t.sft;i;i=i.sft)this.stack.unshift(i.index);this.bufferNode=t,this.yieldBuf(t.index)}}return D(e,[{key:"name",get:function t(){return this.type.name}},{key:"yieldNode",value:function t(n){return!!n&&(this.oMi=n,this.type=n.type,this.from=n.from,this.to=n.to,!0)}},{key:"yieldBuf",value:function t(n,i){this.index=n;var e=this.buffer,r=e.start,e=e.buffer;return this.type=i||e.set.types[e.buffer[n]],this.from=r+e.buffer[n+1],this.to=r+e.buffer[n+2],!0}},{key:"yield",value:function t(n){return!!n&&(n instanceof Sr?(this.buffer=null,this.yieldNode(n)):(this.buffer=n.context,this.yieldBuf(n.index,n.type)))}},{key:"toString",value:function t(){return this.buffer?this.buffer.buffer.childString(this.index):this.oMi.toString()}},{key:"enterChild",value:function t(n,i,e){var r,r;return this.buffer?!((r=(r=this.buffer.buffer).findChild(this.index+4,r.buffer[this.index+3],n,i-this.buffer.start,e))<0)&&(this.stack.push(this.index),this.yieldBuf(r)):this.yield(this.oMi.nextChild(n<0?this.oMi.oMi.children.length-1:0,n,i,e,this.mode))}},{key:"firstChild",value:function t(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function t(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function t(n){return this.enterChild(1,n,2)}},{key:"childBefore",value:function t(n){return this.enterChild(-1,n,-2)}},{key:"enter",value:function t(n,i){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(e&br.ExcludeBuffers)&&this.enterChild(1,n,i):this.yield(this.oMi.enter(n,i,e))}},{key:"parent",value:function t(){var t;return this.buffer?this.stack.length?this.yieldBuf(this.stack.pop()):(t=this.mode&br.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent(),this.buffer=null,this.yieldNode(t)):this.yieldNode(this.mode&br.IncludeAnonymous?this.oMi.sft:this.oMi.parent)}},{key:"sibling",value:function t(n){var i,e,r,r;if(!this.buffer)return!!this.oMi.sft&&this.yield(this.oMi.index<0?null:this.oMi.sft.nextChild(this.oMi.index+n,n,0,4,this.mode));if(i=this.buffer.buffer,e=this.stack.length-1,n<0){if(r=e<0?0:this.stack[e]+4,this.index!=r)return this.yieldBuf(i.findChild(r,this.index,-1,0,4))}else if((r=i.buffer[this.index+3])<(e<0?i.buffer.length:i.buffer[this.stack[e]+3]))return this.yieldBuf(r);return e<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+n,n,0,4,this.mode))}},{key:"nextSibling",value:function t(){return this.sibling(1)}},{key:"prevSibling",value:function t(){return this.sibling(-1)}},{key:"atLastNode",value:function t(n){var i,e,r,o,u,s,a,f,h,r=this.buffer;if(r){if(0<n){if(this.index<r.buffer.buffer.length)return!1}else for(o=0;o<this.index;o++)if(r.buffer.buffer[o+3]<this.index)return!1;i=r.index,e=r.parent}else i=(u=this.oMi).index,e=u.sft;for(;e;i=(s=e).index,e=s.sft)if(-1<i)for(a=i+n,f=n<0?-1:e.oMi.children.length;a!=f;a+=n)if(h=e.oMi.children[a],this.mode&br.IncludeAnonymous||h instanceof xr||!h.type.isAnonymous||fv(h))return!1;return!0}},{key:"move",value:function t(n,i){if(i&&this.enterChild(n,0,4))return!0;for(;;){if(this.sibling(n))return!0;if(this.atLastNode(n)||!this.parent())return!1}}},{key:"next",value:function t(){var n;return this.move(1,!(0<arguments.length&&void 0!==arguments[0])||arguments[0])}},{key:"prev",value:function t(){var n;return this.move(-1,!(0<arguments.length&&void 0!==arguments[0])||arguments[0])}},{key:"moveTo",value:function t(n){for(var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;(this.from==this.to||(i<1?this.from>=n:this.from>n)||(-1<i?this.to<=n:this.to<n))&&this.parent(););for(;this.enterChild(1,n,i););return this}},{key:"node",get:function t(){var n,i,e,r,o,u,s;if(!this.buffer)return this.oMi;if(i=null,e=0,(n=this.bufferNode)&&n.context==this.buffer)t:for(r=this.index,o=this.stack.length;0<=o;){for(u=n;u;u=u.sft)if(u.index==r){if(r==this.index)return u;i=u,e=o+1;break t}r=this.stack[--o]}for(s=e;s<this.stack.length;s++)i=new jr(this.buffer,i,this.stack[s]);return this.bufferNode=new jr(this.buffer,i,this.index)}},{key:"tree",get:function t(){return this.buffer?null:this.oMi.oMi}},{key:"iterate",value:function t(n,i){for(var e,r,e=0;;){if(r=!1,this.type.isAnonymous||!1!==n(this)){if(this.firstChild()){e++;continue}this.type.isAnonymous||(r=!0)}for(;r&&i&&i(this),r=this.type.isAnonymous,!this.nextSibling();){if(!e)return;this.parent(),e--,r=!0}}}},{key:"matchContext",value:function t(n){var i,e,r,o,u;if(!this.buffer)return av(this.node,n);for(e=(i=this.buffer.buffer).set.types,r=n.length-1,o=this.stack.length-1;0<=r;o--){if(o<0)return av(this.node,n,r);if(!(u=e[i.buffer[this.stack[o]]]).isAnonymous){if(n[r]&&n[r]!=u.name)return!1;r--}}return!0}}]),e}(),Or=new WeakMap,Er=function(){function y(t,n,i,e){var r,o,r=4<arguments.length&&void 0!==arguments[4]&&arguments[4],o=5<arguments.length&&void 0!==arguments[5]&&arguments[5];A(this,y),this.from=t,this.to=n,this.tree=i,this.offset=e,this.open=(r?1:0)|(o?2:0)}return D(y,[{key:"openStart",get:function t(){return 0<(1&this.open)}},{key:"openEnd",get:function t(){return 0<(2&this.open)}}],[{key:"addTree",value:function t(n){var i,e,r,o,u,s,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],e,r=[new y(0,n.length,n,0,!1,2<arguments.length&&void 0!==arguments[2]&&arguments[2])],o=F(i);try{for(o.s();!(u=o.n()).done;)(s=u.value).to>n.length&&r.push(s)}catch(t){o.e(t)}finally{o.f()}return r}},{key:"applyChanges",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,d,e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:128;if(!i.length)return n;for(r=[],o=1,u=n.length?n[0]:null,f=a=s=0;;s++){if(e<=(c=(h=s<i.length?i[s]:null)?h.fromA:1e9)-a)for(;u&&u.from<c&&((a>=(l=u).from||c<=l.to||f)&&(v=Math.max(l.from,a)-f,l=(d=Math.min(l.to,c)-f)<=v?null:new y(v,d,l.tree,l.offset+f,0<s,!!h)),l&&r.push(l),!(u.to>c));)u=o<n.length?n[o++]:null;if(!h)break;a=h.toA,f=h.toA-h.toB}return r}}]),y}(),Ar=function(){function t(){A(this,t)}return D(t,[{key:"startParse",value:function t(n,i,e){return"string"==typeof n&&(n=new Dr(n)),e=e?e.length?e.map(function(t){return new mr(t.from,t.to)}):[new mr(0,0)]:[new mr(0,n.length)],this.createParse(n,i||[],e)}},{key:"parse",value:function t(n,i,e){var t,r;for(t=this.startParse(n,i,e);;)if(r=t.advance())return r}}]),t}(),Dr=function(){function n(t){A(this,n),this.string=t}return D(n,[{key:"length",get:function t(){return this.string.length}},{key:"chunk",value:function t(n){return this.string.slice(n)}},{key:"lineChunks",get:function t(){return!1}},{key:"read",value:function t(n,i){return this.string.slice(n,i)}}]),n}(),new M({perNode:!0}),Rr=0,Ir=function(){function u(t,n,i){A(this,u),this.set=t,this.base=n,this.modified=i,this.id=Rr++}return D(u,null,[{key:"define",value:function t(n){var i,e,r,o;if(null!=n&&n.base)throw new Error("Can not derive from a modified tag");if((i=new u([],null,[])).set.push(i),n){e=F(n.set);try{for(e.s();!(r=e.n()).done;)o=r.value,i.set.push(o)}catch(t){e.e(t)}finally{e.f()}}return i}},{key:"defineModifier",value:function t(){var n=new Lr;return function(t){return-1<t.modified.indexOf(n)?t:Lr.get(t.base||t,t.modified.concat(n).sort(function(t,n){return t.id-n.id}))}}}]),u}(),Tr=0,Lr=function(){function m(){A(this,m),this.instances=[],this.id=Tr++}return D(m,null,[{key:"get",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y;if(!i.length)return n;if(e=i[0].instances.find(function(t){return t.base==n&&vv(i,t.modified)}))return e;o=new Ir(r=[],n,i),u=F(i);try{for(u.s();!(s=u.n()).done;)(a=s.value).instances.push(o)}catch(t){u.e(t)}finally{u.f()}f=dv(i),h=F(n.set);try{for(h.s();!(c=h.n()).done;)if(!(l=c.value).modified.length){v=F(f);try{for(v.s();!(d=v.n()).done;)y=d.value,r.push(m.get(l,y))}catch(t){v.e(t)}finally{v.f()}}}catch(t){h.e(t)}finally{h.f()}return o}}]),m}(),Br=new M,(_r=function(){function r(t,n,i,e){A(this,r),this.tags=t,this.mode=n,this.context=i,this.next=e}return D(r,[{key:"opaque",get:function t(){return 0==this.mode}},{key:"inherit",get:function t(){return 1==this.mode}},{key:"sort",value:function t(n){return!n||n.depth<this.depth?(this.next=n,this):(n.next=this.sort(n.next),n)}},{key:"depth",get:function t(){return this.context?this.context.length:0}}]),r}()).empty=new _r([],2,null),Fr=function(){function e(t,n,i){A(this,e),this.at=t,this.highlighters=n,this.span=i,this.class=""}return D(e,[{key:"startSpan",value:function t(n,i){i!=this.class&&(this.flush(n),n>this.at&&(this.at=n),this.class=i)}},{key:"flush",value:function t(n){n>this.at&&this.class&&this.span(this.at,n,this.class)}},{key:"highlightRange",value:function t(n,i,e,r,o){var u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,u=n.type,s=n.from,a=n.to;if(!(e<=s||a<=i||(f=r,(c=pv(o=u.isTop?this.highlighters.filter(function(t){return!t.scope||t.scope(u)}):o,(h=gv(n)||_r.empty).tags))&&(f&&(f+=" "),f+=c,1==h.mode)&&(r+=(r?" ":"")+c),this.startSpan(Math.max(i,s),f),h.opaque)))if((l=n.tree&&n.tree.prop(M.mounted))&&l.overlay){for(v=n.node.enter(l.overlay[0].from+s,1),d=this.highlighters.filter(function(t){return!t.scope||t.scope(l.tree.type)}),y=n.firstChild(),m=0,p=s;;m++){if(g=(k=m<l.overlay.length?l.overlay[m]:null)?k.from+s:a,(w=Math.max(i,p))<(b=Math.min(e,g))&&y)for(;n.from<b&&(this.highlightRange(n,w,b,r,o),this.startSpan(Math.min(b,n.to),f),!(n.to>=g))&&n.nextSibling(););if(!k||e<g)break;i<(p=k.to+s)&&(this.highlightRange(v.cursor(),Math.max(i,k.from+s),Math.min(e,p),"",d),this.startSpan(Math.min(e,p),f))}y&&n.parent()}else if(n.firstChild()){l&&(r="");do{if(!(n.to<=i)){if(n.from>=e)break;this.highlightRange(n,i,e,r,o),this.startSpan(Math.min(e,n.to),f)}}while(n.nextSibling());n.parent()}}}]),e}(),t=(r=Ir.define)(),e=r(),Yt=r(e),Zt=r(e),u=r(),nn=r(u),o=r(u),Nr=r(),Ur=r(Nr),Hr=r(),zr=r(),Wr=r(),Vr=r(Wr),$r=r(),mv([{tag:(a={comment:t,lineComment:r(t),blockComment:r(t),docComment:r(t),name:e,variableName:r(e),typeName:Yt,tagName:r(Yt),propertyName:Zt,attributeName:r(Zt),className:r(e),labelName:r(e),namespace:r(e),macroName:r(e),literal:u,string:nn,docString:r(nn),character:r(nn),attributeValue:r(nn),number:o,integer:r(o),float:r(o),bool:r(u),regexp:r(u),escape:r(u),color:r(u),url:r(u),keyword:Hr,self:r(Hr),null:r(Hr),atom:r(Hr),unit:r(Hr),modifier:r(Hr),operatorKeyword:r(Hr),controlKeyword:r(Hr),definitionKeyword:r(Hr),moduleKeyword:r(Hr),operator:zr,derefOperator:r(zr),arithmeticOperator:r(zr),logicOperator:r(zr),bitwiseOperator:r(zr),compareOperator:r(zr),updateOperator:r(zr),definitionOperator:r(zr),typeOperator:r(zr),controlOperator:r(zr),punctuation:Wr,separator:r(Wr),bracket:Vr,angleBracket:r(Vr),squareBracket:r(Vr),paren:r(Vr),brace:r(Vr),content:Nr,heading:Ur,heading1:r(Ur),heading2:r(Ur),heading3:r(Ur),heading4:r(Ur),heading5:r(Ur),heading6:r(Ur),contentSeparator:r(Nr),list:r(Nr),quote:r(Nr),emphasis:r(Nr),strong:r(Nr),link:r(Nr),monospace:r(Nr),strikethrough:r(Nr),inserted:r(),deleted:r(),changed:r(),invalid:r(),meta:$r,documentMeta:r($r),annotation:r($r),processingInstruction:r($r),definition:Ir.defineModifier(),constant:Ir.defineModifier(),function:Ir.defineModifier(),standard:Ir.defineModifier(),local:Ir.defineModifier(),special:Ir.defineModifier()}).link,class:"tok-link"},{tag:a.heading,class:"tok-heading"},{tag:a.emphasis,class:"tok-emphasis"},{tag:a.strong,class:"tok-strong"},{tag:a.keyword,class:"tok-keyword"},{tag:a.atom,class:"tok-atom"},{tag:a.bool,class:"tok-bool"},{tag:a.url,class:"tok-url"},{tag:a.labelName,class:"tok-labelName"},{tag:a.inserted,class:"tok-inserted"},{tag:a.deleted,class:"tok-deleted"},{tag:a.literal,class:"tok-literal"},{tag:a.string,class:"tok-string"},{tag:a.number,class:"tok-number"},{tag:[a.regexp,a.escape,a.special(a.string)],class:"tok-string2"},{tag:a.variableName,class:"tok-variableName"},{tag:a.local(a.variableName),class:"tok-variableName tok-local"},{tag:a.definition(a.variableName),class:"tok-variableName tok-definition"},{tag:a.special(a.variableName),class:"tok-variableName2"},{tag:a.definition(a.propertyName),class:"tok-propertyName tok-definition"},{tag:a.typeName,class:"tok-typeName"},{tag:a.namespace,class:"tok-namespace"},{tag:a.className,class:"tok-className"},{tag:a.macroName,class:"tok-macroName"},{tag:a.propertyName,class:"tok-propertyName"},{tag:a.operator,class:"tok-operator"},{tag:a.comment,class:"tok-comment"},{tag:a.meta,class:"tok-meta"},{tag:a.invalid,class:"tok-invalid"},{tag:a.punctuation,class:"tok-punctuation"}]),qr=new M,Gr=new M,(Jr=function(){function r(t,n){var i,e,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[],e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"";A(this,r),this.data=t,this.name=e,C.prototype.hasOwnProperty("tree")||Object.defineProperty(C.prototype,"tree",{get:function t(){return R(this)}}),this.parser=n,this.extension=[io.of(this),C.languageData.of(function(t,n,i){var e,r,o,r,u,s,a,f,h,e=bv(t,n,i),r=e.type.prop(qr);if(!r)return[];if(o=t.facet(r),r=e.type.prop(Gr)){u=e.resolve(n-e.from,i),s=F(r);try{for(s.s();!(a=s.n()).done;)if((f=a.value).test(u,t))return h=t.facet(f.facet),"replace"==f.type?h:h.concat(o)}catch(t){s.e(t)}finally{s.f()}}return o})].concat(i)}return D(r,[{key:"isActiveAt",value:function t(n,i){var e;return bv(n,i,2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1).type.prop(qr)==this.data}},{key:"findRegions",value:function t(n){var h,i,c,e,h=this,i=n.facet(io);return(null==i?void 0:i.data)==this.data?[{from:0,to:n.doc.length}]:i&&i.allowsNesting?(c=[],(e=function t(n,i){var e,r,o,u,s,a,f;if(n.prop(qr)==h.data)c.push({from:i,to:i+n.length});else{if(e=n.prop(M.mounted)){if(e.tree.prop(qr)==h.data){if(e.overlay){r=F(e.overlay);try{for(r.s();!(o=r.n()).done;)u=o.value,c.push({from:u.from+i,to:u.to+i})}catch(t){r.e(t)}finally{r.f()}}else c.push({from:i,to:i+n.length});return}if(e.overlay&&(s=c.length,t(e.tree,e.overlay[0].from+i),c.length>s))return}for(a=0;a<n.children.length;a++)(f=n.children[a])instanceof x&&t(f,n.positions[a]+i)}})(R(n),0),c):[]}},{key:"allowsNesting",get:function t(){return!0}}]),r}()).setState=v.define(),t=function(t){f(r,t);var e=S(r);function r(t,n,i){var t;return A(this,r),(t=e.call(this,t,n,[],i)).parser=n,t}return D(r,[{key:"configure",value:function t(n,i){return new r(this.data,this.parser.configure(n),i||this.name)}},{key:"allowsNesting",get:function t(){return this.parser.hasWrappers()}}],[{key:"define",value:function t(n){var i=wv(n.languageData);return new r(i,n.parser.configure({props:[qr.add(function(t){return t.isTop?i:void 0})]}),n.name)}}]),r}(Jr),Kr=function(){function n(t){A(this,n),this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}return D(n,[{key:"length",get:function t(){return this.doc.length}},{key:"syncTo",value:function t(n){return this.string=this.cursor.next(n-this.cursorPos).value,this.cursorPos=n+this.string.length,this.cursorPos-this.string.length}},{key:"chunk",value:function t(n){return this.syncTo(n),this.string}},{key:"lineChunks",get:function t(){return!0}},{key:"read",value:function t(n,i){var e=this.cursorPos-this.string.length;return n<e||i>=this.cursorPos?this.doc.sliceString(n,i):this.string.slice(n-e,i-e)}}]),n}(),Qr=null,Xr=function(){function d(t,n){var i,e,r,o,u,s,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[],e=3<arguments.length?arguments[3]:void 0,r=4<arguments.length?arguments[4]:void 0,o=5<arguments.length?arguments[5]:void 0,u=6<arguments.length?arguments[6]:void 0,s=7<arguments.length?arguments[7]:void 0;A(this,d),this.parser=t,this.state=n,this.fragments=i,this.tree=e,this.treeLen=r,this.viewport=o,this.skipped=u,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}return D(d,[{key:"startParse",value:function t(){return this.parser.startParse(new Kr(this.state.doc),this.fragments)}},{key:"work",value:function t(e,r){var o=this;return null!=r&&r>=this.state.doc.length&&(r=void 0),this.tree!=x.empty&&this.isDone(null!=r?r:this.state.doc.length)?(this.takeTree(),!0):this.withContext(function(){var t,n,i;for("number"==typeof e&&(n=Date.now()+e,e=function t(){return Date.now()>n}),o.parse||(o.parse=o.startParse()),null!=r&&(null==o.parse.stoppedAt||o.parse.stoppedAt>r)&&r<o.state.doc.length&&o.parse.stopAt(r);;){if(i=o.parse.advance()){if(o.fragments=o.withoutTempSkipped(Er.addTree(i,o.fragments,null!=o.parse.stoppedAt)),o.treeLen=null!=(t=o.parse.stoppedAt)?t:o.state.doc.length,o.tree=i,o.parse=null,!(o.treeLen<(null!=r?r:o.state.doc.length)))return!0;o.parse=o.startParse()}if(e())return!1}})}},{key:"takeTree",value:function t(){var n,i,e,n=this;this.parse&&(i=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>i)&&this.parse.stopAt(i),this.withContext(function(){for(;!(e=n.parse.advance()););}),this.treeLen=i,this.tree=e,this.fragments=this.withoutTempSkipped(Er.addTree(this.tree,this.fragments,!0)),this.parse=null)}},{key:"withContext",value:function t(n){var i=Qr;Qr=this;try{return n()}finally{Qr=i}}},{key:"withoutTempSkipped",value:function t(n){for(var i;i=this.tempSkipped.pop();)n=jv(n,i.from,i.to);return n}},{key:"changes",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,e=this.fragments,r=this.tree,o=this.treeLen,u=this.viewport,s=this.skipped;if(this.takeTree(),!n.empty&&(a=[],n.iterChangedRanges(function(t,n,i,e){return a.push({fromA:t,toA:n,fromB:i,toB:e})}),e=Er.applyChanges(e,a),r=x.empty,o=0,u={from:n.mapPos(u.from,-1),to:n.mapPos(u.to,1)},this.skipped.length)){s=[],f=F(this.skipped);try{for(f.s();!(h=f.n()).done;)c=h.value,(l=n.mapPos(c.from,1))<(v=n.mapPos(c.to,-1))&&s.push({from:l,to:v})}catch(t){f.e(t)}finally{f.f()}}return new d(this.parser,i,e,r,o,u,s,this.scheduleOn)}},{key:"updateViewport",value:function t(n){var i,e,r,o,r;if(this.viewport.from==n.from&&this.viewport.to==n.to)return!1;for(this.viewport=n,i=this.skipped.length,e=0;e<this.skipped.length;e++)o=(r=this.skipped[e]).from,r=r.to,o<n.to&&r>n.from&&(this.fragments=jv(this.fragments,o,r),this.skipped.splice(e--,1));return!(this.skipped.length>=i||(this.reset(),0))}},{key:"reset",value:function t(){this.parse&&(this.takeTree(),this.parse=null)}},{key:"skipUntilInView",value:function t(n,i){this.skipped.push({from:n,to:i})}},{key:"isDone",value:function t(n){n=Math.min(n,this.state.doc.length);var i=this.fragments;return this.treeLen>=n&&i.length&&0==i[0].from&&i[0].to>=n}}],[{key:"create",value:function t(n,i,e){return new d(n,i,[],x.empty,0,e,[],null)}},{key:"getSkippingParser",value:function t(a){return new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"createParse",value:function t(n,i,o){var u,s,e,u=o[0].from,s=o[o.length-1].to,e;return{parsedPos:u,advance:function t(){var n,i,e,r,n=Qr;if(n){i=F(o);try{for(i.s();!(e=i.n()).done;)r=e.value,n.tempSkipped.push(r)}catch(t){i.e(t)}finally{i.f()}a&&(n.scheduleOn=n.scheduleOn?Promise.all([n.scheduleOn,a]):a)}return this.parsedPos=s,new x(kr.none,[],[],s-u)},stoppedAt:null,stopAt:function t(){}}}}]),i}(Ar))}},{key:"get",value:function t(){return Qr}}]),d}(),Zr=function(){function e(t){A(this,e),this.context=t,this.tree=t.tree}return D(e,[{key:"apply",value:function t(n){var i,n;return n.docChanged||this.tree!=this.context.tree?(i=this.context.changes(n.changes,n.state),n=this.context.treeLen==n.startState.doc.length?void 0:Math.max(n.changes.mapPos(this.context.treeLen),i.viewport.to),i.work(20,n)||i.takeTree(),new e(i)):this}}],[{key:"init",value:function t(n){var i,n,i=Math.min(3e3,n.doc.length),n=Xr.create(n.facet(io).parser,n,{from:0,to:i});return n.work(20,i)||n.takeTree(),new e(n)}}]),e}(),Jr.state=b.define({create:Zr.init,update:function t(n,i){var e,r,o,e=F(i.effects);try{for(e.s();!(r=e.n()).done;)if((o=r.value).is(Jr.setState))return o.value}catch(t){e.e(t)}finally{e.f()}return i.startState.facet(io)!=i.state.facet(io)?Zr.init(i.state):n.apply(i)}}),Yr=function t(n){var i=setTimeout(function(){return n()},500);return function(){return clearTimeout(i)}},"undefined"!=typeof requestIdleCallback&&(Yr=function t(n){var i=-1,e=setTimeout(function(){i=requestIdleCallback(n,{timeout:400})},100);return function(){return i<0?clearTimeout(e):cancelIdleCallback(i)}}),to="undefined"!=typeof navigator&&null!=(Yt=navigator.scheduling)&&Yt.isInputPending?function(){return navigator.scheduling.isInputPending()}:null,no=d.fromClass(function(){function n(t){A(this,n),this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}return D(n,[{key:"update",value:function t(n){var i=this.view.state.field(Jr.state).context;(i.updateViewport(n.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),n.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}},{key:"scheduleWork",value:function t(){var n,i;this.working||(i=(n=this.view.state).field(Jr.state)).tree==i.context.tree&&i.context.isDone(n.doc.length)||(this.working=Yr(this.work))}},{key:"work",value:function t(n){var i,e,r,e,o,u,n,r;this.working=null,i=Date.now(),this.chunkEnd<i&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=i+3e4,this.chunkBudget=3e3),this.chunkBudget<=0||(r=(e=this.view).state,e=e.viewport.to,(o=r.field(Jr.state)).tree==o.context.tree&&o.context.isDone(e+1e5))||(u=Date.now()+Math.min(this.chunkBudget,100,n&&!to?Math.max(25,n.timeRemaining()-5):1e9),n=o.context.treeLen<e&&r.doc.length>e+1e3,r=o.context.work(function(){return to&&to()||Date.now()>u},e+(n?0:1e5)),this.chunkBudget-=Date.now()-i,(r||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Jr.setState.of(new Zr(o.context))})),0<this.chunkBudget&&(!r||n)&&this.scheduleWork(),this.checkAsyncSchedule(o.context))}},{key:"checkAsyncSchedule",value:function t(n){var i=this;n.scheduleOn&&(this.workScheduled++,n.scheduleOn.then(function(){return i.scheduleWork()}).catch(function(t){return Wc(i.view.state,t)}).then(function(){return i.workScheduled--}),n.scheduleOn=null)}},{key:"destroy",value:function t(){this.working&&this.working()}},{key:"isWorking",value:function t(){return!!(this.working||0<this.workScheduled)}}]),n}(),{eventHandlers:{focus:function t(){this.scheduleWork()}}}),io=y.define({combine:function t(n){return n.length?n[0]:null},enables:function t(n){return[Jr.state,no,w.contentAttributes.compute([n],function(t){var t=t.facet(n);return t&&t.name?{"data-language":t.name}:{}})]}}),Zt=D(function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];A(this,t),this.language=n,this.support=i,this.extension=[n,i]}),e=function(){function u(t,n,i,e,r){var o=5<arguments.length&&void 0!==arguments[5]?arguments[5]:void 0;A(this,u),this.name=t,this.alias=n,this.extensions=i,this.filename=e,this.loadFunc=r,this.support=o,this.loading=null}return D(u,[{key:"load",value:function t(){var n=this;return this.loading||(this.loading=this.loadFunc().then(function(t){return n.support=t},function(t){throw n.loading=null,t}))}}],[{key:"of",value:function t(n){var i=n.load,e=n.support;if(!i){if(!e)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");i=function t(){return Promise.resolve(e)}}return new u(n.name,(n.alias||[]).concat(n.name).map(function(t){return t.toLowerCase()}),n.extensions||[],n.filename,i,e)}},{key:"matchFilename",value:function t(n,i){var e,r,o,u,s,a,f,e=F(n);try{for(e.s();!(r=e.n()).done;)if((o=r.value).filename&&o.filename.test(i))return o}catch(t){e.e(t)}finally{e.f()}if(u=/\.([^.]+)$/.exec(i)){s=F(n);try{for(s.s();!(a=s.n()).done;)if(-1<(f=a.value).extensions.indexOf(u[1]))return f}catch(t){s.e(t)}finally{s.f()}}return null}},{key:"matchLanguageName",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,e=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];i=i.toLowerCase(),r=F(n);try{for(r.s();!(o=r.n()).done;)if((u=o.value).alias.some(function(t){return t==i}))return u}catch(t){r.e(t)}finally{r.f()}if(e){s=F(n);try{for(s.s();!(a=s.n()).done;){h=F((f=a.value).alias);try{for(h.s();!(c=h.n()).done;)if(l=c.value,-1<(v=i.indexOf(l))&&(2<l.length||!/\w/.test(i[v-1])&&!/\w/.test(i[v+l.length])))return f}catch(t){h.e(t)}finally{h.f()}}}catch(t){s.e(t)}finally{s.f()}}return null}}]),u}(),eo=y.define(),ro=y.define({combine:function t(n){if(!n.length)return" ";var i=n[0];if(!i||/\S/.test(i)||Array.from(i).some(function(t){return t!=i[0]}))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return i}}),uo=new M,so=function(t){f(o,t);var r=S(o);function o(t,n,i){var e;return A(this,o),(e=r.call(this,t.state,t.options)).base=t,e.pos=n,e.node=i,e}return D(o,[{key:"textAfter",get:function t(){return this.textAfterPos(this.pos)}},{key:"baseIndent",get:function t(){for(var n,i,n=this.state.doc.lineAt(this.node.from);;){for(i=this.node.resolve(n.from);i.parent&&i.parent.from==i.from;)i=i.parent;if(Bv(i,this.node))break;n=this.state.doc.lineAt(i.from)}return this.lineIndent(n.from)}},{key:"continue",value:function t(){var n=this.node.parent;return n?Tv(n,this.pos,this.base):0}}],[{key:"create",value:function t(n,i,e){return new o(n,i,e)}}]),o}(oo=function(){function i(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};A(this,i),this.state=t,this.options=n,this.unit=Pv(t)}return D(i,[{key:"lineAt",value:function t(n){var i,e,r,o,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,e=this.state.doc.lineAt(n),r=this.options,o=r.simulateBreak,r=r.simulateDoubleBreak;return null!=o&&o>=e.from&&o<=e.to?r&&o==n?{text:"",from:n}:(i<0?o<n:o<=n)?{text:e.text.slice(o-e.from),from:o}:{text:e.text.slice(0,o-e.from),from:e.from}:e}},{key:"textAfterPos",value:function t(n){var i,e,r,e,i;return this.options.simulateDoubleBreak&&n==this.options.simulateBreak?"":(r=(e=this.lineAt(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1)).text,e=e.from,r.slice(n-e,Math.min(r.length,n+100-e)))}},{key:"column",value:function t(n){var i,e,r,e,n,e,i,e=this.lineAt(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1),r=e.text,e=e.from,n=this.countColumn(r,n-e),e=this.options.overrideIndentation?this.options.overrideIndentation(e):-1;return-1<e&&(n+=e-this.countColumn(r,r.search(/\S|$/))),n}},{key:"countColumn",value:function t(n){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:n.length;return ic(n,this.state.tabSize,i)}},{key:"lineIndent",value:function t(n){var i,n,e,n,r,r,i,n=this.lineAt(n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1),e=n.text,n=n.from,r=this.options.overrideIndentation;return r&&-1<(r=r(n))?r:this.countColumn(e,e.search(/\S|$/))}},{key:"simulatedBreak",get:function t(){return this.options.simulateBreak||null}}]),i}()),nn=function t(n){return n.baseIndent},ao=200,fo=y.define(),ho=new M,co=v.define({map:qv}),lo=v.define({map:qv}),vo=b.define({create:function t(){return m.none},update:function t(n,i){var e,r,o,u,s;n=n.map(i.changes),e=F(i.effects);try{for(o=function t(){var e=r.value;e.is(co)&&!Qv(n,e.value.from,e.value.to)?n=n.update({add:[ko.range(e.value.from,e.value.to)]}):e.is(lo)&&(n=n.update({filter:function t(n,i){return e.value.from!=n||e.value.to!=i},filterFrom:e.value.from,filterTo:e.value.to}))},e.s();!(r=e.n()).done;)o()}catch(t){e.e(t)}finally{e.f()}return n=i.selection&&(u=!1,s=i.selection.main.head,n.between(s,s,function(t,n){t<s&&s<n&&(u=!0)}),u)?n.update({filterFrom:s,filterTo:s,filter:function t(n,i){return i<=s||s<=n}}):n},provide:function t(n){return w.decorations.from(n)},toJSON:function t(n,i){var e=[];return n.between(0,i.doc.length,function(t,n){e.push(t,n)}),e},fromJSON:function t(n){var i,e,r,o;if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");for(i=[],e=0;e<n.length;){if(r=n[e++],o=n[e++],"number"!=typeof r||"number"!=typeof o)throw new RangeError("Invalid JSON for fold state");i.push(ko.range(r,o))}return m.set(i,!0)}}),o=function t(n){var i,e,r,o,u,s,i=[],e=F(Gv(n));try{for(e.s();!(r=e.n()).done;)o=r.value,(u=Kv(n.state,o.from,o.to))?i.push(lo.of(u),Zv(n,u,!1)):(s=Yv(n,o))&&i.push(co.of(s),Zv(n,s))}catch(t){e.e(t)}finally{e.f()}return 0<i.length&&n.dispatch({effects:Xv(n.state,i)}),!!i.length},yo=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:u=function t(n){var i,e,r,o,i=F(Gv(n));try{for(i.s();!(e=i.n()).done;)if(r=e.value,o=$v(n.state,r.from,r.to))return n.dispatch({effects:Xv(n.state,[co.of(o),Zv(n,o)])}),!0}catch(t){i.e(t)}finally{i.f()}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Hr=function t(n){var i,e,r,o,u;if(!n.state.field(vo,!1))return!1;i=[],e=F(Gv(n));try{for(e.s();!(r=e.n()).done;)o=r.value,(u=Kv(n.state,o.from,o.to))&&i.push(lo.of(u),Zv(n,u,!1))}catch(t){e.e(t)}finally{e.f()}return i.length&&n.dispatch({effects:i}),0<i.length}},{key:"Ctrl-Alt-[",run:zr=function t(n){for(var i,e,r,o,u,i=n.state,e=[],r=0;r<i.doc.length;)(u=$v(i,(o=n.lineBlockAt(r)).from,o.to))&&e.push(co.of(u)),r=(u?n.lineBlockAt(u.to):o).to+1;return e.length&&n.dispatch({effects:Xv(n.state,e)}),!!e.length}},{key:"Ctrl-Alt-]",run:Wr=function t(n){var i,e,i=n.state.field(vo,!1);return!(!i||!i.size||(e=[],i.between(0,n.state.doc.length,function(t,n){e.push(lo.of({from:t,to:n}))}),n.dispatch({effects:e}),0))}}],mo={placeholderDOM:null,placeholderText:"\u2026"},po=y.define({combine:function t(n){return qh(n,mo)}}),ko=m.replace({widget:new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"toDOM",value:function t(e){var n,i,r,o,n=e.state,i=n.facet(po),r=function t(n){var i,i,i=e.lineBlockAt(e.posAtDOM(n.target)),i=Kv(e.state,i.from,i.to);i&&e.dispatch({effects:lo.of(i)}),n.preventDefault()};return i.placeholderDOM?i.placeholderDOM(e,r):((o=document.createElement("span")).textContent=i.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=r,o)}}]),i}(tn))}),go={openText:"\u2304",closedText:"\u203a",markerDOM:null,domEventHandlers:{},foldingChanged:function t(){return!1}},wo=function(t){f(r,t);var e=S(r);function r(t,n){var i;return A(this,r),(i=e.call(this)).config=t,i.open=n,i}return D(r,[{key:"eq",value:function t(n){return this.config==n.config&&this.open==n.open}},{key:"toDOM",value:function t(n){var i;return this.config.markerDOM?this.config.markerDOM(this.open):((i=document.createElement("span")).textContent=this.open?this.config.openText:this.config.closedText,i.title=n.state.phrase(this.open?"Fold line":"Unfold line"),i)}}]),r}(en),bo=w.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"}}),Mo=function(){function u(t,n){var i,e,r;function o(t){var n=Ft.newName();return(i=i||Object.create(null))["."+n]=t,n}A(this,u),this.specs=t,e="string"==typeof n.all?n.all:n.all?o(n.all):void 0,r=n.scope,this.scope=r instanceof Jr?function(t){return t.prop(qr)==r.data}:r?function(t){return t==r}:void 0,this.style=mv(t.map(function(t){return{tag:t.tag,class:t.class||o(Object.assign({},t,{tag:null}))}}),{all:e}).style,this.module=i?new Ft(i):null,this.themeType=n.themeType}return D(u,null,[{key:"define",value:function t(n,i){return new u(n,i||{})}}]),u}(),xo=y.define(),So=y.define({combine:function t(n){return n.length?[n[0]]:null}}),Vr=function(){function n(t){A(this,n),this.markCache=Object.create(null),this.tree=R(t.state),this.decorations=this.buildDeco(t,id(t.state))}return D(n,[{key:"update",value:function t(n){var i,e,r,i=R(n.state),e=id(n.state),r=e!=id(n.startState);i.length<n.view.viewport.to&&!r&&i.type==this.tree.type?this.decorations=this.decorations.map(n.changes):(i!=this.tree||n.viewportChanged||r)&&(this.tree=i,this.decorations=this.buildDeco(n.view,e))}},{key:"buildDeco",value:function t(n,i){var e,r,o,u,s,a,f,e=this;if(!i||!this.tree.length)return m.none;r=new Et,o=F(n.visibleRanges);try{for(o.s();!(u=o.n()).done;)a=(s=u.value).from,f=s.to,kv(this.tree,i,function(t,n,i){r.add(t,n,e.markCache[i]||(e.markCache[i]=m.mark({class:i})))},a,f)}catch(t){o.e(t)}finally{o.f()}return r.finish()}}]),n}(),Co=st.high(d.fromClass(Vr,{decorations:function t(n){return n.decorations}})),jo=Mo.define([{tag:a.meta,color:"#404740"},{tag:a.link,textDecoration:"underline"},{tag:a.heading,textDecoration:"underline",fontWeight:"bold"},{tag:a.emphasis,fontStyle:"italic"},{tag:a.strong,fontWeight:"bold"},{tag:a.strikethrough,textDecoration:"line-through"},{tag:a.keyword,color:"#708"},{tag:[a.atom,a.bool,a.url,a.contentSeparator,a.labelName],color:"#219"},{tag:[a.literal,a.inserted],color:"#164"},{tag:[a.string,a.deleted],color:"#a11"},{tag:[a.regexp,a.escape,a.special(a.string)],color:"#e40"},{tag:a.definition(a.variableName),color:"#00f"},{tag:a.local(a.variableName),color:"#30a"},{tag:[a.typeName,a.namespace],color:"#085"},{tag:a.className,color:"#167"},{tag:[a.special(a.variableName),a.macroName],color:"#256"},{tag:a.definition(a.propertyName),color:"#00c"},{tag:a.comment,color:"#940"},{tag:a.invalid,color:"#f00"}]),Ur=w.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Po=1e4,Oo="()[]{}",Eo=y.define({combine:function t(n){return qh(n,{afterCursor:!0,brackets:Oo,maxScanDistance:Po,renderMatch:od})}}),Ao=m.mark({class:"cm-matchingBracket"}),Do=m.mark({class:"cm-nonmatchingBracket"}),Io=[Ro=b.define({create:function t(){return m.none},update:function t(n,i){var e,r,o,u,s,a;if(!i.docChanged&&!i.selection)return n;e=[],r=i.state.facet(Eo),o=F(i.state.selection.ranges);try{for(o.s();!(u=o.n()).done;)(s=u.value).empty&&(a=fd(i.state,s.head,-1,r)||0<s.head&&fd(i.state,s.head-1,1,r)||r.afterCursor&&(fd(i.state,s.head,1,r)||s.head<i.state.doc.length&&fd(i.state,s.head+1,-1,r)))&&(e=e.concat(r.renderMatch(a,i.state)))}catch(t){o.e(t)}finally{o.f()}return m.set(e,!0)},provide:function t(n){return w.decorations.from(n)}}),Ur],To=new M,Lo=function(){function r(t,n,i,e){A(this,r),this.string=t,this.tabSize=n,this.indentUnit=i,this.overrideIndent=e,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}return D(r,[{key:"eol",value:function t(){return this.pos>=this.string.length}},{key:"sol",value:function t(){return 0==this.pos}},{key:"peek",value:function t(){return this.string.charAt(this.pos)||void 0}},{key:"next",value:function t(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}},{key:"eat",value:function t(n){var i,n,i=this.string.charAt(this.pos),n="string"==typeof n?i==n:i&&(n instanceof RegExp?n.test(i):n(i));if(n)return++this.pos,i}},{key:"eatWhile",value:function t(n){for(var i=this.pos;this.eat(n););return this.pos>i}},{key:"eatSpace",value:function t(){for(var n=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>n}},{key:"skipToEnd",value:function t(){this.pos=this.string.length}},{key:"skipTo",value:function t(n){var n=this.string.indexOf(n,this.pos);if(-1<n)return this.pos=n,!0}},{key:"backUp",value:function t(n){this.pos-=n}},{key:"column",value:function t(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ld(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}},{key:"indentation",value:function t(){var n;return null!=(n=this.overrideIndent)?n:ld(this.string,null,this.tabSize)}},{key:"match",value:function t(n,i,e){var r,o,t;return"string"==typeof n?(r=function t(n){return e?n.toLowerCase():n})(o=this.string.substr(this.pos,n.length))==r(n)?(!1!==i&&(this.pos+=n.length),!0):null:(t=this.string.slice(this.pos).match(n))&&0<t.index?null:(t&&!1!==i&&(this.pos+=t[0].length),t)}},{key:"current",value:function t(){return this.string.slice(this.start,this.pos)}}]),r}(),Bo=new WeakMap,Nr=function(t){f(s,t);var u=S(s);function s(t){var i,n,e,r,o;return A(this,s),n=wv(t.languageData),e=vd(t),o=new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"createParse",value:function t(n,i,e){return new _o(r,n,i,e)}}]),i}(Ar)),(i=u.call(this,n,o,[eo.of(function(t,n){return i.getIndent(t,n)})],t.name)).topNode=bd(n),r=eh(i),i.streamParser=e,i.stateAfter=new M({perNode:!0}),i.tokenTable=t.tokenTable?new Go(e.tokenTable):Jo,i}return D(s,[{key:"getIndent",value:function t(n,i){for(var e,r,o,u,e,s,a,f,h,c,l,e,e=R(n.state),r=e.resolve(i);r&&r.type!=this.topNode;)r=r.parent;if(!r)return null;if(o=void 0,(u=n.options.overrideIndentation)&&null!=(o=Bo.get(n.state))&&o<i-1e4&&(o=void 0),1e4<i-(s=(e=yd(this,e,0,r.from,null!=o?o:i))?(a=e.state,e.pos+1):(a=this.streamParser.startState(n.unit),0)))return null;for(;s<i;){if(f=n.state.doc.lineAt(s),h=Math.min(i,f.to),f.length)for(c=u?u(f.from):-1,l=new Lo(f.text,n.state.tabSize,n.unit,c<0?void 0:c);l.pos<h-f.from;)kd(this.streamParser.token,l,a);else this.streamParser.blankLine(a,n.unit);if(h==i)break;s=f.to+1}return e=n.lineAt(i),u&&null==o&&Bo.set(n.state,e.from),this.streamParser.indent(a,/^\s*(.*)/.exec(e.text)[1],n)}},{key:"allowsNesting",get:function t(){return!1}}],[{key:"define",value:function t(n){return new s(n)}}]),s}(Jr),_o=function(){function u(t,n,i,e){var n,t,i,e,r,o;for(A(this,u),this.lang=t,this.input=n,this.fragments=i,this.ranges=e,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=e[e.length-1].to,n=Xr.get(),e=(i=pd(t,i,t=e[0].from,null==n?void 0:n.state)).state,r=i.tree,this.state=e,this.parsedPos=this.chunkStart=t+r.length,o=0;o<r.children.length;o++)this.chunks.push(r.children[o]),this.chunkPos.push(r.positions[o]);n&&this.parsedPos<n.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Pv(n.state)),n.skipUntilInView(this.parsedPos,n.viewport.from),this.parsedPos=n.viewport.from),this.moveRangeIndex()}return D(u,[{key:"advance",value:function t(){var n,i,e,n=Xr.get(),i=null==this.stoppedAt?this.to:Math.min(this.to,this.stoppedAt),e=Math.min(i,this.chunkStart+2048);for(n&&(e=Math.min(e,n.viewport.to));this.parsedPos<e;)this.parseLine(n);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=i?this.finish():n&&this.parsedPos>=n.viewport.to?(n.skipUntilInView(this.parsedPos,i),this.finish()):null}},{key:"stopAt",value:function t(n){this.stoppedAt=n}},{key:"lineAfter",value:function t(n){var i,e,i=this.input.chunk(n);return this.input.lineChunks?"\n"==i&&(i=""):-1<(e=i.indexOf("\n"))&&(i=i.slice(0,e)),n+i.length<=this.to?i:i.slice(0,this.to-n)}},{key:"nextLine",value:function t(){for(var n,i,e,r,o,o,u,n=this.parsedPos,i=this.lineAfter(n),e=n+i.length,r=this.rangeIndex;!(e<=(o=this.ranges[r].to))&&(i=i.slice(0,o-(e-i.length)),++r!=this.ranges.length);)o=this.ranges[r].from,i+=u=this.lineAfter(o),e=o+u.length;return{line:i,end:e}}},{key:"skipGapsTo",value:function t(n,i,e){for(var r,o,u;r=this.ranges[this.rangeIndex].to,o=n+i,!(0<e?o<r:o<=r);)i+=(u=this.ranges[++this.rangeIndex].from)-r;return i}},{key:"moveRangeIndex",value:function t(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}},{key:"emitToken",value:function t(n,i,e,r,o){var u;return 1<this.ranges.length&&(i+=o=this.skipGapsTo(i,o,1),u=this.chunk.length,e+=o=this.skipGapsTo(e,o,-1),r+=this.chunk.length-u),this.chunk.push(n,i,e,r),o}},{key:"parseLine",value:function t(n){var i,e,i,r,o,u,s,i=this.nextLine(),e=i.line,i=i.end,r=0,o=this.lang.streamParser,u=new Lo(e,n?n.state.tabSize:4,n?Pv(n.state):2);if(u.eol())o.blankLine(this.state,u.indentUnit);else for(;!(u.eol()||((s=kd(o.token,u,this.state))&&(r=this.emitToken(this.lang.tokenTable.resolve(s),this.parsedPos+u.start,this.parsedPos+u.pos,4,r)),1e4<u.start)););this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}},{key:"finishChunk",value:function t(){var n=x.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Uo,topID:0,maxBufferLength:2048,reused:this.chunkReused}),n=new x(n.type,n.children,n.positions,n.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]);this.chunks.push(n),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}},{key:"finish",value:function t(){return new x(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}]),u}(),Fo=Object.create(null),No=[kr.none],Uo=new n(No),Ho=[],zo=Object.create(null),Wo=0,Vo=[["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"]];Wo<Vo.length;Wo++)qo=($o=Gf(Vo[Wo],2))[0],$o=$o[1],zo[qo]=wd(Fo,$o);function gd(t,n){-1<Ho.indexOf(t)||(Ho.push(t),console.warn(n))}function wd(t,n){var i,e,r,o,u,n,n,i=null,e=F(n.split("."));try{for(e.s();!(r=e.n()).done;)(u=t[o=r.value]||a[o])?"function"==typeof u?i?i=u(i):gd(o,"Modifier ".concat(o," used at start of tag")):i?gd(o,"Tag ".concat(o," used as modifier")):i=u:gd(o,"Unknown highlighting tag ".concat(o))}catch(t){e.e(t)}finally{e.f()}return i?(n=n.replace(/ /g,"_"),n=kr.define({id:No.length,name:n,props:[yv(zf({},n,i))]}),No.push(n),n.id):0}function bd(t){var n=kr.define({id:No.length,name:"Document",props:[qr.add(function(){return t})]});return No.push(n),n}function Md(t){var t,n,t=Object.keys(t).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),"[".concat(n?"\\w":"").concat(t.replace(/[^\w\s]/g,"\\$&"),"]")}function xd(t){var n,i,e,r,o,u,t,n=Object.create(null),i=Object.create(null),e=F(t);try{for(e.s();!(r=e.n()).done;)for(n[(o=r.value.label)[0]]=!0,u=1;u<o.length;u++)i[o[u]]=!0}catch(t){e.e(t)}finally{e.f()}return t=Md(n)+Md(i)+"*$",[new RegExp("^"+t),new RegExp(t)]}function Sd(t){var i,n,t,e,r,i=t.map(function(t){return"string"==typeof t?{label:t}:t}),n,t=Gf(i.every(function(t){return/^\w+$/.test(t.label)})?[/\w*$/,/\w+$/]:xd(i),2),e=t[0],r=t[1];return function(t){var n=t.matchBefore(r);return n||t.explicit?{from:n?n.from:t.pos,options:i,validFor:e}:null}}function Cd(i,e){return function(t){for(var n=R(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(-1<i.indexOf(n.name))return e(t);if(n.type.isTop)break}return null}}function jd(i,e){return function(t){for(var n=R(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(-1<i.indexOf(n.name))return null;if(n.type.isTop)break}return e(t)}}function Pd(t){return t.selection.main.from}function Od(t,n){var n,i,n,e,i=t.source,n=n&&"^"!=i[0],e="$"!=i[i.length-1];return n||e?new RegExp("".concat(n?"^":"","(?:").concat(i,")").concat(e?"$":""),null!=(n=t.flags)?n:t.ignoreCase?"i":""):t}function Ed(n,i,e,r){var o=n.selection.main,u=e-o.from,s=r-o.from;return Object.assign(Object.assign({},n.changeByRange(function(t){return t!=o&&e!=r&&n.sliceDoc(t.from+u,t.from+s)!=n.sliceDoc(e,r)?{range:t}:{changes:{from:t.from+u,to:r==o.from?t.to:t.from+s,insert:i},range:O.cursor(t.from+u+i.length)}})),{userEvent:"input.complete"})}function Ad(t){var n;return Array.isArray(t)?((n=Yo.get(t))||Yo.set(t,n=Sd(t)),n):t}function Dd(t,n){return t?n?t+" "+n:t:n}function Rd(t,n,i,e,r){var t,o,u,s,a,f,h,c,l,e,l,t=t.textDirection==E.RTL,o=t,u=!1,s="top",h=n.left-r.left,c=r.right-n.right,l=e.right-e.left,e=e.bottom-e.top;return o&&h<Math.min(l,c)?o=!1:!o&&c<Math.min(l,h)&&(o=!0),l<=(o?h:c)?(a=Math.max(r.top,Math.min(i.top,r.bottom-e))-n.top,f=Math.min(400,o?h:c)):(u=!0,f=Math.min(400,(t?n.right:r.right-n.left)-30),a=e<=(l=r.bottom-n.bottom)||l>n.top?i.bottom-n.top:(s="bottom",n.bottom-i.top)),{style:"".concat(s,": ").concat(a,"px; max-width: ").concat(f,"px"),class:"cm-completionInfo-"+(u?t?"left-narrow":"right-narrow":o?"left":"right")}}function Id(r){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"option";return function(t){var n,i,e,e,n,n=t.state.field(ku,!1);return!(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(eu).interactionDelay||(i=1,"page"==o&&(e=N0(t,n.open.tooltip))&&(i=Math.max(2,Math.floor(e.dom.offsetHeight/e.dom.querySelector("li").offsetHeight)-1)),e=n.open.options.length,(n=-1<n.open.selected?n.open.selected+i*(r?1:-1):r?0:e-1)<0?n="page"==o?0:e-1:e<=n&&(n="page"==o?e-1:0),t.dispatch({effects:pu.of(n)}),0))}}function Td(t,n){var i,e,i=n.completion.apply||n.completion.label,e=t.state.field(ku).active.find(function(t){return t.source==n.source});return e instanceof yu&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},Ed(t.state,i,e.from,e.to)),{annotations:Zo.of(n.completion)})):i(t,n.completion,e.from,e.to),!0)}function Ld(t){var n=t.addToOptions.slice();return t.icons&&n.push({render:function t(n){var i,e,e=document.createElement("div");return e.classList.add("cm-completionIcon"),n.type&&(i=e.classList).add.apply(i,Wf(n.type.split(/\s+/g).map(function(t){return"cm-completionIcon-"+t}))),e.setAttribute("aria-hidden","true"),e},position:20}),n.push({render:function t(n,i,e){var r,o,u,s,a,f,h,r=document.createElement("span");for(r.className="cm-completionLabel",o=n.label,u=0,s=1;s<e.length;)a=e[s++],f=e[s++],u<a&&r.appendChild(document.createTextNode(o.slice(u,a))),(h=r.appendChild(document.createElement("span"))).appendChild(document.createTextNode(o.slice(a,f))),h.className="cm-completionMatchedText",u=f;return u<o.length&&r.appendChild(document.createTextNode(o.slice(u))),r},position:50},{render:function t(n){var i;return n.detail?((i=document.createElement("span")).className="cm-completionDetail",i.textContent=n.detail,i):null},position:80}),n.sort(function(t,n){return t.position-n.position}).map(function(t){return t.render})}function Bd(t,n,i){var e,e;return t<=i?{from:0,to:t}:(n=n<0?0:n)<=t>>1?{from:(e=Math.floor(n/i))*i,to:(e+1)*i}:{from:t-((e=Math.floor((t-n)/i))+1)*i,to:t-e*i}}function _d(n){return function(t){return new fu(t,n)}}function Fd(t,n){var i,n,i=t.getBoundingClientRect(),n=n.getBoundingClientRect();n.top<i.top?t.scrollTop-=i.top-n.top:n.bottom>i.bottom&&(t.scrollTop+=n.bottom-i.bottom)}function Nd(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Ud(t,n){var e,r,i,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,B,x,S,C,j,P,O,E,A,D,R,I,T,L,e=[],r=null,i=function t(n){var n,i;e.push(n),(n=n.completion.section)&&(r=r||[],i="string"==typeof n?n:n.name,r.some(function(t){return t.name==i})||r.push("string"==typeof n?{name:i}:n))},o=F(t);try{for(o.s();!(u=o.n()).done;)if((s=u.value).hasResult())if(!1===s.result.filter){a=s.result.getMatch,f=F(s.result.options);try{for(f.s();!(h=f.n()).done;){if(c=h.value,l=[1e9-e.length],a){v=F(a(c));try{for(v.s();!(d=v.n()).done;)y=d.value,l.push(y)}catch(t){v.e(t)}finally{v.f()}}i(new Xo(c,s.source,l,l[0]))}}catch(t){f.e(t)}finally{f.f()}}else{m=new iu(n.sliceDoc(s.from,s.to)),p=void 0,k=F(s.result.options);try{for(k.s();!(g=k.n()).done;)w=g.value,(p=m.match(w.label))&&i(new Xo(w,s.source,p,p[0]+(w.boost||0)))}catch(t){k.e(t)}finally{k.f()}}}catch(t){o.e(t)}finally{o.f()}if(r){b=Object.create(null),M=0,x=F(r.sort(B=function t(n,i){var e,e;return(null!=(e=n.rank)?e:1e9)-(null!=(e=i.rank)?e:1e9)||(n.name<i.name?-1:1)}));try{for(x.s();!(S=x.n()).done;)C=S.value,M-=1e5,b[C.name]=M}catch(t){x.e(t)}finally{x.f()}j=F(e);try{for(j.s();!(P=j.n()).done;)(E=(O=P.value).completion.section)&&(O.score+=b["string"==typeof E?E:E.name])}catch(t){j.e(t)}finally{j.f()}}A=[],D=null,R=n.facet(eu).compareCompletions,I=F(e.sort(function(t,n){return n.score-t.score||R(t.completion,n.completion)}));try{for(I.s();!(T=I.n()).done;)L=T.value,!D||D.label!=L.completion.label||D.detail!=L.completion.detail||null!=D.type&&null!=L.completion.type&&D.type!=L.completion.type||D.apply!=L.completion.apply?A.push(L):Nd(L.completion)>Nd(D)&&(A[A.length-1]=L),D=L.completion}catch(t){I.e(t)}finally{I.f()}return A}function Hd(t,n){var i,e,r,o;if(t==n)return 1;for(e=i=0;;){for(;i<t.length&&!t[i].hasResult;)i++;for(;e<n.length&&!n[e].hasResult;)e++;if(r=i==t.length,o=e==n.length,r||o)return r==o;if(t[i++].result!=n[e++].result)return}}function zd(t,n){var i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return-1<n&&(i["aria-activedescendant"]=t+"-"+n),i}function Wd(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}function Vd(t,n,i,e){var r;if(t)return r=n.sliceDoc(i,e),"function"==typeof t?t(r,i,e,n):Od(t,!0).test(r)}function $d(t,n){return O.create(t.filter(function(t){return t.field==n}).map(function(t){return O.range(t.from,t.to)}))}function qd(t){var u=Mu.parse(t);return function(t,n,i,e){var r,o,r,i,e,o,r=u.instantiate(t.state,i),o=r.text,r=r.ranges,i={changes:{from:i,to:e,insert:k.of(o)},scrollIntoView:!0,annotations:n?Zo.of(n):void 0};r.length&&(i.selection=$d(r,0)),1<r.length&&(e=new Cu(r,0),o=i.effects=[ju.of(e)],void 0===t.state.field(Ou,!1))&&o.push(v.appendConfig.of([Ou,Du,Ru,gu])),t.dispatch(t.state.update(i))}}function Gd(o){return function(t){var n,t,i,e,r,n=t.state,t=t.dispatch,i=n.field(Ou,!1);return!(!i||o<0&&0==i.active||(e=i.active+o,r=0<o&&!i.ranges.some(function(t){return t.field==e+o}),t(n.update({selection:$d(i.ranges,e),effects:ju.of(r?null:new Cu(i.ranges,e))})),0))}}function Jd(t){var n=t.field(Ou,!1);return!(!n||!n.ranges.some(function(t){return t.field==n.active+1}))}function Kd(t){var t=t.field(Ou,!1);return!!(t&&0<t.active)}function Qd(t,n){return Object.assign(Object.assign({},n),{apply:qd(t)})}function Xd(n){var n=n.replace(/[\\[.+*?(){|^$]/g,"\\$&");try{return new RegExp("[\\p{Alphabetic}\\p{Number}_".concat(n,"]+"),"ug")}catch(t){return new RegExp("[w".concat(n,"]"),"g")}}function Zd(t,n){return new RegExp(n(t.source),t.unicode?"u":"")}function Yd(t){return Iu[t]||(Iu[t]=new WeakMap)}function t1(t,n,i,e,r){for(var o,u,s,a,o=t.iterLines(),u=0;!o.next().done;){for(s=o.value,a=void 0,n.lastIndex=0;a=n.exec(s);)if(!e[a[0]]&&u+a.index!=r&&(i.push({type:"text",label:a[0]}),e[a[0]]=!0,2e3<=i.length))return;u+=s.length+1}}function n1(t,n,i,e,r){var o,u,s,a,f,h,c,l,v,d,y,o=1e3<=t.length,u=o&&n.get(t);if(u)return u;if(s=[],a=Object.create(null),t.children){f=0,h=F(t.children);try{for(h.s();!(c=h.n()).done;){if(1e3<=(l=c.value).length){v=F(n1(l,n,i,e-f,r-f));try{for(v.s();!(d=v.n()).done;)a[(y=d.value).label]||(a[y.label]=!0,s.push(y))}catch(t){v.e(t)}finally{v.f()}}else t1(l,i,s,a,r-f);f+=l.length+1}}catch(t){h.e(t)}finally{h.f()}}else t1(t,i,s,a,r);return o&&s.length<2e3&&n.set(t,s),s}function i1(){return[Uu,_u]}function e1(t){for(var n=0;n<Fu.length;n+=2)if(Fu.charCodeAt(n)==t)return Fu.charAt(n+1);return bh(t<128?t:t+1)}function r1(t,n){return t.languageDataAt("closeBrackets",n)[0]||Tu}function o1(t,n){var i,e,r,o,u,s,i=r1(t,t.selection.main.head),e=i.brackets||Tu.brackets,r=F(e);try{for(r.s();!(o=r.n()).done;){if(s=e1(wh(u=o.value,0)),n==u)return s==u?c1(t,u,-1<e.indexOf(u+u+u),i):f1(t,u,s,i.before||Tu.before);if(n==s&&u1(t,t.selection.main.from))return h1(t,u,s)}}catch(t){r.e(t)}finally{r.f()}return null}function u1(t,n){var i=!1;return t.field(_u).between(0,t.doc.length,function(t){t==n&&(i=!0)}),i}function s1(t,n){var t=t.sliceString(n,n+2);return t.slice(0,Mh(wh(t,0)))}function a1(t,n){var t=t.sliceString(n-2,n);return Mh(wh(t,0))==t.length?t:t.slice(1)}function f1(i,e,r,o){var u=null,t=i.changeByRange(function(t){var n;return t.empty?!(n=s1(i.doc,t.head))||/\s/.test(n)||-1<o.indexOf(n)?{changes:{insert:e+r,from:t.head},effects:Lu.of(t.head+e.length),range:O.cursor(t.head+e.length)}:{range:u=t}:{changes:[{insert:e,from:t.from},{insert:r,from:t.to}],effects:Lu.of(t.to+e.length),range:O.range(t.anchor+e.length,t.head+e.length)}});return u?null:i.update(t,{scrollIntoView:!0,userEvent:"input.type"})}function h1(n,t,i){var e=null,r=n.changeByRange(function(t){return t.empty&&s1(n.doc,t.head)==i?{changes:{from:t.head,to:t.head+i.length,insert:i},range:O.cursor(t.head+i.length)}:e={range:t}});return e?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function c1(o,u,s,t){var a,f,t,a=t.stringPrefixes||Tu.stringPrefixes,f=null,t=o.changeByRange(function(t){var n,i,e,r,e;if(!t.empty)return{changes:[{insert:u,from:t.from},{insert:u,from:t.to}],effects:Lu.of(t.to+u.length),range:O.range(t.anchor+u.length,t.head+u.length)};if(n=t.head,(i=s1(o.doc,n))==u){if(l1(o,n))return{changes:{insert:u+u,from:n},effects:Lu.of(n+u.length),range:O.cursor(n+u.length)};if(u1(o,n))return{changes:{from:n,to:n+(e=(r=s&&o.sliceDoc(n,n+3*u.length)==u+u+u)?u+u+u:u).length,insert:e},range:O.cursor(n+e.length)}}else{if(s&&o.sliceDoc(n-2*u.length,n)==u+u&&-1<(e=d1(o,n-2*u.length,a))&&l1(o,e))return{changes:{insert:u+u+u+u,from:n},effects:Lu.of(n+u.length),range:O.cursor(n+u.length)};if(o.charCategorizer(n)(i)!=l.Word&&-1<d1(o,n,a)&&!v1(o,n,u,a))return{changes:{insert:u+u,from:n},effects:Lu.of(n+u.length),range:O.cursor(n+u.length)}}return{range:f=t}});return f?null:o.update(t,{scrollIntoView:!0,userEvent:"input.type"})}function l1(t,n){var t=R(t).resolveInner(n+1);return t.parent&&t.from==n}function v1(t,n,i,e){for(var r,o,u,s,a,f,s,r=R(t).resolveInner(n,-1),o=e.reduce(function(t,n){return Math.max(t,n.length)},0),u=0;u<5;u++){if(!(a=(s=t.sliceDoc(r.from,Math.min(r.to,r.from+i.length+o))).indexOf(i))||-1<a&&-1<e.indexOf(s.slice(0,a))){for(f=r.firstChild;f&&f.from==r.from&&f.to-f.from>i.length+a;){if(t.sliceDoc(f.to-i.length,f.to)==i)return;f=f.firstChild}return 1}if(!(s=r.to==n&&r.parent))break;r=s}}function d1(t,n,i){var e,r,o,u,s,e=t.charCategorizer(n);if(e(t.sliceDoc(n-1,n))!=l.Word)return n;r=F(i);try{for(r.s();!(o=r.n()).done;)if(s=n-(u=o.value).length,t.sliceDoc(s,n)==u&&e(t.sliceDoc(s-1,s))!=l.Word)return s}catch(t){r.e(t)}finally{r.f()}return-1}function y1(){var t;return[ku,eu.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),au,Wu,gu]}function m1(t){var t=t.field(ku,!1);return t&&t.active.some(function(t){return 1==t.state})?"pending":t&&t.active.some(function(t){return 0!=t.state})?"active":null}function p1(t){var t,t,n,t=null==(t=t.field(ku,!1))?void 0:t.open;return!t||t.disabled?[]:((n=Vu.get(t.options))||Vu.set(t.options,n=t.options.map(function(t){return t.completion})),n)}function k1(t){var t,t,t=null==(t=t.field(ku,!1))?void 0:t.open;return t&&!t.disabled&&0<=t.selected?t.options[t.selected].completion:null}function g1(t){var t,t,t=null==(t=t.field(ku,!1))?void 0:t.open;return t&&!t.disabled&&0<=t.selected?t.selected:null}function w1(t){return pu.of(t)}function b1(e,r){return function(t){var n,t,i,n=t.state,t=t.dispatch;return!n.readOnly&&!!(i=e(r,n))&&(t(n.update(i)),!0)}}function M1(t,n){var t=t.languageDataAt("commentTokens",n);return t.length?t[0]:{}}function x1(t,n,i,e){var r,n,o,u,s,a,f,h,c,o,f,u,r=n.open,n=n.close,o=t.sliceDoc(i-Ju,i),u=t.sliceDoc(e,e+Ju),s=/\s*$/.exec(o)[0].length,a=/^\s*/.exec(u)[0].length,f=o.length-s;return o.slice(f-r.length,f)==r&&u.slice(a,a+n.length)==n?{open:{pos:i-s,margin:s&&1},close:{pos:e+a,margin:a&&1}}:(e-i<=2*Ju?h=c=t.sliceDoc(i,e):(h=t.sliceDoc(i,i+Ju),c=t.sliceDoc(e-Ju,e)),o=/^\s*/.exec(h)[0].length,f=/\s*$/.exec(c)[0].length,u=c.length-f-n.length,h.slice(o,o+r.length)==r&&c.slice(u,u+n.length)==n?{open:{pos:i+o+r.length,margin:/\s/.test(h.charAt(o+r.length))?1:0},close:{pos:e-f-n.length,margin:/\s/.test(c.charAt(u-1))?1:0}}:null)}function S1(t){var n,i,e,r,o,u,s,n=[],i=F(t.selection.ranges);try{for(i.s();!(e=i.n()).done;)r=e.value,o=t.doc.lineAt(r.from),u=r.to<=o.to?o:t.doc.lineAt(r.to),0<=(s=n.length-1)&&n[s].to>o.from?n[s].to=u.to:n.push({from:o.from+/^\s*/.exec(o.text)[0].length,to:u.to})}catch(t){i.e(t)}finally{i.f()}return n}function C1(t,i){var n,e,r,o,u,s,a,f,h,s,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:i.selection.ranges,e=n.map(function(t){return M1(i,t.from).block});if(e.every(function(t){return t})){if(r=n.map(function(t,n){return x1(i,e[n],t.from,t.to)}),2!=t&&!r.every(function(t){return t}))return{changes:i.changes(n.map(function(t,n){return r[n]?[]:[{from:t.from,insert:e[n].open+" "},{from:t.to,insert:" "+e[n].close}]}))};if(1!=t&&r.some(function(t){return t})){for(o=[],u=0;u<r.length;u++)(s=r[u])&&(a=e[u],h=s.open,s=s.close,o.push({from:h.pos-a.open.length,to:h.pos+h.margin},{from:s.pos-s.margin,to:s.pos+a.close.length}));return{changes:o}}}return null}function j1(t,n){var L,i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,B,j,P,O,E,A,D,R,I,_,T,L,i=[],e=-1,r=F(2<arguments.length&&void 0!==arguments[2]?arguments[2]:n.selection.ranges);try{for(r.s();!(o=r.n()).done;)if(s=(u=o.value).from,a=u.to,f=i.length,h=1e9,c=M1(n,s).line){for(l=s;l<=a;)(v=n.doc.lineAt(l)).from>e&&(s==a||a>v.from)&&(e=v.from,y=(d=/^\s*/.exec(v.text)[0].length)==v.length,m=v.text.slice(d,d+c.length)==c?d:-1,d<v.text.length&&d<h&&(h=d),i.push({line:v,comment:m,token:c,indent:d,empty:y,single:!1})),l=v.to+1;if(h<1e9)for(p=f;p<i.length;p++)i[p].indent<i[p].line.text.length&&(i[p].indent=h);i.length==f+1&&(i[f].single=!0)}}catch(t){r.e(t)}finally{r.f()}if(2!=t&&i.some(function(t){return t.comment<0&&(!t.empty||t.single)})){k=[],g=F(i);try{for(g.s();!(w=g.n()).done;)M=(b=w.value).line,x=b.token,S=b.indent,C=b.empty,!(B=b.single)&&C||k.push({from:M.from+S,insert:x+" "})}catch(t){g.e(t)}finally{g.f()}return{changes:j=n.changes(k),selection:n.selection.map(j,1)}}if(1!=t&&i.some(function(t){return 0<=t.comment})){P=[],O=F(i);try{for(O.s();!(E=O.n()).done;)D=(A=E.value).line,R=A.comment,I=A.token,0<=R&&(T=(_=D.from+R)+I.length," "==D.text[T-D.from]&&T++,P.push({from:_,to:T}))}catch(t){O.e(t)}finally{O.f()}return{changes:P}}return null}function P1(t){var i=0;return t.iterChangedRanges(function(t,n){return i=n}),i}function O1(){var t;return[Yu,Zu.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),w.domEventHandlers({beforeinput:function t(n,i){var e="historyUndo"==n.inputType?ts:"historyRedo"==n.inputType?ns:null;return!!e&&(n.preventDefault(),e(i))}})]}function E1(e,r){return function(t){var n,t,i,i,n=t.state,t=t.dispatch;return!(!r&&n.readOnly||!(i=n.field(Yu,!1))||!(i=i.pop(e,n,r))||(t(i),0))}}function A1(n){return function(t){var t,t,t=t.field(Yu,!1);return t?(t=0==n?t.done:t.undone).length-(t.length&&!t[0].changes?1:0):0}}function D1(t,n,i,e){var r,t,r,t=t.slice(i+20<n+1?n-i-1:0,n);return t.push(e),t}function R1(t,n){var s=[],a=!1;return t.iterChangedRanges(function(t,n){return s.push(t,n)}),n.iterChangedRanges(function(t,n,i,e){for(var r,o,u,r=0;r<s.length;)o=s[r++],u=s[r++],o<=e&&i<=u&&(a=!0)}),a}function I1(t,i){return t.ranges.length==i.ranges.length&&0===t.ranges.filter(function(t,n){return t.empty!=i.ranges[n].empty}).length}function T1(t,n){return t.length?n.length?t.concat(n):t:n}function L1(t,n){var i,e;return t.length?(e=(i=t[t.length-1]).selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-rs))).length&&e[e.length-1].eq(n)?t:(e.push(n),D1(t,t.length-1,1e9,i.setSelAfter(e))):[is.selection([n])]}function B1(t){var n,i,n=t[t.length-1],i=t.slice();return i[t.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),i}function _1(t,n){var i,e,r,o;if(!t.length)return t;for(i=t.length,e=es;i;){if((r=F1(t[i-1],n,e)).changes&&!r.changes.empty||r.effects.length)return(o=t.slice(0,i))[i-1]=r,o;n=r.mapped,i--,e=r.selectionsAfter}return e.length?[is.selection(e)]:es}function F1(t,n,i){var i,e,r,o,i=T1(t.selectionsAfter.length?t.selectionsAfter.map(function(t){return t.map(n)}):es,i);return t.changes?(e=t.changes.map(n),r=n.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r,new is(e,v.mapEffects(t.effects,n),o,t.startSelection.map(r),i)):is.selection(i)}function N1(t,n){return O.create(t.ranges.map(n),t.mainIndex)}function U1(t,n){return t.update({selection:n,scrollIntoView:!0,userEvent:"select"})}function H1(t,n){var i,t,n,i=t.state,t=t.dispatch,n=N1(i.selection,n);return!n.eq(i.selection)&&(t(U1(i,n)),!0)}function z1(t,n){return O.cursor(n?t.to:t.from)}function W1(n,i){return H1(n,function(t){return t.empty?n.moveByChar(t,i):z1(t,i)})}function V1(t){return t.textDirectionAt(t.state.selection.main.head)==E.LTR}function $1(n,i){return H1(n,function(t){return t.empty?n.moveByGroup(t,i):z1(t,i)})}function q1(a,i,f){var h=a.state.charCategorizer(i.from);return a.moveByChar(i,f,function(t){var e,r,o,u,s,n,e=l.Space,r=i.from,o=!1,u=!1,s=!1,n=function t(n){if(o)return!1;r+=f?n.length:-n.length;var i=h(n),i;if(i==l.Word&&n.charCodeAt(0)<128&&/[\W_]/.test(n)&&(i=-1),(e=e==l.Space?i:e)!=i)return!1;if(e==l.Word)if(n.toLowerCase()==n){if(!f&&u)return!1;s=!0}else if(s){if(f)return!1;o=!0}else{if(u&&f&&h(i=a.state.sliceDoc(r,r+1))==l.Word&&i.toLowerCase()==i)return!1;u=!0}return!0};return n(t),n})}function G1(n,i){return H1(n,function(t){return t.empty?q1(n,t,i):z1(t,i)})}function J1(t,n,i){var i;return n.type.prop(i)||(i=n.to-n.from)&&(2<i||/[^\s,.;:]/.test(t.sliceDoc(n.from,n.to)))||n.firstChild}function K1(t,n,i){for(var e,r,o,u,s,n,n,e=R(t).resolveInner(n.head),r=i?M.closedBy:M.openedBy,o=n.head;u=i?e.childAfter(o):e.childBefore(o);)J1(t,u,r)?e=u:o=i?u.to:u.from;return n=(s=e.type.prop(r))&&(n=i?fd(t,e.from,1):fd(t,e.to,-1))&&n.matched?i?n.end.to:n.end.from:i?e.to:e.from,O.cursor(n,i?-1:1)}function Q1(i,e){return H1(i,function(t){var n;return t.empty?(n=i.moveVertically(t,e)).head!=t.head?n:i.moveToLineBoundary(t,e):z1(t,e)})}function X1(t){var n,i,e,r,o,u,s,a,n=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,i=0,e=0;if(n){o=F(t.state.facet(w.scrollMargins));try{for(o.s();!(u=o.n()).done;)null!=(a=(s=u.value)(t))&&a.top&&(i=Math.max(null==a?void 0:a.top,i)),null!=a&&a.bottom&&(e=Math.max(null==a?void 0:a.bottom,e))}catch(t){o.e(t)}finally{o.f()}r=t.scrollDOM.clientHeight-i-e}else r=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:e,selfScroll:n,height:Math.max(t.defaultLineHeight,r-5)}}function Z1(n,i){var e,t,r,o,u,s,a,s,e=X1(n),t=n.state,r=N1(t.selection,function(t){return t.empty?n.moveVertically(t,i,e.height):z1(t,i)});return!r.eq(t.selection)&&(e.selfScroll&&(u=n.coordsAtPos(t.selection.main.head),a=(s=n.scrollDOM.getBoundingClientRect()).top+e.marginTop,s=s.bottom-e.marginBottom,u)&&u.top>a&&u.bottom<s&&(o=w.scrollIntoView(r.main.head,{y:"start",yMargin:u.top-a})),n.dispatch(U1(t,r),{effects:o}),!0)}function Y1(t,n,i){var e,r,i,e=t.lineBlockAt(n.head),r=t.moveToLineBoundary(n,i);return r.head==n.head&&r.head!=(i?e.to:e.from)&&(r=t.moveToLineBoundary(n,i,!1)),r=!i&&r.head==e.from&&e.length&&(i=/^\s*/.exec(t.state.sliceDoc(e.from,Math.min(e.from+100,e.to)))[0].length)&&n.head!=e.from+i?O.cursor(e.from+i):r}function ty(i,t,e){var r=!1,n=N1(i.selection,function(t){var n,n,n=fd(i,t.head,-1)||fd(i,t.head,1)||0<t.head&&fd(i,t.head-1,1)||t.head<i.doc.length&&fd(i,t.head+1,-1);return n&&n.end?(r=!0,n=n.start.from==t.head?n.end.to:n.end.from,e?O.range(t.anchor,n):O.cursor(n)):t});return!!r&&(t(U1(i,n)),!0)}function ny(t,i){var n=N1(t.state.selection,function(t){var n=i(t);return O.range(t.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(t.state.selection)&&(t.dispatch(U1(t.state,n)),!0)}function iy(n,i){return ny(n,function(t){return n.moveByChar(t,i)})}function ey(n,i){return ny(n,function(t){return n.moveByGroup(t,i)})}function ry(n,i){return ny(n,function(t){return q1(n,t,i)})}function oy(n,i){return ny(n,function(t){return n.moveVertically(t,i)})}function uy(n,i){return ny(n,function(t){return n.moveVertically(t,i,X1(n).height)})}function sy(r,o){var u,t,n;return!r.state.readOnly&&(u="delete.selection",!(n=(t=r.state).changeByRange(function(t){var n,i,e,n=t.from,i=t.to;return i=n==i?((e=o(n))<n?e=ay(r,e,!(u="delete.backward")):n<e&&(u="delete.forward",e=ay(r,e,!0)),n=Math.min(n,e),Math.max(i,e)):(n=ay(r,n,!1),ay(r,i,!0)),n==i?{range:t}:{changes:{from:n,to:i},range:O.cursor(n)}})).changes.empty)&&(r.dispatch(t.update(n,{scrollIntoView:!0,userEvent:u,effects:"delete.selection"==u?w.announce.of(t.phrase("Selection deleted")):void 0})),!0)}function ay(n,i,e){var r,t,o;if(n instanceof w){r=F(n.state.facet(w.atomicRanges).map(function(t){return t(n)}));try{for(r.s();!(t=r.n()).done;)(o=t.value).between(i,i,function(t,n){t<i&&i<n&&(i=e?n:t)})}catch(t){r.e(t)}finally{r.f()}}return i}function fy(t){var n,i,e,r,o,u,s,a,n=[],i=-1,e=F(t.selection.ranges);try{for(e.s();!(r=e.n()).done;)o=r.value,u=t.doc.lineAt(o.from),s=t.doc.lineAt(o.to),o.empty||o.to!=s.from||(s=t.doc.lineAt(o.to-1)),i>=u.number?((a=n[n.length-1]).to=s.to,a.ranges.push(o)):n.push({from:u.from,to:s.to,ranges:[o]}),i=s.number+1}catch(t){e.e(t)}finally{e.f()}return n}function hy(t,n,i){var e,r,o,u,s,a,f,h,c,l,v,d,y;if(t.readOnly)return!1;e=[],r=[],o=F(fy(t));try{for(o.s();!(u=o.n()).done;)if(s=u.value,i?s.to!=t.doc.length:0!=s.from)if(f=(a=t.doc.lineAt(i?s.to+1:s.from-1)).length+1,i){e.push({from:s.to,to:a.to},{from:s.from,insert:a.text+t.lineBreak}),h=F(s.ranges);try{for(h.s();!(c=h.n()).done;)l=c.value,r.push(O.range(Math.min(t.doc.length,l.anchor+f),Math.min(t.doc.length,l.head+f)))}catch(t){h.e(t)}finally{h.f()}}else{e.push({from:a.from,to:s.from},{from:s.to,insert:t.lineBreak+a.text}),v=F(s.ranges);try{for(v.s();!(d=v.n()).done;)y=d.value,r.push(O.range(y.anchor-f,y.head-f))}catch(t){v.e(t)}finally{v.f()}}}catch(t){o.e(t)}finally{o.f()}return!!e.length&&(n(t.update({changes:e,scrollIntoView:!0,selection:O.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function cy(t,n,i){var e,r,o,u;if(t.readOnly)return!1;e=[],r=F(fy(t));try{for(r.s();!(o=r.n()).done;)u=o.value,e.push(i?{from:u.from,insert:t.doc.slice(u.from,u.to)+t.lineBreak}:{from:u.to,insert:t.lineBreak+t.doc.slice(u.from,u.to)})}catch(t){r.e(t)}finally{r.f()}return n(t.update({changes:e,scrollIntoView:!0,userEvent:"input.copyline"})),!0}function ly(t,n){var i,e,i,n;return/\(\)|\[\]|\{\}/.test(t.sliceDoc(n-1,n+1))?{from:n,to:n}:(e=(i=R(t).resolveInner(n)).childBefore(n),i=i.childAfter(n),e&&i&&e.to<=n&&i.from>=n&&(n=e.type.prop(M.closedBy))&&-1<n.indexOf(i.name)&&t.doc.lineAt(e.to).from==t.doc.lineAt(i.from).from?{from:e.to,to:i.from}:null)}function vy(s){return function(t){var u,t,n,u=t.state,t=t.dispatch;return!u.readOnly&&(n=u.changeByRange(function(t){var n,i,e,t,r,o,o,n=t.from,i=t.to,e=u.doc.lineAt(n),t=!s&&n==i&&ly(u,n);for(s&&(n=i=(i<=e.to?e:u.doc.lineAt(i)).to),null==(o=Ev(r=new oo(u,{simulateBreak:n,simulateDoubleBreak:!!t}),n))&&(o=/^\s*/.exec(u.doc.lineAt(n).text)[0].length);i<e.to&&/\s/.test(e.text[i-e.from]);)i++;return t?(n=t.from,i=t.to):n>e.from&&n<e.from+100&&!/\S/.test(e.text.slice(0,n))&&(n=e.from),o=["",Ov(u,o)],t&&o.push(Ov(u,r.lineIndent(e.from,-1))),{changes:{from:n,to:i,insert:k.of(o)},range:O.cursor(n+1+o[1].length)}}),t(u.update(n,{scrollIntoView:!0,userEvent:"input"})),!0)}}function dy(o,u){var s=-1;return o.changeByRange(function(t){for(var n,i,e,r,n=[],i=t.from;i<=t.to;)(e=o.doc.lineAt(i)).number>s&&(t.empty||t.to>e.from)&&(u(e,n,t),s=e.number),i=e.to+1;return r=o.changes(n),{changes:n,range:O.range(r.mapPos(t.anchor,1),r.mapPos(t.head,1))}})}function I(t,n){var i,e,r,o,u,i=t;if("string"==typeof i&&(i=document.createElement(i)),e=1,(r=n)&&"object"==uh(r)&&null==r.nodeType&&!Array.isArray(r)){for(o in r)Object.prototype.hasOwnProperty.call(r,o)&&("string"==typeof(u=r[o])?i.setAttribute(o,u):null!=u&&(i[o]=u));e++}for(;e<arguments.length;e++)yy(i,arguments[e]);return i}function yy(t,n){if("string"==typeof n)t.appendChild(document.createTextNode(n));else if(null!=n)if(null!=n.nodeType)t.appendChild(n);else{if(!Array.isArray(n))throw new RangeError("Unsupported child node: "+n);for(var i=0;i<n.length;i++)yy(t,n[i])}}function my(t,n,i){var e,r,o,e=1<arguments.length&&void 0!==n?n:null,r,o=null;return t.between(2<arguments.length&&void 0!==i?i:0,1e9,function(t,n,i){var i=i.spec;if(!e||i.diagnostic==e)return o=new Aa(t,n,i.diagnostic),!1}),o}function py(t,n){return!(!t.effects.some(function(t){return t.is(Ra)})&&!t.changes.touchesRange(n.pos))}function ky(t,n){return t.field(La,!1)?n:n.concat(v.appendConfig.of(Qa))}function gy(t,n){return{effects:ky(t,[Ra.of(n)])}}function wy(t){var t=t.field(La,!1);return t?t.diagnostics.size:0}function by(n,e,r){var t,i,o,u,s,i,t,i=n.state.field(La).diagnostics,o=[],u=2e8,s=0;return i.between(e-(r<0?1:0),e+(0<r?1:0),function(t,n,i){var i=i.spec;t<=e&&e<=n&&(t==n||(t<e||0<r)&&(e<n||r<0))&&(o.push(i.diagnostic),u=Math.min(t,u),s=Math.max(n,s))}),i=n.state.facet(Ua).tooltipFilter,(o=i?i(o):o).length?{pos:u,end:s,above:n.state.doc.lineAt(u).to<s,create:function t(){return{dom:My(n,o)}}}:null}function My(n,t){return I("ul",{class:"cm-tooltip-lint"},t.map(function(t){return jy(n,t,!1)}))}function xy(t){var n;return[Ua.of({source:t,config:1<arguments.length&&void 0!==arguments[1]?arguments[1]:{}}),Na,Qa]}function Sy(t){var t=t.plugin(Na);t&&t.force()}function Cy(t){var i,n,e,r,o,u,i=[];if(t){n=F(t);try{t:for(n.s();!(e=n.n()).done;){for(r=e.value.name,o=function t(){var n=r[u];if(/[a-zA-Z]/.test(n)&&!i.some(function(t){return t.toLowerCase()==n.toLowerCase()}))return i.push(n),1},u=0;u<r.length;u++)if(o())continue t;i.push("")}}catch(t){n.e(t)}finally{n.f()}}return i}function jy(s,a,t){var t,f,f=t?Cy(a.actions):[];return I("li",{class:"cm-diagnostic cm-diagnostic-"+a.severity},I("span",{class:"cm-diagnosticText"},a.renderMessage?a.renderMessage():a.message),null==(t=a.actions)?void 0:t.map(function(i,t){var e,n,r,o,u,e=!1,n=function t(n){var n;n.preventDefault(),!e&&(e=!0,n=my(s.state.field(La).diagnostics,a))&&i.apply(s,n.from,n.to)},r=i.name,o=f[t]?r.indexOf(f[t]):-1,u=o<0?r:[r.slice(0,o),I("u",r.slice(o,o+1)),r.slice(o+1)];return I("button",{type:"button",class:"cm-diagnosticAction",onclick:n,onmousedown:n,"aria-label":" Action: ".concat(r).concat(o<0?"":' (access key "'.concat(f[t],')"'),".")},u)}),a.source&&I("div",{class:"cm-diagnosticSource"},a.source))}function Py(t,n){var i;return'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" '.concat(1<arguments.length&&void 0!==n?n:'viewBox="0 0 40 40"',">").concat(encodeURIComponent(t),"</svg>')")}function Oy(t){return Py('<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"')}function Ey(r,o){var t;window.addEventListener("mousemove",function t(n){var i,e,i=o.getBoundingClientRect();if(!(n.clientX>i.left-10&&n.clientX<i.right+10&&n.clientY>i.top-10&&n.clientY<i.bottom+10)){for(e=n.target;e;e=e.parentNode)if(1==e.nodeType&&e.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",t),r.state.field(Ja)&&r.dispatch({effects:Ga.of(null)})}})}function Ay(i,e,r){var t,n,o;function u(){var t,n,t=i.elementAtHeight(e.getBoundingClientRect().top+5-i.documentTop),n;i.coordsAtPos(t.from)&&i.dispatch({effects:Ga.of({pos:t.from,above:!1,create:function t(){return{dom:My(i,r),getCoords:function t(){return e.getBoundingClientRect()}}}})}),e.onmouseout=e.onmousemove=null,Ey(i,e)}t=i.state.facet(Xa),n=t.hoverTime,o=setTimeout(u,n),e.onmouseout=function(){clearTimeout(o),e.onmouseout=e.onmousemove=null},e.onmousemove=function(){clearTimeout(o),o=setTimeout(u,n)}}function Dy(t,n){var i,e,r,o,u,s,a,i=Object.create(null),e=F(n);try{for(e.s();!(r=e.n()).done;)o=r.value,(i[(u=t.lineAt(o.from)).from]||(i[u.from]=[])).push(o)}catch(t){e.e(t)}finally{e.f()}for(a in s=[],i)s.push(new Va(i[a]).range(+a));return j.of(s,!0)}function Ry(){var t;return[Xa.of(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),qa,$a,Ka,Ja]}function Iy(t,n){var t,i,t=t.field(La,!1);if(t&&t.diagnostics.size)for(i=j.iter([t.diagnostics]);i.value;i.next())n(i.value.spec.diagnostic,i.from,i.to)}function Ty(t){try{return new RegExp(t,ef),!0}catch(t){return!1}}function Ly(t,n){if(!(n>=t.length))for(var i=t.lineAt(n),e;n<i.to&&56320<=(e=i.text.charCodeAt(n-i.from))&&e<57344;)n++;return n}function By(s){var a,t;function i(){var t,n,i,t,e,r,o,t,o,u,t,t,t=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.value);t&&(i=(n=s.state).doc.lineAt(n.selection.main.head),e=(t=Gf(t,5))[1],r=t[2],o=t[3],t=t[4],o=o?+o.slice(1):0,u=r?+r:i.number,r&&t?(t=u/100,e&&(t=t*("-"==e?-1:1)+i.number/n.doc.lines),u=Math.round(n.doc.lines*t)):r&&e&&(u=u*("-"==e?-1:1)+i.number),t=n.doc.line(Math.max(1,Math.min(n.doc.lines,u))),s.dispatch({effects:af.of(!1),selection:O.cursor(t.from+Math.max(0,Math.min(o,t.length))),scrollIntoView:!0}),s.focus())}return a=I("input",{class:"cm-textfield",name:"line"}),{dom:t=I("form",{class:"cm-gotoLine",onkeydown:function t(n){27==n.keyCode?(n.preventDefault(),s.dispatch({effects:af.of(!1)}),s.focus()):13==n.keyCode&&(n.preventDefault(),i())},onsubmit:function t(n){n.preventDefault(),i()}},I("label",s.state.phrase("Go to line"),": ",a)," ",I("button",{class:"cm-button",type:"submit"},s.state.phrase("go")))}}function _y(t){var n=[mf,yf];return t&&n.push(lf.of(t)),n}function Fy(t,n,i,e){return!(0!=i&&t(n.sliceDoc(i-1,i))==l.Word||e!=n.doc.length&&t(n.sliceDoc(e,e+1))==l.Word)}function Ny(t,n,i,e){return t(n.sliceDoc(i,i+1))==l.Word&&t(n.sliceDoc(e-1,e))==l.Word}function Uy(r,o){for(var t,n,u,t,s,i,e,a,f,t=r.selection,n=t.main,u=t.ranges,t=r.wordAt(n.head),s=t&&t.from==n.from&&t.to==n.to,i=function t(n,i){if(i.next(),!i.done){if(n&&u.some(function(t){return t.from==i.value.from}))return a=n,f=i,0;if(s){var e=r.wordAt(i.value.from);if(!e||e.from!=i.value.from||e.to!=i.value.to)return a=n,f=i,0}return{v:i.value}}if(n)return{v:null};i=new tf(r.doc,o,0,Math.max(0,u[u.length-1].from-1)),a=n=!0,f=i},a=!1,f=new tf(r.doc,o,u[u.length-1].to);;)if(0!==(e=i(a,f))&&e)return e.v}function Hy(t){return t?[kf.of(t),Nf]:Nf}function zy(t,n,i,e){return new tf(n.doc,t.unquoted,i,e,t.caseSensitive?void 0:function(t){return t.toLowerCase()},t.wholeWord?Wy(n.doc,n.charCategorizer(n.selection.main.head)):void 0)}function Wy(r,o){return function(t,n,i,e){return(t<e||e+i.length<n)&&(e=Math.max(0,t-2),i=r.sliceString(e,Math.min(r.length,n+2))),!(o($y(i,t-e))==l.Word&&o(qy(i,t-e))==l.Word||o(qy(i,n-e))==l.Word&&o($y(i,n-e))==l.Word)}}function Vy(t,n,i,e){return new rf(n.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?Gy(n.charCategorizer(n.selection.main.head)):void 0},i,e)}function $y(t,n){return t.slice(yh(t,n,!1),n)}function qy(t,n){return t.slice(n,yh(t,n))}function Gy(e){return function(t,n,i){return!i[0].length||(e($y(i.input,i.index))!=l.Word||e(qy(i.input,i.index))!=l.Word)&&(e(qy(i.input,i.index+i[0].length))!=l.Word||e($y(i.input,i.index+i[0].length))!=l.Word)}}function Jy(t){var n=t.field(Sf,!1);return n?n.query.spec:Zy(t)}function Ky(t){var t;return null!=(null==(t=t.field(Sf,!1))?void 0:t.panel)}function Qy(i){return function(t){var n=t.state.field(Sf,!1);return n&&n.query.spec.valid?i(t,n):If(t)}}function Xy(t){return t.state.facet(kf).createPanel(t)}function Zy(t,n){var i,i,e,i,e,e,t,e=t.selection.main,e=e.empty||e.to>e.from+100?"":t.sliceDoc(e.from,e.to);return n&&!e?n:(t=t.facet(kf),new gf({search:(null!=(i=null==n?void 0:n.literal)?i:t.literal)?e:e.replace(/\n/g,"\\n"),caseSensitive:null!=(i=null==n?void 0:n.caseSensitive)?i:t.caseSensitive,literal:null!=(e=null==n?void 0:n.literal)?e:t.literal,wholeWord:null!=(i=null==n?void 0:n.wholeWord)?i:t.wholeWord}))}function Yy(t){var t=W0(t,Xy);return t&&t.dom.querySelector("[main-field]")}function tm(t){var n=Yy(t);n&&n==t.root.activeElement&&n.select()}function nm(t,n){return t.state.phrase(n)}function im(t,n){var i,n,e,r,i,n,o,u,s,i=n.from,n=n.to,e=t.state.doc.lineAt(i),r=t.state.doc.lineAt(n).to,i=Math.max(e.from,i-_f),n=Math.min(r,n+_f),o=t.state.sliceDoc(i,n);if(i!=e.from)for(u=0;u<_f;u++)if(!Ff.test(o[u+1])&&Ff.test(o[u])){o=o.slice(u);break}if(n!=r)for(s=o.length-1;s>o.length-_f;s--)if(!Ff.test(o[s-1])&&Ff.test(o[s])){o=o.slice(0,s);break}return w.announce.of("".concat(t.state.phrase("current match"),". ").concat(o," ").concat(t.state.phrase("on line")," ").concat(e.number,"."))}Jo=new(Go=function(){function n(t){A(this,n),this.extra=t,this.table=Object.assign(Object.create(null),zo)}return D(n,[{key:"resolve",value:function t(n){return n?this.table[n]||(this.table[n]=wd(this.extra,n)):0}}]),n}())(Fo),Ko=L.Language=Object.freeze({__proto__:null,DocInput:Kr,HighlightStyle:Mo,IndentContext:oo,LRLanguage:t,Language:Jr,LanguageDescription:e,LanguageSupport:Zt,ParseContext:Xr,StreamLanguage:Nr,StringStream:Lo,TreeIndentContext:so,bracketMatching:ud,bracketMatchingHandle:To,codeFolding:td,continuedIndent:Uv,defaultHighlightStyle:jo,defineLanguageFacet:wv,delimitedIndent:Fv,ensureSyntaxTree:Mv,flatIndent:nn,foldAll:zr,foldCode:u,foldEffect:co,foldGutter:nd,foldInside:zv,foldKeymap:yo,foldNodeProp:ho,foldService:fo,foldState:vo,foldable:$v,foldedRanges:Jv,forceParsing:Sv,getIndentUnit:Pv,getIndentation:Ev,highlightingFor:rd,indentNodeProp:uo,indentOnInput:Hv,indentRange:Av,indentService:eo,indentString:Ov,indentUnit:ro,language:io,languageDataProp:qr,matchBrackets:fd,sublanguageProp:Gr,syntaxHighlighting:ed,syntaxParserRunning:Cv,syntaxTree:R,syntaxTreeAvailable:xv,toggleFold:o,unfoldAll:Wr,unfoldCode:Hr,unfoldEffect:lo}),Qo=function(){function e(t,n,i){A(this,e),this.state=t,this.pos=n,this.explicit=i,this.abortListeners=[]}return D(e,[{key:"tokenBefore",value:function t(n){for(var i=R(this.state).resolveInner(this.pos,-1);i&&n.indexOf(i.name)<0;)i=i.parent;return i?{from:i.from,to:this.pos,text:this.state.sliceDoc(i.from,this.pos),type:i.type}:null}},{key:"matchBefore",value:function t(n){var i,e,i,n,i=this.state.doc.lineAt(this.pos),e=Math.max(i.from,this.pos-250),i=i.text.slice(e-i.from,this.pos-i.from),n=i.search(Od(n,!1));return n<0?null:{from:e+n,to:this.pos,text:i.slice(n)}}},{key:"aborted",get:function t(){return null==this.abortListeners}},{key:"addEventListener",value:function t(n,i){"abort"==n&&this.abortListeners&&this.abortListeners.push(i)}}]),e}(),Xo=D(function t(n,i,e,r){A(this,t),this.completion=n,this.source=i,this.match=e,this.score=r}),Zo=gt.define(),Yo=new WeakMap,tu=v.define(),nu=v.define(),iu=function(){function o(t){var n,i,e,i,r;for(A(this,o),this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],n=0;n<t.length;)e=Mh(i=wh(t,n)),this.chars.push(i),r=(i=t.slice(n,n+e)).toUpperCase(),this.folded.push(wh(r==i?i.toLowerCase():r,0)),n+=e;this.astral=t.length!=this.chars.length}return D(o,[{key:"match",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,j,P,O,O;if(0==this.pattern.length)return[-100];if(n.length<this.pattern.length)return null;if(i=this.chars,e=this.folded,r=this.any,o=this.precise,u=this.byWord,1==i.length){if(f=(a=Mh(s=wh(n,0)))==n.length?0:-100,s!=i[0]){if(s!=e[0])return null;f+=-200}return[f,0,a]}if(0==(h=n.indexOf(this.pattern)))return[n.length==this.pattern.length?0:-100,0,this.pattern.length];if(c=i.length,h<(l=0)){for(v=0,d=Math.min(n.length,200);v<d&&l<c;)(y=wh(n,v))!=i[l]&&y!=e[l]||(r[l++]=v),v+=Mh(y);if(l<c)return null}for(k=!1,g=p=m=0,b=w=-1,M=/[a-z]/.test(n),x=!0,S=0,C=Math.min(n.length,200),j=0;S<C&&p<c;)P=wh(n,S),h<0&&(m<c&&P==i[m]&&(o[m++]=S),g<c)&&(P==i[g]||P==e[g]?(0==g&&(w=S),b=S+1,g++):g=0),O=void 0,O=P<255?48<=P&&P<=57||97<=P&&P<=122?2:65<=P&&P<=90?1:0:(O=bh(P))!=O.toLowerCase()?1:O!=O.toUpperCase()?2:0,(!S||1==O&&M||0==j&&0!=O)&&(i[p]==P||e[p]==P&&(k=!0)?u[p++]=S:u.length&&(x=!1)),j=O,S+=Mh(P);return p==c&&0==u[0]&&x?this.result((k?-200:0)-100,u,n):g==c&&0==w?[-200-n.length+(b==n.length?0:-100),0,b]:-1<h?[-700-n.length,h,h+this.pattern.length]:g==c?[-900-n.length,w,b]:p==c?this.result((k?-200:0)-100-700+(x?0:-1100),u,n):2==i.length?null:this.result((r[0]?-700:0)-200-1100,r,n)}},{key:"result",value:function t(n,i,e){var t,r,o,u,s,a;t=[n-e.length],r=1,o=F(i);try{for(o.s();!(u=o.n()).done;)a=(s=u.value)+(this.astral?Mh(wh(e,s)):1),1<r&&t[r-1]==s?t[r-1]=a:(t[r++]=s,t[r++]=a)}catch(t){o.e(t)}finally{o.f()}return t}}]),o}(),eu=y.define({combine:function t(n){return qh(n,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:function t(){return""},optionClass:function t(){return""},aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Rd,compareCompletions:function t(n,i){return n.label.localeCompare(i.label)},interactionDelay:75},{defaultKeymap:function t(n,i){return n&&i},closeOnBlur:function t(n,i){return n&&i},icons:function t(n,i){return n&&i},tooltipClass:function t(n,i){return function(t){return Dd(n(t),i(t))}},optionClass:function t(n,i){return function(t){return Dd(n(t),i(t))}},addToOptions:function t(n,i){return n.concat(i)}})}}),r=function t(n){var i=n.state.field(ku,!1);return!(n.state.readOnly||!i||!i.open||i.open.selected<0||Date.now()-i.open.timestamp<n.state.facet(eu).interactionDelay)&&(!!i.open.disabled||Td(n,i.open.options[i.open.selected]))},$r=function t(n){var i;return!!n.state.field(ku,!1)&&(n.dispatch({effects:tu.of(!0)}),!0)},Yt=function t(n){var i=n.state.field(ku,!1);return!(!i||!i.active.some(function(t){return 0!=t.state})||(n.dispatch({effects:nu.of(null)}),0))},ru=D(function t(n,i){A(this,t),this.active=n,this.context=i,this.time=Date.now(),this.updates=[],this.done=void 0}),uu=ou=50,su=1e3,au=d.fromClass(function(){function r(t){var n,i,e;A(this,r),this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0,n=F(t.state.field(ku).active);try{for(n.s();!(i=n.n()).done;)1==(e=i.value).state&&this.startQuery(e)}catch(t){n.e(t)}finally{n.f()}}return D(r,[{key:"update",value:function t(n){var i,e,r,o,u,s,a,f,u,h,c,l,i=this,e=n.state.field(ku);if(n.selectionSet||n.docChanged||n.startState.field(ku)!=e){for(r=n.transactions.some(function(t){return(t.selection||t.docChanged)&&!Wd(t)}),o=0;o<this.running.length;o++)if(u=this.running[o],r||50<u.updates.length+n.transactions.length&&Date.now()-u.time>su){s=F(u.context.abortListeners);try{for(s.s();!(a=s.n()).done;){f=a.value;try{f()}catch(t){Wc(this.view.state,t)}}}catch(t){s.e(t)}finally{s.f()}u.context.abortListeners=null,this.running.splice(o--,1)}else(u=u.updates).push.apply(u,Wf(n.transactions));if(-1<this.debounceUpdate&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(function(n){return 1==n.state&&!i.running.some(function(t){return t.active.source==n.source})})?setTimeout(function(){return i.startUpdate()},50):-1,0!=this.composing){h=F(n.transactions);try{for(h.s();!(c=h.n()).done;)"input"==Wd(l=c.value)?this.composing=2:2==this.composing&&l.selection&&(this.composing=3)}catch(t){h.e(t)}finally{h.f()}}}}},{key:"startUpdate",value:function t(){var i,n,e,r,o,u,i=this;this.debounceUpdate=-1,r=F((e=(n=this.view.state).field(ku)).active);try{for(u=function t(){var n=o.value;1!=n.state||i.running.some(function(t){return t.active.source==n.source})||i.startQuery(n)},r.s();!(o=r.n()).done;)u()}catch(t){r.e(t)}finally{r.f()}}},{key:"startQuery",value:function t(n){var i,e,r,e,o,i=this,e=this.view.state,r=Pd(e),e=new Qo(e,r,n.explicitPos==r),o=new ru(n,e);this.running.push(o),Promise.resolve(n.source(e)).then(function(t){o.context.aborted||(o.done=t||null,i.scheduleAccept())},function(t){i.view.dispatch({effects:nu.of(null)}),Wc(i.view.state,t)})}},{key:"scheduleAccept",value:function t(){var n=this;this.running.every(function(t){return void 0!==t.done})?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(function(){return n.accept()},50))}},{key:"accept",value:function t(){var l,v,d,y,n,i,m,l=this;for(-1<this.debounceAccept&&clearTimeout(this.debounceAccept),this.debounceAccept=-1,d=[],y=this.view.state.facet(eu),n=function t(n){var i,e,r,o,u,s,a,f,h,c,i=l.running[n];if(void 0===i.done)return m=n,0;if(l.running.splice(n--,1),i.done){e=new yu(i.active.source,i.active.explicitPos,i.done,i.done.from,null!=(v=i.done.to)?v:Pd(i.updates.length?i.updates[0].startState:l.view.state)),r=F(i.updates);try{for(r.s();!(o=r.n()).done;)u=o.value,e=e.update(u,y)}catch(t){r.e(t)}finally{r.f()}if(e.hasResult())return d.push(e),m=n,0}if((s=l.view.state.field(ku).active.find(function(t){return t.source==i.active.source}))&&1==s.state)if(null==i.done){a=new du(i.active.source,0),f=F(i.updates);try{for(f.s();!(h=f.n()).done;)c=h.value,a=a.update(c,y)}catch(t){f.e(t)}finally{f.f()}1!=a.state&&d.push(a)}else l.startQuery(s);m=n},m=0;m<this.running.length;m++)i=n(m);d.length&&this.view.dispatch({effects:mu.of(d)})}}]),r}(),{eventHandlers:{blur:function t(n){var i,i,i=this.view.state.field(ku,!1);i&&i.tooltip&&this.view.state.facet(eu).closeOnBlur&&((i=i.open&&N0(this.view,i.open.tooltip))&&i.dom.contains(n.relatedTarget)||this.view.dispatch({effects:nu.of(null)}))},compositionstart:function t(){this.composing=1},compositionend:function t(){var n=this;3==this.composing&&setTimeout(function(){return n.view.dispatch({effects:tu.of(!1)})},20),this.composing=0}}}),fu=function(){function u(e,t){var r,t,n,o,n,i,r=this;A(this,u),this.view=e,this.stateField=t,this.info=null,this.placeInfoReq={read:function t(){return r.measureInfo()},write:function t(n){return r.placeInfo(n)},key:this},this.space=null,this.currentClass="",n=(t=e.state.field(t)).open,o=n.options,n=n.selected,i=e.state.facet(eu),this.optionContent=Ld(i),this.optionClass=i.optionClass,this.tooltipClass=i.tooltipClass,this.range=Bd(o.length,n,i.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",function(t){for(var n=t.target,i;n&&n!=r.dom;n=n.parentNode)if("LI"==n.nodeName&&(i=/-(\d+)$/.exec(n.id))&&+i[1]<o.length)return Td(e,o[+i[1]]),void t.preventDefault()}),this.dom.addEventListener("focusout",function(t){var n=e.state.field(r.stateField,!1);n&&n.tooltip&&e.state.facet(eu).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:nu.of(null)})}),this.list=this.dom.appendChild(this.createListBox(o,t.id,this.range)),this.list.addEventListener("scroll",function(){r.info&&r.view.requestMeasure(r.placeInfoReq)})}return D(u,[{key:"mount",value:function t(){this.updateSel()}},{key:"update",value:function t(n){var n,n,i,e,i,e=n.state.field(this.stateField),i=n.startState.field(this.stateField);this.updateTooltipClass(n.state),e!=i&&(this.updateSel(),(null==(n=e.open)?void 0:n.disabled)!=(null==(n=i.open)?void 0:n.disabled))&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!(null==(i=e.open)||!i.disabled))}},{key:"updateTooltipClass",value:function t(n){var n,i,e,r,o,u,s,n=this.tooltipClass(n);if(n!=this.currentClass){i=F(this.currentClass.split(" "));try{for(i.s();!(e=i.n()).done;)(r=e.value)&&this.dom.classList.remove(r)}catch(t){i.e(t)}finally{i.f()}o=F(n.split(" "));try{for(o.s();!(u=o.n()).done;)(s=u.value)&&this.dom.classList.add(s)}catch(t){o.e(t)}finally{o.f()}this.currentClass=n}}},{key:"positioned",value:function t(n){this.space=n,this.info&&this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSel",value:function t(){var n,i,e,e,r,r,n=this,i=this.view.state.field(this.stateField),e=i.open;(-1<e.selected&&e.selected<this.range.from||e.selected>=this.range.to)&&(this.range=Bd(e.options.length,e.selected,this.view.state.facet(eu).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e.options,i.id,this.range)),this.list.addEventListener("scroll",function(){n.info&&n.view.requestMeasure(n.placeInfoReq)})),this.updateSelectedOption(e.selected)&&(this.info&&(this.info.remove(),this.info=null),r=(e=e.options[e.selected].completion).info)&&(r="string"==typeof r?document.createTextNode(r):r(e))&&("then"in r?r.then(function(t){t&&n.view.state.field(n.stateField,!1)==i&&n.addInfoPane(t)}).catch(function(t){return Wc(n.view.state,t,"completion info")}):this.addInfoPane(r))}},{key:"addInfoPane",value:function t(n){var i=this.info=document.createElement("div");i.className="cm-tooltip cm-completionInfo",i.appendChild(n),this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSelectedOption",value:function t(n){for(var i,e,r,i=null,e=this.list.firstChild,r=this.range.from;e;e=e.nextSibling,r++)"LI"==e.nodeName&&e.id?r==n?e.hasAttribute("aria-selected")||(e.setAttribute("aria-selected","true"),i=e):e.hasAttribute("aria-selected")&&e.removeAttribute("aria-selected"):r--;return i&&Fd(this.list,i),i}},{key:"measureInfo",value:function t(){var n,i,e,n,r,o,n=this.dom.querySelector("[aria-selected]");return!n||!this.info||(i=this.dom.getBoundingClientRect(),e=this.info.getBoundingClientRect(),n=n.getBoundingClientRect(),r=(r=this.space)||{left:0,top:0,right:(o=this.dom.ownerDocument.defaultView||window).innerWidth,bottom:o.innerHeight},n.top>Math.min(r.bottom,i.bottom)-10)||n.bottom<Math.max(r.top,i.top)+10?null:this.view.state.facet(eu).positionInfo(this.view,i,n,e,r)}},{key:"placeInfo",value:function t(n){this.info&&(n?(n.style&&(this.info.style.cssText=n.style),this.info.className="cm-tooltip cm-completionInfo "+(n.class||"")):this.info.style.cssText="top: -1e6px")}},{key:"createListBox",value:function t(n,i,e){var r,o,u,s,a,f,s,h,c,l,s,v,d,y,m,r=document.createElement("ul");for(r.id=i,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),o=null,u=e.from;u<e.to;u++){a=(s=n[u]).completion,f=s.match,(s=a.section)&&(h="string"==typeof s?s:s.name)!=o&&(u>e.from||0==e.from)&&(o=h,"string"!=typeof s&&s.header?r.appendChild(s.header(s)):(c=r.appendChild(document.createElement("completion-section"))).textContent=h),(l=r.appendChild(document.createElement("li"))).id=i+"-"+u,l.setAttribute("role","option"),(s=this.optionClass(a))&&(l.className=s),v=F(this.optionContent);try{for(v.s();!(d=v.n()).done;)(m=(y=d.value)(a,this.view.state,f))&&l.appendChild(m)}catch(t){v.e(t)}finally{v.f()}}return e.from&&r.classList.add("cm-completionListIncompleteTop"),e.to<n.length&&r.classList.add("cm-completionListIncompleteBottom"),r}}]),u}(),hu=function(){function h(t,n,i,e,r,o){A(this,h),this.options=t,this.attrs=n,this.tooltip=i,this.timestamp=e,this.selected=r,this.disabled=o}return D(h,[{key:"setSelected",value:function t(n,i){return n==this.selected||n>=this.options.length?this:new h(this.options,zd(i,n),this.tooltip,this.timestamp,n,this.disabled)}},{key:"map",value:function t(n){return new h(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:n.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}],[{key:"build",value:function t(n,i,e,r,o){var u,s,a,f,u=Ud(n,i);if(!u.length)return r&&n.some(function(t){return 1==t.state})?new h(r.options,r.attrs,r.tooltip,r.timestamp,r.selected,!0):null;if(s=i.facet(eu).selectOnOpen?0:-1,r&&r.selected!=s&&-1!=r.selected)for(a=r.options[r.selected].completion,f=0;f<u.length;f++)if(u[f].completion==a){s=f;break}return new h(u,zd(e,s),{pos:n.reduce(function(t,n){return n.hasResult()?Math.min(t,n.from):t},1e8),create:_d(ku),above:o.aboveCursor},r?r.timestamp:Date.now(),s,!1)}}]),h}(),cu=function(){function c(t,n,i){A(this,c),this.active=t,this.id=n,this.open=i}return D(c,[{key:"update",value:function t(i){var e,n,r,o,u,s,a,f,h,e=this,n=i.state,r=n.facet(eu),o,u=(r.override||n.languageDataAt("autocomplete",Pd(n)).map(Ad)).map(function(n){var t;return(e.active.find(function(t){return t.source==n})||new du(n,e.active.some(function(t){return 0!=t.state})?1:0)).update(i,r)});u.length==this.active.length&&u.every(function(t,n){return t==e.active[n]})&&(u=this.active),(s=this.open)&&i.docChanged&&(s=s.map(i.changes)),i.selection||u.some(function(t){return t.hasResult()&&i.changes.touchesRange(t.from,t.to)})||!Hd(u,this.active)?s=hu.build(u,n,this.id,s,r):s&&s.disabled&&!u.some(function(t){return 1==t.state})&&(s=null),!s&&u.every(function(t){return 1!=t.state})&&u.some(function(t){return t.hasResult()})&&(u=u.map(function(t){return t.hasResult()?new du(t.source,0):t})),a=F(i.effects);try{for(a.s();!(f=a.n()).done;)(h=f.value).is(pu)&&(s=s&&s.setSelected(h.value,this.id))}catch(t){a.e(t)}finally{a.f()}return u==this.active&&s==this.open?this:new c(u,this.id,s)}},{key:"tooltip",get:function t(){return this.open?this.open.tooltip:null}},{key:"attrs",get:function t(){return this.open?this.open.attrs:lu}}],[{key:"start",value:function t(){return new c(vu,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}}]),c}(),lu={"aria-autocomplete":"list"},vu=[],yu=function(t){f(s,t);var o=S(s);function s(t,n,i,e,r){var t;return A(this,s),(t=o.call(this,t,2,n)).result=i,t.from=e,t.to=r,t}return D(s,[{key:"hasResult",value:function t(){return!0}},{key:"handleUserEvent",value:function t(n,i,e){var r,r,o,u,i,e,r=n.changes.mapPos(this.from),o=n.changes.mapPos(this.to,1),u=Pd(n.state);return(this.explicitPos<0?u<=r:u<this.from)||o<u||"delete"==i&&Pd(n.startState)==this.from?new du(this.source,"input"==i&&e.activateOnTyping?1:0):(i=this.explicitPos<0?-1:n.changes.mapPos(this.explicitPos),Vd(this.result.validFor,n.state,r,o)?new s(this.source,i,this.result,r,o):this.result.update&&(e=this.result.update(this.result,r,o,new Qo(n.state,u,0<=i)))?new s(this.source,i,e,e.from,null!=(r=e.to)?r:Pd(n.state)):new du(this.source,1,i))}},{key:"handleChange",value:function t(n){return n.changes.touchesRange(this.from,this.to)?new du(this.source,0):this.map(n.changes)}},{key:"map",value:function t(n){return n.empty?this:new s(this.source,this.explicitPos<0?-1:n.mapPos(this.explicitPos),this.result,n.mapPos(this.from),n.mapPos(this.to,1))}}]),s}(du=function(){function c(t,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:-1;A(this,c),this.source=t,this.state=n,this.explicitPos=i}return D(c,[{key:"hasResult",value:function t(){return!1}},{key:"update",value:function t(n,i){var e,r,o,u,s,a,f,h,e=Wd(n),r=this;e?r=r.handleUserEvent(n,e,i):n.docChanged?r=r.handleChange(n):n.selection&&0!=r.state&&(r=new c(r.source,0)),o=F(n.effects);try{for(o.s();!(u=o.n()).done;)if((s=u.value).is(tu))r=new c(r.source,1,s.value?Pd(n.state):-1);else if(s.is(nu))r=new c(r.source,0);else if(s.is(mu)){a=F(s.value);try{for(a.s();!(f=a.n()).done;)(h=f.value).source==r.source&&(r=h)}catch(t){a.e(t)}finally{a.f()}}}catch(t){o.e(t)}finally{o.f()}return r}},{key:"handleUserEvent",value:function t(n,i,e){return"delete"!=i&&e.activateOnTyping?new c(this.source,1):this.map(n.changes)}},{key:"handleChange",value:function t(n){return n.changes.touchesRange(Pd(n.startState))?new c(this.source,0):this.map(n.changes)}},{key:"map",value:function t(n){return n.empty||this.explicitPos<0?this:new c(this.source,this.state,n.mapPos(this.explicitPos))}}]),c}()),mu=v.define({map:function t(n,i){return n.map(function(t){return t.map(i)})}}),pu=v.define(),ku=b.define({create:function t(){return cu.start()},update:function t(n,i){return n.update(i)},provide:function t(n){return[Ue.from(n,function(t){return t.tooltip}),w.contentAttributes.from(n,function(t){return t.attrs})]}}),gu=w.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:'"\xb7\xb7\xb7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"".concat(400,"px"),boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"".concat(30,"px")},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"".concat(30,"px")},"&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:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25cb'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25cc'"}},".cm-completionIcon-variable":{"&:after":{content:"'\ud835\udc65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\ud835\udc36'"}},".cm-completionIcon-type":{"&:after":{content:"'\ud835\udc61'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222a'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25a1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\ud83d\udd11\ufe0e'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25a2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),wu=D(function t(n,i,e,r){A(this,t),this.field=n,this.line=i,this.from=e,this.to=r}),bu=function(){function e(t,n,i){A(this,e),this.field=t,this.from=n,this.to=i}return D(e,[{key:"map",value:function t(n){var i,n,i=n.mapPos(this.from,-1,h.TrackDel),n=n.mapPos(this.to,1,h.TrackDel);return null==i||null==n?null:new e(this.field,i,n)}}]),e}(),Mu=function(){function b(t,n){A(this,b),this.lines=t,this.fieldPositions=n}return D(b,[{key:"instantiate",value:function t(n,i){var e,r,o,u,s,a,f,h,c,l,v,e=[],r=[i],o=n.doc.lineAt(i),u=/^\s*/.exec(o.text)[0],s=F(this.lines);try{for(s.s();!(a=s.n()).done;){if(f=a.value,e.length){for(h=u,c=/^\t*/.exec(f)[0].length,l=0;l<c;l++)h+=n.facet(ro);r.push(i+h.length-c),f=h+f.slice(c)}e.push(f),i+=f.length+1}}catch(t){s.e(t)}finally{s.f()}return{text:e,ranges:v=this.fieldPositions.map(function(t){return new bu(t.field,r[t.line]+t.from,r[t.line]+t.to)})}}}],[{key:"parse",value:function t(n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,i=[],e=[],r=[],u=F(n.split(/\r\n?|\n/));try{for(u.s();!(s=u.n()).done;){for(a=s.value;o=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(a);){for(f=o[1]?+o[1]:null,h=o[2]||o[3]||"",c=-1,l=0;l<i.length;l++)(null!=f?i[l].seq==f:h&&i[l].name==h)&&(c=l);if(c<0){for(v=0;v<i.length&&(null==f||null!=i[v].seq&&i[v].seq<f);)v++;i.splice(v,0,{seq:f,name:h}),c=v,d=F(r);try{for(d.s();!(y=d.n()).done;)(m=y.value).field>=c&&m.field++}catch(t){d.e(t)}finally{d.f()}}r.push(new wu(c,e.length,o.index,o.index+h.length)),a=a.slice(0,o.index)+h+a.slice(o.index+o[0].length)}for(;p=/\\([{}])/.exec(a);){a=a.slice(0,p.index)+p[1]+a.slice(p.index+p[0].length),k=F(r);try{for(k.s();!(g=k.n()).done;)(w=g.value).line==e.length&&w.from>p.index&&(w.from--,w.to--)}catch(t){k.e(t)}finally{k.f()}}e.push(a)}}catch(t){u.e(t)}finally{u.f()}return new b(e,r)}}]),b}(),xu=m.widget({widget:new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"toDOM",value:function t(){var n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(tn))}),Su=m.mark({class:"cm-snippetField"}),Cu=function(){function s(t,n){A(this,s),this.ranges=t,this.active=n,this.deco=m.set(t.map(function(t){return(t.from==t.to?xu:Su).range(t.from,t.to)}))}return D(s,[{key:"map",value:function t(n){var i,e,r,o,u,i=[],e=F(this.ranges);try{for(e.s();!(r=e.n()).done;){if(!(u=(o=r.value).map(n)))return null;i.push(u)}}catch(t){e.e(t)}finally{e.f()}return new s(i,this.active)}},{key:"selectionInsideField",value:function t(n){var i=this;return n.ranges.every(function(n){return i.ranges.some(function(t){return t.field==i.active&&t.from<=n.from&&t.to>=n.to})})}}]),s}(),ju=v.define({map:function t(n,i){return n&&n.map(i)}}),Pu=v.define(),Ou=b.define({create:function t(){return null},update:function t(n,i){var e,r,o,e=F(i.effects);try{for(e.s();!(r=e.n()).done;){if((o=r.value).is(ju))return o.value;if(o.is(Pu)&&n)return new Cu(n.ranges,o.value)}}catch(t){e.e(t)}finally{e.f()}return n=(n=n&&i.docChanged?n.map(i.changes):n)&&i.selection&&!n.selectionInsideField(i.selection)?null:n},provide:function t(n){return w.decorations.from(n,function(t){return t?t.deco:m.none})}}),Eu=[{key:"Tab",run:Vr=Gd(1),shift:Ur=Gd(-1)},{key:"Escape",run:n=function t(n){var i,n,e,i=n.state,n=n.dispatch,e;return!!i.field(Ou,!1)&&(n(i.update({effects:ju.of(null)})),!0)}}],Au=y.define({combine:function t(n){return n.length?n[0]:Eu}}),Du=st.highest(ie.compute([Au],function(t){return t.facet(Au)})),Ru=w.domEventHandlers({mousedown:function t(n,i){var e,r,o,e=i.state.field(Ou,!1);return!(!e||null==(r=i.posAtCoords({x:n.clientX,y:n.clientY}))||!(o=e.ranges.find(function(t){return t.from<=r&&t.to>=r}))||o.field==e.active||(i.dispatch({selection:$d(e.ranges,o.field),effects:ju.of(e.ranges.some(function(t){return t.field>o.field})?new Cu(e.ranges,o.field):null)}),0))}}),Iu=Object.create(null),t=function t(n){var i,e,r,r,o,i=n.state.languageDataAt("wordChars",n.pos).join(""),e=Xd(i),r=n.matchBefore(Zd(e,function(t){return t+"$"}));return r||n.explicit?{from:r=r?r.from:n.pos,options:o=n1(n.state.doc,Yd(i),e,5e4,r),validFor:Zd(e,function(t){return"^"+t})}:null},Tu={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Lu=v.define({map:function t(n,i){var i=i.mapPos(n,-1,h.TrackAfter);return null==i?void 0:i}}),(Bu=new(function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i)}(jt))).startSide=1,Bu.endSide=-1,_u=b.define({create:function t(){return j.empty},update:function t(n,i){var e,r,o,u,s;n=(n=i.selection&&(e=i.state.doc.lineAt(i.selection.main.head).from,r=i.startState.doc.lineAt(i.startState.selection.main.head).from,e!=i.changes.mapPos(r,-1))?j.empty:n).map(i.changes),o=F(i.effects);try{for(o.s();!(u=o.n()).done;)(s=u.value).is(Lu)&&(n=n.update({add:[Bu.range(s.value,s.value+1)]}))}catch(t){o.e(t)}finally{o.f()}return n}}),Fu="()[]{}<>",Nu="object"==("undefined"==typeof navigator?"undefined":uh(navigator))&&/Android\b/.test(navigator.userAgent),Uu=w.inputHandler.of(function(t,n,i,e){var r,n;return!((Nu?t.composing:t.compositionStarted)||t.state.readOnly||(r=t.state.selection.main,2<e.length)||2==e.length&&1==Mh(wh(e,0))||n!=r.from||i!=r.to||!(n=o1(t.state,e))||(t.dispatch(n),0))}),Hu=[{key:"Backspace",run:e=function t(n){var o,n,i,u,s,i,o=n.state,n=n.dispatch;return!o.readOnly&&(i=r1(o,o.selection.main.head),u=i.brackets||Tu.brackets,s=null,i=o.changeByRange(function(t){var n,i,e,r;if(t.empty){n=a1(o.doc,t.head),i=F(u);try{for(i.s();!(e=i.n()).done;)if((r=e.value)==n&&s1(o.doc,t.head)==e1(wh(r,0)))return{changes:{from:t.head-r.length,to:t.head+r.length},range:O.cursor(t.head-r.length)}}catch(t){i.e(t)}finally{i.f()}}return{range:s=t}}),s||n(o.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s)}}],zu=[{key:"Ctrl-Space",run:$r},{key:"Escape",run:Yt},{key:"ArrowDown",run:Id(!0)},{key:"ArrowUp",run:Id(!1)},{key:"PageDown",run:Id(!0,"page")},{key:"PageUp",run:Id(!1,"page")},{key:"Enter",run:r}],Wu=st.highest(ie.computeN([eu],function(t){return t.facet(eu).defaultKeymap?[zu]:[]})),Vu=new WeakMap,$u=L.Autocomplete=Object.freeze({__proto__:null,CompletionContext:Qo,acceptCompletion:r,autocompletion:y1,clearSnippet:n,closeBrackets:i1,closeBracketsKeymap:Hu,closeCompletion:Yt,completeAnyWord:t,completeFromList:Sd,completionKeymap:zu,completionStatus:m1,currentCompletions:p1,deleteBracketPair:e,hasNextSnippetField:Jd,hasPrevSnippetField:Kd,ifIn:Cd,ifNotIn:jd,insertBracket:o1,insertCompletionText:Ed,moveCompletionSelection:Id,nextSnippetField:Vr,pickedCompletion:Zo,prevSnippetField:Ur,selectedCompletion:k1,selectedCompletionIndex:g1,setSelectedCompletion:w1,snippet:qd,snippetCompletion:Qd,snippetKeymap:Au,startCompletion:$r}),qu=b1(j1,0),Zt=b1(j1,1),Nr=b1(j1,2),nn=b1(C1,0),zr=b1(C1,1),u=b1(C1,2),Gu=b1(function(t,n){return C1(t,n,S1(n))},0),Ju=50,Ku=gt.define(),Qu=gt.define(),Xu=y.define(),Zu=y.define({combine:function t(n){return qh(n,{minDepth:100,newGroupDelay:500,joinToEvent:function t(n,i){return i}},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:function t(i,e){return function(t,n){return i(t,n)||e(t,n)}}})}}),o=Yu=b.define({create:function t(){return us.empty},update:function t(n,i){var e,r,o,o,u,s,o,u,s,r,e=i.state.facet(Zu),r=i.annotation(Ku);return r?(o=i.docChanged?O.single(P1(i.changes)):void 0,o=is.fromTransaction(i,o),s=0==(u=r.side)?n.undone:n.done,s=o?D1(s,s.length,e.minDepth,o):L1(s,i.startState.selection),new us(0==u?r.rest:s,0==u?s:r.rest)):("full"!=(o=i.annotation(Qu))&&"before"!=o||(n=n.isolate()),!1===i.annotation(Mt.addToHistory)?i.changes.empty?n:n.addMapping(i.changes.desc):(u=is.fromTransaction(i),s=i.annotation(Mt.time),r=i.annotation(Mt.userEvent),u?n=n.addChanges(u,s,r,e,i):i.selection&&(n=n.addSelection(i.startState.selection,s,r,e.newGroupDelay)),"full"!=o&&"after"!=o?n:n.isolate()))},toJSON:function t(n){return{done:n.done.map(function(t){return t.toJSON()}),undone:n.undone.map(function(t){return t.toJSON()})}},fromJSON:function t(n){return new us(n.done.map(is.fromJSON),n.undone.map(is.fromJSON))}}),ts=E1(0,!(Wr=function t(n){var i=n.state,i=i.doc.lineAt(i.selection.main.from),i=M1(n.state,i.from);return i.line?qu(n):!!i.block&&Gu(n)})),ns=E1(1,!1),Hr=E1(0,!0),jt=E1(1,!0),r=A1(0),n=A1(1),is=function(){function a(t,n,i,e,r){A(this,a),this.changes=t,this.effects=n,this.mapped=i,this.startSelection=e,this.selectionsAfter=r}return D(a,[{key:"setSelAfter",value:function t(n){return new a(this.changes,this.effects,this.mapped,this.startSelection,n)}},{key:"toJSON",value:function t(){var n,n,n;return{changes:null==(n=this.changes)?void 0:n.toJSON(),mapped:null==(n=this.mapped)?void 0:n.toJSON(),startSelection:null==(n=this.startSelection)?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(function(t){return t.toJSON()})}}}],[{key:"fromJSON",value:function t(n){return new a(n.changes&&K.fromJSON(n.changes),[],n.mapped&&J.fromJSON(n.mapped),n.startSelection&&O.fromJSON(n.startSelection),n.selectionsAfter.map(O.fromJSON))}},{key:"fromTransaction",value:function t(n,i){var e,r,o,u,s,e=es,r=F(n.startState.facet(Xu));try{for(r.s();!(o=r.n()).done;)(s=(u=o.value)(n)).length&&(e=e.concat(s))}catch(t){r.e(t)}finally{r.f()}return!e.length&&n.changes.empty?null:new a(n.changes.invert(n.startState.doc),e,void 0,i||n.startState.selection,es)}},{key:"selection",value:function t(n){return new a(void 0,es,void 0,void 0,n)}}]),a}(),es=[],rs=200,os=/^(input\.type|delete)($|\.)/,(us=function(){function a(t,n){var i,e,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:void 0;A(this,a),this.done=t,this.undone=n,this.prevTime=i,this.prevUserEvent=e}return D(a,[{key:"isolate",value:function t(){return this.prevTime?new a(this.done,this.undone):this}},{key:"addChanges",value:function t(n,i,e,r,o){var u=this.done,s=u[u.length-1],u;return new a(u=s&&s.changes&&!s.changes.empty&&n.changes&&(!e||os.test(e))&&(!s.selectionsAfter.length&&i-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,R1(s.changes,n.changes))||"input.type.compose"==e)?D1(u,u.length-1,r.minDepth,new is(n.changes.compose(s.changes),T1(n.effects,s.effects),s.mapped,s.startSelection,es)):D1(u,u.length,r.minDepth,n),es,i,e)}},{key:"addSelection",value:function t(n,i,e,r){var o=this.done.length?this.done[this.done.length-1].selectionsAfter:es;return 0<o.length&&i-this.prevTime<r&&e==this.prevUserEvent&&e&&/^select($|\.)/.test(e)&&I1(o[o.length-1],n)?this:new a(L1(this.done,n),this.undone,i,e)}},{key:"addMapping",value:function t(n){return new a(_1(this.done,n),_1(this.undone,n),this.prevTime,this.prevUserEvent)}},{key:"pop",value:function t(n,i,e){var r,o,e,r=0==n?this.done:this.undone;return 0==r.length?null:(o=r[r.length-1],e&&o.selectionsAfter.length?i.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:Ku.of({side:n,rest:B1(r)}),userEvent:0==n?"select.undo":"select.redo",scrollIntoView:!0}):o.changes?(e=1==r.length?es:r.slice(0,r.length-1),o.mapped&&(e=_1(e,o.mapped)),i.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:Ku.of({side:n,rest:e}),filter:!1,userEvent:0==n?"undo":"redo",scrollIntoView:!0})):null)}}]),a}()).empty=new us(es,es),ss=[{key:"Mod-z",run:ts,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:ns,preventDefault:!0},{linux:"Ctrl-Shift-z",run:ns,preventDefault:!0},{key:"Mod-u",run:Hr,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:jt,preventDefault:!0}],ra=function t(a,f){return sy(a,function(t){var n,i,e,r,o,u,s,n=a.state,i=n.doc.lineAt(t);if(!f&&t>i.from&&t<i.from+200&&!/[^ \t]/.test(e=i.text.slice(0,t-i.from))){if("\t"==e[e.length-1])return t-1;for(u=(o=ic(e,n.tabSize))%Pv(n)||Pv(n),s=0;s<u&&" "==e[e.length-1-s];s++)t--;r=t}else(r=yh(i.text,t-i.from,f,f)+i.from)==t&&i.number!=(f?n.doc.lines:1)&&(r+=f?1:-1);return r})},sa=function t(f,h){return sy(f,function(t){for(var n,i,e,r,o,u,s,a,n=t,i=f.state,e=i.doc.lineAt(n),r=i.charCategorizer(n),o=null;;){if(n==(h?e.to:e.from)){n==t&&e.number!=(h?i.doc.lines:1)&&(n+=h?1:-1);break}if(u=yh(e.text,n-e.from,h)+e.from,a=r(s=e.text.slice(Math.min(n,u)-e.from,Math.max(n,u)-e.from)),null!=o&&a!=o)break;" "==s&&n==t||(o=a),n=u}return n})},Pa=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Yt=function t(n){return H1(n,function(t){return K1(n.state,t,!V1(n))})},shift:t=function t(n){return ny(n,function(t){return K1(n.state,t,!V1(n))})}},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=function t(n){return H1(n,function(t){return K1(n.state,t,V1(n))})},shift:Vr=function t(n){return ny(n,function(t){return K1(n.state,t,V1(n))})}},{key:"Alt-ArrowUp",run:Ur=function t(n){var i,e;return hy(n.state,n.dispatch,!1)}},{key:"Shift-Alt-ArrowUp",run:$r=function t(n){var i,e;return cy(n.state,n.dispatch,!1)}},{key:"Alt-ArrowDown",run:ya=function t(n){var i,e;return hy(n.state,n.dispatch,!0)}},{key:"Shift-Alt-ArrowDown",run:ma=function t(n){var i,e;return cy(n.state,n.dispatch,!0)}},{key:"Escape",run:ea=function t(n){var i,n,e,r,i=n.state,n=n.dispatch,e=i.selection,r=null;return 1<e.ranges.length?r=O.create([e.main]):e.main.empty||(r=O.create([O.cursor(e.main.head)])),!!r&&(n(U1(i,r)),!0)}},{key:"Mod-Enter",run:wa=vy(!0)},{key:"Alt-l",mac:"Ctrl-l",run:na=function t(n){var i,n,e,i=n.state,n=n.dispatch,e=fy(i).map(function(t){var n=t.from,t=t.to;return O.range(n,Math.min(t+1,i.doc.length))});return n(i.update({selection:O.create(e),userEvent:"select"})),!0}},{key:"Mod-i",run:ia=function t(n){var e,n,i,e=n.state,n=n.dispatch,i=N1(e.selection,function(t){for(var n,i,i=R(e).resolveInner(t.head,1);!(i.from<t.from&&i.to>=t.to||i.to>t.to&&i.from<=t.from||null==(n=i.parent))&&n.parent;)i=i.parent;return O.range(i.to,i.from)});return n(U1(e,i)),!0},preventDefault:!0},{key:"Mod-[",run:xa=function t(n){var u=n.state,n=n.dispatch;return!u.readOnly&&(n(u.update(dy(u,function(t,n){var i,e,r,o,i=/^\s*/.exec(t.text)[0];if(i){for(e=ic(i,u.tabSize),r=0,o=Ov(u,Math.max(0,e-Pv(u)));r<i.length&&r<o.length&&i.charCodeAt(r)==o.charCodeAt(r);)r++;n.push({from:t.from+r,to:t.from+i.length,insert:o.slice(r)})}}),{userEvent:"delete.dedent"})),!0)}},{key:"Mod-]",run:Ma=function t(n){var i=n.state,n=n.dispatch;return!i.readOnly&&(n(i.update(dy(i,function(t,n){n.push({from:t.from,insert:i.facet(ro)})}),{userEvent:"input.indent"})),!0)}},{key:"Mod-Alt-\\",run:ba=function t(n){var u,n,s,a,i,u=n.state,n=n.dispatch;return!u.readOnly&&(s=Object.create(null),a=new oo(u,{overrideIndentation:function t(n){var n=s[n];return null==n?-1:n}}),(i=dy(u,function(t,n,i){var e,r,o,e=Ev(a,t.from);null!=e&&(/\S/.test(t.text)||(e=0),(r=/^\s*/.exec(t.text)[0])!=(o=Ov(u,e))||i.from<t.from+r.length)&&(s[t.from]=e,n.push({from:t.from,to:t.from+r.length,insert:o}))})).changes.empty||n(u.update(i,{userEvent:"indent"})),!0)}},{key:"Shift-Mod-k",run:pa=function t(n){var i,e,r;return!n.state.readOnly&&(e=(i=n.state).changes(fy(i).map(function(t){var n=t.from,t=t.to;return 0<n?n--:t<i.doc.length&&t++,{from:n,to:t}})),r=N1(i.selection,function(t){return n.moveVertically(t,!0)}).map(e),n.dispatch({changes:e,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0)}},{key:"Shift-Mod-\\",run:Os=function t(n){var i,e;return ty(n.state,n.dispatch,!1)}},{key:"Mod-/",run:Wr},{key:"Alt-A",run:nn}].concat(ja=[{key:"ArrowLeft",run:as=function t(n){return W1(n,!V1(n))},shift:As=function t(n){return iy(n,!V1(n))},preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:ls=function t(n){return $1(n,!V1(n))},shift:Ts=function t(n){return ey(n,!V1(n))},preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Ss=function t(n){return H1(n,function(t){return Y1(n,t,!V1(n))})},shift:qs=function t(n){return ny(n,function(t){return Y1(n,t,!V1(n))})},preventDefault:!0},{key:"ArrowRight",run:fs=function t(n){return W1(n,V1(n))},shift:Ds=function t(n){return iy(n,V1(n))},preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:vs=function t(n){return $1(n,V1(n))},shift:Ls=function t(n){return ey(n,V1(n))},preventDefault:!0},{mac:"Cmd-ArrowRight",run:Cs=function t(n){return H1(n,function(t){return Y1(n,t,V1(n))})},shift:Gs=function t(n){return ny(n,function(t){return Y1(n,t,V1(n))})},preventDefault:!0},{key:"ArrowUp",run:ks=function t(n){return Q1(n,!1)},shift:Us=function t(n){return oy(n,!1)},preventDefault:!0},{mac:"Cmd-ArrowUp",run:Qs=function t(n){var i=n.state,e;return(0,n.dispatch)(U1(i,{anchor:0})),!0},shift:Zs=function t(n){var i=n.state,e;return(0,n.dispatch)(U1(i,{anchor:i.selection.main.anchor,head:0})),!0}},{mac:"Ctrl-ArrowUp",run:ws=function t(n){return Z1(n,!1)},shift:zs=function t(n){return uy(n,!1)}},{key:"ArrowDown",run:gs=function t(n){return Q1(n,!0)},shift:Hs=function t(n){return oy(n,!0)},preventDefault:!0},{mac:"Cmd-ArrowDown",run:Xs=function t(n){var i=n.state,e;return(0,n.dispatch)(U1(i,{anchor:i.doc.length})),!0},shift:Ys=function t(n){var i=n.state,e;return(0,n.dispatch)(U1(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0}},{mac:"Ctrl-ArrowDown",run:bs=function t(n){return Z1(n,!0)},shift:Ws=function t(n){return uy(n,!0)}},{key:"PageUp",run:ws,shift:zs},{key:"PageDown",run:bs,shift:Ws},{key:"Home",run:xs=function t(n){return H1(n,function(t){return Y1(n,t,!1)})},shift:$s=function t(n){return ny(n,function(t){return Y1(n,t,!1)})},preventDefault:!0},{key:"Mod-Home",run:Qs,shift:Zs},{key:"End",run:Ms=function t(n){return H1(n,function(t){return Y1(n,t,!0)})},shift:Vs=function t(n){return ny(n,function(t){return Y1(n,t,!0)})},preventDefault:!0},{key:"Mod-End",run:Xs,shift:Ys},{key:"Enter",run:ga=vy(!(ka=function t(n){var i=n.state,e;return(0,n.dispatch)(i.update(i.replaceSelection(i.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0}))},{key:"Mod-a",run:ta=function t(n){var i=n.state,e;return(0,n.dispatch)(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0}},{key:"Backspace",run:oa=function t(n){return ra(n,!1)},shift:oa},{key:"Delete",run:ua=function t(n){return ra(n,!0)}},{key:"Mod-Backspace",mac:"Alt-Backspace",run:aa=function t(n){return sa(n,!1)}},{key:"Mod-Delete",mac:"Alt-Delete",run:fa=function t(n){return sa(n,!0)}},{mac:"Mod-Backspace",run:ca=function t(i){return sy(i,function(t){var n=i.lineBlockAt(t).from;return n<t?n:Math.max(0,t-1)})}},{mac:"Mod-Delete",run:ha=function t(i){return sy(i,function(t){var n=i.lineBlockAt(t).to;return t<n?n:Math.min(i.state.doc.length,t+1)})}}].concat((Ca=[{key:"Ctrl-b",run:as,shift:As,preventDefault:!0},{key:"Ctrl-f",run:fs,shift:Ds},{key:"Ctrl-p",run:ks,shift:Us},{key:"Ctrl-n",run:gs,shift:Hs},{key:"Ctrl-a",run:js=function t(n){return H1(n,function(t){return O.cursor(n.lineBlockAt(t.head).from,1)})},shift:Js=function t(n){return ny(n,function(t){return O.cursor(n.lineBlockAt(t.head).from)})}},{key:"Ctrl-e",run:Ps=function t(n){return H1(n,function(t){return O.cursor(n.lineBlockAt(t.head).to,-1)})},shift:Ks=function t(n){return ny(n,function(t){return O.cursor(n.lineBlockAt(t.head).to)})}},{key:"Ctrl-d",run:ua},{key:"Ctrl-h",run:oa},{key:"Ctrl-k",run:ha},{key:"Ctrl-Alt-h",run:aa},{key:"Ctrl-o",run:va=function t(n){var i,n,e,i=n.state,n=n.dispatch;return!i.readOnly&&(e=i.changeByRange(function(t){return{changes:{from:t.from,to:t.to,insert:k.of(["",""])},range:O.cursor(t.from)}}),n(i.update(e,{scrollIntoView:!0,userEvent:"input"})),!0)}},{key:"Ctrl-t",run:da=function t(n){var r,n,i,r=n.state,n=n.dispatch;return!r.readOnly&&!(i=r.changeByRange(function(t){var n,i,e,i;return t.empty&&0!=t.from&&t.from!=r.doc.length?{changes:{from:e=(n=t.from)==(i=r.doc.lineAt(n)).from?n-1:yh(i.text,n-i.from,!1)+i.from,to:i=n==i.to?n+1:yh(i.text,n-i.from,!0)+i.from,insert:r.doc.slice(n,i).append(r.doc.slice(e,n))},range:O.cursor(i)}:{range:t}})).changes.empty&&(n(r.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:bs}]).map(function(t){return{mac:t.key,run:t.run,shift:t.shift}}))),Ea=L.Commands=Object.freeze({__proto__:null,blockComment:zr,blockUncomment:u,copyLineDown:ma,copyLineUp:$r,cursorCharBackward:cs=function t(n){return W1(n,!1)},cursorCharForward:hs=function t(n){return W1(n,!0)},cursorCharLeft:as,cursorCharRight:fs,cursorDocEnd:Xs,cursorDocStart:Qs,cursorGroupBackward:ys=function t(n){return $1(n,!1)},cursorGroupForward:ds=function t(n){return $1(n,!0)},cursorGroupLeft:ls,cursorGroupRight:vs,cursorLineBoundaryBackward:xs,cursorLineBoundaryForward:Ms,cursorLineBoundaryLeft:Ss,cursorLineBoundaryRight:Cs,cursorLineDown:gs,cursorLineEnd:Ps,cursorLineStart:js,cursorLineUp:ks,cursorMatchingBracket:Os,cursorPageDown:bs,cursorPageUp:ws,cursorSubwordBackward:ps=function t(n){return G1(n,!1)},cursorSubwordForward:ms=function t(n){return G1(n,!0)},cursorSyntaxLeft:Yt,cursorSyntaxRight:e,defaultKeymap:Pa,deleteCharBackward:oa,deleteCharForward:ua,deleteGroupBackward:aa,deleteGroupForward:fa,deleteLine:pa,deleteToLineEnd:ha,deleteToLineStart:ca,deleteTrailingWhitespace:la=function t(n){var i,n,e,r,o,u,s,i=n.state,n=n.dispatch;if(i.readOnly)return!1;for(e=[],r=0,o="",u=i.doc.iter();;){if(u.next(),u.lineBreak||u.done){if(-1<(s=o.search(/\s+$/))&&e.push({from:r-(o.length-s),to:r}),u.done)break;o=""}else o=u.value;r+=u.value.length}return!!e.length&&(n(i.update({changes:e,userEvent:"delete"})),!0)},emacsStyleKeymap:Ca,history:O1,historyField:o,historyKeymap:ss,indentLess:xa,indentMore:Ma,indentSelection:ba,indentWithTab:Oa={key:"Tab",run:Ma,shift:xa},insertBlankLine:wa,insertNewline:ka,insertNewlineAndIndent:ga,insertTab:Sa=function t(n){var i=n.state,n=n.dispatch;return i.selection.ranges.some(function(t){return!t.empty})?Ma({state:i,dispatch:n}):(n(i.update(i.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0)},invertedEffects:Xu,isolateHistory:Qu,lineComment:Zt,lineUncomment:Nr,moveLineDown:ya,moveLineUp:Ur,redo:ns,redoDepth:n,redoSelection:jt,selectAll:ta,selectCharBackward:Is=function t(n){return iy(n,!1)},selectCharForward:Rs=function t(n){return iy(n,!0)},selectCharLeft:As,selectCharRight:Ds,selectDocEnd:Ys,selectDocStart:Zs,selectGroupBackward:_s=function t(n){return ey(n,!1)},selectGroupForward:Bs=function t(n){return ey(n,!0)},selectGroupLeft:Ts,selectGroupRight:Ls,selectLine:na,selectLineBoundaryBackward:$s,selectLineBoundaryForward:Vs,selectLineBoundaryLeft:qs,selectLineBoundaryRight:Gs,selectLineDown:Hs,selectLineEnd:Ks,selectLineStart:Js,selectLineUp:Us,selectMatchingBracket:Es=function t(n){var i,e;return ty(n.state,n.dispatch,!0)},selectPageDown:Ws,selectPageUp:zs,selectParentSyntax:ia,selectSubwordBackward:Ns=function t(n){return ry(n,!1)},selectSubwordForward:Fs=function t(n){return ry(n,!0)},selectSyntaxLeft:t,selectSyntaxRight:Vr,simplifySelection:ea,splitLine:va,standardKeymap:ja,toggleBlockComment:nn,toggleBlockCommentByLine:Gu,toggleComment:Wr,toggleLineComment:qu,transposeChars:da,undo:ts,undoDepth:r,undoSelection:Hr}),Aa=D(function t(n,i,e){A(this,t),this.from=n,this.to=i,this.diagnostic=e}),Da=function(){function o(t,n,i){A(this,o),this.diagnostics=t,this.panel=n,this.selected=i}return D(o,null,[{key:"init",value:function t(n,i,e){var n,r,r,n=n,r=e.facet(Ua).markerFilter;return r&&(n=r(n)),new o(r=m.set(n.map(function(t){return t.from==t.to||t.from==t.to-1&&e.doc.lineAt(t.from).to==t.from?m.widget({widget:new Ha(t),diagnostic:t}).range(t.from):m.mark({attributes:{class:"cm-lintRange cm-lintRange-"+t.severity},diagnostic:t}).range(t.from,t.to)}),!0),i,my(r))}}]),o}(),Ra=v.define(),Ia=v.define(),Ta=v.define(),La=b.define({create:function t(){return new Da(m.none,null,null)},update:function t(n,i){var e,r,o,u,s,a;i.docChanged&&(e=n.diagnostics.map(i.changes),r=null,n.selected&&(o=i.changes.mapPos(n.selected.from,1),r=my(e,n.selected.diagnostic,o)||my(e,null,o)),n=new Da(e,n.panel,r)),u=F(i.effects);try{for(u.s();!(s=u.n()).done;)(a=s.value).is(Ra)?n=Da.init(a.value,n.panel,i.state):a.is(Ia)?n=new Da(n.diagnostics,a.value?Wa.open:null,n.selected):a.is(Ta)&&(n=new Da(n.diagnostics,n.panel,a.value))}catch(t){u.e(t)}finally{u.f()}return n},provide:function t(n){return[Ke.from(n,function(t){return t.panel}),w.decorations.from(n,function(t){return t.diagnostics})]}}),Ba=m.mark({class:"cm-lintRange cm-lintRange-active"}),_a=function t(n){var i=n.state.field(La,!1);return!(!i||!i.panel||(n.dispatch({effects:Ia.of(!1)}),0))},Fa=[{key:"Mod-Shift-m",run:zr=function t(n){var i,i,i=n.state.field(La,!1);return i&&i.panel||n.dispatch({effects:ky(n.state,[Ia.of(!0)])}),(i=W0(n,Wa.open))&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:u=function t(n){var i,e,r,i=n.state.field(La,!1);return!(!i||(e=n.state.selection.main,!(r=i.diagnostics.iter(e.to+1)).value&&(!(r=i.diagnostics.iter(0)).value||r.from==e.from&&r.to==e.to))||(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),0))}}],Na=d.fromClass(function(){function i(t){A(this,i),this.view=t,this.timeout=-1,this.set=!0;var n,t=t.state.facet(Ua).delay;this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}return D(i,[{key:"run",value:function t(){var n,i,e,r,i,n=this,i=Date.now();i<this.lintTime-10?setTimeout(this.run,this.lintTime-i):(this.set=!1,i=(r=(e=this.view.state).facet(Ua)).sources,Promise.all(i.map(function(t){return Promise.resolve(t(n.view))})).then(function(t){var t=t.reduce(function(t,n){return t.concat(n)});n.view.state.doc==e.doc&&n.view.dispatch(gy(n.view.state,t))},function(t){Wc(n.view.state,t)}))}},{key:"update",value:function t(n){var i=n.state.facet(Ua);(n.docChanged||i!=n.startState.facet(Ua)||i.needsRefresh&&i.needsRefresh(n))&&(this.lintTime=Date.now()+i.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,i.delay)))}},{key:"force",value:function t(){this.set&&(this.lintTime=Date.now(),this.run())}},{key:"destroy",value:function t(){clearTimeout(this.timeout)}}]),i}()),Ua=y.define({combine:function t(n){return Object.assign({sources:n.map(function(t){return t.source})},qh(n.map(function(t){return t.config}),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:function t(n,i){return n?i?function(t){return n(t)||i(t)}:n:i}}))}}),Ha=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).diagnostic=t,n}return D(e,[{key:"eq",value:function t(n){return n.diagnostic==this.diagnostic}},{key:"toDOM",value:function t(){return I("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}]),e}(tn),za=D(function t(n,i){A(this,t),this.diagnostic=i,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=jy(n,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}),Wa=function(){function i(u){var s,t,n,s=this;A(this,i),this.view=u,this.items=[],t=function t(n){var i,e,r,o;if(27==n.keyCode)_a(s.view),s.view.focus();else if(38==n.keyCode||33==n.keyCode)s.moveSelection((s.selectedIndex-1+s.items.length)%s.items.length);else if(40==n.keyCode||34==n.keyCode)s.moveSelection((s.selectedIndex+1)%s.items.length);else if(36==n.keyCode)s.moveSelection(0);else if(35==n.keyCode)s.moveSelection(s.items.length-1);else if(13==n.keyCode)s.view.focus();else{if(!(65<=n.keyCode&&n.keyCode<=90&&0<=s.selectedIndex))return;for(e=Cy((i=s.items[s.selectedIndex].diagnostic).actions),r=0;r<e.length;r++)e[r].toUpperCase().charCodeAt(0)==n.keyCode&&(o=my(s.view.state.field(La).diagnostics,i))&&i.actions[r].apply(u,o.from,o.to)}n.preventDefault()},n=function t(n){for(var i=0;i<s.items.length;i++)s.items[i].dom.contains(n.target)&&s.moveSelection(i)},this.list=I("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=I("div",{class:"cm-panel-lint"},this.list,I("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:function t(){return _a(s.view)}},"\xd7")),this.update()}return D(i,[{key:"selectedIndex",get:function t(){var n,i,n=this.view.state.field(La).selected;if(n)for(i=0;i<this.items.length;i++)if(this.items[i].diagnostic==n.diagnostic)return i;return-1}},{key:"update",value:function t(){var s,n,i,a,f,h,c,s=this,n=this.view.state.field(La),i=n.diagnostics,a=n.selected,f=0,h=!1,c=null;for(i.between(0,this.view.state.doc.length,function(t,n,i){for(var e,r,o,u,e=i.spec,r=-1,u=f;u<s.items.length;u++)if(s.items[u].diagnostic==e.diagnostic){r=u;break}r<0?(o=new za(s.view,e.diagnostic),s.items.splice(f,0,o),h=!0):(o=s.items[r],f<r&&(s.items.splice(f,r-f),h=!0)),a&&o.diagnostic==a.diagnostic?o.dom.hasAttribute("aria-selected")||(o.dom.setAttribute("aria-selected","true"),c=o):o.dom.hasAttribute("aria-selected")&&o.dom.removeAttribute("aria-selected"),f++});f<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)h=!0,this.items.pop();0==this.items.length&&(this.items.push(new za(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),h=!0),c?(this.list.setAttribute("aria-activedescendant",c.id),this.view.requestMeasure({key:this,read:function t(){return{sel:c.dom.getBoundingClientRect(),panel:s.list.getBoundingClientRect()}},write:function t(n){var i=n.sel,n=n.panel;i.top<n.top?s.list.scrollTop-=n.top-i.top:i.bottom>n.bottom&&(s.list.scrollTop+=i.bottom-n.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),h&&this.sync()}},{key:"sync",value:function t(){var n,i,e,r;function o(){var t=n;n=t.nextSibling,t.remove()}n=this.list.firstChild,i=F(this.items);try{for(i.s();!(e=i.n()).done;)if((r=e.value).dom.parentNode==this.list){for(;n!=r.dom;)o();n=r.dom.nextSibling}else this.list.insertBefore(r.dom,n)}catch(t){i.e(t)}finally{i.f()}for(;n;)o()}},{key:"moveSelection",value:function t(n){var i,n;this.selectedIndex<0||(n=my((i=this.view.state.field(La)).diagnostics,this.items[n].diagnostic))&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Ta.of(n)})}}],[{key:"open",value:function t(n){return new i(n)}}]),i}(),ma=w.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-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:Oy("#d11")},".cm-lintRange-warning":{backgroundImage:Oy("orange")},".cm-lintRange-info":{backgroundImage:Oy("#999")},".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-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}}}),Va=function(t){f(e,t);var i=S(e);function e(t){var n;return A(this,e),(n=i.call(this)).diagnostics=t,n.severity=t.reduce(function(t,n){var n=n.severity;return"error"==n||"warning"==n&&"info"==t?n:t},"info"),n}return D(e,[{key:"toDOM",value:function t(n){var i,e,r,i=document.createElement("div");return i.className="cm-lint-marker cm-lint-marker-"+this.severity,e=this.diagnostics,r=n.state.facet(Xa).tooltipFilter,(e=r?r(e):e).length&&(i.onmouseover=function(){return Ay(n,i,e)}),i}}]),e}(en),$a=$0({class:"cm-gutter-lint",markers:function t(n){return n.state.field(qa)}}),qa=b.define({create:function t(){return j.empty},update:function t(n,i){var e,r,o,u,s;n=n.map(i.changes),e=i.state.facet(Xa).markerFilter,r=F(i.effects);try{for(r.s();!(o=r.n()).done;)(u=o.value).is(Ra)&&(s=u.value,e&&(s=e(s||[])),n=Dy(i.state.doc,s.slice(0)))}catch(t){r.e(t)}finally{r.f()}return n}}),Ga=v.define(),Ja=b.define({create:function t(){return null},update:function t(n,i){return n&&i.docChanged&&(n=py(i,n)?null:Object.assign(Object.assign({},n),{pos:i.changes.mapPos(n.pos)})),i.effects.reduce(function(t,n){return n.is(Ga)?n.value:t},n)},provide:function t(n){return Ue.from(n)}}),Ka=w.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Py('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Py('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Py('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Qa=[La,w.decorations.compute([La],function(t){var t=t.field(La),n=t.selected,t=t.panel;return n&&t&&n.from!=n.to?m.set([Ba.range(n.from,n.to)]):m.none}),F0(by,{hideOn:py}),ma],Xa=y.define({combine:function t(n){return qh(n,{hoverTime:300,markerFilter:null,tooltipFilter:null})}}),Za=L.Lint=Object.freeze({__proto__:null,closeLintPanel:_a,diagnosticCount:wy,forEachDiagnostic:Iy,forceLinting:Sy,lintGutter:Ry,lintKeymap:Fa,linter:xy,nextDiagnostic:u,openLintPanel:zr,setDiagnostics:gy,setDiagnosticsEffect:Ra}),Ya="function"==typeof String.prototype.normalize?function(t){return t.normalize("NFKD")}:function(t){return t},tf=function(){function u(t,n){var i,e,r,o,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:t.length,r=4<arguments.length?arguments[4]:void 0,o=5<arguments.length?arguments[5]:void 0;A(this,u),this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,e),this.bufferStart=i,this.normalize=r?function(t){return r(Ya(t))}:Ya,this.query=this.normalize(n)}return D(u,[{key:"peek",value:function t(){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 wh(this.buffer,this.bufferPos)}},{key:"next",value:function t(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}},{key:"nextOverlapping",value:function t(){for(var n,i,e,r,o,u,s,a;;){if((n=this.peek())<0)return this.done=!0,this;for(i=bh(n),e=this.bufferStart+this.bufferPos,this.bufferPos+=Mh(n),r=this.normalize(i),o=0,u=e;;o++){if(s=r.charCodeAt(o),a=this.match(s,u))return this.value=a,this;if(o==r.length-1)break;u==e&&o<i.length&&i.charCodeAt(o)==s&&u++}}}},{key:"match",value:function t(n,i){var t,e,r,o;for(t=null,e=0;e<this.matches.length;e+=2)r=this.matches[e],o=!1,this.query.charCodeAt(r)==n&&(r==this.query.length-1?t={from:this.matches[e+1],to:i+1}:(this.matches[e]++,o=!0)),o||(this.matches.splice(e,2),e-=2);return this.query.charCodeAt(0)==n&&(1==this.query.length?t={from:i,to:i+1}:this.matches.push(1,i)),t=t&&this.test&&!this.test(t.from,t.to,this.buffer,this.bufferPos)?null:t}}]),u}(),"undefined"!=typeof Symbol&&(tf.prototype[Symbol.iterator]=function(){return this}),nf={from:-1,to:-1,match:/.*/.exec("")},ef="gm"+(null==/x/.unicode?"":"u"),rf=function(){function o(t,n,i){var e,r,r,e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,r=4<arguments.length&&void 0!==arguments[4]?arguments[4]:t.length;if(A(this,o),this.text=t,this.to=r,this.curLine="",this.done=!1,this.value=nf,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new sf(t,n,i,e,r);this.re=new RegExp(n,ef+(null!=i&&i.ignoreCase?"i":"")),this.test=null==i?void 0:i.test,this.iter=t.iter(),r=t.lineAt(e),this.curLineStart=r.from,this.matchPos=Ly(t,e),this.getLine(this.curLineStart)}return D(o,[{key:"getLine",value:function t(n){this.iter.next(n),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 t(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}},{key:"next",value:function t(){for(var n,i,e,r,n=this.matchPos-this.curLineStart;;)if(this.re.lastIndex=n,i=this.matchPos<=this.to&&this.re.exec(this.curLine)){if(r=(e=this.curLineStart+i.index)+i[0].length,this.matchPos=Ly(this.text,r+(e==r?1:0)),e==this.curLineStart+this.curLine.length&&this.nextLine(),(e<r||e>this.value.to)&&(!this.test||this.test(e,r,i)))return this.value={from:e,to:r,match:i},this;n=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),n=0}}}]),o}(),of=new WeakMap,uf=function(){function s(t,n){A(this,s),this.from=t,this.text=n}return D(s,[{key:"to",get:function t(){return this.from+this.text.length}}],[{key:"get",value:function t(n,i,e){var r,o,o,u,r=of.get(n);return!r||r.from>=e||r.to<=i?(o=new s(i,n.sliceString(i,e)),of.set(n,o),o):r.from==i&&r.to==e?r:(o=r.text,i<(u=r.from)&&(o=n.sliceString(i,u)+o,u=i),r.to<e&&(o+=n.sliceString(r.to,e)),of.set(n,new s(u,o)),new s(i,o.slice(i-u,e-u)))}}]),s}(),sf=function(){function o(t,n,i,e,r){A(this,o),this.text=t,this.to=r,this.done=!1,this.value=nf,this.matchPos=Ly(t,e),this.re=new RegExp(n,ef+(null!=i&&i.ignoreCase?"i":"")),this.test=null==i?void 0:i.test,this.flat=uf.get(t,e,this.chunkEnd(e+5e3))}return D(o,[{key:"chunkEnd",value:function t(n){return(n>=this.to?this:this.text.lineAt(n)).to}},{key:"next",value:function t(){for(var n,i,e,r;;){if(n=this.re.lastIndex=this.matchPos-this.flat.from,(i=this.re.exec(this.flat.text))&&!i[0]&&i.index==n&&(this.re.lastIndex=1+n,i=this.re.exec(this.flat.text)),i&&(r=(e=this.flat.from+i.index)+i[0].length,this.flat.to>=this.to||i.index+i[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,r,i)))return this.value={from:e,to:r,match:i},this.matchPos=Ly(this.text,r+(e==r?1:0)),this;if(this.flat.to==this.to)return this.done=!0,this;this.flat=uf.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}]),o}(),"undefined"!=typeof Symbol&&(rf.prototype[Symbol.iterator]=sf.prototype[Symbol.iterator]=function(){return this}),af=v.define(),ff=b.define({create:function t(){return!0},update:function t(n,i){var e,r,o,e=F(i.effects);try{for(e.s();!(r=e.n()).done;)(o=r.value).is(af)&&(n=o.value)}catch(t){e.e(t)}finally{e.f()}return n},provide:function t(n){return Ke.from(n,function(t){return t?By:null})}}),hf=w.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),cf={highlightWordAroundCursor:!($r=function t(n){var i,e,i=W0(n,By);return i||(e=[af.of(!0)],null==n.state.field(ff,!1)&&e.push(v.appendConfig.of([ff,hf])),n.dispatch({effects:e}),i=W0(n,By)),i&&i.dom.querySelector("input").focus(),!0}),minSelectionLength:1,maxMatches:100,wholeWords:!1},lf=y.define({combine:function t(n){return qh(n,cf,{highlightWordAroundCursor:function t(n,i){return n||i},minSelectionLength:Math.min,maxMatches:Math.min})}}),vf=m.mark({class:"cm-selectionMatch"}),df=m.mark({class:"cm-selectionMatch cm-selectionMatch-main"}),yf=d.fromClass(function(){function n(t){A(this,n),this.decorations=this.getDeco(t)}return D(n,[{key:"update",value:function t(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}},{key:"getDeco",value:function t(n){var i,e,r,o,u,s,r,r,a,f,h,c,l,v,d,y,i=n.state.facet(lf),e=n.state,r=e.selection;if(1<r.ranges.length)return m.none;if(s=null,(o=r.main).empty){if(!i.highlightWordAroundCursor)return m.none;if(!(r=e.wordAt(o.head)))return m.none;s=e.charCategorizer(o.head),u=e.sliceDoc(r.from,r.to)}else{if((r=o.to-o.from)<i.minSelectionLength||200<r)return m.none;if(i.wholeWords){if(u=e.sliceDoc(o.from,o.to),!Fy(s=e.charCategorizer(o.head),e,o.from,o.to)||!Ny(s,e,o.from,o.to))return m.none}else if(!(u=e.sliceDoc(o.from,o.to).trim()))return m.none}a=[],f=F(n.visibleRanges);try{for(f.s();!(h=f.n()).done;)for(c=h.value,l=new tf(e.doc,u,c.from,c.to);!l.next().done;)if(d=(v=l.value).from,y=v.to,(!s||Fy(s,e,d,y))&&(o.empty&&d<=o.from&&y>=o.to?a.push(df.range(d,y)):(d>=o.to||y<=o.from)&&a.push(vf.range(d,y)),a.length>i.maxMatches))return m.none}catch(t){f.e(t)}finally{f.f()}return m.set(a)}}]),n}(),{decorations:function t(n){return n.decorations}}),mf=w.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),pf=function t(n){var i,n,e,r,i=n.state,n=n.dispatch,e=i.selection,r=O.create(e.ranges.map(function(t){return i.wordAt(t.head)||O.cursor(t.head)}),e.mainIndex);return!r.eq(e)&&(n(i.update({selection:r})),!0)},as=function t(n){var i,n,e,r,e,i=n.state,n=n.dispatch,e=i.selection.ranges;return e.some(function(t){return t.from===t.to})?pf({state:i,dispatch:n}):(r=i.sliceDoc(e[0].from,e[0].to),!i.selection.ranges.some(function(t){return i.sliceDoc(t.from,t.to)!=r})&&!!(e=Uy(i,r))&&(n(i.update({selection:i.selection.addRange(O.range(e.from,e.to),!1),effects:w.scrollIntoView(e.to)})),!0))},kf=y.define({combine:function t(n){return qh(n,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:function t(n){return new Bf(n)},scrollToMatch:function t(n){return w.scrollIntoView(n)}})}}),gf=function(){function n(t){A(this,n),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||Ty(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}return D(n,[{key:"unquote",value:function t(n){return this.literal?n:n.replace(/\\([nrt\\])/g,function(t,n){return"n"==n?"\n":"r"==n?"\r":"t"==n?"\t":"\\"})}},{key:"eq",value:function t(n){return this.search==n.search&&this.replace==n.replace&&this.caseSensitive==n.caseSensitive&&this.regexp==n.regexp&&this.wholeWord==n.wholeWord}},{key:"create",value:function t(){return new(this.regexp?bf:wf)(this)}},{key:"getCursor",value:function t(n){var i,e,n,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,e=2<arguments.length?arguments[2]:void 0,n=n.doc?n:C.create({doc:n});return null==e&&(e=n.doc.length),(this.regexp?Vy:zy)(this,n,i,e)}}]),n}(),wf=function(t){f(i,t);var n=S(i);function i(t){return A(this,i),n.call(this,t)}return D(i,[{key:"nextMatch",value:function t(n,i,e){var e=zy(this.spec,n,e,n.doc.length).nextOverlapping();return(e=e.done?zy(this.spec,n,0,i).nextOverlapping():e).done?null:e.value}},{key:"prevMatchInRange",value:function t(n,i,e){for(var r,o,u,s,r=e;;){for(o=Math.max(i,r-1e4-this.spec.unquoted.length),u=zy(this.spec,n,o,r),s=null;!u.nextOverlapping().done;)s=u.value;if(s)return s;if(o==i)return null;r-=1e4}}},{key:"prevMatch",value:function t(n,i,e){return this.prevMatchInRange(n,0,i)||this.prevMatchInRange(n,e,n.doc.length)}},{key:"getReplacement",value:function t(n){return this.spec.unquote(this.spec.replace)}},{key:"matchAll",value:function t(n,i){for(var e=zy(this.spec,n,0,n.doc.length),r=[];!e.next().done;){if(i<=r.length)return null;r.push(e.value)}return r}},{key:"highlight",value:function t(n,i,e,r){for(var o=zy(this.spec,n,Math.max(0,i-this.spec.unquoted.length),Math.min(e+this.spec.unquoted.length,n.doc.length));!o.next().done;)r(o.value.from,o.value.to)}}]),i}(fs=D(function t(n){A(this,t),this.spec=n})),bf=function(t){f(i,t);var n=S(i);function i(){return A(this,i),n.apply(this,arguments)}return D(i,[{key:"nextMatch",value:function t(n,i,e){var e=Vy(this.spec,n,e,n.doc.length).next();return(e=e.done?Vy(this.spec,n,0,i).next():e).done?null:e.value}},{key:"prevMatchInRange",value:function t(n,i,e){for(var r,o,u,s,r=1;;r++){for(o=Math.max(i,e-1e4*r),u=Vy(this.spec,n,o,e),s=null;!u.next().done;)s=u.value;if(s&&(o==i||s.from>o+10))return s;if(o==i)return null}}},{key:"prevMatch",value:function t(n,i,e){return this.prevMatchInRange(n,0,i)||this.prevMatchInRange(n,e,n.doc.length)}},{key:"getReplacement",value:function t(i){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,function(t,n){return"$"==n?"$":"&"==n?i.match[0]:"0"!=n&&+n<i.match.length?i.match[n]:t}))}},{key:"matchAll",value:function t(n,i){for(var e=Vy(this.spec,n,0,n.doc.length),r=[];!e.next().done;){if(i<=r.length)return null;r.push(e.value)}return r}},{key:"highlight",value:function t(n,i,e,r){for(var o=Vy(this.spec,n,Math.max(0,i-250),Math.min(e+250,n.doc.length));!o.next().done;)r(o.value.from,o.value.to)}}]),i}(fs),Mf=v.define(),xf=v.define(),Sf=b.define({create:function t(n){return new Cf(Zy(n).create(),null)},update:function t(n,i){var e,r,o,e=F(i.effects);try{for(e.s();!(r=e.n()).done;)(o=r.value).is(Mf)?n=new Cf(o.value.create(),n.panel):o.is(xf)&&(n=new Cf(n.query,o.value?Xy:null))}catch(t){e.e(t)}finally{e.f()}return n},provide:function t(n){return Ke.from(n,function(t){return t.panel})}}),Cf=D(function t(n,i){A(this,t),this.query=n,this.panel=i}),jf=m.mark({class:"cm-searchMatch"}),Pf=m.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Xs=d.fromClass(function(){function n(t){A(this,n),this.view=t,this.decorations=this.highlight(t.state.field(Sf))}return D(n,[{key:"update",value:function t(n){var i=n.state.field(Sf);(i!=n.startState.field(Sf)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(i))}},{key:"highlight",value:function t(n){var i,e,r,o,u,s,a,f,h,c,i=n.query,e;if(!n.panel||!i.spec.valid)return m.none;for(r=this.view,o=new Et,u=0,a=(s=r.visibleRanges).length;u<a;u++){for(h=(f=s[u]).from,c=f.to;u<a-1&&c>s[u+1].from-500;)c=s[++u].to;i.highlight(r.state,h,c,function(n,i){var t=r.state.selection.ranges.some(function(t){return t.from==n&&t.to==i});o.add(n,i,t?Pf:jf)})}return o.finish()}}]),n}(),{decorations:function t(n){return n.decorations}}),Af=Qy(function(t,n){var i,n,i,n=n.query.matchAll(t.state,1e3);return!(!n||!n.length||(t.dispatch({selection:O.create(n.map(function(t){return O.range(t.from,t.to)})),userEvent:"select.search.matches"}),0))}),Df=Qy(function(t,n){var n,i,e,r,e,o,u,s,a,f,e,n=n.query,i=t.state,e=i.selection.main,r=e.from,e=e.to;return!i.readOnly&&!!(o=n.nextMatch(i,r,r))&&(u=[],f=[],o.from==r&&o.to==e&&(a=i.toText(n.getReplacement(o)),u.push({from:o.from,to:o.to,insert:a}),o=n.nextMatch(i,o.from,o.to),f.push(w.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(r).number)+"."))),o&&(e=0==u.length||u[0].from>=o.to?0:o.to-o.from-a.length,s=O.single(o.from-e,o.to-e),f.push(im(t,o)),f.push(i.facet(kf).scrollToMatch(s.main,t))),t.dispatch({changes:u,selection:s,effects:f,userEvent:"input.replace"}),!0)}),Rf=Qy(function(t,n){var e,n,i,e=n.query;return!t.state.readOnly&&!!(n=e.matchAll(t.state,1e9).map(function(t){var n,i;return{from:t.from,to:t.to,insert:e.getReplacement(t)}})).length&&(i=t.state.phrase("replaced $ matches",n.length)+".",t.dispatch({changes:n,effects:w.announce.of(i),userEvent:"input.replace.all"}),!0)}),Lf=[{key:"Mod-f",run:If=function t(n){var i,e,r,i=n.state.field(Sf,!1);return i&&i.panel?(e=Yy(n))&&e!=n.root.activeElement&&((r=Zy(n.state,i.query.spec)).valid&&n.dispatch({effects:Mf.of(r)}),e.focus(),e.select()):n.dispatch({effects:[xf.of(!0),i?Mf.of(Zy(n.state,i.query.spec)):v.appendConfig.of(Nf)]}),!0},scope:"editor search-panel"},{key:"F3",run:Of=Qy(function(t,n){var n,i,n,i,e,n=n.query,i=t.state.selection.main.to,n=n.nextMatch(t.state,i,i);return!!n&&(i=O.single(n.from,n.to),e=t.state.facet(kf),t.dispatch({selection:i,effects:[im(t,n),e.scrollToMatch(i.main,t)],userEvent:"select.search"}),tm(t),!0)}),shift:Ef=Qy(function(t,n){var n,i,e,n,i,e,n=n.query,i=t.state,e=i.selection.main.from,n=n.prevMatch(i,e,e);return!!n&&(i=O.single(n.from,n.to),e=t.state.facet(kf),t.dispatch({selection:i,effects:[im(t,n),e.scrollToMatch(i.main,t)],userEvent:"select.search"}),tm(t),!0)}),scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Of,shift:Ef,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tf=function t(n){var i,i,i=n.state.field(Sf,!1);return!(!i||!i.panel||((i=W0(n,Xy))&&i.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:xf.of(!1)}),0))},scope:"editor search-panel"},{key:"Mod-Shift-l",run:Qs=function t(n){var i,n,e,e,r,e,o,u,s,i=n.state,n=n.dispatch,e=i.selection;if(1<e.ranges.length||e.main.empty)return!1;for(r=(e=e.main).from,e=e.to,o=[],u=0,s=new tf(i.doc,i.sliceDoc(r,e));!s.next().done;){if(1e3<o.length)return!1;s.value.from==r&&(u=o.length),o.push(O.range(s.value.from,s.value.to))}return n(i.update({selection:O.create(o,u),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:$r},{key:"Mod-d",run:as,preventDefault:!0}],Bf=function(){function r(n){var i,t;function e(t,n,i){return I("button",{class:"cm-button",name:t,onclick:n,type:"button"},i)}A(i=this,r),this.view=n,t=this.query=n.state.field(Sf).query.spec,this.commit=this.commit.bind(this),this.searchField=I("input",{value:t.search,placeholder:nm(n,"Find"),"aria-label":nm(n,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=I("input",{value:t.replace,placeholder:nm(n,"Replace"),"aria-label":nm(n,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=I("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=I("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=I("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=I("div",{onkeydown:function t(n){return i.keydown(n)},class:"cm-search"},[this.searchField,e("next",function(){return Of(n)},[nm(n,"next")]),e("prev",function(){return Ef(n)},[nm(n,"previous")]),e("select",function(){return Af(n)},[nm(n,"all")]),I("label",null,[this.caseField,nm(n,"match case")]),I("label",null,[this.reField,nm(n,"regexp")]),I("label",null,[this.wordField,nm(n,"by word")])].concat(Wf(n.state.readOnly?[]:[I("br"),this.replaceField,e("replace",function(){return Df(n)},[nm(n,"replace")]),e("replaceAll",function(){return Rf(n)},[nm(n,"replace all")])]),[I("button",{name:"close",onclick:function t(){return Tf(n)},"aria-label":nm(n,"close"),type:"button"},["\xd7"])]))}return D(r,[{key:"commit",value:function t(){var n=new gf({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});n.eq(this.query)||(this.query=n,this.view.dispatch({effects:Mf.of(n)}))}},{key:"keydown",value:function t(n){u0(this.view,n,"search-panel")?n.preventDefault():13==n.keyCode&&n.target==this.searchField?(n.preventDefault(),(n.shiftKey?Ef:Of)(this.view)):13==n.keyCode&&n.target==this.replaceField&&(n.preventDefault(),Df(this.view))}},{key:"update",value:function t(n){var i,e,r,o,u,s,i=F(n.transactions);try{for(i.s();!(e=i.n()).done;){o=F((r=e.value).effects);try{for(o.s();!(u=o.n()).done;)(s=u.value).is(Mf)&&!s.value.eq(this.query)&&this.setQuery(s.value)}catch(t){o.e(t)}finally{o.f()}}}catch(t){i.e(t)}finally{i.f()}}},{key:"setQuery",value:function t(n){this.query=n,this.searchField.value=n.search,this.replaceField.value=n.replace,this.caseField.checked=n.caseSensitive,this.reField.checked=n.regexp,this.wordField.checked=n.wholeWord}},{key:"mount",value:function t(){this.searchField.select()}},{key:"pos",get:function t(){return 80}},{key:"top",get:function t(){return this.view.state.facet(kf).top}}]),r}(),_f=30,Ff=/[\s\.,:;?!]/,ls=w.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"}}),Nf=[Sf,st.lowest(Xs),ls],Uf=L.Search=Object.freeze({__proto__:null,RegExpCursor:rf,SearchCursor:tf,SearchQuery:gf,closeSearchPanel:Tf,findNext:Of,findPrevious:Ef,getSearchQuery:Jy,gotoLine:$r,highlightSelectionMatches:_y,openSearchPanel:If,replaceAll:Rf,replaceNext:Df,search:Hy,searchKeymap:Lf,searchPanelOpen:Ky,selectMatches:Af,selectNextOccurrence:as,selectSelectionMatches:Qs,setSearchQuery:Mf}),L.basicSetup=function(){return[X0(),fr,M0(),O1(),nd(),y0(),k0(),C.allowMultipleSelections.of(!0),Hv(),ed(jo,{fallback:!0}),ud(),i1(),y1(),R0(),I0(),Ee,_y(),ie.of([].concat(Hu,Wf(Pa),Lf,ss,yo,zu,Fa))]}()},"./dist/plugins/formulaPanel/editor/common/calcUtil.js":function(B,t,n){var a,u,f,h,c;function i(t,n,i,e,r){var o,u,s,a,f;void 0===r&&(r=!0),o=i.culture,u=i.ignoreError,s=i.Wve,a=i.Jde,i.ignoreError=e,i.culture=!0,i.Wve=r,i.Jde=!0;try{f=n.parse(i,t)}catch(t){}return i.culture=o,i.ignoreError=u,i.Wve=s,i.Jde=a,f}function e(t,n,i){if(t){var e;try{e=n.unparse(i,t)}catch(t){}return e}}function r(t,n,i,e,r){var o,u,o,t,s,o=new a.Parser,u=!0,o=n.Mf?(0,f.Vgt)(o,t,n.Mf,i,e,!0):(o.setParserOption(!0),r.ignoreError=!0,t=t.split(""),s=o.parseToTokens(r,t,!1),s=(0,f.fillBlankToTokens)(s,t),(0,f.getExpressTokenImp)(o,n,r,null,s,t,i,e));return H(o,n)}function l(){return{arrayListSeparator:a.Parser.arrayListSeparator||c.COMMA,arrayGroupSeparator:a.Parser.arrayGroupSeparator||c.SEMICOLON,listSeparator:a.Parser.listSeparator||c.COMMA,numberDecimalSeparator:a.Parser.numberDecimalSeparator||c.FULL_STOP}}function o(t,n){var i,e,r,o,u;for(t=t.filter(function(t){return t.endIndex<n}),i=[],e=[],r="",o=0;o<t.length;o++)g(u=t[o])?r=u.text:w(u)?(i.push(r),e.push(0)):b(u)&&(r="",i.pop(),e.pop()),0<i.length&&k(u)&&e[e.length-1]++;if(0<i.length)return{functionName:i.pop(),activeParameter:e.pop()}}function s(t,n){for(var i,n,e,r,o,u,s,i=n.parameters||[],n=i.length||0,o=0;o<i.length;o++)if(i[o].repeatable)void 0===e&&(e=o);else if(void 0!==e){r=o-1;break}return t=void 0!==e&&(void 0===r&&(r=i.length-1),e<=t)?r+(s=(t-e)%(u=r-e+1))+1<n?r+s+1:e+s:t}function v(t,n){t=s(t,n);var n=n.parameters?n.parameters.length:0;return Math.min(t,n-1)}function d(t,n,i,e){return void 0===i&&(i=!0),void 0===e&&(e=!1),t.find(function(t){return y(t,n,i,e)})}function y(t,n,i,e){return void 0===e&&(e=!1),((i=void 0===i?!0:i)?n>=t.index:n>t.index)&&(e?n<=t.endIndex+1:n<t.endIndex+1)}function m(t,n,i){return n<=t.index&&i>=t.endIndex+1}function p(t,n){var i,e,r,o,u,u,s,a,f;for(t=t.filter(function(t){return t.endIndex<n}),i=[],e=[],r=[],o=0;o<t.length;o++)g(u=t[o])?(i.push(u.text.toUpperCase()),e.push([]),r.push(0)):b(u)?(i.pop(),e.pop(),r.pop()):k(u)&&(u=(0,c.lastItem)(i),s=(0,c.lastItem)(r),a=(0,c.lastItem)(e),f=t[o-1],("LAMBDA"===u||"LET"===u&&s%2==0)&&E(f)&&a.push(f.text),r[r.length-1]=s+1);return e.filter(function(t){return 0<t.length}).reduce(function(t,n){return t.concat(n)},[])}function k(t){return t.type===h.TokenType.FunctionArgumentSeparator}function g(t){return t.type===h.TokenType.FunctionName}function w(t){return t.type===h.TokenType.FunctionCallStart}function b(t){return t.type===h.TokenType.FunctionCallEnd}function M(t){return t.type===h.TokenType.SubExpressionStart}function x(t){return t.type===h.TokenType.SubExpressionEnd}function S(t){return t.type===h.TokenType.FormulaStart}function C(t){return t.type===h.TokenType.Unknown}function j(t){return C(t)&&T(t.text)===c.LEFT_PARENTHESES}function P(t){return C(t)&&T(t.text)===c.RIGHT_PARENTHESES}function O(t){return E(t)||D(t)}function _(t){return t.type===h.TokenType.OperatorInfix}function F(t){return t.type===h.TokenType.OperatorPrefix}function N(t){return t.type===h.TokenType.Whitespace}function E(t){return t.type===h.TokenType.Name}function A(t){return t.type===h.TokenType.OperatorPostfix&&"#"===t.text}function D(t){return t.type===h.TokenType.CellReference}function R(t){return O(t)&&t.ranges&&0<t.ranges.length}function I(t){for(var n,i,n=0,i=0;i<t.length&&t[i]===c.WHITESPACE;i++)n++;return n}function U(t,n,i){var t,e,r,o,u,s;for(void 0===i&&(i=4),t=I(t),e=[],r=function(){return 0===e.length},o=function(){return e[e.length-1]},u=0;u<n.length;u++)w(s=n[u])||M(s)?e.push(s):b(s)?!r()&&w(o())&&e.pop():x(s)&&!r()&&M(o())&&e.pop();return 0<e.length&&(t+=i),t}function T(t){return t.replace(/\s+/g,"")}function H(t,n){for(var i,e,r,o,u,s,a,i=[],e=[],r=l(),o=!1,u=0;u<t.length;u++)(a=z(s=t[u],o,r))===h.TokenType.ArrayConstStart?(e.push(a),o=!0):a===h.TokenType.FunctionCallStart?(e.push(a),o=!1):a!==h.TokenType.FunctionCallEnd&&a!==h.TokenType.ArrayConstEnd||(e.pop(),o=(0,c.lastItem)(e)===h.TokenType.ArrayConstStart),i.push({type:a,index:s.index,endIndex:s.endIndex,text:s.text,ranges:s.ranges,canDrag:s.canDrag,colorIndex:s.colorIndex});return W(V(i),n)}function z(t,n,i){var e,r,o,e=t.type,r=t.subType,o=t.text.trim();return 1===e?1===r?"ARRAY"===o?h.TokenType.ArrayConstStart:"@"===o||o===c.LEFT_PARENTHESES?h.TokenType.FunctionCallStart:h.TokenType.FunctionName:2===r?o!==c.RIGHT_PARENTHESES&&n?h.TokenType.ArrayConstEnd:h.TokenType.FunctionCallEnd:(0,u.Df)(o)?h.TokenType.FormulaStart:void 0:3!==e?4===e?h.TokenType.OperatorPrefix:5===e?h.TokenType.OperatorInfix:6===e?h.TokenType.OperatorPostfix:0===e?5===r?h.TokenType.LogicalConst:4===r?h.TokenType.NumberConst:3===r?h.TokenType.StringConst:6===r?h.TokenType.ErrorConst:7===r||12===r?t.isName?h.TokenType.Name:h.TokenType.CellReference:h.TokenType.StringConst:2===e?1===r?h.TokenType.SubExpressionStart:2===r?h.TokenType.SubExpressionEnd:void 0:7===e?h.TokenType.Whitespace:h.TokenType.Unknown:0===r?n&&o===i.arrayListSeparator?h.TokenType.ArrayConstItemSeparator:n&&o===i.arrayGroupSeparator?h.TokenType.ArrayConstRowSeparator:h.TokenType.FunctionArgumentSeparator:void 0}function W(t,n){for(var i,e,r,o,i=t.length-2;0<i;i--)e=t[i],A(r=t[i+1])&&D(e)&&R(e)&&(o=new a.CalcReference(n,e.ranges).getSpillRef())&&o.$gt&&(e.text+=r.text,e.endIndex=r.endIndex,e.ranges=o.$gt,t.splice(i+1,1));return t}function V(t){for(var n,i,e,r,o,u,s,r,n=[],i=0;i<t.length;i++)$((e=t[i]).type)&&(r=e.text.match(/^(\s*)(\S+)(\s*)$/))&&4===r.length&&(o=r[0],u=r[1],s=r[2],r=r[3],u||r)?(u&&(e.index+=u.length,e.text=e.text.substring(u.length),n.push(L(e.index,u))),n.push(e),r&&(e.endIndex-=r.length,e.text=e.text.substring(0,s.length),n.push(L(e.endIndex+1,r)))):n.push(e);return n}function $(t){return t===h.TokenType.FunctionCallStart||t===h.TokenType.FunctionCallEnd||t===h.TokenType.ArrayConstStart||t===h.TokenType.ArrayConstEnd}function L(t,n){return{type:h.TokenType.Whitespace,index:t,endIndex:t+n.length-1,text:n}}function q(){return a.Functions.findGlobalFunctions()}Object.defineProperty(t,"__esModule",{value:!0}),t.getGlobalFunctions=t.removeWhiteSpace=t.getIndentByPreviousText=t.getLineIndent=t.hasReferenceRanges=t.isReferenceToken=t.isAnchorOperatorToken=t.isNameToken=t.isWhitespaceToken=t.isPrefixOperatorToken=t.isInfixOperatorToken=t.isReferenceOrNameToken=t.isRightParenthesesToken=t.isLeftParenthesesToken=t.isNothingOperandToken=t.isFormulaStartToken=t.isSubExpressionEndToken=t.isSubExpressionStartToken=t.isFunctionCallEndToken=t.isFunctionCallStartToken=t.isFunctionCallToken=t.isFunctionArgumentSeparator=t.getLocalSymbol=t.includeToken=t.isInToken=t.getTokenByPos=t.getActiveParameterInSignatureTip=t.getActiveParameterInParameterResources=t.getSignatureStatus=t.getCultureInfo=t.parseToTokens=t.unparse=t.parse=void 0,a=n("CalcEngine"),u=n("Core"),f=n("SheetsCalc"),h=n("./dist/plugins/formulaPanel/editor/interface.js"),c=n("./dist/plugins/formulaPanel/editor/common/util.js"),t.parse=i,t.unparse=e,t.parseToTokens=r,t.getCultureInfo=l,t.getSignatureStatus=o,t.getActiveParameterInParameterResources=s,t.getActiveParameterInSignatureTip=v,t.getTokenByPos=d,t.isInToken=y,t.includeToken=m,t.getLocalSymbol=p,t.isFunctionArgumentSeparator=k,t.isFunctionCallToken=g,t.isFunctionCallStartToken=w,t.isFunctionCallEndToken=b,t.isSubExpressionStartToken=M,t.isSubExpressionEndToken=x,t.isFormulaStartToken=S,t.isNothingOperandToken=C,t.isLeftParenthesesToken=j,t.isRightParenthesesToken=P,t.isReferenceOrNameToken=O,t.isInfixOperatorToken=_,t.isPrefixOperatorToken=F,t.isWhitespaceToken=N,t.isNameToken=E,t.isAnchorOperatorToken=A,t.isReferenceToken=D,t.hasReferenceRanges=R,t.getLineIndent=I,t.getIndentByPreviousText=U,t.removeWhiteSpace=T,t.getGlobalFunctions=q},"./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js":function(L,t,n){var i,r,e,o,u,s,a,f,h,c;function l(t){return t.field(o.tokenField)}function v(t){return t.doc.toJSON().join("\n")}function d(t){return t.field(o.providerField).getFunctions()}function y(t,n){return(0,u.findFunction)(d(t),n)}function m(t){return d(t).map(u.convertToFunctionResource)}function p(t,n){return(0,u.findFunctionResource)(m(t),n)}function k(t){return t.field(o.customNamesField)}function g(t,n){return n=n.toUpperCase(),k(t).find(function(t){return t.getName().toUpperCase()===n})}function w(t){var n,t,t,n,t=t.field(o.themeField).rules.find(function(t){return t.token===e.SyntaxHighlightingTokenType.reference}),t=t?t.color:"black";return Array.isArray(t)?t:[t]}function b(t,n,i){return t.find(function(t){return(0,s.isInToken)(t,n,!0,!0)&&M(t,i)})}function M(t,n){var t=C(t.text,n);return t&&t.type===r.ExpressionType.reference}function x(t){var n,i,t,n,n=t.field(o.calcServiceField),i=t.field(o.calcSourceField),t=t.field(o.activeCellField),n=n.getParserContext(i);return n.row=t.row,n.column=t.col,n}function S(t,n){var i,e,r,e;return t.field(o.isFormulaField)?(i=t.field(o.calcSourceField),r=(e=t.field(o.activeCellField)).row,e=e.col,(0,s.parseToTokens)(n,i,r,e,x(t))):[]}function C(t,n,i){void 0===i&&(i=!1);var n=x(n);return(0,s.parse)(t,new r.Parser,n,!i)}function j(t,n){var n=x(n);return(0,s.unparse)(t,new r.Parser,n)}function P(t){return t.field(o.optionsField)}function O(t){var t=P(t);return c(t.tabSize)?h.DEFAULT_TAB_SIZE:t.tabSize}function E(t){var t=P(t);return c(t.formatWidthLimit)?h.DEFAULT_FORMAT_WIDTH_LIMIT:t.formatWidthLimit}function A(t){return u.WHITESPACE.repeat(O(t))}function D(t){var t=t.field(o.calcSourceField).Mf;if(t)return(0,a.Kde)(t.parent)||t}function R(t){return t.selection.main}function I(t){return t.field(o.providerField).getStructReferences()}function T(t,n,i){var e,t,n,i;return n===i||!!((0,f.kf)(n)&&(0,f.kf)(i)&&(e=new r.Parser,t=x(t),n=(0,s.unparse)((0,s.parse)(n,e,t,!1,!1),e,t),i=(0,s.unparse)((0,s.parse)(i,e,t,!1,!1),e,t),n)&&i&&n===i)}Object.defineProperty(t,"__esModule",{value:!0}),t.isSameFormula=t.getStructReferencesByState=t.getSelection=t.getActiveSheetByState=t.getOneIndentSpaceByState=t.getFormatWidthLimitByState=t.getTabSizeByState=t.getOptionsByState=t.unparseToText=t.parseToExpressionTree=t.parseToTokens=t.getParseContextByState=t.isValidReferenceToken=t.getValidReferenceTokenByPos=t.getReferenceTokenColors=t.getCustomNameByState=t.getCustomNamesByState=t.getFunctionResourceByState=t.getFunctionResourcesByState=t.getFunctionByState=t.getFunctionsByState=t.getTextByState=t.getTokensByState=void 0,i=n("Common"),r=n("CalcEngine"),e=n("./dist/plugins/formulaPanel/editor/interface.js"),o=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),u=n("./dist/plugins/formulaPanel/editor/common/util.js"),s=n("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),a=n("./dist/plugins/formulaPanel/editor/common/spreadUtil.js"),f=n("Core"),h=n("./dist/plugins/formulaPanel/editor/common/const.js"),c=i.Common.lt.ht,t.getTokensByState=l,t.getTextByState=v,t.getFunctionsByState=d,t.getFunctionByState=y,t.getFunctionResourcesByState=m,t.getFunctionResourceByState=p,t.getCustomNamesByState=k,t.getCustomNameByState=g,t.getReferenceTokenColors=w,t.getValidReferenceTokenByPos=b,t.isValidReferenceToken=M,t.getParseContextByState=x,t.parseToTokens=S,t.parseToExpressionTree=C,t.unparseToText=j,t.getOptionsByState=P,t.getTabSizeByState=O,t.getFormatWidthLimitByState=E,t.getOneIndentSpaceByState=A,t.getActiveSheetByState=D,t.getSelection=R,t.getStructReferencesByState=I,t.isSameFormula=T},"./dist/plugins/formulaPanel/editor/common/const.js":function(t,n,i){var e,r,o,i;function u(){var t=new e.CalcService;return t.addResolver(new r.SheetReferenceResolver),t.addResolver(new r.StructureReferenceResolver),t}Object.defineProperty(n,"__esModule",{value:!0}),n.defaultTheme=n.defaultSyntaxHighlighRules=n.DEFAULT_ACTIVE_CELL_INFO=n.DEFAULT_FORMULA_EDITOR_OPTIONS=n.defaultCalcSource=n.defaultCalcService=n.DEFAULT_PROVIDER=n.DEFAULT_FORMAT_WIDTH_LIMIT=n.DEFAULT_TAB_SIZE=void 0,e=i("CalcEngine"),r=i("SheetsCalc"),o=i("./dist/plugins/formulaPanel/editor/interface.js"),i=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n.DEFAULT_TAB_SIZE=4,n.DEFAULT_FORMAT_WIDTH_LIMIT="auto",n.DEFAULT_PROVIDER={getStructReferences:function(){return[]},getFunctions:i.getGlobalFunctions},n.defaultCalcService=u(),n.defaultCalcSource=new e.CalcSource(n.defaultCalcService),n.DEFAULT_FORMULA_EDITOR_OPTIONS={formatWidthLimit:n.DEFAULT_FORMAT_WIDTH_LIMIT,tabSize:n.DEFAULT_TAB_SIZE},n.DEFAULT_ACTIVE_CELL_INFO={row:0,col:0},n.defaultSyntaxHighlighRules=[{token:o.SyntaxHighlightingTokenType.stringConst,color:"#CC1C1C"},{token:o.SyntaxHighlightingTokenType.errorConst,color:"#CC1C1C"},{token:o.SyntaxHighlightingTokenType.numberConst,color:"#088000"},{token:o.SyntaxHighlightingTokenType.booleanConst,color:"#088000"},{token:o.SyntaxHighlightingTokenType.function,color:"#1C1CFF"},{token:o.SyntaxHighlightingTokenType.argumentSeparator,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.operatorPrefix,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.operatorInfix,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.operatorPostfix,color:"#FF0000"},{token:o.SyntaxHighlightingTokenType.reference,color:["#0000ff","#008000","#9900cc","#800000","#00cc33","#cc6600","#cc0099"]}],n.defaultTheme={rules:n.defaultSyntaxHighlighRules}},"./dist/plugins/formulaPanel/editor/common/formatter.js":function(t,n,i){var r,v,o,d,y,m;function e(t,n){var i,e,t,e,i=new v.Parser,e=n.parseContext,t=(0,o.parse)(t,i,e,!1,!1);if(t)return e=r(r({parser:i,oneIndentTab:d.WHITESPACE.repeat(n.tabSize)},n),(0,o.getCultureInfo)()),d.EQUAL+p(t,0,e,d.EQUAL)}function p(t,n,i,e,r,o){var u,u,s;return void 0===e&&(e=""),void 0===r&&(r=""),void 0===o&&(o=!0),t?(u=h(t,i),S(u=x(n,i,o)+u,i,e,r)&&((s=t.type)===v.ExpressionType.operator?u=a(t,n,i,e,r,o):s===v.ExpressionType.function?u=f(t,n,i,e,r,o):s===v.ExpressionType.parentheses?u=w(t,n,i,o):s===v.ExpressionType.array&&(u=k(t,n,i,o))),u):""}function h(t,n){var i,e;return t?(i=t.type)===v.ExpressionType.operator?u(t,n):i===v.ExpressionType.function?l(t,n):i===v.ExpressionType.parentheses?d.LEFT_PARENTHESES+h(t.value,n)+d.RIGHT_PARENTHESES:(i===v.ExpressionType.array?g:b)(t,n):""}function a(t,n,i,e,r,o){var u,s,u,a,o,f,u=t.operatorType,s=E(u),u=P(u)?x(n,i,o)+s+p(t.value,n,i,e,r,!1):2===u?p(t.value,n,i,e,s+r,o)+s:18===u?c(t,n,i,o):A(u)?(o=e+(a=p(t.value,n,i,e,d.WHITESPACE+s+m+r))+d.WHITESPACE+s,S(f=h(t.value2,i),i,o+d.WHITESPACE,r)?(f=p(t.value2,n+1,i,o+m,r),a+d.WHITESPACE+s+m+f):a+d.WHITESPACE+s+d.WHITESPACE+f):(a=p(t.value,n,i,e,r))+s+(f=p(t.value2,n,i,e+a+s,r,!1));return u}function u(t,n){var i,e,t,r,o,i=t.operatorType,e=E(i),t=P(i)?e+h(t.value,n):2===i?h(t.value,n)+e:(r=h(t.value,n),o=h(t.value2,n),18===i?s(t,n):A(i)?r+d.WHITESPACE+e+d.WHITESPACE+o:r+e+o);return t}function c(t,n,i,e){return x(n,i,e)+b(t,i)}function s(t,n){return b(t,n)}function f(t,n,i,e,r,o){var u,s,a,f,h,c,l,u=x(n,i,o),s=(0,v.isFunction)(t.function)&&t.function.name||t.functionName;if(s===y)return p(t.arguments[0],n,i,e,"#"+r,o)+"#";if("@"===s)return u+"@"+p(t.arguments[0],n,i,e+u+"@",r,!1);if(a=!s&&t.function instanceof v.Expression?p(t.function,n,i,e,r,o)+d.LEFT_PARENTHESES:u+s+d.LEFT_PARENTHESES,0===(h=(f=t.arguments||[]).length))return a+d.RIGHT_PARENTHESES;for(a+=m,c=0;c<h;c++)a+=p(l=f[c],n+1,i),c!==h-1&&(a+=i.listSeparator),a+=m;return a+x(n,i)+d.RIGHT_PARENTHESES}function l(t,n){var i,e,r,o,u,s,i=(0,v.isFunction)(t.function)&&t.function.name||t.functionName;if(i===y)return h(t.arguments[0],n)+"#";if("@"===i)return"@"+h(t.arguments[0],n);for(e=!i&&t.function instanceof v.Expression?h(t.function,n)+d.LEFT_PARENTHESES:D(i)+d.LEFT_PARENTHESES,o=(r=t.arguments||[]).length,u=0;u<o;u++)e+=h(s=r[u],n),u!==o-1&&(e+=n.listSeparator+d.WHITESPACE);return e+d.RIGHT_PARENTHESES}function k(t,n,i,e){for(var r,o,u,t,s,a,f,h,r=t.value,o=r.getRowCount(),u=r.getColumnCount(),t=x(n,i,e),s=x(n+1,i),a=t+d.LEFT_CURLY_BRACKETS+m,f=0;f<o;f++){for(a+=s,h=0;h<u;h++)a+=M(r.getValue(f,h),i),h!==u-1&&(a+=i.arrayListSeparator+d.WHITESPACE);f!==o-1&&(a+=i.arrayGroupSeparator),a+=m}return a+x(n,i)+d.RIGHT_CURLY_BRACKETS}function g(t,n){for(var i,e,r,o,u,s,i=t.value,e=i.getRowCount(),r=i.getColumnCount(),o=d.LEFT_CURLY_BRACKETS,u=0;u<e;u++){for(s=0;s<r;s++)o+=M(i.getValue(u,s),n),s!==r-1&&(o+=n.arrayListSeparator+d.WHITESPACE);u!==e-1&&(o+=n.arrayGroupSeparator+d.WHITESPACE)}return o+d.RIGHT_CURLY_BRACKETS}function w(t,n,i,e){var t,r,t=p(t.value,n+1,i),r;return x(n,i,e)+d.LEFT_PARENTHESES+m+t+m+x(n,i)+d.RIGHT_PARENTHESES}function b(t,n){var i=[];return n.parser.unparse(n.parseContext,t,i),i.join("")}function M(t,n){var i,i;return"string"==typeof t?i=v.ExpressionType.string:"boolean"==typeof t?i=v.ExpressionType.boolean:"number"==typeof t&&(i=v.ExpressionType.number),void 0===i?t.toString():((i=new v.Expression(i)).value=t,b(i,n))}function x(t,n,i){return(i=void 0===i?!0:i)?n.oneIndentTab.repeat(t):""}function S(t,n,i,e){var i;return t.trim().length>n.widthLimit||(i=C(i)+t+j(e),n.measureTextFunc(i)>n.lineWidthLimit)}function C(t){var n=t.lastIndexOf(m);return-1===n?t:t.substring(n+1)}function j(t){var n=t.indexOf(m);return-1===n?t:t.substring(0,n)}function P(t){return 0===t||1===t}function O(t){return 2===t}function E(t){return v.Z9t[t]}function A(t){return 15!==t&&16!==t&&17!==t&&18!==t}function D(t){var n,n,n=(0,v.getMapping)()&&(0,v.getMapping)().builtInFunctionsMapping,n=n&&n[t];return t=n&&n.alias?n.alias:t}r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var n,i,e,r,i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},Object.defineProperty(n,"__esModule",{value:!0}),n.format=void 0,v=i("CalcEngine"),o=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),d=i("./dist/plugins/formulaPanel/editor/common/util.js"),y="ANCHORARRAY",m="\n",n.format=e},"./dist/plugins/formulaPanel/editor/common/spreadUtil.js":function(t,n,i){var e,r;function o(t){if(t)return(0,e.jf)(t)}function u(t){var i,n,e,i=(0,r.getGlobalFunctions)(),n=function(n){Object.keys(n).forEach(function(t){i.push(n[t])})};return t&&(n(t.Amt),(e=o(t))&&n(e.Amt),t.options.allowDynamicArray||(i=i.filter(function(t){return!t.isDynamicArrayFunction}))),i}Object.defineProperty(n,"__esModule",{value:!0}),n.getFunctionsByWorkbook=n.Kde=void 0,e=i("Core"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n.Kde=o,n.getFunctionsByWorkbook=u},"./dist/plugins/formulaPanel/editor/common/util.js":function(t,n,i){var u,e,i,e,r;function o(t){var n,n=(n=t.description())&&s(n);return{name:t.name,description:null==n?void 0:n.description,parameters:null==n?void 0:n.parameters}}function s(t){for(var n,i,e,r,o,n=[],i=t.parameters||[],e=0;e<i.length;e++)(o=2<(r=u({},i[e])).name.length&&r.name.startsWith("[")&&r.name.endsWith("]"))&&(r.optional=!0,r.name=r.name.substring(1,r.name.length-1)),r.repeatable&&(r.optional=!0),n.push(r);return u(u({},t),{parameters:n})}function a(t,n){return n=n.toUpperCase(),(t||[]).find(function(t){return t.name.toUpperCase()===n})}function f(t,n){return n=n.toUpperCase(),(t||[]).find(function(t){return t.name.toUpperCase()===n})}function h(t){return t&&0!==t.length?t.map(c).join(", "):""}function c(t){var n=t.name;return t.optional&&(n="["+n+"]"),n=t.repeatable?"..."+n:n}function l(t){var n=t.name;return t.repeatable&&(n+=", ..."),n=t.optional?"["+n+"]":n}function v(t){return"".concat(t.name,"(").concat(h(t.parameters),")")}function d(t){return"(".concat(r().FORMULA," ").concat(v(t))}function y(t){return t[t.length-1]}function m(t){return"gc-formula-editor-tooltip-help-function-"+t}function p(t,n){var e,i,r,o,u,s,e=document.createElement("p");for(e.className=m("title"),(i=function(t,n){var i=document.createElement("span");return i.className=n,i.textContent=t,e.appendChild(i),i})(t.name,(r=function(t){return m("title-"+t)})("function-name")),i("(",r("parentheses")),o=t.parameters||[],u=0;u<o.length;u++)s=r("parameter"),void 0!==n&&n===u&&(s+=" "+r("active-parameter")),i(l(o[u]),s),u!==o.length-1&&i(",",r("parameter-separator"));return i(")",r("parentheses")),e}function k(t){var n=document.createElement("p");return n.textContent=t,n.className=m("description"),n}u=this&&this.__assign||function(){return(u=Object.assign||function(t){for(var n,i,e,r,i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},Object.defineProperty(n,"__esModule",{value:!0}),n.createHelpFunctionDescriptionDom=n.createHelpFunctionTitleDom=n.lastItem=n.getFunctionHoverTitle=n.getFunctionSignatureString=n.getParameterString=n.getParameterListString=n.findFunctionResource=n.findFunction=n.normalizeFunctionDescription=n.convertToFunctionResource=n.END_OF_LINE=n.WHITESPACE=n.RIGHT_CURLY_BRACKETS=n.LEFT_CURLY_BRACKETS=n.RIGHT_PARENTHESES=n.LEFT_PARENTHESES=n.SEMICOLON=n.COMMA=n.FULL_STOP=n.EQUAL=void 0,e=i("Common"),i=i("./dist/plugins/formulaPanel/editor/editor.ns.js"),e=new e.Common.ResourceManager(i.SR,"formulaEditor"),r=e.getResource.bind(e),n.EQUAL="=",n.FULL_STOP=".",n.COMMA=",",n.SEMICOLON=";",n.LEFT_PARENTHESES="(",n.RIGHT_PARENTHESES=")",n.LEFT_CURLY_BRACKETS="{",n.RIGHT_CURLY_BRACKETS="}",n.WHITESPACE=" ",n.END_OF_LINE="\r\n",n.convertToFunctionResource=o,n.normalizeFunctionDescription=s,n.findFunction=a,n.findFunctionResource=f,n.getParameterListString=h,n.getParameterString=c,n.getFunctionSignatureString=v,n.getFunctionHoverTitle=d,n.lastItem=y,n.createHelpFunctionTitleDom=p,n.createHelpFunctionDescriptionDom=k},"./dist/plugins/formulaPanel/editor/editor.ns.js":function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SR=void 0;var i=i("./dist/plugins/formulaPanel/editor/editor.res.en.js");n.SR={en:i}},"./dist/plugins/formulaPanel/editor/editor.res.en.js":function(t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.FORMULA=n.INVALID_FORMULA=n.INVALID_EXPRESSION=n.DUPLICATE_IDENTIFIER=n.INVALID_IDENTIFIER_ARGUMENT=n.NO_MATCHED_ARGUMENTS=n.UNKNOWN_SHEET=n.UNKNOWN_NAME=n.MISS_LET_FUNCTION_BODY=n.MISS_RIGHT_PARENTHESES=n.NO_MATH_PARENTHESES=void 0,n.NO_MATH_PARENTHESES="No match parentheses",n.MISS_RIGHT_PARENTHESES="')' is expected.",n.MISS_LET_FUNCTION_BODY="Missing body of LET expression.",n.UNKNOWN_NAME="Unknown name",n.UNKNOWN_SHEET='Unknown sheet "$1"',n.NO_MATCHED_ARGUMENTS="Expected $1 arguments, but got $2",n.INVALID_IDENTIFIER_ARGUMENT="This argument must be an identifier to bind.",n.DUPLICATE_IDENTIFIER="Duplicate identifier $1",n.INVALID_EXPRESSION="Invalid EXPRESSION",n.INVALID_FORMULA="Invalid Formula",n.FORMULA="Formula"},"./dist/plugins/formulaPanel/editor/featureProvider/completion.js":function(t,n,i){var h,c,r,o,l,u,s,i;function a(n,t){var i,t,i,t,i=(0,r.getSignatureStatus)((0,o.getTokensByState)(t.state),t.pos);i&&(t=(0,o.getFunctionResourceByState)(t.state,i.functionName))&&(i=(0,r.getActiveParameterInSignatureTip)(i.activeParameter,t),t=t.parameters&&t.parameters[i])&&t.enum&&t.enum.forEach(function(t){n.push({label:t.value,detail:t.description,type:"enum",apply:t.value})})}function f(n,t){var i,t,e,i=t.state,t=t.pos,e;(0,r.getLocalSymbol)((0,o.getTokensByState)(i),t).forEach(function(t){n.push({label:t,type:"variable",apply:t})})}function v(n,t){var i;(0,o.getCustomNamesByState)(t.state).forEach(function(t){n.push({label:t.getName(),detail:t.getComment()||"",type:"constant",apply:t.getName()})})}function d(n,t){var i;(0,o.getFunctionResourcesByState)(t.state).forEach(function(t){t.description&&n.push({label:t.name,detail:t.description,type:"function",apply:e})})}function e(t,n,e,r){var o,u,s,a,f,n,o=t.state,u=o.selection.main,s=e-u.from,a=r-u.from,f=n.label,n=o.changeByRange(function(t){var n,i,n=t.from+s,i=t.from+a;return t!==u&&e!==r&&o.sliceDoc(n,i)!==o.sliceDoc(e,r)?{range:t}:{changes:{from:n,to:r===u.from?t.to:i,insert:f+"()"},range:c.State.EditorSelection.cursor(n+f.length+1)}});t.dispatch(h(h({},n),{userEvent:"input.complete",effects:l.triggerSignatureTooltip.of(null)}))}function y(t){return(0,o.getStructReferencesByState)(t.state).map(p)}function m(t,n){var i,i,e,n,i=t.selection.main.head,i=n.text.substring(0,i-n.index);return i&&"["===i[i.length-1]&&(e=i.substring(0,i.length-1),n=(0,o.getStructReferencesByState)(t).find(function(t){return t.name===e}))?n.getColumns().map(p):[]}function p(t){return{label:t.name,detail:t.description,type:"variable"}}function k(t){var n,t,n=t.state.selection.main.head,t=(0,o.getTokensByState)(t.state);return(0,r.getTokenByPos)(t,n,!1,!0)}function g(t){var n,i,e,r,n;return!t.state.field(u.isFormulaField)||(i=k(t))&&i.type===s.TokenType.StringConst?null:(e=t.matchBefore(/[\w.]*/),(r=[]).push.apply(r,m(t.state,i)),a(r,t),e&&e.from===e.to||(f(r,t),d(r,t),v(r,t),r.push.apply(r,y(t))),{from:e?e.from:t.pos,options:r})}h=this&&this.__assign||function(){return(h=Object.assign||function(t){for(var n,i,e,r,i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)},Object.defineProperty(n,"__esModule",{value:!0}),n.autoCompletionExtensions=void 0,c=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),l=i("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),u=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),s=i("./dist/plugins/formulaPanel/editor/interface.js"),i=c.Autocomplete.autocompletion,n.autoCompletionExtensions=i({override:[g]})},"./dist/plugins/formulaPanel/editor/featureProvider/customField.js":function(t,n,i){var e,r,o,u,s,a,i;function f(t,o){return a.define({create:t,update:function(t,n){for(var i,e,r,i=0,e=n.effects;i<e.length;i++)if((r=e[i]).is(o))return r.value;return t}})}function h(t){return!!t.docChanged||t.effects.some(function(t){return t.is(n.setCalcServiceField)||t.is(n.setCalcSourceField)||t.is(n.setCustomNamesField)||t.is(n.setProviderField)||t.is(n.setActiveCellField)||t.is(n.rebuildFormulaEffect)})}Object.defineProperty(n,"__esModule",{value:!0}),n.needRebuildToken=n.customFields=n.isFormattedFormulaField=n.isFormulaField=n.themeField=n.setThemeField=n.optionsField=n.setOptionsField=n.tokenField=n.rebuildFormulaEffect=n.providerField=n.setProviderField=n.customNamesField=n.setCustomNamesField=n.activeCellField=n.setActiveCellField=n.calcSourceField=n.setCalcSourceField=n.calcServiceField=n.setCalcServiceField=void 0,e=i("Core"),r=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=i("./dist/plugins/formulaPanel/editor/common/const.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/formatter.js"),a=r.State.StateField,i=r.State.StateEffect,n.setCalcServiceField=i.define(),n.calcServiceField=f(function(){return u.defaultCalcService},n.setCalcServiceField),n.setCalcSourceField=i.define(),n.calcSourceField=f(function(){return u.defaultCalcSource},n.setCalcSourceField),n.setActiveCellField=i.define(),n.activeCellField=f(function(){return u.DEFAULT_ACTIVE_CELL_INFO},n.setActiveCellField),n.setCustomNamesField=i.define(),n.customNamesField=f(function(){return[]},n.setCustomNamesField),n.setProviderField=i.define(),n.providerField=f(function(){return u.DEFAULT_PROVIDER},n.setProviderField),n.rebuildFormulaEffect=i.define(),n.tokenField=a.define({create:function(t){return(0,o.parseToTokens)(t,(0,o.getTextByState)(t))},update:function(t,n){return h(n)?(0,o.parseToTokens)(n.state,(0,o.getTextByState)(n.state)):t}}),n.setOptionsField=i.define(),n.optionsField=f(function(){return u.DEFAULT_FORMULA_EDITOR_OPTIONS},n.setOptionsField),n.setThemeField=i.define(),n.themeField=f(function(){return u.defaultTheme},n.setThemeField),n.isFormulaField=a.define({create:function(t){return(0,e.kf)((0,o.getTextByState)(t))},update:function(t,n){return n.docChanged?(0,e.kf)((0,o.getTextByState)(n.state)):t}}),n.isFormattedFormulaField=a.define({create:function(){return!0},update:function(t,n){return n.docChanged?!!n.annotation(s.formatDocumentAnnotation):t}}),n.customFields=[n.optionsField,n.themeField,n.isFormulaField,n.isFormattedFormulaField,n.activeCellField,n.calcServiceField,n.calcSourceField,n.customNamesField,n.providerField,n.tokenField],n.needRebuildToken=h},"./dist/plugins/formulaPanel/editor/featureProvider/dbClickRangeSelector.js":function(t,n,i){var e,o,u,s,a;Object.defineProperty(n,"__esModule",{value:!0}),n.doubleClickSelectRangeExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),u=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),a=e.State.EditorSelection,n.doubleClickSelectRangeExtension=e.View.EditorView.mouseSelectionStyle.of(function(e,t){var n,i,r,n;return!e.state.field(s.isFormulaField)||2!==t.detail||0!==t.button||null===(i=e.posAtCoords(t))?null:(r=e.state.selection,{get:function(t,n,i){var t,t,t,t=e.posAtCoords(t);return null!==t&&(t=(0,o.getTokenByPos)((0,u.getTokensByState)(e.state),t))?(t=a.range(t.index,t.endIndex+1),i?r.addRange(t):a.create([t])):r},update:function(t){i=t.changes.mapPos(i),r=r.map(t.changes)}})})},"./dist/plugins/formulaPanel/editor/featureProvider/folding.js":function(t,n,i){var e,h;Object.defineProperty(n,"__esModule",{value:!0}),n.foldExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),h=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n.foldExtension=e.Language.foldService.of(function(t,n,i){for(var e,r,o,n,u,s,a,f,e=t.doc.lineAt(n),r=t.doc.lines,o=(0,h.getLineIndent)(e.text),n=n,u=i,s=e.number+1;s<r&&(a=t.doc.line(s),o<(f=(0,h.getLineIndent)(a.text)));s++)u=a.to;return t.doc.lineAt(n).number===t.doc.lineAt(u).number?null:{from:n=e.to,to:u}})},"./dist/plugins/formulaPanel/editor/featureProvider/formatter.js":function(t,a,n){var i,f,h,c,l,v,e;function d(t,n,i,e){var r,o,u,t,r=s(t),o=s(n),u=n.length,t=function(t,n){var i,e;for(t-=r[t],i=0;i<o.length;i++){if((e=i-o[i])===t&&!n){t=i;break}if(t<e){t=i-1;break}}return t<=u&&0<=t?t:0};return i===e?i=e=t(e,!1):(i=t(i,!0),e=t(e,!1)),[i,e]}function s(t){for(var n,i,e,r,n=function(t){return" "===t||"\n"===t},i=[0],e=1;e<=t.length;e++)r=i[e-1],i.push(r+(n(t[e-1])?1:0));return i}function y(t){var n,i,e,t,t,n,i,e=r(t.scrollDOM.getBoundingClientRect(),t.contentDOM.getBoundingClientRect()),t=t.contentDOM.querySelector(".cm-line");return t&&(t=window.getComputedStyle(t),e-=parseInt(t.paddingLeft,10)+parseInt(t.paddingRight,10)),e}function r(t,n){var i,e,t,i=Math.max(t.left,n.left),e,t=Math.min(t.right,n.right)-i;return 0<=t?t:0}function m(t){var n,t,i,e,n,t=window.getComputedStyle(t.contentDOM).font,i,e=document.createElement("canvas").getContext("2d");return e.font=t,function(t){return e.measureText(t).width}}Object.defineProperty(a,"__esModule",{value:!0}),a.formatDocumentCommand=a.formatDocumentAnnotation=void 0,i=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),f=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),h=n("./dist/plugins/formulaPanel/editor/common/formatter.js"),c=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),l=n("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),v=Number.MAX_SAFE_INTEGER,a.formatDocumentAnnotation=i.State.Annotation.define(),a.formatDocumentCommand=e=function(t){var n,i,e,r,o,u,s,i,e,r,o,n;return!!t.state.field(c.isFormulaField)&&(i=(0,f.getTabSizeByState)(t.state),e=(0,f.getFormatWidthLimitByState)(t.state),r=v,o=function(t){return 0},"auto"===e&&(r=y(t),e=v,o=m(t)),u=t.state.selection.main,i={absoluteReference:!1,parseContext:s=(0,f.getParseContextByState)(t.state),tabSize:i,widthLimit:e,lineWidthLimit:r,measureTextFunc:o},e=(0,f.getTextByState)(t.state),void 0!==(r=(0,h.format)(e,i)))&&(e!==r&&(o=d(e,r,u.from,u.to),t.dispatch({changes:{from:0,to:t.state.doc.length,insert:r},selection:{anchor:o[0],head:o[1]},annotations:[l.notTriggerSignatureTooltip.of(!0),a.formatDocumentAnnotation.of(!0)]})),!0)}},"./dist/plugins/formulaPanel/editor/featureProvider/hoverTooltips.js":function(t,n,i){var e,o,u,s,a;Object.defineProperty(n,"__esModule",{value:!0}),n.hoverTooltipExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),u=i("./dist/plugins/formulaPanel/editor/common/util.js"),s=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),a=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),n.hoverTooltipExtension=e.View.hoverTooltip(function(t,n){var i,e,e,n,r,i;return!t.state.field(a.isFormulaField)||(e=(0,s.getTokensByState)(t.state),!(e=(0,o.getTokenByPos)(e,n)))||(n=[],r=(0,s.getFunctionResourceByState)(t.state,e.text),(0,o.isFunctionCallToken)(e)&&r&&(n.push((0,u.getFunctionHoverTitle)(r)),r.description)&&n.push(r.description),0===n.length)?null:{pos:e.index,end:e.endIndex+1,above:!0,create:function(){var t=document.createElement("div");return t.className="gc-formula-editor-tooltip-help-function",t.appendChild((0,u.createHelpFunctionTitleDom)(r)),r.description&&t.appendChild((0,u.createHelpFunctionDescriptionDom)(r.description)),{dom:t}}}})},"./dist/plugins/formulaPanel/editor/featureProvider/indent.js":function(t,n,i){var e,r,o;Object.defineProperty(n,"__esModule",{value:!0}),n.indentExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),o=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),n.indentExtension=e.Language.indentService.of(function(t,n){var n;return!(n<=0)&&(n=t.lineAt(n-1))&&n.text?(0,r.getIndentByPreviousText)(n.text,(0,o.getTokensByState)(t.state)):0})},"./dist/plugins/formulaPanel/editor/featureProvider/lint.js":function(t,n,i){var e,r,o,s,h,c,a,u,f,i,l;function v(t,n){return l().NO_MATCHED_ARGUMENTS.replace("$1",t+"").replace("$2",n+"")}function d(t){return l().UNKNOWN_SHEET.replace("$1",t)}function y(t){return l().DUPLICATE_IDENTIFIER.replace("$1",t)}function m(t){var n,i,e,r,o,n=[],i;return t.field(f.isFormulaField)?(e=(0,a.getTextByState)(t),P(n,r=(0,a.getTokensByState)(t),t,e),A(n)||((o=(0,a.parseToExpressionTree)(e,t))?w(n,o,t):O(n,r,t,e),(0,a.parseToExpressionTree)(e,t,!0))||A(n)||p(n,0,e.length,l().INVALID_FORMULA),n):[]}function p(t,n,i,e,r){t.push({from:n,to:i,message:e,severity:r=void 0===r?"error":r})}function k(t,n,i,e){p(t,n.index,n.endIndex+1,i,e=void 0===e?"error":e)}function g(t,n,i,e){p(t,n.lit,n.ywt,i,e=void 0===e?"error":e)}function w(t,n,i){if(n){for(;n.type===s.ExpressionType.parentheses;){if(!n.value)return void g(t,n,l().INVALID_EXPRESSION);n=n.value}var e=n.type;e===s.ExpressionType.name?(0,a.getCustomNameByState)(i,n.value)||g(t,n,l().UNKNOWN_NAME,"warning"):e===s.ExpressionType.operator?(n.value&&w(t,n.value,i),n.value2&&w(t,n.value2,i)):e===s.ExpressionType.function?b(t,n,i):e===s.ExpressionType.reference&&j(t,n)}}function b(t,n,i){var e,r,o,u,e=n.functionName;if("LET"===e)M(t,n,i);else if("LAMBDA"===e)x(t,n,i);else for((0,s.isExpression)(n.function)?w(t,n.function,i):(r=(0,a.getFunctionByState)(i,e))?S(t,n,r):(0,a.getCustomNameByState)(i,e)||p(t,n.lit,n.lit+e.length,l().UNKNOWN_NAME,"warning"),o=n.arguments||[],u=0;u<o.length;u++)w(t,o[u],i)}function M(t,n,i){var e,r,o,u,s,e=n.lit,r=n.ywt,o=n.arguments||[];for(o.length<3&&p(t,e,r,v(3,o.length)),3<=o.length&&o.length%2==0&&p(t,e,r,l().MISS_LET_FUNCTION_BODY),u=[],s=0;s<o.length-1;s++)s%2==0?(C(t,o[s],u),u.push(o[s].value)):w(t,o[s],i);w(t,o[o.length-1],i)}function x(t,n,i){var e,r,o,u,s,e=n.lit,r=n.ywt,o=n.arguments||[];for(o.length<1&&p(t,e,r,v(1,o.length)),u=[],s=0;s<o.length-1;s++)C(t,o[s],u),u.push(o[s].value);w(t,o[o.length-1],i)}function S(t,n,i){var e,r,o,i,n,e=n.lit,r=n.ywt,o=i.minArgs||0,i=i.maxArgs!==u?i.maxArgs:Number.MAX_SAFE_INTEGER,n=n.arguments||[];n.length<o?p(t,e,r,v(o,n.length)):n.length>i&&p(t,e,r,v(i,n.length))}function C(t,n,i){var e,r,e=n.lit,r=n.ywt;!n||8!==n.type&&100!==n.type||-1<n.value.indexOf(".")?p(t,e,r,l().INVALID_IDENTIFIER_ARGUMENT):-1!==i.indexOf(n.value)&&p(t,e,r,y(n.value))}function j(t,n){var i,e,i=n.source,e=i&&i.getName();i instanceof s.ErrorSource&&e&&p(t,n.lit,n.lit+e.length,d(e),"warning")}function P(t,n,i,e){for(var r,o,u,s,a,r=[],o=function(t){return(0,h.isFunctionCallStartToken)(t)||(0,h.isSubExpressionStartToken)(t)||(0,h.isLeftParenthesesToken)(t)},u=function(t){return(0,h.isFunctionCallEndToken)(t)||(0,h.isSubExpressionEndToken)(t)||(0,h.isRightParenthesesToken)(t)},s=0;s<n.length;s++)o(a=n[s])?r.push(a):u(a)&&(0<r.length?r.pop():k(t,a,l().NO_MATH_PARENTHESES));0<r.length&&p(t,e.length,e.length,l().MISS_RIGHT_PARENTHESES)}function O(t,n,i,e){for(var r,o,u,s,a,f,f,r=[],o=[],u=[],s=0;s<n.length;s++)a=n[s],(0,h.isFunctionCallToken)(a)?(r.push({token:a}),u.push([])):(0,h.isSubExpressionStartToken)(a)?o.push({token:a}):(0,h.isFunctionCallEndToken)(a)?0===r.length?k(t,a,l().NO_MATH_PARENTHESES):(f=(0,c.lastItem)(r),r.pop(),u.pop(),f.hasError||(f=E(i,e,f.token,a),t.push.apply(t,f),A(f)&&(r.forEach(function(t){t.hasError=!0}),o.forEach(function(t){t.hasError=!0})))):(0,h.isSubExpressionEndToken)(a)?0===o.length?k(t,a,l().NO_MATH_PARENTHESES):o.pop():(0,h.isFunctionArgumentSeparator)(a)?0!==r.length&&(0,c.lastItem)(u).push(a):(0,h.isRightParenthesesToken)(a)&&k(t,a,l().NO_MATH_PARENTHESES);(0<r.length||0<o.length)&&p(t,e.length,e.length,l().MISS_RIGHT_PARENTHESES)}function E(t,n,i,e){var r,o,i,e,n,r=[],o=i.index,i=e.endIndex+1,e=n.substring(o,i),n=(0,a.parseToExpressionTree)(e,t);return n?(b(r,n,t),r.forEach(function(t){t.from+=o,t.to+=o}),(0,a.parseToExpressionTree)(e,t,!0)||A(r)||p(r,o,i,l().INVALID_EXPRESSION)):p(r,o,i,l().INVALID_EXPRESSION),r}function A(t){return t.some(function(t){return"error"===t.severity})}Object.defineProperty(n,"__esModule",{value:!0}),n.getDiagnostic=n.linterExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("Common"),o=i("./dist/plugins/formulaPanel/editor/editor.ns.js"),s=i("CalcEngine"),h=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),c=i("./dist/plugins/formulaPanel/editor/common/util.js"),a=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=void 0,f=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),i=new r.Common.ResourceManager(o.SR,"formulaEditor"),l=i.getResource.bind(i),n.linterExtension=e.Lint.linter(function(t){return m(t.state)},{needsRefresh:function(t){return t.transactions.some(f.needRebuildToken)}}),n.getDiagnostic=m},"./dist/plugins/formulaPanel/editor/featureProvider/readOnly.js":function(t,n,i){var e,r;function o(t,n){t.dispatch({effects:r.reconfigure(e.State.EditorState.readOnly.of(n))})}Object.defineProperty(n,"__esModule",{value:!0}),n.reconfigureReadOnly=n.readOnlyExtension=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=new e.State.Compartment,n.readOnlyExtension=r.of(e.State.EditorState.readOnly.of(!1)),n.reconfigureReadOnly=o},"./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js":function(t,s,n){var i,o,u,a,f,n,e,r,h,c,n;function l(t){var n,n,i,t,e,r,n=t.selection.main;return n&&n.from===n.to&&(n=n.from,i=(0,o.getSignatureStatus)((0,u.getTokensByState)(t),n))&&(t=(0,u.getFunctionResourceByState)(t,i.functionName))?(r=(0,o.getActiveParameterInSignatureTip)(i.activeParameter,e=t),[{pos:n,above:!0,arrow:!0,create:function(){var t=document.createElement("div");return t.className="gc-formula-editor-tooltip-help-function",t.appendChild((0,f.createHelpFunctionTitleDom)(e,r)),e.description&&t.appendChild((0,f.createHelpFunctionDescriptionDom)(e.description)),{dom:t,overlap:!0}}}]):[]}Object.defineProperty(s,"__esModule",{value:!0}),s.signatureTooltipsExtensions=s.closeParameterHintsCommand=s.triggerParameterHintsCommand=s.hasParameterHints=s.notTriggerSignatureTooltip=s.closeSignatureTooltip=s.triggerSignatureTooltip=void 0,i=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=n("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),u=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),a=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),f=n("./dist/plugins/formulaPanel/editor/common/util.js"),n=i.State.StateField,s.triggerSignatureTooltip=i.State.StateEffect.define(),s.closeSignatureTooltip=i.State.StateEffect.define(),s.notTriggerSignatureTooltip=i.State.Annotation.define(),e=n.define({create:function(){return[]},update:function(t,n){var i,e,r,o,u,i;if(!n.state.field(a.isFormulaField))return[];if(e=t&&0<t.length,n.annotation(s.notTriggerSignatureTooltip)&&!e)return[];for(r=0,o=n.effects;r<o.length;r++){if((u=o[r]).is(s.closeSignatureTooltip))return[];if(u.is(s.triggerSignatureTooltip))return l(n.state)}return n.docChanged?l(n.state):e?n.selection?l(n.state):t:[]},provide:function(n){return i.View.showTooltip.computeN([n],function(t){return t.field(n)})}}),s.hasParameterHints=r=function(t){return 0<t.state.field(e).length},s.triggerParameterHintsCommand=h=function(t){return t.dispatch({effects:s.triggerSignatureTooltip.of(null)}),!0},s.closeParameterHintsCommand=c=function(t){return!!(0,s.hasParameterHints)(t)&&(t.dispatch({effects:s.closeSignatureTooltip.of(null)}),!0)},n=i.View.EditorView.updateListener.of(function(t){t.focusChanged&&!t.view.hasFocus&&(0,s.closeParameterHintsCommand)(t.view)}),s.signatureTooltipsExtensions=[e,n]},"./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js":function(t,e,n){var i,r,o,u,s,n,a;function f(t){return"gc-formula-editor-token_"+r.SyntaxHighlightingTokenType[t]}function h(t){var n;return t.field(u.isFormulaField)?a.of(l(t)):a.of([])}function c(t,n){var i={};return isNaN(n)||(i[e.TOKEN_INDEX_ATTRIBUTE_NAME]=n),{class:f(t),attributes:i}}function l(t){var n=(0,o.getTokensByState)(t);return v(n,t),n.map(function(t){var n=m(t);return i.View.Decoration.mark(c(n,t.colorIndex)).range(t.index,t.endIndex+1)})}function v(t,n){var i,e,i=[];t.forEach(function(n){var t;((0,s.isReferenceToken)(n)||(0,s.isNameToken)(n)&&(0,s.hasReferenceRanges)(n))&&(t=i.find(function(t){return d(t,n)}),n.colorIndex=t?t.colorIndex:y(i),i.push(n))}),e=(0,o.getReferenceTokenColors)(n).length,i.forEach(function(t){t.colorIndex=t.colorIndex%e})}function d(t,n){return(0,s.removeWhiteSpace)(t.text).toUpperCase()===(0,s.removeWhiteSpace)(n.text).toUpperCase()}function y(t){return t&&0!==t.length?Math.max.apply(Math,t.map(function(t){return t.colorIndex}))+1:0}function m(t){var n,i,n=t.type,i=r.SyntaxHighlightingTokenType.unknown;return n===r.TokenType.NumberConst?i=r.SyntaxHighlightingTokenType.numberConst:n===r.TokenType.StringConst?i=r.SyntaxHighlightingTokenType.stringConst:n===r.TokenType.LogicalConst?i=r.SyntaxHighlightingTokenType.booleanConst:n===r.TokenType.ErrorConst?i=r.SyntaxHighlightingTokenType.errorConst:n===r.TokenType.CellReference?i=r.SyntaxHighlightingTokenType.reference:n===r.TokenType.Name?i=(0,s.hasReferenceRanges)(t)?r.SyntaxHighlightingTokenType.reference:r.SyntaxHighlightingTokenType.name:n===r.TokenType.OperatorPrefix?i=r.SyntaxHighlightingTokenType.operatorPrefix:n===r.TokenType.OperatorInfix?i=r.SyntaxHighlightingTokenType.operatorInfix:n===r.TokenType.OperatorPostfix?i=r.SyntaxHighlightingTokenType.operatorPostfix:n===r.TokenType.Whitespace?i=r.SyntaxHighlightingTokenType.whitespace:n===r.TokenType.FunctionName||n===r.TokenType.FunctionCallStart||n===r.TokenType.FunctionCallEnd?i=r.SyntaxHighlightingTokenType.function:n===r.TokenType.FunctionArgumentSeparator||n===r.TokenType.ArrayConstRowSeparator||n===r.TokenType.ArrayConstItemSeparator?i=r.SyntaxHighlightingTokenType.argumentSeparator:n!==r.TokenType.SubExpressionStart&&n!==r.TokenType.SubExpressionEnd||(i=r.SyntaxHighlightingTokenType.subExpression),i}Object.defineProperty(e,"__esModule",{value:!0}),e.markReferenceTokenColorIndex=e.syntaxHighlightingTokenClassName=e.syntaxHighlightingField=e.TOKEN_INDEX_ATTRIBUTE_NAME=void 0,i=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=n("./dist/plugins/formulaPanel/editor/interface.js"),o=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),s=n("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),n=i.State.StateField,a=i.State.RangeSet,e.TOKEN_INDEX_ATTRIBUTE_NAME="data-token-index",e.syntaxHighlightingField=n.define({create:h,update:function(t,n){return h(n.state)},provide:function(t){return i.View.EditorView.decorations.from(t)}}),e.syntaxHighlightingTokenClassName=f,e.markReferenceTokenColorIndex=v},"./dist/plugins/formulaPanel/editor/featureProvider/tab.js":function(t,n,i){var e,r;Object.defineProperty(n,"__esModule",{value:!0}),n.insertTab=void 0,e=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),n.insertTab=r=function(t){var n;return!t.state.readOnly&&!t.state.selection.ranges.some(function(t){return!t.empty})&&(n=(0,e.getOneIndentSpaceByState)(t.state),t.dispatch(t.state.update(t.state.replaceSelection(n),{scrollIntoView:!0,userEvent:"input"})),!0)}},"./dist/plugins/formulaPanel/editor/featureProvider/theme.js":function(t,n,i){var e,r,o,u,s;function a(t){var n=t.autocompletionStyle,t=t.errorStyle;return u.theme({"& .cm-tooltip-autocomplete":{color:n.color,font:n.font,background:n.backgroundColor,border:n.border,"margin-left":"1em"},"& .cm-tooltip-autocomplete ul li":{padding:"5px"},"& .cm-tooltip-autocomplete ul li .cm-completionIcon-function":{color:n.function_icon.color,font:n.function_icon.font},"& .cm-tooltip-autocomplete ul li .cm-completionLabel":{color:n.function_name.color,font:n.function_name.font},"& .cm-tooltip-autocomplete ul li .cm-completionDetail":{color:n.function_name.color,font:n.function_name.font},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionIcon-function":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionLabel":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionDetail":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected]":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip .cm-tooltip-lint .cm-diagnostic ":{color:t.color,font:t.font,background:t.backgroundColor}})}function f(t){var e,r,e={},r=function(t,n,i){var t,i,t=(0,o.syntaxHighlightingTokenClassName)(t),i=isNaN(i)?"":"[".concat(o.TOKEN_INDEX_ATTRIBUTE_NAME,'="').concat(i,'"]');e["& .".concat(t).concat(i)]=n};return t.forEach(function(i){Array.isArray(i.color)?(r(i.token,{color:i.color[0]}),i.color.forEach(function(t,n){r(i.token,{color:t},n)})):r(i.token,{color:i.color})}),u.theme(e)}function h(t,n){return u.theme({"& .cm-scroller":{"background-color":t.backgroundColor,color:t.color,font:t.font},".cm-cursor, .cm-dropCursor":{borderLeftColor:t.caretColor},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:t.selectionBackColor},"& .cm-activeLine":{"background-color":t.activeLineBackColor},"& .cm-gutters":{"background-color":n.backgroundColor,color:n.color,font:n.font,"user-select":"none"},"& .cm-lineNumbers ":{width:"30px"},'& .cm-foldGutter span[title="Fold line"] ':{"padding-bottom":"8px"},"& .cm-gutterElement":{display:"flex","align-items":"center","justify-content":"flex-end"},"& .cm-activeLineGutter":{"background-color":t.activeLineBackColor},"& .cm-tooltip":{border:"none"}})}function c(t){var n,i,t,e,n=t.rules,i=t.editorContentStyle,t=t.editorGuttersStyle,e=[s];return i&&t&&(e=e.concat([h(i,t),a(i)])),e=n?e.concat(f(n)):e}Object.defineProperty(n,"__esModule",{value:!0}),n.themeExtension=n.createThemeExtension=n.themeCompartment=n.createSyntaxHighlightingTheme=void 0,e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=i("./dist/plugins/formulaPanel/editor/common/const.js"),o=i("./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js"),u=e.View.EditorView,s=u.theme({"&":{height:"100%"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-line":{"line-height":1.35}}),n.createSyntaxHighlightingTheme=f,n.themeCompartment=new e.State.Compartment,n.createThemeExtension=c,n.themeExtension=n.themeCompartment.of(c(r.defaultTheme))},"./dist/plugins/formulaPanel/editor/featureProvider/toggleAbsoluteRelativeReferences.js":function(t,n,i){var u,e,p,r,o;function k(t,n,i,e,r,o){var t=(0,p.parseToExpressionTree)(t,n);return t.isFullColumn||t.isFullRow?(0,u.lmt)(t,i,e,!0,!0):t.hmt()?(0,u.dmt)(t,i,e):(0,u.lmt)(t,i,e,r,o),(0,p.unparseToText)(t,n)}function g(t,n,i){return(0,e.includeToken)(t,n,i)||(0,e.isInToken)(t,n,!0,!0)||(0,e.isInToken)(t,i,!0,!0)}Object.defineProperty(n,"__esModule",{value:!0}),n.toggleAbsoluteRelativeReferencesCommand=void 0,u=i("FormulaTextBox"),e=i("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),p=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),r=i("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),n.toggleAbsoluteRelativeReferencesCommand=o=function(s){var t,a,n,i,f,h,i,c,l,v,d,y,m,e,t;return!!s.state.field(r.isFormulaField)&&(a=s.state,n=(0,p.getTokensByState)(a),i=a.selection.main,f=i.from,h=i.to,i=a.field(r.activeCellField),c=i.row,l=i.col,v=!1,d=0,y=f,m=h,(e=n.filter(function(t){return g(t,f,h)&&(0,p.isValidReferenceToken)(t,a)})).forEach(function(t){var n,i,e,r,o,o,u,n=t.text.indexOf(":"),i=-1!==n,e=!i||f<=t.index+n,r=!i||h>t.index+n,o=k(t.text,a,c,l,e,r);o&&(s.dispatch({changes:{from:t.index+d,to:t.endIndex+1+d,insert:o}}),d+=o.length-t.text.length,o=t.index,u=t.endIndex+1,!i||e&&r||(e?u=t.index+n:r&&(o=t.index+n+1)),y=Math.min(y,o),m=Math.max(m,u),s.dispatch({selection:{anchor:y,head:m+d}}),v=!0)}),v)}},"./dist/plugins/formulaPanel/editor/formulaEditor-action.js":function(t,r,n){var u,o,s,i,e,a,f,h,c,l,v,d,y,m,n,p;function k(t,n){return{canUndo:n=void 0===n?!1:n,execute:t}}function g(n,t){return k(function(t){return n(t.li.getView())},t=void 0===t?!1:t)}function w(t){var n=u.mt.Qf(),i=!n,n=n;t.register(y,r.Commands[y],27),t.register(h,r.Commands[h],32,i,!0,!1,n),t.register(c,r.Commands[c],27),t.register(l,r.Commands[l],115),t.register(v,r.Commands[v],70,!1,!0,!0),t.register(d,r.Commands[d],83,i,!1,!1,n)}Object.defineProperty(r,"__esModule",{value:!0}),r.registerDefaultCommands=r.Commands=r.executeCommitContextToCellCommand=void 0,u=n("Core"),o=n("FormulaTextBox"),s=n("./dist/plugins/formulaPanel/editor/common/spreadUtil.js"),i=n("./dist/plugins/formulaPanel/editor/featureProvider/formatter.js"),e=n("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),a=n("./dist/plugins/formulaPanel/editor/featureProvider/toggleAbsoluteRelativeReferences.js"),f=n("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js"),h="showHints",c="closeHints",l="toggleAbsoluteRelativeReferences",v="formatDocument",d="commitContentToActiveCell",y="exitEdit",r.executeCommitContextToCellCommand=m=function(t,n,i,e,r){var e,e,o,o;void 0===r&&(r=u.SheetArea.viewport),e=0<e.length?e:null,e={cmd:"editCell",sheetName:t.name(),row:n,col:i,sheetArea:r,newValue:e},t.dataRanges&&(o=t.dataRanges.getByPosition(n,i))&&(o=o.convertContext({sheet:t,row:n,col:i,sheetArea:r}))&&o.sheet!==t&&(e.sheetName=o.sheet.name(),e.row=o.row,e.col=o.col),t.Qy().execute(e)},n=k(function(t){var n,i,i,t,e,n=(0,s.Kde)(t.Vv);return!!n&&(i=o.Hde.Ude(),(0,f.isFormulaEditorReferencedRangesAcrossSheetContext)(i)?i.zde(n):(i=t.text(),t=n.getActiveRowIndex(),e=n.getActiveColumnIndex(),(0,r.executeCommitContextToCellCommand)(n,t,e,i)),!0)}),p=k(function(t){var n,i,n=t.workbook();return!(!t.Qde()||!n||((i=t.li.getView()).contentDOM.blur(),(0,f.closeFormulaReferencedRanges)(i.state),n.focus(!1),n.focus(),t.Xde(),0))}),r.Commands={},r.Commands[h]=g(e.triggerParameterHintsCommand),r.Commands[c]=g(e.closeParameterHintsCommand),r.Commands[v]=g(i.formatDocumentCommand),r.Commands[l]=g(a.toggleAbsoluteRelativeReferencesCommand),r.Commands[d]=n,r.Commands[y]=p,r.registerDefaultCommands=w},"./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js":function(t,n,i){var e,r,s,o,i,u;function a(t){t.Dn.Fde()}function f(t){var t=t.Bde;return!(!(0,o.isFormulaEditorReferencedRangesContext)(t)||!t.zQt.hasFocus)}function h(t,n,i){var e,r,r,o,o,u,e="";if(t)if(r=(r=t.parent)&&r.options,(o=t.getFormulaInformation(n,i,3))&&o.hasFormula&&!s.mt.HRe(n,i,t)){if(e="="+o.formulaWithCulture,o.isDynamicArray)return"";o.isArrayFormula&&(e="{"+e+"}")}else o=t.getActualStyle(n,i),e="string"==typeof(u=t.getValue(n,i))&&(o.quotePrefix||1<u.length&&"="===u[0]&&r&&r.allowUserEditFormula&&!r.allowInvalidFormula)?"'"+u:s.mt.mi(o,u,t,{sheet:t,row:n,col:i,sheetArea:3})||"";return e}Object.defineProperty(n,"__esModule",{value:!0}),n.getEditText=n.paintFormulaReferencedRanges=void 0,e=i("Common"),r=i("./dist/plugins/formulaPanel/editor/editor.ns.js"),s=i("Core"),o=i("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js"),n.paintFormulaReferencedRanges=a,i=new e.Common.ResourceManager(r.SR,"formulaEditor"),u=i.getResource.bind(i),s.Worksheet.ch("formulaEditor",{preProcessKeyDown:function(t){f(this)&&(t.r=!0)},processCompositionStart:function(t){f(this)&&(t.r=!0)}}),n.getEditText=h,s.Workbook.ch("formulaEditor",{onCultureChanged:function(){u()}})},"./dist/plugins/formulaPanel/editor/formulaEditor.js":function(t,r,n){var o,u,s,a,f,e,h,c,l,i,v,d,y,m,p,k,n;function g(t,n){var i,e;"string"==typeof t&&(t=document.getElementById(t)),g.et(i=this,"onCreate",e={container:t}),i.Wc=t=e.container,i.li=new s.FormulaEditorCore(t,k),i.e$r(),i.Qy=new o.Commands.CommandManager(i),i.Zde=i.Zde.bind(i),i.spe=i.spe.bind(i),i.Yde=i.Yde.bind(i),i.$ve=i.$ve.bind(i),i.ove=i.ove.bind(i),i.tve=i.tve.bind(i),i.Rve=i.Rve.bind(i),i.hme=i.hme.bind(i),i.qve=i.qve.bind(i),i.yme=i.yme.bind(i),i.kme=i.kme.bind(i),i.LEt=y(a.DEFAULT_FORMULA_EDITOR_OPTIONS,i.kme),i.Zp(n),i.wme(),t.addEventListener("keydown",i.Zde),(0,f.registerDefaultCommands)(i.Qy),(0,u.GC$)(t).data(r.CONST_FORMULA_EDITOR,i)}function w(t,n,i){var n;return!(!M(t,n,i)&&!x(t,n,i)&&b(t,n,i)&&(u.Worksheet.et(t,"formulaPanelCheckIsReadOnly",n={r:d}),!n.r))}function b(t,n,i){var t=t.getActualStyle(n,i);return!t||!1!==t.allowEditInCell}function M(t,n,i){return t.isActualProtected()&&!1!==t.l0(n,i,"locked")}function x(t,n,i){var e,t,e=t.getCellType(n,i);return!(!e||(t={sheet:t,sheetName:t.name(),sheetArea:u.SheetArea.viewport,row:n,col:i},!(t=e.lfe(t,v)).readonly))}Object.defineProperty(r,"__esModule",{value:!0}),r.FormulaEditor=r.CONST_FORMULA_EDITOR=void 0,o=n("Common"),u=n("Core"),s=n("./dist/plugins/formulaPanel/editor/formulaEditorCore.js"),a=n("./dist/plugins/formulaPanel/editor/common/const.js"),f=n("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),e=n("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesExtension.js"),h=n("./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js"),c=n("./dist/plugins/formulaPanel/editor/common/spreadUtil.js"),l=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),i=n("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/structReferences.js"),r.CONST_FORMULA_EDITOR="formula-editor",v=void 0,d=null,y=u.mt.b0,m=u.GC$.extend,p=u.GC$.each,k=[e.formulaReferencedRangesExtension],g.prototype.e$r=function(){var t=this;t.li.initTheme(),g.et(t,"onThemeChange",t.li.getTheme())},Object.defineProperty(g.prototype,"options",{get:function(){return this.LEt},set:function(t){if(t&&"object"==typeof t)for(var n in t)t.hasOwnProperty(n)&&(this.LEt[n]=t[n])},enumerable:!1,configurable:!0}),g.prototype.text=function(t){if(0===arguments.length)return this.li.getText();this.li.setText(t+"")},g.prototype.workbook=function(){return this.Vv},g.prototype.attach=function(t){var n=this;n.Vv!==t&&(n.detach(),n.Vv=t,n._6(),n.Vv.D3(u.Events.EnterCellInternal,n.spe),n.Vv.D3(u.Events.CellChanged,n.Yde),n.Vv.D3(u.Events.RangeChangedInternal,n.$ve),n.Vv.D3(u.Events.RangeFiltered,n.yme),n.Vv.D3(u.Events.RangeFilterCleared,n.yme),n.Vv.D3(u.Events.ActiveSheetChangingInternal,n.ove),n.Vv.D3(u.Events.ActiveSheetChangedInternal,n.tve),n.Vv.D3(u.Events.SheetOptionsChangedInternal,n.Rve),n.Vv.D3(u.Events.WorkbookOptionsChangedInternal,n.hme),n.Vv.D3(u.Events.CustomNameChangedInternal,n.qve))},g.prototype.detach=function(){var t=this,n=t.Vv;n&&(n._3(u.Events.EnterCellInternal,t.spe),n._3(u.Events.CellChanged,t.Yde),n._3(u.Events.RangeChangedInternal,t.$ve),n._3(u.Events.RangeFiltered,t.yme),n._3(u.Events.RangeFilterCleared,t.yme),n._3(u.Events.ActiveSheetChangingInternal,t.ove),n._3(u.Events.ActiveSheetChangedInternal,t.tve),n._3(u.Events.SheetOptionsChangedInternal,t.Rve),n._3(u.Events.WorkbookOptionsChangedInternal,t.hme),n._3(u.Events.CustomNameChangedInternal,t.qve),t.Vv=v,t._6())},g.prototype.format=function(){this.li.format()},g.prototype.commandManager=function(){return this.Qy},g.prototype.destroy=function(){var t=this;g.et(t,"onDestroy"),t.detach(),t.li.destroy(),t.Wc.removeEventListener("keydown",t.Zde),(0,u.GC$)(t.Wc).data(r.CONST_FORMULA_EDITOR,d)},g.prototype.refresh=function(){var t=this;t.e$r(),t._6()},g.prototype.getActiveCellInfo=function(){var t,n,t,i,t=this.li.getActiveCellInfo(),n=t.row,t=t.col,i;return{sheet:this.li.getCalcSource().Mf,row:n,col:t}},g.prototype.isFormattedFormula=function(){return this.li.isFormattedFormula()},g.prototype.Qde=function(){return this.li.getView().hasFocus},g.prototype.Xde=function(){var t,n,i,t,e,r,t=this.getActiveCellInfo(),n=t.sheet,i=t.row,t=t.col;n&&(e=this.li,r=(0,h.getEditText)(n,i,t),n.options.showFormulas&&n.hasFormula(i,t)&&u.mt.HRe(i,t,n)&&(r=""),(0,l.isSameFormula)(e.getView().state,e.getText(),r)||e.setText(r),e.format())},g.prototype.Zp=function(t){var i,t,i=this.LEt,t=t||{};t=m(!0,{},a.DEFAULT_FORMULA_EDITOR_OPTIONS,t),p(t,function(t,n){i.hasOwnProperty(t)&&(i[t]=n)}),this.li.setOptions(i)},g.prototype.wme=function(){var t=this;t.li.setProvider({getStructReferences:function(){return(0,i.getStructReferencesByWorkbook)(t.Vv)},getFunctions:function(){return(0,c.getFunctionsByWorkbook)(t.Vv)}})},g.prototype.Zde=function(t){this.hve(t)},g.prototype.spe=function(){var t=this;t.tpe()?t.ope():(t.Xde(),t.Ove())},g.prototype.Yde=function(t,n){var i=this.getActiveCellInfo(),e=i.sheet,r=i.row,i=i.col;e===n.sheet&&r===n.row&&i===n.col&&("[styleinfo]"===n.propertyName&&this.Ove(),this.Xde())},g.prototype.$ve=function(t,n){var i,e,r,i;n&&(e=(i=this.getActiveCellInfo()).sheet,r=i.row,i=i.col,e===n.sheet)&&new u.Range(n.row,n.col,n.rowCount,n.colCount).contains(r,i)&&this.Xde()},g.prototype.ove=function(t,n){(0,e.ave)(t,n)},g.prototype.tve=function(t,n){var i;(0,e.uve)(t,n)||this._6()},g.prototype.Rve=function(t,n){var n=n.propertyName;"isProtected"===n&&this.Ove(),"showFormulas"===n&&this.Xde()},g.prototype.hme=function(t,n){var i;"allowDynamicArray"===n.propertyName&&this.li.rebuildFormula()},g.prototype.qve=function(){this.sve()},g.prototype.yme=function(t,n){var i,i,n,i=null==(i=this.Vv)?void 0:i.getSheetTab(n.sheetName),n=this.li.getCalcSource().Mf;i&&i.Mf===n&&this.Xde()},g.prototype.kme=function(t,n,i){var e;n!==i&&this.li.setOptions(this.LEt)},g.prototype._6=function(){var t=this;t.eve(),t.rve(),t.sve(),t.ope()},g.prototype.eve=function(){var t,t,t=(null==(t=this.Vv)?void 0:t.getCalcService())||a.defaultCalcService;this.li.setCalcService(t)},g.prototype.rve=function(){var t=(0,c.Kde)(this.Vv);t?this.li.setCalcSource(t.Uw()):this.li.setCalcSource(a.defaultCalcSource),this.epe()},g.prototype.sve=function(){var t,n,n,t=[],n=this.Vv;n&&(t.push.apply(t,n.getCustomNames()),n=(0,c.Kde)(n))&&t.push.apply(t,n.getCustomNames()),this.li.setCustomNames(t)},g.prototype.ope=function(){var t,n,t=this,n=t.rpe();t.li.setActiveCellInfo(n),t.Xde(),t.Ove(),t.li.clearHistory(),t.epe()},g.prototype.Ove=function(){var t=(0,c.Kde)(this.Vv);t?this.li.setReadOnly(w(t,t.getActiveRowIndex(),t.getActiveColumnIndex())):this.li.setReadOnly(!1)},g.prototype.tpe=function(){var t,n,t=this.li.getActiveCellInfo(),n=this.rpe();return t.row!==n.row||t.col!==n.col},g.prototype.rpe=function(){var t,n,i,t=(0,c.Kde)(this.Vv);return t?{row:n=t.getActiveRowIndex(),col:i=t.getActiveColumnIndex()}:a.DEFAULT_ACTIVE_CELL_INFO},g.prototype.epe=function(){this.options.onActiveCellChanged&&this.options.onActiveCellChanged()},g.prototype.hve=function(t){var n,i,e,i,r,o,n=this,i=n.Qy.getShortcutKey(t.keyCode,t.ctrlKey,t.shiftKey,t.altKey,t.metaKey),e=n.Qy.getCommands(i);if(e)for(i={cmds:e,r:d},u.Worksheet.et(this.Vv.getActiveSheet(),"beforeExecuteShortcut",i),e=i.cmds,r=0;r<e.length;r++)if(o=e[r].execute(n,{}))return o.ignoreCancelDefault||u.mt.vi(t),!0},r.FormulaEditor=n=g,(0,u.$e)(n)},"./dist/plugins/formulaPanel/editor/formulaEditorCore.js":function(B,t,n){var i,e,r,o,u,s,a,f,h,c,l,v,d,y,m,p,k,g,w,b,M,x,S,C,_,F,N,U,H,z,W,V,$,q,j,P,G,J,K,O,E,A,D,R,I,T,Q,n,i,X,Z,Y;function tt(){return[e.basicSetup,Z,o.customFields,p.readOnlyExtension,y.themeExtension,h.foldExtension,c.indentExtension,u.syntaxHighlightingField,s.autoCompletionExtensions,a.hoverTooltipExtension,f.signatureTooltipsExtensions,v.doubleClickSelectRangeExtension,d.linterExtension]}function L(t,n){this.ipe=n,this.zQt=new Q({state:this.npe(""),parent:t})}Object.defineProperty(t,"__esModule",{value:!0}),t.FormulaEditorCore=void 0,i=n("Core"),e=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),r=n("./dist/plugins/formulaPanel/editor/interface.js"),o=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),u=n("./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js"),s=n("./dist/plugins/formulaPanel/editor/featureProvider/completion.js"),a=n("./dist/plugins/formulaPanel/editor/featureProvider/hoverTooltips.js"),f=n("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),h=n("./dist/plugins/formulaPanel/editor/featureProvider/folding.js"),c=n("./dist/plugins/formulaPanel/editor/featureProvider/indent.js"),l=n("./dist/plugins/formulaPanel/editor/featureProvider/tab.js"),v=n("./dist/plugins/formulaPanel/editor/featureProvider/dbClickRangeSelector.js"),d=n("./dist/plugins/formulaPanel/editor/featureProvider/lint.js"),y=n("./dist/plugins/formulaPanel/editor/featureProvider/theme.js"),m=n("./dist/plugins/formulaPanel/editor/featureProvider/formatter.js"),p=n("./dist/plugins/formulaPanel/editor/featureProvider/readOnly.js"),k=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),g="gc-formula-editor-token-const-string",w="gc-formula-editor-token-const-number",b="gc-formula-editor-token-const-boolean",M="gc-formula-editor-token-const-error",x="gc-formula-editor-token-operator-prefix",S="gc-formula-editor-token-operator-infix",C="gc-formula-editor-token-operator-postfix",_="gc-formula-editor-token-function",F="gc-formula-editor-token-name",N="gc-formula-editor-token-reference-1",U="gc-formula-editor-token-reference-2",H="gc-formula-editor-token-reference-3",z="gc-formula-editor-token-reference-4",W="gc-formula-editor-token-reference-5",V="gc-formula-editor-token-reference-6",$="gc-formula-editor-token-reference-7",q="gc-formula-editor-token-argument-separator",j="gc-formula-editor-content",P="gc-formula-editor-gutters",G="gc-formula-editor-caret",J="gc-formula-editor-active-line",K="gc-formula-editor-selection",O="gc-formula-editor-tooltip-autocompletion-function",E="gc-formula-editor-tooltip-autocompletion-function-active-item",A="gc-formula-editor-tooltip-autocompletion-function-icon",D="gc-formula-editor-tooltip-autocompletion-function-name",R="gc-formula-editor-tooltip-autocompletion-function-description",I="gc-formula-editor-tooltip-error-message",T=i.I.fl,Q=e.View.EditorView,n=e.View.keymap,i=e.Commands.indentWithTab,X=e.Autocomplete.acceptCompletion,Z=n.of([{key:"Tab",run:X},{key:"Tab",run:l.insertTab},i]),L.prototype.getView=function(){return this.zQt},L.prototype.getText=function(){return this.zQt.state.doc.toJSON().join("\n")},L.prototype.setText=function(t){this.zQt.dispatch({changes:{from:0,to:this.zQt.state.doc.length,insert:t}})},L.prototype.getFunctions=function(){return(0,k.getFunctionsByState)(this.zQt.state)},L.prototype.getCustomNames=function(){return this.zQt.state.field(o.customNamesField)},L.prototype.setCustomNames=function(t){this.zQt.dispatch({effects:o.setCustomNamesField.of(t)})},L.prototype.getOptions=function(){return this.zQt.state.field(o.optionsField)},L.prototype.setOptions=function(t){this.zQt.dispatch({effects:o.setOptionsField.of(t)})},L.prototype.getReadOnly=function(){return this.zQt.state.readOnly},L.prototype.setReadOnly=function(t){t!==this.getReadOnly()&&(0,p.reconfigureReadOnly)(this.zQt,t)},L.prototype.getTheme=function(){return this.zQt.state.field(o.themeField)},L.prototype.setTheme=function(t){this.zQt.dispatch({effects:o.setThemeField.of(t)}),this.zQt.dispatch({effects:y.themeCompartment.reconfigure((0,y.createThemeExtension)(t))})},L.prototype.getCalcSource=function(){return this.zQt.state.field(o.calcSourceField)},L.prototype.setCalcSource=function(t){this.zQt.dispatch({effects:o.setCalcSourceField.of(t)})},L.prototype.getCalcService=function(){return this.zQt.state.field(o.calcServiceField)},L.prototype.setCalcService=function(t){this.zQt.dispatch({effects:o.setCalcServiceField.of(t)})},L.prototype.getActiveCellInfo=function(){return this.zQt.state.field(o.activeCellField)},L.prototype.setActiveCellInfo=function(t){this.zQt.dispatch({effects:o.setActiveCellField.of(t)})},L.prototype.getProvider=function(){return this.zQt.state.field(o.providerField)},L.prototype.setProvider=function(t){this.zQt.dispatch({effects:o.setProviderField.of(t)})},L.prototype.format=function(){(0,m.formatDocumentCommand)(this.zQt)},L.prototype.hasFocus=function(){return this.zQt.hasFocus},L.prototype.destroy=function(){this.zQt.destroy()},L.prototype.rebuildFormula=function(){this.zQt.dispatch({effects:o.rebuildFormulaEffect.of(!0)})},L.prototype.clearHistory=function(){var t,n,i,e,r,o,u,s,a,f,n,t=this,n=t.getText(),i=t.getTheme(),e=t.getOptions(),r=t.getCalcService(),o=t.getCalcSource(),u=t.getCustomNames(),s=t.getActiveCellInfo(),a=t.getProvider(),f=t.getReadOnly(),n=t.npe(n);t.zQt.setState(n),t.setTheme(i),t.setOptions(e),t.setCalcService(r),t.setCalcSource(o),t.setActiveCellInfo(s),t.setCustomNames(u),t.setProvider(a),t.setReadOnly(f)},L.prototype.initTheme=function(){var t,n,i,t=[{token:r.SyntaxHighlightingTokenType.stringConst,color:T(g).color},{token:r.SyntaxHighlightingTokenType.numberConst,color:T(w).color},{token:r.SyntaxHighlightingTokenType.booleanConst,color:T(b).color},{token:r.SyntaxHighlightingTokenType.errorConst,color:T(M).color},{token:r.SyntaxHighlightingTokenType.operatorPrefix,color:T(x).color},{token:r.SyntaxHighlightingTokenType.operatorInfix,color:T(S).color},{token:r.SyntaxHighlightingTokenType.operatorPostfix,color:T(C).color},{token:r.SyntaxHighlightingTokenType.function,color:T(_).color},{token:r.SyntaxHighlightingTokenType.name,color:T(F).color},{token:r.SyntaxHighlightingTokenType.argumentSeparator,color:T(q).color},{token:r.SyntaxHighlightingTokenType.reference,color:[T(N).color,T(U).color,T(H).color,T(z).color,T(W).color,T(V).color,T($).color]}],n={backgroundColor:T(j).backgroundColor,font:T(j).font,color:T(j).color,caretColor:T(G).color,selectionBackColor:T(K).backgroundColor,activeLineBackColor:T(J).backgroundColor,autocompletionStyle:{backgroundColor:T(O).backgroundColor,font:T(O).font,color:T(O).color,border:T(O).border,activeItem:{backgroundColor:T(E).backgroundColor,color:T(E).color},function_icon:{color:T(A).color,font:T(A).font},function_name:{color:T(D).color,font:T(D).font},function_description:{color:T(R).color,font:T(R).font}},errorStyle:{backgroundColor:T(I).backgroundColor,font:T(I).font,color:T(I).color}},i={backgroundColor:T(P).backgroundColor,font:T(P).font,color:T(P).color};this.setTheme({rules:t,editorContentStyle:n,editorGuttersStyle:i})},L.prototype.isFormattedFormula=function(){return this.zQt.state.field(o.isFormattedFormulaField)},L.prototype.npe=function(t){var n=tt().concat(this.ipe);return e.State.EditorState.create({extensions:n,doc:t})},t.FormulaEditorCore=L},"./dist/plugins/formulaPanel/editor/interface.js":function(t,n){var i,e,r,r;Object.defineProperty(n,"__esModule",{value:!0}),n.TokenType=n.SyntaxHighlightingTokenType=void 0,(r=i=n.SyntaxHighlightingTokenType||(n.SyntaxHighlightingTokenType={}))[r.subExpression=0]="subExpression",r[r.function=1]="function",r[r.argumentSeparator=2]="argumentSeparator",r[r.operatorPrefix=3]="operatorPrefix",r[r.operatorInfix=4]="operatorInfix",r[r.operatorPostfix=5]="operatorPostfix",r[r.stringConst=6]="stringConst",r[r.errorConst=7]="errorConst",r[r.numberConst=8]="numberConst",r[r.booleanConst=9]="booleanConst",r[r.name=10]="name",r[r.reference=11]="reference",r[r.whitespace=12]="whitespace",r[r.unknown=13]="unknown",(r=e=n.TokenType||(n.TokenType={}))[r.ErrorConst=0]="ErrorConst",r[r.LogicalConst=1]="LogicalConst",r[r.NumberConst=2]="NumberConst",r[r.StringConst=3]="StringConst",r[r.ArrayConstStart=4]="ArrayConstStart",r[r.ArrayConstEnd=5]="ArrayConstEnd",r[r.ArrayConstRowSeparator=6]="ArrayConstRowSeparator",r[r.ArrayConstItemSeparator=7]="ArrayConstItemSeparator",r[r.OperatorPrefix=8]="OperatorPrefix",r[r.OperatorInfix=9]="OperatorInfix",r[r.OperatorPostfix=10]="OperatorPostfix",r[r.FunctionName=11]="FunctionName",r[r.FunctionCallStart=12]="FunctionCallStart",r[r.FunctionCallEnd=13]="FunctionCallEnd",r[r.FunctionArgumentSeparator=14]="FunctionArgumentSeparator",r[r.SubExpressionStart=15]="SubExpressionStart",r[r.SubExpressionEnd=16]="SubExpressionEnd",r[r.CellReference=17]="CellReference",r[r.Name=18]="Name",r[r.FormulaStart=19]="FormulaStart",r[r.Whitespace=20]="Whitespace",r[r.Unknown=21]="Unknown"},"./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js":function(t,c,n){var i,l,e,r,o,v,u,s,d,a,f,h,y,m;function p(t){this.cmt=!0,this.rl=!1,this.Xvt=l.SelectionUnit.cell,this.Ivt=!1,this.xmt=!0,this.qMi=!1,this.XD=!1,this.umt=-1,this.zQt=t}function k(t){this.lve=t}function g(t){var n,i,i,n=(0,v.getActiveSheetByState)(t);n&&(b(i=e.Hde.Ude())&&(i.zde(n),n=(0,v.getActiveSheetByState)(t)),w(i=n.Bde))&&(i.dispose(),n.Bde=h,M(n.parent,!1))}function w(t){return t instanceof y}function b(t){return t instanceof m}function M(t,n){var i=function(t){t&&(t.rt.X6=n)};t.sheets.forEach(i),t.mp.forEach(function(t){i(t.Mf)})}function x(t,n){t.parent.e3(t,n=void 0===n?!0:n)}Object.defineProperty(c,"__esModule",{value:!0}),c.setWorkbookFocusStatus=c.isFormulaEditorReferencedRangesAcrossSheetContext=c.isFormulaEditorReferencedRangesContext=c.closeFormulaReferencedRanges=c.FormulaEditorReferencedRangesAcrossSheetContext=c.FormulaEditorReferencedRangesContext=c.appendingRangeAnnotation=void 0,i=n("Common"),l=n("Core"),e=n("FormulaTextBox"),r=n("./dist/plugins/formulaPanel/editor/codemirror/index.js"),o=n("./dist/plugins/formulaPanel/editor/common/calcUtil.js"),v=n("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),u=n("./dist/plugins/formulaPanel/editor/common/util.js"),s=n("./dist/plugins/formulaPanel/editor/featureProvider/customField.js"),d=n("./dist/plugins/formulaPanel/editor/featureProvider/signatureTooltips.js"),a=n("./dist/plugins/formulaPanel/editor/featureProvider/syntaxHighlighting.js"),f=n("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),h=void 0,c.appendingRangeAnnotation=r.State.Annotation.define(),p.prototype.smt=function(){var t,n,i,e,r,t;if(!this.isFormula())return[];for(t=this.zQt.state,n=(0,v.getTokensByState)(t),(0,a.markReferenceTokenColorIndex)(n,t),i=[],e=0;e<n.length;e++)r=n[e],((0,o.isReferenceToken)(r)||(0,o.isNameToken)(r)&&(0,o.hasReferenceRanges)(r))&&i.push({index:i.length,textOffset:r.index,text:r.text,ranges:r.ranges,allowDrag:r.canDrag,sheetArea:l.SheetArea.viewport,tag:{colorIndex:r.colorIndex}});return(t=this.Fvt)&&i.push({textOffset:-1,text:"",ranges:[t],index:i.length,allowDrag:!1,isPivotClickCell:!0,tag:{colorIndex:0}}),i},p.prototype.pmt=function(t){var n,n,t,n=(0,v.getReferenceTokenColors)(this.zQt.state),t=this.smt()[t];return n[(null==(n=null==t?void 0:t.tag)?void 0:n.colorIndex)||0]},p.prototype.ymt=function(t){var n=this.zQt.state.selection.main.head;return t.textOffset<=n&&t.textOffset+t.text.length>=n},p.prototype.bmt=function(t){var n,i;return!!this.XD&&(n=this.zQt.state.selection.main.head,i=this.umt,t.textOffset>=i)&&t.textOffset+t.text.length<=n},p.prototype.Qvt=function(){return l.SheetArea.viewport},p.prototype.Dvt=function(){var t,t,t=this.zQt.state;return!t.readOnly&&(!(!this.XD&&!(0,l.Df)(this.text()))||!!this.isFormula()&&!!(t=(0,o.getTokenByPos)((0,v.getTokensByState)(t),(0,v.getSelection)(t).from-1))&&((0,o.isFormulaStartToken)(t)||(0,o.isFunctionCallStartToken)(t)||(0,o.isSubExpressionStartToken)(t)||(0,o.isFunctionArgumentSeparator)(t)||(0,o.isLeftParenthesesToken)(t)||(0,o.isInfixOperatorToken)(t)||(0,o.isPrefixOperatorToken)(t)||(0,o.isWhitespaceToken)(t)))},p.prototype.text=function(){return(0,v.getTextByState)(this.zQt.state)},p.prototype.caret=function(){return this.zQt.state.selection.main.head},p.prototype.close=function(){},p.prototype.mmt=function(){},p.prototype.Vde=function(t,n){var i,e,t,r,t,o;n&&(i=this.zQt,t=(e=this.smt())[t])&&(t=(r=t.textOffset)+t.text.length,o=r+n.length,i.dispatch({changes:{from:r,to:t,insert:n},selection:{anchor:o,head:o},annotations:d.notTriggerSignatureTooltip.of(!0)}))},p.prototype.Gvt=function(t,n,i,e,r){var r,o,u,s,a,f,f,h;if(void 0===r&&(r=l.SheetArea.viewport),t){if(u=(o=(r=this).zQt).state,!r.XD){if(!r.Dvt())return;r.XD=!(n=!1),r.umt=(0,v.getSelection)(u).from}s=r.umt,a=(0,v.getSelection)(u).to,f=(0,v.getTokensByState)(u),f=(0,v.getValidReferenceTokenByPos)(f,a,u),i?(h=s+t.length,o.dispatch({changes:{from:s,to:a,insert:t},selection:{anchor:h,head:h},annotations:[c.appendingRangeAnnotation.of(!0),d.notTriggerSignatureTooltip.of(!0)]})):n?f&&f.index>=s&&a>=f.index&&(h=f.index+t.length,o.dispatch({changes:{from:f.index,to:a,insert:t},selection:{anchor:h,head:h},annotations:[c.appendingRangeAnnotation.of(!0),d.notTriggerSignatureTooltip.of(!0)]})):(h=a+(t=s<a?r.fgt()+t:t).length,o.dispatch({changes:{from:a,to:a,insert:t},selection:{anchor:h,head:h},annotations:[c.appendingRangeAnnotation.of(!0),d.notTriggerSignatureTooltip.of(!0)]}))}},p.prototype.qD=function(){var t=this;t.XD&&(t.XD=!1,t.umt=-1)},p.prototype.onRangeMoved=function(){},p.prototype.onRangeResized=function(){},p.prototype.onRangeAppend=function(){},p.prototype.fgt=function(){var t=i.Common.CultureManager.Fe().NumberFormat;return t&&t.listSeparator||u.COMMA},p.prototype.cve=function(){return this.zQt.state.field(s.calcSourceField).Mf},p.prototype.fve=function(){return this.zQt.state.field(s.activeCellField)},p.prototype.isFormula=function(){return this.zQt.state.field(s.isFormulaField)},p.prototype.Ak=function(t){t&&(this.Dmt=[t])},p.prototype.Hce=function(){this.Dmt=h},p.prototype.Ymt=function(){return this.Dmt},p.prototype.dispose=function(){this.zQt=h},p.prototype.dve=function(){var t=this.zQt;t&&(g(t.state),t.hasFocus&&t.contentDOM.blur(),this.dispose())},y=p,c.FormulaEditorReferencedRangesContext=y,Object.defineProperty(k.prototype,"Ivt",{get:function(){return this.lve.Ivt},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"Mf",{get:function(){return this.lve.cve()},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"_text",{get:function(){return this.lve.text()},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"bZ",{get:function(){return this.lve.fve().row},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"mvt",{get:function(){return this.lve.fve().col},enumerable:!1,configurable:!0}),k.prototype.zde=function(t){var n,i,e,r,o,n=!1,i=this.Mf,e=this.bZ,r=this.mvt,o=this._text;return i!==t&&(x(i),n=!0),(0,f.executeCommitContextToCellCommand)(i,e,r,o),this.d5(),n},k.prototype.d5=function(){this.lve=h,e.Hde.DJ=h},m=k,c.FormulaEditorReferencedRangesAcrossSheetContext=m,c.closeFormulaReferencedRanges=g,c.isFormulaEditorReferencedRangesContext=w,c.isFormulaEditorReferencedRangesAcrossSheetContext=b,c.setWorkbookFocusStatus=M},"./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesExtension.js":function(t,n,i){var o,e,u,s,a,f,i,e;function h(t,n,i){var e=i.parent;t&&t.zQt===n||(i.Bde=new a.FormulaEditorReferencedRangesContext(n),(0,a.setWorkbookFocusStatus)(e,i.Bde.Dvt()))}function c(t,n,i){var i;(0,a.isFormulaEditorReferencedRangesContext)(t)&&(i=i.parent,r(t,n,i)?(0,a.closeFormulaReferencedRanges)(n.state):document.activeElement!==n.contentDOM&&setTimeout(function(){n.focus()},10))}function r(t,n,i){var e=document.activeElement;return e!==n.contentDOM&&!(e.hasAttribute("data-gc-formula-editor-additional-element")||t.Dvt()&&i&&i.Ti&&i.Ti.contains(e))}function l(t,n){var n,i;v(t.keyCode)&&(i=(n=(0,u.getActiveSheetByState)(n.state))&&n.Bde,(0,a.isFormulaEditorReferencedRangesContext)(i))&&n.rt.yk(t)}function v(t){return 16===t||17===t||18===t}function d(t,n){var i,e,r,i=n.oldSheet,e=n.newSheet;i&&e&&i!==e&&(r=i.Bde,(0,a.isFormulaEditorReferencedRangesContext)(r))&&(r.Dvt()||o.Hde.DJ)&&(n.needTriggerSheetChange=!1,e.Bde=r,i.Bde=f)}function y(t,n){var i,n,i,i,i=n.oldSheet,n=n.newSheet;if(n&&!n.xT&&i!==n&&(i=n.Bde,(0,a.isFormulaEditorReferencedRangesContext)(i))&&(i.Dvt()||o.Hde.DJ))return i.cve()!==n?o.Hde.DJ=new a.FormulaEditorReferencedRangesAcrossSheetContext(i):(i=o.Hde.DJ,(0,a.isFormulaEditorReferencedRangesAcrossSheetContext)(i)&&(i.d5(),o.Hde.DJ=f)),(0,s.paintFormulaReferencedRanges)(n),!0}Object.defineProperty(n,"__esModule",{value:!0}),n.uve=n.ave=n.isMetaKeyForAppendingRange=n.formulaReferencedRangesExtension=void 0,o=i("FormulaTextBox"),e=i("./dist/plugins/formulaPanel/editor/codemirror/index.js"),u=i("./dist/plugins/formulaPanel/editor/common/codeMirrorUtil.js"),s=i("./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js"),a=i("./dist/plugins/formulaPanel/editor/spreadFeatureProvider/formulaReferencedRangesContext.js"),f=void 0,i=e.View.EditorView.updateListener.of(function(t){var n,i,e,r,n=(0,u.getActiveSheetByState)(t.state);n&&(i=n.parent,e=n.Bde,r=o.Hde.Ude(),!e&&(0,a.isFormulaEditorReferencedRangesAcrossSheetContext)(r)&&(e=r.lve),t.focusChanged?((t.view.hasFocus?h:c)(e,t.view,n),(0,s.paintFormulaReferencedRanges)(n)):(t.selectionSet||t.docChanged)&&e&&(t.transactions.some(function(t){return!t.annotation(a.appendingRangeAnnotation)})&&e.qD(),(0,a.setWorkbookFocusStatus)(i,e.Dvt()),(0,s.paintFormulaReferencedRanges)(n)))}),e=e.View.ViewPlugin.define(function(){return null},{eventHandlers:{keydown:l,keyup:l}}),n.formulaReferencedRangesExtension=[i,e],n.isMetaKeyForAppendingRange=v,n.ave=d,n.uve=y},"./dist/plugins/formulaPanel/editor/spreadFeatureProvider/structReferences.js":function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.getStructReferencesByWorkbook=void 0;var u=i("CalcEngine");function e(t){return t?r(t).concat(s(t)):[]}function r(t){var i=[];return t.sheets.forEach(function(t){var n;(t.tables&&t.tables.all()||[]).forEach(function(t){i.push({name:t.name(),description:(0,u.sR)().Fbx_TableName_Description+t.name(),getColumns:function(){return o(t)}})})}),i}function o(t){for(var i,n,e,r,o,i=[],n=0,e="";null!==e;)e=t.getColumnName(n),n++,null!==e&&i.push({name:e,description:""});return r=(0,u.sR)().d2t,o=(0,u.getMapping)()&&(0,u.getMapping)().tableFunctionsMapping,Object.keys(r).forEach(function(t){var t=r[t],n=t.name,t=t.description,n=o&&o[n]||n;i.push({name:n,description:t})}),i}function s(t){var n=[];return t.mp.forEach(function(t){n.push({name:t.name(),description:(0,u.sR)().Fbx_TableSheetName_Description+t.name(),getColumns:function(){return a(t)}})}),n}function a(t){for(var n,i,e,n=[],i=t.getColumnCount(),e=0;e<i;e++)n.push({name:t.getColumnName(e),description:""});return n}n.getStructReferencesByWorkbook=e},"./dist/plugins/formulaPanel/formulaPanel.entry.js":function(t,n,i){var e,r,o,u,s,a,f,h,c,e=this&&this.__createBinding||(Object.create?function(t,n,i,e){void 0===e&&(e=i);var r=Object.getOwnPropertyDescriptor(n,i);r&&("get"in r?n.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(t,e,r)}:function(t,n,i,e){t[e=void 0===e?i:e]=n[i]}),r=this&&this.__exportStar||function(t,n){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||e(n,t,i)};Object.defineProperty(n,"__esModule",{value:!0}),n.findControl=n.vve=n.Commands=n.FormulaEditor=void 0,o=i("Core"),i("./dist/plugins/formulaPanel/editor/formulaEditor-spreadjs.js"),i("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),u=i("./dist/plugins/formulaPanel/editor/formulaEditor.js"),s=i("./dist/plugins/formulaPanel/editor/featureProvider/lint.js"),a=i("./dist/plugins/formulaPanel/editor/common/formatter.js"),f=i("./dist/plugins/formulaPanel/editor/formulaEditor.js"),Object.defineProperty(n,"FormulaEditor",{enumerable:!0,get:function(){return f.FormulaEditor}}),h=i("./dist/plugins/formulaPanel/editor/formulaEditor-action.js"),Object.defineProperty(n,"Commands",{enumerable:!0,get:function(){return h.Commands}}),n.vve={mve:s.getDiagnostic,I5:a.format},r(i("./dist/plugins/formulaPanel/editor/editor.ns.js"),n),n.findControl=c=function(t){return"string"==typeof t&&(t=document.getElementById(t)),(0,o.GC$)(t).data(u.CONST_FORMULA_EDITOR)}},Common:function(t){t.exports=n.Spread},CalcEngine:function(t){t.exports=n.Spread.CalcEngine},Core:function(t){t.exports=n.Spread.Sheets},SheetsCalc:function(t){t.exports=n.Spread.Sheets.CalcEngine},FormulaTextBox:function(t){t.exports=n.Spread.Sheets.FormulaTextBox}},e={},t=r("./dist/plugins/formulaPanel/formulaPanel.entry.js"),(((n=void 0===n?{}:n).Spread=n.Spread||{}).Sheets=n.Spread.Sheets||{}).FormulaPanel=t}(),n.Spread.Common.CultureManager.reloadResources&&n.Spread.Common.CultureManager.reloadResources("FormulaPanel")});
|