@aquera/nile-elements 0.1.12 → 0.1.14
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.
- package/README.md +7 -0
- package/dist/nile-code-editor/extensionSetup.cjs.js +5 -5
- package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
- package/dist/nile-code-editor/theme.cjs.js +1 -1
- package/dist/nile-code-editor/theme.cjs.js.map +1 -1
- package/dist/nile-code-editor/theme.esm.js +1 -1
- package/dist/nile-form-help-text/index.cjs.js +1 -1
- package/dist/nile-form-help-text/index.esm.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.cjs.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.cjs.js.map +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.css.cjs.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.css.cjs.js.map +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.css.esm.js +22 -6
- package/dist/nile-form-help-text/nile-form-help-text.esm.js +20 -16
- package/dist/nile-form-help-text/nile-form-help-text.test.cjs.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.test.cjs.js.map +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.test.esm.js +1 -1
- package/dist/src/nile-code-editor/extensionSetup.js +1 -3
- package/dist/src/nile-code-editor/extensionSetup.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.d.ts +5 -0
- package/dist/src/nile-code-editor/nile-code-editor.js +32 -2
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-code-editor/theme.d.ts +24 -0
- package/dist/src/nile-code-editor/theme.js +24 -0
- package/dist/src/nile-code-editor/theme.js.map +1 -1
- package/dist/src/nile-form-help-text/nile-form-help-text.css.js +22 -6
- package/dist/src/nile-form-help-text/nile-form-help-text.css.js.map +1 -1
- package/dist/src/nile-form-help-text/nile-form-help-text.d.ts +13 -10
- package/dist/src/nile-form-help-text/nile-form-help-text.js +61 -82
- package/dist/src/nile-form-help-text/nile-form-help-text.js.map +1 -1
- package/dist/src/nile-form-help-text/nile-form-help-text.test.js +73 -52
- package/dist/src/nile-form-help-text/nile-form-help-text.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-code-editor/extensionSetup.ts +0 -6
- package/src/nile-code-editor/nile-code-editor.ts +34 -2
- package/src/nile-code-editor/theme.ts +28 -0
- package/src/nile-form-help-text/nile-form-help-text.css.ts +22 -6
- package/src/nile-form-help-text/nile-form-help-text.test.ts +83 -59
- package/src/nile-form-help-text/nile-form-help-text.ts +64 -82
- package/vscode-html-custom-data.json +2 -14
@@ -1,7 +1,7 @@
|
|
1
|
-
System.register([],function(_export,_context){"use strict";var t,e,i,n,h,l,o,f,_t18,d,M,x,S,A,R,T,B,N,j,z,V,F,q,U,J,G,_,X,Y,Q,Z,it,st,rt,nt,ht,lt,ot,ut,ft,at,ct,dt,bt,kt,yt,Mt,St,Ct,Ot,Et,It,Rt,Bt,Lt,jt,qt,Ut,Jt,Gt,Kt,_t,Xt,Yt,Qt,Zt,te,ee,pe,me,ge,Se,Ae,Ce,De,Re,Te,Be,Le,Ne,je,$e,ze,Pe,He,We,Ve,Fe,qe,Ue,Je,Ye,ei,ii,si,ri,ni,hi,li,oi,ai,di,pi,mi,gi,bi,vi,ki,yi,_i66,_arr,_t66,_e61,_i67,xi,Si,Ci,Ii,Bi,Li,Ni,ji,$i,zi,Pi,Hi,Wi,Vi,Fi,qi,Ji,Gi,Ki,_i,Xi,Yi,Qi,Zi,ts,es,is,rs,hs,ls,os,us,fs,cs,Cs,Es,Is,Rs,Bs,Ls,Ns,js,Ps,Hs,Fs,qs,Us,Js,_s,Xs,Zs,tr,er,ir,sr,rr,nr,hr,lr,or,ur,fr,cr,dr,gr,wr,br,vr,xr,Sr,Cr,Or,Dr,Er,Ir,Rr,Br,Lr,Nr,$r,zr,Hr,Wr,Vr,Ur,Jr,Gr,Kr,Xr,Qr,Zr,tn,sn,rn,hn,un,fn,cn,dn,mn,wn,bn,vn,kn,yn,Mn,Sn,An,Cn,On,Dn,En,In,Rn,Tn,Bn,Ln,Nn,$n,Hn,Wn,Vn,Fn,Un,Jn,Gn,Kn,_n,Xn,Yn,Qn,Zn,th,eh,rh,nh,lh,oh,fh,ah,ch,dh,ph,gh,bh,yh,Mh,xh,Sh,Ah,Ch,Dh,Rh,Th,Bh,Lh,Nh,jh,$h,zh,Ph,Hh,Wh,Vh,Fh,qh,Uh,Jh,_h,Xh,Zh,tl,il,sl,nl,ol,ul,fl,al,dl,ml,gl,wl,yl,Ml,Cl,Ol,Dl,El,Rl,Tl,Nl,jl,$l,zl,Pl,Hl,Wl,Vl,Fl,ql,Ul,Jl,Gl,Kl,_l,Xl,Yl,Ql,Zl,eo,io,ro,ho,lo,oo,fo,ao,co,po,mo,go,wo,bo,Mo,xo,Oo,Ro,Bo,Lo,Po,Ho,Vo,Go,Ko,_o,Qo,Zo,tu,eu,iu,su,ru,nu,lu,ou,uu,fu,au,cu,du,pu,mu,wu,bu,vu,Su,Au,Cu,Ou,Du,_i176,_arr2,_arr2$_i,_t252,_e213,Tu,Bu,Lu,ju,Pu,Hu,Wu,Vu,Fu,Uu,Ju,Gu,Ku,_u,Qu,Zu,nf,hf,lf,pf,mf,kf,yf,Sf,Af,Ef,If,Bf,Lf,jf,$f,zf,Pf,Hf,Wf,qf,Uf,Jf,Gf,Kf,Qf,ea,ra,na,ha,la,oa,ua,fa,aa,pa,ma,ga,wa,ba,va,ka,Ma,xa,Sa,Aa,Ca,Da,Ta,Ba,La,Na,ja,$a,za,Pa,Wa,Va,Fa,qa,Ua,Xa,Ya,Qa,Za,ec,ic,rc,nc,hc,fc,dc,pc,gc,wc,bc,vc,kc,Sc,Oc,Dc,Ec,Rc,Bc,Lc,Nc,jc,$c,Pc,Wc,Vc,Fc,qc,Uc,Jc,Gc,Kc,_c,Xc,Yc,Qc,Zc,td,rd,nd,hd,od,ud,fd,ad,cd,dd,gd,wd,bd,Od,Dd,Ed,Id,Td,Bd,Ld,Nd,jd,Pd,Hd,Wd,qd,Ud,Jd,Kd,_d,Xd,Yd;function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e268){throw _e268;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e269){didErr=true;err=_e269;},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]();}finally{if(didErr)throw err;}}};}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function s(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1e9;for(var _r9=0,_n11=0,_h8=!0;_n11<t.length&&_r9<=s;_n11++){var _l7=t[_n11],_o4=_r9+_l7.length;_o4>=i&&(_o4>s&&(_l7=_l7.slice(0,s-_r9)),_r9<i&&(_l7=_l7.slice(i-_r9)),_h8?(e[e.length-1]+=_l7,_h8=!1):e.push(_l7)),_r9=_o4+1;}return e;}function r(t,e,i){return s(t,[""],e,i);}function u(t,e,i){return[e=Math.max(0,Math.min(t.length,e)),Math.max(e,Math.min(t.length,i))];}function a(t){for(var _e13=1;_e13<f.length;_e13+=2)if(f[_e13]>t)return f[_e13-1]<=t;return!1;}function c(t){return t>=127462&&t<=127487;}function p(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;return(i?m:g)(t,e,s);}function m(t,e,i){if(e==t.length)return e;e&&w(t.charCodeAt(e))&&b(t.charCodeAt(e-1))&&e--;var s=v(t,e);for(e+=y(s);e<t.length;){var _r11=v(t,e);if(s==d||_r11==d||i&&a(_r11))e+=y(_r11),s=_r11;else{if(!c(_r11))break;{var _i9=0,_s4=e-2;for(;_s4>=0&&c(v(t,_s4));)_i9++,_s4-=2;if(_i9%2==0)break;e+=2;}}}return e;}function g(t,e,i){for(;e>0;){var _s5=m(t,e-2,i);if(_s5<e)return _s5;e--;}return 0;}function w(t){return t>=56320&&t<57344;}function b(t){return t>=55296&&t<56320;}function v(t,e){var i=t.charCodeAt(e);if(!b(i)||e+1==t.length)return i;var s=t.charCodeAt(e+1);return w(s)?s-56320+(i-55296<<10)+65536:i;}function k(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)));}function y(t){return t<65536?1:2;}function C(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1;if(0==e&&i<=0)return;var r=t.length-2;r>=0&&i<=0&&i==t[r+1]?t[r]+=e:0==e&&0==t[r]?t[r+1]+=i:s?(t[r]+=e,t[r+1]+=i):t.push(e,i);}function O(e,i,s){if(0==s.length)return;var r=i.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(s);else{for(;e.length<r;)e.push(t.empty);e.push(s);}}function D(e,i,s){var r=e.inserted;for(var _n20=0,_h13=0,_l13=0;_l13<e.sections.length;){var _o8=e.sections[_l13++],_u15=e.sections[_l13++];if(_u15<0)_n20+=_o8,_h13+=_o8;else{var _f3=_n20,_a3=_h13,_c3=t.empty;for(;_f3+=_o8,_a3+=_u15,_u15&&r&&(_c3=_c3.append(r[_l13-2>>1])),!(s||_l13==e.sections.length||e.sections[_l13+1]<0);)_o8=e.sections[_l13++],_u15=e.sections[_l13++];i(_n20,_f3,_h13,_a3,_c3),_n20=_f3,_h13=_a3;}}}function E(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1;var r=[],n=s?[]:null,h=new R(t),l=new R(e);for(var _t22=-1;;)if(-1==h.ins&&-1==l.ins){var _t23=Math.min(h.len,l.len);C(r,_t23,-1),h.forward(_t23),l.forward(_t23);}else if(l.ins>=0&&(h.ins<0||_t22==h.i||0==h.off&&(l.len<h.len||l.len==h.len&&!i))){var _e21=l.len;for(C(r,l.ins,-1);_e21;){var _i16=Math.min(h.len,_e21);h.ins>=0&&_t22<h.i&&h.len<=_i16&&(C(r,0,h.ins),n&&O(n,r,h.text),_t22=h.i),h.forward(_i16),_e21-=_i16;}l.next();}else{if(!(h.ins>=0)){if(h.done&&l.done)return n?A.createSet(r,n):S.create(r);throw new Error("Mismatched change set lengths");}{var _e22=0,_i17=h.len;for(;_i17;)if(-1==l.ins){var _t24=Math.min(_i17,l.len);_e22+=_t24,_i17-=_t24,l.forward(_t24);}else{if(!(0==l.ins&&l.len<_i17))break;_i17-=l.len,l.next();}C(r,_e22,_t22<h.i?h.ins:0),n&&_t22<h.i&&O(n,r,h.text),_t22=h.i,h.forward(h.len-_i17);}}}function I(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=[],r=i?[]:null,n=new R(t),h=new R(e);for(var _t25=!1;;){if(n.done&&h.done)return r?A.createSet(s,r):S.create(s);if(0==n.ins)C(s,n.len,0,_t25),n.next();else if(0!=h.len||h.done){if(n.done||h.done)throw new Error("Mismatched change set lengths");{var _e23=Math.min(n.len2,h.len),_i18=s.length;if(-1==n.ins){var _i19=-1==h.ins?-1:h.off?0:h.ins;C(s,_e23,_i19,_t25),r&&_i19&&O(r,s,h.text);}else-1==h.ins?(C(s,n.off?0:n.len,_e23,_t25),r&&O(r,s,n.textBit(_e23))):(C(s,n.off?0:n.len,h.off?0:h.ins,_t25),r&&!h.off&&O(r,s,h.text));_t25=(n.ins>_e23||h.ins>=0&&h.len>_e23)&&(_t25||s.length>_i18),n.forward2(_e23),h.forward(_e23);}}else C(s,0,h.ins,_t25),r&&O(r,s,h.text),h.next();}}function L(t,e){var _iterator11=_createForOfIteratorHelper(t.ranges),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var _i23=_step11.value;if(_i23.to>e)throw new RangeError("Selection points outside of document");}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}}function $(t,e){return t==e||t.length==e.length&&t.every(function(t,i){return t===e[i];});}function P(t,e,i){if(t.length!=e.length)return!1;for(var _s13=0;_s13<t.length;_s13++)if(!i(t[_s13],e[_s13]))return!1;return!0;}function H(t,e){var i=!1;var _iterator13=_createForOfIteratorHelper(e),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var _s14=_step13.value;1&tt(t,_s14)&&(i=!0);}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}return i;}function W(t,e,i){var s=i.map(function(e){return t[e.id];}),r=i.map(function(t){return t.type;}),n=s.filter(function(t){return!(1&t);}),h=t[e.id]>>1;function l(t){var i=[];for(var _e25=0;_e25<s.length;_e25++){var _n22=et(t,s[_e25]);if(2==r[_e25]){var _iterator14=_createForOfIteratorHelper(_n22),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var _t26=_step14.value;i.push(_t26);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}else i.push(_n22);}return e.combine(i);}return{create:function create(t){var _iterator15=_createForOfIteratorHelper(s),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var _e26=_step15.value;tt(t,_e26);}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}return t.values[h]=l(t),1;},update:function update(t,i){if(!H(t,n))return 0;var s=l(t);return e.compare(s,t.values[h])?0:(t.values[h]=s,1);},reconfigure:function reconfigure(t,r){var n=H(t,s),o=r.config.facets[e.id],u=r.facet(e);if(o&&!n&&$(i,o))return t.values[h]=u,0;var f=l(t);return e.compare(f,u)?(t.values[h]=u,0):(t.values[h]=f,1);}};}function K(t){return function(e){return new X(e,t);};}function tt(t,e){if(1&e)return 2;var i=e>>1,s=t.status[i];if(4==s)throw new Error("Cyclic dependency between fields and/or facets");if(2&s)return s;t.status[i]=4;var r=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|r;}function et(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1];}function pt(t,e){var i=[];for(var _s18=0,_r19=0;;){var _n23=void 0,_h15=void 0;if(_s18<t.length&&(_r19==e.length||e[_r19]>=t[_s18]))_n23=t[_s18++],_h15=t[_s18++];else{if(!(_r19<e.length))return i;_n23=e[_r19++],_h15=e[_r19++];}!i.length||i[i.length-1]<_n23?i.push(_n23,_h15):i[i.length-1]<_h15&&(i[i.length-1]=_h15);}}function mt(t,e,i){var s;var r,n,h;return i?(r=e.changes,n=A.empty(e.changes.length),h=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),n=t.changes.mapDesc(e.changes,!0),h=t.changes.compose(r)),{changes:h,selection:e.selection?e.selection.map(n):null===(s=t.selection)||void 0===s?void 0:s.map(r),effects:ct.mapEffects(t.effects,r).concat(ct.mapEffects(e.effects,n)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView};}function gt(t,e,i){var s=e.selection,r=vt(e.annotations);return e.userEvent&&(r=r.concat(dt.userEvent.of(e.userEvent))),{changes:e.changes instanceof A?e.changes:A.of(e.changes||[],i,t.facet(rt)),selection:s&&(s instanceof B?s:B.single(s.anchor,s.head)),effects:vt(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView};}function wt(t,e,i){var s=gt(t,e.length?e[0]:{},t.doc.length);e.length&&!1===e[0].filter&&(i=!1);for(var _r20=1;_r20<e.length;_r20++){!1===e[_r20].filter&&(i=!1);var _n24=!!e[_r20].sequential;s=mt(s,gt(t,e[_r20],_n24?s.changes.newLength:t.doc.length),_n24);}var r=dt.create(t,s.changes,s.selection,s.effects,s.annotations,s.scrollIntoView);return function(t){var e=t.startState,i=e.facet(lt),s=t;for(var _r21=i.length-1;_r21>=0;_r21--){var _n25=i[_r21](t);_n25&&Object.keys(_n25).length&&(s=mt(s,gt(e,_n25,t.changes.newLength),!0));}return s==t?t:dt.create(e,t.changes,t.selection,s.effects,s.annotations,s.scrollIntoView);}(i?function(t){var e=t.startState,i=!0;var _iterator21=_createForOfIteratorHelper(e.facet(nt)),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var _s20=_step21.value;var _e32=_s20(t);if(!1===_e32){i=!1;break;}Array.isArray(_e32)&&(i=!0===i?_e32:pt(i,_e32));}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}if(!0!==i){var _s19,_r22;if(!1===i)_r22=t.changes.invertedDesc,_s19=A.empty(e.doc.length);else{var _e31=t.changes.filter(i);_s19=_e31.changes,_r22=_e31.filtered.mapDesc(_e31.changes).invertedDesc;}t=dt.create(e,_s19,t.selection&&t.selection.map(_r22),ct.mapEffects(t.effects,_r22),t.annotations,t.scrollIntoView);}var s=e.facet(ht);for(var _i27=s.length-1;_i27>=0;_i27--){var _r23=s[_i27](t);t=_r23 instanceof dt?_r23:Array.isArray(_r23)&&1==_r23.length&&_r23[0]instanceof dt?_r23[0]:wt(e,vt(_r23),!1);}return t;}(r):r);}function vt(t){return null==t?bt:Array.isArray(t)?t:[t];}function xt(t){return function(e){if(!/\S/.test(e))return kt.Space;if(function(t){if(Mt)return Mt.test(t);for(var _e33=0;_e33<t.length;_e33++){var _i28=t[_e33];if(/\w/.test(_i28)||_i28>""&&(_i28.toUpperCase()!=_i28.toLowerCase()||yt.test(_i28)))return!0;}return!1;}(e))return kt.Word;for(var _i29=0;_i29<t.length;_i29++)if(e.indexOf(t[_i29])>-1)return kt.Word;return kt.Other;};}function At(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var s={};var _iterator26=_createForOfIteratorHelper(t),_step26;try{for(_iterator26.s();!(_step26=_iterator26.n()).done;){var _e37=_step26.value;for(var _i33=0,_Object$keys=Object.keys(_e37);_i33<_Object$keys.length;_i33++){var _t35=_Object$keys[_i33];var _r26=_e37[_t35],_n28=s[_t35];if(void 0===_n28)s[_t35]=_r26;else if(_n28===_r26||void 0===_r26);else{if(!Object.hasOwnProperty.call(i,_t35))throw new Error("Config merge conflict for field "+_t35);s[_t35]=i[_t35](_n28,_r26);}}}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}for(var _t34 in e)void 0===s[_t34]&&(s[_t34]=e[_t34]);return s;}function Dt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide;}function Tt(t,e,i){var s=new Map();var _iterator29=_createForOfIteratorHelper(t),_step29;try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var _e40=_step29.value;for(var _t40=0;_t40<_e40.chunk.length;_t40++)_e40.chunk[_t40].maxPoint<=0&&s.set(_e40.chunk[_t40],_e40.chunkPos[_t40]);}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}var r=new Set();var _iterator30=_createForOfIteratorHelper(e),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var _t41=_step30.value;for(var _e41=0;_e41<_t41.chunk.length;_e41++){var _n33=s.get(_t41.chunk[_e41]);null==_n33||(i?i.mapPos(_n33):_n33)!=_t41.chunkPos[_e41]||(null==i?void 0:i.touchesRange(_n33,_n33+_t41.chunk[_e41].length))||r.add(_t41.chunk[_e41]);}}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}return r;}function Nt(t,e){for(var _i40=t[e];;){var _s28=1+(e<<1);if(_s28>=t.length)break;var _r33=t[_s28];if(_s28+1<t.length&&_r33.compare(t[_s28+1])>=0&&(_r33=t[_s28+1],_s28++),_i40.compare(_r33)<0)break;t[_s28]=_i40,t[e]=_r33,e=_s28;}}function $t(t,e,i,s,r,n){t["goto"](e),i["goto"](s);var h=s+r,l=s,o=s-e;for(;;){var _e45=t.to+o-i.to||t.endSide-i.endSide,_s30=_e45<0?t.to+o:i.to,_r34=Math.min(_s30,h);if(t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&zt(t.activeForPoint(t.to),i.activeForPoint(i.to))||n.comparePoint(l,_r34,t.point,i.point):_r34>l&&!zt(t.active,i.active)&&n.compareRange(l,_r34,t.active,i.active),_s30>h)break;l=_s30,_e45<=0&&t.next(),_e45>=0&&i.next();}}function zt(t,e){if(t.length!=e.length)return!1;for(var _i43=0;_i43<t.length;_i43++)if(t[_i43]!=e[_i43]&&!t[_i43].eq(e[_i43]))return!1;return!0;}function Pt(t,e){for(var _i44=e,_s31=t.length-1;_i44<_s31;_i44++)t[_i44]=t[_i44+1];t.pop();}function Ht(t,e,i){for(var _i45=t.length-1;_i45>=e;_i45--)t[_i45+1]=t[_i45];t[e]=i;}function Wt(t,e){var i=-1,s=1e9;for(var _r35=0;_r35<e.length;_r35++)(e[_r35]-s||t[_r35].endSide-t[i].endSide)<0&&(i=_r35,s=e[_r35]);return i;}function Vt(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:t.length;var s=0;for(var _r36=0;_r36<i;)9==t.charCodeAt(_r36)?(s+=e-s%e,_r36++):(s++,_r36=p(t,_r36));return s;}function Ft(t,e,i,s){for(var _s32=0,_r37=0;;){if(_r37>=e)return _s32;if(_s32==t.length)break;_r37+=9==t.charCodeAt(_s32)?i-_r37%i:1,_s32=p(t,_s32);}return!0===s?-1:t.length;}function ie(t){var e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection();}function se(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e));}function re(t,e){if(!e.anchorNode)return!1;try{return se(t,e.anchorNode);}catch(t){return!1;}}function ne(t){return 3==t.nodeType?be(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[];}function he(t,e,i,s){return!!i&&(ue(t,e,i,s,-1)||ue(t,e,i,s,1));}function le(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e;}function oe(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName);}function ue(t,e,i,s,r){for(;;){if(t==i&&e==s)return!0;if(e==(r<0?0:fe(t))){if("DIV"==t.nodeName)return!1;var _i48=t.parentNode;if(!_i48||1!=_i48.nodeType)return!1;e=le(t)+(r<0?0:1),t=_i48;}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=r<0?fe(t):0;}}}function fe(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length;}function ae(t,e){var i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom};}function ce(t){var e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight};}function de(t,e){var i=e.width/t.offsetWidth,s=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(s>.995&&s<1.005||!isFinite(s)||Math.abs(e.height-t.offsetHeight)<1)&&(s=1),{scaleX:i,scaleY:s};}function we(t){if(t.setActive)return t.setActive();if(ge)return t.focus(ge);var e=[];for(var _i49=t;_i49&&(e.push(_i49,_i49.scrollTop,_i49.scrollLeft),_i49!=_i49.ownerDocument);_i49=_i49.parentNode);if(t.focus(null==ge?{get preventScroll(){return ge={preventScroll:!0},!0;}}:void 0),!ge){ge=!1;for(var _t49=0;_t49<e.length;){var _i50=e[_t49++],_s33=e[_t49++],_r38=e[_t49++];_i50.scrollTop!=_s33&&(_i50.scrollTop=_s33),_i50.scrollLeft!=_r38&&(_i50.scrollLeft=_r38);}}}function be(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:e;var s=me||(me=document.createRange());return s.setEnd(t,i),s.setStart(t,e),s;}function ve(t,e,i,s){var _s34;var r={key:e,code:e,keyCode:i,which:i,cancelable:!0};s&&(_s34=s,r.altKey=_s34.altKey,r.ctrlKey=_s34.ctrlKey,r.shiftKey=_s34.shiftKey,r.metaKey=_s34.metaKey,_s34);var n=new KeyboardEvent("keydown",r);n.synthetic=!0,t.dispatchEvent(n);var h=new KeyboardEvent("keyup",r);return h.synthetic=!0,t.dispatchEvent(h),n.defaultPrevented||h.defaultPrevented;}function ke(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0]);}function ye(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4);}function Me(t,e){for(var _i51=t,_s35=e;;){if(3==_i51.nodeType&&_s35>0)return{node:_i51,offset:_s35};if(1==_i51.nodeType&&_s35>0){if("false"==_i51.contentEditable)return null;_i51=_i51.childNodes[_s35-1],_s35=fe(_i51);}else{if(!_i51.parentNode||oe(_i51))return null;_s35=le(_i51),_i51=_i51.parentNode;}}}function xe(t,e){for(var _i52=t,_s36=e;;){if(3==_i52.nodeType&&_s36<_i52.nodeValue.length)return{node:_i52,offset:_s36};if(1==_i52.nodeType&&_s36<_i52.childNodes.length){if("false"==_i52.contentEditable)return null;_i52=_i52.childNodes[_s36],_s36=0;}else{if(!_i52.parentNode||oe(_i52))return null;_s36=le(_i52)+1,_i52=_i52.parentNode;}}}function Oe(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e;}function Ee(t,e,i,s,r,n,h,l,o){var u=t.children,f=u.length?u[e]:null,a=n.length?n[n.length-1]:null,c=a?a.breakAfter:h;if(!(e==s&&f&&!h&&!c&&n.length<2&&f.merge(i,r,n.length?a:null,0==i,l,o))){if(s<u.length){var _t56=u[s];_t56&&(r<_t56.length||_t56.breakAfter&&(null==a?void 0:a.breakAfter))?(e==s&&(_t56=_t56.split(r),r=0),!c&&a&&_t56.merge(0,r,a,!0,0,o)?n[n.length-1]=_t56:((r||_t56.children.length&&!_t56.children[0].length)&&_t56.merge(0,r,null,!1,0,o),n.push(_t56))):(null==_t56?void 0:_t56.breakAfter)&&(a?a.breakAfter=1:h=1),s++;}for(f&&(f.breakAfter=h,i>0&&(!h&&n.length&&f.merge(i,f.length,n[0],!1,l,0)?f.breakAfter=n.shift().breakAfter:(i<f.length||f.children.length&&0==f.children[f.children.length-1].length)&&f.merge(i,f.length,null,!1,l,0),e++));e<s&&n.length;)if(u[s-1].become(n[n.length-1]))s--,n.pop(),o=n.length?0:l;else{if(!u[e].become(n[0]))break;e++,n.shift(),l=n.length?0:o;}!n.length&&e&&s<u.length&&!u[e-1].breakAfter&&u[s].merge(0,0,u[e-1],!1,l,o)&&e--,(e<s||n.length)&&t.replaceChildren(e,s,n);}}function Ie(t,e,i,s,r,n){var h=t.childCursor(),_h$findPos=h.findPos(i,1),l=_h$findPos.i,o=_h$findPos.off,_h$findPos2=h.findPos(e,-1),u=_h$findPos2.i,f=_h$findPos2.off,a=e-i;var _iterator37=_createForOfIteratorHelper(s),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var _t57=_step37.value;a+=_t57.length;}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}t.length+=a,Ee(t,u,f,l,o,s,0,r,n);}function Ge(t,e){var i=t.dom,s=t.children,r=0;for(var _t60=0;r<s.length;r++){var _n38=s[r],_h22=_t60+_n38.length;if(!(_h22==_t60&&_n38.getSide()<=0)){if(e>_t60&&e<_h22&&_n38.dom.parentNode==i)return _n38.domAtPos(e-_t60);if(e<=_t60)break;_t60=_h22;}}for(var _t61=r;_t61>0;_t61--){var _e57=s[_t61-1];if(_e57.dom.parentNode==i)return _e57.domAtPos(_e57.length);}for(var _t62=r;_t62<s.length;_t62++){var _e58=s[_t62];if(_e58.dom.parentNode==i)return _e58.domAtPos(0);}return new Se(i,0);}function Ke(t,e,i){var s,r=t.children;i>0&&e instanceof qe&&r.length&&(s=r[r.length-1])instanceof qe&&s.mark.eq(e.mark)?Ke(s,e.children[0],i-1):(r.push(e),e.setParent(t)),t.length+=e.length;}function _e(t,e,i){var s=null,r=-1,n=null,h=-1;!function t(e,l){for(var _o12=0,_u19=0;_o12<e.children.length&&_u19<=l;_o12++){var _f6=e.children[_o12],_a5=_u19+_f6.length;_a5>=l&&(_f6.children.length?t(_f6,l-_u19):(!n||n.isHidden&&i>0)&&(_a5>l||_u19==_a5&&_f6.getSide()>0)?(n=_f6,h=l-_u19):(_u19<l||_u19==_a5&&_f6.getSide()<0&&!_f6.isHidden)&&(s=_f6,r=l-_u19)),_u19=_a5;}}(t,e);var l=(i<0?s:n)||s||n;return l?l.coordsAt(Math.max(0,l==s?r:h),i):function(t){var e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();var i=ne(e);return i[i.length-1]||null;}(t);}function Xe(t,e){for(var _i58 in t)"class"==_i58&&e["class"]?e["class"]+=" "+t["class"]:"style"==_i58&&e.style?e.style+=";"+t.style:e[_i58]=t[_i58];return e;}function Qe(t,e,i){if(t==e)return!0;t||(t=Ye),e||(e=Ye);var s=Object.keys(t),r=Object.keys(e);if(s.length-(i&&s.indexOf(i)>-1?1:0)!=r.length-(i&&r.indexOf(i)>-1?1:0))return!1;for(var _i59=0,_s41=s;_i59<_s41.length;_i59++){var _n39=_s41[_i59];if(_n39!=i&&(-1==r.indexOf(_n39)||t[_n39]!==e[_n39]))return!1;}return!0;}function Ze(t,e,i){var s=!1;if(e)for(var _r40 in e)i&&_r40 in i||(s=!0,"style"==_r40?t.style.cssText="":t.removeAttribute(_r40));if(i)for(var _r41 in i)e&&e[_r41]==i[_r41]||(s=!0,"style"==_r41?t.style.cssText=i[_r41]:t.setAttribute(_r41,i[_r41]));return s;}function ti(t){var e=Object.create(null);for(var _i60=0;_i60<t.attributes.length;_i60++){var _s42=t.attributes[_i60];e[_s42.name]=_s42.value;}return e;}function ui(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;var i=t.inclusiveStart,s=t.inclusiveEnd;return null==i&&(i=t.inclusive),null==s&&(s=t.inclusive),{start:null!=i?i:e,end:null!=s?s:e};}function fi(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=i.length-1;r>=0&&i[r]+s>=t?i[r]=Math.max(i[r],e):i.push(t,e);}function ci(t,e){var _iterator41=_createForOfIteratorHelper(e),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var _i64=_step41.value;t=new qe(_i64,[t],t.length);}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}return t;}function wi(t){var e=[];for(var _i65=0;_i65<t.length;_i65++)e.push(1<<+t[_i65]);return e;}function Mi(t){return t<=247?bi[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?vi[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1;}function Ai(t,e){if(t.length!=e.length)return!1;for(var _i68=0;_i68<t.length;_i68++){var _s48=t[_i68],_r44=e[_i68];if(_s48.from!=_r44.from||_s48.to!=_r44.to||_s48.direction!=_r44.direction||!Ai(_s48.inner,_r44.inner))return!1;}return!0;}function Oi(t,e,i,s,r,n,h){var l=s%2?2:1;if(s%2==r%2)for(var _o14=e,_u21=0;_o14<i;){var _e62=!0,_f7=!1;if(_u21==n.length||_o14<n[_u21].from){var _t67=Ci[_o14];_t67!=l&&(_e62=!1,_f7=16==_t67);}var _a6=_e62||1!=l?null:[],_c5=_e62?s:s+1,_d2=_o14;t:for(;;)if(_u21<n.length&&_d2==n[_u21].from){if(_f7)break t;var _p=n[_u21];if(!_e62)for(var _t68=_p.to,_e63=_u21+1;;){if(_t68==i)break t;if(!(_e63<n.length&&n[_e63].from==_t68)){if(Ci[_t68]==l)break t;break;}_t68=n[_e63++].to;}if(_u21++,_a6)_a6.push(_p);else{_p.from>_o14&&h.push(new Si(_o14,_p.from,_c5)),Di(t,_p.direction==mi!=!(_c5%2)?s+1:s,r,_p.inner,_p.from,_p.to,h),_o14=_p.to;}_d2=_p.to;}else{if(_d2==i||(_e62?Ci[_d2]!=l:Ci[_d2]==l))break;_d2++;}_a6?Oi(t,_o14,_d2,s+1,r,_a6,h):_o14<_d2&&h.push(new Si(_o14,_d2,_c5)),_o14=_d2;}else for(var _o15=i,_u22=n.length;_o15>e;){var _i69=!0,_f8=!1;if(!_u22||_o15>n[_u22-1].to){var _t69=Ci[_o15-1];_t69!=l&&(_i69=!1,_f8=16==_t69);}var _a7=_i69||1!=l?null:[],_c6=_i69?s:s+1,_d3=_o15;t:for(;;)if(_u22&&_d3==n[_u22-1].to){if(_f8)break t;var _p2=n[--_u22];if(!_i69)for(var _t70=_p2.from,_i70=_u22;;){if(_t70==e)break t;if(!_i70||n[_i70-1].to!=_t70){if(Ci[_t70-1]==l)break t;break;}_t70=n[--_i70].from;}if(_a7)_a7.push(_p2);else{_p2.to<_o15&&h.push(new Si(_p2.to,_o15,_c6)),Di(t,_p2.direction==mi!=!(_c6%2)?s+1:s,r,_p2.inner,_p2.from,_p2.to,h),_o15=_p2.from;}_d3=_p2.from;}else{if(_d3==e||(_i69?Ci[_d3-1]!=l:Ci[_d3-1]==l))break;_d3--;}_a7?Oi(t,_d3,_o15,s+1,r,_a7,h):_d3<_o15&&h.push(new Si(_d3,_o15,_c6)),_o15=_d3;}}function Di(t,e,i,s,r,n,h){var l=e%2?2:1;!function(t,e,i,s,r){for(var _n44=0;_n44<=s.length;_n44++){var _h24=_n44?s[_n44-1].to:e,_l21=_n44<s.length?s[_n44].from:i,_o16=_n44?256:r;for(var _e64=_h24,_i71=_o16,_s49=_o16;_e64<_l21;_e64++){var _r45=Mi(t.charCodeAt(_e64));512==_r45?_r45=_i71:8==_r45&&4==_s49&&(_r45=16),Ci[_e64]=4==_r45?2:_r45,7&_r45&&(_s49=_r45),_i71=_r45;}for(var _t71=_h24,_e65=_o16,_s50=_o16;_t71<_l21;_t71++){var _r46=Ci[_t71];if(128==_r46)_t71<_l21-1&&_e65==Ci[_t71+1]&&24&_e65?_r46=Ci[_t71]=_e65:Ci[_t71]=256;else if(64==_r46){var _r47=_t71+1;for(;_r47<_l21&&64==Ci[_r47];)_r47++;var _n45=_t71&&8==_e65||_r47<i&&8==Ci[_r47]?1==_s50?1:8:256;for(var _e66=_t71;_e66<_r47;_e66++)Ci[_e66]=_n45;_t71=_r47-1;}else 8==_r46&&1==_s50&&(Ci[_t71]=1);_e65=_r46,7&_r46&&(_s50=_r46);}}}(t,r,n,s,l),function(t,e,i,s,r){var n=1==r?2:1;for(var _h25=0,_l22=0,_o17=0;_h25<=s.length;_h25++){var _u23=_h25?s[_h25-1].to:e,_f9=_h25<s.length?s[_h25].from:i;for(var _e67,_i72,_s51,_h26=_u23;_h26<_f9;_h26++)if(_i72=ki[_e67=t.charCodeAt(_h26)]){if(_i72<0){for(var _t72=_l22-3;_t72>=0;_t72-=3)if(yi[_t72+1]==-_i72){var _e68=yi[_t72+2],_i73=2&_e68?r:4&_e68?1&_e68?n:r:0;_i73&&(Ci[_h26]=Ci[yi[_t72]]=_i73),_l22=_t72;break;}}else{if(189==yi.length)break;yi[_l22++]=_h26,yi[_l22++]=_e67,yi[_l22++]=_o17;}}else if(2==(_s51=Ci[_h26])||1==_s51){var _t73=_s51==r;_o17=_t73?0:1;for(var _e69=_l22-3;_e69>=0;_e69-=3){var _i74=yi[_e69+2];if(2&_i74)break;if(_t73)yi[_e69+2]|=2;else{if(4&_i74)break;yi[_e69+2]|=4;}}}}}(t,r,n,s,l),function(t,e,i,s){for(var _r48=0,_n46=s;_r48<=i.length;_r48++){var _h27=_r48?i[_r48-1].to:t,_l23=_r48<i.length?i[_r48].from:e;for(var _o18=_h27;_o18<_l23;){var _h28=Ci[_o18];if(256==_h28){var _h29=_o18+1;for(;;)if(_h29==_l23){if(_r48==i.length)break;_h29=i[_r48++].to,_l23=_r48<i.length?i[_r48].from:e;}else{if(256!=Ci[_h29])break;_h29++;}var _u24=1==_n46,_f10=_u24==(1==(_h29<e?Ci[_h29]:s))?_u24?1:2:s;for(var _e70=_h29,_s52=_r48,_n47=_s52?i[_s52-1].to:t;_e70>_o18;)_e70==_n47&&(_e70=i[--_s52].from,_n47=_s52?i[_s52-1].to:t),Ci[--_e70]=_f10;_o18=_h29;}else _n46=_h28,_o18++;}}}(r,n,s,l),Oi(t,r,n,e,i,s,h);}function Ei(t){return[new Si(0,t,0)];}function Ri(t,e,i,s,r){var n;var h=s.head-t.from,l=Si.find(e,h,null!==(n=s.bidiLevel)&&void 0!==n?n:-1,s.assoc),o=e[l],u=o.side(r,i);if(h==u){var _t74=l+=r?1:-1;if(_t74<0||_t74>=e.length)return null;o=e[l=_t74],h=o.side(!r,i),u=o.side(r,i);}var f=p(t.text,h,o.forward(r,i));(f<o.from||f>o.to)&&(f=u),Ii=t.text.slice(Math.min(h,f),Math.max(h,f));var a=l==(r?e.length-1:0)?null:e[l+(r?1:-1)];return a&&f==u&&a.level+(r?0:1)<o.level?B.cursor(a.side(!r,i)+t.from,a.forward(r,i)?1:-1,a.level):B.cursor(f+t.from,o.forward(r,i)?-1:1,o.level);}function Ti(t,e,i){for(var _s53=e;_s53<i;_s53++){var _e71=Mi(t.charCodeAt(_s53));if(1==_e71)return mi;if(2==_e71||4==_e71)return gi;}return mi;}function Ui(t,e,i){var s=t.facet(ji);s.length?s[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e);}function ss(t,e){var i=t.state.facet(is);if(!i.length)return i;var s=i.map(function(e){return e instanceof Function?e(t):e;}),r=[];return It.spans(s,e.from,e.to,{point:function point(){},span:function span(t,i,s,n){var h=t-e.from,l=i-e.from,o=r;for(var _t76=s.length-1;_t76>=0;_t76--,n--){var _i75=void 0,_r49=s[_t76].spec.bidiIsolate;if(null==_r49&&(_r49=Ti(e.text,h,l)),n>0&&o.length&&(_i75=o[o.length-1]).to==h&&_i75.direction==_r49)_i75.to=l,o=_i75.inner;else{var _t77={from:h,to:l,direction:_r49,inner:[]};o.push(_t77),o=_t77.inner;}}}}),r;}function ns(t){var e=0,i=0,s=0,r=0;var _iterator42=_createForOfIteratorHelper(t.state.facet(rs)),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var _n48=_step42.value;var _h30=_n48(t);_h30&&(null!=_h30.left&&(e=Math.max(e,_h30.left)),null!=_h30.right&&(i=Math.max(i,_h30.right)),null!=_h30.top&&(s=Math.max(s,_h30.top)),null!=_h30.bottom&&(r=Math.max(r,_h30.bottom)));}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}return{left:e,right:i,top:s,bottom:r};}function as(t,e){var i=t.observer.selectionRange;if(!i.focusNode)return null;var s=Me(i.focusNode,i.focusOffset),r=xe(i.focusNode,i.focusOffset),n=s||r;if(r&&s&&r.node!=s.node){var _e89=Ce.get(r.node);if(!_e89||_e89 instanceof Fe&&_e89.text!=r.node.nodeValue)n=r;else if(t.docView.lastCompositionAfterCursor){var _t96=Ce.get(s.node);!_t96||_t96 instanceof Fe&&_t96.text!=s.node.nodeValue||(n=r);}}if(t.docView.lastCompositionAfterCursor=n!=s,!n)return null;var h=e-n.offset;return{from:h,to:h+n.node.nodeValue.length,node:n.node};}function ds(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right);}function ps(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom);}function ms(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1;}function gs(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t;}function ws(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t;}function bs(t,e,i){var s,r,n,h,l,o,u,f,a=!1;for(var _c9=t.firstChild;_c9;_c9=_c9.nextSibling){var _t97=ne(_c9);for(var _d6=0;_d6<_t97.length;_d6++){var _p5=_t97[_d6];r&&ms(r,_p5)&&(_p5=gs(ws(_p5,r.bottom),r.top));var _m3=ds(e,_p5),_g3=ps(i,_p5);if(0==_m3&&0==_g3)return 3==_c9.nodeType?vs(_c9,e,i):bs(_c9,e,i);if(!s||h>_g3||h==_g3&&n>_m3){s=_c9,r=_p5,n=_m3,h=_g3;var _l28=_g3?i<_p5.top?-1:1:_m3?e<_p5.left?-1:1:0;a=!_l28||(_l28>0?_d6<_t97.length-1:_d6>0);}0==_m3?i>_p5.bottom&&(!u||u.bottom<_p5.bottom)?(l=_c9,u=_p5):i<_p5.top&&(!f||f.top>_p5.top)&&(o=_c9,f=_p5):u&&ms(u,_p5)?u=ws(u,_p5.bottom):f&&ms(f,_p5)&&(f=gs(f,_p5.top));}}if(u&&u.bottom>=i?(s=l,r=u):f&&f.top<=i&&(s=o,r=f),!s)return{node:t,offset:0};var c=Math.max(r.left,Math.min(r.right,e));return 3==s.nodeType?vs(s,c,i):a&&"false"!=s.contentEditable?bs(s,c,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,s)+(e>=(r.left+r.right)/2?1:0)};}function vs(t,e,i){var s=t.nodeValue.length,r=-1,n=1e9,h=0;for(var _l29=0;_l29<s;_l29++){var _s65=be(t,_l29,_l29+1).getClientRects();for(var _o23=0;_o23<_s65.length;_o23++){var _u28=_s65[_o23];if(_u28.top==_u28.bottom)continue;h||(h=e-_u28.left);var _f14=(_u28.top>i?_u28.top-i:i-_u28.bottom)-1;if(_u28.left-1<=e&&_u28.right+1>=e&&_f14<n){var _i82=e>=(_u28.left+_u28.right)/2,_s66=_i82;if(Ve.chrome||Ve.gecko){be(t,_l29).getBoundingClientRect().left==_u28.right&&(_s66=!_i82);}if(_f14<=0)return{node:t,offset:_l29+(_s66?1:0)};r=_l29+(_s66?1:0),n=_f14;}}}return{node:t,offset:r>-1?r:h>0?t.nodeValue.length:0};}function ks(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:-1;var r,n;var h,l=t.contentDOM.getBoundingClientRect(),o=l.top+t.viewState.paddingTop,u=t.viewState.docHeight,f=e.x,a=e.y,c=a-o;if(c<0)return 0;if(c>u)return t.state.doc.length;for(var _e90=t.viewState.heightOracle.textHeight/2,_r54=!1;h=t.elementAtHeight(c),h.type!=ri.Text;)for(;c=s>0?h.bottom+_e90:h.top-_e90,!(c>=0&&c<=u);){if(_r54)return i?null:0;_r54=!0,s=-s;}a=o+c;var d=h.from;if(d<t.viewport.from)return 0==t.viewport.from?0:i?null:ys(t,l,h,f,a);if(d>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:ys(t,l,h,f,a);var p=t.dom.ownerDocument,m=t.root.elementFromPoint?t.root:p,g=m.elementFromPoint(f,a);g&&!t.contentDOM.contains(g)&&(g=null),g||(f=Math.max(l.left+1,Math.min(l.right-1,f)),g=m.elementFromPoint(f,a),g&&!t.contentDOM.contains(g)&&(g=null));var w,b=-1;if(g&&0!=(null===(r=t.docView.nearest(g))||void 0===r?void 0:r.isEditable))if(p.caretPositionFromPoint){var _t99;var _t98=p.caretPositionFromPoint(f,a);_t98&&(_t99=_t98,w=_t99.offsetNode,b=_t99.offset,_t99);}else if(p.caretRangeFromPoint){var _e91=p.caretRangeFromPoint(f,a);_e91&&((w=_e91.startContainer,b=_e91.startOffset),(!t.contentDOM.contains(w)||Ve.safari&&function(t,e,i){var s;if(3!=t.nodeType||e!=(s=t.nodeValue.length))return!1;for(var _e92=t.nextSibling;_e92;_e92=_e92.nextSibling)if(1!=_e92.nodeType||"BR"!=_e92.nodeName)return!1;return be(t,s-1,s).getBoundingClientRect().left>i;}(w,b,f)||Ve.chrome&&function(t,e,i){if(0!=e)return!1;for(var _e93=t;;){var _t100=_e93.parentNode;if(!_t100||1!=_t100.nodeType||_t100.firstChild!=_e93)return!1;if(_t100.classList.contains("cm-line"))break;_e93=_t100;}var s=1==t.nodeType?t.getBoundingClientRect():be(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-s.left>5;}(w,b,f))&&(w=void 0));}if(!w||!t.docView.dom.contains(w)){var _e94=ei.find(t.docView,d);if(!_e94)return c>h.top+h.height/2?h.to:h.from;var _bs=bs(_e94.dom,f,a);w=_bs.node;b=_bs.offset;}var v=t.docView.nearest(w);if(!v)return null;if(v.isWidget&&1==(null===(n=v.dom)||void 0===n?void 0:n.nodeType)){var _t101=v.dom.getBoundingClientRect();return e.y<_t101.top||e.y<=_t101.bottom&&e.x<=(_t101.left+_t101.right)/2?v.posAtStart:v.posAtEnd;}return v.localPosFromDOM(w,b)+v.posAtStart;}function ys(t,e,i,s,r){var n=Math.round((s-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>1.5*t.defaultLineHeight){var _e95=t.viewState.heightOracle.textHeight;n+=Math.floor((r-i.top-.5*(t.defaultLineHeight-_e95))/_e95)*t.viewState.heightOracle.lineLength;}var h=t.state.sliceDoc(i.from,i.to);return i.from+Ft(h,n,t.state.tabSize);}function Ms(t,e){var i=t.lineBlockAt(e);if(Array.isArray(i.type)){var _iterator48=_createForOfIteratorHelper(i.type),_step48;try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){var _t102=_step48.value;if(_t102.to>e||_t102.to==e&&(_t102.to==i.to||_t102.type==ri.Text))return _t102;}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}}return i;}function xs(t,e,i,s){var r=t.state.doc.lineAt(e.head),n=t.bidiSpans(r),h=t.textDirectionAt(r.from);for(var _l30=e,_o24=null;;){var _e96=Ri(r,n,h,_l30,i),_u29=Ii;if(!_e96){if(r.number==(i?t.state.doc.lines:1))return _l30;_u29="\n",r=t.state.doc.line(r.number+(i?1:-1)),n=t.bidiSpans(r),_e96=t.visualLineSide(r,!i);}if(_o24){if(!_o24(_u29))return _l30;}else{if(!s)return _e96;_o24=s(_u29);}_l30=_e96;}}function Ss(t,e,i){var _loop5=function _loop5(){var s=0;var _iterator49=_createForOfIteratorHelper(t),_step49;try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){var _r55=_step49.value;_r55.between(e-1,e+1,function(t,r,n){if(e>t&&e<r){var _n56=s||i||(e-t<r-e?-1:1);e=_n56<0?t:r,s=_n56;}});}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}if(!s)return{v:e};},_ret;for(;;){_ret=_loop5();if(_ret)return _ret.v;}}function As(t,e,i){var s=Ss(t.state.facet(es).map(function(e){return e(t);}),i.from,e.head>i.from?-1:1);return s==i.from?i:B.cursor(s,s<i.from?1:-1);}function Os(t,e){return function(i,s){try{return e.call(t,s,i);}catch(t){Ui(i.state,t);}};}function Ds(t){var e=Object.create(null);function i(t){return e[t]||(e[t]={observers:[],handlers:[]});}var _iterator52=_createForOfIteratorHelper(t),_step52;try{for(_iterator52.s();!(_step52=_iterator52.n()).done;){var _e97=_step52.value;var _t109=_e97.spec;if(_t109&&_t109.domEventHandlers)for(var _s68 in _t109.domEventHandlers){var _r57=_t109.domEventHandlers[_s68];_r57&&i(_s68).handlers.push(Os(_e97.value,_r57));}if(_t109&&_t109.domEventObservers)for(var _s69 in _t109.domEventObservers){var _r58=_t109.domEventObservers[_s69];_r58&&i(_s69).observers.push(Os(_e97.value,_r58));}}}catch(err){_iterator52.e(err);}finally{_iterator52.f();}for(var _t107 in Ls)i(_t107).handlers.push(Ls[_t107]);for(var _t108 in Ns)i(_t108).observers.push(Ns[_t108]);return e;}function Ts(t){return .7*Math.max(0,t)+8;}function $s(t,e){var i,s=t.state,r=1,n=s.toText(e),h=n.lines==s.selection.ranges.length;if(null!=_s&&s.selection.ranges.every(function(t){return t.empty;})&&_s==n.toString()){var _t113=-1;i=s.changeByRange(function(i){var l=s.doc.lineAt(i.from);if(l.from==_t113)return{range:i};_t113=l.from;var o=s.toText((h?n.line(r++).text:e)+s.lineBreak);return{changes:{from:l.from,insert:o},range:B.cursor(i.from+o.length)};});}else i=h?s.changeByRange(function(t){var e=n.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:B.cursor(t.from+e.length)};}):s.replaceSelection(n);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0});}function zs(t,e,i,s){if(1==s)return B.cursor(e,i);if(2==s)return function(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;var s=t.charCategorizer(e),r=t.doc.lineAt(e),n=e-r.from;if(0==r.length)return B.cursor(e);0==n?i=1:n==r.length&&(i=-1);var h=n,l=n;i<0?h=p(r.text,n,!1):l=p(r.text,n);var o=s(r.text.slice(h,l));for(;h>0;){var _t114=p(r.text,h,!1);if(s(r.text.slice(_t114,h))!=o)break;h=_t114;}for(;l<r.length;){var _t115=p(r.text,l);if(s(r.text.slice(l,_t115))!=o)break;l=_t115;}return B.range(h+r.from,l+r.from);}(t.state,e,i);{var _i87=ei.find(t.docView,e),_s71=t.state.doc.lineAt(_i87?_i87.posAtEnd:e),_r60=_i87?_i87.posAtStart:_s71.from,_n58=_i87?_i87.posAtEnd:_s71.to;return _n58<t.state.doc.length&&_n58==_s71.to&&_n58++,B.range(_r60,_n58);}}function Ws(t,e,i,s){var r=ei.find(t.docView,e);if(!r)return 1;var n=e-r.posAtStart;if(0==n)return 1;if(n==r.length)return-1;var h=r.coordsAt(n,-1);if(h&&Hs(i,s,h))return-1;var l=r.coordsAt(n,1);return l&&Hs(i,s,l)?1:h&&Ps(s,h)?-1:1;}function Vs(t,e){var i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:Ws(t,i,e.clientX,e.clientY)};}function Gs(t){if(!Fs)return t.detail;var e=qs,i=Js;return qs=t,Js=Date.now(),Us=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Us+1)%3:1;}function Ks(t,e,i,s){if(!i)return;var r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.inputState.draggedContent,h=s&&n&&function(t,e){var i=t.state.facet(Li);return i.length?i[0](e):Ve.mac?!e.altKey:!e.ctrlKey;}(t,e)?{from:n.from,to:n.to}:null,l={from:r,insert:i},o=t.state.changes(h?[h,l]:l);t.focus(),t.dispatch({changes:o,selection:{anchor:o.mapPos(r,-1),head:o.mapPos(r,1)},userEvent:h?"move.drop":"input.drop"}),t.inputState.draggedContent=null;}function Ys(t,e){var i=[];var _iterator56=_createForOfIteratorHelper(t.facet(Pi)),_step56;try{for(_iterator56.s();!(_step56=_iterator56.n()).done;){var _s79=_step56.value;var _r66=_s79(t,e);_r66&&i.push(_r66);}}catch(err){_iterator56.e(err);}finally{_iterator56.f();}return i?t.update({effects:i,annotations:Xs.of(!0)}):null;}function Qs(t){setTimeout(function(){var e=t.hasFocus;if(e!=t.inputState.notifiedFocused){var _i90=Ys(t.state,e);_i90?t.dispatch(_i90):t.update([]);}},10);}function ar(t,e){var i,s;null==t[e]&&(i=t[e-1])instanceof ur&&(s=t[e+1])instanceof ur&&t.splice(e-1,3,new ur(i.length+1+s.length));}function pr(t,e){var i=t.getBoundingClientRect(),s=t.ownerDocument,r=s.defaultView||window,n=Math.max(0,i.left),h=Math.min(r.innerWidth,i.right),l=Math.max(0,i.top),o=Math.min(r.innerHeight,i.bottom);for(var _e110=t.parentNode;_e110&&_e110!=s.body;)if(1==_e110.nodeType){var _i96=_e110,_s85=window.getComputedStyle(_i96);if((_i96.scrollHeight>_i96.clientHeight||_i96.scrollWidth>_i96.clientWidth)&&"visible"!=_s85.overflow){var _s86=_i96.getBoundingClientRect();n=Math.max(n,_s86.left),h=Math.min(h,_s86.right),l=Math.max(l,_s86.top),o=_e110==t.parentNode?_s86.bottom:Math.min(o,_s86.bottom);}_e110="absolute"==_s85.position||"fixed"==_s85.position?_i96.offsetParent:_i96.parentNode;}else{if(11!=_e110.nodeType)break;_e110=_e110.host;}return{left:n-i.left,right:Math.max(n,h)-i.left,top:l-(i.top+e),bottom:Math.max(l,o)-(i.top+e)};}function mr(t,e){var i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)};}function kr(t,e,i){var s=[],r=t,n=0;return It.spans(i,t,e,{span:function span(){},point:function point(t,e){t>r&&(s.push({from:r,to:t}),n+=t-r),r=e;}},20),r<e&&(s.push({from:r,to:e}),n+=e-r),{total:n,ranges:s};}function yr(_ref10,i){var t=_ref10.total,e=_ref10.ranges;if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;var s=Math.floor(t*i);for(var _t131=0;;_t131++){var _e$_t=e[_t131],_i106=_e$_t.from,_r75=_e$_t.to,_n69=_r75-_i106;if(s<=_n69)return _i106+s;s-=_n69;}}function Mr(t,e){var i=0;var _iterator63=_createForOfIteratorHelper(t.ranges),_step63;try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){var _step63$value=_step63.value,_s93=_step63$value.from,_r76=_step63$value.to;if(e<=_r76){i+=e-_s93;break;}i+=_r76-_s93;}}catch(err){_iterator63.e(err);}finally{_iterator63.f();}return i/t.total;}function Ar(t,e){if(1==e.scale)return t;var i=e.toDOM(t.top),s=e.toDOM(t.bottom);return new sr(t.from,t.length,i,s-i,Array.isArray(t._content)?t._content.map(function(t){return Ar(t,e);}):t._content);}function Tr(t,e,i){return new Gt(e,{finish:function finish(e){return /&/.test(e)?e.replace(/&\w*/,function(e){if("&"==e)return t;if(!i||!i[e])throw new RangeError("Unsupported selector: ".concat(e));return i[e];}):t+" "+e;}});}function jr(t,e,i){for(;;){if(!e||i<fe(e))return!1;if(e==t)return!0;i=le(e)+1,e=e.parentNode;}}function Pr(e,i){var s,r=i.newSel,n=e.state.selection.main,h=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(i.bounds){var _i$bounds=i.bounds,_r82=_i$bounds.from,_l39=_i$bounds.to,_o30=n.from,_u33=null;(8===h||Ve.android&&i.text.length<_l39-_r82)&&(_o30=n.to,_u33="end");var _f17=function(t,e,i,s){var r=Math.min(t.length,e.length),n=0;for(;n<r&&t.charCodeAt(n)==e.charCodeAt(n);)n++;if(n==r&&t.length==e.length)return null;var h=t.length,l=e.length;for(;h>0&&l>0&&t.charCodeAt(h-1)==e.charCodeAt(l-1);)h--,l--;if("end"==s){i-=h+Math.max(0,n-Math.min(h,l))-n;}if(h<n&&t.length<e.length){n-=i<=n&&i>=h?n-i:0,l=n+(l-h),h=n;}else if(l<n){n-=i<=n&&i>=l?n-i:0,h=n+(h-l),l=n;}return{from:n,toA:h,toB:l};}(e.state.doc.sliceString(_r82,_l39,Lr),i.text,_o30-_r82,_u33);_f17&&(Ve.chrome&&13==h&&_f17.toB==_f17.from+2&&i.text.slice(_f17.from,_f17.toB)==Lr+Lr&&_f17.toB--,s={from:_r82+_f17.from,to:_r82+_f17.toA,insert:t.of(i.text.slice(_f17.from,_f17.toB).split(Lr))});}else r&&(!e.hasFocus&&e.state.facet(Ji)||r.main.eq(n))&&(r=null);if(!s&&!r)return!1;if(!s&&i.typeOver&&!n.empty&&r&&r.main.empty?s={from:n.from,to:n.to,insert:e.state.doc.slice(n.from,n.to)}:s&&s.from>=n.from&&s.to<=n.to&&(s.from!=n.from||s.to!=n.to)&&n.to-n.from-(s.to-s.from)<=4?s={from:n.from,to:n.to,insert:e.state.doc.slice(n.from,s.from).append(s.insert).append(e.state.doc.slice(s.to,n.to))}:(Ve.mac||Ve.android)&&s&&s.from==s.to&&s.from==n.head-1&&/^\. ?$/.test(s.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==s.insert.length&&(r=B.single(r.main.anchor-1,r.main.head-1)),s={from:n.from,to:n.to,insert:t.of([" "])}):Ve.chrome&&s&&s.from==s.to&&s.from==n.head&&"\n "==s.insert.toString()&&e.lineWrapping&&(r&&(r=B.single(r.main.anchor-1,r.main.head-1)),s={from:n.from,to:n.to,insert:t.of([" "])}),s){if(Ve.ios&&e.inputState.flushIOSKey(s))return!0;if(Ve.android&&(s.to==n.to&&(s.from==n.from||s.from==n.from-1&&" "==e.state.sliceDoc(s.from,n.from))&&1==s.insert.length&&2==s.insert.lines&&ve(e.contentDOM,"Enter",13)||(s.from==n.from-1&&s.to==n.to&&0==s.insert.length||8==h&&s.insert.length<s.to-s.from&&s.to>n.head)&&ve(e.contentDOM,"Backspace",8)||s.from==n.from&&s.to==n.to+1&&0==s.insert.length&&ve(e.contentDOM,"Delete",46)))return!0;var _t135,_i115=s.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;var _l40=function _l40(){return _t135||(_t135=function(t,e,i){var s,r=t.state,n=r.selection.main;if(e.from>=n.from&&e.to<=n.to&&e.to-e.from>=(n.to-n.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){var _i116=n.from<e.from?r.sliceDoc(n.from,e.from):"",_h41=n.to>e.to?r.sliceDoc(e.to,n.to):"";s=r.replaceSelection(t.state.toText(_i116+e.insert.sliceString(0,void 0,t.state.lineBreak)+_h41));}else{var _h42=r.changes(e),_l41=i&&i.main.to<=_h42.newLength?i.main:void 0;if(r.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=n.to&&e.to>=n.to-10){var _o31,_u34=t.state.sliceDoc(e.from,e.to),_f18=i&&as(t,i.main.head);if(_f18){var _t136=e.insert.length-(e.to-e.from);_o31={from:_f18.from,to:_f18.to-_t136};}else _o31=t.state.doc.lineAt(n.head);var _a12=n.to-e.to,_c11=n.to-n.from;s=r.changeByRange(function(i){if(i.from==n.from&&i.to==n.to)return{changes:_h42,range:_l41||i.map(_h42)};var s=i.to-_a12,f=s-_u34.length;if(i.to-i.from!=_c11||t.state.sliceDoc(f,s)!=_u34||i.to>=_o31.from&&i.from<=_o31.to)return{range:i};var d=r.changes({from:f,to:s,insert:e.insert}),p=i.to-n.to;return{changes:d,range:_l41?B.range(Math.max(0,_l41.anchor+p),Math.max(0,_l41.head+p)):i.map(d)};});}else s={changes:_h42,selection:_l41&&r.selection.replaceRange(_l41)};}var h="input.type";(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,h+=".compose",t.inputState.compositionFirstChange&&(h+=".start",t.inputState.compositionFirstChange=!1));return r.update(s,{userEvent:h,scrollIntoView:!0});}(e,s,r));};return e.state.facet(zi).some(function(t){return t(e,s.from,s.to,_i115,_l40);})||e.dispatch(_l40()),!0;}if(r&&!r.main.eq(n)){var _t137=!1,_i117="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(_t137=!0),_i117=e.inputState.lastSelectionOrigin),e.dispatch({selection:r,scrollIntoView:_t137,userEvent:_i117}),!0;}return!1;}function Fr(t,e,i){for(;e;){var _s100=Ce.get(e);if(_s100&&_s100.parent==t)return _s100;var _r84=e.parentNode;e=_r84!=t.dom?_r84:i>0?e.nextSibling:e.previousSibling;}return null;}function qr(t,e){var _ref12;var i=e.startContainer,s=e.startOffset,r=e.endContainer,n=e.endOffset,h=t.docView.domAtPos(t.state.selection.main.anchor);return he(h.node,h.offset,r,n)&&(_ref12=[r,n,i,s],i=_ref12[0],s=_ref12[1],r=_ref12[2],n=_ref12[3],_ref12),{anchorNode:i,anchorOffset:s,focusNode:r,focusOffset:n};}function _r(t,e,i){for(var _s105=t.state.facet(e),_r88=_s105.length-1;_r88>=0;_r88--){var _e133=_s105[_r88],_n74="function"==typeof _e133?_e133(t):_e133;_n74&&Xe(_n74,i);}return i;}function Yr(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t;}function en(t){var e=t.facet(Zr),i=tn.get(e);return i||tn.set(e,i=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Xr;var i=Object.create(null),s=Object.create(null),r=function r(t,e){var i=s[t];if(null==i)s[t]=e;else if(i!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix");},n=function n(t,s,_n75,h,l){var o,u;var f=i[t]||(i[t]=Object.create(null)),a=s.split(/ (?!$)/).map(function(t){return function(t,e){var i=t.split(/-(?!$)/);var s,r,n,h,l=i[i.length-1];"Space"==l&&(l=" ");for(var _t162=0;_t162<i.length-1;++_t162){var _l43=i[_t162];if(/^(cmd|meta|m)$/i.test(_l43))h=!0;else if(/^a(lt)?$/i.test(_l43))s=!0;else if(/^(c|ctrl|control)$/i.test(_l43))r=!0;else if(/^s(hift)?$/i.test(_l43))n=!0;else{if(!/^mod$/i.test(_l43))throw new Error("Unrecognized modifier name: "+_l43);"mac"==e?h=!0:r=!0;}}return s&&(l="Alt-"+l),r&&(l="Ctrl-"+l),h&&(l="Meta-"+l),n&&(l="Shift-"+l),l;}(t,e);});var _loop8=function _loop8(){var i=a.slice(0,_e134).join(" ");r(i,!0),f[i]||(f[i]={preventDefault:!0,stopPropagation:!1,run:[function(e){var s=sn={view:e,prefix:i,scope:t};return setTimeout(function(){sn==s&&(sn=null);},rn),!0;}]});};for(var _e134=1;_e134<a.length;_e134++){_loop8();}var c=a.join(" ");r(c,!1);var d=f[c]||(f[c]={preventDefault:!1,stopPropagation:!1,run:(null===(u=null===(o=f._any)||void 0===o?void 0:o.run)||void 0===u?void 0:u.slice())||[]});_n75&&d.run.push(_n75),h&&(d.preventDefault=!0),l&&(d.stopPropagation=!0);};var _iterator92=_createForOfIteratorHelper(t),_step92;try{for(_iterator92.s();!(_step92=_iterator92.n()).done;){var _s106=_step92.value;var _t163=_s106.scope?_s106.scope.split(" "):["editor"];if(_s106.any){var _iterator93=_createForOfIteratorHelper(_t163),_step93;try{for(_iterator93.s();!(_step93=_iterator93.n()).done;){var _e135=_step93.value;var _t164=i[_e135]||(i[_e135]=Object.create(null));_t164._any||(_t164._any={preventDefault:!1,stopPropagation:!1,run:[]});for(var _e136 in _t164)_t164[_e136].run.push(_s106.any);}}catch(err){_iterator93.e(err);}finally{_iterator93.f();}}var _r89=_s106[e]||_s106.key;if(_r89){var _iterator94=_createForOfIteratorHelper(_t163),_step94;try{for(_iterator94.s();!(_step94=_iterator94.n()).done;){var _e137=_step94.value;n(_e137,_r89,_s106.run,_s106.preventDefault,_s106.stopPropagation),_s106.shift&&n(_e137,"Shift-"+_r89,_s106.shift,_s106.preventDefault,_s106.stopPropagation);}}catch(err){_iterator94.e(err);}finally{_iterator94.f();}}}}catch(err){_iterator92.e(err);}finally{_iterator92.f();}return i;}(e.reduce(function(t,e){return t.concat(e);},[]))),i;}function nn(t,e,i,s){var r=function(t){var e=!(Qt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Zt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Yt:Xt)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e;}(e),n=y(v(r,0))==r.length&&" "!=r,h="",l=!1,o=!1,u=!1;sn&&sn.view==i&&sn.scope==s&&(h=sn.prefix+" ",Rs.indexOf(e.keyCode)<0&&(o=!0,sn=null));var f,a,c=new Set(),d=function d(t){if(t){var _iterator95=_createForOfIteratorHelper(t.run),_step95;try{for(_iterator95.s();!(_step95=_iterator95.n()).done;){var _s107=_step95.value;if(!c.has(_s107)&&(c.add(_s107),_s107(i,e)))return t.stopPropagation&&(u=!0),!0;}}catch(err){_iterator95.e(err);}finally{_iterator95.f();}t.preventDefault&&(t.stopPropagation&&(u=!0),o=!0);}return!1;},p=t[s];return p&&(d(p[h+Yr(r,e,!n)])?l=!0:n&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ve.windows&&e.ctrlKey&&e.altKey)&&(f=Xt[e.keyCode])&&f!=r?(d(p[h+Yr(f,e,!0)])||e.shiftKey&&(a=Yt[e.keyCode])!=r&&a!=f&&d(p[h+Yr(a,e,!1)]))&&(l=!0):n&&e.shiftKey&&d(p[h+Yr(r,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),o&&(l=!0),l&&u&&e.stopPropagation(),l;}function ln(t){var e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==pi.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY};}function on(t,e,i){var s=B.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(s,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(s,!0,!0).from),type:ri.Text};}function an(t){return[_i.define(function(e){return new un(e,t);}),fn.of(t)];}function pn(t){return t.startState.facet(dn)!=t.state.facet(dn);}function gn(t,e){e.style.animationDuration=t.facet(dn).cursorBlinkRate+"ms";}function xn(t,e,i,s,r){e.lastIndex=0;for(var _n78,_h46=t.iterRange(i,s),_l45=i;!_h46.next().done;_l45+=_h46.value.length)if(!_h46.lineBreak)for(;_n78=e.exec(_h46.value);)r(_l45+_n78.index,_n78);}function jn(t){return _i.fromClass(/*#__PURE__*/function(){function _class3(e){_classCallCheck(this,_class3);this.view=e,this.placeholder=t?ni.set([ni.widget({widget:new Nn(t),side:1}).range(0)]):ni.none;}return _createClass(_class3,[{key:"decorations",get:function get(){return this.view.state.doc.length?ni.none:this.placeholder;}}]);}(),{decorations:function decorations(t){return t.decorations;}});}function zn(t,e){var i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),s=t.state.doc.lineAt(i),r=i-s.from,n=r>$n?-1:r==s.length?function(t,e){var i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1;}(t,e.clientX):Vt(s.text,t.state.tabSize,i-s.from);return{line:s.number,col:n,off:r};}function Pn(t,e){var i=zn(t,e),s=t.state.selection;return i?{update:function update(t){if(t.docChanged){var _e144=t.changes.mapPos(t.startState.doc.line(i.line).from),_r98=t.state.doc.lineAt(_e144);i={line:_r98.number,col:i.col,off:Math.min(i.off,_r98.length)},s=s.map(t.changes);}},get:function get(e,r,n){var h=zn(t,e);if(!h)return s;var l=function(t,e,i){var s=Math.min(e.line,i.line),r=Math.max(e.line,i.line),n=[];if(e.off>$n||i.off>$n||e.col<0||i.col<0){var _h47=Math.min(e.off,i.off),_l47=Math.max(e.off,i.off);for(var _e145=s;_e145<=r;_e145++){var _i128=t.doc.line(_e145);_i128.length<=_l47&&n.push(B.range(_i128.from+_h47,_i128.to+_l47));}}else{var _h48=Math.min(e.col,i.col),_l48=Math.max(e.col,i.col);for(var _e146=s;_e146<=r;_e146++){var _i129=t.doc.line(_e146),_s116=Ft(_i129.text,_h48,t.tabSize,!0);if(_s116<0)n.push(B.cursor(_i129.to));else{var _e147=Ft(_i129.text,_l48,t.tabSize);n.push(B.range(_i129.from+_s116,_i129.from+_e147));}}}return n;}(t.state,i,h);return l.length?n?B.create(l.concat(s.ranges)):B.create(l):s;}}:null;}function qn(t){var e=t.win;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth};}function ih(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var i=ct.define(),s=F.define({create:function create(){return[];},update:function update(t,s){if(t.length&&(e.hideOnChange&&(s.docChanged||s.selection)?t=[]:e.hideOn&&(t=t.filter(function(t){return!e.hideOn(s,t);})),s.docChanged)){var _e157=[];var _iterator118=_createForOfIteratorHelper(t),_step118;try{for(_iterator118.s();!(_step118=_iterator118.n()).done;){var _i133=_step118.value;var _t179=s.changes.mapPos(_i133.pos,-1,x.TrackDel);if(null!=_t179){var _r100=Object.assign(Object.create(null),_i133);_r100.pos=_t179,null!=_r100.end&&(_r100.end=s.changes.mapPos(_r100.end)),_e157.push(_r100);}}}catch(err){_iterator118.e(err);}finally{_iterator118.f();}t=_e157;}var _iterator119=_createForOfIteratorHelper(s.effects),_step119;try{for(_iterator119.s();!(_step119=_iterator119.n()).done;){var _e158=_step119.value;_e158.is(i)&&(t=_e158.value),_e158.is(rh)&&(t=[]);}}catch(err){_iterator119.e(err);}finally{_iterator119.f();}return t;},provide:function provide(t){return Yn.from(t);}});return[s,_i.define(function(r){return new th(r,t,s,i,e.hoverTime||300);}),Zn];}function sh(t,e){var i=t.plugin(Gn);if(!i)return null;var s=i.manager.tooltips.indexOf(e);return s<0?null:i.manager.tooltipViews[s];}function hh(t,e){var i=t.plugin(lh),s=i?i.specs.indexOf(e):-1;return s>-1?i.panels[s]:null;}function uh(t){var e=t.nextSibling;return t.remove(),e;}function mh(t){return[wh(),ph.of(Object.assign(Object.assign({},dh),t))];}function wh(t){var e=[bh];return t&&!1===t.fixed&&e.push(gh.of(!0)),e;}function vh(t){return Array.isArray(t)?t:[t];}function kh(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next();}function Oh(t,e){return t.state.facet(Ah).formatNumber(e,t.state);}function Eh(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[Ah.of(t),wh(),Dh];}function Ih(t){var e=9;for(;e<t;)e=10*e+9;return e;}function Gh(t,e,i,s){switch(t){case-2:return i<e;case-1:return s>=e&&i<e;case 0:return i<e&&s>e;case 1:return i<=e&&s>e;case 2:return s>e;case 4:return!0;}}function Kh(t,e,i,s){for(var r;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to<e);){var _e185=!s&&t instanceof Xh&&t.index<0?null:t.parent;if(!_e185)return t;t=_e185;}var n=s?0:Fh.IgnoreOverlays;if(s)for(var _s131=t,_h56=_s131.parent;_h56;_s131=_h56,_h56=_s131.parent)_s131 instanceof Xh&&_s131.index<0&&(null===(r=_h56.enter(e,i,n))||void 0===r?void 0:r.from)!=_s131.from&&(t=_h56);for(;;){var _s132=t.enter(e,i,n);if(!_s132)return t;t=_s132;}}function Yh(t,e,i,s){var r=t.cursor(),n=[];if(!r.firstChild())return n;if(null!=i)for(var _t213=!1;!_t213;)if(_t213=r.type.is(i),!r.nextSibling())return n;for(;;){if(null!=s&&r.type.is(s))return n;if(r.type.is(e)&&n.push(r.node),!r.nextSibling())return null==s?n:[];}}function Qh(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:e.length-1;for(var _s133=t.parent;i>=0;_s133=_s133.parent){if(!_s133)return!1;if(!_s133.type.isAnonymous){if(e[i]&&e[i]!=_s133.name)return!1;i--;}}return!0;}function el(t){if(!t.length)return null;var e=0,i=t[0];for(var _s134=1;_s134<t.length;_s134++){var _r111=t[_s134];(_r111.from>i.from||_r111.to<i.to)&&(i=_r111,e=_s134);}var s=i instanceof Xh&&i.index<0?null:i.parent,r=t.slice();return s?r[e]=s:r.splice(e,1),new il(r,i);}function rl(t){return t.children.some(function(t){return t instanceof Jh||!t.type.isAnonymous||rl(t);});}function hl(t,e){if(!t.isAnonymous||e instanceof Jh||e.type!=t)return 1;var i=nl.get(e);if(null==i){i=1;var _iterator149=_createForOfIteratorHelper(e.children),_step149;try{for(_iterator149.s();!(_step149=_iterator149.n()).done;){var _s139=_step149.value;if(_s139.type!=t||!(_s139 instanceof qh)){i=1;break;}i+=hl(t,_s139);}}catch(err){_iterator149.e(err);}finally{_iterator149.f();}nl.set(e,i);}return i;}function ll(t,e,i,s,r,n,h,l,o){var u=0;for(var _i153=s;_i153<r;_i153++)u+=hl(t,e[_i153]);var f=Math.ceil(1.5*u/8),a=[],c=[];return function e(i,s,r,h,l){for(var _u39=r;_u39<h;){var _r115=_u39,_d9=s[_u39],_p7=hl(t,i[_u39]);for(_u39++;_u39<h;_u39++){var _e187=hl(t,i[_u39]);if(_p7+_e187>=f)break;_p7+=_e187;}if(_u39==_r115+1){if(_p7>f){var _t219=i[_r115];e(_t219.children,_t219.positions,0,_t219.children.length,s[_r115]+l);continue;}a.push(i[_r115]);}else{var _e188=s[_u39-1]+i[_u39-1].length-_d9;a.push(ll(t,i,s,_r115,_u39,_d9,_e188,null,o));}c.push(_d9+l-n);}}(e,i,s,r,0),(l||o)(a,c,h);}function cl(t){return function(e,i,s,r){return new wl(e,t,i,s,r);};}function pl(t){if(!t.length||t.some(function(t){return t.from>=t.to;}))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t));}function bl(t,e,i){var _iterator153=_createForOfIteratorHelper(t),_step153;try{for(_iterator153.s();!(_step153=_iterator153.n()).done;){var _s140=_step153.value;if(_s140.from>=i)break;if(_s140.to>e)return _s140.from<=e&&_s140.to>=i?2:1;}}catch(err){_iterator153.e(err);}finally{_iterator153.f();}return 0;}function vl(t,e,i,s,r,n){if(e<i){var _h64=t.buffer[e+1];s.push(t.slice(e,i,_h64)),r.push(_h64-n);}}function kl(t){var e=t.node,i=[],s=e.context.buffer;do{i.push(t.index),t.parent();}while(!t.tree);var r=t.tree,n=r.children.indexOf(s),h=r.children[n],l=h.buffer,o=[n];r.children[n]=function t(s,r,n,u,f,a){var c=i[a],d=[],p=[];vl(h,s,c,d,p,u);var m=l[c+1],g=l[c+2];o.push(d.length);var w=a?t(c+4,l[c+3],h.set.types[l[c]],m,g-m,a-1):e.toTree();return d.push(w),p.push(m-u),vl(h,l[c+3],r,d,p,u),new qh(n,d,p,f);}(0,l.length,Ph.none,0,h.length,i.length-1);for(var _i157=0,_o40=o;_i157<_o40.length;_i157++){var _e192=_o40[_i157];var _i158=t.tree.children[_e192],_s141=t.tree.positions[_e192];t["yield"](new Xh(_i158,_s141+t.from,_e192,t._tree));}}function xl(t,e){var i=null,s=e;for(var _r118=1,_n95=0;_r118<t.length;_r118++){var _h65=t[_r118-1].to,_l60=t[_r118].from;for(;_n95<s.length;_n95++){var _t229=s[_n95];if(_t229.from>=_l60)break;_t229.to<=_h65||(i||(s=i=e.slice()),_t229.from<_h65?(i[_n95]=new Nh(_t229.from,_h65),_t229.to>_l60&&i.splice(_n95+1,0,new Nh(_l60,_t229.to))):_t229.to>_l60?i[_n95--]=new Nh(_l60,_t229.to):i.splice(_n95--,1));}}return s;}function Sl(t,e,i,s){var r=0,n=0,h=!1,l=!1,o=-1e9,u=[];for(;;){var _f23=r==t.length?1e9:h?t[r].to:t[r].from,_a16=n==e.length?1e9:l?e[n].to:e[n].from;if(h!=l){var _t230=Math.max(o,i),_e196=Math.min(_f23,_a16,s);_t230<_e196&&u.push(new Nh(_t230,_e196));}if(o=Math.min(_f23,_a16),1e9==o)break;_f23==o&&(h?(h=!1,r++):h=!0),_a16==o&&(l?(l=!1,n++):l=!0);}return u;}function Al(t,e){var i=[];var _iterator154=_createForOfIteratorHelper(t),_step154;try{var _loop13=function _loop13(){var _step154$value=_step154.value,s=_step154$value.pos,r=_step154$value.mount,n=_step154$value.frag;var t=s+(r.overlay?r.overlay[0].from:0),h=t+r.tree.length,l=Math.max(n.from,t),o=Math.min(n.to,h);if(r.overlay){var _h66=Sl(e,r.overlay.map(function(t){return new Nh(t.from+s,t.to+s);}),l,o);for(var _e197=0,_s142=l;;_e197++){var _l61=_e197==_h66.length,_u41=_l61?o:_h66[_e197].from;if(_u41>_s142&&i.push(new ul(_s142,_u41,r.tree,-t,n.from>=_s142||n.openStart,n.to<=_u41||n.openEnd)),_l61)break;_s142=_h66[_e197].to;}}else i.push(new ul(l,o,r.tree,-t,n.from>=t||n.openStart,n.to<=h||n.openEnd));};for(_iterator154.s();!(_step154=_iterator154.n()).done;){_loop13();}}catch(err){_iterator154.e(err);}finally{_iterator154.f();}return i;}function Il(t){var e=Object.create(null);for(var _i163 in t){var _s144=t[_i163];Array.isArray(_s144)||(_s144=[_s144]);var _iterator159=_createForOfIteratorHelper(_i163.split(" ")),_step159;try{for(_iterator159.s();!(_step159=_iterator159.n()).done;){var _t233=_step159.value;if(_t233){var _i164=[],_r120=2,_n96=_t233;for(var _e199=0;;){if("..."==_n96&&_e199>0&&_e199+3==_t233.length){_r120=1;break;}var _s145=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(_n96);if(!_s145)throw new RangeError("Invalid path: "+_t233);if(_i164.push("*"==_s145[0]?"":'"'==_s145[0][0]?JSON.parse(_s145[0]):_s145[0]),_e199+=_s145[0].length,_e199==_t233.length)break;var _h67=_t233[_e199++];if(_e199==_t233.length&&"!"==_h67){_r120=0;break;}if("/"!=_h67)throw new RangeError("Invalid path: "+_t233);_n96=_t233.slice(_e199);}var _h68=_i164.length-1,_l62=_i164[_h68];if(!_l62)throw new RangeError("Invalid path: "+_t233);var _o41=new Tl(_s144,_r120,_h68>0?_i164.slice(0,_h68):null);e[_l62]=_o41.sort(e[_l62]);}}}catch(err){_iterator159.e(err);}finally{_iterator159.f();}}return Rl.add(e);}function Bl(t,e){var i=Object.create(null);var _iterator160=_createForOfIteratorHelper(t),_step160;try{for(_iterator160.s();!(_step160=_iterator160.n()).done;){var _e200=_step160.value;if(Array.isArray(_e200.tag)){var _iterator163=_createForOfIteratorHelper(_e200.tag),_step163;try{for(_iterator163.s();!(_step163=_iterator163.n()).done;){var _t235=_step163.value;i[_t235.id]=_e200["class"];}}catch(err){_iterator163.e(err);}finally{_iterator163.f();}}else i[_e200.tag.id]=_e200["class"];}}catch(err){_iterator160.e(err);}finally{_iterator160.f();}var _ref17=e||{},s=_ref17.scope,_ref17$all=_ref17.all,r=_ref17$all===void 0?null:_ref17$all;return{style:function style(t){var e=r;var _iterator161=_createForOfIteratorHelper(t),_step161;try{for(_iterator161.s();!(_step161=_iterator161.n()).done;){var _s146=_step161.value;var _iterator162=_createForOfIteratorHelper(_s146.set),_step162;try{for(_iterator162.s();!(_step162=_iterator162.n()).done;){var _t234=_step162.value;var _s147=i[_t234.id];if(_s147){e=e?e+" "+_s147:_s147;break;}}}catch(err){_iterator162.e(err);}finally{_iterator162.f();}}}catch(err){_iterator161.e(err);}finally{_iterator161.f();}return e;},scope:s};}function Ll(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:t.length;var n=new Nl(s,Array.isArray(e)?e:[e],i);n.highlightRange(t.cursor(),s,r,"",n.highlighters),n.flush(r);}function to(t){return j.define({combine:t?function(e){return e.concat(t);}:void 0});}function so(t,e,i){var s=t.facet(mo),r=no(t).topNode;if(!s||s.allowsNesting)for(var _t239=r;_t239;_t239=_t239.enter(e,i,Fh.ExcludeBuffers))_t239.type.isTop&&(r=_t239);return r;}function no(t){var e=t.field(io.state,!1);return e?e.tree:qh.empty;}function uo(t,e,i){return ul.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}]);}function vo(t){var e=t.facet(bo);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length;}function ko(t,e){var i="",s=t.tabSize,r=t.facet(bo)[0];if("\t"==r){for(;e>=s;)i+="\t",e-=s;r=" ";}for(var _t242=0;_t242<e;_t242++)i+=r;return i;}function yo(t,e){t instanceof St&&(t=new Mo(t));var _iterator170=_createForOfIteratorHelper(t.state.facet(wo)),_step170;try{for(_iterator170.s();!(_step170=_iterator170.n()).done;){var _i169=_step170.value;var _s152=_i169(t,e);if(void 0!==_s152)return _s152;}}catch(err){_iterator170.e(err);}finally{_iterator170.f();}var i=no(t.state);return i.length>=e?function(t,e,i){var s=e.resolveStack(i),r=s.node.enterUnfinishedNodesBefore(i);if(r!=s.node){var _t243=[];for(var _e207=r;_e207!=s.node;_e207=_e207.parent)_t243.push(_e207);for(var _e208=_t243.length-1;_e208>=0;_e208--)s={node:_t243[_e208],next:s};}return So(s,t,i);}(t,i,e):null;}function So(t,e,i){for(var _s153=t;_s153;_s153=_s153.next){var _t245=Ao(_s153.node);if(_t245)return _t245(Oo.create(e,i,_s153));}return 0;}function Ao(t){var e=t.type.prop(xo);if(e)return e;var i,s=t.firstChild;if(s&&(i=s.type.prop(jh.closedBy))){var _e209=t.lastChild,_s154=_e209&&i.indexOf(_e209.name)>-1;return function(t){return Io(t,!0,1,void 0,_s154&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak;}(t)?_e209.from:void 0);};}return null==t.parent?Co:null;}function Co(){return 0;}function Do(t,e){for(var _i171=e;_i171;_i171=_i171.parent)if(t==_i171)return!0;return!1;}function Eo(_ref18){var t=_ref18.closing,_ref18$align=_ref18.align,e=_ref18$align===void 0?!0:_ref18$align,_ref18$units=_ref18.units,i=_ref18$units===void 0?1:_ref18$units;return function(s){return Io(s,e,i,t);};}function Io(t,e,i,s,r){var n=t.textAfter,h=n.match(/^\s*/)[0].length,l=s&&n.slice(h,h+s.length)==s||r==t.pos+h,o=e?function(t){var e=t.node,i=e.childAfter(e.from),s=e.lastChild;if(!i)return null;var r=t.options.simulateBreak,n=t.state.doc.lineAt(i.from),h=null==r||r<=n.from?n.to:Math.min(n.to,r);for(var _t246=i.to;;){var _r123=e.childAfter(_t246);if(!_r123||_r123==s)return null;if(!_r123.type.isSkipped)return _r123.from<h?i:null;_t246=_r123.to;}}(t):null;return o?l?t.column(o.from):t.column(o.to):t.baseIndent+(l?0:t.unit*i);}function To(){var _ref19=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},t=_ref19.except,_ref19$units=_ref19.units,e=_ref19$units===void 0?1:_ref19$units;return function(i){var s=t&&t.test(i.textAfter);return i.baseIndent+(s?0:e*i.unit);};}function No(t){var e=t.firstChild,i=t.lastChild;return e&&e.to<i.from?{from:e.to,to:i.type.isError?t.to:i.from}:null;}function jo(t){var e=t.lastChild;return e&&e.to==t.to&&e.type.isError;}function $o(t,e,i){var _iterator171=_createForOfIteratorHelper(t.facet(Bo)),_step171;try{for(_iterator171.s();!(_step171=_iterator171.n()).done;){var _s156=_step171.value;var _r124=_s156(t,e,i);if(_r124)return _r124;}}catch(err){_iterator171.e(err);}finally{_iterator171.f();}return function(t,e,i){var s=no(t);if(s.length<i)return null;var r=null;for(var _n98=s.resolveStack(i,1);_n98;_n98=_n98.next){var _h69=_n98.node;if(_h69.to<=i||_h69.from>i)continue;if(r&&_h69.from<e)break;var _l63=_h69.type.prop(Lo);if(_l63&&(_h69.to<s.length-50||s.length==t.doc.length||!jo(_h69))){var _s155=_l63(_h69,t);_s155&&_s155.from<=i&&_s155.from>=e&&_s155.to>i&&(r=_s155);}}return r;}(t,e,i);}function zo(t,e){var i=e.mapPos(t.from,1),s=e.mapPos(t.to,-1);return i>=s?void 0:{from:i,to:s};}function Wo(t){var e=[];var _iterator172=_createForOfIteratorHelper(t.state.selection.ranges),_step172;try{var _loop14=function _loop14(){var i=_step172.value.head;e.some(function(t){return t.from<=i&&t.to>=i;})||e.push(t.lineBlockAt(i));};for(_iterator172.s();!(_step172=_iterator172.n()).done;){_loop14();}}catch(err){_iterator172.e(err);}finally{_iterator172.f();}return e;}function Fo(t,e,i){var s;var r=null;return null===(s=t.field(Vo,!1))||void 0===s||s.between(e,i,function(t,e){(!r||r.from>t)&&(r={from:t,to:e});}),r;}function qo(t,e,i){var s=!1;return t.between(e,e,function(t,r){t==e&&r==i&&(s=!0);}),s;}function Uo(t,e){return t.field(Vo,!1)?e:e.concat(ct.appendConfig.of(Xo()));}function Jo(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var s=t.state.doc.lineAt(e.from).number,r=t.state.doc.lineAt(e.to).number;return Ur.announce.of("".concat(t.state.phrase(i?"Folded lines":"Unfolded lines")," ").concat(s," ").concat(t.state.phrase("to")," ").concat(r,"."));}function Xo(t){var e=[Vo,iu];return t&&e.push(_o.of(t)),e;}function Yo(t,e){var i=t.state,s=i.facet(_o),r=function r(e){var i=t.lineBlockAt(t.posAtDOM(e.target)),s=Fo(t.state,i.from,i.to);s&&t.dispatch({effects:Ho.of(s)}),e.preventDefault();};if(s.placeholderDOM)return s.placeholderDOM(t,r,e);var n=document.createElement("span");return n.textContent=s.placeholderText,n.setAttribute("aria-label",i.phrase("folded code")),n.title=i.phrase("unfold"),n.className="cm-foldPlaceholder",n.onclick=r,n;}function hu(t){var e=t.facet(ru);return e.length?e:t.facet(nu);}function gu(t){var e=[],i=t.matched?pu:mu;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e;}function ku(t,e,i){var s=t.prop(e<0?jh.openedBy:jh.closedBy);if(s)return s;if(1==t.name.length){var _s163=i.indexOf(t.name);if(_s163>-1&&_s163%2==(e<0?1:0))return[i[_s163+e]];}return null;}function yu(t){var e=t.type.prop(vu);return e?e(t.node):t;}function Mu(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};var r=s.maxScanDistance||au,n=s.brackets||cu,h=no(t),l=h.resolveInner(e,i);for(var _s164=l;_s164;_s164=_s164.parent){var _r130=ku(_s164.type,i,n);if(_r130&&_s164.from<_s164.to){var _h70=yu(_s164);if(_h70&&(i>0?e>=_h70.from&&e<_h70.to:e>_h70.from&&e<=_h70.to))return xu(t,e,i,_s164,_h70,_r130,n);}}return function(t,e,i,s,r,n,h){var l=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),o=h.indexOf(l);if(o<0||o%2==0!=i>0)return null;var u={from:i<0?e-1:e,to:i>0?e+1:e},f=t.doc.iterRange(e,i>0?t.doc.length:0),a=0;for(var _t248=0;!f.next().done&&_t248<=n;){var _n100=f.value;i<0&&(_t248+=_n100.length);var _l64=e+_t248*i;for(var _t249=i>0?0:_n100.length-1,_e211=i>0?_n100.length:-1;_t249!=_e211;_t249+=i){var _e212=h.indexOf(_n100[_t249]);if(!(_e212<0||s.resolveInner(_l64+_t249,1).type!=r))if(_e212%2==0==i>0)a++;else{if(1==a)return{start:u,end:{from:_l64+_t249,to:_l64+_t249+1},matched:_e212>>1==o>>1};a--;}}i>0&&(_t248+=_n100.length);}return f.done?{start:u,matched:!1}:null;}(t,e,i,h,l.type,r,n);}function xu(t,e,i,s,r,n,h){var l=s.parent,o={from:r.from,to:r.to},u=0,f=null==l?void 0:l.cursor();if(f&&(i<0?f.childBefore(s.from):f.childAfter(s.to)))do{if(i<0?f.to<=s.from:f.from>=s.to){if(0==u&&n.indexOf(f.type.name)>-1&&f.from<f.to){var _t250=yu(f);return{start:o,end:_t250?{from:_t250.from,to:_t250.to}:void 0,matched:!0};}if(ku(f.type,i,h))u++;else if(ku(f.type,-i,h)){if(0==u){var _t251=yu(f);return{start:o,end:_t251&&_t251.from<_t251.to?{from:_t251.from,to:_t251.to}:void 0,matched:!1};}u--;}}}while(i<0?f.prevSibling():f.nextSibling());return{start:o,matched:!1};}function Eu(t,e){Cu.indexOf(t)>-1||(Cu.push(t),console.warn(e));}function Iu(t,e){var i=[];var _iterator178=_createForOfIteratorHelper(e.split(" ")),_step178;try{for(_iterator178.s();!(_step178=_iterator178.n()).done;){var _s165=_step178.value;var _e214=[];var _iterator179=_createForOfIteratorHelper(_s165.split(".")),_step179;try{for(_iterator179.s();!(_step179=_iterator179.n()).done;){var _i177=_step179.value;var _s166=t[_i177]||Yl[_i177];_s166?"function"==typeof _s166?_e214.length?_e214=_e214.map(_s166):Eu(_i177,"Modifier ".concat(_i177," used at start of tag")):_e214.length?Eu(_i177,"Tag ".concat(_i177," used as modifier")):_e214=Array.isArray(_s166)?_s166:[_s166]:Eu(_i177,"Unknown highlighting tag ".concat(_i177));}}catch(err){_iterator179.e(err);}finally{_iterator179.f();}var _iterator180=_createForOfIteratorHelper(_e214),_step180;try{for(_iterator180.s();!(_step180=_iterator180.n()).done;){var _t253=_step180.value;i.push(_t253);}}catch(err){_iterator180.e(err);}finally{_iterator180.f();}}}catch(err){_iterator178.e(err);}finally{_iterator178.f();}if(!i.length)return 0;var s=e.replace(/ /g,"_"),r=s+" "+i.map(function(t){return t.id;}),n=Ou[r];if(n)return n.id;var h=Ou[r]=Ph.define({id:Au.length,name:s,props:[Il(_defineProperty({},s,i))]});return Au.push(h),h.id;}function Ru(t,e){return function(_ref20){var i=_ref20.state,s=_ref20.dispatch;if(i.readOnly)return!1;var r=t(e,i);return!!r&&(s(i.update(r)),!0);};}function Nu(t,e){var i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{};}function $u(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:e.selection.ranges;var s=i.map(function(t){return Nu(e,t.from).block;});if(!s.every(function(t){return t;}))return null;var r=i.map(function(t,i){return function(t,_ref21,s,r){var e=_ref21.open,i=_ref21.close;var n,h,l=t.sliceDoc(s-ju,s),o=t.sliceDoc(r,r+ju),u=/\s*$/.exec(l)[0].length,f=/^\s*/.exec(o)[0].length,a=l.length-u;if(l.slice(a-e.length,a)==e&&o.slice(f,f+i.length)==i)return{open:{pos:s-u,margin:u&&1},close:{pos:r+f,margin:f&&1}};r-s<=2*ju?n=h=t.sliceDoc(s,r):(n=t.sliceDoc(s,s+ju),h=t.sliceDoc(r-ju,r));var c=/^\s*/.exec(n)[0].length,d=/\s*$/.exec(h)[0].length,p=h.length-d-i.length;return n.slice(c,c+e.length)==e&&h.slice(p,p+i.length)==i?{open:{pos:s+c+e.length,margin:/\s/.test(n.charAt(c+e.length))?1:0},close:{pos:r-d-i.length,margin:/\s/.test(h.charAt(p-1))?1:0}}:null;}(e,s[i],t.from,t.to);});if(2!=t&&!r.every(function(t){return t;}))return{changes:e.changes(i.map(function(t,e){return r[e]?[]:[{from:t.from,insert:s[e].open+" "},{from:t.to,insert:" "+s[e].close}];}))};if(1!=t&&r.some(function(t){return t;})){var _t254=[];for(var _e215,_i179=0;_i179<r.length;_i179++)if(_e215=r[_i179]){var _r132=s[_i179],_e216=_e215,_n102=_e216.open,_h71=_e216.close;_t254.push({from:_n102.pos-_r132.open.length,to:_n102.pos+_n102.margin},{from:_h71.pos-_h71.margin,to:_h71.pos+_r132.close.length});}return{changes:_t254};}return null;}function zu(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:e.selection.ranges;var s=[],r=-1;var _iterator182=_createForOfIteratorHelper(i),_step182;try{for(_iterator182.s();!(_step182=_iterator182.n()).done;){var _step182$value=_step182.value,_t257=_step182$value.from,_n105=_step182$value.to;var _i183=s.length,_h73=1e9,_l65=Nu(e,_t257).line;if(_l65){for(var _i184=_t257;_i184<=_n105;){var _o42=e.doc.lineAt(_i184);if(_o42.from>r&&(_t257==_n105||_n105>_o42.from)){r=_o42.from;var _t258=/^\s*/.exec(_o42.text)[0].length,_e219=_t258==_o42.length,_i185=_o42.text.slice(_t258,_t258+_l65.length)==_l65?_t258:-1;_t258<_o42.text.length&&_t258<_h73&&(_h73=_t258),s.push({line:_o42,comment:_i185,token:_l65,indent:_t258,empty:_e219,single:!1});}_i184=_o42.to+1;}if(_h73<1e9)for(var _t259=_i183;_t259<s.length;_t259++)s[_t259].indent<s[_t259].line.text.length&&(s[_t259].indent=_h73);s.length==_i183+1&&(s[_i183].single=!0);}}}catch(err){_iterator182.e(err);}finally{_iterator182.f();}if(2!=t&&s.some(function(t){return t.comment<0&&(!t.empty||t.single);})){var _t255=[];var _iterator183=_createForOfIteratorHelper(s),_step183;try{for(_iterator183.s();!(_step183=_iterator183.n()).done;){var _step183$value=_step183.value,_e217=_step183$value.line,_i181=_step183$value.token,_r133=_step183$value.indent,_n103=_step183$value.empty,_h72=_step183$value.single;!_h72&&_n103||_t255.push({from:_e217.from+_r133,insert:_i181+" "});}}catch(err){_iterator183.e(err);}finally{_iterator183.f();}var _i180=e.changes(_t255);return{changes:_i180,selection:e.selection.map(_i180,1)};}if(1!=t&&s.some(function(t){return t.comment>=0;})){var _t256=[];var _iterator184=_createForOfIteratorHelper(s),_step184;try{for(_iterator184.s();!(_step184=_iterator184.n()).done;){var _step184$value=_step184.value,_e218=_step184$value.line,_i182=_step184$value.comment,_r134=_step184$value.token;if(_i182>=0){var _s168=_e218.from+_i182,_n104=_s168+_r134.length;" "==_e218.text[_n104-_e218.from]&&_n104++,_t256.push({from:_s168,to:_n104});}}}catch(err){_iterator184.e(err);}finally{_iterator184.f();}return{changes:_t256};}return null;}function qu(t,e){return function(_ref22){var i=_ref22.state,s=_ref22.dispatch;if(!e&&i.readOnly)return!1;var r=i.field(Fu,!1);if(!r)return!1;var n=r.pop(t,i,e);return!!n&&(s(n),!0);};}function Xu(t,e,i,s){var r=e+1>i+20?e-i-1:0,n=t.slice(r,e);return n.push(s),n;}function Yu(t,e){return t.length?e.length?t.concat(e):t:e;}function tf(t,e){if(t.length){var _i186=t[t.length-1],_s170=_i186.selectionsAfter.slice(Math.max(0,_i186.selectionsAfter.length-Zu));return _s170.length&&_s170[_s170.length-1].eq(e)?t:(_s170.push(e),Xu(t,t.length-1,1e9,_i186.setSelAfter(_s170)));}return[_u.selection([e])];}function ef(t){var e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i;}function sf(t,e){if(!t.length)return t;var i=t.length,s=Qu;for(;i;){var _r136=rf(t[i-1],e,s);if(_r136.changes&&!_r136.changes.empty||_r136.effects.length){var _e221=t.slice(0,i);return _e221[i-1]=_r136,_e221;}e=_r136.mapped,i--,s=_r136.selectionsAfter;}return s.length?[_u.selection(s)]:Qu;}function rf(t,e,i){var s=Yu(t.selectionsAfter.length?t.selectionsAfter.map(function(t){return t.map(e);}):Qu,i);if(!t.changes)return _u.selection(s);var r=t.changes.map(e),n=e.mapDesc(t.changes,!0),h=t.mapped?t.mapped.composeDesc(n):n;return new _u(r,ct.mapEffects(t.effects,e),h,t.startSelection.map(n),s);}function of(t,e){return B.create(t.ranges.map(e),t.mainIndex);}function uf(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"});}function ff(_ref23,i){var t=_ref23.state,e=_ref23.dispatch;var s=of(t.selection,i);return!s.eq(t.selection,!0)&&(e(uf(t,s)),!0);}function af(t,e){return B.cursor(e?t.to:t.from);}function cf(t,e){return ff(t,function(i){return i.empty?t.moveByChar(i,e):af(i,e);});}function df(t){return t.textDirectionAt(t.state.selection.main.head)==pi.LTR;}function gf(t,e){return ff(t,function(i){return i.empty?t.moveByGroup(i,e):af(i,e);});}function wf(t,e,i){if(e.type.prop(i))return!0;var s=e.to-e.from;return s&&(s>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild;}function bf(t,e,i){var s,r,n=no(t).resolveInner(e.head),h=i?jh.closedBy:jh.openedBy;for(var _s171=e.head;;){var _e223=i?n.childAfter(_s171):n.childBefore(_s171);if(!_e223)break;wf(t,_e223,h)?n=_e223:_s171=i?_e223.to:_e223.from;}return r=n.type.prop(h)&&(s=i?Mu(t,n.from,1):Mu(t,n.to,-1))&&s.matched?i?s.end.to:s.end.from:i?n.to:n.from,B.cursor(r,i?-1:1);}function vf(t,e){return ff(t,function(i){if(!i.empty)return af(i,e);var s=t.moveVertically(i,e);return s.head!=i.head?s:t.moveToLineBoundary(i,e);});}function Mf(t){var e,i=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,s=0,r=0;if(i){var _iterator186=_createForOfIteratorHelper(t.state.facet(Ur.scrollMargins)),_step186;try{for(_iterator186.s();!(_step186=_iterator186.n()).done;){var _e224=_step186.value;var _i188=_e224(t);(null==_i188?void 0:_i188.top)&&(s=Math.max(null==_i188?void 0:_i188.top,s)),(null==_i188?void 0:_i188.bottom)&&(r=Math.max(null==_i188?void 0:_i188.bottom,r));}}catch(err){_iterator186.e(err);}finally{_iterator186.f();}e=t.scrollDOM.clientHeight-s-r;}else e=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:s,marginBottom:r,selfScroll:i,height:Math.max(t.defaultLineHeight,e-5)};}function xf(t,e){var i,s=Mf(t),r=t.state,n=of(r.selection,function(i){return i.empty?t.moveVertically(i,e,s.height):af(i,e);});if(n.eq(r.selection))return!1;if(s.selfScroll){var _e225=t.coordsAtPos(r.selection.main.head),_h76=t.scrollDOM.getBoundingClientRect(),_l66=_h76.top+s.marginTop,_o43=_h76.bottom-s.marginBottom;_e225&&_e225.top>_l66&&_e225.bottom<_o43&&(i=Ur.scrollIntoView(n.main.head,{y:"start",yMargin:_e225.top-_l66}));}return t.dispatch(uf(r,n),{effects:i}),!0;}function Cf(t,e,i){var s=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?s.to:s.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==s.from&&s.length){var _i189=/^\s*/.exec(t.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;_i189&&e.head!=s.from+_i189&&(r=B.cursor(s.from+_i189));}return r;}function Of(t,e){var i=of(t.state.selection,function(t){var i=e(t);return B.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0);});return!i.eq(t.state.selection)&&(t.dispatch(uf(t.state,i)),!0);}function Df(t,e){return Of(t,function(i){return t.moveByChar(i,e);});}function Rf(t,e){return Of(t,function(i){return t.moveByGroup(i,e);});}function Tf(t,e){return Of(t,function(i){return t.moveVertically(i,e);});}function Nf(t,e){return Of(t,function(i){return t.moveVertically(i,e,Mf(t).height);});}function Vf(t,e){if(t.state.readOnly)return!1;var i="delete.selection",s=t.state,r=s.changeByRange(function(s){var r=s.from,n=s.to;if(r==n){var _h77=e(s);_h77<r?(i="delete.backward",_h77=Ff(t,_h77,!1)):_h77>r&&(i="delete.forward",_h77=Ff(t,_h77,!0)),r=Math.min(r,_h77),n=Math.max(n,_h77);}else r=Ff(t,r,!1),n=Ff(t,n,!0);return r==n?{range:s}:{changes:{from:r,to:n},range:B.cursor(r,r<s.head?-1:1)};});return!r.changes.empty&&(t.dispatch(s.update(r,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ur.announce.of(s.phrase("Selection deleted")):void 0})),!0);}function Ff(t,e,i){if(t instanceof Ur){var _iterator187=_createForOfIteratorHelper(t.state.facet(Ur.atomicRanges).map(function(e){return e(t);})),_step187;try{for(_iterator187.s();!(_step187=_iterator187.n()).done;){var _s172=_step187.value;_s172.between(e,e,function(t,s){t<e&&s>e&&(e=i?s:t);});}}catch(err){_iterator187.e(err);}finally{_iterator187.f();}}return e;}function _f(t){var e=[],i=-1;var _iterator188=_createForOfIteratorHelper(t.selection.ranges),_step188;try{for(_iterator188.s();!(_step188=_iterator188.n()).done;){var _s173=_step188.value;var _r137=t.doc.lineAt(_s173.from),_n107=t.doc.lineAt(_s173.to);if(_s173.empty||_s173.to!=_n107.from||(_n107=t.doc.lineAt(_s173.to-1)),i>=_r137.number){var _t263=e[e.length-1];_t263.to=_n107.to,_t263.ranges.push(_s173);}else e.push({from:_r137.from,to:_n107.to,ranges:[_s173]});i=_n107.number+1;}}catch(err){_iterator188.e(err);}finally{_iterator188.f();}return e;}function Xf(t,e,i){if(t.readOnly)return!1;var s=[],r=[];var _iterator189=_createForOfIteratorHelper(_f(t)),_step189;try{for(_iterator189.s();!(_step189=_iterator189.n()).done;){var _e227=_step189.value;if(i?_e227.to==t.doc.length:0==_e227.from)continue;var _n108=t.doc.lineAt(i?_e227.to+1:_e227.from-1),_h78=_n108.length+1;if(i){s.push({from:_e227.to,to:_n108.to},{from:_e227.from,insert:_n108.text+t.lineBreak});var _iterator190=_createForOfIteratorHelper(_e227.ranges),_step190;try{for(_iterator190.s();!(_step190=_iterator190.n()).done;){var _i190=_step190.value;r.push(B.range(Math.min(t.doc.length,_i190.anchor+_h78),Math.min(t.doc.length,_i190.head+_h78)));}}catch(err){_iterator190.e(err);}finally{_iterator190.f();}}else{s.push({from:_n108.from,to:_e227.from},{from:_e227.to,insert:t.lineBreak+_n108.text});var _iterator191=_createForOfIteratorHelper(_e227.ranges),_step191;try{for(_iterator191.s();!(_step191=_iterator191.n()).done;){var _t264=_step191.value;r.push(B.range(_t264.anchor-_h78,_t264.head-_h78));}}catch(err){_iterator191.e(err);}finally{_iterator191.f();}}}}catch(err){_iterator189.e(err);}finally{_iterator189.f();}return!!s.length&&(e(t.update({changes:s,scrollIntoView:!0,selection:B.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0);}function Yf(t,e,i){if(t.readOnly)return!1;var s=[];var _iterator192=_createForOfIteratorHelper(_f(t)),_step192;try{for(_iterator192.s();!(_step192=_iterator192.n()).done;){var _e228=_step192.value;i?s.push({from:_e228.from,insert:t.doc.slice(_e228.from,_e228.to)+t.lineBreak}):s.push({from:_e228.to,insert:t.lineBreak+t.doc.slice(_e228.from,_e228.to)});}}catch(err){_iterator192.e(err);}finally{_iterator192.f();}return e(t.update({changes:s,scrollIntoView:!0,userEvent:"input.copyline"})),!0;}function Zf(e){return function(_ref28){var i=_ref28.state,s=_ref28.dispatch;if(i.readOnly)return!1;var r=i.changeByRange(function(s){var _l68;var r=s.from,n=s.to,h=i.doc.lineAt(r),l=!e&&r==n&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};var i,s=no(t).resolveInner(e),r=s.childBefore(e),n=s.childAfter(e);return r&&n&&r.to<=e&&n.from>=e&&(i=r.type.prop(jh.closedBy))&&i.indexOf(n.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(n.from).from&&!/\S/.test(t.sliceDoc(r.to,n.from))?{from:r.to,to:n.from}:null;}(i,r);e&&(r=n=(n<=h.to?h:i.doc.lineAt(n)).to);var o=new Mo(i,{simulateBreak:r,simulateDoubleBreak:!!l}),u=yo(o,r);for(null==u&&(u=Vt(/^\s*/.exec(i.doc.lineAt(r).text)[0],i.tabSize));n<h.to&&/\s/.test(h.text[n-h.from]);)n++;l?(_l68=l,r=_l68.from,n=_l68.to,_l68):r>h.from&&r<h.from+100&&!/\S/.test(h.text.slice(0,r))&&(r=h.from);var f=["",ko(i,u)];return l&&f.push(ko(i,o.lineIndent(h.from,-1))),{changes:{from:r,to:n,insert:t.of(f)},range:B.cursor(r+1+f[1].length)};});return s(i.update(r,{scrollIntoView:!0,userEvent:"input"})),!0;};}function ta(t,e){var i=-1;return t.changeByRange(function(s){var r=[];for(var _n109=s.from;_n109<=s.to;){var _h79=t.doc.lineAt(_n109);_h79.number>i&&(s.empty||s.to>_h79.from)&&(e(_h79,r,s),i=_h79.number),_n109=_h79.to+1;}var n=t.changes(r);return{changes:r,range:B.range(n.mapPos(s.anchor,1),n.mapPos(s.head,1))};});}function ia(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&"object"==_typeof(i)&&null==i.nodeType&&!Array.isArray(i)){for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){var r=i[s];"string"==typeof r?t.setAttribute(s,r):null!=r&&(t[s]=r);}e++;}for(;e<arguments.length;e++)sa(t,arguments[e]);return t;}function sa(t,e){if("string"==typeof e)t.appendChild(document.createTextNode(e));else if(null==e);else if(null!=e.nodeType)t.appendChild(e);else{if(!Array.isArray(e))throw new RangeError("Unsupported child node: "+e);for(var i=0;i<e.length;i++)sa(t,e[i]);}}function ca(t,e){if(e>=t.length)return e;var i,s=t.lineAt(e);for(;e<s.to&&(i=s.text.charCodeAt(e-s.from))>=56320&&i<57344;)e++;return e;}function da(t){var e=ia("input",{"class":"cm-textfield",name:"line",value:String(t.state.doc.lineAt(t.state.selection.main.head).number)});function i(){var i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!i)return;var s=t.state,r=s.doc.lineAt(s.selection.main.head),_i194=_slicedToArray(i,5),n=_i194[1],h=_i194[2],l=_i194[3],o=_i194[4],u=l?+l.slice(1):0,f=h?+h:r.number;if(h&&o){var _t271=f/100;n&&(_t271=_t271*("-"==n?-1:1)+r.number/s.doc.lines),f=Math.round(s.doc.lines*_t271);}else h&&n&&(f=f*("-"==n?-1:1)+r.number);var a=s.doc.line(Math.max(1,Math.min(s.doc.lines,f))),c=B.cursor(a.from+Math.max(0,Math.min(u,a.length)));t.dispatch({effects:[pa.of(!1),Ur.scrollIntoView(c.from,{y:"center"})],selection:c}),t.focus();}return{dom:ia("form",{"class":"cm-gotoLine",onkeydown:function onkeydown(e){27==e.keyCode?(e.preventDefault(),t.dispatch({effects:pa.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i());},onsubmit:function onsubmit(t){t.preventDefault(),i();}},ia("label",t.state.phrase("Go to line"),": ",e)," ",ia("button",{"class":"cm-button",type:"submit"},t.state.phrase("go")))};}function ya(t,e,i,s){return!(0!=i&&t(e.sliceDoc(i-1,i))==kt.Word||s!=e.doc.length&&t(e.sliceDoc(s,s+1))==kt.Word);}function Oa(t,e,i,s){return new na(e.doc,t.unquoted,i,s,t.caseSensitive?void 0:function(t){return t.toLowerCase();},t.wholeWord?function(t,e){return function(i,s,r,n){return(n>i||n+r.length<s)&&(n=Math.max(0,i-2),r=t.sliceString(n,Math.min(t.length,s+2))),!(e(Ia(r,i-n))==kt.Word&&e(Ra(r,i-n))==kt.Word||e(Ra(r,s-n))==kt.Word&&e(Ia(r,s-n))==kt.Word);};}(e.doc,e.charCategorizer(e.selection.main.head)):void 0);}function Ea(t,e,i,s){return new oa(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(r=e.charCategorizer(e.selection.main.head),function(t,e,i){return!i[0].length||(r(Ia(i.input,i.index))!=kt.Word||r(Ra(i.input,i.index))!=kt.Word)&&(r(Ra(i.input,i.index+i[0].length))!=kt.Word||r(Ia(i.input,i.index+i[0].length))!=kt.Word);}):void 0},i,s);var r;}function Ia(t,e){return t.slice(p(t,e,!1),e);}function Ra(t,e){return t.slice(e,p(t,e));}function Ha(t){return function(e){var i=e.state.field(Na,!1);return i&&i.query.spec.valid?t(e,i):Xa(e);};}function Ja(t){return t.state.facet(Sa).createPanel(t);}function Ga(t,e){var i,s,r,n,h;var l=t.selection.main,o=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!o)return e;var u=t.facet(Sa);return new Aa({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:u.literal)?o:o.replace(/\n/g,"\\n"),caseSensitive:null!==(s=null==e?void 0:e.caseSensitive)&&void 0!==s?s:u.caseSensitive,literal:null!==(r=null==e?void 0:e.literal)&&void 0!==r?r:u.literal,regexp:null!==(n=null==e?void 0:e.regexp)&&void 0!==n?n:u.regexp,wholeWord:null!==(h=null==e?void 0:e.wholeWord)&&void 0!==h?h:u.wholeWord});}function Ka(t){var e=hh(t,Ja);return e&&e.dom.querySelector("[main-field]");}function _a(t){var e=Ka(t);e&&e==t.root.activeElement&&e.select();}function tc(t,e){return t.state.phrase(e);}function sc(t,_ref54){var e=_ref54.from,i=_ref54.to;var s=t.state.doc.lineAt(e),r=t.state.doc.lineAt(i).to,n=Math.max(s.from,e-ec),h=Math.min(r,i+ec),l=t.state.sliceDoc(n,h);if(n!=s.from)for(var _t276=0;_t276<ec;_t276++)if(!ic.test(l[_t276+1])&&ic.test(l[_t276])){l=l.slice(_t276);break;}if(h!=r)for(var _t277=l.length-1;_t277>l.length-ec;_t277--)if(!ic.test(l[_t277-1])&&ic.test(l[_t277])){l=l.slice(0,_t277);break;}return Ur.announce.of("".concat(t.state.phrase("current match"),". ").concat(l," ").concat(t.state.phrase("on line")," ").concat(s.number,"."));}function lc(t){var e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),"[".concat(i?"\\w":"").concat(e.replace(/[^\w\s]/g,"\\$&"),"]");}function oc(t){var e=t.map(function(t){return"string"==typeof t?{label:t}:t;}),_ref55=e.every(function(t){return /^\w+$/.test(t.label);})?[/\w*$/,/\w+$/]:function(t){var e=Object.create(null),i=Object.create(null);var _iterator198=_createForOfIteratorHelper(t),_step198;try{for(_iterator198.s();!(_step198=_iterator198.n()).done;){var _s185=_step198.value.label;e[_s185[0]]=!0;for(var _t278=1;_t278<_s185.length;_t278++)i[_s185[_t278]]=!0;}}catch(err){_iterator198.e(err);}finally{_iterator198.f();}var s=lc(e)+lc(i)+"*$";return[new RegExp("^"+s),new RegExp(s)];}(e),_ref56=_slicedToArray(_ref55,2),i=_ref56[0],s=_ref56[1];return function(t){var r=t.matchBefore(s);return r||t.explicit?{from:r?r.from:t.pos,options:e,validFor:i}:null;};}function uc(t,e){return function(i){for(var _e238=no(i.state).resolveInner(i.pos,-1);_e238;_e238=_e238.parent){if(t.indexOf(_e238.name)>-1)return null;if(_e238.type.isTop)break;}return e(i);};}function ac(t){return t.selection.main.from;}function cc(t,e){var i;var s=t.source,r=e&&"^"!=s[0],n="$"!=s[s.length-1];return r||n?new RegExp("".concat(r?"^":"","(?:").concat(s,")").concat(n?"$":""),null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t;}function mc(t){if(!Array.isArray(t))return t;var e=pc.get(t);return e||pc.set(t,e=oc(t)),e;}function yc(t,e){return t?e?t+" "+e:t:e;}function Mc(t,e,i,s,r,n){var h,l,o=t.textDirection==pi.RTL,u=o,f=!1,a="top",c=e.left-r.left,d=r.right-e.right,p=s.right-s.left,m=s.bottom-s.top;if(u&&c<Math.min(p,d)?u=!1:!u&&d<Math.min(p,c)&&(u=!0),p<=(u?c:d))h=Math.max(r.top,Math.min(i.top,r.bottom-m))-e.top,l=Math.min(400,u?c:d);else{f=!0,l=Math.min(400,(o?e.right:r.right-e.left)-30);var _t280=r.bottom-e.bottom;_t280>=m||_t280>e.top?h=i.bottom-e.top:(a="bottom",h=e.bottom-i.top);}return{style:"".concat(a,": ").concat(h/((e.bottom-e.top)/n.offsetHeight),"px; max-width: ").concat(l/((e.right-e.left)/n.offsetWidth),"px"),"class":"cm-completionInfo-"+(f?o?"left-narrow":"right-narrow":u?"left":"right")};}function xc(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){var _t281=Math.floor(e/i);return{from:_t281*i,to:(_t281+1)*i};}var s=Math.floor((t-e)/i);return{from:t-(s+1)*i,to:t-s*i};}function Ac(t,e){return function(i){return new Sc(i,t,e);};}function Cc(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0);}function Ic(t,e){var i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i;}function Tc(t,e){if(t.isUserEvent("input.complete")){var _i210=t.annotation(dc);if(_i210&&e.activateOnCompletion(_i210))return"input";}return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null;}function zc(t,e){var i=e.completion.apply||e.completion.label;var s=t.state.field($c).active.find(function(t){return t.source==e.source;});return s instanceof Lc&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,s){var r=t.selection.main,n=i-r.from,h=s-r.from;return Object.assign(Object.assign({},t.changeByRange(function(l){return l!=r&&i!=s&&t.sliceDoc(l.from+n,l.from+h)!=t.sliceDoc(i,s)?{range:l}:{changes:{from:l.from+n,to:s==r.from?l.to:l.from+h,insert:e},range:B.cursor(l.from+n+e.length)};})),{scrollIntoView:!0,userEvent:"input.complete"});}(t.state,i,s.from,s.to)),{annotations:dc.of(e.completion)})):i(t,e.completion,s.from,s.to),!0);}function Hc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"option";return function(i){var s=i.state.field($c,!1);if(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<i.state.facet(kc).interactionDelay)return!1;var r,n=1;"page"==e&&(r=sh(i,s.open.tooltip))&&(n=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1));var h=s.open.options.length,l=s.open.selected>-1?s.open.selected+n*(t?1:-1):t?0:h-1;return l<0?l="page"==e?0:h-1:l>=h&&(l="page"==e?h-1:0),i.dispatch({effects:jc.of(l)}),!0;};}function ed(t,e){return B.create(t.filter(function(t){return t.field==e;}).map(function(t){return B.range(t.from,t.to);}));}function id(e){var i=Kc.parse(e);return function(e,s,r,n){var _i$instantiate=i.instantiate(e.state,r),h=_i$instantiate.text,l=_i$instantiate.ranges,o={changes:{from:r,to:n,insert:t.of(h)},scrollIntoView:!0,annotations:s?[dc.of(s),dt.userEvent.of("input.complete")]:void 0};if(l.length&&(o.selection=ed(l,0)),l.some(function(t){return t.field>0;})){var _t300=new Yc(l,0),_i216=o.effects=[Qc.of(_t300)];void 0===e.state.field(td,!1)&&_i216.push(ct.appendConfig.of([td,hd,od,Uc]));}e.dispatch(e.state.update(o));};}function sd(t){return function(_ref57){var e=_ref57.state,i=_ref57.dispatch;var s=e.field(td,!1);if(!s||t<0&&0==s.active)return!1;var r=s.active+t,n=t>0&&!s.ranges.some(function(e){return e.field==r+t;});return i(e.update({selection:ed(s.ranges,r),effects:Qc.of(n?null:new Yc(s.ranges,r)),scrollIntoView:!0})),!0;};}function ld(t,e){return Object.assign(Object.assign({},e),{apply:id(t)});}function pd(t){for(var _e261=0;_e261<dd.length;_e261+=2)if(dd.charCodeAt(_e261)==t)return dd.charAt(_e261+1);return k(t<128?t:t+1);}function md(t,e){return t.languageDataAt("closeBrackets",e)[0]||ud;}function vd(t,e){var i=!1;return t.field(cd).between(0,t.doc.length,function(t){t==e&&(i=!0);}),i;}function kd(t,e){var i=t.sliceString(e,e+2);return i.slice(0,y(v(i,0)));}function yd(t,e,i,s){var r=null,n=t.changeByRange(function(n){if(!n.empty)return{changes:[{insert:e,from:n.from},{insert:i,from:n.to}],effects:fd.of(n.to+e.length),range:B.range(n.anchor+e.length,n.head+e.length)};var h=kd(t.doc,n.head);return!h||/\s/.test(h)||s.indexOf(h)>-1?{changes:{insert:e+i,from:n.head},effects:fd.of(n.head+e.length),range:B.cursor(n.head+e.length)}:{range:r=n};});return r?null:t.update(n,{scrollIntoView:!0,userEvent:"input.type"});}function Md(t,e,i){var s=null,r=t.changeByRange(function(e){return e.empty&&kd(t.doc,e.head)==i?{changes:{from:e.head,to:e.head+i.length,insert:i},range:B.cursor(e.head+i.length)}:s={range:e};});return s?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"});}function xd(t,e,i,s){var r=s.stringPrefixes||ud.stringPrefixes,n=null,h=t.changeByRange(function(s){if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:e,from:s.to}],effects:fd.of(s.to+e.length),range:B.range(s.anchor+e.length,s.head+e.length)};var h,l=s.head,o=kd(t.doc,l);if(o==e){if(Sd(t,l))return{changes:{insert:e+e,from:l},effects:fd.of(l+e.length),range:B.cursor(l+e.length)};if(vd(t,l)){var _s199=i&&t.sliceDoc(l,l+3*e.length)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+_s199.length,insert:_s199},range:B.cursor(l+_s199.length)};}}else{if(i&&t.sliceDoc(l-2*e.length,l)==e+e&&(h=Ad(t,l-2*e.length,r))>-1&&Sd(t,h))return{changes:{insert:e+e+e+e,from:l},effects:fd.of(l+e.length),range:B.cursor(l+e.length)};if(t.charCategorizer(l)(o)!=kt.Word&&Ad(t,l,r)>-1&&!function(t,e,i,s){var r=no(t).resolveInner(e,-1),n=s.reduce(function(t,e){return Math.max(t,e.length);},0);for(var _h88=0;_h88<5;_h88++){var _h89=t.sliceDoc(r.from,Math.min(r.to,r.from+i.length+n)),_l74=_h89.indexOf(i);if(!_l74||_l74>-1&&s.indexOf(_h89.slice(0,_l74))>-1){var _e262=r.firstChild;for(;_e262&&_e262.from==r.from&&_e262.to-_e262.from>i.length+_l74;){if(t.sliceDoc(_e262.to-i.length,_e262.to)==i)return!1;_e262=_e262.firstChild;}return!0;}var _o48=r.to==e&&r.parent;if(!_o48)break;r=_o48;}return!1;}(t,l,e,r))return{changes:{insert:e+e,from:l},effects:fd.of(l+e.length),range:B.cursor(l+e.length)};}return{range:n=s};});return n?null:t.update(h,{scrollIntoView:!0,userEvent:"input.type"});}function Sd(t,e){var i=no(t).resolveInner(e+1);return i.parent&&i.from==e;}function Ad(t,e,i){var s=t.charCategorizer(e);if(s(t.sliceDoc(e-1,e))!=kt.Word)return e;var _iterator227=_createForOfIteratorHelper(i),_step227;try{for(_iterator227.s();!(_step227=_iterator227.n()).done;){var _r158=_step227.value;var _i219=e-_r158.length;if(t.sliceDoc(_i219,e)==_r158&&s(t.sliceDoc(_i219-1,_i219))!=kt.Word)return _i219;}}catch(err){_iterator227.e(err);}finally{_iterator227.f();}return-1;}function Cd(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[qc,$c,kc.of(t),Vc,Dd,Uc];}function Rd(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=null;return t.between(i,1e9,function(t,i,_ref60){var r=_ref60.spec;if(!e||r.diagnostic==e)return s=new Ed(t,i,r.diagnostic),!1;}),s;}function $d(t,e,i){var _t$state$field=t.state.field(Nd),s=_t$state$field.diagnostics,r=[],n=2e8,h=0;s.between(e-(i<0?1:0),e+(i>0?1:0),function(t,s,_ref61){var l=_ref61.spec;e>=t&&e<=s&&(t==s||(e>t||i>0)&&(e<s||i<0))&&(r.push(l.diagnostic),n=Math.min(t,n),h=Math.max(s,h));});var l=t.state.facet(Wd).tooltipFilter;return l&&(r=l(r,t.state)),r.length?{pos:n,end:h,above:t.state.doc.lineAt(n).to<h,create:function create(){return{dom:zd(t,r)};}}:null;}function zd(t,e){return ia("ul",{"class":"cm-tooltip-lint"},e.map(function(e){return Fd(t,e,!1);}));}function Vd(t){var e=[];if(t){var _iterator229=_createForOfIteratorHelper(t),_step229;try{t:for(_iterator229.s();!(_step229=_iterator229.n()).done;){var _i222=_step229.value.name;var _loop19=function _loop19(){var s=_i222[_t301];if(/[a-zA-Z]/.test(s)&&!e.some(function(t){return t.toLowerCase()==s.toLowerCase();})){e.push(s);return 1;// continue t
|
2
|
-
}};for(var _t301=0;_t301<_i222.length;_t301++){if(_loop19())continue t;}e.push("");}}catch(err){_iterator229.e(err);}finally{_iterator229.f();}}return e;}function Fd(t,e,i){var s;var r=i?Vd(e.actions):[];return ia("li",{"class":"cm-diagnostic cm-diagnostic-"+e.severity},ia("span",{"class":"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),null===(s=e.actions)||void 0===s?void 0:s.map(function(i,s){var n=!1,h=function h(s){if(s.preventDefault(),n)return;n=!0;var r=Rd(t.state.field(Nd).diagnostics,e);r&&i.apply(t,r.from,r.to);},l=i.name,o=r[s]?l.indexOf(r[s]):-1,u=o<0?l:[l.slice(0,o),ia("u",l.slice(o,o+1)),l.slice(o+1)];return ia("button",{type:"button","class":"cm-diagnosticAction",onclick:h,onmousedown:h,"aria-label":" Action: ".concat(l).concat(o<0?"":" (access key \"".concat(r[s],")\""),".")},u);}),e.source&&ia("div",{"class":"cm-diagnosticSource"},e.source));}function Gd(t){return function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'viewBox="0 0 40 40"';return"url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" ".concat(e,">").concat(encodeURIComponent(t),"</svg>')");}("<path d=\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\" stroke=\"".concat(t,"\" fill=\"none\" stroke-width=\".7\"/>"),'width="6" height="3"');}_export({O:Cd,Q:Eh,U:jn,c:To,d:Eo,g:No,j:uc,k:oc,l:no,n:ld,p:to,r:cl,s:Il,y:Ui,I:void 0});return{setters:[],execute:function execute(){_export("A",t=/*#__PURE__*/function(){function t(){_classCallCheck(this,t);}return _createClass(t,[{key:"lineAt",value:function lineAt(_t2){if(_t2<0||_t2>this.length)throw new RangeError("Invalid position ".concat(_t2," in document of length ").concat(this.length));return this.lineInner(_t2,!1,1,0);}},{key:"line",value:function line(_t3){if(_t3<1||_t3>this.lines)throw new RangeError("Invalid line number ".concat(_t3," in ").concat(this.lines,"-line document"));return this.lineInner(_t3,!0,1,0);}},{key:"replace",value:function replace(_t4,e,s){var _u2=u(this,_t4,e);var _u3=_slicedToArray(_u2,2);_t4=_u3[0];e=_u3[1];var r=[];return this.decompose(0,_t4,r,2),s.length&&s.decompose(0,s.length,r,3),this.decompose(e,this.length,r,1),i.from(r,this.length-(e-_t4)+s.length);}},{key:"append",value:function append(_t5){return this.replace(this.length,this.length,_t5);}},{key:"slice",value:function slice(_t6){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;var _u4=u(this,_t6,e);var _u5=_slicedToArray(_u4,2);_t6=_u5[0];e=_u5[1];var s=[];return this.decompose(_t6,e,s,0),i.from(s,e-_t6);}},{key:"eq",value:function eq(_t7){if(_t7==this)return!0;if(_t7.length!=this.length||_t7.lines!=this.lines)return!1;var e=this.scanIdentical(_t7,1),i=this.length-this.scanIdentical(_t7,-1),s=new n(this),r=new n(_t7);for(var _t13=e,_n2=e;;){if(s.next(_t13),r.next(_t13),_t13=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(_n2+=s.value.length,s.done||_n2>=i)return!0;}}},{key:"iter",value:function iter(){var _t9=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;return new n(this,_t9);}},{key:"iterRange",value:function iterRange(_t10){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;return new h(this,_t10,e);}},{key:"iterLines",value:function iterLines(_t11,e){var i;if(null==_t11)i=this.iter();else{null==e&&(e=this.lines+1);var _s2=this.line(_t11).from;i=this.iterRange(_s2,Math.max(_s2,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to));}return new l(i);}},{key:"toString",value:function toString(){return this.sliceString(0);}},{key:"toJSON",value:function toJSON(){var _t12=[];return this.flatten(_t12),_t12;}}],[{key:"of",value:function of(s){if(0==s.length)throw new RangeError("A document must have at least one line");return 1!=s.length||s[0]?s.length<=32?new e(s):i.from(e.split(s,[])):t.empty;}}]);}());e=/*#__PURE__*/function(_t14){function e(t){var _this;var _e2=arguments.length>1&&arguments[1]!==undefined?arguments[1]:function(t){var e=-1;var _iterator=_createForOfIteratorHelper(t),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _i2=_step.value;e+=_i2.length+1;}}catch(err){_iterator.e(err);}finally{_iterator.f();}return e;}(t);_classCallCheck(this,e);_this=_callSuper(this,e),_this.text=t,_this.length=_e2;return _this;}_inherits(e,_t14);return _createClass(e,[{key:"lines",get:function get(){return this.text.length;}},{key:"children",get:function get(){return null;}},{key:"lineInner",value:function lineInner(t,_e3,i,s){for(var _r2=0;;_r2++){var _n3=this.text[_r2],_h2=s+_n3.length;if((_e3?i:_h2)>=t)return new o(s,_h2,i,_n3);s=_h2+1,i++;}}},{key:"decompose",value:function decompose(t,i,n,h){var l=t<=0&&i>=this.length?this:new e(r(this.text,t,i),Math.min(i,this.length)-Math.max(0,t));if(1&h){var _t15=n.pop(),_i3=s(l.text,_t15.text.slice(),0,l.length);if(_i3.length<=32)n.push(new e(_i3,_t15.length+l.length));else{var _t16=_i3.length>>1;n.push(new e(_i3.slice(0,_t16)),new e(_i3.slice(_t16)));}}else n.push(l);}},{key:"replace",value:function replace(t,n,h){if(!(h instanceof e))return _get(_getPrototypeOf(e.prototype),"replace",this).call(this,t,n,h);var _u6=u(this,t,n);var _u7=_slicedToArray(_u6,2);t=_u7[0];n=_u7[1];var l=s(this.text,s(h.text,r(this.text,0,t)),n),o=this.length+h.length-(n-t);return l.length<=32?new e(l,o):i.from(e.split(l,[]),o);}},{key:"sliceString",value:function sliceString(t){var _e4=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"\n";var _u8=u(this,t,_e4);var _u9=_slicedToArray(_u8,2);t=_u9[0];_e4=_u9[1];var s="";for(var _r3=0,_n4=0;_r3<=_e4&&_n4<this.text.length;_n4++){var _h3=this.text[_n4],_l2=_r3+_h3.length;_r3>t&&_n4&&(s+=i),t<_l2&&_e4>_r3&&(s+=_h3.slice(Math.max(0,t-_r3),_e4-_r3)),_r3=_l2+1;}return s;}},{key:"flatten",value:function flatten(t){var _iterator2=_createForOfIteratorHelper(this.text),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _e5=_step2.value;t.push(_e5);}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}},{key:"scanIdentical",value:function scanIdentical(){return 0;}}],[{key:"split",value:function split(t,i){var s=[],r=-1;var _iterator3=_createForOfIteratorHelper(t),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _n5=_step3.value;s.push(_n5),r+=_n5.length+1,32==s.length&&(i.push(new e(s,r)),s=[],r=-1);}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}return r>-1&&i.push(new e(s,r)),i;}}]);}(t);i=/*#__PURE__*/function(_t17){function i(t,e){var _this2;_classCallCheck(this,i);_this2=_callSuper(this,i),_this2.children=t,_this2.length=e,_this2.lines=0;var _iterator4=_createForOfIteratorHelper(t),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _e6=_step4.value;_this2.lines+=_e6.lines;}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}return _this2;}_inherits(i,_t17);return _createClass(i,[{key:"lineInner",value:function lineInner(t,e,_i4,s){for(var _r4=0;;_r4++){var _n6=this.children[_r4],_h4=s+_n6.length,_l3=_i4+_n6.lines-1;if((e?_l3:_h4)>=t)return _n6.lineInner(t,e,_i4,s);s=_h4+1,_i4=_l3+1;}}},{key:"decompose",value:function decompose(t,e,_i5,s){for(var _r5=0,_n7=0;_n7<=e&&_r5<this.children.length;_r5++){var _h5=this.children[_r5],_l4=_n7+_h5.length;if(t<=_l4&&e>=_n7){var _r6=s&((_n7<=t?1:0)|(_l4>=e?2:0));_n7>=t&&_l4<=e&&!_r6?_i5.push(_h5):_h5.decompose(t-_n7,e-_n7,_i5,_r6);}_n7=_l4+1;}}},{key:"replace",value:function replace(t,e,s){var _u10,_u11;if((_u10=u(this,t,e),_u11=_slicedToArray(_u10,2),t=_u11[0],e=_u11[1]),s.lines<this.lines)for(var _r7=0,_n8=0;_r7<this.children.length;_r7++){var _h6=this.children[_r7],_l5=_n8+_h6.length;if(t>=_n8&&e<=_l5){var _o2=_h6.replace(t-_n8,e-_n8,s),_u12=this.lines-_h6.lines+_o2.lines;if(_o2.lines<_u12>>4&&_o2.lines>_u12>>6){var _n9=this.children.slice();return _n9[_r7]=_o2,new i(_n9,this.length-(e-t)+s.length);}return _get(_getPrototypeOf(i.prototype),"replace",this).call(this,_n8,_l5,_o2);}_n8=_l5+1;}return _get(_getPrototypeOf(i.prototype),"replace",this).call(this,t,e,s);}},{key:"sliceString",value:function sliceString(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;var _i6=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"\n";var _u13=u(this,t,e);var _u14=_slicedToArray(_u13,2);t=_u14[0];e=_u14[1];var s="";for(var _r8=0,_n10=0;_r8<this.children.length&&_n10<=e;_r8++){var _h7=this.children[_r8],_l6=_n10+_h7.length;_n10>t&&_r8&&(s+=_i6),t<_l6&&e>_n10&&(s+=_h7.sliceString(t-_n10,e-_n10,_i6)),_n10=_l6+1;}return s;}},{key:"flatten",value:function flatten(t){var _iterator5=_createForOfIteratorHelper(this.children),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _e7=_step5.value;_e7.flatten(t);}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}},{key:"scanIdentical",value:function scanIdentical(t,e){if(!(t instanceof i))return 0;var s=0,_ref=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1],_ref2=_slicedToArray(_ref,4),r=_ref2[0],n=_ref2[1],h=_ref2[2],l=_ref2[3];for(;;r+=e,n+=e){if(r==h||n==l)return s;var _i7=this.children[r],_o3=t.children[n];if(_i7!=_o3)return s+_i7.scanIdentical(_o3,e);s+=_i7.length+1;}}}],[{key:"from",value:function from(t){var s=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t.reduce(function(t,e){return t+e.length+1;},-1);var r=0;var _iterator6=_createForOfIteratorHelper(t),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _e10=_step6.value;r+=_e10.lines;}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}if(r<32){var _i8=[];var _iterator7=_createForOfIteratorHelper(t),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _e8=_step7.value;_e8.flatten(_i8);}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}return new e(_i8,s);}var n=Math.max(32,r>>5),h=n<<1,l=n>>1,o=[],u=0,f=-1,a=[];function c(t){var s;if(t.lines>h&&t instanceof i){var _iterator8=_createForOfIteratorHelper(t.children),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _e9=_step8.value;c(_e9);}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}else t.lines>l&&(u>l||!u)?(d(),o.push(t)):t instanceof e&&u&&(s=a[a.length-1])instanceof e&&t.lines+s.lines<=32?(u+=t.lines,f+=t.length+1,a[a.length-1]=new e(s.text.concat(t.text),s.length+1+t.length)):(u+t.lines>n&&d(),u+=t.lines,f+=t.length+1,a.push(t));}function d(){0!=u&&(o.push(1==a.length?a[0]:i.from(a,f)),f=-1,u=a.length=0);}var _iterator9=_createForOfIteratorHelper(t),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _e11=_step9.value;c(_e11);}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}return d(),1==o.length?o[0]:new i(o,s);}}]);}(t);t.empty=new e([""],0);n=/*#__PURE__*/function(){function n(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;_classCallCheck(this,n);this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[i>0?1:(t instanceof e?t.text.length:t.children.length)<<1];}return _createClass(n,[{key:"nextInner",value:function nextInner(t,i){for(this.done=this.lineBreak=!1;;){var _s3=this.nodes.length-1,_r10=this.nodes[_s3],_n12=this.offsets[_s3],_h9=_n12>>1,_l8=_r10 instanceof e?_r10.text.length:_r10.children.length;if(_h9==(i>0?_l8:0)){if(0==_s3)return this.done=!0,this.value="",this;i>0&&this.offsets[_s3-1]++,this.nodes.pop(),this.offsets.pop();}else if((1&_n12)==(i>0?0:1)){if(this.offsets[_s3]+=i,0==t)return this.lineBreak=!0,this.value="\n",this;t--;}else if(_r10 instanceof e){var _e12=_r10.text[_h9+(i<0?-1:0)];if(this.offsets[_s3]+=i,_e12.length>Math.max(0,t))return this.value=0==t?_e12:i>0?_e12.slice(t):_e12.slice(0,_e12.length-t),this;t-=_e12.length;}else{var _n13=_r10.children[_h9+(i<0?-1:0)];t>_n13.length?(t-=_n13.length,this.offsets[_s3]+=i):(i<0&&this.offsets[_s3]--,this.nodes.push(_n13),this.offsets.push(i>0?1:(_n13 instanceof e?_n13.text.length:_n13.children.length)<<1));}}}},{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir);}}]);}();h=/*#__PURE__*/function(){function h(t,e,i){_classCallCheck(this,h);this.value="",this.done=!1,this.cursor=new n(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i);}return _createClass(h,[{key:"nextInner",value:function nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);var i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;var _this$cursor$next=this.cursor.next(t),s=_this$cursor$next.value;return this.pos+=(s.length+t)*e,this.value=s.length<=i?s:e<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this;}},{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir);}},{key:"lineBreak",get:function get(){return this.cursor.lineBreak&&""!=this.value;}}]);}();l=/*#__PURE__*/function(){function l(t){_classCallCheck(this,l);this.inner=t,this.afterBreak=!0,this.value="",this.done=!1;}return _createClass(l,[{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var _this$inner$next=this.inner.next(t),e=_this$inner$next.done,i=_this$inner$next.lineBreak,s=_this$inner$next.value;return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this;}},{key:"lineBreak",get:function get(){return!1;}}]);}();"undefined"!=typeof Symbol&&(t.prototype[Symbol.iterator]=function(){return this.iter();},n.prototype[Symbol.iterator]=h.prototype[Symbol.iterator]=l.prototype[Symbol.iterator]=function(){return this;});o=/*#__PURE__*/function(){function o(t,e,i,s){_classCallCheck(this,o);this.from=t,this.to=e,this.number=i,this.text=s;}return _createClass(o,[{key:"length",get:function get(){return this.to-this.from;}}]);}();f="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(function(t){return t?parseInt(t,36):1;});for(_t18=1;_t18<f.length;_t18++)f[_t18]+=f[_t18-1];d=8205;M=/\r\n?|\n/;_export("M",x=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t;}(x||_export("M",x={})));S=/*#__PURE__*/function(){function S(t){_classCallCheck(this,S);this.sections=t;}return _createClass(S,[{key:"length",get:function get(){var t=0;for(var _e14=0;_e14<this.sections.length;_e14+=2)t+=this.sections[_e14];return t;}},{key:"newLength",get:function get(){var t=0;for(var _e15=0;_e15<this.sections.length;_e15+=2){var _i10=this.sections[_e15+1];t+=_i10<0?this.sections[_e15]:_i10;}return t;}},{key:"empty",get:function get(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0;}},{key:"iterGaps",value:function iterGaps(t){for(var _e16=0,_i11=0,_s6=0;_e16<this.sections.length;){var _r12=this.sections[_e16++],_n14=this.sections[_e16++];_n14<0?(t(_i11,_s6,_r12),_s6+=_r12):_s6+=_n14,_i11+=_r12;}}},{key:"iterChangedRanges",value:function iterChangedRanges(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;D(this,t,e);}},{key:"invertedDesc",get:function get(){var t=[];for(var _e17=0;_e17<this.sections.length;){var _i12=this.sections[_e17++],_s7=this.sections[_e17++];_s7<0?t.push(_i12,_s7):t.push(_s7,_i12);}return new S(t);}},{key:"composeDesc",value:function composeDesc(t){return this.empty?t:t.empty?this:I(this,t);}},{key:"mapDesc",value:function mapDesc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return t.empty?this:E(this,t,e);}},{key:"mapPos",value:function mapPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:x.Simple;var s=0,r=0;for(var _n15=0;_n15<this.sections.length;){var _h10=this.sections[_n15++],_l9=this.sections[_n15++],_o5=s+_h10;if(_l9<0){if(_o5>t)return r+(t-s);r+=_h10;}else{if(i!=x.Simple&&_o5>=t&&(i==x.TrackDel&&s<t&&_o5>t||i==x.TrackBefore&&s<t||i==x.TrackAfter&&_o5>t))return null;if(_o5>t||_o5==t&&e<0&&!_h10)return t==s||e<0?r:r+_l9;r+=_l9;}s=_o5;}if(t>s)throw new RangeError("Position ".concat(t," is out of range for changeset of length ").concat(s));return r;}},{key:"touchesRange",value:function touchesRange(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;for(var _i13=0,_s8=0;_i13<this.sections.length&&_s8<=e;){var _r13=_s8+this.sections[_i13++];if(this.sections[_i13++]>=0&&_s8<=e&&_r13>=t)return!(_s8<t&&_r13>e)||"cover";_s8=_r13;}return!1;}},{key:"toString",value:function toString(){var t="";for(var _e18=0;_e18<this.sections.length;){var _i14=this.sections[_e18++],_s9=this.sections[_e18++];t+=(t?" ":"")+_i14+(_s9>=0?":"+_s9:"");}return t;}},{key:"toJSON",value:function toJSON(){return this.sections;}}],[{key:"fromJSON",value:function fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(function(t){return"number"!=typeof t;}))throw new RangeError("Invalid JSON representation of ChangeDesc");return new S(t);}},{key:"create",value:function create(t){return new S(t);}}]);}();A=/*#__PURE__*/function(_S){function A(t,e){var _this3;_classCallCheck(this,A);_this3=_callSuper(this,A,[t]),_this3.inserted=e;return _this3;}_inherits(A,_S);return _createClass(A,[{key:"apply",value:function apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return D(this,function(e,i,s,r,n){return t=t.replace(s,s+(i-e),n);},!1),t;}},{key:"mapDesc",value:function mapDesc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return E(this,t,e,!0);}},{key:"invert",value:function invert(e){var i=this.sections.slice(),s=[];for(var _r14=0,_n16=0;_r14<i.length;_r14+=2){var _h11=i[_r14],_l10=i[_r14+1];if(_l10>=0){i[_r14]=_l10,i[_r14+1]=_h11;var _o6=_r14>>1;for(;s.length<_o6;)s.push(t.empty);s.push(_h11?e.slice(_n16,_n16+_h11):t.empty);}_n16+=_h11;}return new A(i,s);}},{key:"compose",value:function compose(t){return this.empty?t:t.empty?this:I(this,t,!0);}},{key:"map",value:function map(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return t.empty?this:E(this,t,e,!0);}},{key:"iterChanges",value:function iterChanges(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;D(this,t,e);}},{key:"desc",get:function get(){return S.create(this.sections);}},{key:"filter",value:function filter(t){var e=[],i=[],s=[],r=new R(this);t:for(var _n17=0,_h12=0;;){var _l11=_n17==t.length?1e9:t[_n17++];for(;_h12<_l11||_h12==_l11&&0==r.len;){if(r.done)break t;var _t19=Math.min(r.len,_l11-_h12);C(s,_t19,-1);var _n18=-1==r.ins?-1:0==r.off?r.ins:0;C(e,_t19,_n18),_n18>0&&O(i,e,r.text),r.forward(_t19),_h12+=_t19;}var _o7=t[_n17++];for(;_h12<_o7;){if(r.done)break t;var _t20=Math.min(r.len,_o7-_h12);C(e,_t20,-1),C(s,_t20,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(_t20),_h12+=_t20;}}return{changes:new A(e,i),filtered:S.create(s)};}},{key:"toJSON",value:function toJSON(){var t=[];for(var _e19=0;_e19<this.sections.length;_e19+=2){var _i15=this.sections[_e19],_s10=this.sections[_e19+1];_s10<0?t.push(_i15):0==_s10?t.push([_i15]):t.push([_i15].concat(this.inserted[_e19>>1].toJSON()));}return t;}}],[{key:"of",value:function of(e,i,s){var r=[],n=[],h=0,l=null;function o(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;if(!t&&!r.length)return;h<i&&C(r,i-h,-1);var e=new A(r,n);l=l?l.compose(e.map(l)):e,r=[],n=[],h=0;}return function e(u){if(Array.isArray(u)){var _iterator10=_createForOfIteratorHelper(u),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var _t21=_step10.value;e(_t21);}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}else if(u instanceof A){if(u.length!=i)throw new RangeError("Mismatched change set length (got ".concat(u.length,", expected ").concat(i,")"));o(),l=l?l.compose(u.map(l)):u;}else{var _e20=u.from,_u$to=u.to,_l12=_u$to===void 0?_e20:_u$to,_f2=u.insert;if(_e20>_l12||_e20<0||_l12>i)throw new RangeError("Invalid change range ".concat(_e20," to ").concat(_l12," (in doc of length ").concat(i,")"));var _a2=_f2?"string"==typeof _f2?t.of(_f2.split(s||M)):_f2:t.empty,_c2=_a2.length;if(_e20==_l12&&0==_c2)return;_e20<h&&o(),_e20>h&&C(r,_e20-h,-1),C(r,_l12-_e20,_c2),O(n,r,_a2),h=_l12;}}(e),o(!l),l;}},{key:"empty",value:function empty(t){return new A(t?[t,-1]:[],[]);}},{key:"fromJSON",value:function fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");var i=[],s=[];for(var _r15=0;_r15<e.length;_r15++){var _n19=e[_r15];if("number"==typeof _n19)i.push(_n19,-1);else{if(!Array.isArray(_n19)||"number"!=typeof _n19[0]||_n19.some(function(t,e){return e&&"string"!=typeof t;}))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==_n19.length)i.push(_n19[0],0);else{for(;s.length<_r15;)s.push(t.empty);s[_r15]=t.of(_n19.slice(1)),i.push(_n19[0],s[_r15].length);}}}return new A(i,s);}},{key:"createSet",value:function createSet(t,e){return new A(t,e);}}]);}(S);R=/*#__PURE__*/function(){function R(t){_classCallCheck(this,R);this.set=t,this.i=0,this.next();}return _createClass(R,[{key:"next",value:function next(){var t=this.set.sections;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0;}},{key:"done",get:function get(){return-2==this.ins;}},{key:"len2",get:function get(){return this.ins<0?this.len:this.ins;}},{key:"text",get:function get(){var e=this.set.inserted,i=this.i-2>>1;return i>=e.length?t.empty:e[i];}},{key:"textBit",value:function textBit(e){var i=this.set.inserted,s=this.i-2>>1;return s>=i.length&&!e?t.empty:i[s].slice(this.off,null==e?void 0:this.off+e);}},{key:"forward",value:function forward(t){t==this.len?this.next():(this.len-=t,this.off+=t);}},{key:"forward2",value:function forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t);}}]);}();T=/*#__PURE__*/function(){function T(t,e,i){_classCallCheck(this,T);this.from=t,this.to=e,this.flags=i;}return _createClass(T,[{key:"anchor",get:function get(){return 32&this.flags?this.to:this.from;}},{key:"head",get:function get(){return 32&this.flags?this.from:this.to;}},{key:"empty",get:function get(){return this.from==this.to;}},{key:"assoc",get:function get(){return 8&this.flags?-1:16&this.flags?1:0;}},{key:"bidiLevel",get:function get(){var t=7&this.flags;return 7==t?null:t;}},{key:"goalColumn",get:function get(){var t=this.flags>>6;return 16777215==t?void 0:t;}},{key:"map",value:function map(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;var i,s;return this.empty?i=s=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),s=t.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new T(i,s,this.flags);}},{key:"extend",value:function extend(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(t<=this.anchor&&e>=this.anchor)return B.range(t,e);var i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return B.range(this.anchor,i);}},{key:"eq",value:function eq(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return!(this.anchor!=t.anchor||this.head!=t.head||e&&this.empty&&this.assoc!=t.assoc);}},{key:"toJSON",value:function toJSON(){return{anchor:this.anchor,head:this.head};}}],[{key:"fromJSON",value:function fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return B.range(t.anchor,t.head);}},{key:"create",value:function create(t,e,i){return new T(t,e,i);}}]);}();_export("m",B=/*#__PURE__*/function(){function B(t,e){_classCallCheck(this,B);this.ranges=t,this.mainIndex=e;}return _createClass(B,[{key:"map",value:function map(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;return t.empty?this:B.create(this.ranges.map(function(i){return i.map(t,e);}),this.mainIndex);}},{key:"eq",value:function eq(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(var _i20=0;_i20<this.ranges.length;_i20++)if(!this.ranges[_i20].eq(t.ranges[_i20],e))return!1;return!0;}},{key:"main",get:function get(){return this.ranges[this.mainIndex];}},{key:"asSingle",value:function asSingle(){return 1==this.ranges.length?this:new B([this.main],0);}},{key:"addRange",value:function addRange(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;return B.create([t].concat(this.ranges),e?0:this.mainIndex+1);}},{key:"replaceRange",value:function replaceRange(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.mainIndex;var i=this.ranges.slice();return i[e]=t,B.create(i,this.mainIndex);}},{key:"toJSON",value:function toJSON(){return{ranges:this.ranges.map(function(t){return t.toJSON();}),main:this.mainIndex};}}],[{key:"fromJSON",value:function fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new B(t.ranges.map(function(t){return T.fromJSON(t);}),t.main);}},{key:"single",value:function single(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;return new B([B.range(t,e)],0);}},{key:"create",value:function create(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(0==t.length)throw new RangeError("A selection needs at least one range");for(var _i21=0,_s11=0;_s11<t.length;_s11++){var _r16=t[_s11];if(_r16.empty?_r16.from<=_i21:_r16.from<_i21)return B.normalized(t.slice(),e);_i21=_r16.to;}return new B(t,e);}},{key:"cursor",value:function cursor(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2?arguments[2]:undefined;var s=arguments.length>3?arguments[3]:undefined;return T.create(t,t,(0==e?0:e<0?8:16)|(null==i?7:Math.min(6,i))|(null!=s?s:16777215)<<6);}},{key:"range",value:function range(t,e,i,s){var r=(null!=i?i:16777215)<<6|(null==s?7:Math.min(6,s));return e<t?T.create(e,t,48|r):T.create(t,e,(e>t?8:0)|r);}},{key:"normalized",value:function normalized(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=t[e];t.sort(function(t,e){return t.from-e.from;}),e=t.indexOf(i);for(var _i22=1;_i22<t.length;_i22++){var _s12=t[_i22],_r17=t[_i22-1];if(_s12.empty?_s12.from<=_r17.to:_s12.from<_r17.to){var _n21=_r17.from,_h14=Math.max(_s12.to,_r17.to);_i22<=e&&e--,t.splice(--_i22,2,_s12.anchor>_s12.head?B.range(_h14,_n21):B.range(_n21,_h14));}}return new B(t,e);}}]);}());N=0;_export("F",j=/*#__PURE__*/function(){function j(t,e,i,s,r){_classCallCheck(this,j);this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=s,this.id=N++,this["default"]=t([]),this.extensions="function"==typeof r?r(this):r;}return _createClass(j,[{key:"reader",get:function get(){return this;}},{key:"of",value:function of(t){return new z([],this,0,t);}},{key:"compute",value:function compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new z(t,this,1,e);}},{key:"computeN",value:function computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new z(t,this,2,e);}},{key:"from",value:function from(t,e){return e||(e=function e(t){return t;}),this.compute([t],function(i){return e(i.field(t));});}}],[{key:"define",value:function define(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new j(t.combine||function(t){return t;},t.compareInput||function(t,e){return t===e;},t.compare||(t.combine?function(t,e){return t===e;}:$),!!t["static"],t.enables);}}]);}());z=/*#__PURE__*/function(){function z(t,e,i,s){_classCallCheck(this,z);this.dependencies=t,this.facet=e,this.type=i,this.value=s,this.id=N++;}return _createClass(z,[{key:"dynamicSlot",value:function dynamicSlot(t){var _this4=this;var e;var i=this.value,s=this.facet.compareInput,r=this.id,n=t[r]>>1,h=2==this.type,l=!1,o=!1,u=[];var _iterator12=_createForOfIteratorHelper(this.dependencies),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var _i24=_step12.value;"doc"==_i24?l=!0:"selection"==_i24?o=!0:1&(null!==(e=t[_i24.id])&&void 0!==e?e:1)||u.push(t[_i24.id]);}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}return{create:function create(t){return t.values[n]=i(t),1;},update:function update(t,e){if(l&&e.docChanged||o&&(e.docChanged||e.selection)||H(t,u)){var _e24=i(t);if(h?!P(_e24,t.values[n],s):!s(_e24,t.values[n]))return t.values[n]=_e24,1;}return 0;},reconfigure:function reconfigure(t,e){var l,o=e.config.address[r];if(null!=o){var _r18=et(e,o);if(_this4.dependencies.every(function(i){return i instanceof j?e.facet(i)===t.facet(i):!(i instanceof F)||e.field(i,!1)==t.field(i,!1);})||(h?P(l=i(t),_r18,s):s(l=i(t),_r18)))return t.values[n]=_r18,0;}else l=i(t);return t.values[n]=l,1;}};}}]);}();V=j.define({"static":!0});_export("S",F=/*#__PURE__*/function(){function F(t,e,i,s,r){_classCallCheck(this,F);this.id=t,this.createF=e,this.updateF=i,this.compareF=s,this.spec=r,this.provides=void 0;}return _createClass(F,[{key:"create",value:function create(t){var _this5=this;var e=t.facet(V).find(function(t){return t.field==_this5;});return((null==e?void 0:e.create)||this.createF)(t);}},{key:"slot",value:function slot(t){var _this6=this;var e=t[this.id]>>1;return{create:function create(t){return t.values[e]=_this6.create(t),1;},update:function update(t,i){var s=t.values[e],r=_this6.updateF(s,i);return _this6.compareF(s,r)?0:(t.values[e]=r,1);},reconfigure:function reconfigure(t,i){return null!=i.config.address[_this6.id]?(t.values[e]=i.field(_this6),0):(t.values[e]=_this6.create(t),1);}};}},{key:"init",value:function init(t){return[this,V.of({field:this,create:t})];}},{key:"extension",get:function get(){return this;}}],[{key:"define",value:function define(t){var e=new F(N++,t.create,t.update,t.compare||function(t,e){return t===e;},t);return t.provide&&(e.provides=t.provide(e)),e;}}]);}());q=4;U=3;J=2;G=1;_export("C",_={highest:K(0),high:K(G),"default":K(J),low:K(U),lowest:K(q)});X=/*#__PURE__*/_createClass(function X(t,e){_classCallCheck(this,X);this.inner=t,this.prec=e;});_export("J",Y=/*#__PURE__*/function(){function Y(){_classCallCheck(this,Y);}return _createClass(Y,[{key:"of",value:function of(t){return new Q(this,t);}},{key:"reconfigure",value:function reconfigure(t){return Y.reconfigure.of({compartment:this,extension:t});}},{key:"get",value:function get(t){return t.config.compartments.get(this);}}]);}());Q=/*#__PURE__*/_createClass(function Q(t,e){_classCallCheck(this,Q);this.compartment=t,this.inner=e;});Z=/*#__PURE__*/function(){function Z(t,e,i,s,r,n){_classCallCheck(this,Z);for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=n,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0);}return _createClass(Z,[{key:"staticFacet",value:function staticFacet(t){var e=this.address[t.id];return null==e?t["default"]:this.staticValues[e>>1];}}],[{key:"resolve",value:function resolve(t,e,i){var s=[],r=Object.create(null),n=new Map();var _iterator16=_createForOfIteratorHelper(function(t,e,i){var s=[[],[],[],[],[]],r=new Map();function n(t,h){var l=r.get(t);if(null!=l){if(l<=h)return;var _e27=s[l].indexOf(t);_e27>-1&&s[l].splice(_e27,1),t instanceof Q&&i["delete"](t.compartment);}if(r.set(t,h),Array.isArray(t)){var _iterator17=_createForOfIteratorHelper(t),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var _e28=_step17.value;n(_e28,h);}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}}else if(t instanceof Q){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");var _s16=e.get(t.compartment)||t.inner;i.set(t.compartment,_s16),n(_s16,h);}else if(t instanceof X)n(t.inner,t.prec);else if(t instanceof F)s[h].push(t),t.provides&&n(t.provides,h);else if(t instanceof z)s[h].push(t),t.facet.extensions&&n(t.facet.extensions,J);else{var _e29=t.extension;if(!_e29)throw new Error("Unrecognized extension value in extension set (".concat(t,"). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks."));n(_e29,h);}}return n(t,J),s.reduce(function(t,e){return t.concat(e);});}(t,e,n)),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var _i26=_step16.value;_i26 instanceof F?s.push(_i26):(r[_i26.facet.id]||(r[_i26.facet.id]=[])).push(_i26);}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}var h=Object.create(null),l=[],o=[];var _loop=function _loop(){var t=_s15[_i25];h[t.id]=o.length<<1,o.push(function(e){return t.slot(e);});};for(var _i25=0,_s15=s;_i25<_s15.length;_i25++){_loop();}var u=null==i?void 0:i.config.facets;var _loop2=function _loop2(){var e=r[_t27],s=e[0].facet,n=u&&u[_t27]||[];if(e.every(function(t){return 0==t.type;})){if(h[s.id]=l.length<<1|1,$(n,e))l.push(i.facet(s));else{var _t28=s.combine(e.map(function(t){return t.value;}));l.push(i&&s.compare(_t28,i.facet(s))?i.facet(s):_t28);}}else{var _iterator18=_createForOfIteratorHelper(e),_step18;try{var _loop3=function _loop3(){var t=_step18.value;0==t.type?(h[t.id]=l.length<<1|1,l.push(t.value)):(h[t.id]=o.length<<1,o.push(function(e){return t.dynamicSlot(e);}));};for(_iterator18.s();!(_step18=_iterator18.n()).done;){_loop3();}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}h[s.id]=o.length<<1,o.push(function(t){return W(t,s,e);});}};for(var _t27 in r){_loop2();}var f=o.map(function(t){return t(h);});return new Z(t,n,f,h,l,r);}}]);}();it=j.define();st=j.define({combine:function combine(t){return t.some(function(t){return t;});},"static":!0});rt=j.define({combine:function combine(t){return t.length?t[0]:void 0;},"static":!0});nt=j.define();ht=j.define();lt=j.define();ot=j.define({combine:function combine(t){return!!t.length&&t[0];}});_export("H",ut=/*#__PURE__*/function(){function ut(t,e){_classCallCheck(this,ut);this.type=t,this.value=e;}return _createClass(ut,null,[{key:"define",value:function define(){return new ft();}}]);}());ft=/*#__PURE__*/function(){function ft(){_classCallCheck(this,ft);}return _createClass(ft,[{key:"of",value:function of(t){return new ut(this,t);}}]);}();at=/*#__PURE__*/function(){function at(t){_classCallCheck(this,at);this.map=t;}return _createClass(at,[{key:"of",value:function of(t){return new ct(this,t);}}]);}();_export("x",ct=/*#__PURE__*/function(){function ct(t,e){_classCallCheck(this,ct);this.type=t,this.value=e;}return _createClass(ct,[{key:"map",value:function map(t){var e=this.type.map(this.value,t);return void 0===e?void 0:e==this.value?this:new ct(this.type,e);}},{key:"is",value:function is(t){return this.type==t;}}],[{key:"define",value:function define(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new at(t.map||function(t){return t;});}},{key:"mapEffects",value:function mapEffects(t,e){if(!t.length)return t;var i=[];var _iterator19=_createForOfIteratorHelper(t),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var _s17=_step19.value;var _t29=_s17.map(e);_t29&&i.push(_t29);}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}return i;}}]);}());ct.reconfigure=ct.define(),ct.appendConfig=ct.define();_export("B",dt=/*#__PURE__*/function(){function dt(t,e,i,s,r,n){_classCallCheck(this,dt);this.startState=t,this.changes=e,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=n,this._doc=null,this._state=null,i&&L(i,e.newLength),r.some(function(t){return t.type==dt.time;})||(this.annotations=r.concat(dt.time.of(Date.now())));}return _createClass(dt,[{key:"newDoc",get:function get(){return this._doc||(this._doc=this.changes.apply(this.startState.doc));}},{key:"newSelection",get:function get(){return this.selection||this.startState.selection.map(this.changes);}},{key:"state",get:function get(){return this._state||this.startState.applyTransaction(this),this._state;}},{key:"annotation",value:function annotation(t){var _iterator20=_createForOfIteratorHelper(this.annotations),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var _e30=_step20.value;if(_e30.type==t)return _e30.value;}}catch(err){_iterator20.e(err);}finally{_iterator20.f();}}},{key:"docChanged",get:function get(){return!this.changes.empty;}},{key:"reconfigured",get:function get(){return this.startState.config!=this.state.config;}},{key:"isUserEvent",value:function isUserEvent(t){var e=this.annotation(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]));}}],[{key:"create",value:function create(t,e,i,s,r,n){return new dt(t,e,i,s,r,n);}}]);}());dt.time=ut.define(),dt.userEvent=ut.define(),dt.addToHistory=ut.define(),dt.remote=ut.define();bt=[];kt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t;}(kt||(kt={}));yt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{Mt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u");}catch(t){}_export("w",St=/*#__PURE__*/function(){function St(t,e,i,s,r,n){_classCallCheck(this,St);this.config=t,this.doc=e,this.selection=i,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=r,n&&(n._state=this);for(var _t30=0;_t30<this.config.dynamicSlots.length;_t30++)tt(this,_t30<<1);this.computeSlot=null;}return _createClass(St,[{key:"field",value:function field(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var i=this.config.address[t.id];if(null!=i)return tt(this,i),et(this,i);if(e)throw new RangeError("Field is not present in this state");}},{key:"update",value:function update(){for(var _len=arguments.length,t=new Array(_len),_key=0;_key<_len;_key++){t[_key]=arguments[_key];}return wt(this,t,!0);}},{key:"applyTransaction",value:function applyTransaction(t){var _this7=this;var e,i=this.config,_i30=i,s=_i30.base,r=_i30.compartments;var _iterator22=_createForOfIteratorHelper(t.effects),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var _e34=_step22.value;_e34.is(Y.reconfigure)?(i&&(r=new Map(),i.compartments.forEach(function(t,e){return r.set(e,t);}),i=null),r.set(_e34.value.compartment,_e34.value.extension)):_e34.is(ct.reconfigure)?(i=null,s=_e34.value):_e34.is(ct.appendConfig)&&(i=null,s=vt(s).concat(_e34.value));}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}if(i)e=t.startState.values.slice();else{i=Z.resolve(s,r,this),e=new St(i,this.doc,this.selection,i.dynamicSlots.map(function(){return null;}),function(t,e){return e.reconfigure(t,_this7);},null).values;}var n=t.startState.facet(st)?t.newSelection:t.newSelection.asSingle();new St(i,t.newDoc,n,e,function(e,i){return i.update(e,t);},t);}},{key:"replaceSelection",value:function replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange(function(e){return{changes:{from:e.from,to:e.to,insert:t},range:B.cursor(e.from+t.length)};});}},{key:"changeByRange",value:function changeByRange(t){var e=this.selection,i=t(e.ranges[0]),s=this.changes(i.changes),r=[i.range],n=vt(i.effects);for(var _i31=1;_i31<e.ranges.length;_i31++){var _h16=t(e.ranges[_i31]),_l14=this.changes(_h16.changes),_o9=_l14.map(s);for(var _t31=0;_t31<_i31;_t31++)r[_t31]=r[_t31].map(_o9);var _u16=s.mapDesc(_l14,!0);r.push(_h16.range.map(_u16)),s=s.compose(_o9),n=ct.mapEffects(n,_o9).concat(ct.mapEffects(vt(_h16.effects),_u16));}return{changes:s,selection:B.create(r,e.mainIndex),effects:n};}},{key:"changes",value:function changes(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];return t instanceof A?t:A.of(t,this.doc.length,this.facet(St.lineSeparator));}},{key:"toText",value:function toText(e){return t.of(e.split(this.facet(St.lineSeparator)||M));}},{key:"sliceDoc",value:function sliceDoc(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.doc.length;return this.doc.sliceString(t,e,this.lineBreak);}},{key:"facet",value:function facet(t){var e=this.config.address[t.id];return null==e?t["default"]:(tt(this,e),et(this,e));}},{key:"toJSON",value:function toJSON(t){var e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(var _i32 in t){var _s21=t[_i32];_s21 instanceof F&&null!=this.config.address[_s21.id]&&(e[_i32]=_s21.spec.toJSON(this.field(t[_i32]),this));}return e;}},{key:"tabSize",get:function get(){return this.facet(St.tabSize);}},{key:"lineBreak",get:function get(){return this.facet(St.lineSeparator)||"\n";}},{key:"readOnly",get:function get(){return this.facet(ot);}},{key:"phrase",value:function phrase(t){for(var _len2=arguments.length,e=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){e[_key2-1]=arguments[_key2];}var _iterator23=_createForOfIteratorHelper(this.facet(St.phrases)),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var _e35=_step23.value;if(Object.prototype.hasOwnProperty.call(_e35,t)){t=_e35[t];break;}}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}return e.length&&(t=t.replace(/\$(\$|\d*)/g,function(t,i){if("$"==i)return"$";var s=+(i||1);return!s||s>e.length?t:e[s-1];})),t;}},{key:"languageDataAt",value:function languageDataAt(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;var s=[];var _iterator24=_createForOfIteratorHelper(this.facet(it)),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var _r24=_step24.value;var _iterator25=_createForOfIteratorHelper(_r24(this,e,i)),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _n26=_step25.value;Object.prototype.hasOwnProperty.call(_n26,t)&&s.push(_n26[t]);}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}return s;}},{key:"charCategorizer",value:function charCategorizer(t){return xt(this.languageDataAt("wordChars",t).join(""));}},{key:"wordAt",value:function wordAt(t){var _this$doc$lineAt=this.doc.lineAt(t),e=_this$doc$lineAt.text,i=_this$doc$lineAt.from,s=_this$doc$lineAt.length,r=this.charCategorizer(t),n=t-i,h=t-i;for(;n>0;){var _t32=p(e,n,!1);if(r(e.slice(_t32,n))!=kt.Word)break;n=_t32;}for(;h<s;){var _t33=p(e,h);if(r(e.slice(h,_t33))!=kt.Word)break;h=_t33;}return n==h?null:B.range(n+i,h+i);}}],[{key:"fromJSON",value:function fromJSON(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var i=arguments.length>2?arguments[2]:undefined;if(!t||"string"!=typeof t.doc)throw new RangeError("Invalid JSON representation for EditorState");var s=[];if(i){var _loop4=function _loop4(){if(Object.prototype.hasOwnProperty.call(t,_e36)){var _r25=i[_e36],_n27=t[_e36];s.push(_r25.init(function(t){return _r25.spec.fromJSON(_n27,t);}));}};for(var _e36 in i){_loop4();}}return St.create({doc:t.doc,selection:B.fromJSON(t.selection),extensions:e.extensions?s.concat([e.extensions]):s});}},{key:"create",value:function create(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var i=Z.resolve(e.extensions||[],new Map()),s=e.doc instanceof t?e.doc:t.of((e.doc||"").split(i.staticFacet(St.lineSeparator)||M)),r=e.selection?e.selection instanceof B?e.selection:B.single(e.selection.anchor,e.selection.head):B.single(0);return L(r,s.length),i.staticFacet(st)||(r=r.asSingle()),new St(i,s,r,i.dynamicSlots.map(function(){return null;}),function(t,e){return e.create(t);},null);}}]);}());St.allowMultipleSelections=st,St.tabSize=j.define({combine:function combine(t){return t.length?t[0]:4;}}),St.lineSeparator=rt,St.readOnly=ot,St.phrases=j.define({compare:function compare(t,e){var i=Object.keys(t),s=Object.keys(e);return i.length==s.length&&i.every(function(i){return t[i]==e[i];});}}),St.languageData=it,St.changeFilter=nt,St.transactionFilter=ht,St.transactionExtender=lt,Y.reconfigure=ct.define();_export("R",Ct=/*#__PURE__*/function(){function Ct(){_classCallCheck(this,Ct);}return _createClass(Ct,[{key:"eq",value:function eq(t){return this==t;}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;return Ot.create(t,e,this);}}]);}());Ct.prototype.startSide=Ct.prototype.endSide=0,Ct.prototype.point=!1,Ct.prototype.mapMode=x.TrackDel;Ot=/*#__PURE__*/function(){function t(_t36,e,i){_classCallCheck(this,t);this.from=_t36,this.to=e,this.value=i;}return _createClass(t,null,[{key:"create",value:function create(e,i,s){return new t(e,i,s);}}]);}();Et=/*#__PURE__*/function(){function Et(t,e,i,s){_classCallCheck(this,Et);this.from=t,this.to=e,this.value=i,this.maxPoint=s;}return _createClass(Et,[{key:"length",get:function get(){return this.to[this.to.length-1];}},{key:"findIndex",value:function findIndex(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=i?this.to:this.from;for(var _n29=s,_h17=r.length;;){if(_n29==_h17)return _n29;var _s22=_n29+_h17>>1,_l15=r[_s22]-t||(i?this.value[_s22].endSide:this.value[_s22].startSide)-e;if(_s22==_n29)return _l15>=0?_n29:_h17;_l15>=0?_h17=_s22:_n29=_s22+1;}}},{key:"between",value:function between(t,e,i,s){for(var _r27=this.findIndex(e,-1e9,!0),_n30=this.findIndex(i,1e9,!1,_r27);_r27<_n30;_r27++)if(!1===s(this.from[_r27]+t,this.to[_r27]+t,this.value[_r27]))return!1;}},{key:"map",value:function map(t,e){var i=[],s=[],r=[],n=-1,h=-1;for(var _l16=0;_l16<this.value.length;_l16++){var _o10=void 0,_u17=void 0,_f4=this.value[_l16],_a4=this.from[_l16]+t,_c4=this.to[_l16]+t;if(_a4==_c4){var _t37=e.mapPos(_a4,_f4.startSide,_f4.mapMode);if(null==_t37)continue;if(_o10=_u17=_t37,_f4.startSide!=_f4.endSide&&(_u17=e.mapPos(_a4,_f4.endSide),_u17<_o10))continue;}else if(_o10=e.mapPos(_a4,_f4.startSide),_u17=e.mapPos(_c4,_f4.endSide),_o10>_u17||_o10==_u17&&_f4.startSide>0&&_f4.endSide<=0)continue;(_u17-_o10||_f4.endSide-_f4.startSide)<0||(n<0&&(n=_o10),_f4.point&&(h=Math.max(h,_u17-_o10)),i.push(_f4),s.push(_o10-n),r.push(_u17-n));}return{mapped:i.length?new Et(s,r,i,h):null,pos:n};}}]);}();It=/*#__PURE__*/function(){function It(t,e,i,s){_classCallCheck(this,It);this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=s;}return _createClass(It,[{key:"length",get:function get(){var t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length);}},{key:"size",get:function get(){if(this.isEmpty)return 0;var t=this.nextLayer.size;var _iterator27=_createForOfIteratorHelper(this.chunk),_step27;try{for(_iterator27.s();!(_step27=_iterator27.n()).done;){var _e38=_step27.value;t+=_e38.value.length;}}catch(err){_iterator27.e(err);}finally{_iterator27.f();}return t;}},{key:"chunkEnd",value:function chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length;}},{key:"update",value:function update(t){var _t$add=t.add,e=_t$add===void 0?[]:_t$add,_t$sort=t.sort,i=_t$sort===void 0?!1:_t$sort,_t$filterFrom=t.filterFrom,s=_t$filterFrom===void 0?0:_t$filterFrom,_t$filterTo=t.filterTo,r=_t$filterTo===void 0?this.length:_t$filterTo,n=t.filter;if(0==e.length&&!n)return this;if(i&&(e=e.slice().sort(Dt)),this.isEmpty)return e.length?It.of(e):this;var h=new Bt(this,null,-1)["goto"](0),l=0,o=[],u=new Rt();for(;h.value||l<e.length;)if(l<e.length&&(h.from-e[l].from||h.startSide-e[l].value.startSide)>=0){var _t38=e[l++];u.addInner(_t38.from,_t38.to,_t38.value)||o.push(_t38);}else 1==h.rangeIndex&&h.chunkIndex<this.chunk.length&&(l==e.length||this.chunkEnd(h.chunkIndex)<e[l].from)&&(!n||s>this.chunkEnd(h.chunkIndex)||r<this.chunkPos[h.chunkIndex])&&u.addChunk(this.chunkPos[h.chunkIndex],this.chunk[h.chunkIndex])?h.nextChunk():((!n||s>h.to||r<h.from||n(h.from,h.to,h.value))&&(u.addInner(h.from,h.to,h.value)||o.push(Ot.create(h.from,h.to,h.value))),h.next());return u.finishInner(this.nextLayer.isEmpty&&!o.length?It.empty:this.nextLayer.update({add:o,filter:n,filterFrom:s,filterTo:r}));}},{key:"map",value:function map(t){if(t.empty||this.isEmpty)return this;var e=[],i=[],s=-1;for(var _r28=0;_r28<this.chunk.length;_r28++){var _n31=this.chunkPos[_r28],_h18=this.chunk[_r28],_l17=t.touchesRange(_n31,_n31+_h18.length);if(!1===_l17)s=Math.max(s,_h18.maxPoint),e.push(_h18),i.push(t.mapPos(_n31));else if(!0===_l17){var _h18$map=_h18.map(_n31,t),_r29=_h18$map.mapped,_l18=_h18$map.pos;_r29&&(s=Math.max(s,_r29.maxPoint),e.push(_r29),i.push(_l18));}}var r=this.nextLayer.map(t);return 0==e.length?r:new It(i,e,r||It.empty,s);}},{key:"between",value:function between(t,e,i){if(!this.isEmpty){for(var _s23=0;_s23<this.chunk.length;_s23++){var _r30=this.chunkPos[_s23],_n32=this.chunk[_s23];if(e>=_r30&&t<=_r30+_n32.length&&!1===_n32.between(_r30,t-_r30,e-_r30,i))return;}this.nextLayer.between(t,e,i);}}},{key:"iter",value:function iter(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return Lt.from([this])["goto"](t);}},{key:"isEmpty",get:function get(){return this.nextLayer==this;}}],[{key:"create",value:function create(t,e,i,s){return new It(t,e,i,s);}},{key:"iter",value:function iter(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Lt.from(t)["goto"](e);}},{key:"compare",value:function compare(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:-1;var n=t.filter(function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r;}),h=e.filter(function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r;}),l=Tt(n,h,i),o=new jt(n,l,r),u=new jt(h,l,r);i.iterGaps(function(t,e,i){return $t(o,t,u,e,i,s);}),i.empty&&0==i.length&&$t(o,0,u,0,0,s);}},{key:"eq",value:function eq(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3?arguments[3]:undefined;null==s&&(s=999999999);var r=t.filter(function(t){return!t.isEmpty&&e.indexOf(t)<0;}),n=e.filter(function(e){return!e.isEmpty&&t.indexOf(e)<0;});if(r.length!=n.length)return!1;if(!r.length)return!0;var h=Tt(r,n),l=new jt(r,h,0)["goto"](i),o=new jt(n,h,0)["goto"](i);for(;;){if(l.to!=o.to||!zt(l.active,o.active)||l.point&&(!o.point||!l.point.eq(o.point)))return!1;if(l.to>s)return!0;l.next(),o.next();}}},{key:"spans",value:function spans(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:-1;var n=new jt(t,null,r)["goto"](e),h=e,l=n.openStart;for(;;){var _t39=Math.min(n.to,i);if(n.point){var _i34=n.activeForPoint(n.to),_r31=n.pointFrom<e?_i34.length+1:n.point.startSide<0?_i34.length:Math.min(_i34.length,l);s.point(h,_t39,n.point,_i34,_r31,n.pointRank),l=Math.min(n.openEnd(_t39),_i34.length);}else _t39>h&&(s.span(h,_t39,n.active,l),l=n.openEnd(_t39));if(n.to>i)return l+(n.point&&n.to>i?1:0);h=n.to,n.next();}}},{key:"of",value:function of(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;var i=new Rt();var _iterator28=_createForOfIteratorHelper(t instanceof Ot?[t]:e?function(t){if(t.length>1)for(var _e39=t[0],_i35=1;_i35<t.length;_i35++){var _s24=t[_i35];if(Dt(_e39,_s24)>0)return t.slice().sort(Dt);_e39=_s24;}return t;}(t):t),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var _s25=_step28.value;i.add(_s25.from,_s25.to,_s25.value);}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}return i.finish();}},{key:"join",value:function join(t){if(!t.length)return It.empty;var e=t[t.length-1];for(var _i36=t.length-2;_i36>=0;_i36--)for(var _s26=t[_i36];_s26!=It.empty;_s26=_s26.nextLayer)e=new It(_s26.chunkPos,_s26.chunk,e,Math.max(_s26.maxPoint,e.maxPoint));return e;}}]);}();It.empty=new It([],[],null,-1),It.empty.nextLayer=It.empty;Rt=/*#__PURE__*/function(){function Rt(){_classCallCheck(this,Rt);this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null;}return _createClass(Rt,[{key:"finishChunk",value:function finishChunk(t){this.chunks.push(new Et(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[]);}},{key:"add",value:function add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Rt())).add(t,e,i);}},{key:"addInner",value:function addInner(t,e,i){var s=t-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(s<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0);}},{key:"addChunk",value:function addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);var i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0;}},{key:"finish",value:function finish(){return this.finishInner(It.empty);}},{key:"finishInner",value:function finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;var e=It.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e;}}]);}();Bt=/*#__PURE__*/function(){function Bt(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;_classCallCheck(this,Bt);this.layer=t,this.skip=e,this.minPoint=i,this.rank=s;}return _createClass(Bt,[{key:"startSide",get:function get(){return this.value?this.value.startSide:0;}},{key:"endSide",get:function get(){return this.value?this.value.endSide:0;}},{key:"goto",value:function goto(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this;}},{key:"gotoInner",value:function gotoInner(t,e,i){for(;this.chunkIndex<this.layer.chunk.length;){var _e42=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(_e42)||this.layer.chunkEnd(this.chunkIndex)<t||_e42.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1;}if(this.chunkIndex<this.layer.chunk.length){var _s27=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!i||this.rangeIndex<_s27)&&this.setRangeIndex(_s27);}this.next();}},{key:"forward",value:function forward(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0);}},{key:"next",value:function next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break;}{var _t42=this.layer.chunkPos[this.chunkIndex],_e43=this.layer.chunk[this.chunkIndex],_i37=_t42+_e43.from[this.rangeIndex];if(this.from=_i37,this.to=_t42+_e43.to[this.rangeIndex],this.value=_e43.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break;}}}},{key:"setRangeIndex",value:function setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0;}else this.rangeIndex=t;}},{key:"nextChunk",value:function nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next();}},{key:"compare",value:function compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide;}}]);}();Lt=/*#__PURE__*/function(){function Lt(t){_classCallCheck(this,Lt);this.heap=t;}return _createClass(Lt,[{key:"startSide",get:function get(){return this.value?this.value.startSide:0;}},{key:"goto",value:function goto(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1e9;var _iterator31=_createForOfIteratorHelper(this.heap),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var _i38=_step31.value;_i38["goto"](t,e);}}catch(err){_iterator31.e(err);}finally{_iterator31.f();}for(var _t43=this.heap.length>>1;_t43>=0;_t43--)Nt(this.heap,_t43);return this.next(),this;}},{key:"forward",value:function forward(t,e){var _iterator32=_createForOfIteratorHelper(this.heap),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var _i39=_step32.value;_i39.forward(t,e);}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}for(var _t44=this.heap.length>>1;_t44>=0;_t44--)Nt(this.heap,_t44);(this.to-t||this.value.endSide-e)<0&&this.next();}},{key:"next",value:function next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var _t45=this.heap[0];this.from=_t45.from,this.to=_t45.to,this.value=_t45.value,this.rank=_t45.rank,_t45.value&&_t45.next(),Nt(this.heap,0);}}}],[{key:"from",value:function from(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;var s=[];for(var _r32=0;_r32<t.length;_r32++)for(var _n34=t[_r32];!_n34.isEmpty;_n34=_n34.nextLayer)_n34.maxPoint>=i&&s.push(new Bt(_n34,e,i,_r32));return 1==s.length?s[0]:new Lt(s);}}]);}();jt=/*#__PURE__*/function(){function jt(t,e,i){_classCallCheck(this,jt);this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Lt.from(t,e,i);}return _createClass(jt,[{key:"goto",value:function goto(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1e9;return this.cursor["goto"](t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this;}},{key:"forward",value:function forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e);}},{key:"removeActive",value:function removeActive(t){Pt(this.active,t),Pt(this.activeTo,t),Pt(this.activeRank,t),this.minActive=Wt(this.active,this.activeTo);}},{key:"addActive",value:function addActive(t){var e=0,_this$cursor=this.cursor,i=_this$cursor.value,s=_this$cursor.to,r=_this$cursor.rank;for(;e<this.activeRank.length&&(r-this.activeRank[e]||s-this.activeTo[e])>0;)e++;Ht(this.active,e,i),Ht(this.activeTo,e,s),Ht(this.activeRank,e,r),t&&Ht(t,e,this.cursor.from),this.minActive=Wt(this.active,this.activeTo);}},{key:"next",value:function next(){var t=this.to,e=this.point;this.point=null;var i=this.openStart<0?[]:null;for(;;){var _s29=this.minActive;if(_s29>-1&&(this.activeTo[_s29]-this.cursor.from||this.active[_s29].endSide-this.cursor.startSide)<0){if(this.activeTo[_s29]>t){this.to=this.activeTo[_s29],this.endSide=this.active[_s29].endSide;break;}this.removeActive(_s29),i&&Pt(i,_s29);}else{if(!this.cursor.value){this.to=this.endSide=1e9;break;}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break;}{var _t46=this.cursor.value;if(_t46.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=_t46,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=_t46.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break;}this.cursor.next();}else this.addActive(i),this.cursor.next();}}}if(i){this.openStart=0;for(var _e44=i.length-1;_e44>=0&&i[_e44]<t;_e44--)this.openStart++;}}},{key:"activeForPoint",value:function activeForPoint(t){if(!this.active.length)return this.active;var e=[];for(var _i41=this.active.length-1;_i41>=0&&!(this.activeRank[_i41]<this.pointRank);_i41--)(this.activeTo[_i41]>t||this.activeTo[_i41]==t&&this.active[_i41].endSide>=this.point.endSide)&&e.push(this.active[_i41]);return e.reverse();}},{key:"openEnd",value:function openEnd(t){var e=0;for(var _i42=this.activeTo.length-1;_i42>=0&&this.activeTo[_i42]>t;_i42--)e++;return e;}}]);}();qt="undefined"==typeof Symbol?"__ͼ":Symbol["for"]("ͼ");Ut="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet");Jt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};Gt=/*#__PURE__*/function(){function Gt(t,e){_classCallCheck(this,Gt);this.rules=[];var _ref3=e||{},i=_ref3.finish;function s(t){return /^@/.test(t)?[t]:t.split(/,\s*/);}function r(t,e,n,h){var l=[],o=/^@(\w+)\b/.exec(t[0]),u=o&&"keyframes"==o[1];if(o&&null==e)return n.push(t[0]+";");for(var _i46 in e){var _h19=e[_i46];if(/&/.test(_i46))r(_i46.split(/,\s*/).map(function(e){return t.map(function(t){return e.replace(/&/,t);});}).reduce(function(t,e){return t.concat(e);}),_h19,n);else if(_h19&&"object"==_typeof(_h19)){if(!o)throw new RangeError("The value of a property ("+_i46+") should be a primitive value.");r(s(_i46),_h19,l,u);}else null!=_h19&&l.push(_i46.replace(/_.*/,"").replace(/[A-Z]/g,function(t){return"-"+t.toLowerCase();})+": "+_h19+";");}(l.length||u)&&n.push((!i||o||h?t:t.map(i)).join(", ")+" {"+l.join(" ")+"}");}for(var _e46 in t)r(s(_e46),t[_e46],this.rules);}return _createClass(Gt,[{key:"getRules",value:function getRules(){return this.rules.join("\n");}}],[{key:"newName",value:function newName(){var t=Jt[qt]||1;return Jt[qt]=t+1,"ͼ"+t.toString(36);}},{key:"mount",value:function mount(t,e,i){var s=t[Ut],r=i&&i.nonce;s?r&&s.setNonce(r):s=new _t(t,r),s.mount(Array.isArray(e)?e:[e],t);}}]);}();Kt=new Map();_t=/*#__PURE__*/function(){function _t(t,e){_classCallCheck(this,_t);var i=t.ownerDocument||t,s=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){var _e47=Kt.get(i);if(_e47)return t[Ut]=_e47;this.sheet=new s.CSSStyleSheet(),Kt.set(i,this);}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[Ut]=this;}return _createClass(_t,[{key:"mount",value:function mount(t,e){var i=this.sheet,s=0,r=0;for(var _e48=0;_e48<t.length;_e48++){var _n35=t[_e48],_h20=this.modules.indexOf(_n35);if(_h20<r&&_h20>-1&&(this.modules.splice(_h20,1),r--,_h20=-1),-1==_h20){if(this.modules.splice(r++,0,_n35),i)for(var _t47=0;_t47<_n35.rules.length;_t47++)i.insertRule(_n35.rules[_t47],s++);}else{for(;r<_h20;)s+=this.modules[r++].rules.length;s+=_n35.rules.length,r++;}}if(i)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet].concat(_toConsumableArray(e.adoptedStyleSheets)));else{var _t48="";for(var _e49=0;_e49<this.modules.length;_e49++)_t48+=this.modules[_e49].getRules()+"\n";this.styleTag.textContent=_t48;var _i47=e.head||e;this.styleTag.parentNode!=_i47&&_i47.insertBefore(this.styleTag,_i47.firstChild);}}},{key:"setNonce",value:function setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t);}}]);}();for(Xt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Yt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Qt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Zt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),te=0;te<10;te++)Xt[48+te]=Xt[96+te]=String(te);for(te=1;te<=24;te++)Xt[te+111]="F"+te;for(te=65;te<=90;te++)Xt[te]=String.fromCharCode(te+32),Yt[te]=String.fromCharCode(te);for(ee in Xt)Yt.hasOwnProperty(ee)||(Yt[ee]=Xt[ee]);pe=/*#__PURE__*/function(){function pe(){_classCallCheck(this,pe);this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0;}return _createClass(pe,[{key:"eq",value:function eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset;}},{key:"setRange",value:function setRange(t){var e=t.anchorNode,i=t.focusNode;this.set(e,Math.min(t.anchorOffset,e?fe(e):0),i,Math.min(t.focusOffset,i?fe(i):0));}},{key:"set",value:function set(t,e,i,s){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=s;}}]);}();ge=null;Se=/*#__PURE__*/function(){function Se(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;_classCallCheck(this,Se);this.node=t,this.offset=e,this.precise=i;}return _createClass(Se,null,[{key:"before",value:function before(t,e){return new Se(t.parentNode,le(t),e);}},{key:"after",value:function after(t,e){return new Se(t.parentNode,le(t)+1,e);}}]);}();Ae=[];Ce=/*#__PURE__*/function(){function Ce(){_classCallCheck(this,Ce);this.parent=null,this.dom=null,this.flags=2;}return _createClass(Ce,[{key:"overrideDOMText",get:function get(){return null;}},{key:"posAtStart",get:function get(){return this.parent?this.parent.posBefore(this):0;}},{key:"posAtEnd",get:function get(){return this.posAtStart+this.length;}},{key:"posBefore",value:function posBefore(t){var e=this.posAtStart;var _iterator33=_createForOfIteratorHelper(this.children),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var _i53=_step33.value;if(_i53==t)return e;e+=_i53.length+_i53.breakAfter;}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}throw new RangeError("Invalid child in posBefore");}},{key:"posAfter",value:function posAfter(t){return this.posBefore(t)+t.length;}},{key:"sync",value:function sync(t,e){if(2&this.flags){var _i54,_s37=this.dom,_r39=null;var _iterator34=_createForOfIteratorHelper(this.children),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _n36=_step34.value;if(7&_n36.flags){if(!_n36.dom&&(_i54=_r39?_r39.nextSibling:_s37.firstChild)){var _t50=Ce.get(_i54);(!_t50||!_t50.parent&&_t50.canReuseDOM(_n36))&&_n36.reuseDOM(_i54);}_n36.sync(t,e),_n36.flags&=-8;}if(_i54=_r39?_r39.nextSibling:_s37.firstChild,e&&!e.written&&e.node==_s37&&_i54!=_n36.dom&&(e.written=!0),_n36.dom.parentNode==_s37)for(;_i54&&_i54!=_n36.dom;)_i54=Oe(_i54);else _s37.insertBefore(_n36.dom,_i54);_r39=_n36.dom;}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}for(_i54=_r39?_r39.nextSibling:_s37.firstChild,_i54&&e&&e.node==_s37&&(e.written=!0);_i54;)_i54=Oe(_i54);}else if(1&this.flags){var _iterator35=_createForOfIteratorHelper(this.children),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _i55=_step35.value;7&_i55.flags&&(_i55.sync(t,e),_i55.flags&=-8);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}}}},{key:"reuseDOM",value:function reuseDOM(t){}},{key:"localPosFromDOM",value:function localPosFromDOM(t,e){var i;if(t==this.dom)i=this.dom.childNodes[e];else{var _s38=0==fe(t)?0:0==e?-1:1;for(;;){var _e50=t.parentNode;if(_e50==this.dom)break;0==_s38&&_e50.firstChild!=_e50.lastChild&&(_s38=t==_e50.firstChild?-1:1),t=_e50;}i=_s38<0?t:t.nextSibling;}if(i==this.dom.firstChild)return 0;for(;i&&!Ce.get(i);)i=i.nextSibling;if(!i)return this.length;for(var _t51=0,_e51=0;;_t51++){var _s39=this.children[_t51];if(_s39.dom==i)return _e51;_e51+=_s39.length+_s39.breakAfter;}}},{key:"domBoundsAround",value:function domBoundsAround(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=-1,r=-1,n=-1,h=-1;for(var _l19=0,_o11=i,_u18=i;_l19<this.children.length;_l19++){var _i56=this.children[_l19],_f5=_o11+_i56.length;if(_o11<t&&_f5>e)return _i56.domBoundsAround(t,e,_o11);if(_f5>=t&&-1==s&&(s=_l19,r=_o11),_o11>e&&_i56.dom.parentNode==this.dom){n=_l19,h=_u18;break;}_u18=_f5,_o11=_f5+_i56.breakAfter;}return{from:r,to:h<0?i+this.length:h,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:n<this.children.length&&n>=0?this.children[n].dom:null};}},{key:"markDirty",value:function markDirty(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;this.flags|=2,this.markParentsDirty(t);}},{key:"markParentsDirty",value:function markParentsDirty(t){for(var _e52=this.parent;_e52;_e52=_e52.parent){if(t&&(_e52.flags|=2),1&_e52.flags)return;_e52.flags|=1,t=!1;}}},{key:"setParent",value:function setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0));}},{key:"setDOM",value:function setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this);}},{key:"rootView",get:function get(){for(var _t52=this;;){var _e53=_t52.parent;if(!_e53)return _t52;_t52=_e53;}}},{key:"replaceChildren",value:function replaceChildren(t,e){var _this$children;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:Ae;this.markDirty();for(var _s40=t;_s40<e;_s40++){var _t53=this.children[_s40];_t53.parent==this&&i.indexOf(_t53)<0&&_t53.destroy();}(_this$children=this.children).splice.apply(_this$children,[t,e-t].concat(_toConsumableArray(i)));for(var _t54=0;_t54<i.length;_t54++)i[_t54].setParent(this);}},{key:"ignoreMutation",value:function ignoreMutation(t){return!1;}},{key:"ignoreEvent",value:function ignoreEvent(t){return!1;}},{key:"childCursor",value:function childCursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.length;return new De(this.children,t,this.children.length);}},{key:"childPos",value:function childPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;return this.childCursor().findPos(t,e);}},{key:"toString",value:function toString(){var t=this.constructor.name.replace("View","");return t+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==t?this.text:this.length)+"]":"")+(this.breakAfter?"#":"");}},{key:"isEditable",get:function get(){return!0;}},{key:"isWidget",get:function get(){return!1;}},{key:"isHidden",get:function get(){return!1;}},{key:"merge",value:function merge(t,e,i,s,r,n){return!1;}},{key:"become",value:function become(t){return!1;}},{key:"canReuseDOM",value:function canReuseDOM(t){return t.constructor==this.constructor&&!(8&(this.flags|t.flags));}},{key:"getSide",value:function getSide(){return 0;}},{key:"destroy",value:function destroy(){var _iterator36=_createForOfIteratorHelper(this.children),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _t55=_step36.value;_t55.parent==this&&_t55.destroy();}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}this.parent=null;}}],[{key:"get",value:function get(t){return t.cmView;}}]);}();Ce.prototype.breakAfter=0;De=/*#__PURE__*/function(){function De(t,e,i){_classCallCheck(this,De);this.children=t,this.pos=e,this.i=i,this.off=0;}return _createClass(De,[{key:"findPos",value:function findPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;for(;;){if(t>this.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;var _i57=this.children[--this.i];this.pos-=_i57.length+_i57.breakAfter;}}}]);}();Re="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""};Te="undefined"!=typeof document?document:{documentElement:{style:{}}};Be=/Edge\/(\d+)/.exec(Re.userAgent);Le=/MSIE \d/.test(Re.userAgent);Ne=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Re.userAgent);je=!!(Le||Ne||Be);$e=!je&&/gecko\/(\d+)/i.test(Re.userAgent);ze=!je&&/Chrome\/(\d+)/.exec(Re.userAgent);Pe="webkitFontSmoothing"in Te.documentElement.style;He=!je&&/Apple Computer/.test(Re.vendor);We=He&&(/Mobile\/\w+/.test(Re.userAgent)||Re.maxTouchPoints>2);Ve={mac:We||/Mac/.test(Re.platform),windows:/Win/.test(Re.platform),linux:/Linux|X11/.test(Re.platform),ie:je,ie_version:Le?Te.documentMode||6:Ne?+Ne[1]:Be?+Be[1]:0,gecko:$e,gecko_version:$e?+(/Firefox\/(\d+)/.exec(Re.userAgent)||[0,0])[1]:0,chrome:!!ze,chrome_version:ze?+ze[1]:0,ios:We,android:/Android\b/.test(Re.userAgent),webkit:Pe,safari:He,webkit_version:Pe?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Te.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};Fe=/*#__PURE__*/function(_Ce){function Fe(t){var _this8;_classCallCheck(this,Fe);_this8=_callSuper(this,Fe),_this8.text=t;return _this8;}_inherits(Fe,_Ce);return _createClass(Fe,[{key:"length",get:function get(){return this.text.length;}},{key:"createDOM",value:function createDOM(t){this.setDOM(t||document.createTextNode(this.text));}},{key:"sync",value:function sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text);}},{key:"reuseDOM",value:function reuseDOM(t){3==t.nodeType&&this.createDOM(t);}},{key:"merge",value:function merge(t,e,i){return!(8&this.flags||i&&(!(i instanceof Fe)||this.length-(e-t)+i.length>256||8&i.flags))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0);}},{key:"split",value:function split(t){var e=new Fe(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e;}},{key:"localPosFromDOM",value:function localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0;}},{key:"domAtPos",value:function domAtPos(t){return new Se(this.dom,t);}},{key:"domBoundsAround",value:function domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling};}},{key:"coordsAt",value:function coordsAt(t,e){return function(t,e,i){var s=t.nodeValue.length;e>s&&(e=s);var r=e,n=e,h=0;0==e&&i<0||e==s&&i>=0?Ve.chrome||Ve.gecko||(e?(r--,h=1):n<s&&(n++,h=-1)):i<0?r--:n<s&&n++;var l=be(t,r,n).getClientRects();if(!l.length)return null;var o=l[(h?h<0:i>=0)?0:l.length-1];Ve.safari&&!h&&0==o.width&&(o=Array.prototype.find.call(l,function(t){return t.width;})||o);return h?ae(o,h<0):o||null;}(this.dom,t,e);}}]);}(Ce);qe=/*#__PURE__*/function(_Ce2){function qe(t){var _this9;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_classCallCheck(this,qe);_this9=_callSuper(this,qe),_this9.mark=t,_this9.children=e,_this9.length=i;var _iterator38=_createForOfIteratorHelper(e),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var _t58=_step38.value;_t58.setParent(_this9);}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}return _this9;}_inherits(qe,_Ce2);return _createClass(qe,[{key:"setAttrs",value:function setAttrs(t){if(ke(t),this.mark["class"]&&(t.className=this.mark["class"]),this.mark.attrs)for(var _e54 in this.mark.attrs)t.setAttribute(_e54,this.mark.attrs[_e54]);return t;}},{key:"canReuseDOM",value:function canReuseDOM(t){return _get(_getPrototypeOf(qe.prototype),"canReuseDOM",this).call(this,t)&&!(8&(this.flags|t.flags));}},{key:"reuseDOM",value:function reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6);}},{key:"sync",value:function sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),_get(_getPrototypeOf(qe.prototype),"sync",this).call(this,t,e);}},{key:"merge",value:function merge(t,e,i,s,r,n){return(!i||!(!(i instanceof qe&&i.mark.eq(this.mark))||t&&r<=0||e<this.length&&n<=0))&&(Ie(this,t,e,i?i.children.slice():[],r-1,n-1),this.markDirty(),!0);}},{key:"split",value:function split(t){var e=[],i=0,s=-1,r=0;var _iterator39=_createForOfIteratorHelper(this.children),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var _n37=_step39.value;var _h21=i+_n37.length;_h21>t&&e.push(i<t?_n37.split(t-i):_n37),s<0&&i>=t&&(s=r),i=_h21,r++;}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}var n=this.length-t;return this.length=t,s>-1&&(this.children.length=s,this.markDirty()),new qe(this.mark,e,n);}},{key:"domAtPos",value:function domAtPos(t){return Ge(this,t);}},{key:"coordsAt",value:function coordsAt(t,e){return _e(this,t,e);}}]);}(Ce);Ue=/*#__PURE__*/function(_Ce3){function Ue(t,e,i){var _this10;_classCallCheck(this,Ue);_this10=_callSuper(this,Ue),_this10.widget=t,_this10.length=e,_this10.side=i,_this10.prevWidget=null;return _this10;}_inherits(Ue,_Ce3);return _createClass(Ue,[{key:"split",value:function split(t){var e=Ue.create(this.widget,this.length-t,this.side);return this.length-=t,e;}},{key:"sync",value:function sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"));}},{key:"getSide",value:function getSide(){return this.side;}},{key:"merge",value:function merge(t,e,i,s,r,n){return!(i&&(!(i instanceof Ue&&this.widget.compare(i.widget))||t>0&&r<=0||e<this.length&&n<=0))&&(this.length=t+(i?i.length:0)+(this.length-e),!0);}},{key:"become",value:function become(t){return t instanceof Ue&&t.side==this.side&&this.widget.constructor==t.widget.constructor&&(this.widget.compare(t.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,!0);}},{key:"ignoreMutation",value:function ignoreMutation(){return!0;}},{key:"ignoreEvent",value:function ignoreEvent(t){return this.widget.ignoreEvent(t);}},{key:"overrideDOMText",get:function get(){if(0==this.length)return t.empty;var e=this;for(;e.parent;)e=e.parent;var _e55=e,i=_e55.view,s=i&&i.state.doc,r=this.posAtStart;return s?s.slice(r,r+this.length):t.empty;}},{key:"domAtPos",value:function domAtPos(t){return(this.length?0==t:this.side>0)?Se.before(this.dom):Se.after(this.dom,t==this.length);}},{key:"domBoundsAround",value:function domBoundsAround(){return null;}},{key:"coordsAt",value:function coordsAt(t,e){var i=this.widget.coordsAt(this.dom,t,e);if(i)return i;var s=this.dom.getClientRects(),r=null;if(!s.length)return null;var n=this.side?this.side<0:t>0;for(var _e56=n?s.length-1:0;r=s[_e56],!(t>0?0==_e56:_e56==s.length-1||r.top<r.bottom);_e56+=n?-1:1);return ae(r,!n);}},{key:"isEditable",get:function get(){return!1;}},{key:"isWidget",get:function get(){return!0;}},{key:"isHidden",get:function get(){return this.widget.isHidden;}},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(Ue.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom);}}],[{key:"create",value:function create(t,e,i){return new Ue(t,e,i);}}]);}(Ce);Je=/*#__PURE__*/function(_Ce4){function Je(t){var _this11;_classCallCheck(this,Je);_this11=_callSuper(this,Je),_this11.side=t;return _this11;}_inherits(Je,_Ce4);return _createClass(Je,[{key:"length",get:function get(){return 0;}},{key:"merge",value:function merge(){return!1;}},{key:"become",value:function become(t){return t instanceof Je&&t.side==this.side;}},{key:"split",value:function split(){return new Je(this.side);}},{key:"sync",value:function sync(){if(!this.dom){var _t59=document.createElement("img");_t59.className="cm-widgetBuffer",_t59.setAttribute("aria-hidden","true"),this.setDOM(_t59);}}},{key:"getSide",value:function getSide(){return this.side;}},{key:"domAtPos",value:function domAtPos(t){return this.side>0?Se.before(this.dom):Se.after(this.dom);}},{key:"localPosFromDOM",value:function localPosFromDOM(){return 0;}},{key:"domBoundsAround",value:function domBoundsAround(){return null;}},{key:"coordsAt",value:function coordsAt(t){return this.dom.getBoundingClientRect();}},{key:"overrideDOMText",get:function get(){return t.empty;}},{key:"isHidden",get:function get(){return!0;}}]);}(Ce);Fe.prototype.children=Ue.prototype.children=Je.prototype.children=Ae;Ye=Object.create(null);ei=/*#__PURE__*/function(_Ce5){function ei(){var _this12;_classCallCheck(this,ei);_this12=_callSuper(this,ei,arguments),_this12.children=[],_this12.length=0,_this12.prevAttrs=void 0,_this12.attrs=null,_this12.breakAfter=0;return _this12;}_inherits(ei,_Ce5);return _createClass(ei,[{key:"merge",value:function merge(t,e,i,s,r,n){if(i){if(!(i instanceof ei))return!1;this.dom||i.transferDOM(this);}return s&&this.setDeco(i?i.attrs:null),Ie(this,t,e,i?i.children.slice():[],r,n),!0;}},{key:"split",value:function split(t){var e=new ei();if(e.breakAfter=this.breakAfter,0==this.length)return e;var _this$childPos=this.childPos(t),i=_this$childPos.i,s=_this$childPos.off;s&&(e.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(var _t63=i;_t63<this.children.length;_t63++)e.append(this.children[_t63],0);for(;i>0&&0==this.children[i-1].length;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e;}},{key:"transferDOM",value:function transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null);}},{key:"setDeco",value:function setDeco(t){Qe(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t);}},{key:"append",value:function append(t,e){Ke(this,t,e);}},{key:"addLineDeco",value:function addLineDeco(t){var e=t.spec.attributes,i=t.spec["class"];e&&(this.attrs=Xe(e,this.attrs||{})),i&&(this.attrs=Xe({"class":i},this.attrs||{}));}},{key:"domAtPos",value:function domAtPos(t){return Ge(this,t);}},{key:"reuseDOM",value:function reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6);}},{key:"sync",value:function sync(t,e){var i;this.dom?4&this.flags&&(ke(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(Ze(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),_get(_getPrototypeOf(ei.prototype),"sync",this).call(this,t,e);var s=this.dom.lastChild;for(;s&&Ce.get(s)instanceof qe;)s=s.lastChild;if(!(s&&this.length&&("BR"==s.nodeName||0!=(null===(i=Ce.get(s))||void 0===i?void 0:i.isEditable)||Ve.ios&&this.children.some(function(t){return t instanceof Fe;})))){var _t64=document.createElement("BR");_t64.cmIgnore=!0,this.dom.appendChild(_t64);}}},{key:"measureTextSize",value:function measureTextSize(){if(0==this.children.length||this.length>20)return null;var t,e=0;var _iterator40=_createForOfIteratorHelper(this.children),_step40;try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var _i61=_step40.value;if(!(_i61 instanceof Fe)||/[^ -~]/.test(_i61.text))return null;var _s43=ne(_i61.dom);if(1!=_s43.length)return null;e+=_s43[0].width,t=_s43[0].height;}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null;}},{key:"coordsAt",value:function coordsAt(t,e){var i=_e(this,t,e);if(!this.children.length&&i&&this.parent){var _t65=this.parent.view.viewState.heightOracle,_e59=i.bottom-i.top;if(Math.abs(_e59-_t65.lineHeight)<2&&_t65.textHeight<_e59){var _s44=(_e59-_t65.textHeight)/2;return{top:i.top+_s44,bottom:i.bottom-_s44,left:i.left,right:i.left};}}return i;}},{key:"become",value:function become(t){return!1;}},{key:"covers",value:function covers(){return!0;}}],[{key:"find",value:function find(t,e){for(var _i62=0,_s45=0;_i62<t.children.length;_i62++){var _r42=t.children[_i62],_n40=_s45+_r42.length;if(_n40>=e){if(_r42 instanceof ei)return _r42;if(_n40>e)break;}_s45=_n40+_r42.breakAfter;}return null;}}]);}(Ce);ii=/*#__PURE__*/function(_Ce6){function ii(t,e,i){var _this13;_classCallCheck(this,ii);_this13=_callSuper(this,ii),_this13.widget=t,_this13.length=e,_this13.deco=i,_this13.breakAfter=0,_this13.prevWidget=null;return _this13;}_inherits(ii,_Ce6);return _createClass(ii,[{key:"merge",value:function merge(t,e,i,s,r,n){return!(i&&(!(i instanceof ii&&this.widget.compare(i.widget))||t>0&&r<=0||e<this.length&&n<=0))&&(this.length=t+(i?i.length:0)+(this.length-e),!0);}},{key:"domAtPos",value:function domAtPos(t){return 0==t?Se.before(this.dom):Se.after(this.dom,t==this.length);}},{key:"split",value:function split(t){var e=this.length-t;this.length=t;var i=new ii(this.widget,e,this.deco);return i.breakAfter=this.breakAfter,i;}},{key:"children",get:function get(){return Ae;}},{key:"sync",value:function sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"));}},{key:"overrideDOMText",get:function get(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):t.empty;}},{key:"domBoundsAround",value:function domBoundsAround(){return null;}},{key:"become",value:function become(t){return t instanceof ii&&t.widget.constructor==this.widget.constructor&&(t.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,this.deco=t.deco,this.breakAfter=t.breakAfter,!0);}},{key:"ignoreMutation",value:function ignoreMutation(){return!0;}},{key:"ignoreEvent",value:function ignoreEvent(t){return this.widget.ignoreEvent(t);}},{key:"isEditable",get:function get(){return!1;}},{key:"isWidget",get:function get(){return!0;}},{key:"coordsAt",value:function coordsAt(t,e){return this.widget.coordsAt(this.dom,t,e);}},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(ii.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom);}},{key:"covers",value:function covers(t){var _this$deco=this.deco,e=_this$deco.startSide,i=_this$deco.endSide;return e!=i&&(t<0?e<0:i>0);}}]);}(Ce);_export("W",si=/*#__PURE__*/function(){function si(){_classCallCheck(this,si);}return _createClass(si,[{key:"eq",value:function eq(t){return!1;}},{key:"updateDOM",value:function updateDOM(t,e){return!1;}},{key:"compare",value:function compare(t){return this==t||this.constructor==t.constructor&&this.eq(t);}},{key:"estimatedHeight",get:function get(){return-1;}},{key:"lineBreaks",get:function get(){return 0;}},{key:"ignoreEvent",value:function ignoreEvent(t){return!0;}},{key:"coordsAt",value:function coordsAt(t,e,i){return null;}},{key:"isHidden",get:function get(){return!1;}},{key:"editable",get:function get(){return!1;}},{key:"destroy",value:function destroy(t){}}]);}());ri=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t;}(ri||(ri={}));_export("u",ni=/*#__PURE__*/function(_Ct){function ni(t,e,i,s){var _this14;_classCallCheck(this,ni);_this14=_callSuper(this,ni),_this14.startSide=t,_this14.endSide=e,_this14.widget=i,_this14.spec=s;return _this14;}_inherits(ni,_Ct);return _createClass(ni,[{key:"heightRelevant",get:function get(){return!1;}},{key:"hasHeight",value:function hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1;}}],[{key:"mark",value:function mark(t){return new hi(t);}},{key:"widget",value:function widget(t){var e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new oi(t,e,e,i,t.widget||null,!1);}},{key:"replace",value:function replace(t){var e,i,s=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{var _ui=ui(t,s),_r43=_ui.start,_n41=_ui.end;e=(_r43?s?-3e8:-1:5e8)-1,i=1+(_n41?s?2e8:1:-6e8);}return new oi(t,e,i,s,t.widget||null,!0);}},{key:"line",value:function line(t){return new li(t);}},{key:"set",value:function set(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return It.of(t,e);}}]);}(Ct));ni.none=It.empty;hi=/*#__PURE__*/function(_ni){function hi(t){var _this15;_classCallCheck(this,hi);var _ui2=ui(t),e=_ui2.start,i=_ui2.end;_this15=_callSuper(this,hi,[e?-1:5e8,i?1:-6e8,null,t]),_this15.tagName=t.tagName||"span",_this15["class"]=t["class"]||"",_this15.attrs=t.attributes||null;return _this15;}_inherits(hi,_ni);return _createClass(hi,[{key:"eq",value:function eq(t){var e,i;return this==t||t instanceof hi&&this.tagName==t.tagName&&(this["class"]||(null===(e=this.attrs)||void 0===e?void 0:e["class"]))==(t["class"]||(null===(i=t.attrs)||void 0===i?void 0:i["class"]))&&Qe(this.attrs,t.attrs,"class");}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(t>=e)throw new RangeError("Mark decorations may not be empty");return _get(_getPrototypeOf(hi.prototype),"range",this).call(this,t,e);}}]);}(ni);hi.prototype.point=!1;li=/*#__PURE__*/function(_ni2){function li(t){_classCallCheck(this,li);return _callSuper(this,li,[-2e8,-2e8,null,t]);}_inherits(li,_ni2);return _createClass(li,[{key:"eq",value:function eq(t){return t instanceof li&&this.spec["class"]==t.spec["class"]&&Qe(this.spec.attributes,t.spec.attributes);}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return _get(_getPrototypeOf(li.prototype),"range",this).call(this,t,e);}}]);}(ni);li.prototype.mapMode=x.TrackBefore,li.prototype.point=!0;oi=/*#__PURE__*/function(_ni3){function oi(t,e,i,s,r,n){var _this16;_classCallCheck(this,oi);_this16=_callSuper(this,oi,[e,i,r,t]),_this16.block=s,_this16.isReplace=n,_this16.mapMode=s?e<=0?x.TrackBefore:x.TrackAfter:x.TrackDel;return _this16;}_inherits(oi,_ni3);return _createClass(oi,[{key:"type",get:function get(){return this.startSide!=this.endSide?ri.WidgetRange:this.startSide<=0?ri.WidgetBefore:ri.WidgetAfter;}},{key:"heightRelevant",get:function get(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0);}},{key:"eq",value:function eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i;}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return _get(_getPrototypeOf(oi.prototype),"range",this).call(this,t,e);}}]);}(ni);oi.prototype.point=!0;ai=/*#__PURE__*/function(){function ai(t,e,i,s){_classCallCheck(this,ai);this.doc=t,this.pos=e,this.end=i,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=e;}return _createClass(ai,[{key:"posCovered",value:function posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;var t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof ii&&t.deco.endSide<0);}},{key:"getLine",value:function getLine(){return this.curLine||(this.content.push(this.curLine=new ei()),this.atCursorPos=!0),this.curLine;}},{key:"flushBuffer",value:function flushBuffer(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(ci(new Je(-1),t),t.length),this.pendingBuffer=0);}},{key:"addBlockWidget",value:function addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t);}},{key:"finish",value:function finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||t&&this.content.length&&this.content[this.content.length-1]instanceof ii||this.getLine();}},{key:"buildText",value:function buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){var _this$cursor$next2=this.cursor.next(this.skip),_e60=_this$cursor$next2.value,_i63=_this$cursor$next2.lineBreak,_s46=_this$cursor$next2.done;if(this.skip=0,_s46)throw new Error("Ran out of text content when drawing inline views");if(_i63){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue;}this.text=_e60,this.textOff=0;}var _s47=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(ci(new Fe(this.text.slice(this.textOff,this.textOff+_s47)),e),i),this.atCursorPos=!0,this.textOff+=_s47,t-=_s47,i=0;}}},{key:"span",value:function span(t,e,i,s){this.buildText(e-t,i,s),this.pos=e,this.openStart<0&&(this.openStart=s);}},{key:"point",value:function point(t,e,i,s,r,n){if(this.disallowBlockEffectsFor[n]&&i instanceof oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins");}var h=e-t;if(i instanceof oi){if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ii(i.widget||di.block,h,i));else{var _n42=Ue.create(i.widget||di.inline,h,h?0:i.startSide),_l20=this.atCursorPos&&!_n42.isEditable&&r<=s.length&&(t<e||i.startSide>0),_o13=!_n42.isEditable&&(t<e||r>s.length||i.startSide<=0),_u20=this.getLine();2!=this.pendingBuffer||_l20||_n42.isEditable||(this.pendingBuffer=0),this.flushBuffer(s),_l20&&(_u20.append(ci(new Je(1),s),r),r=s.length+Math.max(0,r-s.length)),_u20.append(ci(_n42,s),r),this.atCursorPos=_o13,this.pendingBuffer=_o13?t<e||r>s.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice());}}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);h&&(this.textOff+h<=this.text.length?this.textOff+=h:(this.skip+=h-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r);}}],[{key:"build",value:function build(t,e,i,s,r){var n=new ai(t,e,i,r);return n.openEnd=It.spans(s,e,i,n),n.openStart<0&&(n.openStart=n.openEnd),n.finish(n.openEnd),n;}}]);}();di=/*#__PURE__*/function(_si){function di(t){var _this17;_classCallCheck(this,di);_this17=_callSuper(this,di),_this17.tag=t;return _this17;}_inherits(di,_si);return _createClass(di,[{key:"eq",value:function eq(t){return t.tag==this.tag;}},{key:"toDOM",value:function toDOM(){return document.createElement(this.tag);}},{key:"updateDOM",value:function updateDOM(t){return t.nodeName.toLowerCase()==this.tag;}},{key:"isHidden",get:function get(){return!0;}}]);}(si);di.inline=new di("span"),di.block=new di("div");_export("v",pi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t;}(pi||_export("v",pi={})));mi=pi.LTR;gi=pi.RTL;bi=wi("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008");vi=wi("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333");ki=Object.create(null);yi=[];for(_i66=0,_arr=["()","[]","{}"];_i66<_arr.length;_i66++){_t66=_arr[_i66];_e61=_t66.charCodeAt(0);_i67=_t66.charCodeAt(1);ki[_e61]=_i67,ki[_i67]=-_e61;}xi=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;Si=/*#__PURE__*/function(){function Si(t,e,i){_classCallCheck(this,Si);this.from=t,this.to=e,this.level=i;}return _createClass(Si,[{key:"dir",get:function get(){return this.level%2?gi:mi;}},{key:"side",value:function side(t,e){return this.dir==e==t?this.to:this.from;}},{key:"forward",value:function forward(t,e){return t==(this.dir==e);}}],[{key:"find",value:function find(t,e,i,s){var r=-1;for(var _n43=0;_n43<t.length;_n43++){var _h23=t[_n43];if(_h23.from<=e&&_h23.to>=e){if(_h23.level==i)return _n43;(r<0||(0!=s?s<0?_h23.from<e:_h23.to>e:t[r].level>_h23.level))&&(r=_n43);}}if(r<0)throw new RangeError("Index out of range");return r;}}]);}();Ci=[];Ii="";Bi=j.define();Li=j.define();Ni=j.define();ji=j.define();$i=j.define();zi=j.define();Pi=j.define();Hi=j.define({combine:function combine(t){return t.some(function(t){return t;});}});Wi=j.define({combine:function combine(t){return t.some(function(t){return t;});}});Vi=j.define();Fi=/*#__PURE__*/function(){function Fi(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"nearest";var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"nearest";var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:5;var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:5;var n=arguments.length>5&&arguments[5]!==undefined?arguments[5]:!1;_classCallCheck(this,Fi);this.range=t,this.y=e,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=n;}return _createClass(Fi,[{key:"map",value:function map(t){return t.empty?this:new Fi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot);}},{key:"clip",value:function clip(t){return this.range.to<=t.doc.length?this:new Fi(B.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot);}}]);}();qi=ct.define({map:function map(t,e){return t.map(e);}});Ji=j.define({combine:function combine(t){return!t.length||t[0];}});Gi=0;Ki=j.define();_export("V",_i=/*#__PURE__*/function(){function _i(t,e,i,s,r){_classCallCheck(this,_i);this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=s,this.extension=r(this);}return _createClass(_i,null,[{key:"define",value:function define(t,e){var _ref4=e||{},i=_ref4.eventHandlers,s=_ref4.eventObservers,r=_ref4.provide,n=_ref4.decorations;return new _i(Gi++,t,i,s,function(t){var e=[Ki.of(t)];return n&&e.push(Zi.of(function(e){var i=e.plugin(t);return i?n(i):ni.none;})),r&&e.push(r(t)),e;});}},{key:"fromClass",value:function fromClass(t,e){return _i.define(function(e){return new t(e);},e);}}]);}());Xi=/*#__PURE__*/function(){function Xi(t){_classCallCheck(this,Xi);this.spec=t,this.mustUpdate=null,this.value=null;}return _createClass(Xi,[{key:"update",value:function update(t){if(this.value){if(this.mustUpdate){var _t75=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(_t75);}catch(e){if(Ui(_t75.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy();}catch(t){}this.deactivate();}}}else if(this.spec)try{this.value=this.spec.create(t);}catch(e){Ui(t.state,e,"CodeMirror plugin crashed"),this.deactivate();}return this;}},{key:"destroy",value:function destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy();}catch(e){Ui(t.state,e,"CodeMirror plugin crashed");}}},{key:"deactivate",value:function deactivate(){this.spec=this.value=null;}}]);}();Yi=j.define();Qi=j.define();Zi=j.define();ts=j.define();es=j.define();is=j.define();rs=j.define();hs=j.define();ls=/*#__PURE__*/function(){function ls(t,e,i,s){_classCallCheck(this,ls);this.fromA=t,this.toA=e,this.fromB=i,this.toB=s;}return _createClass(ls,[{key:"join",value:function join(t){return new ls(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB));}},{key:"addToSet",value:function addToSet(t){var e=t.length,i=this;for(;e>0;e--){var _s54=t[e-1];if(!(_s54.fromA>i.toA)){if(_s54.toA<i.fromA)break;i=i.join(_s54),t.splice(e-1,1);}}return t.splice(e,0,i),t;}}],[{key:"extendWithRanges",value:function extendWithRanges(t,e){if(0==e.length)return t;var i=[];for(var _s55=0,_r50=0,_n49=0,_h31=0;;_s55++){var _l24=_s55==t.length?null:t[_s55],_o19=_n49-_h31,_u25=_l24?_l24.fromB:1e9;for(;_r50<e.length&&e[_r50]<_u25;){var _t78=e[_r50],_s56=e[_r50+1],_n50=Math.max(_h31,_t78),_l25=Math.min(_u25,_s56);if(_n50<=_l25&&new ls(_n50+_o19,_l25+_o19,_n50,_l25).addToSet(i),_s56>_u25)break;_r50+=2;}if(!_l24)return i;new ls(_l24.fromA,_l24.toA,_l24.fromB,_l24.toB).addToSet(i),_n49=_l24.toA,_h31=_l24.toB;}}}]);}();os=/*#__PURE__*/function(){function os(t,e,i){_classCallCheck(this,os);this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=A.empty(this.startState.doc.length);var _iterator43=_createForOfIteratorHelper(i),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var _t79=_step43.value;this.changes=this.changes.compose(_t79.changes);}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}var s=[];this.changes.iterChangedRanges(function(t,e,i,r){return s.push(new ls(t,e,i,r));}),this.changedRanges=s;}return _createClass(os,[{key:"viewportChanged",get:function get(){return(4&this.flags)>0;}},{key:"heightChanged",get:function get(){return(2&this.flags)>0;}},{key:"geometryChanged",get:function get(){return this.docChanged||(10&this.flags)>0;}},{key:"focusChanged",get:function get(){return(1&this.flags)>0;}},{key:"docChanged",get:function get(){return!this.changes.empty;}},{key:"selectionSet",get:function get(){return this.transactions.some(function(t){return t.selection;});}},{key:"empty",get:function get(){return 0==this.flags&&0==this.transactions.length;}}],[{key:"create",value:function create(t,e,i){return new os(t,e,i);}}]);}();us=/*#__PURE__*/function(_Ce7){function us(t){var _this18;_classCallCheck(this,us);_this18=_callSuper(this,us),_this18.view=t,_this18.decorations=[],_this18.dynamicDecorationMap=[],_this18.domChanged=null,_this18.hasComposition=null,_this18.markedForComposition=new Set(),_this18.lastCompositionAfterCursor=!1,_this18.minWidth=0,_this18.minWidthFrom=0,_this18.minWidthTo=0,_this18.impreciseAnchor=null,_this18.impreciseHead=null,_this18.forceSelection=!1,_this18.lastUpdate=Date.now(),_this18.setDOM(t.contentDOM),_this18.children=[new ei()],_this18.children[0].setParent(_assertThisInitialized(_this18)),_this18.updateDeco(),_this18.updateInner([new ls(0,0,0,t.state.doc.length)],0,null);return _this18;}_inherits(us,_Ce7);return _createClass(us,[{key:"length",get:function get(){return this.view.state.doc.length;}},{key:"update",value:function update(t){var _this19=this;var e;var i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(function(_ref5){var t=_ref5.fromA,e=_ref5.toA;return e<_this19.minWidthFrom||t>_this19.minWidthTo;})?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);var s=-1;this.view.inputState.composing>=0&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?s=this.domChanged.newSel.head:function(t,e){var i=!1;e&&t.iterChangedRanges(function(t,s){t<e.to&&s>e.from&&(i=!0);});return i;}(t.changes,this.hasComposition)||t.selectionSet||(s=t.state.selection.main.head));var r=s>-1?function(t,e,i){var s=as(t,i);if(!s)return null;var r=s.node,n=s.from,h=s.to,l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(t.state.doc.sliceString(s.from,s.to)!=l)return null;var o=e.invertedDesc,u=new ls(o.mapPos(n),o.mapPos(h),n,h),f=[];for(var _e72=r.parentNode;;_e72=_e72.parentNode){var _i76=Ce.get(_e72);if(_i76 instanceof qe)f.push({node:_e72,deco:_i76.mark});else{if(_i76 instanceof ei||"DIV"==_e72.nodeName&&_e72.parentNode==t.contentDOM)return{range:u,text:r,marks:f,line:_e72};if(_e72==t.contentDOM)return null;f.push({node:_e72,deco:new hi({inclusive:!0,attributes:ti(_e72),tagName:_e72.tagName.toLowerCase()})});}}}(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();var _this$hasComposition=this.hasComposition,_e73=_this$hasComposition.from,_s57=_this$hasComposition.to;i=new ls(_e73,_s57,t.changes.mapPos(_e73,-1),t.changes.mapPos(_s57,1)).addToSet(i.slice());}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Ve.ie||Ve.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);var n=function(t,e,i){var s=new cs();return It.compare(t,e,i,s),s.changes;}(this.decorations,this.updateDeco(),t.changes);return i=ls.extendWithRanges(i,n),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,t.startState.doc.length,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0);}},{key:"updateInner",value:function updateInner(t,e,i){var _this20=this;this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,i);var s=this.view.observer;s.ignore(function(){_this20.dom.style.height=_this20.view.viewState.contentHeight/_this20.view.scaleY+"px",_this20.dom.style.flexBasis=_this20.minWidth?_this20.minWidth+"px":"";var t=Ve.chrome||Ve.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;_this20.sync(_this20.view,t),_this20.flags&=-8,t&&(t.written||s.selectionRange.focusNode!=t.node)&&(_this20.forceSelection=!0),_this20.dom.style.height="";}),this.markedForComposition.forEach(function(t){return t.flags&=-9;});var r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){var _iterator44=_createForOfIteratorHelper(this.children),_step44;try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var _t80=_step44.value;_t80 instanceof ii&&_t80.widget instanceof fs&&r.push(_t80.dom);}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}}s.updateGaps(r);}},{key:"updateChildren",value:function updateChildren(t,e,i){var s=i?i.range.addToSet(t.slice()):t,r=this.childCursor(e);for(var _t81=s.length-1;;_t81--){var _e74=_t81>=0?s[_t81]:null;if(!_e74)break;var _n51=void 0,_h32=void 0,_l26=void 0,_o20=void 0,_u26=_e74.fromA,_f11=_e74.toA,_a8=_e74.fromB,_c7=_e74.toB;if(i&&i.range.fromB<_c7&&i.range.toB>_a8){var _t82=ai.build(this.view.state.doc,_a8,i.range.fromB,this.decorations,this.dynamicDecorationMap),_e75=ai.build(this.view.state.doc,i.range.toB,_c7,this.decorations,this.dynamicDecorationMap);_h32=_t82.breakAtStart,_l26=_t82.openStart,_o20=_e75.openEnd;var _s58=this.compositionView(i);_e75.breakAtStart?_s58.breakAfter=1:_e75.content.length&&_s58.merge(_s58.length,_s58.length,_e75.content[0],!1,_e75.openStart,0)&&(_s58.breakAfter=_e75.content[0].breakAfter,_e75.content.shift()),_t82.content.length&&_s58.merge(0,0,_t82.content[_t82.content.length-1],!0,0,_t82.openEnd)&&_t82.content.pop(),_n51=_t82.content.concat(_s58).concat(_e75.content);}else{var _ai$build=ai.build(this.view.state.doc,_a8,_c7,this.decorations,this.dynamicDecorationMap);_n51=_ai$build.content;_h32=_ai$build.breakAtStart;_l26=_ai$build.openStart;_o20=_ai$build.openEnd;}var _r$findPos=r.findPos(_f11,1),_d4=_r$findPos.i,_p3=_r$findPos.off,_r$findPos2=r.findPos(_u26,-1),_m=_r$findPos2.i,_g=_r$findPos2.off;Ee(this,_m,_g,_d4,_p3,_n51,_h32,_l26,_o20);}i&&this.fixCompositionDOM(i);}},{key:"compositionView",value:function compositionView(t){var e=new Fe(t.text.nodeValue);e.flags|=8;var _iterator45=_createForOfIteratorHelper(t.marks),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var _i77=_step45.value.deco;e=new qe(_i77,[e],e.length);}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}var i=new ei();return i.append(e,0),i;}},{key:"fixCompositionDOM",value:function fixCompositionDOM(t){var _this21=this;var e=function e(t,_e76){_e76.flags|=8|(_e76.children.some(function(t){return 7&t.flags;})?1:0),_this21.markedForComposition.add(_e76);var i=Ce.get(t);i&&i!=_e76&&(i.dom=null),_e76.setDOM(t);},i=this.childPos(t.range.fromB,1),s=this.children[i.i];e(t.line,s);for(var _r51=t.marks.length-1;_r51>=-1;_r51--)i=s.childPos(i.off,1),s=s.children[i.i],e(_r51>=0?t.marks[_r51].node:t.text,s);}},{key:"updateSelection",value:function updateSelection(){var _this22=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();var i=this.view.root.activeElement,s=i==this.dom,r=!s&&re(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||e||r))return;var n=this.forceSelection;this.forceSelection=!1;var h=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(h.anchor)),o=h.empty?l:this.moveToLine(this.domAtPos(h.head));if(Ve.gecko&&h.empty&&!this.hasComposition&&1==(u=l).node.nodeType&&u.node.firstChild&&(0==u.offset||"false"==u.node.childNodes[u.offset-1].contentEditable)&&(u.offset==u.node.childNodes.length||"false"==u.node.childNodes[u.offset].contentEditable)){var _t83=document.createTextNode("");this.view.observer.ignore(function(){return l.node.insertBefore(_t83,l.node.childNodes[l.offset]||null);}),l=o=new Se(_t83,0),n=!0;}var u;var f=this.view.observer.selectionRange;!n&&f.focusNode&&(he(l.node,l.offset,f.anchorNode,f.anchorOffset)&&he(o.node,o.offset,f.focusNode,f.focusOffset)||this.suppressWidgetCursorChange(f,h))||(this.view.observer.ignore(function(){Ve.android&&Ve.chrome&&_this22.dom.contains(f.focusNode)&&function(t,e){for(var _i78=t;_i78&&_i78!=e;_i78=_i78.assignedSlot||_i78.parentNode)if(1==_i78.nodeType&&"false"==_i78.contentEditable)return!0;return!1;}(f.focusNode,_this22.dom)&&(_this22.dom.blur(),_this22.dom.focus({preventScroll:!0}));var t=ie(_this22.view.root);if(t){if(h.empty){if(Ve.gecko){var _t84=(e=l.node,s=l.offset,1!=e.nodeType?0:(s&&"false"==e.childNodes[s-1].contentEditable?1:0)|(s<e.childNodes.length&&"false"==e.childNodes[s].contentEditable?2:0));if(_t84&&3!=_t84){var _e77=(1==_t84?Me:xe)(l.node,l.offset);_e77&&(l=new Se(_e77.node,_e77.offset));}}t.collapse(l.node,l.offset),null!=h.bidiLevel&&void 0!==t.caretBidiLevel&&(t.caretBidiLevel=h.bidiLevel);}else if(t.extend){t.collapse(l.node,l.offset);try{t.extend(o.node,o.offset);}catch(t){}}else{var _ref6;var _e78=document.createRange();h.anchor>h.head&&(_ref6=[o,l],l=_ref6[0],o=_ref6[1],_ref6),_e78.setEnd(o.node,o.offset),_e78.setStart(l.node,l.offset),t.removeAllRanges(),t.addRange(_e78);}}else;var e,s;r&&_this22.view.root.activeElement==_this22.dom&&(_this22.dom.blur(),i&&i.focus());}),this.view.observer.setSelectionRange(l,o)),this.impreciseAnchor=l.precise?null:new Se(f.anchorNode,f.anchorOffset),this.impreciseHead=o.precise?null:new Se(f.focusNode,f.focusOffset);}},{key:"suppressWidgetCursorChange",value:function suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&he(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head;}},{key:"enforceCursorAssoc",value:function enforceCursorAssoc(){if(this.hasComposition)return;var t=this.view,e=t.state.selection.main,i=ie(t.root),_t$observer$selection=t.observer.selectionRange,s=_t$observer$selection.anchorNode,r=_t$observer$selection.anchorOffset;if(!(i&&e.empty&&e.assoc&&i.modify))return;var n=ei.find(this,e.head);if(!n)return;var h=n.posAtStart;if(e.head==h||e.head==h+n.length)return;var l=this.coordsAt(e.head,-1),o=this.coordsAt(e.head,1);if(!l||!o||l.bottom>o.top)return;var u=this.domAtPos(e.head+e.assoc);i.collapse(u.node,u.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();var f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=e.from&&i.collapse(s,r);}},{key:"moveToLine",value:function moveToLine(t){var e,i=this.dom;if(t.node!=i)return t;for(var _s59=t.offset;!e&&_s59<i.childNodes.length;_s59++){var _t85=Ce.get(i.childNodes[_s59]);_t85 instanceof ei&&(e=_t85.domAtPos(0));}for(var _s60=t.offset-1;!e&&_s60>=0;_s60--){var _t86=Ce.get(i.childNodes[_s60]);_t86 instanceof ei&&(e=_t86.domAtPos(_t86.length));}return e?new Se(e.node,e.offset,!0):t;}},{key:"nearest",value:function nearest(t){for(var _e79=t;_e79;){var _t87=Ce.get(_e79);if(_t87&&_t87.rootView==this)return _t87;_e79=_e79.parentNode;}return null;}},{key:"posFromDOM",value:function posFromDOM(t,e){var i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart;}},{key:"domAtPos",value:function domAtPos(t){var _this$childCursor$fin=this.childCursor().findPos(t,-1),e=_this$childCursor$fin.i,i=_this$childCursor$fin.off;for(;e<this.children.length-1;){var _t88=this.children[e];if(i<_t88.length||_t88 instanceof ei)break;e++,i=0;}return this.children[e].domAtPos(i);}},{key:"coordsAt",value:function coordsAt(t,e){var i=null,s=0;for(var _r52=this.length,_n52=this.children.length-1;_n52>=0;_n52--){var _h33=this.children[_n52],_l27=_r52-_h33.breakAfter,_o21=_l27-_h33.length;if(_l27<t)break;_o21<=t&&(_o21<t||_h33.covers(-1))&&(_l27>t||_h33.covers(1))&&(!i||_h33 instanceof ei&&!(i instanceof ei&&e>=0))&&(i=_h33,s=_o21),_r52=_o21;}return i?i.coordsAt(t-s,e):null;}},{key:"coordsForChar",value:function coordsForChar(t){var _this$childPos2=this.childPos(t,1),e=_this$childPos2.i,i=_this$childPos2.off,s=this.children[e];if(!(s instanceof ei))return null;for(;s.children.length;){var _s$childPos=s.childPos(i,1),_t89=_s$childPos.i,_e80=_s$childPos.off;for(;;_t89++){if(_t89==s.children.length)return null;if((s=s.children[_t89]).length)break;}i=_e80;}if(!(s instanceof Fe))return null;var r=p(s.text,i);if(r==i)return null;var n=be(s.dom,i,r).getClientRects();for(var _t90=0;_t90<n.length;_t90++){var _e81=n[_t90];if(_t90==n.length-1||_e81.top<_e81.bottom&&_e81.left<_e81.right)return _e81;}return null;}},{key:"measureVisibleLineHeights",value:function measureVisibleLineHeights(t){var e=[],i=t.from,s=t.to,r=this.view.contentDOM.clientWidth,n=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,h=-1,l=this.view.textDirection==pi.LTR;for(var _t91=0,_o22=0;_o22<this.children.length;_o22++){var _u27=this.children[_o22],_f12=_t91+_u27.length;if(_f12>s)break;if(_t91>=i){var _i79=_u27.dom.getBoundingClientRect();if(e.push(_i79.height),n){var _e82=_u27.dom.lastChild,_s61=_e82?ne(_e82):[];if(_s61.length){var _e83=_s61[_s61.length-1],_n53=l?_e83.right-_i79.left:_i79.right-_e83.left;_n53>h&&(h=_n53,this.minWidth=r,this.minWidthFrom=_t91,this.minWidthTo=_f12);}}}_t91=_f12+_u27.breakAfter;}return e;}},{key:"textDirectionAt",value:function textDirectionAt(t){var _this$childPos3=this.childPos(t,1),e=_this$childPos3.i;return"rtl"==getComputedStyle(this.children[e].dom).direction?pi.RTL:pi.LTR;}},{key:"measureTextSize",value:function measureTextSize(){var _this23=this;var _iterator46=_createForOfIteratorHelper(this.children),_step46;try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){var _t92=_step46.value;if(_t92 instanceof ei){var _e84=_t92.measureTextSize();if(_e84)return _e84;}}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}var t,e,i,s=document.createElement("div");return s.className="cm-line",s.style.width="99999px",s.style.position="absolute",s.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(function(){_this23.dom.appendChild(s);var r=ne(s.firstChild)[0];t=s.getBoundingClientRect().height,e=r?r.width/27:7,i=r?r.height:t,s.remove();}),{lineHeight:t,charWidth:e,textHeight:i};}},{key:"childCursor",value:function childCursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.length;var e=this.children.length;return e&&(t-=this.children[--e].length),new De(this.children,t,e);}},{key:"computeBlockGapDeco",value:function computeBlockGapDeco(){var t=[],e=this.view.viewState;for(var _i80=0,_s62=0;;_s62++){var _r53=_s62==e.viewports.length?null:e.viewports[_s62],_n54=_r53?_r53.from-1:this.length;if(_n54>_i80){var _s63=(e.lineBlockAt(_n54).bottom-e.lineBlockAt(_i80).top)/this.view.scaleY;t.push(ni.replace({widget:new fs(_s63),block:!0,inclusive:!0,isBlockGap:!0}).range(_i80,_n54));}if(!_r53)break;_i80=_r53.to+1;}return ni.set(t);}},{key:"updateDeco",value:function updateDeco(){var _this24=this;var t=0,e=this.view.state.facet(Zi).map(function(e){return(_this24.dynamicDecorationMap[t++]="function"==typeof e)?e(_this24.view):e;}),i=!1,s=this.view.state.facet(ts).map(function(t,e){var s="function"==typeof t;return s&&(i=!0),s?t(_this24.view):t;});for(s.length&&(this.dynamicDecorationMap[t++]=i,e.push(It.join(s))),this.decorations=[].concat(_toConsumableArray(e),[this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]);t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;return this.decorations;}},{key:"scrollIntoView",value:function scrollIntoView(t){if(t.isSnapshot){var _e85=this.view.viewState.lineBlockAt(t.range.head);return this.view.scrollDOM.scrollTop=_e85.top-t.yMargin,void(this.view.scrollDOM.scrollLeft=t.xMargin);}var _iterator47=_createForOfIteratorHelper(this.view.state.facet(Vi)),_step47;try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){var _e88=_step47.value;try{if(_e88(this.view,t.range,t))return!0;}catch(t){Ui(this.view.state,t,"scroll handler");}}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}var e,i=t.range,s=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1);if(!s)return;!i.empty&&(e=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(s={left:Math.min(s.left,e.left),top:Math.min(s.top,e.top),right:Math.max(s.right,e.right),bottom:Math.max(s.bottom,e.bottom)});var r=ns(this.view),n={left:s.left-r.left,top:s.top-r.top,right:s.right+r.right,bottom:s.bottom+r.bottom},_this$view$scrollDOM=this.view.scrollDOM,h=_this$view$scrollDOM.offsetWidth,l=_this$view$scrollDOM.offsetHeight;!function(t,e,i,s,r,n,h,l){var o=t.ownerDocument,u=o.defaultView||window;for(var _f13=t,_a9=!1;_f13&&!_a9;)if(1==_f13.nodeType){var _t93=void 0,_c8=_f13==o.body,_d5=1,_p4=1;if(_c8)_t93=ce(u);else{var _de;if(/^(fixed|sticky)$/.test(getComputedStyle(_f13).position)&&(_a9=!0),_f13.scrollHeight<=_f13.clientHeight&&_f13.scrollWidth<=_f13.clientWidth){_f13=_f13.assignedSlot||_f13.parentNode;continue;}var _e86=_f13.getBoundingClientRect();(_de=de(_f13,_e86),_d5=_de.scaleX,_p4=_de.scaleY),_t93={left:_e86.left,right:_e86.left+_f13.clientWidth*_d5,top:_e86.top,bottom:_e86.top+_f13.clientHeight*_p4};}var _m2=0,_g2=0;if("nearest"==r)e.top<_t93.top?(_g2=-(_t93.top-e.top+h),i>0&&e.bottom>_t93.bottom+_g2&&(_g2=e.bottom-_t93.bottom+_g2+h)):e.bottom>_t93.bottom&&(_g2=e.bottom-_t93.bottom+h,i<0&&e.top-_g2<_t93.top&&(_g2=-(_t93.top+_g2-e.top+h)));else{var _s64=e.bottom-e.top,_n55=_t93.bottom-_t93.top;_g2=("center"==r&&_s64<=_n55?e.top+_s64/2-_n55/2:"start"==r||"center"==r&&i<0?e.top-h:e.bottom-_n55+h)-_t93.top;}if("nearest"==s?e.left<_t93.left?(_m2=-(_t93.left-e.left+n),i>0&&e.right>_t93.right+_m2&&(_m2=e.right-_t93.right+_m2+n)):e.right>_t93.right&&(_m2=e.right-_t93.right+n,i<0&&e.left<_t93.left+_m2&&(_m2=-(_t93.left+_m2-e.left+n))):_m2=("center"==s?e.left+(e.right-e.left)/2-(_t93.right-_t93.left)/2:"start"==s==l?e.left-n:e.right-(_t93.right-_t93.left)+n)-_t93.left,_m2||_g2)if(_c8)u.scrollBy(_m2,_g2);else{var _t94=0,_i81=0;if(_g2){var _t95=_f13.scrollTop;_f13.scrollTop+=_g2/_p4,_i81=(_f13.scrollTop-_t95)*_p4;}if(_m2){var _e87=_f13.scrollLeft;_f13.scrollLeft+=_m2/_d5,_t94=(_f13.scrollLeft-_e87)*_d5;}e={left:e.left-_t94,top:e.top-_i81,right:e.right-_t94,bottom:e.bottom-_i81},_t94&&Math.abs(_t94-_m2)<1&&(s="nearest"),_i81&&Math.abs(_i81-_g2)<1&&(r="nearest");}if(_c8)break;_f13=_f13.assignedSlot||_f13.parentNode;}else{if(11!=_f13.nodeType)break;_f13=_f13.host;}}(this.view.scrollDOM,n,i.head<i.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,h),-h),Math.max(Math.min(t.yMargin,l),-l),this.view.textDirection==pi.LTR);}}]);}(Ce);fs=/*#__PURE__*/function(_si2){function fs(t){var _this25;_classCallCheck(this,fs);_this25=_callSuper(this,fs),_this25.height=t;return _this25;}_inherits(fs,_si2);return _createClass(fs,[{key:"toDOM",value:function toDOM(){var t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t;}},{key:"eq",value:function eq(t){return t.height==this.height;}},{key:"updateDOM",value:function updateDOM(t){return t.style.height=this.height+"px",!0;}},{key:"editable",get:function get(){return!0;}},{key:"estimatedHeight",get:function get(){return this.height;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);cs=/*#__PURE__*/function(){function cs(){_classCallCheck(this,cs);this.changes=[];}return _createClass(cs,[{key:"compareRange",value:function compareRange(t,e){fi(t,e,this.changes);}},{key:"comparePoint",value:function comparePoint(t,e){fi(t,e,this.changes);}}]);}();Cs=/*#__PURE__*/function(){function Cs(t){_classCallCheck(this,Cs);this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,Ve.safari&&t.contentDOM.addEventListener("input",function(){return null;}),Ve.gecko&&function(t){Zs.has(t)||(Zs.add(t),t.addEventListener("copy",function(){}),t.addEventListener("cut",function(){}));}(t.contentDOM.ownerDocument);}return _createClass(Cs,[{key:"setSelectionOrigin",value:function setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now();}},{key:"handleEvent",value:function handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var _i83,_s67=e.target;_s67!=t.contentDOM;_s67=_s67.parentNode)if(!_s67||11==_s67.nodeType||(_i83=Ce.get(_s67))&&_i83.ignoreEvent(e))return!1;return!0;})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||this.runHandlers(t.type,t));}},{key:"runHandlers",value:function runHandlers(t,e){var i=this.handlers[t];if(i){var _iterator50=_createForOfIteratorHelper(i.observers),_step50;try{for(_iterator50.s();!(_step50=_iterator50.n()).done;){var _t103=_step50.value;_t103(this.view,e);}}catch(err){_iterator50.e(err);}finally{_iterator50.f();}var _iterator51=_createForOfIteratorHelper(i.handlers),_step51;try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){var _t104=_step51.value;if(e.defaultPrevented)break;if(_t104(this.view,e)){e.preventDefault();break;}}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}}}},{key:"ensureHandlers",value:function ensureHandlers(t){var e=Ds(t),i=this.handlers,s=this.view.contentDOM;for(var _t105 in e)if("scroll"!=_t105){var _r56=!e[_t105].handlers.length,_n57=i[_t105];_n57&&_r56!=!_n57.handlers.length&&(s.removeEventListener(_t105,this.handleEvent),_n57=null),_n57||s.addEventListener(_t105,this.handleEvent,{passive:_r56});}for(var _t106 in i)"scroll"==_t106||e[_t106]||s.removeEventListener(_t106,this.handleEvent);this.handlers=e;}},{key:"keydown",value:function keydown(t){var _this26=this;if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&Date.now()<this.lastEscPress+2e3)return!0;if(27!=t.keyCode&&Rs.indexOf(t.keyCode)<0&&(this.view.inputState.lastEscPress=0),Ve.android&&Ve.chrome&&!t.synthetic&&(13==t.keyCode||8==t.keyCode))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;var e;return!Ve.ios||t.synthetic||t.altKey||t.metaKey||!((e=Es.find(function(e){return e.keyCode==t.keyCode;}))&&!t.ctrlKey||Is.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout(function(){return _this26.flushIOSKey();},250),!0);}},{key:"flushIOSKey",value:function flushIOSKey(t){var e=this.pendingIOSKey;return!!e&&!("Enter"==e.key&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString()))&&(this.pendingIOSKey=void 0,ve(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0));}},{key:"ignoreDuringComposition",value:function ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Ve.safari&&!Ve.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0));}},{key:"startMouseSelection",value:function startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t;}},{key:"update",value:function update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0);}},{key:"destroy",value:function destroy(){this.mouseSelection&&this.mouseSelection.destroy();}}]);}();Es=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}];Is="dthko";Rs=[16,17,18,20,91,92,224,225];Bs=/*#__PURE__*/function(){function Bs(t,e,i,s){_classCallCheck(this,Bs);this.view=t,this.startEvent=e,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=function(t){var e=t.ownerDocument;for(var _i84=t.parentNode;_i84&&_i84!=e.body;)if(1==_i84.nodeType){if(_i84.scrollHeight>_i84.clientHeight||_i84.scrollWidth>_i84.clientWidth)return _i84;_i84=_i84.assignedSlot||_i84.parentNode;}else{if(11!=_i84.nodeType)break;_i84=_i84.host;}return null;}(t.contentDOM),this.atoms=t.state.facet(es).map(function(e){return e(t);});var r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(St.allowMultipleSelections)&&function(t,e){var i=t.state.facet(Bi);return i.length?i[0](e):Ve.mac?e.metaKey:e.ctrlKey;}(t,e),this.dragging=!(!function(t,e){var i=t.state.selection.main;if(i.empty)return!1;var s=ie(t.root);if(!s||0==s.rangeCount)return!0;var r=s.getRangeAt(0).getClientRects();for(var _t110=0;_t110<r.length;_t110++){var _i85=r[_t110];if(_i85.left<=e.clientX&&_i85.right>=e.clientX&&_i85.top<=e.clientY&&_i85.bottom>=e.clientY)return!0;}return!1;}(t,e)||1!=Gs(e))&&null;}return _createClass(Bs,[{key:"start",value:function start(t){!1===this.dragging&&this.select(t);}},{key:"move",value:function move(t){var e,i,s;if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(i=this.startEvent,s=t,Math.max(Math.abs(i.clientX-s.clientX),Math.abs(i.clientY-s.clientY))<10))return;this.select(this.lastEvent=t);var r=0,n=0,h=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},l=ns(this.view);t.clientX-l.left<=h.left+6?r=-Ts(h.left-t.clientX):t.clientX+l.right>=h.right-6&&(r=Ts(t.clientX-h.right)),t.clientY-l.top<=h.top+6?n=-Ts(h.top-t.clientY):t.clientY+l.bottom>=h.bottom-6&&(n=Ts(t.clientY-h.bottom)),this.setScrollSpeed(r,n);}},{key:"up",value:function up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy();}},{key:"destroy",value:function destroy(){this.setScrollSpeed(0,0);var t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null;}},{key:"setScrollSpeed",value:function setScrollSpeed(t,e){var _this27=this;this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(function(){return _this27.scroll();},50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1);}},{key:"scroll",value:function scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent);}},{key:"skipAtoms",value:function skipAtoms(t){var e=null;for(var _i86=0;_i86<t.ranges.length;_i86++){var _s70=t.ranges[_i86],_r59=null;if(_s70.empty){var _t111=Ss(this.atoms,_s70.from,0);_t111!=_s70.from&&(_r59=B.cursor(_t111,-1));}else{var _t112=Ss(this.atoms,_s70.from,-1),_e98=Ss(this.atoms,_s70.to,1);_t112==_s70.from&&_e98==_s70.to||(_r59=B.range(_s70.from==_s70.anchor?_t112:_e98,_s70.from==_s70.head?_t112:_e98));}_r59&&(e||(e=t.ranges.slice()),e[_i86]=_r59);}return e?B.create(e,t.mainIndex):t;}},{key:"select",value:function select(t){var e=this.view,i=this.skipAtoms(this.style.get(t,this.extend,this.multiple));!this.mustSelect&&i.eq(e.state.selection,!1===this.dragging)||this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1;}},{key:"update",value:function update(t){var _this28=this;this.style.update(t)&&setTimeout(function(){return _this28.select(_this28.lastEvent);},20);}}]);}();Ls=Object.create(null);Ns=Object.create(null);js=Ve.ie&&Ve.ie_version<15||Ve.ios&&Ve.webkit_version<604;Ns.scroll=function(t){t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft;},Ls.keydown=function(t,e){return t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now()),!1;},Ns.touchstart=function(t,e){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer");},Ns.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer");},Ls.mousedown=function(t,e){if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;var i=null;var _iterator53=_createForOfIteratorHelper(t.state.facet(Ni)),_step53;try{for(_iterator53.s();!(_step53=_iterator53.n()).done;){var _s74=_step53.value;if(i=_s74(t,e),i)break;}}catch(err){_iterator53.e(err);}finally{_iterator53.f();}if(i||0!=e.button||(i=function(t,e){var i=Vs(t,e),s=Gs(e),r=t.state.selection;return{update:function update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),r=r.map(t.changes));},get:function get(e,n,h){var l,o=Vs(t,e),u=zs(t,o.pos,o.bias,s);if(i.pos!=o.pos&&!n){var _e99=zs(t,i.pos,i.bias,s),_r61=Math.min(_e99.from,u.from),_n59=Math.max(_e99.to,u.to);u=_r61<u.from?B.range(_r61,_n59):B.range(_n59,_r61);}return n?r.replaceRange(r.main.extend(u.from,u.to)):h&&1==s&&r.ranges.length>1&&(l=function(t,e){for(var _i88=0;_i88<t.ranges.length;_i88++){var _t$ranges$_i=t.ranges[_i88],_s72=_t$ranges$_i.from,_r62=_t$ranges$_i.to;if(_s72<=e&&_r62>=e)return B.create(t.ranges.slice(0,_i88).concat(t.ranges.slice(_i88+1)),t.mainIndex==_i88?0:t.mainIndex-(t.mainIndex>_i88?1:0));}return null;}(r,o.pos))?l:h?r.addRange(u):B.create([u]);}};}(t,e)),i){var _s73=!t.hasFocus;t.inputState.startMouseSelection(new Bs(t,e,i,_s73)),_s73&&t.observer.ignore(function(){return we(t.contentDOM);});var _r63=t.inputState.mouseSelection;if(_r63)return _r63.start(e),!1===_r63.dragging;}return!1;};Ps=function Ps(t,e){return t>=e.top&&t<=e.bottom;};Hs=function Hs(t,e,i){return Ps(e,i)&&t>=i.left&&t<=i.right;};Fs=Ve.ie&&Ve.ie_version<=11;qs=null;Us=0;Js=0;Ls.dragstart=function(t,e){var i=t.state.selection.main;if(e.target.draggable){var _s75=t.docView.nearest(e.target);if(_s75&&_s75.isWidget){var _t116=_s75.posAtStart,_e100=_t116+_s75.length;(_t116>=i.to||_e100<=i.from)&&(i=B.range(_t116,_e100));}}var s=t.inputState;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove"),!1;},Ls.dragend=function(t){return t.inputState.draggedContent=null,!1;},Ls.drop=function(t,e){if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;var i=e.dataTransfer.files;if(i&&i.length){var _s76=Array(i.length),_r64=0,_n60=function _n60(){++_r64==i.length&&Ks(t,e,_s76.filter(function(t){return null!=t;}).join(t.state.lineBreak),!1);};var _loop6=function _loop6(_t117){var e=new FileReader();e.onerror=_n60,e.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(_s76[_t117]=e.result),_n60();},e.readAsText(i[_t117]);};for(var _t117=0;_t117<i.length;_t117++){_loop6(_t117);}return!0;}{var _i89=e.dataTransfer.getData("Text");if(_i89)return Ks(t,e,_i89,!0),!0;}return!1;},Ls.paste=function(t,e){if(t.state.readOnly)return!0;t.observer.flush();var i=js?null:e.clipboardData;return i?($s(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(function(t){var e=t.dom.parentNode;if(!e)return;var i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(function(){t.focus(),i.remove(),$s(t,i.value);},50);}(t),!1);};_s=null;Ls.copy=Ls.cut=function(t,e){var _ref7=function(t){var e=[],i=[],s=!1;var _iterator54=_createForOfIteratorHelper(t.selection.ranges),_step54;try{for(_iterator54.s();!(_step54=_iterator54.n()).done;){var _s78=_step54.value;_s78.empty||(e.push(t.sliceDoc(_s78.from,_s78.to)),i.push(_s78));}}catch(err){_iterator54.e(err);}finally{_iterator54.f();}if(!e.length){var _r65=-1;var _iterator55=_createForOfIteratorHelper(t.selection.ranges),_step55;try{for(_iterator55.s();!(_step55=_iterator55.n()).done;){var _s77=_step55.value.from;var _n61=t.doc.lineAt(_s77);_n61.number>_r65&&(e.push(_n61.text),i.push({from:_n61.from,to:Math.min(t.doc.length,_n61.to+1)})),_r65=_n61.number;}}catch(err){_iterator55.e(err);}finally{_iterator55.f();}s=!0;}return{text:e.join(t.lineBreak),ranges:i,linewise:s};}(t.state),i=_ref7.text,s=_ref7.ranges,r=_ref7.linewise;if(!i&&!r)return!1;_s=r?i:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});var n=js?null:e.clipboardData;return n?(n.clearData(),n.setData("text/plain",i),!0):(function(t,e){var i=t.dom.parentNode;if(!i)return;var s=i.appendChild(document.createElement("textarea"));s.style.cssText="position: fixed; left: -10000px; top: 10px",s.value=e,s.focus(),s.selectionEnd=e.length,s.selectionStart=0,setTimeout(function(){s.remove(),t.focus();},50);}(t,i),!1);};Xs=ut.define();Ns.focus=function(t){t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Qs(t);},Ns.blur=function(t){t.observer.clearSelectionRange(),Qs(t);},Ns.compositionstart=Ns.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0);},Ns.compositionend=function(t){t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Ve.chrome&&Ve.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(function(){return t.observer.flush();}):setTimeout(function(){t.inputState.composing<0&&t.docView.hasComposition&&t.update([]);},50);},Ns.contextmenu=function(t){t.inputState.lastContextMenu=Date.now();},Ls.beforeinput=function(t,e){var i;var s;if(Ve.chrome&&Ve.android&&(s=Es.find(function(t){return t.inputType==e.inputType;}))&&(t.observer.delayAndroidKey(s.key,s.keyCode),"Backspace"==s.key||"Delete"==s.key)){var _e101=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout(function(){var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>_e101+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus());},100);}return Ve.ios&&"deleteContentForward"==e.inputType&&t.observer.flushSoon(),Ve.safari&&"insertText"==e.inputType&&t.inputState.composing>=0&&setTimeout(function(){return Ns.compositionend(t,e);},20),!1;};Zs=new Set();tr=["pre-wrap","normal","pre-line","break-spaces"];er=/*#__PURE__*/function(){function er(e){_classCallCheck(this,er);this.lineWrapping=e,this.doc=t.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1;}return _createClass(er,[{key:"heightForGap",value:function heightForGap(t,e){var i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i;}},{key:"heightForLine",value:function heightForLine(t){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight;}},{key:"setDoc",value:function setDoc(t){return this.doc=t,this;}},{key:"mustRefreshForWrapping",value:function mustRefreshForWrapping(t){return tr.indexOf(t)>-1!=this.lineWrapping;}},{key:"mustRefreshForHeights",value:function mustRefreshForHeights(t){var e=!1;for(var _i91=0;_i91<t.length;_i91++){var _s80=t[_i91];_s80<0?_i91++:this.heightSamples[Math.floor(10*_s80)]||(e=!0,this.heightSamples[Math.floor(10*_s80)]=!0);}return e;}},{key:"refresh",value:function refresh(t,e,i,s,r,n){var h=tr.indexOf(t)>-1,l=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=h;if(this.lineWrapping=h,this.lineHeight=e,this.charWidth=i,this.textHeight=s,this.lineLength=r,l){this.heightSamples={};for(var _t118=0;_t118<n.length;_t118++){var _e102=n[_t118];_e102<0?_t118++:this.heightSamples[Math.floor(10*_e102)]=!0;}}return l;}}]);}();ir=/*#__PURE__*/function(){function ir(t,e){_classCallCheck(this,ir);this.from=t,this.heights=e,this.index=0;}return _createClass(ir,[{key:"more",get:function get(){return this.index<this.heights.length;}}]);}();sr=/*#__PURE__*/function(){function sr(t,e,i,s,r){_classCallCheck(this,sr);this.from=t,this.length=e,this.top=i,this.height=s,this._content=r;}return _createClass(sr,[{key:"type",get:function get(){return"number"==typeof this._content?ri.Text:Array.isArray(this._content)?this._content:this._content.type;}},{key:"to",get:function get(){return this.from+this.length;}},{key:"bottom",get:function get(){return this.top+this.height;}},{key:"widget",get:function get(){return this._content instanceof oi?this._content.widget:null;}},{key:"widgetLineBreaks",get:function get(){return"number"==typeof this._content?this._content:0;}},{key:"join",value:function join(t){var e=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new sr(this.from,this.length+t.length,this.top,this.height+t.height,e);}}]);}();rr=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t;}(rr||(rr={}));nr=.001;hr=/*#__PURE__*/function(){function hr(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:2;_classCallCheck(this,hr);this.length=t,this.height=e,this.flags=i;}return _createClass(hr,[{key:"outdated",get:function get(){return(2&this.flags)>0;},set:function set(t){this.flags=(t?2:0)|-3&this.flags;}},{key:"setHeight",value:function setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>nr&&(t.heightChanged=!0),this.height=e);}},{key:"replace",value:function replace(t,e,i){return hr.of(i);}},{key:"decomposeLeft",value:function decomposeLeft(t,e){e.push(this);}},{key:"decomposeRight",value:function decomposeRight(t,e){e.push(this);}},{key:"applyChanges",value:function applyChanges(t,e,i,s){var r=this,n=i.doc;for(var _h34=s.length-1;_h34>=0;_h34--){var _s$_h=s[_h34],_l31=_s$_h.fromA,_o25=_s$_h.toA,_u30=_s$_h.fromB,_f15=_s$_h.toB,_a10=r.lineAt(_l31,rr.ByPosNoHeight,i.setDoc(e),0,0),_c10=_a10.to>=_o25?_a10:r.lineAt(_o25,rr.ByPosNoHeight,i,0,0);for(_f15+=_c10.to-_o25,_o25=_c10.to;_h34>0&&_a10.from<=s[_h34-1].toA;)_l31=s[_h34-1].fromA,_u30=s[_h34-1].fromB,_h34--,_l31<_a10.from&&(_a10=r.lineAt(_l31,rr.ByPosNoHeight,i,0,0));_u30+=_a10.from-_l31,_l31=_a10.from;var _d7=cr.build(i.setDoc(n),t,_u30,_f15);r=r.replace(_l31,_o25,_d7);}return r.updateHeight(i,0);}}],[{key:"empty",value:function empty(){return new or(0,0);}},{key:"of",value:function of(t){if(1==t.length)return t[0];var e=0,i=t.length,s=0,r=0;for(;;)if(e==i){if(s>2*r){var _r67=t[e-1];_r67["break"]?t.splice(--e,1,_r67.left,null,_r67.right):t.splice(--e,1,_r67.left,_r67.right),i+=1+_r67["break"],s-=_r67.size;}else{if(!(r>2*s))break;{var _e103=t[i];_e103["break"]?t.splice(i,1,_e103.left,null,_e103.right):t.splice(i,1,_e103.left,_e103.right),i+=2+_e103["break"],r-=_e103.size;}}}else if(s<r){var _i92=t[e++];_i92&&(s+=_i92.size);}else{var _e104=t[--i];_e104&&(r+=_e104.size);}var n=0;return null==t[e-1]?(n=1,e--):null==t[e]&&(n=1,i++),new fr(hr.of(t.slice(0,e)),n,hr.of(t.slice(i)));}}]);}();hr.prototype.size=1;lr=/*#__PURE__*/function(_hr){function lr(t,e,i){var _this29;_classCallCheck(this,lr);_this29=_callSuper(this,lr,[t,e]),_this29.deco=i;return _this29;}_inherits(lr,_hr);return _createClass(lr,[{key:"blockAt",value:function blockAt(t,e,i,s){return new sr(s,this.length,i,this.height,this.deco||0);}},{key:"lineAt",value:function lineAt(t,e,i,s,r){return this.blockAt(0,i,s,r);}},{key:"forEachLine",value:function forEachLine(t,e,i,s,r,n){t<=r+this.length&&e>=r&&n(this.blockAt(0,i,s,r));}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;return s&&s.from<=e&&s.more&&this.setHeight(t,s.heights[s.index++]),this.outdated=!1,this;}},{key:"toString",value:function toString(){return"block(".concat(this.length,")");}}]);}(hr);or=/*#__PURE__*/function(_lr){function or(t,e){var _this30;_classCallCheck(this,or);_this30=_callSuper(this,or,[t,e,null]),_this30.collapsed=0,_this30.widgetHeight=0,_this30.breaks=0;return _this30;}_inherits(or,_lr);return _createClass(or,[{key:"blockAt",value:function blockAt(t,e,i,s){return new sr(s,this.length,i,this.height,this.breaks);}},{key:"replace",value:function replace(t,e,i){var s=i[0];return 1==i.length&&(s instanceof or||s instanceof ur&&4&s.flags)&&Math.abs(this.length-s.length)<10?(s instanceof ur?s=new or(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):hr.of(i);}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;return s&&s.from<=e&&s.more?this.setHeight(t,s.heights[s.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this;}},{key:"toString",value:function toString(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")");}}]);}(lr);ur=/*#__PURE__*/function(_hr2){function ur(t){_classCallCheck(this,ur);return _callSuper(this,ur,[t,0]);}_inherits(ur,_hr2);return _createClass(ur,[{key:"heightMetrics",value:function heightMetrics(t,e){var i,s=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,n=r-s+1,h=0;if(t.lineWrapping){var _e105=Math.min(this.height,t.lineHeight*n);i=_e105/n,this.length>n+1&&(h=(this.height-_e105)/(this.length-n-1));}else i=this.height/n;return{firstLine:s,lastLine:r,perLine:i,perChar:h};}},{key:"blockAt",value:function blockAt(t,e,i,s){var _this$heightMetrics=this.heightMetrics(e,s),r=_this$heightMetrics.firstLine,n=_this$heightMetrics.lastLine,h=_this$heightMetrics.perLine,l=_this$heightMetrics.perChar;if(e.lineWrapping){var _r68=s+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length)),_n62=e.doc.lineAt(_r68),_o26=h+_n62.length*l,_u31=Math.max(i,t-_o26/2);return new sr(_n62.from,_n62.length,_u31,_o26,0);}{var _s81=Math.max(0,Math.min(n-r,Math.floor((t-i)/h))),_e$doc$line=e.doc.line(r+_s81),_l32=_e$doc$line.from,_o27=_e$doc$line.length;return new sr(_l32,_o27,i+h*_s81,h,0);}}},{key:"lineAt",value:function lineAt(t,e,i,s,r){if(e==rr.ByHeight)return this.blockAt(t,i,s,r);if(e==rr.ByPosNoHeight){var _i$doc$lineAt=i.doc.lineAt(t),_e106=_i$doc$lineAt.from,_s82=_i$doc$lineAt.to;return new sr(_e106,_s82-_e106,0,0,0);}var _this$heightMetrics2=this.heightMetrics(i,r),n=_this$heightMetrics2.firstLine,h=_this$heightMetrics2.perLine,l=_this$heightMetrics2.perChar,o=i.doc.lineAt(t),u=h+o.length*l,f=o.number-n,a=s+h*f+l*(o.from-r-f);return new sr(o.from,o.length,Math.max(s,Math.min(a,s+this.height-u)),u,0);}},{key:"forEachLine",value:function forEachLine(t,e,i,s,r,n){t=Math.max(t,r),e=Math.min(e,r+this.length);var _this$heightMetrics3=this.heightMetrics(i,r),h=_this$heightMetrics3.firstLine,l=_this$heightMetrics3.perLine,o=_this$heightMetrics3.perChar;for(var _u32=t,_f16=s;_u32<=e;){var _e107=i.doc.lineAt(_u32);if(_u32==t){var _i93=_e107.number-h;_f16+=l*_i93+o*(t-r-_i93);}var _s83=l+o*_e107.length;n(new sr(_e107.from,_e107.length,_f16,_s83,0)),_f16+=_s83,_u32=_e107.to+1;}}},{key:"replace",value:function replace(t,e,i){var s=this.length-e;if(s>0){var _t119=i[i.length-1];_t119 instanceof ur?i[i.length-1]=new ur(_t119.length+s):i.push(null,new ur(s-1));}if(t>0){var _e108=i[0];_e108 instanceof ur?i[0]=new ur(t+_e108.length):i.unshift(new ur(t-1),null);}return hr.of(i);}},{key:"decomposeLeft",value:function decomposeLeft(t,e){e.push(new ur(t-1),null);}},{key:"decomposeRight",value:function decomposeRight(t,e){e.push(null,new ur(this.length-t-1));}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;var r=e+this.length;if(s&&s.from<=e+this.length&&s.more){var _i94=[],_n63=Math.max(e,s.from),_h35=-1;for(s.from>e&&_i94.push(new ur(s.from-e-1).updateHeight(t,e));_n63<=r&&s.more;){var _e109=t.doc.lineAt(_n63).length;_i94.length&&_i94.push(null);var _r69=s.heights[s.index++];-1==_h35?_h35=_r69:Math.abs(_r69-_h35)>=nr&&(_h35=-2);var _l33=new or(_e109,_r69);_l33.outdated=!1,_i94.push(_l33),_n63+=_e109+1;}_n63<=r&&_i94.push(null,new ur(r-_n63).updateHeight(t,_n63));var _l34=hr.of(_i94);return(_h35<0||Math.abs(_l34.height-this.height)>=nr||Math.abs(_h35-this.heightMetrics(t,e).perLine)>=nr)&&(t.heightChanged=!0),_l34;}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this;}},{key:"toString",value:function toString(){return"gap(".concat(this.length,")");}}]);}(hr);fr=/*#__PURE__*/function(_hr3){function fr(t,e,i){var _this31;_classCallCheck(this,fr);_this31=_callSuper(this,fr,[t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)]),_this31.left=t,_this31.right=i,_this31.size=t.size+i.size;return _this31;}_inherits(fr,_hr3);return _createClass(fr,[{key:"break",get:function get(){return 1&this.flags;}},{key:"blockAt",value:function blockAt(t,e,i,s){var r=i+this.left.height;return t<r?this.left.blockAt(t,e,i,s):this.right.blockAt(t,e,r,s+this.left.length+this["break"]);}},{key:"lineAt",value:function lineAt(t,e,i,s,r){var n=s+this.left.height,h=r+this.left.length+this["break"],l=e==rr.ByHeight?t<n:t<h,o=l?this.left.lineAt(t,e,i,s,r):this.right.lineAt(t,e,i,n,h);if(this["break"]||(l?o.to<h:o.from>h))return o;var u=e==rr.ByPosNoHeight?rr.ByPosNoHeight:rr.ByPos;return l?o.join(this.right.lineAt(h,u,i,n,h)):this.left.lineAt(h,u,i,s,r).join(o);}},{key:"forEachLine",value:function forEachLine(t,e,i,s,r,n){var h=s+this.left.height,l=r+this.left.length+this["break"];if(this["break"])t<l&&this.left.forEachLine(t,e,i,s,r,n),e>=l&&this.right.forEachLine(t,e,i,h,l,n);else{var _o28=this.lineAt(l,rr.ByPos,i,s,r);t<_o28.from&&this.left.forEachLine(t,_o28.from-1,i,s,r,n),_o28.to>=t&&_o28.from<=e&&n(_o28),e>_o28.to&&this.right.forEachLine(_o28.to+1,e,i,h,l,n);}}},{key:"replace",value:function replace(t,e,i){var s=this.left.length+this["break"];if(e<s)return this.balanced(this.left.replace(t,e,i),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-s,e-s,i));var r=[];t>0&&this.decomposeLeft(t,r);var n=r.length;var _iterator57=_createForOfIteratorHelper(i),_step57;try{for(_iterator57.s();!(_step57=_iterator57.n()).done;){var _t121=_step57.value;r.push(_t121);}}catch(err){_iterator57.e(err);}finally{_iterator57.f();}if(t>0&&ar(r,n-1),e<this.length){var _t120=r.length;this.decomposeRight(e,r),ar(r,_t120);}return hr.of(r);}},{key:"decomposeLeft",value:function decomposeLeft(t,e){var i=this.left.length;if(t<=i)return this.left.decomposeLeft(t,e);e.push(this.left),this["break"]&&(i++,t>=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e);}},{key:"decomposeRight",value:function decomposeRight(t,e){var i=this.left.length,s=i+this["break"];if(t>=s)return this.right.decomposeRight(t-s,e);t<i&&this.left.decomposeRight(t,e),this["break"]&&t<s&&e.push(null),e.push(this.right);}},{key:"balanced",value:function balanced(t,e){return t.size>2*e.size||e.size>2*t.size?hr.of(this["break"]?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this["break"]+e.length,this);}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;var r=this.left,n=this.right,h=e+r.length+this["break"],l=null;return s&&s.from<=e+r.length&&s.more?l=r=r.updateHeight(t,e,i,s):r.updateHeight(t,e,i),s&&s.from<=h+n.length&&s.more?l=n=n.updateHeight(t,h,i,s):n.updateHeight(t,h,i),l?this.balanced(r,n):(this.height=this.left.height+this.right.height,this.outdated=!1,this);}},{key:"toString",value:function toString(){return this.left+(this["break"]?" ":"-")+this.right;}}]);}(hr);cr=/*#__PURE__*/function(){function cr(t,e){_classCallCheck(this,cr);this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t;}return _createClass(cr,[{key:"isCovered",get:function get(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering;}},{key:"span",value:function span(t,e){if(this.lineStart>-1){var _t122=Math.min(e,this.lineEnd),_i95=this.nodes[this.nodes.length-1];_i95 instanceof or?_i95.length+=_t122-this.pos:(_t122>this.pos||!this.isCovered)&&this.nodes.push(new or(_t122-this.pos,-1)),this.writtenTo=_t122,e>_t122&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1);}this.pos=e;}},{key:"point",value:function point(t,e,i){if(t<e||i.heightRelevant){var _s84=i.widget?i.widget.estimatedHeight:0,_r70=i.widget?i.widget.lineBreaks:0;_s84<0&&(_s84=this.oracle.lineHeight);var _n64=e-t;i.block?this.addBlock(new lr(_n64,_s84,i)):(_n64||_r70||_s84>=5)&&this.addLineDeco(_s84,_r70,_n64);}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to);}},{key:"enterLine",value:function enterLine(){if(this.lineStart>-1)return;var _this$oracle$doc$line=this.oracle.doc.lineAt(this.pos),t=_this$oracle$doc$line.from,e=_this$oracle$doc$line.to;this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new or(this.pos-t,-1)),this.writtenTo=this.pos;}},{key:"blankContent",value:function blankContent(t,e){var i=new ur(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i;}},{key:"ensureLine",value:function ensureLine(){this.enterLine();var t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof or)return t;var e=new or(0,-1);return this.nodes.push(e),e;}},{key:"addBlock",value:function addBlock(t){this.enterLine();var e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t);}},{key:"addLineDeco",value:function addLineDeco(t,e,i){var s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,t),s.breaks+=e,this.writtenTo=this.pos=this.pos+i;}},{key:"finish",value:function finish(t){var e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof or||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new or(0,-1));var i=t;var _iterator58=_createForOfIteratorHelper(this.nodes),_step58;try{for(_iterator58.s();!(_step58=_iterator58.n()).done;){var _t123=_step58.value;_t123 instanceof or&&_t123.updateHeight(this.oracle,i),i+=_t123?_t123.length:1;}}catch(err){_iterator58.e(err);}finally{_iterator58.f();}return this.nodes;}}],[{key:"build",value:function build(t,e,i,s){var r=new cr(i,t);return It.spans(e,i,s,r,0),r.finish(i);}}]);}();dr=/*#__PURE__*/function(){function dr(){_classCallCheck(this,dr);this.changes=[];}return _createClass(dr,[{key:"compareRange",value:function compareRange(){}},{key:"comparePoint",value:function comparePoint(t,e,i,s){(t<e||i&&i.heightRelevant||s&&s.heightRelevant)&&fi(t,e,this.changes,5);}}]);}();gr=/*#__PURE__*/function(){function gr(t,e,i){_classCallCheck(this,gr);this.from=t,this.to=e,this.size=i;}return _createClass(gr,[{key:"draw",value:function draw(t,e){return ni.replace({widget:new wr(this.size*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to);}}],[{key:"same",value:function same(t,e){if(t.length!=e.length)return!1;for(var _i97=0;_i97<t.length;_i97++){var _s87=t[_i97],_r71=e[_i97];if(_s87.from!=_r71.from||_s87.to!=_r71.to||_s87.size!=_r71.size)return!1;}return!0;}}]);}();wr=/*#__PURE__*/function(_si3){function wr(t,e){var _this32;_classCallCheck(this,wr);_this32=_callSuper(this,wr),_this32.size=t,_this32.vertical=e;return _this32;}_inherits(wr,_si3);return _createClass(wr,[{key:"eq",value:function eq(t){return t.size==this.size&&t.vertical==this.vertical;}},{key:"toDOM",value:function toDOM(){var t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t;}},{key:"estimatedHeight",get:function get(){return this.vertical?this.size:-1;}}]);}(si);br=/*#__PURE__*/function(){function br(e){var _this33=this;_classCallCheck(this,br);this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=xr,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=pi.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;var i=e.facet(Qi).some(function(t){return"function"!=typeof t&&"cm-lineWrapping"==t["class"];});this.heightOracle=new er(i),this.stateDeco=e.facet(Zi).filter(function(t){return"function"!=typeof t;}),this.heightMap=hr.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new ls(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map(function(t){return t.draw(_this33,!1);})),this.computeVisibleRanges();}return _createClass(br,[{key:"updateForViewport",value:function updateForViewport(){var _this34=this;var t=[this.viewport],e=this.state.selection.main;var _loop7=function _loop7(){var s=_i98?e.head:e.anchor;if(!t.some(function(_ref8){var t=_ref8.from,e=_ref8.to;return s>=t&&s<=e;})){var _this34$lineBlockAt=_this34.lineBlockAt(s),_e111=_this34$lineBlockAt.from,_i99=_this34$lineBlockAt.to;t.push(new vr(_e111,_i99));}};for(var _i98=0;_i98<=1;_i98++){_loop7();}this.viewports=t.sort(function(t,e){return t.from-e.from;}),this.scaler=this.heightMap.height<=7e6?xr:new Sr(this.heightOracle,this.heightMap,this.viewports);}},{key:"updateViewportLines",value:function updateViewportLines(){var _this35=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,function(t){_this35.viewportLines.push(1==_this35.scaler.scale?t:Ar(t,_this35.scaler));});}},{key:"update",value:function update(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;this.state=t.state;var i=this.stateDeco;this.stateDeco=this.state.facet(Zi).filter(function(t){return"function"!=typeof t;});var s=t.changedRanges,r=ls.extendWithRanges(s,function(t,e,i){var s=new dr();return It.compare(t,e,i,s,0),s.changes;}(i,this.stateDeco,t?t.changes:A.empty(this.state.doc.length))),n=this.heightMap.height,h=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=n&&(t.flags|=2),h?(this.scrollAnchorPos=t.changes.mapPos(h.from,-1),this.scrollAnchorHeight=h.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);var l=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<l.from||e.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));var o=!t.changes.empty||2&t.flags||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),o&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(Wi)&&(this.mustEnforceCursorAssoc=!0);}},{key:"measure",value:function measure(e){var i=e.contentDOM,s=window.getComputedStyle(i),r=this.heightOracle,n=s.whiteSpace;this.defaultTextDirection="rtl"==s.direction?pi.RTL:pi.LTR;var h=this.heightOracle.mustRefreshForWrapping(n),l=i.getBoundingClientRect(),o=h||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;var u=0,f=0;if(l.width&&l.height){var _de2=de(i,l),_t124=_de2.scaleX,_e112=_de2.scaleY;(_t124>.005&&Math.abs(this.scaleX-_t124)>.005||_e112>.005&&Math.abs(this.scaleY-_e112)>.005)&&(this.scaleX=_t124,this.scaleY=_e112,u|=8,h=o=!0);}var a=(parseInt(s.paddingTop)||0)*this.scaleY,c=(parseInt(s.paddingBottom)||0)*this.scaleY;this.paddingTop==a&&this.paddingBottom==c||(this.paddingTop=a,this.paddingBottom=c,u|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(o=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=8);var d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=ye(e.scrollDOM);var p=(this.printing?mr:pr)(i,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;var w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(o=!0)),!this.inView&&!this.scrollTarget)return 0;var b=l.width;if(this.contentDOMWidth==b&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,u|=8),o){var _i100=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(_i100)&&(h=!0),h||r.lineWrapping&&Math.abs(b-this.contentDOMWidth)>r.charWidth){var _e$docView$measureTex=e.docView.measureTextSize(),_t125=_e$docView$measureTex.lineHeight,_s88=_e$docView$measureTex.charWidth,_l35=_e$docView$measureTex.textHeight;h=_t125>0&&r.refresh(n,_t125,_s88,_l35,b/_s88,_i100),h&&(e.docView.minWidth=0,u|=8);}m>0&&g>0?f=Math.max(m,g):m<0&&g<0&&(f=Math.min(m,g)),r.heightChanged=!1;var _iterator59=_createForOfIteratorHelper(this.viewports),_step59;try{for(_iterator59.s();!(_step59=_iterator59.n()).done;){var _s89=_step59.value;var _n65=_s89.from==this.viewport.from?_i100:e.docView.measureVisibleLineHeights(_s89);this.heightMap=(h?hr.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle,[new ls(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,h,new ir(_s89.from,_n65));}}catch(err){_iterator59.e(err);}finally{_iterator59.f();}r.heightChanged&&(u|=2);}var v=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return v&&(this.viewport=this.getViewport(f,this.scrollTarget)),this.updateForViewport(),(2&u||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(h?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u;}},{key:"visibleTop",get:function get(){return this.scaler.fromDOM(this.pixelViewport.top);}},{key:"visibleBottom",get:function get(){return this.scaler.fromDOM(this.pixelViewport.bottom);}},{key:"getViewport",value:function getViewport(t,e){var i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,r=this.heightOracle,n=this.visibleTop,h=this.visibleBottom,l=new vr(s.lineAt(n-1e3*i,rr.ByHeight,r,0,0).from,s.lineAt(h+1e3*(1-i),rr.ByHeight,r,0,0).to);if(e){var _t126=e.range.head;if(_t126<l.from||_t126>l.to){var _i101,_n66=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),_h36=s.lineAt(_t126,rr.ByPos,r,0,0);_i101="center"==e.y?(_h36.top+_h36.bottom)/2-_n66/2:"start"==e.y||"nearest"==e.y&&_t126<l.from?_h36.top:_h36.bottom-_n66,l=new vr(s.lineAt(_i101-500,rr.ByHeight,r,0,0).from,s.lineAt(_i101+_n66+500,rr.ByHeight,r,0,0).to);}}return l;}},{key:"mapViewport",value:function mapViewport(t,e){var i=e.mapPos(t.from,-1),s=e.mapPos(t.to,1);return new vr(this.heightMap.lineAt(i,rr.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,rr.ByPos,this.heightOracle,0,0).to);}},{key:"viewportIsAppropriate",value:function viewportIsAppropriate(_ref9){var t=_ref9.from,e=_ref9.to;var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(!this.inView)return!0;var _this$heightMap$lineA=this.heightMap.lineAt(t,rr.ByPos,this.heightOracle,0,0),s=_this$heightMap$lineA.top,_this$heightMap$lineA2=this.heightMap.lineAt(e,rr.ByPos,this.heightOracle,0,0),r=_this$heightMap$lineA2.bottom,n=this.visibleTop,h=this.visibleBottom;return(0==t||s<=n-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||r>=h+Math.max(10,Math.min(i,250)))&&s>n-2e3&&r<h+2e3;}},{key:"mapLineGaps",value:function mapLineGaps(t,e){if(!t.length||e.empty)return t;var i=[];var _iterator60=_createForOfIteratorHelper(t),_step60;try{for(_iterator60.s();!(_step60=_iterator60.n()).done;){var _s90=_step60.value;e.touchesRange(_s90.from,_s90.to)||i.push(new gr(e.mapPos(_s90.from),e.mapPos(_s90.to),_s90.size));}}catch(err){_iterator60.e(err);}finally{_iterator60.f();}return i;}},{key:"ensureLineGaps",value:function ensureLineGaps(t,e){var _this36=this;var i=this.heightOracle.lineWrapping,s=i?1e4:2e3,r=s>>1,n=s<<1;if(this.defaultTextDirection!=pi.LTR&&!i)return[];var h=[],l=function l(s,n,o,u){if(n-s<r)return;var f=_this36.state.selection.main,a=[f.from];f.empty||a.push(f.to);for(var _i102=0,_a11=a;_i102<_a11.length;_i102++){var _t127=_a11[_i102];if(_t127>s&&_t127<n)return l(s,_t127-10,o,u),void l(_t127+10,n,o,u);}var c=function(t,e){var _iterator61=_createForOfIteratorHelper(t),_step61;try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){var _i103=_step61.value;if(e(_i103))return _i103;}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}return;}(t,function(t){return t.from>=o.from&&t.to<=o.to&&Math.abs(t.from-s)<r&&Math.abs(t.to-n)<r&&!a.some(function(e){return t.from<e&&t.to>e;});});if(!c){if(n<o.to&&e&&i&&e.visibleRanges.some(function(t){return t.from<=n&&t.to>=n;})){var _t128=e.moveToLineBoundary(B.cursor(n),!1,!0).head;_t128>s&&(n=_t128);}c=new gr(s,n,_this36.gapSize(o,s,n,u));}h.push(c);};var _iterator62=_createForOfIteratorHelper(this.viewportLines),_step62;try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){var _t129=_step62.value;if(_t129.length<n)continue;var _e113=kr(_t129.from,_t129.to,this.stateDeco);if(_e113.total<n)continue;var _r72=void 0,_h37=void 0,_o29=this.scrollTarget?this.scrollTarget.range.head:null;if(i){var _i104=void 0,_n67=void 0,_l36=s/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=_o29){var _s91=Mr(_e113,_o29),_r73=((this.visibleBottom-this.visibleTop)/2+_l36)/_t129.height;_i104=_s91-_r73,_n67=_s91+_r73;}else _i104=(this.visibleTop-_t129.top-_l36)/_t129.height,_n67=(this.visibleBottom-_t129.top+_l36)/_t129.height;_r72=yr(_e113,_i104),_h37=yr(_e113,_n67);}else{var _t130=void 0,_i105=void 0,_n68=_e113.total*this.heightOracle.charWidth,_l37=s*this.heightOracle.charWidth;if(null!=_o29){var _s92=Mr(_e113,_o29),_r74=((this.pixelViewport.right-this.pixelViewport.left)/2+_l37)/_n68;_t130=_s92-_r74,_i105=_s92+_r74;}else _t130=(this.pixelViewport.left-_l37)/_n68,_i105=(this.pixelViewport.right+_l37)/_n68;_r72=yr(_e113,_t130),_h37=yr(_e113,_i105);}_r72>_t129.from&&l(_t129.from,_r72,_t129,_e113),_h37<_t129.to&&l(_h37,_t129.to,_t129,_e113);}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}return h;}},{key:"gapSize",value:function gapSize(t,e,i,s){var r=Mr(s,i)-Mr(s,e);return this.heightOracle.lineWrapping?t.height*r:s.total*this.heightOracle.charWidth*r;}},{key:"updateLineGaps",value:function updateLineGaps(t){var _this37=this;gr.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=ni.set(t.map(function(t){return t.draw(_this37,_this37.heightOracle.lineWrapping);})));}},{key:"computeVisibleRanges",value:function computeVisibleRanges(){var t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));var e=[];It.spans(t,this.viewport.from,this.viewport.to,{span:function span(t,i){e.push({from:t,to:i});},point:function point(){}},20);var i=e.length!=this.visibleRanges.length||this.visibleRanges.some(function(t,i){return t.from!=e[i].from||t.to!=e[i].to;});return this.visibleRanges=e,i?4:0;}},{key:"lineBlockAt",value:function lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(function(e){return e.from<=t&&e.to>=t;})||Ar(this.heightMap.lineAt(t,rr.ByPos,this.heightOracle,0,0),this.scaler);}},{key:"lineBlockAtHeight",value:function lineBlockAtHeight(t){return Ar(this.heightMap.lineAt(this.scaler.fromDOM(t),rr.ByHeight,this.heightOracle,0,0),this.scaler);}},{key:"scrollAnchorAt",value:function scrollAnchorAt(t){var e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0];}},{key:"elementAtHeight",value:function elementAtHeight(t){return Ar(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler);}},{key:"docHeight",get:function get(){return this.scaler.toDOM(this.heightMap.height);}},{key:"contentHeight",get:function get(){return this.docHeight+this.paddingTop+this.paddingBottom;}}]);}();vr=/*#__PURE__*/_createClass(function vr(t,e){_classCallCheck(this,vr);this.from=t,this.to=e;});xr={toDOM:function toDOM(t){return t;},fromDOM:function fromDOM(t){return t;},scale:1};Sr=/*#__PURE__*/function(){function Sr(t,e,i){_classCallCheck(this,Sr);var s=0,r=0,n=0;this.viewports=i.map(function(_ref11){var i=_ref11.from,r=_ref11.to;var n=e.lineAt(i,rr.ByPos,t,0,0).top,h=e.lineAt(r,rr.ByPos,t,0,0).bottom;return s+=h-n,{from:i,to:r,top:n,bottom:h,domTop:0,domBottom:0};}),this.scale=(7e6-s)/(e.height-s);var _iterator64=_createForOfIteratorHelper(this.viewports),_step64;try{for(_iterator64.s();!(_step64=_iterator64.n()).done;){var _t132=_step64.value;_t132.domTop=n+(_t132.top-r)*this.scale,n=_t132.domBottom=_t132.domTop+(_t132.bottom-_t132.top),r=_t132.bottom;}}catch(err){_iterator64.e(err);}finally{_iterator64.f();}}return _createClass(Sr,[{key:"toDOM",value:function toDOM(t){for(var _e114=0,_i107=0,_s94=0;;_e114++){var _r77=_e114<this.viewports.length?this.viewports[_e114]:null;if(!_r77||t<_r77.top)return _s94+(t-_i107)*this.scale;if(t<=_r77.bottom)return _r77.domTop+(t-_r77.top);_i107=_r77.bottom,_s94=_r77.domBottom;}}},{key:"fromDOM",value:function fromDOM(t){for(var _e115=0,_i108=0,_s95=0;;_e115++){var _r78=_e115<this.viewports.length?this.viewports[_e115]:null;if(!_r78||t<_r78.domTop)return _i108+(t-_s95)/this.scale;if(t<=_r78.domBottom)return _r78.top+(t-_r78.domTop);_i108=_r78.bottom,_s95=_r78.domBottom;}}}]);}();Cr=j.define({combine:function combine(t){return t.join(" ");}});Or=j.define({combine:function combine(t){return t.indexOf(!0)>-1;}});Dr=Gt.newName();Er=Gt.newName();Ir=Gt.newName();Rr={"&light":"."+Er,"&dark":"."+Ir};Br=Tr("."+Dr,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Rr);Lr="";Nr=/*#__PURE__*/function(){function Nr(t,e){_classCallCheck(this,Nr);this.points=t,this.text="",this.lineSeparator=e.facet(St.lineSeparator);}return _createClass(Nr,[{key:"append",value:function append(t){this.text+=t;}},{key:"lineBreak",value:function lineBreak(){this.text+=Lr;}},{key:"readRange",value:function readRange(t,e){if(!t)return this;var i=t.parentNode;for(var _s96=t;;){this.findPointBefore(i,_s96);var _t133=this.text.length;this.readNode(_s96);var _r79=_s96.nextSibling;if(_r79==e)break;var _n70=Ce.get(_s96),_h38=Ce.get(_r79);(_n70&&_h38?_n70.breakAfter:(_n70?_n70.breakAfter:oe(_s96))||oe(_r79)&&("BR"!=_s96.nodeName||_s96.cmIgnore)&&this.text.length>_t133)&&this.lineBreak(),_s96=_r79;}return this.findPointBefore(i,e),this;}},{key:"readTextNode",value:function readTextNode(t){var e=t.nodeValue;var _iterator65=_createForOfIteratorHelper(this.points),_step65;try{for(_iterator65.s();!(_step65=_iterator65.n()).done;){var _i110=_step65.value;_i110.node==t&&(_i110.pos=this.text.length+Math.min(_i110.offset,e.length));}}catch(err){_iterator65.e(err);}finally{_iterator65.f();}for(var _i109=0,_s97=this.lineSeparator?null:/\r\n?|\n/g;;){var _r80=void 0,_n71=-1,_h39=1;if(this.lineSeparator?(_n71=e.indexOf(this.lineSeparator,_i109),_h39=this.lineSeparator.length):(_r80=_s97.exec(e))&&(_n71=_r80.index,_h39=_r80[0].length),this.append(e.slice(_i109,_n71<0?e.length:_n71)),_n71<0)break;if(this.lineBreak(),_h39>1){var _iterator66=_createForOfIteratorHelper(this.points),_step66;try{for(_iterator66.s();!(_step66=_iterator66.n()).done;){var _e116=_step66.value;_e116.node==t&&_e116.pos>this.text.length&&(_e116.pos-=_h39-1);}}catch(err){_iterator66.e(err);}finally{_iterator66.f();}}_i109=_n71+_h39;}}},{key:"readNode",value:function readNode(t){if(t.cmIgnore)return;var e=Ce.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(var _t134=i.iter();!_t134.next().done;)_t134.lineBreak?this.lineBreak():this.append(_t134.value);}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null);}},{key:"findPointBefore",value:function findPointBefore(t,e){var _iterator67=_createForOfIteratorHelper(this.points),_step67;try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){var _i111=_step67.value;_i111.node==t&&t.childNodes[_i111.offset]==e&&(_i111.pos=this.text.length);}}catch(err){_iterator67.e(err);}finally{_iterator67.f();}}},{key:"findPointInside",value:function findPointInside(t,e){var _iterator68=_createForOfIteratorHelper(this.points),_step68;try{for(_iterator68.s();!(_step68=_iterator68.n()).done;){var _i112=_step68.value;(3==t.nodeType?_i112.node==t:t.contains(_i112.node))&&(_i112.pos=this.text.length+(jr(t,_i112.node,_i112.offset)?e:0));}}catch(err){_iterator68.e(err);}finally{_iterator68.f();}}}]);}();$r=/*#__PURE__*/_createClass(function $r(t,e){_classCallCheck(this,$r);this.node=t,this.offset=e,this.pos=-1;});zr=/*#__PURE__*/_createClass(function zr(t,e,i,s){_classCallCheck(this,zr);this.typeOver=s,this.bounds=null,this.text="";var _t$docView=t.docView,r=_t$docView.impreciseHead,n=_t$docView.impreciseAnchor;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){var _e117=r||n?[]:function(t){var e=[];if(t.root.activeElement!=t.contentDOM)return e;var _t$observer$selection2=t.observer.selectionRange,i=_t$observer$selection2.anchorNode,s=_t$observer$selection2.anchorOffset,r=_t$observer$selection2.focusNode,n=_t$observer$selection2.focusOffset;i&&(e.push(new $r(i,s)),r==i&&n==s||e.push(new $r(r,n)));return e;}(t),_i113=new Nr(_e117,t.state);_i113.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=_i113.text,this.newSel=function(t,e){if(0==t.length)return null;var i=t[0].pos,s=2==t.length?t[1].pos:i;return i>-1&&s>-1?B.single(i+e,s+e):null;}(_e117,this.bounds.from);}else{var _e118=t.observer.selectionRange,_i114=r&&r.node==_e118.focusNode&&r.offset==_e118.focusOffset||!se(t.contentDOM,_e118.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(_e118.focusNode,_e118.focusOffset),_s98=n&&n.node==_e118.anchorNode&&n.offset==_e118.anchorOffset||!se(t.contentDOM,_e118.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(_e118.anchorNode,_e118.anchorOffset),_h40=t.viewport;if((Ve.ios||Ve.chrome)&&t.state.selection.main.empty&&_i114!=_s98&&(_h40.from>0||_h40.to<t.state.doc.length)){var _e119=Math.min(_i114,_s98),_r81=Math.max(_i114,_s98),_n72=_h40.from-_e119,_l38=_h40.to-_r81;0!=_n72&&1!=_n72&&0!=_e119||0!=_l38&&-1!=_l38&&_r81!=t.state.doc.length||(_i114=0,_s98=t.state.doc.length);}this.newSel=B.single(_s98,_i114);}});Hr={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0};Wr=Ve.ie&&Ve.ie_version<=11;Vr=/*#__PURE__*/function(){function Vr(t){var _this38=this;_classCallCheck(this,Vr);this.view=t,this.active=!1,this.selectionRange=new pe(),this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(function(e){var _iterator69=_createForOfIteratorHelper(e),_step69;try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){var _t138=_step69.value;_this38.queue.push(_t138);}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}(Ve.ie&&Ve.ie_version<=11||Ve.ios&&t.composing)&&e.some(function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length;})?_this38.flushSoon():_this38.flush();}),Wr&&(this.onCharData=function(t){_this38.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),_this38.flushSoon();}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(function(){var t;(null===(t=_this38.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&_this38.onResize();}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(function(t){_this38.parentCheck<0&&(_this38.parentCheck=setTimeout(_this38.listenForScroll.bind(_this38),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=_this38.intersecting&&(_this38.intersecting=!_this38.intersecting,_this38.intersecting!=_this38.view.inView&&_this38.onScrollChanged(document.createEvent("Event")));},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(function(t){t.length>0&&t[t.length-1].intersectionRatio>0&&_this38.onScrollChanged(document.createEvent("Event"));},{})),this.listenForScroll(),this.readSelectionRange();}return _createClass(Vr,[{key:"onScrollChanged",value:function onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure();}},{key:"onScroll",value:function onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t);}},{key:"onResize",value:function onResize(){var _this39=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(function(){_this39.resizeTimeout=-1,_this39.view.requestMeasure();},50));}},{key:"onPrint",value:function onPrint(t){var _this40=this;("change"!=t.type||t.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(function(){_this40.view.viewState.printing=!1,_this40.view.requestMeasure();},500));}},{key:"updateGaps",value:function updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some(function(e,i){return e!=t[i];}))){this.gapIntersection.disconnect();var _iterator70=_createForOfIteratorHelper(t),_step70;try{for(_iterator70.s();!(_step70=_iterator70.n()).done;){var _e120=_step70.value;this.gapIntersection.observe(_e120);}}catch(err){_iterator70.e(err);}finally{_iterator70.f();}this.gaps=t;}}},{key:"onSelectionChange",value:function onSelectionChange(t){var e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;var i=this.view,s=this.selectionRange;if(i.state.facet(Ji)?i.root.activeElement!=this.dom:!re(i.dom,s))return;var r=s.anchorNode&&i.docView.nearest(s.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(Ve.ie&&Ve.ie_version<=11||Ve.android&&Ve.chrome)&&!i.state.selection.main.empty&&s.focusNode&&he(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1);}},{key:"readSelectionRange",value:function readSelectionRange(){var t=this.view,e=ie(t.root);if(!e)return!1;var i=Ve.safari&&11==t.root.nodeType&&function(t){var e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e;}(this.dom.ownerDocument)==this.dom&&function(t,e){if(e.getComposedRanges){var _i118=e.getComposedRanges(t.root)[0];if(_i118)return qr(t,_i118);}var i=null;function s(t){t.preventDefault(),t.stopImmediatePropagation(),i=t.getTargetRanges()[0];}return t.contentDOM.addEventListener("beforeinput",s,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",s,!0),i?qr(t,i):null;}(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;var s=re(this.dom,i);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){var i=e.focusNode,s=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=s)return!1;for(s=Math.min(s,fe(i));;)if(s){if(1!=i.nodeType)return!1;var _t139=i.childNodes[s-1];"false"==_t139.contentEditable?s--:(i=_t139,s=fe(i));}else{if(i==t)return!0;s=le(i),i=i.parentNode;}}(this.dom,i)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(i),s&&(this.selectionChanged=!0),!0);}},{key:"setSelectionRange",value:function setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1;}},{key:"clearSelectionRange",value:function clearSelectionRange(){this.selectionRange.set(null,0,null,0);}},{key:"listenForScroll",value:function listenForScroll(){this.parentCheck=-1;var t=0,e=null;for(var _i119=this.dom;_i119;)if(1==_i119.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==_i119?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(_i119),_i119=_i119.assignedSlot||_i119.parentNode;else{if(11!=_i119.nodeType)break;_i119=_i119.host;}if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){var _iterator71=_createForOfIteratorHelper(this.scrollTargets),_step71;try{for(_iterator71.s();!(_step71=_iterator71.n()).done;){var _t140=_step71.value;_t140.removeEventListener("scroll",this.onScroll);}}catch(err){_iterator71.e(err);}finally{_iterator71.f();}var _iterator72=_createForOfIteratorHelper(this.scrollTargets=e),_step72;try{for(_iterator72.s();!(_step72=_iterator72.n()).done;){var _t141=_step72.value;_t141.addEventListener("scroll",this.onScroll);}}catch(err){_iterator72.e(err);}finally{_iterator72.f();}}}},{key:"ignore",value:function ignore(t){if(!this.active)return t();try{return this.stop(),t();}finally{this.start(),this.clear();}}},{key:"start",value:function start(){this.active||(this.observer.observe(this.dom,Hr),Wr&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0);}},{key:"stop",value:function stop(){this.active&&(this.active=!1,this.observer.disconnect(),Wr&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData));}},{key:"clear",value:function clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1;}},{key:"delayAndroidKey",value:function delayAndroidKey(t,e){var _this41=this;var i;if(!this.delayedAndroidKey){var _t142=function _t142(){var t=_this41.delayedAndroidKey;if(t){_this41.clearDelayedAndroidKey(),_this41.view.inputState.lastKeyCode=t.keyCode,_this41.view.inputState.lastKeyTime=Date.now(),!_this41.flush()&&t.force&&ve(_this41.dom,t.key,t.keyCode);}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(_t142);}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(null===(i=this.delayedAndroidKey)||void 0===i?void 0:i.force)});}},{key:"clearDelayedAndroidKey",value:function clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1;}},{key:"flushSoon",value:function flushSoon(){var _this42=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(function(){_this42.delayedFlush=-1,_this42.flush();}));}},{key:"forceFlush",value:function forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush();}},{key:"pendingRecords",value:function pendingRecords(){var _iterator73=_createForOfIteratorHelper(this.observer.takeRecords()),_step73;try{for(_iterator73.s();!(_step73=_iterator73.n()).done;){var _t143=_step73.value;this.queue.push(_t143);}}catch(err){_iterator73.e(err);}finally{_iterator73.f();}return this.queue;}},{key:"processRecords",value:function processRecords(){var t=this.pendingRecords();t.length&&(this.queue=[]);var e=-1,i=-1,s=!1;var _iterator74=_createForOfIteratorHelper(t),_step74;try{for(_iterator74.s();!(_step74=_iterator74.n()).done;){var _t145;var _r83=_step74.value;var _t144=this.readMutation(_r83);_t144&&(_t144.typeOver&&(s=!0),-1==e?(_t145=_t144,e=_t145.from,i=_t145.to,_t145):(e=Math.min(_t144.from,e),i=Math.max(_t144.to,i)));}}catch(err){_iterator74.e(err);}finally{_iterator74.f();}return{from:e,to:i,typeOver:s};}},{key:"readChange",value:function readChange(){var _this$processRecords=this.processRecords(),t=_this$processRecords.from,e=_this$processRecords.to,i=_this$processRecords.typeOver,s=this.selectionChanged&&re(this.dom,this.selectionRange);if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;var r=new zr(this.view,t,e,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r;}},{key:"flush",value:function flush(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();var e=this.readChange();if(!e)return this.view.requestMeasure(),!1;var i=this.view.state,s=Pr(this.view,e);return this.view.state==i&&this.view.update([]),s;}},{key:"readMutation",value:function readMutation(t){var e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){var _i120=Fr(e,t.previousSibling||t.target.previousSibling,-1),_s99=Fr(e,t.nextSibling||t.target.nextSibling,1);return{from:_i120?e.posAfter(_i120):e.posAtStart,to:_s99?e.posBefore(_s99):e.posAtEnd,typeOver:!1};}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null;}},{key:"setWindow",value:function setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win));}},{key:"addWindowListeners",value:function addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange);}},{key:"removeWindowListeners",value:function removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange);}},{key:"destroy",value:function destroy(){var t,e,i;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect();var _iterator75=_createForOfIteratorHelper(this.scrollTargets),_step75;try{for(_iterator75.s();!(_step75=_iterator75.n()).done;){var _t146=_step75.value;_t146.removeEventListener("scroll",this.onScroll);}}catch(err){_iterator75.e(err);}finally{_iterator75.f();}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey);}}]);}();_export("E",Ur=/*#__PURE__*/function(){function Ur(){var _this43=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,Ur);this.plugins=[],this.pluginMap=new Map(),this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);var e=t.dispatch;this.dispatchTransactions=t.dispatchTransactions||e&&function(t){return t.forEach(function(t){return e(t,_this43);});}||function(t){return _this43.update(t);},this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode;}return null;}(t.parent)||document,this.viewState=new br(t.state||St.create(t)),t.scrollTo&&t.scrollTo.is(qi)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ki).map(function(t){return new Xi(t);});var _iterator76=_createForOfIteratorHelper(this.plugins),_step76;try{for(_iterator76.s();!(_step76=_iterator76.n()).done;){var _t147=_step76.value;_t147.update(this);}}catch(err){_iterator76.e(err);}finally{_iterator76.f();}this.observer=new Vr(this),this.inputState=new Cs(this),this.inputState.ensureHandlers(this.plugins),this.docView=new us(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure();}return _createClass(Ur,[{key:"state",get:function get(){return this.viewState.state;}},{key:"viewport",get:function get(){return this.viewState.viewport;}},{key:"visibleRanges",get:function get(){return this.viewState.visibleRanges;}},{key:"inView",get:function get(){return this.viewState.inView;}},{key:"composing",get:function get(){return this.inputState.composing>0;}},{key:"compositionStarted",get:function get(){return this.inputState.composing>=0;}},{key:"root",get:function get(){return this._root;}},{key:"win",get:function get(){return this.dom.ownerDocument.defaultView||window;}},{key:"dispatch",value:function dispatch(){var _this$state;for(var _len3=arguments.length,t=new Array(_len3),_key3=0;_key3<_len3;_key3++){t[_key3]=arguments[_key3];}var e=1==t.length&&t[0]instanceof dt?t:1==t.length&&Array.isArray(t[0])?t[0]:[(_this$state=this.state).update.apply(_this$state,t)];this.dispatchTransactions(e,this);}},{key:"update",value:function update(t){var _this44=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");var e,i=!1,s=!1,r=this.state;var _iterator77=_createForOfIteratorHelper(t),_step77;try{for(_iterator77.s();!(_step77=_iterator77.n()).done;){var _e122=_step77.value;if(_e122.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=_e122.state;}}catch(err){_iterator77.e(err);}finally{_iterator77.f();}if(this.destroyed)return void(this.viewState.state=r);var n=this.hasFocus,h=0,l=null;t.some(function(t){return t.annotation(Xs);})?(this.inputState.notifiedFocused=n,h=1):n!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=n,l=Ys(r,n),l||(h=1));var o=this.observer.delayedAndroidKey,u=null;if(o?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(u=null)):this.observer.clear(),r.facet(St.phrases)!=this.state.facet(St.phrases))return this.setState(r);e=os.create(this,r,t),e.flags|=h;var f=this.viewState.scrollTarget;try{this.updateState=2;var _iterator78=_createForOfIteratorHelper(t),_step78;try{for(_iterator78.s();!(_step78=_iterator78.n()).done;){var _e121=_step78.value;if(f&&(f=f.map(_e121.changes)),_e121.scrollIntoView){var _t148=_e121.state.selection.main;f=new Fi(_t148.empty?_t148:B.cursor(_t148.head,_t148.head>_t148.anchor?-1:1));}var _iterator79=_createForOfIteratorHelper(_e121.effects),_step79;try{for(_iterator79.s();!(_step79=_iterator79.n()).done;){var _t149=_step79.value;_t149.is(qi)&&(f=_t149.value.clip(this.state));}}catch(err){_iterator79.e(err);}finally{_iterator79.f();}}}catch(err){_iterator78.e(err);}finally{_iterator78.f();}this.viewState.update(e,f),this.bidiCache=Kr.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(hs)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(i,t.some(function(t){return t.isUserEvent("select.pointer");}));}finally{this.updateState=0;}if(e.startState.facet(Cr)!=e.state.facet(Cr)&&(this.viewState.mustMeasureContent=!0),(i||s||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!e.empty){var _iterator80=_createForOfIteratorHelper(this.state.facet($i)),_step80;try{for(_iterator80.s();!(_step80=_iterator80.n()).done;){var _t150=_step80.value;try{_t150(e);}catch(t){Ui(this.state,t,"update listener");}}}catch(err){_iterator80.e(err);}finally{_iterator80.f();}}(l||u)&&Promise.resolve().then(function(){l&&_this44.state==l.startState&&_this44.dispatch(l),u&&!Pr(_this44,u)&&o.force&&ve(_this44.contentDOM,o.key,o.keyCode);});}},{key:"setState",value:function setState(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=t);this.updateState=2;var e=this.hasFocus;try{var _iterator81=_createForOfIteratorHelper(this.plugins),_step81;try{for(_iterator81.s();!(_step81=_iterator81.n()).done;){var _t151=_step81.value;_t151.destroy(this);}}catch(err){_iterator81.e(err);}finally{_iterator81.f();}this.viewState=new br(t),this.plugins=t.facet(Ki).map(function(t){return new Xi(t);}),this.pluginMap.clear();var _iterator82=_createForOfIteratorHelper(this.plugins),_step82;try{for(_iterator82.s();!(_step82=_iterator82.n()).done;){var _t152=_step82.value;_t152.update(this);}}catch(err){_iterator82.e(err);}finally{_iterator82.f();}this.docView.destroy(),this.docView=new us(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[];}finally{this.updateState=0;}e&&this.focus(),this.requestMeasure();}},{key:"updatePlugins",value:function updatePlugins(t){var e=t.startState.facet(Ki),i=t.state.facet(Ki);if(e!=i){var _s101=[];var _iterator83=_createForOfIteratorHelper(i),_step83;try{for(_iterator83.s();!(_step83=_iterator83.n()).done;){var _r85=_step83.value;var _i121=e.indexOf(_r85);if(_i121<0)_s101.push(new Xi(_r85));else{var _e123=this.plugins[_i121];_e123.mustUpdate=t,_s101.push(_e123);}}}catch(err){_iterator83.e(err);}finally{_iterator83.f();}var _iterator84=_createForOfIteratorHelper(this.plugins),_step84;try{for(_iterator84.s();!(_step84=_iterator84.n()).done;){var _e124=_step84.value;_e124.mustUpdate!=t&&_e124.destroy(this);}}catch(err){_iterator84.e(err);}finally{_iterator84.f();}this.plugins=_s101,this.pluginMap.clear();}else{var _iterator85=_createForOfIteratorHelper(this.plugins),_step85;try{for(_iterator85.s();!(_step85=_iterator85.n()).done;){var _e125=_step85.value;_e125.mustUpdate=t;}}catch(err){_iterator85.e(err);}finally{_iterator85.f();}}for(var _t153=0;_t153<this.plugins.length;_t153++)this.plugins[_t153].update(this);e!=i&&this.inputState.ensureHandlers(this.plugins);}},{key:"docViewUpdate",value:function docViewUpdate(){var _iterator86=_createForOfIteratorHelper(this.plugins),_step86;try{for(_iterator86.s();!(_step86=_iterator86.n()).done;){var _t154=_step86.value;var _e126=_t154.value;if(_e126&&_e126.docViewUpdate)try{_e126.docViewUpdate(this);}catch(t){Ui(this.state,t,"doc view update listener");}}}catch(err){_iterator86.e(err);}finally{_iterator86.f();}}},{key:"measure",value:function measure(){var _this45=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();var e=null,i=this.scrollDOM,s=i.scrollTop*this.scaleY,_this$viewState=this.viewState,r=_this$viewState.scrollAnchorPos,n=_this$viewState.scrollAnchorHeight;Math.abs(s-this.viewState.scrollTop)>1&&(n=-1),this.viewState.scrollAnchorHeight=-1;try{for(var _t155=0;;_t155++){var _ref13;if(n<0)if(ye(i))r=-1,n=this.viewState.heightMap.height;else{var _t156=this.viewState.scrollAnchorAt(s);r=_t156.from,n=_t156.top;}this.updateState=1;var _h43=this.viewState.measure(this);if(!_h43&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(_t155>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break;}var _l42=[];4&_h43||(_ref13=[_l42,this.measureRequests],this.measureRequests=_ref13[0],_l42=_ref13[1],_ref13);var _o32=_l42.map(function(t){try{return t.read(_this45);}catch(t){return Ui(_this45.state,t),Gr;}}),_u35=os.create(this,this.state,[]),_f19=!1;_u35.flags|=_h43,e?e.flags|=_h43:e=_u35,this.updateState=2,_u35.empty||(this.updatePlugins(_u35),this.inputState.update(_u35),this.updateAttrs(),_f19=this.docView.update(_u35),_f19&&this.docViewUpdate());for(var _t157=0;_t157<_l42.length;_t157++)if(_o32[_t157]!=Gr)try{var _e127=_l42[_t157];_e127.write&&_e127.write(_o32[_t157],this);}catch(t){Ui(this.state,t);}if(_f19&&this.docView.updateSelection(!0),!_u35.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,n=-1;continue;}{var _t158=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-n;if(_t158>1||_t158<-1){s+=_t158,i.scrollTop=s/this.scaleY,n=-1;continue;}}}break;}}}finally{this.updateState=0,this.measureScheduled=-1;}if(e&&!e.empty){var _iterator87=_createForOfIteratorHelper(this.state.facet($i)),_step87;try{for(_iterator87.s();!(_step87=_iterator87.n()).done;){var _t159=_step87.value;_t159(e);}}catch(err){_iterator87.e(err);}finally{_iterator87.f();}}}},{key:"themeClasses",get:function get(){return Dr+" "+(this.state.facet(Or)?Ir:Er)+" "+this.state.facet(Cr);}},{key:"updateAttrs",value:function updateAttrs(){var _this46=this;var t=_r(this,Yi,{"class":"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Ji)?"true":"false","class":"cm-content",style:"".concat(Ve.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),_r(this,Qi,e);var i=this.observer.ignore(function(){var i=Ze(_this46.contentDOM,_this46.contentAttrs,e),s=Ze(_this46.dom,_this46.editorAttrs,t);return i||s;});return this.editorAttrs=t,this.contentAttrs=e,i;}},{key:"showAnnouncements",value:function showAnnouncements(t){var e=!0;var _iterator88=_createForOfIteratorHelper(t),_step88;try{for(_iterator88.s();!(_step88=_iterator88.n()).done;){var _i122=_step88.value;var _iterator89=_createForOfIteratorHelper(_i122.effects),_step89;try{for(_iterator89.s();!(_step89=_iterator89.n()).done;){var _t160=_step89.value;if(_t160.is(Ur.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=_t160.value;}}}catch(err){_iterator89.e(err);}finally{_iterator89.f();}}}catch(err){_iterator88.e(err);}finally{_iterator88.f();}}},{key:"mountStyles",value:function mountStyles(){this.styleModules=this.state.facet(hs);var t=this.state.facet(Ur.cspNonce);Gt.mount(this.root,this.styleModules.concat(Br).reverse(),t?{nonce:t}:void 0);}},{key:"readMeasured",value:function readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1);}},{key:"requestMeasure",value:function requestMeasure(t){var _this47=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(function(){return _this47.measure();})),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(var _e128=0;_e128<this.measureRequests.length;_e128++)if(this.measureRequests[_e128].key===t.key)return void(this.measureRequests[_e128]=t);this.measureRequests.push(t);}}},{key:"plugin",value:function plugin(t){var e=this.pluginMap.get(t);return(void 0===e||e&&e.spec!=t)&&this.pluginMap.set(t,e=this.plugins.find(function(e){return e.spec==t;})||null),e&&e.update(this).value;}},{key:"documentTop",get:function get(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop;}},{key:"documentPadding",get:function get(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom};}},{key:"scaleX",get:function get(){return this.viewState.scaleX;}},{key:"scaleY",get:function get(){return this.viewState.scaleY;}},{key:"elementAtHeight",value:function elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t);}},{key:"lineBlockAtHeight",value:function lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t);}},{key:"viewportLineBlocks",get:function get(){return this.viewState.viewportLines;}},{key:"lineBlockAt",value:function lineBlockAt(t){return this.viewState.lineBlockAt(t);}},{key:"contentHeight",get:function get(){return this.viewState.contentHeight;}},{key:"moveByChar",value:function moveByChar(t,e,i){return As(this,t,xs(this,t,e,i));}},{key:"moveByGroup",value:function moveByGroup(t,e){var _this48=this;return As(this,t,xs(this,t,e,function(e){return function(t,e,i){var s=t.state.charCategorizer(e),r=s(i);return function(t){var e=s(t);return r==kt.Space&&(r=e),r==e;};}(_this48,t.head,e);}));}},{key:"visualLineSide",value:function visualLineSide(t,e){var i=this.bidiSpans(t),s=this.textDirectionAt(t.from),r=i[e?i.length-1:0];return B.cursor(r.side(e,s)+t.from,r.forward(!e,s)?1:-1);}},{key:"moveToLineBoundary",value:function moveToLineBoundary(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;return function(t,e,i,s){var r=Ms(t,e.head),n=s&&r.type==ri.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(n){var _e129=t.dom.getBoundingClientRect(),_s102=t.textDirectionAt(r.from),_h44=t.posAtCoords({x:i==(_s102==pi.LTR)?_e129.right-1:_e129.left+1,y:(n.top+n.bottom)/2});if(null!=_h44)return B.cursor(_h44,i?-1:1);}return B.cursor(i?r.to:r.from,i?-1:1);}(this,t,e,i);}},{key:"moveVertically",value:function moveVertically(t,e,i){return As(this,t,function(t,e,i,s){var r=e.head,n=i?1:-1;if(r==(i?t.state.doc.length:0))return B.cursor(r,e.assoc);var h,l=e.goalColumn,o=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(r,e.assoc||-1),f=t.documentTop;if(u)null==l&&(l=u.left-o.left),h=n<0?u.top:u.bottom;else{var _e130=t.viewState.lineBlockAt(r);null==l&&(l=Math.min(o.right-o.left,t.defaultCharacterWidth*(r-_e130.from))),h=(n<0?_e130.top:_e130.bottom)+f;}var a=o.left+l,c=null!=s?s:t.viewState.heightOracle.textHeight>>1;for(var _e131=0;;_e131+=10){var _i123=h+(c+_e131)*n,_s103=ks(t,{x:a,y:_i123},!1,n);if(_i123<o.top||_i123>o.bottom||(n<0?_s103<r:_s103>r)){var _e132=t.docView.coordsForChar(_s103),_r86=!_e132||_i123<_e132.top?-1:1;return B.cursor(_s103,_r86,void 0,l);}}}(this,t,e,i));}},{key:"domAtPos",value:function domAtPos(t){return this.docView.domAtPos(t);}},{key:"posAtDOM",value:function posAtDOM(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return this.docView.posFromDOM(t,e);}},{key:"posAtCoords",value:function posAtCoords(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;return this.readMeasured(),ks(this,t,e);}},{key:"coordsAtPos",value:function coordsAtPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;this.readMeasured();var i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;var s=this.state.doc.lineAt(t),r=this.bidiSpans(s);return ae(i,r[Si.find(r,t-s.from,-1,e)].dir==pi.LTR==e>0);}},{key:"coordsForChar",value:function coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t);}},{key:"defaultCharacterWidth",get:function get(){return this.viewState.heightOracle.charWidth;}},{key:"defaultLineHeight",get:function get(){return this.viewState.heightOracle.lineHeight;}},{key:"textDirection",get:function get(){return this.viewState.defaultTextDirection;}},{key:"textDirectionAt",value:function textDirectionAt(t){return!this.state.facet(Hi)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t));}},{key:"lineWrapping",get:function get(){return this.viewState.heightOracle.lineWrapping;}},{key:"bidiSpans",value:function bidiSpans(t){if(t.length>Jr)return Ei(t.length);var e,i=this.textDirectionAt(t.from);var _iterator90=_createForOfIteratorHelper(this.bidiCache),_step90;try{for(_iterator90.s();!(_step90=_iterator90.n()).done;){var _s104=_step90.value;if(_s104.from==t.from&&_s104.dir==i&&(_s104.fresh||Ai(_s104.isolates,e=ss(this,t))))return _s104.order;}}catch(err){_iterator90.e(err);}finally{_iterator90.f();}e||(e=ss(this,t));var s=function(t,e,i){if(!t)return[new Si(0,0,e==gi?1:0)];if(e==mi&&!i.length&&!xi.test(t))return Ei(t.length);if(i.length)for(;t.length>Ci.length;)Ci[Ci.length]=256;var s=[],r=e==mi?0:1;return Di(t,r,r,i,0,t.length,s),s;}(t.text,i,e);return this.bidiCache.push(new Kr(t.from,t.to,i,e,!0,s)),s;}},{key:"hasFocus",get:function get(){var t;return(this.dom.ownerDocument.hasFocus()||Ve.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM;}},{key:"focus",value:function focus(){var _this49=this;this.observer.ignore(function(){we(_this49.contentDOM),_this49.docView.updateSelection();});}},{key:"setRoot",value:function setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles());}},{key:"destroy",value:function destroy(){var _iterator91=_createForOfIteratorHelper(this.plugins),_step91;try{for(_iterator91.s();!(_step91=_iterator91.n()).done;){var _t161=_step91.value;_t161.destroy(this);}}catch(err){_iterator91.e(err);}finally{_iterator91.f();}this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0;}},{key:"scrollSnapshot",value:function scrollSnapshot(){var _this$scrollDOM=this.scrollDOM,t=_this$scrollDOM.scrollTop,e=_this$scrollDOM.scrollLeft,i=this.viewState.scrollAnchorAt(t);return qi.of(new Fi(B.cursor(i.from),"start","start",i.top-t,e,!0));}}],[{key:"scrollIntoView",value:function scrollIntoView(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return qi.of(new Fi("number"==typeof t?B.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin));}},{key:"domEventHandlers",value:function domEventHandlers(t){return _i.define(function(){return{};},{eventHandlers:t});}},{key:"domEventObservers",value:function domEventObservers(t){return _i.define(function(){return{};},{eventObservers:t});}},{key:"theme",value:function theme(t,e){var i=Gt.newName(),s=[Cr.of(i),hs.of(Tr(".".concat(i),t))];return e&&e.dark&&s.push(Or.of(!0)),s;}},{key:"baseTheme",value:function baseTheme(t){return _.lowest(hs.of(Tr("."+Dr,t,Rr)));}},{key:"findFromDOM",value:function findFromDOM(t){var e;var i=t.querySelector(".cm-content"),s=i&&Ce.get(i)||Ce.get(t);return(null===(e=null==s?void 0:s.rootView)||void 0===e?void 0:e.view)||null;}}]);}());Ur.styleModule=hs,Ur.inputHandler=zi,Ur.scrollHandler=Vi,Ur.focusChangeEffect=Pi,Ur.perLineTextDirection=Hi,Ur.exceptionSink=ji,Ur.updateListener=$i,Ur.editable=Ji,Ur.mouseSelectionStyle=Ni,Ur.dragMovesSelection=Li,Ur.clickAddsSelectionRange=Bi,Ur.decorations=Zi,Ur.outerDecorations=ts,Ur.atomicRanges=es,Ur.bidiIsolatedRanges=is,Ur.scrollMargins=rs,Ur.darkTheme=Or,Ur.cspNonce=j.define({combine:function combine(t){return t.length?t[0]:"";}}),Ur.contentAttributes=Qi,Ur.editorAttributes=Yi,Ur.lineWrapping=Ur.contentAttributes.of({"class":"cm-lineWrapping"}),Ur.announce=ct.define();Jr=4096;Gr={};Kr=/*#__PURE__*/function(){function Kr(t,e,i,s,r,n){_classCallCheck(this,Kr);this.from=t,this.to=e,this.dir=i,this.isolates=s,this.fresh=r,this.order=n;}return _createClass(Kr,null,[{key:"update",value:function update(t,e){if(e.empty&&!t.some(function(t){return t.fresh;}))return t;var i=[],s=t.length?t[t.length-1].dir:pi.LTR;for(var _r87=Math.max(0,t.length-10);_r87<t.length;_r87++){var _n73=t[_r87];_n73.dir!=s||e.touchesRange(_n73.from,_n73.to)||i.push(new Kr(e.mapPos(_n73.from,1),e.mapPos(_n73.to,-1),_n73.dir,_n73.isolates,!1,_n73.order));}return i;}}]);}();Xr=Ve.mac?"mac":Ve.windows?"win":Ve.linux?"linux":"key";Qr=_["default"](Ur.domEventHandlers({keydown:function keydown(t,e){return nn(en(e.state),t,e,"editor");}}));_export("G",Zr=j.define({enables:Qr}));tn=new WeakMap();sn=null;rn=4e3;hn=/*#__PURE__*/function(){function hn(t,e,i,s,r){_classCallCheck(this,hn);this.className=t,this.left=e,this.top=i,this.width=s,this.height=r;}return _createClass(hn,[{key:"draw",value:function draw(){var t=document.createElement("div");return t.className=this.className,this.adjust(t),t;}},{key:"update",value:function update(t,e){return e.className==this.className&&(this.adjust(t),!0);}},{key:"adjust",value:function adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px";}},{key:"eq",value:function eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className;}}],[{key:"forRange",value:function forRange(t,e,i){if(i.empty){var _s108=t.coordsAtPos(i.head,i.assoc||1);if(!_s108)return[];var _r90=ln(t);return[new hn(e,_s108.left-_r90.left,_s108.top-_r90.top,null,_s108.bottom-_s108.top)];}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];var s=Math.max(i.from,t.viewport.from),r=Math.min(i.to,t.viewport.to),n=t.textDirection==pi.LTR,h=t.contentDOM,l=h.getBoundingClientRect(),o=ln(t),u=h.querySelector(".cm-line"),f=u&&window.getComputedStyle(u),a=l.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),c=l.right-(f?parseInt(f.paddingRight):0),d=Ms(t,s),p=Ms(t,r),m=d.type==ri.Text?d:null,g=p.type==ri.Text?p:null;m&&(t.lineWrapping||d.widgetLineBreaks)&&(m=on(t,s,m));g&&(t.lineWrapping||p.widgetLineBreaks)&&(g=on(t,r,g));if(m&&g&&m.from==g.from)return b(v(i.from,i.to,m));{var _e138=m?v(i.from,null,m):k(d,!1),_s109=g?v(null,i.to,g):k(p,!0),_r91=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&_e138.bottom+t.defaultLineHeight/2<_s109.top?_r91.push(w(a,_e138.bottom,c,_s109.top)):_e138.bottom<_s109.top&&t.elementAtHeight((_e138.bottom+_s109.top)/2).type==ri.Text&&(_e138.bottom=_s109.top=(_e138.bottom+_s109.top)/2),b(_e138).concat(_r91).concat(b(_s109));}function w(t,i,s,r){return new hn(e,t-o.left,i-o.top-.01,s-t,r-i+.01);}function b(_ref14){var t=_ref14.top,e=_ref14.bottom,i=_ref14.horizontal;var s=[];for(var _r92=0;_r92<i.length;_r92+=2)s.push(w(i[_r92],t,i[_r92+1],e));return s;}function v(e,i,s){var r=1e9,h=-1e9,l=[];function o(e,i,o,u,f){var d=t.coordsAtPos(e,e==s.to?-2:2),p=t.coordsAtPos(o,o==s.from?2:-2);d&&p&&(r=Math.min(d.top,p.top,r),h=Math.max(d.bottom,p.bottom,h),f==pi.LTR?l.push(n&&i?a:d.left,n&&u?c:p.right):l.push(!n&&u?a:p.left,!n&&i?c:d.right));}var u=null!=e?e:s.from,f=null!=i?i:s.to;var _iterator96=_createForOfIteratorHelper(t.visibleRanges),_step96;try{for(_iterator96.s();!(_step96=_iterator96.n()).done;){var _s110=_step96.value;if(_s110.to>u&&_s110.from<f)for(var _r93=Math.max(_s110.from,u),_n76=Math.min(_s110.to,f);;){var _s111=t.state.doc.lineAt(_r93);var _iterator97=_createForOfIteratorHelper(t.bidiSpans(_s111)),_step97;try{for(_iterator97.s();!(_step97=_iterator97.n()).done;){var _h45=_step97.value;var _t165=_h45.from+_s111.from,_l44=_h45.to+_s111.from;if(_t165>=_n76)break;_l44>_r93&&o(Math.max(_t165,_r93),null==e&&_t165<=u,Math.min(_l44,_n76),null==i&&_l44>=f,_h45.dir);}}catch(err){_iterator97.e(err);}finally{_iterator97.f();}if(_r93=_s111.to+1,_r93>=_n76)break;}}}catch(err){_iterator96.e(err);}finally{_iterator96.f();}return 0==l.length&&o(u,null==e,f,null==i,t.textDirection),{top:r,bottom:h,horizontal:l};}function k(t,e){var i=l.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]};}}(t,e,i);}}]);}();un=/*#__PURE__*/function(){function un(t,e){_classCallCheck(this,un);this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e["class"]&&this.dom.classList.add(e["class"]),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t);}return _createClass(un,[{key:"update",value:function update(t){t.startState.facet(fn)!=t.state.facet(fn)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq));}},{key:"docViewUpdate",value:function docViewUpdate(t){!1!==this.layer.updateOnDocViewUpdate&&t.requestMeasure(this.measureReq);}},{key:"setOrder",value:function setOrder(t){var e=0,i=t.facet(fn);for(;e<i.length&&i[e]!=this.layer;)e++;this.dom.style.zIndex=String((this.layer.above?150:-1)-e);}},{key:"measure",value:function measure(){return this.layer.markers(this.view);}},{key:"scale",value:function scale(){var _this$view=this.view,t=_this$view.scaleX,e=_this$view.scaleY;t==this.scaleX&&e==this.scaleY||(this.scaleX=t,this.scaleY=e,this.dom.style.transform="scale(".concat(1/t,", ").concat(1/e,")"));}},{key:"draw",value:function draw(t){var _this50=this;if(t.length!=this.drawn.length||t.some(function(t,e){return i=t,s=_this50.drawn[e],!(i.constructor==s.constructor&&i.eq(s));var i,s;})){var _e139=this.dom.firstChild,_i124=0;var _iterator98=_createForOfIteratorHelper(t),_step98;try{for(_iterator98.s();!(_step98=_iterator98.n()).done;){var _s112=_step98.value;_s112.update&&_e139&&_s112.constructor&&this.drawn[_i124].constructor&&_s112.update(_e139,this.drawn[_i124])?(_e139=_e139.nextSibling,_i124++):this.dom.insertBefore(_s112.draw(),_e139);}}catch(err){_iterator98.e(err);}finally{_iterator98.f();}for(;_e139;){var _t166=_e139.nextSibling;_e139.remove(),_e139=_t166;}this.drawn=t;}}},{key:"destroy",value:function destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove();}}]);}();fn=j.define();cn=!Ve.ios;dn=j.define({combine:function combine(t){return At(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:function cursorBlinkRate(t,e){return Math.min(t,e);},drawRangeCursor:function drawRangeCursor(t,e){return t||e;}});}});mn=an({above:!0,markers:function markers(t){var e=t.state,i=e.facet(dn),s=[];var _iterator99=_createForOfIteratorHelper(e.selection.ranges),_step99;try{for(_iterator99.s();!(_step99=_iterator99.n()).done;){var _r94=_step99.value;var _n77=_r94==e.selection.main;if(_r94.empty?!_n77||cn:i.drawRangeCursor){var _e140=_n77?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",_i125=_r94.empty?_r94:B.cursor(_r94.head,_r94.head>_r94.anchor?-1:1);var _iterator100=_createForOfIteratorHelper(hn.forRange(t,_e140,_i125)),_step100;try{for(_iterator100.s();!(_step100=_iterator100.n()).done;){var _r95=_step100.value;s.push(_r95);}}catch(err){_iterator100.e(err);}finally{_iterator100.f();}}}}catch(err){_iterator99.e(err);}finally{_iterator99.f();}return s;},update:function update(t,e){t.transactions.some(function(t){return t.selection;})&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");var i=pn(t);return i&&gn(t.state,e),t.docChanged||t.selectionSet||i;},mount:function mount(t,e){gn(e.state,t);},"class":"cm-cursorLayer"});wn=an({above:!1,markers:function markers(t){return t.state.selection.ranges.map(function(e){return e.empty?[]:hn.forRange(t,"cm-selectionBackground",e);}).reduce(function(t,e){return t.concat(e);});},update:function update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||pn(t);},"class":"cm-selectionLayer"});bn={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};cn&&(bn[".cm-line"].caretColor="transparent !important",bn[".cm-content"]={caretColor:"transparent !important"});vn=_.highest(Ur.theme(bn));kn=ct.define({map:function map(t,e){return null==t?null:e.mapPos(t);}});yn=F.define({create:function create(){return null;},update:function update(t,e){return null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(function(t,e){return e.is(kn)?e.value:t;},t);}});Mn=_i.fromClass(/*#__PURE__*/function(){function _class(t){_classCallCheck(this,_class);this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)};}return _createClass(_class,[{key:"update",value:function update(t){var e;var i=t.state.field(yn);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(yn)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq));}},{key:"readPos",value:function readPos(){var t=this.view,e=t.state.field(yn),i=null!=e&&t.coordsAtPos(e);if(!i)return null;var s=t.scrollDOM.getBoundingClientRect();return{left:i.left-s.left+t.scrollDOM.scrollLeft*t.scaleX,top:i.top-s.top+t.scrollDOM.scrollTop*t.scaleY,height:i.bottom-i.top};}},{key:"drawCursor",value:function drawCursor(t){if(this.cursor){var _this$view2=this.view,_e141=_this$view2.scaleX,_i126=_this$view2.scaleY;t?(this.cursor.style.left=t.left/_e141+"px",this.cursor.style.top=t.top/_i126+"px",this.cursor.style.height=t.height/_i126+"px"):this.cursor.style.left="-100000px";}}},{key:"destroy",value:function destroy(){this.cursor&&this.cursor.remove();}},{key:"setDropPos",value:function setDropPos(t){this.view.state.field(yn)!=t&&this.view.dispatch({effects:kn.of(t)});}}]);}(),{eventObservers:{dragover:function dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}));},dragleave:function dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null);},dragend:function dragend(){this.setDropPos(null);},drop:function drop(){this.setDropPos(null);}}});Sn=/*#__PURE__*/function(){function Sn(t){_classCallCheck(this,Sn);var e=t.regexp,i=t.decoration,s=t.decorate,r=t.boundary,_t$maxLength=t.maxLength,n=_t$maxLength===void 0?1e3:_t$maxLength;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,s)this.addMatch=function(t,e,i,r){return s(r,i,i+t[0].length,t,e);};else if("function"==typeof i)this.addMatch=function(t,e,s,r){var n=i(t,e,s);n&&r(s,s+t[0].length,n);};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,s,r){return r(s,s+t[0].length,i);};}this.boundary=r,this.maxLength=n;}return _createClass(Sn,[{key:"createDeco",value:function createDeco(t){var _this51=this;var e=new Rt(),i=e.add.bind(e);var _iterator101=_createForOfIteratorHelper(function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;var s=[];var _iterator102=_createForOfIteratorHelper(i),_step102;try{for(_iterator102.s();!(_step102=_iterator102.n()).done;){var _step102$value=_step102.value,_r96=_step102$value.from,_n79=_step102$value.to;_r96=Math.max(t.state.doc.lineAt(_r96).from,_r96-e),_n79=Math.min(t.state.doc.lineAt(_n79).to,_n79+e),s.length&&s[s.length-1].to>=_r96?s[s.length-1].to=_n79:s.push({from:_r96,to:_n79});}}catch(err){_iterator102.e(err);}finally{_iterator102.f();}return s;}(t,this.maxLength)),_step101;try{for(_iterator101.s();!(_step101=_iterator101.n()).done;){var _step101$value=_step101.value,_e142=_step101$value.from,_s113=_step101$value.to;xn(t.state.doc,this.regexp,_e142,_s113,function(e,s){return _this51.addMatch(s,t,e,i);});}}catch(err){_iterator101.e(err);}finally{_iterator101.f();}return e.finish();}},{key:"updateDeco",value:function updateDeco(t,e){var i=1e9,s=-1;return t.docChanged&&t.changes.iterChanges(function(e,r,n,h){h>t.view.viewport.from&&n<t.view.viewport.to&&(i=Math.min(n,i),s=Math.max(h,s));}),t.viewportChanged||s-i>1e3?this.createDeco(t.view):s>-1?this.updateRange(t.view,e.map(t.changes),i,s):e;}},{key:"updateRange",value:function updateRange(t,e,i,s){var _this52=this;var _iterator103=_createForOfIteratorHelper(t.visibleRanges),_step103;try{var _loop9=function _loop9(){var r=_step103.value;var n=Math.max(r.from,i),h=Math.min(r.to,s);if(h>n){var _i127=t.state.doc.lineAt(n),_s114=_i127.to<h?t.state.doc.lineAt(h):_i127,_l46=Math.max(r.from,_i127.from),_o33=Math.min(r.to,_s114.to);if(_this52.boundary){for(;n>_i127.from;n--)if(_this52.boundary.test(_i127.text[n-1-_i127.from])){_l46=n;break;}for(;h<_s114.to;h++)if(_this52.boundary.test(_s114.text[h-_s114.from])){_o33=h;break;}}var _u36,_f20=[],_a13=function _a13(t,e,i){return _f20.push(i.range(t,e));};if(_i127==_s114)for(_this52.regexp.lastIndex=_l46-_i127.from;(_u36=_this52.regexp.exec(_i127.text))&&_u36.index<_o33-_i127.from;)_this52.addMatch(_u36,t,_u36.index+_i127.from,_a13);else xn(t.state.doc,_this52.regexp,_l46,_o33,function(e,i){return _this52.addMatch(i,t,e,_a13);});e=e.update({filterFrom:_l46,filterTo:_o33,filter:function filter(t,e){return t<_l46||e>_o33;},add:_f20});}};for(_iterator103.s();!(_step103=_iterator103.n()).done;){_loop9();}}catch(err){_iterator103.e(err);}finally{_iterator103.f();}return e;}}]);}();An=null!=/x/.unicode?"gu":"g";Cn=new RegExp("[\0-\b\n-\x1F\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]",An);On={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"};Dn=null;En=j.define({combine:function combine(t){var e=At(t,{render:null,specialChars:Cn,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==Dn&&"undefined"!=typeof document&&document.body){var _e143=document.body.style;Dn=null!=(null!==(t=_e143.tabSize)&&void 0!==t?t:_e143.MozTabSize);}return Dn||!1;}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,An)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,An)),e;}});In=null;Rn=/*#__PURE__*/function(_si4){function Rn(t,e){var _this53;_classCallCheck(this,Rn);_this53=_callSuper(this,Rn),_this53.options=t,_this53.code=e;return _this53;}_inherits(Rn,_si4);return _createClass(Rn,[{key:"eq",value:function eq(t){return t.code==this.code;}},{key:"toDOM",value:function toDOM(t){var e=function(t){return t>=32?"•":10==t?"":String.fromCharCode(9216+t);}(this.code),i=t.state.phrase("Control character")+" "+(On[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,e);if(s)return s;var r=document.createElement("span");return r.textContent=e,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);Tn=/*#__PURE__*/function(_si5){function Tn(t){var _this54;_classCallCheck(this,Tn);_this54=_callSuper(this,Tn),_this54.width=t;return _this54;}_inherits(Tn,_si5);return _createClass(Tn,[{key:"eq",value:function eq(t){return t.width==this.width;}},{key:"toDOM",value:function toDOM(){var t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);Bn=ni.line({"class":"cm-activeLine"});Ln=_i.fromClass(/*#__PURE__*/function(){function _class2(t){_classCallCheck(this,_class2);this.decorations=this.getDeco(t);}return _createClass(_class2,[{key:"update",value:function update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view));}},{key:"getDeco",value:function getDeco(t){var e=-1,i=[];var _iterator104=_createForOfIteratorHelper(t.state.selection.ranges),_step104;try{for(_iterator104.s();!(_step104=_iterator104.n()).done;){var _s115=_step104.value;var _r97=t.lineBlockAt(_s115.head);_r97.from>e&&(i.push(Bn.range(_r97.from)),e=_r97.from);}}catch(err){_iterator104.e(err);}finally{_iterator104.f();}return ni.set(i);}}]);}(),{decorations:function decorations(t){return t.decorations;}});Nn=/*#__PURE__*/function(_si6){function Nn(t){var _this55;_classCallCheck(this,Nn);_this55=_callSuper(this,Nn),_this55.content=t;return _this55;}_inherits(Nn,_si6);return _createClass(Nn,[{key:"toDOM",value:function toDOM(){var t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t;}},{key:"coordsAt",value:function coordsAt(t){var e=t.firstChild?ne(t.firstChild):[];if(!e.length)return null;var i=window.getComputedStyle(t.parentNode),s=ae(e[0],"rtl"!=i.direction),r=parseInt(i.lineHeight);return s.bottom-s.top>1.5*r?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);$n=2e3;Hn={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;}]};Wn={style:"cursor: crosshair"};Vn="-10000px";Fn=/*#__PURE__*/function(){function Fn(t,e,i,s){_classCallCheck(this,Fn);this.facet=e,this.createTooltipView=i,this.removeTooltipView=s,this.input=t.state.facet(e),this.tooltips=this.input.filter(function(t){return t;});var r=null;this.tooltipViews=this.tooltips.map(function(t){return r=i(t,r);});}return _createClass(Fn,[{key:"update",value:function update(t,e){var i;var s=t.state.facet(this.facet),r=s.filter(function(t){return t;});if(s===this.input){var _iterator105=_createForOfIteratorHelper(this.tooltipViews),_step105;try{for(_iterator105.s();!(_step105=_iterator105.n()).done;){var _e148=_step105.value;_e148.update&&_e148.update(t);}}catch(err){_iterator105.e(err);}finally{_iterator105.f();}return!1;}var n=[],h=e?[]:null;for(var _i130=0;_i130<r.length;_i130++){var _s117=r[_i130],_l49=-1;if(_s117){for(var _t167=0;_t167<this.tooltips.length;_t167++){var _e149=this.tooltips[_t167];_e149&&_e149.create==_s117.create&&(_l49=_t167);}if(_l49<0)n[_i130]=this.createTooltipView(_s117,_i130?n[_i130-1]:null),h&&(h[_i130]=!!_s117.above);else{var _s118=n[_i130]=this.tooltipViews[_l49];h&&(h[_i130]=e[_l49]),_s118.update&&_s118.update(t);}}}var _iterator106=_createForOfIteratorHelper(this.tooltipViews),_step106;try{for(_iterator106.s();!(_step106=_iterator106.n()).done;){var _t168=_step106.value;n.indexOf(_t168)<0&&(this.removeTooltipView(_t168),null===(i=_t168.destroy)||void 0===i||i.call(_t168));}}catch(err){_iterator106.e(err);}finally{_iterator106.f();}return e&&(h.forEach(function(t,i){return e[i]=t;}),e.length=h.length),this.input=s,this.tooltips=r,this.tooltipViews=n,!0;}}]);}();Un=j.define({combine:function combine(t){var e,i,s;return{position:Ve.ios?"absolute":(null===(e=t.find(function(t){return t.position;}))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find(function(t){return t.parent;}))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(s=t.find(function(t){return t.tooltipSpace;}))||void 0===s?void 0:s.tooltipSpace)||qn};}});Jn=new WeakMap();Gn=_i.fromClass(/*#__PURE__*/function(){function _class4(t){var _this56=this;_classCallCheck(this,_class4);this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;var e=t.state.facet(Un);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(function(){return _this56.measureSoon();}):null,this.manager=new Fn(t,Xn,function(t,e){return _this56.createTooltip(t,e);},function(t){_this56.resizeObserver&&_this56.resizeObserver.unobserve(t.dom),t.dom.remove();}),this.above=this.manager.tooltips.map(function(t){return!!t.above;}),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(function(t){Date.now()>_this56.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&_this56.measureSoon();},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure();}return _createClass(_class4,[{key:"createContainer",value:function createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom;}},{key:"observeIntersection",value:function observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();var _iterator107=_createForOfIteratorHelper(this.manager.tooltipViews),_step107;try{for(_iterator107.s();!(_step107=_iterator107.n()).done;){var _t169=_step107.value;this.intersectionObserver.observe(_t169.dom);}}catch(err){_iterator107.e(err);}finally{_iterator107.f();}}}},{key:"measureSoon",value:function measureSoon(){var _this57=this;this.measureTimeout<0&&(this.measureTimeout=setTimeout(function(){_this57.measureTimeout=-1,_this57.maybeMeasure();},50));}},{key:"update",value:function update(t){t.transactions.length&&(this.lastTransaction=Date.now());var e=this.manager.update(t,this.above);e&&this.observeIntersection();var i=e||t.geometryChanged,s=t.state.facet(Un);if(s.position!=this.position&&!this.madeAbsolute){this.position=s.position;var _iterator108=_createForOfIteratorHelper(this.manager.tooltipViews),_step108;try{for(_iterator108.s();!(_step108=_iterator108.n()).done;){var _t170=_step108.value;_t170.dom.style.position=this.position;}}catch(err){_iterator108.e(err);}finally{_iterator108.f();}i=!0;}if(s.parent!=this.parent){this.parent&&this.container.remove(),this.parent=s.parent,this.createContainer();var _iterator109=_createForOfIteratorHelper(this.manager.tooltipViews),_step109;try{for(_iterator109.s();!(_step109=_iterator109.n()).done;){var _t171=_step109.value;this.container.appendChild(_t171.dom);}}catch(err){_iterator109.e(err);}finally{_iterator109.f();}i=!0;}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure();}},{key:"createTooltip",value:function createTooltip(t,e){var i=t.create(this.view),s=e?e.dom:null;if(i.dom.classList.add("cm-tooltip"),t.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){var _t172=document.createElement("div");_t172.className="cm-tooltip-arrow",i.dom.appendChild(_t172);}return i.dom.style.position=this.position,i.dom.style.top=Vn,i.dom.style.left="0px",this.container.insertBefore(i.dom,s),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i;}},{key:"destroy",value:function destroy(){var t,e,i;this.view.win.removeEventListener("resize",this.measureSoon);var _iterator110=_createForOfIteratorHelper(this.manager.tooltipViews),_step110;try{for(_iterator110.s();!(_step110=_iterator110.n()).done;){var _e150=_step110.value;_e150.dom.remove(),null===(t=_e150.destroy)||void 0===t||t.call(_e150);}}catch(err){_iterator110.e(err);}finally{_iterator110.f();}this.parent&&this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(i=this.intersectionObserver)||void 0===i||i.disconnect(),clearTimeout(this.measureTimeout);}},{key:"readMeasure",value:function readMeasure(){var _this58=this;var t=this.view.dom.getBoundingClientRect(),e=1,i=1,s=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){var _t173=this.manager.tooltipViews[0].dom;if(Ve.gecko)s=_t173.offsetParent!=this.container.ownerDocument.body;else if(_t173.style.top==Vn&&"0px"==_t173.style.left){var _e151=_t173.getBoundingClientRect();s=Math.abs(_e151.top+1e4)>1||Math.abs(_e151.left)>1;}}if(s||"absolute"==this.position)if(this.parent){var _t174=this.parent.getBoundingClientRect();_t174.width&&_t174.height&&(e=_t174.width/this.parent.offsetWidth,i=_t174.height/this.parent.offsetHeight);}else{var _this$view$viewState=this.view.viewState;e=_this$view$viewState.scaleX;i=_this$view$viewState.scaleY;}return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(function(t,e){var i=_this58.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):_this58.view.coordsAtPos(t.pos);}),size:this.manager.tooltipViews.map(function(_ref15){var t=_ref15.dom;return t.getBoundingClientRect();}),space:this.view.state.facet(Un).tooltipSpace(this.view),scaleX:e,scaleY:i,makeAbsolute:s};}},{key:"writeMeasure",value:function writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";var _iterator111=_createForOfIteratorHelper(this.manager.tooltipViews),_step111;try{for(_iterator111.s();!(_step111=_iterator111.n()).done;){var _t175=_step111.value;_t175.dom.style.position="absolute";}}catch(err){_iterator111.e(err);}finally{_iterator111.f();}}var i=t.editor,s=t.space,r=t.scaleX,n=t.scaleY,h=[];for(var _l50=0;_l50<this.manager.tooltips.length;_l50++){var _o34=this.manager.tooltips[_l50],_u37=this.manager.tooltipViews[_l50],_f21=_u37.dom,_a14=t.pos[_l50],_c12=t.size[_l50];if(!_a14||_a14.bottom<=Math.max(i.top,s.top)||_a14.top>=Math.min(i.bottom,s.bottom)||_a14.right<Math.max(i.left,s.left)-.1||_a14.left>Math.min(i.right,s.right)+.1){_f21.style.top=Vn;continue;}var _d8=_o34.arrow?_u37.dom.querySelector(".cm-tooltip-arrow"):null,_p6=_d8?7:0,_m4=_c12.right-_c12.left,_g4=null!==(e=Jn.get(_u37))&&void 0!==e?e:_c12.bottom-_c12.top,_w=_u37.offset||_n,_b=this.view.textDirection==pi.LTR,_v=_c12.width>s.right-s.left?_b?s.left:s.right-_c12.width:_b?Math.min(_a14.left-(_d8?14:0)+_w.x,s.right-_m4):Math.max(s.left,_a14.left-_m4+(_d8?14:0)-_w.x),_k=this.above[_l50];!_o34.strictSide&&(_k?_a14.top-(_c12.bottom-_c12.top)-_w.y<s.top:_a14.bottom+(_c12.bottom-_c12.top)+_w.y>s.bottom)&&_k==s.bottom-_a14.bottom>_a14.top-s.top&&(_k=this.above[_l50]=!_k);var _y=(_k?_a14.top-s.top:s.bottom-_a14.bottom)-_p6;if(_y<_g4&&!1!==_u37.resize){if(_y<this.view.defaultLineHeight){_f21.style.top=Vn;continue;}Jn.set(_u37,_g4),_f21.style.height=(_g4=_y)/n+"px";}else _f21.style.height&&(_f21.style.height="");var _M=_k?_a14.top-_g4-_p6-_w.y:_a14.bottom+_p6+_w.y,_x=_v+_m4;if(!0!==_u37.overlap){var _iterator112=_createForOfIteratorHelper(h),_step112;try{for(_iterator112.s();!(_step112=_iterator112.n()).done;){var _t176=_step112.value;_t176.left<_x&&_t176.right>_v&&_t176.top<_M+_g4&&_t176.bottom>_M&&(_M=_k?_t176.top-_g4-2-_p6:_t176.bottom+_p6+2);}}catch(err){_iterator112.e(err);}finally{_iterator112.f();}}if("absolute"==this.position?(_f21.style.top=(_M-t.parent.top)/n+"px",_f21.style.left=(_v-t.parent.left)/r+"px"):(_f21.style.top=_M/n+"px",_f21.style.left=_v/r+"px"),_d8){var _t177=_a14.left+(_b?_w.x:-_w.x)-(_v+14-7);_d8.style.left=_t177/r+"px";}!0!==_u37.overlap&&h.push({left:_v,top:_M,right:_x,bottom:_M+_g4}),_f21.classList.toggle("cm-tooltip-above",_k),_f21.classList.toggle("cm-tooltip-below",!_k),_u37.positioned&&_u37.positioned(t.space);}}},{key:"maybeMeasure",value:function maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView))){var _iterator113=_createForOfIteratorHelper(this.manager.tooltipViews),_step113;try{for(_iterator113.s();!(_step113=_iterator113.n()).done;){var _t178=_step113.value;_t178.dom.style.top=Vn;}}catch(err){_iterator113.e(err);}finally{_iterator113.f();}}}}]);}(),{eventObservers:{scroll:function scroll(){this.maybeMeasure();}}});Kn=Ur.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}});_n={x:0,y:0};Xn=j.define({enables:[Gn,Kn]});Yn=j.define({combine:function combine(t){return t.reduce(function(t,e){return t.concat(e);},[]);}});Qn=/*#__PURE__*/function(){function Qn(t){var _this59=this;_classCallCheck(this,Qn);this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Fn(t,Yn,function(t,e){return _this59.createHostedView(t,e);},function(t){return t.dom.remove();});}return _createClass(Qn,[{key:"createHostedView",value:function createHostedView(t,e){var i=t.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i;}},{key:"mount",value:function mount(t){var _iterator114=_createForOfIteratorHelper(this.manager.tooltipViews),_step114;try{for(_iterator114.s();!(_step114=_iterator114.n()).done;){var _e152=_step114.value;_e152.mount&&_e152.mount(t);}}catch(err){_iterator114.e(err);}finally{_iterator114.f();}this.mounted=!0;}},{key:"positioned",value:function positioned(t){var _iterator115=_createForOfIteratorHelper(this.manager.tooltipViews),_step115;try{for(_iterator115.s();!(_step115=_iterator115.n()).done;){var _e153=_step115.value;_e153.positioned&&_e153.positioned(t);}}catch(err){_iterator115.e(err);}finally{_iterator115.f();}}},{key:"update",value:function update(t){this.manager.update(t);}},{key:"destroy",value:function destroy(){var t;var _iterator116=_createForOfIteratorHelper(this.manager.tooltipViews),_step116;try{for(_iterator116.s();!(_step116=_iterator116.n()).done;){var _e154=_step116.value;null===(t=_e154.destroy)||void 0===t||t.call(_e154);}}catch(err){_iterator116.e(err);}finally{_iterator116.f();}}},{key:"passProp",value:function passProp(t){var e;var _iterator117=_createForOfIteratorHelper(this.manager.tooltipViews),_step117;try{for(_iterator117.s();!(_step117=_iterator117.n()).done;){var _i131=_step117.value;var _s119=_i131[t];if(void 0!==_s119)if(void 0===e)e=_s119;else if(e!==_s119)return;}}catch(err){_iterator117.e(err);}finally{_iterator117.f();}return e;}},{key:"offset",get:function get(){return this.passProp("offset");}},{key:"getCoords",get:function get(){return this.passProp("getCoords");}},{key:"overlap",get:function get(){return this.passProp("overlap");}},{key:"resize",get:function get(){return this.passProp("resize");}}],[{key:"create",value:function create(t){return new Qn(t);}}]);}();Zn=Xn.compute([Yn],function(t){var e=t.facet(Yn);return 0===e.length?null:{pos:Math.min.apply(Math,_toConsumableArray(e.map(function(t){return t.pos;}))),end:Math.max.apply(Math,_toConsumableArray(e.map(function(t){var e;return null!==(e=t.end)&&void 0!==e?e:t.pos;}))),create:Qn.create,above:e[0].above,arrow:e.some(function(t){return t.arrow;})};});th=/*#__PURE__*/function(){function th(t,e,i,s,r){_classCallCheck(this,th);this.view=t,this.source=e,this.field=i,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this));}return _createClass(th,[{key:"update",value:function update(){var _this60=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(function(){return _this60.startHover();},20));}},{key:"active",get:function get(){return this.view.state.field(this.field);}},{key:"checkHover",value:function checkHover(){if(this.hoverTimeout=-1,this.active.length)return;var t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover();}},{key:"startHover",value:function startHover(){var _this61=this;clearTimeout(this.restartTimeout);var t=this.view,e=this.lastMove,i=t.docView.nearest(e.target);if(!i)return;var s,r=1;if(i instanceof Ue)s=i.posAtStart;else{if(s=t.posAtCoords(e),null==s)return;var _i132=t.coordsAtPos(s);if(!_i132||e.y<_i132.top||e.y>_i132.bottom||e.x<_i132.left-t.defaultCharacterWidth||e.x>_i132.right+t.defaultCharacterWidth)return;var _n80=t.bidiSpans(t.state.doc.lineAt(s)).find(function(t){return t.from<=s&&t.to>=s;}),_h49=_n80&&_n80.dir==pi.RTL?-1:1;r=e.x<_i132.left?-_h49:_h49;}var n=this.source(t,s,r);if(null==n?void 0:n.then){var _e155=this.pending={pos:s};n.then(function(i){_this61.pending==_e155&&(_this61.pending=null,!i||Array.isArray(i)&&!i.length||t.dispatch({effects:_this61.setHover.of(Array.isArray(i)?i:[i])}));},function(e){return Ui(t.state,e,"hover tooltip");});}else!n||Array.isArray(n)&&!n.length||t.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])});}},{key:"tooltip",get:function get(){var t=this.view.plugin(Gn),e=t?t.manager.tooltips.findIndex(function(t){return t.create==Qn.create;}):-1;return e>-1?t.manager.tooltipViews[e]:null;}},{key:"mousemove",value:function mousemove(t){var e,i;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));var s=this.active,r=this.tooltip;if(s.length&&r&&!function(t,e){var i=t.getBoundingClientRect();return e.clientX>=i.left-eh&&e.clientX<=i.right+eh&&e.clientY>=i.top-eh&&e.clientY<=i.bottom+eh;}(r.dom,t)||this.pending){var _ref16=s[0]||this.pending,_r99=_ref16.pos,_n81=null!==(i=null===(e=s[0])||void 0===e?void 0:e.end)&&void 0!==i?i:_r99;(_r99==_n81?this.view.posAtCoords(this.lastMove)==_r99:function(t,e,i,s,r,n){var h=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(h.left>s||h.right<s||h.top>r||Math.min(h.bottom,l)<r)return!1;var o=t.posAtCoords({x:s,y:r},!1);return o>=e&&o<=i;}(this.view,_r99,_n81,t.clientX,t.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null);}}},{key:"mouseleave",value:function mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;var e=this.active;if(e.length){var _e156=this.tooltip;_e156&&_e156.dom.contains(t.relatedTarget)?this.watchTooltipLeave(_e156.dom):this.view.dispatch({effects:this.setHover.of([])});}}},{key:"watchTooltipLeave",value:function watchTooltipLeave(t){var _this62=this;var e=function e(i){t.removeEventListener("mouseleave",e),_this62.active.length&&!_this62.view.dom.contains(i.relatedTarget)&&_this62.view.dispatch({effects:_this62.setHover.of([])});};t.addEventListener("mouseleave",e);}},{key:"destroy",value:function destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove);}}]);}();eh=4;rh=ct.define();nh=j.define({combine:function combine(t){var e,i;var _iterator120=_createForOfIteratorHelper(t),_step120;try{for(_iterator120.s();!(_step120=_iterator120.n()).done;){var _s120=_step120.value;e=e||_s120.topContainer,i=i||_s120.bottomContainer;}}catch(err){_iterator120.e(err);}finally{_iterator120.f();}return{topContainer:e,bottomContainer:i};}});lh=_i.fromClass(/*#__PURE__*/function(){function _class5(t){_classCallCheck(this,_class5);this.input=t.state.facet(fh),this.specs=this.input.filter(function(t){return t;}),this.panels=this.specs.map(function(e){return e(t);});var e=t.state.facet(nh);this.top=new oh(t,!0,e.topContainer),this.bottom=new oh(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(function(t){return t.top;})),this.bottom.sync(this.panels.filter(function(t){return!t.top;}));var _iterator121=_createForOfIteratorHelper(this.panels),_step121;try{for(_iterator121.s();!(_step121=_iterator121.n()).done;){var _t180=_step121.value;_t180.dom.classList.add("cm-panel"),_t180.mount&&_t180.mount();}}catch(err){_iterator121.e(err);}finally{_iterator121.f();}}return _createClass(_class5,[{key:"update",value:function update(t){var e=t.state.facet(nh);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new oh(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new oh(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();var i=t.state.facet(fh);if(i!=this.input){var _e159=i.filter(function(t){return t;}),_s121=[],_r101=[],_n82=[],_h50=[];var _iterator122=_createForOfIteratorHelper(_e159),_step122;try{for(_iterator122.s();!(_step122=_iterator122.n()).done;){var _i135=_step122.value;var _e160=void 0,_l51=this.specs.indexOf(_i135);_l51<0?(_e160=_i135(t.view),_h50.push(_e160)):(_e160=this.panels[_l51],_e160.update&&_e160.update(t)),_s121.push(_e160),(_e160.top?_r101:_n82).push(_e160);}}catch(err){_iterator122.e(err);}finally{_iterator122.f();}this.specs=_e159,this.panels=_s121,this.top.sync(_r101),this.bottom.sync(_n82);for(var _i134=0,_h51=_h50;_i134<_h51.length;_i134++){var _t181=_h51[_i134];_t181.dom.classList.add("cm-panel"),_t181.mount&&_t181.mount();}}else{var _iterator123=_createForOfIteratorHelper(this.panels),_step123;try{for(_iterator123.s();!(_step123=_iterator123.n()).done;){var _e161=_step123.value;_e161.update&&_e161.update(t);}}catch(err){_iterator123.e(err);}finally{_iterator123.f();}}}},{key:"destroy",value:function destroy(){this.top.sync([]),this.bottom.sync([]);}}]);}(),{provide:function provide(t){return Ur.scrollMargins.of(function(e){var i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()};});}});oh=/*#__PURE__*/function(){function oh(t,e,i){_classCallCheck(this,oh);this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses();}return _createClass(oh,[{key:"sync",value:function sync(t){var _iterator124=_createForOfIteratorHelper(this.panels),_step124;try{for(_iterator124.s();!(_step124=_iterator124.n()).done;){var _e162=_step124.value;_e162.destroy&&t.indexOf(_e162)<0&&_e162.destroy();}}catch(err){_iterator124.e(err);}finally{_iterator124.f();}this.panels=t,this.syncDOM();}},{key:"syncDOM",value:function syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";var _t182=this.container||this.view.dom;_t182.insertBefore(this.dom,this.top?_t182.firstChild:null);}var t=this.dom.firstChild;var _iterator125=_createForOfIteratorHelper(this.panels),_step125;try{for(_iterator125.s();!(_step125=_iterator125.n()).done;){var _e163=_step125.value;if(_e163.dom.parentNode==this.dom){for(;t!=_e163.dom;)t=uh(t);t=t.nextSibling;}else this.dom.insertBefore(_e163.dom,t);}}catch(err){_iterator125.e(err);}finally{_iterator125.f();}for(;t;)t=uh(t);}},{key:"scrollMargin",value:function scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top);}},{key:"syncClasses",value:function syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){var _iterator126=_createForOfIteratorHelper(this.classes.split(" ")),_step126;try{for(_iterator126.s();!(_step126=_iterator126.n()).done;){var _t183=_step126.value;_t183&&this.container.classList.remove(_t183);}}catch(err){_iterator126.e(err);}finally{_iterator126.f();}var _iterator127=_createForOfIteratorHelper((this.classes=this.view.themeClasses).split(" ")),_step127;try{for(_iterator127.s();!(_step127=_iterator127.n()).done;){var _t184=_step127.value;_t184&&this.container.classList.add(_t184);}}catch(err){_iterator127.e(err);}finally{_iterator127.f();}}}}]);}();fh=j.define({enables:lh});ah=/*#__PURE__*/function(_Ct2){function ah(){_classCallCheck(this,ah);return _callSuper(this,ah,arguments);}_inherits(ah,_Ct2);return _createClass(ah,[{key:"compare",value:function compare(t){return this==t||this.constructor==t.constructor&&this.eq(t);}},{key:"eq",value:function eq(t){return!1;}},{key:"destroy",value:function destroy(t){}}]);}(Ct);ah.prototype.elementClass="",ah.prototype.toDOM=void 0,ah.prototype.mapMode=x.TrackBefore,ah.prototype.startSide=ah.prototype.endSide=-1,ah.prototype.point=!0;ch=j.define();dh={"class":"",renderEmptyElements:!1,elementStyle:"",markers:function markers(){return It.empty;},lineMarker:function lineMarker(){return null;},widgetMarker:function widgetMarker(){return null;},lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}};ph=j.define();gh=j.define({combine:function combine(t){return t.some(function(t){return t;});}});bh=_i.fromClass(/*#__PURE__*/function(){function _class6(t){_classCallCheck(this,_class6);this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(ph).map(function(e){return new Mh(t,e);});var _iterator128=_createForOfIteratorHelper(this.gutters),_step128;try{for(_iterator128.s();!(_step128=_iterator128.n()).done;){var _t185=_step128.value;this.dom.appendChild(_t185.dom);}}catch(err){_iterator128.e(err);}finally{_iterator128.f();}this.fixed=!t.state.facet(gh),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM);}return _createClass(_class6,[{key:"update",value:function update(t){if(this.updateGutters(t)){var _e164=this.prevViewport,_i136=t.view.viewport,_s122=Math.min(_e164.to,_i136.to)-Math.max(_e164.from,_i136.from);this.syncGutters(_s122<.8*(_i136.to-_i136.from));}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(gh)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport;}},{key:"syncGutters",value:function syncGutters(t){var _this63=this;var e=this.dom.nextSibling;t&&this.dom.remove();var i=It.iter(this.view.state.facet(ch),this.view.viewport.from),s=[],r=this.gutters.map(function(t){return new yh(t,_this63.view.viewport,-_this63.view.documentPadding.top);});var _iterator129=_createForOfIteratorHelper(this.view.viewportLineBlocks),_step129;try{for(_iterator129.s();!(_step129=_iterator129.n()).done;){var _t186=_step129.value;if(s.length&&(s=[]),Array.isArray(_t186.type)){var _e165=!0;var _iterator131=_createForOfIteratorHelper(_t186.type),_step131;try{for(_iterator131.s();!(_step131=_iterator131.n()).done;){var _n83=_step131.value;if(_n83.type==ri.Text&&_e165){kh(i,s,_n83.from);var _iterator132=_createForOfIteratorHelper(r),_step132;try{for(_iterator132.s();!(_step132=_iterator132.n()).done;){var _t187=_step132.value;_t187.line(this.view,_n83,s);}}catch(err){_iterator132.e(err);}finally{_iterator132.f();}_e165=!1;}else if(_n83.widget){var _iterator133=_createForOfIteratorHelper(r),_step133;try{for(_iterator133.s();!(_step133=_iterator133.n()).done;){var _t188=_step133.value;_t188.widget(this.view,_n83);}}catch(err){_iterator133.e(err);}finally{_iterator133.f();}}}}catch(err){_iterator131.e(err);}finally{_iterator131.f();}}else if(_t186.type==ri.Text){kh(i,s,_t186.from);var _iterator134=_createForOfIteratorHelper(r),_step134;try{for(_iterator134.s();!(_step134=_iterator134.n()).done;){var _e166=_step134.value;_e166.line(this.view,_t186,s);}}catch(err){_iterator134.e(err);}finally{_iterator134.f();}}else if(_t186.widget){var _iterator135=_createForOfIteratorHelper(r),_step135;try{for(_iterator135.s();!(_step135=_iterator135.n()).done;){var _e167=_step135.value;_e167.widget(this.view,_t186);}}catch(err){_iterator135.e(err);}finally{_iterator135.f();}}}}catch(err){_iterator129.e(err);}finally{_iterator129.f();}var _iterator130=_createForOfIteratorHelper(r),_step130;try{for(_iterator130.s();!(_step130=_iterator130.n()).done;){var _t189=_step130.value;_t189.finish();}}catch(err){_iterator130.e(err);}finally{_iterator130.f();}t&&this.view.scrollDOM.insertBefore(this.dom,e);}},{key:"updateGutters",value:function updateGutters(t){var e=t.startState.facet(ph),i=t.state.facet(ph),s=t.docChanged||t.heightChanged||t.viewportChanged||!It.eq(t.startState.facet(ch),t.state.facet(ch),t.view.viewport.from,t.view.viewport.to);if(e==i){var _iterator136=_createForOfIteratorHelper(this.gutters),_step136;try{for(_iterator136.s();!(_step136=_iterator136.n()).done;){var _e168=_step136.value;_e168.update(t)&&(s=!0);}}catch(err){_iterator136.e(err);}finally{_iterator136.f();}}else{s=!0;var _r102=[];var _iterator137=_createForOfIteratorHelper(i),_step137;try{for(_iterator137.s();!(_step137=_iterator137.n()).done;){var _s123=_step137.value;var _i138=e.indexOf(_s123);_i138<0?_r102.push(new Mh(this.view,_s123)):(this.gutters[_i138].update(t),_r102.push(this.gutters[_i138]));}}catch(err){_iterator137.e(err);}finally{_iterator137.f();}var _iterator138=_createForOfIteratorHelper(this.gutters),_step138;try{for(_iterator138.s();!(_step138=_iterator138.n()).done;){var _t191=_step138.value;_t191.dom.remove(),_r102.indexOf(_t191)<0&&_t191.destroy();}}catch(err){_iterator138.e(err);}finally{_iterator138.f();}for(var _i137=0,_r103=_r102;_i137<_r103.length;_i137++){var _t190=_r103[_i137];this.dom.appendChild(_t190.dom);}this.gutters=_r102;}return s;}},{key:"destroy",value:function destroy(){var _iterator139=_createForOfIteratorHelper(this.gutters),_step139;try{for(_iterator139.s();!(_step139=_iterator139.n()).done;){var _t192=_step139.value;_t192.destroy();}}catch(err){_iterator139.e(err);}finally{_iterator139.f();}this.dom.remove();}}]);}(),{provide:function provide(t){return Ur.scrollMargins.of(function(e){var i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==pi.LTR?{left:i.dom.offsetWidth*e.scaleX}:{right:i.dom.offsetWidth*e.scaleX}:null;});}});yh=/*#__PURE__*/function(){function yh(t,e,i){_classCallCheck(this,yh);this.gutter=t,this.height=i,this.i=0,this.cursor=It.iter(t.markers,e.from);}return _createClass(yh,[{key:"addElement",value:function addElement(t,e,i){var s=this.gutter,r=(e.top-this.height)/t.scaleY,n=e.height/t.scaleY;if(this.i==s.elements.length){var _e169=new xh(t,n,r,i);s.elements.push(_e169),s.dom.appendChild(_e169.dom);}else s.elements[this.i].update(t,n,r,i);this.height=e.bottom,this.i++;}},{key:"line",value:function line(t,e,i){var s=[];kh(this.cursor,s,e.from),i.length&&(s=s.concat(i));var r=this.gutter.config.lineMarker(t,e,s);r&&s.unshift(r);var n=this.gutter;(0!=s.length||n.config.renderEmptyElements)&&this.addElement(t,e,s);}},{key:"widget",value:function widget(t,e){var i=this.gutter.config.widgetMarker(t,e.widget,e);i&&this.addElement(t,e,[i]);}},{key:"finish",value:function finish(){var t=this.gutter;for(;t.elements.length>this.i;){var _e170=t.elements.pop();t.dom.removeChild(_e170.dom),_e170.destroy();}}}]);}();Mh=/*#__PURE__*/function(){function Mh(t,e){var _this64=this;_classCallCheck(this,Mh);this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config["class"]?" "+this.config["class"]:"");var _loop10=function _loop10(_i139){_this64.dom.addEventListener(_i139,function(s){var r,n=s.target;if(n!=_this64.dom&&_this64.dom.contains(n)){for(;n.parentNode!=_this64.dom;)n=n.parentNode;var _t193=n.getBoundingClientRect();r=(_t193.top+_t193.bottom)/2;}else r=s.clientY;var h=t.lineBlockAtHeight(r-t.documentTop);e.domEventHandlers[_i139](t,h,s)&&s.preventDefault();});};for(var _i139 in e.domEventHandlers){_loop10(_i139);}this.markers=vh(e.markers(t)),e.initialSpacer&&(this.spacer=new xh(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none");}return _createClass(Mh,[{key:"update",value:function update(t){var e=this.markers;if(this.markers=vh(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){var _e171=this.config.updateSpacer(this.spacer.markers[0],t);_e171!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[_e171]);}var i=t.view.viewport;return!It.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t);}},{key:"destroy",value:function destroy(){var _iterator140=_createForOfIteratorHelper(this.elements),_step140;try{for(_iterator140.s();!(_step140=_iterator140.n()).done;){var _t194=_step140.value;_t194.destroy();}}catch(err){_iterator140.e(err);}finally{_iterator140.f();}}}]);}();xh=/*#__PURE__*/function(){function xh(t,e,i,s){_classCallCheck(this,xh);this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,s);}return _createClass(xh,[{key:"update",value:function update(t,e,i,s){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(var _i140=0;_i140<t.length;_i140++)if(!t[_i140].compare(e[_i140]))return!1;return!0;}(this.markers,s)||this.setMarkers(t,s);}},{key:"setMarkers",value:function setMarkers(t,e){var i="cm-gutterElement",s=this.dom.firstChild;for(var _r104=0,_n84=0;;){var _h52=_n84,_l52=_r104<e.length?e[_r104++]:null,_o35=!1;if(_l52){var _t195=_l52.elementClass;_t195&&(i+=" "+_t195);for(var _t196=_n84;_t196<this.markers.length;_t196++)if(this.markers[_t196].compare(_l52)){_h52=_t196,_o35=!0;break;}}else _h52=this.markers.length;for(;_n84<_h52;){var _t197=this.markers[_n84++];if(_t197.toDOM){_t197.destroy(s);var _e172=s.nextSibling;s.remove(),s=_e172;}}if(!_l52)break;_l52.toDOM&&(_o35?s=s.nextSibling:this.dom.insertBefore(_l52.toDOM(t),s)),_o35&&_n84++;}this.dom.className=i,this.markers=e;}},{key:"destroy",value:function destroy(){this.setMarkers(null,[]);}}]);}();Sh=j.define();Ah=j.define({combine:function combine(t){return At(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers:function domEventHandlers(t,e){var i=Object.assign({},t);var _loop11=function _loop11(){var s=i[_t198],r=e[_t198];i[_t198]=s?function(t,e,i){return s(t,e,i)||r(t,e,i);}:r;};for(var _t198 in e){_loop11();}return i;}});}});Ch=/*#__PURE__*/function(_ah){function Ch(t){var _this65;_classCallCheck(this,Ch);_this65=_callSuper(this,Ch),_this65.number=t;return _this65;}_inherits(Ch,_ah);return _createClass(Ch,[{key:"eq",value:function eq(t){return this.number==t.number;}},{key:"toDOM",value:function toDOM(){return document.createTextNode(this.number);}}]);}(ah);Dh=ph.compute([Ah],function(t){return{"class":"cm-lineNumbers",renderEmptyElements:!1,markers:function markers(t){return t.state.facet(Sh);},lineMarker:function lineMarker(t,e,i){return i.some(function(t){return t.toDOM;})?null:new Ch(Oh(t,t.state.doc.lineAt(e.from).number));},widgetMarker:function widgetMarker(){return null;},lineMarkerChange:function lineMarkerChange(t){return t.startState.facet(Ah)!=t.state.facet(Ah);},initialSpacer:function initialSpacer(t){return new Ch(Oh(t,Ih(t.state.doc.lines)));},updateSpacer:function updateSpacer(t,e){var i=Oh(e.view,Ih(e.view.state.doc.lines));return i==t.number?t:new Ch(i);},domEventHandlers:t.facet(Ah).domEventHandlers};});Rh=new(/*#__PURE__*/function(_ah2){function _class7(){var _this66;_classCallCheck(this,_class7);_this66=_callSuper(this,_class7,arguments),_this66.elementClass="cm-activeLineGutter";return _this66;}_inherits(_class7,_ah2);return _createClass(_class7);}(ah))();Th=ch.compute(["selection"],function(t){var e=[],i=-1;var _iterator141=_createForOfIteratorHelper(t.selection.ranges),_step141;try{for(_iterator141.s();!(_step141=_iterator141.n()).done;){var _s124=_step141.value;var _r105=t.doc.lineAt(_s124.head).from;_r105>i&&(i=_r105,e.push(Rh.range(_r105)));}}catch(err){_iterator141.e(err);}finally{_iterator141.f();}return It.of(e);});_export("D",Bh=1024);Lh=0;Nh=/*#__PURE__*/_createClass(function Nh(t,e){_classCallCheck(this,Nh);this.from=t,this.to=e;});_export("b",jh=/*#__PURE__*/function(){function jh(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,jh);this.id=Lh++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||function(){throw new Error("This node type doesn't define a deserialize function");};}return _createClass(jh,[{key:"add",value:function add(t){var _this67=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=Ph.match(t)),function(e){var i=t(e);return void 0===i?null:[_this67,i];};}}]);}());jh.closedBy=new jh({deserialize:function deserialize(t){return t.split(" ");}}),jh.openedBy=new jh({deserialize:function deserialize(t){return t.split(" ");}}),jh.group=new jh({deserialize:function deserialize(t){return t.split(" ");}}),jh.isolate=new jh({deserialize:function deserialize(t){if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto";}}),jh.contextHash=new jh({perNode:!0}),jh.lookAhead=new jh({perNode:!0}),jh.mounted=new jh({perNode:!0});$h=/*#__PURE__*/function(){function $h(t,e,i){_classCallCheck(this,$h);this.tree=t,this.overlay=e,this.parser=i;}return _createClass($h,null,[{key:"get",value:function get(t){return t&&t.props&&t.props[jh.mounted.id];}}]);}();zh=Object.create(null);_export("a",Ph=/*#__PURE__*/function(){function Ph(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;_classCallCheck(this,Ph);this.name=t,this.props=e,this.id=i,this.flags=s;}return _createClass(Ph,[{key:"prop",value:function prop(t){return this.props[t.id];}},{key:"isTop",get:function get(){return(1&this.flags)>0;}},{key:"isSkipped",get:function get(){return(2&this.flags)>0;}},{key:"isError",get:function get(){return(4&this.flags)>0;}},{key:"isAnonymous",get:function get(){return(8&this.flags)>0;}},{key:"is",value:function is(t){if("string"==typeof t){if(this.name==t)return!0;var _e173=this.prop(jh.group);return!!_e173&&_e173.indexOf(t)>-1;}return this.id==t;}}],[{key:"define",value:function define(t){var e=t.props&&t.props.length?Object.create(null):zh,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),s=new Ph(t.name||"",e,t.id,i);if(t.props){var _iterator142=_createForOfIteratorHelper(t.props),_step142;try{for(_iterator142.s();!(_step142=_iterator142.n()).done;){var _i141=_step142.value;if(Array.isArray(_i141)||(_i141=_i141(s)),_i141){if(_i141[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[_i141[0].id]=_i141[1];}}}catch(err){_iterator142.e(err);}finally{_iterator142.f();}}return s;}},{key:"match",value:function match(t){var e=Object.create(null);for(var _i142 in t){var _iterator143=_createForOfIteratorHelper(_i142.split(" ")),_step143;try{for(_iterator143.s();!(_step143=_iterator143.n()).done;){var _s125=_step143.value;e[_s125]=t[_i142];}}catch(err){_iterator143.e(err);}finally{_iterator143.f();}}return function(t){for(var _i143=t.prop(jh.group),_s126=-1;_s126<(_i143?_i143.length:0);_s126++){var _r106=e[_s126<0?t.name:_i143[_s126]];if(_r106)return _r106;}};}}]);}());Ph.none=new Ph("",Object.create(null),0,8);_export("N",Hh=/*#__PURE__*/function(){function Hh(t){_classCallCheck(this,Hh);this.types=t;for(var _e174=0;_e174<t.length;_e174++)if(t[_e174].id!=_e174)throw new RangeError("Node type ids should correspond to array positions when creating a node set");}return _createClass(Hh,[{key:"extend",value:function extend(){var e=[];for(var _len4=arguments.length,t=new Array(_len4),_key4=0;_key4<_len4;_key4++){t[_key4]=arguments[_key4];}var _iterator144=_createForOfIteratorHelper(this.types),_step144;try{for(_iterator144.s();!(_step144=_iterator144.n()).done;){var _i144=_step144.value;var _s127=null;var _iterator145=_createForOfIteratorHelper(t),_step145;try{for(_iterator145.s();!(_step145=_iterator145.n()).done;){var _e175=_step145.value;var _t199=_e175(_i144);_t199&&(_s127||(_s127=Object.assign({},_i144.props)),_s127[_t199[0].id]=_t199[1]);}}catch(err){_iterator145.e(err);}finally{_iterator145.f();}e.push(_s127?new Ph(_i144.name,_s127,_i144.id,_i144.flags):_i144);}}catch(err){_iterator144.e(err);}finally{_iterator144.f();}return new Hh(e);}}]);}());Wh=new WeakMap();Vh=new WeakMap();!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays";}(Fh||_export("I",Fh={}));_export("T",qh=/*#__PURE__*/function(){function qh(t,e,i,s,r){_classCallCheck(this,qh);if(this.type=t,this.children=e,this.positions=i,this.length=s,this.props=null,r&&r.length){this.props=Object.create(null);var _iterator146=_createForOfIteratorHelper(r),_step146;try{for(_iterator146.s();!(_step146=_iterator146.n()).done;){var _step146$value=_slicedToArray(_step146.value,2),_t200=_step146$value[0],_e176=_step146$value[1];this.props["number"==typeof _t200?_t200:_t200.id]=_e176;}}catch(err){_iterator146.e(err);}finally{_iterator146.f();}}}return _createClass(qh,[{key:"toString",value:function toString(){var t=$h.get(this);if(t&&!t.overlay)return t.tree.toString();var e="";var _iterator147=_createForOfIteratorHelper(this.children),_step147;try{for(_iterator147.s();!(_step147=_iterator147.n()).done;){var _t201=_step147.value;var _i145=_t201.toString();_i145&&(e&&(e+=","),e+=_i145);}}catch(err){_iterator147.e(err);}finally{_iterator147.f();}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e;}},{key:"cursor",value:function cursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return new sl(this.topNode,t);}},{key:"cursorAt",value:function cursorAt(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=Wh.get(this)||this.topNode,r=new sl(s);return r.moveTo(t,e),Wh.set(this,r._tree),r;}},{key:"topNode",get:function get(){return new Xh(this,0,0,null);}},{key:"resolve",value:function resolve(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=Kh(Wh.get(this)||this.topNode,t,e,!1);return Wh.set(this,i),i;}},{key:"resolveInner",value:function resolveInner(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=Kh(Vh.get(this)||this.topNode,t,e,!0);return Vh.set(this,i),i;}},{key:"resolveStack",value:function resolveStack(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return function(t,e,i){var s=t.resolveInner(e,i),r=null;for(var _t202=s instanceof Xh?s:s.context.parent;_t202;_t202=_t202.parent)if(_t202.index<0){var _n85=_t202.parent;(r||(r=[s])).push(_n85.resolve(e,i)),_t202=_n85;}else{var _n86=$h.get(_t202.tree);if(_n86&&_n86.overlay&&_n86.overlay[0].from<=e&&_n86.overlay[_n86.overlay.length-1].to>=e){var _h53=new Xh(_n86.tree,_n86.overlay[0].from+_t202.from,-1,_t202);(r||(r=[s])).push(Kh(_h53,e,i,!1));}}return r?el(r):s;}(this,t,e);}},{key:"iterate",value:function iterate(t){var e=t.enter,i=t.leave,_t$from=t.from,s=_t$from===void 0?0:_t$from,_t$to=t.to,r=_t$to===void 0?this.length:_t$to,n=t.mode||0,h=(n&Fh.IncludeAnonymous)>0;for(var _t203=this.cursor(n|Fh.IncludeAnonymous);;){var _n87=!1;if(_t203.from<=r&&_t203.to>=s&&(!h&&_t203.type.isAnonymous||!1!==e(_t203))){if(_t203.firstChild())continue;_n87=!0;}for(;_n87&&i&&(h||!_t203.type.isAnonymous)&&i(_t203),!_t203.nextSibling();){if(!_t203.parent())return;_n87=!0;}}}},{key:"prop",value:function prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t);}},{key:"propValues",get:function get(){var t=[];if(this.props)for(var _e177 in this.props)t.push([+_e177,this.props[_e177]]);return t;}},{key:"balance",value:function balance(){var _this68=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return this.children.length<=8?this:ll(Ph.none,this.children,this.positions,0,this.children.length,0,this.length,function(t,e,i){return new qh(_this68.type,t,e,i,_this68.propValues);},t.makeTree||function(t,e,i){return new qh(Ph.none,t,e,i);});}}],[{key:"build",value:function build(t){return function(t){var e;var i=t.buffer,s=t.nodeSet,_t$maxBufferLength=t.maxBufferLength,r=_t$maxBufferLength===void 0?Bh:_t$maxBufferLength,_t$reused=t.reused,n=_t$reused===void 0?[]:_t$reused,_t$minRepeatType=t.minRepeatType,h=_t$minRepeatType===void 0?s.types.length:_t$minRepeatType,l=Array.isArray(i)?new Uh(i,i.length):i,o=s.types,u=0,f=0;function a(t,e,i,b,v,k){var y=l.id,M=l.start,x=l.end,S=l.size,A=f;for(;S<0;){if(l.next(),-1==S){var _e178=n[y];return i.push(_e178),void b.push(M-t);}if(-3==S)return void(u=y);if(-4==S)return void(f=y);throw new RangeError("Unrecognized record size: ".concat(S));}var C,O,D=o[y],E=M-t;if(x-M<=r&&(O=g(l.pos-e,v))){var _e179=new Uint16Array(O.size-O.skip),_i146=l.pos-O.size,_r107=_e179.length;for(;l.pos>_i146;)_r107=w(O.start,_e179,_r107);C=new Jh(_e179,x-O.start,s),E=O.start-t;}else{var _t204=l.pos-S;l.next();var _e180=[],_i147=[],_s128=y>=h?y:-1,_n88=0,_o36=x;for(;l.pos>_t204;)_s128>=0&&l.id==_s128&&l.size>=0?(l.end<=_o36-r&&(p(_e180,_i147,M,_n88,l.end,_o36,_s128,A),_n88=_e180.length,_o36=l.end),l.next()):k>2500?c(M,_t204,_e180,_i147):a(M,_t204,_e180,_i147,_s128,k+1);if(_s128>=0&&_n88>0&&_n88<_e180.length&&p(_e180,_i147,M,_n88,M,_o36,_s128,A),_e180.reverse(),_i147.reverse(),_s128>-1&&_n88>0){var _t205=d(D);C=ll(D,_e180,_i147,0,_e180.length,0,x-M,_t205,_t205);}else C=m(D,_e180,_i147,x-M,A-x);}i.push(C),b.push(E);}function c(t,e,i,n){var h=[],o=0,u=-1;for(;l.pos>e;){var _t206=l.id,_e181=l.start,_i148=l.end,_s129=l.size;if(_s129>4)l.next();else{if(u>-1&&_e181<u)break;u<0&&(u=_i148-r),h.push(_t206,_e181,_i148),o++,l.next();}}if(o){var _e182=new Uint16Array(4*o),_r108=h[h.length-2];for(var _t207=h.length-3,_i149=0;_t207>=0;_t207-=3)_e182[_i149++]=h[_t207],_e182[_i149++]=h[_t207+1]-_r108,_e182[_i149++]=h[_t207+2]-_r108,_e182[_i149++]=_i149;i.push(new Jh(_e182,h[2]-_r108,s)),n.push(_r108-t);}}function d(t){return function(e,i,s){var r,n,h=0,l=e.length-1;if(l>=0&&(r=e[l])instanceof qh){if(!l&&r.type==t&&r.length==s)return r;(n=r.prop(jh.lookAhead))&&(h=i[l]+r.length+n);}return m(t,e,i,s,h);};}function p(t,e,i,r,n,h,l,o){var u=[],f=[];for(;t.length>r;)u.push(t.pop()),f.push(e.pop()+i-n);t.push(m(s.types[l],u,f,h-n,o-h)),e.push(n-i);}function m(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var n=arguments.length>5?arguments[5]:undefined;if(u){var _t208=[jh.contextHash,u];n=n?[_t208].concat(n):[_t208];}if(r>25){var _t209=[jh.lookAhead,r];n=n?[_t209].concat(n):[_t209];}return new qh(t,e,i,s,n);}function g(t,e){var i=l.fork(),s=0,n=0,o=0,u=i.end-r,f={size:0,start:0,skip:0};t:for(var _r109=i.pos-t;i.pos>_r109;){var _t210=i.size;if(i.id==e&&_t210>=0){f.size=s,f.start=n,f.skip=o,o+=4,s+=4,i.next();continue;}var _l53=i.pos-_t210;if(_t210<0||_l53<_r109||i.start<u)break;var _a15=i.id>=h?4:0,_c13=i.start;for(i.next();i.pos>_l53;){if(i.size<0){if(-3!=i.size)break t;_a15+=4;}else i.id>=h&&(_a15+=4);i.next();}n=_c13,s+=_t210,o+=_a15;}return(e<0||s==t)&&(f.size=s,f.start=n,f.skip=o),f.size>4?f:void 0;}function w(t,e,i){var s=l.id,r=l.start,n=l.end,o=l.size;if(l.next(),o>=0&&s<h){var _h54=i;if(o>4){var _s130=l.pos-(o-4);for(;l.pos>_s130;)i=w(t,e,i);}e[--i]=_h54,e[--i]=n-t,e[--i]=r-t,e[--i]=s;}else-3==o?u=s:-4==o&&(f=s);return i;}var b=[],v=[];for(;l.pos>0;)a(t.start||0,t.bufferStart||0,b,v,-1,0);var k=null!==(e=t.length)&&void 0!==e?e:b.length?v[0]+b[0].length:0;return new qh(o[t.topID],b.reverse(),v.reverse(),k);}(t);}}]);}());qh.empty=new qh(Ph.none,[],[],0);Uh=/*#__PURE__*/function(){function Uh(t,e){_classCallCheck(this,Uh);this.buffer=t,this.index=e;}return _createClass(Uh,[{key:"id",get:function get(){return this.buffer[this.index-4];}},{key:"start",get:function get(){return this.buffer[this.index-3];}},{key:"end",get:function get(){return this.buffer[this.index-2];}},{key:"size",get:function get(){return this.buffer[this.index-1];}},{key:"pos",get:function get(){return this.index;}},{key:"next",value:function next(){this.index-=4;}},{key:"fork",value:function fork(){return new Uh(this.buffer,this.index);}}]);}();Jh=/*#__PURE__*/function(){function Jh(t,e,i){_classCallCheck(this,Jh);this.buffer=t,this.length=e,this.set=i;}return _createClass(Jh,[{key:"type",get:function get(){return Ph.none;}},{key:"toString",value:function toString(){var t=[];for(var _e183=0;_e183<this.buffer.length;)t.push(this.childString(_e183)),_e183=this.buffer[_e183+3];return t.join(",");}},{key:"childString",value:function childString(t){var e=this.buffer[t],i=this.buffer[t+3],s=this.set.types[e],r=s.name;if(/\W/.test(r)&&!s.isError&&(r=JSON.stringify(r)),i==(t+=4))return r;var n=[];for(;t<i;)n.push(this.childString(t)),t=this.buffer[t+3];return r+"("+n.join(",")+")";}},{key:"findChild",value:function findChild(t,e,i,s,r){var n=this.buffer,h=-1;for(var _l54=t;_l54!=e&&!(Gh(r,s,n[_l54+1],n[_l54+2])&&(h=_l54,i>0));_l54=n[_l54+3]);return h;}},{key:"slice",value:function slice(t,e,i){var s=this.buffer,r=new Uint16Array(e-t),n=0;for(var _h55=t,_l55=0;_h55<e;){r[_l55++]=s[_h55++],r[_l55++]=s[_h55++]-i;var _e184=r[_l55++]=s[_h55++]-i;r[_l55++]=s[_h55++]-t,n=Math.max(n,_e184);}return new Jh(r,n,this.set);}}]);}();_h=/*#__PURE__*/function(){function _h(){_classCallCheck(this,_h);}return _createClass(_h,[{key:"cursor",value:function cursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return new sl(this,t);}},{key:"getChild",value:function getChild(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var s=Yh(this,t,e,i);return s.length?s[0]:null;}},{key:"getChildren",value:function getChildren(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return Yh(this,t,e,i);}},{key:"resolve",value:function resolve(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Kh(this,t,e,!1);}},{key:"resolveInner",value:function resolveInner(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Kh(this,t,e,!0);}},{key:"matchContext",value:function matchContext(t){return Qh(this,t);}},{key:"enterUnfinishedNodesBefore",value:function enterUnfinishedNodesBefore(t){var e=this.childBefore(t),i=this;for(;e;){var _t211=e.lastChild;if(!_t211||_t211.to!=e.to)break;_t211.type.isError&&_t211.from==_t211.to?(i=e,e=_t211.prevSibling):e=_t211;}return i;}},{key:"node",get:function get(){return this;}},{key:"next",get:function get(){return this.parent;}}]);}();Xh=/*#__PURE__*/function(_h57){function Xh(t,e,i,s){var _this69;_classCallCheck(this,Xh);_this69=_callSuper(this,Xh),_this69._tree=t,_this69.from=e,_this69.index=i,_this69._parent=s;return _this69;}_inherits(Xh,_h57);return _createClass(Xh,[{key:"type",get:function get(){return this._tree.type;}},{key:"name",get:function get(){return this._tree.type.name;}},{key:"to",get:function get(){return this.from+this._tree.length;}},{key:"nextChild",value:function nextChild(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;for(var _n89=this;;){for(var _n89$_tree=_n89._tree,_h58=_n89$_tree.children,_l56=_n89$_tree.positions,_o37=e>0?_h58.length:-1;t!=_o37;t+=e){var _o38=_h58[t],_u38=_l56[t]+_n89.from;if(Gh(s,i,_u38,_u38+_o38.length))if(_o38 instanceof Jh){if(r&Fh.ExcludeBuffers)continue;var _h59=_o38.findChild(0,_o38.buffer.length,e,i-_u38,s);if(_h59>-1)return new tl(new Zh(_n89,_o38,t,_u38),null,_h59);}else if(r&Fh.IncludeAnonymous||!_o38.type.isAnonymous||rl(_o38)){var _h60=void 0;if(!(r&Fh.IgnoreMounts)&&(_h60=$h.get(_o38))&&!_h60.overlay)return new Xh(_h60.tree,_u38,t,_n89);var _l57=new Xh(_o38,_u38,t,_n89);return r&Fh.IncludeAnonymous||!_l57.type.isAnonymous?_l57:_l57.nextChild(e<0?_o38.children.length-1:0,e,i,s);}}if(r&Fh.IncludeAnonymous||!_n89.type.isAnonymous)return null;if(t=_n89.index>=0?_n89.index+e:e<0?-1:_n89._parent._tree.children.length,_n89=_n89._parent,!_n89)return null;}}},{key:"firstChild",get:function get(){return this.nextChild(0,1,0,4);}},{key:"lastChild",get:function get(){return this.nextChild(this._tree.children.length-1,-1,0,4);}},{key:"childAfter",value:function childAfter(t){return this.nextChild(0,1,t,2);}},{key:"childBefore",value:function childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2);}},{key:"enter",value:function enter(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s;if(!(i&Fh.IgnoreOverlays)&&(s=$h.get(this._tree))&&s.overlay){var _i150=t-this.from;var _iterator148=_createForOfIteratorHelper(s.overlay),_step148;try{for(_iterator148.s();!(_step148=_iterator148.n()).done;){var _step148$value=_step148.value,_t212=_step148$value.from,_r110=_step148$value.to;if((e>0?_t212<=_i150:_t212<_i150)&&(e<0?_r110>=_i150:_r110>_i150))return new Xh(s.tree,s.overlay[0].from+this.from,-1,this);}}catch(err){_iterator148.e(err);}finally{_iterator148.f();}}return this.nextChild(0,1,t,e,i);}},{key:"nextSignificantParent",value:function nextSignificantParent(){var t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t;}},{key:"parent",get:function get(){return this._parent?this._parent.nextSignificantParent():null;}},{key:"nextSibling",get:function get(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null;}},{key:"prevSibling",get:function get(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null;}},{key:"tree",get:function get(){return this._tree;}},{key:"toTree",value:function toTree(){return this._tree;}},{key:"toString",value:function toString(){return this._tree.toString();}}]);}(_h);Zh=/*#__PURE__*/_createClass(function Zh(t,e,i,s){_classCallCheck(this,Zh);this.parent=t,this.buffer=e,this.index=i,this.start=s;});tl=/*#__PURE__*/function(_h61){function tl(t,e,i){var _this70;_classCallCheck(this,tl);_this70=_callSuper(this,tl),_this70.context=t,_this70._parent=e,_this70.index=i,_this70.type=t.buffer.set.types[t.buffer.buffer[i]];return _this70;}_inherits(tl,_h61);return _createClass(tl,[{key:"name",get:function get(){return this.type.name;}},{key:"from",get:function get(){return this.context.start+this.context.buffer.buffer[this.index+1];}},{key:"to",get:function get(){return this.context.start+this.context.buffer.buffer[this.index+2];}},{key:"child",value:function child(t,e,i){var s=this.context.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],t,e-this.context.start,i);return r<0?null:new tl(this.context,this,r);}},{key:"firstChild",get:function get(){return this.child(1,0,4);}},{key:"lastChild",get:function get(){return this.child(-1,0,4);}},{key:"childAfter",value:function childAfter(t){return this.child(1,t,2);}},{key:"childBefore",value:function childBefore(t){return this.child(-1,t,-2);}},{key:"enter",value:function enter(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;if(i&Fh.ExcludeBuffers)return null;var s=this.context.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new tl(this.context,this,r);}},{key:"parent",get:function get(){return this._parent||this.context.parent.nextSignificantParent();}},{key:"externalSibling",value:function externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4);}},{key:"nextSibling",get:function get(){var t=this.context.buffer,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new tl(this.context,this._parent,e):this.externalSibling(1);}},{key:"prevSibling",get:function get(){var t=this.context.buffer,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new tl(this.context,this._parent,t.findChild(e,this.index,-1,0,4));}},{key:"tree",get:function get(){return null;}},{key:"toTree",value:function toTree(){var t=[],e=[],i=this.context.buffer,s=this.index+4,r=i.buffer[this.index+3];if(r>s){var _n90=i.buffer[this.index+1];t.push(i.slice(s,r,_n90)),e.push(0);}return new qh(this.type,t,e,this.to-this.from);}},{key:"toString",value:function toString(){return this.context.buffer.childString(this.index);}}]);}(_h);il=/*#__PURE__*/function(){function il(t,e){_classCallCheck(this,il);this.heads=t,this.node=e;}return _createClass(il,[{key:"next",get:function get(){return el(this.heads);}}]);}();sl=/*#__PURE__*/function(){function sl(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;_classCallCheck(this,sl);if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Xh)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(var _e186=t._parent;_e186;_e186=_e186._parent)this.stack.unshift(_e186.index);this.bufferNode=t,this.yieldBuf(t.index);}}return _createClass(sl,[{key:"name",get:function get(){return this.type.name;}},{key:"yieldNode",value:function yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0);}},{key:"yieldBuf",value:function yieldBuf(t,e){this.index=t;var _this$buffer=this.buffer,i=_this$buffer.start,s=_this$buffer.buffer;return this.type=e||s.set.types[s.buffer[t]],this.from=i+s.buffer[t+1],this.to=i+s.buffer[t+2],!0;}},{key:"yield",value:function _yield(t){return!!t&&(t instanceof Xh?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)));}},{key:"toString",value:function toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString();}},{key:"enterChild",value:function enterChild(t,e,i){if(!this.buffer)return this["yield"](this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));var s=this.buffer.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],t,e-this.buffer.start,i);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r));}},{key:"firstChild",value:function firstChild(){return this.enterChild(1,0,4);}},{key:"lastChild",value:function lastChild(){return this.enterChild(-1,0,4);}},{key:"childAfter",value:function childAfter(t){return this.enterChild(1,t,2);}},{key:"childBefore",value:function childBefore(t){return this.enterChild(-1,t,-2);}},{key:"enter",value:function enter(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.mode;return this.buffer?!(i&Fh.ExcludeBuffers)&&this.enterChild(1,t,e):this["yield"](this._tree.enter(t,e,i));}},{key:"parent",value:function parent(){if(!this.buffer)return this.yieldNode(this.mode&Fh.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&Fh.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t);}},{key:"sibling",value:function sibling(t){if(!this.buffer)return!!this._tree._parent&&this["yield"](this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));var e=this.buffer.buffer,i=this.stack.length-1;if(t<0){var _t214=i<0?0:this.stack[i]+4;if(this.index!=_t214)return this.yieldBuf(e.findChild(_t214,this.index,-1,0,4));}else{var _t215=e.buffer[this.index+3];if(_t215<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(_t215);}return i<0&&this["yield"](this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode));}},{key:"nextSibling",value:function nextSibling(){return this.sibling(1);}},{key:"prevSibling",value:function prevSibling(){return this.sibling(-1);}},{key:"atLastNode",value:function atLastNode(t){var e,i,s=this.buffer;if(s){if(t>0){if(this.index<s.buffer.buffer.length)return!1;}else for(var _t216=0;_t216<this.index;_t216++)if(s.buffer.buffer[_t216+3]<this.index)return!1;e=s.index;i=s.parent;}else{var _this$_tree=this._tree;e=_this$_tree.index;i=_this$_tree._parent;}for(;i;_i151=i,e=_i151.index,i=_i151._parent,_i151){var _i151;if(e>-1)for(var _s135=e+t,_r112=t<0?-1:i._tree.children.length;_s135!=_r112;_s135+=t){var _t217=i._tree.children[_s135];if(this.mode&Fh.IncludeAnonymous||_t217 instanceof Jh||!_t217.type.isAnonymous||rl(_t217))return!1;}}return!0;}},{key:"move",value:function move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1;}}},{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;return this.move(1,t);}},{key:"prev",value:function prev(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;return this.move(-1,t);}},{key:"moveTo",value:function moveTo(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this;}},{key:"node",get:function get(){if(!this.buffer)return this._tree;var t=this.bufferNode,e=null,i=0;if(t&&t.context==this.buffer)t:for(var _s136=this.index,_r113=this.stack.length;_r113>=0;){for(var _n91=t;_n91;_n91=_n91._parent)if(_n91.index==_s136){if(_s136==this.index)return _n91;e=_n91,i=_r113+1;break t;}_s136=this.stack[--_r113];}for(var _t218=i;_t218<this.stack.length;_t218++)e=new tl(this.buffer,e,this.stack[_t218]);return this.bufferNode=new tl(this.buffer,e,this.index);}},{key:"tree",get:function get(){return this.buffer?null:this._tree._tree;}},{key:"iterate",value:function iterate(t,e){for(var _i152=0;;){var _s137=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){_i152++;continue;}this.type.isAnonymous||(_s137=!0);}for(;_s137&&e&&e(this),_s137=this.type.isAnonymous,!this.nextSibling();){if(!_i152)return;this.parent(),_i152--,_s137=!0;}}}},{key:"matchContext",value:function matchContext(t){if(!this.buffer)return Qh(this.node,t);var e=this.buffer.buffer,i=e.set.types;for(var _s138=t.length-1,_r114=this.stack.length-1;_s138>=0;_r114--){if(_r114<0)return Qh(this.node,t,_s138);var _n92=i[e.buffer[this.stack[_r114]]];if(!_n92.isAnonymous){if(t[_s138]&&t[_s138]!=_n92.name)return!1;_s138--;}}return!0;}}]);}();nl=new WeakMap();_export("q",ol=/*#__PURE__*/function(){function ol(){_classCallCheck(this,ol);this.map=new WeakMap();}return _createClass(ol,[{key:"setBuffer",value:function setBuffer(t,e,i){var s=this.map.get(t);s||this.map.set(t,s=new Map()),s.set(e,i);}},{key:"getBuffer",value:function getBuffer(t,e){var i=this.map.get(t);return i&&i.get(e);}},{key:"set",value:function set(t,e){t instanceof tl?this.setBuffer(t.context.buffer,t.index,e):t instanceof Xh&&this.map.set(t.tree,e);}},{key:"get",value:function get(t){return t instanceof tl?this.getBuffer(t.context.buffer,t.index):t instanceof Xh?this.map.get(t.tree):void 0;}},{key:"cursorSet",value:function cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e);}},{key:"cursorGet",value:function cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree);}}]);}());_export("z",ul=/*#__PURE__*/function(){function ul(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:!1;var n=arguments.length>5&&arguments[5]!==undefined?arguments[5]:!1;_classCallCheck(this,ul);this.from=t,this.to=e,this.tree=i,this.offset=s,this.open=(r?1:0)|(n?2:0);}return _createClass(ul,[{key:"openStart",get:function get(){return(1&this.open)>0;}},{key:"openEnd",get:function get(){return(2&this.open)>0;}}],[{key:"addTree",value:function addTree(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=[new ul(0,t.length,t,0,!1,i)];var _iterator150=_createForOfIteratorHelper(e),_step150;try{for(_iterator150.s();!(_step150=_iterator150.n()).done;){var _i154=_step150.value;_i154.to>t.length&&s.push(_i154);}}catch(err){_iterator150.e(err);}finally{_iterator150.f();}return s;}},{key:"applyChanges",value:function applyChanges(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:128;if(!e.length)return t;var s=[],r=1,n=t.length?t[0]:null;for(var _h62=0,_l58=0,_o39=0;;_h62++){var _u40=_h62<e.length?e[_h62]:null,_f22=_u40?_u40.fromA:1e9;if(_f22-_l58>=i)for(;n&&n.from<_f22;){var _e189=n;if(_l58>=_e189.from||_f22<=_e189.to||_o39){var _t220=Math.max(_e189.from,_l58)-_o39,_i155=Math.min(_e189.to,_f22)-_o39;_e189=_t220>=_i155?null:new ul(_t220,_i155,_e189.tree,_e189.offset+_o39,_h62>0,!!_u40);}if(_e189&&s.push(_e189),n.to>_f22)break;n=r<t.length?t[r++]:null;}if(!_u40)break;_l58=_u40.toA,_o39=_u40.toA-_u40.toB;}return s;}}]);}());_export("P",fl=/*#__PURE__*/function(){function fl(){_classCallCheck(this,fl);}return _createClass(fl,[{key:"startParse",value:function startParse(t,e,i){return"string"==typeof t&&(t=new al(t)),i=i?i.length?i.map(function(t){return new Nh(t.from,t.to);}):[new Nh(0,0)]:[new Nh(0,t.length)],this.createParse(t,e||[],i);}},{key:"parse",value:function parse(t,e,i){var s=this.startParse(t,e,i);for(;;){var _t221=s.advance();if(_t221)return _t221;}}}]);}());al=/*#__PURE__*/function(){function al(t){_classCallCheck(this,al);this.string=t;}return _createClass(al,[{key:"length",get:function get(){return this.string.length;}},{key:"chunk",value:function chunk(t){return this.string.slice(t);}},{key:"lineChunks",get:function get(){return!1;}},{key:"read",value:function read(t,e){return this.string.slice(t,e);}}]);}();dl=/*#__PURE__*/_createClass(function dl(t,e,i,s,r){_classCallCheck(this,dl);this.parser=t,this.parse=e,this.overlay=i,this.target=s,this.from=r;});ml=/*#__PURE__*/_createClass(function ml(t,e,i,s,r,n,h){_classCallCheck(this,ml);this.parser=t,this.predicate=e,this.mounts=i,this.index=s,this.start=r,this.target=n,this.prev=h,this.depth=0,this.ranges=[];});gl=new jh({perNode:!0});wl=/*#__PURE__*/function(){function wl(t,e,i,s,r){_classCallCheck(this,wl);this.nest=e,this.input=i,this.fragments=s,this.ranges=r,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t;}return _createClass(wl,[{key:"advance",value:function advance(){if(this.baseParse){var _t222=this.baseParse.advance();if(!_t222)return null;if(this.baseParse=null,this.baseTree=_t222,this.startInner(),null!=this.stoppedAt){var _iterator151=_createForOfIteratorHelper(this.inner),_step151;try{for(_iterator151.s();!(_step151=_iterator151.n()).done;){var _t223=_step151.value;_t223.parse.stopAt(this.stoppedAt);}}catch(err){_iterator151.e(err);}finally{_iterator151.f();}}}if(this.innerDone==this.inner.length){var _t224=this.baseTree;return null!=this.stoppedAt&&(_t224=new qh(_t224.type,_t224.children,_t224.positions,_t224.length,_t224.propValues.concat([[gl,this.stoppedAt]]))),_t224;}var t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;var _i156=Object.assign(Object.create(null),t.target.props);_i156[jh.mounted.id]=new $h(e,t.overlay,t.parser),t.target.props=_i156;}return null;}},{key:"parsedPos",get:function get(){if(this.baseParse)return 0;var t=this.input.length;for(var _e190=this.innerDone;_e190<this.inner.length;_e190++)this.inner[_e190].from<t&&(t=Math.min(t,this.inner[_e190].parse.parsedPos));return t;}},{key:"stopAt",value:function stopAt(t){if(this.stoppedAt=t,this.baseParse)this.baseParse.stopAt(t);else for(var _e191=this.innerDone;_e191<this.inner.length;_e191++)this.inner[_e191].parse.stopAt(t);}},{key:"startInner",value:function startInner(){var t=new Ml(this.fragments),e=null,i=null,s=new sl(new Xh(this.baseTree,this.ranges[0].from,0,null),Fh.IncludeAnonymous|Fh.IgnoreMounts);t:for(var _r116,_n93;;){var _h63=void 0,_l59=!0;if(null!=this.stoppedAt&&s.from>=this.stoppedAt)_l59=!1;else if(t.hasNode(s)){if(e){var _t225=e.mounts.find(function(t){return t.frag.from<=s.from&&t.frag.to>=s.to&&t.mount.overlay;});if(_t225){var _iterator152=_createForOfIteratorHelper(_t225.mount.overlay),_step152;try{var _loop12=function _loop12(){var i=_step152.value;var r=i.from+_t225.pos,n=i.to+_t225.pos;r>=s.from&&n<=s.to&&!e.ranges.some(function(t){return t.from<n&&t.to>r;})&&e.ranges.push({from:r,to:n});};for(_iterator152.s();!(_step152=_iterator152.n()).done;){_loop12();}}catch(err){_iterator152.e(err);}finally{_iterator152.f();}}}_l59=!1;}else if(i&&(_n93=bl(i.ranges,s.from,s.to)))_l59=2!=_n93;else if(!s.type.isAnonymous&&(_r116=this.nest(s,this.input))&&(s.from<s.to||!_r116.overlay)){s.tree||kl(s);var _n94=t.findMounts(s.from,_r116.parser);if("function"==typeof _r116.overlay)e=new ml(_r116.parser,_r116.overlay,_n94,this.inner.length,s.from,s.tree,e);else{var _t226=xl(this.ranges,_r116.overlay||(s.from<s.to?[new Nh(s.from,s.to)]:[]));_t226.length&&pl(_t226),!_t226.length&&_r116.overlay||this.inner.push(new dl(_r116.parser,_t226.length?_r116.parser.startParse(this.input,Al(_n94,_t226),_t226):_r116.parser.startParse(""),_r116.overlay?_r116.overlay.map(function(t){return new Nh(t.from-s.from,t.to-s.from);}):null,s.tree,_t226.length?_t226[0].from:s.from)),_r116.overlay?_t226.length&&(i={ranges:_t226,depth:0,prev:i}):_l59=!1;}}else e&&(_h63=e.predicate(s))&&(!0===_h63&&(_h63=new Nh(s.from,s.to)),_h63.from<_h63.to&&e.ranges.push(_h63));if(_l59&&s.firstChild())e&&e.depth++,i&&i.depth++;else for(;!s.nextSibling();){if(!s.parent())break t;if(e&&! --e.depth){var _t227=xl(this.ranges,e.ranges);_t227.length&&(pl(_t227),this.inner.splice(e.index,0,new dl(e.parser,e.parser.startParse(this.input,Al(e.mounts,_t227),_t227),e.ranges.map(function(t){return new Nh(t.from-e.start,t.to-e.start);}),e.target,_t227[0].from))),e=e.prev;}i&&! --i.depth&&(i=i.prev);}}}}]);}();yl=/*#__PURE__*/function(){function yl(t,e){_classCallCheck(this,yl);this.offset=e,this.done=!1,this.cursor=t.cursor(Fh.IncludeAnonymous|Fh.IgnoreMounts);}return _createClass(yl,[{key:"moveTo",value:function moveTo(t){var e=this.cursor,i=t-this.offset;for(;!this.done&&e.from<i;)e.to>=t&&e.enter(i,1,Fh.IgnoreOverlays|Fh.ExcludeBuffers)||e.next(!1)||(this.done=!0);}},{key:"hasNode",value:function hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(var _e193=this.cursor.tree;;){if(_e193==t.tree)return!0;if(!(_e193.children.length&&0==_e193.positions[0]&&_e193.children[0]instanceof qh))break;_e193=_e193.children[0];}return!1;}}]);}();Ml=/*#__PURE__*/function(){function Ml(t){_classCallCheck(this,Ml);var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){var _i159=this.curFrag=t[0];this.curTo=null!==(e=_i159.tree.prop(gl))&&void 0!==e?e:_i159.to,this.inner=new yl(_i159.tree,-_i159.offset);}else this.curFrag=this.inner=null;}return _createClass(Ml,[{key:"hasNode",value:function hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t);}},{key:"nextFrag",value:function nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{var _e194=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=_e194.tree.prop(gl))&&void 0!==t?t:_e194.to,this.inner=new yl(_e194.tree,-_e194.offset);}}},{key:"findMounts",value:function findMounts(t,e){var i;var s=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(var _t228=this.inner.cursor.node;_t228;_t228=_t228.parent){var _r117=null===(i=_t228.tree)||void 0===i?void 0:i.prop(jh.mounted);if(_r117&&_r117.parser==e)for(var _e195=this.fragI;_e195<this.fragments.length;_e195++){var _i160=this.fragments[_e195];if(_i160.from>=_t228.to)break;_i160.tree==this.curFrag.tree&&s.push({frag:_i160,pos:_t228.from-_i160.offset,mount:_r117});}}}return s;}}]);}();Cl=0;Ol=/*#__PURE__*/function(){function Ol(t,e,i){_classCallCheck(this,Ol);this.set=t,this.base=e,this.modified=i,this.id=Cl++;}return _createClass(Ol,null,[{key:"define",value:function define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");var e=new Ol([],null,[]);if(e.set.push(e),t){var _iterator155=_createForOfIteratorHelper(t.set),_step155;try{for(_iterator155.s();!(_step155=_iterator155.n()).done;){var _i161=_step155.value;e.set.push(_i161);}}catch(err){_iterator155.e(err);}finally{_iterator155.f();}}return e;}},{key:"defineModifier",value:function defineModifier(){var t=new El();return function(e){return e.modified.indexOf(t)>-1?e:El.get(e.base||e,e.modified.concat(t).sort(function(t,e){return t.id-e.id;}));};}}]);}();Dl=0;El=/*#__PURE__*/function(){function El(){_classCallCheck(this,El);this.instances=[],this.id=Dl++;}return _createClass(El,null,[{key:"get",value:function get(t,e){if(!e.length)return t;var i=e[0].instances.find(function(i){return i.base==t&&(s=e,r=i.modified,s.length==r.length&&s.every(function(t,e){return t==r[e];}));var s,r;});if(i)return i;var s=[],r=new Ol(s,t,e);var _iterator156=_createForOfIteratorHelper(e),_step156;try{for(_iterator156.s();!(_step156=_iterator156.n()).done;){var _t231=_step156.value;_t231.instances.push(r);}}catch(err){_iterator156.e(err);}finally{_iterator156.f();}var n=function(t){var e=[[]];for(var _i162=0;_i162<t.length;_i162++)for(var _s143=0,_r119=e.length;_s143<_r119;_s143++)e.push(e[_s143].concat(t[_i162]));return e.sort(function(t,e){return e.length-t.length;});}(e);var _iterator157=_createForOfIteratorHelper(t.set),_step157;try{for(_iterator157.s();!(_step157=_iterator157.n()).done;){var _e198=_step157.value;if(!_e198.modified.length){var _iterator158=_createForOfIteratorHelper(n),_step158;try{for(_iterator158.s();!(_step158=_iterator158.n()).done;){var _t232=_step158.value;s.push(El.get(_e198,_t232));}}catch(err){_iterator158.e(err);}finally{_iterator158.f();}}}}catch(err){_iterator157.e(err);}finally{_iterator157.f();}return r;}}]);}();Rl=new jh();Tl=/*#__PURE__*/function(){function Tl(t,e,i,s){_classCallCheck(this,Tl);this.tags=t,this.mode=e,this.context=i,this.next=s;}return _createClass(Tl,[{key:"opaque",get:function get(){return 0==this.mode;}},{key:"inherit",get:function get(){return 1==this.mode;}},{key:"sort",value:function sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t);}},{key:"depth",get:function get(){return this.context?this.context.length:0;}}]);}();Tl.empty=new Tl([],2,null);Nl=/*#__PURE__*/function(){function Nl(t,e,i){_classCallCheck(this,Nl);this.at=t,this.highlighters=e,this.span=i,this["class"]="";}return _createClass(Nl,[{key:"startSpan",value:function startSpan(t,e){e!=this["class"]&&(this.flush(t),t>this.at&&(this.at=t),this["class"]=e);}},{key:"flush",value:function flush(t){t>this.at&&this["class"]&&this.span(this.at,t,this["class"]);}},{key:"highlightRange",value:function highlightRange(t,e,i,s,r){var n=t.type,h=t.from,l=t.to;if(h>=i||l<=e)return;n.isTop&&(r=this.highlighters.filter(function(t){return!t.scope||t.scope(n);}));var o=s,u=function(t){var e=t.type.prop(Rl);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null;}(t)||Tl.empty,f=function(t,e){var i=null;var _iterator164=_createForOfIteratorHelper(t),_step164;try{for(_iterator164.s();!(_step164=_iterator164.n()).done;){var _s148=_step164.value;var _t236=_s148.style(e);_t236&&(i=i?i+" "+_t236:_t236);}}catch(err){_iterator164.e(err);}finally{_iterator164.f();}return i;}(r,u.tags);if(f&&(o&&(o+=" "),o+=f,1==u.mode&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(e,h),o),u.opaque)return;var a=t.tree&&t.tree.prop(jh.mounted);if(a&&a.overlay){var _n97=t.node.enter(a.overlay[0].from+h,1),_u42=this.highlighters.filter(function(t){return!t.scope||t.scope(a.tree.type);}),_f24=t.firstChild();for(var _c14=0,_d10=h;;_c14++){var _p8=_c14<a.overlay.length?a.overlay[_c14]:null,_m5=_p8?_p8.from+h:l,_g5=Math.max(e,_d10),_w2=Math.min(i,_m5);if(_g5<_w2&&_f24)for(;t.from<_w2&&(this.highlightRange(t,_g5,_w2,s,r),this.startSpan(Math.min(_w2,t.to),o),!(t.to>=_m5)&&t.nextSibling()););if(!_p8||_m5>i)break;_d10=_p8.to+h,_d10>e&&(this.highlightRange(_n97.cursor(),Math.max(e,_p8.from+h),Math.min(i,_d10),"",_u42),this.startSpan(Math.min(i,_d10),o));}_f24&&t.parent();}else if(t.firstChild()){a&&(s="");do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,s,r),this.startSpan(Math.min(i,t.to),o);}}while(t.nextSibling());t.parent();}}}]);}();jl=Ol.define;$l=jl();zl=jl();Pl=jl(zl);Hl=jl(zl);Wl=jl();Vl=jl(Wl);Fl=jl(Wl);ql=jl();Ul=jl(ql);Jl=jl();Gl=jl();Kl=jl();_l=jl(Kl);Xl=jl();_export("t",Yl={comment:$l,lineComment:jl($l),blockComment:jl($l),docComment:jl($l),name:zl,variableName:jl(zl),typeName:Pl,tagName:jl(Pl),propertyName:Hl,attributeName:jl(Hl),className:jl(zl),labelName:jl(zl),namespace:jl(zl),macroName:jl(zl),literal:Wl,string:Vl,docString:jl(Vl),character:jl(Vl),attributeValue:jl(Vl),number:Fl,integer:jl(Fl),"float":jl(Fl),bool:jl(Wl),regexp:jl(Wl),escape:jl(Wl),color:jl(Wl),url:jl(Wl),keyword:Jl,self:jl(Jl),"null":jl(Jl),atom:jl(Jl),unit:jl(Jl),modifier:jl(Jl),operatorKeyword:jl(Jl),controlKeyword:jl(Jl),definitionKeyword:jl(Jl),moduleKeyword:jl(Jl),operator:Gl,derefOperator:jl(Gl),arithmeticOperator:jl(Gl),logicOperator:jl(Gl),bitwiseOperator:jl(Gl),compareOperator:jl(Gl),updateOperator:jl(Gl),definitionOperator:jl(Gl),typeOperator:jl(Gl),controlOperator:jl(Gl),punctuation:Kl,separator:jl(Kl),bracket:_l,angleBracket:jl(_l),squareBracket:jl(_l),paren:jl(_l),brace:jl(_l),content:ql,heading:Ul,heading1:jl(Ul),heading2:jl(Ul),heading3:jl(Ul),heading4:jl(Ul),heading5:jl(Ul),heading6:jl(Ul),contentSeparator:jl(ql),list:jl(ql),quote:jl(ql),emphasis:jl(ql),strong:jl(ql),link:jl(ql),monospace:jl(ql),strikethrough:jl(ql),inserted:jl(),deleted:jl(),changed:jl(),invalid:jl(),meta:Xl,documentMeta:jl(Xl),annotation:jl(Xl),processingInstruction:jl(Xl),definition:Ol.defineModifier(),constant:Ol.defineModifier(),"function":Ol.defineModifier(),standard:Ol.defineModifier(),local:Ol.defineModifier(),special:Ol.defineModifier()});Bl([{tag:Yl.link,"class":"tok-link"},{tag:Yl.heading,"class":"tok-heading"},{tag:Yl.emphasis,"class":"tok-emphasis"},{tag:Yl.strong,"class":"tok-strong"},{tag:Yl.keyword,"class":"tok-keyword"},{tag:Yl.atom,"class":"tok-atom"},{tag:Yl.bool,"class":"tok-bool"},{tag:Yl.url,"class":"tok-url"},{tag:Yl.labelName,"class":"tok-labelName"},{tag:Yl.inserted,"class":"tok-inserted"},{tag:Yl.deleted,"class":"tok-deleted"},{tag:Yl.literal,"class":"tok-literal"},{tag:Yl.string,"class":"tok-string"},{tag:Yl.number,"class":"tok-number"},{tag:[Yl.regexp,Yl.escape,Yl.special(Yl.string)],"class":"tok-string2"},{tag:Yl.variableName,"class":"tok-variableName"},{tag:Yl.local(Yl.variableName),"class":"tok-variableName tok-local"},{tag:Yl.definition(Yl.variableName),"class":"tok-variableName tok-definition"},{tag:Yl.special(Yl.variableName),"class":"tok-variableName2"},{tag:Yl.definition(Yl.propertyName),"class":"tok-propertyName tok-definition"},{tag:Yl.typeName,"class":"tok-typeName"},{tag:Yl.namespace,"class":"tok-namespace"},{tag:Yl.className,"class":"tok-className"},{tag:Yl.macroName,"class":"tok-macroName"},{tag:Yl.propertyName,"class":"tok-propertyName"},{tag:Yl.operator,"class":"tok-operator"},{tag:Yl.comment,"class":"tok-comment"},{tag:Yl.meta,"class":"tok-meta"},{tag:Yl.invalid,"class":"tok-invalid"},{tag:Yl.punctuation,"class":"tok-punctuation"}]);Zl=new jh();_export("o",eo=new jh());io=/*#__PURE__*/function(){function io(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";_classCallCheck(this,io);this.data=t,this.name=s,St.prototype.hasOwnProperty("tree")||Object.defineProperty(St.prototype,"tree",{get:function get(){return no(this);}}),this.parser=e,this.extension=[mo.of(this),St.languageData.of(function(t,e,i){var s=so(t,e,i),r=s.type.prop(Zl);if(!r)return[];var n=t.facet(r),h=s.type.prop(eo);if(h){var _r121=s.resolve(e-s.from,i);var _iterator165=_createForOfIteratorHelper(h),_step165;try{for(_iterator165.s();!(_step165=_iterator165.n()).done;){var _e201=_step165.value;if(_e201.test(_r121,t)){var _i165=t.facet(_e201.facet);return"replace"==_e201.type?_i165:_i165.concat(n);}}}catch(err){_iterator165.e(err);}finally{_iterator165.f();}}return n;})].concat(i);}return _createClass(io,[{key:"isActiveAt",value:function isActiveAt(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;return so(t,e,i).type.prop(Zl)==this.data;}},{key:"findRegions",value:function findRegions(t){var _this71=this;var e=t.facet(mo);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];var i=[],s=function s(t,e){if(t.prop(Zl)==_this71.data)return void i.push({from:e,to:e+t.length});var r=t.prop(jh.mounted);if(r){if(r.tree.prop(Zl)==_this71.data){if(r.overlay){var _iterator166=_createForOfIteratorHelper(r.overlay),_step166;try{for(_iterator166.s();!(_step166=_iterator166.n()).done;){var _t237=_step166.value;i.push({from:_t237.from+e,to:_t237.to+e});}}catch(err){_iterator166.e(err);}finally{_iterator166.f();}}else i.push({from:e,to:e+t.length});return;}if(r.overlay){var _t238=i.length;if(s(r.tree,r.overlay[0].from+e),i.length>_t238)return;}}for(var _i166=0;_i166<t.children.length;_i166++){var _r122=t.children[_i166];_r122 instanceof qh&&s(_r122,t.positions[_i166]+e);}};return s(no(t),0),i;}},{key:"allowsNesting",get:function get(){return!0;}}]);}();io.setState=ct.define();_export("L",ro=/*#__PURE__*/function(_io){function ro(t,e,i){var _this72;_classCallCheck(this,ro);_this72=_callSuper(this,ro,[t,e,[],i]),_this72.parser=e;return _this72;}_inherits(ro,_io);return _createClass(ro,[{key:"configure",value:function configure(t,e){return new ro(this.data,this.parser.configure(t),e||this.name);}},{key:"allowsNesting",get:function get(){return this.parser.hasWrappers();}}],[{key:"define",value:function define(t){var e=to(t.languageData);return new ro(e,t.parser.configure({props:[Zl.add(function(t){return t.isTop?e:void 0;})]}),t.name);}}]);}(io));ho=/*#__PURE__*/function(){function ho(t){_classCallCheck(this,ho);this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter();}return _createClass(ho,[{key:"length",get:function get(){return this.doc.length;}},{key:"syncTo",value:function syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length;}},{key:"chunk",value:function chunk(t){return this.syncTo(t),this.string;}},{key:"lineChunks",get:function get(){return!0;}},{key:"read",value:function read(t,e){var i=this.cursorPos-this.string.length;return t<i||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i);}}]);}();lo=null;oo=/*#__PURE__*/function(){function oo(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var s=arguments.length>3?arguments[3]:undefined;var r=arguments.length>4?arguments[4]:undefined;var n=arguments.length>5?arguments[5]:undefined;var h=arguments.length>6?arguments[6]:undefined;var l=arguments.length>7?arguments[7]:undefined;_classCallCheck(this,oo);this.parser=t,this.state=e,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=n,this.skipped=h,this.scheduleOn=l,this.parse=null,this.tempSkipped=[];}return _createClass(oo,[{key:"startParse",value:function startParse(){return this.parser.startParse(new ho(this.state.doc),this.fragments);}},{key:"work",value:function work(t,e){var _this73=this;return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=qh.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext(function(){var i;if("number"==typeof t){var _e202=Date.now()+t;t=function t(){return Date.now()>_e202;};}for(_this73.parse||(_this73.parse=_this73.startParse()),null!=e&&(null==_this73.parse.stoppedAt||_this73.parse.stoppedAt>e)&&e<_this73.state.doc.length&&_this73.parse.stopAt(e);;){var _s149=_this73.parse.advance();if(_s149){if(_this73.fragments=_this73.withoutTempSkipped(ul.addTree(_s149,_this73.fragments,null!=_this73.parse.stoppedAt)),_this73.treeLen=null!==(i=_this73.parse.stoppedAt)&&void 0!==i?i:_this73.state.doc.length,_this73.tree=_s149,_this73.parse=null,!(_this73.treeLen<(null!=e?e:_this73.state.doc.length)))return!0;_this73.parse=_this73.startParse();}if(t())return!1;}});}},{key:"takeTree",value:function takeTree(){var _this74=this;var t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(function(){for(;!(e=_this74.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(ul.addTree(this.tree,this.fragments,!0)),this.parse=null);}},{key:"withContext",value:function withContext(t){var e=lo;lo=this;try{return t();}finally{lo=e;}}},{key:"withoutTempSkipped",value:function withoutTempSkipped(t){for(var _e203;_e203=this.tempSkipped.pop();)t=uo(t,_e203.from,_e203.to);return t;}},{key:"changes",value:function changes(t,e){var i=this.fragments,s=this.tree,r=this.treeLen,n=this.viewport,h=this.skipped;if(this.takeTree(),!t.empty){var _e204=[];if(t.iterChangedRanges(function(t,i,s,r){return _e204.push({fromA:t,toA:i,fromB:s,toB:r});}),i=ul.applyChanges(i,_e204),s=qh.empty,r=0,n={from:t.mapPos(n.from,-1),to:t.mapPos(n.to,1)},this.skipped.length){h=[];var _iterator167=_createForOfIteratorHelper(this.skipped),_step167;try{for(_iterator167.s();!(_step167=_iterator167.n()).done;){var _e205=_step167.value;var _i167=t.mapPos(_e205.from,1),_s150=t.mapPos(_e205.to,-1);_i167<_s150&&h.push({from:_i167,to:_s150});}}catch(err){_iterator167.e(err);}finally{_iterator167.f();}}}return new oo(this.parser,e,i,s,r,n,h,this.scheduleOn);}},{key:"updateViewport",value:function updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;var e=this.skipped.length;for(var _e206=0;_e206<this.skipped.length;_e206++){var _this$skipped$_e=this.skipped[_e206],_i168=_this$skipped$_e.from,_s151=_this$skipped$_e.to;_i168<t.to&&_s151>t.from&&(this.fragments=uo(this.fragments,_i168,_s151),this.skipped.splice(_e206--,1));}return!(this.skipped.length>=e)&&(this.reset(),!0);}},{key:"reset",value:function reset(){this.parse&&(this.takeTree(),this.parse=null);}},{key:"skipUntilInView",value:function skipUntilInView(t,e){this.skipped.push({from:t,to:e});}},{key:"isDone",value:function isDone(t){t=Math.min(t,this.state.doc.length);var e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t;}}],[{key:"create",value:function create(t,e,i){return new oo(t,e,[],qh.empty,0,i,[],null);}},{key:"getSkippingParser",value:function getSkippingParser(t){return new(/*#__PURE__*/function(_fl){function _class8(){_classCallCheck(this,_class8);return _callSuper(this,_class8,arguments);}_inherits(_class8,_fl);return _createClass(_class8,[{key:"createParse",value:function createParse(e,i,s){var r=s[0].from,n=s[s.length-1].to;return{parsedPos:r,advance:function advance(){var e=lo;if(e){var _iterator168=_createForOfIteratorHelper(s),_step168;try{for(_iterator168.s();!(_step168=_iterator168.n()).done;){var _t240=_step168.value;e.tempSkipped.push(_t240);}}catch(err){_iterator168.e(err);}finally{_iterator168.f();}t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t);}return this.parsedPos=n,new qh(Ph.none,[],[],n-r);},stoppedAt:null,stopAt:function stopAt(){}};}}]);}(fl))();}},{key:"get",value:function get(){return lo;}}]);}();fo=/*#__PURE__*/function(){function fo(t){_classCallCheck(this,fo);this.context=t,this.tree=t.tree;}return _createClass(fo,[{key:"apply",value:function apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;var e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new fo(e);}}],[{key:"init",value:function init(t){var e=Math.min(3e3,t.doc.length),i=oo.create(t.facet(mo).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new fo(i);}}]);}();io.state=F.define({create:fo.init,update:function update(t,e){var _iterator169=_createForOfIteratorHelper(e.effects),_step169;try{for(_iterator169.s();!(_step169=_iterator169.n()).done;){var _t241=_step169.value;if(_t241.is(io.setState))return _t241.value;}}catch(err){_iterator169.e(err);}finally{_iterator169.f();}return e.startState.facet(mo)!=e.state.facet(mo)?fo.init(e.state):t.apply(e);}});ao=function ao(t){var e=setTimeout(function(){return t();},500);return function(){return clearTimeout(e);};};"undefined"!=typeof requestIdleCallback&&(ao=function ao(t){var e=-1,i=setTimeout(function(){e=requestIdleCallback(t,{timeout:400});},100);return function(){return e<0?clearTimeout(i):cancelIdleCallback(e);};});co="undefined"!=typeof navigator&&(null===(Ql=navigator.scheduling)||void 0===Ql?void 0:Ql.isInputPending)?function(){return navigator.scheduling.isInputPending();}:null;po=_i.fromClass(/*#__PURE__*/function(){function _class9(t){_classCallCheck(this,_class9);this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork();}return _createClass(_class9,[{key:"update",value:function update(t){var e=this.view.state.field(io.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e);}},{key:"scheduleWork",value:function scheduleWork(){if(this.working)return;var t=this.view.state,e=t.field(io.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=ao(this.work));}},{key:"work",value:function work(t){this.working=null;var e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;var _this$view3=this.view,i=_this$view3.state,s=_this$view3.viewport.to,r=i.field(io.state);if(r.tree==r.context.tree&&r.context.isDone(s+1e5))return;var n=Date.now()+Math.min(this.chunkBudget,100,t&&!co?Math.max(25,t.timeRemaining()-5):1e9),h=r.context.treeLen<s&&i.doc.length>s+1e3,l=r.context.work(function(){return co&&co()||Date.now()>n;},s+(h?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:io.setState.of(new fo(r.context))})),this.chunkBudget>0&&(!l||h)&&this.scheduleWork(),this.checkAsyncSchedule(r.context);}},{key:"checkAsyncSchedule",value:function checkAsyncSchedule(t){var _this75=this;t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(function(){return _this75.scheduleWork();})["catch"](function(t){return Ui(_this75.view.state,t);}).then(function(){return _this75.workScheduled--;}),t.scheduleOn=null);}},{key:"destroy",value:function destroy(){this.working&&this.working();}},{key:"isWorking",value:function isWorking(){return!!(this.working||this.workScheduled>0);}}]);}(),{eventHandlers:{focus:function focus(){this.scheduleWork();}}});mo=j.define({combine:function combine(t){return t.length?t[0]:null;},enables:function enables(t){return[io.state,po,Ur.contentAttributes.compute([t],function(e){var i=e.facet(t);return i&&i.name?{"data-language":i.name}:{};})];}});_export("h",go=/*#__PURE__*/_createClass(function go(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];_classCallCheck(this,go);this.language=t,this.support=e,this.extension=[t,e];}));wo=j.define();bo=j.define({combine:function combine(t){if(!t.length)return" ";var e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(function(t){return t!=e[0];}))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e;}});Mo=/*#__PURE__*/function(){function Mo(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Mo);this.state=t,this.options=e,this.unit=vo(t);}return _createClass(Mo,[{key:"lineAt",value:function lineAt(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var i=this.state.doc.lineAt(t),_this$options=this.options,s=_this$options.simulateBreak,r=_this$options.simulateDoubleBreak;return null!=s&&s>=i.from&&s<=i.to?r&&s==t?{text:"",from:t}:(e<0?s<t:s<=t)?{text:i.text.slice(s-i.from),from:s}:{text:i.text.slice(0,s-i.from),from:i.from}:i;}},{key:"textAfterPos",value:function textAfterPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";var _this$lineAt=this.lineAt(t,e),i=_this$lineAt.text,s=_this$lineAt.from;return i.slice(t-s,Math.min(i.length,t+100-s));}},{key:"column",value:function column(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var _this$lineAt2=this.lineAt(t,e),i=_this$lineAt2.text,s=_this$lineAt2.from,r=this.countColumn(i,t-s),n=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return n>-1&&(r+=n-this.countColumn(i,i.search(/\S|$/))),r;}},{key:"countColumn",value:function countColumn(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t.length;return Vt(t,this.state.tabSize,e);}},{key:"lineIndent",value:function lineIndent(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var _this$lineAt3=this.lineAt(t,e),i=_this$lineAt3.text,s=_this$lineAt3.from,r=this.options.overrideIndentation;if(r){var _t244=r(s);if(_t244>-1)return _t244;}return this.countColumn(i,i.search(/\S|$/));}},{key:"simulatedBreak",get:function get(){return this.options.simulateBreak||null;}}]);}();_export("i",xo=new jh());Oo=/*#__PURE__*/function(_Mo){function Oo(t,e,i){var _this76;_classCallCheck(this,Oo);_this76=_callSuper(this,Oo,[t.state,t.options]),_this76.base=t,_this76.pos=e,_this76.context=i;return _this76;}_inherits(Oo,_Mo);return _createClass(Oo,[{key:"node",get:function get(){return this.context.node;}},{key:"textAfter",get:function get(){return this.textAfterPos(this.pos);}},{key:"baseIndent",get:function get(){return this.baseIndentFor(this.node);}},{key:"baseIndentFor",value:function baseIndentFor(t){var e=this.state.doc.lineAt(t.from);for(;;){var _i170=t.resolve(e.from);for(;_i170.parent&&_i170.parent.from==_i170.from;)_i170=_i170.parent;if(Do(_i170,t))break;e=this.state.doc.lineAt(_i170.from);}return this.lineIndent(e.from);}},{key:"continue",value:function _continue(){return So(this.context.next,this.base,this.pos);}}],[{key:"create",value:function create(t,e,i){return new Oo(t,e,i);}}]);}(Mo);_export("f",Ro=function Ro(t){return t.baseIndent;});Bo=j.define();_export("e",Lo=new jh());Po=ct.define({map:zo});Ho=ct.define({map:zo});Vo=F.define({create:function create(){return ni.none;},update:function update(t,e){t=t.map(e.changes);var _iterator173=_createForOfIteratorHelper(e.effects),_step173;try{var _loop15=function _loop15(){var i=_step173.value;if(i.is(Po)&&!qo(t,i.value.from,i.value.to)){var _e$state$facet=e.state.facet(_o),_s158=_e$state$facet.preparePlaceholder,_r125=_s158?ni.replace({widget:new Zo(_s158(e.state,i.value))}):Qo;t=t.update({add:[_r125.range(i.value.from,i.value.to)]});}else i.is(Ho)&&(t=t.update({filter:function filter(t,e){return i.value.from!=t||i.value.to!=e;},filterFrom:i.value.from,filterTo:i.value.to}));};for(_iterator173.s();!(_step173=_iterator173.n()).done;){_loop15();}}catch(err){_iterator173.e(err);}finally{_iterator173.f();}if(e.selection){var _i172=!1,_s157=e.selection.main.head;t.between(_s157,_s157,function(t,e){t<_s157&&e>_s157&&(_i172=!0);}),_i172&&(t=t.update({filterFrom:_s157,filterTo:_s157,filter:function filter(t,e){return e<=_s157||t>=_s157;}}));}return t;},provide:function provide(t){return Ur.decorations.from(t);},toJSON:function toJSON(t,e){var i=[];return t.between(0,e.doc.length,function(t,e){i.push(t,e);}),i;},fromJSON:function fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");var e=[];for(var _i173=0;_i173<t.length;){var _s159=t[_i173++],_r126=t[_i173++];if("number"!=typeof _s159||"number"!=typeof _r126)throw new RangeError("Invalid JSON for fold state");e.push(Qo.range(_s159,_r126));}return ni.set(e,!0);}});Go=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:function run(t){var _iterator174=_createForOfIteratorHelper(Wo(t)),_step174;try{for(_iterator174.s();!(_step174=_iterator174.n()).done;){var _e210=_step174.value;var _i174=$o(t.state,_e210.from,_e210.to);if(_i174)return t.dispatch({effects:Uo(t.state,[Po.of(_i174),Jo(t,_i174)])}),!0;}}catch(err){_iterator174.e(err);}finally{_iterator174.f();}return!1;}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:function run(t){if(!t.state.field(Vo,!1))return!1;var e=[];var _iterator175=_createForOfIteratorHelper(Wo(t)),_step175;try{for(_iterator175.s();!(_step175=_iterator175.n()).done;){var _i175=_step175.value;var _s160=Fo(t.state,_i175.from,_i175.to);_s160&&e.push(Ho.of(_s160),Jo(t,_s160,!1));}}catch(err){_iterator175.e(err);}finally{_iterator175.f();}return e.length&&t.dispatch({effects:e}),e.length>0;}},{key:"Ctrl-Alt-[",run:function run(t){var e=t.state,i=[];for(var _s161=0;_s161<e.doc.length;){var _r127=t.lineBlockAt(_s161),_n99=$o(e,_r127.from,_r127.to);_n99&&i.push(Po.of(_n99)),_s161=(_n99?t.lineBlockAt(_n99.to):_r127).to+1;}return i.length&&t.dispatch({effects:Uo(t.state,i)}),!!i.length;}},{key:"Ctrl-Alt-]",run:function run(t){var e=t.state.field(Vo,!1);if(!e||!e.size)return!1;var i=[];return e.between(0,t.state.doc.length,function(t,e){i.push(Ho.of({from:t,to:e}));}),t.dispatch({effects:i}),!0;}}];Ko={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"};_o=j.define({combine:function combine(t){return At(t,Ko);}});Qo=ni.replace({widget:new(/*#__PURE__*/function(_si7){function _class10(){_classCallCheck(this,_class10);return _callSuper(this,_class10,arguments);}_inherits(_class10,_si7);return _createClass(_class10,[{key:"toDOM",value:function toDOM(t){return Yo(t,null);}}]);}(si))()});Zo=/*#__PURE__*/function(_si8){function Zo(t){var _this77;_classCallCheck(this,Zo);_this77=_callSuper(this,Zo),_this77.value=t;return _this77;}_inherits(Zo,_si8);return _createClass(Zo,[{key:"eq",value:function eq(t){return this.value==t.value;}},{key:"toDOM",value:function toDOM(t){return Yo(t,this.value);}}]);}(si);tu={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:function foldingChanged(){return!1;}};eu=/*#__PURE__*/function(_ah3){function eu(t,e){var _this78;_classCallCheck(this,eu);_this78=_callSuper(this,eu),_this78.config=t,_this78.open=e;return _this78;}_inherits(eu,_ah3);return _createClass(eu,[{key:"eq",value:function eq(t){return this.config==t.config&&this.open==t.open;}},{key:"toDOM",value:function toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);var e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e;}}]);}(ah);iu=Ur.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});su=/*#__PURE__*/function(){function su(t,e){_classCallCheck(this,su);var i;function s(t){var e=Gt.newName();return(i||(i=Object.create(null)))["."+e]=t,e;}this.specs=t;var r="string"==typeof e.all?e.all:e.all?s(e.all):void 0,n=e.scope;this.scope=n instanceof io?function(t){return t.prop(Zl)==n.data;}:n?function(t){return t==n;}:void 0,this.style=Bl(t.map(function(t){return{tag:t.tag,"class":t["class"]||s(Object.assign({},t,{tag:null}))};}),{all:r}).style,this.module=i?new Gt(i):null,this.themeType=e.themeType;}return _createClass(su,null,[{key:"define",value:function define(t,e){return new su(t,e||{});}}]);}();ru=j.define();nu=j.define({combine:function combine(t){return t.length?[t[0]]:null;}});lu=/*#__PURE__*/function(){function lu(t){_classCallCheck(this,lu);this.markCache=Object.create(null),this.tree=no(t.state),this.decorations=this.buildDeco(t,hu(t.state)),this.decoratedTo=t.viewport.to;}return _createClass(lu,[{key:"update",value:function update(t){var e=no(t.state),i=hu(t.state),s=i!=hu(t.startState),r=t.view.viewport,n=t.changes.mapPos(this.decoratedTo,1);e.length<r.to&&!s&&e.type==this.tree.type&&n>=r.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=n):(e!=this.tree||t.viewportChanged||s)&&(this.tree=e,this.decorations=this.buildDeco(t.view,i),this.decoratedTo=r.to);}},{key:"buildDeco",value:function buildDeco(t,e){var _this79=this;if(!e||!this.tree.length)return ni.none;var i=new Rt();var _iterator176=_createForOfIteratorHelper(t.visibleRanges),_step176;try{for(_iterator176.s();!(_step176=_iterator176.n()).done;){var _step176$value=_step176.value,_s162=_step176$value.from,_r128=_step176$value.to;Ll(this.tree,e,function(t,e,s){i.add(t,e,_this79.markCache[s]||(_this79.markCache[s]=ni.mark({"class":s})));},_s162,_r128);}}catch(err){_iterator176.e(err);}finally{_iterator176.f();}return i.finish();}}]);}();ou=_.high(_i.fromClass(lu,{decorations:function decorations(t){return t.decorations;}}));uu=su.define([{tag:Yl.meta,color:"#404740"},{tag:Yl.link,textDecoration:"underline"},{tag:Yl.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Yl.emphasis,fontStyle:"italic"},{tag:Yl.strong,fontWeight:"bold"},{tag:Yl.strikethrough,textDecoration:"line-through"},{tag:Yl.keyword,color:"#708"},{tag:[Yl.atom,Yl.bool,Yl.url,Yl.contentSeparator,Yl.labelName],color:"#219"},{tag:[Yl.literal,Yl.inserted],color:"#164"},{tag:[Yl.string,Yl.deleted],color:"#a11"},{tag:[Yl.regexp,Yl.escape,Yl.special(Yl.string)],color:"#e40"},{tag:Yl.definition(Yl.variableName),color:"#00f"},{tag:Yl.local(Yl.variableName),color:"#30a"},{tag:[Yl.typeName,Yl.namespace],color:"#085"},{tag:Yl.className,color:"#167"},{tag:[Yl.special(Yl.variableName),Yl.macroName],color:"#256"},{tag:Yl.definition(Yl.propertyName),color:"#00c"},{tag:Yl.comment,color:"#940"},{tag:Yl.invalid,color:"#f00"}]);fu=Ur.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}});au=1e4;cu="()[]{}";du=j.define({combine:function combine(t){return At(t,{afterCursor:!0,brackets:cu,maxScanDistance:au,renderMatch:gu});}});pu=ni.mark({"class":"cm-matchingBracket"});mu=ni.mark({"class":"cm-nonmatchingBracket"});wu=F.define({create:function create(){return ni.none;},update:function update(t,e){if(!e.docChanged&&!e.selection)return t;var i=[],s=e.state.facet(du);var _iterator177=_createForOfIteratorHelper(e.state.selection.ranges),_step177;try{for(_iterator177.s();!(_step177=_iterator177.n()).done;){var _t247=_step177.value;if(!_t247.empty)continue;var _r129=Mu(e.state,_t247.head,-1,s)||_t247.head>0&&Mu(e.state,_t247.head-1,1,s)||s.afterCursor&&(Mu(e.state,_t247.head,1,s)||_t247.head<e.state.doc.length&&Mu(e.state,_t247.head+1,-1,s));_r129&&(i=i.concat(s.renderMatch(_r129,e.state)));}}catch(err){_iterator177.e(err);}finally{_iterator177.f();}return ni.set(i,!0);},provide:function provide(t){return Ur.decorations.from(t);}});bu=[wu,fu];vu=new jh();Su=Object.create(null);Au=[Ph.none];Cu=[];Ou=Object.create(null);Du=Object.create(null);for(_i176=0,_arr2=[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]];_i176<_arr2.length;_i176++){_arr2$_i=_slicedToArray(_arr2[_i176],2);_t252=_arr2$_i[0];_e213=_arr2$_i[1];Du[_t252]=Iu(Su,_e213);}pi.RTL,pi.LTR;Tu=Ru(zu,0);Bu=Ru($u,0);Lu=Ru(function(t,e){return $u(t,e,function(t){var e=[];var _iterator181=_createForOfIteratorHelper(t.selection.ranges),_step181;try{for(_iterator181.s();!(_step181=_iterator181.n()).done;){var _i178=_step181.value;var _s167=t.doc.lineAt(_i178.from),_r131=_i178.to<=_s167.to?_s167:t.doc.lineAt(_i178.to),_n101=e.length-1;_n101>=0&&e[_n101].to>_s167.from?e[_n101].to=_r131.to:e.push({from:_s167.from+/^\s*/.exec(_s167.text)[0].length,to:_r131.to});}}catch(err){_iterator181.e(err);}finally{_iterator181.f();}return e;}(e));},0);ju=50;Pu=ut.define();Hu=ut.define();Wu=j.define();Vu=j.define({combine:function combine(t){return At(t,{minDepth:100,newGroupDelay:500,joinToEvent:function joinToEvent(t,e){return e;}},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:function joinToEvent(t,e){return function(i,s){return t(i,s)||e(i,s);};}});}});Fu=F.define({create:function create(){return hf.empty;},update:function update(t,e){var i=e.state.facet(Vu),s=e.annotation(Pu);if(s){var _r135=_u.fromTransaction(e,s.selection),_n106=s.side,_h74=0==_n106?t.undone:t.done;return _h74=_r135?Xu(_h74,_h74.length,i.minDepth,_r135):tf(_h74,e.startState.selection),new hf(0==_n106?s.rest:_h74,0==_n106?_h74:s.rest);}var r=e.annotation(Hu);if("full"!=r&&"before"!=r||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);var n=_u.fromTransaction(e),h=e.annotation(dt.time),l=e.annotation(dt.userEvent);return n?t=t.addChanges(n,h,l,i,e):e.selection&&(t=t.addSelection(e.startState.selection,h,l,i.newGroupDelay)),"full"!=r&&"after"!=r||(t=t.isolate()),t;},toJSON:function toJSON(t){return{done:t.done.map(function(t){return t.toJSON();}),undone:t.undone.map(function(t){return t.toJSON();})};},fromJSON:function fromJSON(t){return new hf(t.done.map(_u.fromJSON),t.undone.map(_u.fromJSON));}});Uu=qu(0,!1);Ju=qu(1,!1);Gu=qu(0,!0);Ku=qu(1,!0);_u=/*#__PURE__*/function(){function _u(t,e,i,s,r){_classCallCheck(this,_u);this.changes=t,this.effects=e,this.mapped=i,this.startSelection=s,this.selectionsAfter=r;}return _createClass(_u,[{key:"setSelAfter",value:function setSelAfter(t){return new _u(this.changes,this.effects,this.mapped,this.startSelection,t);}},{key:"toJSON",value:function toJSON(){var t,e,i;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(function(t){return t.toJSON();})};}}],[{key:"fromJSON",value:function fromJSON(t){return new _u(t.changes&&A.fromJSON(t.changes),[],t.mapped&&S.fromJSON(t.mapped),t.startSelection&&B.fromJSON(t.startSelection),t.selectionsAfter.map(B.fromJSON));}},{key:"fromTransaction",value:function fromTransaction(t,e){var i=Qu;var _iterator185=_createForOfIteratorHelper(t.startState.facet(Wu)),_step185;try{for(_iterator185.s();!(_step185=_iterator185.n()).done;){var _e220=_step185.value;var _s169=_e220(t);_s169.length&&(i=i.concat(_s169));}}catch(err){_iterator185.e(err);}finally{_iterator185.f();}return!i.length&&t.changes.empty?null:new _u(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Qu);}},{key:"selection",value:function selection(t){return new _u(void 0,Qu,void 0,void 0,t);}}]);}();Qu=[];Zu=200;nf=/^(input\.type|delete)($|\.)/;hf=/*#__PURE__*/function(){function hf(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:void 0;_classCallCheck(this,hf);this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=s;}return _createClass(hf,[{key:"isolate",value:function isolate(){return this.prevTime?new hf(this.done,this.undone):this;}},{key:"addChanges",value:function addChanges(t,e,i,s,r){var n=this.done,h=n[n.length-1];return n=h&&h.changes&&!h.changes.empty&&t.changes&&(!i||nf.test(i))&&(!h.selectionsAfter.length&&e-this.prevTime<s.newGroupDelay&&s.joinToEvent(r,function(t,e){var i=[],s=!1;return t.iterChangedRanges(function(t,e){return i.push(t,e);}),e.iterChangedRanges(function(t,e,r,n){for(var _t260=0;_t260<i.length;){var _e222=i[_t260++],_h75=i[_t260++];n>=_e222&&r<=_h75&&(s=!0);}}),s;}(h.changes,t.changes))||"input.type.compose"==i)?Xu(n,n.length-1,s.minDepth,new _u(t.changes.compose(h.changes),Yu(t.effects,h.effects),h.mapped,h.startSelection,Qu)):Xu(n,n.length,s.minDepth,t),new hf(n,Qu,e,i);}},{key:"addSelection",value:function addSelection(t,e,i,s){var r=this.done.length?this.done[this.done.length-1].selectionsAfter:Qu;return r.length>0&&e-this.prevTime<s&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&(n=r[r.length-1],h=t,n.ranges.length==h.ranges.length&&0===n.ranges.filter(function(t,e){return t.empty!=h.ranges[e].empty;}).length)?this:new hf(tf(this.done,t),this.undone,e,i);var n,h;}},{key:"addMapping",value:function addMapping(t){return new hf(sf(this.done,t),sf(this.undone,t),this.prevTime,this.prevUserEvent);}},{key:"pop",value:function pop(t,e,i){var s=0==t?this.done:this.undone;if(0==s.length)return null;var r=s[s.length-1],n=r.selectionsAfter[0]||e.selection;if(i&&r.selectionsAfter.length)return e.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Pu.of({side:t,rest:ef(s),selection:n}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){var _i187=1==s.length?Qu:s.slice(0,s.length-1);return r.mapped&&(_i187=sf(_i187,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Pu.of({side:t,rest:_i187,selection:n}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0});}return null;}}]);}();hf.empty=new hf(Qu,Qu);lf=[{key:"Mod-z",run:Uu,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Ju,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Ju,preventDefault:!0},{key:"Mod-u",run:Gu,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ku,preventDefault:!0}];pf=function pf(t){return cf(t,!df(t));};mf=function mf(t){return cf(t,df(t));};kf=function kf(t){return vf(t,!1);};yf=function yf(t){return vf(t,!0);};Sf=function Sf(t){return xf(t,!1);};Af=function Af(t){return xf(t,!0);};Ef=function Ef(t){return Df(t,!df(t));};If=function If(t){return Df(t,df(t));};Bf=function Bf(t){return Tf(t,!1);};Lf=function Lf(t){return Tf(t,!0);};jf=function jf(t){return Nf(t,!1);};$f=function $f(t){return Nf(t,!0);};zf=function zf(_ref24){var t=_ref24.state,e=_ref24.dispatch;return e(uf(t,{anchor:0})),!0;};Pf=function Pf(_ref25){var t=_ref25.state,e=_ref25.dispatch;return e(uf(t,{anchor:t.doc.length})),!0;};Hf=function Hf(_ref26){var t=_ref26.state,e=_ref26.dispatch;return e(uf(t,{anchor:t.selection.main.anchor,head:0})),!0;};Wf=function Wf(_ref27){var t=_ref27.state,e=_ref27.dispatch;return e(uf(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0;};qf=function qf(t,e,i){return Vf(t,function(s){var r,n,h=s.from,l=t.state,o=l.doc.lineAt(h);if(i&&!e&&h>o.from&&h<o.from+200&&!/[^ \t]/.test(r=o.text.slice(0,h-o.from))){if("\t"==r[r.length-1])return h-1;var _t261=Vt(r,l.tabSize)%vo(l)||vo(l);for(var _e226=0;_e226<_t261&&" "==r[r.length-1-_e226];_e226++)h--;n=h;}else n=p(o.text,h-o.from,e,e)+o.from,n==h&&o.number!=(e?l.doc.lines:1)?n+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(n-o.from,h-o.from))&&(n=p(o.text,n-o.from,!1,!1)+o.from);return n;});};Uf=function Uf(t){return qf(t,!1,!0);};Jf=function Jf(t){return qf(t,!0,!1);};Gf=function Gf(t,e){return Vf(t,function(i){var s=i.head,r=t.state,n=r.doc.lineAt(s),h=r.charCategorizer(s);for(var _t262=null;;){if(s==(e?n.to:n.from)){s==i.head&&n.number!=(e?r.doc.lines:1)&&(s+=e?1:-1);break;}var _l67=p(n.text,s-n.from,e)+n.from,_o44=n.text.slice(Math.min(s,_l67)-n.from,Math.max(s,_l67)-n.from),_u43=h(_o44);if(null!=_t262&&_u43!=_t262)break;" "==_o44&&s==i.head||(_t262=_u43),s=_l67;}return s;});};Kf=function Kf(t){return Gf(t,!1);};Qf=Zf(!1);ea=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:function run(t){return ff(t,function(e){return bf(t.state,e,!df(t));});},shift:function shift(t){return Of(t,function(e){return bf(t.state,e,!df(t));});}},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:function run(t){return ff(t,function(e){return bf(t.state,e,df(t));});},shift:function shift(t){return Of(t,function(e){return bf(t.state,e,df(t));});}},{key:"Alt-ArrowUp",run:function run(_ref29){var t=_ref29.state,e=_ref29.dispatch;return Xf(t,e,!1);}},{key:"Shift-Alt-ArrowUp",run:function run(_ref30){var t=_ref30.state,e=_ref30.dispatch;return Yf(t,e,!1);}},{key:"Alt-ArrowDown",run:function run(_ref31){var t=_ref31.state,e=_ref31.dispatch;return Xf(t,e,!0);}},{key:"Shift-Alt-ArrowDown",run:function run(_ref32){var t=_ref32.state,e=_ref32.dispatch;return Yf(t,e,!0);}},{key:"Escape",run:function run(_ref33){var t=_ref33.state,e=_ref33.dispatch;var i=t.selection,s=null;return i.ranges.length>1?s=B.create([i.main]):i.main.empty||(s=B.create([B.cursor(i.main.head)])),!!s&&(e(uf(t,s)),!0);}},{key:"Mod-Enter",run:Zf(!0)},{key:"Alt-l",mac:"Ctrl-l",run:function run(_ref34){var t=_ref34.state,e=_ref34.dispatch;var i=_f(t).map(function(_ref35){var e=_ref35.from,i=_ref35.to;return B.range(e,Math.min(i+1,t.doc.length));});return e(t.update({selection:B.create(i),userEvent:"select"})),!0;}},{key:"Mod-i",run:function run(_ref36){var t=_ref36.state,e=_ref36.dispatch;var i=of(t.selection,function(e){var i;for(var _s174=no(t).resolveStack(e.from,1);_s174;_s174=_s174.next){var _s175=_s174,_t265=_s175.node;if((_t265.from<e.from&&_t265.to>=e.to||_t265.to>e.to&&_t265.from<=e.from)&&(null===(i=_t265.parent)||void 0===i?void 0:i.parent))return B.range(_t265.to,_t265.from);}return e;});return e(uf(t,i)),!0;},preventDefault:!0},{key:"Mod-[",run:function run(_ref37){var t=_ref37.state,e=_ref37.dispatch;return!t.readOnly&&(e(t.update(ta(t,function(e,i){var s=/^\s*/.exec(e.text)[0];if(!s)return;var r=Vt(s,t.tabSize),n=0,h=ko(t,Math.max(0,r-vo(t)));for(;n<s.length&&n<h.length&&s.charCodeAt(n)==h.charCodeAt(n);)n++;i.push({from:e.from+n,to:e.from+s.length,insert:h.slice(n)});}),{userEvent:"delete.dedent"})),!0);}},{key:"Mod-]",run:function run(_ref38){var t=_ref38.state,e=_ref38.dispatch;return!t.readOnly&&(e(t.update(ta(t,function(e,i){i.push({from:e.from,insert:t.facet(bo)});}),{userEvent:"input.indent"})),!0);}},{key:"Mod-Alt-\\",run:function run(_ref39){var t=_ref39.state,e=_ref39.dispatch;if(t.readOnly)return!1;var i=Object.create(null),s=new Mo(t,{overrideIndentation:function overrideIndentation(t){var e=i[t];return null==e?-1:e;}}),r=ta(t,function(e,r,n){var h=yo(s,e.from);if(null==h)return;/\S/.test(e.text)||(h=0);var l=/^\s*/.exec(e.text)[0],o=ko(t,h);(l!=o||n.from<e.from+l.length)&&(i[e.from]=h,r.push({from:e.from,to:e.from+l.length,insert:o}));});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0;}},{key:"Shift-Mod-k",run:function run(t){if(t.state.readOnly)return!1;var e=t.state,i=e.changes(_f(e).map(function(_ref40){var t=_ref40.from,i=_ref40.to;return t>0?t--:i<e.doc.length&&i++,{from:t,to:i};})),s=of(e.selection,function(e){var i;if(t.lineWrapping){var _s176=t.lineBlockAt(e.head),_r138=t.coordsAtPos(e.head,e.assoc||1);_r138&&(i=_s176.bottom+t.documentTop-_r138.bottom+t.defaultLineHeight/2);}return t.moveVertically(e,!0,i);}).map(i);return t.dispatch({changes:i,selection:s,scrollIntoView:!0,userEvent:"delete.line"}),!0;}},{key:"Shift-Mod-\\",run:function run(_ref41){var t=_ref41.state,e=_ref41.dispatch;return function(t,e,i){var s=!1,r=of(t.selection,function(e){var r=Mu(t,e.head,-1)||Mu(t,e.head,1)||e.head>0&&Mu(t,e.head-1,1)||e.head<t.doc.length&&Mu(t,e.head+1,-1);if(!r||!r.end)return e;s=!0;var n=r.start.from==e.head?r.end.to:r.end.from;return i?B.range(e.anchor,n):B.cursor(n);});return!!s&&(e(uf(t,r)),!0);}(t,e,!1);}},{key:"Mod-/",run:function run(t){var e=t.state,i=e.doc.lineAt(e.selection.main.from),s=Nu(t.state,i.from);return s.line?Tu(t):!!s.block&&Lu(t);}},{key:"Alt-A",run:Bu}].concat([{key:"ArrowLeft",run:pf,shift:Ef,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:function run(t){return gf(t,!df(t));},shift:function shift(t){return Rf(t,!df(t));},preventDefault:!0},{mac:"Cmd-ArrowLeft",run:function run(t){return ff(t,function(e){return Cf(t,e,!df(t));});},shift:function shift(t){return Of(t,function(e){return Cf(t,e,!df(t));});},preventDefault:!0},{key:"ArrowRight",run:mf,shift:If,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:function run(t){return gf(t,df(t));},shift:function shift(t){return Rf(t,df(t));},preventDefault:!0},{mac:"Cmd-ArrowRight",run:function run(t){return ff(t,function(e){return Cf(t,e,df(t));});},shift:function shift(t){return Of(t,function(e){return Cf(t,e,df(t));});},preventDefault:!0},{key:"ArrowUp",run:kf,shift:Bf,preventDefault:!0},{mac:"Cmd-ArrowUp",run:zf,shift:Hf},{mac:"Ctrl-ArrowUp",run:Sf,shift:jf},{key:"ArrowDown",run:yf,shift:Lf,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Pf,shift:Wf},{mac:"Ctrl-ArrowDown",run:Af,shift:$f},{key:"PageUp",run:Sf,shift:jf},{key:"PageDown",run:Af,shift:$f},{key:"Home",run:function run(t){return ff(t,function(e){return Cf(t,e,!1);});},shift:function shift(t){return Of(t,function(e){return Cf(t,e,!1);});},preventDefault:!0},{key:"Mod-Home",run:zf,shift:Hf},{key:"End",run:function run(t){return ff(t,function(e){return Cf(t,e,!0);});},shift:function shift(t){return Of(t,function(e){return Cf(t,e,!0);});},preventDefault:!0},{key:"Mod-End",run:Pf,shift:Wf},{key:"Enter",run:Qf},{key:"Mod-a",run:function run(_ref42){var t=_ref42.state,e=_ref42.dispatch;return e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0;}},{key:"Backspace",run:Uf,shift:Uf},{key:"Delete",run:Jf},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Kf},{key:"Mod-Delete",mac:"Alt-Delete",run:function run(t){return Gf(t,!0);}},{mac:"Mod-Backspace",run:function run(t){return Vf(t,function(e){var i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1);});}},{mac:"Mod-Delete",run:function run(t){return Vf(t,function(e){var i=t.moveToLineBoundary(e,!0).head;return e.head<i?i:Math.min(t.state.doc.length,e.head+1);});}}].concat([{key:"Ctrl-b",run:pf,shift:Ef,preventDefault:!0},{key:"Ctrl-f",run:mf,shift:If},{key:"Ctrl-p",run:kf,shift:Bf},{key:"Ctrl-n",run:yf,shift:Lf},{key:"Ctrl-a",run:function run(t){return ff(t,function(e){return B.cursor(t.lineBlockAt(e.head).from,1);});},shift:function shift(t){return Of(t,function(e){return B.cursor(t.lineBlockAt(e.head).from);});}},{key:"Ctrl-e",run:function run(t){return ff(t,function(e){return B.cursor(t.lineBlockAt(e.head).to,-1);});},shift:function shift(t){return Of(t,function(e){return B.cursor(t.lineBlockAt(e.head).to);});}},{key:"Ctrl-d",run:Jf},{key:"Ctrl-h",run:Uf},{key:"Ctrl-k",run:function run(t){return Vf(t,function(e){var i=t.lineBlockAt(e.head).to;return e.head<i?i:Math.min(t.state.doc.length,e.head+1);});}},{key:"Ctrl-Alt-h",run:Kf},{key:"Ctrl-o",run:function run(_ref43){var e=_ref43.state,i=_ref43.dispatch;if(e.readOnly)return!1;var s=e.changeByRange(function(e){return{changes:{from:e.from,to:e.to,insert:t.of(["",""])},range:B.cursor(e.from)};});return i(e.update(s,{scrollIntoView:!0,userEvent:"input"})),!0;}},{key:"Ctrl-t",run:function run(_ref44){var t=_ref44.state,e=_ref44.dispatch;if(t.readOnly)return!1;var i=t.changeByRange(function(e){if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};var i=e.from,s=t.doc.lineAt(i),r=i==s.from?i-1:p(s.text,i-s.from,!1)+s.from,n=i==s.to?i+1:p(s.text,i-s.from,!0)+s.from;return{changes:{from:r,to:n,insert:t.doc.slice(i,n).append(t.doc.slice(r,i))},range:B.cursor(n)};});return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0);}},{key:"Ctrl-v",run:Af}].map(function(t){return{mac:t.key,run:t.run,shift:t.shift};})));ra="function"==typeof String.prototype.normalize?function(t){return t.normalize("NFKD");}:function(t){return t;};na=/*#__PURE__*/function(){function na(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:t.length;var r=arguments.length>4?arguments[4]:undefined;var n=arguments.length>5?arguments[5]:undefined;_classCallCheck(this,na);this.test=n,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,s),this.bufferStart=i,this.normalize=r?function(t){return r(ra(t));}:ra,this.query=this.normalize(e);}return _createClass(na,[{key:"peek",value:function peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value;}return v(this.buffer,this.bufferPos);}},{key:"next",value:function next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping();}},{key:"nextOverlapping",value:function nextOverlapping(){for(;;){var _t266=this.peek();if(_t266<0)return this.done=!0,this;var _e229=k(_t266),_i191=this.bufferStart+this.bufferPos;this.bufferPos+=y(_t266);var _s177=this.normalize(_e229);for(var _t267=0,_r139=_i191;;_t267++){var _n110=_s177.charCodeAt(_t267),_h80=this.match(_n110,_r139,this.bufferPos+this.bufferStart);if(_t267==_s177.length-1){if(_h80)return this.value=_h80,this;break;}_r139==_i191&&_t267<_e229.length&&_e229.charCodeAt(_t267)==_n110&&_r139++;}}}},{key:"match",value:function match(t,e,i){var s=null;for(var _e230=0;_e230<this.matches.length;_e230+=2){var _r140=this.matches[_e230],_n111=!1;this.query.charCodeAt(_r140)==t&&(_r140==this.query.length-1?s={from:this.matches[_e230+1],to:i}:(this.matches[_e230]++,_n111=!0)),_n111||(this.matches.splice(_e230,2),_e230-=2);}return this.query.charCodeAt(0)==t&&(1==this.query.length?s={from:e,to:i}:this.matches.push(1,e)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s;}}]);}();"undefined"!=typeof Symbol&&(na.prototype[Symbol.iterator]=function(){return this;});ha={from:-1,to:-1,match:/.*/.exec("")};la="gm"+(null==/x/.unicode?"":"u");oa=/*#__PURE__*/function(){function oa(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:t.length;_classCallCheck(this,oa);if(this.text=t,this.to=r,this.curLine="",this.done=!1,this.value=ha,/\\[sWDnr]|\n|\r|\[\^/.test(e))return new aa(t,e,i,s,r);this.re=new RegExp(e,la+((null==i?void 0:i.ignoreCase)?"i":"")),this.test=null==i?void 0:i.test,this.iter=t.iter();var n=t.lineAt(s);this.curLineStart=n.from,this.matchPos=ca(t,s),this.getLine(this.curLineStart);}return _createClass(oa,[{key:"getLine",value:function getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next());}},{key:"nextLine",value:function nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0);}},{key:"next",value:function next(){for(var _t268=this.matchPos-this.curLineStart;;){this.re.lastIndex=_t268;var _e231=this.matchPos<=this.to&&this.re.exec(this.curLine);if(_e231){var _i192=this.curLineStart+_e231.index,_s178=_i192+_e231[0].length;if(this.matchPos=ca(this.text,_s178+(_i192==_s178?1:0)),_i192==this.curLineStart+this.curLine.length&&this.nextLine(),(_i192<_s178||_i192>this.value.to)&&(!this.test||this.test(_i192,_s178,_e231)))return this.value={from:_i192,to:_s178,match:_e231},this;_t268=this.matchPos-this.curLineStart;}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),_t268=0;}}}}]);}();ua=new WeakMap();fa=/*#__PURE__*/function(){function fa(t,e){_classCallCheck(this,fa);this.from=t,this.text=e;}return _createClass(fa,[{key:"to",get:function get(){return this.from+this.text.length;}}],[{key:"get",value:function get(t,e,i){var s=ua.get(t);if(!s||s.from>=i||s.to<=e){var _s179=new fa(e,t.sliceString(e,i));return ua.set(t,_s179),_s179;}if(s.from==e&&s.to==i)return s;var r=s.text,n=s.from;return n>e&&(r=t.sliceString(e,n)+r,n=e),s.to<i&&(r+=t.sliceString(s.to,i)),ua.set(t,new fa(n,r)),new fa(e,r.slice(e-n,i-n));}}]);}();aa=/*#__PURE__*/function(){function aa(t,e,i,s,r){_classCallCheck(this,aa);this.text=t,this.to=r,this.done=!1,this.value=ha,this.matchPos=ca(t,s),this.re=new RegExp(e,la+((null==i?void 0:i.ignoreCase)?"i":"")),this.test=null==i?void 0:i.test,this.flat=fa.get(t,s,this.chunkEnd(s+5e3));}return _createClass(aa,[{key:"chunkEnd",value:function chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to;}},{key:"next",value:function next(){for(;;){var _t269=this.re.lastIndex=this.matchPos-this.flat.from,_e232=this.re.exec(this.flat.text);if(_e232&&!_e232[0]&&_e232.index==_t269&&(this.re.lastIndex=_t269+1,_e232=this.re.exec(this.flat.text)),_e232){var _t270=this.flat.from+_e232.index,_i193=_t270+_e232[0].length;if((this.flat.to>=this.to||_e232.index+_e232[0].length<=this.flat.text.length-10)&&(!this.test||this.test(_t270,_i193,_e232)))return this.value={from:_t270,to:_i193,match:_e232},this.matchPos=ca(this.text,_i193+(_t270==_i193?1:0)),this;}if(this.flat.to==this.to)return this.done=!0,this;this.flat=fa.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length));}}}]);}();"undefined"!=typeof Symbol&&(oa.prototype[Symbol.iterator]=aa.prototype[Symbol.iterator]=function(){return this;});pa=ct.define();ma=F.define({create:function create(){return!0;},update:function update(t,e){var _iterator193=_createForOfIteratorHelper(e.effects),_step193;try{for(_iterator193.s();!(_step193=_iterator193.n()).done;){var _i195=_step193.value;_i195.is(pa)&&(t=_i195.value);}}catch(err){_iterator193.e(err);}finally{_iterator193.f();}return t;},provide:function provide(t){return fh.from(t,function(t){return t?da:null;});}});ga=Ur.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}});wa={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1};ba=j.define({combine:function combine(t){return At(t,wa,{highlightWordAroundCursor:function highlightWordAroundCursor(t,e){return t||e;},minSelectionLength:Math.min,maxMatches:Math.min});}});va=ni.mark({"class":"cm-selectionMatch"});ka=ni.mark({"class":"cm-selectionMatch cm-selectionMatch-main"});Ma=_i.fromClass(/*#__PURE__*/function(){function _class11(t){_classCallCheck(this,_class11);this.decorations=this.getDeco(t);}return _createClass(_class11,[{key:"update",value:function update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view));}},{key:"getDeco",value:function getDeco(t){var e=t.state.facet(ba),i=t.state,s=i.selection;if(s.ranges.length>1)return ni.none;var r,n=s.main,h=null;if(n.empty){if(!e.highlightWordAroundCursor)return ni.none;var _t272=i.wordAt(n.head);if(!_t272)return ni.none;h=i.charCategorizer(n.head),r=i.sliceDoc(_t272.from,_t272.to);}else{var _t273=n.to-n.from;if(_t273<e.minSelectionLength||_t273>200)return ni.none;if(e.wholeWords){if(r=i.sliceDoc(n.from,n.to),h=i.charCategorizer(n.head),!ya(h,i,n.from,n.to)||!function(t,e,i,s){return t(e.sliceDoc(i,i+1))==kt.Word&&t(e.sliceDoc(s-1,s))==kt.Word;}(h,i,n.from,n.to))return ni.none;}else if(r=i.sliceDoc(n.from,n.to),!r)return ni.none;}var l=[];var _iterator194=_createForOfIteratorHelper(t.visibleRanges),_step194;try{for(_iterator194.s();!(_step194=_iterator194.n()).done;){var _s180=_step194.value;var _t274=new na(i.doc,r,_s180.from,_s180.to);for(;!_t274.next().done;){var _t274$value=_t274.value,_s181=_t274$value.from,_r141=_t274$value.to;if((!h||ya(h,i,_s181,_r141))&&(n.empty&&_s181<=n.from&&_r141>=n.to?l.push(ka.range(_s181,_r141)):(_s181>=n.to||_r141<=n.from)&&l.push(va.range(_s181,_r141)),l.length>e.maxMatches))return ni.none;}}}catch(err){_iterator194.e(err);}finally{_iterator194.f();}return ni.set(l);}}]);}(),{decorations:function decorations(t){return t.decorations;}});xa=Ur.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});Sa=j.define({combine:function combine(t){return At(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:function createPanel(t){return new Za(t);},scrollToMatch:function scrollToMatch(t){return Ur.scrollIntoView(t);}});}});Aa=/*#__PURE__*/function(){function Aa(t){_classCallCheck(this,Aa);this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,la),!0;}catch(t){return!1;}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord;}return _createClass(Aa,[{key:"unquote",value:function unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,function(t,e){return"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\";});}},{key:"eq",value:function eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord;}},{key:"create",value:function create(){return this.regexp?new Ta(this):new Da(this);}},{key:"getCursor",value:function getCursor(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2?arguments[2]:undefined;var s=t.doc?t:St.create({doc:t});return null==i&&(i=s.doc.length),this.regexp?Ea(this,s,e,i):Oa(this,s,e,i);}}]);}();Ca=/*#__PURE__*/_createClass(function Ca(t){_classCallCheck(this,Ca);this.spec=t;});Da=/*#__PURE__*/function(_Ca){function Da(t){_classCallCheck(this,Da);return _callSuper(this,Da,[t]);}_inherits(Da,_Ca);return _createClass(Da,[{key:"nextMatch",value:function nextMatch(t,e,i){var s=Oa(this.spec,t,i,t.doc.length).nextOverlapping();return s.done&&(s=Oa(this.spec,t,0,e).nextOverlapping()),s.done?null:s.value;}},{key:"prevMatchInRange",value:function prevMatchInRange(t,e,i){for(var _s182=i;;){var _i196=Math.max(e,_s182-1e4-this.spec.unquoted.length),_r142=Oa(this.spec,t,_i196,_s182),_n112=null;for(;!_r142.nextOverlapping().done;)_n112=_r142.value;if(_n112)return _n112;if(_i196==e)return null;_s182-=1e4;}}},{key:"prevMatch",value:function prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length);}},{key:"getReplacement",value:function getReplacement(t){return this.spec.unquote(this.spec.replace);}},{key:"matchAll",value:function matchAll(t,e){var i=Oa(this.spec,t,0,t.doc.length),s=[];for(;!i.next().done;){if(s.length>=e)return null;s.push(i.value);}return s;}},{key:"highlight",value:function highlight(t,e,i,s){var r=Oa(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to);}}]);}(Ca);Ta=/*#__PURE__*/function(_Ca2){function Ta(){_classCallCheck(this,Ta);return _callSuper(this,Ta,arguments);}_inherits(Ta,_Ca2);return _createClass(Ta,[{key:"nextMatch",value:function nextMatch(t,e,i){var s=Ea(this.spec,t,i,t.doc.length).next();return s.done&&(s=Ea(this.spec,t,0,e).next()),s.done?null:s.value;}},{key:"prevMatchInRange",value:function prevMatchInRange(t,e,i){for(var _s183=1;;_s183++){var _r143=Math.max(e,i-1e4*_s183),_n113=Ea(this.spec,t,_r143,i),_h81=null;for(;!_n113.next().done;)_h81=_n113.value;if(_h81&&(_r143==e||_h81.from>_r143+10))return _h81;if(_r143==e)return null;}}},{key:"prevMatch",value:function prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length);}},{key:"getReplacement",value:function getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,function(e,i){return"$"==i?"$":"&"==i?t.match[0]:"0"!=i&&+i<t.match.length?t.match[i]:e;});}},{key:"matchAll",value:function matchAll(t,e){var i=Ea(this.spec,t,0,t.doc.length),s=[];for(;!i.next().done;){if(s.length>=e)return null;s.push(i.value);}return s;}},{key:"highlight",value:function highlight(t,e,i,s){var r=Ea(this.spec,t,Math.max(0,e-250),Math.min(i+250,t.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to);}}]);}(Ca);Ba=ct.define();La=ct.define();Na=F.define({create:function create(t){return new ja(Ga(t).create(),null);},update:function update(t,e){var _iterator195=_createForOfIteratorHelper(e.effects),_step195;try{for(_iterator195.s();!(_step195=_iterator195.n()).done;){var _i197=_step195.value;_i197.is(Ba)?t=new ja(_i197.value.create(),t.panel):_i197.is(La)&&(t=new ja(t.query,_i197.value?Ja:null));}}catch(err){_iterator195.e(err);}finally{_iterator195.f();}return t;},provide:function provide(t){return fh.from(t,function(t){return t.panel;});}});ja=/*#__PURE__*/_createClass(function ja(t,e){_classCallCheck(this,ja);this.query=t,this.panel=e;});$a=ni.mark({"class":"cm-searchMatch"});za=ni.mark({"class":"cm-searchMatch cm-searchMatch-selected"});Pa=_i.fromClass(/*#__PURE__*/function(){function _class12(t){_classCallCheck(this,_class12);this.view=t,this.decorations=this.highlight(t.state.field(Na));}return _createClass(_class12,[{key:"update",value:function update(t){var e=t.state.field(Na);(e!=t.startState.field(Na)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e));}},{key:"highlight",value:function highlight(_ref45){var t=_ref45.query,e=_ref45.panel;if(!e||!t.spec.valid)return ni.none;var i=this.view,s=new Rt();for(var _e233=0,_r144=i.visibleRanges,_n114=_r144.length;_e233<_n114;_e233++){var _r144$_e=_r144[_e233],_h82=_r144$_e.from,_l69=_r144$_e.to;for(;_e233<_n114-1&&_l69>_r144[_e233+1].from-500;)_l69=_r144[++_e233].to;t.highlight(i.state,_h82,_l69,function(t,e){var r=i.state.selection.ranges.some(function(i){return i.from==t&&i.to==e;});s.add(t,e,r?za:$a);});}return s.finish();}}]);}(),{decorations:function decorations(t){return t.decorations;}});Wa=Ha(function(t,_ref46){var e=_ref46.query;var i=t.state.selection.main.to,s=e.nextMatch(t.state,i,i);if(!s)return!1;var r=B.single(s.from,s.to),n=t.state.facet(Sa);return t.dispatch({selection:r,effects:[sc(t,s),n.scrollToMatch(r.main,t)],userEvent:"select.search"}),_a(t),!0;});Va=Ha(function(t,_ref47){var e=_ref47.query;var i=t.state,s=i.selection.main.from,r=e.prevMatch(i,s,s);if(!r)return!1;var n=B.single(r.from,r.to),h=t.state.facet(Sa);return t.dispatch({selection:n,effects:[sc(t,r),h.scrollToMatch(n.main,t)],userEvent:"select.search"}),_a(t),!0;});Fa=Ha(function(t,_ref48){var e=_ref48.query;var i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:B.create(i.map(function(t){return B.range(t.from,t.to);})),userEvent:"select.search.matches"}),!0);});qa=Ha(function(t,_ref49){var e=_ref49.query;var i=t.state,_i$selection$main=i.selection.main,s=_i$selection$main.from,r=_i$selection$main.to;if(i.readOnly)return!1;var n=e.nextMatch(i,s,s);if(!n)return!1;var h,l,o=[],u=[];if(n.from==s&&n.to==r&&(l=i.toText(e.getReplacement(n)),o.push({from:n.from,to:n.to,insert:l}),n=e.nextMatch(i,n.from,n.to),u.push(Ur.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(s).number)+"."))),n){var _e234=0==o.length||o[0].from>=n.to?0:n.to-n.from-l.length;h=B.single(n.from-_e234,n.to-_e234),u.push(sc(t,n)),u.push(i.facet(Sa).scrollToMatch(h.main,t));}return t.dispatch({changes:o,selection:h,effects:u,userEvent:"input.replace"}),!0;});Ua=Ha(function(t,_ref50){var e=_ref50.query;if(t.state.readOnly)return!1;var i=e.matchAll(t.state,1e9).map(function(t){var i=t.from,s=t.to;return{from:i,to:s,insert:e.getReplacement(t)};});if(!i.length)return!1;var s=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:Ur.announce.of(s),userEvent:"input.replace.all"}),!0;});Xa=function Xa(t){var e=t.state.field(Na,!1);if(e&&e.panel){var _i198=Ka(t);if(_i198&&_i198!=t.root.activeElement){var _s184=Ga(t.state,e.query.spec);_s184.valid&&t.dispatch({effects:Ba.of(_s184)}),_i198.focus(),_i198.select();}}else t.dispatch({effects:[La.of(!0),e?Ba.of(Ga(t.state,e.query.spec)):ct.appendConfig.of(nc)]});return!0;};Ya=function Ya(t){var e=t.state.field(Na,!1);if(!e||!e.panel)return!1;var i=hh(t,Ja);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:La.of(!1)}),!0;};Qa=[{key:"Mod-f",run:Xa,scope:"editor search-panel"},{key:"F3",run:Wa,shift:Va,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Wa,shift:Va,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Ya,scope:"editor search-panel"},{key:"Mod-Shift-l",run:function run(_ref51){var t=_ref51.state,e=_ref51.dispatch;var i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;var _i$main=i.main,s=_i$main.from,r=_i$main.to,n=[],h=0;for(var _e235=new na(t.doc,t.sliceDoc(s,r));!_e235.next().done;){if(n.length>1e3)return!1;_e235.value.from==s&&(h=n.length),n.push(B.range(_e235.value.from,_e235.value.to));}return e(t.update({selection:B.create(n,h),userEvent:"select.search.matches"})),!0;}},{key:"Mod-Alt-g",run:function run(t){var e=hh(t,da);if(!e){var _i199=[pa.of(!0)];null==t.state.field(ma,!1)&&_i199.push(ct.appendConfig.of([ma,ga])),t.dispatch({effects:_i199}),e=hh(t,da);}return e&&e.dom.querySelector("input").select(),!0;}},{key:"Mod-d",run:function run(_ref52){var t=_ref52.state,e=_ref52.dispatch;var i=t.selection.ranges;if(i.some(function(t){return t.from===t.to;}))return function(_ref53){var t=_ref53.state,e=_ref53.dispatch;var i=t.selection,s=B.create(i.ranges.map(function(e){return t.wordAt(e.head)||B.cursor(e.head);}),i.mainIndex);return!s.eq(i)&&(e(t.update({selection:s})),!0);}({state:t,dispatch:e});var s=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(function(e){return t.sliceDoc(e.from,e.to)!=s;}))return!1;var r=function(t,e){var _t$selection=t.selection,i=_t$selection.main,s=_t$selection.ranges,r=t.wordAt(i.head),n=r&&r.from==i.from&&r.to==i.to;var _loop16=function _loop16(_i201,_r146){if(_r146.next(),!_r146.done){if(_i201&&s.some(function(t){return t.from==_r146.value.from;})){_i200=_i201,_r145=_r146;return 0;}// continue
|
1
|
+
System.register([],function(_export,_context){"use strict";var t,e,i,n,h,l,o,f,_t18,d,M,x,S,A,R,T,B,N,j,z,V,F,q,U,J,G,_,X,Y,Q,Z,it,st,rt,nt,ht,lt,ot,ut,ft,at,ct,dt,bt,kt,yt,Mt,St,Ct,Ot,Et,It,Rt,Bt,Lt,jt,qt,Ut,Jt,Gt,Kt,_t,Xt,Yt,Qt,Zt,te,ee,pe,me,ge,Se,Ae,Ce,De,Re,Te,Be,Le,Ne,je,$e,ze,Pe,He,We,Ve,Fe,qe,Ue,Je,Ye,ei,ii,si,ri,ni,hi,li,oi,ai,di,pi,mi,gi,bi,vi,ki,yi,_i66,_arr,_t66,_e61,_i67,xi,Si,Ci,Ii,Bi,Li,Ni,ji,$i,zi,Pi,Hi,Wi,Vi,Fi,qi,Ji,Gi,Ki,_i,Xi,Yi,Qi,Zi,ts,es,is,rs,hs,ls,os,us,fs,cs,Cs,Es,Is,Rs,Bs,Ls,Ns,js,Ps,Hs,Fs,qs,Us,Js,_s,Xs,Zs,tr,er,ir,sr,rr,nr,hr,lr,or,ur,fr,cr,dr,gr,wr,br,vr,xr,Sr,Cr,Or,Dr,Er,Ir,Rr,Br,Lr,Nr,$r,zr,Hr,Wr,Vr,Ur,Jr,Gr,Kr,Xr,Qr,Zr,tn,sn,rn,hn,un,fn,cn,dn,mn,wn,bn,vn,kn,yn,Mn,Sn,An,Cn,On,Dn,En,In,Rn,Tn,Bn,Ln,Nn,$n,Hn,Wn,Vn,Fn,Un,Jn,Gn,Kn,_n,Xn,Yn,Qn,Zn,th,eh,rh,nh,lh,oh,fh,ah,ch,dh,ph,gh,bh,yh,Mh,xh,Sh,Ah,Ch,Dh,Rh,Th,Bh,Lh,Nh,jh,$h,zh,Ph,Hh,Wh,Vh,Fh,qh,Uh,Jh,_h,Xh,Zh,tl,il,sl,nl,ol,ul,fl,al,dl,ml,gl,wl,yl,Ml,Cl,Ol,Dl,El,Rl,Tl,Nl,jl,$l,zl,Pl,Hl,Wl,Vl,Fl,ql,Ul,Jl,Gl,Kl,_l,Xl,Yl,Ql,Zl,eo,io,ro,ho,lo,oo,fo,ao,co,po,mo,go,wo,bo,Mo,xo,Oo,Ro,Bo,Lo,Po,Ho,Vo,Go,Ko,_o,Qo,Zo,tu,eu,iu,su,ru,nu,ou,uu,fu,au,cu,du,pu,mu,gu,bu,vu,ku,Au,Cu,Ou,Du,Eu,_i176,_arr2,_arr2$_i,_t252,_e213,Bu,Lu,Nu,$u,Hu,Wu,Vu,Fu,qu,Ju,Gu,Ku,_u,Xu,Zu,tf,hf,lf,of,mf,gf,yf,Mf,Af,Cf,If,Rf,Lf,Nf,$f,zf,Pf,Hf,Wf,Vf,Uf,Jf,Gf,Kf,_f,Zf,ia,na,ha,la,oa,ua,fa,aa,ca,ma,ga,wa,ba,va,ka,ya,xa,Sa,Aa,Ca,Oa,Ea,Ba,La,Na,ja,$a,za,Pa,Ha,Va,Fa,qa,Ua,Ja,Ya,Qa,Za,tc,ic,sc,nc,hc,lc,ac,pc,mc,wc,bc,vc,kc,yc,Ac,Dc,Ec,Ic,Tc,Lc,Nc,jc,$c,zc,Hc,Vc,Fc,qc,Uc,Jc,Gc,Kc,_c,Xc,Yc,Qc,Zc,td,ed,nd,hd,ld,ud,fd,ad,cd,dd,pd,wd,bd,vd,Dd,Ed,Id,Rd,Bd,Ld,Nd,jd,$d,Hd,Wd,Vd,Ud,Jd,Gd,_d,Xd,Yd,Qd;function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e268){throw _e268;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e269){didErr=true;err=_e269;},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]();}finally{if(didErr)throw err;}}};}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function s(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1e9;for(var _r9=0,_n11=0,_h8=!0;_n11<t.length&&_r9<=s;_n11++){var _l7=t[_n11],_o4=_r9+_l7.length;_o4>=i&&(_o4>s&&(_l7=_l7.slice(0,s-_r9)),_r9<i&&(_l7=_l7.slice(i-_r9)),_h8?(e[e.length-1]+=_l7,_h8=!1):e.push(_l7)),_r9=_o4+1;}return e;}function r(t,e,i){return s(t,[""],e,i);}function u(t,e,i){return[e=Math.max(0,Math.min(t.length,e)),Math.max(e,Math.min(t.length,i))];}function a(t){for(var _e13=1;_e13<f.length;_e13+=2)if(f[_e13]>t)return f[_e13-1]<=t;return!1;}function c(t){return t>=127462&&t<=127487;}function p(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!0;return(i?m:g)(t,e,s);}function m(t,e,i){if(e==t.length)return e;e&&w(t.charCodeAt(e))&&b(t.charCodeAt(e-1))&&e--;var s=v(t,e);for(e+=y(s);e<t.length;){var _r11=v(t,e);if(s==d||_r11==d||i&&a(_r11))e+=y(_r11),s=_r11;else{if(!c(_r11))break;{var _i9=0,_s4=e-2;for(;_s4>=0&&c(v(t,_s4));)_i9++,_s4-=2;if(_i9%2==0)break;e+=2;}}}return e;}function g(t,e,i){for(;e>0;){var _s5=m(t,e-2,i);if(_s5<e)return _s5;e--;}return 0;}function w(t){return t>=56320&&t<57344;}function b(t){return t>=55296&&t<56320;}function v(t,e){var i=t.charCodeAt(e);if(!b(i)||e+1==t.length)return i;var s=t.charCodeAt(e+1);return w(s)?s-56320+(i-55296<<10)+65536:i;}function k(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)));}function y(t){return t<65536?1:2;}function C(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1;if(0==e&&i<=0)return;var r=t.length-2;r>=0&&i<=0&&i==t[r+1]?t[r]+=e:0==e&&0==t[r]?t[r+1]+=i:s?(t[r]+=e,t[r+1]+=i):t.push(e,i);}function O(e,i,s){if(0==s.length)return;var r=i.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(s);else{for(;e.length<r;)e.push(t.empty);e.push(s);}}function D(e,i,s){var r=e.inserted;for(var _n20=0,_h13=0,_l13=0;_l13<e.sections.length;){var _o8=e.sections[_l13++],_u15=e.sections[_l13++];if(_u15<0)_n20+=_o8,_h13+=_o8;else{var _f3=_n20,_a3=_h13,_c3=t.empty;for(;_f3+=_o8,_a3+=_u15,_u15&&r&&(_c3=_c3.append(r[_l13-2>>1])),!(s||_l13==e.sections.length||e.sections[_l13+1]<0);)_o8=e.sections[_l13++],_u15=e.sections[_l13++];i(_n20,_f3,_h13,_a3,_c3),_n20=_f3,_h13=_a3;}}}function E(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1;var r=[],n=s?[]:null,h=new R(t),l=new R(e);for(var _t22=-1;;)if(-1==h.ins&&-1==l.ins){var _t23=Math.min(h.len,l.len);C(r,_t23,-1),h.forward(_t23),l.forward(_t23);}else if(l.ins>=0&&(h.ins<0||_t22==h.i||0==h.off&&(l.len<h.len||l.len==h.len&&!i))){var _e21=l.len;for(C(r,l.ins,-1);_e21;){var _i16=Math.min(h.len,_e21);h.ins>=0&&_t22<h.i&&h.len<=_i16&&(C(r,0,h.ins),n&&O(n,r,h.text),_t22=h.i),h.forward(_i16),_e21-=_i16;}l.next();}else{if(!(h.ins>=0)){if(h.done&&l.done)return n?A.createSet(r,n):S.create(r);throw new Error("Mismatched change set lengths");}{var _e22=0,_i17=h.len;for(;_i17;)if(-1==l.ins){var _t24=Math.min(_i17,l.len);_e22+=_t24,_i17-=_t24,l.forward(_t24);}else{if(!(0==l.ins&&l.len<_i17))break;_i17-=l.len,l.next();}C(r,_e22,_t22<h.i?h.ins:0),n&&_t22<h.i&&O(n,r,h.text),_t22=h.i,h.forward(h.len-_i17);}}}function I(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=[],r=i?[]:null,n=new R(t),h=new R(e);for(var _t25=!1;;){if(n.done&&h.done)return r?A.createSet(s,r):S.create(s);if(0==n.ins)C(s,n.len,0,_t25),n.next();else if(0!=h.len||h.done){if(n.done||h.done)throw new Error("Mismatched change set lengths");{var _e23=Math.min(n.len2,h.len),_i18=s.length;if(-1==n.ins){var _i19=-1==h.ins?-1:h.off?0:h.ins;C(s,_e23,_i19,_t25),r&&_i19&&O(r,s,h.text);}else-1==h.ins?(C(s,n.off?0:n.len,_e23,_t25),r&&O(r,s,n.textBit(_e23))):(C(s,n.off?0:n.len,h.off?0:h.ins,_t25),r&&!h.off&&O(r,s,h.text));_t25=(n.ins>_e23||h.ins>=0&&h.len>_e23)&&(_t25||s.length>_i18),n.forward2(_e23),h.forward(_e23);}}else C(s,0,h.ins,_t25),r&&O(r,s,h.text),h.next();}}function L(t,e){var _iterator11=_createForOfIteratorHelper(t.ranges),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var _i23=_step11.value;if(_i23.to>e)throw new RangeError("Selection points outside of document");}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}}function $(t,e){return t==e||t.length==e.length&&t.every(function(t,i){return t===e[i];});}function P(t,e,i){if(t.length!=e.length)return!1;for(var _s13=0;_s13<t.length;_s13++)if(!i(t[_s13],e[_s13]))return!1;return!0;}function H(t,e){var i=!1;var _iterator13=_createForOfIteratorHelper(e),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var _s14=_step13.value;1&tt(t,_s14)&&(i=!0);}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}return i;}function W(t,e,i){var s=i.map(function(e){return t[e.id];}),r=i.map(function(t){return t.type;}),n=s.filter(function(t){return!(1&t);}),h=t[e.id]>>1;function l(t){var i=[];for(var _e25=0;_e25<s.length;_e25++){var _n22=et(t,s[_e25]);if(2==r[_e25]){var _iterator14=_createForOfIteratorHelper(_n22),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var _t26=_step14.value;i.push(_t26);}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}}else i.push(_n22);}return e.combine(i);}return{create:function create(t){var _iterator15=_createForOfIteratorHelper(s),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var _e26=_step15.value;tt(t,_e26);}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}return t.values[h]=l(t),1;},update:function update(t,i){if(!H(t,n))return 0;var s=l(t);return e.compare(s,t.values[h])?0:(t.values[h]=s,1);},reconfigure:function reconfigure(t,r){var n=H(t,s),o=r.config.facets[e.id],u=r.facet(e);if(o&&!n&&$(i,o))return t.values[h]=u,0;var f=l(t);return e.compare(f,u)?(t.values[h]=u,0):(t.values[h]=f,1);}};}function K(t){return function(e){return new X(e,t);};}function tt(t,e){if(1&e)return 2;var i=e>>1,s=t.status[i];if(4==s)throw new Error("Cyclic dependency between fields and/or facets");if(2&s)return s;t.status[i]=4;var r=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|r;}function et(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1];}function pt(t,e){var i=[];for(var _s18=0,_r19=0;;){var _n23=void 0,_h15=void 0;if(_s18<t.length&&(_r19==e.length||e[_r19]>=t[_s18]))_n23=t[_s18++],_h15=t[_s18++];else{if(!(_r19<e.length))return i;_n23=e[_r19++],_h15=e[_r19++];}!i.length||i[i.length-1]<_n23?i.push(_n23,_h15):i[i.length-1]<_h15&&(i[i.length-1]=_h15);}}function mt(t,e,i){var s;var r,n,h;return i?(r=e.changes,n=A.empty(e.changes.length),h=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),n=t.changes.mapDesc(e.changes,!0),h=t.changes.compose(r)),{changes:h,selection:e.selection?e.selection.map(n):null===(s=t.selection)||void 0===s?void 0:s.map(r),effects:ct.mapEffects(t.effects,r).concat(ct.mapEffects(e.effects,n)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView};}function gt(t,e,i){var s=e.selection,r=vt(e.annotations);return e.userEvent&&(r=r.concat(dt.userEvent.of(e.userEvent))),{changes:e.changes instanceof A?e.changes:A.of(e.changes||[],i,t.facet(rt)),selection:s&&(s instanceof B?s:B.single(s.anchor,s.head)),effects:vt(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView};}function wt(t,e,i){var s=gt(t,e.length?e[0]:{},t.doc.length);e.length&&!1===e[0].filter&&(i=!1);for(var _r20=1;_r20<e.length;_r20++){!1===e[_r20].filter&&(i=!1);var _n24=!!e[_r20].sequential;s=mt(s,gt(t,e[_r20],_n24?s.changes.newLength:t.doc.length),_n24);}var r=dt.create(t,s.changes,s.selection,s.effects,s.annotations,s.scrollIntoView);return function(t){var e=t.startState,i=e.facet(lt),s=t;for(var _r21=i.length-1;_r21>=0;_r21--){var _n25=i[_r21](t);_n25&&Object.keys(_n25).length&&(s=mt(s,gt(e,_n25,t.changes.newLength),!0));}return s==t?t:dt.create(e,t.changes,t.selection,s.effects,s.annotations,s.scrollIntoView);}(i?function(t){var e=t.startState,i=!0;var _iterator21=_createForOfIteratorHelper(e.facet(nt)),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var _s20=_step21.value;var _e32=_s20(t);if(!1===_e32){i=!1;break;}Array.isArray(_e32)&&(i=!0===i?_e32:pt(i,_e32));}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}if(!0!==i){var _s19,_r22;if(!1===i)_r22=t.changes.invertedDesc,_s19=A.empty(e.doc.length);else{var _e31=t.changes.filter(i);_s19=_e31.changes,_r22=_e31.filtered.mapDesc(_e31.changes).invertedDesc;}t=dt.create(e,_s19,t.selection&&t.selection.map(_r22),ct.mapEffects(t.effects,_r22),t.annotations,t.scrollIntoView);}var s=e.facet(ht);for(var _i27=s.length-1;_i27>=0;_i27--){var _r23=s[_i27](t);t=_r23 instanceof dt?_r23:Array.isArray(_r23)&&1==_r23.length&&_r23[0]instanceof dt?_r23[0]:wt(e,vt(_r23),!1);}return t;}(r):r);}function vt(t){return null==t?bt:Array.isArray(t)?t:[t];}function xt(t){return function(e){if(!/\S/.test(e))return kt.Space;if(function(t){if(Mt)return Mt.test(t);for(var _e33=0;_e33<t.length;_e33++){var _i28=t[_e33];if(/\w/.test(_i28)||_i28>""&&(_i28.toUpperCase()!=_i28.toLowerCase()||yt.test(_i28)))return!0;}return!1;}(e))return kt.Word;for(var _i29=0;_i29<t.length;_i29++)if(e.indexOf(t[_i29])>-1)return kt.Word;return kt.Other;};}function At(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var s={};var _iterator26=_createForOfIteratorHelper(t),_step26;try{for(_iterator26.s();!(_step26=_iterator26.n()).done;){var _e37=_step26.value;for(var _i33=0,_Object$keys=Object.keys(_e37);_i33<_Object$keys.length;_i33++){var _t35=_Object$keys[_i33];var _r26=_e37[_t35],_n28=s[_t35];if(void 0===_n28)s[_t35]=_r26;else if(_n28===_r26||void 0===_r26);else{if(!Object.hasOwnProperty.call(i,_t35))throw new Error("Config merge conflict for field "+_t35);s[_t35]=i[_t35](_n28,_r26);}}}}catch(err){_iterator26.e(err);}finally{_iterator26.f();}for(var _t34 in e)void 0===s[_t34]&&(s[_t34]=e[_t34]);return s;}function Dt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide;}function Tt(t,e,i){var s=new Map();var _iterator29=_createForOfIteratorHelper(t),_step29;try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var _e40=_step29.value;for(var _t40=0;_t40<_e40.chunk.length;_t40++)_e40.chunk[_t40].maxPoint<=0&&s.set(_e40.chunk[_t40],_e40.chunkPos[_t40]);}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}var r=new Set();var _iterator30=_createForOfIteratorHelper(e),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var _t41=_step30.value;for(var _e41=0;_e41<_t41.chunk.length;_e41++){var _n33=s.get(_t41.chunk[_e41]);null==_n33||(i?i.mapPos(_n33):_n33)!=_t41.chunkPos[_e41]||(null==i?void 0:i.touchesRange(_n33,_n33+_t41.chunk[_e41].length))||r.add(_t41.chunk[_e41]);}}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}return r;}function Nt(t,e){for(var _i40=t[e];;){var _s28=1+(e<<1);if(_s28>=t.length)break;var _r33=t[_s28];if(_s28+1<t.length&&_r33.compare(t[_s28+1])>=0&&(_r33=t[_s28+1],_s28++),_i40.compare(_r33)<0)break;t[_s28]=_i40,t[e]=_r33,e=_s28;}}function $t(t,e,i,s,r,n){t["goto"](e),i["goto"](s);var h=s+r,l=s,o=s-e;for(;;){var _e45=t.to+o-i.to||t.endSide-i.endSide,_s30=_e45<0?t.to+o:i.to,_r34=Math.min(_s30,h);if(t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&zt(t.activeForPoint(t.to),i.activeForPoint(i.to))||n.comparePoint(l,_r34,t.point,i.point):_r34>l&&!zt(t.active,i.active)&&n.compareRange(l,_r34,t.active,i.active),_s30>h)break;l=_s30,_e45<=0&&t.next(),_e45>=0&&i.next();}}function zt(t,e){if(t.length!=e.length)return!1;for(var _i43=0;_i43<t.length;_i43++)if(t[_i43]!=e[_i43]&&!t[_i43].eq(e[_i43]))return!1;return!0;}function Pt(t,e){for(var _i44=e,_s31=t.length-1;_i44<_s31;_i44++)t[_i44]=t[_i44+1];t.pop();}function Ht(t,e,i){for(var _i45=t.length-1;_i45>=e;_i45--)t[_i45+1]=t[_i45];t[e]=i;}function Wt(t,e){var i=-1,s=1e9;for(var _r35=0;_r35<e.length;_r35++)(e[_r35]-s||t[_r35].endSide-t[i].endSide)<0&&(i=_r35,s=e[_r35]);return i;}function Vt(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:t.length;var s=0;for(var _r36=0;_r36<i;)9==t.charCodeAt(_r36)?(s+=e-s%e,_r36++):(s++,_r36=p(t,_r36));return s;}function Ft(t,e,i,s){for(var _s32=0,_r37=0;;){if(_r37>=e)return _s32;if(_s32==t.length)break;_r37+=9==t.charCodeAt(_s32)?i-_r37%i:1,_s32=p(t,_s32);}return!0===s?-1:t.length;}function ie(t){var e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection();}function se(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e));}function re(t,e){if(!e.anchorNode)return!1;try{return se(t,e.anchorNode);}catch(t){return!1;}}function ne(t){return 3==t.nodeType?be(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[];}function he(t,e,i,s){return!!i&&(ue(t,e,i,s,-1)||ue(t,e,i,s,1));}function le(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e;}function oe(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName);}function ue(t,e,i,s,r){for(;;){if(t==i&&e==s)return!0;if(e==(r<0?0:fe(t))){if("DIV"==t.nodeName)return!1;var _i48=t.parentNode;if(!_i48||1!=_i48.nodeType)return!1;e=le(t)+(r<0?0:1),t=_i48;}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=r<0?fe(t):0;}}}function fe(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length;}function ae(t,e){var i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom};}function ce(t){var e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight};}function de(t,e){var i=e.width/t.offsetWidth,s=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(s>.995&&s<1.005||!isFinite(s)||Math.abs(e.height-t.offsetHeight)<1)&&(s=1),{scaleX:i,scaleY:s};}function we(t){if(t.setActive)return t.setActive();if(ge)return t.focus(ge);var e=[];for(var _i49=t;_i49&&(e.push(_i49,_i49.scrollTop,_i49.scrollLeft),_i49!=_i49.ownerDocument);_i49=_i49.parentNode);if(t.focus(null==ge?{get preventScroll(){return ge={preventScroll:!0},!0;}}:void 0),!ge){ge=!1;for(var _t49=0;_t49<e.length;){var _i50=e[_t49++],_s33=e[_t49++],_r38=e[_t49++];_i50.scrollTop!=_s33&&(_i50.scrollTop=_s33),_i50.scrollLeft!=_r38&&(_i50.scrollLeft=_r38);}}}function be(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:e;var s=me||(me=document.createRange());return s.setEnd(t,i),s.setStart(t,e),s;}function ve(t,e,i,s){var _s34;var r={key:e,code:e,keyCode:i,which:i,cancelable:!0};s&&(_s34=s,r.altKey=_s34.altKey,r.ctrlKey=_s34.ctrlKey,r.shiftKey=_s34.shiftKey,r.metaKey=_s34.metaKey,_s34);var n=new KeyboardEvent("keydown",r);n.synthetic=!0,t.dispatchEvent(n);var h=new KeyboardEvent("keyup",r);return h.synthetic=!0,t.dispatchEvent(h),n.defaultPrevented||h.defaultPrevented;}function ke(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0]);}function ye(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4);}function Me(t,e){for(var _i51=t,_s35=e;;){if(3==_i51.nodeType&&_s35>0)return{node:_i51,offset:_s35};if(1==_i51.nodeType&&_s35>0){if("false"==_i51.contentEditable)return null;_i51=_i51.childNodes[_s35-1],_s35=fe(_i51);}else{if(!_i51.parentNode||oe(_i51))return null;_s35=le(_i51),_i51=_i51.parentNode;}}}function xe(t,e){for(var _i52=t,_s36=e;;){if(3==_i52.nodeType&&_s36<_i52.nodeValue.length)return{node:_i52,offset:_s36};if(1==_i52.nodeType&&_s36<_i52.childNodes.length){if("false"==_i52.contentEditable)return null;_i52=_i52.childNodes[_s36],_s36=0;}else{if(!_i52.parentNode||oe(_i52))return null;_s36=le(_i52)+1,_i52=_i52.parentNode;}}}function Oe(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e;}function Ee(t,e,i,s,r,n,h,l,o){var u=t.children,f=u.length?u[e]:null,a=n.length?n[n.length-1]:null,c=a?a.breakAfter:h;if(!(e==s&&f&&!h&&!c&&n.length<2&&f.merge(i,r,n.length?a:null,0==i,l,o))){if(s<u.length){var _t56=u[s];_t56&&(r<_t56.length||_t56.breakAfter&&(null==a?void 0:a.breakAfter))?(e==s&&(_t56=_t56.split(r),r=0),!c&&a&&_t56.merge(0,r,a,!0,0,o)?n[n.length-1]=_t56:((r||_t56.children.length&&!_t56.children[0].length)&&_t56.merge(0,r,null,!1,0,o),n.push(_t56))):(null==_t56?void 0:_t56.breakAfter)&&(a?a.breakAfter=1:h=1),s++;}for(f&&(f.breakAfter=h,i>0&&(!h&&n.length&&f.merge(i,f.length,n[0],!1,l,0)?f.breakAfter=n.shift().breakAfter:(i<f.length||f.children.length&&0==f.children[f.children.length-1].length)&&f.merge(i,f.length,null,!1,l,0),e++));e<s&&n.length;)if(u[s-1].become(n[n.length-1]))s--,n.pop(),o=n.length?0:l;else{if(!u[e].become(n[0]))break;e++,n.shift(),l=n.length?0:o;}!n.length&&e&&s<u.length&&!u[e-1].breakAfter&&u[s].merge(0,0,u[e-1],!1,l,o)&&e--,(e<s||n.length)&&t.replaceChildren(e,s,n);}}function Ie(t,e,i,s,r,n){var h=t.childCursor(),_h$findPos=h.findPos(i,1),l=_h$findPos.i,o=_h$findPos.off,_h$findPos2=h.findPos(e,-1),u=_h$findPos2.i,f=_h$findPos2.off,a=e-i;var _iterator37=_createForOfIteratorHelper(s),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var _t57=_step37.value;a+=_t57.length;}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}t.length+=a,Ee(t,u,f,l,o,s,0,r,n);}function Ge(t,e){var i=t.dom,s=t.children,r=0;for(var _t60=0;r<s.length;r++){var _n38=s[r],_h22=_t60+_n38.length;if(!(_h22==_t60&&_n38.getSide()<=0)){if(e>_t60&&e<_h22&&_n38.dom.parentNode==i)return _n38.domAtPos(e-_t60);if(e<=_t60)break;_t60=_h22;}}for(var _t61=r;_t61>0;_t61--){var _e57=s[_t61-1];if(_e57.dom.parentNode==i)return _e57.domAtPos(_e57.length);}for(var _t62=r;_t62<s.length;_t62++){var _e58=s[_t62];if(_e58.dom.parentNode==i)return _e58.domAtPos(0);}return new Se(i,0);}function Ke(t,e,i){var s,r=t.children;i>0&&e instanceof qe&&r.length&&(s=r[r.length-1])instanceof qe&&s.mark.eq(e.mark)?Ke(s,e.children[0],i-1):(r.push(e),e.setParent(t)),t.length+=e.length;}function _e(t,e,i){var s=null,r=-1,n=null,h=-1;!function t(e,l){for(var _o12=0,_u19=0;_o12<e.children.length&&_u19<=l;_o12++){var _f6=e.children[_o12],_a5=_u19+_f6.length;_a5>=l&&(_f6.children.length?t(_f6,l-_u19):(!n||n.isHidden&&i>0)&&(_a5>l||_u19==_a5&&_f6.getSide()>0)?(n=_f6,h=l-_u19):(_u19<l||_u19==_a5&&_f6.getSide()<0&&!_f6.isHidden)&&(s=_f6,r=l-_u19)),_u19=_a5;}}(t,e);var l=(i<0?s:n)||s||n;return l?l.coordsAt(Math.max(0,l==s?r:h),i):function(t){var e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();var i=ne(e);return i[i.length-1]||null;}(t);}function Xe(t,e){for(var _i58 in t)"class"==_i58&&e["class"]?e["class"]+=" "+t["class"]:"style"==_i58&&e.style?e.style+=";"+t.style:e[_i58]=t[_i58];return e;}function Qe(t,e,i){if(t==e)return!0;t||(t=Ye),e||(e=Ye);var s=Object.keys(t),r=Object.keys(e);if(s.length-(i&&s.indexOf(i)>-1?1:0)!=r.length-(i&&r.indexOf(i)>-1?1:0))return!1;for(var _i59=0,_s41=s;_i59<_s41.length;_i59++){var _n39=_s41[_i59];if(_n39!=i&&(-1==r.indexOf(_n39)||t[_n39]!==e[_n39]))return!1;}return!0;}function Ze(t,e,i){var s=!1;if(e)for(var _r40 in e)i&&_r40 in i||(s=!0,"style"==_r40?t.style.cssText="":t.removeAttribute(_r40));if(i)for(var _r41 in i)e&&e[_r41]==i[_r41]||(s=!0,"style"==_r41?t.style.cssText=i[_r41]:t.setAttribute(_r41,i[_r41]));return s;}function ti(t){var e=Object.create(null);for(var _i60=0;_i60<t.attributes.length;_i60++){var _s42=t.attributes[_i60];e[_s42.name]=_s42.value;}return e;}function ui(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;var i=t.inclusiveStart,s=t.inclusiveEnd;return null==i&&(i=t.inclusive),null==s&&(s=t.inclusive),{start:null!=i?i:e,end:null!=s?s:e};}function fi(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=i.length-1;r>=0&&i[r]+s>=t?i[r]=Math.max(i[r],e):i.push(t,e);}function ci(t,e){var _iterator41=_createForOfIteratorHelper(e),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var _i64=_step41.value;t=new qe(_i64,[t],t.length);}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}return t;}function wi(t){var e=[];for(var _i65=0;_i65<t.length;_i65++)e.push(1<<+t[_i65]);return e;}function Mi(t){return t<=247?bi[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?vi[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1;}function Ai(t,e){if(t.length!=e.length)return!1;for(var _i68=0;_i68<t.length;_i68++){var _s48=t[_i68],_r44=e[_i68];if(_s48.from!=_r44.from||_s48.to!=_r44.to||_s48.direction!=_r44.direction||!Ai(_s48.inner,_r44.inner))return!1;}return!0;}function Oi(t,e,i,s,r,n,h){var l=s%2?2:1;if(s%2==r%2)for(var _o14=e,_u21=0;_o14<i;){var _e62=!0,_f7=!1;if(_u21==n.length||_o14<n[_u21].from){var _t67=Ci[_o14];_t67!=l&&(_e62=!1,_f7=16==_t67);}var _a6=_e62||1!=l?null:[],_c5=_e62?s:s+1,_d2=_o14;t:for(;;)if(_u21<n.length&&_d2==n[_u21].from){if(_f7)break t;var _p=n[_u21];if(!_e62)for(var _t68=_p.to,_e63=_u21+1;;){if(_t68==i)break t;if(!(_e63<n.length&&n[_e63].from==_t68)){if(Ci[_t68]==l)break t;break;}_t68=n[_e63++].to;}if(_u21++,_a6)_a6.push(_p);else{_p.from>_o14&&h.push(new Si(_o14,_p.from,_c5)),Di(t,_p.direction==mi!=!(_c5%2)?s+1:s,r,_p.inner,_p.from,_p.to,h),_o14=_p.to;}_d2=_p.to;}else{if(_d2==i||(_e62?Ci[_d2]!=l:Ci[_d2]==l))break;_d2++;}_a6?Oi(t,_o14,_d2,s+1,r,_a6,h):_o14<_d2&&h.push(new Si(_o14,_d2,_c5)),_o14=_d2;}else for(var _o15=i,_u22=n.length;_o15>e;){var _i69=!0,_f8=!1;if(!_u22||_o15>n[_u22-1].to){var _t69=Ci[_o15-1];_t69!=l&&(_i69=!1,_f8=16==_t69);}var _a7=_i69||1!=l?null:[],_c6=_i69?s:s+1,_d3=_o15;t:for(;;)if(_u22&&_d3==n[_u22-1].to){if(_f8)break t;var _p2=n[--_u22];if(!_i69)for(var _t70=_p2.from,_i70=_u22;;){if(_t70==e)break t;if(!_i70||n[_i70-1].to!=_t70){if(Ci[_t70-1]==l)break t;break;}_t70=n[--_i70].from;}if(_a7)_a7.push(_p2);else{_p2.to<_o15&&h.push(new Si(_p2.to,_o15,_c6)),Di(t,_p2.direction==mi!=!(_c6%2)?s+1:s,r,_p2.inner,_p2.from,_p2.to,h),_o15=_p2.from;}_d3=_p2.from;}else{if(_d3==e||(_i69?Ci[_d3-1]!=l:Ci[_d3-1]==l))break;_d3--;}_a7?Oi(t,_d3,_o15,s+1,r,_a7,h):_d3<_o15&&h.push(new Si(_d3,_o15,_c6)),_o15=_d3;}}function Di(t,e,i,s,r,n,h){var l=e%2?2:1;!function(t,e,i,s,r){for(var _n44=0;_n44<=s.length;_n44++){var _h24=_n44?s[_n44-1].to:e,_l21=_n44<s.length?s[_n44].from:i,_o16=_n44?256:r;for(var _e64=_h24,_i71=_o16,_s49=_o16;_e64<_l21;_e64++){var _r45=Mi(t.charCodeAt(_e64));512==_r45?_r45=_i71:8==_r45&&4==_s49&&(_r45=16),Ci[_e64]=4==_r45?2:_r45,7&_r45&&(_s49=_r45),_i71=_r45;}for(var _t71=_h24,_e65=_o16,_s50=_o16;_t71<_l21;_t71++){var _r46=Ci[_t71];if(128==_r46)_t71<_l21-1&&_e65==Ci[_t71+1]&&24&_e65?_r46=Ci[_t71]=_e65:Ci[_t71]=256;else if(64==_r46){var _r47=_t71+1;for(;_r47<_l21&&64==Ci[_r47];)_r47++;var _n45=_t71&&8==_e65||_r47<i&&8==Ci[_r47]?1==_s50?1:8:256;for(var _e66=_t71;_e66<_r47;_e66++)Ci[_e66]=_n45;_t71=_r47-1;}else 8==_r46&&1==_s50&&(Ci[_t71]=1);_e65=_r46,7&_r46&&(_s50=_r46);}}}(t,r,n,s,l),function(t,e,i,s,r){var n=1==r?2:1;for(var _h25=0,_l22=0,_o17=0;_h25<=s.length;_h25++){var _u23=_h25?s[_h25-1].to:e,_f9=_h25<s.length?s[_h25].from:i;for(var _e67,_i72,_s51,_h26=_u23;_h26<_f9;_h26++)if(_i72=ki[_e67=t.charCodeAt(_h26)]){if(_i72<0){for(var _t72=_l22-3;_t72>=0;_t72-=3)if(yi[_t72+1]==-_i72){var _e68=yi[_t72+2],_i73=2&_e68?r:4&_e68?1&_e68?n:r:0;_i73&&(Ci[_h26]=Ci[yi[_t72]]=_i73),_l22=_t72;break;}}else{if(189==yi.length)break;yi[_l22++]=_h26,yi[_l22++]=_e67,yi[_l22++]=_o17;}}else if(2==(_s51=Ci[_h26])||1==_s51){var _t73=_s51==r;_o17=_t73?0:1;for(var _e69=_l22-3;_e69>=0;_e69-=3){var _i74=yi[_e69+2];if(2&_i74)break;if(_t73)yi[_e69+2]|=2;else{if(4&_i74)break;yi[_e69+2]|=4;}}}}}(t,r,n,s,l),function(t,e,i,s){for(var _r48=0,_n46=s;_r48<=i.length;_r48++){var _h27=_r48?i[_r48-1].to:t,_l23=_r48<i.length?i[_r48].from:e;for(var _o18=_h27;_o18<_l23;){var _h28=Ci[_o18];if(256==_h28){var _h29=_o18+1;for(;;)if(_h29==_l23){if(_r48==i.length)break;_h29=i[_r48++].to,_l23=_r48<i.length?i[_r48].from:e;}else{if(256!=Ci[_h29])break;_h29++;}var _u24=1==_n46,_f10=_u24==(1==(_h29<e?Ci[_h29]:s))?_u24?1:2:s;for(var _e70=_h29,_s52=_r48,_n47=_s52?i[_s52-1].to:t;_e70>_o18;)_e70==_n47&&(_e70=i[--_s52].from,_n47=_s52?i[_s52-1].to:t),Ci[--_e70]=_f10;_o18=_h29;}else _n46=_h28,_o18++;}}}(r,n,s,l),Oi(t,r,n,e,i,s,h);}function Ei(t){return[new Si(0,t,0)];}function Ri(t,e,i,s,r){var n;var h=s.head-t.from,l=Si.find(e,h,null!==(n=s.bidiLevel)&&void 0!==n?n:-1,s.assoc),o=e[l],u=o.side(r,i);if(h==u){var _t74=l+=r?1:-1;if(_t74<0||_t74>=e.length)return null;o=e[l=_t74],h=o.side(!r,i),u=o.side(r,i);}var f=p(t.text,h,o.forward(r,i));(f<o.from||f>o.to)&&(f=u),Ii=t.text.slice(Math.min(h,f),Math.max(h,f));var a=l==(r?e.length-1:0)?null:e[l+(r?1:-1)];return a&&f==u&&a.level+(r?0:1)<o.level?B.cursor(a.side(!r,i)+t.from,a.forward(r,i)?1:-1,a.level):B.cursor(f+t.from,o.forward(r,i)?-1:1,o.level);}function Ti(t,e,i){for(var _s53=e;_s53<i;_s53++){var _e71=Mi(t.charCodeAt(_s53));if(1==_e71)return mi;if(2==_e71||4==_e71)return gi;}return mi;}function Ui(t,e,i){var s=t.facet(ji);s.length?s[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e);}function ss(t,e){var i=t.state.facet(is);if(!i.length)return i;var s=i.map(function(e){return e instanceof Function?e(t):e;}),r=[];return It.spans(s,e.from,e.to,{point:function point(){},span:function span(t,i,s,n){var h=t-e.from,l=i-e.from,o=r;for(var _t76=s.length-1;_t76>=0;_t76--,n--){var _i75=void 0,_r49=s[_t76].spec.bidiIsolate;if(null==_r49&&(_r49=Ti(e.text,h,l)),n>0&&o.length&&(_i75=o[o.length-1]).to==h&&_i75.direction==_r49)_i75.to=l,o=_i75.inner;else{var _t77={from:h,to:l,direction:_r49,inner:[]};o.push(_t77),o=_t77.inner;}}}}),r;}function ns(t){var e=0,i=0,s=0,r=0;var _iterator42=_createForOfIteratorHelper(t.state.facet(rs)),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var _n48=_step42.value;var _h30=_n48(t);_h30&&(null!=_h30.left&&(e=Math.max(e,_h30.left)),null!=_h30.right&&(i=Math.max(i,_h30.right)),null!=_h30.top&&(s=Math.max(s,_h30.top)),null!=_h30.bottom&&(r=Math.max(r,_h30.bottom)));}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}return{left:e,right:i,top:s,bottom:r};}function as(t,e){var i=t.observer.selectionRange;if(!i.focusNode)return null;var s=Me(i.focusNode,i.focusOffset),r=xe(i.focusNode,i.focusOffset),n=s||r;if(r&&s&&r.node!=s.node){var _e89=Ce.get(r.node);if(!_e89||_e89 instanceof Fe&&_e89.text!=r.node.nodeValue)n=r;else if(t.docView.lastCompositionAfterCursor){var _t96=Ce.get(s.node);!_t96||_t96 instanceof Fe&&_t96.text!=s.node.nodeValue||(n=r);}}if(t.docView.lastCompositionAfterCursor=n!=s,!n)return null;var h=e-n.offset;return{from:h,to:h+n.node.nodeValue.length,node:n.node};}function ds(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right);}function ps(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom);}function ms(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1;}function gs(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t;}function ws(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t;}function bs(t,e,i){var s,r,n,h,l,o,u,f,a=!1;for(var _c9=t.firstChild;_c9;_c9=_c9.nextSibling){var _t97=ne(_c9);for(var _d6=0;_d6<_t97.length;_d6++){var _p5=_t97[_d6];r&&ms(r,_p5)&&(_p5=gs(ws(_p5,r.bottom),r.top));var _m3=ds(e,_p5),_g3=ps(i,_p5);if(0==_m3&&0==_g3)return 3==_c9.nodeType?vs(_c9,e,i):bs(_c9,e,i);if(!s||h>_g3||h==_g3&&n>_m3){s=_c9,r=_p5,n=_m3,h=_g3;var _l28=_g3?i<_p5.top?-1:1:_m3?e<_p5.left?-1:1:0;a=!_l28||(_l28>0?_d6<_t97.length-1:_d6>0);}0==_m3?i>_p5.bottom&&(!u||u.bottom<_p5.bottom)?(l=_c9,u=_p5):i<_p5.top&&(!f||f.top>_p5.top)&&(o=_c9,f=_p5):u&&ms(u,_p5)?u=ws(u,_p5.bottom):f&&ms(f,_p5)&&(f=gs(f,_p5.top));}}if(u&&u.bottom>=i?(s=l,r=u):f&&f.top<=i&&(s=o,r=f),!s)return{node:t,offset:0};var c=Math.max(r.left,Math.min(r.right,e));return 3==s.nodeType?vs(s,c,i):a&&"false"!=s.contentEditable?bs(s,c,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,s)+(e>=(r.left+r.right)/2?1:0)};}function vs(t,e,i){var s=t.nodeValue.length,r=-1,n=1e9,h=0;for(var _l29=0;_l29<s;_l29++){var _s65=be(t,_l29,_l29+1).getClientRects();for(var _o23=0;_o23<_s65.length;_o23++){var _u28=_s65[_o23];if(_u28.top==_u28.bottom)continue;h||(h=e-_u28.left);var _f14=(_u28.top>i?_u28.top-i:i-_u28.bottom)-1;if(_u28.left-1<=e&&_u28.right+1>=e&&_f14<n){var _i82=e>=(_u28.left+_u28.right)/2,_s66=_i82;if(Ve.chrome||Ve.gecko){be(t,_l29).getBoundingClientRect().left==_u28.right&&(_s66=!_i82);}if(_f14<=0)return{node:t,offset:_l29+(_s66?1:0)};r=_l29+(_s66?1:0),n=_f14;}}}return{node:t,offset:r>-1?r:h>0?t.nodeValue.length:0};}function ks(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:-1;var r,n;var h,l=t.contentDOM.getBoundingClientRect(),o=l.top+t.viewState.paddingTop,u=t.viewState.docHeight,f=e.x,a=e.y,c=a-o;if(c<0)return 0;if(c>u)return t.state.doc.length;for(var _e90=t.viewState.heightOracle.textHeight/2,_r54=!1;h=t.elementAtHeight(c),h.type!=ri.Text;)for(;c=s>0?h.bottom+_e90:h.top-_e90,!(c>=0&&c<=u);){if(_r54)return i?null:0;_r54=!0,s=-s;}a=o+c;var d=h.from;if(d<t.viewport.from)return 0==t.viewport.from?0:i?null:ys(t,l,h,f,a);if(d>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:ys(t,l,h,f,a);var p=t.dom.ownerDocument,m=t.root.elementFromPoint?t.root:p,g=m.elementFromPoint(f,a);g&&!t.contentDOM.contains(g)&&(g=null),g||(f=Math.max(l.left+1,Math.min(l.right-1,f)),g=m.elementFromPoint(f,a),g&&!t.contentDOM.contains(g)&&(g=null));var w,b=-1;if(g&&0!=(null===(r=t.docView.nearest(g))||void 0===r?void 0:r.isEditable))if(p.caretPositionFromPoint){var _t99;var _t98=p.caretPositionFromPoint(f,a);_t98&&(_t99=_t98,w=_t99.offsetNode,b=_t99.offset,_t99);}else if(p.caretRangeFromPoint){var _e91=p.caretRangeFromPoint(f,a);_e91&&((w=_e91.startContainer,b=_e91.startOffset),(!t.contentDOM.contains(w)||Ve.safari&&function(t,e,i){var s;if(3!=t.nodeType||e!=(s=t.nodeValue.length))return!1;for(var _e92=t.nextSibling;_e92;_e92=_e92.nextSibling)if(1!=_e92.nodeType||"BR"!=_e92.nodeName)return!1;return be(t,s-1,s).getBoundingClientRect().left>i;}(w,b,f)||Ve.chrome&&function(t,e,i){if(0!=e)return!1;for(var _e93=t;;){var _t100=_e93.parentNode;if(!_t100||1!=_t100.nodeType||_t100.firstChild!=_e93)return!1;if(_t100.classList.contains("cm-line"))break;_e93=_t100;}var s=1==t.nodeType?t.getBoundingClientRect():be(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return i-s.left>5;}(w,b,f))&&(w=void 0));}if(!w||!t.docView.dom.contains(w)){var _e94=ei.find(t.docView,d);if(!_e94)return c>h.top+h.height/2?h.to:h.from;var _bs=bs(_e94.dom,f,a);w=_bs.node;b=_bs.offset;}var v=t.docView.nearest(w);if(!v)return null;if(v.isWidget&&1==(null===(n=v.dom)||void 0===n?void 0:n.nodeType)){var _t101=v.dom.getBoundingClientRect();return e.y<_t101.top||e.y<=_t101.bottom&&e.x<=(_t101.left+_t101.right)/2?v.posAtStart:v.posAtEnd;}return v.localPosFromDOM(w,b)+v.posAtStart;}function ys(t,e,i,s,r){var n=Math.round((s-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&i.height>1.5*t.defaultLineHeight){var _e95=t.viewState.heightOracle.textHeight;n+=Math.floor((r-i.top-.5*(t.defaultLineHeight-_e95))/_e95)*t.viewState.heightOracle.lineLength;}var h=t.state.sliceDoc(i.from,i.to);return i.from+Ft(h,n,t.state.tabSize);}function Ms(t,e){var i=t.lineBlockAt(e);if(Array.isArray(i.type)){var _iterator48=_createForOfIteratorHelper(i.type),_step48;try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){var _t102=_step48.value;if(_t102.to>e||_t102.to==e&&(_t102.to==i.to||_t102.type==ri.Text))return _t102;}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}}return i;}function xs(t,e,i,s){var r=t.state.doc.lineAt(e.head),n=t.bidiSpans(r),h=t.textDirectionAt(r.from);for(var _l30=e,_o24=null;;){var _e96=Ri(r,n,h,_l30,i),_u29=Ii;if(!_e96){if(r.number==(i?t.state.doc.lines:1))return _l30;_u29="\n",r=t.state.doc.line(r.number+(i?1:-1)),n=t.bidiSpans(r),_e96=t.visualLineSide(r,!i);}if(_o24){if(!_o24(_u29))return _l30;}else{if(!s)return _e96;_o24=s(_u29);}_l30=_e96;}}function Ss(t,e,i){var _loop5=function _loop5(){var s=0;var _iterator49=_createForOfIteratorHelper(t),_step49;try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){var _r55=_step49.value;_r55.between(e-1,e+1,function(t,r,n){if(e>t&&e<r){var _n56=s||i||(e-t<r-e?-1:1);e=_n56<0?t:r,s=_n56;}});}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}if(!s)return{v:e};},_ret;for(;;){_ret=_loop5();if(_ret)return _ret.v;}}function As(t,e,i){var s=Ss(t.state.facet(es).map(function(e){return e(t);}),i.from,e.head>i.from?-1:1);return s==i.from?i:B.cursor(s,s<i.from?1:-1);}function Os(t,e){return function(i,s){try{return e.call(t,s,i);}catch(t){Ui(i.state,t);}};}function Ds(t){var e=Object.create(null);function i(t){return e[t]||(e[t]={observers:[],handlers:[]});}var _iterator52=_createForOfIteratorHelper(t),_step52;try{for(_iterator52.s();!(_step52=_iterator52.n()).done;){var _e97=_step52.value;var _t109=_e97.spec;if(_t109&&_t109.domEventHandlers)for(var _s68 in _t109.domEventHandlers){var _r57=_t109.domEventHandlers[_s68];_r57&&i(_s68).handlers.push(Os(_e97.value,_r57));}if(_t109&&_t109.domEventObservers)for(var _s69 in _t109.domEventObservers){var _r58=_t109.domEventObservers[_s69];_r58&&i(_s69).observers.push(Os(_e97.value,_r58));}}}catch(err){_iterator52.e(err);}finally{_iterator52.f();}for(var _t107 in Ls)i(_t107).handlers.push(Ls[_t107]);for(var _t108 in Ns)i(_t108).observers.push(Ns[_t108]);return e;}function Ts(t){return .7*Math.max(0,t)+8;}function $s(t,e){var i,s=t.state,r=1,n=s.toText(e),h=n.lines==s.selection.ranges.length;if(null!=_s&&s.selection.ranges.every(function(t){return t.empty;})&&_s==n.toString()){var _t113=-1;i=s.changeByRange(function(i){var l=s.doc.lineAt(i.from);if(l.from==_t113)return{range:i};_t113=l.from;var o=s.toText((h?n.line(r++).text:e)+s.lineBreak);return{changes:{from:l.from,insert:o},range:B.cursor(i.from+o.length)};});}else i=h?s.changeByRange(function(t){var e=n.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:B.cursor(t.from+e.length)};}):s.replaceSelection(n);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0});}function zs(t,e,i,s){if(1==s)return B.cursor(e,i);if(2==s)return function(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;var s=t.charCategorizer(e),r=t.doc.lineAt(e),n=e-r.from;if(0==r.length)return B.cursor(e);0==n?i=1:n==r.length&&(i=-1);var h=n,l=n;i<0?h=p(r.text,n,!1):l=p(r.text,n);var o=s(r.text.slice(h,l));for(;h>0;){var _t114=p(r.text,h,!1);if(s(r.text.slice(_t114,h))!=o)break;h=_t114;}for(;l<r.length;){var _t115=p(r.text,l);if(s(r.text.slice(l,_t115))!=o)break;l=_t115;}return B.range(h+r.from,l+r.from);}(t.state,e,i);{var _i87=ei.find(t.docView,e),_s71=t.state.doc.lineAt(_i87?_i87.posAtEnd:e),_r60=_i87?_i87.posAtStart:_s71.from,_n58=_i87?_i87.posAtEnd:_s71.to;return _n58<t.state.doc.length&&_n58==_s71.to&&_n58++,B.range(_r60,_n58);}}function Ws(t,e,i,s){var r=ei.find(t.docView,e);if(!r)return 1;var n=e-r.posAtStart;if(0==n)return 1;if(n==r.length)return-1;var h=r.coordsAt(n,-1);if(h&&Hs(i,s,h))return-1;var l=r.coordsAt(n,1);return l&&Hs(i,s,l)?1:h&&Ps(s,h)?-1:1;}function Vs(t,e){var i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:Ws(t,i,e.clientX,e.clientY)};}function Gs(t){if(!Fs)return t.detail;var e=qs,i=Js;return qs=t,Js=Date.now(),Us=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Us+1)%3:1;}function Ks(t,e,i,s){if(!i)return;var r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.inputState.draggedContent,h=s&&n&&function(t,e){var i=t.state.facet(Li);return i.length?i[0](e):Ve.mac?!e.altKey:!e.ctrlKey;}(t,e)?{from:n.from,to:n.to}:null,l={from:r,insert:i},o=t.state.changes(h?[h,l]:l);t.focus(),t.dispatch({changes:o,selection:{anchor:o.mapPos(r,-1),head:o.mapPos(r,1)},userEvent:h?"move.drop":"input.drop"}),t.inputState.draggedContent=null;}function Ys(t,e){var i=[];var _iterator56=_createForOfIteratorHelper(t.facet(Pi)),_step56;try{for(_iterator56.s();!(_step56=_iterator56.n()).done;){var _s79=_step56.value;var _r66=_s79(t,e);_r66&&i.push(_r66);}}catch(err){_iterator56.e(err);}finally{_iterator56.f();}return i?t.update({effects:i,annotations:Xs.of(!0)}):null;}function Qs(t){setTimeout(function(){var e=t.hasFocus;if(e!=t.inputState.notifiedFocused){var _i90=Ys(t.state,e);_i90?t.dispatch(_i90):t.update([]);}},10);}function ar(t,e){var i,s;null==t[e]&&(i=t[e-1])instanceof ur&&(s=t[e+1])instanceof ur&&t.splice(e-1,3,new ur(i.length+1+s.length));}function pr(t,e){var i=t.getBoundingClientRect(),s=t.ownerDocument,r=s.defaultView||window,n=Math.max(0,i.left),h=Math.min(r.innerWidth,i.right),l=Math.max(0,i.top),o=Math.min(r.innerHeight,i.bottom);for(var _e110=t.parentNode;_e110&&_e110!=s.body;)if(1==_e110.nodeType){var _i96=_e110,_s85=window.getComputedStyle(_i96);if((_i96.scrollHeight>_i96.clientHeight||_i96.scrollWidth>_i96.clientWidth)&&"visible"!=_s85.overflow){var _s86=_i96.getBoundingClientRect();n=Math.max(n,_s86.left),h=Math.min(h,_s86.right),l=Math.max(l,_s86.top),o=_e110==t.parentNode?_s86.bottom:Math.min(o,_s86.bottom);}_e110="absolute"==_s85.position||"fixed"==_s85.position?_i96.offsetParent:_i96.parentNode;}else{if(11!=_e110.nodeType)break;_e110=_e110.host;}return{left:n-i.left,right:Math.max(n,h)-i.left,top:l-(i.top+e),bottom:Math.max(l,o)-(i.top+e)};}function mr(t,e){var i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)};}function kr(t,e,i){var s=[],r=t,n=0;return It.spans(i,t,e,{span:function span(){},point:function point(t,e){t>r&&(s.push({from:r,to:t}),n+=t-r),r=e;}},20),r<e&&(s.push({from:r,to:e}),n+=e-r),{total:n,ranges:s};}function yr(_ref10,i){var t=_ref10.total,e=_ref10.ranges;if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;var s=Math.floor(t*i);for(var _t131=0;;_t131++){var _e$_t=e[_t131],_i106=_e$_t.from,_r75=_e$_t.to,_n69=_r75-_i106;if(s<=_n69)return _i106+s;s-=_n69;}}function Mr(t,e){var i=0;var _iterator63=_createForOfIteratorHelper(t.ranges),_step63;try{for(_iterator63.s();!(_step63=_iterator63.n()).done;){var _step63$value=_step63.value,_s93=_step63$value.from,_r76=_step63$value.to;if(e<=_r76){i+=e-_s93;break;}i+=_r76-_s93;}}catch(err){_iterator63.e(err);}finally{_iterator63.f();}return i/t.total;}function Ar(t,e){if(1==e.scale)return t;var i=e.toDOM(t.top),s=e.toDOM(t.bottom);return new sr(t.from,t.length,i,s-i,Array.isArray(t._content)?t._content.map(function(t){return Ar(t,e);}):t._content);}function Tr(t,e,i){return new Gt(e,{finish:function finish(e){return /&/.test(e)?e.replace(/&\w*/,function(e){if("&"==e)return t;if(!i||!i[e])throw new RangeError("Unsupported selector: ".concat(e));return i[e];}):t+" "+e;}});}function jr(t,e,i){for(;;){if(!e||i<fe(e))return!1;if(e==t)return!0;i=le(e)+1,e=e.parentNode;}}function Pr(e,i){var s,r=i.newSel,n=e.state.selection.main,h=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(i.bounds){var _i$bounds=i.bounds,_r82=_i$bounds.from,_l39=_i$bounds.to,_o30=n.from,_u33=null;(8===h||Ve.android&&i.text.length<_l39-_r82)&&(_o30=n.to,_u33="end");var _f17=function(t,e,i,s){var r=Math.min(t.length,e.length),n=0;for(;n<r&&t.charCodeAt(n)==e.charCodeAt(n);)n++;if(n==r&&t.length==e.length)return null;var h=t.length,l=e.length;for(;h>0&&l>0&&t.charCodeAt(h-1)==e.charCodeAt(l-1);)h--,l--;if("end"==s){i-=h+Math.max(0,n-Math.min(h,l))-n;}if(h<n&&t.length<e.length){n-=i<=n&&i>=h?n-i:0,l=n+(l-h),h=n;}else if(l<n){n-=i<=n&&i>=l?n-i:0,h=n+(h-l),l=n;}return{from:n,toA:h,toB:l};}(e.state.doc.sliceString(_r82,_l39,Lr),i.text,_o30-_r82,_u33);_f17&&(Ve.chrome&&13==h&&_f17.toB==_f17.from+2&&i.text.slice(_f17.from,_f17.toB)==Lr+Lr&&_f17.toB--,s={from:_r82+_f17.from,to:_r82+_f17.toA,insert:t.of(i.text.slice(_f17.from,_f17.toB).split(Lr))});}else r&&(!e.hasFocus&&e.state.facet(Ji)||r.main.eq(n))&&(r=null);if(!s&&!r)return!1;if(!s&&i.typeOver&&!n.empty&&r&&r.main.empty?s={from:n.from,to:n.to,insert:e.state.doc.slice(n.from,n.to)}:s&&s.from>=n.from&&s.to<=n.to&&(s.from!=n.from||s.to!=n.to)&&n.to-n.from-(s.to-s.from)<=4?s={from:n.from,to:n.to,insert:e.state.doc.slice(n.from,s.from).append(s.insert).append(e.state.doc.slice(s.to,n.to))}:(Ve.mac||Ve.android)&&s&&s.from==s.to&&s.from==n.head-1&&/^\. ?$/.test(s.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(r&&2==s.insert.length&&(r=B.single(r.main.anchor-1,r.main.head-1)),s={from:n.from,to:n.to,insert:t.of([" "])}):Ve.chrome&&s&&s.from==s.to&&s.from==n.head&&"\n "==s.insert.toString()&&e.lineWrapping&&(r&&(r=B.single(r.main.anchor-1,r.main.head-1)),s={from:n.from,to:n.to,insert:t.of([" "])}),s){if(Ve.ios&&e.inputState.flushIOSKey(s))return!0;if(Ve.android&&(s.to==n.to&&(s.from==n.from||s.from==n.from-1&&" "==e.state.sliceDoc(s.from,n.from))&&1==s.insert.length&&2==s.insert.lines&&ve(e.contentDOM,"Enter",13)||(s.from==n.from-1&&s.to==n.to&&0==s.insert.length||8==h&&s.insert.length<s.to-s.from&&s.to>n.head)&&ve(e.contentDOM,"Backspace",8)||s.from==n.from&&s.to==n.to+1&&0==s.insert.length&&ve(e.contentDOM,"Delete",46)))return!0;var _t135,_i115=s.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;var _l40=function _l40(){return _t135||(_t135=function(t,e,i){var s,r=t.state,n=r.selection.main;if(e.from>=n.from&&e.to<=n.to&&e.to-e.from>=(n.to-n.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){var _i116=n.from<e.from?r.sliceDoc(n.from,e.from):"",_h41=n.to>e.to?r.sliceDoc(e.to,n.to):"";s=r.replaceSelection(t.state.toText(_i116+e.insert.sliceString(0,void 0,t.state.lineBreak)+_h41));}else{var _h42=r.changes(e),_l41=i&&i.main.to<=_h42.newLength?i.main:void 0;if(r.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=n.to&&e.to>=n.to-10){var _o31,_u34=t.state.sliceDoc(e.from,e.to),_f18=i&&as(t,i.main.head);if(_f18){var _t136=e.insert.length-(e.to-e.from);_o31={from:_f18.from,to:_f18.to-_t136};}else _o31=t.state.doc.lineAt(n.head);var _a12=n.to-e.to,_c11=n.to-n.from;s=r.changeByRange(function(i){if(i.from==n.from&&i.to==n.to)return{changes:_h42,range:_l41||i.map(_h42)};var s=i.to-_a12,f=s-_u34.length;if(i.to-i.from!=_c11||t.state.sliceDoc(f,s)!=_u34||i.to>=_o31.from&&i.from<=_o31.to)return{range:i};var d=r.changes({from:f,to:s,insert:e.insert}),p=i.to-n.to;return{changes:d,range:_l41?B.range(Math.max(0,_l41.anchor+p),Math.max(0,_l41.head+p)):i.map(d)};});}else s={changes:_h42,selection:_l41&&r.selection.replaceRange(_l41)};}var h="input.type";(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,h+=".compose",t.inputState.compositionFirstChange&&(h+=".start",t.inputState.compositionFirstChange=!1));return r.update(s,{userEvent:h,scrollIntoView:!0});}(e,s,r));};return e.state.facet(zi).some(function(t){return t(e,s.from,s.to,_i115,_l40);})||e.dispatch(_l40()),!0;}if(r&&!r.main.eq(n)){var _t137=!1,_i117="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(_t137=!0),_i117=e.inputState.lastSelectionOrigin),e.dispatch({selection:r,scrollIntoView:_t137,userEvent:_i117}),!0;}return!1;}function Fr(t,e,i){for(;e;){var _s100=Ce.get(e);if(_s100&&_s100.parent==t)return _s100;var _r84=e.parentNode;e=_r84!=t.dom?_r84:i>0?e.nextSibling:e.previousSibling;}return null;}function qr(t,e){var _ref12;var i=e.startContainer,s=e.startOffset,r=e.endContainer,n=e.endOffset,h=t.docView.domAtPos(t.state.selection.main.anchor);return he(h.node,h.offset,r,n)&&(_ref12=[r,n,i,s],i=_ref12[0],s=_ref12[1],r=_ref12[2],n=_ref12[3],_ref12),{anchorNode:i,anchorOffset:s,focusNode:r,focusOffset:n};}function _r(t,e,i){for(var _s105=t.state.facet(e),_r88=_s105.length-1;_r88>=0;_r88--){var _e133=_s105[_r88],_n74="function"==typeof _e133?_e133(t):_e133;_n74&&Xe(_n74,i);}return i;}function Yr(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t;}function en(t){var e=t.facet(Zr),i=tn.get(e);return i||tn.set(e,i=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Xr;var i=Object.create(null),s=Object.create(null),r=function r(t,e){var i=s[t];if(null==i)s[t]=e;else if(i!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix");},n=function n(t,s,_n75,h,l){var o,u;var f=i[t]||(i[t]=Object.create(null)),a=s.split(/ (?!$)/).map(function(t){return function(t,e){var i=t.split(/-(?!$)/);var s,r,n,h,l=i[i.length-1];"Space"==l&&(l=" ");for(var _t162=0;_t162<i.length-1;++_t162){var _l43=i[_t162];if(/^(cmd|meta|m)$/i.test(_l43))h=!0;else if(/^a(lt)?$/i.test(_l43))s=!0;else if(/^(c|ctrl|control)$/i.test(_l43))r=!0;else if(/^s(hift)?$/i.test(_l43))n=!0;else{if(!/^mod$/i.test(_l43))throw new Error("Unrecognized modifier name: "+_l43);"mac"==e?h=!0:r=!0;}}return s&&(l="Alt-"+l),r&&(l="Ctrl-"+l),h&&(l="Meta-"+l),n&&(l="Shift-"+l),l;}(t,e);});var _loop8=function _loop8(){var i=a.slice(0,_e134).join(" ");r(i,!0),f[i]||(f[i]={preventDefault:!0,stopPropagation:!1,run:[function(e){var s=sn={view:e,prefix:i,scope:t};return setTimeout(function(){sn==s&&(sn=null);},rn),!0;}]});};for(var _e134=1;_e134<a.length;_e134++){_loop8();}var c=a.join(" ");r(c,!1);var d=f[c]||(f[c]={preventDefault:!1,stopPropagation:!1,run:(null===(u=null===(o=f._any)||void 0===o?void 0:o.run)||void 0===u?void 0:u.slice())||[]});_n75&&d.run.push(_n75),h&&(d.preventDefault=!0),l&&(d.stopPropagation=!0);};var _iterator92=_createForOfIteratorHelper(t),_step92;try{for(_iterator92.s();!(_step92=_iterator92.n()).done;){var _s106=_step92.value;var _t163=_s106.scope?_s106.scope.split(" "):["editor"];if(_s106.any){var _iterator93=_createForOfIteratorHelper(_t163),_step93;try{for(_iterator93.s();!(_step93=_iterator93.n()).done;){var _e135=_step93.value;var _t164=i[_e135]||(i[_e135]=Object.create(null));_t164._any||(_t164._any={preventDefault:!1,stopPropagation:!1,run:[]});for(var _e136 in _t164)_t164[_e136].run.push(_s106.any);}}catch(err){_iterator93.e(err);}finally{_iterator93.f();}}var _r89=_s106[e]||_s106.key;if(_r89){var _iterator94=_createForOfIteratorHelper(_t163),_step94;try{for(_iterator94.s();!(_step94=_iterator94.n()).done;){var _e137=_step94.value;n(_e137,_r89,_s106.run,_s106.preventDefault,_s106.stopPropagation),_s106.shift&&n(_e137,"Shift-"+_r89,_s106.shift,_s106.preventDefault,_s106.stopPropagation);}}catch(err){_iterator94.e(err);}finally{_iterator94.f();}}}}catch(err){_iterator92.e(err);}finally{_iterator92.f();}return i;}(e.reduce(function(t,e){return t.concat(e);},[]))),i;}function nn(t,e,i,s){var r=function(t){var e=!(Qt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Zt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Yt:Xt)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e;}(e),n=y(v(r,0))==r.length&&" "!=r,h="",l=!1,o=!1,u=!1;sn&&sn.view==i&&sn.scope==s&&(h=sn.prefix+" ",Rs.indexOf(e.keyCode)<0&&(o=!0,sn=null));var f,a,c=new Set(),d=function d(t){if(t){var _iterator95=_createForOfIteratorHelper(t.run),_step95;try{for(_iterator95.s();!(_step95=_iterator95.n()).done;){var _s107=_step95.value;if(!c.has(_s107)&&(c.add(_s107),_s107(i,e)))return t.stopPropagation&&(u=!0),!0;}}catch(err){_iterator95.e(err);}finally{_iterator95.f();}t.preventDefault&&(t.stopPropagation&&(u=!0),o=!0);}return!1;},p=t[s];return p&&(d(p[h+Yr(r,e,!n)])?l=!0:n&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ve.windows&&e.ctrlKey&&e.altKey)&&(f=Xt[e.keyCode])&&f!=r?(d(p[h+Yr(f,e,!0)])||e.shiftKey&&(a=Yt[e.keyCode])!=r&&a!=f&&d(p[h+Yr(a,e,!1)]))&&(l=!0):n&&e.shiftKey&&d(p[h+Yr(r,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),o&&(l=!0),l&&u&&e.stopPropagation(),l;}function ln(t){var e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==pi.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY};}function on(t,e,i){var s=B.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(s,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(s,!0,!0).from),type:ri.Text};}function an(t){return[_i.define(function(e){return new un(e,t);}),fn.of(t)];}function pn(t){return t.startState.facet(dn)!=t.state.facet(dn);}function gn(t,e){e.style.animationDuration=t.facet(dn).cursorBlinkRate+"ms";}function xn(t,e,i,s,r){e.lastIndex=0;for(var _n78,_h46=t.iterRange(i,s),_l45=i;!_h46.next().done;_l45+=_h46.value.length)if(!_h46.lineBreak)for(;_n78=e.exec(_h46.value);)r(_l45+_n78.index,_n78);}function jn(t){return _i.fromClass(/*#__PURE__*/function(){function _class3(e){_classCallCheck(this,_class3);this.view=e,this.placeholder=t?ni.set([ni.widget({widget:new Nn(t),side:1}).range(0)]):ni.none;}return _createClass(_class3,[{key:"decorations",get:function get(){return this.view.state.doc.length?ni.none:this.placeholder;}}]);}(),{decorations:function decorations(t){return t.decorations;}});}function zn(t,e){var i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),s=t.state.doc.lineAt(i),r=i-s.from,n=r>$n?-1:r==s.length?function(t,e){var i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1;}(t,e.clientX):Vt(s.text,t.state.tabSize,i-s.from);return{line:s.number,col:n,off:r};}function Pn(t,e){var i=zn(t,e),s=t.state.selection;return i?{update:function update(t){if(t.docChanged){var _e144=t.changes.mapPos(t.startState.doc.line(i.line).from),_r98=t.state.doc.lineAt(_e144);i={line:_r98.number,col:i.col,off:Math.min(i.off,_r98.length)},s=s.map(t.changes);}},get:function get(e,r,n){var h=zn(t,e);if(!h)return s;var l=function(t,e,i){var s=Math.min(e.line,i.line),r=Math.max(e.line,i.line),n=[];if(e.off>$n||i.off>$n||e.col<0||i.col<0){var _h47=Math.min(e.off,i.off),_l47=Math.max(e.off,i.off);for(var _e145=s;_e145<=r;_e145++){var _i128=t.doc.line(_e145);_i128.length<=_l47&&n.push(B.range(_i128.from+_h47,_i128.to+_l47));}}else{var _h48=Math.min(e.col,i.col),_l48=Math.max(e.col,i.col);for(var _e146=s;_e146<=r;_e146++){var _i129=t.doc.line(_e146),_s116=Ft(_i129.text,_h48,t.tabSize,!0);if(_s116<0)n.push(B.cursor(_i129.to));else{var _e147=Ft(_i129.text,_l48,t.tabSize);n.push(B.range(_i129.from+_s116,_i129.from+_e147));}}}return n;}(t.state,i,h);return l.length?n?B.create(l.concat(s.ranges)):B.create(l):s;}}:null;}function qn(t){var e=t.win;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth};}function ih(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var i=ct.define(),s=F.define({create:function create(){return[];},update:function update(t,s){if(t.length&&(e.hideOnChange&&(s.docChanged||s.selection)?t=[]:e.hideOn&&(t=t.filter(function(t){return!e.hideOn(s,t);})),s.docChanged)){var _e157=[];var _iterator118=_createForOfIteratorHelper(t),_step118;try{for(_iterator118.s();!(_step118=_iterator118.n()).done;){var _i133=_step118.value;var _t179=s.changes.mapPos(_i133.pos,-1,x.TrackDel);if(null!=_t179){var _r100=Object.assign(Object.create(null),_i133);_r100.pos=_t179,null!=_r100.end&&(_r100.end=s.changes.mapPos(_r100.end)),_e157.push(_r100);}}}catch(err){_iterator118.e(err);}finally{_iterator118.f();}t=_e157;}var _iterator119=_createForOfIteratorHelper(s.effects),_step119;try{for(_iterator119.s();!(_step119=_iterator119.n()).done;){var _e158=_step119.value;_e158.is(i)&&(t=_e158.value),_e158.is(rh)&&(t=[]);}}catch(err){_iterator119.e(err);}finally{_iterator119.f();}return t;},provide:function provide(t){return Yn.from(t);}});return[s,_i.define(function(r){return new th(r,t,s,i,e.hoverTime||300);}),Zn];}function sh(t,e){var i=t.plugin(Gn);if(!i)return null;var s=i.manager.tooltips.indexOf(e);return s<0?null:i.manager.tooltipViews[s];}function hh(t,e){var i=t.plugin(lh),s=i?i.specs.indexOf(e):-1;return s>-1?i.panels[s]:null;}function uh(t){var e=t.nextSibling;return t.remove(),e;}function mh(t){return[wh(),ph.of(Object.assign(Object.assign({},dh),t))];}function wh(t){var e=[bh];return t&&!1===t.fixed&&e.push(gh.of(!0)),e;}function vh(t){return Array.isArray(t)?t:[t];}function kh(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next();}function Oh(t,e){return t.state.facet(Ah).formatNumber(e,t.state);}function Eh(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[Ah.of(t),wh(),Dh];}function Ih(t){var e=9;for(;e<t;)e=10*e+9;return e;}function Gh(t,e,i,s){switch(t){case-2:return i<e;case-1:return s>=e&&i<e;case 0:return i<e&&s>e;case 1:return i<=e&&s>e;case 2:return s>e;case 4:return!0;}}function Kh(t,e,i,s){for(var r;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to<e);){var _e185=!s&&t instanceof Xh&&t.index<0?null:t.parent;if(!_e185)return t;t=_e185;}var n=s?0:Fh.IgnoreOverlays;if(s)for(var _s131=t,_h56=_s131.parent;_h56;_s131=_h56,_h56=_s131.parent)_s131 instanceof Xh&&_s131.index<0&&(null===(r=_h56.enter(e,i,n))||void 0===r?void 0:r.from)!=_s131.from&&(t=_h56);for(;;){var _s132=t.enter(e,i,n);if(!_s132)return t;t=_s132;}}function Yh(t,e,i,s){var r=t.cursor(),n=[];if(!r.firstChild())return n;if(null!=i)for(var _t213=!1;!_t213;)if(_t213=r.type.is(i),!r.nextSibling())return n;for(;;){if(null!=s&&r.type.is(s))return n;if(r.type.is(e)&&n.push(r.node),!r.nextSibling())return null==s?n:[];}}function Qh(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:e.length-1;for(var _s133=t.parent;i>=0;_s133=_s133.parent){if(!_s133)return!1;if(!_s133.type.isAnonymous){if(e[i]&&e[i]!=_s133.name)return!1;i--;}}return!0;}function el(t){if(!t.length)return null;var e=0,i=t[0];for(var _s134=1;_s134<t.length;_s134++){var _r111=t[_s134];(_r111.from>i.from||_r111.to<i.to)&&(i=_r111,e=_s134);}var s=i instanceof Xh&&i.index<0?null:i.parent,r=t.slice();return s?r[e]=s:r.splice(e,1),new il(r,i);}function rl(t){return t.children.some(function(t){return t instanceof Jh||!t.type.isAnonymous||rl(t);});}function hl(t,e){if(!t.isAnonymous||e instanceof Jh||e.type!=t)return 1;var i=nl.get(e);if(null==i){i=1;var _iterator149=_createForOfIteratorHelper(e.children),_step149;try{for(_iterator149.s();!(_step149=_iterator149.n()).done;){var _s139=_step149.value;if(_s139.type!=t||!(_s139 instanceof qh)){i=1;break;}i+=hl(t,_s139);}}catch(err){_iterator149.e(err);}finally{_iterator149.f();}nl.set(e,i);}return i;}function ll(t,e,i,s,r,n,h,l,o){var u=0;for(var _i153=s;_i153<r;_i153++)u+=hl(t,e[_i153]);var f=Math.ceil(1.5*u/8),a=[],c=[];return function e(i,s,r,h,l){for(var _u39=r;_u39<h;){var _r115=_u39,_d9=s[_u39],_p7=hl(t,i[_u39]);for(_u39++;_u39<h;_u39++){var _e187=hl(t,i[_u39]);if(_p7+_e187>=f)break;_p7+=_e187;}if(_u39==_r115+1){if(_p7>f){var _t219=i[_r115];e(_t219.children,_t219.positions,0,_t219.children.length,s[_r115]+l);continue;}a.push(i[_r115]);}else{var _e188=s[_u39-1]+i[_u39-1].length-_d9;a.push(ll(t,i,s,_r115,_u39,_d9,_e188,null,o));}c.push(_d9+l-n);}}(e,i,s,r,0),(l||o)(a,c,h);}function cl(t){return function(e,i,s,r){return new wl(e,t,i,s,r);};}function pl(t){if(!t.length||t.some(function(t){return t.from>=t.to;}))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t));}function bl(t,e,i){var _iterator153=_createForOfIteratorHelper(t),_step153;try{for(_iterator153.s();!(_step153=_iterator153.n()).done;){var _s140=_step153.value;if(_s140.from>=i)break;if(_s140.to>e)return _s140.from<=e&&_s140.to>=i?2:1;}}catch(err){_iterator153.e(err);}finally{_iterator153.f();}return 0;}function vl(t,e,i,s,r,n){if(e<i){var _h64=t.buffer[e+1];s.push(t.slice(e,i,_h64)),r.push(_h64-n);}}function kl(t){var e=t.node,i=[],s=e.context.buffer;do{i.push(t.index),t.parent();}while(!t.tree);var r=t.tree,n=r.children.indexOf(s),h=r.children[n],l=h.buffer,o=[n];r.children[n]=function t(s,r,n,u,f,a){var c=i[a],d=[],p=[];vl(h,s,c,d,p,u);var m=l[c+1],g=l[c+2];o.push(d.length);var w=a?t(c+4,l[c+3],h.set.types[l[c]],m,g-m,a-1):e.toTree();return d.push(w),p.push(m-u),vl(h,l[c+3],r,d,p,u),new qh(n,d,p,f);}(0,l.length,Ph.none,0,h.length,i.length-1);for(var _i157=0,_o40=o;_i157<_o40.length;_i157++){var _e192=_o40[_i157];var _i158=t.tree.children[_e192],_s141=t.tree.positions[_e192];t["yield"](new Xh(_i158,_s141+t.from,_e192,t._tree));}}function xl(t,e){var i=null,s=e;for(var _r118=1,_n95=0;_r118<t.length;_r118++){var _h65=t[_r118-1].to,_l60=t[_r118].from;for(;_n95<s.length;_n95++){var _t229=s[_n95];if(_t229.from>=_l60)break;_t229.to<=_h65||(i||(s=i=e.slice()),_t229.from<_h65?(i[_n95]=new Nh(_t229.from,_h65),_t229.to>_l60&&i.splice(_n95+1,0,new Nh(_l60,_t229.to))):_t229.to>_l60?i[_n95--]=new Nh(_l60,_t229.to):i.splice(_n95--,1));}}return s;}function Sl(t,e,i,s){var r=0,n=0,h=!1,l=!1,o=-1e9,u=[];for(;;){var _f23=r==t.length?1e9:h?t[r].to:t[r].from,_a16=n==e.length?1e9:l?e[n].to:e[n].from;if(h!=l){var _t230=Math.max(o,i),_e196=Math.min(_f23,_a16,s);_t230<_e196&&u.push(new Nh(_t230,_e196));}if(o=Math.min(_f23,_a16),1e9==o)break;_f23==o&&(h?(h=!1,r++):h=!0),_a16==o&&(l?(l=!1,n++):l=!0);}return u;}function Al(t,e){var i=[];var _iterator154=_createForOfIteratorHelper(t),_step154;try{var _loop13=function _loop13(){var _step154$value=_step154.value,s=_step154$value.pos,r=_step154$value.mount,n=_step154$value.frag;var t=s+(r.overlay?r.overlay[0].from:0),h=t+r.tree.length,l=Math.max(n.from,t),o=Math.min(n.to,h);if(r.overlay){var _h66=Sl(e,r.overlay.map(function(t){return new Nh(t.from+s,t.to+s);}),l,o);for(var _e197=0,_s142=l;;_e197++){var _l61=_e197==_h66.length,_u41=_l61?o:_h66[_e197].from;if(_u41>_s142&&i.push(new ul(_s142,_u41,r.tree,-t,n.from>=_s142||n.openStart,n.to<=_u41||n.openEnd)),_l61)break;_s142=_h66[_e197].to;}}else i.push(new ul(l,o,r.tree,-t,n.from>=t||n.openStart,n.to<=h||n.openEnd));};for(_iterator154.s();!(_step154=_iterator154.n()).done;){_loop13();}}catch(err){_iterator154.e(err);}finally{_iterator154.f();}return i;}function Il(t){var e=Object.create(null);for(var _i163 in t){var _s144=t[_i163];Array.isArray(_s144)||(_s144=[_s144]);var _iterator159=_createForOfIteratorHelper(_i163.split(" ")),_step159;try{for(_iterator159.s();!(_step159=_iterator159.n()).done;){var _t233=_step159.value;if(_t233){var _i164=[],_r120=2,_n96=_t233;for(var _e199=0;;){if("..."==_n96&&_e199>0&&_e199+3==_t233.length){_r120=1;break;}var _s145=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(_n96);if(!_s145)throw new RangeError("Invalid path: "+_t233);if(_i164.push("*"==_s145[0]?"":'"'==_s145[0][0]?JSON.parse(_s145[0]):_s145[0]),_e199+=_s145[0].length,_e199==_t233.length)break;var _h67=_t233[_e199++];if(_e199==_t233.length&&"!"==_h67){_r120=0;break;}if("/"!=_h67)throw new RangeError("Invalid path: "+_t233);_n96=_t233.slice(_e199);}var _h68=_i164.length-1,_l62=_i164[_h68];if(!_l62)throw new RangeError("Invalid path: "+_t233);var _o41=new Tl(_s144,_r120,_h68>0?_i164.slice(0,_h68):null);e[_l62]=_o41.sort(e[_l62]);}}}catch(err){_iterator159.e(err);}finally{_iterator159.f();}}return Rl.add(e);}function Bl(t,e){var i=Object.create(null);var _iterator160=_createForOfIteratorHelper(t),_step160;try{for(_iterator160.s();!(_step160=_iterator160.n()).done;){var _e200=_step160.value;if(Array.isArray(_e200.tag)){var _iterator163=_createForOfIteratorHelper(_e200.tag),_step163;try{for(_iterator163.s();!(_step163=_iterator163.n()).done;){var _t235=_step163.value;i[_t235.id]=_e200["class"];}}catch(err){_iterator163.e(err);}finally{_iterator163.f();}}else i[_e200.tag.id]=_e200["class"];}}catch(err){_iterator160.e(err);}finally{_iterator160.f();}var _ref17=e||{},s=_ref17.scope,_ref17$all=_ref17.all,r=_ref17$all===void 0?null:_ref17$all;return{style:function style(t){var e=r;var _iterator161=_createForOfIteratorHelper(t),_step161;try{for(_iterator161.s();!(_step161=_iterator161.n()).done;){var _s146=_step161.value;var _iterator162=_createForOfIteratorHelper(_s146.set),_step162;try{for(_iterator162.s();!(_step162=_iterator162.n()).done;){var _t234=_step162.value;var _s147=i[_t234.id];if(_s147){e=e?e+" "+_s147:_s147;break;}}}catch(err){_iterator162.e(err);}finally{_iterator162.f();}}}catch(err){_iterator161.e(err);}finally{_iterator161.f();}return e;},scope:s};}function Ll(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:t.length;var n=new Nl(s,Array.isArray(e)?e:[e],i);n.highlightRange(t.cursor(),s,r,"",n.highlighters),n.flush(r);}function to(t){return j.define({combine:t?function(e){return e.concat(t);}:void 0});}function so(t,e,i){var s=t.facet(mo),r=no(t).topNode;if(!s||s.allowsNesting)for(var _t239=r;_t239;_t239=_t239.enter(e,i,Fh.ExcludeBuffers))_t239.type.isTop&&(r=_t239);return r;}function no(t){var e=t.field(io.state,!1);return e?e.tree:qh.empty;}function uo(t,e,i){return ul.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}]);}function vo(t){var e=t.facet(bo);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length;}function ko(t,e){var i="",s=t.tabSize,r=t.facet(bo)[0];if("\t"==r){for(;e>=s;)i+="\t",e-=s;r=" ";}for(var _t242=0;_t242<e;_t242++)i+=r;return i;}function yo(t,e){t instanceof St&&(t=new Mo(t));var _iterator170=_createForOfIteratorHelper(t.state.facet(wo)),_step170;try{for(_iterator170.s();!(_step170=_iterator170.n()).done;){var _i169=_step170.value;var _s152=_i169(t,e);if(void 0!==_s152)return _s152;}}catch(err){_iterator170.e(err);}finally{_iterator170.f();}var i=no(t.state);return i.length>=e?function(t,e,i){var s=e.resolveStack(i),r=s.node.enterUnfinishedNodesBefore(i);if(r!=s.node){var _t243=[];for(var _e207=r;_e207!=s.node;_e207=_e207.parent)_t243.push(_e207);for(var _e208=_t243.length-1;_e208>=0;_e208--)s={node:_t243[_e208],next:s};}return So(s,t,i);}(t,i,e):null;}function So(t,e,i){for(var _s153=t;_s153;_s153=_s153.next){var _t245=Ao(_s153.node);if(_t245)return _t245(Oo.create(e,i,_s153));}return 0;}function Ao(t){var e=t.type.prop(xo);if(e)return e;var i,s=t.firstChild;if(s&&(i=s.type.prop(jh.closedBy))){var _e209=t.lastChild,_s154=_e209&&i.indexOf(_e209.name)>-1;return function(t){return Io(t,!0,1,void 0,_s154&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak;}(t)?_e209.from:void 0);};}return null==t.parent?Co:null;}function Co(){return 0;}function Do(t,e){for(var _i171=e;_i171;_i171=_i171.parent)if(t==_i171)return!0;return!1;}function Eo(_ref18){var t=_ref18.closing,_ref18$align=_ref18.align,e=_ref18$align===void 0?!0:_ref18$align,_ref18$units=_ref18.units,i=_ref18$units===void 0?1:_ref18$units;return function(s){return Io(s,e,i,t);};}function Io(t,e,i,s,r){var n=t.textAfter,h=n.match(/^\s*/)[0].length,l=s&&n.slice(h,h+s.length)==s||r==t.pos+h,o=e?function(t){var e=t.node,i=e.childAfter(e.from),s=e.lastChild;if(!i)return null;var r=t.options.simulateBreak,n=t.state.doc.lineAt(i.from),h=null==r||r<=n.from?n.to:Math.min(n.to,r);for(var _t246=i.to;;){var _r123=e.childAfter(_t246);if(!_r123||_r123==s)return null;if(!_r123.type.isSkipped)return _r123.from<h?i:null;_t246=_r123.to;}}(t):null;return o?l?t.column(o.from):t.column(o.to):t.baseIndent+(l?0:t.unit*i);}function To(){var _ref19=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},t=_ref19.except,_ref19$units=_ref19.units,e=_ref19$units===void 0?1:_ref19$units;return function(i){var s=t&&t.test(i.textAfter);return i.baseIndent+(s?0:e*i.unit);};}function No(t){var e=t.firstChild,i=t.lastChild;return e&&e.to<i.from?{from:e.to,to:i.type.isError?t.to:i.from}:null;}function jo(t){var e=t.lastChild;return e&&e.to==t.to&&e.type.isError;}function $o(t,e,i){var _iterator171=_createForOfIteratorHelper(t.facet(Bo)),_step171;try{for(_iterator171.s();!(_step171=_iterator171.n()).done;){var _s156=_step171.value;var _r124=_s156(t,e,i);if(_r124)return _r124;}}catch(err){_iterator171.e(err);}finally{_iterator171.f();}return function(t,e,i){var s=no(t);if(s.length<i)return null;var r=null;for(var _n98=s.resolveStack(i,1);_n98;_n98=_n98.next){var _h69=_n98.node;if(_h69.to<=i||_h69.from>i)continue;if(r&&_h69.from<e)break;var _l63=_h69.type.prop(Lo);if(_l63&&(_h69.to<s.length-50||s.length==t.doc.length||!jo(_h69))){var _s155=_l63(_h69,t);_s155&&_s155.from<=i&&_s155.from>=e&&_s155.to>i&&(r=_s155);}}return r;}(t,e,i);}function zo(t,e){var i=e.mapPos(t.from,1),s=e.mapPos(t.to,-1);return i>=s?void 0:{from:i,to:s};}function Wo(t){var e=[];var _iterator172=_createForOfIteratorHelper(t.state.selection.ranges),_step172;try{var _loop14=function _loop14(){var i=_step172.value.head;e.some(function(t){return t.from<=i&&t.to>=i;})||e.push(t.lineBlockAt(i));};for(_iterator172.s();!(_step172=_iterator172.n()).done;){_loop14();}}catch(err){_iterator172.e(err);}finally{_iterator172.f();}return e;}function Fo(t,e,i){var s;var r=null;return null===(s=t.field(Vo,!1))||void 0===s||s.between(e,i,function(t,e){(!r||r.from>t)&&(r={from:t,to:e});}),r;}function qo(t,e,i){var s=!1;return t.between(e,e,function(t,r){t==e&&r==i&&(s=!0);}),s;}function Uo(t,e){return t.field(Vo,!1)?e:e.concat(ct.appendConfig.of(Xo()));}function Jo(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;var s=t.state.doc.lineAt(e.from).number,r=t.state.doc.lineAt(e.to).number;return Ur.announce.of("".concat(t.state.phrase(i?"Folded lines":"Unfolded lines")," ").concat(s," ").concat(t.state.phrase("to")," ").concat(r,"."));}function Xo(t){var e=[Vo,iu];return t&&e.push(_o.of(t)),e;}function Yo(t,e){var i=t.state,s=i.facet(_o),r=function r(e){var i=t.lineBlockAt(t.posAtDOM(e.target)),s=Fo(t.state,i.from,i.to);s&&t.dispatch({effects:Ho.of(s)}),e.preventDefault();};if(s.placeholderDOM)return s.placeholderDOM(t,r,e);var n=document.createElement("span");return n.textContent=s.placeholderText,n.setAttribute("aria-label",i.phrase("folded code")),n.title=i.phrase("unfold"),n.className="cm-foldPlaceholder",n.onclick=r,n;}function hu(t){var e=t.facet(ru);return e.length?e:t.facet(nu);}function lu(t,e){var i,s=[uu];return t instanceof su&&(t.module&&s.push(Ur.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?s.push(nu.of(t)):i?s.push(ru.computeN([Ur.darkTheme],function(e){return e.facet(Ur.darkTheme)==("dark"==i)?[t]:[];})):s.push(ru.of(t)),s;}function wu(t){var e=[],i=t.matched?mu:gu;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e;}function yu(t,e,i){var s=t.prop(e<0?jh.openedBy:jh.closedBy);if(s)return s;if(1==t.name.length){var _s163=i.indexOf(t.name);if(_s163>-1&&_s163%2==(e<0?1:0))return[i[_s163+e]];}return null;}function Mu(t){var e=t.type.prop(ku);return e?e(t.node):t;}function xu(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};var r=s.maxScanDistance||cu,n=s.brackets||du,h=no(t),l=h.resolveInner(e,i);for(var _s164=l;_s164;_s164=_s164.parent){var _r130=yu(_s164.type,i,n);if(_r130&&_s164.from<_s164.to){var _h70=Mu(_s164);if(_h70&&(i>0?e>=_h70.from&&e<_h70.to:e>_h70.from&&e<=_h70.to))return Su(t,e,i,_s164,_h70,_r130,n);}}return function(t,e,i,s,r,n,h){var l=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),o=h.indexOf(l);if(o<0||o%2==0!=i>0)return null;var u={from:i<0?e-1:e,to:i>0?e+1:e},f=t.doc.iterRange(e,i>0?t.doc.length:0),a=0;for(var _t248=0;!f.next().done&&_t248<=n;){var _n100=f.value;i<0&&(_t248+=_n100.length);var _l64=e+_t248*i;for(var _t249=i>0?0:_n100.length-1,_e211=i>0?_n100.length:-1;_t249!=_e211;_t249+=i){var _e212=h.indexOf(_n100[_t249]);if(!(_e212<0||s.resolveInner(_l64+_t249,1).type!=r))if(_e212%2==0==i>0)a++;else{if(1==a)return{start:u,end:{from:_l64+_t249,to:_l64+_t249+1},matched:_e212>>1==o>>1};a--;}}i>0&&(_t248+=_n100.length);}return f.done?{start:u,matched:!1}:null;}(t,e,i,h,l.type,r,n);}function Su(t,e,i,s,r,n,h){var l=s.parent,o={from:r.from,to:r.to},u=0,f=null==l?void 0:l.cursor();if(f&&(i<0?f.childBefore(s.from):f.childAfter(s.to)))do{if(i<0?f.to<=s.from:f.from>=s.to){if(0==u&&n.indexOf(f.type.name)>-1&&f.from<f.to){var _t250=Mu(f);return{start:o,end:_t250?{from:_t250.from,to:_t250.to}:void 0,matched:!0};}if(yu(f.type,i,h))u++;else if(yu(f.type,-i,h)){if(0==u){var _t251=Mu(f);return{start:o,end:_t251&&_t251.from<_t251.to?{from:_t251.from,to:_t251.to}:void 0,matched:!1};}u--;}}}while(i<0?f.prevSibling():f.nextSibling());return{start:o,matched:!1};}function Iu(t,e){Ou.indexOf(t)>-1||(Ou.push(t),console.warn(e));}function Ru(t,e){var i=[];var _iterator178=_createForOfIteratorHelper(e.split(" ")),_step178;try{for(_iterator178.s();!(_step178=_iterator178.n()).done;){var _s165=_step178.value;var _e214=[];var _iterator179=_createForOfIteratorHelper(_s165.split(".")),_step179;try{for(_iterator179.s();!(_step179=_iterator179.n()).done;){var _i177=_step179.value;var _s166=t[_i177]||Yl[_i177];_s166?"function"==typeof _s166?_e214.length?_e214=_e214.map(_s166):Iu(_i177,"Modifier ".concat(_i177," used at start of tag")):_e214.length?Iu(_i177,"Tag ".concat(_i177," used as modifier")):_e214=Array.isArray(_s166)?_s166:[_s166]:Iu(_i177,"Unknown highlighting tag ".concat(_i177));}}catch(err){_iterator179.e(err);}finally{_iterator179.f();}var _iterator180=_createForOfIteratorHelper(_e214),_step180;try{for(_iterator180.s();!(_step180=_iterator180.n()).done;){var _t253=_step180.value;i.push(_t253);}}catch(err){_iterator180.e(err);}finally{_iterator180.f();}}}catch(err){_iterator178.e(err);}finally{_iterator178.f();}if(!i.length)return 0;var s=e.replace(/ /g,"_"),r=s+" "+i.map(function(t){return t.id;}),n=Du[r];if(n)return n.id;var h=Du[r]=Ph.define({id:Cu.length,name:s,props:[Il(_defineProperty({},s,i))]});return Cu.push(h),h.id;}function Tu(t,e){return function(_ref20){var i=_ref20.state,s=_ref20.dispatch;if(i.readOnly)return!1;var r=t(e,i);return!!r&&(s(i.update(r)),!0);};}function ju(t,e){var i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{};}function zu(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:e.selection.ranges;var s=i.map(function(t){return ju(e,t.from).block;});if(!s.every(function(t){return t;}))return null;var r=i.map(function(t,i){return function(t,_ref21,s,r){var e=_ref21.open,i=_ref21.close;var n,h,l=t.sliceDoc(s-$u,s),o=t.sliceDoc(r,r+$u),u=/\s*$/.exec(l)[0].length,f=/^\s*/.exec(o)[0].length,a=l.length-u;if(l.slice(a-e.length,a)==e&&o.slice(f,f+i.length)==i)return{open:{pos:s-u,margin:u&&1},close:{pos:r+f,margin:f&&1}};r-s<=2*$u?n=h=t.sliceDoc(s,r):(n=t.sliceDoc(s,s+$u),h=t.sliceDoc(r-$u,r));var c=/^\s*/.exec(n)[0].length,d=/\s*$/.exec(h)[0].length,p=h.length-d-i.length;return n.slice(c,c+e.length)==e&&h.slice(p,p+i.length)==i?{open:{pos:s+c+e.length,margin:/\s/.test(n.charAt(c+e.length))?1:0},close:{pos:r-d-i.length,margin:/\s/.test(h.charAt(p-1))?1:0}}:null;}(e,s[i],t.from,t.to);});if(2!=t&&!r.every(function(t){return t;}))return{changes:e.changes(i.map(function(t,e){return r[e]?[]:[{from:t.from,insert:s[e].open+" "},{from:t.to,insert:" "+s[e].close}];}))};if(1!=t&&r.some(function(t){return t;})){var _t254=[];for(var _e215,_i179=0;_i179<r.length;_i179++)if(_e215=r[_i179]){var _r132=s[_i179],_e216=_e215,_n102=_e216.open,_h71=_e216.close;_t254.push({from:_n102.pos-_r132.open.length,to:_n102.pos+_n102.margin},{from:_h71.pos-_h71.margin,to:_h71.pos+_r132.close.length});}return{changes:_t254};}return null;}function Pu(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:e.selection.ranges;var s=[],r=-1;var _iterator182=_createForOfIteratorHelper(i),_step182;try{for(_iterator182.s();!(_step182=_iterator182.n()).done;){var _step182$value=_step182.value,_t257=_step182$value.from,_n105=_step182$value.to;var _i183=s.length,_h73=1e9,_l65=ju(e,_t257).line;if(_l65){for(var _i184=_t257;_i184<=_n105;){var _o42=e.doc.lineAt(_i184);if(_o42.from>r&&(_t257==_n105||_n105>_o42.from)){r=_o42.from;var _t258=/^\s*/.exec(_o42.text)[0].length,_e219=_t258==_o42.length,_i185=_o42.text.slice(_t258,_t258+_l65.length)==_l65?_t258:-1;_t258<_o42.text.length&&_t258<_h73&&(_h73=_t258),s.push({line:_o42,comment:_i185,token:_l65,indent:_t258,empty:_e219,single:!1});}_i184=_o42.to+1;}if(_h73<1e9)for(var _t259=_i183;_t259<s.length;_t259++)s[_t259].indent<s[_t259].line.text.length&&(s[_t259].indent=_h73);s.length==_i183+1&&(s[_i183].single=!0);}}}catch(err){_iterator182.e(err);}finally{_iterator182.f();}if(2!=t&&s.some(function(t){return t.comment<0&&(!t.empty||t.single);})){var _t255=[];var _iterator183=_createForOfIteratorHelper(s),_step183;try{for(_iterator183.s();!(_step183=_iterator183.n()).done;){var _step183$value=_step183.value,_e217=_step183$value.line,_i181=_step183$value.token,_r133=_step183$value.indent,_n103=_step183$value.empty,_h72=_step183$value.single;!_h72&&_n103||_t255.push({from:_e217.from+_r133,insert:_i181+" "});}}catch(err){_iterator183.e(err);}finally{_iterator183.f();}var _i180=e.changes(_t255);return{changes:_i180,selection:e.selection.map(_i180,1)};}if(1!=t&&s.some(function(t){return t.comment>=0;})){var _t256=[];var _iterator184=_createForOfIteratorHelper(s),_step184;try{for(_iterator184.s();!(_step184=_iterator184.n()).done;){var _step184$value=_step184.value,_e218=_step184$value.line,_i182=_step184$value.comment,_r134=_step184$value.token;if(_i182>=0){var _s168=_e218.from+_i182,_n104=_s168+_r134.length;" "==_e218.text[_n104-_e218.from]&&_n104++,_t256.push({from:_s168,to:_n104});}}}catch(err){_iterator184.e(err);}finally{_iterator184.f();}return{changes:_t256};}return null;}function Uu(t,e){return function(_ref22){var i=_ref22.state,s=_ref22.dispatch;if(!e&&i.readOnly)return!1;var r=i.field(qu,!1);if(!r)return!1;var n=r.pop(t,i,e);return!!n&&(s(n),!0);};}function Yu(t,e,i,s){var r=e+1>i+20?e-i-1:0,n=t.slice(r,e);return n.push(s),n;}function Qu(t,e){return t.length?e.length?t.concat(e):t:e;}function ef(t,e){if(t.length){var _i186=t[t.length-1],_s170=_i186.selectionsAfter.slice(Math.max(0,_i186.selectionsAfter.length-tf));return _s170.length&&_s170[_s170.length-1].eq(e)?t:(_s170.push(e),Yu(t,t.length-1,1e9,_i186.setSelAfter(_s170)));}return[Xu.selection([e])];}function sf(t){var e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i;}function rf(t,e){if(!t.length)return t;var i=t.length,s=Zu;for(;i;){var _r136=nf(t[i-1],e,s);if(_r136.changes&&!_r136.changes.empty||_r136.effects.length){var _e221=t.slice(0,i);return _e221[i-1]=_r136,_e221;}e=_r136.mapped,i--,s=_r136.selectionsAfter;}return s.length?[Xu.selection(s)]:Zu;}function nf(t,e,i){var s=Qu(t.selectionsAfter.length?t.selectionsAfter.map(function(t){return t.map(e);}):Zu,i);if(!t.changes)return Xu.selection(s);var r=t.changes.map(e),n=e.mapDesc(t.changes,!0),h=t.mapped?t.mapped.composeDesc(n):n;return new Xu(r,ct.mapEffects(t.effects,e),h,t.startSelection.map(n),s);}function uf(t,e){return B.create(t.ranges.map(e),t.mainIndex);}function ff(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"});}function af(_ref23,i){var t=_ref23.state,e=_ref23.dispatch;var s=uf(t.selection,i);return!s.eq(t.selection,!0)&&(e(ff(t,s)),!0);}function cf(t,e){return B.cursor(e?t.to:t.from);}function df(t,e){return af(t,function(i){return i.empty?t.moveByChar(i,e):cf(i,e);});}function pf(t){return t.textDirectionAt(t.state.selection.main.head)==pi.LTR;}function wf(t,e){return af(t,function(i){return i.empty?t.moveByGroup(i,e):cf(i,e);});}function bf(t,e,i){if(e.type.prop(i))return!0;var s=e.to-e.from;return s&&(s>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild;}function vf(t,e,i){var s,r,n=no(t).resolveInner(e.head),h=i?jh.closedBy:jh.openedBy;for(var _s171=e.head;;){var _e223=i?n.childAfter(_s171):n.childBefore(_s171);if(!_e223)break;bf(t,_e223,h)?n=_e223:_s171=i?_e223.to:_e223.from;}return r=n.type.prop(h)&&(s=i?xu(t,n.from,1):xu(t,n.to,-1))&&s.matched?i?s.end.to:s.end.from:i?n.to:n.from,B.cursor(r,i?-1:1);}function kf(t,e){return af(t,function(i){if(!i.empty)return cf(i,e);var s=t.moveVertically(i,e);return s.head!=i.head?s:t.moveToLineBoundary(i,e);});}function xf(t){var e,i=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,s=0,r=0;if(i){var _iterator186=_createForOfIteratorHelper(t.state.facet(Ur.scrollMargins)),_step186;try{for(_iterator186.s();!(_step186=_iterator186.n()).done;){var _e224=_step186.value;var _i188=_e224(t);(null==_i188?void 0:_i188.top)&&(s=Math.max(null==_i188?void 0:_i188.top,s)),(null==_i188?void 0:_i188.bottom)&&(r=Math.max(null==_i188?void 0:_i188.bottom,r));}}catch(err){_iterator186.e(err);}finally{_iterator186.f();}e=t.scrollDOM.clientHeight-s-r;}else e=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:s,marginBottom:r,selfScroll:i,height:Math.max(t.defaultLineHeight,e-5)};}function Sf(t,e){var i,s=xf(t),r=t.state,n=uf(r.selection,function(i){return i.empty?t.moveVertically(i,e,s.height):cf(i,e);});if(n.eq(r.selection))return!1;if(s.selfScroll){var _e225=t.coordsAtPos(r.selection.main.head),_h76=t.scrollDOM.getBoundingClientRect(),_l66=_h76.top+s.marginTop,_o43=_h76.bottom-s.marginBottom;_e225&&_e225.top>_l66&&_e225.bottom<_o43&&(i=Ur.scrollIntoView(n.main.head,{y:"start",yMargin:_e225.top-_l66}));}return t.dispatch(ff(r,n),{effects:i}),!0;}function Of(t,e,i){var s=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,i);if(r.head==e.head&&r.head!=(i?s.to:s.from)&&(r=t.moveToLineBoundary(e,i,!1)),!i&&r.head==s.from&&s.length){var _i189=/^\s*/.exec(t.state.sliceDoc(s.from,Math.min(s.from+100,s.to)))[0].length;_i189&&e.head!=s.from+_i189&&(r=B.cursor(s.from+_i189));}return r;}function Df(t,e){var i=uf(t.state.selection,function(t){var i=e(t);return B.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0);});return!i.eq(t.state.selection)&&(t.dispatch(ff(t.state,i)),!0);}function Ef(t,e){return Df(t,function(i){return t.moveByChar(i,e);});}function Tf(t,e){return Df(t,function(i){return t.moveByGroup(i,e);});}function Bf(t,e){return Df(t,function(i){return t.moveVertically(i,e);});}function jf(t,e){return Df(t,function(i){return t.moveVertically(i,e,xf(t).height);});}function Ff(t,e){if(t.state.readOnly)return!1;var i="delete.selection",s=t.state,r=s.changeByRange(function(s){var r=s.from,n=s.to;if(r==n){var _h77=e(s);_h77<r?(i="delete.backward",_h77=qf(t,_h77,!1)):_h77>r&&(i="delete.forward",_h77=qf(t,_h77,!0)),r=Math.min(r,_h77),n=Math.max(n,_h77);}else r=qf(t,r,!1),n=qf(t,n,!0);return r==n?{range:s}:{changes:{from:r,to:n},range:B.cursor(r,r<s.head?-1:1)};});return!r.changes.empty&&(t.dispatch(s.update(r,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ur.announce.of(s.phrase("Selection deleted")):void 0})),!0);}function qf(t,e,i){if(t instanceof Ur){var _iterator187=_createForOfIteratorHelper(t.state.facet(Ur.atomicRanges).map(function(e){return e(t);})),_step187;try{for(_iterator187.s();!(_step187=_iterator187.n()).done;){var _s172=_step187.value;_s172.between(e,e,function(t,s){t<e&&s>e&&(e=i?s:t);});}}catch(err){_iterator187.e(err);}finally{_iterator187.f();}}return e;}function Xf(t){var e=[],i=-1;var _iterator188=_createForOfIteratorHelper(t.selection.ranges),_step188;try{for(_iterator188.s();!(_step188=_iterator188.n()).done;){var _s173=_step188.value;var _r137=t.doc.lineAt(_s173.from),_n107=t.doc.lineAt(_s173.to);if(_s173.empty||_s173.to!=_n107.from||(_n107=t.doc.lineAt(_s173.to-1)),i>=_r137.number){var _t263=e[e.length-1];_t263.to=_n107.to,_t263.ranges.push(_s173);}else e.push({from:_r137.from,to:_n107.to,ranges:[_s173]});i=_n107.number+1;}}catch(err){_iterator188.e(err);}finally{_iterator188.f();}return e;}function Yf(t,e,i){if(t.readOnly)return!1;var s=[],r=[];var _iterator189=_createForOfIteratorHelper(Xf(t)),_step189;try{for(_iterator189.s();!(_step189=_iterator189.n()).done;){var _e227=_step189.value;if(i?_e227.to==t.doc.length:0==_e227.from)continue;var _n108=t.doc.lineAt(i?_e227.to+1:_e227.from-1),_h78=_n108.length+1;if(i){s.push({from:_e227.to,to:_n108.to},{from:_e227.from,insert:_n108.text+t.lineBreak});var _iterator190=_createForOfIteratorHelper(_e227.ranges),_step190;try{for(_iterator190.s();!(_step190=_iterator190.n()).done;){var _i190=_step190.value;r.push(B.range(Math.min(t.doc.length,_i190.anchor+_h78),Math.min(t.doc.length,_i190.head+_h78)));}}catch(err){_iterator190.e(err);}finally{_iterator190.f();}}else{s.push({from:_n108.from,to:_e227.from},{from:_e227.to,insert:t.lineBreak+_n108.text});var _iterator191=_createForOfIteratorHelper(_e227.ranges),_step191;try{for(_iterator191.s();!(_step191=_iterator191.n()).done;){var _t264=_step191.value;r.push(B.range(_t264.anchor-_h78,_t264.head-_h78));}}catch(err){_iterator191.e(err);}finally{_iterator191.f();}}}}catch(err){_iterator189.e(err);}finally{_iterator189.f();}return!!s.length&&(e(t.update({changes:s,scrollIntoView:!0,selection:B.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0);}function Qf(t,e,i){if(t.readOnly)return!1;var s=[];var _iterator192=_createForOfIteratorHelper(Xf(t)),_step192;try{for(_iterator192.s();!(_step192=_iterator192.n()).done;){var _e228=_step192.value;i?s.push({from:_e228.from,insert:t.doc.slice(_e228.from,_e228.to)+t.lineBreak}):s.push({from:_e228.to,insert:t.lineBreak+t.doc.slice(_e228.from,_e228.to)});}}catch(err){_iterator192.e(err);}finally{_iterator192.f();}return e(t.update({changes:s,scrollIntoView:!0,userEvent:"input.copyline"})),!0;}function ta(e){return function(_ref28){var i=_ref28.state,s=_ref28.dispatch;if(i.readOnly)return!1;var r=i.changeByRange(function(s){var _l68;var r=s.from,n=s.to,h=i.doc.lineAt(r),l=!e&&r==n&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};var i,s=no(t).resolveInner(e),r=s.childBefore(e),n=s.childAfter(e);return r&&n&&r.to<=e&&n.from>=e&&(i=r.type.prop(jh.closedBy))&&i.indexOf(n.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(n.from).from&&!/\S/.test(t.sliceDoc(r.to,n.from))?{from:r.to,to:n.from}:null;}(i,r);e&&(r=n=(n<=h.to?h:i.doc.lineAt(n)).to);var o=new Mo(i,{simulateBreak:r,simulateDoubleBreak:!!l}),u=yo(o,r);for(null==u&&(u=Vt(/^\s*/.exec(i.doc.lineAt(r).text)[0],i.tabSize));n<h.to&&/\s/.test(h.text[n-h.from]);)n++;l?(_l68=l,r=_l68.from,n=_l68.to,_l68):r>h.from&&r<h.from+100&&!/\S/.test(h.text.slice(0,r))&&(r=h.from);var f=["",ko(i,u)];return l&&f.push(ko(i,o.lineIndent(h.from,-1))),{changes:{from:r,to:n,insert:t.of(f)},range:B.cursor(r+1+f[1].length)};});return s(i.update(r,{scrollIntoView:!0,userEvent:"input"})),!0;};}function ea(t,e){var i=-1;return t.changeByRange(function(s){var r=[];for(var _n109=s.from;_n109<=s.to;){var _h79=t.doc.lineAt(_n109);_h79.number>i&&(s.empty||s.to>_h79.from)&&(e(_h79,r,s),i=_h79.number),_n109=_h79.to+1;}var n=t.changes(r);return{changes:r,range:B.range(n.mapPos(s.anchor,1),n.mapPos(s.head,1))};});}function sa(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&"object"==_typeof(i)&&null==i.nodeType&&!Array.isArray(i)){for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){var r=i[s];"string"==typeof r?t.setAttribute(s,r):null!=r&&(t[s]=r);}e++;}for(;e<arguments.length;e++)ra(t,arguments[e]);return t;}function ra(t,e){if("string"==typeof e)t.appendChild(document.createTextNode(e));else if(null==e);else if(null!=e.nodeType)t.appendChild(e);else{if(!Array.isArray(e))throw new RangeError("Unsupported child node: "+e);for(var i=0;i<e.length;i++)ra(t,e[i]);}}function da(t,e){if(e>=t.length)return e;var i,s=t.lineAt(e);for(;e<s.to&&(i=s.text.charCodeAt(e-s.from))>=56320&&i<57344;)e++;return e;}function pa(t){var e=sa("input",{"class":"cm-textfield",name:"line",value:String(t.state.doc.lineAt(t.state.selection.main.head).number)});function i(){var i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!i)return;var s=t.state,r=s.doc.lineAt(s.selection.main.head),_i194=_slicedToArray(i,5),n=_i194[1],h=_i194[2],l=_i194[3],o=_i194[4],u=l?+l.slice(1):0,f=h?+h:r.number;if(h&&o){var _t271=f/100;n&&(_t271=_t271*("-"==n?-1:1)+r.number/s.doc.lines),f=Math.round(s.doc.lines*_t271);}else h&&n&&(f=f*("-"==n?-1:1)+r.number);var a=s.doc.line(Math.max(1,Math.min(s.doc.lines,f))),c=B.cursor(a.from+Math.max(0,Math.min(u,a.length)));t.dispatch({effects:[ma.of(!1),Ur.scrollIntoView(c.from,{y:"center"})],selection:c}),t.focus();}return{dom:sa("form",{"class":"cm-gotoLine",onkeydown:function onkeydown(e){27==e.keyCode?(e.preventDefault(),t.dispatch({effects:ma.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i());},onsubmit:function onsubmit(t){t.preventDefault(),i();}},sa("label",t.state.phrase("Go to line"),": ",e)," ",sa("button",{"class":"cm-button",type:"submit"},t.state.phrase("go")))};}function Ma(t,e,i,s){return!(0!=i&&t(e.sliceDoc(i-1,i))==kt.Word||s!=e.doc.length&&t(e.sliceDoc(s,s+1))==kt.Word);}function Da(t,e,i,s){return new ha(e.doc,t.unquoted,i,s,t.caseSensitive?void 0:function(t){return t.toLowerCase();},t.wholeWord?function(t,e){return function(i,s,r,n){return(n>i||n+r.length<s)&&(n=Math.max(0,i-2),r=t.sliceString(n,Math.min(t.length,s+2))),!(e(Ra(r,i-n))==kt.Word&&e(Ta(r,i-n))==kt.Word||e(Ta(r,s-n))==kt.Word&&e(Ra(r,s-n))==kt.Word);};}(e.doc,e.charCategorizer(e.selection.main.head)):void 0);}function Ia(t,e,i,s){return new ua(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(r=e.charCategorizer(e.selection.main.head),function(t,e,i){return!i[0].length||(r(Ra(i.input,i.index))!=kt.Word||r(Ta(i.input,i.index))!=kt.Word)&&(r(Ta(i.input,i.index+i[0].length))!=kt.Word||r(Ra(i.input,i.index+i[0].length))!=kt.Word);}):void 0},i,s);var r;}function Ra(t,e){return t.slice(p(t,e,!1),e);}function Ta(t,e){return t.slice(e,p(t,e));}function Wa(t){return function(e){var i=e.state.field(ja,!1);return i&&i.query.spec.valid?t(e,i):Ya(e);};}function Ga(t){return t.state.facet(Aa).createPanel(t);}function Ka(t,e){var i,s,r,n,h;var l=t.selection.main,o=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!o)return e;var u=t.facet(Aa);return new Ca({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:u.literal)?o:o.replace(/\n/g,"\\n"),caseSensitive:null!==(s=null==e?void 0:e.caseSensitive)&&void 0!==s?s:u.caseSensitive,literal:null!==(r=null==e?void 0:e.literal)&&void 0!==r?r:u.literal,regexp:null!==(n=null==e?void 0:e.regexp)&&void 0!==n?n:u.regexp,wholeWord:null!==(h=null==e?void 0:e.wholeWord)&&void 0!==h?h:u.wholeWord});}function _a(t){var e=hh(t,Ga);return e&&e.dom.querySelector("[main-field]");}function Xa(t){var e=_a(t);e&&e==t.root.activeElement&&e.select();}function ec(t,e){return t.state.phrase(e);}function rc(t,_ref54){var e=_ref54.from,i=_ref54.to;var s=t.state.doc.lineAt(e),r=t.state.doc.lineAt(i).to,n=Math.max(s.from,e-ic),h=Math.min(r,i+ic),l=t.state.sliceDoc(n,h);if(n!=s.from)for(var _t276=0;_t276<ic;_t276++)if(!sc.test(l[_t276+1])&&sc.test(l[_t276])){l=l.slice(_t276);break;}if(h!=r)for(var _t277=l.length-1;_t277>l.length-ic;_t277--)if(!sc.test(l[_t277-1])&&sc.test(l[_t277])){l=l.slice(0,_t277);break;}return Ur.announce.of("".concat(t.state.phrase("current match"),". ").concat(l," ").concat(t.state.phrase("on line")," ").concat(s.number,"."));}function oc(t){var e=Object.keys(t).join(""),i=/\w/.test(e);return i&&(e=e.replace(/\w/g,"")),"[".concat(i?"\\w":"").concat(e.replace(/[^\w\s]/g,"\\$&"),"]");}function uc(t){var e=t.map(function(t){return"string"==typeof t?{label:t}:t;}),_ref55=e.every(function(t){return /^\w+$/.test(t.label);})?[/\w*$/,/\w+$/]:function(t){var e=Object.create(null),i=Object.create(null);var _iterator198=_createForOfIteratorHelper(t),_step198;try{for(_iterator198.s();!(_step198=_iterator198.n()).done;){var _s185=_step198.value.label;e[_s185[0]]=!0;for(var _t278=1;_t278<_s185.length;_t278++)i[_s185[_t278]]=!0;}}catch(err){_iterator198.e(err);}finally{_iterator198.f();}var s=oc(e)+oc(i)+"*$";return[new RegExp("^"+s),new RegExp(s)];}(e),_ref56=_slicedToArray(_ref55,2),i=_ref56[0],s=_ref56[1];return function(t){var r=t.matchBefore(s);return r||t.explicit?{from:r?r.from:t.pos,options:e,validFor:i}:null;};}function fc(t,e){return function(i){for(var _e238=no(i.state).resolveInner(i.pos,-1);_e238;_e238=_e238.parent){if(t.indexOf(_e238.name)>-1)return null;if(_e238.type.isTop)break;}return e(i);};}function cc(t){return t.selection.main.from;}function dc(t,e){var i;var s=t.source,r=e&&"^"!=s[0],n="$"!=s[s.length-1];return r||n?new RegExp("".concat(r?"^":"","(?:").concat(s,")").concat(n?"$":""),null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t;}function gc(t){if(!Array.isArray(t))return t;var e=mc.get(t);return e||mc.set(t,e=uc(t)),e;}function Mc(t,e){return t?e?t+" "+e:t:e;}function xc(t,e,i,s,r,n){var h,l,o=t.textDirection==pi.RTL,u=o,f=!1,a="top",c=e.left-r.left,d=r.right-e.right,p=s.right-s.left,m=s.bottom-s.top;if(u&&c<Math.min(p,d)?u=!1:!u&&d<Math.min(p,c)&&(u=!0),p<=(u?c:d))h=Math.max(r.top,Math.min(i.top,r.bottom-m))-e.top,l=Math.min(400,u?c:d);else{f=!0,l=Math.min(400,(o?e.right:r.right-e.left)-30);var _t280=r.bottom-e.bottom;_t280>=m||_t280>e.top?h=i.bottom-e.top:(a="bottom",h=e.bottom-i.top);}return{style:"".concat(a,": ").concat(h/((e.bottom-e.top)/n.offsetHeight),"px; max-width: ").concat(l/((e.right-e.left)/n.offsetWidth),"px"),"class":"cm-completionInfo-"+(f?o?"left-narrow":"right-narrow":u?"left":"right")};}function Sc(t,e,i){if(t<=i)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){var _t281=Math.floor(e/i);return{from:_t281*i,to:(_t281+1)*i};}var s=Math.floor((t-e)/i);return{from:t-(s+1)*i,to:t-s*i};}function Cc(t,e){return function(i){return new Ac(i,t,e);};}function Oc(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0);}function Rc(t,e){var i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(i["aria-activedescendant"]=t+"-"+e),i;}function Bc(t,e){if(t.isUserEvent("input.complete")){var _i210=t.annotation(pc);if(_i210&&e.activateOnCompletion(_i210))return"input";}return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null;}function Pc(t,e){var i=e.completion.apply||e.completion.label;var s=t.state.field(zc).active.find(function(t){return t.source==e.source;});return s instanceof Nc&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},function(t,e,i,s){var r=t.selection.main,n=i-r.from,h=s-r.from;return Object.assign(Object.assign({},t.changeByRange(function(l){return l!=r&&i!=s&&t.sliceDoc(l.from+n,l.from+h)!=t.sliceDoc(i,s)?{range:l}:{changes:{from:l.from+n,to:s==r.from?l.to:l.from+h,insert:e},range:B.cursor(l.from+n+e.length)};})),{scrollIntoView:!0,userEvent:"input.complete"});}(t.state,i,s.from,s.to)),{annotations:pc.of(e.completion)})):i(t,e.completion,s.from,s.to),!0);}function Wc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"option";return function(i){var s=i.state.field(zc,!1);if(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<i.state.facet(yc).interactionDelay)return!1;var r,n=1;"page"==e&&(r=sh(i,s.open.tooltip))&&(n=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1));var h=s.open.options.length,l=s.open.selected>-1?s.open.selected+n*(t?1:-1):t?0:h-1;return l<0?l="page"==e?0:h-1:l>=h&&(l="page"==e?h-1:0),i.dispatch({effects:$c.of(l)}),!0;};}function id(t,e){return B.create(t.filter(function(t){return t.field==e;}).map(function(t){return B.range(t.from,t.to);}));}function sd(e){var i=_c.parse(e);return function(e,s,r,n){var _i$instantiate=i.instantiate(e.state,r),h=_i$instantiate.text,l=_i$instantiate.ranges,o={changes:{from:r,to:n,insert:t.of(h)},scrollIntoView:!0,annotations:s?[pc.of(s),dt.userEvent.of("input.complete")]:void 0};if(l.length&&(o.selection=id(l,0)),l.some(function(t){return t.field>0;})){var _t300=new Qc(l,0),_i216=o.effects=[Zc.of(_t300)];void 0===e.state.field(ed,!1)&&_i216.push(ct.appendConfig.of([ed,ld,ud,Jc]));}e.dispatch(e.state.update(o));};}function rd(t){return function(_ref57){var e=_ref57.state,i=_ref57.dispatch;var s=e.field(ed,!1);if(!s||t<0&&0==s.active)return!1;var r=s.active+t,n=t>0&&!s.ranges.some(function(e){return e.field==r+t;});return i(e.update({selection:id(s.ranges,r),effects:Zc.of(n?null:new Qc(s.ranges,r)),scrollIntoView:!0})),!0;};}function od(t,e){return Object.assign(Object.assign({},e),{apply:sd(t)});}function md(t){for(var _e261=0;_e261<pd.length;_e261+=2)if(pd.charCodeAt(_e261)==t)return pd.charAt(_e261+1);return k(t<128?t:t+1);}function gd(t,e){return t.languageDataAt("closeBrackets",e)[0]||fd;}function kd(t,e){var i=!1;return t.field(dd).between(0,t.doc.length,function(t){t==e&&(i=!0);}),i;}function yd(t,e){var i=t.sliceString(e,e+2);return i.slice(0,y(v(i,0)));}function Md(t,e,i,s){var r=null,n=t.changeByRange(function(n){if(!n.empty)return{changes:[{insert:e,from:n.from},{insert:i,from:n.to}],effects:ad.of(n.to+e.length),range:B.range(n.anchor+e.length,n.head+e.length)};var h=yd(t.doc,n.head);return!h||/\s/.test(h)||s.indexOf(h)>-1?{changes:{insert:e+i,from:n.head},effects:ad.of(n.head+e.length),range:B.cursor(n.head+e.length)}:{range:r=n};});return r?null:t.update(n,{scrollIntoView:!0,userEvent:"input.type"});}function xd(t,e,i){var s=null,r=t.changeByRange(function(e){return e.empty&&yd(t.doc,e.head)==i?{changes:{from:e.head,to:e.head+i.length,insert:i},range:B.cursor(e.head+i.length)}:s={range:e};});return s?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"});}function Sd(t,e,i,s){var r=s.stringPrefixes||fd.stringPrefixes,n=null,h=t.changeByRange(function(s){if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:e,from:s.to}],effects:ad.of(s.to+e.length),range:B.range(s.anchor+e.length,s.head+e.length)};var h,l=s.head,o=yd(t.doc,l);if(o==e){if(Ad(t,l))return{changes:{insert:e+e,from:l},effects:ad.of(l+e.length),range:B.cursor(l+e.length)};if(kd(t,l)){var _s199=i&&t.sliceDoc(l,l+3*e.length)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+_s199.length,insert:_s199},range:B.cursor(l+_s199.length)};}}else{if(i&&t.sliceDoc(l-2*e.length,l)==e+e&&(h=Cd(t,l-2*e.length,r))>-1&&Ad(t,h))return{changes:{insert:e+e+e+e,from:l},effects:ad.of(l+e.length),range:B.cursor(l+e.length)};if(t.charCategorizer(l)(o)!=kt.Word&&Cd(t,l,r)>-1&&!function(t,e,i,s){var r=no(t).resolveInner(e,-1),n=s.reduce(function(t,e){return Math.max(t,e.length);},0);for(var _h88=0;_h88<5;_h88++){var _h89=t.sliceDoc(r.from,Math.min(r.to,r.from+i.length+n)),_l74=_h89.indexOf(i);if(!_l74||_l74>-1&&s.indexOf(_h89.slice(0,_l74))>-1){var _e262=r.firstChild;for(;_e262&&_e262.from==r.from&&_e262.to-_e262.from>i.length+_l74;){if(t.sliceDoc(_e262.to-i.length,_e262.to)==i)return!1;_e262=_e262.firstChild;}return!0;}var _o48=r.to==e&&r.parent;if(!_o48)break;r=_o48;}return!1;}(t,l,e,r))return{changes:{insert:e+e,from:l},effects:ad.of(l+e.length),range:B.cursor(l+e.length)};}return{range:n=s};});return n?null:t.update(h,{scrollIntoView:!0,userEvent:"input.type"});}function Ad(t,e){var i=no(t).resolveInner(e+1);return i.parent&&i.from==e;}function Cd(t,e,i){var s=t.charCategorizer(e);if(s(t.sliceDoc(e-1,e))!=kt.Word)return e;var _iterator227=_createForOfIteratorHelper(i),_step227;try{for(_iterator227.s();!(_step227=_iterator227.n()).done;){var _r158=_step227.value;var _i219=e-_r158.length;if(t.sliceDoc(_i219,e)==_r158&&s(t.sliceDoc(_i219-1,_i219))!=kt.Word)return _i219;}}catch(err){_iterator227.e(err);}finally{_iterator227.f();}return-1;}function Od(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[Uc,zc,yc.of(t),Fc,Ed,Jc];}function Td(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=null;return t.between(i,1e9,function(t,i,_ref60){var r=_ref60.spec;if(!e||r.diagnostic==e)return s=new Id(t,i,r.diagnostic),!1;}),s;}function zd(t,e,i){var _t$state$field=t.state.field(jd),s=_t$state$field.diagnostics,r=[],n=2e8,h=0;s.between(e-(i<0?1:0),e+(i>0?1:0),function(t,s,_ref61){var l=_ref61.spec;e>=t&&e<=s&&(t==s||(e>t||i>0)&&(e<s||i<0))&&(r.push(l.diagnostic),n=Math.min(t,n),h=Math.max(s,h));});var l=t.state.facet(Vd).tooltipFilter;return l&&(r=l(r,t.state)),r.length?{pos:n,end:h,above:t.state.doc.lineAt(n).to<h,create:function create(){return{dom:Pd(t,r)};}}:null;}function Pd(t,e){return sa("ul",{"class":"cm-tooltip-lint"},e.map(function(e){return qd(t,e,!1);}));}function Fd(t){var e=[];if(t){var _iterator229=_createForOfIteratorHelper(t),_step229;try{t:for(_iterator229.s();!(_step229=_iterator229.n()).done;){var _i222=_step229.value.name;var _loop19=function _loop19(){var s=_i222[_t301];if(/[a-zA-Z]/.test(s)&&!e.some(function(t){return t.toLowerCase()==s.toLowerCase();})){e.push(s);return 1;// continue t
|
2
|
+
}};for(var _t301=0;_t301<_i222.length;_t301++){if(_loop19())continue t;}e.push("");}}catch(err){_iterator229.e(err);}finally{_iterator229.f();}}return e;}function qd(t,e,i){var s;var r=i?Fd(e.actions):[];return sa("li",{"class":"cm-diagnostic cm-diagnostic-"+e.severity},sa("span",{"class":"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),null===(s=e.actions)||void 0===s?void 0:s.map(function(i,s){var n=!1,h=function h(s){if(s.preventDefault(),n)return;n=!0;var r=Td(t.state.field(jd).diagnostics,e);r&&i.apply(t,r.from,r.to);},l=i.name,o=r[s]?l.indexOf(r[s]):-1,u=o<0?l:[l.slice(0,o),sa("u",l.slice(o,o+1)),l.slice(o+1)];return sa("button",{type:"button","class":"cm-diagnosticAction",onclick:h,onmousedown:h,"aria-label":" Action: ".concat(l).concat(o<0?"":" (access key \"".concat(r[s],")\""),".")},u);}),e.source&&sa("div",{"class":"cm-diagnosticSource"},e.source));}function Kd(t){return function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'viewBox="0 0 40 40"';return"url('data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" ".concat(e,">").concat(encodeURIComponent(t),"</svg>')");}("<path d=\"m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0\" stroke=\"".concat(t,"\" fill=\"none\" stroke-width=\".7\"/>"),'width="6" height="3"');}_export({O:Od,Q:Eh,U:jn,X:lu,c:To,d:Eo,g:No,j:fc,k:uc,l:no,n:od,p:to,r:cl,s:Il,y:Ui,I:void 0});return{setters:[],execute:function execute(){_export("A",t=/*#__PURE__*/function(){function t(){_classCallCheck(this,t);}return _createClass(t,[{key:"lineAt",value:function lineAt(_t2){if(_t2<0||_t2>this.length)throw new RangeError("Invalid position ".concat(_t2," in document of length ").concat(this.length));return this.lineInner(_t2,!1,1,0);}},{key:"line",value:function line(_t3){if(_t3<1||_t3>this.lines)throw new RangeError("Invalid line number ".concat(_t3," in ").concat(this.lines,"-line document"));return this.lineInner(_t3,!0,1,0);}},{key:"replace",value:function replace(_t4,e,s){var _u2=u(this,_t4,e);var _u3=_slicedToArray(_u2,2);_t4=_u3[0];e=_u3[1];var r=[];return this.decompose(0,_t4,r,2),s.length&&s.decompose(0,s.length,r,3),this.decompose(e,this.length,r,1),i.from(r,this.length-(e-_t4)+s.length);}},{key:"append",value:function append(_t5){return this.replace(this.length,this.length,_t5);}},{key:"slice",value:function slice(_t6){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;var _u4=u(this,_t6,e);var _u5=_slicedToArray(_u4,2);_t6=_u5[0];e=_u5[1];var s=[];return this.decompose(_t6,e,s,0),i.from(s,e-_t6);}},{key:"eq",value:function eq(_t7){if(_t7==this)return!0;if(_t7.length!=this.length||_t7.lines!=this.lines)return!1;var e=this.scanIdentical(_t7,1),i=this.length-this.scanIdentical(_t7,-1),s=new n(this),r=new n(_t7);for(var _t13=e,_n2=e;;){if(s.next(_t13),r.next(_t13),_t13=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(_n2+=s.value.length,s.done||_n2>=i)return!0;}}},{key:"iter",value:function iter(){var _t9=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;return new n(this,_t9);}},{key:"iterRange",value:function iterRange(_t10){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;return new h(this,_t10,e);}},{key:"iterLines",value:function iterLines(_t11,e){var i;if(null==_t11)i=this.iter();else{null==e&&(e=this.lines+1);var _s2=this.line(_t11).from;i=this.iterRange(_s2,Math.max(_s2,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to));}return new l(i);}},{key:"toString",value:function toString(){return this.sliceString(0);}},{key:"toJSON",value:function toJSON(){var _t12=[];return this.flatten(_t12),_t12;}}],[{key:"of",value:function of(s){if(0==s.length)throw new RangeError("A document must have at least one line");return 1!=s.length||s[0]?s.length<=32?new e(s):i.from(e.split(s,[])):t.empty;}}]);}());e=/*#__PURE__*/function(_t14){function e(t){var _this;var _e2=arguments.length>1&&arguments[1]!==undefined?arguments[1]:function(t){var e=-1;var _iterator=_createForOfIteratorHelper(t),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _i2=_step.value;e+=_i2.length+1;}}catch(err){_iterator.e(err);}finally{_iterator.f();}return e;}(t);_classCallCheck(this,e);_this=_callSuper(this,e),_this.text=t,_this.length=_e2;return _this;}_inherits(e,_t14);return _createClass(e,[{key:"lines",get:function get(){return this.text.length;}},{key:"children",get:function get(){return null;}},{key:"lineInner",value:function lineInner(t,_e3,i,s){for(var _r2=0;;_r2++){var _n3=this.text[_r2],_h2=s+_n3.length;if((_e3?i:_h2)>=t)return new o(s,_h2,i,_n3);s=_h2+1,i++;}}},{key:"decompose",value:function decompose(t,i,n,h){var l=t<=0&&i>=this.length?this:new e(r(this.text,t,i),Math.min(i,this.length)-Math.max(0,t));if(1&h){var _t15=n.pop(),_i3=s(l.text,_t15.text.slice(),0,l.length);if(_i3.length<=32)n.push(new e(_i3,_t15.length+l.length));else{var _t16=_i3.length>>1;n.push(new e(_i3.slice(0,_t16)),new e(_i3.slice(_t16)));}}else n.push(l);}},{key:"replace",value:function replace(t,n,h){if(!(h instanceof e))return _get(_getPrototypeOf(e.prototype),"replace",this).call(this,t,n,h);var _u6=u(this,t,n);var _u7=_slicedToArray(_u6,2);t=_u7[0];n=_u7[1];var l=s(this.text,s(h.text,r(this.text,0,t)),n),o=this.length+h.length-(n-t);return l.length<=32?new e(l,o):i.from(e.split(l,[]),o);}},{key:"sliceString",value:function sliceString(t){var _e4=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"\n";var _u8=u(this,t,_e4);var _u9=_slicedToArray(_u8,2);t=_u9[0];_e4=_u9[1];var s="";for(var _r3=0,_n4=0;_r3<=_e4&&_n4<this.text.length;_n4++){var _h3=this.text[_n4],_l2=_r3+_h3.length;_r3>t&&_n4&&(s+=i),t<_l2&&_e4>_r3&&(s+=_h3.slice(Math.max(0,t-_r3),_e4-_r3)),_r3=_l2+1;}return s;}},{key:"flatten",value:function flatten(t){var _iterator2=_createForOfIteratorHelper(this.text),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _e5=_step2.value;t.push(_e5);}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}},{key:"scanIdentical",value:function scanIdentical(){return 0;}}],[{key:"split",value:function split(t,i){var s=[],r=-1;var _iterator3=_createForOfIteratorHelper(t),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _n5=_step3.value;s.push(_n5),r+=_n5.length+1,32==s.length&&(i.push(new e(s,r)),s=[],r=-1);}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}return r>-1&&i.push(new e(s,r)),i;}}]);}(t);i=/*#__PURE__*/function(_t17){function i(t,e){var _this2;_classCallCheck(this,i);_this2=_callSuper(this,i),_this2.children=t,_this2.length=e,_this2.lines=0;var _iterator4=_createForOfIteratorHelper(t),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _e6=_step4.value;_this2.lines+=_e6.lines;}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}return _this2;}_inherits(i,_t17);return _createClass(i,[{key:"lineInner",value:function lineInner(t,e,_i4,s){for(var _r4=0;;_r4++){var _n6=this.children[_r4],_h4=s+_n6.length,_l3=_i4+_n6.lines-1;if((e?_l3:_h4)>=t)return _n6.lineInner(t,e,_i4,s);s=_h4+1,_i4=_l3+1;}}},{key:"decompose",value:function decompose(t,e,_i5,s){for(var _r5=0,_n7=0;_n7<=e&&_r5<this.children.length;_r5++){var _h5=this.children[_r5],_l4=_n7+_h5.length;if(t<=_l4&&e>=_n7){var _r6=s&((_n7<=t?1:0)|(_l4>=e?2:0));_n7>=t&&_l4<=e&&!_r6?_i5.push(_h5):_h5.decompose(t-_n7,e-_n7,_i5,_r6);}_n7=_l4+1;}}},{key:"replace",value:function replace(t,e,s){var _u10,_u11;if((_u10=u(this,t,e),_u11=_slicedToArray(_u10,2),t=_u11[0],e=_u11[1]),s.lines<this.lines)for(var _r7=0,_n8=0;_r7<this.children.length;_r7++){var _h6=this.children[_r7],_l5=_n8+_h6.length;if(t>=_n8&&e<=_l5){var _o2=_h6.replace(t-_n8,e-_n8,s),_u12=this.lines-_h6.lines+_o2.lines;if(_o2.lines<_u12>>4&&_o2.lines>_u12>>6){var _n9=this.children.slice();return _n9[_r7]=_o2,new i(_n9,this.length-(e-t)+s.length);}return _get(_getPrototypeOf(i.prototype),"replace",this).call(this,_n8,_l5,_o2);}_n8=_l5+1;}return _get(_getPrototypeOf(i.prototype),"replace",this).call(this,t,e,s);}},{key:"sliceString",value:function sliceString(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.length;var _i6=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"\n";var _u13=u(this,t,e);var _u14=_slicedToArray(_u13,2);t=_u14[0];e=_u14[1];var s="";for(var _r8=0,_n10=0;_r8<this.children.length&&_n10<=e;_r8++){var _h7=this.children[_r8],_l6=_n10+_h7.length;_n10>t&&_r8&&(s+=_i6),t<_l6&&e>_n10&&(s+=_h7.sliceString(t-_n10,e-_n10,_i6)),_n10=_l6+1;}return s;}},{key:"flatten",value:function flatten(t){var _iterator5=_createForOfIteratorHelper(this.children),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _e7=_step5.value;_e7.flatten(t);}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}},{key:"scanIdentical",value:function scanIdentical(t,e){if(!(t instanceof i))return 0;var s=0,_ref=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1],_ref2=_slicedToArray(_ref,4),r=_ref2[0],n=_ref2[1],h=_ref2[2],l=_ref2[3];for(;;r+=e,n+=e){if(r==h||n==l)return s;var _i7=this.children[r],_o3=t.children[n];if(_i7!=_o3)return s+_i7.scanIdentical(_o3,e);s+=_i7.length+1;}}}],[{key:"from",value:function from(t){var s=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t.reduce(function(t,e){return t+e.length+1;},-1);var r=0;var _iterator6=_createForOfIteratorHelper(t),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var _e10=_step6.value;r+=_e10.lines;}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}if(r<32){var _i8=[];var _iterator7=_createForOfIteratorHelper(t),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var _e8=_step7.value;_e8.flatten(_i8);}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}return new e(_i8,s);}var n=Math.max(32,r>>5),h=n<<1,l=n>>1,o=[],u=0,f=-1,a=[];function c(t){var s;if(t.lines>h&&t instanceof i){var _iterator8=_createForOfIteratorHelper(t.children),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var _e9=_step8.value;c(_e9);}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}else t.lines>l&&(u>l||!u)?(d(),o.push(t)):t instanceof e&&u&&(s=a[a.length-1])instanceof e&&t.lines+s.lines<=32?(u+=t.lines,f+=t.length+1,a[a.length-1]=new e(s.text.concat(t.text),s.length+1+t.length)):(u+t.lines>n&&d(),u+=t.lines,f+=t.length+1,a.push(t));}function d(){0!=u&&(o.push(1==a.length?a[0]:i.from(a,f)),f=-1,u=a.length=0);}var _iterator9=_createForOfIteratorHelper(t),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var _e11=_step9.value;c(_e11);}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}return d(),1==o.length?o[0]:new i(o,s);}}]);}(t);t.empty=new e([""],0);n=/*#__PURE__*/function(){function n(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;_classCallCheck(this,n);this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[i>0?1:(t instanceof e?t.text.length:t.children.length)<<1];}return _createClass(n,[{key:"nextInner",value:function nextInner(t,i){for(this.done=this.lineBreak=!1;;){var _s3=this.nodes.length-1,_r10=this.nodes[_s3],_n12=this.offsets[_s3],_h9=_n12>>1,_l8=_r10 instanceof e?_r10.text.length:_r10.children.length;if(_h9==(i>0?_l8:0)){if(0==_s3)return this.done=!0,this.value="",this;i>0&&this.offsets[_s3-1]++,this.nodes.pop(),this.offsets.pop();}else if((1&_n12)==(i>0?0:1)){if(this.offsets[_s3]+=i,0==t)return this.lineBreak=!0,this.value="\n",this;t--;}else if(_r10 instanceof e){var _e12=_r10.text[_h9+(i<0?-1:0)];if(this.offsets[_s3]+=i,_e12.length>Math.max(0,t))return this.value=0==t?_e12:i>0?_e12.slice(t):_e12.slice(0,_e12.length-t),this;t-=_e12.length;}else{var _n13=_r10.children[_h9+(i<0?-1:0)];t>_n13.length?(t-=_n13.length,this.offsets[_s3]+=i):(i<0&&this.offsets[_s3]--,this.nodes.push(_n13),this.offsets.push(i>0?1:(_n13 instanceof e?_n13.text.length:_n13.children.length)<<1));}}}},{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir);}}]);}();h=/*#__PURE__*/function(){function h(t,e,i){_classCallCheck(this,h);this.value="",this.done=!1,this.cursor=new n(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i);}return _createClass(h,[{key:"nextInner",value:function nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);var i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;var _this$cursor$next=this.cursor.next(t),s=_this$cursor$next.value;return this.pos+=(s.length+t)*e,this.value=s.length<=i?s:e<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this;}},{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir);}},{key:"lineBreak",get:function get(){return this.cursor.lineBreak&&""!=this.value;}}]);}();l=/*#__PURE__*/function(){function l(t){_classCallCheck(this,l);this.inner=t,this.afterBreak=!0,this.value="",this.done=!1;}return _createClass(l,[{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var _this$inner$next=this.inner.next(t),e=_this$inner$next.done,i=_this$inner$next.lineBreak,s=_this$inner$next.value;return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this;}},{key:"lineBreak",get:function get(){return!1;}}]);}();"undefined"!=typeof Symbol&&(t.prototype[Symbol.iterator]=function(){return this.iter();},n.prototype[Symbol.iterator]=h.prototype[Symbol.iterator]=l.prototype[Symbol.iterator]=function(){return this;});o=/*#__PURE__*/function(){function o(t,e,i,s){_classCallCheck(this,o);this.from=t,this.to=e,this.number=i,this.text=s;}return _createClass(o,[{key:"length",get:function get(){return this.to-this.from;}}]);}();f="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(function(t){return t?parseInt(t,36):1;});for(_t18=1;_t18<f.length;_t18++)f[_t18]+=f[_t18-1];d=8205;M=/\r\n?|\n/;_export("M",x=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t;}(x||_export("M",x={})));S=/*#__PURE__*/function(){function S(t){_classCallCheck(this,S);this.sections=t;}return _createClass(S,[{key:"length",get:function get(){var t=0;for(var _e14=0;_e14<this.sections.length;_e14+=2)t+=this.sections[_e14];return t;}},{key:"newLength",get:function get(){var t=0;for(var _e15=0;_e15<this.sections.length;_e15+=2){var _i10=this.sections[_e15+1];t+=_i10<0?this.sections[_e15]:_i10;}return t;}},{key:"empty",get:function get(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0;}},{key:"iterGaps",value:function iterGaps(t){for(var _e16=0,_i11=0,_s6=0;_e16<this.sections.length;){var _r12=this.sections[_e16++],_n14=this.sections[_e16++];_n14<0?(t(_i11,_s6,_r12),_s6+=_r12):_s6+=_n14,_i11+=_r12;}}},{key:"iterChangedRanges",value:function iterChangedRanges(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;D(this,t,e);}},{key:"invertedDesc",get:function get(){var t=[];for(var _e17=0;_e17<this.sections.length;){var _i12=this.sections[_e17++],_s7=this.sections[_e17++];_s7<0?t.push(_i12,_s7):t.push(_s7,_i12);}return new S(t);}},{key:"composeDesc",value:function composeDesc(t){return this.empty?t:t.empty?this:I(this,t);}},{key:"mapDesc",value:function mapDesc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return t.empty?this:E(this,t,e);}},{key:"mapPos",value:function mapPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:x.Simple;var s=0,r=0;for(var _n15=0;_n15<this.sections.length;){var _h10=this.sections[_n15++],_l9=this.sections[_n15++],_o5=s+_h10;if(_l9<0){if(_o5>t)return r+(t-s);r+=_h10;}else{if(i!=x.Simple&&_o5>=t&&(i==x.TrackDel&&s<t&&_o5>t||i==x.TrackBefore&&s<t||i==x.TrackAfter&&_o5>t))return null;if(_o5>t||_o5==t&&e<0&&!_h10)return t==s||e<0?r:r+_l9;r+=_l9;}s=_o5;}if(t>s)throw new RangeError("Position ".concat(t," is out of range for changeset of length ").concat(s));return r;}},{key:"touchesRange",value:function touchesRange(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;for(var _i13=0,_s8=0;_i13<this.sections.length&&_s8<=e;){var _r13=_s8+this.sections[_i13++];if(this.sections[_i13++]>=0&&_s8<=e&&_r13>=t)return!(_s8<t&&_r13>e)||"cover";_s8=_r13;}return!1;}},{key:"toString",value:function toString(){var t="";for(var _e18=0;_e18<this.sections.length;){var _i14=this.sections[_e18++],_s9=this.sections[_e18++];t+=(t?" ":"")+_i14+(_s9>=0?":"+_s9:"");}return t;}},{key:"toJSON",value:function toJSON(){return this.sections;}}],[{key:"fromJSON",value:function fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(function(t){return"number"!=typeof t;}))throw new RangeError("Invalid JSON representation of ChangeDesc");return new S(t);}},{key:"create",value:function create(t){return new S(t);}}]);}();A=/*#__PURE__*/function(_S){function A(t,e){var _this3;_classCallCheck(this,A);_this3=_callSuper(this,A,[t]),_this3.inserted=e;return _this3;}_inherits(A,_S);return _createClass(A,[{key:"apply",value:function apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return D(this,function(e,i,s,r,n){return t=t.replace(s,s+(i-e),n);},!1),t;}},{key:"mapDesc",value:function mapDesc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return E(this,t,e,!0);}},{key:"invert",value:function invert(e){var i=this.sections.slice(),s=[];for(var _r14=0,_n16=0;_r14<i.length;_r14+=2){var _h11=i[_r14],_l10=i[_r14+1];if(_l10>=0){i[_r14]=_l10,i[_r14+1]=_h11;var _o6=_r14>>1;for(;s.length<_o6;)s.push(t.empty);s.push(_h11?e.slice(_n16,_n16+_h11):t.empty);}_n16+=_h11;}return new A(i,s);}},{key:"compose",value:function compose(t){return this.empty?t:t.empty?this:I(this,t,!0);}},{key:"map",value:function map(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return t.empty?this:E(this,t,e,!0);}},{key:"iterChanges",value:function iterChanges(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;D(this,t,e);}},{key:"desc",get:function get(){return S.create(this.sections);}},{key:"filter",value:function filter(t){var e=[],i=[],s=[],r=new R(this);t:for(var _n17=0,_h12=0;;){var _l11=_n17==t.length?1e9:t[_n17++];for(;_h12<_l11||_h12==_l11&&0==r.len;){if(r.done)break t;var _t19=Math.min(r.len,_l11-_h12);C(s,_t19,-1);var _n18=-1==r.ins?-1:0==r.off?r.ins:0;C(e,_t19,_n18),_n18>0&&O(i,e,r.text),r.forward(_t19),_h12+=_t19;}var _o7=t[_n17++];for(;_h12<_o7;){if(r.done)break t;var _t20=Math.min(r.len,_o7-_h12);C(e,_t20,-1),C(s,_t20,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(_t20),_h12+=_t20;}}return{changes:new A(e,i),filtered:S.create(s)};}},{key:"toJSON",value:function toJSON(){var t=[];for(var _e19=0;_e19<this.sections.length;_e19+=2){var _i15=this.sections[_e19],_s10=this.sections[_e19+1];_s10<0?t.push(_i15):0==_s10?t.push([_i15]):t.push([_i15].concat(this.inserted[_e19>>1].toJSON()));}return t;}}],[{key:"of",value:function of(e,i,s){var r=[],n=[],h=0,l=null;function o(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;if(!t&&!r.length)return;h<i&&C(r,i-h,-1);var e=new A(r,n);l=l?l.compose(e.map(l)):e,r=[],n=[],h=0;}return function e(u){if(Array.isArray(u)){var _iterator10=_createForOfIteratorHelper(u),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var _t21=_step10.value;e(_t21);}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}else if(u instanceof A){if(u.length!=i)throw new RangeError("Mismatched change set length (got ".concat(u.length,", expected ").concat(i,")"));o(),l=l?l.compose(u.map(l)):u;}else{var _e20=u.from,_u$to=u.to,_l12=_u$to===void 0?_e20:_u$to,_f2=u.insert;if(_e20>_l12||_e20<0||_l12>i)throw new RangeError("Invalid change range ".concat(_e20," to ").concat(_l12," (in doc of length ").concat(i,")"));var _a2=_f2?"string"==typeof _f2?t.of(_f2.split(s||M)):_f2:t.empty,_c2=_a2.length;if(_e20==_l12&&0==_c2)return;_e20<h&&o(),_e20>h&&C(r,_e20-h,-1),C(r,_l12-_e20,_c2),O(n,r,_a2),h=_l12;}}(e),o(!l),l;}},{key:"empty",value:function empty(t){return new A(t?[t,-1]:[],[]);}},{key:"fromJSON",value:function fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");var i=[],s=[];for(var _r15=0;_r15<e.length;_r15++){var _n19=e[_r15];if("number"==typeof _n19)i.push(_n19,-1);else{if(!Array.isArray(_n19)||"number"!=typeof _n19[0]||_n19.some(function(t,e){return e&&"string"!=typeof t;}))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==_n19.length)i.push(_n19[0],0);else{for(;s.length<_r15;)s.push(t.empty);s[_r15]=t.of(_n19.slice(1)),i.push(_n19[0],s[_r15].length);}}}return new A(i,s);}},{key:"createSet",value:function createSet(t,e){return new A(t,e);}}]);}(S);R=/*#__PURE__*/function(){function R(t){_classCallCheck(this,R);this.set=t,this.i=0,this.next();}return _createClass(R,[{key:"next",value:function next(){var t=this.set.sections;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0;}},{key:"done",get:function get(){return-2==this.ins;}},{key:"len2",get:function get(){return this.ins<0?this.len:this.ins;}},{key:"text",get:function get(){var e=this.set.inserted,i=this.i-2>>1;return i>=e.length?t.empty:e[i];}},{key:"textBit",value:function textBit(e){var i=this.set.inserted,s=this.i-2>>1;return s>=i.length&&!e?t.empty:i[s].slice(this.off,null==e?void 0:this.off+e);}},{key:"forward",value:function forward(t){t==this.len?this.next():(this.len-=t,this.off+=t);}},{key:"forward2",value:function forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t);}}]);}();T=/*#__PURE__*/function(){function T(t,e,i){_classCallCheck(this,T);this.from=t,this.to=e,this.flags=i;}return _createClass(T,[{key:"anchor",get:function get(){return 32&this.flags?this.to:this.from;}},{key:"head",get:function get(){return 32&this.flags?this.from:this.to;}},{key:"empty",get:function get(){return this.from==this.to;}},{key:"assoc",get:function get(){return 8&this.flags?-1:16&this.flags?1:0;}},{key:"bidiLevel",get:function get(){var t=7&this.flags;return 7==t?null:t;}},{key:"goalColumn",get:function get(){var t=this.flags>>6;return 16777215==t?void 0:t;}},{key:"map",value:function map(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;var i,s;return this.empty?i=s=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),s=t.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new T(i,s,this.flags);}},{key:"extend",value:function extend(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(t<=this.anchor&&e>=this.anchor)return B.range(t,e);var i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return B.range(this.anchor,i);}},{key:"eq",value:function eq(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return!(this.anchor!=t.anchor||this.head!=t.head||e&&this.empty&&this.assoc!=t.assoc);}},{key:"toJSON",value:function toJSON(){return{anchor:this.anchor,head:this.head};}}],[{key:"fromJSON",value:function fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return B.range(t.anchor,t.head);}},{key:"create",value:function create(t,e,i){return new T(t,e,i);}}]);}();_export("m",B=/*#__PURE__*/function(){function B(t,e){_classCallCheck(this,B);this.ranges=t,this.mainIndex=e;}return _createClass(B,[{key:"map",value:function map(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;return t.empty?this:B.create(this.ranges.map(function(i){return i.map(t,e);}),this.mainIndex);}},{key:"eq",value:function eq(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(var _i20=0;_i20<this.ranges.length;_i20++)if(!this.ranges[_i20].eq(t.ranges[_i20],e))return!1;return!0;}},{key:"main",get:function get(){return this.ranges[this.mainIndex];}},{key:"asSingle",value:function asSingle(){return 1==this.ranges.length?this:new B([this.main],0);}},{key:"addRange",value:function addRange(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;return B.create([t].concat(this.ranges),e?0:this.mainIndex+1);}},{key:"replaceRange",value:function replaceRange(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.mainIndex;var i=this.ranges.slice();return i[e]=t,B.create(i,this.mainIndex);}},{key:"toJSON",value:function toJSON(){return{ranges:this.ranges.map(function(t){return t.toJSON();}),main:this.mainIndex};}}],[{key:"fromJSON",value:function fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new B(t.ranges.map(function(t){return T.fromJSON(t);}),t.main);}},{key:"single",value:function single(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;return new B([B.range(t,e)],0);}},{key:"create",value:function create(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(0==t.length)throw new RangeError("A selection needs at least one range");for(var _i21=0,_s11=0;_s11<t.length;_s11++){var _r16=t[_s11];if(_r16.empty?_r16.from<=_i21:_r16.from<_i21)return B.normalized(t.slice(),e);_i21=_r16.to;}return new B(t,e);}},{key:"cursor",value:function cursor(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2?arguments[2]:undefined;var s=arguments.length>3?arguments[3]:undefined;return T.create(t,t,(0==e?0:e<0?8:16)|(null==i?7:Math.min(6,i))|(null!=s?s:16777215)<<6);}},{key:"range",value:function range(t,e,i,s){var r=(null!=i?i:16777215)<<6|(null==s?7:Math.min(6,s));return e<t?T.create(e,t,48|r):T.create(t,e,(e>t?8:0)|r);}},{key:"normalized",value:function normalized(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=t[e];t.sort(function(t,e){return t.from-e.from;}),e=t.indexOf(i);for(var _i22=1;_i22<t.length;_i22++){var _s12=t[_i22],_r17=t[_i22-1];if(_s12.empty?_s12.from<=_r17.to:_s12.from<_r17.to){var _n21=_r17.from,_h14=Math.max(_s12.to,_r17.to);_i22<=e&&e--,t.splice(--_i22,2,_s12.anchor>_s12.head?B.range(_h14,_n21):B.range(_n21,_h14));}}return new B(t,e);}}]);}());N=0;_export("F",j=/*#__PURE__*/function(){function j(t,e,i,s,r){_classCallCheck(this,j);this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=s,this.id=N++,this["default"]=t([]),this.extensions="function"==typeof r?r(this):r;}return _createClass(j,[{key:"reader",get:function get(){return this;}},{key:"of",value:function of(t){return new z([],this,0,t);}},{key:"compute",value:function compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new z(t,this,1,e);}},{key:"computeN",value:function computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new z(t,this,2,e);}},{key:"from",value:function from(t,e){return e||(e=function e(t){return t;}),this.compute([t],function(i){return e(i.field(t));});}}],[{key:"define",value:function define(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new j(t.combine||function(t){return t;},t.compareInput||function(t,e){return t===e;},t.compare||(t.combine?function(t,e){return t===e;}:$),!!t["static"],t.enables);}}]);}());z=/*#__PURE__*/function(){function z(t,e,i,s){_classCallCheck(this,z);this.dependencies=t,this.facet=e,this.type=i,this.value=s,this.id=N++;}return _createClass(z,[{key:"dynamicSlot",value:function dynamicSlot(t){var _this4=this;var e;var i=this.value,s=this.facet.compareInput,r=this.id,n=t[r]>>1,h=2==this.type,l=!1,o=!1,u=[];var _iterator12=_createForOfIteratorHelper(this.dependencies),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var _i24=_step12.value;"doc"==_i24?l=!0:"selection"==_i24?o=!0:1&(null!==(e=t[_i24.id])&&void 0!==e?e:1)||u.push(t[_i24.id]);}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}return{create:function create(t){return t.values[n]=i(t),1;},update:function update(t,e){if(l&&e.docChanged||o&&(e.docChanged||e.selection)||H(t,u)){var _e24=i(t);if(h?!P(_e24,t.values[n],s):!s(_e24,t.values[n]))return t.values[n]=_e24,1;}return 0;},reconfigure:function reconfigure(t,e){var l,o=e.config.address[r];if(null!=o){var _r18=et(e,o);if(_this4.dependencies.every(function(i){return i instanceof j?e.facet(i)===t.facet(i):!(i instanceof F)||e.field(i,!1)==t.field(i,!1);})||(h?P(l=i(t),_r18,s):s(l=i(t),_r18)))return t.values[n]=_r18,0;}else l=i(t);return t.values[n]=l,1;}};}}]);}();V=j.define({"static":!0});_export("S",F=/*#__PURE__*/function(){function F(t,e,i,s,r){_classCallCheck(this,F);this.id=t,this.createF=e,this.updateF=i,this.compareF=s,this.spec=r,this.provides=void 0;}return _createClass(F,[{key:"create",value:function create(t){var _this5=this;var e=t.facet(V).find(function(t){return t.field==_this5;});return((null==e?void 0:e.create)||this.createF)(t);}},{key:"slot",value:function slot(t){var _this6=this;var e=t[this.id]>>1;return{create:function create(t){return t.values[e]=_this6.create(t),1;},update:function update(t,i){var s=t.values[e],r=_this6.updateF(s,i);return _this6.compareF(s,r)?0:(t.values[e]=r,1);},reconfigure:function reconfigure(t,i){return null!=i.config.address[_this6.id]?(t.values[e]=i.field(_this6),0):(t.values[e]=_this6.create(t),1);}};}},{key:"init",value:function init(t){return[this,V.of({field:this,create:t})];}},{key:"extension",get:function get(){return this;}}],[{key:"define",value:function define(t){var e=new F(N++,t.create,t.update,t.compare||function(t,e){return t===e;},t);return t.provide&&(e.provides=t.provide(e)),e;}}]);}());q=4;U=3;J=2;G=1;_export("C",_={highest:K(0),high:K(G),"default":K(J),low:K(U),lowest:K(q)});X=/*#__PURE__*/_createClass(function X(t,e){_classCallCheck(this,X);this.inner=t,this.prec=e;});_export("J",Y=/*#__PURE__*/function(){function Y(){_classCallCheck(this,Y);}return _createClass(Y,[{key:"of",value:function of(t){return new Q(this,t);}},{key:"reconfigure",value:function reconfigure(t){return Y.reconfigure.of({compartment:this,extension:t});}},{key:"get",value:function get(t){return t.config.compartments.get(this);}}]);}());Q=/*#__PURE__*/_createClass(function Q(t,e){_classCallCheck(this,Q);this.compartment=t,this.inner=e;});Z=/*#__PURE__*/function(){function Z(t,e,i,s,r,n){_classCallCheck(this,Z);for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=n,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0);}return _createClass(Z,[{key:"staticFacet",value:function staticFacet(t){var e=this.address[t.id];return null==e?t["default"]:this.staticValues[e>>1];}}],[{key:"resolve",value:function resolve(t,e,i){var s=[],r=Object.create(null),n=new Map();var _iterator16=_createForOfIteratorHelper(function(t,e,i){var s=[[],[],[],[],[]],r=new Map();function n(t,h){var l=r.get(t);if(null!=l){if(l<=h)return;var _e27=s[l].indexOf(t);_e27>-1&&s[l].splice(_e27,1),t instanceof Q&&i["delete"](t.compartment);}if(r.set(t,h),Array.isArray(t)){var _iterator17=_createForOfIteratorHelper(t),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var _e28=_step17.value;n(_e28,h);}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}}else if(t instanceof Q){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");var _s16=e.get(t.compartment)||t.inner;i.set(t.compartment,_s16),n(_s16,h);}else if(t instanceof X)n(t.inner,t.prec);else if(t instanceof F)s[h].push(t),t.provides&&n(t.provides,h);else if(t instanceof z)s[h].push(t),t.facet.extensions&&n(t.facet.extensions,J);else{var _e29=t.extension;if(!_e29)throw new Error("Unrecognized extension value in extension set (".concat(t,"). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks."));n(_e29,h);}}return n(t,J),s.reduce(function(t,e){return t.concat(e);});}(t,e,n)),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var _i26=_step16.value;_i26 instanceof F?s.push(_i26):(r[_i26.facet.id]||(r[_i26.facet.id]=[])).push(_i26);}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}var h=Object.create(null),l=[],o=[];var _loop=function _loop(){var t=_s15[_i25];h[t.id]=o.length<<1,o.push(function(e){return t.slot(e);});};for(var _i25=0,_s15=s;_i25<_s15.length;_i25++){_loop();}var u=null==i?void 0:i.config.facets;var _loop2=function _loop2(){var e=r[_t27],s=e[0].facet,n=u&&u[_t27]||[];if(e.every(function(t){return 0==t.type;})){if(h[s.id]=l.length<<1|1,$(n,e))l.push(i.facet(s));else{var _t28=s.combine(e.map(function(t){return t.value;}));l.push(i&&s.compare(_t28,i.facet(s))?i.facet(s):_t28);}}else{var _iterator18=_createForOfIteratorHelper(e),_step18;try{var _loop3=function _loop3(){var t=_step18.value;0==t.type?(h[t.id]=l.length<<1|1,l.push(t.value)):(h[t.id]=o.length<<1,o.push(function(e){return t.dynamicSlot(e);}));};for(_iterator18.s();!(_step18=_iterator18.n()).done;){_loop3();}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}h[s.id]=o.length<<1,o.push(function(t){return W(t,s,e);});}};for(var _t27 in r){_loop2();}var f=o.map(function(t){return t(h);});return new Z(t,n,f,h,l,r);}}]);}();it=j.define();st=j.define({combine:function combine(t){return t.some(function(t){return t;});},"static":!0});rt=j.define({combine:function combine(t){return t.length?t[0]:void 0;},"static":!0});nt=j.define();ht=j.define();lt=j.define();ot=j.define({combine:function combine(t){return!!t.length&&t[0];}});_export("H",ut=/*#__PURE__*/function(){function ut(t,e){_classCallCheck(this,ut);this.type=t,this.value=e;}return _createClass(ut,null,[{key:"define",value:function define(){return new ft();}}]);}());ft=/*#__PURE__*/function(){function ft(){_classCallCheck(this,ft);}return _createClass(ft,[{key:"of",value:function of(t){return new ut(this,t);}}]);}();at=/*#__PURE__*/function(){function at(t){_classCallCheck(this,at);this.map=t;}return _createClass(at,[{key:"of",value:function of(t){return new ct(this,t);}}]);}();_export("x",ct=/*#__PURE__*/function(){function ct(t,e){_classCallCheck(this,ct);this.type=t,this.value=e;}return _createClass(ct,[{key:"map",value:function map(t){var e=this.type.map(this.value,t);return void 0===e?void 0:e==this.value?this:new ct(this.type,e);}},{key:"is",value:function is(t){return this.type==t;}}],[{key:"define",value:function define(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new at(t.map||function(t){return t;});}},{key:"mapEffects",value:function mapEffects(t,e){if(!t.length)return t;var i=[];var _iterator19=_createForOfIteratorHelper(t),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var _s17=_step19.value;var _t29=_s17.map(e);_t29&&i.push(_t29);}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}return i;}}]);}());ct.reconfigure=ct.define(),ct.appendConfig=ct.define();_export("B",dt=/*#__PURE__*/function(){function dt(t,e,i,s,r,n){_classCallCheck(this,dt);this.startState=t,this.changes=e,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=n,this._doc=null,this._state=null,i&&L(i,e.newLength),r.some(function(t){return t.type==dt.time;})||(this.annotations=r.concat(dt.time.of(Date.now())));}return _createClass(dt,[{key:"newDoc",get:function get(){return this._doc||(this._doc=this.changes.apply(this.startState.doc));}},{key:"newSelection",get:function get(){return this.selection||this.startState.selection.map(this.changes);}},{key:"state",get:function get(){return this._state||this.startState.applyTransaction(this),this._state;}},{key:"annotation",value:function annotation(t){var _iterator20=_createForOfIteratorHelper(this.annotations),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var _e30=_step20.value;if(_e30.type==t)return _e30.value;}}catch(err){_iterator20.e(err);}finally{_iterator20.f();}}},{key:"docChanged",get:function get(){return!this.changes.empty;}},{key:"reconfigured",get:function get(){return this.startState.config!=this.state.config;}},{key:"isUserEvent",value:function isUserEvent(t){var e=this.annotation(dt.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]));}}],[{key:"create",value:function create(t,e,i,s,r,n){return new dt(t,e,i,s,r,n);}}]);}());dt.time=ut.define(),dt.userEvent=ut.define(),dt.addToHistory=ut.define(),dt.remote=ut.define();bt=[];kt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t;}(kt||(kt={}));yt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{Mt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u");}catch(t){}_export("w",St=/*#__PURE__*/function(){function St(t,e,i,s,r,n){_classCallCheck(this,St);this.config=t,this.doc=e,this.selection=i,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=r,n&&(n._state=this);for(var _t30=0;_t30<this.config.dynamicSlots.length;_t30++)tt(this,_t30<<1);this.computeSlot=null;}return _createClass(St,[{key:"field",value:function field(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;var i=this.config.address[t.id];if(null!=i)return tt(this,i),et(this,i);if(e)throw new RangeError("Field is not present in this state");}},{key:"update",value:function update(){for(var _len=arguments.length,t=new Array(_len),_key=0;_key<_len;_key++){t[_key]=arguments[_key];}return wt(this,t,!0);}},{key:"applyTransaction",value:function applyTransaction(t){var _this7=this;var e,i=this.config,_i30=i,s=_i30.base,r=_i30.compartments;var _iterator22=_createForOfIteratorHelper(t.effects),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var _e34=_step22.value;_e34.is(Y.reconfigure)?(i&&(r=new Map(),i.compartments.forEach(function(t,e){return r.set(e,t);}),i=null),r.set(_e34.value.compartment,_e34.value.extension)):_e34.is(ct.reconfigure)?(i=null,s=_e34.value):_e34.is(ct.appendConfig)&&(i=null,s=vt(s).concat(_e34.value));}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}if(i)e=t.startState.values.slice();else{i=Z.resolve(s,r,this),e=new St(i,this.doc,this.selection,i.dynamicSlots.map(function(){return null;}),function(t,e){return e.reconfigure(t,_this7);},null).values;}var n=t.startState.facet(st)?t.newSelection:t.newSelection.asSingle();new St(i,t.newDoc,n,e,function(e,i){return i.update(e,t);},t);}},{key:"replaceSelection",value:function replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange(function(e){return{changes:{from:e.from,to:e.to,insert:t},range:B.cursor(e.from+t.length)};});}},{key:"changeByRange",value:function changeByRange(t){var e=this.selection,i=t(e.ranges[0]),s=this.changes(i.changes),r=[i.range],n=vt(i.effects);for(var _i31=1;_i31<e.ranges.length;_i31++){var _h16=t(e.ranges[_i31]),_l14=this.changes(_h16.changes),_o9=_l14.map(s);for(var _t31=0;_t31<_i31;_t31++)r[_t31]=r[_t31].map(_o9);var _u16=s.mapDesc(_l14,!0);r.push(_h16.range.map(_u16)),s=s.compose(_o9),n=ct.mapEffects(n,_o9).concat(ct.mapEffects(vt(_h16.effects),_u16));}return{changes:s,selection:B.create(r,e.mainIndex),effects:n};}},{key:"changes",value:function changes(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];return t instanceof A?t:A.of(t,this.doc.length,this.facet(St.lineSeparator));}},{key:"toText",value:function toText(e){return t.of(e.split(this.facet(St.lineSeparator)||M));}},{key:"sliceDoc",value:function sliceDoc(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.doc.length;return this.doc.sliceString(t,e,this.lineBreak);}},{key:"facet",value:function facet(t){var e=this.config.address[t.id];return null==e?t["default"]:(tt(this,e),et(this,e));}},{key:"toJSON",value:function toJSON(t){var e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(var _i32 in t){var _s21=t[_i32];_s21 instanceof F&&null!=this.config.address[_s21.id]&&(e[_i32]=_s21.spec.toJSON(this.field(t[_i32]),this));}return e;}},{key:"tabSize",get:function get(){return this.facet(St.tabSize);}},{key:"lineBreak",get:function get(){return this.facet(St.lineSeparator)||"\n";}},{key:"readOnly",get:function get(){return this.facet(ot);}},{key:"phrase",value:function phrase(t){for(var _len2=arguments.length,e=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){e[_key2-1]=arguments[_key2];}var _iterator23=_createForOfIteratorHelper(this.facet(St.phrases)),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var _e35=_step23.value;if(Object.prototype.hasOwnProperty.call(_e35,t)){t=_e35[t];break;}}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}return e.length&&(t=t.replace(/\$(\$|\d*)/g,function(t,i){if("$"==i)return"$";var s=+(i||1);return!s||s>e.length?t:e[s-1];})),t;}},{key:"languageDataAt",value:function languageDataAt(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;var s=[];var _iterator24=_createForOfIteratorHelper(this.facet(it)),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var _r24=_step24.value;var _iterator25=_createForOfIteratorHelper(_r24(this,e,i)),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _n26=_step25.value;Object.prototype.hasOwnProperty.call(_n26,t)&&s.push(_n26[t]);}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}return s;}},{key:"charCategorizer",value:function charCategorizer(t){return xt(this.languageDataAt("wordChars",t).join(""));}},{key:"wordAt",value:function wordAt(t){var _this$doc$lineAt=this.doc.lineAt(t),e=_this$doc$lineAt.text,i=_this$doc$lineAt.from,s=_this$doc$lineAt.length,r=this.charCategorizer(t),n=t-i,h=t-i;for(;n>0;){var _t32=p(e,n,!1);if(r(e.slice(_t32,n))!=kt.Word)break;n=_t32;}for(;h<s;){var _t33=p(e,h);if(r(e.slice(h,_t33))!=kt.Word)break;h=_t33;}return n==h?null:B.range(n+i,h+i);}}],[{key:"fromJSON",value:function fromJSON(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var i=arguments.length>2?arguments[2]:undefined;if(!t||"string"!=typeof t.doc)throw new RangeError("Invalid JSON representation for EditorState");var s=[];if(i){var _loop4=function _loop4(){if(Object.prototype.hasOwnProperty.call(t,_e36)){var _r25=i[_e36],_n27=t[_e36];s.push(_r25.init(function(t){return _r25.spec.fromJSON(_n27,t);}));}};for(var _e36 in i){_loop4();}}return St.create({doc:t.doc,selection:B.fromJSON(t.selection),extensions:e.extensions?s.concat([e.extensions]):s});}},{key:"create",value:function create(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var i=Z.resolve(e.extensions||[],new Map()),s=e.doc instanceof t?e.doc:t.of((e.doc||"").split(i.staticFacet(St.lineSeparator)||M)),r=e.selection?e.selection instanceof B?e.selection:B.single(e.selection.anchor,e.selection.head):B.single(0);return L(r,s.length),i.staticFacet(st)||(r=r.asSingle()),new St(i,s,r,i.dynamicSlots.map(function(){return null;}),function(t,e){return e.create(t);},null);}}]);}());St.allowMultipleSelections=st,St.tabSize=j.define({combine:function combine(t){return t.length?t[0]:4;}}),St.lineSeparator=rt,St.readOnly=ot,St.phrases=j.define({compare:function compare(t,e){var i=Object.keys(t),s=Object.keys(e);return i.length==s.length&&i.every(function(i){return t[i]==e[i];});}}),St.languageData=it,St.changeFilter=nt,St.transactionFilter=ht,St.transactionExtender=lt,Y.reconfigure=ct.define();_export("R",Ct=/*#__PURE__*/function(){function Ct(){_classCallCheck(this,Ct);}return _createClass(Ct,[{key:"eq",value:function eq(t){return this==t;}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;return Ot.create(t,e,this);}}]);}());Ct.prototype.startSide=Ct.prototype.endSide=0,Ct.prototype.point=!1,Ct.prototype.mapMode=x.TrackDel;Ot=/*#__PURE__*/function(){function t(_t36,e,i){_classCallCheck(this,t);this.from=_t36,this.to=e,this.value=i;}return _createClass(t,null,[{key:"create",value:function create(e,i,s){return new t(e,i,s);}}]);}();Et=/*#__PURE__*/function(){function Et(t,e,i,s){_classCallCheck(this,Et);this.from=t,this.to=e,this.value=i,this.maxPoint=s;}return _createClass(Et,[{key:"length",get:function get(){return this.to[this.to.length-1];}},{key:"findIndex",value:function findIndex(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=i?this.to:this.from;for(var _n29=s,_h17=r.length;;){if(_n29==_h17)return _n29;var _s22=_n29+_h17>>1,_l15=r[_s22]-t||(i?this.value[_s22].endSide:this.value[_s22].startSide)-e;if(_s22==_n29)return _l15>=0?_n29:_h17;_l15>=0?_h17=_s22:_n29=_s22+1;}}},{key:"between",value:function between(t,e,i,s){for(var _r27=this.findIndex(e,-1e9,!0),_n30=this.findIndex(i,1e9,!1,_r27);_r27<_n30;_r27++)if(!1===s(this.from[_r27]+t,this.to[_r27]+t,this.value[_r27]))return!1;}},{key:"map",value:function map(t,e){var i=[],s=[],r=[],n=-1,h=-1;for(var _l16=0;_l16<this.value.length;_l16++){var _o10=void 0,_u17=void 0,_f4=this.value[_l16],_a4=this.from[_l16]+t,_c4=this.to[_l16]+t;if(_a4==_c4){var _t37=e.mapPos(_a4,_f4.startSide,_f4.mapMode);if(null==_t37)continue;if(_o10=_u17=_t37,_f4.startSide!=_f4.endSide&&(_u17=e.mapPos(_a4,_f4.endSide),_u17<_o10))continue;}else if(_o10=e.mapPos(_a4,_f4.startSide),_u17=e.mapPos(_c4,_f4.endSide),_o10>_u17||_o10==_u17&&_f4.startSide>0&&_f4.endSide<=0)continue;(_u17-_o10||_f4.endSide-_f4.startSide)<0||(n<0&&(n=_o10),_f4.point&&(h=Math.max(h,_u17-_o10)),i.push(_f4),s.push(_o10-n),r.push(_u17-n));}return{mapped:i.length?new Et(s,r,i,h):null,pos:n};}}]);}();It=/*#__PURE__*/function(){function It(t,e,i,s){_classCallCheck(this,It);this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=s;}return _createClass(It,[{key:"length",get:function get(){var t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length);}},{key:"size",get:function get(){if(this.isEmpty)return 0;var t=this.nextLayer.size;var _iterator27=_createForOfIteratorHelper(this.chunk),_step27;try{for(_iterator27.s();!(_step27=_iterator27.n()).done;){var _e38=_step27.value;t+=_e38.value.length;}}catch(err){_iterator27.e(err);}finally{_iterator27.f();}return t;}},{key:"chunkEnd",value:function chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length;}},{key:"update",value:function update(t){var _t$add=t.add,e=_t$add===void 0?[]:_t$add,_t$sort=t.sort,i=_t$sort===void 0?!1:_t$sort,_t$filterFrom=t.filterFrom,s=_t$filterFrom===void 0?0:_t$filterFrom,_t$filterTo=t.filterTo,r=_t$filterTo===void 0?this.length:_t$filterTo,n=t.filter;if(0==e.length&&!n)return this;if(i&&(e=e.slice().sort(Dt)),this.isEmpty)return e.length?It.of(e):this;var h=new Bt(this,null,-1)["goto"](0),l=0,o=[],u=new Rt();for(;h.value||l<e.length;)if(l<e.length&&(h.from-e[l].from||h.startSide-e[l].value.startSide)>=0){var _t38=e[l++];u.addInner(_t38.from,_t38.to,_t38.value)||o.push(_t38);}else 1==h.rangeIndex&&h.chunkIndex<this.chunk.length&&(l==e.length||this.chunkEnd(h.chunkIndex)<e[l].from)&&(!n||s>this.chunkEnd(h.chunkIndex)||r<this.chunkPos[h.chunkIndex])&&u.addChunk(this.chunkPos[h.chunkIndex],this.chunk[h.chunkIndex])?h.nextChunk():((!n||s>h.to||r<h.from||n(h.from,h.to,h.value))&&(u.addInner(h.from,h.to,h.value)||o.push(Ot.create(h.from,h.to,h.value))),h.next());return u.finishInner(this.nextLayer.isEmpty&&!o.length?It.empty:this.nextLayer.update({add:o,filter:n,filterFrom:s,filterTo:r}));}},{key:"map",value:function map(t){if(t.empty||this.isEmpty)return this;var e=[],i=[],s=-1;for(var _r28=0;_r28<this.chunk.length;_r28++){var _n31=this.chunkPos[_r28],_h18=this.chunk[_r28],_l17=t.touchesRange(_n31,_n31+_h18.length);if(!1===_l17)s=Math.max(s,_h18.maxPoint),e.push(_h18),i.push(t.mapPos(_n31));else if(!0===_l17){var _h18$map=_h18.map(_n31,t),_r29=_h18$map.mapped,_l18=_h18$map.pos;_r29&&(s=Math.max(s,_r29.maxPoint),e.push(_r29),i.push(_l18));}}var r=this.nextLayer.map(t);return 0==e.length?r:new It(i,e,r||It.empty,s);}},{key:"between",value:function between(t,e,i){if(!this.isEmpty){for(var _s23=0;_s23<this.chunk.length;_s23++){var _r30=this.chunkPos[_s23],_n32=this.chunk[_s23];if(e>=_r30&&t<=_r30+_n32.length&&!1===_n32.between(_r30,t-_r30,e-_r30,i))return;}this.nextLayer.between(t,e,i);}}},{key:"iter",value:function iter(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return Lt.from([this])["goto"](t);}},{key:"isEmpty",get:function get(){return this.nextLayer==this;}}],[{key:"create",value:function create(t,e,i,s){return new It(t,e,i,s);}},{key:"iter",value:function iter(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Lt.from(t)["goto"](e);}},{key:"compare",value:function compare(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:-1;var n=t.filter(function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r;}),h=e.filter(function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r;}),l=Tt(n,h,i),o=new jt(n,l,r),u=new jt(h,l,r);i.iterGaps(function(t,e,i){return $t(o,t,u,e,i,s);}),i.empty&&0==i.length&&$t(o,0,u,0,0,s);}},{key:"eq",value:function eq(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3?arguments[3]:undefined;null==s&&(s=999999999);var r=t.filter(function(t){return!t.isEmpty&&e.indexOf(t)<0;}),n=e.filter(function(e){return!e.isEmpty&&t.indexOf(e)<0;});if(r.length!=n.length)return!1;if(!r.length)return!0;var h=Tt(r,n),l=new jt(r,h,0)["goto"](i),o=new jt(n,h,0)["goto"](i);for(;;){if(l.to!=o.to||!zt(l.active,o.active)||l.point&&(!o.point||!l.point.eq(o.point)))return!1;if(l.to>s)return!0;l.next(),o.next();}}},{key:"spans",value:function spans(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:-1;var n=new jt(t,null,r)["goto"](e),h=e,l=n.openStart;for(;;){var _t39=Math.min(n.to,i);if(n.point){var _i34=n.activeForPoint(n.to),_r31=n.pointFrom<e?_i34.length+1:n.point.startSide<0?_i34.length:Math.min(_i34.length,l);s.point(h,_t39,n.point,_i34,_r31,n.pointRank),l=Math.min(n.openEnd(_t39),_i34.length);}else _t39>h&&(s.span(h,_t39,n.active,l),l=n.openEnd(_t39));if(n.to>i)return l+(n.point&&n.to>i?1:0);h=n.to,n.next();}}},{key:"of",value:function of(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;var i=new Rt();var _iterator28=_createForOfIteratorHelper(t instanceof Ot?[t]:e?function(t){if(t.length>1)for(var _e39=t[0],_i35=1;_i35<t.length;_i35++){var _s24=t[_i35];if(Dt(_e39,_s24)>0)return t.slice().sort(Dt);_e39=_s24;}return t;}(t):t),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var _s25=_step28.value;i.add(_s25.from,_s25.to,_s25.value);}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}return i.finish();}},{key:"join",value:function join(t){if(!t.length)return It.empty;var e=t[t.length-1];for(var _i36=t.length-2;_i36>=0;_i36--)for(var _s26=t[_i36];_s26!=It.empty;_s26=_s26.nextLayer)e=new It(_s26.chunkPos,_s26.chunk,e,Math.max(_s26.maxPoint,e.maxPoint));return e;}}]);}();It.empty=new It([],[],null,-1),It.empty.nextLayer=It.empty;Rt=/*#__PURE__*/function(){function Rt(){_classCallCheck(this,Rt);this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null;}return _createClass(Rt,[{key:"finishChunk",value:function finishChunk(t){this.chunks.push(new Et(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[]);}},{key:"add",value:function add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Rt())).add(t,e,i);}},{key:"addInner",value:function addInner(t,e,i){var s=t-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(s<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0);}},{key:"addChunk",value:function addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);var i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0;}},{key:"finish",value:function finish(){return this.finishInner(It.empty);}},{key:"finishInner",value:function finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;var e=It.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e;}}]);}();Bt=/*#__PURE__*/function(){function Bt(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;_classCallCheck(this,Bt);this.layer=t,this.skip=e,this.minPoint=i,this.rank=s;}return _createClass(Bt,[{key:"startSide",get:function get(){return this.value?this.value.startSide:0;}},{key:"endSide",get:function get(){return this.value?this.value.endSide:0;}},{key:"goto",value:function goto(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this;}},{key:"gotoInner",value:function gotoInner(t,e,i){for(;this.chunkIndex<this.layer.chunk.length;){var _e42=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(_e42)||this.layer.chunkEnd(this.chunkIndex)<t||_e42.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1;}if(this.chunkIndex<this.layer.chunk.length){var _s27=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!i||this.rangeIndex<_s27)&&this.setRangeIndex(_s27);}this.next();}},{key:"forward",value:function forward(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0);}},{key:"next",value:function next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break;}{var _t42=this.layer.chunkPos[this.chunkIndex],_e43=this.layer.chunk[this.chunkIndex],_i37=_t42+_e43.from[this.rangeIndex];if(this.from=_i37,this.to=_t42+_e43.to[this.rangeIndex],this.value=_e43.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break;}}}},{key:"setRangeIndex",value:function setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0;}else this.rangeIndex=t;}},{key:"nextChunk",value:function nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next();}},{key:"compare",value:function compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide;}}]);}();Lt=/*#__PURE__*/function(){function Lt(t){_classCallCheck(this,Lt);this.heap=t;}return _createClass(Lt,[{key:"startSide",get:function get(){return this.value?this.value.startSide:0;}},{key:"goto",value:function goto(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1e9;var _iterator31=_createForOfIteratorHelper(this.heap),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var _i38=_step31.value;_i38["goto"](t,e);}}catch(err){_iterator31.e(err);}finally{_iterator31.f();}for(var _t43=this.heap.length>>1;_t43>=0;_t43--)Nt(this.heap,_t43);return this.next(),this;}},{key:"forward",value:function forward(t,e){var _iterator32=_createForOfIteratorHelper(this.heap),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var _i39=_step32.value;_i39.forward(t,e);}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}for(var _t44=this.heap.length>>1;_t44>=0;_t44--)Nt(this.heap,_t44);(this.to-t||this.value.endSide-e)<0&&this.next();}},{key:"next",value:function next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var _t45=this.heap[0];this.from=_t45.from,this.to=_t45.to,this.value=_t45.value,this.rank=_t45.rank,_t45.value&&_t45.next(),Nt(this.heap,0);}}}],[{key:"from",value:function from(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;var s=[];for(var _r32=0;_r32<t.length;_r32++)for(var _n34=t[_r32];!_n34.isEmpty;_n34=_n34.nextLayer)_n34.maxPoint>=i&&s.push(new Bt(_n34,e,i,_r32));return 1==s.length?s[0]:new Lt(s);}}]);}();jt=/*#__PURE__*/function(){function jt(t,e,i){_classCallCheck(this,jt);this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Lt.from(t,e,i);}return _createClass(jt,[{key:"goto",value:function goto(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1e9;return this.cursor["goto"](t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this;}},{key:"forward",value:function forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e);}},{key:"removeActive",value:function removeActive(t){Pt(this.active,t),Pt(this.activeTo,t),Pt(this.activeRank,t),this.minActive=Wt(this.active,this.activeTo);}},{key:"addActive",value:function addActive(t){var e=0,_this$cursor=this.cursor,i=_this$cursor.value,s=_this$cursor.to,r=_this$cursor.rank;for(;e<this.activeRank.length&&(r-this.activeRank[e]||s-this.activeTo[e])>0;)e++;Ht(this.active,e,i),Ht(this.activeTo,e,s),Ht(this.activeRank,e,r),t&&Ht(t,e,this.cursor.from),this.minActive=Wt(this.active,this.activeTo);}},{key:"next",value:function next(){var t=this.to,e=this.point;this.point=null;var i=this.openStart<0?[]:null;for(;;){var _s29=this.minActive;if(_s29>-1&&(this.activeTo[_s29]-this.cursor.from||this.active[_s29].endSide-this.cursor.startSide)<0){if(this.activeTo[_s29]>t){this.to=this.activeTo[_s29],this.endSide=this.active[_s29].endSide;break;}this.removeActive(_s29),i&&Pt(i,_s29);}else{if(!this.cursor.value){this.to=this.endSide=1e9;break;}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break;}{var _t46=this.cursor.value;if(_t46.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=_t46,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=_t46.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break;}this.cursor.next();}else this.addActive(i),this.cursor.next();}}}if(i){this.openStart=0;for(var _e44=i.length-1;_e44>=0&&i[_e44]<t;_e44--)this.openStart++;}}},{key:"activeForPoint",value:function activeForPoint(t){if(!this.active.length)return this.active;var e=[];for(var _i41=this.active.length-1;_i41>=0&&!(this.activeRank[_i41]<this.pointRank);_i41--)(this.activeTo[_i41]>t||this.activeTo[_i41]==t&&this.active[_i41].endSide>=this.point.endSide)&&e.push(this.active[_i41]);return e.reverse();}},{key:"openEnd",value:function openEnd(t){var e=0;for(var _i42=this.activeTo.length-1;_i42>=0&&this.activeTo[_i42]>t;_i42--)e++;return e;}}]);}();qt="undefined"==typeof Symbol?"__ͼ":Symbol["for"]("ͼ");Ut="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet");Jt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};Gt=/*#__PURE__*/function(){function Gt(t,e){_classCallCheck(this,Gt);this.rules=[];var _ref3=e||{},i=_ref3.finish;function s(t){return /^@/.test(t)?[t]:t.split(/,\s*/);}function r(t,e,n,h){var l=[],o=/^@(\w+)\b/.exec(t[0]),u=o&&"keyframes"==o[1];if(o&&null==e)return n.push(t[0]+";");for(var _i46 in e){var _h19=e[_i46];if(/&/.test(_i46))r(_i46.split(/,\s*/).map(function(e){return t.map(function(t){return e.replace(/&/,t);});}).reduce(function(t,e){return t.concat(e);}),_h19,n);else if(_h19&&"object"==_typeof(_h19)){if(!o)throw new RangeError("The value of a property ("+_i46+") should be a primitive value.");r(s(_i46),_h19,l,u);}else null!=_h19&&l.push(_i46.replace(/_.*/,"").replace(/[A-Z]/g,function(t){return"-"+t.toLowerCase();})+": "+_h19+";");}(l.length||u)&&n.push((!i||o||h?t:t.map(i)).join(", ")+" {"+l.join(" ")+"}");}for(var _e46 in t)r(s(_e46),t[_e46],this.rules);}return _createClass(Gt,[{key:"getRules",value:function getRules(){return this.rules.join("\n");}}],[{key:"newName",value:function newName(){var t=Jt[qt]||1;return Jt[qt]=t+1,"ͼ"+t.toString(36);}},{key:"mount",value:function mount(t,e,i){var s=t[Ut],r=i&&i.nonce;s?r&&s.setNonce(r):s=new _t(t,r),s.mount(Array.isArray(e)?e:[e],t);}}]);}();Kt=new Map();_t=/*#__PURE__*/function(){function _t(t,e){_classCallCheck(this,_t);var i=t.ownerDocument||t,s=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){var _e47=Kt.get(i);if(_e47)return t[Ut]=_e47;this.sheet=new s.CSSStyleSheet(),Kt.set(i,this);}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[Ut]=this;}return _createClass(_t,[{key:"mount",value:function mount(t,e){var i=this.sheet,s=0,r=0;for(var _e48=0;_e48<t.length;_e48++){var _n35=t[_e48],_h20=this.modules.indexOf(_n35);if(_h20<r&&_h20>-1&&(this.modules.splice(_h20,1),r--,_h20=-1),-1==_h20){if(this.modules.splice(r++,0,_n35),i)for(var _t47=0;_t47<_n35.rules.length;_t47++)i.insertRule(_n35.rules[_t47],s++);}else{for(;r<_h20;)s+=this.modules[r++].rules.length;s+=_n35.rules.length,r++;}}if(i)e.adoptedStyleSheets.indexOf(this.sheet)<0&&(e.adoptedStyleSheets=[this.sheet].concat(_toConsumableArray(e.adoptedStyleSheets)));else{var _t48="";for(var _e49=0;_e49<this.modules.length;_e49++)_t48+=this.modules[_e49].getRules()+"\n";this.styleTag.textContent=_t48;var _i47=e.head||e;this.styleTag.parentNode!=_i47&&_i47.insertBefore(this.styleTag,_i47.firstChild);}}},{key:"setNonce",value:function setNonce(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t);}}]);}();for(Xt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Yt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Qt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Zt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),te=0;te<10;te++)Xt[48+te]=Xt[96+te]=String(te);for(te=1;te<=24;te++)Xt[te+111]="F"+te;for(te=65;te<=90;te++)Xt[te]=String.fromCharCode(te+32),Yt[te]=String.fromCharCode(te);for(ee in Xt)Yt.hasOwnProperty(ee)||(Yt[ee]=Xt[ee]);pe=/*#__PURE__*/function(){function pe(){_classCallCheck(this,pe);this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0;}return _createClass(pe,[{key:"eq",value:function eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset;}},{key:"setRange",value:function setRange(t){var e=t.anchorNode,i=t.focusNode;this.set(e,Math.min(t.anchorOffset,e?fe(e):0),i,Math.min(t.focusOffset,i?fe(i):0));}},{key:"set",value:function set(t,e,i,s){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=s;}}]);}();ge=null;Se=/*#__PURE__*/function(){function Se(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;_classCallCheck(this,Se);this.node=t,this.offset=e,this.precise=i;}return _createClass(Se,null,[{key:"before",value:function before(t,e){return new Se(t.parentNode,le(t),e);}},{key:"after",value:function after(t,e){return new Se(t.parentNode,le(t)+1,e);}}]);}();Ae=[];Ce=/*#__PURE__*/function(){function Ce(){_classCallCheck(this,Ce);this.parent=null,this.dom=null,this.flags=2;}return _createClass(Ce,[{key:"overrideDOMText",get:function get(){return null;}},{key:"posAtStart",get:function get(){return this.parent?this.parent.posBefore(this):0;}},{key:"posAtEnd",get:function get(){return this.posAtStart+this.length;}},{key:"posBefore",value:function posBefore(t){var e=this.posAtStart;var _iterator33=_createForOfIteratorHelper(this.children),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var _i53=_step33.value;if(_i53==t)return e;e+=_i53.length+_i53.breakAfter;}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}throw new RangeError("Invalid child in posBefore");}},{key:"posAfter",value:function posAfter(t){return this.posBefore(t)+t.length;}},{key:"sync",value:function sync(t,e){if(2&this.flags){var _i54,_s37=this.dom,_r39=null;var _iterator34=_createForOfIteratorHelper(this.children),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _n36=_step34.value;if(7&_n36.flags){if(!_n36.dom&&(_i54=_r39?_r39.nextSibling:_s37.firstChild)){var _t50=Ce.get(_i54);(!_t50||!_t50.parent&&_t50.canReuseDOM(_n36))&&_n36.reuseDOM(_i54);}_n36.sync(t,e),_n36.flags&=-8;}if(_i54=_r39?_r39.nextSibling:_s37.firstChild,e&&!e.written&&e.node==_s37&&_i54!=_n36.dom&&(e.written=!0),_n36.dom.parentNode==_s37)for(;_i54&&_i54!=_n36.dom;)_i54=Oe(_i54);else _s37.insertBefore(_n36.dom,_i54);_r39=_n36.dom;}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}for(_i54=_r39?_r39.nextSibling:_s37.firstChild,_i54&&e&&e.node==_s37&&(e.written=!0);_i54;)_i54=Oe(_i54);}else if(1&this.flags){var _iterator35=_createForOfIteratorHelper(this.children),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _i55=_step35.value;7&_i55.flags&&(_i55.sync(t,e),_i55.flags&=-8);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}}}},{key:"reuseDOM",value:function reuseDOM(t){}},{key:"localPosFromDOM",value:function localPosFromDOM(t,e){var i;if(t==this.dom)i=this.dom.childNodes[e];else{var _s38=0==fe(t)?0:0==e?-1:1;for(;;){var _e50=t.parentNode;if(_e50==this.dom)break;0==_s38&&_e50.firstChild!=_e50.lastChild&&(_s38=t==_e50.firstChild?-1:1),t=_e50;}i=_s38<0?t:t.nextSibling;}if(i==this.dom.firstChild)return 0;for(;i&&!Ce.get(i);)i=i.nextSibling;if(!i)return this.length;for(var _t51=0,_e51=0;;_t51++){var _s39=this.children[_t51];if(_s39.dom==i)return _e51;_e51+=_s39.length+_s39.breakAfter;}}},{key:"domBoundsAround",value:function domBoundsAround(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=-1,r=-1,n=-1,h=-1;for(var _l19=0,_o11=i,_u18=i;_l19<this.children.length;_l19++){var _i56=this.children[_l19],_f5=_o11+_i56.length;if(_o11<t&&_f5>e)return _i56.domBoundsAround(t,e,_o11);if(_f5>=t&&-1==s&&(s=_l19,r=_o11),_o11>e&&_i56.dom.parentNode==this.dom){n=_l19,h=_u18;break;}_u18=_f5,_o11=_f5+_i56.breakAfter;}return{from:r,to:h<0?i+this.length:h,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:n<this.children.length&&n>=0?this.children[n].dom:null};}},{key:"markDirty",value:function markDirty(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;this.flags|=2,this.markParentsDirty(t);}},{key:"markParentsDirty",value:function markParentsDirty(t){for(var _e52=this.parent;_e52;_e52=_e52.parent){if(t&&(_e52.flags|=2),1&_e52.flags)return;_e52.flags|=1,t=!1;}}},{key:"setParent",value:function setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0));}},{key:"setDOM",value:function setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this);}},{key:"rootView",get:function get(){for(var _t52=this;;){var _e53=_t52.parent;if(!_e53)return _t52;_t52=_e53;}}},{key:"replaceChildren",value:function replaceChildren(t,e){var _this$children;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:Ae;this.markDirty();for(var _s40=t;_s40<e;_s40++){var _t53=this.children[_s40];_t53.parent==this&&i.indexOf(_t53)<0&&_t53.destroy();}(_this$children=this.children).splice.apply(_this$children,[t,e-t].concat(_toConsumableArray(i)));for(var _t54=0;_t54<i.length;_t54++)i[_t54].setParent(this);}},{key:"ignoreMutation",value:function ignoreMutation(t){return!1;}},{key:"ignoreEvent",value:function ignoreEvent(t){return!1;}},{key:"childCursor",value:function childCursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.length;return new De(this.children,t,this.children.length);}},{key:"childPos",value:function childPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;return this.childCursor().findPos(t,e);}},{key:"toString",value:function toString(){var t=this.constructor.name.replace("View","");return t+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==t?this.text:this.length)+"]":"")+(this.breakAfter?"#":"");}},{key:"isEditable",get:function get(){return!0;}},{key:"isWidget",get:function get(){return!1;}},{key:"isHidden",get:function get(){return!1;}},{key:"merge",value:function merge(t,e,i,s,r,n){return!1;}},{key:"become",value:function become(t){return!1;}},{key:"canReuseDOM",value:function canReuseDOM(t){return t.constructor==this.constructor&&!(8&(this.flags|t.flags));}},{key:"getSide",value:function getSide(){return 0;}},{key:"destroy",value:function destroy(){var _iterator36=_createForOfIteratorHelper(this.children),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _t55=_step36.value;_t55.parent==this&&_t55.destroy();}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}this.parent=null;}}],[{key:"get",value:function get(t){return t.cmView;}}]);}();Ce.prototype.breakAfter=0;De=/*#__PURE__*/function(){function De(t,e,i){_classCallCheck(this,De);this.children=t,this.pos=e,this.i=i,this.off=0;}return _createClass(De,[{key:"findPos",value:function findPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;for(;;){if(t>this.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;var _i57=this.children[--this.i];this.pos-=_i57.length+_i57.breakAfter;}}}]);}();Re="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""};Te="undefined"!=typeof document?document:{documentElement:{style:{}}};Be=/Edge\/(\d+)/.exec(Re.userAgent);Le=/MSIE \d/.test(Re.userAgent);Ne=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Re.userAgent);je=!!(Le||Ne||Be);$e=!je&&/gecko\/(\d+)/i.test(Re.userAgent);ze=!je&&/Chrome\/(\d+)/.exec(Re.userAgent);Pe="webkitFontSmoothing"in Te.documentElement.style;He=!je&&/Apple Computer/.test(Re.vendor);We=He&&(/Mobile\/\w+/.test(Re.userAgent)||Re.maxTouchPoints>2);Ve={mac:We||/Mac/.test(Re.platform),windows:/Win/.test(Re.platform),linux:/Linux|X11/.test(Re.platform),ie:je,ie_version:Le?Te.documentMode||6:Ne?+Ne[1]:Be?+Be[1]:0,gecko:$e,gecko_version:$e?+(/Firefox\/(\d+)/.exec(Re.userAgent)||[0,0])[1]:0,chrome:!!ze,chrome_version:ze?+ze[1]:0,ios:We,android:/Android\b/.test(Re.userAgent),webkit:Pe,safari:He,webkit_version:Pe?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Te.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};Fe=/*#__PURE__*/function(_Ce){function Fe(t){var _this8;_classCallCheck(this,Fe);_this8=_callSuper(this,Fe),_this8.text=t;return _this8;}_inherits(Fe,_Ce);return _createClass(Fe,[{key:"length",get:function get(){return this.text.length;}},{key:"createDOM",value:function createDOM(t){this.setDOM(t||document.createTextNode(this.text));}},{key:"sync",value:function sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text);}},{key:"reuseDOM",value:function reuseDOM(t){3==t.nodeType&&this.createDOM(t);}},{key:"merge",value:function merge(t,e,i){return!(8&this.flags||i&&(!(i instanceof Fe)||this.length-(e-t)+i.length>256||8&i.flags))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0);}},{key:"split",value:function split(t){var e=new Fe(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e;}},{key:"localPosFromDOM",value:function localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0;}},{key:"domAtPos",value:function domAtPos(t){return new Se(this.dom,t);}},{key:"domBoundsAround",value:function domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling};}},{key:"coordsAt",value:function coordsAt(t,e){return function(t,e,i){var s=t.nodeValue.length;e>s&&(e=s);var r=e,n=e,h=0;0==e&&i<0||e==s&&i>=0?Ve.chrome||Ve.gecko||(e?(r--,h=1):n<s&&(n++,h=-1)):i<0?r--:n<s&&n++;var l=be(t,r,n).getClientRects();if(!l.length)return null;var o=l[(h?h<0:i>=0)?0:l.length-1];Ve.safari&&!h&&0==o.width&&(o=Array.prototype.find.call(l,function(t){return t.width;})||o);return h?ae(o,h<0):o||null;}(this.dom,t,e);}}]);}(Ce);qe=/*#__PURE__*/function(_Ce2){function qe(t){var _this9;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_classCallCheck(this,qe);_this9=_callSuper(this,qe),_this9.mark=t,_this9.children=e,_this9.length=i;var _iterator38=_createForOfIteratorHelper(e),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var _t58=_step38.value;_t58.setParent(_this9);}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}return _this9;}_inherits(qe,_Ce2);return _createClass(qe,[{key:"setAttrs",value:function setAttrs(t){if(ke(t),this.mark["class"]&&(t.className=this.mark["class"]),this.mark.attrs)for(var _e54 in this.mark.attrs)t.setAttribute(_e54,this.mark.attrs[_e54]);return t;}},{key:"canReuseDOM",value:function canReuseDOM(t){return _get(_getPrototypeOf(qe.prototype),"canReuseDOM",this).call(this,t)&&!(8&(this.flags|t.flags));}},{key:"reuseDOM",value:function reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6);}},{key:"sync",value:function sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),_get(_getPrototypeOf(qe.prototype),"sync",this).call(this,t,e);}},{key:"merge",value:function merge(t,e,i,s,r,n){return(!i||!(!(i instanceof qe&&i.mark.eq(this.mark))||t&&r<=0||e<this.length&&n<=0))&&(Ie(this,t,e,i?i.children.slice():[],r-1,n-1),this.markDirty(),!0);}},{key:"split",value:function split(t){var e=[],i=0,s=-1,r=0;var _iterator39=_createForOfIteratorHelper(this.children),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var _n37=_step39.value;var _h21=i+_n37.length;_h21>t&&e.push(i<t?_n37.split(t-i):_n37),s<0&&i>=t&&(s=r),i=_h21,r++;}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}var n=this.length-t;return this.length=t,s>-1&&(this.children.length=s,this.markDirty()),new qe(this.mark,e,n);}},{key:"domAtPos",value:function domAtPos(t){return Ge(this,t);}},{key:"coordsAt",value:function coordsAt(t,e){return _e(this,t,e);}}]);}(Ce);Ue=/*#__PURE__*/function(_Ce3){function Ue(t,e,i){var _this10;_classCallCheck(this,Ue);_this10=_callSuper(this,Ue),_this10.widget=t,_this10.length=e,_this10.side=i,_this10.prevWidget=null;return _this10;}_inherits(Ue,_Ce3);return _createClass(Ue,[{key:"split",value:function split(t){var e=Ue.create(this.widget,this.length-t,this.side);return this.length-=t,e;}},{key:"sync",value:function sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"));}},{key:"getSide",value:function getSide(){return this.side;}},{key:"merge",value:function merge(t,e,i,s,r,n){return!(i&&(!(i instanceof Ue&&this.widget.compare(i.widget))||t>0&&r<=0||e<this.length&&n<=0))&&(this.length=t+(i?i.length:0)+(this.length-e),!0);}},{key:"become",value:function become(t){return t instanceof Ue&&t.side==this.side&&this.widget.constructor==t.widget.constructor&&(this.widget.compare(t.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,!0);}},{key:"ignoreMutation",value:function ignoreMutation(){return!0;}},{key:"ignoreEvent",value:function ignoreEvent(t){return this.widget.ignoreEvent(t);}},{key:"overrideDOMText",get:function get(){if(0==this.length)return t.empty;var e=this;for(;e.parent;)e=e.parent;var _e55=e,i=_e55.view,s=i&&i.state.doc,r=this.posAtStart;return s?s.slice(r,r+this.length):t.empty;}},{key:"domAtPos",value:function domAtPos(t){return(this.length?0==t:this.side>0)?Se.before(this.dom):Se.after(this.dom,t==this.length);}},{key:"domBoundsAround",value:function domBoundsAround(){return null;}},{key:"coordsAt",value:function coordsAt(t,e){var i=this.widget.coordsAt(this.dom,t,e);if(i)return i;var s=this.dom.getClientRects(),r=null;if(!s.length)return null;var n=this.side?this.side<0:t>0;for(var _e56=n?s.length-1:0;r=s[_e56],!(t>0?0==_e56:_e56==s.length-1||r.top<r.bottom);_e56+=n?-1:1);return ae(r,!n);}},{key:"isEditable",get:function get(){return!1;}},{key:"isWidget",get:function get(){return!0;}},{key:"isHidden",get:function get(){return this.widget.isHidden;}},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(Ue.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom);}}],[{key:"create",value:function create(t,e,i){return new Ue(t,e,i);}}]);}(Ce);Je=/*#__PURE__*/function(_Ce4){function Je(t){var _this11;_classCallCheck(this,Je);_this11=_callSuper(this,Je),_this11.side=t;return _this11;}_inherits(Je,_Ce4);return _createClass(Je,[{key:"length",get:function get(){return 0;}},{key:"merge",value:function merge(){return!1;}},{key:"become",value:function become(t){return t instanceof Je&&t.side==this.side;}},{key:"split",value:function split(){return new Je(this.side);}},{key:"sync",value:function sync(){if(!this.dom){var _t59=document.createElement("img");_t59.className="cm-widgetBuffer",_t59.setAttribute("aria-hidden","true"),this.setDOM(_t59);}}},{key:"getSide",value:function getSide(){return this.side;}},{key:"domAtPos",value:function domAtPos(t){return this.side>0?Se.before(this.dom):Se.after(this.dom);}},{key:"localPosFromDOM",value:function localPosFromDOM(){return 0;}},{key:"domBoundsAround",value:function domBoundsAround(){return null;}},{key:"coordsAt",value:function coordsAt(t){return this.dom.getBoundingClientRect();}},{key:"overrideDOMText",get:function get(){return t.empty;}},{key:"isHidden",get:function get(){return!0;}}]);}(Ce);Fe.prototype.children=Ue.prototype.children=Je.prototype.children=Ae;Ye=Object.create(null);ei=/*#__PURE__*/function(_Ce5){function ei(){var _this12;_classCallCheck(this,ei);_this12=_callSuper(this,ei,arguments),_this12.children=[],_this12.length=0,_this12.prevAttrs=void 0,_this12.attrs=null,_this12.breakAfter=0;return _this12;}_inherits(ei,_Ce5);return _createClass(ei,[{key:"merge",value:function merge(t,e,i,s,r,n){if(i){if(!(i instanceof ei))return!1;this.dom||i.transferDOM(this);}return s&&this.setDeco(i?i.attrs:null),Ie(this,t,e,i?i.children.slice():[],r,n),!0;}},{key:"split",value:function split(t){var e=new ei();if(e.breakAfter=this.breakAfter,0==this.length)return e;var _this$childPos=this.childPos(t),i=_this$childPos.i,s=_this$childPos.off;s&&(e.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(var _t63=i;_t63<this.children.length;_t63++)e.append(this.children[_t63],0);for(;i>0&&0==this.children[i-1].length;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e;}},{key:"transferDOM",value:function transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null);}},{key:"setDeco",value:function setDeco(t){Qe(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t);}},{key:"append",value:function append(t,e){Ke(this,t,e);}},{key:"addLineDeco",value:function addLineDeco(t){var e=t.spec.attributes,i=t.spec["class"];e&&(this.attrs=Xe(e,this.attrs||{})),i&&(this.attrs=Xe({"class":i},this.attrs||{}));}},{key:"domAtPos",value:function domAtPos(t){return Ge(this,t);}},{key:"reuseDOM",value:function reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6);}},{key:"sync",value:function sync(t,e){var i;this.dom?4&this.flags&&(ke(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(Ze(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),_get(_getPrototypeOf(ei.prototype),"sync",this).call(this,t,e);var s=this.dom.lastChild;for(;s&&Ce.get(s)instanceof qe;)s=s.lastChild;if(!(s&&this.length&&("BR"==s.nodeName||0!=(null===(i=Ce.get(s))||void 0===i?void 0:i.isEditable)||Ve.ios&&this.children.some(function(t){return t instanceof Fe;})))){var _t64=document.createElement("BR");_t64.cmIgnore=!0,this.dom.appendChild(_t64);}}},{key:"measureTextSize",value:function measureTextSize(){if(0==this.children.length||this.length>20)return null;var t,e=0;var _iterator40=_createForOfIteratorHelper(this.children),_step40;try{for(_iterator40.s();!(_step40=_iterator40.n()).done;){var _i61=_step40.value;if(!(_i61 instanceof Fe)||/[^ -~]/.test(_i61.text))return null;var _s43=ne(_i61.dom);if(1!=_s43.length)return null;e+=_s43[0].width,t=_s43[0].height;}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null;}},{key:"coordsAt",value:function coordsAt(t,e){var i=_e(this,t,e);if(!this.children.length&&i&&this.parent){var _t65=this.parent.view.viewState.heightOracle,_e59=i.bottom-i.top;if(Math.abs(_e59-_t65.lineHeight)<2&&_t65.textHeight<_e59){var _s44=(_e59-_t65.textHeight)/2;return{top:i.top+_s44,bottom:i.bottom-_s44,left:i.left,right:i.left};}}return i;}},{key:"become",value:function become(t){return!1;}},{key:"covers",value:function covers(){return!0;}}],[{key:"find",value:function find(t,e){for(var _i62=0,_s45=0;_i62<t.children.length;_i62++){var _r42=t.children[_i62],_n40=_s45+_r42.length;if(_n40>=e){if(_r42 instanceof ei)return _r42;if(_n40>e)break;}_s45=_n40+_r42.breakAfter;}return null;}}]);}(Ce);ii=/*#__PURE__*/function(_Ce6){function ii(t,e,i){var _this13;_classCallCheck(this,ii);_this13=_callSuper(this,ii),_this13.widget=t,_this13.length=e,_this13.deco=i,_this13.breakAfter=0,_this13.prevWidget=null;return _this13;}_inherits(ii,_Ce6);return _createClass(ii,[{key:"merge",value:function merge(t,e,i,s,r,n){return!(i&&(!(i instanceof ii&&this.widget.compare(i.widget))||t>0&&r<=0||e<this.length&&n<=0))&&(this.length=t+(i?i.length:0)+(this.length-e),!0);}},{key:"domAtPos",value:function domAtPos(t){return 0==t?Se.before(this.dom):Se.after(this.dom,t==this.length);}},{key:"split",value:function split(t){var e=this.length-t;this.length=t;var i=new ii(this.widget,e,this.deco);return i.breakAfter=this.breakAfter,i;}},{key:"children",get:function get(){return Ae;}},{key:"sync",value:function sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable="false"));}},{key:"overrideDOMText",get:function get(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):t.empty;}},{key:"domBoundsAround",value:function domBoundsAround(){return null;}},{key:"become",value:function become(t){return t instanceof ii&&t.widget.constructor==this.widget.constructor&&(t.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,this.deco=t.deco,this.breakAfter=t.breakAfter,!0);}},{key:"ignoreMutation",value:function ignoreMutation(){return!0;}},{key:"ignoreEvent",value:function ignoreEvent(t){return this.widget.ignoreEvent(t);}},{key:"isEditable",get:function get(){return!1;}},{key:"isWidget",get:function get(){return!0;}},{key:"coordsAt",value:function coordsAt(t,e){return this.widget.coordsAt(this.dom,t,e);}},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(ii.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom);}},{key:"covers",value:function covers(t){var _this$deco=this.deco,e=_this$deco.startSide,i=_this$deco.endSide;return e!=i&&(t<0?e<0:i>0);}}]);}(Ce);_export("W",si=/*#__PURE__*/function(){function si(){_classCallCheck(this,si);}return _createClass(si,[{key:"eq",value:function eq(t){return!1;}},{key:"updateDOM",value:function updateDOM(t,e){return!1;}},{key:"compare",value:function compare(t){return this==t||this.constructor==t.constructor&&this.eq(t);}},{key:"estimatedHeight",get:function get(){return-1;}},{key:"lineBreaks",get:function get(){return 0;}},{key:"ignoreEvent",value:function ignoreEvent(t){return!0;}},{key:"coordsAt",value:function coordsAt(t,e,i){return null;}},{key:"isHidden",get:function get(){return!1;}},{key:"editable",get:function get(){return!1;}},{key:"destroy",value:function destroy(t){}}]);}());ri=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t;}(ri||(ri={}));_export("u",ni=/*#__PURE__*/function(_Ct){function ni(t,e,i,s){var _this14;_classCallCheck(this,ni);_this14=_callSuper(this,ni),_this14.startSide=t,_this14.endSide=e,_this14.widget=i,_this14.spec=s;return _this14;}_inherits(ni,_Ct);return _createClass(ni,[{key:"heightRelevant",get:function get(){return!1;}},{key:"hasHeight",value:function hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1;}}],[{key:"mark",value:function mark(t){return new hi(t);}},{key:"widget",value:function widget(t){var e=Math.max(-1e4,Math.min(1e4,t.side||0)),i=!!t.block;return e+=i&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new oi(t,e,e,i,t.widget||null,!1);}},{key:"replace",value:function replace(t){var e,i,s=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{var _ui=ui(t,s),_r43=_ui.start,_n41=_ui.end;e=(_r43?s?-3e8:-1:5e8)-1,i=1+(_n41?s?2e8:1:-6e8);}return new oi(t,e,i,s,t.widget||null,!0);}},{key:"line",value:function line(t){return new li(t);}},{key:"set",value:function set(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;return It.of(t,e);}}]);}(Ct));ni.none=It.empty;hi=/*#__PURE__*/function(_ni){function hi(t){var _this15;_classCallCheck(this,hi);var _ui2=ui(t),e=_ui2.start,i=_ui2.end;_this15=_callSuper(this,hi,[e?-1:5e8,i?1:-6e8,null,t]),_this15.tagName=t.tagName||"span",_this15["class"]=t["class"]||"",_this15.attrs=t.attributes||null;return _this15;}_inherits(hi,_ni);return _createClass(hi,[{key:"eq",value:function eq(t){var e,i;return this==t||t instanceof hi&&this.tagName==t.tagName&&(this["class"]||(null===(e=this.attrs)||void 0===e?void 0:e["class"]))==(t["class"]||(null===(i=t.attrs)||void 0===i?void 0:i["class"]))&&Qe(this.attrs,t.attrs,"class");}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(t>=e)throw new RangeError("Mark decorations may not be empty");return _get(_getPrototypeOf(hi.prototype),"range",this).call(this,t,e);}}]);}(ni);hi.prototype.point=!1;li=/*#__PURE__*/function(_ni2){function li(t){_classCallCheck(this,li);return _callSuper(this,li,[-2e8,-2e8,null,t]);}_inherits(li,_ni2);return _createClass(li,[{key:"eq",value:function eq(t){return t instanceof li&&this.spec["class"]==t.spec["class"]&&Qe(this.spec.attributes,t.spec.attributes);}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return _get(_getPrototypeOf(li.prototype),"range",this).call(this,t,e);}}]);}(ni);li.prototype.mapMode=x.TrackBefore,li.prototype.point=!0;oi=/*#__PURE__*/function(_ni3){function oi(t,e,i,s,r,n){var _this16;_classCallCheck(this,oi);_this16=_callSuper(this,oi,[e,i,r,t]),_this16.block=s,_this16.isReplace=n,_this16.mapMode=s?e<=0?x.TrackBefore:x.TrackAfter:x.TrackDel;return _this16;}_inherits(oi,_ni3);return _createClass(oi,[{key:"type",get:function get(){return this.startSide!=this.endSide?ri.WidgetRange:this.startSide<=0?ri.WidgetBefore:ri.WidgetAfter;}},{key:"heightRelevant",get:function get(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0);}},{key:"eq",value:function eq(t){return t instanceof oi&&(e=this.widget,i=t.widget,e==i||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i;}},{key:"range",value:function range(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return _get(_getPrototypeOf(oi.prototype),"range",this).call(this,t,e);}}]);}(ni);oi.prototype.point=!0;ai=/*#__PURE__*/function(){function ai(t,e,i,s){_classCallCheck(this,ai);this.doc=t,this.pos=e,this.end=i,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=t.iter(),this.skip=e;}return _createClass(ai,[{key:"posCovered",value:function posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;var t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof ii&&t.deco.endSide<0);}},{key:"getLine",value:function getLine(){return this.curLine||(this.content.push(this.curLine=new ei()),this.atCursorPos=!0),this.curLine;}},{key:"flushBuffer",value:function flushBuffer(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(ci(new Je(-1),t),t.length),this.pendingBuffer=0);}},{key:"addBlockWidget",value:function addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t);}},{key:"finish",value:function finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||t&&this.content.length&&this.content[this.content.length-1]instanceof ii||this.getLine();}},{key:"buildText",value:function buildText(t,e,i){for(;t>0;){if(this.textOff==this.text.length){var _this$cursor$next2=this.cursor.next(this.skip),_e60=_this$cursor$next2.value,_i63=_this$cursor$next2.lineBreak,_s46=_this$cursor$next2.done;if(this.skip=0,_s46)throw new Error("Ran out of text content when drawing inline views");if(_i63){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue;}this.text=_e60,this.textOff=0;}var _s47=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(ci(new Fe(this.text.slice(this.textOff,this.textOff+_s47)),e),i),this.atCursorPos=!0,this.textOff+=_s47,t-=_s47,i=0;}}},{key:"span",value:function span(t,e,i,s){this.buildText(e-t,i,s),this.pos=e,this.openStart<0&&(this.openStart=s);}},{key:"point",value:function point(t,e,i,s,r,n){if(this.disallowBlockEffectsFor[n]&&i instanceof oi){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins");}var h=e-t;if(i instanceof oi){if(i.block)i.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ii(i.widget||di.block,h,i));else{var _n42=Ue.create(i.widget||di.inline,h,h?0:i.startSide),_l20=this.atCursorPos&&!_n42.isEditable&&r<=s.length&&(t<e||i.startSide>0),_o13=!_n42.isEditable&&(t<e||r>s.length||i.startSide<=0),_u20=this.getLine();2!=this.pendingBuffer||_l20||_n42.isEditable||(this.pendingBuffer=0),this.flushBuffer(s),_l20&&(_u20.append(ci(new Je(1),s),r),r=s.length+Math.max(0,r-s.length)),_u20.append(ci(_n42,s),r),this.atCursorPos=_o13,this.pendingBuffer=_o13?t<e||r>s.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice());}}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);h&&(this.textOff+h<=this.text.length?this.textOff+=h:(this.skip+=h-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r);}}],[{key:"build",value:function build(t,e,i,s,r){var n=new ai(t,e,i,r);return n.openEnd=It.spans(s,e,i,n),n.openStart<0&&(n.openStart=n.openEnd),n.finish(n.openEnd),n;}}]);}();di=/*#__PURE__*/function(_si){function di(t){var _this17;_classCallCheck(this,di);_this17=_callSuper(this,di),_this17.tag=t;return _this17;}_inherits(di,_si);return _createClass(di,[{key:"eq",value:function eq(t){return t.tag==this.tag;}},{key:"toDOM",value:function toDOM(){return document.createElement(this.tag);}},{key:"updateDOM",value:function updateDOM(t){return t.nodeName.toLowerCase()==this.tag;}},{key:"isHidden",get:function get(){return!0;}}]);}(si);di.inline=new di("span"),di.block=new di("div");_export("v",pi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t;}(pi||_export("v",pi={})));mi=pi.LTR;gi=pi.RTL;bi=wi("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008");vi=wi("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333");ki=Object.create(null);yi=[];for(_i66=0,_arr=["()","[]","{}"];_i66<_arr.length;_i66++){_t66=_arr[_i66];_e61=_t66.charCodeAt(0);_i67=_t66.charCodeAt(1);ki[_e61]=_i67,ki[_i67]=-_e61;}xi=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;Si=/*#__PURE__*/function(){function Si(t,e,i){_classCallCheck(this,Si);this.from=t,this.to=e,this.level=i;}return _createClass(Si,[{key:"dir",get:function get(){return this.level%2?gi:mi;}},{key:"side",value:function side(t,e){return this.dir==e==t?this.to:this.from;}},{key:"forward",value:function forward(t,e){return t==(this.dir==e);}}],[{key:"find",value:function find(t,e,i,s){var r=-1;for(var _n43=0;_n43<t.length;_n43++){var _h23=t[_n43];if(_h23.from<=e&&_h23.to>=e){if(_h23.level==i)return _n43;(r<0||(0!=s?s<0?_h23.from<e:_h23.to>e:t[r].level>_h23.level))&&(r=_n43);}}if(r<0)throw new RangeError("Index out of range");return r;}}]);}();Ci=[];Ii="";Bi=j.define();Li=j.define();Ni=j.define();ji=j.define();$i=j.define();zi=j.define();Pi=j.define();Hi=j.define({combine:function combine(t){return t.some(function(t){return t;});}});Wi=j.define({combine:function combine(t){return t.some(function(t){return t;});}});Vi=j.define();Fi=/*#__PURE__*/function(){function Fi(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"nearest";var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"nearest";var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:5;var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:5;var n=arguments.length>5&&arguments[5]!==undefined?arguments[5]:!1;_classCallCheck(this,Fi);this.range=t,this.y=e,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=n;}return _createClass(Fi,[{key:"map",value:function map(t){return t.empty?this:new Fi(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot);}},{key:"clip",value:function clip(t){return this.range.to<=t.doc.length?this:new Fi(B.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot);}}]);}();qi=ct.define({map:function map(t,e){return t.map(e);}});Ji=j.define({combine:function combine(t){return!t.length||t[0];}});Gi=0;Ki=j.define();_export("V",_i=/*#__PURE__*/function(){function _i(t,e,i,s,r){_classCallCheck(this,_i);this.id=t,this.create=e,this.domEventHandlers=i,this.domEventObservers=s,this.extension=r(this);}return _createClass(_i,null,[{key:"define",value:function define(t,e){var _ref4=e||{},i=_ref4.eventHandlers,s=_ref4.eventObservers,r=_ref4.provide,n=_ref4.decorations;return new _i(Gi++,t,i,s,function(t){var e=[Ki.of(t)];return n&&e.push(Zi.of(function(e){var i=e.plugin(t);return i?n(i):ni.none;})),r&&e.push(r(t)),e;});}},{key:"fromClass",value:function fromClass(t,e){return _i.define(function(e){return new t(e);},e);}}]);}());Xi=/*#__PURE__*/function(){function Xi(t){_classCallCheck(this,Xi);this.spec=t,this.mustUpdate=null,this.value=null;}return _createClass(Xi,[{key:"update",value:function update(t){if(this.value){if(this.mustUpdate){var _t75=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(_t75);}catch(e){if(Ui(_t75.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy();}catch(t){}this.deactivate();}}}else if(this.spec)try{this.value=this.spec.create(t);}catch(e){Ui(t.state,e,"CodeMirror plugin crashed"),this.deactivate();}return this;}},{key:"destroy",value:function destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy();}catch(e){Ui(t.state,e,"CodeMirror plugin crashed");}}},{key:"deactivate",value:function deactivate(){this.spec=this.value=null;}}]);}();Yi=j.define();Qi=j.define();Zi=j.define();ts=j.define();es=j.define();is=j.define();rs=j.define();hs=j.define();ls=/*#__PURE__*/function(){function ls(t,e,i,s){_classCallCheck(this,ls);this.fromA=t,this.toA=e,this.fromB=i,this.toB=s;}return _createClass(ls,[{key:"join",value:function join(t){return new ls(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB));}},{key:"addToSet",value:function addToSet(t){var e=t.length,i=this;for(;e>0;e--){var _s54=t[e-1];if(!(_s54.fromA>i.toA)){if(_s54.toA<i.fromA)break;i=i.join(_s54),t.splice(e-1,1);}}return t.splice(e,0,i),t;}}],[{key:"extendWithRanges",value:function extendWithRanges(t,e){if(0==e.length)return t;var i=[];for(var _s55=0,_r50=0,_n49=0,_h31=0;;_s55++){var _l24=_s55==t.length?null:t[_s55],_o19=_n49-_h31,_u25=_l24?_l24.fromB:1e9;for(;_r50<e.length&&e[_r50]<_u25;){var _t78=e[_r50],_s56=e[_r50+1],_n50=Math.max(_h31,_t78),_l25=Math.min(_u25,_s56);if(_n50<=_l25&&new ls(_n50+_o19,_l25+_o19,_n50,_l25).addToSet(i),_s56>_u25)break;_r50+=2;}if(!_l24)return i;new ls(_l24.fromA,_l24.toA,_l24.fromB,_l24.toB).addToSet(i),_n49=_l24.toA,_h31=_l24.toB;}}}]);}();os=/*#__PURE__*/function(){function os(t,e,i){_classCallCheck(this,os);this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=A.empty(this.startState.doc.length);var _iterator43=_createForOfIteratorHelper(i),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var _t79=_step43.value;this.changes=this.changes.compose(_t79.changes);}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}var s=[];this.changes.iterChangedRanges(function(t,e,i,r){return s.push(new ls(t,e,i,r));}),this.changedRanges=s;}return _createClass(os,[{key:"viewportChanged",get:function get(){return(4&this.flags)>0;}},{key:"heightChanged",get:function get(){return(2&this.flags)>0;}},{key:"geometryChanged",get:function get(){return this.docChanged||(10&this.flags)>0;}},{key:"focusChanged",get:function get(){return(1&this.flags)>0;}},{key:"docChanged",get:function get(){return!this.changes.empty;}},{key:"selectionSet",get:function get(){return this.transactions.some(function(t){return t.selection;});}},{key:"empty",get:function get(){return 0==this.flags&&0==this.transactions.length;}}],[{key:"create",value:function create(t,e,i){return new os(t,e,i);}}]);}();us=/*#__PURE__*/function(_Ce7){function us(t){var _this18;_classCallCheck(this,us);_this18=_callSuper(this,us),_this18.view=t,_this18.decorations=[],_this18.dynamicDecorationMap=[],_this18.domChanged=null,_this18.hasComposition=null,_this18.markedForComposition=new Set(),_this18.lastCompositionAfterCursor=!1,_this18.minWidth=0,_this18.minWidthFrom=0,_this18.minWidthTo=0,_this18.impreciseAnchor=null,_this18.impreciseHead=null,_this18.forceSelection=!1,_this18.lastUpdate=Date.now(),_this18.setDOM(t.contentDOM),_this18.children=[new ei()],_this18.children[0].setParent(_assertThisInitialized(_this18)),_this18.updateDeco(),_this18.updateInner([new ls(0,0,0,t.state.doc.length)],0,null);return _this18;}_inherits(us,_Ce7);return _createClass(us,[{key:"length",get:function get(){return this.view.state.doc.length;}},{key:"update",value:function update(t){var _this19=this;var e;var i=t.changedRanges;this.minWidth>0&&i.length&&(i.every(function(_ref5){var t=_ref5.fromA,e=_ref5.toA;return e<_this19.minWidthFrom||t>_this19.minWidthTo;})?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);var s=-1;this.view.inputState.composing>=0&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?s=this.domChanged.newSel.head:function(t,e){var i=!1;e&&t.iterChangedRanges(function(t,s){t<e.to&&s>e.from&&(i=!0);});return i;}(t.changes,this.hasComposition)||t.selectionSet||(s=t.state.selection.main.head));var r=s>-1?function(t,e,i){var s=as(t,i);if(!s)return null;var r=s.node,n=s.from,h=s.to,l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(t.state.doc.sliceString(s.from,s.to)!=l)return null;var o=e.invertedDesc,u=new ls(o.mapPos(n),o.mapPos(h),n,h),f=[];for(var _e72=r.parentNode;;_e72=_e72.parentNode){var _i76=Ce.get(_e72);if(_i76 instanceof qe)f.push({node:_e72,deco:_i76.mark});else{if(_i76 instanceof ei||"DIV"==_e72.nodeName&&_e72.parentNode==t.contentDOM)return{range:u,text:r,marks:f,line:_e72};if(_e72==t.contentDOM)return null;f.push({node:_e72,deco:new hi({inclusive:!0,attributes:ti(_e72),tagName:_e72.tagName.toLowerCase()})});}}}(this.view,t.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();var _this$hasComposition=this.hasComposition,_e73=_this$hasComposition.from,_s57=_this$hasComposition.to;i=new ls(_e73,_s57,t.changes.mapPos(_e73,-1),t.changes.mapPos(_s57,1)).addToSet(i.slice());}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Ve.ie||Ve.chrome)&&!r&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);var n=function(t,e,i){var s=new cs();return It.compare(t,e,i,s),s.changes;}(this.decorations,this.updateDeco(),t.changes);return i=ls.extendWithRanges(i,n),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,t.startState.doc.length,r),t.transactions.length&&(this.lastUpdate=Date.now()),!0);}},{key:"updateInner",value:function updateInner(t,e,i){var _this20=this;this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,i);var s=this.view.observer;s.ignore(function(){_this20.dom.style.height=_this20.view.viewState.contentHeight/_this20.view.scaleY+"px",_this20.dom.style.flexBasis=_this20.minWidth?_this20.minWidth+"px":"";var t=Ve.chrome||Ve.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;_this20.sync(_this20.view,t),_this20.flags&=-8,t&&(t.written||s.selectionRange.focusNode!=t.node)&&(_this20.forceSelection=!0),_this20.dom.style.height="";}),this.markedForComposition.forEach(function(t){return t.flags&=-9;});var r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){var _iterator44=_createForOfIteratorHelper(this.children),_step44;try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){var _t80=_step44.value;_t80 instanceof ii&&_t80.widget instanceof fs&&r.push(_t80.dom);}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}}s.updateGaps(r);}},{key:"updateChildren",value:function updateChildren(t,e,i){var s=i?i.range.addToSet(t.slice()):t,r=this.childCursor(e);for(var _t81=s.length-1;;_t81--){var _e74=_t81>=0?s[_t81]:null;if(!_e74)break;var _n51=void 0,_h32=void 0,_l26=void 0,_o20=void 0,_u26=_e74.fromA,_f11=_e74.toA,_a8=_e74.fromB,_c7=_e74.toB;if(i&&i.range.fromB<_c7&&i.range.toB>_a8){var _t82=ai.build(this.view.state.doc,_a8,i.range.fromB,this.decorations,this.dynamicDecorationMap),_e75=ai.build(this.view.state.doc,i.range.toB,_c7,this.decorations,this.dynamicDecorationMap);_h32=_t82.breakAtStart,_l26=_t82.openStart,_o20=_e75.openEnd;var _s58=this.compositionView(i);_e75.breakAtStart?_s58.breakAfter=1:_e75.content.length&&_s58.merge(_s58.length,_s58.length,_e75.content[0],!1,_e75.openStart,0)&&(_s58.breakAfter=_e75.content[0].breakAfter,_e75.content.shift()),_t82.content.length&&_s58.merge(0,0,_t82.content[_t82.content.length-1],!0,0,_t82.openEnd)&&_t82.content.pop(),_n51=_t82.content.concat(_s58).concat(_e75.content);}else{var _ai$build=ai.build(this.view.state.doc,_a8,_c7,this.decorations,this.dynamicDecorationMap);_n51=_ai$build.content;_h32=_ai$build.breakAtStart;_l26=_ai$build.openStart;_o20=_ai$build.openEnd;}var _r$findPos=r.findPos(_f11,1),_d4=_r$findPos.i,_p3=_r$findPos.off,_r$findPos2=r.findPos(_u26,-1),_m=_r$findPos2.i,_g=_r$findPos2.off;Ee(this,_m,_g,_d4,_p3,_n51,_h32,_l26,_o20);}i&&this.fixCompositionDOM(i);}},{key:"compositionView",value:function compositionView(t){var e=new Fe(t.text.nodeValue);e.flags|=8;var _iterator45=_createForOfIteratorHelper(t.marks),_step45;try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){var _i77=_step45.value.deco;e=new qe(_i77,[e],e.length);}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}var i=new ei();return i.append(e,0),i;}},{key:"fixCompositionDOM",value:function fixCompositionDOM(t){var _this21=this;var e=function e(t,_e76){_e76.flags|=8|(_e76.children.some(function(t){return 7&t.flags;})?1:0),_this21.markedForComposition.add(_e76);var i=Ce.get(t);i&&i!=_e76&&(i.dom=null),_e76.setDOM(t);},i=this.childPos(t.range.fromB,1),s=this.children[i.i];e(t.line,s);for(var _r51=t.marks.length-1;_r51>=-1;_r51--)i=s.childPos(i.off,1),s=s.children[i.i],e(_r51>=0?t.marks[_r51].node:t.text,s);}},{key:"updateSelection",value:function updateSelection(){var _this22=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!1;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();var i=this.view.root.activeElement,s=i==this.dom,r=!s&&re(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||e||r))return;var n=this.forceSelection;this.forceSelection=!1;var h=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(h.anchor)),o=h.empty?l:this.moveToLine(this.domAtPos(h.head));if(Ve.gecko&&h.empty&&!this.hasComposition&&1==(u=l).node.nodeType&&u.node.firstChild&&(0==u.offset||"false"==u.node.childNodes[u.offset-1].contentEditable)&&(u.offset==u.node.childNodes.length||"false"==u.node.childNodes[u.offset].contentEditable)){var _t83=document.createTextNode("");this.view.observer.ignore(function(){return l.node.insertBefore(_t83,l.node.childNodes[l.offset]||null);}),l=o=new Se(_t83,0),n=!0;}var u;var f=this.view.observer.selectionRange;!n&&f.focusNode&&(he(l.node,l.offset,f.anchorNode,f.anchorOffset)&&he(o.node,o.offset,f.focusNode,f.focusOffset)||this.suppressWidgetCursorChange(f,h))||(this.view.observer.ignore(function(){Ve.android&&Ve.chrome&&_this22.dom.contains(f.focusNode)&&function(t,e){for(var _i78=t;_i78&&_i78!=e;_i78=_i78.assignedSlot||_i78.parentNode)if(1==_i78.nodeType&&"false"==_i78.contentEditable)return!0;return!1;}(f.focusNode,_this22.dom)&&(_this22.dom.blur(),_this22.dom.focus({preventScroll:!0}));var t=ie(_this22.view.root);if(t){if(h.empty){if(Ve.gecko){var _t84=(e=l.node,s=l.offset,1!=e.nodeType?0:(s&&"false"==e.childNodes[s-1].contentEditable?1:0)|(s<e.childNodes.length&&"false"==e.childNodes[s].contentEditable?2:0));if(_t84&&3!=_t84){var _e77=(1==_t84?Me:xe)(l.node,l.offset);_e77&&(l=new Se(_e77.node,_e77.offset));}}t.collapse(l.node,l.offset),null!=h.bidiLevel&&void 0!==t.caretBidiLevel&&(t.caretBidiLevel=h.bidiLevel);}else if(t.extend){t.collapse(l.node,l.offset);try{t.extend(o.node,o.offset);}catch(t){}}else{var _ref6;var _e78=document.createRange();h.anchor>h.head&&(_ref6=[o,l],l=_ref6[0],o=_ref6[1],_ref6),_e78.setEnd(o.node,o.offset),_e78.setStart(l.node,l.offset),t.removeAllRanges(),t.addRange(_e78);}}else;var e,s;r&&_this22.view.root.activeElement==_this22.dom&&(_this22.dom.blur(),i&&i.focus());}),this.view.observer.setSelectionRange(l,o)),this.impreciseAnchor=l.precise?null:new Se(f.anchorNode,f.anchorOffset),this.impreciseHead=o.precise?null:new Se(f.focusNode,f.focusOffset);}},{key:"suppressWidgetCursorChange",value:function suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&he(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head;}},{key:"enforceCursorAssoc",value:function enforceCursorAssoc(){if(this.hasComposition)return;var t=this.view,e=t.state.selection.main,i=ie(t.root),_t$observer$selection=t.observer.selectionRange,s=_t$observer$selection.anchorNode,r=_t$observer$selection.anchorOffset;if(!(i&&e.empty&&e.assoc&&i.modify))return;var n=ei.find(this,e.head);if(!n)return;var h=n.posAtStart;if(e.head==h||e.head==h+n.length)return;var l=this.coordsAt(e.head,-1),o=this.coordsAt(e.head,1);if(!l||!o||l.bottom>o.top)return;var u=this.domAtPos(e.head+e.assoc);i.collapse(u.node,u.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();var f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=e.from&&i.collapse(s,r);}},{key:"moveToLine",value:function moveToLine(t){var e,i=this.dom;if(t.node!=i)return t;for(var _s59=t.offset;!e&&_s59<i.childNodes.length;_s59++){var _t85=Ce.get(i.childNodes[_s59]);_t85 instanceof ei&&(e=_t85.domAtPos(0));}for(var _s60=t.offset-1;!e&&_s60>=0;_s60--){var _t86=Ce.get(i.childNodes[_s60]);_t86 instanceof ei&&(e=_t86.domAtPos(_t86.length));}return e?new Se(e.node,e.offset,!0):t;}},{key:"nearest",value:function nearest(t){for(var _e79=t;_e79;){var _t87=Ce.get(_e79);if(_t87&&_t87.rootView==this)return _t87;_e79=_e79.parentNode;}return null;}},{key:"posFromDOM",value:function posFromDOM(t,e){var i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart;}},{key:"domAtPos",value:function domAtPos(t){var _this$childCursor$fin=this.childCursor().findPos(t,-1),e=_this$childCursor$fin.i,i=_this$childCursor$fin.off;for(;e<this.children.length-1;){var _t88=this.children[e];if(i<_t88.length||_t88 instanceof ei)break;e++,i=0;}return this.children[e].domAtPos(i);}},{key:"coordsAt",value:function coordsAt(t,e){var i=null,s=0;for(var _r52=this.length,_n52=this.children.length-1;_n52>=0;_n52--){var _h33=this.children[_n52],_l27=_r52-_h33.breakAfter,_o21=_l27-_h33.length;if(_l27<t)break;_o21<=t&&(_o21<t||_h33.covers(-1))&&(_l27>t||_h33.covers(1))&&(!i||_h33 instanceof ei&&!(i instanceof ei&&e>=0))&&(i=_h33,s=_o21),_r52=_o21;}return i?i.coordsAt(t-s,e):null;}},{key:"coordsForChar",value:function coordsForChar(t){var _this$childPos2=this.childPos(t,1),e=_this$childPos2.i,i=_this$childPos2.off,s=this.children[e];if(!(s instanceof ei))return null;for(;s.children.length;){var _s$childPos=s.childPos(i,1),_t89=_s$childPos.i,_e80=_s$childPos.off;for(;;_t89++){if(_t89==s.children.length)return null;if((s=s.children[_t89]).length)break;}i=_e80;}if(!(s instanceof Fe))return null;var r=p(s.text,i);if(r==i)return null;var n=be(s.dom,i,r).getClientRects();for(var _t90=0;_t90<n.length;_t90++){var _e81=n[_t90];if(_t90==n.length-1||_e81.top<_e81.bottom&&_e81.left<_e81.right)return _e81;}return null;}},{key:"measureVisibleLineHeights",value:function measureVisibleLineHeights(t){var e=[],i=t.from,s=t.to,r=this.view.contentDOM.clientWidth,n=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,h=-1,l=this.view.textDirection==pi.LTR;for(var _t91=0,_o22=0;_o22<this.children.length;_o22++){var _u27=this.children[_o22],_f12=_t91+_u27.length;if(_f12>s)break;if(_t91>=i){var _i79=_u27.dom.getBoundingClientRect();if(e.push(_i79.height),n){var _e82=_u27.dom.lastChild,_s61=_e82?ne(_e82):[];if(_s61.length){var _e83=_s61[_s61.length-1],_n53=l?_e83.right-_i79.left:_i79.right-_e83.left;_n53>h&&(h=_n53,this.minWidth=r,this.minWidthFrom=_t91,this.minWidthTo=_f12);}}}_t91=_f12+_u27.breakAfter;}return e;}},{key:"textDirectionAt",value:function textDirectionAt(t){var _this$childPos3=this.childPos(t,1),e=_this$childPos3.i;return"rtl"==getComputedStyle(this.children[e].dom).direction?pi.RTL:pi.LTR;}},{key:"measureTextSize",value:function measureTextSize(){var _this23=this;var _iterator46=_createForOfIteratorHelper(this.children),_step46;try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){var _t92=_step46.value;if(_t92 instanceof ei){var _e84=_t92.measureTextSize();if(_e84)return _e84;}}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}var t,e,i,s=document.createElement("div");return s.className="cm-line",s.style.width="99999px",s.style.position="absolute",s.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(function(){_this23.dom.appendChild(s);var r=ne(s.firstChild)[0];t=s.getBoundingClientRect().height,e=r?r.width/27:7,i=r?r.height:t,s.remove();}),{lineHeight:t,charWidth:e,textHeight:i};}},{key:"childCursor",value:function childCursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.length;var e=this.children.length;return e&&(t-=this.children[--e].length),new De(this.children,t,e);}},{key:"computeBlockGapDeco",value:function computeBlockGapDeco(){var t=[],e=this.view.viewState;for(var _i80=0,_s62=0;;_s62++){var _r53=_s62==e.viewports.length?null:e.viewports[_s62],_n54=_r53?_r53.from-1:this.length;if(_n54>_i80){var _s63=(e.lineBlockAt(_n54).bottom-e.lineBlockAt(_i80).top)/this.view.scaleY;t.push(ni.replace({widget:new fs(_s63),block:!0,inclusive:!0,isBlockGap:!0}).range(_i80,_n54));}if(!_r53)break;_i80=_r53.to+1;}return ni.set(t);}},{key:"updateDeco",value:function updateDeco(){var _this24=this;var t=0,e=this.view.state.facet(Zi).map(function(e){return(_this24.dynamicDecorationMap[t++]="function"==typeof e)?e(_this24.view):e;}),i=!1,s=this.view.state.facet(ts).map(function(t,e){var s="function"==typeof t;return s&&(i=!0),s?t(_this24.view):t;});for(s.length&&(this.dynamicDecorationMap[t++]=i,e.push(It.join(s))),this.decorations=[].concat(_toConsumableArray(e),[this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]);t<this.decorations.length;)this.dynamicDecorationMap[t++]=!1;return this.decorations;}},{key:"scrollIntoView",value:function scrollIntoView(t){if(t.isSnapshot){var _e85=this.view.viewState.lineBlockAt(t.range.head);return this.view.scrollDOM.scrollTop=_e85.top-t.yMargin,void(this.view.scrollDOM.scrollLeft=t.xMargin);}var _iterator47=_createForOfIteratorHelper(this.view.state.facet(Vi)),_step47;try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){var _e88=_step47.value;try{if(_e88(this.view,t.range,t))return!0;}catch(t){Ui(this.view.state,t,"scroll handler");}}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}var e,i=t.range,s=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1);if(!s)return;!i.empty&&(e=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(s={left:Math.min(s.left,e.left),top:Math.min(s.top,e.top),right:Math.max(s.right,e.right),bottom:Math.max(s.bottom,e.bottom)});var r=ns(this.view),n={left:s.left-r.left,top:s.top-r.top,right:s.right+r.right,bottom:s.bottom+r.bottom},_this$view$scrollDOM=this.view.scrollDOM,h=_this$view$scrollDOM.offsetWidth,l=_this$view$scrollDOM.offsetHeight;!function(t,e,i,s,r,n,h,l){var o=t.ownerDocument,u=o.defaultView||window;for(var _f13=t,_a9=!1;_f13&&!_a9;)if(1==_f13.nodeType){var _t93=void 0,_c8=_f13==o.body,_d5=1,_p4=1;if(_c8)_t93=ce(u);else{var _de;if(/^(fixed|sticky)$/.test(getComputedStyle(_f13).position)&&(_a9=!0),_f13.scrollHeight<=_f13.clientHeight&&_f13.scrollWidth<=_f13.clientWidth){_f13=_f13.assignedSlot||_f13.parentNode;continue;}var _e86=_f13.getBoundingClientRect();(_de=de(_f13,_e86),_d5=_de.scaleX,_p4=_de.scaleY),_t93={left:_e86.left,right:_e86.left+_f13.clientWidth*_d5,top:_e86.top,bottom:_e86.top+_f13.clientHeight*_p4};}var _m2=0,_g2=0;if("nearest"==r)e.top<_t93.top?(_g2=-(_t93.top-e.top+h),i>0&&e.bottom>_t93.bottom+_g2&&(_g2=e.bottom-_t93.bottom+_g2+h)):e.bottom>_t93.bottom&&(_g2=e.bottom-_t93.bottom+h,i<0&&e.top-_g2<_t93.top&&(_g2=-(_t93.top+_g2-e.top+h)));else{var _s64=e.bottom-e.top,_n55=_t93.bottom-_t93.top;_g2=("center"==r&&_s64<=_n55?e.top+_s64/2-_n55/2:"start"==r||"center"==r&&i<0?e.top-h:e.bottom-_n55+h)-_t93.top;}if("nearest"==s?e.left<_t93.left?(_m2=-(_t93.left-e.left+n),i>0&&e.right>_t93.right+_m2&&(_m2=e.right-_t93.right+_m2+n)):e.right>_t93.right&&(_m2=e.right-_t93.right+n,i<0&&e.left<_t93.left+_m2&&(_m2=-(_t93.left+_m2-e.left+n))):_m2=("center"==s?e.left+(e.right-e.left)/2-(_t93.right-_t93.left)/2:"start"==s==l?e.left-n:e.right-(_t93.right-_t93.left)+n)-_t93.left,_m2||_g2)if(_c8)u.scrollBy(_m2,_g2);else{var _t94=0,_i81=0;if(_g2){var _t95=_f13.scrollTop;_f13.scrollTop+=_g2/_p4,_i81=(_f13.scrollTop-_t95)*_p4;}if(_m2){var _e87=_f13.scrollLeft;_f13.scrollLeft+=_m2/_d5,_t94=(_f13.scrollLeft-_e87)*_d5;}e={left:e.left-_t94,top:e.top-_i81,right:e.right-_t94,bottom:e.bottom-_i81},_t94&&Math.abs(_t94-_m2)<1&&(s="nearest"),_i81&&Math.abs(_i81-_g2)<1&&(r="nearest");}if(_c8)break;_f13=_f13.assignedSlot||_f13.parentNode;}else{if(11!=_f13.nodeType)break;_f13=_f13.host;}}(this.view.scrollDOM,n,i.head<i.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,h),-h),Math.max(Math.min(t.yMargin,l),-l),this.view.textDirection==pi.LTR);}}]);}(Ce);fs=/*#__PURE__*/function(_si2){function fs(t){var _this25;_classCallCheck(this,fs);_this25=_callSuper(this,fs),_this25.height=t;return _this25;}_inherits(fs,_si2);return _createClass(fs,[{key:"toDOM",value:function toDOM(){var t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t;}},{key:"eq",value:function eq(t){return t.height==this.height;}},{key:"updateDOM",value:function updateDOM(t){return t.style.height=this.height+"px",!0;}},{key:"editable",get:function get(){return!0;}},{key:"estimatedHeight",get:function get(){return this.height;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);cs=/*#__PURE__*/function(){function cs(){_classCallCheck(this,cs);this.changes=[];}return _createClass(cs,[{key:"compareRange",value:function compareRange(t,e){fi(t,e,this.changes);}},{key:"comparePoint",value:function comparePoint(t,e){fi(t,e,this.changes);}}]);}();Cs=/*#__PURE__*/function(){function Cs(t){_classCallCheck(this,Cs);this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,Ve.safari&&t.contentDOM.addEventListener("input",function(){return null;}),Ve.gecko&&function(t){Zs.has(t)||(Zs.add(t),t.addEventListener("copy",function(){}),t.addEventListener("cut",function(){}));}(t.contentDOM.ownerDocument);}return _createClass(Cs,[{key:"setSelectionOrigin",value:function setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now();}},{key:"handleEvent",value:function handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var _i83,_s67=e.target;_s67!=t.contentDOM;_s67=_s67.parentNode)if(!_s67||11==_s67.nodeType||(_i83=Ce.get(_s67))&&_i83.ignoreEvent(e))return!1;return!0;})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||this.runHandlers(t.type,t));}},{key:"runHandlers",value:function runHandlers(t,e){var i=this.handlers[t];if(i){var _iterator50=_createForOfIteratorHelper(i.observers),_step50;try{for(_iterator50.s();!(_step50=_iterator50.n()).done;){var _t103=_step50.value;_t103(this.view,e);}}catch(err){_iterator50.e(err);}finally{_iterator50.f();}var _iterator51=_createForOfIteratorHelper(i.handlers),_step51;try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){var _t104=_step51.value;if(e.defaultPrevented)break;if(_t104(this.view,e)){e.preventDefault();break;}}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}}}},{key:"ensureHandlers",value:function ensureHandlers(t){var e=Ds(t),i=this.handlers,s=this.view.contentDOM;for(var _t105 in e)if("scroll"!=_t105){var _r56=!e[_t105].handlers.length,_n57=i[_t105];_n57&&_r56!=!_n57.handlers.length&&(s.removeEventListener(_t105,this.handleEvent),_n57=null),_n57||s.addEventListener(_t105,this.handleEvent,{passive:_r56});}for(var _t106 in i)"scroll"==_t106||e[_t106]||s.removeEventListener(_t106,this.handleEvent);this.handlers=e;}},{key:"keydown",value:function keydown(t){var _this26=this;if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&Date.now()<this.lastEscPress+2e3)return!0;if(27!=t.keyCode&&Rs.indexOf(t.keyCode)<0&&(this.view.inputState.lastEscPress=0),Ve.android&&Ve.chrome&&!t.synthetic&&(13==t.keyCode||8==t.keyCode))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;var e;return!Ve.ios||t.synthetic||t.altKey||t.metaKey||!((e=Es.find(function(e){return e.keyCode==t.keyCode;}))&&!t.ctrlKey||Is.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout(function(){return _this26.flushIOSKey();},250),!0);}},{key:"flushIOSKey",value:function flushIOSKey(t){var e=this.pendingIOSKey;return!!e&&!("Enter"==e.key&&t&&t.from<t.to&&/^\S+$/.test(t.insert.toString()))&&(this.pendingIOSKey=void 0,ve(this.view.contentDOM,e.key,e.keyCode,e instanceof KeyboardEvent?e:void 0));}},{key:"ignoreDuringComposition",value:function ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Ve.safari&&!Ve.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0));}},{key:"startMouseSelection",value:function startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t;}},{key:"update",value:function update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0);}},{key:"destroy",value:function destroy(){this.mouseSelection&&this.mouseSelection.destroy();}}]);}();Es=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}];Is="dthko";Rs=[16,17,18,20,91,92,224,225];Bs=/*#__PURE__*/function(){function Bs(t,e,i,s){_classCallCheck(this,Bs);this.view=t,this.startEvent=e,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=function(t){var e=t.ownerDocument;for(var _i84=t.parentNode;_i84&&_i84!=e.body;)if(1==_i84.nodeType){if(_i84.scrollHeight>_i84.clientHeight||_i84.scrollWidth>_i84.clientWidth)return _i84;_i84=_i84.assignedSlot||_i84.parentNode;}else{if(11!=_i84.nodeType)break;_i84=_i84.host;}return null;}(t.contentDOM),this.atoms=t.state.facet(es).map(function(e){return e(t);});var r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(St.allowMultipleSelections)&&function(t,e){var i=t.state.facet(Bi);return i.length?i[0](e):Ve.mac?e.metaKey:e.ctrlKey;}(t,e),this.dragging=!(!function(t,e){var i=t.state.selection.main;if(i.empty)return!1;var s=ie(t.root);if(!s||0==s.rangeCount)return!0;var r=s.getRangeAt(0).getClientRects();for(var _t110=0;_t110<r.length;_t110++){var _i85=r[_t110];if(_i85.left<=e.clientX&&_i85.right>=e.clientX&&_i85.top<=e.clientY&&_i85.bottom>=e.clientY)return!0;}return!1;}(t,e)||1!=Gs(e))&&null;}return _createClass(Bs,[{key:"start",value:function start(t){!1===this.dragging&&this.select(t);}},{key:"move",value:function move(t){var e,i,s;if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(i=this.startEvent,s=t,Math.max(Math.abs(i.clientX-s.clientX),Math.abs(i.clientY-s.clientY))<10))return;this.select(this.lastEvent=t);var r=0,n=0,h=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},l=ns(this.view);t.clientX-l.left<=h.left+6?r=-Ts(h.left-t.clientX):t.clientX+l.right>=h.right-6&&(r=Ts(t.clientX-h.right)),t.clientY-l.top<=h.top+6?n=-Ts(h.top-t.clientY):t.clientY+l.bottom>=h.bottom-6&&(n=Ts(t.clientY-h.bottom)),this.setScrollSpeed(r,n);}},{key:"up",value:function up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy();}},{key:"destroy",value:function destroy(){this.setScrollSpeed(0,0);var t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null;}},{key:"setScrollSpeed",value:function setScrollSpeed(t,e){var _this27=this;this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(function(){return _this27.scroll();},50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1);}},{key:"scroll",value:function scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent);}},{key:"skipAtoms",value:function skipAtoms(t){var e=null;for(var _i86=0;_i86<t.ranges.length;_i86++){var _s70=t.ranges[_i86],_r59=null;if(_s70.empty){var _t111=Ss(this.atoms,_s70.from,0);_t111!=_s70.from&&(_r59=B.cursor(_t111,-1));}else{var _t112=Ss(this.atoms,_s70.from,-1),_e98=Ss(this.atoms,_s70.to,1);_t112==_s70.from&&_e98==_s70.to||(_r59=B.range(_s70.from==_s70.anchor?_t112:_e98,_s70.from==_s70.head?_t112:_e98));}_r59&&(e||(e=t.ranges.slice()),e[_i86]=_r59);}return e?B.create(e,t.mainIndex):t;}},{key:"select",value:function select(t){var e=this.view,i=this.skipAtoms(this.style.get(t,this.extend,this.multiple));!this.mustSelect&&i.eq(e.state.selection,!1===this.dragging)||this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1;}},{key:"update",value:function update(t){var _this28=this;this.style.update(t)&&setTimeout(function(){return _this28.select(_this28.lastEvent);},20);}}]);}();Ls=Object.create(null);Ns=Object.create(null);js=Ve.ie&&Ve.ie_version<15||Ve.ios&&Ve.webkit_version<604;Ns.scroll=function(t){t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft;},Ls.keydown=function(t,e){return t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now()),!1;},Ns.touchstart=function(t,e){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer");},Ns.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer");},Ls.mousedown=function(t,e){if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;var i=null;var _iterator53=_createForOfIteratorHelper(t.state.facet(Ni)),_step53;try{for(_iterator53.s();!(_step53=_iterator53.n()).done;){var _s74=_step53.value;if(i=_s74(t,e),i)break;}}catch(err){_iterator53.e(err);}finally{_iterator53.f();}if(i||0!=e.button||(i=function(t,e){var i=Vs(t,e),s=Gs(e),r=t.state.selection;return{update:function update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),r=r.map(t.changes));},get:function get(e,n,h){var l,o=Vs(t,e),u=zs(t,o.pos,o.bias,s);if(i.pos!=o.pos&&!n){var _e99=zs(t,i.pos,i.bias,s),_r61=Math.min(_e99.from,u.from),_n59=Math.max(_e99.to,u.to);u=_r61<u.from?B.range(_r61,_n59):B.range(_n59,_r61);}return n?r.replaceRange(r.main.extend(u.from,u.to)):h&&1==s&&r.ranges.length>1&&(l=function(t,e){for(var _i88=0;_i88<t.ranges.length;_i88++){var _t$ranges$_i=t.ranges[_i88],_s72=_t$ranges$_i.from,_r62=_t$ranges$_i.to;if(_s72<=e&&_r62>=e)return B.create(t.ranges.slice(0,_i88).concat(t.ranges.slice(_i88+1)),t.mainIndex==_i88?0:t.mainIndex-(t.mainIndex>_i88?1:0));}return null;}(r,o.pos))?l:h?r.addRange(u):B.create([u]);}};}(t,e)),i){var _s73=!t.hasFocus;t.inputState.startMouseSelection(new Bs(t,e,i,_s73)),_s73&&t.observer.ignore(function(){return we(t.contentDOM);});var _r63=t.inputState.mouseSelection;if(_r63)return _r63.start(e),!1===_r63.dragging;}return!1;};Ps=function Ps(t,e){return t>=e.top&&t<=e.bottom;};Hs=function Hs(t,e,i){return Ps(e,i)&&t>=i.left&&t<=i.right;};Fs=Ve.ie&&Ve.ie_version<=11;qs=null;Us=0;Js=0;Ls.dragstart=function(t,e){var i=t.state.selection.main;if(e.target.draggable){var _s75=t.docView.nearest(e.target);if(_s75&&_s75.isWidget){var _t116=_s75.posAtStart,_e100=_t116+_s75.length;(_t116>=i.to||_e100<=i.from)&&(i=B.range(_t116,_e100));}}var s=t.inputState;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=i,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove"),!1;},Ls.dragend=function(t){return t.inputState.draggedContent=null,!1;},Ls.drop=function(t,e){if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;var i=e.dataTransfer.files;if(i&&i.length){var _s76=Array(i.length),_r64=0,_n60=function _n60(){++_r64==i.length&&Ks(t,e,_s76.filter(function(t){return null!=t;}).join(t.state.lineBreak),!1);};var _loop6=function _loop6(_t117){var e=new FileReader();e.onerror=_n60,e.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(_s76[_t117]=e.result),_n60();},e.readAsText(i[_t117]);};for(var _t117=0;_t117<i.length;_t117++){_loop6(_t117);}return!0;}{var _i89=e.dataTransfer.getData("Text");if(_i89)return Ks(t,e,_i89,!0),!0;}return!1;},Ls.paste=function(t,e){if(t.state.readOnly)return!0;t.observer.flush();var i=js?null:e.clipboardData;return i?($s(t,i.getData("text/plain")||i.getData("text/uri-list")),!0):(function(t){var e=t.dom.parentNode;if(!e)return;var i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(function(){t.focus(),i.remove(),$s(t,i.value);},50);}(t),!1);};_s=null;Ls.copy=Ls.cut=function(t,e){var _ref7=function(t){var e=[],i=[],s=!1;var _iterator54=_createForOfIteratorHelper(t.selection.ranges),_step54;try{for(_iterator54.s();!(_step54=_iterator54.n()).done;){var _s78=_step54.value;_s78.empty||(e.push(t.sliceDoc(_s78.from,_s78.to)),i.push(_s78));}}catch(err){_iterator54.e(err);}finally{_iterator54.f();}if(!e.length){var _r65=-1;var _iterator55=_createForOfIteratorHelper(t.selection.ranges),_step55;try{for(_iterator55.s();!(_step55=_iterator55.n()).done;){var _s77=_step55.value.from;var _n61=t.doc.lineAt(_s77);_n61.number>_r65&&(e.push(_n61.text),i.push({from:_n61.from,to:Math.min(t.doc.length,_n61.to+1)})),_r65=_n61.number;}}catch(err){_iterator55.e(err);}finally{_iterator55.f();}s=!0;}return{text:e.join(t.lineBreak),ranges:i,linewise:s};}(t.state),i=_ref7.text,s=_ref7.ranges,r=_ref7.linewise;if(!i&&!r)return!1;_s=r?i:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"});var n=js?null:e.clipboardData;return n?(n.clearData(),n.setData("text/plain",i),!0):(function(t,e){var i=t.dom.parentNode;if(!i)return;var s=i.appendChild(document.createElement("textarea"));s.style.cssText="position: fixed; left: -10000px; top: 10px",s.value=e,s.focus(),s.selectionEnd=e.length,s.selectionStart=0,setTimeout(function(){s.remove(),t.focus();},50);}(t,i),!1);};Xs=ut.define();Ns.focus=function(t){t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Qs(t);},Ns.blur=function(t){t.observer.clearSelectionRange(),Qs(t);},Ns.compositionstart=Ns.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0);},Ns.compositionend=function(t){t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Ve.chrome&&Ve.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(function(){return t.observer.flush();}):setTimeout(function(){t.inputState.composing<0&&t.docView.hasComposition&&t.update([]);},50);},Ns.contextmenu=function(t){t.inputState.lastContextMenu=Date.now();},Ls.beforeinput=function(t,e){var i;var s;if(Ve.chrome&&Ve.android&&(s=Es.find(function(t){return t.inputType==e.inputType;}))&&(t.observer.delayAndroidKey(s.key,s.keyCode),"Backspace"==s.key||"Delete"==s.key)){var _e101=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout(function(){var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>_e101+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus());},100);}return Ve.ios&&"deleteContentForward"==e.inputType&&t.observer.flushSoon(),Ve.safari&&"insertText"==e.inputType&&t.inputState.composing>=0&&setTimeout(function(){return Ns.compositionend(t,e);},20),!1;};Zs=new Set();tr=["pre-wrap","normal","pre-line","break-spaces"];er=/*#__PURE__*/function(){function er(e){_classCallCheck(this,er);this.lineWrapping=e,this.doc=t.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1;}return _createClass(er,[{key:"heightForGap",value:function heightForGap(t,e){var i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i;}},{key:"heightForLine",value:function heightForLine(t){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight;}},{key:"setDoc",value:function setDoc(t){return this.doc=t,this;}},{key:"mustRefreshForWrapping",value:function mustRefreshForWrapping(t){return tr.indexOf(t)>-1!=this.lineWrapping;}},{key:"mustRefreshForHeights",value:function mustRefreshForHeights(t){var e=!1;for(var _i91=0;_i91<t.length;_i91++){var _s80=t[_i91];_s80<0?_i91++:this.heightSamples[Math.floor(10*_s80)]||(e=!0,this.heightSamples[Math.floor(10*_s80)]=!0);}return e;}},{key:"refresh",value:function refresh(t,e,i,s,r,n){var h=tr.indexOf(t)>-1,l=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=h;if(this.lineWrapping=h,this.lineHeight=e,this.charWidth=i,this.textHeight=s,this.lineLength=r,l){this.heightSamples={};for(var _t118=0;_t118<n.length;_t118++){var _e102=n[_t118];_e102<0?_t118++:this.heightSamples[Math.floor(10*_e102)]=!0;}}return l;}}]);}();ir=/*#__PURE__*/function(){function ir(t,e){_classCallCheck(this,ir);this.from=t,this.heights=e,this.index=0;}return _createClass(ir,[{key:"more",get:function get(){return this.index<this.heights.length;}}]);}();sr=/*#__PURE__*/function(){function sr(t,e,i,s,r){_classCallCheck(this,sr);this.from=t,this.length=e,this.top=i,this.height=s,this._content=r;}return _createClass(sr,[{key:"type",get:function get(){return"number"==typeof this._content?ri.Text:Array.isArray(this._content)?this._content:this._content.type;}},{key:"to",get:function get(){return this.from+this.length;}},{key:"bottom",get:function get(){return this.top+this.height;}},{key:"widget",get:function get(){return this._content instanceof oi?this._content.widget:null;}},{key:"widgetLineBreaks",get:function get(){return"number"==typeof this._content?this._content:0;}},{key:"join",value:function join(t){var e=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new sr(this.from,this.length+t.length,this.top,this.height+t.height,e);}}]);}();rr=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t;}(rr||(rr={}));nr=.001;hr=/*#__PURE__*/function(){function hr(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:2;_classCallCheck(this,hr);this.length=t,this.height=e,this.flags=i;}return _createClass(hr,[{key:"outdated",get:function get(){return(2&this.flags)>0;},set:function set(t){this.flags=(t?2:0)|-3&this.flags;}},{key:"setHeight",value:function setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>nr&&(t.heightChanged=!0),this.height=e);}},{key:"replace",value:function replace(t,e,i){return hr.of(i);}},{key:"decomposeLeft",value:function decomposeLeft(t,e){e.push(this);}},{key:"decomposeRight",value:function decomposeRight(t,e){e.push(this);}},{key:"applyChanges",value:function applyChanges(t,e,i,s){var r=this,n=i.doc;for(var _h34=s.length-1;_h34>=0;_h34--){var _s$_h=s[_h34],_l31=_s$_h.fromA,_o25=_s$_h.toA,_u30=_s$_h.fromB,_f15=_s$_h.toB,_a10=r.lineAt(_l31,rr.ByPosNoHeight,i.setDoc(e),0,0),_c10=_a10.to>=_o25?_a10:r.lineAt(_o25,rr.ByPosNoHeight,i,0,0);for(_f15+=_c10.to-_o25,_o25=_c10.to;_h34>0&&_a10.from<=s[_h34-1].toA;)_l31=s[_h34-1].fromA,_u30=s[_h34-1].fromB,_h34--,_l31<_a10.from&&(_a10=r.lineAt(_l31,rr.ByPosNoHeight,i,0,0));_u30+=_a10.from-_l31,_l31=_a10.from;var _d7=cr.build(i.setDoc(n),t,_u30,_f15);r=r.replace(_l31,_o25,_d7);}return r.updateHeight(i,0);}}],[{key:"empty",value:function empty(){return new or(0,0);}},{key:"of",value:function of(t){if(1==t.length)return t[0];var e=0,i=t.length,s=0,r=0;for(;;)if(e==i){if(s>2*r){var _r67=t[e-1];_r67["break"]?t.splice(--e,1,_r67.left,null,_r67.right):t.splice(--e,1,_r67.left,_r67.right),i+=1+_r67["break"],s-=_r67.size;}else{if(!(r>2*s))break;{var _e103=t[i];_e103["break"]?t.splice(i,1,_e103.left,null,_e103.right):t.splice(i,1,_e103.left,_e103.right),i+=2+_e103["break"],r-=_e103.size;}}}else if(s<r){var _i92=t[e++];_i92&&(s+=_i92.size);}else{var _e104=t[--i];_e104&&(r+=_e104.size);}var n=0;return null==t[e-1]?(n=1,e--):null==t[e]&&(n=1,i++),new fr(hr.of(t.slice(0,e)),n,hr.of(t.slice(i)));}}]);}();hr.prototype.size=1;lr=/*#__PURE__*/function(_hr){function lr(t,e,i){var _this29;_classCallCheck(this,lr);_this29=_callSuper(this,lr,[t,e]),_this29.deco=i;return _this29;}_inherits(lr,_hr);return _createClass(lr,[{key:"blockAt",value:function blockAt(t,e,i,s){return new sr(s,this.length,i,this.height,this.deco||0);}},{key:"lineAt",value:function lineAt(t,e,i,s,r){return this.blockAt(0,i,s,r);}},{key:"forEachLine",value:function forEachLine(t,e,i,s,r,n){t<=r+this.length&&e>=r&&n(this.blockAt(0,i,s,r));}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;return s&&s.from<=e&&s.more&&this.setHeight(t,s.heights[s.index++]),this.outdated=!1,this;}},{key:"toString",value:function toString(){return"block(".concat(this.length,")");}}]);}(hr);or=/*#__PURE__*/function(_lr){function or(t,e){var _this30;_classCallCheck(this,or);_this30=_callSuper(this,or,[t,e,null]),_this30.collapsed=0,_this30.widgetHeight=0,_this30.breaks=0;return _this30;}_inherits(or,_lr);return _createClass(or,[{key:"blockAt",value:function blockAt(t,e,i,s){return new sr(s,this.length,i,this.height,this.breaks);}},{key:"replace",value:function replace(t,e,i){var s=i[0];return 1==i.length&&(s instanceof or||s instanceof ur&&4&s.flags)&&Math.abs(this.length-s.length)<10?(s instanceof ur?s=new or(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):hr.of(i);}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;return s&&s.from<=e&&s.more?this.setHeight(t,s.heights[s.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this;}},{key:"toString",value:function toString(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")");}}]);}(lr);ur=/*#__PURE__*/function(_hr2){function ur(t){_classCallCheck(this,ur);return _callSuper(this,ur,[t,0]);}_inherits(ur,_hr2);return _createClass(ur,[{key:"heightMetrics",value:function heightMetrics(t,e){var i,s=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,n=r-s+1,h=0;if(t.lineWrapping){var _e105=Math.min(this.height,t.lineHeight*n);i=_e105/n,this.length>n+1&&(h=(this.height-_e105)/(this.length-n-1));}else i=this.height/n;return{firstLine:s,lastLine:r,perLine:i,perChar:h};}},{key:"blockAt",value:function blockAt(t,e,i,s){var _this$heightMetrics=this.heightMetrics(e,s),r=_this$heightMetrics.firstLine,n=_this$heightMetrics.lastLine,h=_this$heightMetrics.perLine,l=_this$heightMetrics.perChar;if(e.lineWrapping){var _r68=s+(t<e.lineHeight?0:Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length)),_n62=e.doc.lineAt(_r68),_o26=h+_n62.length*l,_u31=Math.max(i,t-_o26/2);return new sr(_n62.from,_n62.length,_u31,_o26,0);}{var _s81=Math.max(0,Math.min(n-r,Math.floor((t-i)/h))),_e$doc$line=e.doc.line(r+_s81),_l32=_e$doc$line.from,_o27=_e$doc$line.length;return new sr(_l32,_o27,i+h*_s81,h,0);}}},{key:"lineAt",value:function lineAt(t,e,i,s,r){if(e==rr.ByHeight)return this.blockAt(t,i,s,r);if(e==rr.ByPosNoHeight){var _i$doc$lineAt=i.doc.lineAt(t),_e106=_i$doc$lineAt.from,_s82=_i$doc$lineAt.to;return new sr(_e106,_s82-_e106,0,0,0);}var _this$heightMetrics2=this.heightMetrics(i,r),n=_this$heightMetrics2.firstLine,h=_this$heightMetrics2.perLine,l=_this$heightMetrics2.perChar,o=i.doc.lineAt(t),u=h+o.length*l,f=o.number-n,a=s+h*f+l*(o.from-r-f);return new sr(o.from,o.length,Math.max(s,Math.min(a,s+this.height-u)),u,0);}},{key:"forEachLine",value:function forEachLine(t,e,i,s,r,n){t=Math.max(t,r),e=Math.min(e,r+this.length);var _this$heightMetrics3=this.heightMetrics(i,r),h=_this$heightMetrics3.firstLine,l=_this$heightMetrics3.perLine,o=_this$heightMetrics3.perChar;for(var _u32=t,_f16=s;_u32<=e;){var _e107=i.doc.lineAt(_u32);if(_u32==t){var _i93=_e107.number-h;_f16+=l*_i93+o*(t-r-_i93);}var _s83=l+o*_e107.length;n(new sr(_e107.from,_e107.length,_f16,_s83,0)),_f16+=_s83,_u32=_e107.to+1;}}},{key:"replace",value:function replace(t,e,i){var s=this.length-e;if(s>0){var _t119=i[i.length-1];_t119 instanceof ur?i[i.length-1]=new ur(_t119.length+s):i.push(null,new ur(s-1));}if(t>0){var _e108=i[0];_e108 instanceof ur?i[0]=new ur(t+_e108.length):i.unshift(new ur(t-1),null);}return hr.of(i);}},{key:"decomposeLeft",value:function decomposeLeft(t,e){e.push(new ur(t-1),null);}},{key:"decomposeRight",value:function decomposeRight(t,e){e.push(null,new ur(this.length-t-1));}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;var r=e+this.length;if(s&&s.from<=e+this.length&&s.more){var _i94=[],_n63=Math.max(e,s.from),_h35=-1;for(s.from>e&&_i94.push(new ur(s.from-e-1).updateHeight(t,e));_n63<=r&&s.more;){var _e109=t.doc.lineAt(_n63).length;_i94.length&&_i94.push(null);var _r69=s.heights[s.index++];-1==_h35?_h35=_r69:Math.abs(_r69-_h35)>=nr&&(_h35=-2);var _l33=new or(_e109,_r69);_l33.outdated=!1,_i94.push(_l33),_n63+=_e109+1;}_n63<=r&&_i94.push(null,new ur(r-_n63).updateHeight(t,_n63));var _l34=hr.of(_i94);return(_h35<0||Math.abs(_l34.height-this.height)>=nr||Math.abs(_h35-this.heightMetrics(t,e).perLine)>=nr)&&(t.heightChanged=!0),_l34;}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this;}},{key:"toString",value:function toString(){return"gap(".concat(this.length,")");}}]);}(hr);fr=/*#__PURE__*/function(_hr3){function fr(t,e,i){var _this31;_classCallCheck(this,fr);_this31=_callSuper(this,fr,[t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)]),_this31.left=t,_this31.right=i,_this31.size=t.size+i.size;return _this31;}_inherits(fr,_hr3);return _createClass(fr,[{key:"break",get:function get(){return 1&this.flags;}},{key:"blockAt",value:function blockAt(t,e,i,s){var r=i+this.left.height;return t<r?this.left.blockAt(t,e,i,s):this.right.blockAt(t,e,r,s+this.left.length+this["break"]);}},{key:"lineAt",value:function lineAt(t,e,i,s,r){var n=s+this.left.height,h=r+this.left.length+this["break"],l=e==rr.ByHeight?t<n:t<h,o=l?this.left.lineAt(t,e,i,s,r):this.right.lineAt(t,e,i,n,h);if(this["break"]||(l?o.to<h:o.from>h))return o;var u=e==rr.ByPosNoHeight?rr.ByPosNoHeight:rr.ByPos;return l?o.join(this.right.lineAt(h,u,i,n,h)):this.left.lineAt(h,u,i,s,r).join(o);}},{key:"forEachLine",value:function forEachLine(t,e,i,s,r,n){var h=s+this.left.height,l=r+this.left.length+this["break"];if(this["break"])t<l&&this.left.forEachLine(t,e,i,s,r,n),e>=l&&this.right.forEachLine(t,e,i,h,l,n);else{var _o28=this.lineAt(l,rr.ByPos,i,s,r);t<_o28.from&&this.left.forEachLine(t,_o28.from-1,i,s,r,n),_o28.to>=t&&_o28.from<=e&&n(_o28),e>_o28.to&&this.right.forEachLine(_o28.to+1,e,i,h,l,n);}}},{key:"replace",value:function replace(t,e,i){var s=this.left.length+this["break"];if(e<s)return this.balanced(this.left.replace(t,e,i),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-s,e-s,i));var r=[];t>0&&this.decomposeLeft(t,r);var n=r.length;var _iterator57=_createForOfIteratorHelper(i),_step57;try{for(_iterator57.s();!(_step57=_iterator57.n()).done;){var _t121=_step57.value;r.push(_t121);}}catch(err){_iterator57.e(err);}finally{_iterator57.f();}if(t>0&&ar(r,n-1),e<this.length){var _t120=r.length;this.decomposeRight(e,r),ar(r,_t120);}return hr.of(r);}},{key:"decomposeLeft",value:function decomposeLeft(t,e){var i=this.left.length;if(t<=i)return this.left.decomposeLeft(t,e);e.push(this.left),this["break"]&&(i++,t>=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e);}},{key:"decomposeRight",value:function decomposeRight(t,e){var i=this.left.length,s=i+this["break"];if(t>=s)return this.right.decomposeRight(t-s,e);t<i&&this.left.decomposeRight(t,e),this["break"]&&t<s&&e.push(null),e.push(this.right);}},{key:"balanced",value:function balanced(t,e){return t.size>2*e.size||e.size>2*t.size?hr.of(this["break"]?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this["break"]+e.length,this);}},{key:"updateHeight",value:function updateHeight(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=arguments.length>3?arguments[3]:undefined;var r=this.left,n=this.right,h=e+r.length+this["break"],l=null;return s&&s.from<=e+r.length&&s.more?l=r=r.updateHeight(t,e,i,s):r.updateHeight(t,e,i),s&&s.from<=h+n.length&&s.more?l=n=n.updateHeight(t,h,i,s):n.updateHeight(t,h,i),l?this.balanced(r,n):(this.height=this.left.height+this.right.height,this.outdated=!1,this);}},{key:"toString",value:function toString(){return this.left+(this["break"]?" ":"-")+this.right;}}]);}(hr);cr=/*#__PURE__*/function(){function cr(t,e){_classCallCheck(this,cr);this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t;}return _createClass(cr,[{key:"isCovered",get:function get(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering;}},{key:"span",value:function span(t,e){if(this.lineStart>-1){var _t122=Math.min(e,this.lineEnd),_i95=this.nodes[this.nodes.length-1];_i95 instanceof or?_i95.length+=_t122-this.pos:(_t122>this.pos||!this.isCovered)&&this.nodes.push(new or(_t122-this.pos,-1)),this.writtenTo=_t122,e>_t122&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1);}this.pos=e;}},{key:"point",value:function point(t,e,i){if(t<e||i.heightRelevant){var _s84=i.widget?i.widget.estimatedHeight:0,_r70=i.widget?i.widget.lineBreaks:0;_s84<0&&(_s84=this.oracle.lineHeight);var _n64=e-t;i.block?this.addBlock(new lr(_n64,_s84,i)):(_n64||_r70||_s84>=5)&&this.addLineDeco(_s84,_r70,_n64);}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to);}},{key:"enterLine",value:function enterLine(){if(this.lineStart>-1)return;var _this$oracle$doc$line=this.oracle.doc.lineAt(this.pos),t=_this$oracle$doc$line.from,e=_this$oracle$doc$line.to;this.lineStart=t,this.lineEnd=e,this.writtenTo<t&&((this.writtenTo<t-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,t-1)),this.nodes.push(null)),this.pos>t&&this.nodes.push(new or(this.pos-t,-1)),this.writtenTo=this.pos;}},{key:"blankContent",value:function blankContent(t,e){var i=new ur(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i;}},{key:"ensureLine",value:function ensureLine(){this.enterLine();var t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof or)return t;var e=new or(0,-1);return this.nodes.push(e),e;}},{key:"addBlock",value:function addBlock(t){this.enterLine();var e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t);}},{key:"addLineDeco",value:function addLineDeco(t,e,i){var s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,t),s.breaks+=e,this.writtenTo=this.pos=this.pos+i;}},{key:"finish",value:function finish(t){var e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof or||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new or(0,-1));var i=t;var _iterator58=_createForOfIteratorHelper(this.nodes),_step58;try{for(_iterator58.s();!(_step58=_iterator58.n()).done;){var _t123=_step58.value;_t123 instanceof or&&_t123.updateHeight(this.oracle,i),i+=_t123?_t123.length:1;}}catch(err){_iterator58.e(err);}finally{_iterator58.f();}return this.nodes;}}],[{key:"build",value:function build(t,e,i,s){var r=new cr(i,t);return It.spans(e,i,s,r,0),r.finish(i);}}]);}();dr=/*#__PURE__*/function(){function dr(){_classCallCheck(this,dr);this.changes=[];}return _createClass(dr,[{key:"compareRange",value:function compareRange(){}},{key:"comparePoint",value:function comparePoint(t,e,i,s){(t<e||i&&i.heightRelevant||s&&s.heightRelevant)&&fi(t,e,this.changes,5);}}]);}();gr=/*#__PURE__*/function(){function gr(t,e,i){_classCallCheck(this,gr);this.from=t,this.to=e,this.size=i;}return _createClass(gr,[{key:"draw",value:function draw(t,e){return ni.replace({widget:new wr(this.size*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to);}}],[{key:"same",value:function same(t,e){if(t.length!=e.length)return!1;for(var _i97=0;_i97<t.length;_i97++){var _s87=t[_i97],_r71=e[_i97];if(_s87.from!=_r71.from||_s87.to!=_r71.to||_s87.size!=_r71.size)return!1;}return!0;}}]);}();wr=/*#__PURE__*/function(_si3){function wr(t,e){var _this32;_classCallCheck(this,wr);_this32=_callSuper(this,wr),_this32.size=t,_this32.vertical=e;return _this32;}_inherits(wr,_si3);return _createClass(wr,[{key:"eq",value:function eq(t){return t.size==this.size&&t.vertical==this.vertical;}},{key:"toDOM",value:function toDOM(){var t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t;}},{key:"estimatedHeight",get:function get(){return this.vertical?this.size:-1;}}]);}(si);br=/*#__PURE__*/function(){function br(e){var _this33=this;_classCallCheck(this,br);this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=xr,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=pi.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;var i=e.facet(Qi).some(function(t){return"function"!=typeof t&&"cm-lineWrapping"==t["class"];});this.heightOracle=new er(i),this.stateDeco=e.facet(Zi).filter(function(t){return"function"!=typeof t;}),this.heightMap=hr.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new ls(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ni.set(this.lineGaps.map(function(t){return t.draw(_this33,!1);})),this.computeVisibleRanges();}return _createClass(br,[{key:"updateForViewport",value:function updateForViewport(){var _this34=this;var t=[this.viewport],e=this.state.selection.main;var _loop7=function _loop7(){var s=_i98?e.head:e.anchor;if(!t.some(function(_ref8){var t=_ref8.from,e=_ref8.to;return s>=t&&s<=e;})){var _this34$lineBlockAt=_this34.lineBlockAt(s),_e111=_this34$lineBlockAt.from,_i99=_this34$lineBlockAt.to;t.push(new vr(_e111,_i99));}};for(var _i98=0;_i98<=1;_i98++){_loop7();}this.viewports=t.sort(function(t,e){return t.from-e.from;}),this.scaler=this.heightMap.height<=7e6?xr:new Sr(this.heightOracle,this.heightMap,this.viewports);}},{key:"updateViewportLines",value:function updateViewportLines(){var _this35=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,function(t){_this35.viewportLines.push(1==_this35.scaler.scale?t:Ar(t,_this35.scaler));});}},{key:"update",value:function update(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;this.state=t.state;var i=this.stateDeco;this.stateDeco=this.state.facet(Zi).filter(function(t){return"function"!=typeof t;});var s=t.changedRanges,r=ls.extendWithRanges(s,function(t,e,i){var s=new dr();return It.compare(t,e,i,s,0),s.changes;}(i,this.stateDeco,t?t.changes:A.empty(this.state.doc.length))),n=this.heightMap.height,h=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=n&&(t.flags|=2),h?(this.scrollAnchorPos=t.changes.mapPos(h.from,-1),this.scrollAnchorHeight=h.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);var l=r.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<l.from||e.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));var o=!t.changes.empty||2&t.flags||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),o&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(Wi)&&(this.mustEnforceCursorAssoc=!0);}},{key:"measure",value:function measure(e){var i=e.contentDOM,s=window.getComputedStyle(i),r=this.heightOracle,n=s.whiteSpace;this.defaultTextDirection="rtl"==s.direction?pi.RTL:pi.LTR;var h=this.heightOracle.mustRefreshForWrapping(n),l=i.getBoundingClientRect(),o=h||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;var u=0,f=0;if(l.width&&l.height){var _de2=de(i,l),_t124=_de2.scaleX,_e112=_de2.scaleY;(_t124>.005&&Math.abs(this.scaleX-_t124)>.005||_e112>.005&&Math.abs(this.scaleY-_e112)>.005)&&(this.scaleX=_t124,this.scaleY=_e112,u|=8,h=o=!0);}var a=(parseInt(s.paddingTop)||0)*this.scaleY,c=(parseInt(s.paddingBottom)||0)*this.scaleY;this.paddingTop==a&&this.paddingBottom==c||(this.paddingTop=a,this.paddingBottom=c,u|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(o=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=8);var d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=ye(e.scrollDOM);var p=(this.printing?mr:pr)(i,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;var w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(o=!0)),!this.inView&&!this.scrollTarget)return 0;var b=l.width;if(this.contentDOMWidth==b&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,u|=8),o){var _i100=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(_i100)&&(h=!0),h||r.lineWrapping&&Math.abs(b-this.contentDOMWidth)>r.charWidth){var _e$docView$measureTex=e.docView.measureTextSize(),_t125=_e$docView$measureTex.lineHeight,_s88=_e$docView$measureTex.charWidth,_l35=_e$docView$measureTex.textHeight;h=_t125>0&&r.refresh(n,_t125,_s88,_l35,b/_s88,_i100),h&&(e.docView.minWidth=0,u|=8);}m>0&&g>0?f=Math.max(m,g):m<0&&g<0&&(f=Math.min(m,g)),r.heightChanged=!1;var _iterator59=_createForOfIteratorHelper(this.viewports),_step59;try{for(_iterator59.s();!(_step59=_iterator59.n()).done;){var _s89=_step59.value;var _n65=_s89.from==this.viewport.from?_i100:e.docView.measureVisibleLineHeights(_s89);this.heightMap=(h?hr.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle,[new ls(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,h,new ir(_s89.from,_n65));}}catch(err){_iterator59.e(err);}finally{_iterator59.f();}r.heightChanged&&(u|=2);}var v=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return v&&(this.viewport=this.getViewport(f,this.scrollTarget)),this.updateForViewport(),(2&u||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(h?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u;}},{key:"visibleTop",get:function get(){return this.scaler.fromDOM(this.pixelViewport.top);}},{key:"visibleBottom",get:function get(){return this.scaler.fromDOM(this.pixelViewport.bottom);}},{key:"getViewport",value:function getViewport(t,e){var i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,r=this.heightOracle,n=this.visibleTop,h=this.visibleBottom,l=new vr(s.lineAt(n-1e3*i,rr.ByHeight,r,0,0).from,s.lineAt(h+1e3*(1-i),rr.ByHeight,r,0,0).to);if(e){var _t126=e.range.head;if(_t126<l.from||_t126>l.to){var _i101,_n66=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),_h36=s.lineAt(_t126,rr.ByPos,r,0,0);_i101="center"==e.y?(_h36.top+_h36.bottom)/2-_n66/2:"start"==e.y||"nearest"==e.y&&_t126<l.from?_h36.top:_h36.bottom-_n66,l=new vr(s.lineAt(_i101-500,rr.ByHeight,r,0,0).from,s.lineAt(_i101+_n66+500,rr.ByHeight,r,0,0).to);}}return l;}},{key:"mapViewport",value:function mapViewport(t,e){var i=e.mapPos(t.from,-1),s=e.mapPos(t.to,1);return new vr(this.heightMap.lineAt(i,rr.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,rr.ByPos,this.heightOracle,0,0).to);}},{key:"viewportIsAppropriate",value:function viewportIsAppropriate(_ref9){var t=_ref9.from,e=_ref9.to;var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(!this.inView)return!0;var _this$heightMap$lineA=this.heightMap.lineAt(t,rr.ByPos,this.heightOracle,0,0),s=_this$heightMap$lineA.top,_this$heightMap$lineA2=this.heightMap.lineAt(e,rr.ByPos,this.heightOracle,0,0),r=_this$heightMap$lineA2.bottom,n=this.visibleTop,h=this.visibleBottom;return(0==t||s<=n-Math.max(10,Math.min(-i,250)))&&(e==this.state.doc.length||r>=h+Math.max(10,Math.min(i,250)))&&s>n-2e3&&r<h+2e3;}},{key:"mapLineGaps",value:function mapLineGaps(t,e){if(!t.length||e.empty)return t;var i=[];var _iterator60=_createForOfIteratorHelper(t),_step60;try{for(_iterator60.s();!(_step60=_iterator60.n()).done;){var _s90=_step60.value;e.touchesRange(_s90.from,_s90.to)||i.push(new gr(e.mapPos(_s90.from),e.mapPos(_s90.to),_s90.size));}}catch(err){_iterator60.e(err);}finally{_iterator60.f();}return i;}},{key:"ensureLineGaps",value:function ensureLineGaps(t,e){var _this36=this;var i=this.heightOracle.lineWrapping,s=i?1e4:2e3,r=s>>1,n=s<<1;if(this.defaultTextDirection!=pi.LTR&&!i)return[];var h=[],l=function l(s,n,o,u){if(n-s<r)return;var f=_this36.state.selection.main,a=[f.from];f.empty||a.push(f.to);for(var _i102=0,_a11=a;_i102<_a11.length;_i102++){var _t127=_a11[_i102];if(_t127>s&&_t127<n)return l(s,_t127-10,o,u),void l(_t127+10,n,o,u);}var c=function(t,e){var _iterator61=_createForOfIteratorHelper(t),_step61;try{for(_iterator61.s();!(_step61=_iterator61.n()).done;){var _i103=_step61.value;if(e(_i103))return _i103;}}catch(err){_iterator61.e(err);}finally{_iterator61.f();}return;}(t,function(t){return t.from>=o.from&&t.to<=o.to&&Math.abs(t.from-s)<r&&Math.abs(t.to-n)<r&&!a.some(function(e){return t.from<e&&t.to>e;});});if(!c){if(n<o.to&&e&&i&&e.visibleRanges.some(function(t){return t.from<=n&&t.to>=n;})){var _t128=e.moveToLineBoundary(B.cursor(n),!1,!0).head;_t128>s&&(n=_t128);}c=new gr(s,n,_this36.gapSize(o,s,n,u));}h.push(c);};var _iterator62=_createForOfIteratorHelper(this.viewportLines),_step62;try{for(_iterator62.s();!(_step62=_iterator62.n()).done;){var _t129=_step62.value;if(_t129.length<n)continue;var _e113=kr(_t129.from,_t129.to,this.stateDeco);if(_e113.total<n)continue;var _r72=void 0,_h37=void 0,_o29=this.scrollTarget?this.scrollTarget.range.head:null;if(i){var _i104=void 0,_n67=void 0,_l36=s/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=_o29){var _s91=Mr(_e113,_o29),_r73=((this.visibleBottom-this.visibleTop)/2+_l36)/_t129.height;_i104=_s91-_r73,_n67=_s91+_r73;}else _i104=(this.visibleTop-_t129.top-_l36)/_t129.height,_n67=(this.visibleBottom-_t129.top+_l36)/_t129.height;_r72=yr(_e113,_i104),_h37=yr(_e113,_n67);}else{var _t130=void 0,_i105=void 0,_n68=_e113.total*this.heightOracle.charWidth,_l37=s*this.heightOracle.charWidth;if(null!=_o29){var _s92=Mr(_e113,_o29),_r74=((this.pixelViewport.right-this.pixelViewport.left)/2+_l37)/_n68;_t130=_s92-_r74,_i105=_s92+_r74;}else _t130=(this.pixelViewport.left-_l37)/_n68,_i105=(this.pixelViewport.right+_l37)/_n68;_r72=yr(_e113,_t130),_h37=yr(_e113,_i105);}_r72>_t129.from&&l(_t129.from,_r72,_t129,_e113),_h37<_t129.to&&l(_h37,_t129.to,_t129,_e113);}}catch(err){_iterator62.e(err);}finally{_iterator62.f();}return h;}},{key:"gapSize",value:function gapSize(t,e,i,s){var r=Mr(s,i)-Mr(s,e);return this.heightOracle.lineWrapping?t.height*r:s.total*this.heightOracle.charWidth*r;}},{key:"updateLineGaps",value:function updateLineGaps(t){var _this37=this;gr.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=ni.set(t.map(function(t){return t.draw(_this37,_this37.heightOracle.lineWrapping);})));}},{key:"computeVisibleRanges",value:function computeVisibleRanges(){var t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));var e=[];It.spans(t,this.viewport.from,this.viewport.to,{span:function span(t,i){e.push({from:t,to:i});},point:function point(){}},20);var i=e.length!=this.visibleRanges.length||this.visibleRanges.some(function(t,i){return t.from!=e[i].from||t.to!=e[i].to;});return this.visibleRanges=e,i?4:0;}},{key:"lineBlockAt",value:function lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(function(e){return e.from<=t&&e.to>=t;})||Ar(this.heightMap.lineAt(t,rr.ByPos,this.heightOracle,0,0),this.scaler);}},{key:"lineBlockAtHeight",value:function lineBlockAtHeight(t){return Ar(this.heightMap.lineAt(this.scaler.fromDOM(t),rr.ByHeight,this.heightOracle,0,0),this.scaler);}},{key:"scrollAnchorAt",value:function scrollAnchorAt(t){var e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0];}},{key:"elementAtHeight",value:function elementAtHeight(t){return Ar(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler);}},{key:"docHeight",get:function get(){return this.scaler.toDOM(this.heightMap.height);}},{key:"contentHeight",get:function get(){return this.docHeight+this.paddingTop+this.paddingBottom;}}]);}();vr=/*#__PURE__*/_createClass(function vr(t,e){_classCallCheck(this,vr);this.from=t,this.to=e;});xr={toDOM:function toDOM(t){return t;},fromDOM:function fromDOM(t){return t;},scale:1};Sr=/*#__PURE__*/function(){function Sr(t,e,i){_classCallCheck(this,Sr);var s=0,r=0,n=0;this.viewports=i.map(function(_ref11){var i=_ref11.from,r=_ref11.to;var n=e.lineAt(i,rr.ByPos,t,0,0).top,h=e.lineAt(r,rr.ByPos,t,0,0).bottom;return s+=h-n,{from:i,to:r,top:n,bottom:h,domTop:0,domBottom:0};}),this.scale=(7e6-s)/(e.height-s);var _iterator64=_createForOfIteratorHelper(this.viewports),_step64;try{for(_iterator64.s();!(_step64=_iterator64.n()).done;){var _t132=_step64.value;_t132.domTop=n+(_t132.top-r)*this.scale,n=_t132.domBottom=_t132.domTop+(_t132.bottom-_t132.top),r=_t132.bottom;}}catch(err){_iterator64.e(err);}finally{_iterator64.f();}}return _createClass(Sr,[{key:"toDOM",value:function toDOM(t){for(var _e114=0,_i107=0,_s94=0;;_e114++){var _r77=_e114<this.viewports.length?this.viewports[_e114]:null;if(!_r77||t<_r77.top)return _s94+(t-_i107)*this.scale;if(t<=_r77.bottom)return _r77.domTop+(t-_r77.top);_i107=_r77.bottom,_s94=_r77.domBottom;}}},{key:"fromDOM",value:function fromDOM(t){for(var _e115=0,_i108=0,_s95=0;;_e115++){var _r78=_e115<this.viewports.length?this.viewports[_e115]:null;if(!_r78||t<_r78.domTop)return _i108+(t-_s95)/this.scale;if(t<=_r78.domBottom)return _r78.top+(t-_r78.domTop);_i108=_r78.bottom,_s95=_r78.domBottom;}}}]);}();Cr=j.define({combine:function combine(t){return t.join(" ");}});Or=j.define({combine:function combine(t){return t.indexOf(!0)>-1;}});Dr=Gt.newName();Er=Gt.newName();Ir=Gt.newName();Rr={"&light":"."+Er,"&dark":"."+Ir};Br=Tr("."+Dr,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Rr);Lr="";Nr=/*#__PURE__*/function(){function Nr(t,e){_classCallCheck(this,Nr);this.points=t,this.text="",this.lineSeparator=e.facet(St.lineSeparator);}return _createClass(Nr,[{key:"append",value:function append(t){this.text+=t;}},{key:"lineBreak",value:function lineBreak(){this.text+=Lr;}},{key:"readRange",value:function readRange(t,e){if(!t)return this;var i=t.parentNode;for(var _s96=t;;){this.findPointBefore(i,_s96);var _t133=this.text.length;this.readNode(_s96);var _r79=_s96.nextSibling;if(_r79==e)break;var _n70=Ce.get(_s96),_h38=Ce.get(_r79);(_n70&&_h38?_n70.breakAfter:(_n70?_n70.breakAfter:oe(_s96))||oe(_r79)&&("BR"!=_s96.nodeName||_s96.cmIgnore)&&this.text.length>_t133)&&this.lineBreak(),_s96=_r79;}return this.findPointBefore(i,e),this;}},{key:"readTextNode",value:function readTextNode(t){var e=t.nodeValue;var _iterator65=_createForOfIteratorHelper(this.points),_step65;try{for(_iterator65.s();!(_step65=_iterator65.n()).done;){var _i110=_step65.value;_i110.node==t&&(_i110.pos=this.text.length+Math.min(_i110.offset,e.length));}}catch(err){_iterator65.e(err);}finally{_iterator65.f();}for(var _i109=0,_s97=this.lineSeparator?null:/\r\n?|\n/g;;){var _r80=void 0,_n71=-1,_h39=1;if(this.lineSeparator?(_n71=e.indexOf(this.lineSeparator,_i109),_h39=this.lineSeparator.length):(_r80=_s97.exec(e))&&(_n71=_r80.index,_h39=_r80[0].length),this.append(e.slice(_i109,_n71<0?e.length:_n71)),_n71<0)break;if(this.lineBreak(),_h39>1){var _iterator66=_createForOfIteratorHelper(this.points),_step66;try{for(_iterator66.s();!(_step66=_iterator66.n()).done;){var _e116=_step66.value;_e116.node==t&&_e116.pos>this.text.length&&(_e116.pos-=_h39-1);}}catch(err){_iterator66.e(err);}finally{_iterator66.f();}}_i109=_n71+_h39;}}},{key:"readNode",value:function readNode(t){if(t.cmIgnore)return;var e=Ce.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(var _t134=i.iter();!_t134.next().done;)_t134.lineBreak?this.lineBreak():this.append(_t134.value);}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null);}},{key:"findPointBefore",value:function findPointBefore(t,e){var _iterator67=_createForOfIteratorHelper(this.points),_step67;try{for(_iterator67.s();!(_step67=_iterator67.n()).done;){var _i111=_step67.value;_i111.node==t&&t.childNodes[_i111.offset]==e&&(_i111.pos=this.text.length);}}catch(err){_iterator67.e(err);}finally{_iterator67.f();}}},{key:"findPointInside",value:function findPointInside(t,e){var _iterator68=_createForOfIteratorHelper(this.points),_step68;try{for(_iterator68.s();!(_step68=_iterator68.n()).done;){var _i112=_step68.value;(3==t.nodeType?_i112.node==t:t.contains(_i112.node))&&(_i112.pos=this.text.length+(jr(t,_i112.node,_i112.offset)?e:0));}}catch(err){_iterator68.e(err);}finally{_iterator68.f();}}}]);}();$r=/*#__PURE__*/_createClass(function $r(t,e){_classCallCheck(this,$r);this.node=t,this.offset=e,this.pos=-1;});zr=/*#__PURE__*/_createClass(function zr(t,e,i,s){_classCallCheck(this,zr);this.typeOver=s,this.bounds=null,this.text="";var _t$docView=t.docView,r=_t$docView.impreciseHead,n=_t$docView.impreciseAnchor;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){var _e117=r||n?[]:function(t){var e=[];if(t.root.activeElement!=t.contentDOM)return e;var _t$observer$selection2=t.observer.selectionRange,i=_t$observer$selection2.anchorNode,s=_t$observer$selection2.anchorOffset,r=_t$observer$selection2.focusNode,n=_t$observer$selection2.focusOffset;i&&(e.push(new $r(i,s)),r==i&&n==s||e.push(new $r(r,n)));return e;}(t),_i113=new Nr(_e117,t.state);_i113.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=_i113.text,this.newSel=function(t,e){if(0==t.length)return null;var i=t[0].pos,s=2==t.length?t[1].pos:i;return i>-1&&s>-1?B.single(i+e,s+e):null;}(_e117,this.bounds.from);}else{var _e118=t.observer.selectionRange,_i114=r&&r.node==_e118.focusNode&&r.offset==_e118.focusOffset||!se(t.contentDOM,_e118.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(_e118.focusNode,_e118.focusOffset),_s98=n&&n.node==_e118.anchorNode&&n.offset==_e118.anchorOffset||!se(t.contentDOM,_e118.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(_e118.anchorNode,_e118.anchorOffset),_h40=t.viewport;if((Ve.ios||Ve.chrome)&&t.state.selection.main.empty&&_i114!=_s98&&(_h40.from>0||_h40.to<t.state.doc.length)){var _e119=Math.min(_i114,_s98),_r81=Math.max(_i114,_s98),_n72=_h40.from-_e119,_l38=_h40.to-_r81;0!=_n72&&1!=_n72&&0!=_e119||0!=_l38&&-1!=_l38&&_r81!=t.state.doc.length||(_i114=0,_s98=t.state.doc.length);}this.newSel=B.single(_s98,_i114);}});Hr={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0};Wr=Ve.ie&&Ve.ie_version<=11;Vr=/*#__PURE__*/function(){function Vr(t){var _this38=this;_classCallCheck(this,Vr);this.view=t,this.active=!1,this.selectionRange=new pe(),this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(function(e){var _iterator69=_createForOfIteratorHelper(e),_step69;try{for(_iterator69.s();!(_step69=_iterator69.n()).done;){var _t138=_step69.value;_this38.queue.push(_t138);}}catch(err){_iterator69.e(err);}finally{_iterator69.f();}(Ve.ie&&Ve.ie_version<=11||Ve.ios&&t.composing)&&e.some(function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length;})?_this38.flushSoon():_this38.flush();}),Wr&&(this.onCharData=function(t){_this38.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),_this38.flushSoon();}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(function(){var t;(null===(t=_this38.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&_this38.onResize();}),this.resizeScroll.observe(t.scrollDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(function(t){_this38.parentCheck<0&&(_this38.parentCheck=setTimeout(_this38.listenForScroll.bind(_this38),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=_this38.intersecting&&(_this38.intersecting=!_this38.intersecting,_this38.intersecting!=_this38.view.inView&&_this38.onScrollChanged(document.createEvent("Event")));},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(function(t){t.length>0&&t[t.length-1].intersectionRatio>0&&_this38.onScrollChanged(document.createEvent("Event"));},{})),this.listenForScroll(),this.readSelectionRange();}return _createClass(Vr,[{key:"onScrollChanged",value:function onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure();}},{key:"onScroll",value:function onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t);}},{key:"onResize",value:function onResize(){var _this39=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(function(){_this39.resizeTimeout=-1,_this39.view.requestMeasure();},50));}},{key:"onPrint",value:function onPrint(t){var _this40=this;("change"!=t.type||t.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(function(){_this40.view.viewState.printing=!1,_this40.view.requestMeasure();},500));}},{key:"updateGaps",value:function updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some(function(e,i){return e!=t[i];}))){this.gapIntersection.disconnect();var _iterator70=_createForOfIteratorHelper(t),_step70;try{for(_iterator70.s();!(_step70=_iterator70.n()).done;){var _e120=_step70.value;this.gapIntersection.observe(_e120);}}catch(err){_iterator70.e(err);}finally{_iterator70.f();}this.gaps=t;}}},{key:"onSelectionChange",value:function onSelectionChange(t){var e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;var i=this.view,s=this.selectionRange;if(i.state.facet(Ji)?i.root.activeElement!=this.dom:!re(i.dom,s))return;var r=s.anchorNode&&i.docView.nearest(s.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(Ve.ie&&Ve.ie_version<=11||Ve.android&&Ve.chrome)&&!i.state.selection.main.empty&&s.focusNode&&he(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1);}},{key:"readSelectionRange",value:function readSelectionRange(){var t=this.view,e=ie(t.root);if(!e)return!1;var i=Ve.safari&&11==t.root.nodeType&&function(t){var e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e;}(this.dom.ownerDocument)==this.dom&&function(t,e){if(e.getComposedRanges){var _i118=e.getComposedRanges(t.root)[0];if(_i118)return qr(t,_i118);}var i=null;function s(t){t.preventDefault(),t.stopImmediatePropagation(),i=t.getTargetRanges()[0];}return t.contentDOM.addEventListener("beforeinput",s,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",s,!0),i?qr(t,i):null;}(this.view,e)||e;if(!i||this.selectionRange.eq(i))return!1;var s=re(this.dom,i);return s&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){var i=e.focusNode,s=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=s)return!1;for(s=Math.min(s,fe(i));;)if(s){if(1!=i.nodeType)return!1;var _t139=i.childNodes[s-1];"false"==_t139.contentEditable?s--:(i=_t139,s=fe(i));}else{if(i==t)return!0;s=le(i),i=i.parentNode;}}(this.dom,i)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(i),s&&(this.selectionChanged=!0),!0);}},{key:"setSelectionRange",value:function setSelectionRange(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1;}},{key:"clearSelectionRange",value:function clearSelectionRange(){this.selectionRange.set(null,0,null,0);}},{key:"listenForScroll",value:function listenForScroll(){this.parentCheck=-1;var t=0,e=null;for(var _i119=this.dom;_i119;)if(1==_i119.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==_i119?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(_i119),_i119=_i119.assignedSlot||_i119.parentNode;else{if(11!=_i119.nodeType)break;_i119=_i119.host;}if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){var _iterator71=_createForOfIteratorHelper(this.scrollTargets),_step71;try{for(_iterator71.s();!(_step71=_iterator71.n()).done;){var _t140=_step71.value;_t140.removeEventListener("scroll",this.onScroll);}}catch(err){_iterator71.e(err);}finally{_iterator71.f();}var _iterator72=_createForOfIteratorHelper(this.scrollTargets=e),_step72;try{for(_iterator72.s();!(_step72=_iterator72.n()).done;){var _t141=_step72.value;_t141.addEventListener("scroll",this.onScroll);}}catch(err){_iterator72.e(err);}finally{_iterator72.f();}}}},{key:"ignore",value:function ignore(t){if(!this.active)return t();try{return this.stop(),t();}finally{this.start(),this.clear();}}},{key:"start",value:function start(){this.active||(this.observer.observe(this.dom,Hr),Wr&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0);}},{key:"stop",value:function stop(){this.active&&(this.active=!1,this.observer.disconnect(),Wr&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData));}},{key:"clear",value:function clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1;}},{key:"delayAndroidKey",value:function delayAndroidKey(t,e){var _this41=this;var i;if(!this.delayedAndroidKey){var _t142=function _t142(){var t=_this41.delayedAndroidKey;if(t){_this41.clearDelayedAndroidKey(),_this41.view.inputState.lastKeyCode=t.keyCode,_this41.view.inputState.lastKeyTime=Date.now(),!_this41.flush()&&t.force&&ve(_this41.dom,t.key,t.keyCode);}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(_t142);}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(null===(i=this.delayedAndroidKey)||void 0===i?void 0:i.force)});}},{key:"clearDelayedAndroidKey",value:function clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1;}},{key:"flushSoon",value:function flushSoon(){var _this42=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(function(){_this42.delayedFlush=-1,_this42.flush();}));}},{key:"forceFlush",value:function forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush();}},{key:"pendingRecords",value:function pendingRecords(){var _iterator73=_createForOfIteratorHelper(this.observer.takeRecords()),_step73;try{for(_iterator73.s();!(_step73=_iterator73.n()).done;){var _t143=_step73.value;this.queue.push(_t143);}}catch(err){_iterator73.e(err);}finally{_iterator73.f();}return this.queue;}},{key:"processRecords",value:function processRecords(){var t=this.pendingRecords();t.length&&(this.queue=[]);var e=-1,i=-1,s=!1;var _iterator74=_createForOfIteratorHelper(t),_step74;try{for(_iterator74.s();!(_step74=_iterator74.n()).done;){var _t145;var _r83=_step74.value;var _t144=this.readMutation(_r83);_t144&&(_t144.typeOver&&(s=!0),-1==e?(_t145=_t144,e=_t145.from,i=_t145.to,_t145):(e=Math.min(_t144.from,e),i=Math.max(_t144.to,i)));}}catch(err){_iterator74.e(err);}finally{_iterator74.f();}return{from:e,to:i,typeOver:s};}},{key:"readChange",value:function readChange(){var _this$processRecords=this.processRecords(),t=_this$processRecords.from,e=_this$processRecords.to,i=_this$processRecords.typeOver,s=this.selectionChanged&&re(this.dom,this.selectionRange);if(t<0&&!s)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;var r=new zr(this.view,t,e,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r;}},{key:"flush",value:function flush(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();var e=this.readChange();if(!e)return this.view.requestMeasure(),!1;var i=this.view.state,s=Pr(this.view,e);return this.view.state==i&&this.view.update([]),s;}},{key:"readMutation",value:function readMutation(t){var e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){var _i120=Fr(e,t.previousSibling||t.target.previousSibling,-1),_s99=Fr(e,t.nextSibling||t.target.nextSibling,1);return{from:_i120?e.posAfter(_i120):e.posAtStart,to:_s99?e.posBefore(_s99):e.posAtEnd,typeOver:!1};}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null;}},{key:"setWindow",value:function setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win));}},{key:"addWindowListeners",value:function addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange);}},{key:"removeWindowListeners",value:function removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange);}},{key:"destroy",value:function destroy(){var t,e,i;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect();var _iterator75=_createForOfIteratorHelper(this.scrollTargets),_step75;try{for(_iterator75.s();!(_step75=_iterator75.n()).done;){var _t146=_step75.value;_t146.removeEventListener("scroll",this.onScroll);}}catch(err){_iterator75.e(err);}finally{_iterator75.f();}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey);}}]);}();_export("E",Ur=/*#__PURE__*/function(){function Ur(){var _this43=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,Ur);this.plugins=[],this.pluginMap=new Map(),this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);var e=t.dispatch;this.dispatchTransactions=t.dispatchTransactions||e&&function(t){return t.forEach(function(t){return e(t,_this43);});}||function(t){return _this43.update(t);},this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode;}return null;}(t.parent)||document,this.viewState=new br(t.state||St.create(t)),t.scrollTo&&t.scrollTo.is(qi)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ki).map(function(t){return new Xi(t);});var _iterator76=_createForOfIteratorHelper(this.plugins),_step76;try{for(_iterator76.s();!(_step76=_iterator76.n()).done;){var _t147=_step76.value;_t147.update(this);}}catch(err){_iterator76.e(err);}finally{_iterator76.f();}this.observer=new Vr(this),this.inputState=new Cs(this),this.inputState.ensureHandlers(this.plugins),this.docView=new us(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure();}return _createClass(Ur,[{key:"state",get:function get(){return this.viewState.state;}},{key:"viewport",get:function get(){return this.viewState.viewport;}},{key:"visibleRanges",get:function get(){return this.viewState.visibleRanges;}},{key:"inView",get:function get(){return this.viewState.inView;}},{key:"composing",get:function get(){return this.inputState.composing>0;}},{key:"compositionStarted",get:function get(){return this.inputState.composing>=0;}},{key:"root",get:function get(){return this._root;}},{key:"win",get:function get(){return this.dom.ownerDocument.defaultView||window;}},{key:"dispatch",value:function dispatch(){var _this$state;for(var _len3=arguments.length,t=new Array(_len3),_key3=0;_key3<_len3;_key3++){t[_key3]=arguments[_key3];}var e=1==t.length&&t[0]instanceof dt?t:1==t.length&&Array.isArray(t[0])?t[0]:[(_this$state=this.state).update.apply(_this$state,t)];this.dispatchTransactions(e,this);}},{key:"update",value:function update(t){var _this44=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");var e,i=!1,s=!1,r=this.state;var _iterator77=_createForOfIteratorHelper(t),_step77;try{for(_iterator77.s();!(_step77=_iterator77.n()).done;){var _e122=_step77.value;if(_e122.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=_e122.state;}}catch(err){_iterator77.e(err);}finally{_iterator77.f();}if(this.destroyed)return void(this.viewState.state=r);var n=this.hasFocus,h=0,l=null;t.some(function(t){return t.annotation(Xs);})?(this.inputState.notifiedFocused=n,h=1):n!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=n,l=Ys(r,n),l||(h=1));var o=this.observer.delayedAndroidKey,u=null;if(o?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(u=null)):this.observer.clear(),r.facet(St.phrases)!=this.state.facet(St.phrases))return this.setState(r);e=os.create(this,r,t),e.flags|=h;var f=this.viewState.scrollTarget;try{this.updateState=2;var _iterator78=_createForOfIteratorHelper(t),_step78;try{for(_iterator78.s();!(_step78=_iterator78.n()).done;){var _e121=_step78.value;if(f&&(f=f.map(_e121.changes)),_e121.scrollIntoView){var _t148=_e121.state.selection.main;f=new Fi(_t148.empty?_t148:B.cursor(_t148.head,_t148.head>_t148.anchor?-1:1));}var _iterator79=_createForOfIteratorHelper(_e121.effects),_step79;try{for(_iterator79.s();!(_step79=_iterator79.n()).done;){var _t149=_step79.value;_t149.is(qi)&&(f=_t149.value.clip(this.state));}}catch(err){_iterator79.e(err);}finally{_iterator79.f();}}}catch(err){_iterator78.e(err);}finally{_iterator78.f();}this.viewState.update(e,f),this.bidiCache=Kr.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(hs)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(i,t.some(function(t){return t.isUserEvent("select.pointer");}));}finally{this.updateState=0;}if(e.startState.facet(Cr)!=e.state.facet(Cr)&&(this.viewState.mustMeasureContent=!0),(i||s||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),i&&this.docViewUpdate(),!e.empty){var _iterator80=_createForOfIteratorHelper(this.state.facet($i)),_step80;try{for(_iterator80.s();!(_step80=_iterator80.n()).done;){var _t150=_step80.value;try{_t150(e);}catch(t){Ui(this.state,t,"update listener");}}}catch(err){_iterator80.e(err);}finally{_iterator80.f();}}(l||u)&&Promise.resolve().then(function(){l&&_this44.state==l.startState&&_this44.dispatch(l),u&&!Pr(_this44,u)&&o.force&&ve(_this44.contentDOM,o.key,o.keyCode);});}},{key:"setState",value:function setState(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=t);this.updateState=2;var e=this.hasFocus;try{var _iterator81=_createForOfIteratorHelper(this.plugins),_step81;try{for(_iterator81.s();!(_step81=_iterator81.n()).done;){var _t151=_step81.value;_t151.destroy(this);}}catch(err){_iterator81.e(err);}finally{_iterator81.f();}this.viewState=new br(t),this.plugins=t.facet(Ki).map(function(t){return new Xi(t);}),this.pluginMap.clear();var _iterator82=_createForOfIteratorHelper(this.plugins),_step82;try{for(_iterator82.s();!(_step82=_iterator82.n()).done;){var _t152=_step82.value;_t152.update(this);}}catch(err){_iterator82.e(err);}finally{_iterator82.f();}this.docView.destroy(),this.docView=new us(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[];}finally{this.updateState=0;}e&&this.focus(),this.requestMeasure();}},{key:"updatePlugins",value:function updatePlugins(t){var e=t.startState.facet(Ki),i=t.state.facet(Ki);if(e!=i){var _s101=[];var _iterator83=_createForOfIteratorHelper(i),_step83;try{for(_iterator83.s();!(_step83=_iterator83.n()).done;){var _r85=_step83.value;var _i121=e.indexOf(_r85);if(_i121<0)_s101.push(new Xi(_r85));else{var _e123=this.plugins[_i121];_e123.mustUpdate=t,_s101.push(_e123);}}}catch(err){_iterator83.e(err);}finally{_iterator83.f();}var _iterator84=_createForOfIteratorHelper(this.plugins),_step84;try{for(_iterator84.s();!(_step84=_iterator84.n()).done;){var _e124=_step84.value;_e124.mustUpdate!=t&&_e124.destroy(this);}}catch(err){_iterator84.e(err);}finally{_iterator84.f();}this.plugins=_s101,this.pluginMap.clear();}else{var _iterator85=_createForOfIteratorHelper(this.plugins),_step85;try{for(_iterator85.s();!(_step85=_iterator85.n()).done;){var _e125=_step85.value;_e125.mustUpdate=t;}}catch(err){_iterator85.e(err);}finally{_iterator85.f();}}for(var _t153=0;_t153<this.plugins.length;_t153++)this.plugins[_t153].update(this);e!=i&&this.inputState.ensureHandlers(this.plugins);}},{key:"docViewUpdate",value:function docViewUpdate(){var _iterator86=_createForOfIteratorHelper(this.plugins),_step86;try{for(_iterator86.s();!(_step86=_iterator86.n()).done;){var _t154=_step86.value;var _e126=_t154.value;if(_e126&&_e126.docViewUpdate)try{_e126.docViewUpdate(this);}catch(t){Ui(this.state,t,"doc view update listener");}}}catch(err){_iterator86.e(err);}finally{_iterator86.f();}}},{key:"measure",value:function measure(){var _this45=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();var e=null,i=this.scrollDOM,s=i.scrollTop*this.scaleY,_this$viewState=this.viewState,r=_this$viewState.scrollAnchorPos,n=_this$viewState.scrollAnchorHeight;Math.abs(s-this.viewState.scrollTop)>1&&(n=-1),this.viewState.scrollAnchorHeight=-1;try{for(var _t155=0;;_t155++){var _ref13;if(n<0)if(ye(i))r=-1,n=this.viewState.heightMap.height;else{var _t156=this.viewState.scrollAnchorAt(s);r=_t156.from,n=_t156.top;}this.updateState=1;var _h43=this.viewState.measure(this);if(!_h43&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(_t155>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break;}var _l42=[];4&_h43||(_ref13=[_l42,this.measureRequests],this.measureRequests=_ref13[0],_l42=_ref13[1],_ref13);var _o32=_l42.map(function(t){try{return t.read(_this45);}catch(t){return Ui(_this45.state,t),Gr;}}),_u35=os.create(this,this.state,[]),_f19=!1;_u35.flags|=_h43,e?e.flags|=_h43:e=_u35,this.updateState=2,_u35.empty||(this.updatePlugins(_u35),this.inputState.update(_u35),this.updateAttrs(),_f19=this.docView.update(_u35),_f19&&this.docViewUpdate());for(var _t157=0;_t157<_l42.length;_t157++)if(_o32[_t157]!=Gr)try{var _e127=_l42[_t157];_e127.write&&_e127.write(_o32[_t157],this);}catch(t){Ui(this.state,t);}if(_f19&&this.docView.updateSelection(!0),!_u35.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,n=-1;continue;}{var _t158=(r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-n;if(_t158>1||_t158<-1){s+=_t158,i.scrollTop=s/this.scaleY,n=-1;continue;}}}break;}}}finally{this.updateState=0,this.measureScheduled=-1;}if(e&&!e.empty){var _iterator87=_createForOfIteratorHelper(this.state.facet($i)),_step87;try{for(_iterator87.s();!(_step87=_iterator87.n()).done;){var _t159=_step87.value;_t159(e);}}catch(err){_iterator87.e(err);}finally{_iterator87.f();}}}},{key:"themeClasses",get:function get(){return Dr+" "+(this.state.facet(Or)?Ir:Er)+" "+this.state.facet(Cr);}},{key:"updateAttrs",value:function updateAttrs(){var _this46=this;var t=_r(this,Yi,{"class":"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Ji)?"true":"false","class":"cm-content",style:"".concat(Ve.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),_r(this,Qi,e);var i=this.observer.ignore(function(){var i=Ze(_this46.contentDOM,_this46.contentAttrs,e),s=Ze(_this46.dom,_this46.editorAttrs,t);return i||s;});return this.editorAttrs=t,this.contentAttrs=e,i;}},{key:"showAnnouncements",value:function showAnnouncements(t){var e=!0;var _iterator88=_createForOfIteratorHelper(t),_step88;try{for(_iterator88.s();!(_step88=_iterator88.n()).done;){var _i122=_step88.value;var _iterator89=_createForOfIteratorHelper(_i122.effects),_step89;try{for(_iterator89.s();!(_step89=_iterator89.n()).done;){var _t160=_step89.value;if(_t160.is(Ur.announce)){e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=_t160.value;}}}catch(err){_iterator89.e(err);}finally{_iterator89.f();}}}catch(err){_iterator88.e(err);}finally{_iterator88.f();}}},{key:"mountStyles",value:function mountStyles(){this.styleModules=this.state.facet(hs);var t=this.state.facet(Ur.cspNonce);Gt.mount(this.root,this.styleModules.concat(Br).reverse(),t?{nonce:t}:void 0);}},{key:"readMeasured",value:function readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1);}},{key:"requestMeasure",value:function requestMeasure(t){var _this47=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(function(){return _this47.measure();})),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(var _e128=0;_e128<this.measureRequests.length;_e128++)if(this.measureRequests[_e128].key===t.key)return void(this.measureRequests[_e128]=t);this.measureRequests.push(t);}}},{key:"plugin",value:function plugin(t){var e=this.pluginMap.get(t);return(void 0===e||e&&e.spec!=t)&&this.pluginMap.set(t,e=this.plugins.find(function(e){return e.spec==t;})||null),e&&e.update(this).value;}},{key:"documentTop",get:function get(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop;}},{key:"documentPadding",get:function get(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom};}},{key:"scaleX",get:function get(){return this.viewState.scaleX;}},{key:"scaleY",get:function get(){return this.viewState.scaleY;}},{key:"elementAtHeight",value:function elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t);}},{key:"lineBlockAtHeight",value:function lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t);}},{key:"viewportLineBlocks",get:function get(){return this.viewState.viewportLines;}},{key:"lineBlockAt",value:function lineBlockAt(t){return this.viewState.lineBlockAt(t);}},{key:"contentHeight",get:function get(){return this.viewState.contentHeight;}},{key:"moveByChar",value:function moveByChar(t,e,i){return As(this,t,xs(this,t,e,i));}},{key:"moveByGroup",value:function moveByGroup(t,e){var _this48=this;return As(this,t,xs(this,t,e,function(e){return function(t,e,i){var s=t.state.charCategorizer(e),r=s(i);return function(t){var e=s(t);return r==kt.Space&&(r=e),r==e;};}(_this48,t.head,e);}));}},{key:"visualLineSide",value:function visualLineSide(t,e){var i=this.bidiSpans(t),s=this.textDirectionAt(t.from),r=i[e?i.length-1:0];return B.cursor(r.side(e,s)+t.from,r.forward(!e,s)?1:-1);}},{key:"moveToLineBoundary",value:function moveToLineBoundary(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0;return function(t,e,i,s){var r=Ms(t,e.head),n=s&&r.type==ri.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(n){var _e129=t.dom.getBoundingClientRect(),_s102=t.textDirectionAt(r.from),_h44=t.posAtCoords({x:i==(_s102==pi.LTR)?_e129.right-1:_e129.left+1,y:(n.top+n.bottom)/2});if(null!=_h44)return B.cursor(_h44,i?-1:1);}return B.cursor(i?r.to:r.from,i?-1:1);}(this,t,e,i);}},{key:"moveVertically",value:function moveVertically(t,e,i){return As(this,t,function(t,e,i,s){var r=e.head,n=i?1:-1;if(r==(i?t.state.doc.length:0))return B.cursor(r,e.assoc);var h,l=e.goalColumn,o=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(r,e.assoc||-1),f=t.documentTop;if(u)null==l&&(l=u.left-o.left),h=n<0?u.top:u.bottom;else{var _e130=t.viewState.lineBlockAt(r);null==l&&(l=Math.min(o.right-o.left,t.defaultCharacterWidth*(r-_e130.from))),h=(n<0?_e130.top:_e130.bottom)+f;}var a=o.left+l,c=null!=s?s:t.viewState.heightOracle.textHeight>>1;for(var _e131=0;;_e131+=10){var _i123=h+(c+_e131)*n,_s103=ks(t,{x:a,y:_i123},!1,n);if(_i123<o.top||_i123>o.bottom||(n<0?_s103<r:_s103>r)){var _e132=t.docView.coordsForChar(_s103),_r86=!_e132||_i123<_e132.top?-1:1;return B.cursor(_s103,_r86,void 0,l);}}}(this,t,e,i));}},{key:"domAtPos",value:function domAtPos(t){return this.docView.domAtPos(t);}},{key:"posAtDOM",value:function posAtDOM(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return this.docView.posFromDOM(t,e);}},{key:"posAtCoords",value:function posAtCoords(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!0;return this.readMeasured(),ks(this,t,e);}},{key:"coordsAtPos",value:function coordsAtPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;this.readMeasured();var i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;var s=this.state.doc.lineAt(t),r=this.bidiSpans(s);return ae(i,r[Si.find(r,t-s.from,-1,e)].dir==pi.LTR==e>0);}},{key:"coordsForChar",value:function coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t);}},{key:"defaultCharacterWidth",get:function get(){return this.viewState.heightOracle.charWidth;}},{key:"defaultLineHeight",get:function get(){return this.viewState.heightOracle.lineHeight;}},{key:"textDirection",get:function get(){return this.viewState.defaultTextDirection;}},{key:"textDirectionAt",value:function textDirectionAt(t){return!this.state.facet(Hi)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t));}},{key:"lineWrapping",get:function get(){return this.viewState.heightOracle.lineWrapping;}},{key:"bidiSpans",value:function bidiSpans(t){if(t.length>Jr)return Ei(t.length);var e,i=this.textDirectionAt(t.from);var _iterator90=_createForOfIteratorHelper(this.bidiCache),_step90;try{for(_iterator90.s();!(_step90=_iterator90.n()).done;){var _s104=_step90.value;if(_s104.from==t.from&&_s104.dir==i&&(_s104.fresh||Ai(_s104.isolates,e=ss(this,t))))return _s104.order;}}catch(err){_iterator90.e(err);}finally{_iterator90.f();}e||(e=ss(this,t));var s=function(t,e,i){if(!t)return[new Si(0,0,e==gi?1:0)];if(e==mi&&!i.length&&!xi.test(t))return Ei(t.length);if(i.length)for(;t.length>Ci.length;)Ci[Ci.length]=256;var s=[],r=e==mi?0:1;return Di(t,r,r,i,0,t.length,s),s;}(t.text,i,e);return this.bidiCache.push(new Kr(t.from,t.to,i,e,!0,s)),s;}},{key:"hasFocus",get:function get(){var t;return(this.dom.ownerDocument.hasFocus()||Ve.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM;}},{key:"focus",value:function focus(){var _this49=this;this.observer.ignore(function(){we(_this49.contentDOM),_this49.docView.updateSelection();});}},{key:"setRoot",value:function setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles());}},{key:"destroy",value:function destroy(){var _iterator91=_createForOfIteratorHelper(this.plugins),_step91;try{for(_iterator91.s();!(_step91=_iterator91.n()).done;){var _t161=_step91.value;_t161.destroy(this);}}catch(err){_iterator91.e(err);}finally{_iterator91.f();}this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0;}},{key:"scrollSnapshot",value:function scrollSnapshot(){var _this$scrollDOM=this.scrollDOM,t=_this$scrollDOM.scrollTop,e=_this$scrollDOM.scrollLeft,i=this.viewState.scrollAnchorAt(t);return qi.of(new Fi(B.cursor(i.from),"start","start",i.top-t,e,!0));}}],[{key:"scrollIntoView",value:function scrollIntoView(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return qi.of(new Fi("number"==typeof t?B.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin));}},{key:"domEventHandlers",value:function domEventHandlers(t){return _i.define(function(){return{};},{eventHandlers:t});}},{key:"domEventObservers",value:function domEventObservers(t){return _i.define(function(){return{};},{eventObservers:t});}},{key:"theme",value:function theme(t,e){var i=Gt.newName(),s=[Cr.of(i),hs.of(Tr(".".concat(i),t))];return e&&e.dark&&s.push(Or.of(!0)),s;}},{key:"baseTheme",value:function baseTheme(t){return _.lowest(hs.of(Tr("."+Dr,t,Rr)));}},{key:"findFromDOM",value:function findFromDOM(t){var e;var i=t.querySelector(".cm-content"),s=i&&Ce.get(i)||Ce.get(t);return(null===(e=null==s?void 0:s.rootView)||void 0===e?void 0:e.view)||null;}}]);}());Ur.styleModule=hs,Ur.inputHandler=zi,Ur.scrollHandler=Vi,Ur.focusChangeEffect=Pi,Ur.perLineTextDirection=Hi,Ur.exceptionSink=ji,Ur.updateListener=$i,Ur.editable=Ji,Ur.mouseSelectionStyle=Ni,Ur.dragMovesSelection=Li,Ur.clickAddsSelectionRange=Bi,Ur.decorations=Zi,Ur.outerDecorations=ts,Ur.atomicRanges=es,Ur.bidiIsolatedRanges=is,Ur.scrollMargins=rs,Ur.darkTheme=Or,Ur.cspNonce=j.define({combine:function combine(t){return t.length?t[0]:"";}}),Ur.contentAttributes=Qi,Ur.editorAttributes=Yi,Ur.lineWrapping=Ur.contentAttributes.of({"class":"cm-lineWrapping"}),Ur.announce=ct.define();Jr=4096;Gr={};Kr=/*#__PURE__*/function(){function Kr(t,e,i,s,r,n){_classCallCheck(this,Kr);this.from=t,this.to=e,this.dir=i,this.isolates=s,this.fresh=r,this.order=n;}return _createClass(Kr,null,[{key:"update",value:function update(t,e){if(e.empty&&!t.some(function(t){return t.fresh;}))return t;var i=[],s=t.length?t[t.length-1].dir:pi.LTR;for(var _r87=Math.max(0,t.length-10);_r87<t.length;_r87++){var _n73=t[_r87];_n73.dir!=s||e.touchesRange(_n73.from,_n73.to)||i.push(new Kr(e.mapPos(_n73.from,1),e.mapPos(_n73.to,-1),_n73.dir,_n73.isolates,!1,_n73.order));}return i;}}]);}();Xr=Ve.mac?"mac":Ve.windows?"win":Ve.linux?"linux":"key";Qr=_["default"](Ur.domEventHandlers({keydown:function keydown(t,e){return nn(en(e.state),t,e,"editor");}}));_export("G",Zr=j.define({enables:Qr}));tn=new WeakMap();sn=null;rn=4e3;hn=/*#__PURE__*/function(){function hn(t,e,i,s,r){_classCallCheck(this,hn);this.className=t,this.left=e,this.top=i,this.width=s,this.height=r;}return _createClass(hn,[{key:"draw",value:function draw(){var t=document.createElement("div");return t.className=this.className,this.adjust(t),t;}},{key:"update",value:function update(t,e){return e.className==this.className&&(this.adjust(t),!0);}},{key:"adjust",value:function adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px";}},{key:"eq",value:function eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className;}}],[{key:"forRange",value:function forRange(t,e,i){if(i.empty){var _s108=t.coordsAtPos(i.head,i.assoc||1);if(!_s108)return[];var _r90=ln(t);return[new hn(e,_s108.left-_r90.left,_s108.top-_r90.top,null,_s108.bottom-_s108.top)];}return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];var s=Math.max(i.from,t.viewport.from),r=Math.min(i.to,t.viewport.to),n=t.textDirection==pi.LTR,h=t.contentDOM,l=h.getBoundingClientRect(),o=ln(t),u=h.querySelector(".cm-line"),f=u&&window.getComputedStyle(u),a=l.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),c=l.right-(f?parseInt(f.paddingRight):0),d=Ms(t,s),p=Ms(t,r),m=d.type==ri.Text?d:null,g=p.type==ri.Text?p:null;m&&(t.lineWrapping||d.widgetLineBreaks)&&(m=on(t,s,m));g&&(t.lineWrapping||p.widgetLineBreaks)&&(g=on(t,r,g));if(m&&g&&m.from==g.from)return b(v(i.from,i.to,m));{var _e138=m?v(i.from,null,m):k(d,!1),_s109=g?v(null,i.to,g):k(p,!0),_r91=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&_e138.bottom+t.defaultLineHeight/2<_s109.top?_r91.push(w(a,_e138.bottom,c,_s109.top)):_e138.bottom<_s109.top&&t.elementAtHeight((_e138.bottom+_s109.top)/2).type==ri.Text&&(_e138.bottom=_s109.top=(_e138.bottom+_s109.top)/2),b(_e138).concat(_r91).concat(b(_s109));}function w(t,i,s,r){return new hn(e,t-o.left,i-o.top-.01,s-t,r-i+.01);}function b(_ref14){var t=_ref14.top,e=_ref14.bottom,i=_ref14.horizontal;var s=[];for(var _r92=0;_r92<i.length;_r92+=2)s.push(w(i[_r92],t,i[_r92+1],e));return s;}function v(e,i,s){var r=1e9,h=-1e9,l=[];function o(e,i,o,u,f){var d=t.coordsAtPos(e,e==s.to?-2:2),p=t.coordsAtPos(o,o==s.from?2:-2);d&&p&&(r=Math.min(d.top,p.top,r),h=Math.max(d.bottom,p.bottom,h),f==pi.LTR?l.push(n&&i?a:d.left,n&&u?c:p.right):l.push(!n&&u?a:p.left,!n&&i?c:d.right));}var u=null!=e?e:s.from,f=null!=i?i:s.to;var _iterator96=_createForOfIteratorHelper(t.visibleRanges),_step96;try{for(_iterator96.s();!(_step96=_iterator96.n()).done;){var _s110=_step96.value;if(_s110.to>u&&_s110.from<f)for(var _r93=Math.max(_s110.from,u),_n76=Math.min(_s110.to,f);;){var _s111=t.state.doc.lineAt(_r93);var _iterator97=_createForOfIteratorHelper(t.bidiSpans(_s111)),_step97;try{for(_iterator97.s();!(_step97=_iterator97.n()).done;){var _h45=_step97.value;var _t165=_h45.from+_s111.from,_l44=_h45.to+_s111.from;if(_t165>=_n76)break;_l44>_r93&&o(Math.max(_t165,_r93),null==e&&_t165<=u,Math.min(_l44,_n76),null==i&&_l44>=f,_h45.dir);}}catch(err){_iterator97.e(err);}finally{_iterator97.f();}if(_r93=_s111.to+1,_r93>=_n76)break;}}}catch(err){_iterator96.e(err);}finally{_iterator96.f();}return 0==l.length&&o(u,null==e,f,null==i,t.textDirection),{top:r,bottom:h,horizontal:l};}function k(t,e){var i=l.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]};}}(t,e,i);}}]);}();un=/*#__PURE__*/function(){function un(t,e){_classCallCheck(this,un);this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e["class"]&&this.dom.classList.add(e["class"]),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t);}return _createClass(un,[{key:"update",value:function update(t){t.startState.facet(fn)!=t.state.facet(fn)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq));}},{key:"docViewUpdate",value:function docViewUpdate(t){!1!==this.layer.updateOnDocViewUpdate&&t.requestMeasure(this.measureReq);}},{key:"setOrder",value:function setOrder(t){var e=0,i=t.facet(fn);for(;e<i.length&&i[e]!=this.layer;)e++;this.dom.style.zIndex=String((this.layer.above?150:-1)-e);}},{key:"measure",value:function measure(){return this.layer.markers(this.view);}},{key:"scale",value:function scale(){var _this$view=this.view,t=_this$view.scaleX,e=_this$view.scaleY;t==this.scaleX&&e==this.scaleY||(this.scaleX=t,this.scaleY=e,this.dom.style.transform="scale(".concat(1/t,", ").concat(1/e,")"));}},{key:"draw",value:function draw(t){var _this50=this;if(t.length!=this.drawn.length||t.some(function(t,e){return i=t,s=_this50.drawn[e],!(i.constructor==s.constructor&&i.eq(s));var i,s;})){var _e139=this.dom.firstChild,_i124=0;var _iterator98=_createForOfIteratorHelper(t),_step98;try{for(_iterator98.s();!(_step98=_iterator98.n()).done;){var _s112=_step98.value;_s112.update&&_e139&&_s112.constructor&&this.drawn[_i124].constructor&&_s112.update(_e139,this.drawn[_i124])?(_e139=_e139.nextSibling,_i124++):this.dom.insertBefore(_s112.draw(),_e139);}}catch(err){_iterator98.e(err);}finally{_iterator98.f();}for(;_e139;){var _t166=_e139.nextSibling;_e139.remove(),_e139=_t166;}this.drawn=t;}}},{key:"destroy",value:function destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove();}}]);}();fn=j.define();cn=!Ve.ios;dn=j.define({combine:function combine(t){return At(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:function cursorBlinkRate(t,e){return Math.min(t,e);},drawRangeCursor:function drawRangeCursor(t,e){return t||e;}});}});mn=an({above:!0,markers:function markers(t){var e=t.state,i=e.facet(dn),s=[];var _iterator99=_createForOfIteratorHelper(e.selection.ranges),_step99;try{for(_iterator99.s();!(_step99=_iterator99.n()).done;){var _r94=_step99.value;var _n77=_r94==e.selection.main;if(_r94.empty?!_n77||cn:i.drawRangeCursor){var _e140=_n77?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",_i125=_r94.empty?_r94:B.cursor(_r94.head,_r94.head>_r94.anchor?-1:1);var _iterator100=_createForOfIteratorHelper(hn.forRange(t,_e140,_i125)),_step100;try{for(_iterator100.s();!(_step100=_iterator100.n()).done;){var _r95=_step100.value;s.push(_r95);}}catch(err){_iterator100.e(err);}finally{_iterator100.f();}}}}catch(err){_iterator99.e(err);}finally{_iterator99.f();}return s;},update:function update(t,e){t.transactions.some(function(t){return t.selection;})&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");var i=pn(t);return i&&gn(t.state,e),t.docChanged||t.selectionSet||i;},mount:function mount(t,e){gn(e.state,t);},"class":"cm-cursorLayer"});wn=an({above:!1,markers:function markers(t){return t.state.selection.ranges.map(function(e){return e.empty?[]:hn.forRange(t,"cm-selectionBackground",e);}).reduce(function(t,e){return t.concat(e);});},update:function update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||pn(t);},"class":"cm-selectionLayer"});bn={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};cn&&(bn[".cm-line"].caretColor="transparent !important",bn[".cm-content"]={caretColor:"transparent !important"});vn=_.highest(Ur.theme(bn));kn=ct.define({map:function map(t,e){return null==t?null:e.mapPos(t);}});yn=F.define({create:function create(){return null;},update:function update(t,e){return null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce(function(t,e){return e.is(kn)?e.value:t;},t);}});Mn=_i.fromClass(/*#__PURE__*/function(){function _class(t){_classCallCheck(this,_class);this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)};}return _createClass(_class,[{key:"update",value:function update(t){var e;var i=t.state.field(yn);null==i?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(yn)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq));}},{key:"readPos",value:function readPos(){var t=this.view,e=t.state.field(yn),i=null!=e&&t.coordsAtPos(e);if(!i)return null;var s=t.scrollDOM.getBoundingClientRect();return{left:i.left-s.left+t.scrollDOM.scrollLeft*t.scaleX,top:i.top-s.top+t.scrollDOM.scrollTop*t.scaleY,height:i.bottom-i.top};}},{key:"drawCursor",value:function drawCursor(t){if(this.cursor){var _this$view2=this.view,_e141=_this$view2.scaleX,_i126=_this$view2.scaleY;t?(this.cursor.style.left=t.left/_e141+"px",this.cursor.style.top=t.top/_i126+"px",this.cursor.style.height=t.height/_i126+"px"):this.cursor.style.left="-100000px";}}},{key:"destroy",value:function destroy(){this.cursor&&this.cursor.remove();}},{key:"setDropPos",value:function setDropPos(t){this.view.state.field(yn)!=t&&this.view.dispatch({effects:kn.of(t)});}}]);}(),{eventObservers:{dragover:function dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}));},dragleave:function dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null);},dragend:function dragend(){this.setDropPos(null);},drop:function drop(){this.setDropPos(null);}}});Sn=/*#__PURE__*/function(){function Sn(t){_classCallCheck(this,Sn);var e=t.regexp,i=t.decoration,s=t.decorate,r=t.boundary,_t$maxLength=t.maxLength,n=_t$maxLength===void 0?1e3:_t$maxLength;if(!e.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,s)this.addMatch=function(t,e,i,r){return s(r,i,i+t[0].length,t,e);};else if("function"==typeof i)this.addMatch=function(t,e,s,r){var n=i(t,e,s);n&&r(s,s+t[0].length,n);};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,s,r){return r(s,s+t[0].length,i);};}this.boundary=r,this.maxLength=n;}return _createClass(Sn,[{key:"createDeco",value:function createDeco(t){var _this51=this;var e=new Rt(),i=e.add.bind(e);var _iterator101=_createForOfIteratorHelper(function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;var s=[];var _iterator102=_createForOfIteratorHelper(i),_step102;try{for(_iterator102.s();!(_step102=_iterator102.n()).done;){var _step102$value=_step102.value,_r96=_step102$value.from,_n79=_step102$value.to;_r96=Math.max(t.state.doc.lineAt(_r96).from,_r96-e),_n79=Math.min(t.state.doc.lineAt(_n79).to,_n79+e),s.length&&s[s.length-1].to>=_r96?s[s.length-1].to=_n79:s.push({from:_r96,to:_n79});}}catch(err){_iterator102.e(err);}finally{_iterator102.f();}return s;}(t,this.maxLength)),_step101;try{for(_iterator101.s();!(_step101=_iterator101.n()).done;){var _step101$value=_step101.value,_e142=_step101$value.from,_s113=_step101$value.to;xn(t.state.doc,this.regexp,_e142,_s113,function(e,s){return _this51.addMatch(s,t,e,i);});}}catch(err){_iterator101.e(err);}finally{_iterator101.f();}return e.finish();}},{key:"updateDeco",value:function updateDeco(t,e){var i=1e9,s=-1;return t.docChanged&&t.changes.iterChanges(function(e,r,n,h){h>t.view.viewport.from&&n<t.view.viewport.to&&(i=Math.min(n,i),s=Math.max(h,s));}),t.viewportChanged||s-i>1e3?this.createDeco(t.view):s>-1?this.updateRange(t.view,e.map(t.changes),i,s):e;}},{key:"updateRange",value:function updateRange(t,e,i,s){var _this52=this;var _iterator103=_createForOfIteratorHelper(t.visibleRanges),_step103;try{var _loop9=function _loop9(){var r=_step103.value;var n=Math.max(r.from,i),h=Math.min(r.to,s);if(h>n){var _i127=t.state.doc.lineAt(n),_s114=_i127.to<h?t.state.doc.lineAt(h):_i127,_l46=Math.max(r.from,_i127.from),_o33=Math.min(r.to,_s114.to);if(_this52.boundary){for(;n>_i127.from;n--)if(_this52.boundary.test(_i127.text[n-1-_i127.from])){_l46=n;break;}for(;h<_s114.to;h++)if(_this52.boundary.test(_s114.text[h-_s114.from])){_o33=h;break;}}var _u36,_f20=[],_a13=function _a13(t,e,i){return _f20.push(i.range(t,e));};if(_i127==_s114)for(_this52.regexp.lastIndex=_l46-_i127.from;(_u36=_this52.regexp.exec(_i127.text))&&_u36.index<_o33-_i127.from;)_this52.addMatch(_u36,t,_u36.index+_i127.from,_a13);else xn(t.state.doc,_this52.regexp,_l46,_o33,function(e,i){return _this52.addMatch(i,t,e,_a13);});e=e.update({filterFrom:_l46,filterTo:_o33,filter:function filter(t,e){return t<_l46||e>_o33;},add:_f20});}};for(_iterator103.s();!(_step103=_iterator103.n()).done;){_loop9();}}catch(err){_iterator103.e(err);}finally{_iterator103.f();}return e;}}]);}();An=null!=/x/.unicode?"gu":"g";Cn=new RegExp("[\0-\b\n-\x1F\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]",An);On={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"};Dn=null;En=j.define({combine:function combine(t){var e=At(t,{render:null,specialChars:Cn,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==Dn&&"undefined"!=typeof document&&document.body){var _e143=document.body.style;Dn=null!=(null!==(t=_e143.tabSize)&&void 0!==t?t:_e143.MozTabSize);}return Dn||!1;}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,An)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,An)),e;}});In=null;Rn=/*#__PURE__*/function(_si4){function Rn(t,e){var _this53;_classCallCheck(this,Rn);_this53=_callSuper(this,Rn),_this53.options=t,_this53.code=e;return _this53;}_inherits(Rn,_si4);return _createClass(Rn,[{key:"eq",value:function eq(t){return t.code==this.code;}},{key:"toDOM",value:function toDOM(t){var e=function(t){return t>=32?"•":10==t?"":String.fromCharCode(9216+t);}(this.code),i=t.state.phrase("Control character")+" "+(On[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,e);if(s)return s;var r=document.createElement("span");return r.textContent=e,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);Tn=/*#__PURE__*/function(_si5){function Tn(t){var _this54;_classCallCheck(this,Tn);_this54=_callSuper(this,Tn),_this54.width=t;return _this54;}_inherits(Tn,_si5);return _createClass(Tn,[{key:"eq",value:function eq(t){return t.width==this.width;}},{key:"toDOM",value:function toDOM(){var t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);Bn=ni.line({"class":"cm-activeLine"});Ln=_i.fromClass(/*#__PURE__*/function(){function _class2(t){_classCallCheck(this,_class2);this.decorations=this.getDeco(t);}return _createClass(_class2,[{key:"update",value:function update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view));}},{key:"getDeco",value:function getDeco(t){var e=-1,i=[];var _iterator104=_createForOfIteratorHelper(t.state.selection.ranges),_step104;try{for(_iterator104.s();!(_step104=_iterator104.n()).done;){var _s115=_step104.value;var _r97=t.lineBlockAt(_s115.head);_r97.from>e&&(i.push(Bn.range(_r97.from)),e=_r97.from);}}catch(err){_iterator104.e(err);}finally{_iterator104.f();}return ni.set(i);}}]);}(),{decorations:function decorations(t){return t.decorations;}});Nn=/*#__PURE__*/function(_si6){function Nn(t){var _this55;_classCallCheck(this,Nn);_this55=_callSuper(this,Nn),_this55.content=t;return _this55;}_inherits(Nn,_si6);return _createClass(Nn,[{key:"toDOM",value:function toDOM(){var t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t;}},{key:"coordsAt",value:function coordsAt(t){var e=t.firstChild?ne(t.firstChild):[];if(!e.length)return null;var i=window.getComputedStyle(t.parentNode),s=ae(e[0],"rtl"!=i.direction),r=parseInt(i.lineHeight);return s.bottom-s.top>1.5*r?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si);$n=2e3;Hn={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;}]};Wn={style:"cursor: crosshair"};Vn="-10000px";Fn=/*#__PURE__*/function(){function Fn(t,e,i,s){_classCallCheck(this,Fn);this.facet=e,this.createTooltipView=i,this.removeTooltipView=s,this.input=t.state.facet(e),this.tooltips=this.input.filter(function(t){return t;});var r=null;this.tooltipViews=this.tooltips.map(function(t){return r=i(t,r);});}return _createClass(Fn,[{key:"update",value:function update(t,e){var i;var s=t.state.facet(this.facet),r=s.filter(function(t){return t;});if(s===this.input){var _iterator105=_createForOfIteratorHelper(this.tooltipViews),_step105;try{for(_iterator105.s();!(_step105=_iterator105.n()).done;){var _e148=_step105.value;_e148.update&&_e148.update(t);}}catch(err){_iterator105.e(err);}finally{_iterator105.f();}return!1;}var n=[],h=e?[]:null;for(var _i130=0;_i130<r.length;_i130++){var _s117=r[_i130],_l49=-1;if(_s117){for(var _t167=0;_t167<this.tooltips.length;_t167++){var _e149=this.tooltips[_t167];_e149&&_e149.create==_s117.create&&(_l49=_t167);}if(_l49<0)n[_i130]=this.createTooltipView(_s117,_i130?n[_i130-1]:null),h&&(h[_i130]=!!_s117.above);else{var _s118=n[_i130]=this.tooltipViews[_l49];h&&(h[_i130]=e[_l49]),_s118.update&&_s118.update(t);}}}var _iterator106=_createForOfIteratorHelper(this.tooltipViews),_step106;try{for(_iterator106.s();!(_step106=_iterator106.n()).done;){var _t168=_step106.value;n.indexOf(_t168)<0&&(this.removeTooltipView(_t168),null===(i=_t168.destroy)||void 0===i||i.call(_t168));}}catch(err){_iterator106.e(err);}finally{_iterator106.f();}return e&&(h.forEach(function(t,i){return e[i]=t;}),e.length=h.length),this.input=s,this.tooltips=r,this.tooltipViews=n,!0;}}]);}();Un=j.define({combine:function combine(t){var e,i,s;return{position:Ve.ios?"absolute":(null===(e=t.find(function(t){return t.position;}))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find(function(t){return t.parent;}))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(s=t.find(function(t){return t.tooltipSpace;}))||void 0===s?void 0:s.tooltipSpace)||qn};}});Jn=new WeakMap();Gn=_i.fromClass(/*#__PURE__*/function(){function _class4(t){var _this56=this;_classCallCheck(this,_class4);this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;var e=t.state.facet(Un);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(function(){return _this56.measureSoon();}):null,this.manager=new Fn(t,Xn,function(t,e){return _this56.createTooltip(t,e);},function(t){_this56.resizeObserver&&_this56.resizeObserver.unobserve(t.dom),t.dom.remove();}),this.above=this.manager.tooltips.map(function(t){return!!t.above;}),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(function(t){Date.now()>_this56.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&_this56.measureSoon();},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure();}return _createClass(_class4,[{key:"createContainer",value:function createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom;}},{key:"observeIntersection",value:function observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();var _iterator107=_createForOfIteratorHelper(this.manager.tooltipViews),_step107;try{for(_iterator107.s();!(_step107=_iterator107.n()).done;){var _t169=_step107.value;this.intersectionObserver.observe(_t169.dom);}}catch(err){_iterator107.e(err);}finally{_iterator107.f();}}}},{key:"measureSoon",value:function measureSoon(){var _this57=this;this.measureTimeout<0&&(this.measureTimeout=setTimeout(function(){_this57.measureTimeout=-1,_this57.maybeMeasure();},50));}},{key:"update",value:function update(t){t.transactions.length&&(this.lastTransaction=Date.now());var e=this.manager.update(t,this.above);e&&this.observeIntersection();var i=e||t.geometryChanged,s=t.state.facet(Un);if(s.position!=this.position&&!this.madeAbsolute){this.position=s.position;var _iterator108=_createForOfIteratorHelper(this.manager.tooltipViews),_step108;try{for(_iterator108.s();!(_step108=_iterator108.n()).done;){var _t170=_step108.value;_t170.dom.style.position=this.position;}}catch(err){_iterator108.e(err);}finally{_iterator108.f();}i=!0;}if(s.parent!=this.parent){this.parent&&this.container.remove(),this.parent=s.parent,this.createContainer();var _iterator109=_createForOfIteratorHelper(this.manager.tooltipViews),_step109;try{for(_iterator109.s();!(_step109=_iterator109.n()).done;){var _t171=_step109.value;this.container.appendChild(_t171.dom);}}catch(err){_iterator109.e(err);}finally{_iterator109.f();}i=!0;}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure();}},{key:"createTooltip",value:function createTooltip(t,e){var i=t.create(this.view),s=e?e.dom:null;if(i.dom.classList.add("cm-tooltip"),t.arrow&&!i.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){var _t172=document.createElement("div");_t172.className="cm-tooltip-arrow",i.dom.appendChild(_t172);}return i.dom.style.position=this.position,i.dom.style.top=Vn,i.dom.style.left="0px",this.container.insertBefore(i.dom,s),i.mount&&i.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(i.dom),i;}},{key:"destroy",value:function destroy(){var t,e,i;this.view.win.removeEventListener("resize",this.measureSoon);var _iterator110=_createForOfIteratorHelper(this.manager.tooltipViews),_step110;try{for(_iterator110.s();!(_step110=_iterator110.n()).done;){var _e150=_step110.value;_e150.dom.remove(),null===(t=_e150.destroy)||void 0===t||t.call(_e150);}}catch(err){_iterator110.e(err);}finally{_iterator110.f();}this.parent&&this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(i=this.intersectionObserver)||void 0===i||i.disconnect(),clearTimeout(this.measureTimeout);}},{key:"readMeasure",value:function readMeasure(){var _this58=this;var t=this.view.dom.getBoundingClientRect(),e=1,i=1,s=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){var _t173=this.manager.tooltipViews[0].dom;if(Ve.gecko)s=_t173.offsetParent!=this.container.ownerDocument.body;else if(_t173.style.top==Vn&&"0px"==_t173.style.left){var _e151=_t173.getBoundingClientRect();s=Math.abs(_e151.top+1e4)>1||Math.abs(_e151.left)>1;}}if(s||"absolute"==this.position)if(this.parent){var _t174=this.parent.getBoundingClientRect();_t174.width&&_t174.height&&(e=_t174.width/this.parent.offsetWidth,i=_t174.height/this.parent.offsetHeight);}else{var _this$view$viewState=this.view.viewState;e=_this$view$viewState.scaleX;i=_this$view$viewState.scaleY;}return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map(function(t,e){var i=_this58.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):_this58.view.coordsAtPos(t.pos);}),size:this.manager.tooltipViews.map(function(_ref15){var t=_ref15.dom;return t.getBoundingClientRect();}),space:this.view.state.facet(Un).tooltipSpace(this.view),scaleX:e,scaleY:i,makeAbsolute:s};}},{key:"writeMeasure",value:function writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";var _iterator111=_createForOfIteratorHelper(this.manager.tooltipViews),_step111;try{for(_iterator111.s();!(_step111=_iterator111.n()).done;){var _t175=_step111.value;_t175.dom.style.position="absolute";}}catch(err){_iterator111.e(err);}finally{_iterator111.f();}}var i=t.editor,s=t.space,r=t.scaleX,n=t.scaleY,h=[];for(var _l50=0;_l50<this.manager.tooltips.length;_l50++){var _o34=this.manager.tooltips[_l50],_u37=this.manager.tooltipViews[_l50],_f21=_u37.dom,_a14=t.pos[_l50],_c12=t.size[_l50];if(!_a14||_a14.bottom<=Math.max(i.top,s.top)||_a14.top>=Math.min(i.bottom,s.bottom)||_a14.right<Math.max(i.left,s.left)-.1||_a14.left>Math.min(i.right,s.right)+.1){_f21.style.top=Vn;continue;}var _d8=_o34.arrow?_u37.dom.querySelector(".cm-tooltip-arrow"):null,_p6=_d8?7:0,_m4=_c12.right-_c12.left,_g4=null!==(e=Jn.get(_u37))&&void 0!==e?e:_c12.bottom-_c12.top,_w=_u37.offset||_n,_b=this.view.textDirection==pi.LTR,_v=_c12.width>s.right-s.left?_b?s.left:s.right-_c12.width:_b?Math.min(_a14.left-(_d8?14:0)+_w.x,s.right-_m4):Math.max(s.left,_a14.left-_m4+(_d8?14:0)-_w.x),_k=this.above[_l50];!_o34.strictSide&&(_k?_a14.top-(_c12.bottom-_c12.top)-_w.y<s.top:_a14.bottom+(_c12.bottom-_c12.top)+_w.y>s.bottom)&&_k==s.bottom-_a14.bottom>_a14.top-s.top&&(_k=this.above[_l50]=!_k);var _y=(_k?_a14.top-s.top:s.bottom-_a14.bottom)-_p6;if(_y<_g4&&!1!==_u37.resize){if(_y<this.view.defaultLineHeight){_f21.style.top=Vn;continue;}Jn.set(_u37,_g4),_f21.style.height=(_g4=_y)/n+"px";}else _f21.style.height&&(_f21.style.height="");var _M=_k?_a14.top-_g4-_p6-_w.y:_a14.bottom+_p6+_w.y,_x=_v+_m4;if(!0!==_u37.overlap){var _iterator112=_createForOfIteratorHelper(h),_step112;try{for(_iterator112.s();!(_step112=_iterator112.n()).done;){var _t176=_step112.value;_t176.left<_x&&_t176.right>_v&&_t176.top<_M+_g4&&_t176.bottom>_M&&(_M=_k?_t176.top-_g4-2-_p6:_t176.bottom+_p6+2);}}catch(err){_iterator112.e(err);}finally{_iterator112.f();}}if("absolute"==this.position?(_f21.style.top=(_M-t.parent.top)/n+"px",_f21.style.left=(_v-t.parent.left)/r+"px"):(_f21.style.top=_M/n+"px",_f21.style.left=_v/r+"px"),_d8){var _t177=_a14.left+(_b?_w.x:-_w.x)-(_v+14-7);_d8.style.left=_t177/r+"px";}!0!==_u37.overlap&&h.push({left:_v,top:_M,right:_x,bottom:_M+_g4}),_f21.classList.toggle("cm-tooltip-above",_k),_f21.classList.toggle("cm-tooltip-below",!_k),_u37.positioned&&_u37.positioned(t.space);}}},{key:"maybeMeasure",value:function maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView))){var _iterator113=_createForOfIteratorHelper(this.manager.tooltipViews),_step113;try{for(_iterator113.s();!(_step113=_iterator113.n()).done;){var _t178=_step113.value;_t178.dom.style.top=Vn;}}catch(err){_iterator113.e(err);}finally{_iterator113.f();}}}}]);}(),{eventObservers:{scroll:function scroll(){this.maybeMeasure();}}});Kn=Ur.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}});_n={x:0,y:0};Xn=j.define({enables:[Gn,Kn]});Yn=j.define({combine:function combine(t){return t.reduce(function(t,e){return t.concat(e);},[]);}});Qn=/*#__PURE__*/function(){function Qn(t){var _this59=this;_classCallCheck(this,Qn);this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Fn(t,Yn,function(t,e){return _this59.createHostedView(t,e);},function(t){return t.dom.remove();});}return _createClass(Qn,[{key:"createHostedView",value:function createHostedView(t,e){var i=t.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i;}},{key:"mount",value:function mount(t){var _iterator114=_createForOfIteratorHelper(this.manager.tooltipViews),_step114;try{for(_iterator114.s();!(_step114=_iterator114.n()).done;){var _e152=_step114.value;_e152.mount&&_e152.mount(t);}}catch(err){_iterator114.e(err);}finally{_iterator114.f();}this.mounted=!0;}},{key:"positioned",value:function positioned(t){var _iterator115=_createForOfIteratorHelper(this.manager.tooltipViews),_step115;try{for(_iterator115.s();!(_step115=_iterator115.n()).done;){var _e153=_step115.value;_e153.positioned&&_e153.positioned(t);}}catch(err){_iterator115.e(err);}finally{_iterator115.f();}}},{key:"update",value:function update(t){this.manager.update(t);}},{key:"destroy",value:function destroy(){var t;var _iterator116=_createForOfIteratorHelper(this.manager.tooltipViews),_step116;try{for(_iterator116.s();!(_step116=_iterator116.n()).done;){var _e154=_step116.value;null===(t=_e154.destroy)||void 0===t||t.call(_e154);}}catch(err){_iterator116.e(err);}finally{_iterator116.f();}}},{key:"passProp",value:function passProp(t){var e;var _iterator117=_createForOfIteratorHelper(this.manager.tooltipViews),_step117;try{for(_iterator117.s();!(_step117=_iterator117.n()).done;){var _i131=_step117.value;var _s119=_i131[t];if(void 0!==_s119)if(void 0===e)e=_s119;else if(e!==_s119)return;}}catch(err){_iterator117.e(err);}finally{_iterator117.f();}return e;}},{key:"offset",get:function get(){return this.passProp("offset");}},{key:"getCoords",get:function get(){return this.passProp("getCoords");}},{key:"overlap",get:function get(){return this.passProp("overlap");}},{key:"resize",get:function get(){return this.passProp("resize");}}],[{key:"create",value:function create(t){return new Qn(t);}}]);}();Zn=Xn.compute([Yn],function(t){var e=t.facet(Yn);return 0===e.length?null:{pos:Math.min.apply(Math,_toConsumableArray(e.map(function(t){return t.pos;}))),end:Math.max.apply(Math,_toConsumableArray(e.map(function(t){var e;return null!==(e=t.end)&&void 0!==e?e:t.pos;}))),create:Qn.create,above:e[0].above,arrow:e.some(function(t){return t.arrow;})};});th=/*#__PURE__*/function(){function th(t,e,i,s,r){_classCallCheck(this,th);this.view=t,this.source=e,this.field=i,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this));}return _createClass(th,[{key:"update",value:function update(){var _this60=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(function(){return _this60.startHover();},20));}},{key:"active",get:function get(){return this.view.state.field(this.field);}},{key:"checkHover",value:function checkHover(){if(this.hoverTimeout=-1,this.active.length)return;var t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover();}},{key:"startHover",value:function startHover(){var _this61=this;clearTimeout(this.restartTimeout);var t=this.view,e=this.lastMove,i=t.docView.nearest(e.target);if(!i)return;var s,r=1;if(i instanceof Ue)s=i.posAtStart;else{if(s=t.posAtCoords(e),null==s)return;var _i132=t.coordsAtPos(s);if(!_i132||e.y<_i132.top||e.y>_i132.bottom||e.x<_i132.left-t.defaultCharacterWidth||e.x>_i132.right+t.defaultCharacterWidth)return;var _n80=t.bidiSpans(t.state.doc.lineAt(s)).find(function(t){return t.from<=s&&t.to>=s;}),_h49=_n80&&_n80.dir==pi.RTL?-1:1;r=e.x<_i132.left?-_h49:_h49;}var n=this.source(t,s,r);if(null==n?void 0:n.then){var _e155=this.pending={pos:s};n.then(function(i){_this61.pending==_e155&&(_this61.pending=null,!i||Array.isArray(i)&&!i.length||t.dispatch({effects:_this61.setHover.of(Array.isArray(i)?i:[i])}));},function(e){return Ui(t.state,e,"hover tooltip");});}else!n||Array.isArray(n)&&!n.length||t.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])});}},{key:"tooltip",get:function get(){var t=this.view.plugin(Gn),e=t?t.manager.tooltips.findIndex(function(t){return t.create==Qn.create;}):-1;return e>-1?t.manager.tooltipViews[e]:null;}},{key:"mousemove",value:function mousemove(t){var e,i;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));var s=this.active,r=this.tooltip;if(s.length&&r&&!function(t,e){var i=t.getBoundingClientRect();return e.clientX>=i.left-eh&&e.clientX<=i.right+eh&&e.clientY>=i.top-eh&&e.clientY<=i.bottom+eh;}(r.dom,t)||this.pending){var _ref16=s[0]||this.pending,_r99=_ref16.pos,_n81=null!==(i=null===(e=s[0])||void 0===e?void 0:e.end)&&void 0!==i?i:_r99;(_r99==_n81?this.view.posAtCoords(this.lastMove)==_r99:function(t,e,i,s,r,n){var h=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(h.left>s||h.right<s||h.top>r||Math.min(h.bottom,l)<r)return!1;var o=t.posAtCoords({x:s,y:r},!1);return o>=e&&o<=i;}(this.view,_r99,_n81,t.clientX,t.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null);}}},{key:"mouseleave",value:function mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;var e=this.active;if(e.length){var _e156=this.tooltip;_e156&&_e156.dom.contains(t.relatedTarget)?this.watchTooltipLeave(_e156.dom):this.view.dispatch({effects:this.setHover.of([])});}}},{key:"watchTooltipLeave",value:function watchTooltipLeave(t){var _this62=this;var e=function e(i){t.removeEventListener("mouseleave",e),_this62.active.length&&!_this62.view.dom.contains(i.relatedTarget)&&_this62.view.dispatch({effects:_this62.setHover.of([])});};t.addEventListener("mouseleave",e);}},{key:"destroy",value:function destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove);}}]);}();eh=4;rh=ct.define();nh=j.define({combine:function combine(t){var e,i;var _iterator120=_createForOfIteratorHelper(t),_step120;try{for(_iterator120.s();!(_step120=_iterator120.n()).done;){var _s120=_step120.value;e=e||_s120.topContainer,i=i||_s120.bottomContainer;}}catch(err){_iterator120.e(err);}finally{_iterator120.f();}return{topContainer:e,bottomContainer:i};}});lh=_i.fromClass(/*#__PURE__*/function(){function _class5(t){_classCallCheck(this,_class5);this.input=t.state.facet(fh),this.specs=this.input.filter(function(t){return t;}),this.panels=this.specs.map(function(e){return e(t);});var e=t.state.facet(nh);this.top=new oh(t,!0,e.topContainer),this.bottom=new oh(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(function(t){return t.top;})),this.bottom.sync(this.panels.filter(function(t){return!t.top;}));var _iterator121=_createForOfIteratorHelper(this.panels),_step121;try{for(_iterator121.s();!(_step121=_iterator121.n()).done;){var _t180=_step121.value;_t180.dom.classList.add("cm-panel"),_t180.mount&&_t180.mount();}}catch(err){_iterator121.e(err);}finally{_iterator121.f();}}return _createClass(_class5,[{key:"update",value:function update(t){var e=t.state.facet(nh);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new oh(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new oh(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();var i=t.state.facet(fh);if(i!=this.input){var _e159=i.filter(function(t){return t;}),_s121=[],_r101=[],_n82=[],_h50=[];var _iterator122=_createForOfIteratorHelper(_e159),_step122;try{for(_iterator122.s();!(_step122=_iterator122.n()).done;){var _i135=_step122.value;var _e160=void 0,_l51=this.specs.indexOf(_i135);_l51<0?(_e160=_i135(t.view),_h50.push(_e160)):(_e160=this.panels[_l51],_e160.update&&_e160.update(t)),_s121.push(_e160),(_e160.top?_r101:_n82).push(_e160);}}catch(err){_iterator122.e(err);}finally{_iterator122.f();}this.specs=_e159,this.panels=_s121,this.top.sync(_r101),this.bottom.sync(_n82);for(var _i134=0,_h51=_h50;_i134<_h51.length;_i134++){var _t181=_h51[_i134];_t181.dom.classList.add("cm-panel"),_t181.mount&&_t181.mount();}}else{var _iterator123=_createForOfIteratorHelper(this.panels),_step123;try{for(_iterator123.s();!(_step123=_iterator123.n()).done;){var _e161=_step123.value;_e161.update&&_e161.update(t);}}catch(err){_iterator123.e(err);}finally{_iterator123.f();}}}},{key:"destroy",value:function destroy(){this.top.sync([]),this.bottom.sync([]);}}]);}(),{provide:function provide(t){return Ur.scrollMargins.of(function(e){var i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()};});}});oh=/*#__PURE__*/function(){function oh(t,e,i){_classCallCheck(this,oh);this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses();}return _createClass(oh,[{key:"sync",value:function sync(t){var _iterator124=_createForOfIteratorHelper(this.panels),_step124;try{for(_iterator124.s();!(_step124=_iterator124.n()).done;){var _e162=_step124.value;_e162.destroy&&t.indexOf(_e162)<0&&_e162.destroy();}}catch(err){_iterator124.e(err);}finally{_iterator124.f();}this.panels=t,this.syncDOM();}},{key:"syncDOM",value:function syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";var _t182=this.container||this.view.dom;_t182.insertBefore(this.dom,this.top?_t182.firstChild:null);}var t=this.dom.firstChild;var _iterator125=_createForOfIteratorHelper(this.panels),_step125;try{for(_iterator125.s();!(_step125=_iterator125.n()).done;){var _e163=_step125.value;if(_e163.dom.parentNode==this.dom){for(;t!=_e163.dom;)t=uh(t);t=t.nextSibling;}else this.dom.insertBefore(_e163.dom,t);}}catch(err){_iterator125.e(err);}finally{_iterator125.f();}for(;t;)t=uh(t);}},{key:"scrollMargin",value:function scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top);}},{key:"syncClasses",value:function syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){var _iterator126=_createForOfIteratorHelper(this.classes.split(" ")),_step126;try{for(_iterator126.s();!(_step126=_iterator126.n()).done;){var _t183=_step126.value;_t183&&this.container.classList.remove(_t183);}}catch(err){_iterator126.e(err);}finally{_iterator126.f();}var _iterator127=_createForOfIteratorHelper((this.classes=this.view.themeClasses).split(" ")),_step127;try{for(_iterator127.s();!(_step127=_iterator127.n()).done;){var _t184=_step127.value;_t184&&this.container.classList.add(_t184);}}catch(err){_iterator127.e(err);}finally{_iterator127.f();}}}}]);}();fh=j.define({enables:lh});ah=/*#__PURE__*/function(_Ct2){function ah(){_classCallCheck(this,ah);return _callSuper(this,ah,arguments);}_inherits(ah,_Ct2);return _createClass(ah,[{key:"compare",value:function compare(t){return this==t||this.constructor==t.constructor&&this.eq(t);}},{key:"eq",value:function eq(t){return!1;}},{key:"destroy",value:function destroy(t){}}]);}(Ct);ah.prototype.elementClass="",ah.prototype.toDOM=void 0,ah.prototype.mapMode=x.TrackBefore,ah.prototype.startSide=ah.prototype.endSide=-1,ah.prototype.point=!0;ch=j.define();dh={"class":"",renderEmptyElements:!1,elementStyle:"",markers:function markers(){return It.empty;},lineMarker:function lineMarker(){return null;},widgetMarker:function widgetMarker(){return null;},lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}};ph=j.define();gh=j.define({combine:function combine(t){return t.some(function(t){return t;});}});bh=_i.fromClass(/*#__PURE__*/function(){function _class6(t){_classCallCheck(this,_class6);this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(ph).map(function(e){return new Mh(t,e);});var _iterator128=_createForOfIteratorHelper(this.gutters),_step128;try{for(_iterator128.s();!(_step128=_iterator128.n()).done;){var _t185=_step128.value;this.dom.appendChild(_t185.dom);}}catch(err){_iterator128.e(err);}finally{_iterator128.f();}this.fixed=!t.state.facet(gh),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM);}return _createClass(_class6,[{key:"update",value:function update(t){if(this.updateGutters(t)){var _e164=this.prevViewport,_i136=t.view.viewport,_s122=Math.min(_e164.to,_i136.to)-Math.max(_e164.from,_i136.from);this.syncGutters(_s122<.8*(_i136.to-_i136.from));}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(gh)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport;}},{key:"syncGutters",value:function syncGutters(t){var _this63=this;var e=this.dom.nextSibling;t&&this.dom.remove();var i=It.iter(this.view.state.facet(ch),this.view.viewport.from),s=[],r=this.gutters.map(function(t){return new yh(t,_this63.view.viewport,-_this63.view.documentPadding.top);});var _iterator129=_createForOfIteratorHelper(this.view.viewportLineBlocks),_step129;try{for(_iterator129.s();!(_step129=_iterator129.n()).done;){var _t186=_step129.value;if(s.length&&(s=[]),Array.isArray(_t186.type)){var _e165=!0;var _iterator131=_createForOfIteratorHelper(_t186.type),_step131;try{for(_iterator131.s();!(_step131=_iterator131.n()).done;){var _n83=_step131.value;if(_n83.type==ri.Text&&_e165){kh(i,s,_n83.from);var _iterator132=_createForOfIteratorHelper(r),_step132;try{for(_iterator132.s();!(_step132=_iterator132.n()).done;){var _t187=_step132.value;_t187.line(this.view,_n83,s);}}catch(err){_iterator132.e(err);}finally{_iterator132.f();}_e165=!1;}else if(_n83.widget){var _iterator133=_createForOfIteratorHelper(r),_step133;try{for(_iterator133.s();!(_step133=_iterator133.n()).done;){var _t188=_step133.value;_t188.widget(this.view,_n83);}}catch(err){_iterator133.e(err);}finally{_iterator133.f();}}}}catch(err){_iterator131.e(err);}finally{_iterator131.f();}}else if(_t186.type==ri.Text){kh(i,s,_t186.from);var _iterator134=_createForOfIteratorHelper(r),_step134;try{for(_iterator134.s();!(_step134=_iterator134.n()).done;){var _e166=_step134.value;_e166.line(this.view,_t186,s);}}catch(err){_iterator134.e(err);}finally{_iterator134.f();}}else if(_t186.widget){var _iterator135=_createForOfIteratorHelper(r),_step135;try{for(_iterator135.s();!(_step135=_iterator135.n()).done;){var _e167=_step135.value;_e167.widget(this.view,_t186);}}catch(err){_iterator135.e(err);}finally{_iterator135.f();}}}}catch(err){_iterator129.e(err);}finally{_iterator129.f();}var _iterator130=_createForOfIteratorHelper(r),_step130;try{for(_iterator130.s();!(_step130=_iterator130.n()).done;){var _t189=_step130.value;_t189.finish();}}catch(err){_iterator130.e(err);}finally{_iterator130.f();}t&&this.view.scrollDOM.insertBefore(this.dom,e);}},{key:"updateGutters",value:function updateGutters(t){var e=t.startState.facet(ph),i=t.state.facet(ph),s=t.docChanged||t.heightChanged||t.viewportChanged||!It.eq(t.startState.facet(ch),t.state.facet(ch),t.view.viewport.from,t.view.viewport.to);if(e==i){var _iterator136=_createForOfIteratorHelper(this.gutters),_step136;try{for(_iterator136.s();!(_step136=_iterator136.n()).done;){var _e168=_step136.value;_e168.update(t)&&(s=!0);}}catch(err){_iterator136.e(err);}finally{_iterator136.f();}}else{s=!0;var _r102=[];var _iterator137=_createForOfIteratorHelper(i),_step137;try{for(_iterator137.s();!(_step137=_iterator137.n()).done;){var _s123=_step137.value;var _i138=e.indexOf(_s123);_i138<0?_r102.push(new Mh(this.view,_s123)):(this.gutters[_i138].update(t),_r102.push(this.gutters[_i138]));}}catch(err){_iterator137.e(err);}finally{_iterator137.f();}var _iterator138=_createForOfIteratorHelper(this.gutters),_step138;try{for(_iterator138.s();!(_step138=_iterator138.n()).done;){var _t191=_step138.value;_t191.dom.remove(),_r102.indexOf(_t191)<0&&_t191.destroy();}}catch(err){_iterator138.e(err);}finally{_iterator138.f();}for(var _i137=0,_r103=_r102;_i137<_r103.length;_i137++){var _t190=_r103[_i137];this.dom.appendChild(_t190.dom);}this.gutters=_r102;}return s;}},{key:"destroy",value:function destroy(){var _iterator139=_createForOfIteratorHelper(this.gutters),_step139;try{for(_iterator139.s();!(_step139=_iterator139.n()).done;){var _t192=_step139.value;_t192.destroy();}}catch(err){_iterator139.e(err);}finally{_iterator139.f();}this.dom.remove();}}]);}(),{provide:function provide(t){return Ur.scrollMargins.of(function(e){var i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==pi.LTR?{left:i.dom.offsetWidth*e.scaleX}:{right:i.dom.offsetWidth*e.scaleX}:null;});}});yh=/*#__PURE__*/function(){function yh(t,e,i){_classCallCheck(this,yh);this.gutter=t,this.height=i,this.i=0,this.cursor=It.iter(t.markers,e.from);}return _createClass(yh,[{key:"addElement",value:function addElement(t,e,i){var s=this.gutter,r=(e.top-this.height)/t.scaleY,n=e.height/t.scaleY;if(this.i==s.elements.length){var _e169=new xh(t,n,r,i);s.elements.push(_e169),s.dom.appendChild(_e169.dom);}else s.elements[this.i].update(t,n,r,i);this.height=e.bottom,this.i++;}},{key:"line",value:function line(t,e,i){var s=[];kh(this.cursor,s,e.from),i.length&&(s=s.concat(i));var r=this.gutter.config.lineMarker(t,e,s);r&&s.unshift(r);var n=this.gutter;(0!=s.length||n.config.renderEmptyElements)&&this.addElement(t,e,s);}},{key:"widget",value:function widget(t,e){var i=this.gutter.config.widgetMarker(t,e.widget,e);i&&this.addElement(t,e,[i]);}},{key:"finish",value:function finish(){var t=this.gutter;for(;t.elements.length>this.i;){var _e170=t.elements.pop();t.dom.removeChild(_e170.dom),_e170.destroy();}}}]);}();Mh=/*#__PURE__*/function(){function Mh(t,e){var _this64=this;_classCallCheck(this,Mh);this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config["class"]?" "+this.config["class"]:"");var _loop10=function _loop10(_i139){_this64.dom.addEventListener(_i139,function(s){var r,n=s.target;if(n!=_this64.dom&&_this64.dom.contains(n)){for(;n.parentNode!=_this64.dom;)n=n.parentNode;var _t193=n.getBoundingClientRect();r=(_t193.top+_t193.bottom)/2;}else r=s.clientY;var h=t.lineBlockAtHeight(r-t.documentTop);e.domEventHandlers[_i139](t,h,s)&&s.preventDefault();});};for(var _i139 in e.domEventHandlers){_loop10(_i139);}this.markers=vh(e.markers(t)),e.initialSpacer&&(this.spacer=new xh(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none");}return _createClass(Mh,[{key:"update",value:function update(t){var e=this.markers;if(this.markers=vh(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){var _e171=this.config.updateSpacer(this.spacer.markers[0],t);_e171!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[_e171]);}var i=t.view.viewport;return!It.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t);}},{key:"destroy",value:function destroy(){var _iterator140=_createForOfIteratorHelper(this.elements),_step140;try{for(_iterator140.s();!(_step140=_iterator140.n()).done;){var _t194=_step140.value;_t194.destroy();}}catch(err){_iterator140.e(err);}finally{_iterator140.f();}}}]);}();xh=/*#__PURE__*/function(){function xh(t,e,i,s){_classCallCheck(this,xh);this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,s);}return _createClass(xh,[{key:"update",value:function update(t,e,i,s){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(var _i140=0;_i140<t.length;_i140++)if(!t[_i140].compare(e[_i140]))return!1;return!0;}(this.markers,s)||this.setMarkers(t,s);}},{key:"setMarkers",value:function setMarkers(t,e){var i="cm-gutterElement",s=this.dom.firstChild;for(var _r104=0,_n84=0;;){var _h52=_n84,_l52=_r104<e.length?e[_r104++]:null,_o35=!1;if(_l52){var _t195=_l52.elementClass;_t195&&(i+=" "+_t195);for(var _t196=_n84;_t196<this.markers.length;_t196++)if(this.markers[_t196].compare(_l52)){_h52=_t196,_o35=!0;break;}}else _h52=this.markers.length;for(;_n84<_h52;){var _t197=this.markers[_n84++];if(_t197.toDOM){_t197.destroy(s);var _e172=s.nextSibling;s.remove(),s=_e172;}}if(!_l52)break;_l52.toDOM&&(_o35?s=s.nextSibling:this.dom.insertBefore(_l52.toDOM(t),s)),_o35&&_n84++;}this.dom.className=i,this.markers=e;}},{key:"destroy",value:function destroy(){this.setMarkers(null,[]);}}]);}();Sh=j.define();Ah=j.define({combine:function combine(t){return At(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers:function domEventHandlers(t,e){var i=Object.assign({},t);var _loop11=function _loop11(){var s=i[_t198],r=e[_t198];i[_t198]=s?function(t,e,i){return s(t,e,i)||r(t,e,i);}:r;};for(var _t198 in e){_loop11();}return i;}});}});Ch=/*#__PURE__*/function(_ah){function Ch(t){var _this65;_classCallCheck(this,Ch);_this65=_callSuper(this,Ch),_this65.number=t;return _this65;}_inherits(Ch,_ah);return _createClass(Ch,[{key:"eq",value:function eq(t){return this.number==t.number;}},{key:"toDOM",value:function toDOM(){return document.createTextNode(this.number);}}]);}(ah);Dh=ph.compute([Ah],function(t){return{"class":"cm-lineNumbers",renderEmptyElements:!1,markers:function markers(t){return t.state.facet(Sh);},lineMarker:function lineMarker(t,e,i){return i.some(function(t){return t.toDOM;})?null:new Ch(Oh(t,t.state.doc.lineAt(e.from).number));},widgetMarker:function widgetMarker(){return null;},lineMarkerChange:function lineMarkerChange(t){return t.startState.facet(Ah)!=t.state.facet(Ah);},initialSpacer:function initialSpacer(t){return new Ch(Oh(t,Ih(t.state.doc.lines)));},updateSpacer:function updateSpacer(t,e){var i=Oh(e.view,Ih(e.view.state.doc.lines));return i==t.number?t:new Ch(i);},domEventHandlers:t.facet(Ah).domEventHandlers};});Rh=new(/*#__PURE__*/function(_ah2){function _class7(){var _this66;_classCallCheck(this,_class7);_this66=_callSuper(this,_class7,arguments),_this66.elementClass="cm-activeLineGutter";return _this66;}_inherits(_class7,_ah2);return _createClass(_class7);}(ah))();Th=ch.compute(["selection"],function(t){var e=[],i=-1;var _iterator141=_createForOfIteratorHelper(t.selection.ranges),_step141;try{for(_iterator141.s();!(_step141=_iterator141.n()).done;){var _s124=_step141.value;var _r105=t.doc.lineAt(_s124.head).from;_r105>i&&(i=_r105,e.push(Rh.range(_r105)));}}catch(err){_iterator141.e(err);}finally{_iterator141.f();}return It.of(e);});_export("D",Bh=1024);Lh=0;Nh=/*#__PURE__*/_createClass(function Nh(t,e){_classCallCheck(this,Nh);this.from=t,this.to=e;});_export("b",jh=/*#__PURE__*/function(){function jh(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,jh);this.id=Lh++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||function(){throw new Error("This node type doesn't define a deserialize function");};}return _createClass(jh,[{key:"add",value:function add(t){var _this67=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=Ph.match(t)),function(e){var i=t(e);return void 0===i?null:[_this67,i];};}}]);}());jh.closedBy=new jh({deserialize:function deserialize(t){return t.split(" ");}}),jh.openedBy=new jh({deserialize:function deserialize(t){return t.split(" ");}}),jh.group=new jh({deserialize:function deserialize(t){return t.split(" ");}}),jh.isolate=new jh({deserialize:function deserialize(t){if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto";}}),jh.contextHash=new jh({perNode:!0}),jh.lookAhead=new jh({perNode:!0}),jh.mounted=new jh({perNode:!0});$h=/*#__PURE__*/function(){function $h(t,e,i){_classCallCheck(this,$h);this.tree=t,this.overlay=e,this.parser=i;}return _createClass($h,null,[{key:"get",value:function get(t){return t&&t.props&&t.props[jh.mounted.id];}}]);}();zh=Object.create(null);_export("a",Ph=/*#__PURE__*/function(){function Ph(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;_classCallCheck(this,Ph);this.name=t,this.props=e,this.id=i,this.flags=s;}return _createClass(Ph,[{key:"prop",value:function prop(t){return this.props[t.id];}},{key:"isTop",get:function get(){return(1&this.flags)>0;}},{key:"isSkipped",get:function get(){return(2&this.flags)>0;}},{key:"isError",get:function get(){return(4&this.flags)>0;}},{key:"isAnonymous",get:function get(){return(8&this.flags)>0;}},{key:"is",value:function is(t){if("string"==typeof t){if(this.name==t)return!0;var _e173=this.prop(jh.group);return!!_e173&&_e173.indexOf(t)>-1;}return this.id==t;}}],[{key:"define",value:function define(t){var e=t.props&&t.props.length?Object.create(null):zh,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),s=new Ph(t.name||"",e,t.id,i);if(t.props){var _iterator142=_createForOfIteratorHelper(t.props),_step142;try{for(_iterator142.s();!(_step142=_iterator142.n()).done;){var _i141=_step142.value;if(Array.isArray(_i141)||(_i141=_i141(s)),_i141){if(_i141[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[_i141[0].id]=_i141[1];}}}catch(err){_iterator142.e(err);}finally{_iterator142.f();}}return s;}},{key:"match",value:function match(t){var e=Object.create(null);for(var _i142 in t){var _iterator143=_createForOfIteratorHelper(_i142.split(" ")),_step143;try{for(_iterator143.s();!(_step143=_iterator143.n()).done;){var _s125=_step143.value;e[_s125]=t[_i142];}}catch(err){_iterator143.e(err);}finally{_iterator143.f();}}return function(t){for(var _i143=t.prop(jh.group),_s126=-1;_s126<(_i143?_i143.length:0);_s126++){var _r106=e[_s126<0?t.name:_i143[_s126]];if(_r106)return _r106;}};}}]);}());Ph.none=new Ph("",Object.create(null),0,8);_export("N",Hh=/*#__PURE__*/function(){function Hh(t){_classCallCheck(this,Hh);this.types=t;for(var _e174=0;_e174<t.length;_e174++)if(t[_e174].id!=_e174)throw new RangeError("Node type ids should correspond to array positions when creating a node set");}return _createClass(Hh,[{key:"extend",value:function extend(){var e=[];for(var _len4=arguments.length,t=new Array(_len4),_key4=0;_key4<_len4;_key4++){t[_key4]=arguments[_key4];}var _iterator144=_createForOfIteratorHelper(this.types),_step144;try{for(_iterator144.s();!(_step144=_iterator144.n()).done;){var _i144=_step144.value;var _s127=null;var _iterator145=_createForOfIteratorHelper(t),_step145;try{for(_iterator145.s();!(_step145=_iterator145.n()).done;){var _e175=_step145.value;var _t199=_e175(_i144);_t199&&(_s127||(_s127=Object.assign({},_i144.props)),_s127[_t199[0].id]=_t199[1]);}}catch(err){_iterator145.e(err);}finally{_iterator145.f();}e.push(_s127?new Ph(_i144.name,_s127,_i144.id,_i144.flags):_i144);}}catch(err){_iterator144.e(err);}finally{_iterator144.f();}return new Hh(e);}}]);}());Wh=new WeakMap();Vh=new WeakMap();!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays";}(Fh||_export("I",Fh={}));_export("T",qh=/*#__PURE__*/function(){function qh(t,e,i,s,r){_classCallCheck(this,qh);if(this.type=t,this.children=e,this.positions=i,this.length=s,this.props=null,r&&r.length){this.props=Object.create(null);var _iterator146=_createForOfIteratorHelper(r),_step146;try{for(_iterator146.s();!(_step146=_iterator146.n()).done;){var _step146$value=_slicedToArray(_step146.value,2),_t200=_step146$value[0],_e176=_step146$value[1];this.props["number"==typeof _t200?_t200:_t200.id]=_e176;}}catch(err){_iterator146.e(err);}finally{_iterator146.f();}}}return _createClass(qh,[{key:"toString",value:function toString(){var t=$h.get(this);if(t&&!t.overlay)return t.tree.toString();var e="";var _iterator147=_createForOfIteratorHelper(this.children),_step147;try{for(_iterator147.s();!(_step147=_iterator147.n()).done;){var _t201=_step147.value;var _i145=_t201.toString();_i145&&(e&&(e+=","),e+=_i145);}}catch(err){_iterator147.e(err);}finally{_iterator147.f();}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(e.length?"("+e+")":""):e;}},{key:"cursor",value:function cursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return new sl(this.topNode,t);}},{key:"cursorAt",value:function cursorAt(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=Wh.get(this)||this.topNode,r=new sl(s);return r.moveTo(t,e),Wh.set(this,r._tree),r;}},{key:"topNode",get:function get(){return new Xh(this,0,0,null);}},{key:"resolve",value:function resolve(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=Kh(Wh.get(this)||this.topNode,t,e,!1);return Wh.set(this,i),i;}},{key:"resolveInner",value:function resolveInner(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=Kh(Vh.get(this)||this.topNode,t,e,!0);return Vh.set(this,i),i;}},{key:"resolveStack",value:function resolveStack(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return function(t,e,i){var s=t.resolveInner(e,i),r=null;for(var _t202=s instanceof Xh?s:s.context.parent;_t202;_t202=_t202.parent)if(_t202.index<0){var _n85=_t202.parent;(r||(r=[s])).push(_n85.resolve(e,i)),_t202=_n85;}else{var _n86=$h.get(_t202.tree);if(_n86&&_n86.overlay&&_n86.overlay[0].from<=e&&_n86.overlay[_n86.overlay.length-1].to>=e){var _h53=new Xh(_n86.tree,_n86.overlay[0].from+_t202.from,-1,_t202);(r||(r=[s])).push(Kh(_h53,e,i,!1));}}return r?el(r):s;}(this,t,e);}},{key:"iterate",value:function iterate(t){var e=t.enter,i=t.leave,_t$from=t.from,s=_t$from===void 0?0:_t$from,_t$to=t.to,r=_t$to===void 0?this.length:_t$to,n=t.mode||0,h=(n&Fh.IncludeAnonymous)>0;for(var _t203=this.cursor(n|Fh.IncludeAnonymous);;){var _n87=!1;if(_t203.from<=r&&_t203.to>=s&&(!h&&_t203.type.isAnonymous||!1!==e(_t203))){if(_t203.firstChild())continue;_n87=!0;}for(;_n87&&i&&(h||!_t203.type.isAnonymous)&&i(_t203),!_t203.nextSibling();){if(!_t203.parent())return;_n87=!0;}}}},{key:"prop",value:function prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t);}},{key:"propValues",get:function get(){var t=[];if(this.props)for(var _e177 in this.props)t.push([+_e177,this.props[_e177]]);return t;}},{key:"balance",value:function balance(){var _this68=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return this.children.length<=8?this:ll(Ph.none,this.children,this.positions,0,this.children.length,0,this.length,function(t,e,i){return new qh(_this68.type,t,e,i,_this68.propValues);},t.makeTree||function(t,e,i){return new qh(Ph.none,t,e,i);});}}],[{key:"build",value:function build(t){return function(t){var e;var i=t.buffer,s=t.nodeSet,_t$maxBufferLength=t.maxBufferLength,r=_t$maxBufferLength===void 0?Bh:_t$maxBufferLength,_t$reused=t.reused,n=_t$reused===void 0?[]:_t$reused,_t$minRepeatType=t.minRepeatType,h=_t$minRepeatType===void 0?s.types.length:_t$minRepeatType,l=Array.isArray(i)?new Uh(i,i.length):i,o=s.types,u=0,f=0;function a(t,e,i,b,v,k){var y=l.id,M=l.start,x=l.end,S=l.size,A=f;for(;S<0;){if(l.next(),-1==S){var _e178=n[y];return i.push(_e178),void b.push(M-t);}if(-3==S)return void(u=y);if(-4==S)return void(f=y);throw new RangeError("Unrecognized record size: ".concat(S));}var C,O,D=o[y],E=M-t;if(x-M<=r&&(O=g(l.pos-e,v))){var _e179=new Uint16Array(O.size-O.skip),_i146=l.pos-O.size,_r107=_e179.length;for(;l.pos>_i146;)_r107=w(O.start,_e179,_r107);C=new Jh(_e179,x-O.start,s),E=O.start-t;}else{var _t204=l.pos-S;l.next();var _e180=[],_i147=[],_s128=y>=h?y:-1,_n88=0,_o36=x;for(;l.pos>_t204;)_s128>=0&&l.id==_s128&&l.size>=0?(l.end<=_o36-r&&(p(_e180,_i147,M,_n88,l.end,_o36,_s128,A),_n88=_e180.length,_o36=l.end),l.next()):k>2500?c(M,_t204,_e180,_i147):a(M,_t204,_e180,_i147,_s128,k+1);if(_s128>=0&&_n88>0&&_n88<_e180.length&&p(_e180,_i147,M,_n88,M,_o36,_s128,A),_e180.reverse(),_i147.reverse(),_s128>-1&&_n88>0){var _t205=d(D);C=ll(D,_e180,_i147,0,_e180.length,0,x-M,_t205,_t205);}else C=m(D,_e180,_i147,x-M,A-x);}i.push(C),b.push(E);}function c(t,e,i,n){var h=[],o=0,u=-1;for(;l.pos>e;){var _t206=l.id,_e181=l.start,_i148=l.end,_s129=l.size;if(_s129>4)l.next();else{if(u>-1&&_e181<u)break;u<0&&(u=_i148-r),h.push(_t206,_e181,_i148),o++,l.next();}}if(o){var _e182=new Uint16Array(4*o),_r108=h[h.length-2];for(var _t207=h.length-3,_i149=0;_t207>=0;_t207-=3)_e182[_i149++]=h[_t207],_e182[_i149++]=h[_t207+1]-_r108,_e182[_i149++]=h[_t207+2]-_r108,_e182[_i149++]=_i149;i.push(new Jh(_e182,h[2]-_r108,s)),n.push(_r108-t);}}function d(t){return function(e,i,s){var r,n,h=0,l=e.length-1;if(l>=0&&(r=e[l])instanceof qh){if(!l&&r.type==t&&r.length==s)return r;(n=r.prop(jh.lookAhead))&&(h=i[l]+r.length+n);}return m(t,e,i,s,h);};}function p(t,e,i,r,n,h,l,o){var u=[],f=[];for(;t.length>r;)u.push(t.pop()),f.push(e.pop()+i-n);t.push(m(s.types[l],u,f,h-n,o-h)),e.push(n-i);}function m(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var n=arguments.length>5?arguments[5]:undefined;if(u){var _t208=[jh.contextHash,u];n=n?[_t208].concat(n):[_t208];}if(r>25){var _t209=[jh.lookAhead,r];n=n?[_t209].concat(n):[_t209];}return new qh(t,e,i,s,n);}function g(t,e){var i=l.fork(),s=0,n=0,o=0,u=i.end-r,f={size:0,start:0,skip:0};t:for(var _r109=i.pos-t;i.pos>_r109;){var _t210=i.size;if(i.id==e&&_t210>=0){f.size=s,f.start=n,f.skip=o,o+=4,s+=4,i.next();continue;}var _l53=i.pos-_t210;if(_t210<0||_l53<_r109||i.start<u)break;var _a15=i.id>=h?4:0,_c13=i.start;for(i.next();i.pos>_l53;){if(i.size<0){if(-3!=i.size)break t;_a15+=4;}else i.id>=h&&(_a15+=4);i.next();}n=_c13,s+=_t210,o+=_a15;}return(e<0||s==t)&&(f.size=s,f.start=n,f.skip=o),f.size>4?f:void 0;}function w(t,e,i){var s=l.id,r=l.start,n=l.end,o=l.size;if(l.next(),o>=0&&s<h){var _h54=i;if(o>4){var _s130=l.pos-(o-4);for(;l.pos>_s130;)i=w(t,e,i);}e[--i]=_h54,e[--i]=n-t,e[--i]=r-t,e[--i]=s;}else-3==o?u=s:-4==o&&(f=s);return i;}var b=[],v=[];for(;l.pos>0;)a(t.start||0,t.bufferStart||0,b,v,-1,0);var k=null!==(e=t.length)&&void 0!==e?e:b.length?v[0]+b[0].length:0;return new qh(o[t.topID],b.reverse(),v.reverse(),k);}(t);}}]);}());qh.empty=new qh(Ph.none,[],[],0);Uh=/*#__PURE__*/function(){function Uh(t,e){_classCallCheck(this,Uh);this.buffer=t,this.index=e;}return _createClass(Uh,[{key:"id",get:function get(){return this.buffer[this.index-4];}},{key:"start",get:function get(){return this.buffer[this.index-3];}},{key:"end",get:function get(){return this.buffer[this.index-2];}},{key:"size",get:function get(){return this.buffer[this.index-1];}},{key:"pos",get:function get(){return this.index;}},{key:"next",value:function next(){this.index-=4;}},{key:"fork",value:function fork(){return new Uh(this.buffer,this.index);}}]);}();Jh=/*#__PURE__*/function(){function Jh(t,e,i){_classCallCheck(this,Jh);this.buffer=t,this.length=e,this.set=i;}return _createClass(Jh,[{key:"type",get:function get(){return Ph.none;}},{key:"toString",value:function toString(){var t=[];for(var _e183=0;_e183<this.buffer.length;)t.push(this.childString(_e183)),_e183=this.buffer[_e183+3];return t.join(",");}},{key:"childString",value:function childString(t){var e=this.buffer[t],i=this.buffer[t+3],s=this.set.types[e],r=s.name;if(/\W/.test(r)&&!s.isError&&(r=JSON.stringify(r)),i==(t+=4))return r;var n=[];for(;t<i;)n.push(this.childString(t)),t=this.buffer[t+3];return r+"("+n.join(",")+")";}},{key:"findChild",value:function findChild(t,e,i,s,r){var n=this.buffer,h=-1;for(var _l54=t;_l54!=e&&!(Gh(r,s,n[_l54+1],n[_l54+2])&&(h=_l54,i>0));_l54=n[_l54+3]);return h;}},{key:"slice",value:function slice(t,e,i){var s=this.buffer,r=new Uint16Array(e-t),n=0;for(var _h55=t,_l55=0;_h55<e;){r[_l55++]=s[_h55++],r[_l55++]=s[_h55++]-i;var _e184=r[_l55++]=s[_h55++]-i;r[_l55++]=s[_h55++]-t,n=Math.max(n,_e184);}return new Jh(r,n,this.set);}}]);}();_h=/*#__PURE__*/function(){function _h(){_classCallCheck(this,_h);}return _createClass(_h,[{key:"cursor",value:function cursor(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return new sl(this,t);}},{key:"getChild",value:function getChild(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var s=Yh(this,t,e,i);return s.length?s[0]:null;}},{key:"getChildren",value:function getChildren(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return Yh(this,t,e,i);}},{key:"resolve",value:function resolve(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Kh(this,t,e,!1);}},{key:"resolveInner",value:function resolveInner(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Kh(this,t,e,!0);}},{key:"matchContext",value:function matchContext(t){return Qh(this,t);}},{key:"enterUnfinishedNodesBefore",value:function enterUnfinishedNodesBefore(t){var e=this.childBefore(t),i=this;for(;e;){var _t211=e.lastChild;if(!_t211||_t211.to!=e.to)break;_t211.type.isError&&_t211.from==_t211.to?(i=e,e=_t211.prevSibling):e=_t211;}return i;}},{key:"node",get:function get(){return this;}},{key:"next",get:function get(){return this.parent;}}]);}();Xh=/*#__PURE__*/function(_h57){function Xh(t,e,i,s){var _this69;_classCallCheck(this,Xh);_this69=_callSuper(this,Xh),_this69._tree=t,_this69.from=e,_this69.index=i,_this69._parent=s;return _this69;}_inherits(Xh,_h57);return _createClass(Xh,[{key:"type",get:function get(){return this._tree.type;}},{key:"name",get:function get(){return this._tree.type.name;}},{key:"to",get:function get(){return this.from+this._tree.length;}},{key:"nextChild",value:function nextChild(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;for(var _n89=this;;){for(var _n89$_tree=_n89._tree,_h58=_n89$_tree.children,_l56=_n89$_tree.positions,_o37=e>0?_h58.length:-1;t!=_o37;t+=e){var _o38=_h58[t],_u38=_l56[t]+_n89.from;if(Gh(s,i,_u38,_u38+_o38.length))if(_o38 instanceof Jh){if(r&Fh.ExcludeBuffers)continue;var _h59=_o38.findChild(0,_o38.buffer.length,e,i-_u38,s);if(_h59>-1)return new tl(new Zh(_n89,_o38,t,_u38),null,_h59);}else if(r&Fh.IncludeAnonymous||!_o38.type.isAnonymous||rl(_o38)){var _h60=void 0;if(!(r&Fh.IgnoreMounts)&&(_h60=$h.get(_o38))&&!_h60.overlay)return new Xh(_h60.tree,_u38,t,_n89);var _l57=new Xh(_o38,_u38,t,_n89);return r&Fh.IncludeAnonymous||!_l57.type.isAnonymous?_l57:_l57.nextChild(e<0?_o38.children.length-1:0,e,i,s);}}if(r&Fh.IncludeAnonymous||!_n89.type.isAnonymous)return null;if(t=_n89.index>=0?_n89.index+e:e<0?-1:_n89._parent._tree.children.length,_n89=_n89._parent,!_n89)return null;}}},{key:"firstChild",get:function get(){return this.nextChild(0,1,0,4);}},{key:"lastChild",get:function get(){return this.nextChild(this._tree.children.length-1,-1,0,4);}},{key:"childAfter",value:function childAfter(t){return this.nextChild(0,1,t,2);}},{key:"childBefore",value:function childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2);}},{key:"enter",value:function enter(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s;if(!(i&Fh.IgnoreOverlays)&&(s=$h.get(this._tree))&&s.overlay){var _i150=t-this.from;var _iterator148=_createForOfIteratorHelper(s.overlay),_step148;try{for(_iterator148.s();!(_step148=_iterator148.n()).done;){var _step148$value=_step148.value,_t212=_step148$value.from,_r110=_step148$value.to;if((e>0?_t212<=_i150:_t212<_i150)&&(e<0?_r110>=_i150:_r110>_i150))return new Xh(s.tree,s.overlay[0].from+this.from,-1,this);}}catch(err){_iterator148.e(err);}finally{_iterator148.f();}}return this.nextChild(0,1,t,e,i);}},{key:"nextSignificantParent",value:function nextSignificantParent(){var t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t;}},{key:"parent",get:function get(){return this._parent?this._parent.nextSignificantParent():null;}},{key:"nextSibling",get:function get(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null;}},{key:"prevSibling",get:function get(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null;}},{key:"tree",get:function get(){return this._tree;}},{key:"toTree",value:function toTree(){return this._tree;}},{key:"toString",value:function toString(){return this._tree.toString();}}]);}(_h);Zh=/*#__PURE__*/_createClass(function Zh(t,e,i,s){_classCallCheck(this,Zh);this.parent=t,this.buffer=e,this.index=i,this.start=s;});tl=/*#__PURE__*/function(_h61){function tl(t,e,i){var _this70;_classCallCheck(this,tl);_this70=_callSuper(this,tl),_this70.context=t,_this70._parent=e,_this70.index=i,_this70.type=t.buffer.set.types[t.buffer.buffer[i]];return _this70;}_inherits(tl,_h61);return _createClass(tl,[{key:"name",get:function get(){return this.type.name;}},{key:"from",get:function get(){return this.context.start+this.context.buffer.buffer[this.index+1];}},{key:"to",get:function get(){return this.context.start+this.context.buffer.buffer[this.index+2];}},{key:"child",value:function child(t,e,i){var s=this.context.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],t,e-this.context.start,i);return r<0?null:new tl(this.context,this,r);}},{key:"firstChild",get:function get(){return this.child(1,0,4);}},{key:"lastChild",get:function get(){return this.child(-1,0,4);}},{key:"childAfter",value:function childAfter(t){return this.child(1,t,2);}},{key:"childBefore",value:function childBefore(t){return this.child(-1,t,-2);}},{key:"enter",value:function enter(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;if(i&Fh.ExcludeBuffers)return null;var s=this.context.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return r<0?null:new tl(this.context,this,r);}},{key:"parent",get:function get(){return this._parent||this.context.parent.nextSignificantParent();}},{key:"externalSibling",value:function externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4);}},{key:"nextSibling",get:function get(){var t=this.context.buffer,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new tl(this.context,this._parent,e):this.externalSibling(1);}},{key:"prevSibling",get:function get(){var t=this.context.buffer,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new tl(this.context,this._parent,t.findChild(e,this.index,-1,0,4));}},{key:"tree",get:function get(){return null;}},{key:"toTree",value:function toTree(){var t=[],e=[],i=this.context.buffer,s=this.index+4,r=i.buffer[this.index+3];if(r>s){var _n90=i.buffer[this.index+1];t.push(i.slice(s,r,_n90)),e.push(0);}return new qh(this.type,t,e,this.to-this.from);}},{key:"toString",value:function toString(){return this.context.buffer.childString(this.index);}}]);}(_h);il=/*#__PURE__*/function(){function il(t,e){_classCallCheck(this,il);this.heads=t,this.node=e;}return _createClass(il,[{key:"next",get:function get(){return el(this.heads);}}]);}();sl=/*#__PURE__*/function(){function sl(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;_classCallCheck(this,sl);if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof Xh)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(var _e186=t._parent;_e186;_e186=_e186._parent)this.stack.unshift(_e186.index);this.bufferNode=t,this.yieldBuf(t.index);}}return _createClass(sl,[{key:"name",get:function get(){return this.type.name;}},{key:"yieldNode",value:function yieldNode(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0);}},{key:"yieldBuf",value:function yieldBuf(t,e){this.index=t;var _this$buffer=this.buffer,i=_this$buffer.start,s=_this$buffer.buffer;return this.type=e||s.set.types[s.buffer[t]],this.from=i+s.buffer[t+1],this.to=i+s.buffer[t+2],!0;}},{key:"yield",value:function _yield(t){return!!t&&(t instanceof Xh?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)));}},{key:"toString",value:function toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString();}},{key:"enterChild",value:function enterChild(t,e,i){if(!this.buffer)return this["yield"](this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,i,this.mode));var s=this.buffer.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],t,e-this.buffer.start,i);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r));}},{key:"firstChild",value:function firstChild(){return this.enterChild(1,0,4);}},{key:"lastChild",value:function lastChild(){return this.enterChild(-1,0,4);}},{key:"childAfter",value:function childAfter(t){return this.enterChild(1,t,2);}},{key:"childBefore",value:function childBefore(t){return this.enterChild(-1,t,-2);}},{key:"enter",value:function enter(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.mode;return this.buffer?!(i&Fh.ExcludeBuffers)&&this.enterChild(1,t,e):this["yield"](this._tree.enter(t,e,i));}},{key:"parent",value:function parent(){if(!this.buffer)return this.yieldNode(this.mode&Fh.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&Fh.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t);}},{key:"sibling",value:function sibling(t){if(!this.buffer)return!!this._tree._parent&&this["yield"](this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));var e=this.buffer.buffer,i=this.stack.length-1;if(t<0){var _t214=i<0?0:this.stack[i]+4;if(this.index!=_t214)return this.yieldBuf(e.findChild(_t214,this.index,-1,0,4));}else{var _t215=e.buffer[this.index+3];if(_t215<(i<0?e.buffer.length:e.buffer[this.stack[i]+3]))return this.yieldBuf(_t215);}return i<0&&this["yield"](this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode));}},{key:"nextSibling",value:function nextSibling(){return this.sibling(1);}},{key:"prevSibling",value:function prevSibling(){return this.sibling(-1);}},{key:"atLastNode",value:function atLastNode(t){var e,i,s=this.buffer;if(s){if(t>0){if(this.index<s.buffer.buffer.length)return!1;}else for(var _t216=0;_t216<this.index;_t216++)if(s.buffer.buffer[_t216+3]<this.index)return!1;e=s.index;i=s.parent;}else{var _this$_tree=this._tree;e=_this$_tree.index;i=_this$_tree._parent;}for(;i;_i151=i,e=_i151.index,i=_i151._parent,_i151){var _i151;if(e>-1)for(var _s135=e+t,_r112=t<0?-1:i._tree.children.length;_s135!=_r112;_s135+=t){var _t217=i._tree.children[_s135];if(this.mode&Fh.IncludeAnonymous||_t217 instanceof Jh||!_t217.type.isAnonymous||rl(_t217))return!1;}}return!0;}},{key:"move",value:function move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1;}}},{key:"next",value:function next(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;return this.move(1,t);}},{key:"prev",value:function prev(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:!0;return this.move(-1,t);}},{key:"moveTo",value:function moveTo(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,e););return this;}},{key:"node",get:function get(){if(!this.buffer)return this._tree;var t=this.bufferNode,e=null,i=0;if(t&&t.context==this.buffer)t:for(var _s136=this.index,_r113=this.stack.length;_r113>=0;){for(var _n91=t;_n91;_n91=_n91._parent)if(_n91.index==_s136){if(_s136==this.index)return _n91;e=_n91,i=_r113+1;break t;}_s136=this.stack[--_r113];}for(var _t218=i;_t218<this.stack.length;_t218++)e=new tl(this.buffer,e,this.stack[_t218]);return this.bufferNode=new tl(this.buffer,e,this.index);}},{key:"tree",get:function get(){return this.buffer?null:this._tree._tree;}},{key:"iterate",value:function iterate(t,e){for(var _i152=0;;){var _s137=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){_i152++;continue;}this.type.isAnonymous||(_s137=!0);}for(;_s137&&e&&e(this),_s137=this.type.isAnonymous,!this.nextSibling();){if(!_i152)return;this.parent(),_i152--,_s137=!0;}}}},{key:"matchContext",value:function matchContext(t){if(!this.buffer)return Qh(this.node,t);var e=this.buffer.buffer,i=e.set.types;for(var _s138=t.length-1,_r114=this.stack.length-1;_s138>=0;_r114--){if(_r114<0)return Qh(this.node,t,_s138);var _n92=i[e.buffer[this.stack[_r114]]];if(!_n92.isAnonymous){if(t[_s138]&&t[_s138]!=_n92.name)return!1;_s138--;}}return!0;}}]);}();nl=new WeakMap();_export("q",ol=/*#__PURE__*/function(){function ol(){_classCallCheck(this,ol);this.map=new WeakMap();}return _createClass(ol,[{key:"setBuffer",value:function setBuffer(t,e,i){var s=this.map.get(t);s||this.map.set(t,s=new Map()),s.set(e,i);}},{key:"getBuffer",value:function getBuffer(t,e){var i=this.map.get(t);return i&&i.get(e);}},{key:"set",value:function set(t,e){t instanceof tl?this.setBuffer(t.context.buffer,t.index,e):t instanceof Xh&&this.map.set(t.tree,e);}},{key:"get",value:function get(t){return t instanceof tl?this.getBuffer(t.context.buffer,t.index):t instanceof Xh?this.map.get(t.tree):void 0;}},{key:"cursorSet",value:function cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e);}},{key:"cursorGet",value:function cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree);}}]);}());_export("z",ul=/*#__PURE__*/function(){function ul(t,e,i,s){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:!1;var n=arguments.length>5&&arguments[5]!==undefined?arguments[5]:!1;_classCallCheck(this,ul);this.from=t,this.to=e,this.tree=i,this.offset=s,this.open=(r?1:0)|(n?2:0);}return _createClass(ul,[{key:"openStart",get:function get(){return(1&this.open)>0;}},{key:"openEnd",get:function get(){return(2&this.open)>0;}}],[{key:"addTree",value:function addTree(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;var s=[new ul(0,t.length,t,0,!1,i)];var _iterator150=_createForOfIteratorHelper(e),_step150;try{for(_iterator150.s();!(_step150=_iterator150.n()).done;){var _i154=_step150.value;_i154.to>t.length&&s.push(_i154);}}catch(err){_iterator150.e(err);}finally{_iterator150.f();}return s;}},{key:"applyChanges",value:function applyChanges(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:128;if(!e.length)return t;var s=[],r=1,n=t.length?t[0]:null;for(var _h62=0,_l58=0,_o39=0;;_h62++){var _u40=_h62<e.length?e[_h62]:null,_f22=_u40?_u40.fromA:1e9;if(_f22-_l58>=i)for(;n&&n.from<_f22;){var _e189=n;if(_l58>=_e189.from||_f22<=_e189.to||_o39){var _t220=Math.max(_e189.from,_l58)-_o39,_i155=Math.min(_e189.to,_f22)-_o39;_e189=_t220>=_i155?null:new ul(_t220,_i155,_e189.tree,_e189.offset+_o39,_h62>0,!!_u40);}if(_e189&&s.push(_e189),n.to>_f22)break;n=r<t.length?t[r++]:null;}if(!_u40)break;_l58=_u40.toA,_o39=_u40.toA-_u40.toB;}return s;}}]);}());_export("P",fl=/*#__PURE__*/function(){function fl(){_classCallCheck(this,fl);}return _createClass(fl,[{key:"startParse",value:function startParse(t,e,i){return"string"==typeof t&&(t=new al(t)),i=i?i.length?i.map(function(t){return new Nh(t.from,t.to);}):[new Nh(0,0)]:[new Nh(0,t.length)],this.createParse(t,e||[],i);}},{key:"parse",value:function parse(t,e,i){var s=this.startParse(t,e,i);for(;;){var _t221=s.advance();if(_t221)return _t221;}}}]);}());al=/*#__PURE__*/function(){function al(t){_classCallCheck(this,al);this.string=t;}return _createClass(al,[{key:"length",get:function get(){return this.string.length;}},{key:"chunk",value:function chunk(t){return this.string.slice(t);}},{key:"lineChunks",get:function get(){return!1;}},{key:"read",value:function read(t,e){return this.string.slice(t,e);}}]);}();dl=/*#__PURE__*/_createClass(function dl(t,e,i,s,r){_classCallCheck(this,dl);this.parser=t,this.parse=e,this.overlay=i,this.target=s,this.from=r;});ml=/*#__PURE__*/_createClass(function ml(t,e,i,s,r,n,h){_classCallCheck(this,ml);this.parser=t,this.predicate=e,this.mounts=i,this.index=s,this.start=r,this.target=n,this.prev=h,this.depth=0,this.ranges=[];});gl=new jh({perNode:!0});wl=/*#__PURE__*/function(){function wl(t,e,i,s,r){_classCallCheck(this,wl);this.nest=e,this.input=i,this.fragments=s,this.ranges=r,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t;}return _createClass(wl,[{key:"advance",value:function advance(){if(this.baseParse){var _t222=this.baseParse.advance();if(!_t222)return null;if(this.baseParse=null,this.baseTree=_t222,this.startInner(),null!=this.stoppedAt){var _iterator151=_createForOfIteratorHelper(this.inner),_step151;try{for(_iterator151.s();!(_step151=_iterator151.n()).done;){var _t223=_step151.value;_t223.parse.stopAt(this.stoppedAt);}}catch(err){_iterator151.e(err);}finally{_iterator151.f();}}}if(this.innerDone==this.inner.length){var _t224=this.baseTree;return null!=this.stoppedAt&&(_t224=new qh(_t224.type,_t224.children,_t224.positions,_t224.length,_t224.propValues.concat([[gl,this.stoppedAt]]))),_t224;}var t=this.inner[this.innerDone],e=t.parse.advance();if(e){this.innerDone++;var _i156=Object.assign(Object.create(null),t.target.props);_i156[jh.mounted.id]=new $h(e,t.overlay,t.parser),t.target.props=_i156;}return null;}},{key:"parsedPos",get:function get(){if(this.baseParse)return 0;var t=this.input.length;for(var _e190=this.innerDone;_e190<this.inner.length;_e190++)this.inner[_e190].from<t&&(t=Math.min(t,this.inner[_e190].parse.parsedPos));return t;}},{key:"stopAt",value:function stopAt(t){if(this.stoppedAt=t,this.baseParse)this.baseParse.stopAt(t);else for(var _e191=this.innerDone;_e191<this.inner.length;_e191++)this.inner[_e191].parse.stopAt(t);}},{key:"startInner",value:function startInner(){var t=new Ml(this.fragments),e=null,i=null,s=new sl(new Xh(this.baseTree,this.ranges[0].from,0,null),Fh.IncludeAnonymous|Fh.IgnoreMounts);t:for(var _r116,_n93;;){var _h63=void 0,_l59=!0;if(null!=this.stoppedAt&&s.from>=this.stoppedAt)_l59=!1;else if(t.hasNode(s)){if(e){var _t225=e.mounts.find(function(t){return t.frag.from<=s.from&&t.frag.to>=s.to&&t.mount.overlay;});if(_t225){var _iterator152=_createForOfIteratorHelper(_t225.mount.overlay),_step152;try{var _loop12=function _loop12(){var i=_step152.value;var r=i.from+_t225.pos,n=i.to+_t225.pos;r>=s.from&&n<=s.to&&!e.ranges.some(function(t){return t.from<n&&t.to>r;})&&e.ranges.push({from:r,to:n});};for(_iterator152.s();!(_step152=_iterator152.n()).done;){_loop12();}}catch(err){_iterator152.e(err);}finally{_iterator152.f();}}}_l59=!1;}else if(i&&(_n93=bl(i.ranges,s.from,s.to)))_l59=2!=_n93;else if(!s.type.isAnonymous&&(_r116=this.nest(s,this.input))&&(s.from<s.to||!_r116.overlay)){s.tree||kl(s);var _n94=t.findMounts(s.from,_r116.parser);if("function"==typeof _r116.overlay)e=new ml(_r116.parser,_r116.overlay,_n94,this.inner.length,s.from,s.tree,e);else{var _t226=xl(this.ranges,_r116.overlay||(s.from<s.to?[new Nh(s.from,s.to)]:[]));_t226.length&&pl(_t226),!_t226.length&&_r116.overlay||this.inner.push(new dl(_r116.parser,_t226.length?_r116.parser.startParse(this.input,Al(_n94,_t226),_t226):_r116.parser.startParse(""),_r116.overlay?_r116.overlay.map(function(t){return new Nh(t.from-s.from,t.to-s.from);}):null,s.tree,_t226.length?_t226[0].from:s.from)),_r116.overlay?_t226.length&&(i={ranges:_t226,depth:0,prev:i}):_l59=!1;}}else e&&(_h63=e.predicate(s))&&(!0===_h63&&(_h63=new Nh(s.from,s.to)),_h63.from<_h63.to&&e.ranges.push(_h63));if(_l59&&s.firstChild())e&&e.depth++,i&&i.depth++;else for(;!s.nextSibling();){if(!s.parent())break t;if(e&&! --e.depth){var _t227=xl(this.ranges,e.ranges);_t227.length&&(pl(_t227),this.inner.splice(e.index,0,new dl(e.parser,e.parser.startParse(this.input,Al(e.mounts,_t227),_t227),e.ranges.map(function(t){return new Nh(t.from-e.start,t.to-e.start);}),e.target,_t227[0].from))),e=e.prev;}i&&! --i.depth&&(i=i.prev);}}}}]);}();yl=/*#__PURE__*/function(){function yl(t,e){_classCallCheck(this,yl);this.offset=e,this.done=!1,this.cursor=t.cursor(Fh.IncludeAnonymous|Fh.IgnoreMounts);}return _createClass(yl,[{key:"moveTo",value:function moveTo(t){var e=this.cursor,i=t-this.offset;for(;!this.done&&e.from<i;)e.to>=t&&e.enter(i,1,Fh.IgnoreOverlays|Fh.ExcludeBuffers)||e.next(!1)||(this.done=!0);}},{key:"hasNode",value:function hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(var _e193=this.cursor.tree;;){if(_e193==t.tree)return!0;if(!(_e193.children.length&&0==_e193.positions[0]&&_e193.children[0]instanceof qh))break;_e193=_e193.children[0];}return!1;}}]);}();Ml=/*#__PURE__*/function(){function Ml(t){_classCallCheck(this,Ml);var e;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){var _i159=this.curFrag=t[0];this.curTo=null!==(e=_i159.tree.prop(gl))&&void 0!==e?e:_i159.to,this.inner=new yl(_i159.tree,-_i159.offset);}else this.curFrag=this.inner=null;}return _createClass(Ml,[{key:"hasNode",value:function hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t);}},{key:"nextFrag",value:function nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{var _e194=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(t=_e194.tree.prop(gl))&&void 0!==t?t:_e194.to,this.inner=new yl(_e194.tree,-_e194.offset);}}},{key:"findMounts",value:function findMounts(t,e){var i;var s=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(var _t228=this.inner.cursor.node;_t228;_t228=_t228.parent){var _r117=null===(i=_t228.tree)||void 0===i?void 0:i.prop(jh.mounted);if(_r117&&_r117.parser==e)for(var _e195=this.fragI;_e195<this.fragments.length;_e195++){var _i160=this.fragments[_e195];if(_i160.from>=_t228.to)break;_i160.tree==this.curFrag.tree&&s.push({frag:_i160,pos:_t228.from-_i160.offset,mount:_r117});}}}return s;}}]);}();Cl=0;Ol=/*#__PURE__*/function(){function Ol(t,e,i){_classCallCheck(this,Ol);this.set=t,this.base=e,this.modified=i,this.id=Cl++;}return _createClass(Ol,null,[{key:"define",value:function define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");var e=new Ol([],null,[]);if(e.set.push(e),t){var _iterator155=_createForOfIteratorHelper(t.set),_step155;try{for(_iterator155.s();!(_step155=_iterator155.n()).done;){var _i161=_step155.value;e.set.push(_i161);}}catch(err){_iterator155.e(err);}finally{_iterator155.f();}}return e;}},{key:"defineModifier",value:function defineModifier(){var t=new El();return function(e){return e.modified.indexOf(t)>-1?e:El.get(e.base||e,e.modified.concat(t).sort(function(t,e){return t.id-e.id;}));};}}]);}();Dl=0;El=/*#__PURE__*/function(){function El(){_classCallCheck(this,El);this.instances=[],this.id=Dl++;}return _createClass(El,null,[{key:"get",value:function get(t,e){if(!e.length)return t;var i=e[0].instances.find(function(i){return i.base==t&&(s=e,r=i.modified,s.length==r.length&&s.every(function(t,e){return t==r[e];}));var s,r;});if(i)return i;var s=[],r=new Ol(s,t,e);var _iterator156=_createForOfIteratorHelper(e),_step156;try{for(_iterator156.s();!(_step156=_iterator156.n()).done;){var _t231=_step156.value;_t231.instances.push(r);}}catch(err){_iterator156.e(err);}finally{_iterator156.f();}var n=function(t){var e=[[]];for(var _i162=0;_i162<t.length;_i162++)for(var _s143=0,_r119=e.length;_s143<_r119;_s143++)e.push(e[_s143].concat(t[_i162]));return e.sort(function(t,e){return e.length-t.length;});}(e);var _iterator157=_createForOfIteratorHelper(t.set),_step157;try{for(_iterator157.s();!(_step157=_iterator157.n()).done;){var _e198=_step157.value;if(!_e198.modified.length){var _iterator158=_createForOfIteratorHelper(n),_step158;try{for(_iterator158.s();!(_step158=_iterator158.n()).done;){var _t232=_step158.value;s.push(El.get(_e198,_t232));}}catch(err){_iterator158.e(err);}finally{_iterator158.f();}}}}catch(err){_iterator157.e(err);}finally{_iterator157.f();}return r;}}]);}();Rl=new jh();Tl=/*#__PURE__*/function(){function Tl(t,e,i,s){_classCallCheck(this,Tl);this.tags=t,this.mode=e,this.context=i,this.next=s;}return _createClass(Tl,[{key:"opaque",get:function get(){return 0==this.mode;}},{key:"inherit",get:function get(){return 1==this.mode;}},{key:"sort",value:function sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t);}},{key:"depth",get:function get(){return this.context?this.context.length:0;}}]);}();Tl.empty=new Tl([],2,null);Nl=/*#__PURE__*/function(){function Nl(t,e,i){_classCallCheck(this,Nl);this.at=t,this.highlighters=e,this.span=i,this["class"]="";}return _createClass(Nl,[{key:"startSpan",value:function startSpan(t,e){e!=this["class"]&&(this.flush(t),t>this.at&&(this.at=t),this["class"]=e);}},{key:"flush",value:function flush(t){t>this.at&&this["class"]&&this.span(this.at,t,this["class"]);}},{key:"highlightRange",value:function highlightRange(t,e,i,s,r){var n=t.type,h=t.from,l=t.to;if(h>=i||l<=e)return;n.isTop&&(r=this.highlighters.filter(function(t){return!t.scope||t.scope(n);}));var o=s,u=function(t){var e=t.type.prop(Rl);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null;}(t)||Tl.empty,f=function(t,e){var i=null;var _iterator164=_createForOfIteratorHelper(t),_step164;try{for(_iterator164.s();!(_step164=_iterator164.n()).done;){var _s148=_step164.value;var _t236=_s148.style(e);_t236&&(i=i?i+" "+_t236:_t236);}}catch(err){_iterator164.e(err);}finally{_iterator164.f();}return i;}(r,u.tags);if(f&&(o&&(o+=" "),o+=f,1==u.mode&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(e,h),o),u.opaque)return;var a=t.tree&&t.tree.prop(jh.mounted);if(a&&a.overlay){var _n97=t.node.enter(a.overlay[0].from+h,1),_u42=this.highlighters.filter(function(t){return!t.scope||t.scope(a.tree.type);}),_f24=t.firstChild();for(var _c14=0,_d10=h;;_c14++){var _p8=_c14<a.overlay.length?a.overlay[_c14]:null,_m5=_p8?_p8.from+h:l,_g5=Math.max(e,_d10),_w2=Math.min(i,_m5);if(_g5<_w2&&_f24)for(;t.from<_w2&&(this.highlightRange(t,_g5,_w2,s,r),this.startSpan(Math.min(_w2,t.to),o),!(t.to>=_m5)&&t.nextSibling()););if(!_p8||_m5>i)break;_d10=_p8.to+h,_d10>e&&(this.highlightRange(_n97.cursor(),Math.max(e,_p8.from+h),Math.min(i,_d10),"",_u42),this.startSpan(Math.min(i,_d10),o));}_f24&&t.parent();}else if(t.firstChild()){a&&(s="");do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,s,r),this.startSpan(Math.min(i,t.to),o);}}while(t.nextSibling());t.parent();}}}]);}();jl=Ol.define;$l=jl();zl=jl();Pl=jl(zl);Hl=jl(zl);Wl=jl();Vl=jl(Wl);Fl=jl(Wl);ql=jl();Ul=jl(ql);Jl=jl();Gl=jl();Kl=jl();_l=jl(Kl);Xl=jl();_export("t",Yl={comment:$l,lineComment:jl($l),blockComment:jl($l),docComment:jl($l),name:zl,variableName:jl(zl),typeName:Pl,tagName:jl(Pl),propertyName:Hl,attributeName:jl(Hl),className:jl(zl),labelName:jl(zl),namespace:jl(zl),macroName:jl(zl),literal:Wl,string:Vl,docString:jl(Vl),character:jl(Vl),attributeValue:jl(Vl),number:Fl,integer:jl(Fl),"float":jl(Fl),bool:jl(Wl),regexp:jl(Wl),escape:jl(Wl),color:jl(Wl),url:jl(Wl),keyword:Jl,self:jl(Jl),"null":jl(Jl),atom:jl(Jl),unit:jl(Jl),modifier:jl(Jl),operatorKeyword:jl(Jl),controlKeyword:jl(Jl),definitionKeyword:jl(Jl),moduleKeyword:jl(Jl),operator:Gl,derefOperator:jl(Gl),arithmeticOperator:jl(Gl),logicOperator:jl(Gl),bitwiseOperator:jl(Gl),compareOperator:jl(Gl),updateOperator:jl(Gl),definitionOperator:jl(Gl),typeOperator:jl(Gl),controlOperator:jl(Gl),punctuation:Kl,separator:jl(Kl),bracket:_l,angleBracket:jl(_l),squareBracket:jl(_l),paren:jl(_l),brace:jl(_l),content:ql,heading:Ul,heading1:jl(Ul),heading2:jl(Ul),heading3:jl(Ul),heading4:jl(Ul),heading5:jl(Ul),heading6:jl(Ul),contentSeparator:jl(ql),list:jl(ql),quote:jl(ql),emphasis:jl(ql),strong:jl(ql),link:jl(ql),monospace:jl(ql),strikethrough:jl(ql),inserted:jl(),deleted:jl(),changed:jl(),invalid:jl(),meta:Xl,documentMeta:jl(Xl),annotation:jl(Xl),processingInstruction:jl(Xl),definition:Ol.defineModifier(),constant:Ol.defineModifier(),"function":Ol.defineModifier(),standard:Ol.defineModifier(),local:Ol.defineModifier(),special:Ol.defineModifier()});Bl([{tag:Yl.link,"class":"tok-link"},{tag:Yl.heading,"class":"tok-heading"},{tag:Yl.emphasis,"class":"tok-emphasis"},{tag:Yl.strong,"class":"tok-strong"},{tag:Yl.keyword,"class":"tok-keyword"},{tag:Yl.atom,"class":"tok-atom"},{tag:Yl.bool,"class":"tok-bool"},{tag:Yl.url,"class":"tok-url"},{tag:Yl.labelName,"class":"tok-labelName"},{tag:Yl.inserted,"class":"tok-inserted"},{tag:Yl.deleted,"class":"tok-deleted"},{tag:Yl.literal,"class":"tok-literal"},{tag:Yl.string,"class":"tok-string"},{tag:Yl.number,"class":"tok-number"},{tag:[Yl.regexp,Yl.escape,Yl.special(Yl.string)],"class":"tok-string2"},{tag:Yl.variableName,"class":"tok-variableName"},{tag:Yl.local(Yl.variableName),"class":"tok-variableName tok-local"},{tag:Yl.definition(Yl.variableName),"class":"tok-variableName tok-definition"},{tag:Yl.special(Yl.variableName),"class":"tok-variableName2"},{tag:Yl.definition(Yl.propertyName),"class":"tok-propertyName tok-definition"},{tag:Yl.typeName,"class":"tok-typeName"},{tag:Yl.namespace,"class":"tok-namespace"},{tag:Yl.className,"class":"tok-className"},{tag:Yl.macroName,"class":"tok-macroName"},{tag:Yl.propertyName,"class":"tok-propertyName"},{tag:Yl.operator,"class":"tok-operator"},{tag:Yl.comment,"class":"tok-comment"},{tag:Yl.meta,"class":"tok-meta"},{tag:Yl.invalid,"class":"tok-invalid"},{tag:Yl.punctuation,"class":"tok-punctuation"}]);Zl=new jh();_export("o",eo=new jh());io=/*#__PURE__*/function(){function io(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"";_classCallCheck(this,io);this.data=t,this.name=s,St.prototype.hasOwnProperty("tree")||Object.defineProperty(St.prototype,"tree",{get:function get(){return no(this);}}),this.parser=e,this.extension=[mo.of(this),St.languageData.of(function(t,e,i){var s=so(t,e,i),r=s.type.prop(Zl);if(!r)return[];var n=t.facet(r),h=s.type.prop(eo);if(h){var _r121=s.resolve(e-s.from,i);var _iterator165=_createForOfIteratorHelper(h),_step165;try{for(_iterator165.s();!(_step165=_iterator165.n()).done;){var _e201=_step165.value;if(_e201.test(_r121,t)){var _i165=t.facet(_e201.facet);return"replace"==_e201.type?_i165:_i165.concat(n);}}}catch(err){_iterator165.e(err);}finally{_iterator165.f();}}return n;})].concat(i);}return _createClass(io,[{key:"isActiveAt",value:function isActiveAt(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;return so(t,e,i).type.prop(Zl)==this.data;}},{key:"findRegions",value:function findRegions(t){var _this71=this;var e=t.facet(mo);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];var i=[],s=function s(t,e){if(t.prop(Zl)==_this71.data)return void i.push({from:e,to:e+t.length});var r=t.prop(jh.mounted);if(r){if(r.tree.prop(Zl)==_this71.data){if(r.overlay){var _iterator166=_createForOfIteratorHelper(r.overlay),_step166;try{for(_iterator166.s();!(_step166=_iterator166.n()).done;){var _t237=_step166.value;i.push({from:_t237.from+e,to:_t237.to+e});}}catch(err){_iterator166.e(err);}finally{_iterator166.f();}}else i.push({from:e,to:e+t.length});return;}if(r.overlay){var _t238=i.length;if(s(r.tree,r.overlay[0].from+e),i.length>_t238)return;}}for(var _i166=0;_i166<t.children.length;_i166++){var _r122=t.children[_i166];_r122 instanceof qh&&s(_r122,t.positions[_i166]+e);}};return s(no(t),0),i;}},{key:"allowsNesting",get:function get(){return!0;}}]);}();io.setState=ct.define();_export("L",ro=/*#__PURE__*/function(_io){function ro(t,e,i){var _this72;_classCallCheck(this,ro);_this72=_callSuper(this,ro,[t,e,[],i]),_this72.parser=e;return _this72;}_inherits(ro,_io);return _createClass(ro,[{key:"configure",value:function configure(t,e){return new ro(this.data,this.parser.configure(t),e||this.name);}},{key:"allowsNesting",get:function get(){return this.parser.hasWrappers();}}],[{key:"define",value:function define(t){var e=to(t.languageData);return new ro(e,t.parser.configure({props:[Zl.add(function(t){return t.isTop?e:void 0;})]}),t.name);}}]);}(io));ho=/*#__PURE__*/function(){function ho(t){_classCallCheck(this,ho);this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter();}return _createClass(ho,[{key:"length",get:function get(){return this.doc.length;}},{key:"syncTo",value:function syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length;}},{key:"chunk",value:function chunk(t){return this.syncTo(t),this.string;}},{key:"lineChunks",get:function get(){return!0;}},{key:"read",value:function read(t,e){var i=this.cursorPos-this.string.length;return t<i||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i);}}]);}();lo=null;oo=/*#__PURE__*/function(){function oo(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[];var s=arguments.length>3?arguments[3]:undefined;var r=arguments.length>4?arguments[4]:undefined;var n=arguments.length>5?arguments[5]:undefined;var h=arguments.length>6?arguments[6]:undefined;var l=arguments.length>7?arguments[7]:undefined;_classCallCheck(this,oo);this.parser=t,this.state=e,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=n,this.skipped=h,this.scheduleOn=l,this.parse=null,this.tempSkipped=[];}return _createClass(oo,[{key:"startParse",value:function startParse(){return this.parser.startParse(new ho(this.state.doc),this.fragments);}},{key:"work",value:function work(t,e){var _this73=this;return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=qh.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext(function(){var i;if("number"==typeof t){var _e202=Date.now()+t;t=function t(){return Date.now()>_e202;};}for(_this73.parse||(_this73.parse=_this73.startParse()),null!=e&&(null==_this73.parse.stoppedAt||_this73.parse.stoppedAt>e)&&e<_this73.state.doc.length&&_this73.parse.stopAt(e);;){var _s149=_this73.parse.advance();if(_s149){if(_this73.fragments=_this73.withoutTempSkipped(ul.addTree(_s149,_this73.fragments,null!=_this73.parse.stoppedAt)),_this73.treeLen=null!==(i=_this73.parse.stoppedAt)&&void 0!==i?i:_this73.state.doc.length,_this73.tree=_s149,_this73.parse=null,!(_this73.treeLen<(null!=e?e:_this73.state.doc.length)))return!0;_this73.parse=_this73.startParse();}if(t())return!1;}});}},{key:"takeTree",value:function takeTree(){var _this74=this;var t,e;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(function(){for(;!(e=_this74.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(ul.addTree(this.tree,this.fragments,!0)),this.parse=null);}},{key:"withContext",value:function withContext(t){var e=lo;lo=this;try{return t();}finally{lo=e;}}},{key:"withoutTempSkipped",value:function withoutTempSkipped(t){for(var _e203;_e203=this.tempSkipped.pop();)t=uo(t,_e203.from,_e203.to);return t;}},{key:"changes",value:function changes(t,e){var i=this.fragments,s=this.tree,r=this.treeLen,n=this.viewport,h=this.skipped;if(this.takeTree(),!t.empty){var _e204=[];if(t.iterChangedRanges(function(t,i,s,r){return _e204.push({fromA:t,toA:i,fromB:s,toB:r});}),i=ul.applyChanges(i,_e204),s=qh.empty,r=0,n={from:t.mapPos(n.from,-1),to:t.mapPos(n.to,1)},this.skipped.length){h=[];var _iterator167=_createForOfIteratorHelper(this.skipped),_step167;try{for(_iterator167.s();!(_step167=_iterator167.n()).done;){var _e205=_step167.value;var _i167=t.mapPos(_e205.from,1),_s150=t.mapPos(_e205.to,-1);_i167<_s150&&h.push({from:_i167,to:_s150});}}catch(err){_iterator167.e(err);}finally{_iterator167.f();}}}return new oo(this.parser,e,i,s,r,n,h,this.scheduleOn);}},{key:"updateViewport",value:function updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;var e=this.skipped.length;for(var _e206=0;_e206<this.skipped.length;_e206++){var _this$skipped$_e=this.skipped[_e206],_i168=_this$skipped$_e.from,_s151=_this$skipped$_e.to;_i168<t.to&&_s151>t.from&&(this.fragments=uo(this.fragments,_i168,_s151),this.skipped.splice(_e206--,1));}return!(this.skipped.length>=e)&&(this.reset(),!0);}},{key:"reset",value:function reset(){this.parse&&(this.takeTree(),this.parse=null);}},{key:"skipUntilInView",value:function skipUntilInView(t,e){this.skipped.push({from:t,to:e});}},{key:"isDone",value:function isDone(t){t=Math.min(t,this.state.doc.length);var e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t;}}],[{key:"create",value:function create(t,e,i){return new oo(t,e,[],qh.empty,0,i,[],null);}},{key:"getSkippingParser",value:function getSkippingParser(t){return new(/*#__PURE__*/function(_fl){function _class8(){_classCallCheck(this,_class8);return _callSuper(this,_class8,arguments);}_inherits(_class8,_fl);return _createClass(_class8,[{key:"createParse",value:function createParse(e,i,s){var r=s[0].from,n=s[s.length-1].to;return{parsedPos:r,advance:function advance(){var e=lo;if(e){var _iterator168=_createForOfIteratorHelper(s),_step168;try{for(_iterator168.s();!(_step168=_iterator168.n()).done;){var _t240=_step168.value;e.tempSkipped.push(_t240);}}catch(err){_iterator168.e(err);}finally{_iterator168.f();}t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t);}return this.parsedPos=n,new qh(Ph.none,[],[],n-r);},stoppedAt:null,stopAt:function stopAt(){}};}}]);}(fl))();}},{key:"get",value:function get(){return lo;}}]);}();fo=/*#__PURE__*/function(){function fo(t){_classCallCheck(this,fo);this.context=t,this.tree=t.tree;}return _createClass(fo,[{key:"apply",value:function apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;var e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new fo(e);}}],[{key:"init",value:function init(t){var e=Math.min(3e3,t.doc.length),i=oo.create(t.facet(mo).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new fo(i);}}]);}();io.state=F.define({create:fo.init,update:function update(t,e){var _iterator169=_createForOfIteratorHelper(e.effects),_step169;try{for(_iterator169.s();!(_step169=_iterator169.n()).done;){var _t241=_step169.value;if(_t241.is(io.setState))return _t241.value;}}catch(err){_iterator169.e(err);}finally{_iterator169.f();}return e.startState.facet(mo)!=e.state.facet(mo)?fo.init(e.state):t.apply(e);}});ao=function ao(t){var e=setTimeout(function(){return t();},500);return function(){return clearTimeout(e);};};"undefined"!=typeof requestIdleCallback&&(ao=function ao(t){var e=-1,i=setTimeout(function(){e=requestIdleCallback(t,{timeout:400});},100);return function(){return e<0?clearTimeout(i):cancelIdleCallback(e);};});co="undefined"!=typeof navigator&&(null===(Ql=navigator.scheduling)||void 0===Ql?void 0:Ql.isInputPending)?function(){return navigator.scheduling.isInputPending();}:null;po=_i.fromClass(/*#__PURE__*/function(){function _class9(t){_classCallCheck(this,_class9);this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork();}return _createClass(_class9,[{key:"update",value:function update(t){var e=this.view.state.field(io.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e);}},{key:"scheduleWork",value:function scheduleWork(){if(this.working)return;var t=this.view.state,e=t.field(io.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=ao(this.work));}},{key:"work",value:function work(t){this.working=null;var e=Date.now();if(this.chunkEnd<e&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=e+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;var _this$view3=this.view,i=_this$view3.state,s=_this$view3.viewport.to,r=i.field(io.state);if(r.tree==r.context.tree&&r.context.isDone(s+1e5))return;var n=Date.now()+Math.min(this.chunkBudget,100,t&&!co?Math.max(25,t.timeRemaining()-5):1e9),h=r.context.treeLen<s&&i.doc.length>s+1e3,l=r.context.work(function(){return co&&co()||Date.now()>n;},s+(h?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:io.setState.of(new fo(r.context))})),this.chunkBudget>0&&(!l||h)&&this.scheduleWork(),this.checkAsyncSchedule(r.context);}},{key:"checkAsyncSchedule",value:function checkAsyncSchedule(t){var _this75=this;t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(function(){return _this75.scheduleWork();})["catch"](function(t){return Ui(_this75.view.state,t);}).then(function(){return _this75.workScheduled--;}),t.scheduleOn=null);}},{key:"destroy",value:function destroy(){this.working&&this.working();}},{key:"isWorking",value:function isWorking(){return!!(this.working||this.workScheduled>0);}}]);}(),{eventHandlers:{focus:function focus(){this.scheduleWork();}}});mo=j.define({combine:function combine(t){return t.length?t[0]:null;},enables:function enables(t){return[io.state,po,Ur.contentAttributes.compute([t],function(e){var i=e.facet(t);return i&&i.name?{"data-language":i.name}:{};})];}});_export("h",go=/*#__PURE__*/_createClass(function go(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];_classCallCheck(this,go);this.language=t,this.support=e,this.extension=[t,e];}));wo=j.define();bo=j.define({combine:function combine(t){if(!t.length)return" ";var e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(function(t){return t!=e[0];}))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e;}});Mo=/*#__PURE__*/function(){function Mo(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Mo);this.state=t,this.options=e,this.unit=vo(t);}return _createClass(Mo,[{key:"lineAt",value:function lineAt(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var i=this.state.doc.lineAt(t),_this$options=this.options,s=_this$options.simulateBreak,r=_this$options.simulateDoubleBreak;return null!=s&&s>=i.from&&s<=i.to?r&&s==t?{text:"",from:t}:(e<0?s<t:s<=t)?{text:i.text.slice(s-i.from),from:s}:{text:i.text.slice(0,s-i.from),from:i.from}:i;}},{key:"textAfterPos",value:function textAfterPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";var _this$lineAt=this.lineAt(t,e),i=_this$lineAt.text,s=_this$lineAt.from;return i.slice(t-s,Math.min(i.length,t+100-s));}},{key:"column",value:function column(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var _this$lineAt2=this.lineAt(t,e),i=_this$lineAt2.text,s=_this$lineAt2.from,r=this.countColumn(i,t-s),n=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return n>-1&&(r+=n-this.countColumn(i,i.search(/\S|$/))),r;}},{key:"countColumn",value:function countColumn(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t.length;return Vt(t,this.state.tabSize,e);}},{key:"lineIndent",value:function lineIndent(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var _this$lineAt3=this.lineAt(t,e),i=_this$lineAt3.text,s=_this$lineAt3.from,r=this.options.overrideIndentation;if(r){var _t244=r(s);if(_t244>-1)return _t244;}return this.countColumn(i,i.search(/\S|$/));}},{key:"simulatedBreak",get:function get(){return this.options.simulateBreak||null;}}]);}();_export("i",xo=new jh());Oo=/*#__PURE__*/function(_Mo){function Oo(t,e,i){var _this76;_classCallCheck(this,Oo);_this76=_callSuper(this,Oo,[t.state,t.options]),_this76.base=t,_this76.pos=e,_this76.context=i;return _this76;}_inherits(Oo,_Mo);return _createClass(Oo,[{key:"node",get:function get(){return this.context.node;}},{key:"textAfter",get:function get(){return this.textAfterPos(this.pos);}},{key:"baseIndent",get:function get(){return this.baseIndentFor(this.node);}},{key:"baseIndentFor",value:function baseIndentFor(t){var e=this.state.doc.lineAt(t.from);for(;;){var _i170=t.resolve(e.from);for(;_i170.parent&&_i170.parent.from==_i170.from;)_i170=_i170.parent;if(Do(_i170,t))break;e=this.state.doc.lineAt(_i170.from);}return this.lineIndent(e.from);}},{key:"continue",value:function _continue(){return So(this.context.next,this.base,this.pos);}}],[{key:"create",value:function create(t,e,i){return new Oo(t,e,i);}}]);}(Mo);_export("f",Ro=function Ro(t){return t.baseIndent;});Bo=j.define();_export("e",Lo=new jh());Po=ct.define({map:zo});Ho=ct.define({map:zo});Vo=F.define({create:function create(){return ni.none;},update:function update(t,e){t=t.map(e.changes);var _iterator173=_createForOfIteratorHelper(e.effects),_step173;try{var _loop15=function _loop15(){var i=_step173.value;if(i.is(Po)&&!qo(t,i.value.from,i.value.to)){var _e$state$facet=e.state.facet(_o),_s158=_e$state$facet.preparePlaceholder,_r125=_s158?ni.replace({widget:new Zo(_s158(e.state,i.value))}):Qo;t=t.update({add:[_r125.range(i.value.from,i.value.to)]});}else i.is(Ho)&&(t=t.update({filter:function filter(t,e){return i.value.from!=t||i.value.to!=e;},filterFrom:i.value.from,filterTo:i.value.to}));};for(_iterator173.s();!(_step173=_iterator173.n()).done;){_loop15();}}catch(err){_iterator173.e(err);}finally{_iterator173.f();}if(e.selection){var _i172=!1,_s157=e.selection.main.head;t.between(_s157,_s157,function(t,e){t<_s157&&e>_s157&&(_i172=!0);}),_i172&&(t=t.update({filterFrom:_s157,filterTo:_s157,filter:function filter(t,e){return e<=_s157||t>=_s157;}}));}return t;},provide:function provide(t){return Ur.decorations.from(t);},toJSON:function toJSON(t,e){var i=[];return t.between(0,e.doc.length,function(t,e){i.push(t,e);}),i;},fromJSON:function fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");var e=[];for(var _i173=0;_i173<t.length;){var _s159=t[_i173++],_r126=t[_i173++];if("number"!=typeof _s159||"number"!=typeof _r126)throw new RangeError("Invalid JSON for fold state");e.push(Qo.range(_s159,_r126));}return ni.set(e,!0);}});Go=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:function run(t){var _iterator174=_createForOfIteratorHelper(Wo(t)),_step174;try{for(_iterator174.s();!(_step174=_iterator174.n()).done;){var _e210=_step174.value;var _i174=$o(t.state,_e210.from,_e210.to);if(_i174)return t.dispatch({effects:Uo(t.state,[Po.of(_i174),Jo(t,_i174)])}),!0;}}catch(err){_iterator174.e(err);}finally{_iterator174.f();}return!1;}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:function run(t){if(!t.state.field(Vo,!1))return!1;var e=[];var _iterator175=_createForOfIteratorHelper(Wo(t)),_step175;try{for(_iterator175.s();!(_step175=_iterator175.n()).done;){var _i175=_step175.value;var _s160=Fo(t.state,_i175.from,_i175.to);_s160&&e.push(Ho.of(_s160),Jo(t,_s160,!1));}}catch(err){_iterator175.e(err);}finally{_iterator175.f();}return e.length&&t.dispatch({effects:e}),e.length>0;}},{key:"Ctrl-Alt-[",run:function run(t){var e=t.state,i=[];for(var _s161=0;_s161<e.doc.length;){var _r127=t.lineBlockAt(_s161),_n99=$o(e,_r127.from,_r127.to);_n99&&i.push(Po.of(_n99)),_s161=(_n99?t.lineBlockAt(_n99.to):_r127).to+1;}return i.length&&t.dispatch({effects:Uo(t.state,i)}),!!i.length;}},{key:"Ctrl-Alt-]",run:function run(t){var e=t.state.field(Vo,!1);if(!e||!e.size)return!1;var i=[];return e.between(0,t.state.doc.length,function(t,e){i.push(Ho.of({from:t,to:e}));}),t.dispatch({effects:i}),!0;}}];Ko={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"};_o=j.define({combine:function combine(t){return At(t,Ko);}});Qo=ni.replace({widget:new(/*#__PURE__*/function(_si7){function _class10(){_classCallCheck(this,_class10);return _callSuper(this,_class10,arguments);}_inherits(_class10,_si7);return _createClass(_class10,[{key:"toDOM",value:function toDOM(t){return Yo(t,null);}}]);}(si))()});Zo=/*#__PURE__*/function(_si8){function Zo(t){var _this77;_classCallCheck(this,Zo);_this77=_callSuper(this,Zo),_this77.value=t;return _this77;}_inherits(Zo,_si8);return _createClass(Zo,[{key:"eq",value:function eq(t){return this.value==t.value;}},{key:"toDOM",value:function toDOM(t){return Yo(t,this.value);}}]);}(si);tu={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:function foldingChanged(){return!1;}};eu=/*#__PURE__*/function(_ah3){function eu(t,e){var _this78;_classCallCheck(this,eu);_this78=_callSuper(this,eu),_this78.config=t,_this78.open=e;return _this78;}_inherits(eu,_ah3);return _createClass(eu,[{key:"eq",value:function eq(t){return this.config==t.config&&this.open==t.open;}},{key:"toDOM",value:function toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);var e=document.createElement("span");return e.textContent=this.open?this.config.openText:this.config.closedText,e.title=t.state.phrase(this.open?"Fold line":"Unfold line"),e;}}]);}(ah);iu=Ur.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});su=/*#__PURE__*/function(){function su(t,e){_classCallCheck(this,su);var i;function s(t){var e=Gt.newName();return(i||(i=Object.create(null)))["."+e]=t,e;}this.specs=t;var r="string"==typeof e.all?e.all:e.all?s(e.all):void 0,n=e.scope;this.scope=n instanceof io?function(t){return t.prop(Zl)==n.data;}:n?function(t){return t==n;}:void 0,this.style=Bl(t.map(function(t){return{tag:t.tag,"class":t["class"]||s(Object.assign({},t,{tag:null}))};}),{all:r}).style,this.module=i?new Gt(i):null,this.themeType=e.themeType;}return _createClass(su,null,[{key:"define",value:function define(t,e){return new su(t,e||{});}}]);}();ru=j.define();nu=j.define({combine:function combine(t){return t.length?[t[0]]:null;}});ou=/*#__PURE__*/function(){function ou(t){_classCallCheck(this,ou);this.markCache=Object.create(null),this.tree=no(t.state),this.decorations=this.buildDeco(t,hu(t.state)),this.decoratedTo=t.viewport.to;}return _createClass(ou,[{key:"update",value:function update(t){var e=no(t.state),i=hu(t.state),s=i!=hu(t.startState),r=t.view.viewport,n=t.changes.mapPos(this.decoratedTo,1);e.length<r.to&&!s&&e.type==this.tree.type&&n>=r.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=n):(e!=this.tree||t.viewportChanged||s)&&(this.tree=e,this.decorations=this.buildDeco(t.view,i),this.decoratedTo=r.to);}},{key:"buildDeco",value:function buildDeco(t,e){var _this79=this;if(!e||!this.tree.length)return ni.none;var i=new Rt();var _iterator176=_createForOfIteratorHelper(t.visibleRanges),_step176;try{for(_iterator176.s();!(_step176=_iterator176.n()).done;){var _step176$value=_step176.value,_s162=_step176$value.from,_r128=_step176$value.to;Ll(this.tree,e,function(t,e,s){i.add(t,e,_this79.markCache[s]||(_this79.markCache[s]=ni.mark({"class":s})));},_s162,_r128);}}catch(err){_iterator176.e(err);}finally{_iterator176.f();}return i.finish();}}]);}();uu=_.high(_i.fromClass(ou,{decorations:function decorations(t){return t.decorations;}}));_export("Y",fu=su.define([{tag:Yl.meta,color:"#404740"},{tag:Yl.link,textDecoration:"underline"},{tag:Yl.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Yl.emphasis,fontStyle:"italic"},{tag:Yl.strong,fontWeight:"bold"},{tag:Yl.strikethrough,textDecoration:"line-through"},{tag:Yl.keyword,color:"#708"},{tag:[Yl.atom,Yl.bool,Yl.url,Yl.contentSeparator,Yl.labelName],color:"#219"},{tag:[Yl.literal,Yl.inserted],color:"#164"},{tag:[Yl.string,Yl.deleted],color:"#a11"},{tag:[Yl.regexp,Yl.escape,Yl.special(Yl.string)],color:"#e40"},{tag:Yl.definition(Yl.variableName),color:"#00f"},{tag:Yl.local(Yl.variableName),color:"#30a"},{tag:[Yl.typeName,Yl.namespace],color:"#085"},{tag:Yl.className,color:"#167"},{tag:[Yl.special(Yl.variableName),Yl.macroName],color:"#256"},{tag:Yl.definition(Yl.propertyName),color:"#00c"},{tag:Yl.comment,color:"#940"},{tag:Yl.invalid,color:"#f00"}]));au=Ur.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}});cu=1e4;du="()[]{}";pu=j.define({combine:function combine(t){return At(t,{afterCursor:!0,brackets:du,maxScanDistance:cu,renderMatch:wu});}});mu=ni.mark({"class":"cm-matchingBracket"});gu=ni.mark({"class":"cm-nonmatchingBracket"});bu=F.define({create:function create(){return ni.none;},update:function update(t,e){if(!e.docChanged&&!e.selection)return t;var i=[],s=e.state.facet(pu);var _iterator177=_createForOfIteratorHelper(e.state.selection.ranges),_step177;try{for(_iterator177.s();!(_step177=_iterator177.n()).done;){var _t247=_step177.value;if(!_t247.empty)continue;var _r129=xu(e.state,_t247.head,-1,s)||_t247.head>0&&xu(e.state,_t247.head-1,1,s)||s.afterCursor&&(xu(e.state,_t247.head,1,s)||_t247.head<e.state.doc.length&&xu(e.state,_t247.head+1,-1,s));_r129&&(i=i.concat(s.renderMatch(_r129,e.state)));}}catch(err){_iterator177.e(err);}finally{_iterator177.f();}return ni.set(i,!0);},provide:function provide(t){return Ur.decorations.from(t);}});vu=[bu,au];ku=new jh();Au=Object.create(null);Cu=[Ph.none];Ou=[];Du=Object.create(null);Eu=Object.create(null);for(_i176=0,_arr2=[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]];_i176<_arr2.length;_i176++){_arr2$_i=_slicedToArray(_arr2[_i176],2);_t252=_arr2$_i[0];_e213=_arr2$_i[1];Eu[_t252]=Ru(Au,_e213);}pi.RTL,pi.LTR;Bu=Tu(Pu,0);Lu=Tu(zu,0);Nu=Tu(function(t,e){return zu(t,e,function(t){var e=[];var _iterator181=_createForOfIteratorHelper(t.selection.ranges),_step181;try{for(_iterator181.s();!(_step181=_iterator181.n()).done;){var _i178=_step181.value;var _s167=t.doc.lineAt(_i178.from),_r131=_i178.to<=_s167.to?_s167:t.doc.lineAt(_i178.to),_n101=e.length-1;_n101>=0&&e[_n101].to>_s167.from?e[_n101].to=_r131.to:e.push({from:_s167.from+/^\s*/.exec(_s167.text)[0].length,to:_r131.to});}}catch(err){_iterator181.e(err);}finally{_iterator181.f();}return e;}(e));},0);$u=50;Hu=ut.define();Wu=ut.define();Vu=j.define();Fu=j.define({combine:function combine(t){return At(t,{minDepth:100,newGroupDelay:500,joinToEvent:function joinToEvent(t,e){return e;}},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:function joinToEvent(t,e){return function(i,s){return t(i,s)||e(i,s);};}});}});qu=F.define({create:function create(){return lf.empty;},update:function update(t,e){var i=e.state.facet(Fu),s=e.annotation(Hu);if(s){var _r135=Xu.fromTransaction(e,s.selection),_n106=s.side,_h74=0==_n106?t.undone:t.done;return _h74=_r135?Yu(_h74,_h74.length,i.minDepth,_r135):ef(_h74,e.startState.selection),new lf(0==_n106?s.rest:_h74,0==_n106?_h74:s.rest);}var r=e.annotation(Wu);if("full"!=r&&"before"!=r||(t=t.isolate()),!1===e.annotation(dt.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);var n=Xu.fromTransaction(e),h=e.annotation(dt.time),l=e.annotation(dt.userEvent);return n?t=t.addChanges(n,h,l,i,e):e.selection&&(t=t.addSelection(e.startState.selection,h,l,i.newGroupDelay)),"full"!=r&&"after"!=r||(t=t.isolate()),t;},toJSON:function toJSON(t){return{done:t.done.map(function(t){return t.toJSON();}),undone:t.undone.map(function(t){return t.toJSON();})};},fromJSON:function fromJSON(t){return new lf(t.done.map(Xu.fromJSON),t.undone.map(Xu.fromJSON));}});Ju=Uu(0,!1);Gu=Uu(1,!1);Ku=Uu(0,!0);_u=Uu(1,!0);Xu=/*#__PURE__*/function(){function Xu(t,e,i,s,r){_classCallCheck(this,Xu);this.changes=t,this.effects=e,this.mapped=i,this.startSelection=s,this.selectionsAfter=r;}return _createClass(Xu,[{key:"setSelAfter",value:function setSelAfter(t){return new Xu(this.changes,this.effects,this.mapped,this.startSelection,t);}},{key:"toJSON",value:function toJSON(){var t,e,i;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(function(t){return t.toJSON();})};}}],[{key:"fromJSON",value:function fromJSON(t){return new Xu(t.changes&&A.fromJSON(t.changes),[],t.mapped&&S.fromJSON(t.mapped),t.startSelection&&B.fromJSON(t.startSelection),t.selectionsAfter.map(B.fromJSON));}},{key:"fromTransaction",value:function fromTransaction(t,e){var i=Zu;var _iterator185=_createForOfIteratorHelper(t.startState.facet(Vu)),_step185;try{for(_iterator185.s();!(_step185=_iterator185.n()).done;){var _e220=_step185.value;var _s169=_e220(t);_s169.length&&(i=i.concat(_s169));}}catch(err){_iterator185.e(err);}finally{_iterator185.f();}return!i.length&&t.changes.empty?null:new Xu(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,Zu);}},{key:"selection",value:function selection(t){return new Xu(void 0,Zu,void 0,void 0,t);}}]);}();Zu=[];tf=200;hf=/^(input\.type|delete)($|\.)/;lf=/*#__PURE__*/function(){function lf(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:void 0;_classCallCheck(this,lf);this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=s;}return _createClass(lf,[{key:"isolate",value:function isolate(){return this.prevTime?new lf(this.done,this.undone):this;}},{key:"addChanges",value:function addChanges(t,e,i,s,r){var n=this.done,h=n[n.length-1];return n=h&&h.changes&&!h.changes.empty&&t.changes&&(!i||hf.test(i))&&(!h.selectionsAfter.length&&e-this.prevTime<s.newGroupDelay&&s.joinToEvent(r,function(t,e){var i=[],s=!1;return t.iterChangedRanges(function(t,e){return i.push(t,e);}),e.iterChangedRanges(function(t,e,r,n){for(var _t260=0;_t260<i.length;){var _e222=i[_t260++],_h75=i[_t260++];n>=_e222&&r<=_h75&&(s=!0);}}),s;}(h.changes,t.changes))||"input.type.compose"==i)?Yu(n,n.length-1,s.minDepth,new Xu(t.changes.compose(h.changes),Qu(t.effects,h.effects),h.mapped,h.startSelection,Zu)):Yu(n,n.length,s.minDepth,t),new lf(n,Zu,e,i);}},{key:"addSelection",value:function addSelection(t,e,i,s){var r=this.done.length?this.done[this.done.length-1].selectionsAfter:Zu;return r.length>0&&e-this.prevTime<s&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&(n=r[r.length-1],h=t,n.ranges.length==h.ranges.length&&0===n.ranges.filter(function(t,e){return t.empty!=h.ranges[e].empty;}).length)?this:new lf(ef(this.done,t),this.undone,e,i);var n,h;}},{key:"addMapping",value:function addMapping(t){return new lf(rf(this.done,t),rf(this.undone,t),this.prevTime,this.prevUserEvent);}},{key:"pop",value:function pop(t,e,i){var s=0==t?this.done:this.undone;if(0==s.length)return null;var r=s[s.length-1],n=r.selectionsAfter[0]||e.selection;if(i&&r.selectionsAfter.length)return e.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Hu.of({side:t,rest:sf(s),selection:n}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){var _i187=1==s.length?Zu:s.slice(0,s.length-1);return r.mapped&&(_i187=rf(_i187,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Hu.of({side:t,rest:_i187,selection:n}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0});}return null;}}]);}();lf.empty=new lf(Zu,Zu);of=[{key:"Mod-z",run:Ju,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Gu,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Gu,preventDefault:!0},{key:"Mod-u",run:Ku,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:_u,preventDefault:!0}];mf=function mf(t){return df(t,!pf(t));};gf=function gf(t){return df(t,pf(t));};yf=function yf(t){return kf(t,!1);};Mf=function Mf(t){return kf(t,!0);};Af=function Af(t){return Sf(t,!1);};Cf=function Cf(t){return Sf(t,!0);};If=function If(t){return Ef(t,!pf(t));};Rf=function Rf(t){return Ef(t,pf(t));};Lf=function Lf(t){return Bf(t,!1);};Nf=function Nf(t){return Bf(t,!0);};$f=function $f(t){return jf(t,!1);};zf=function zf(t){return jf(t,!0);};Pf=function Pf(_ref24){var t=_ref24.state,e=_ref24.dispatch;return e(ff(t,{anchor:0})),!0;};Hf=function Hf(_ref25){var t=_ref25.state,e=_ref25.dispatch;return e(ff(t,{anchor:t.doc.length})),!0;};Wf=function Wf(_ref26){var t=_ref26.state,e=_ref26.dispatch;return e(ff(t,{anchor:t.selection.main.anchor,head:0})),!0;};Vf=function Vf(_ref27){var t=_ref27.state,e=_ref27.dispatch;return e(ff(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0;};Uf=function Uf(t,e,i){return Ff(t,function(s){var r,n,h=s.from,l=t.state,o=l.doc.lineAt(h);if(i&&!e&&h>o.from&&h<o.from+200&&!/[^ \t]/.test(r=o.text.slice(0,h-o.from))){if("\t"==r[r.length-1])return h-1;var _t261=Vt(r,l.tabSize)%vo(l)||vo(l);for(var _e226=0;_e226<_t261&&" "==r[r.length-1-_e226];_e226++)h--;n=h;}else n=p(o.text,h-o.from,e,e)+o.from,n==h&&o.number!=(e?l.doc.lines:1)?n+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(n-o.from,h-o.from))&&(n=p(o.text,n-o.from,!1,!1)+o.from);return n;});};Jf=function Jf(t){return Uf(t,!1,!0);};Gf=function Gf(t){return Uf(t,!0,!1);};Kf=function Kf(t,e){return Ff(t,function(i){var s=i.head,r=t.state,n=r.doc.lineAt(s),h=r.charCategorizer(s);for(var _t262=null;;){if(s==(e?n.to:n.from)){s==i.head&&n.number!=(e?r.doc.lines:1)&&(s+=e?1:-1);break;}var _l67=p(n.text,s-n.from,e)+n.from,_o44=n.text.slice(Math.min(s,_l67)-n.from,Math.max(s,_l67)-n.from),_u43=h(_o44);if(null!=_t262&&_u43!=_t262)break;" "==_o44&&s==i.head||(_t262=_u43),s=_l67;}return s;});};_f=function _f(t){return Kf(t,!1);};Zf=ta(!1);ia=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:function run(t){return af(t,function(e){return vf(t.state,e,!pf(t));});},shift:function shift(t){return Df(t,function(e){return vf(t.state,e,!pf(t));});}},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:function run(t){return af(t,function(e){return vf(t.state,e,pf(t));});},shift:function shift(t){return Df(t,function(e){return vf(t.state,e,pf(t));});}},{key:"Alt-ArrowUp",run:function run(_ref29){var t=_ref29.state,e=_ref29.dispatch;return Yf(t,e,!1);}},{key:"Shift-Alt-ArrowUp",run:function run(_ref30){var t=_ref30.state,e=_ref30.dispatch;return Qf(t,e,!1);}},{key:"Alt-ArrowDown",run:function run(_ref31){var t=_ref31.state,e=_ref31.dispatch;return Yf(t,e,!0);}},{key:"Shift-Alt-ArrowDown",run:function run(_ref32){var t=_ref32.state,e=_ref32.dispatch;return Qf(t,e,!0);}},{key:"Escape",run:function run(_ref33){var t=_ref33.state,e=_ref33.dispatch;var i=t.selection,s=null;return i.ranges.length>1?s=B.create([i.main]):i.main.empty||(s=B.create([B.cursor(i.main.head)])),!!s&&(e(ff(t,s)),!0);}},{key:"Mod-Enter",run:ta(!0)},{key:"Alt-l",mac:"Ctrl-l",run:function run(_ref34){var t=_ref34.state,e=_ref34.dispatch;var i=Xf(t).map(function(_ref35){var e=_ref35.from,i=_ref35.to;return B.range(e,Math.min(i+1,t.doc.length));});return e(t.update({selection:B.create(i),userEvent:"select"})),!0;}},{key:"Mod-i",run:function run(_ref36){var t=_ref36.state,e=_ref36.dispatch;var i=uf(t.selection,function(e){var i;for(var _s174=no(t).resolveStack(e.from,1);_s174;_s174=_s174.next){var _s175=_s174,_t265=_s175.node;if((_t265.from<e.from&&_t265.to>=e.to||_t265.to>e.to&&_t265.from<=e.from)&&(null===(i=_t265.parent)||void 0===i?void 0:i.parent))return B.range(_t265.to,_t265.from);}return e;});return e(ff(t,i)),!0;},preventDefault:!0},{key:"Mod-[",run:function run(_ref37){var t=_ref37.state,e=_ref37.dispatch;return!t.readOnly&&(e(t.update(ea(t,function(e,i){var s=/^\s*/.exec(e.text)[0];if(!s)return;var r=Vt(s,t.tabSize),n=0,h=ko(t,Math.max(0,r-vo(t)));for(;n<s.length&&n<h.length&&s.charCodeAt(n)==h.charCodeAt(n);)n++;i.push({from:e.from+n,to:e.from+s.length,insert:h.slice(n)});}),{userEvent:"delete.dedent"})),!0);}},{key:"Mod-]",run:function run(_ref38){var t=_ref38.state,e=_ref38.dispatch;return!t.readOnly&&(e(t.update(ea(t,function(e,i){i.push({from:e.from,insert:t.facet(bo)});}),{userEvent:"input.indent"})),!0);}},{key:"Mod-Alt-\\",run:function run(_ref39){var t=_ref39.state,e=_ref39.dispatch;if(t.readOnly)return!1;var i=Object.create(null),s=new Mo(t,{overrideIndentation:function overrideIndentation(t){var e=i[t];return null==e?-1:e;}}),r=ea(t,function(e,r,n){var h=yo(s,e.from);if(null==h)return;/\S/.test(e.text)||(h=0);var l=/^\s*/.exec(e.text)[0],o=ko(t,h);(l!=o||n.from<e.from+l.length)&&(i[e.from]=h,r.push({from:e.from,to:e.from+l.length,insert:o}));});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0;}},{key:"Shift-Mod-k",run:function run(t){if(t.state.readOnly)return!1;var e=t.state,i=e.changes(Xf(e).map(function(_ref40){var t=_ref40.from,i=_ref40.to;return t>0?t--:i<e.doc.length&&i++,{from:t,to:i};})),s=uf(e.selection,function(e){var i;if(t.lineWrapping){var _s176=t.lineBlockAt(e.head),_r138=t.coordsAtPos(e.head,e.assoc||1);_r138&&(i=_s176.bottom+t.documentTop-_r138.bottom+t.defaultLineHeight/2);}return t.moveVertically(e,!0,i);}).map(i);return t.dispatch({changes:i,selection:s,scrollIntoView:!0,userEvent:"delete.line"}),!0;}},{key:"Shift-Mod-\\",run:function run(_ref41){var t=_ref41.state,e=_ref41.dispatch;return function(t,e,i){var s=!1,r=uf(t.selection,function(e){var r=xu(t,e.head,-1)||xu(t,e.head,1)||e.head>0&&xu(t,e.head-1,1)||e.head<t.doc.length&&xu(t,e.head+1,-1);if(!r||!r.end)return e;s=!0;var n=r.start.from==e.head?r.end.to:r.end.from;return i?B.range(e.anchor,n):B.cursor(n);});return!!s&&(e(ff(t,r)),!0);}(t,e,!1);}},{key:"Mod-/",run:function run(t){var e=t.state,i=e.doc.lineAt(e.selection.main.from),s=ju(t.state,i.from);return s.line?Bu(t):!!s.block&&Nu(t);}},{key:"Alt-A",run:Lu}].concat([{key:"ArrowLeft",run:mf,shift:If,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:function run(t){return wf(t,!pf(t));},shift:function shift(t){return Tf(t,!pf(t));},preventDefault:!0},{mac:"Cmd-ArrowLeft",run:function run(t){return af(t,function(e){return Of(t,e,!pf(t));});},shift:function shift(t){return Df(t,function(e){return Of(t,e,!pf(t));});},preventDefault:!0},{key:"ArrowRight",run:gf,shift:Rf,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:function run(t){return wf(t,pf(t));},shift:function shift(t){return Tf(t,pf(t));},preventDefault:!0},{mac:"Cmd-ArrowRight",run:function run(t){return af(t,function(e){return Of(t,e,pf(t));});},shift:function shift(t){return Df(t,function(e){return Of(t,e,pf(t));});},preventDefault:!0},{key:"ArrowUp",run:yf,shift:Lf,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Pf,shift:Wf},{mac:"Ctrl-ArrowUp",run:Af,shift:$f},{key:"ArrowDown",run:Mf,shift:Nf,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Hf,shift:Vf},{mac:"Ctrl-ArrowDown",run:Cf,shift:zf},{key:"PageUp",run:Af,shift:$f},{key:"PageDown",run:Cf,shift:zf},{key:"Home",run:function run(t){return af(t,function(e){return Of(t,e,!1);});},shift:function shift(t){return Df(t,function(e){return Of(t,e,!1);});},preventDefault:!0},{key:"Mod-Home",run:Pf,shift:Wf},{key:"End",run:function run(t){return af(t,function(e){return Of(t,e,!0);});},shift:function shift(t){return Df(t,function(e){return Of(t,e,!0);});},preventDefault:!0},{key:"Mod-End",run:Hf,shift:Vf},{key:"Enter",run:Zf},{key:"Mod-a",run:function run(_ref42){var t=_ref42.state,e=_ref42.dispatch;return e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0;}},{key:"Backspace",run:Jf,shift:Jf},{key:"Delete",run:Gf},{key:"Mod-Backspace",mac:"Alt-Backspace",run:_f},{key:"Mod-Delete",mac:"Alt-Delete",run:function run(t){return Kf(t,!0);}},{mac:"Mod-Backspace",run:function run(t){return Ff(t,function(e){var i=t.moveToLineBoundary(e,!1).head;return e.head>i?i:Math.max(0,e.head-1);});}},{mac:"Mod-Delete",run:function run(t){return Ff(t,function(e){var i=t.moveToLineBoundary(e,!0).head;return e.head<i?i:Math.min(t.state.doc.length,e.head+1);});}}].concat([{key:"Ctrl-b",run:mf,shift:If,preventDefault:!0},{key:"Ctrl-f",run:gf,shift:Rf},{key:"Ctrl-p",run:yf,shift:Lf},{key:"Ctrl-n",run:Mf,shift:Nf},{key:"Ctrl-a",run:function run(t){return af(t,function(e){return B.cursor(t.lineBlockAt(e.head).from,1);});},shift:function shift(t){return Df(t,function(e){return B.cursor(t.lineBlockAt(e.head).from);});}},{key:"Ctrl-e",run:function run(t){return af(t,function(e){return B.cursor(t.lineBlockAt(e.head).to,-1);});},shift:function shift(t){return Df(t,function(e){return B.cursor(t.lineBlockAt(e.head).to);});}},{key:"Ctrl-d",run:Gf},{key:"Ctrl-h",run:Jf},{key:"Ctrl-k",run:function run(t){return Ff(t,function(e){var i=t.lineBlockAt(e.head).to;return e.head<i?i:Math.min(t.state.doc.length,e.head+1);});}},{key:"Ctrl-Alt-h",run:_f},{key:"Ctrl-o",run:function run(_ref43){var e=_ref43.state,i=_ref43.dispatch;if(e.readOnly)return!1;var s=e.changeByRange(function(e){return{changes:{from:e.from,to:e.to,insert:t.of(["",""])},range:B.cursor(e.from)};});return i(e.update(s,{scrollIntoView:!0,userEvent:"input"})),!0;}},{key:"Ctrl-t",run:function run(_ref44){var t=_ref44.state,e=_ref44.dispatch;if(t.readOnly)return!1;var i=t.changeByRange(function(e){if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};var i=e.from,s=t.doc.lineAt(i),r=i==s.from?i-1:p(s.text,i-s.from,!1)+s.from,n=i==s.to?i+1:p(s.text,i-s.from,!0)+s.from;return{changes:{from:r,to:n,insert:t.doc.slice(i,n).append(t.doc.slice(r,i))},range:B.cursor(n)};});return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0);}},{key:"Ctrl-v",run:Cf}].map(function(t){return{mac:t.key,run:t.run,shift:t.shift};})));na="function"==typeof String.prototype.normalize?function(t){return t.normalize("NFKD");}:function(t){return t;};ha=/*#__PURE__*/function(){function ha(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:t.length;var r=arguments.length>4?arguments[4]:undefined;var n=arguments.length>5?arguments[5]:undefined;_classCallCheck(this,ha);this.test=n,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,s),this.bufferStart=i,this.normalize=r?function(t){return r(na(t));}:na,this.query=this.normalize(e);}return _createClass(ha,[{key:"peek",value:function peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value;}return v(this.buffer,this.bufferPos);}},{key:"next",value:function next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping();}},{key:"nextOverlapping",value:function nextOverlapping(){for(;;){var _t266=this.peek();if(_t266<0)return this.done=!0,this;var _e229=k(_t266),_i191=this.bufferStart+this.bufferPos;this.bufferPos+=y(_t266);var _s177=this.normalize(_e229);for(var _t267=0,_r139=_i191;;_t267++){var _n110=_s177.charCodeAt(_t267),_h80=this.match(_n110,_r139,this.bufferPos+this.bufferStart);if(_t267==_s177.length-1){if(_h80)return this.value=_h80,this;break;}_r139==_i191&&_t267<_e229.length&&_e229.charCodeAt(_t267)==_n110&&_r139++;}}}},{key:"match",value:function match(t,e,i){var s=null;for(var _e230=0;_e230<this.matches.length;_e230+=2){var _r140=this.matches[_e230],_n111=!1;this.query.charCodeAt(_r140)==t&&(_r140==this.query.length-1?s={from:this.matches[_e230+1],to:i}:(this.matches[_e230]++,_n111=!0)),_n111||(this.matches.splice(_e230,2),_e230-=2);}return this.query.charCodeAt(0)==t&&(1==this.query.length?s={from:e,to:i}:this.matches.push(1,e)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s;}}]);}();"undefined"!=typeof Symbol&&(ha.prototype[Symbol.iterator]=function(){return this;});la={from:-1,to:-1,match:/.*/.exec("")};oa="gm"+(null==/x/.unicode?"":"u");ua=/*#__PURE__*/function(){function ua(t,e,i){var s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:t.length;_classCallCheck(this,ua);if(this.text=t,this.to=r,this.curLine="",this.done=!1,this.value=la,/\\[sWDnr]|\n|\r|\[\^/.test(e))return new ca(t,e,i,s,r);this.re=new RegExp(e,oa+((null==i?void 0:i.ignoreCase)?"i":"")),this.test=null==i?void 0:i.test,this.iter=t.iter();var n=t.lineAt(s);this.curLineStart=n.from,this.matchPos=da(t,s),this.getLine(this.curLineStart);}return _createClass(ua,[{key:"getLine",value:function getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next());}},{key:"nextLine",value:function nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0);}},{key:"next",value:function next(){for(var _t268=this.matchPos-this.curLineStart;;){this.re.lastIndex=_t268;var _e231=this.matchPos<=this.to&&this.re.exec(this.curLine);if(_e231){var _i192=this.curLineStart+_e231.index,_s178=_i192+_e231[0].length;if(this.matchPos=da(this.text,_s178+(_i192==_s178?1:0)),_i192==this.curLineStart+this.curLine.length&&this.nextLine(),(_i192<_s178||_i192>this.value.to)&&(!this.test||this.test(_i192,_s178,_e231)))return this.value={from:_i192,to:_s178,match:_e231},this;_t268=this.matchPos-this.curLineStart;}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),_t268=0;}}}}]);}();fa=new WeakMap();aa=/*#__PURE__*/function(){function aa(t,e){_classCallCheck(this,aa);this.from=t,this.text=e;}return _createClass(aa,[{key:"to",get:function get(){return this.from+this.text.length;}}],[{key:"get",value:function get(t,e,i){var s=fa.get(t);if(!s||s.from>=i||s.to<=e){var _s179=new aa(e,t.sliceString(e,i));return fa.set(t,_s179),_s179;}if(s.from==e&&s.to==i)return s;var r=s.text,n=s.from;return n>e&&(r=t.sliceString(e,n)+r,n=e),s.to<i&&(r+=t.sliceString(s.to,i)),fa.set(t,new aa(n,r)),new aa(e,r.slice(e-n,i-n));}}]);}();ca=/*#__PURE__*/function(){function ca(t,e,i,s,r){_classCallCheck(this,ca);this.text=t,this.to=r,this.done=!1,this.value=la,this.matchPos=da(t,s),this.re=new RegExp(e,oa+((null==i?void 0:i.ignoreCase)?"i":"")),this.test=null==i?void 0:i.test,this.flat=aa.get(t,s,this.chunkEnd(s+5e3));}return _createClass(ca,[{key:"chunkEnd",value:function chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to;}},{key:"next",value:function next(){for(;;){var _t269=this.re.lastIndex=this.matchPos-this.flat.from,_e232=this.re.exec(this.flat.text);if(_e232&&!_e232[0]&&_e232.index==_t269&&(this.re.lastIndex=_t269+1,_e232=this.re.exec(this.flat.text)),_e232){var _t270=this.flat.from+_e232.index,_i193=_t270+_e232[0].length;if((this.flat.to>=this.to||_e232.index+_e232[0].length<=this.flat.text.length-10)&&(!this.test||this.test(_t270,_i193,_e232)))return this.value={from:_t270,to:_i193,match:_e232},this.matchPos=da(this.text,_i193+(_t270==_i193?1:0)),this;}if(this.flat.to==this.to)return this.done=!0,this;this.flat=aa.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length));}}}]);}();"undefined"!=typeof Symbol&&(ua.prototype[Symbol.iterator]=ca.prototype[Symbol.iterator]=function(){return this;});ma=ct.define();ga=F.define({create:function create(){return!0;},update:function update(t,e){var _iterator193=_createForOfIteratorHelper(e.effects),_step193;try{for(_iterator193.s();!(_step193=_iterator193.n()).done;){var _i195=_step193.value;_i195.is(ma)&&(t=_i195.value);}}catch(err){_iterator193.e(err);}finally{_iterator193.f();}return t;},provide:function provide(t){return fh.from(t,function(t){return t?pa:null;});}});wa=Ur.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}});ba={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1};va=j.define({combine:function combine(t){return At(t,ba,{highlightWordAroundCursor:function highlightWordAroundCursor(t,e){return t||e;},minSelectionLength:Math.min,maxMatches:Math.min});}});ka=ni.mark({"class":"cm-selectionMatch"});ya=ni.mark({"class":"cm-selectionMatch cm-selectionMatch-main"});xa=_i.fromClass(/*#__PURE__*/function(){function _class11(t){_classCallCheck(this,_class11);this.decorations=this.getDeco(t);}return _createClass(_class11,[{key:"update",value:function update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view));}},{key:"getDeco",value:function getDeco(t){var e=t.state.facet(va),i=t.state,s=i.selection;if(s.ranges.length>1)return ni.none;var r,n=s.main,h=null;if(n.empty){if(!e.highlightWordAroundCursor)return ni.none;var _t272=i.wordAt(n.head);if(!_t272)return ni.none;h=i.charCategorizer(n.head),r=i.sliceDoc(_t272.from,_t272.to);}else{var _t273=n.to-n.from;if(_t273<e.minSelectionLength||_t273>200)return ni.none;if(e.wholeWords){if(r=i.sliceDoc(n.from,n.to),h=i.charCategorizer(n.head),!Ma(h,i,n.from,n.to)||!function(t,e,i,s){return t(e.sliceDoc(i,i+1))==kt.Word&&t(e.sliceDoc(s-1,s))==kt.Word;}(h,i,n.from,n.to))return ni.none;}else if(r=i.sliceDoc(n.from,n.to),!r)return ni.none;}var l=[];var _iterator194=_createForOfIteratorHelper(t.visibleRanges),_step194;try{for(_iterator194.s();!(_step194=_iterator194.n()).done;){var _s180=_step194.value;var _t274=new ha(i.doc,r,_s180.from,_s180.to);for(;!_t274.next().done;){var _t274$value=_t274.value,_s181=_t274$value.from,_r141=_t274$value.to;if((!h||Ma(h,i,_s181,_r141))&&(n.empty&&_s181<=n.from&&_r141>=n.to?l.push(ya.range(_s181,_r141)):(_s181>=n.to||_r141<=n.from)&&l.push(ka.range(_s181,_r141)),l.length>e.maxMatches))return ni.none;}}}catch(err){_iterator194.e(err);}finally{_iterator194.f();}return ni.set(l);}}]);}(),{decorations:function decorations(t){return t.decorations;}});Sa=Ur.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});Aa=j.define({combine:function combine(t){return At(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:function createPanel(t){return new tc(t);},scrollToMatch:function scrollToMatch(t){return Ur.scrollIntoView(t);}});}});Ca=/*#__PURE__*/function(){function Ca(t){_classCallCheck(this,Ca);this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,oa),!0;}catch(t){return!1;}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord;}return _createClass(Ca,[{key:"unquote",value:function unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,function(t,e){return"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\";});}},{key:"eq",value:function eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord;}},{key:"create",value:function create(){return this.regexp?new Ba(this):new Ea(this);}},{key:"getCursor",value:function getCursor(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var i=arguments.length>2?arguments[2]:undefined;var s=t.doc?t:St.create({doc:t});return null==i&&(i=s.doc.length),this.regexp?Ia(this,s,e,i):Da(this,s,e,i);}}]);}();Oa=/*#__PURE__*/_createClass(function Oa(t){_classCallCheck(this,Oa);this.spec=t;});Ea=/*#__PURE__*/function(_Oa){function Ea(t){_classCallCheck(this,Ea);return _callSuper(this,Ea,[t]);}_inherits(Ea,_Oa);return _createClass(Ea,[{key:"nextMatch",value:function nextMatch(t,e,i){var s=Da(this.spec,t,i,t.doc.length).nextOverlapping();return s.done&&(s=Da(this.spec,t,0,e).nextOverlapping()),s.done?null:s.value;}},{key:"prevMatchInRange",value:function prevMatchInRange(t,e,i){for(var _s182=i;;){var _i196=Math.max(e,_s182-1e4-this.spec.unquoted.length),_r142=Da(this.spec,t,_i196,_s182),_n112=null;for(;!_r142.nextOverlapping().done;)_n112=_r142.value;if(_n112)return _n112;if(_i196==e)return null;_s182-=1e4;}}},{key:"prevMatch",value:function prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length);}},{key:"getReplacement",value:function getReplacement(t){return this.spec.unquote(this.spec.replace);}},{key:"matchAll",value:function matchAll(t,e){var i=Da(this.spec,t,0,t.doc.length),s=[];for(;!i.next().done;){if(s.length>=e)return null;s.push(i.value);}return s;}},{key:"highlight",value:function highlight(t,e,i,s){var r=Da(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to);}}]);}(Oa);Ba=/*#__PURE__*/function(_Oa2){function Ba(){_classCallCheck(this,Ba);return _callSuper(this,Ba,arguments);}_inherits(Ba,_Oa2);return _createClass(Ba,[{key:"nextMatch",value:function nextMatch(t,e,i){var s=Ia(this.spec,t,i,t.doc.length).next();return s.done&&(s=Ia(this.spec,t,0,e).next()),s.done?null:s.value;}},{key:"prevMatchInRange",value:function prevMatchInRange(t,e,i){for(var _s183=1;;_s183++){var _r143=Math.max(e,i-1e4*_s183),_n113=Ia(this.spec,t,_r143,i),_h81=null;for(;!_n113.next().done;)_h81=_n113.value;if(_h81&&(_r143==e||_h81.from>_r143+10))return _h81;if(_r143==e)return null;}}},{key:"prevMatch",value:function prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length);}},{key:"getReplacement",value:function getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,function(e,i){return"$"==i?"$":"&"==i?t.match[0]:"0"!=i&&+i<t.match.length?t.match[i]:e;});}},{key:"matchAll",value:function matchAll(t,e){var i=Ia(this.spec,t,0,t.doc.length),s=[];for(;!i.next().done;){if(s.length>=e)return null;s.push(i.value);}return s;}},{key:"highlight",value:function highlight(t,e,i,s){var r=Ia(this.spec,t,Math.max(0,e-250),Math.min(i+250,t.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to);}}]);}(Oa);La=ct.define();Na=ct.define();ja=F.define({create:function create(t){return new $a(Ka(t).create(),null);},update:function update(t,e){var _iterator195=_createForOfIteratorHelper(e.effects),_step195;try{for(_iterator195.s();!(_step195=_iterator195.n()).done;){var _i197=_step195.value;_i197.is(La)?t=new $a(_i197.value.create(),t.panel):_i197.is(Na)&&(t=new $a(t.query,_i197.value?Ga:null));}}catch(err){_iterator195.e(err);}finally{_iterator195.f();}return t;},provide:function provide(t){return fh.from(t,function(t){return t.panel;});}});$a=/*#__PURE__*/_createClass(function $a(t,e){_classCallCheck(this,$a);this.query=t,this.panel=e;});za=ni.mark({"class":"cm-searchMatch"});Pa=ni.mark({"class":"cm-searchMatch cm-searchMatch-selected"});Ha=_i.fromClass(/*#__PURE__*/function(){function _class12(t){_classCallCheck(this,_class12);this.view=t,this.decorations=this.highlight(t.state.field(ja));}return _createClass(_class12,[{key:"update",value:function update(t){var e=t.state.field(ja);(e!=t.startState.field(ja)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e));}},{key:"highlight",value:function highlight(_ref45){var t=_ref45.query,e=_ref45.panel;if(!e||!t.spec.valid)return ni.none;var i=this.view,s=new Rt();for(var _e233=0,_r144=i.visibleRanges,_n114=_r144.length;_e233<_n114;_e233++){var _r144$_e=_r144[_e233],_h82=_r144$_e.from,_l69=_r144$_e.to;for(;_e233<_n114-1&&_l69>_r144[_e233+1].from-500;)_l69=_r144[++_e233].to;t.highlight(i.state,_h82,_l69,function(t,e){var r=i.state.selection.ranges.some(function(i){return i.from==t&&i.to==e;});s.add(t,e,r?Pa:za);});}return s.finish();}}]);}(),{decorations:function decorations(t){return t.decorations;}});Va=Wa(function(t,_ref46){var e=_ref46.query;var i=t.state.selection.main.to,s=e.nextMatch(t.state,i,i);if(!s)return!1;var r=B.single(s.from,s.to),n=t.state.facet(Aa);return t.dispatch({selection:r,effects:[rc(t,s),n.scrollToMatch(r.main,t)],userEvent:"select.search"}),Xa(t),!0;});Fa=Wa(function(t,_ref47){var e=_ref47.query;var i=t.state,s=i.selection.main.from,r=e.prevMatch(i,s,s);if(!r)return!1;var n=B.single(r.from,r.to),h=t.state.facet(Aa);return t.dispatch({selection:n,effects:[rc(t,r),h.scrollToMatch(n.main,t)],userEvent:"select.search"}),Xa(t),!0;});qa=Wa(function(t,_ref48){var e=_ref48.query;var i=e.matchAll(t.state,1e3);return!(!i||!i.length)&&(t.dispatch({selection:B.create(i.map(function(t){return B.range(t.from,t.to);})),userEvent:"select.search.matches"}),!0);});Ua=Wa(function(t,_ref49){var e=_ref49.query;var i=t.state,_i$selection$main=i.selection.main,s=_i$selection$main.from,r=_i$selection$main.to;if(i.readOnly)return!1;var n=e.nextMatch(i,s,s);if(!n)return!1;var h,l,o=[],u=[];if(n.from==s&&n.to==r&&(l=i.toText(e.getReplacement(n)),o.push({from:n.from,to:n.to,insert:l}),n=e.nextMatch(i,n.from,n.to),u.push(Ur.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(s).number)+"."))),n){var _e234=0==o.length||o[0].from>=n.to?0:n.to-n.from-l.length;h=B.single(n.from-_e234,n.to-_e234),u.push(rc(t,n)),u.push(i.facet(Aa).scrollToMatch(h.main,t));}return t.dispatch({changes:o,selection:h,effects:u,userEvent:"input.replace"}),!0;});Ja=Wa(function(t,_ref50){var e=_ref50.query;if(t.state.readOnly)return!1;var i=e.matchAll(t.state,1e9).map(function(t){var i=t.from,s=t.to;return{from:i,to:s,insert:e.getReplacement(t)};});if(!i.length)return!1;var s=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:Ur.announce.of(s),userEvent:"input.replace.all"}),!0;});Ya=function Ya(t){var e=t.state.field(ja,!1);if(e&&e.panel){var _i198=_a(t);if(_i198&&_i198!=t.root.activeElement){var _s184=Ka(t.state,e.query.spec);_s184.valid&&t.dispatch({effects:La.of(_s184)}),_i198.focus(),_i198.select();}}else t.dispatch({effects:[Na.of(!0),e?La.of(Ka(t.state,e.query.spec)):ct.appendConfig.of(hc)]});return!0;};Qa=function Qa(t){var e=t.state.field(ja,!1);if(!e||!e.panel)return!1;var i=hh(t,Ga);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Na.of(!1)}),!0;};Za=[{key:"Mod-f",run:Ya,scope:"editor search-panel"},{key:"F3",run:Va,shift:Fa,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Va,shift:Fa,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Qa,scope:"editor search-panel"},{key:"Mod-Shift-l",run:function run(_ref51){var t=_ref51.state,e=_ref51.dispatch;var i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;var _i$main=i.main,s=_i$main.from,r=_i$main.to,n=[],h=0;for(var _e235=new ha(t.doc,t.sliceDoc(s,r));!_e235.next().done;){if(n.length>1e3)return!1;_e235.value.from==s&&(h=n.length),n.push(B.range(_e235.value.from,_e235.value.to));}return e(t.update({selection:B.create(n,h),userEvent:"select.search.matches"})),!0;}},{key:"Mod-Alt-g",run:function run(t){var e=hh(t,pa);if(!e){var _i199=[ma.of(!0)];null==t.state.field(ga,!1)&&_i199.push(ct.appendConfig.of([ga,wa])),t.dispatch({effects:_i199}),e=hh(t,pa);}return e&&e.dom.querySelector("input").select(),!0;}},{key:"Mod-d",run:function run(_ref52){var t=_ref52.state,e=_ref52.dispatch;var i=t.selection.ranges;if(i.some(function(t){return t.from===t.to;}))return function(_ref53){var t=_ref53.state,e=_ref53.dispatch;var i=t.selection,s=B.create(i.ranges.map(function(e){return t.wordAt(e.head)||B.cursor(e.head);}),i.mainIndex);return!s.eq(i)&&(e(t.update({selection:s})),!0);}({state:t,dispatch:e});var s=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some(function(e){return t.sliceDoc(e.from,e.to)!=s;}))return!1;var r=function(t,e){var _t$selection=t.selection,i=_t$selection.main,s=_t$selection.ranges,r=t.wordAt(i.head),n=r&&r.from==i.from&&r.to==i.to;var _loop16=function _loop16(_i201,_r146){if(_r146.next(),!_r146.done){if(_i201&&s.some(function(t){return t.from==_r146.value.from;})){_i200=_i201,_r145=_r146;return 0;}// continue
|
3
3
|
if(n){var _e236=t.wordAt(_r146.value.from);if(!_e236||_e236.from!=_r146.value.from||_e236.to!=_r146.value.to){_i200=_i201,_r145=_r146;return 0;}// continue
|
4
|
-
}return{v:_r146.value};}if(_i201)return{v:null};_r146=new na(t.doc,e,0,Math.max(0,s[s.length-1].from-1)),_i201=!0;_i200=_i201,_r145=_r146;},_ret2;for(var _i200=!1,_r145=new na(t.doc,e,s[s.length-1].to);;){_ret2=_loop16(_i200,_r145);if(_ret2===0)continue;if(_ret2)return _ret2.v;}}(t,s);return!!r&&(e(t.update({selection:t.selection.addRange(B.range(r.from,r.to),!1),effects:Ur.scrollIntoView(r.to)})),!0);},preventDefault:!0}];Za=/*#__PURE__*/function(){function Za(t){var _this80=this;_classCallCheck(this,Za);this.view=t;var e=this.query=t.state.field(Na).query.spec;function i(t,e,i){return ia("button",{"class":"cm-button",name:t,onclick:e,type:"button"},i);}this.commit=this.commit.bind(this),this.searchField=ia("input",{value:e.search,placeholder:tc(t,"Find"),"aria-label":tc(t,"Find"),"class":"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ia("input",{value:e.replace,placeholder:tc(t,"Replace"),"aria-label":tc(t,"Replace"),"class":"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ia("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=ia("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=ia("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=ia("div",{onkeydown:function onkeydown(t){return _this80.keydown(t);},"class":"cm-search"},[this.searchField,i("next",function(){return Wa(t);},[tc(t,"next")]),i("prev",function(){return Va(t);},[tc(t,"previous")]),i("select",function(){return Fa(t);},[tc(t,"all")]),ia("label",null,[this.caseField,tc(t,"match case")]),ia("label",null,[this.reField,tc(t,"regexp")]),ia("label",null,[this.wordField,tc(t,"by word")])].concat(_toConsumableArray(t.state.readOnly?[]:[ia("br"),this.replaceField,i("replace",function(){return qa(t);},[tc(t,"replace")]),i("replaceAll",function(){return Ua(t);},[tc(t,"replace all")])]),[ia("button",{name:"close",onclick:function onclick(){return Ya(t);},"aria-label":tc(t,"close"),type:"button"},["×"])]));}return _createClass(Za,[{key:"commit",value:function commit(){var t=new Aa({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:Ba.of(t)}));}},{key:"keydown",value:function keydown(t){var e,i,s;e=this.view,i=t,s="search-panel",nn(en(e.state),i,e,s)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?Va:Wa)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),qa(this.view));}},{key:"update",value:function update(t){var _iterator196=_createForOfIteratorHelper(t.transactions),_step196;try{for(_iterator196.s();!(_step196=_iterator196.n()).done;){var _e237=_step196.value;var _iterator197=_createForOfIteratorHelper(_e237.effects),_step197;try{for(_iterator197.s();!(_step197=_iterator197.n()).done;){var _t275=_step197.value;_t275.is(Ba)&&!_t275.value.eq(this.query)&&this.setQuery(_t275.value);}}catch(err){_iterator197.e(err);}finally{_iterator197.f();}}}catch(err){_iterator196.e(err);}finally{_iterator196.f();}}},{key:"setQuery",value:function setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord;}},{key:"mount",value:function mount(){this.searchField.select();}},{key:"pos",get:function get(){return 80;}},{key:"top",get:function get(){return this.view.state.facet(Sa).top;}}]);}();ec=30;ic=/[\s\.,:;?!]/;rc=Ur.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}});nc=[Na,_.low(Pa),rc];hc=/*#__PURE__*/function(){function hc(t,e,i){_classCallCheck(this,hc);this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[];}return _createClass(hc,[{key:"tokenBefore",value:function tokenBefore(t){var e=no(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null;}},{key:"matchBefore",value:function matchBefore(t){var e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),s=e.text.slice(i-e.from,this.pos-e.from),r=s.search(cc(t,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)};}},{key:"aborted",get:function get(){return null==this.abortListeners;}},{key:"addEventListener",value:function addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e);}}]);}();fc=/*#__PURE__*/_createClass(function fc(t,e,i,s){_classCallCheck(this,fc);this.completion=t,this.source=e,this.match=i,this.score=s;});dc=ut.define();pc=new WeakMap();gc=ct.define();wc=ct.define();bc=/*#__PURE__*/function(){function bc(t){_classCallCheck(this,bc);this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(var _e239=0;_e239<t.length;){var _i202=v(t,_e239),_s186=y(_i202);this.chars.push(_i202);var _r147=t.slice(_e239,_e239+_s186),_n115=_r147.toUpperCase();this.folded.push(v(_n115==_r147?_r147.toLowerCase():_n115,0)),_e239+=_s186;}this.astral=t.length!=this.chars.length;}return _createClass(bc,[{key:"ret",value:function ret(t,e){return this.score=t,this.matched=e,this;}},{key:"match",value:function match(t){if(0==this.pattern.length)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;var e=this.chars,i=this.folded,s=this.any,r=this.precise,n=this.byWord;if(1==e.length){var _s187=v(t,0),_r148=y(_s187),_n116=_r148==t.length?0:-100;if(_s187==e[0]);else{if(_s187!=i[0])return null;_n116+=-200;}return this.ret(_n116,[0,_r148]);}var h=t.indexOf(this.pattern);if(0==h)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);var l=e.length,o=0;if(h<0){for(var _r149=0,_n117=Math.min(t.length,200);_r149<_n117&&o<l;){var _n118=v(t,_r149);_n118!=e[o]&&_n118!=i[o]||(s[o++]=_r149),_r149+=y(_n118);}if(o<l)return null;}var u=0,f=0,a=!1,c=0,d=-1,p=-1,m=/[a-z]/.test(t),g=!0;for(var _s188=0,_o45=Math.min(t.length,200),_w3=0;_s188<_o45&&f<l;){var _o46=v(t,_s188);h<0&&(u<l&&_o46==e[u]&&(r[u++]=_s188),c<l&&(_o46==e[c]||_o46==i[c]?(0==c&&(d=_s188),p=_s188+1,c++):c=0));var _b2=void 0,_M2=_o46<255?_o46>=48&&_o46<=57||_o46>=97&&_o46<=122?2:_o46>=65&&_o46<=90?1:0:(_b2=k(_o46))!=_b2.toLowerCase()?1:_b2!=_b2.toUpperCase()?2:0;(!_s188||1==_M2&&m||0==_w3&&0!=_M2)&&(e[f]==_o46||i[f]==_o46&&(a=!0)?n[f++]=_s188:n.length&&(g=!1)),_w3=_M2,_s188+=y(_o46);}return f==l&&0==n[0]&&g?this.result((a?-200:0)-100,n,t):c==l&&0==d?this.ret(-200-t.length+(p==t.length?0:-100),[0,p]):h>-1?this.ret(-700-t.length,[h,h+this.pattern.length]):c==l?this.ret(-900-t.length,[d,p]):f==l?this.result((a?-200:0)-100-700+(g?0:-1100),n,t):2==e.length?null:this.result((s[0]?-700:0)-200-1100,s,t);}},{key:"result",value:function result(t,e,i){var s=[],r=0;var _iterator199=_createForOfIteratorHelper(e),_step199;try{for(_iterator199.s();!(_step199=_iterator199.n()).done;){var _t279=_step199.value;var _e240=_t279+(this.astral?y(v(i,_t279)):1);r&&s[r-1]==_t279?s[r-1]=_e240:(s[r++]=_t279,s[r++]=_e240);}}catch(err){_iterator199.e(err);}finally{_iterator199.f();}return this.ret(t-i.length,s);}}]);}();vc=/*#__PURE__*/function(){function vc(t){_classCallCheck(this,vc);this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase();}return _createClass(vc,[{key:"match",value:function match(t){if(t.length<this.pattern.length)return null;var e=t.slice(0,this.pattern.length),i=e==this.pattern?0:e.toLowerCase()==this.folded?-200:null;return null==i?null:(this.matched=[0,e.length],this.score=i+(t.length==this.pattern.length?0:-100),this);}}]);}();kc=j.define({combine:function combine(t){return At(t,{activateOnTyping:!0,activateOnCompletion:function activateOnCompletion(){return!1;},activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:function tooltipClass(){return"";},optionClass:function optionClass(){return"";},aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Mc,filterStrict:!1,compareCompletions:function compareCompletions(t,e){return t.label.localeCompare(e.label);},interactionDelay:75,updateSyncTime:100},{defaultKeymap:function defaultKeymap(t,e){return t&&e;},closeOnBlur:function closeOnBlur(t,e){return t&&e;},icons:function icons(t,e){return t&&e;},tooltipClass:function tooltipClass(t,e){return function(i){return yc(t(i),e(i));};},optionClass:function optionClass(t,e){return function(i){return yc(t(i),e(i));};},addToOptions:function addToOptions(t,e){return t.concat(e);},filterStrict:function filterStrict(t,e){return t||e;}});}});Sc=/*#__PURE__*/function(){function Sc(t,e,i){var _this81=this;_classCallCheck(this,Sc);this.view=t,this.stateField=e,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:function read(){return _this81.measureInfo();},write:function write(t){return _this81.placeInfo(t);},key:this},this.space=null,this.currentClass="";var s=t.state.field(e),_s$open=s.open,r=_s$open.options,n=_s$open.selected,h=t.state.facet(kc);this.optionContent=function(t){var e=t.addToOptions.slice();return t.icons&&e.push({render:function render(t){var _e$classList;var e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&(_e$classList=e.classList).add.apply(_e$classList,_toConsumableArray(t.type.split(/\s+/g).map(function(t){return"cm-completionIcon-"+t;}))),e.setAttribute("aria-hidden","true"),e;},position:20}),e.push({render:function render(t,e,i,s){var r=document.createElement("span");r.className="cm-completionLabel";var n=t.displayLabel||t.label,h=0;for(var _t282=0;_t282<s.length;){var _e241=s[_t282++],_i203=s[_t282++];_e241>h&&r.appendChild(document.createTextNode(n.slice(h,_e241)));var _l70=r.appendChild(document.createElement("span"));_l70.appendChild(document.createTextNode(n.slice(_e241,_i203))),_l70.className="cm-completionMatchedText",h=_i203;}return h<n.length&&r.appendChild(document.createTextNode(n.slice(h))),r;},position:50},{render:function render(t){if(!t.detail)return null;var e=document.createElement("span");return e.className="cm-completionDetail",e.textContent=t.detail,e;},position:80}),e.sort(function(t,e){return t.position-e.position;}).map(function(t){return t.render;});}(h),this.optionClass=h.optionClass,this.tooltipClass=h.tooltipClass,this.range=xc(r.length,n,h.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",function(i){var s=t.state.field(e).open.options;for(var _e242,_r150=i.target;_r150&&_r150!=_this81.dom;_r150=_r150.parentNode)if("LI"==_r150.nodeName&&(_e242=/-(\d+)$/.exec(_r150.id))&&+_e242[1]<s.length)return _this81.applyCompletion(t,s[+_e242[1]]),void i.preventDefault();}),this.dom.addEventListener("focusout",function(e){var i=t.state.field(_this81.stateField,!1);i&&i.tooltip&&t.state.facet(kc).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:wc.of(null)});}),this.showOptions(r,s.id);}return _createClass(Sc,[{key:"mount",value:function mount(){this.updateSel();}},{key:"showOptions",value:function showOptions(t,e){var _this82=this;this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener("scroll",function(){_this82.info&&_this82.view.requestMeasure(_this82.placeInfoReq);});}},{key:"update",value:function update(t){var e;var i=t.state.field(this.stateField),s=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),i!=s){var _i$open=i.open,_r151=_i$open.options,_n119=_i$open.selected,_h83=_i$open.disabled;s.open&&s.open.options==_r151||(this.range=xc(_r151.length,_n119,t.state.facet(kc).maxRenderedOptions),this.showOptions(_r151,i.id)),this.updateSel(),_h83!=(null===(e=s.open)||void 0===e?void 0:e.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!_h83);}}},{key:"updateTooltipClass",value:function updateTooltipClass(t){var e=this.tooltipClass(t);if(e!=this.currentClass){var _iterator200=_createForOfIteratorHelper(this.currentClass.split(" ")),_step200;try{for(_iterator200.s();!(_step200=_iterator200.n()).done;){var _t283=_step200.value;_t283&&this.dom.classList.remove(_t283);}}catch(err){_iterator200.e(err);}finally{_iterator200.f();}var _iterator201=_createForOfIteratorHelper(e.split(" ")),_step201;try{for(_iterator201.s();!(_step201=_iterator201.n()).done;){var _t284=_step201.value;_t284&&this.dom.classList.add(_t284);}}catch(err){_iterator201.e(err);}finally{_iterator201.f();}this.currentClass=e;}}},{key:"positioned",value:function positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq);}},{key:"updateSel",value:function updateSel(){var _this83=this;var t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected<this.range.from||e.selected>=this.range.to)&&(this.range=xc(e.options.length,e.selected,this.view.state.facet(kc).maxRenderedOptions),this.showOptions(e.options,t.id)),this.updateSelectedOption(e.selected)){this.destroyInfo();var _i204=e.options[e.selected].completion,_s189=_i204.info;if(!_s189)return;var _r152="string"==typeof _s189?document.createTextNode(_s189):_s189(_i204);if(!_r152)return;"then"in _r152?_r152.then(function(e){e&&_this83.view.state.field(_this83.stateField,!1)==t&&_this83.addInfoPane(e,_i204);})["catch"](function(t){return Ui(_this83.view.state,t,"completion info");}):this.addInfoPane(_r152,_i204);}}},{key:"addInfoPane",value:function addInfoPane(t,e){this.destroyInfo();var i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",null!=t.nodeType)i.appendChild(t),this.infoDestroy=null;else{var _e243=t.dom,_s190=t.destroy;i.appendChild(_e243),this.infoDestroy=_s190||null;}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq);}},{key:"updateSelectedOption",value:function updateSelectedOption(t){var e=null;for(var _i205=this.list.firstChild,_s191=this.range.from;_i205;_i205=_i205.nextSibling,_s191++)"LI"==_i205.nodeName&&_i205.id?_s191==t?_i205.hasAttribute("aria-selected")||(_i205.setAttribute("aria-selected","true"),e=_i205):_i205.hasAttribute("aria-selected")&&_i205.removeAttribute("aria-selected"):_s191--;return e&&function(t,e){var i=t.getBoundingClientRect(),s=e.getBoundingClientRect(),r=i.height/t.offsetHeight;s.top<i.top?t.scrollTop-=(i.top-s.top)/r:s.bottom>i.bottom&&(t.scrollTop+=(s.bottom-i.bottom)/r);}(this.list,e),e;}},{key:"measureInfo",value:function measureInfo(){var t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;var e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=t.getBoundingClientRect(),r=this.space;if(!r){var _t285=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:_t285.innerWidth,bottom:_t285.innerHeight};}return s.top>Math.min(r.bottom,e.bottom)-10||s.bottom<Math.max(r.top,e.top)+10?null:this.view.state.facet(kc).positionInfo(this.view,e,s,i,r,this.dom);}},{key:"placeInfo",value:function placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t["class"]||"")):this.info.style.cssText="top: -1e6px");}},{key:"createListBox",value:function createListBox(t,e,i){var s=document.createElement("ul");s.id=e,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions"));var r=null;for(var _n120=i.from;_n120<i.to;_n120++){var _t$_n=t[_n120],_h84=_t$_n.completion,_l71=_t$_n.match,_o47=_h84.section;if(_o47){var _t286="string"==typeof _o47?_o47:_o47.name;if(_t286!=r&&(_n120>i.from||0==i.from))if(r=_t286,"string"!=typeof _o47&&_o47.header)s.appendChild(_o47.header(_o47));else{s.appendChild(document.createElement("completion-section")).textContent=_t286;}}var _u44=s.appendChild(document.createElement("li"));_u44.id=e+"-"+_n120,_u44.setAttribute("role","option");var _f25=this.optionClass(_h84);_f25&&(_u44.className=_f25);var _iterator202=_createForOfIteratorHelper(this.optionContent),_step202;try{for(_iterator202.s();!(_step202=_iterator202.n()).done;){var _t287=_step202.value;var _e244=_t287(_h84,this.view.state,this.view,_l71);_e244&&_u44.appendChild(_e244);}}catch(err){_iterator202.e(err);}finally{_iterator202.f();}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.to<t.length&&s.classList.add("cm-completionListIncompleteBottom"),s;}},{key:"destroyInfo",value:function destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null);}},{key:"destroy",value:function destroy(){this.destroyInfo();}}]);}();Oc=/*#__PURE__*/function(){function Oc(t,e,i,s,r,n){_classCallCheck(this,Oc);this.options=t,this.attrs=e,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=n;}return _createClass(Oc,[{key:"setSelected",value:function setSelected(t,e){return t==this.selected||t>=this.options.length?this:new Oc(this.options,Ic(e,t),this.tooltip,this.timestamp,t,this.disabled);}},{key:"map",value:function map(t){return new Oc(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled);}}],[{key:"build",value:function build(t,e,i,s,r){var n=function(t,e){var i=[],s=null,r=function r(t){i.push(t);var e=t.completion.section;if(e){s||(s=[]);var _t288="string"==typeof e?e:e.name;s.some(function(e){return e.name==_t288;})||s.push("string"==typeof e?{name:_t288}:e);}},n=e.facet(kc);var _iterator203=_createForOfIteratorHelper(t),_step203;try{for(_iterator203.s();!(_step203=_iterator203.n()).done;){var _s192=_step203.value;if(_s192.hasResult()){var _t290=_s192.result.getMatch;if(!1===_s192.result.filter){var _iterator207=_createForOfIteratorHelper(_s192.result.options),_step207;try{for(_iterator207.s();!(_step207=_iterator207.n()).done;){var _e247=_step207.value;r(new fc(_e247,_s192.source,_t290?_t290(_e247):[],1e9-i.length));}}catch(err){_iterator207.e(err);}finally{_iterator207.f();}}else{var _i208=void 0,_h85=e.sliceDoc(_s192.from,_s192.to),_l72=n.filterStrict?new vc(_h85):new bc(_h85);var _iterator208=_createForOfIteratorHelper(_s192.result.options),_step208;try{for(_iterator208.s();!(_step208=_iterator208.n()).done;){var _e248=_step208.value;if(_i208=_l72.match(_e248.label)){var _n121=_e248.displayLabel?_t290?_t290(_e248,_i208.matched):[]:_i208.matched;r(new fc(_e248,_s192.source,_n121,_i208.score+(_e248.boost||0)));}}}catch(err){_iterator208.e(err);}finally{_iterator208.f();}}}}}catch(err){_iterator203.e(err);}finally{_iterator203.f();}if(s){var _t289=Object.create(null),_e245=0,_r153=function _r153(t,e){var i,s;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(s=e.rank)&&void 0!==s?s:1e9)||(t.name<e.name?-1:1);};var _iterator204=_createForOfIteratorHelper(s.sort(_r153)),_step204;try{for(_iterator204.s();!(_step204=_iterator204.n()).done;){var _i206=_step204.value;_e245-=1e5,_t289[_i206.name]=_e245;}}catch(err){_iterator204.e(err);}finally{_iterator204.f();}var _iterator205=_createForOfIteratorHelper(i),_step205;try{for(_iterator205.s();!(_step205=_iterator205.n()).done;){var _e246=_step205.value;var _i207=_e246.completion.section;_i207&&(_e246.score+=_t289["string"==typeof _i207?_i207:_i207.name]);}}catch(err){_iterator205.e(err);}finally{_iterator205.f();}}var h=[],l=null,o=n.compareCompletions;var _iterator206=_createForOfIteratorHelper(i.sort(function(t,e){return e.score-t.score||o(t.completion,e.completion);})),_step206;try{for(_iterator206.s();!(_step206=_iterator206.n()).done;){var _t291=_step206.value;var _e249=_t291.completion;!l||l.label!=_e249.label||l.detail!=_e249.detail||null!=l.type&&null!=_e249.type&&l.type!=_e249.type||l.apply!=_e249.apply||l.boost!=_e249.boost?h.push(_t291):Cc(_t291.completion)>Cc(l)&&(h[h.length-1]=_t291),l=_t291.completion;}}catch(err){_iterator206.e(err);}finally{_iterator206.f();}return h;}(t,e);if(!n.length)return s&&t.some(function(t){return 1==t.state;})?new Oc(s.options,s.attrs,s.tooltip,s.timestamp,s.selected,!0):null;var h=e.facet(kc).selectOnOpen?0:-1;if(s&&s.selected!=h&&-1!=s.selected){var _t292=s.options[s.selected].completion;for(var _e250=0;_e250<n.length;_e250++)if(n[_e250].completion==_t292){h=_e250;break;}}return new Oc(n,Ic(i,h),{pos:t.reduce(function(t,e){return e.hasResult()?Math.min(t,e.from):t;},1e8),create:Pc,above:r.aboveCursor},s?s.timestamp:Date.now(),h,!1);}}]);}();Dc=/*#__PURE__*/function(){function Dc(t,e,i){_classCallCheck(this,Dc);this.active=t,this.id=e,this.open=i;}return _createClass(Dc,[{key:"update",value:function update(t){var _this84=this;var e=t.state,i=e.facet(kc),s=(i.override||e.languageDataAt("autocomplete",ac(e)).map(mc)).map(function(e){return(_this84.active.find(function(t){return t.source==e;})||new Bc(e,_this84.active.some(function(t){return 0!=t.state;})?1:0)).update(t,i);});s.length==this.active.length&&s.every(function(t,e){return t==_this84.active[e];})&&(s=this.active);var r=this.open;r&&t.docChanged&&(r=r.map(t.changes)),t.selection||s.some(function(e){return e.hasResult()&&t.changes.touchesRange(e.from,e.to);})||!function(t,e){if(t==e)return!0;for(var _i209=0,_s193=0;;){for(;_i209<t.length&&!t[_i209].hasResult;)_i209++;for(;_s193<e.length&&!e[_s193].hasResult;)_s193++;var _r154=_i209==t.length,_n122=_s193==e.length;if(_r154||_n122)return _r154==_n122;if(t[_i209++].result!=e[_s193++].result)return!1;}}(s,this.active)?r=Oc.build(s,e,this.id,r,i):r&&r.disabled&&!s.some(function(t){return 1==t.state;})&&(r=null),!r&&s.every(function(t){return 1!=t.state;})&&s.some(function(t){return t.hasResult();})&&(s=s.map(function(t){return t.hasResult()?new Bc(t.source,0):t;}));var _iterator209=_createForOfIteratorHelper(t.effects),_step209;try{for(_iterator209.s();!(_step209=_iterator209.n()).done;){var _e251=_step209.value;_e251.is(jc)&&(r=r&&r.setSelected(_e251.value,this.id));}}catch(err){_iterator209.e(err);}finally{_iterator209.f();}return s==this.active&&r==this.open?this:new Dc(s,this.id,r);}},{key:"tooltip",get:function get(){return this.open?this.open.tooltip:null;}},{key:"attrs",get:function get(){return this.open?this.open.attrs:Ec;}}],[{key:"start",value:function start(){return new Dc(Rc,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null);}}]);}();Ec={"aria-autocomplete":"list"};Rc=[];Bc=/*#__PURE__*/function(){function Bc(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;_classCallCheck(this,Bc);this.source=t,this.state=e,this.explicitPos=i;}return _createClass(Bc,[{key:"hasResult",value:function hasResult(){return!1;}},{key:"update",value:function update(t,e){var i=Tc(t,e),s=this;i?s=s.handleUserEvent(t,i,e):t.docChanged?s=s.handleChange(t):t.selection&&0!=s.state&&(s=new Bc(s.source,0));var _iterator210=_createForOfIteratorHelper(t.effects),_step210;try{for(_iterator210.s();!(_step210=_iterator210.n()).done;){var _e252=_step210.value;if(_e252.is(gc))s=new Bc(s.source,1,_e252.value?ac(t.state):-1);else if(_e252.is(wc))s=new Bc(s.source,0);else if(_e252.is(Nc)){var _iterator211=_createForOfIteratorHelper(_e252.value),_step211;try{for(_iterator211.s();!(_step211=_iterator211.n()).done;){var _t293=_step211.value;_t293.source==s.source&&(s=_t293);}}catch(err){_iterator211.e(err);}finally{_iterator211.f();}}}}catch(err){_iterator210.e(err);}finally{_iterator210.f();}return s;}},{key:"handleUserEvent",value:function handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new Bc(this.source,1):this.map(t.changes);}},{key:"handleChange",value:function handleChange(t){return t.changes.touchesRange(ac(t.startState))?new Bc(this.source,0):this.map(t.changes);}},{key:"map",value:function map(t){return t.empty||this.explicitPos<0?this:new Bc(this.source,this.state,t.mapPos(this.explicitPos));}}]);}();Lc=/*#__PURE__*/function(_Bc){function Lc(t,e,i,s,r){var _this85;_classCallCheck(this,Lc);_this85=_callSuper(this,Lc,[t,2,e]),_this85.result=i,_this85.from=s,_this85.to=r;return _this85;}_inherits(Lc,_Bc);return _createClass(Lc,[{key:"hasResult",value:function hasResult(){return!0;}},{key:"handleUserEvent",value:function handleUserEvent(t,e,i){var s;var r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));var n=t.changes.mapPos(this.from),h=t.changes.mapPos(this.to,1),l=ac(t.state);if((this.explicitPos<0?l<=n:l<this.from)||l>h||!r||"delete"==e&&ac(t.startState)==this.from)return new Bc(this.source,"input"==e&&i.activateOnTyping?1:0);var o=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,s){if(!t)return!1;var r=e.sliceDoc(i,s);return"function"==typeof t?t(r,i,s,e):cc(t,!0).test(r);}(r.validFor,t.state,n,h)?new Lc(this.source,o,r,n,h):r.update&&(r=r.update(r,n,h,new hc(t.state,l,o>=0)))?new Lc(this.source,o,r,r.from,null!==(s=r.to)&&void 0!==s?s:ac(t.state)):new Bc(this.source,1,o);}},{key:"handleChange",value:function handleChange(t){return t.changes.touchesRange(this.from,this.to)?new Bc(this.source,0):this.map(t.changes);}},{key:"map",value:function map(t){if(t.empty)return this;return(this.result.map?this.result.map(this.result,t):this.result)?new Lc(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new Bc(this.source,0);}}]);}(Bc);Nc=ct.define({map:function map(t,e){return t.map(function(t){return t.map(e);});}});jc=ct.define();$c=F.define({create:function create(){return Dc.start();},update:function update(t,e){return t.update(e);},provide:function provide(t){return[Xn.from(t,function(t){return t.tooltip;}),Ur.contentAttributes.from(t,function(t){return t.attrs;})];}});Pc=Ac($c,zc);Wc=/*#__PURE__*/_createClass(function Wc(t,e){_classCallCheck(this,Wc);this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0;});Vc=_i.fromClass(/*#__PURE__*/function(){function _class13(t){_classCallCheck(this,_class13);this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;var _iterator212=_createForOfIteratorHelper(t.state.field($c).active),_step212;try{for(_iterator212.s();!(_step212=_iterator212.n()).done;){var _e253=_step212.value;1==_e253.state&&this.startQuery(_e253);}}catch(err){_iterator212.e(err);}finally{_iterator212.f();}}return _createClass(_class13,[{key:"update",value:function update(t){var _this86=this;var e=t.state.field($c),i=t.state.facet(kc);if(!t.selectionSet&&!t.docChanged&&t.startState.field($c)==e)return;var s=t.transactions.some(function(t){return(t.selection||t.docChanged)&&!Tc(t,i);});for(var _e254=0;_e254<this.running.length;_e254++){var _i211$updates;var _i211=this.running[_e254];if(s||_i211.updates.length+t.transactions.length>50&&Date.now()-_i211.time>1e3){var _iterator213=_createForOfIteratorHelper(_i211.context.abortListeners),_step213;try{for(_iterator213.s();!(_step213=_iterator213.n()).done;){var _t294=_step213.value;try{_t294();}catch(t){Ui(this.view.state,t);}}}catch(err){_iterator213.e(err);}finally{_iterator213.f();}_i211.context.abortListeners=null,this.running.splice(_e254--,1);}else(_i211$updates=_i211.updates).push.apply(_i211$updates,_toConsumableArray(t.transactions));}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(function(t){return t.effects.some(function(t){return t.is(gc);});})&&(this.pendingStart=!0);var r=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(function(t){return 1==t.state&&!_this86.running.some(function(e){return e.active.source==t.source;});})?setTimeout(function(){return _this86.startUpdate();},r):-1,0!=this.composing){var _iterator214=_createForOfIteratorHelper(t.transactions),_step214;try{for(_iterator214.s();!(_step214=_iterator214.n()).done;){var _e255=_step214.value;"input"==Tc(_e255,i)?this.composing=2:2==this.composing&&_e255.selection&&(this.composing=3);}}catch(err){_iterator214.e(err);}finally{_iterator214.f();}}}},{key:"startUpdate",value:function startUpdate(){var _this87=this;this.debounceUpdate=-1,this.pendingStart=!1;var t=this.view.state,e=t.field($c);var _iterator215=_createForOfIteratorHelper(e.active),_step215;try{var _loop17=function _loop17(){var t=_step215.value;1!=t.state||_this87.running.some(function(e){return e.active.source==t.source;})||_this87.startQuery(t);};for(_iterator215.s();!(_step215=_iterator215.n()).done;){_loop17();}}catch(err){_iterator215.e(err);}finally{_iterator215.f();}}},{key:"startQuery",value:function startQuery(t){var _this88=this;var e=this.view.state,i=ac(e),s=new hc(e,i,t.explicitPos==i),r=new Wc(t,s);this.running.push(r),Promise.resolve(t.source(s)).then(function(t){r.context.aborted||(r.done=t||null,_this88.scheduleAccept());},function(t){_this88.view.dispatch({effects:wc.of(null)}),Ui(_this88.view.state,t);});}},{key:"scheduleAccept",value:function scheduleAccept(){var _this89=this;this.running.every(function(t){return void 0!==t.done;})?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(function(){return _this89.accept();},this.view.state.facet(kc).updateSyncTime));}},{key:"accept",value:function accept(){var _this90=this;var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;var e=[],i=this.view.state.facet(kc);var _loop18=function _loop18(_s195){var r=_this90.running[_s195];if(void 0===r.done){_s194=_s195;return 0;}// continue
|
5
|
-
if(_this90.running.splice(_s195--,1),r.done){var _s196=new
|
6
|
-
}}var n=_this90.view.state.field($c).active.find(function(t){return t.source==r.active.source;});if(n&&1==n.state)if(null==r.done){var _t296=new Bc(r.active.source,0);var _iterator217=_createForOfIteratorHelper(r.updates),_step217;try{for(_iterator217.s();!(_step217=_iterator217.n()).done;){var _e256=_step217.value;_t296=_t296.update(_e256,i);}}catch(err){_iterator217.e(err);}finally{_iterator217.f();}1!=_t296.state&&e.push(_t296);}else _this90.startQuery(n);_s194=_s195;},_ret3;for(var _s194=0;_s194<this.running.length;_s194++){_ret3=_loop18(_s194);if(_ret3===0)continue;}e.length&&this.view.dispatch({effects:Nc.of(e)});}}]);}(),{eventHandlers:{blur:function blur(t){var _this91=this;var e=this.view.state.field($c,!1);if(e&&e.tooltip&&this.view.state.facet(kc).closeOnBlur){var _i212=e.open&&sh(this.view,e.open.tooltip);_i212&&_i212.dom.contains(t.relatedTarget)||setTimeout(function(){return _this91.view.dispatch({effects:wc.of(null)});},10);}},compositionstart:function compositionstart(){this.composing=1;},compositionend:function compositionend(){var _this92=this;3==this.composing&&setTimeout(function(){return _this92.view.dispatch({effects:gc.of(!1)});},20),this.composing=0;}}});Fc="object"==(typeof navigator==="undefined"?"undefined":_typeof(navigator))&&/Win/.test(navigator.platform);qc=_.highest(Ur.domEventHandlers({keydown:function keydown(t,e){var i=e.state.field($c,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||t.key.length>1||t.ctrlKey&&(!Fc||!t.altKey)||t.metaKey)return!1;var s=i.open.options[i.open.selected],r=i.active.find(function(t){return t.source==s.source;}),n=s.completion.commitCharacters||r.result.commitCharacters;return n&&n.indexOf(t.key)>-1&&zc(e,s),!1;}}));Uc=Ur.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});Jc=/*#__PURE__*/_createClass(function Jc(t,e,i,s){_classCallCheck(this,Jc);this.field=t,this.line=e,this.from=i,this.to=s;});Gc=/*#__PURE__*/function(){function Gc(t,e,i){_classCallCheck(this,Gc);this.field=t,this.from=e,this.to=i;}return _createClass(Gc,[{key:"map",value:function map(t){var e=t.mapPos(this.from,-1,x.TrackDel),i=t.mapPos(this.to,1,x.TrackDel);return null==e||null==i?null:new Gc(this.field,e,i);}}]);}();Kc=/*#__PURE__*/function(){function Kc(t,e){_classCallCheck(this,Kc);this.lines=t,this.fieldPositions=e;}return _createClass(Kc,[{key:"instantiate",value:function instantiate(t,e){var i=[],s=[e],r=t.doc.lineAt(e),n=/^\s*/.exec(r.text)[0];var _iterator218=_createForOfIteratorHelper(this.lines),_step218;try{for(_iterator218.s();!(_step218=_iterator218.n()).done;){var _r155=_step218.value;if(i.length){var _i213=n,_h86=/^\t*/.exec(_r155)[0].length;for(var _e257=0;_e257<_h86;_e257++)_i213+=t.facet(bo);s.push(e+_i213.length-_h86),_r155=_i213+_r155.slice(_h86);}i.push(_r155),e+=_r155.length+1;}}catch(err){_iterator218.e(err);}finally{_iterator218.f();}var h=this.fieldPositions.map(function(t){return new Gc(t.field,s[t.line]+t.from,s[t.line]+t.to);});return{text:i,ranges:h};}}],[{key:"parse",value:function parse(t){var e,i=[],s=[],r=[];var _iterator219=_createForOfIteratorHelper(t.split(/\r\n?|\n/)),_step219;try{for(_iterator219.s();!(_step219=_iterator219.n()).done;){var _n123=_step219.value;for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(_n123);){var _t297=e[1]?+e[1]:null,_h87=e[2]||e[3]||"",_l73=-1;for(var _e258=0;_e258<i.length;_e258++)(null!=_t297?i[_e258].seq==_t297:_h87&&i[_e258].name==_h87)&&(_l73=_e258);if(_l73<0){var _e259=0;for(;_e259<i.length&&(null==_t297||null!=i[_e259].seq&&i[_e259].seq<_t297);)_e259++;i.splice(_e259,0,{seq:_t297,name:_h87}),_l73=_e259;var _iterator220=_createForOfIteratorHelper(r),_step220;try{for(_iterator220.s();!(_step220=_iterator220.n()).done;){var _t298=_step220.value;_t298.field>=_l73&&_t298.field++;}}catch(err){_iterator220.e(err);}finally{_iterator220.f();}}r.push(new Jc(_l73,s.length,e.index,e.index+_h87.length)),_n123=_n123.slice(0,e.index)+_h87+_n123.slice(e.index+e[0].length);}for(var _t299;_t299=/\\([{}])/.exec(_n123);){_n123=_n123.slice(0,_t299.index)+_t299[1]+_n123.slice(_t299.index+_t299[0].length);var _iterator221=_createForOfIteratorHelper(r),_step221;try{for(_iterator221.s();!(_step221=_iterator221.n()).done;){var _e260=_step221.value;_e260.line==s.length&&_e260.from>_t299.index&&(_e260.from--,_e260.to--);}}catch(err){_iterator221.e(err);}finally{_iterator221.f();}}s.push(_n123);}}catch(err){_iterator219.e(err);}finally{_iterator219.f();}return new Kc(s,r);}}]);}();_c=ni.widget({widget:new(/*#__PURE__*/function(_si9){function _class14(){_classCallCheck(this,_class14);return _callSuper(this,_class14,arguments);}_inherits(_class14,_si9);return _createClass(_class14,[{key:"toDOM",value:function toDOM(){var t=document.createElement("span");return t.className="cm-snippetFieldPosition",t;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si))()});Xc=ni.mark({"class":"cm-snippetField"});Yc=/*#__PURE__*/function(){function Yc(t,e){_classCallCheck(this,Yc);this.ranges=t,this.active=e,this.deco=ni.set(t.map(function(t){return(t.from==t.to?_c:Xc).range(t.from,t.to);}));}return _createClass(Yc,[{key:"map",value:function map(t){var e=[];var _iterator222=_createForOfIteratorHelper(this.ranges),_step222;try{for(_iterator222.s();!(_step222=_iterator222.n()).done;){var _i214=_step222.value;var _s197=_i214.map(t);if(!_s197)return null;e.push(_s197);}}catch(err){_iterator222.e(err);}finally{_iterator222.f();}return new Yc(e,this.active);}},{key:"selectionInsideField",value:function selectionInsideField(t){var _this93=this;return t.ranges.every(function(t){return _this93.ranges.some(function(e){return e.field==_this93.active&&e.from<=t.from&&e.to>=t.to;});});}}]);}();Qc=ct.define({map:function map(t,e){return t&&t.map(e);}});Zc=ct.define();td=F.define({create:function create(){return null;},update:function update(t,e){var _iterator223=_createForOfIteratorHelper(e.effects),_step223;try{for(_iterator223.s();!(_step223=_iterator223.n()).done;){var _i215=_step223.value;if(_i215.is(Qc))return _i215.value;if(_i215.is(Zc)&&t)return new Yc(t.ranges,_i215.value);}}catch(err){_iterator223.e(err);}finally{_iterator223.f();}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t;},provide:function provide(t){return Ur.decorations.from(t,function(t){return t?t.deco:ni.none;});}});rd=[{key:"Tab",run:sd(1),shift:sd(-1)},{key:"Escape",run:function run(_ref58){var t=_ref58.state,e=_ref58.dispatch;return!!t.field(td,!1)&&(e(t.update({effects:Qc.of(null)})),!0);}}];nd=j.define({combine:function combine(t){return t.length?t[0]:rd;}});hd=_.highest(Zr.compute([nd],function(t){return t.facet(nd);}));od=Ur.domEventHandlers({mousedown:function mousedown(t,e){var i,s=e.state.field(td,!1);if(!s||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;var r=s.ranges.find(function(t){return t.from<=i&&t.to>=i;});return!(!r||r.field==s.active)&&(e.dispatch({selection:ed(s.ranges,r.field),effects:Qc.of(s.ranges.some(function(t){return t.field>r.field;})?new Yc(s.ranges,r.field):null),scrollIntoView:!0}),!0);}});ud={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]};fd=ct.define({map:function map(t,e){var i=e.mapPos(t,-1,x.TrackAfter);return null==i?void 0:i;}});ad=new(/*#__PURE__*/function(_Ct3){function _class15(){_classCallCheck(this,_class15);return _callSuper(this,_class15,arguments);}_inherits(_class15,_Ct3);return _createClass(_class15);}(Ct))();ad.startSide=1,ad.endSide=-1;cd=F.define({create:function create(){return It.empty;},update:function update(t,e){if(t=t.map(e.changes),e.selection){var _i217=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:function filter(t){return t>=_i217.from&&t<=_i217.to;}});}var _iterator224=_createForOfIteratorHelper(e.effects),_step224;try{for(_iterator224.s();!(_step224=_iterator224.n()).done;){var _i218=_step224.value;_i218.is(fd)&&(t=t.update({add:[ad.range(_i218.value,_i218.value+1)]}));}}catch(err){_iterator224.e(err);}finally{_iterator224.f();}return t;}});dd="()[]{}<>";gd="object"==(typeof navigator==="undefined"?"undefined":_typeof(navigator))&&/Android\b/.test(navigator.userAgent);wd=Ur.inputHandler.of(function(t,e,i,s){if((gd?t.composing:t.compositionStarted)||t.state.readOnly)return!1;var r=t.state.selection.main;if(s.length>2||2==s.length&&1==y(v(s,0))||e!=r.from||i!=r.to)return!1;var n=function(t,e){var i=md(t,t.selection.main.head),s=i.brackets||ud.brackets;var _iterator225=_createForOfIteratorHelper(s),_step225;try{for(_iterator225.s();!(_step225=_iterator225.n()).done;){var _r156=_step225.value;var _n124=pd(v(_r156,0));if(e==_r156)return _n124==_r156?xd(t,_r156,s.indexOf(_r156+_r156+_r156)>-1,i):yd(t,_r156,_n124,i.before||ud.before);if(e==_n124&&vd(t,t.selection.main.from))return Md(t,_r156,_n124);}}catch(err){_iterator225.e(err);}finally{_iterator225.f();}return null;}(t.state,s);return!!n&&(t.dispatch(n),!0);});bd=[{key:"Backspace",run:function run(_ref59){var t=_ref59.state,e=_ref59.dispatch;if(t.readOnly)return!1;var i=md(t,t.selection.main.head).brackets||ud.brackets,s=null,r=t.changeByRange(function(e){if(e.empty){var _s198=function(t,e){var i=t.sliceString(e-2,e);return y(v(i,0))==i.length?i:i.slice(1);}(t.doc,e.head);var _iterator226=_createForOfIteratorHelper(i),_step226;try{for(_iterator226.s();!(_step226=_iterator226.n()).done;){var _r157=_step226.value;if(_r157==_s198&&kd(t.doc,e.head)==pd(v(_r157,0)))return{changes:{from:e.head-_r157.length,to:e.head+_r157.length},range:B.cursor(e.head-_r157.length)};}}catch(err){_iterator226.e(err);}finally{_iterator226.f();}}return{range:s=e};});return s||e(t.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s;}}];Od=[{key:"Ctrl-Space",run:function run(t){return!!t.state.field($c,!1)&&(t.dispatch({effects:gc.of(!0)}),!0);}},{key:"Escape",run:function run(t){var e=t.state.field($c,!1);return!(!e||!e.active.some(function(t){return 0!=t.state;}))&&(t.dispatch({effects:wc.of(null)}),!0);}},{key:"ArrowDown",run:Hc(!0)},{key:"ArrowUp",run:Hc(!1)},{key:"PageDown",run:Hc(!0,"page")},{key:"PageUp",run:Hc(!1,"page")},{key:"Enter",run:function run(t){var e=t.state.field($c,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(kc).interactionDelay)&&zc(t,e.open.options[e.open.selected]);}}];Dd=_.highest(Zr.computeN([kc],function(t){return t.facet(kc).defaultKeymap?[Od]:[];}));Ed=/*#__PURE__*/_createClass(function Ed(t,e,i){_classCallCheck(this,Ed);this.from=t,this.to=e,this.diagnostic=i;});Id=/*#__PURE__*/function(){function Id(t,e,i){_classCallCheck(this,Id);this.diagnostics=t,this.panel=e,this.selected=i;}return _createClass(Id,null,[{key:"init",value:function init(t,e,i){var s=t,r=i.facet(Wd).markerFilter;r&&(s=r(s,i));var n=ni.set(s.map(function(t){return t.from==t.to||t.from==t.to-1&&i.doc.lineAt(t.from).to==t.from?ni.widget({widget:new qd(t),diagnostic:t}).range(t.from):ni.mark({attributes:{"class":"cm-lintRange cm-lintRange-"+t.severity+(t.markClass?" "+t.markClass:"")},diagnostic:t,inclusive:!0}).range(t.from,t.to);}),!0);return new Id(n,e,Rd(n));}}]);}();Td=ct.define();Bd=ct.define();Ld=ct.define();Nd=F.define({create:function create(){return new Id(ni.none,null,null);},update:function update(t,e){if(e.docChanged){var _i220=t.diagnostics.map(e.changes),_s200=null;if(t.selected){var _r159=e.changes.mapPos(t.selected.from,1);_s200=Rd(_i220,t.selected.diagnostic,_r159)||Rd(_i220,null,_r159);}t=new Id(_i220,t.panel,_s200);}var _iterator228=_createForOfIteratorHelper(e.effects),_step228;try{for(_iterator228.s();!(_step228=_iterator228.n()).done;){var _i221=_step228.value;_i221.is(Td)?t=Id.init(_i221.value,t.panel,e.state):_i221.is(Bd)?t=new Id(t.diagnostics,_i221.value?Jd.open:null,t.selected):_i221.is(Ld)&&(t=new Id(t.diagnostics,t.panel,_i221.value));}}catch(err){_iterator228.e(err);}finally{_iterator228.f();}return t;},provide:function provide(t){return[fh.from(t,function(t){return t.panel;}),Ur.decorations.from(t,function(t){return t.diagnostics;})];}});jd=ni.mark({"class":"cm-lintRange cm-lintRange-active",inclusive:!0});Pd=function Pd(t){var e=t.state.field(Nd,!1);return!(!e||!e.panel)&&(t.dispatch({effects:Bd.of(!1)}),!0);};Hd=[{key:"Mod-Shift-m",run:function run(t){var e=t.state.field(Nd,!1);var i,s;e&&e.panel||t.dispatch({effects:(i=t.state,s=[Bd.of(!0)],i.field(Nd,!1)?s:s.concat(ct.appendConfig.of(_d)))});var r=hh(t,Jd.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0;},preventDefault:!0},{key:"F8",run:function run(t){var e=t.state.field(Nd,!1);if(!e)return!1;var i=t.state.selection.main,s=e.diagnostics.iter(i.to+1);return!(!s.value&&(s=e.diagnostics.iter(0),!s.value||s.from==i.from&&s.to==i.to))&&(t.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0}),!0);}}];Wd=j.define({combine:function combine(t){return Object.assign({sources:t.map(function(t){return t.source;}).filter(function(t){return null!=t;})},At(t.map(function(t){return t.config;}),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:function hideOn(){return null;}},{needsRefresh:function needsRefresh(t,e){return t?e?function(i){return t(i)||e(i);}:t:e;}}));}});qd=/*#__PURE__*/function(_si10){function qd(t){var _this94;_classCallCheck(this,qd);_this94=_callSuper(this,qd),_this94.diagnostic=t;return _this94;}_inherits(qd,_si10);return _createClass(qd,[{key:"eq",value:function eq(t){return t.diagnostic==this.diagnostic;}},{key:"toDOM",value:function toDOM(){return ia("span",{"class":"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity});}}]);}(si);Ud=/*#__PURE__*/_createClass(function Ud(t,e){_classCallCheck(this,Ud);this.diagnostic=e,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=Fd(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option");});Jd=/*#__PURE__*/function(){function Jd(t){var _this95=this;_classCallCheck(this,Jd);this.view=t,this.items=[];this.list=ia("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:function onkeydown(e){if(27==e.keyCode)Pd(_this95.view),_this95.view.focus();else if(38==e.keyCode||33==e.keyCode)_this95.moveSelection((_this95.selectedIndex-1+_this95.items.length)%_this95.items.length);else if(40==e.keyCode||34==e.keyCode)_this95.moveSelection((_this95.selectedIndex+1)%_this95.items.length);else if(36==e.keyCode)_this95.moveSelection(0);else if(35==e.keyCode)_this95.moveSelection(_this95.items.length-1);else if(13==e.keyCode)_this95.view.focus();else{if(!(e.keyCode>=65&&e.keyCode<=90&&_this95.selectedIndex>=0))return;{var _i223=_this95.items[_this95.selectedIndex].diagnostic,_s201=Vd(_i223.actions);for(var _r160=0;_r160<_s201.length;_r160++)if(_s201[_r160].toUpperCase().charCodeAt(0)==e.keyCode){var _e263=Rd(_this95.view.state.field(Nd).diagnostics,_i223);_e263&&_i223.actions[_r160].apply(t,_e263.from,_e263.to);}}}e.preventDefault();},onclick:function onclick(t){for(var _e264=0;_e264<_this95.items.length;_e264++)_this95.items[_e264].dom.contains(t.target)&&_this95.moveSelection(_e264);}}),this.dom=ia("div",{"class":"cm-panel-lint"},this.list,ia("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:function onclick(){return Pd(_this95.view);}},"×")),this.update();}return _createClass(Jd,[{key:"selectedIndex",get:function get(){var t=this.view.state.field(Nd).selected;if(!t)return-1;for(var _e265=0;_e265<this.items.length;_e265++)if(this.items[_e265].diagnostic==t.diagnostic)return _e265;return-1;}},{key:"update",value:function update(){var _this96=this;var _this$view$state$fiel=this.view.state.field(Nd),t=_this$view$state$fiel.diagnostics,e=_this$view$state$fiel.selected,i=0,s=!1,r=null;for(t.between(0,this.view.state.doc.length,function(t,n,_ref62){var h=_ref62.spec;var l,o=-1;for(var _t302=i;_t302<_this96.items.length;_t302++)if(_this96.items[_t302].diagnostic==h.diagnostic){o=_t302;break;}o<0?(l=new Ud(_this96.view,h.diagnostic),_this96.items.splice(i,0,l),s=!0):(l=_this96.items[o],o>i&&(_this96.items.splice(i,o-i),s=!0)),e&&l.diagnostic==e.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),r=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),i++;});i<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();0==this.items.length&&(this.items.push(new Ud(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:function read(){return{sel:r.dom.getBoundingClientRect(),panel:_this96.list.getBoundingClientRect()};},write:function write(_ref63){var t=_ref63.sel,e=_ref63.panel;var i=e.height/_this96.list.offsetHeight;t.top<e.top?_this96.list.scrollTop-=(e.top-t.top)/i:t.bottom>e.bottom&&(_this96.list.scrollTop+=(t.bottom-e.bottom)/i);}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync();}},{key:"sync",value:function sync(){var t=this.list.firstChild;function e(){var e=t;t=e.nextSibling,e.remove();}var _iterator230=_createForOfIteratorHelper(this.items),_step230;try{for(_iterator230.s();!(_step230=_iterator230.n()).done;){var _i224=_step230.value;if(_i224.dom.parentNode==this.list){for(;t!=_i224.dom;)e();t=_i224.dom.nextSibling;}else this.list.insertBefore(_i224.dom,t);}}catch(err){_iterator230.e(err);}finally{_iterator230.f();}for(;t;)e();}},{key:"moveSelection",value:function moveSelection(t){if(this.selectedIndex<0)return;var e=Rd(this.view.state.field(Nd).diagnostics,this.items[t].diagnostic);e&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:Ld.of(e)});}}],[{key:"open",value:function open(t){return new Jd(t);}}]);}();Kd=Ur.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Gd("#d11")},".cm-lintRange-warning":{backgroundImage:Gd("orange")},".cm-lintRange-info":{backgroundImage:Gd("#999")},".cm-lintRange-hint":{backgroundImage:Gd("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});_d=[Nd,Ur.decorations.compute([Nd],function(t){var _t$field=t.field(Nd),e=_t$field.selected,i=_t$field.panel;return e&&i&&e.from!=e.to?ni.set([jd.range(e.from,e.to)]):ni.none;}),ih($d,{hideOn:function hideOn(t,e){var i=e.pos,s=e.end||i,r=t.state.facet(Wd).hideOn(t,i,s);if(null!=r)return r;var n=t.startState.doc.lineAt(e.pos);return!(!t.effects.some(function(t){return t.is(Td);})&&!t.changes.touchesRange(n.from,Math.max(n.to,s)));}}),Kd];Xd=function Xd(t){return void 0===t||t;};_export("K",Yd=function Yd(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=[];Xd(t.defaultKeymap)&&e.push.apply(e,_toConsumableArray(ea)),Xd(t.closeBracketsKeymap)&&e.push.apply(e,bd),Xd(t.searchKeymap)&&e.push.apply(e,Qa),Xd(t.historyKeymap)&&e.push.apply(e,lf),Xd(t.foldKeymap)&&e.push.apply(e,Go),Xd(t.lintKeymap)&&e.push.apply(e,Hd);var i=[];return Xd(t.highlightActiveLineGutter)&&i.push(Th),Xd(t.highlightSpecialChars)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[En.of(t),In||(In=_i.fromClass(/*#__PURE__*/function(){function _class16(t){_classCallCheck(this,_class16);this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(En)),this.decorations=this.decorator.createDeco(t);}return _createClass(_class16,[{key:"makeDecorator",value:function makeDecorator(t){var _this97=this;return new Sn({regexp:t.specialChars,decoration:function decoration(e,i,s){var r=i.state.doc,n=v(e[0],0);if(9==n){var _t303=r.lineAt(s),_e266=i.state.tabSize,_n125=Vt(_t303.text,_e266,s-_t303.from);return ni.replace({widget:new Tn((_e266-_n125%_e266)*_this97.view.defaultCharacterWidth/_this97.view.scaleX)});}return _this97.decorationCache[n]||(_this97.decorationCache[n]=ni.replace({widget:new Rn(t,n)}));},boundary:t.replaceTabs?void 0:/[^]/});}},{key:"update",value:function update(t){var e=t.state.facet(En);t.startState.facet(En)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations);}}]);}(),{decorations:function decorations(t){return t.decorations;}}))];}()),Xd(t.history)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[Fu,Vu.of(t),Ur.domEventHandlers({beforeinput:function beforeinput(t,e){var i="historyUndo"==t.inputType?Uu:"historyRedo"==t.inputType?Ju:null;return!!i&&(t.preventDefault(),i(e));}})];}()),Xd(t.foldGutter)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=Object.assign(Object.assign({},tu),t),i=new eu(e,!0),s=new eu(e,!1),r=_i.fromClass(/*#__PURE__*/function(){function _class17(t){_classCallCheck(this,_class17);this.from=t.viewport.from,this.markers=this.buildMarkers(t);}return _createClass(_class17,[{key:"update",value:function update(t){(t.docChanged||t.viewportChanged||t.startState.facet(mo)!=t.state.facet(mo)||t.startState.field(Vo,!1)!=t.state.field(Vo,!1)||no(t.startState)!=no(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view));}},{key:"buildMarkers",value:function buildMarkers(t){var e=new Rt();var _iterator231=_createForOfIteratorHelper(t.viewportLineBlocks),_step231;try{for(_iterator231.s();!(_step231=_iterator231.n()).done;){var _r161=_step231.value;var _n126=Fo(t.state,_r161.from,_r161.to)?s:$o(t.state,_r161.from,_r161.to)?i:null;_n126&&e.add(_r161.from,_r161.from,_n126);}}catch(err){_iterator231.e(err);}finally{_iterator231.f();}return e.finish();}}]);}()),n=e.domEventHandlers;return[r,mh({"class":"cm-foldGutter",markers:function markers(t){var e;return(null===(e=t.plugin(r))||void 0===e?void 0:e.markers)||It.empty;},initialSpacer:function initialSpacer(){return new eu(e,!1);},domEventHandlers:Object.assign(Object.assign({},n),{click:function click(t,e,i){if(n.click&&n.click(t,e,i))return!0;var s=Fo(t.state,e.from,e.to);if(s)return t.dispatch({effects:Ho.of(s)}),!0;var r=$o(t.state,e.from,e.to);return!!r&&(t.dispatch({effects:Po.of(r)}),!0);}})}),Xo()];}()),Xd(t.drawSelection)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[dn.of(t),mn,wn,vn,Wi.of(!0)];}()),Xd(t.dropCursor)&&i.push([yn,Mn]),Xd(t.allowMultipleSelections)&&i.push(St.allowMultipleSelections.of(!0)),Xd(t.indentOnInput)&&i.push(St.transactionFilter.of(function(t){if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;var e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;var i=t.newDoc,s=t.newSelection.main.head,r=i.lineAt(s);if(s>r.from+200)return t;var n=i.sliceString(r.from,s);if(!e.some(function(t){return t.test(n);}))return t;var h=t.state,l=-1,o=[];var _iterator232=_createForOfIteratorHelper(h.selection.ranges),_step232;try{for(_iterator232.s();!(_step232=_iterator232.n()).done;){var _t304=_step232.value.head;var _e267=h.doc.lineAt(_t304);if(_e267.from==l)continue;l=_e267.from;var _i225=yo(h,_e267.from);if(null==_i225)continue;var _s202=/^\s*/.exec(_e267.text)[0],_r162=ko(h,_i225);_s202!=_r162&&o.push({from:_e267.from,to:_e267.from+_s202.length,insert:_r162});}}catch(err){_iterator232.e(err);}finally{_iterator232.f();}return o.length?[t,{changes:o,sequential:!0}]:t;})),Xd(t.syntaxHighlighting)&&i.push(function(t,e){var i,s=[ou];return t instanceof su&&(t.module&&s.push(Ur.styleModule.of(t.module)),i=t.themeType),(null==e?void 0:e.fallback)?s.push(nu.of(t)):i?s.push(ru.computeN([Ur.darkTheme],function(e){return e.facet(Ur.darkTheme)==("dark"==i)?[t]:[];})):s.push(ru.of(t)),s;}(uu,{fallback:!0})),Xd(t.bracketMatching)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[du.of(t),bu];}()),Xd(t.closeBrackets)&&i.push([wd,cd]),Xd(t.autocompletion)&&i.push(Cd()),Xd(t.rectangularSelection)&&i.push(function(t){var e=(null==t?void 0:t.eventFilter)||function(t){return t.altKey&&0==t.button;};return Ur.mouseSelectionStyle.of(function(t,i){return e(i)?Pn(t,i):null;});}()),Xd(t.crosshairCursor)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var _Hn=_slicedToArray(Hn[t.key||"Alt"],2),e=_Hn[0],i=_Hn[1],s=_i.fromClass(/*#__PURE__*/function(){function _class18(t){_classCallCheck(this,_class18);this.view=t,this.isDown=!1;}return _createClass(_class18,[{key:"set",value:function set(t){this.isDown!=t&&(this.isDown=t,this.view.update([]));}}]);}(),{eventObservers:{keydown:function keydown(t){this.set(t.keyCode==e||i(t));},keyup:function keyup(t){t.keyCode!=e&&i(t)||this.set(!1);},mousemove:function mousemove(t){this.set(i(t));}}});return[s,Ur.contentAttributes.of(function(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.isDown)?Wn:null;})];}()),Xd(t.highlightActiveLine)&&i.push(Ln),Xd(t.highlightSelectionMatches)&&i.push(function(t){var e=[xa,Ma];return t&&e.push(ba.of(t)),e;}()),t.tabSize&&"number"==typeof t.tabSize&&i.push(bo.of(" ".repeat(t.tabSize))),i.concat([Zr.of(e.flat())]).filter(Boolean);});}};});
|
4
|
+
}return{v:_r146.value};}if(_i201)return{v:null};_r146=new ha(t.doc,e,0,Math.max(0,s[s.length-1].from-1)),_i201=!0;_i200=_i201,_r145=_r146;},_ret2;for(var _i200=!1,_r145=new ha(t.doc,e,s[s.length-1].to);;){_ret2=_loop16(_i200,_r145);if(_ret2===0)continue;if(_ret2)return _ret2.v;}}(t,s);return!!r&&(e(t.update({selection:t.selection.addRange(B.range(r.from,r.to),!1),effects:Ur.scrollIntoView(r.to)})),!0);},preventDefault:!0}];tc=/*#__PURE__*/function(){function tc(t){var _this80=this;_classCallCheck(this,tc);this.view=t;var e=this.query=t.state.field(ja).query.spec;function i(t,e,i){return sa("button",{"class":"cm-button",name:t,onclick:e,type:"button"},i);}this.commit=this.commit.bind(this),this.searchField=sa("input",{value:e.search,placeholder:ec(t,"Find"),"aria-label":ec(t,"Find"),"class":"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=sa("input",{value:e.replace,placeholder:ec(t,"Replace"),"aria-label":ec(t,"Replace"),"class":"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=sa("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=sa("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=sa("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=sa("div",{onkeydown:function onkeydown(t){return _this80.keydown(t);},"class":"cm-search"},[this.searchField,i("next",function(){return Va(t);},[ec(t,"next")]),i("prev",function(){return Fa(t);},[ec(t,"previous")]),i("select",function(){return qa(t);},[ec(t,"all")]),sa("label",null,[this.caseField,ec(t,"match case")]),sa("label",null,[this.reField,ec(t,"regexp")]),sa("label",null,[this.wordField,ec(t,"by word")])].concat(_toConsumableArray(t.state.readOnly?[]:[sa("br"),this.replaceField,i("replace",function(){return Ua(t);},[ec(t,"replace")]),i("replaceAll",function(){return Ja(t);},[ec(t,"replace all")])]),[sa("button",{name:"close",onclick:function onclick(){return Qa(t);},"aria-label":ec(t,"close"),type:"button"},["×"])]));}return _createClass(tc,[{key:"commit",value:function commit(){var t=new Ca({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:La.of(t)}));}},{key:"keydown",value:function keydown(t){var e,i,s;e=this.view,i=t,s="search-panel",nn(en(e.state),i,e,s)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?Fa:Va)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),Ua(this.view));}},{key:"update",value:function update(t){var _iterator196=_createForOfIteratorHelper(t.transactions),_step196;try{for(_iterator196.s();!(_step196=_iterator196.n()).done;){var _e237=_step196.value;var _iterator197=_createForOfIteratorHelper(_e237.effects),_step197;try{for(_iterator197.s();!(_step197=_iterator197.n()).done;){var _t275=_step197.value;_t275.is(La)&&!_t275.value.eq(this.query)&&this.setQuery(_t275.value);}}catch(err){_iterator197.e(err);}finally{_iterator197.f();}}}catch(err){_iterator196.e(err);}finally{_iterator196.f();}}},{key:"setQuery",value:function setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord;}},{key:"mount",value:function mount(){this.searchField.select();}},{key:"pos",get:function get(){return 80;}},{key:"top",get:function get(){return this.view.state.facet(Aa).top;}}]);}();ic=30;sc=/[\s\.,:;?!]/;nc=Ur.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}});hc=[ja,_.low(Ha),nc];lc=/*#__PURE__*/function(){function lc(t,e,i){_classCallCheck(this,lc);this.state=t,this.pos=e,this.explicit=i,this.abortListeners=[];}return _createClass(lc,[{key:"tokenBefore",value:function tokenBefore(t){var e=no(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null;}},{key:"matchBefore",value:function matchBefore(t){var e=this.state.doc.lineAt(this.pos),i=Math.max(e.from,this.pos-250),s=e.text.slice(i-e.from,this.pos-e.from),r=s.search(dc(t,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)};}},{key:"aborted",get:function get(){return null==this.abortListeners;}},{key:"addEventListener",value:function addEventListener(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e);}}]);}();ac=/*#__PURE__*/_createClass(function ac(t,e,i,s){_classCallCheck(this,ac);this.completion=t,this.source=e,this.match=i,this.score=s;});pc=ut.define();mc=new WeakMap();wc=ct.define();bc=ct.define();vc=/*#__PURE__*/function(){function vc(t){_classCallCheck(this,vc);this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(var _e239=0;_e239<t.length;){var _i202=v(t,_e239),_s186=y(_i202);this.chars.push(_i202);var _r147=t.slice(_e239,_e239+_s186),_n115=_r147.toUpperCase();this.folded.push(v(_n115==_r147?_r147.toLowerCase():_n115,0)),_e239+=_s186;}this.astral=t.length!=this.chars.length;}return _createClass(vc,[{key:"ret",value:function ret(t,e){return this.score=t,this.matched=e,this;}},{key:"match",value:function match(t){if(0==this.pattern.length)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;var e=this.chars,i=this.folded,s=this.any,r=this.precise,n=this.byWord;if(1==e.length){var _s187=v(t,0),_r148=y(_s187),_n116=_r148==t.length?0:-100;if(_s187==e[0]);else{if(_s187!=i[0])return null;_n116+=-200;}return this.ret(_n116,[0,_r148]);}var h=t.indexOf(this.pattern);if(0==h)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);var l=e.length,o=0;if(h<0){for(var _r149=0,_n117=Math.min(t.length,200);_r149<_n117&&o<l;){var _n118=v(t,_r149);_n118!=e[o]&&_n118!=i[o]||(s[o++]=_r149),_r149+=y(_n118);}if(o<l)return null;}var u=0,f=0,a=!1,c=0,d=-1,p=-1,m=/[a-z]/.test(t),g=!0;for(var _s188=0,_o45=Math.min(t.length,200),_w3=0;_s188<_o45&&f<l;){var _o46=v(t,_s188);h<0&&(u<l&&_o46==e[u]&&(r[u++]=_s188),c<l&&(_o46==e[c]||_o46==i[c]?(0==c&&(d=_s188),p=_s188+1,c++):c=0));var _b2=void 0,_M2=_o46<255?_o46>=48&&_o46<=57||_o46>=97&&_o46<=122?2:_o46>=65&&_o46<=90?1:0:(_b2=k(_o46))!=_b2.toLowerCase()?1:_b2!=_b2.toUpperCase()?2:0;(!_s188||1==_M2&&m||0==_w3&&0!=_M2)&&(e[f]==_o46||i[f]==_o46&&(a=!0)?n[f++]=_s188:n.length&&(g=!1)),_w3=_M2,_s188+=y(_o46);}return f==l&&0==n[0]&&g?this.result((a?-200:0)-100,n,t):c==l&&0==d?this.ret(-200-t.length+(p==t.length?0:-100),[0,p]):h>-1?this.ret(-700-t.length,[h,h+this.pattern.length]):c==l?this.ret(-900-t.length,[d,p]):f==l?this.result((a?-200:0)-100-700+(g?0:-1100),n,t):2==e.length?null:this.result((s[0]?-700:0)-200-1100,s,t);}},{key:"result",value:function result(t,e,i){var s=[],r=0;var _iterator199=_createForOfIteratorHelper(e),_step199;try{for(_iterator199.s();!(_step199=_iterator199.n()).done;){var _t279=_step199.value;var _e240=_t279+(this.astral?y(v(i,_t279)):1);r&&s[r-1]==_t279?s[r-1]=_e240:(s[r++]=_t279,s[r++]=_e240);}}catch(err){_iterator199.e(err);}finally{_iterator199.f();}return this.ret(t-i.length,s);}}]);}();kc=/*#__PURE__*/function(){function kc(t){_classCallCheck(this,kc);this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase();}return _createClass(kc,[{key:"match",value:function match(t){if(t.length<this.pattern.length)return null;var e=t.slice(0,this.pattern.length),i=e==this.pattern?0:e.toLowerCase()==this.folded?-200:null;return null==i?null:(this.matched=[0,e.length],this.score=i+(t.length==this.pattern.length?0:-100),this);}}]);}();yc=j.define({combine:function combine(t){return At(t,{activateOnTyping:!0,activateOnCompletion:function activateOnCompletion(){return!1;},activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:function tooltipClass(){return"";},optionClass:function optionClass(){return"";},aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:xc,filterStrict:!1,compareCompletions:function compareCompletions(t,e){return t.label.localeCompare(e.label);},interactionDelay:75,updateSyncTime:100},{defaultKeymap:function defaultKeymap(t,e){return t&&e;},closeOnBlur:function closeOnBlur(t,e){return t&&e;},icons:function icons(t,e){return t&&e;},tooltipClass:function tooltipClass(t,e){return function(i){return Mc(t(i),e(i));};},optionClass:function optionClass(t,e){return function(i){return Mc(t(i),e(i));};},addToOptions:function addToOptions(t,e){return t.concat(e);},filterStrict:function filterStrict(t,e){return t||e;}});}});Ac=/*#__PURE__*/function(){function Ac(t,e,i){var _this81=this;_classCallCheck(this,Ac);this.view=t,this.stateField=e,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:function read(){return _this81.measureInfo();},write:function write(t){return _this81.placeInfo(t);},key:this},this.space=null,this.currentClass="";var s=t.state.field(e),_s$open=s.open,r=_s$open.options,n=_s$open.selected,h=t.state.facet(yc);this.optionContent=function(t){var e=t.addToOptions.slice();return t.icons&&e.push({render:function render(t){var _e$classList;var e=document.createElement("div");return e.classList.add("cm-completionIcon"),t.type&&(_e$classList=e.classList).add.apply(_e$classList,_toConsumableArray(t.type.split(/\s+/g).map(function(t){return"cm-completionIcon-"+t;}))),e.setAttribute("aria-hidden","true"),e;},position:20}),e.push({render:function render(t,e,i,s){var r=document.createElement("span");r.className="cm-completionLabel";var n=t.displayLabel||t.label,h=0;for(var _t282=0;_t282<s.length;){var _e241=s[_t282++],_i203=s[_t282++];_e241>h&&r.appendChild(document.createTextNode(n.slice(h,_e241)));var _l70=r.appendChild(document.createElement("span"));_l70.appendChild(document.createTextNode(n.slice(_e241,_i203))),_l70.className="cm-completionMatchedText",h=_i203;}return h<n.length&&r.appendChild(document.createTextNode(n.slice(h))),r;},position:50},{render:function render(t){if(!t.detail)return null;var e=document.createElement("span");return e.className="cm-completionDetail",e.textContent=t.detail,e;},position:80}),e.sort(function(t,e){return t.position-e.position;}).map(function(t){return t.render;});}(h),this.optionClass=h.optionClass,this.tooltipClass=h.tooltipClass,this.range=Sc(r.length,n,h.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",function(i){var s=t.state.field(e).open.options;for(var _e242,_r150=i.target;_r150&&_r150!=_this81.dom;_r150=_r150.parentNode)if("LI"==_r150.nodeName&&(_e242=/-(\d+)$/.exec(_r150.id))&&+_e242[1]<s.length)return _this81.applyCompletion(t,s[+_e242[1]]),void i.preventDefault();}),this.dom.addEventListener("focusout",function(e){var i=t.state.field(_this81.stateField,!1);i&&i.tooltip&&t.state.facet(yc).closeOnBlur&&e.relatedTarget!=t.contentDOM&&t.dispatch({effects:bc.of(null)});}),this.showOptions(r,s.id);}return _createClass(Ac,[{key:"mount",value:function mount(){this.updateSel();}},{key:"showOptions",value:function showOptions(t,e){var _this82=this;this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener("scroll",function(){_this82.info&&_this82.view.requestMeasure(_this82.placeInfoReq);});}},{key:"update",value:function update(t){var e;var i=t.state.field(this.stateField),s=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),i!=s){var _i$open=i.open,_r151=_i$open.options,_n119=_i$open.selected,_h83=_i$open.disabled;s.open&&s.open.options==_r151||(this.range=Sc(_r151.length,_n119,t.state.facet(yc).maxRenderedOptions),this.showOptions(_r151,i.id)),this.updateSel(),_h83!=(null===(e=s.open)||void 0===e?void 0:e.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!_h83);}}},{key:"updateTooltipClass",value:function updateTooltipClass(t){var e=this.tooltipClass(t);if(e!=this.currentClass){var _iterator200=_createForOfIteratorHelper(this.currentClass.split(" ")),_step200;try{for(_iterator200.s();!(_step200=_iterator200.n()).done;){var _t283=_step200.value;_t283&&this.dom.classList.remove(_t283);}}catch(err){_iterator200.e(err);}finally{_iterator200.f();}var _iterator201=_createForOfIteratorHelper(e.split(" ")),_step201;try{for(_iterator201.s();!(_step201=_iterator201.n()).done;){var _t284=_step201.value;_t284&&this.dom.classList.add(_t284);}}catch(err){_iterator201.e(err);}finally{_iterator201.f();}this.currentClass=e;}}},{key:"positioned",value:function positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq);}},{key:"updateSel",value:function updateSel(){var _this83=this;var t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected<this.range.from||e.selected>=this.range.to)&&(this.range=Sc(e.options.length,e.selected,this.view.state.facet(yc).maxRenderedOptions),this.showOptions(e.options,t.id)),this.updateSelectedOption(e.selected)){this.destroyInfo();var _i204=e.options[e.selected].completion,_s189=_i204.info;if(!_s189)return;var _r152="string"==typeof _s189?document.createTextNode(_s189):_s189(_i204);if(!_r152)return;"then"in _r152?_r152.then(function(e){e&&_this83.view.state.field(_this83.stateField,!1)==t&&_this83.addInfoPane(e,_i204);})["catch"](function(t){return Ui(_this83.view.state,t,"completion info");}):this.addInfoPane(_r152,_i204);}}},{key:"addInfoPane",value:function addInfoPane(t,e){this.destroyInfo();var i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",null!=t.nodeType)i.appendChild(t),this.infoDestroy=null;else{var _e243=t.dom,_s190=t.destroy;i.appendChild(_e243),this.infoDestroy=_s190||null;}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq);}},{key:"updateSelectedOption",value:function updateSelectedOption(t){var e=null;for(var _i205=this.list.firstChild,_s191=this.range.from;_i205;_i205=_i205.nextSibling,_s191++)"LI"==_i205.nodeName&&_i205.id?_s191==t?_i205.hasAttribute("aria-selected")||(_i205.setAttribute("aria-selected","true"),e=_i205):_i205.hasAttribute("aria-selected")&&_i205.removeAttribute("aria-selected"):_s191--;return e&&function(t,e){var i=t.getBoundingClientRect(),s=e.getBoundingClientRect(),r=i.height/t.offsetHeight;s.top<i.top?t.scrollTop-=(i.top-s.top)/r:s.bottom>i.bottom&&(t.scrollTop+=(s.bottom-i.bottom)/r);}(this.list,e),e;}},{key:"measureInfo",value:function measureInfo(){var t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;var e=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=t.getBoundingClientRect(),r=this.space;if(!r){var _t285=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:_t285.innerWidth,bottom:_t285.innerHeight};}return s.top>Math.min(r.bottom,e.bottom)-10||s.bottom<Math.max(r.top,e.top)+10?null:this.view.state.facet(yc).positionInfo(this.view,e,s,i,r,this.dom);}},{key:"placeInfo",value:function placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t["class"]||"")):this.info.style.cssText="top: -1e6px");}},{key:"createListBox",value:function createListBox(t,e,i){var s=document.createElement("ul");s.id=e,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions"));var r=null;for(var _n120=i.from;_n120<i.to;_n120++){var _t$_n=t[_n120],_h84=_t$_n.completion,_l71=_t$_n.match,_o47=_h84.section;if(_o47){var _t286="string"==typeof _o47?_o47:_o47.name;if(_t286!=r&&(_n120>i.from||0==i.from))if(r=_t286,"string"!=typeof _o47&&_o47.header)s.appendChild(_o47.header(_o47));else{s.appendChild(document.createElement("completion-section")).textContent=_t286;}}var _u44=s.appendChild(document.createElement("li"));_u44.id=e+"-"+_n120,_u44.setAttribute("role","option");var _f25=this.optionClass(_h84);_f25&&(_u44.className=_f25);var _iterator202=_createForOfIteratorHelper(this.optionContent),_step202;try{for(_iterator202.s();!(_step202=_iterator202.n()).done;){var _t287=_step202.value;var _e244=_t287(_h84,this.view.state,this.view,_l71);_e244&&_u44.appendChild(_e244);}}catch(err){_iterator202.e(err);}finally{_iterator202.f();}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.to<t.length&&s.classList.add("cm-completionListIncompleteBottom"),s;}},{key:"destroyInfo",value:function destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null);}},{key:"destroy",value:function destroy(){this.destroyInfo();}}]);}();Dc=/*#__PURE__*/function(){function Dc(t,e,i,s,r,n){_classCallCheck(this,Dc);this.options=t,this.attrs=e,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=n;}return _createClass(Dc,[{key:"setSelected",value:function setSelected(t,e){return t==this.selected||t>=this.options.length?this:new Dc(this.options,Rc(e,t),this.tooltip,this.timestamp,t,this.disabled);}},{key:"map",value:function map(t){return new Dc(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled);}}],[{key:"build",value:function build(t,e,i,s,r){var n=function(t,e){var i=[],s=null,r=function r(t){i.push(t);var e=t.completion.section;if(e){s||(s=[]);var _t288="string"==typeof e?e:e.name;s.some(function(e){return e.name==_t288;})||s.push("string"==typeof e?{name:_t288}:e);}},n=e.facet(yc);var _iterator203=_createForOfIteratorHelper(t),_step203;try{for(_iterator203.s();!(_step203=_iterator203.n()).done;){var _s192=_step203.value;if(_s192.hasResult()){var _t290=_s192.result.getMatch;if(!1===_s192.result.filter){var _iterator207=_createForOfIteratorHelper(_s192.result.options),_step207;try{for(_iterator207.s();!(_step207=_iterator207.n()).done;){var _e247=_step207.value;r(new ac(_e247,_s192.source,_t290?_t290(_e247):[],1e9-i.length));}}catch(err){_iterator207.e(err);}finally{_iterator207.f();}}else{var _i208=void 0,_h85=e.sliceDoc(_s192.from,_s192.to),_l72=n.filterStrict?new kc(_h85):new vc(_h85);var _iterator208=_createForOfIteratorHelper(_s192.result.options),_step208;try{for(_iterator208.s();!(_step208=_iterator208.n()).done;){var _e248=_step208.value;if(_i208=_l72.match(_e248.label)){var _n121=_e248.displayLabel?_t290?_t290(_e248,_i208.matched):[]:_i208.matched;r(new ac(_e248,_s192.source,_n121,_i208.score+(_e248.boost||0)));}}}catch(err){_iterator208.e(err);}finally{_iterator208.f();}}}}}catch(err){_iterator203.e(err);}finally{_iterator203.f();}if(s){var _t289=Object.create(null),_e245=0,_r153=function _r153(t,e){var i,s;return(null!==(i=t.rank)&&void 0!==i?i:1e9)-(null!==(s=e.rank)&&void 0!==s?s:1e9)||(t.name<e.name?-1:1);};var _iterator204=_createForOfIteratorHelper(s.sort(_r153)),_step204;try{for(_iterator204.s();!(_step204=_iterator204.n()).done;){var _i206=_step204.value;_e245-=1e5,_t289[_i206.name]=_e245;}}catch(err){_iterator204.e(err);}finally{_iterator204.f();}var _iterator205=_createForOfIteratorHelper(i),_step205;try{for(_iterator205.s();!(_step205=_iterator205.n()).done;){var _e246=_step205.value;var _i207=_e246.completion.section;_i207&&(_e246.score+=_t289["string"==typeof _i207?_i207:_i207.name]);}}catch(err){_iterator205.e(err);}finally{_iterator205.f();}}var h=[],l=null,o=n.compareCompletions;var _iterator206=_createForOfIteratorHelper(i.sort(function(t,e){return e.score-t.score||o(t.completion,e.completion);})),_step206;try{for(_iterator206.s();!(_step206=_iterator206.n()).done;){var _t291=_step206.value;var _e249=_t291.completion;!l||l.label!=_e249.label||l.detail!=_e249.detail||null!=l.type&&null!=_e249.type&&l.type!=_e249.type||l.apply!=_e249.apply||l.boost!=_e249.boost?h.push(_t291):Oc(_t291.completion)>Oc(l)&&(h[h.length-1]=_t291),l=_t291.completion;}}catch(err){_iterator206.e(err);}finally{_iterator206.f();}return h;}(t,e);if(!n.length)return s&&t.some(function(t){return 1==t.state;})?new Dc(s.options,s.attrs,s.tooltip,s.timestamp,s.selected,!0):null;var h=e.facet(yc).selectOnOpen?0:-1;if(s&&s.selected!=h&&-1!=s.selected){var _t292=s.options[s.selected].completion;for(var _e250=0;_e250<n.length;_e250++)if(n[_e250].completion==_t292){h=_e250;break;}}return new Dc(n,Rc(i,h),{pos:t.reduce(function(t,e){return e.hasResult()?Math.min(t,e.from):t;},1e8),create:Hc,above:r.aboveCursor},s?s.timestamp:Date.now(),h,!1);}}]);}();Ec=/*#__PURE__*/function(){function Ec(t,e,i){_classCallCheck(this,Ec);this.active=t,this.id=e,this.open=i;}return _createClass(Ec,[{key:"update",value:function update(t){var _this84=this;var e=t.state,i=e.facet(yc),s=(i.override||e.languageDataAt("autocomplete",cc(e)).map(gc)).map(function(e){return(_this84.active.find(function(t){return t.source==e;})||new Lc(e,_this84.active.some(function(t){return 0!=t.state;})?1:0)).update(t,i);});s.length==this.active.length&&s.every(function(t,e){return t==_this84.active[e];})&&(s=this.active);var r=this.open;r&&t.docChanged&&(r=r.map(t.changes)),t.selection||s.some(function(e){return e.hasResult()&&t.changes.touchesRange(e.from,e.to);})||!function(t,e){if(t==e)return!0;for(var _i209=0,_s193=0;;){for(;_i209<t.length&&!t[_i209].hasResult;)_i209++;for(;_s193<e.length&&!e[_s193].hasResult;)_s193++;var _r154=_i209==t.length,_n122=_s193==e.length;if(_r154||_n122)return _r154==_n122;if(t[_i209++].result!=e[_s193++].result)return!1;}}(s,this.active)?r=Dc.build(s,e,this.id,r,i):r&&r.disabled&&!s.some(function(t){return 1==t.state;})&&(r=null),!r&&s.every(function(t){return 1!=t.state;})&&s.some(function(t){return t.hasResult();})&&(s=s.map(function(t){return t.hasResult()?new Lc(t.source,0):t;}));var _iterator209=_createForOfIteratorHelper(t.effects),_step209;try{for(_iterator209.s();!(_step209=_iterator209.n()).done;){var _e251=_step209.value;_e251.is($c)&&(r=r&&r.setSelected(_e251.value,this.id));}}catch(err){_iterator209.e(err);}finally{_iterator209.f();}return s==this.active&&r==this.open?this:new Ec(s,this.id,r);}},{key:"tooltip",get:function get(){return this.open?this.open.tooltip:null;}},{key:"attrs",get:function get(){return this.open?this.open.attrs:Ic;}}],[{key:"start",value:function start(){return new Ec(Tc,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null);}}]);}();Ic={"aria-autocomplete":"list"};Tc=[];Lc=/*#__PURE__*/function(){function Lc(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;_classCallCheck(this,Lc);this.source=t,this.state=e,this.explicitPos=i;}return _createClass(Lc,[{key:"hasResult",value:function hasResult(){return!1;}},{key:"update",value:function update(t,e){var i=Bc(t,e),s=this;i?s=s.handleUserEvent(t,i,e):t.docChanged?s=s.handleChange(t):t.selection&&0!=s.state&&(s=new Lc(s.source,0));var _iterator210=_createForOfIteratorHelper(t.effects),_step210;try{for(_iterator210.s();!(_step210=_iterator210.n()).done;){var _e252=_step210.value;if(_e252.is(wc))s=new Lc(s.source,1,_e252.value?cc(t.state):-1);else if(_e252.is(bc))s=new Lc(s.source,0);else if(_e252.is(jc)){var _iterator211=_createForOfIteratorHelper(_e252.value),_step211;try{for(_iterator211.s();!(_step211=_iterator211.n()).done;){var _t293=_step211.value;_t293.source==s.source&&(s=_t293);}}catch(err){_iterator211.e(err);}finally{_iterator211.f();}}}}catch(err){_iterator210.e(err);}finally{_iterator210.f();}return s;}},{key:"handleUserEvent",value:function handleUserEvent(t,e,i){return"delete"!=e&&i.activateOnTyping?new Lc(this.source,1):this.map(t.changes);}},{key:"handleChange",value:function handleChange(t){return t.changes.touchesRange(cc(t.startState))?new Lc(this.source,0):this.map(t.changes);}},{key:"map",value:function map(t){return t.empty||this.explicitPos<0?this:new Lc(this.source,this.state,t.mapPos(this.explicitPos));}}]);}();Nc=/*#__PURE__*/function(_Lc){function Nc(t,e,i,s,r){var _this85;_classCallCheck(this,Nc);_this85=_callSuper(this,Nc,[t,2,e]),_this85.result=i,_this85.from=s,_this85.to=r;return _this85;}_inherits(Nc,_Lc);return _createClass(Nc,[{key:"hasResult",value:function hasResult(){return!0;}},{key:"handleUserEvent",value:function handleUserEvent(t,e,i){var s;var r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));var n=t.changes.mapPos(this.from),h=t.changes.mapPos(this.to,1),l=cc(t.state);if((this.explicitPos<0?l<=n:l<this.from)||l>h||!r||"delete"==e&&cc(t.startState)==this.from)return new Lc(this.source,"input"==e&&i.activateOnTyping?1:0);var o=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,i,s){if(!t)return!1;var r=e.sliceDoc(i,s);return"function"==typeof t?t(r,i,s,e):dc(t,!0).test(r);}(r.validFor,t.state,n,h)?new Nc(this.source,o,r,n,h):r.update&&(r=r.update(r,n,h,new lc(t.state,l,o>=0)))?new Nc(this.source,o,r,r.from,null!==(s=r.to)&&void 0!==s?s:cc(t.state)):new Lc(this.source,1,o);}},{key:"handleChange",value:function handleChange(t){return t.changes.touchesRange(this.from,this.to)?new Lc(this.source,0):this.map(t.changes);}},{key:"map",value:function map(t){if(t.empty)return this;return(this.result.map?this.result.map(this.result,t):this.result)?new Nc(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new Lc(this.source,0);}}]);}(Lc);jc=ct.define({map:function map(t,e){return t.map(function(t){return t.map(e);});}});$c=ct.define();zc=F.define({create:function create(){return Ec.start();},update:function update(t,e){return t.update(e);},provide:function provide(t){return[Xn.from(t,function(t){return t.tooltip;}),Ur.contentAttributes.from(t,function(t){return t.attrs;})];}});Hc=Cc(zc,Pc);Vc=/*#__PURE__*/_createClass(function Vc(t,e){_classCallCheck(this,Vc);this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0;});Fc=_i.fromClass(/*#__PURE__*/function(){function _class13(t){_classCallCheck(this,_class13);this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;var _iterator212=_createForOfIteratorHelper(t.state.field(zc).active),_step212;try{for(_iterator212.s();!(_step212=_iterator212.n()).done;){var _e253=_step212.value;1==_e253.state&&this.startQuery(_e253);}}catch(err){_iterator212.e(err);}finally{_iterator212.f();}}return _createClass(_class13,[{key:"update",value:function update(t){var _this86=this;var e=t.state.field(zc),i=t.state.facet(yc);if(!t.selectionSet&&!t.docChanged&&t.startState.field(zc)==e)return;var s=t.transactions.some(function(t){return(t.selection||t.docChanged)&&!Bc(t,i);});for(var _e254=0;_e254<this.running.length;_e254++){var _i211$updates;var _i211=this.running[_e254];if(s||_i211.updates.length+t.transactions.length>50&&Date.now()-_i211.time>1e3){var _iterator213=_createForOfIteratorHelper(_i211.context.abortListeners),_step213;try{for(_iterator213.s();!(_step213=_iterator213.n()).done;){var _t294=_step213.value;try{_t294();}catch(t){Ui(this.view.state,t);}}}catch(err){_iterator213.e(err);}finally{_iterator213.f();}_i211.context.abortListeners=null,this.running.splice(_e254--,1);}else(_i211$updates=_i211.updates).push.apply(_i211$updates,_toConsumableArray(t.transactions));}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(function(t){return t.effects.some(function(t){return t.is(wc);});})&&(this.pendingStart=!0);var r=this.pendingStart?50:i.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(function(t){return 1==t.state&&!_this86.running.some(function(e){return e.active.source==t.source;});})?setTimeout(function(){return _this86.startUpdate();},r):-1,0!=this.composing){var _iterator214=_createForOfIteratorHelper(t.transactions),_step214;try{for(_iterator214.s();!(_step214=_iterator214.n()).done;){var _e255=_step214.value;"input"==Bc(_e255,i)?this.composing=2:2==this.composing&&_e255.selection&&(this.composing=3);}}catch(err){_iterator214.e(err);}finally{_iterator214.f();}}}},{key:"startUpdate",value:function startUpdate(){var _this87=this;this.debounceUpdate=-1,this.pendingStart=!1;var t=this.view.state,e=t.field(zc);var _iterator215=_createForOfIteratorHelper(e.active),_step215;try{var _loop17=function _loop17(){var t=_step215.value;1!=t.state||_this87.running.some(function(e){return e.active.source==t.source;})||_this87.startQuery(t);};for(_iterator215.s();!(_step215=_iterator215.n()).done;){_loop17();}}catch(err){_iterator215.e(err);}finally{_iterator215.f();}}},{key:"startQuery",value:function startQuery(t){var _this88=this;var e=this.view.state,i=cc(e),s=new lc(e,i,t.explicitPos==i),r=new Vc(t,s);this.running.push(r),Promise.resolve(t.source(s)).then(function(t){r.context.aborted||(r.done=t||null,_this88.scheduleAccept());},function(t){_this88.view.dispatch({effects:bc.of(null)}),Ui(_this88.view.state,t);});}},{key:"scheduleAccept",value:function scheduleAccept(){var _this89=this;this.running.every(function(t){return void 0!==t.done;})?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(function(){return _this89.accept();},this.view.state.facet(yc).updateSyncTime));}},{key:"accept",value:function accept(){var _this90=this;var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;var e=[],i=this.view.state.facet(yc);var _loop18=function _loop18(_s195){var r=_this90.running[_s195];if(void 0===r.done){_s194=_s195;return 0;}// continue
|
5
|
+
if(_this90.running.splice(_s195--,1),r.done){var _s196=new Nc(r.active.source,r.active.explicitPos,r.done,r.done.from,null!==(t=r.done.to)&&void 0!==t?t:cc(r.updates.length?r.updates[0].startState:_this90.view.state));var _iterator216=_createForOfIteratorHelper(r.updates),_step216;try{for(_iterator216.s();!(_step216=_iterator216.n()).done;){var _t295=_step216.value;_s196=_s196.update(_t295,i);}}catch(err){_iterator216.e(err);}finally{_iterator216.f();}if(_s196.hasResult()){e.push(_s196);_s194=_s195;return 0;// continue
|
6
|
+
}}var n=_this90.view.state.field(zc).active.find(function(t){return t.source==r.active.source;});if(n&&1==n.state)if(null==r.done){var _t296=new Lc(r.active.source,0);var _iterator217=_createForOfIteratorHelper(r.updates),_step217;try{for(_iterator217.s();!(_step217=_iterator217.n()).done;){var _e256=_step217.value;_t296=_t296.update(_e256,i);}}catch(err){_iterator217.e(err);}finally{_iterator217.f();}1!=_t296.state&&e.push(_t296);}else _this90.startQuery(n);_s194=_s195;},_ret3;for(var _s194=0;_s194<this.running.length;_s194++){_ret3=_loop18(_s194);if(_ret3===0)continue;}e.length&&this.view.dispatch({effects:jc.of(e)});}}]);}(),{eventHandlers:{blur:function blur(t){var _this91=this;var e=this.view.state.field(zc,!1);if(e&&e.tooltip&&this.view.state.facet(yc).closeOnBlur){var _i212=e.open&&sh(this.view,e.open.tooltip);_i212&&_i212.dom.contains(t.relatedTarget)||setTimeout(function(){return _this91.view.dispatch({effects:bc.of(null)});},10);}},compositionstart:function compositionstart(){this.composing=1;},compositionend:function compositionend(){var _this92=this;3==this.composing&&setTimeout(function(){return _this92.view.dispatch({effects:wc.of(!1)});},20),this.composing=0;}}});qc="object"==(typeof navigator==="undefined"?"undefined":_typeof(navigator))&&/Win/.test(navigator.platform);Uc=_.highest(Ur.domEventHandlers({keydown:function keydown(t,e){var i=e.state.field(zc,!1);if(!i||!i.open||i.open.disabled||i.open.selected<0||t.key.length>1||t.ctrlKey&&(!qc||!t.altKey)||t.metaKey)return!1;var s=i.open.options[i.open.selected],r=i.active.find(function(t){return t.source==s.source;}),n=s.completion.commitCharacters||r.result.commitCharacters;return n&&n.indexOf(t.key)>-1&&Pc(e,s),!1;}}));Jc=Ur.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});Gc=/*#__PURE__*/_createClass(function Gc(t,e,i,s){_classCallCheck(this,Gc);this.field=t,this.line=e,this.from=i,this.to=s;});Kc=/*#__PURE__*/function(){function Kc(t,e,i){_classCallCheck(this,Kc);this.field=t,this.from=e,this.to=i;}return _createClass(Kc,[{key:"map",value:function map(t){var e=t.mapPos(this.from,-1,x.TrackDel),i=t.mapPos(this.to,1,x.TrackDel);return null==e||null==i?null:new Kc(this.field,e,i);}}]);}();_c=/*#__PURE__*/function(){function _c(t,e){_classCallCheck(this,_c);this.lines=t,this.fieldPositions=e;}return _createClass(_c,[{key:"instantiate",value:function instantiate(t,e){var i=[],s=[e],r=t.doc.lineAt(e),n=/^\s*/.exec(r.text)[0];var _iterator218=_createForOfIteratorHelper(this.lines),_step218;try{for(_iterator218.s();!(_step218=_iterator218.n()).done;){var _r155=_step218.value;if(i.length){var _i213=n,_h86=/^\t*/.exec(_r155)[0].length;for(var _e257=0;_e257<_h86;_e257++)_i213+=t.facet(bo);s.push(e+_i213.length-_h86),_r155=_i213+_r155.slice(_h86);}i.push(_r155),e+=_r155.length+1;}}catch(err){_iterator218.e(err);}finally{_iterator218.f();}var h=this.fieldPositions.map(function(t){return new Kc(t.field,s[t.line]+t.from,s[t.line]+t.to);});return{text:i,ranges:h};}}],[{key:"parse",value:function parse(t){var e,i=[],s=[],r=[];var _iterator219=_createForOfIteratorHelper(t.split(/\r\n?|\n/)),_step219;try{for(_iterator219.s();!(_step219=_iterator219.n()).done;){var _n123=_step219.value;for(;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(_n123);){var _t297=e[1]?+e[1]:null,_h87=e[2]||e[3]||"",_l73=-1;for(var _e258=0;_e258<i.length;_e258++)(null!=_t297?i[_e258].seq==_t297:_h87&&i[_e258].name==_h87)&&(_l73=_e258);if(_l73<0){var _e259=0;for(;_e259<i.length&&(null==_t297||null!=i[_e259].seq&&i[_e259].seq<_t297);)_e259++;i.splice(_e259,0,{seq:_t297,name:_h87}),_l73=_e259;var _iterator220=_createForOfIteratorHelper(r),_step220;try{for(_iterator220.s();!(_step220=_iterator220.n()).done;){var _t298=_step220.value;_t298.field>=_l73&&_t298.field++;}}catch(err){_iterator220.e(err);}finally{_iterator220.f();}}r.push(new Gc(_l73,s.length,e.index,e.index+_h87.length)),_n123=_n123.slice(0,e.index)+_h87+_n123.slice(e.index+e[0].length);}for(var _t299;_t299=/\\([{}])/.exec(_n123);){_n123=_n123.slice(0,_t299.index)+_t299[1]+_n123.slice(_t299.index+_t299[0].length);var _iterator221=_createForOfIteratorHelper(r),_step221;try{for(_iterator221.s();!(_step221=_iterator221.n()).done;){var _e260=_step221.value;_e260.line==s.length&&_e260.from>_t299.index&&(_e260.from--,_e260.to--);}}catch(err){_iterator221.e(err);}finally{_iterator221.f();}}s.push(_n123);}}catch(err){_iterator219.e(err);}finally{_iterator219.f();}return new _c(s,r);}}]);}();Xc=ni.widget({widget:new(/*#__PURE__*/function(_si9){function _class14(){_classCallCheck(this,_class14);return _callSuper(this,_class14,arguments);}_inherits(_class14,_si9);return _createClass(_class14,[{key:"toDOM",value:function toDOM(){var t=document.createElement("span");return t.className="cm-snippetFieldPosition",t;}},{key:"ignoreEvent",value:function ignoreEvent(){return!1;}}]);}(si))()});Yc=ni.mark({"class":"cm-snippetField"});Qc=/*#__PURE__*/function(){function Qc(t,e){_classCallCheck(this,Qc);this.ranges=t,this.active=e,this.deco=ni.set(t.map(function(t){return(t.from==t.to?Xc:Yc).range(t.from,t.to);}));}return _createClass(Qc,[{key:"map",value:function map(t){var e=[];var _iterator222=_createForOfIteratorHelper(this.ranges),_step222;try{for(_iterator222.s();!(_step222=_iterator222.n()).done;){var _i214=_step222.value;var _s197=_i214.map(t);if(!_s197)return null;e.push(_s197);}}catch(err){_iterator222.e(err);}finally{_iterator222.f();}return new Qc(e,this.active);}},{key:"selectionInsideField",value:function selectionInsideField(t){var _this93=this;return t.ranges.every(function(t){return _this93.ranges.some(function(e){return e.field==_this93.active&&e.from<=t.from&&e.to>=t.to;});});}}]);}();Zc=ct.define({map:function map(t,e){return t&&t.map(e);}});td=ct.define();ed=F.define({create:function create(){return null;},update:function update(t,e){var _iterator223=_createForOfIteratorHelper(e.effects),_step223;try{for(_iterator223.s();!(_step223=_iterator223.n()).done;){var _i215=_step223.value;if(_i215.is(Zc))return _i215.value;if(_i215.is(td)&&t)return new Qc(t.ranges,_i215.value);}}catch(err){_iterator223.e(err);}finally{_iterator223.f();}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t;},provide:function provide(t){return Ur.decorations.from(t,function(t){return t?t.deco:ni.none;});}});nd=[{key:"Tab",run:rd(1),shift:rd(-1)},{key:"Escape",run:function run(_ref58){var t=_ref58.state,e=_ref58.dispatch;return!!t.field(ed,!1)&&(e(t.update({effects:Zc.of(null)})),!0);}}];hd=j.define({combine:function combine(t){return t.length?t[0]:nd;}});ld=_.highest(Zr.compute([hd],function(t){return t.facet(hd);}));ud=Ur.domEventHandlers({mousedown:function mousedown(t,e){var i,s=e.state.field(ed,!1);if(!s||null==(i=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;var r=s.ranges.find(function(t){return t.from<=i&&t.to>=i;});return!(!r||r.field==s.active)&&(e.dispatch({selection:id(s.ranges,r.field),effects:Zc.of(s.ranges.some(function(t){return t.field>r.field;})?new Qc(s.ranges,r.field):null),scrollIntoView:!0}),!0);}});fd={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]};ad=ct.define({map:function map(t,e){var i=e.mapPos(t,-1,x.TrackAfter);return null==i?void 0:i;}});cd=new(/*#__PURE__*/function(_Ct3){function _class15(){_classCallCheck(this,_class15);return _callSuper(this,_class15,arguments);}_inherits(_class15,_Ct3);return _createClass(_class15);}(Ct))();cd.startSide=1,cd.endSide=-1;dd=F.define({create:function create(){return It.empty;},update:function update(t,e){if(t=t.map(e.changes),e.selection){var _i217=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:function filter(t){return t>=_i217.from&&t<=_i217.to;}});}var _iterator224=_createForOfIteratorHelper(e.effects),_step224;try{for(_iterator224.s();!(_step224=_iterator224.n()).done;){var _i218=_step224.value;_i218.is(ad)&&(t=t.update({add:[cd.range(_i218.value,_i218.value+1)]}));}}catch(err){_iterator224.e(err);}finally{_iterator224.f();}return t;}});pd="()[]{}<>";wd="object"==(typeof navigator==="undefined"?"undefined":_typeof(navigator))&&/Android\b/.test(navigator.userAgent);bd=Ur.inputHandler.of(function(t,e,i,s){if((wd?t.composing:t.compositionStarted)||t.state.readOnly)return!1;var r=t.state.selection.main;if(s.length>2||2==s.length&&1==y(v(s,0))||e!=r.from||i!=r.to)return!1;var n=function(t,e){var i=gd(t,t.selection.main.head),s=i.brackets||fd.brackets;var _iterator225=_createForOfIteratorHelper(s),_step225;try{for(_iterator225.s();!(_step225=_iterator225.n()).done;){var _r156=_step225.value;var _n124=md(v(_r156,0));if(e==_r156)return _n124==_r156?Sd(t,_r156,s.indexOf(_r156+_r156+_r156)>-1,i):Md(t,_r156,_n124,i.before||fd.before);if(e==_n124&&kd(t,t.selection.main.from))return xd(t,_r156,_n124);}}catch(err){_iterator225.e(err);}finally{_iterator225.f();}return null;}(t.state,s);return!!n&&(t.dispatch(n),!0);});vd=[{key:"Backspace",run:function run(_ref59){var t=_ref59.state,e=_ref59.dispatch;if(t.readOnly)return!1;var i=gd(t,t.selection.main.head).brackets||fd.brackets,s=null,r=t.changeByRange(function(e){if(e.empty){var _s198=function(t,e){var i=t.sliceString(e-2,e);return y(v(i,0))==i.length?i:i.slice(1);}(t.doc,e.head);var _iterator226=_createForOfIteratorHelper(i),_step226;try{for(_iterator226.s();!(_step226=_iterator226.n()).done;){var _r157=_step226.value;if(_r157==_s198&&yd(t.doc,e.head)==md(v(_r157,0)))return{changes:{from:e.head-_r157.length,to:e.head+_r157.length},range:B.cursor(e.head-_r157.length)};}}catch(err){_iterator226.e(err);}finally{_iterator226.f();}}return{range:s=e};});return s||e(t.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s;}}];Dd=[{key:"Ctrl-Space",run:function run(t){return!!t.state.field(zc,!1)&&(t.dispatch({effects:wc.of(!0)}),!0);}},{key:"Escape",run:function run(t){var e=t.state.field(zc,!1);return!(!e||!e.active.some(function(t){return 0!=t.state;}))&&(t.dispatch({effects:bc.of(null)}),!0);}},{key:"ArrowDown",run:Wc(!0)},{key:"ArrowUp",run:Wc(!1)},{key:"PageDown",run:Wc(!0,"page")},{key:"PageUp",run:Wc(!1,"page")},{key:"Enter",run:function run(t){var e=t.state.field(zc,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(yc).interactionDelay)&&Pc(t,e.open.options[e.open.selected]);}}];Ed=_.highest(Zr.computeN([yc],function(t){return t.facet(yc).defaultKeymap?[Dd]:[];}));Id=/*#__PURE__*/_createClass(function Id(t,e,i){_classCallCheck(this,Id);this.from=t,this.to=e,this.diagnostic=i;});Rd=/*#__PURE__*/function(){function Rd(t,e,i){_classCallCheck(this,Rd);this.diagnostics=t,this.panel=e,this.selected=i;}return _createClass(Rd,null,[{key:"init",value:function init(t,e,i){var s=t,r=i.facet(Vd).markerFilter;r&&(s=r(s,i));var n=ni.set(s.map(function(t){return t.from==t.to||t.from==t.to-1&&i.doc.lineAt(t.from).to==t.from?ni.widget({widget:new Ud(t),diagnostic:t}).range(t.from):ni.mark({attributes:{"class":"cm-lintRange cm-lintRange-"+t.severity+(t.markClass?" "+t.markClass:"")},diagnostic:t,inclusive:!0}).range(t.from,t.to);}),!0);return new Rd(n,e,Td(n));}}]);}();Bd=ct.define();Ld=ct.define();Nd=ct.define();jd=F.define({create:function create(){return new Rd(ni.none,null,null);},update:function update(t,e){if(e.docChanged){var _i220=t.diagnostics.map(e.changes),_s200=null;if(t.selected){var _r159=e.changes.mapPos(t.selected.from,1);_s200=Td(_i220,t.selected.diagnostic,_r159)||Td(_i220,null,_r159);}t=new Rd(_i220,t.panel,_s200);}var _iterator228=_createForOfIteratorHelper(e.effects),_step228;try{for(_iterator228.s();!(_step228=_iterator228.n()).done;){var _i221=_step228.value;_i221.is(Bd)?t=Rd.init(_i221.value,t.panel,e.state):_i221.is(Ld)?t=new Rd(t.diagnostics,_i221.value?Gd.open:null,t.selected):_i221.is(Nd)&&(t=new Rd(t.diagnostics,t.panel,_i221.value));}}catch(err){_iterator228.e(err);}finally{_iterator228.f();}return t;},provide:function provide(t){return[fh.from(t,function(t){return t.panel;}),Ur.decorations.from(t,function(t){return t.diagnostics;})];}});$d=ni.mark({"class":"cm-lintRange cm-lintRange-active",inclusive:!0});Hd=function Hd(t){var e=t.state.field(jd,!1);return!(!e||!e.panel)&&(t.dispatch({effects:Ld.of(!1)}),!0);};Wd=[{key:"Mod-Shift-m",run:function run(t){var e=t.state.field(jd,!1);var i,s;e&&e.panel||t.dispatch({effects:(i=t.state,s=[Ld.of(!0)],i.field(jd,!1)?s:s.concat(ct.appendConfig.of(Xd)))});var r=hh(t,Gd.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0;},preventDefault:!0},{key:"F8",run:function run(t){var e=t.state.field(jd,!1);if(!e)return!1;var i=t.state.selection.main,s=e.diagnostics.iter(i.to+1);return!(!s.value&&(s=e.diagnostics.iter(0),!s.value||s.from==i.from&&s.to==i.to))&&(t.dispatch({selection:{anchor:s.from,head:s.to},scrollIntoView:!0}),!0);}}];Vd=j.define({combine:function combine(t){return Object.assign({sources:t.map(function(t){return t.source;}).filter(function(t){return null!=t;})},At(t.map(function(t){return t.config;}),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:function hideOn(){return null;}},{needsRefresh:function needsRefresh(t,e){return t?e?function(i){return t(i)||e(i);}:t:e;}}));}});Ud=/*#__PURE__*/function(_si10){function Ud(t){var _this94;_classCallCheck(this,Ud);_this94=_callSuper(this,Ud),_this94.diagnostic=t;return _this94;}_inherits(Ud,_si10);return _createClass(Ud,[{key:"eq",value:function eq(t){return t.diagnostic==this.diagnostic;}},{key:"toDOM",value:function toDOM(){return sa("span",{"class":"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity});}}]);}(si);Jd=/*#__PURE__*/_createClass(function Jd(t,e){_classCallCheck(this,Jd);this.diagnostic=e,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=qd(t,e,!0),this.dom.id=this.id,this.dom.setAttribute("role","option");});Gd=/*#__PURE__*/function(){function Gd(t){var _this95=this;_classCallCheck(this,Gd);this.view=t,this.items=[];this.list=sa("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:function onkeydown(e){if(27==e.keyCode)Hd(_this95.view),_this95.view.focus();else if(38==e.keyCode||33==e.keyCode)_this95.moveSelection((_this95.selectedIndex-1+_this95.items.length)%_this95.items.length);else if(40==e.keyCode||34==e.keyCode)_this95.moveSelection((_this95.selectedIndex+1)%_this95.items.length);else if(36==e.keyCode)_this95.moveSelection(0);else if(35==e.keyCode)_this95.moveSelection(_this95.items.length-1);else if(13==e.keyCode)_this95.view.focus();else{if(!(e.keyCode>=65&&e.keyCode<=90&&_this95.selectedIndex>=0))return;{var _i223=_this95.items[_this95.selectedIndex].diagnostic,_s201=Fd(_i223.actions);for(var _r160=0;_r160<_s201.length;_r160++)if(_s201[_r160].toUpperCase().charCodeAt(0)==e.keyCode){var _e263=Td(_this95.view.state.field(jd).diagnostics,_i223);_e263&&_i223.actions[_r160].apply(t,_e263.from,_e263.to);}}}e.preventDefault();},onclick:function onclick(t){for(var _e264=0;_e264<_this95.items.length;_e264++)_this95.items[_e264].dom.contains(t.target)&&_this95.moveSelection(_e264);}}),this.dom=sa("div",{"class":"cm-panel-lint"},this.list,sa("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:function onclick(){return Hd(_this95.view);}},"×")),this.update();}return _createClass(Gd,[{key:"selectedIndex",get:function get(){var t=this.view.state.field(jd).selected;if(!t)return-1;for(var _e265=0;_e265<this.items.length;_e265++)if(this.items[_e265].diagnostic==t.diagnostic)return _e265;return-1;}},{key:"update",value:function update(){var _this96=this;var _this$view$state$fiel=this.view.state.field(jd),t=_this$view$state$fiel.diagnostics,e=_this$view$state$fiel.selected,i=0,s=!1,r=null;for(t.between(0,this.view.state.doc.length,function(t,n,_ref62){var h=_ref62.spec;var l,o=-1;for(var _t302=i;_t302<_this96.items.length;_t302++)if(_this96.items[_t302].diagnostic==h.diagnostic){o=_t302;break;}o<0?(l=new Jd(_this96.view,h.diagnostic),_this96.items.splice(i,0,l),s=!0):(l=_this96.items[o],o>i&&(_this96.items.splice(i,o-i),s=!0)),e&&l.diagnostic==e.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),r=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),i++;});i<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();0==this.items.length&&(this.items.push(new Jd(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:function read(){return{sel:r.dom.getBoundingClientRect(),panel:_this96.list.getBoundingClientRect()};},write:function write(_ref63){var t=_ref63.sel,e=_ref63.panel;var i=e.height/_this96.list.offsetHeight;t.top<e.top?_this96.list.scrollTop-=(e.top-t.top)/i:t.bottom>e.bottom&&(_this96.list.scrollTop+=(t.bottom-e.bottom)/i);}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync();}},{key:"sync",value:function sync(){var t=this.list.firstChild;function e(){var e=t;t=e.nextSibling,e.remove();}var _iterator230=_createForOfIteratorHelper(this.items),_step230;try{for(_iterator230.s();!(_step230=_iterator230.n()).done;){var _i224=_step230.value;if(_i224.dom.parentNode==this.list){for(;t!=_i224.dom;)e();t=_i224.dom.nextSibling;}else this.list.insertBefore(_i224.dom,t);}}catch(err){_iterator230.e(err);}finally{_iterator230.f();}for(;t;)e();}},{key:"moveSelection",value:function moveSelection(t){if(this.selectedIndex<0)return;var e=Td(this.view.state.field(jd).diagnostics,this.items[t].diagnostic);e&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:Nd.of(e)});}}],[{key:"open",value:function open(t){return new Gd(t);}}]);}();_d=Ur.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Kd("#d11")},".cm-lintRange-warning":{backgroundImage:Kd("orange")},".cm-lintRange-info":{backgroundImage:Kd("#999")},".cm-lintRange-hint":{backgroundImage:Kd("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});Xd=[jd,Ur.decorations.compute([jd],function(t){var _t$field=t.field(jd),e=_t$field.selected,i=_t$field.panel;return e&&i&&e.from!=e.to?ni.set([$d.range(e.from,e.to)]):ni.none;}),ih(zd,{hideOn:function hideOn(t,e){var i=e.pos,s=e.end||i,r=t.state.facet(Vd).hideOn(t,i,s);if(null!=r)return r;var n=t.startState.doc.lineAt(e.pos);return!(!t.effects.some(function(t){return t.is(Bd);})&&!t.changes.touchesRange(n.from,Math.max(n.to,s)));}}),_d];Yd=function Yd(t){return void 0===t||t;};_export("K",Qd=function Qd(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=[];Yd(t.defaultKeymap)&&e.push.apply(e,_toConsumableArray(ia)),Yd(t.closeBracketsKeymap)&&e.push.apply(e,vd),Yd(t.searchKeymap)&&e.push.apply(e,Za),Yd(t.historyKeymap)&&e.push.apply(e,of),Yd(t.foldKeymap)&&e.push.apply(e,Go),Yd(t.lintKeymap)&&e.push.apply(e,Wd);var i=[];return Yd(t.highlightActiveLineGutter)&&i.push(Th),Yd(t.highlightSpecialChars)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[En.of(t),In||(In=_i.fromClass(/*#__PURE__*/function(){function _class16(t){_classCallCheck(this,_class16);this.view=t,this.decorations=ni.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(En)),this.decorations=this.decorator.createDeco(t);}return _createClass(_class16,[{key:"makeDecorator",value:function makeDecorator(t){var _this97=this;return new Sn({regexp:t.specialChars,decoration:function decoration(e,i,s){var r=i.state.doc,n=v(e[0],0);if(9==n){var _t303=r.lineAt(s),_e266=i.state.tabSize,_n125=Vt(_t303.text,_e266,s-_t303.from);return ni.replace({widget:new Tn((_e266-_n125%_e266)*_this97.view.defaultCharacterWidth/_this97.view.scaleX)});}return _this97.decorationCache[n]||(_this97.decorationCache[n]=ni.replace({widget:new Rn(t,n)}));},boundary:t.replaceTabs?void 0:/[^]/});}},{key:"update",value:function update(t){var e=t.state.facet(En);t.startState.facet(En)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations);}}]);}(),{decorations:function decorations(t){return t.decorations;}}))];}()),Yd(t.history)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[qu,Fu.of(t),Ur.domEventHandlers({beforeinput:function beforeinput(t,e){var i="historyUndo"==t.inputType?Ju:"historyRedo"==t.inputType?Gu:null;return!!i&&(t.preventDefault(),i(e));}})];}()),Yd(t.foldGutter)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=Object.assign(Object.assign({},tu),t),i=new eu(e,!0),s=new eu(e,!1),r=_i.fromClass(/*#__PURE__*/function(){function _class17(t){_classCallCheck(this,_class17);this.from=t.viewport.from,this.markers=this.buildMarkers(t);}return _createClass(_class17,[{key:"update",value:function update(t){(t.docChanged||t.viewportChanged||t.startState.facet(mo)!=t.state.facet(mo)||t.startState.field(Vo,!1)!=t.state.field(Vo,!1)||no(t.startState)!=no(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view));}},{key:"buildMarkers",value:function buildMarkers(t){var e=new Rt();var _iterator231=_createForOfIteratorHelper(t.viewportLineBlocks),_step231;try{for(_iterator231.s();!(_step231=_iterator231.n()).done;){var _r161=_step231.value;var _n126=Fo(t.state,_r161.from,_r161.to)?s:$o(t.state,_r161.from,_r161.to)?i:null;_n126&&e.add(_r161.from,_r161.from,_n126);}}catch(err){_iterator231.e(err);}finally{_iterator231.f();}return e.finish();}}]);}()),n=e.domEventHandlers;return[r,mh({"class":"cm-foldGutter",markers:function markers(t){var e;return(null===(e=t.plugin(r))||void 0===e?void 0:e.markers)||It.empty;},initialSpacer:function initialSpacer(){return new eu(e,!1);},domEventHandlers:Object.assign(Object.assign({},n),{click:function click(t,e,i){if(n.click&&n.click(t,e,i))return!0;var s=Fo(t.state,e.from,e.to);if(s)return t.dispatch({effects:Ho.of(s)}),!0;var r=$o(t.state,e.from,e.to);return!!r&&(t.dispatch({effects:Po.of(r)}),!0);}})}),Xo()];}()),Yd(t.drawSelection)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[dn.of(t),mn,wn,vn,Wi.of(!0)];}()),Yd(t.dropCursor)&&i.push([yn,Mn]),Yd(t.allowMultipleSelections)&&i.push(St.allowMultipleSelections.of(!0)),Yd(t.indentOnInput)&&i.push(St.transactionFilter.of(function(t){if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;var e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;var i=t.newDoc,s=t.newSelection.main.head,r=i.lineAt(s);if(s>r.from+200)return t;var n=i.sliceString(r.from,s);if(!e.some(function(t){return t.test(n);}))return t;var h=t.state,l=-1,o=[];var _iterator232=_createForOfIteratorHelper(h.selection.ranges),_step232;try{for(_iterator232.s();!(_step232=_iterator232.n()).done;){var _t304=_step232.value.head;var _e267=h.doc.lineAt(_t304);if(_e267.from==l)continue;l=_e267.from;var _i225=yo(h,_e267.from);if(null==_i225)continue;var _s202=/^\s*/.exec(_e267.text)[0],_r162=ko(h,_i225);_s202!=_r162&&o.push({from:_e267.from,to:_e267.from+_s202.length,insert:_r162});}}catch(err){_iterator232.e(err);}finally{_iterator232.f();}return o.length?[t,{changes:o,sequential:!0}]:t;})),Yd(t.bracketMatching)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return[pu.of(t),vu];}()),Yd(t.closeBrackets)&&i.push([bd,dd]),Yd(t.autocompletion)&&i.push(Od()),Yd(t.rectangularSelection)&&i.push(function(t){var e=(null==t?void 0:t.eventFilter)||function(t){return t.altKey&&0==t.button;};return Ur.mouseSelectionStyle.of(function(t,i){return e(i)?Pn(t,i):null;});}()),Yd(t.crosshairCursor)&&i.push(function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var _Hn=_slicedToArray(Hn[t.key||"Alt"],2),e=_Hn[0],i=_Hn[1],s=_i.fromClass(/*#__PURE__*/function(){function _class18(t){_classCallCheck(this,_class18);this.view=t,this.isDown=!1;}return _createClass(_class18,[{key:"set",value:function set(t){this.isDown!=t&&(this.isDown=t,this.view.update([]));}}]);}(),{eventObservers:{keydown:function keydown(t){this.set(t.keyCode==e||i(t));},keyup:function keyup(t){t.keyCode!=e&&i(t)||this.set(!1);},mousemove:function mousemove(t){this.set(i(t));}}});return[s,Ur.contentAttributes.of(function(t){var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.isDown)?Wn:null;})];}()),Yd(t.highlightActiveLine)&&i.push(Ln),Yd(t.highlightSelectionMatches)&&i.push(function(t){var e=[Sa,xa];return t&&e.push(va.of(t)),e;}()),t.tabSize&&"number"==typeof t.tabSize&&i.push(bo.of(" ".repeat(t.tabSize))),i.concat([Zr.of(e.flat())]).filter(Boolean);});}};});
|
7
7
|
//# sourceMappingURL=extensionSetup.cjs.js.map
|