r.bottom)&&y==r.bottom-u.bottom>u.top-r.top&&(y=!y);var b=(y?u.top-r.top:r.bottom-u.bottom)-h;if(bg&&C.topw&&(w=y?C.top-p-2-h:C.bottom+h+2)}}catch(A){S.e(A)}finally{S.f()}}"absolute"==this.position?(l.style.top=w-e.parent.top+"px",l.style.left=g-e.parent.left+"px"):(l.style.top=w+"px",l.style.left=g+"px"),f&&(f.style.left="".concat(u.left+(v?m.x:-m.x)-(g+14-7),"px")),!0!==s.overlap&&i.push({left:g,top:w,right:k,bottom:w+p}),l.classList.toggle("cm-tooltip-above",y),l.classList.toggle("cm-tooltip-below",!y),s.positioned&&s.positioned(e.space)}}}},{key:"maybeMeasure",value:function(){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 e,t=T(this.manager.tooltipViews);try{for(t.s();!(e=t.n()).done;){e.value.dom.style.top=lf}}catch(n){t.e(n)}finally{t.f()}}}}]),e}(),{eventHandlers:{scroll:function(){this.maybeMeasure()}}}),pf=fc.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"".concat(7,"px"),width:"".concat(14,"px"),position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"".concat(7,"px solid transparent"),borderRight:"".concat(7,"px solid transparent")},".cm-tooltip-above &":{bottom:"-".concat(7,"px"),"&:before":{borderTop:"".concat(7,"px solid #bbb")},"&:after":{borderTop:"".concat(7,"px solid #f5f5f5"),bottom:"1px"}},".cm-tooltip-below &":{top:"-".concat(7,"px"),"&:before":{borderBottom:"".concat(7,"px solid #bbb")},"&:after":{borderBottom:"".concat(7,"px solid #f5f5f5"),top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),mf={x:0,y:0},vf=io.define({enables:[df,pf]}),gf=io.define(),yf=function(){function e(t){var n=this;p(this,e),this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new uf(t,gf,(function(e){return n.createHostedView(e)}))}return y(e,[{key:"createHostedView",value:function(e){var t=e.create(this.view);return t.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(t.dom),this.mounted&&t.mount&&t.mount(this.view),t}},{key:"mount",value:function(e){var t,n=T(this.manager.tooltipViews);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.mount&&r.mount(e)}}catch(i){n.e(i)}finally{n.f()}this.mounted=!0}},{key:"positioned",value:function(e){var t,n=T(this.manager.tooltipViews);try{for(n.s();!(t=n.n()).done;){var r=t.value;r.positioned&&r.positioned(e)}}catch(i){n.e(i)}finally{n.f()}}},{key:"update",value:function(e){this.manager.update(e)}},{key:"destroy",value:function(){var e,t,n=T(this.manager.tooltipViews);try{for(n.s();!(t=n.n()).done;){var r=t.value;null===(e=r.destroy)||void 0===e||e.call(r)}}catch(i){n.e(i)}finally{n.f()}}}],[{key:"create",value:function(t){return new e(t)}}]),e}(),bf=vf.compute([gf],(function(e){var t=e.facet(gf).filter((function(e){return e}));return 0===t.length?null:{pos:Math.min.apply(Math,d(t.map((function(e){return e.pos})))),end:Math.max.apply(Math,d(t.filter((function(e){return null!=e.end})).map((function(e){return e.end})))),create:yf.create,above:t[0].above,arrow:t.some((function(e){return e.arrow}))}})),wf=function(){function e(t,n,r,i,o){p(this,e),this.view=t,this.source=n,this.field=r,this.setHover=i,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}return y(e,[{key:"update",value:function(){var e=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((function(){return e.startHover()}),20))}},{key:"active",get:function(){return this.view.state.field(this.field)}},{key:"checkHover",value:function(){if(this.hoverTimeout=-1,!this.active){var e=Date.now()-this.lastMove.time;er.bottom||t.xr.right+this.view.defaultCharacterWidth)){var i=this.view.bidiSpans(this.view.state.doc.lineAt(n)).find((function(e){return e.from<=n&&e.to>=n})),o=i&&i.dir==ll.RTL?-1:1,a=this.source(this.view,n,t.x1&&void 0!==arguments[1]?arguments[1]:{},n=Io.define(),r=co.define({create:function(){return null},update:function(e,r){if(e&&(t.hideOnChange&&(r.docChanged||r.selection)||t.hideOn&&t.hideOn(r,e)))return null;if(e&&r.docChanged){var i=r.changes.mapPos(e.pos,-1,Ui.TrackDel);if(null==i)return null;var o=Object.assign(Object.create(null),e);o.pos=i,null!=e.end&&(o.end=r.changes.mapPos(e.end)),e=o}var a,s=T(r.effects);try{for(s.s();!(a=s.n()).done;){var l=a.value;l.is(n)&&(e=l.value),l.is(Cf)&&(e=null)}}catch(u){s.e(u)}finally{s.f()}return e},provide:function(e){return gf.from(e)}});return[r,Qs.define((function(i){return new wf(i,e,r,n,t.hoverTime||300)})),bf]}function Sf(e,t){var n=e.plugin(df);if(!n)return null;var r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}var Cf=Io.define();var Af=io.define({combine:function(e){var t,n,r,i=T(e);try{for(i.s();!(r=i.n()).done;){var o=r.value;t=t||o.topContainer,n=n||o.bottomContainer}}catch(a){i.e(a)}finally{i.f()}return{topContainer:t,bottomContainer:n}}});function Mf(e,t){var n=e.plugin(Ef),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var Ef=Qs.fromClass(function(){function e(t){p(this,e),this.input=t.state.facet(_f),this.specs=this.input.filter((function(e){return e})),this.panels=this.specs.map((function(e){return e(t)}));var n=t.state.facet(Af);this.top=new Tf(t,!0,n.topContainer),this.bottom=new Tf(t,!1,n.bottomContainer),this.top.sync(this.panels.filter((function(e){return e.top}))),this.bottom.sync(this.panels.filter((function(e){return!e.top})));var r,i=T(this.panels);try{for(i.s();!(r=i.n()).done;){var o=r.value;o.dom.classList.add("cm-panel"),o.mount&&o.mount()}}catch(a){i.e(a)}finally{i.f()}}return y(e,[{key:"update",value:function(e){var t=e.state.facet(Af);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Tf(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Tf(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();var n=e.state.facet(_f);if(n!=this.input){var r,i=n.filter((function(e){return e})),o=[],a=[],s=[],l=[],u=T(i);try{for(u.s();!(r=u.n()).done;){var c=r.value,f=this.specs.indexOf(c),h=void 0;f<0?(h=c(e.view),l.push(h)):(h=this.panels[f]).update&&h.update(e),o.push(h),(h.top?a:s).push(h)}}catch(b){u.e(b)}finally{u.f()}this.specs=i,this.panels=o,this.top.sync(a),this.bottom.sync(s);for(var d=0,p=l;dthis.i;){var t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}]),e}(),Hf=function(){function e(t,n){var r=this;p(this,e),this.view=t,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");var i=function(e){r.dom.addEventListener(e,(function(i){var o,a=i.target;if(a!=r.dom&&r.dom.contains(a)){for(;a.parentNode!=r.dom;)a=a.parentNode;var s=a.getBoundingClientRect();o=(s.top+s.bottom)/2}else o=i.clientY;var l=t.lineBlockAtHeight(o-t.documentTop);n.domEventHandlers[e](t,l,i)&&i.preventDefault()}))};for(var o in n.domEventHandlers)i(o);this.markers=Bf(n.markers(t)),n.initialSpacer&&(this.spacer=new Vf(t,0,0,[n.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}return y(e,[{key:"update",value:function(e){var t=this.markers;if(this.markers=Bf(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){var n=this.config.updateSpacer(this.spacer.markers[0],e);n!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[n])}var r=e.view.viewport;return!Jo.eq(this.markers,t,r.from,r.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}},{key:"destroy",value:function(){var e,t=T(this.elements);try{for(t.s();!(e=t.n()).done;){e.value.destroy()}}catch(n){t.e(n)}finally{t.f()}}}]),e}(),Vf=function(){function e(t,n,r,i){p(this,e),this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,r,i)}return y(e,[{key:"update",value:function(e,t,n,r){this.height!=t&&(this.dom.style.height=(this.height=t)+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(var n=0;nr&&(r=a,n.push(Xf.range(a)))}}catch(s){i.e(s)}finally{i.f()}return Jo.of(n)}));var Jf=0,Zf=y((function e(t,n){p(this,e),this.from=t,this.to=n})),eh=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};p(this,e),this.id=Jf++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return y(e,[{key:"add",value:function(e){var t=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=nh.match(e)),function(n){var r=e(n);return void 0===r?null:[t,r]}}}]),e}();eh.closedBy=new eh({deserialize:function(e){return e.split(" ")}}),eh.openedBy=new eh({deserialize:function(e){return e.split(" ")}}),eh.group=new eh({deserialize:function(e){return e.split(" ")}}),eh.contextHash=new eh({perNode:!0}),eh.lookAhead=new eh({perNode:!0}),eh.mounted=new eh({perNode:!0});var th=Object.create(null),nh=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;p(this,e),this.name=t,this.props=n,this.id=r,this.flags=i}return y(e,[{key:"prop",value:function(e){return this.props[e.id]}},{key:"isTop",get:function(){return(1&this.flags)>0}},{key:"isSkipped",get:function(){return(2&this.flags)>0}},{key:"isError",get:function(){return(4&this.flags)>0}},{key:"isAnonymous",get:function(){return(8&this.flags)>0}},{key:"is",value:function(e){if("string"==typeof e){if(this.name==e)return!0;var t=this.prop(eh.group);return!!t&&t.indexOf(e)>-1}return this.id==e}}],[{key:"define",value:function(t){var n=t.props&&t.props.length?Object.create(null):th,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),i=new e(t.name||"",n,t.id,r);if(t.props){var o,a=T(t.props);try{for(a.s();!(o=a.n()).done;){var s=o.value;if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}}catch(l){a.e(l)}finally{a.f()}}return i}},{key:"match",value:function(e){var t=Object.create(null);for(var n in e){var r,i=T(n.split(" "));try{for(i.s();!(r=i.n()).done;){var o=r.value;t[o]=e[n]}}catch(a){i.e(a)}finally{i.f()}}return function(e){for(var n=e.prop(eh.group),r=-1;r<(n?n.length:0);r++){var i=t[r<0?e.name:n[r]];if(i)return i}}}}]),e}();nh.none=new nh("",Object.create(null),0,8);var rh,ih=new WeakMap,oh=new WeakMap;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"}(rh||(rh={}));var ah=function(){function e(t,n,r,i,o){if(p(this,e),this.type=t,this.children=n,this.positions=r,this.length=i,this.props=null,o&&o.length){this.props=Object.create(null);var a,s=T(o);try{for(s.s();!(a=s.n()).done;){var l=f(a.value,2),u=l[0],c=l[1];this.props["number"==typeof u?u:u.id]=c}}catch(h){s.e(h)}finally{s.f()}}}return y(e,[{key:"toString",value:function(){var e=this.prop(eh.mounted);if(e&&!e.overlay)return e.tree.toString();var t,n="",r=T(this.children);try{for(r.s();!(t=r.n()).done;){var i=t.value.toString();i&&(n&&(n+=","),n+=i)}}catch(o){r.e(o)}finally{r.f()}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}},{key:"cursor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new gh(this.topNode,e)}},{key:"cursorAt",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=ih.get(this)||this.topNode,r=new gh(n);return r.moveTo(e,t),ih.set(this,r._tree),r}},{key:"topNode",get:function(){return new hh(this,0,0,null)}},{key:"resolve",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=fh(ih.get(this)||this.topNode,e,t,!1);return ih.set(this,n),n}},{key:"resolveInner",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=fh(oh.get(this)||this.topNode,e,t,!0);return oh.set(this,n),n}},{key:"iterate",value:function(e){for(var t=e.enter,n=e.leave,r=e.from,i=void 0===r?0:r,o=e.to,a=void 0===o?this.length:o,s=e.mode||0,l=(s&rh.IncludeAnonymous)>0,u=this.cursor(s|rh.IncludeAnonymous);;){var c=!1;if(u.from<=a&&u.to>=i&&(!l&&u.type.isAnonymous||!1!==t(u))){if(u.firstChild())continue;c=!0}for(;c&&n&&(l||!u.type.isAnonymous)&&n(u),!u.nextSibling();){if(!u.parent())return;c=!0}}}},{key:"prop",value:function(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}},{key:"propValues",get:function(){var e=[];if(this.props)for(var t in this.props)e.push([+t,this.props[t]]);return e}},{key:"balance",value:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.children.length<=8?this:kh(nh.none,this.children,this.positions,0,this.children.length,0,this.length,(function(n,r,i){return new e(t.type,n,r,i,t.propValues)}),n.makeTree||function(t,n,r){return new e(nh.none,t,n,r)})}}],[{key:"build",value:function(e){return function(e){var t,n=e.buffer,r=e.nodeSet,i=e.maxBufferLength,o=void 0===i?1024:i,a=e.reused,s=void 0===a?[]:a,l=e.minRepeatType,u=void 0===l?r.types.length:l,c=Array.isArray(n)?new sh(n,n.length):n,f=r.types,h=0,d=0;function p(e,t,n,i,a){for(var l=c.id,w=c.start,k=c.end,x=c.size,S=d;x<0;){if(c.next(),-1==x){var C=s[l];return n.push(C),void i.push(w-e)}if(-3==x)return void(h=l);if(-4==x)return void(d=l);throw new RangeError("Unrecognized record size: ".concat(x))}var A,M,E=f[l],T=w-e;if(k-w<=o&&(M=y(c.pos-t,a))){for(var O=new Uint16Array(M.size-M.skip),_=c.pos-M.size,D=O.length;c.pos>_;)D=b(M.start,O,D);A=new lh(O,k-M.start,r),T=M.start-e}else{var N=c.pos-x;c.next();for(var R=[],I=[],L=l>=u?l:-1,P=0,z=k;c.pos>N;)L>=0&&c.id==L&&c.size>=0?(c.end<=z-o&&(v(R,I,w,P,c.end,z,L,S),P=R.length,z=c.end),c.next()):p(w,N,R,I,L);if(L>=0&&P>0&&P-1&&P>0){var F=m(E);A=kh(E,R,I,0,R.length,0,k-w,F,F)}else A=g(E,R,I,k-w,S-k)}n.push(A),i.push(T)}function m(e){return function(t,n,r){var i,o,a=0,s=t.length-1;if(s>=0&&(i=t[s])instanceof ah){if(!s&&i.type==e&&i.length==r)return i;(o=i.prop(eh.lookAhead))&&(a=n[s]+i.length+o)}return g(e,t,n,r,a)}}function v(e,t,n,i,o,a,s,l){for(var u=[],c=[];e.length>i;)u.push(e.pop()),c.push(t.pop()+n-o);e.push(g(r.types[s],u,c,a-o,l-a)),t.push(o-n)}function g(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0;if(h){var a=[eh.contextHash,h];o=o?[a].concat(o):[a]}if(i>25){var s=[eh.lookAhead,i];o=o?[s].concat(o):[s]}return new ah(e,t,n,r,o)}function y(e,t){var n=c.fork(),r=0,i=0,a=0,s=n.end-o,l={size:0,start:0,skip:0};e:for(var f=n.pos-e;n.pos>f;){var h=n.size;if(n.id==t&&h>=0)l.size=r,l.start=i,l.skip=a,a+=4,r+=4,n.next();else{var d=n.pos-h;if(h<0||d=u?4:0,m=n.start;for(n.next();n.pos>d;){if(n.size<0){if(-3!=n.size)break e;p+=4}else n.id>=u&&(p+=4);n.next()}i=m,r+=h,a+=p}}return(t<0||r==e)&&(l.size=r,l.start=i,l.skip=a),l.size>4?l:void 0}function b(e,t,n){var r=c.id,i=c.start,o=c.end,a=c.size;if(c.next(),a>=0&&r4)for(var l=c.pos-(a-4);c.pos>l;)n=b(e,t,n);t[--n]=s,t[--n]=o-e,t[--n]=i-e,t[--n]=r}else-3==a?h=r:-4==a&&(d=r);return n}var w=[],k=[];for(;c.pos>0;)p(e.start||0,e.bufferStart||0,w,k,-1);var x=null!==(t=e.length)&&void 0!==t?t:w.length?k[0]+w[0].length:0;return new ah(f[e.topID],w.reverse(),k.reverse(),x)}(e)}}]),e}();ah.empty=new ah(nh.none,[],[],0);var sh=function(){function e(t,n){p(this,e),this.buffer=t,this.index=n}return y(e,[{key:"id",get:function(){return this.buffer[this.index-4]}},{key:"start",get:function(){return this.buffer[this.index-3]}},{key:"end",get:function(){return this.buffer[this.index-2]}},{key:"size",get:function(){return this.buffer[this.index-1]}},{key:"pos",get:function(){return this.index}},{key:"next",value:function(){this.index-=4}},{key:"fork",value:function(){return new e(this.buffer,this.index)}}]),e}(),lh=function(){function e(t,n,r){p(this,e),this.buffer=t,this.length=n,this.set=r}return y(e,[{key:"type",get:function(){return nh.none}},{key:"toString",value:function(){for(var e=[],t=0;t0));s=o[s+3]);return a}},{key:"slice",value:function(t,n,r){for(var i=this.buffer,o=new Uint16Array(n-t),a=0,s=t,l=0;s=t&&nt;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function ch(e,t){for(var n=e.childBefore(t);n;){var r=n.lastChild;if(!r||r.to!=n.to)break;r.type.isError&&r.from==r.to?(e=n,n=r.prevSibling):n=r}return e}function fh(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to4&&void 0!==arguments[4]?arguments[4]:0,a=this;;){for(var s=a._tree,l=s.children,u=s.positions,c=n>0?l.length:-1;t!=c;t+=n){var f=l[t],h=u[t]+a.from;if(uh(i,r,h,h+f.length))if(f instanceof lh){if(o&rh.ExcludeBuffers)continue;var d=f.findChild(0,f.buffer.length,n,r-h,i);if(d>-1)return new vh(new mh(a,f,t,h),null,d)}else if(o&rh.IncludeAnonymous||!f.type.isAnonymous||yh(f)){var p=void 0;if(!(o&rh.IgnoreMounts)&&f.props&&(p=f.prop(eh.mounted))&&!p.overlay)return new e(p.tree,h,t,a);var m=new e(f,h,t,a);return o&rh.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(n<0?f.children.length-1:0,n,r,i)}}if(o&rh.IncludeAnonymous||!a.type.isAnonymous)return null;if(t=a.index>=0?a.index+n:n<0?-1:a._parent._tree.children.length,!(a=a._parent))return null}}},{key:"firstChild",get:function(){return this.nextChild(0,1,0,4)}},{key:"lastChild",get:function(){return this.nextChild(this._tree.children.length-1,-1,0,4)}},{key:"childAfter",value:function(e){return this.nextChild(0,1,e,2)}},{key:"childBefore",value:function(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}},{key:"enter",value:function(t,n){var r,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(i&rh.IgnoreOverlays)&&(r=this._tree.prop(eh.mounted))&&r.overlay){var o,a=t-this.from,s=T(r.overlay);try{for(s.s();!(o=s.n()).done;){var l=o.value,u=l.from,c=l.to;if((n>0?u<=a:u=a:c>a))return new e(r.tree,r.overlay[0].from+this.from,-1,this)}}catch(f){s.e(f)}finally{s.f()}}return this.nextChild(0,1,t,n,i)}},{key:"nextSignificantParent",value:function(){for(var e=this;e.type.isAnonymous&&e._parent;)e=e._parent;return e}},{key:"parent",get:function(){return this._parent?this._parent.nextSignificantParent():null}},{key:"nextSibling",get:function(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}},{key:"prevSibling",get:function(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}},{key:"cursor",value:function(){return new gh(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function(){return this._tree}},{key:"toTree",value:function(){return this._tree}},{key:"resolve",value:function(e){return fh(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(e){return fh(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function(e){return ch(this,e)}},{key:"getChild",value:function(e){var t=dh(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return t.length?t[0]:null}},{key:"getChildren",value:function(e){return dh(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}},{key:"toString",value:function(){return this._tree.toString()}},{key:"node",get:function(){return this}},{key:"matchContext",value:function(e){return ph(this,e)}}]),e}();function dh(e,t,n,r){var i=e.cursor(),o=[];if(!i.firstChild())return o;if(null!=n)for(;!i.type.is(n);)if(!i.nextSibling())return o;for(;;){if(null!=r&&i.type.is(r))return o;if(i.type.is(t)&&o.push(i.node),!i.nextSibling())return null==r?o:[]}}function ph(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length-1,r=e.parent;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var mh=y((function e(t,n,r,i){p(this,e),this.parent=t,this.buffer=n,this.index=r,this.start=i})),vh=function(){function e(t,n,r){p(this,e),this.context=t,this._parent=n,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}return y(e,[{key:"name",get:function(){return this.type.name}},{key:"from",get:function(){return this.context.start+this.context.buffer.buffer[this.index+1]}},{key:"to",get:function(){return this.context.start+this.context.buffer.buffer[this.index+2]}},{key:"child",value:function(t,n,r){var i=this.context.buffer,o=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return o<0?null:new e(this.context,this,o)}},{key:"firstChild",get:function(){return this.child(1,0,4)}},{key:"lastChild",get:function(){return this.child(-1,0,4)}},{key:"childAfter",value:function(e){return this.child(1,e,2)}},{key:"childBefore",value:function(e){return this.child(-1,e,-2)}},{key:"enter",value:function(t,n){if((arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)&rh.ExcludeBuffers)return null;var r=this.context.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return i<0?null:new e(this.context,this,i)}},{key:"parent",get:function(){return this._parent||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}},{key:"nextSibling",get:function(){var t=this.context.buffer,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}},{key:"prevSibling",get:function(){var t=this.context.buffer,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}},{key:"cursor",value:function(){return new gh(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function(){return null}},{key:"toTree",value:function(){var e=[],t=[],n=this.context.buffer,r=this.index+4,i=n.buffer[this.index+3];if(i>r){var o=n.buffer[this.index+1];e.push(n.slice(r,i,o)),t.push(0)}return new ah(this.type,e,t,this.to-this.from)}},{key:"resolve",value:function(e){return fh(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(e){return fh(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function(e){return ch(this,e)}},{key:"toString",value:function(){return this.context.buffer.childString(this.index)}},{key:"getChild",value:function(e){var t=dh(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return t.length?t[0]:null}},{key:"getChildren",value:function(e){return dh(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}},{key:"node",get:function(){return this}},{key:"matchContext",value:function(e){return ph(this,e)}}]),e}(),gh=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(p(this,e),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof hh)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(var r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}return y(e,[{key:"name",get:function(){return this.type.name}},{key:"yieldNode",value:function(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}},{key:"yieldBuf",value:function(e,t){this.index=e;var n=this.buffer,r=n.start,i=n.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}},{key:"yield",value:function(e){return!!e&&(e instanceof hh?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}},{key:"toString",value:function(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}},{key:"enterChild",value:function(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));var r=this.buffer.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}},{key:"firstChild",value:function(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function(e){return this.enterChild(1,e,2)}},{key:"childBefore",value:function(e){return this.enterChild(-1,e,-2)}},{key:"enter",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(n&rh.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}},{key:"parent",value:function(){if(!this.buffer)return this.yieldNode(this.mode&rh.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var e=this.mode&rh.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}},{key:"sibling",value:function(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));var t=this.buffer.buffer,n=this.stack.length-1;if(e<0){var r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{var i=t.buffer[this.index+3];if(i<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}},{key:"nextSibling",value:function(){return this.sibling(1)}},{key:"prevSibling",value:function(){return this.sibling(-1)}},{key:"atLastNode",value:function(e){var t,n,r=this.buffer;if(r){if(e>0){if(this.index-1)for(var s=t+e,l=e<0?-1:n._tree.children.length;s!=l;s+=e){var u=n._tree.children[s];if(this.mode&rh.IncludeAnonymous||u instanceof lh||!u.type.isAnonymous||yh(u))return!1}}return!0}},{key:"move",value:function(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}},{key:"next",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(1,e)}},{key:"prev",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(-1,e)}},{key:"moveTo",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(var o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=i+1;break e}r=this.stack[--i]}for(var a=n;a=0;i--){if(i<0)return ph(this.node,e,r);var o=n[t.buffer[this.stack[i]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}]),e}();function yh(e){return e.children.some((function(e){return e instanceof lh||!e.type.isAnonymous||yh(e)}))}var bh=new WeakMap;function wh(e,t){if(!e.isAnonymous||t instanceof lh||t.type!=e)return 1;var n=bh.get(t);if(null==n){n=1;var r,i=T(t.children);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(o.type!=e||!(o instanceof ah)){n=1;break}n+=wh(e,o)}}catch(a){i.e(a)}finally{i.f()}bh.set(t,n)}return n}function kh(e,t,n,r,i,o,a,s,l){for(var u=0,c=r;c=f)break;m+=v}if(u==c+1){if(m>f){var g=n[c];t(g.children,g.positions,0,g.children.length,r[c]+s);continue}h.push(n[c])}else{var y=r[u-1]+n[u-1].length-p;h.push(kh(e,n,r,c,u,p,y,null,l))}d.push(p+s-o)}}(t,n,r,i,0),(s||l)(h,d,a)}var xh=function(){function e(t,n,r,i){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];p(this,e),this.from=t,this.to=n,this.tree=r,this.offset=i,this.open=(o?1:0)|(a?2:0)}return y(e,[{key:"openStart",get:function(){return(1&this.open)>0}},{key:"openEnd",get:function(){return(2&this.open)>0}}],[{key:"addTree",value:function(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=[new e(0,t.length,t,0,!1,i)],a=T(r);try{for(a.s();!(n=a.n()).done;){var s=n.value;s.to>t.length&&o.push(s)}}catch(l){a.e(l)}finally{a.f()}return o}},{key:"applyChanges",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:128;if(!n.length)return t;for(var i=[],o=1,a=t.length?t[0]:null,s=0,l=0,u=0;;s++){var c=s=r)for(;a&&a.from=h.from||f<=h.to||u){var d=Math.max(h.from,l)-u,p=Math.min(h.to,f)-u;h=d>=p?null:new e(d,p,h.tree,h.offset+u,s>0,!!c)}if(h&&i.push(h),a.to>f)break;a=o-1?t:Th.get(t.base||t,t.modified.concat(e).sort((function(e,t){return e.id-t.id})))}}}]),e}(),Eh=0,Th=function(){function e(){p(this,e),this.instances=[],this.id=Eh++}return y(e,null,[{key:"get",value:function(t,n){if(!n.length)return t;var r=n[0].instances.find((function(e){return e.base==t&&function(e,t){return e.length==t.length&&e.every((function(e,n){return e==t[n]}))}(n,e.modified)}));if(r)return r;var i,o=[],a=new Mh(o,t,n),s=T(n);try{for(s.s();!(i=s.n()).done;){i.value.instances.push(a)}}catch(m){s.e(m)}finally{s.f()}var l,u=function(e){for(var t=[[]],n=0;n0&&c+3==a.length){l=1;break}var f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(u);if(!f)throw new RangeError("Invalid path: "+a);if(s.push("*"==f[0]?"":'"'==f[0][0]?JSON.parse(f[0]):f[0]),(c+=f[0].length)==a.length)break;var h=a[c++];if(c==a.length&&"!"==h){l=0;break}if("/"!=h)throw new RangeError("Invalid path: "+a);u=a.slice(c)}var d=s.length-1,p=s[d];if(!p)throw new RangeError("Invalid path: "+a);var m=new Dh(r,l,d>0?s.slice(0,d):null);t[p]=m.sort(t[p])}}}catch(v){o.e(v)}finally{o.f()}}return _h.add(t)}var _h=new eh,Dh=function(){function e(t,n,r,i){p(this,e),this.tags=t,this.mode=n,this.context=r,this.next=i}return y(e,[{key:"opaque",get:function(){return 0==this.mode}},{key:"inherit",get:function(){return 1==this.mode}},{key:"sort",value:function(e){return!e||e.depth