homeassistant/custom_components/hacs/hacs_frontend_experimental/frontend_es5/2562.Ciqv7fC2yh4.js
2025-01-10 21:08:35 -08:00

2 lines
No EOL
1 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";(self.webpackChunkhacs_frontend=self.webpackChunkhacs_frontend||[]).push([[2562],{33232:function(t){var e=RangeError;t.exports=function(t){if(t==t)return t;throw new e("NaN is not allowed")}},45882:function(t,e,n){var i=n(68077),r=n(19480),o=n(10228),s=n(97673),a=n(90476);i({target:"Array",proto:!0},{at:function(t){var e=r(this),n=o(e),i=s(t),a=i>=0?i:n+i;return a<0||a>=n?void 0:e[a]}}),a("at")},71779:function(t,e,n){var i=n(5813),r=n(58849),o=n(40030),s=n(85891),a=n(18431),h=i.RegExp,u=h.prototype;r&&a((function(){var t=!0;try{h(".","d")}catch(a){t=!1}var e={},n="",i=t?"dgimsy":"gimsy",r=function(t,i){Object.defineProperty(e,t,{get:function(){return n+=i,!0}})},o={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var s in t&&(o.hasIndices="d"),o)r(s,o[s]);return Object.getOwnPropertyDescriptor(u,"flags").get.call(e)!==i||n!==i}))&&o(u,"flags",{configurable:!0,get:s})},37724:function(t,e,n){var i=n(68077),r=n(55418),o=n(43313),s=n(97673),a=n(11336),h=n(18431),u=r("".charAt);i({target:"String",proto:!0,forced:h((function(){return"\ud842"!=="𠮷".at(-2)}))},{at:function(t){var e=a(o(this)),n=e.length,i=s(t),r=i>=0?i:n+i;return r<0||r>=n?void 0:u(e,r)}})},7507:function(t,e,n){var i=n(68077),r=n(14265);i({target:"String",proto:!0,forced:n(24089)("link")},{link:function(t){return r(this,"a","href",t)}})},86658:function(t,e,n){var i=n(68077),r=n(43173),o=n(74734),s=n(54398),a=n(85501),h=n(43313),u=n(97142),l=n(11336),c=n(22933),f=n(59317),d=n(42458),v=n(90744),g=n(78287),p=n(54339),m=n(73936),y=n(18431),k=n(10282),w=n(51048),b=n(18513),x=n(94448),S=n(12648),A=n(95448),M=k("matchAll"),Z="RegExp String",C=Z+" Iterator",O=S.set,T=S.getterFor(C),D=RegExp.prototype,E=TypeError,B=o("".indexOf),R=o("".matchAll),I=!!R&&!y((function(){R("a",/./)})),P=s((function(t,e,n,i){O(this,{type:C,regexp:t,string:e,global:n,unicode:i,done:!1})}),Z,(function(){var t=T(this);if(t.done)return a(void 0,!0);var e=t.regexp,n=t.string,i=x(e,n);return null===i?(t.done=!0,a(void 0,!0)):t.global?(""===l(i[0])&&(e.lastIndex=b(n,u(e.lastIndex),t.unicode)),a(i,!1)):(t.done=!0,a(i,!1))})),N=function(t){var e,n,i,r=c(this),o=l(t),s=w(r,RegExp),a=l(g(r));return e=new s(s===RegExp?r.source:r,a),n=!!~B(a,"g"),i=!!~B(a,"u"),e.lastIndex=u(r.lastIndex),new P(e,o,n,i)};i({target:"String",proto:!0,forced:I},{matchAll:function(t){var e,n,i,o,s=h(this);if(f(t)){if(I)return R(s,t)}else{if(v(t)&&(e=l(h(g(t))),!~B(e,"g")))throw new E("`.matchAll` does not allow non-global regexes");if(I)return R(s,t);if(void 0===(i=p(t,M))&&A&&"RegExp"===d(t)&&(i=N),i)return r(i,t,s)}return n=l(s),o=new RegExp(t,"g"),A?r(N,o,n):o[M](n)}}),A||M in D||m(D,M,N)},12397:function(t,e,n){n(78950)("Uint16",(function(t){return function(e,n,i){return t(this,e,n,i)}}))},75164:function(t,e,n){var i=n(68077),r=n(43173),o=n(22933),s=n(73177),a=n(33232),h=n(22719),u=n(8900),l=n(95448),c=u((function(){for(var t,e=this.iterator,n=this.next;this.remaining;)if(this.remaining--,t=o(r(n,e)),this.done=!!t.done)return;if(t=o(r(n,e)),!(this.done=!!t.done))return t.value}));i({target:"Iterator",proto:!0,real:!0,forced:l},{drop:function(t){o(this);var e=h(a(+t));return new c(s(this),{remaining:e})}})},49089:function(t,e,n){var i=n(68077),r=n(72208),o=n(9160),s=n(22933),a=n(73177);i({target:"Iterator",proto:!0,real:!0},{every:function(t){s(this),o(t);var e=a(this),n=0;return!r(e,(function(e,i){if(!t(e,n++))return i()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},54299:function(t,e,n){var i=n(68077),r=n(43173);i({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return r(URL.prototype.toString,this)}})},90561:function(t,e,n){n.d(e,{ys:function(){return X}});var i=n(76775),r=n(68308),o=n(69205),s=n(46097),a=n(62746),h=n(40039),u=n(71650),l=n(33368),c=(n(56308),n(22859),n(17692),n(63789),n(35221),n(36513),n(91989),n(65974),n(99397),n(24074),n(97393),n(10999),n(52117),n(82479),n(94570),n(46349),n(70320),n(46798),n(9849),n(49089),n(18098),n(71779),n(85717),n(51358),n(5239),n(39685),n(98490),n(57778),n(37313),n(13526),n(87438),n(22890),n(34997),n(12148),n(85472),n(90126),n(41353),n(47084),n(80641),n(74075)),f=n(58626),d=n(67289),v=function(){function t(e,n,i){(0,u.Z)(this,t),this.state=e,this.pos=n,this.explicit=i,this.abortListeners=[]}return(0,l.Z)(t,[{key:"tokenBefore",value:function(t){for(var e=(0,d.qz)(this.state).resolveInner(this.pos,-1);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(t){var e=this.state.doc.lineAt(this.pos),n=Math.max(e.from,this.pos-250),i=e.text.slice(n-e.from,this.pos-e.from),r=i.search(k(t,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}},{key:"aborted",get:function(){return null==this.abortListeners}},{key:"addEventListener",value:function(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}]),t}();function g(t){var e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),"[".concat(n?"\\w":"").concat(e.replace(/[^\w\s]/g,"\\$&"),"]")}function p(t){var e=t.map((function(t){return"string"==typeof t?{label:t}:t})),n=e.every((function(t){return/^\w+$/.test(t.label)}))?[/\w*$/,/\w+$/]:function(t){var e,n=Object.create(null),i=Object.create(null),r=(0,h.Z)(t);try{for(r.s();!(e=r.n()).done;){var o=e.value.label;n[o[0]]=!0;for(var s=1;s<o.length;s++)i[o[s]]=!0}}catch(u){r.e(u)}finally{r.f()}var a=g(n)+g(i)+"*$";return[new RegExp("^"+a),new RegExp(a)]}(e),i=(0,a.Z)(n,2),r=i[0],o=i[1];return function(t){var n=t.matchBefore(o);return n||t.explicit?{from:n?n.from:t.pos,options:e,validFor:r}:null}}var m=(0,l.Z)((function t(e,n,i,r){(0,u.Z)(this,t),this.completion=e,this.source=n,this.match=i,this.score=r}));function y(t){return t.selection.main.from}function k(t,e){var n,i=t.source,r=e&&"^"!=i[0],o="$"!=i[i.length-1];return r||o?new RegExp("".concat(r?"^":"","(?:").concat(i,")").concat(o?"$":""),null!==(n=t.flags)&&void 0!==n?n:t.ignoreCase?"i":""):t}var w=c.q6.define();var b=new WeakMap;function x(t){if(!Array.isArray(t))return t;var e=b.get(t);return e||b.set(t,e=p(t)),e}var S=c.Py.define(),A=c.Py.define(),M=function(){function t(e){(0,u.Z)(this,t),this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(var n=0;n<e.length;){var i=(0,c.gm)(e,n),r=(0,c.nZ)(i);this.chars.push(i);var o=e.slice(n,n+r),s=o.toUpperCase();this.folded.push((0,c.gm)(s==o?o.toLowerCase():s,0)),n+=r}this.astral=e.length!=this.chars.length}return(0,l.Z)(t,[{key:"ret",value:function(t,e){return this.score=t,this.matched=e,!0}},{key:"match",value:function(t){if(0==this.pattern.length)return this.ret(-100,[]);if(t.length<this.pattern.length)return!1;var e=this.chars,n=this.folded,i=this.any,r=this.precise,o=this.byWord;if(1==e.length){var s=(0,c.gm)(t,0),a=(0,c.nZ)(s),h=a==t.length?0:-100;if(s==e[0]);else{if(s!=n[0])return!1;h+=-200}return this.ret(h,[0,a])}var u=t.indexOf(this.pattern);if(0==u)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);var l=e.length,f=0;if(u<0){for(var d=0,v=Math.min(t.length,200);d<v&&f<l;){var g=(0,c.gm)(t,d);g!=e[f]&&g!=n[f]||(i[f++]=d),d+=(0,c.nZ)(g)}if(f<l)return!1}for(var p=0,m=0,y=!1,k=0,w=-1,b=-1,x=/[a-z]/.test(t),S=!0,A=0,M=Math.min(t.length,200),Z=0;A<M&&m<l;){var C=(0,c.gm)(t,A);u<0&&(p<l&&C==e[p]&&(r[p++]=A),k<l&&(C==e[k]||C==n[k]?(0==k&&(w=A),b=A+1,k++):k=0));var O=void 0,T=C<255?C>=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(O=(0,c.bg)(C))!=O.toLowerCase()?1:O!=O.toUpperCase()?2:0;(!A||1==T&&x||0==Z&&0!=T)&&(e[m]==C||n[m]==C&&(y=!0)?o[m++]=A:o.length&&(S=!1)),Z=T,A+=(0,c.nZ)(C)}return m==l&&0==o[0]&&S?this.result((y?-200:0)-100,o,t):k==l&&0==w?this.ret(-200-t.length+(b==t.length?0:-100),[0,b]):u>-1?this.ret(-700-t.length,[u,u+this.pattern.length]):k==l?this.ret(-900-t.length,[w,b]):m==l?this.result((y?-200:0)-100-700+(S?0:-1100),o,t):2!=e.length&&this.result((i[0]?-700:0)-200-1100,i,t)}},{key:"result",value:function(t,e,n){var i,r=[],o=0,s=(0,h.Z)(e);try{for(s.s();!(i=s.n()).done;){var a=i.value,u=a+(this.astral?(0,c.nZ)((0,c.gm)(n,a)):1);o&&r[o-1]==a?r[o-1]=u:(r[o++]=a,r[o++]=u)}}catch(l){s.e(l)}finally{s.f()}return this.ret(t-n.length,r)}}]),t}(),Z=c.r$.define({combine:function(t){return(0,c.BO)(t,{activateOnTyping:!0,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:function(){return""},optionClass:function(){return""},aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:O,compareCompletions:function(t,e){return t.label.localeCompare(e.label)},interactionDelay:75,updateSyncTime:100},{defaultKeymap:function(t,e){return t&&e},closeOnBlur:function(t,e){return t&&e},icons:function(t,e){return t&&e},tooltipClass:function(t,e){return function(n){return C(t(n),e(n))}},optionClass:function(t,e){return function(n){return C(t(n),e(n))}},addToOptions:function(t,e){return t.concat(e)}})}});function C(t,e){return t?e?t+" "+e:t:e}function O(t,e,n,i,r,o){var s,a,h=t.textDirection==f.Nm.RTL,u=h,l=!1,c="top",d=e.left-r.left,v=r.right-e.right,g=i.right-i.left,p=i.bottom-i.top;if(u&&d<Math.min(g,v)?u=!1:!u&&v<Math.min(g,d)&&(u=!0),g<=(u?d:v))s=Math.max(r.top,Math.min(n.top,r.bottom-p))-e.top,a=Math.min(400,u?d:v);else{l=!0,a=Math.min(400,(h?e.right:r.right-e.left)-30);var m=r.bottom-e.bottom;m>=p||m>e.top?s=n.bottom-e.top:(c="bottom",s=e.bottom-n.top)}var y=(e.bottom-e.top)/o.offsetHeight,k=(e.right-e.left)/o.offsetWidth;return{style:"".concat(c,": ").concat(s/y,"px; max-width: ").concat(a/k,"px"),class:"cm-completionInfo-"+(l?h?"left-narrow":"right-narrow":u?"left":"right")}}function T(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){var i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}var r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}var D=function(){function t(e,n,i){var r=this;(0,u.Z)(this,t),this.view=e,this.stateField=n,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:function(){return r.measureInfo()},write:function(t){return r.placeInfo(t)},key:this},this.space=null,this.currentClass="";var o=e.state.field(n),a=o.open,h=a.options,l=a.selected,c=e.state.facet(Z);this.optionContent=function(t){var e=t.addToOptions.slice();return t.icons&&e.push({render:function(t){var e,n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&(e=n.classList).add.apply(e,(0,s.Z)(t.type.split(/\s+/g).map((function(t){return"cm-completionIcon-"+t})))),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render:function(t,e,n,i){var r=document.createElement("span");r.className="cm-completionLabel";for(var o=t.displayLabel||t.label,s=0,a=0;a<i.length;){var h=i[a++],u=i[a++];h>s&&r.appendChild(document.createTextNode(o.slice(s,h)));var l=r.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(o.slice(h,u))),l.className="cm-completionMatchedText",s=u}return s<o.length&&r.appendChild(document.createTextNode(o.slice(s))),r},position:50},{render:function(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}))}(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=T(h.length,l,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",(function(t){for(var i,o=e.state.field(n).open.options,s=t.target;s&&s!=r.dom;s=s.parentNode)if("LI"==s.nodeName&&(i=/-(\d+)$/.exec(s.id))&&+i[1]<o.length)return r.applyCompletion(e,o[+i[1]]),void t.preventDefault()})),this.dom.addEventListener("focusout",(function(t){var n=e.state.field(r.stateField,!1);n&&n.tooltip&&e.state.facet(Z).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:A.of(null)})})),this.showOptions(h,o.id)}return(0,l.Z)(t,[{key:"mount",value:function(){this.updateSel()}},{key:"showOptions",value:function(t,e){var n=this;this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener("scroll",(function(){n.info&&n.view.requestMeasure(n.placeInfoReq)}))}},{key:"update",value:function(t){var e,n=t.state.field(this.stateField),i=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),n!=i){var r=n.open,o=r.options,s=r.selected,a=r.disabled;i.open&&i.open.options==o||(this.range=T(o.length,s,t.state.facet(Z).maxRenderedOptions),this.showOptions(o,n.id)),this.updateSel(),a!=(null===(e=i.open)||void 0===e?void 0:e.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}},{key:"updateTooltipClass",value:function(t){var e=this.tooltipClass(t);if(e!=this.currentClass){var n,i=(0,h.Z)(this.currentClass.split(" "));try{for(i.s();!(n=i.n()).done;){var r=n.value;r&&this.dom.classList.remove(r)}}catch(u){i.e(u)}finally{i.f()}var o,s=(0,h.Z)(e.split(" "));try{for(s.s();!(o=s.n()).done;){var a=o.value;a&&this.dom.classList.add(a)}}catch(u){s.e(u)}finally{s.f()}this.currentClass=e}}},{key:"positioned",value:function(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSel",value:function(){var t=this,e=this.view.state.field(this.stateField),n=e.open;if((n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=T(n.options.length,n.selected,this.view.state.facet(Z).maxRenderedOptions),this.showOptions(n.options,e.id)),this.updateSelectedOption(n.selected)){this.destroyInfo();var i=n.options[n.selected].completion,r=i.info;if(!r)return;var o="string"==typeof r?document.createTextNode(r):r(i);if(!o)return;"then"in o?o.then((function(n){n&&t.view.state.field(t.stateField,!1)==e&&t.addInfoPane(n,i)})).catch((function(e){return(0,f.OO)(t.view.state,e,"completion info")})):this.addInfoPane(o,i)}}},{key:"addInfoPane",value:function(t,e){this.destroyInfo();var n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",null!=t.nodeType)n.appendChild(t),this.infoDestroy=null;else{var i=t.dom,r=t.destroy;n.appendChild(i),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSelectedOption",value:function(t){for(var e=null,n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)"LI"==n.nodeName&&n.id?i==t?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),e=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected"):i--;return e&&function(t,e){var n=t.getBoundingClientRect(),i=e.getBoundingClientRect(),r=n.height/t.offsetHeight;i.top<n.top?t.scrollTop-=(n.top-i.top)/r:i.bottom>n.bottom&&(t.scrollTop+=(i.bottom-n.bottom)/r)}(this.list,e),e}},{key:"measureInfo",value:function(){var t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;var e=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=t.getBoundingClientRect(),r=this.space;if(!r){var o=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return i.top>Math.min(r.bottom,e.bottom)-10||i.bottom<Math.max(r.top,e.top)+10?null:this.view.state.facet(Z).positionInfo(this.view,e,i,n,r,this.dom)}},{key:"placeInfo",value:function(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(t,e,n){var i=document.createElement("ul");i.id=e,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions"));for(var r=null,o=n.from;o<n.to;o++){var s=t[o],a=s.completion,u=s.match,l=a.section;if(l){var c="string"==typeof l?l:l.name;if(c!=r&&(o>n.from||0==n.from))if(r=c,"string"!=typeof l&&l.header)i.appendChild(l.header(l));else i.appendChild(document.createElement("completion-section")).textContent=c}var f=i.appendChild(document.createElement("li"));f.id=e+"-"+o,f.setAttribute("role","option");var d=this.optionClass(a);d&&(f.className=d);var v,g=(0,h.Z)(this.optionContent);try{for(g.s();!(v=g.n()).done;){var p=(0,v.value)(a,this.view.state,this.view,u);p&&f.appendChild(p)}}catch(m){g.e(m)}finally{g.f()}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<t.length&&i.classList.add("cm-completionListIncompleteBottom"),i}},{key:"destroyInfo",value:function(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}},{key:"destroy",value:function(){this.destroyInfo()}}]),t}();function E(t,e){return function(n){return new D(n,t,e)}}function B(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}var R=function(){function t(e,n,i,r,o,s){(0,u.Z)(this,t),this.options=e,this.attrs=n,this.tooltip=i,this.timestamp=r,this.selected=o,this.disabled=s}return(0,l.Z)(t,[{key:"setSelected",value:function(e,n){return e==this.selected||e>=this.options.length?this:new t(this.options,N(n,e),this.tooltip,this.timestamp,e,this.disabled)}},{key:"map",value:function(e){return new t(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}],[{key:"build",value:function(e,n,i,r,o){var s=function(t,e){var n,i=[],r=null,o=function(t){i.push(t);var e=t.completion.section;if(e){r||(r=[]);var n="string"==typeof e?e:e.name;r.some((function(t){return t.name==n}))||r.push("string"==typeof e?{name:n}:e)}},s=(0,h.Z)(t);try{for(s.s();!(n=s.n()).done;){var a=n.value;if(a.hasResult()){var u=a.result.getMatch;if(!1===a.result.filter){var l,c=(0,h.Z)(a.result.options);try{for(c.s();!(l=c.n()).done;){var f=l.value;o(new m(f,a.source,u?u(f):[],1e9-i.length))}}catch(V){c.e(V)}finally{c.f()}}else{var d,v=new M(e.sliceDoc(a.from,a.to)),g=(0,h.Z)(a.result.options);try{for(g.s();!(d=g.n()).done;){var p=d.value;if(v.match(p.label)){var y=p.displayLabel?u?u(p,v.matched):[]:v.matched;o(new m(p,a.source,y,v.score+(p.boost||0)))}}}catch(V){g.e(V)}finally{g.f()}}}}}catch(V){s.e(V)}finally{s.f()}if(r){var k,w=Object.create(null),b=0,x=(0,h.Z)(r.sort((function(t,e){var n,i;return(null!==(n=t.rank)&&void 0!==n?n:1e9)-(null!==(i=e.rank)&&void 0!==i?i:1e9)||(t.name<e.name?-1:1)})));try{for(x.s();!(k=x.n()).done;){var S=k.value;b-=1e5,w[S.name]=b}}catch(V){x.e(V)}finally{x.f()}var A,C=(0,h.Z)(i);try{for(C.s();!(A=C.n()).done;){var O=A.value,T=O.completion.section;T&&(O.score+=w["string"==typeof T?T:T.name])}}catch(V){C.e(V)}finally{C.f()}}var D,E=[],R=null,I=e.facet(Z).compareCompletions,P=(0,h.Z)(i.sort((function(t,e){return e.score-t.score||I(t.completion,e.completion)})));try{for(P.s();!(D=P.n()).done;){var N=D.value,L=N.completion;!R||R.label!=L.label||R.detail!=L.detail||null!=R.type&&null!=L.type&&R.type!=L.type||R.apply!=L.apply||R.boost!=L.boost?E.push(N):B(N.completion)>B(R)&&(E[E.length-1]=N),R=N.completion}}catch(V){P.e(V)}finally{P.f()}return E}(e,n);if(!s.length)return r&&e.some((function(t){return 1==t.state}))?new t(r.options,r.attrs,r.tooltip,r.timestamp,r.selected,!0):null;var a=n.facet(Z).selectOnOpen?0:-1;if(r&&r.selected!=a&&-1!=r.selected)for(var u=r.options[r.selected].completion,l=0;l<s.length;l++)if(s[l].completion==u){a=l;break}return new t(s,N(i,a),{pos:e.reduce((function(t,e){return e.hasResult()?Math.min(t,e.from):t}),1e8),create:j,above:o.aboveCursor},r?r.timestamp:Date.now(),a,!1)}}]),t}(),I=function(){function t(e,n,i){(0,u.Z)(this,t),this.active=e,this.id=n,this.open=i}return(0,l.Z)(t,[{key:"update",value:function(e){var n=this,i=e.state,r=i.facet(Z),o=(r.override||i.languageDataAt("autocomplete",y(i)).map(x)).map((function(t){return(n.active.find((function(e){return e.source==t}))||new H(t,n.active.some((function(t){return 0!=t.state}))?1:0)).update(e,r)}));o.length==this.active.length&&o.every((function(t,e){return t==n.active[e]}))&&(o=this.active);var s=this.open;s&&e.docChanged&&(s=s.map(e.changes)),e.selection||o.some((function(t){return t.hasResult()&&e.changes.touchesRange(t.from,t.to)}))||!function(t,e){if(t==e)return!0;for(var n=0,i=0;;){for(;n<t.length&&!t[n].hasResult;)n++;for(;i<e.length&&!e[i].hasResult;)i++;var r=n==t.length,o=i==e.length;if(r||o)return r==o;if(t[n++].result!=e[i++].result)return!1}}(o,this.active)?s=R.build(o,i,this.id,s,r):s&&s.disabled&&!o.some((function(t){return 1==t.state}))&&(s=null),!s&&o.every((function(t){return 1!=t.state}))&&o.some((function(t){return t.hasResult()}))&&(o=o.map((function(t){return t.hasResult()?new H(t.source,0):t})));var a,u=(0,h.Z)(e.effects);try{for(u.s();!(a=u.n()).done;){var l=a.value;l.is(z)&&(s=s&&s.setSelected(l.value,this.id))}}catch(c){u.e(c)}finally{u.f()}return o==this.active&&s==this.open?this:new t(o,this.id,s)}},{key:"tooltip",get:function(){return this.open?this.open.tooltip:null}},{key:"attrs",get:function(){return this.open?this.open.attrs:P}}],[{key:"start",value:function(){return new t(L,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}}]),t}();var P={"aria-autocomplete":"list"};function N(t,e){var n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return e>-1&&(n["aria-activedescendant"]=t+"-"+e),n}var L=[];function V(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}var H=function(){function t(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;(0,u.Z)(this,t),this.source=e,this.state=n,this.explicitPos=i}return(0,l.Z)(t,[{key:"hasResult",value:function(){return!1}},{key:"update",value:function(e,n){var i=V(e),r=this;i?r=r.handleUserEvent(e,i,n):e.docChanged?r=r.handleChange(e):e.selection&&0!=r.state&&(r=new t(r.source,0));var o,s=(0,h.Z)(e.effects);try{for(s.s();!(o=s.n()).done;){var a=o.value;if(a.is(S))r=new t(r.source,1,a.value?y(e.state):-1);else if(a.is(A))r=new t(r.source,0);else if(a.is(_)){var u,l=(0,h.Z)(a.value);try{for(l.s();!(u=l.n()).done;){var c=u.value;c.source==r.source&&(r=c)}}catch(f){l.e(f)}finally{l.f()}}}}catch(f){s.e(f)}finally{s.f()}return r}},{key:"handleUserEvent",value:function(e,n,i){return"delete"!=n&&i.activateOnTyping?new t(this.source,1):this.map(e.changes)}},{key:"handleChange",value:function(e){return e.changes.touchesRange(y(e.startState))?new t(this.source,0):this.map(e.changes)}},{key:"map",value:function(e){return e.empty||this.explicitPos<0?this:new t(this.source,this.state,e.mapPos(this.explicitPos))}}]),t}(),W=function(t){function e(t,n,i,o,s){var a;return(0,u.Z)(this,e),(a=(0,r.Z)(this,e,[t,2,n])).result=i,a.from=o,a.to=s,a}return(0,o.Z)(e,t),(0,l.Z)(e,[{key:"hasResult",value:function(){return!0}},{key:"handleUserEvent",value:function(t,n,i){var r,o=t.changes.mapPos(this.from),s=t.changes.mapPos(this.to,1),a=y(t.state);if((this.explicitPos<0?a<=o:a<this.from)||a>s||"delete"==n&&y(t.startState)==this.from)return new H(this.source,"input"==n&&i.activateOnTyping?1:0);var h,u=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,n,i){if(!t)return!1;var r=e.sliceDoc(n,i);return"function"==typeof t?t(r,n,i,e):k(t,!0).test(r)}(this.result.validFor,t.state,o,s)?new e(this.source,u,this.result,o,s):this.result.update&&(h=this.result.update(this.result,o,s,new v(t.state,a,u>=0)))?new e(this.source,u,h,h.from,null!==(r=h.to)&&void 0!==r?r:y(t.state)):new H(this.source,1,u)}},{key:"handleChange",value:function(t){return t.changes.touchesRange(this.from,this.to)?new H(this.source,0):this.map(t.changes)}},{key:"map",value:function(t){return t.empty?this:new e(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}}]),e}(H);var _=c.Py.define({map:function(t,e){return t.map((function(t){return t.map(e)}))}}),z=c.Py.define(),F=c.QQ.define({create:function(){return I.start()},update:function(t,e){return t.update(e)},provide:function(t){return[f.hJ.from(t,(function(t){return t.tooltip})),f.tk.contentAttributes.from(t,(function(t){return t.attrs}))]}});function q(t,e){var n,i,r,o,s,a,h,u=e.completion.apply||e.completion.label,l=t.state.field(F).active.find((function(t){return t.source==e.source}));return l instanceof W&&("string"==typeof u?t.dispatch(Object.assign(Object.assign({},(n=t.state,i=u,r=l.from,o=l.to,s=n.selection.main,a=r-s.from,h=o-s.from,Object.assign(Object.assign({},n.changeByRange((function(t){return t!=s&&r!=o&&n.sliceDoc(t.from+a,t.from+h)!=n.sliceDoc(r,o)?{range:t}:{changes:{from:t.from+a,to:o==s.from?t.to:t.from+h,insert:i},range:c.jT.cursor(t.from+a+i.length)}}))),{scrollIntoView:!0,userEvent:"input.complete"}))),{annotations:w.of(e.completion)})):u(t,e.completion,l.from,l.to),!0)}var j=E(F,q);function K(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"option";return function(n){var i=n.state.field(F,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(Z).interactionDelay)return!1;var r,o=1;"page"==e&&(r=(0,f.gB)(n,i.open.tooltip))&&(o=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1));var s=i.open.options.length,a=i.open.selected>-1?i.open.selected+o*(t?1:-1):t?0:s-1;return a<0?a="page"==e?0:s-1:a>=s&&(a="page"==e?s-1:0),n.dispatch({effects:z.of(a)}),!0}}var J=(0,l.Z)((function t(e,n){(0,u.Z)(this,t),this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0})),U=f.lg.fromClass(function(){function t(e){(0,u.Z)(this,t),this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;var n,i=(0,h.Z)(e.state.field(F).active);try{for(i.s();!(n=i.n()).done;){var r=n.value;1==r.state&&this.startQuery(r)}}catch(o){i.e(o)}finally{i.f()}}return(0,l.Z)(t,[{key:"update",value:function(t){var e=this,n=t.state.field(F);if(t.selectionSet||t.docChanged||t.startState.field(F)!=n){for(var i=t.transactions.some((function(t){return(t.selection||t.docChanged)&&!V(t)})),r=0;r<this.running.length;r++){var o=this.running[r];if(i||o.updates.length+t.transactions.length>50&&Date.now()-o.time>1e3){var a,u=(0,h.Z)(o.context.abortListeners);try{for(u.s();!(a=u.n()).done;){var l=a.value;try{l()}catch(m){(0,f.OO)(this.view.state,m)}}}catch(y){u.e(y)}finally{u.f()}o.context.abortListeners=null,this.running.splice(r--,1)}else{var c;(c=o.updates).push.apply(c,(0,s.Z)(t.transactions))}}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some((function(t){return t.effects.some((function(t){return t.is(S)}))}))&&(this.pendingStart=!0);var d=this.pendingStart?50:t.state.facet(Z).activateOnTypingDelay;if(this.debounceUpdate=n.active.some((function(t){return 1==t.state&&!e.running.some((function(e){return e.active.source==t.source}))}))?setTimeout((function(){return e.startUpdate()}),d):-1,0!=this.composing){var v,g=(0,h.Z)(t.transactions);try{for(g.s();!(v=g.n()).done;){var p=v.value;"input"==V(p)?this.composing=2:2==this.composing&&p.selection&&(this.composing=3)}}catch(y){g.e(y)}finally{g.f()}}}}},{key:"startUpdate",value:function(){var t=this;this.debounceUpdate=-1,this.pendingStart=!1;var e,n=this.view.state.field(F),i=(0,h.Z)(n.active);try{var r=function(){var n=e.value;1!=n.state||t.running.some((function(t){return t.active.source==n.source}))||t.startQuery(n)};for(i.s();!(e=i.n()).done;)r()}catch(o){i.e(o)}finally{i.f()}}},{key:"startQuery",value:function(t){var e=this,n=this.view.state,i=y(n),r=new v(n,i,t.explicitPos==i),o=new J(t,r);this.running.push(o),Promise.resolve(t.source(r)).then((function(t){o.context.aborted||(o.done=t||null,e.scheduleAccept())}),(function(t){e.view.dispatch({effects:A.of(null)}),(0,f.OO)(e.view.state,t)}))}},{key:"scheduleAccept",value:function(){var t=this;this.running.every((function(t){return void 0!==t.done}))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((function(){return t.accept()}),this.view.state.facet(Z).updateSyncTime))}},{key:"accept",value:function(){var t,e=this;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;for(var n=[],i=this.view.state.facet(Z),r=function(r){var s=e.running[r];if(void 0===s.done)return o=r,0;if(e.running.splice(r--,1),s.done){var a,u=new W(s.active.source,s.active.explicitPos,s.done,s.done.from,null!==(t=s.done.to)&&void 0!==t?t:y(s.updates.length?s.updates[0].startState:e.view.state)),l=(0,h.Z)(s.updates);try{for(l.s();!(a=l.n()).done;){var c=a.value;u=u.update(c,i)}}catch(m){l.e(m)}finally{l.f()}if(u.hasResult())return n.push(u),o=r,0}var f=e.view.state.field(F).active.find((function(t){return t.source==s.active.source}));if(f&&1==f.state)if(null==s.done){var d,v=new H(s.active.source,0),g=(0,h.Z)(s.updates);try{for(g.s();!(d=g.n()).done;){var p=d.value;v=v.update(p,i)}}catch(m){g.e(m)}finally{g.f()}1!=v.state&&n.push(v)}else e.startQuery(f);o=r},o=0;o<this.running.length;o++)r(o);n.length&&this.view.dispatch({effects:_.of(n)})}}]),t}(),{eventHandlers:{blur:function(t){var e=this,n=this.view.state.field(F,!1);if(n&&n.tooltip&&this.view.state.facet(Z).closeOnBlur){var i=n.open&&(0,f.gB)(this.view,n.open.tooltip);i&&i.dom.contains(t.relatedTarget)||setTimeout((function(){return e.view.dispatch({effects:A.of(null)})}),10)}},compositionstart:function(){this.composing=1},compositionend:function(){var t=this;3==this.composing&&setTimeout((function(){return t.view.dispatch({effects:S.of(!1)})}),20),this.composing=0}}}),G=f.tk.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:"".concat(400,"px"),boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"".concat(30,"px")},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"".concat(30,"px")},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".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"}}});var $=new(function(t){function e(){return(0,u.Z)(this,e),(0,r.Z)(this,e,arguments)}return(0,o.Z)(e,t),(0,l.Z)(e)}(c.uU));$.startSide=1,$.endSide=-1;"object"==("undefined"==typeof navigator?"undefined":(0,i.Z)(navigator))&&navigator.userAgent;function X(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[F,Z.of(t),U,Q,G]}var Y=[{key:"Ctrl-Space",run:function(t){return!!t.state.field(F,!1)&&(t.dispatch({effects:S.of(!0)}),!0)}},{key:"Escape",run:function(t){var e=t.state.field(F,!1);return!(!e||!e.active.some((function(t){return 0!=t.state})))&&(t.dispatch({effects:A.of(null)}),!0)}},{key:"ArrowDown",run:K(!0)},{key:"ArrowUp",run:K(!1)},{key:"PageDown",run:K(!0,"page")},{key:"PageUp",run:K(!1,"page")},{key:"Enter",run:function(t){var e=t.state.field(F,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<t.state.facet(Z).interactionDelay)&&q(t,e.open.options[e.open.selected])}}],Q=c.Wl.highest(f.$f.computeN([Z],(function(t){return t.facet(Z).defaultKeymap?[Y]:[]})))},65300:function(t,e,n){n.d(e,{wQ:function(){return zl},m8:function(){return Ou},f$:function(){return ju},xi:function(){return _l},at:function(){return Wl}});var i=n(71650),r=n(33368),o=n(40039),s=(n(63789),n(17692),n(99397),n(36513),n(46349),n(70320),n(46798),n(9849),n(49089),n(13526),n(54299),n(97393),n(87438),n(22890),n(32797),n(5239),n(80641),n(35221),n(56308),n(22859),n(74075)),a=n(62746),h=n(82390),u=n(34541),l=n(47838),c=n(68308),f=n(69205),d=n(46097),v=(n(51467),n(41353),n(24074),n(91989),n(57778),n(85472),n(65974),n(71779),n(90126),n(47084),n(75164),n(94570),n(80628),n(37313),n(27392),n(51358),n(96043),n(98490),n(64777),n(39685),n(34997),n(12148),n(78399),n(56086),n(47884),n(81912),n(64584),n(41483),n(12367),n(9454),n(10999),n(52117),n(82479),n(85717),n(73855),n(94738),n(98214),n(20254),n(50289),n(94167),n(86439),function(){function t(){(0,i.Z)(this,t)}return(0,r.Z)(t,[{key:"lineAt",value:function(t){if(t<0||t>this.length)throw new RangeError("Invalid position ".concat(t," in document of length ").concat(this.length));return this.lineInner(t,!1,1,0)}},{key:"line",value:function(t){if(t<1||t>this.lines)throw new RangeError("Invalid line number ".concat(t," in ").concat(this.lines,"-line document"));return this.lineInner(t,!0,1,0)}},{key:"replace",value:function(t,e,n){var i=[];return this.decompose(0,t,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(e,this.length,i,1),p.from(i,this.length-(e-t)+n.length)}},{key:"append",value:function(t){return this.replace(this.length,this.length,t)}},{key:"slice",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=[];return this.decompose(t,e,n,0),p.from(n,e-t)}},{key:"eq",value:function(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;for(var e=this.scanIdentical(t,1),n=this.length-this.scanIdentical(t,-1),i=new k(this),r=new k(t),o=e,s=e;;){if(i.next(o),r.next(o),o=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}},{key:"iter",value:function(){return new k(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)}},{key:"iterRange",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return new w(this,t,e)}},{key:"iterLines",value:function(t,e){var n;if(null==t)n=this.iter();else{null==e&&(e=this.lines+1);var i=this.line(t).from;n=this.iterRange(i,Math.max(i,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new b(n)}},{key:"toString",value:function(){return this.sliceString(0)}},{key:"toJSON",value:function(){var t=[];return this.flatten(t),t}}],[{key:"of",value:function(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new g(e):p.from(g.split(e,[])):t.empty}}]),t}()),g=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){var e,n=-1,i=(0,o.Z)(t);try{for(i.s();!(e=i.n()).done;){n+=e.value.length+1}}catch(r){i.e(r)}finally{i.f()}return n}(t);return(0,i.Z)(this,e),(n=(0,c.Z)(this,e)).text=t,n.length=r,n}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"lines",get:function(){return this.text.length}},{key:"children",get:function(){return null}},{key:"lineInner",value:function(t,e,n,i){for(var r=0;;r++){var o=this.text[r],s=i+o.length;if((e?n:s)>=t)return new x(i,s,n,o);i=s+1,n++}}},{key:"decompose",value:function(t,n,i,r){var o=t<=0&&n>=this.length?this:new e(y(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(1&r){var s=i.pop(),a=m(o.text,s.text.slice(),0,o.length);if(a.length<=32)i.push(new e(a,s.length+o.length));else{var h=a.length>>1;i.push(new e(a.slice(0,h)),new e(a.slice(h)))}}else i.push(o)}},{key:"replace",value:function(t,n,i){if(!(i instanceof e))return(0,u.Z)((0,l.Z)(e.prototype),"replace",this).call(this,t,n,i);var r=m(this.text,m(i.text,y(this.text,0,t)),n),o=this.length+i.length-(n-t);return r.length<=32?new e(r,o):p.from(e.split(r,[]),o)}},{key:"sliceString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",i="",r=0,o=0;r<=e&&o<this.text.length;o++){var s=this.text[o],a=r+s.length;r>t&&o&&(i+=n),t<a&&e>r&&(i+=s.slice(Math.max(0,t-r),e-r)),r=a+1}return i}},{key:"flatten",value:function(t){var e,n=(0,o.Z)(this.text);try{for(n.s();!(e=n.n()).done;){var i=e.value;t.push(i)}}catch(r){n.e(r)}finally{n.f()}}},{key:"scanIdentical",value:function(){return 0}}],[{key:"split",value:function(t,n){var i,r=[],s=-1,a=(0,o.Z)(t);try{for(a.s();!(i=a.n()).done;){var h=i.value;r.push(h),s+=h.length+1,32==r.length&&(n.push(new e(r,s)),r=[],s=-1)}}catch(u){a.e(u)}finally{a.f()}return s>-1&&n.push(new e(r,s)),n}}]),e}(v),p=function(t){function e(t,n){var r;(0,i.Z)(this,e),(r=(0,c.Z)(this,e)).children=t,r.length=n,r.lines=0;var s,a=(0,o.Z)(t);try{for(a.s();!(s=a.n()).done;){var h=s.value;r.lines+=h.lines}}catch(u){a.e(u)}finally{a.f()}return r}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"lineInner",value:function(t,e,n,i){for(var r=0;;r++){var o=this.children[r],s=i+o.length,a=n+o.lines-1;if((e?a:s)>=t)return o.lineInner(t,e,n,i);i=s+1,n=a+1}}},{key:"decompose",value:function(t,e,n,i){for(var r=0,o=0;o<=e&&r<this.children.length;r++){var s=this.children[r],a=o+s.length;if(t<=a&&e>=o){var h=i&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?n.push(s):s.decompose(t-o,e-o,n,h)}o=a+1}}},{key:"replace",value:function(t,n,i){if(i.lines<this.lines)for(var r=0,o=0;r<this.children.length;r++){var s=this.children[r],a=o+s.length;if(t>=o&&n<=a){var h=s.replace(t-o,n-o,i),c=this.lines-s.lines+h.lines;if(h.lines<c>>4&&h.lines>c>>6){var f=this.children.slice();return f[r]=h,new e(f,this.length-(n-t)+i.length)}return(0,u.Z)((0,l.Z)(e.prototype),"replace",this).call(this,o,a,h)}o=a+1}return(0,u.Z)((0,l.Z)(e.prototype),"replace",this).call(this,t,n,i)}},{key:"sliceString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",i="",r=0,o=0;r<this.children.length&&o<=e;r++){var s=this.children[r],a=o+s.length;o>t&&r&&(i+=n),t<a&&e>o&&(i+=s.sliceString(t-o,e-o,n)),o=a+1}return i}},{key:"flatten",value:function(t){var e,n=(0,o.Z)(this.children);try{for(n.s();!(e=n.n()).done;){e.value.flatten(t)}}catch(i){n.e(i)}finally{n.f()}}},{key:"scanIdentical",value:function(t,n){if(!(t instanceof e))return 0;for(var i=0,r=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1],o=(0,a.Z)(r,4),s=o[0],h=o[1],u=o[2],l=o[3];;s+=n,h+=n){if(s==u||h==l)return i;var c=this.children[s],f=t.children[h];if(c!=f)return i+c.scanIdentical(f,n);i+=c.length+1}}}],[{key:"from",value:function(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.reduce((function(t,e){return t+e.length+1}),-1),r=0,s=(0,o.Z)(t);try{for(s.s();!(n=s.n()).done;){r+=n.value.lines}}catch(x){s.e(x)}finally{s.f()}if(r<32){var a,h=[],u=(0,o.Z)(t);try{for(u.s();!(a=u.n()).done;){a.value.flatten(h)}}catch(x){u.e(x)}finally{u.f()}return new g(h,i)}var l=Math.max(32,r>>5),c=l<<1,f=l>>1,d=[],v=0,p=-1,m=[];function y(t){var n;if(t.lines>c&&t instanceof e){var i,r=(0,o.Z)(t.children);try{for(r.s();!(i=r.n()).done;){y(i.value)}}catch(x){r.e(x)}finally{r.f()}}else t.lines>f&&(v>f||!v)?(k(),d.push(t)):t instanceof g&&v&&(n=m[m.length-1])instanceof g&&t.lines+n.lines<=32?(v+=t.lines,p+=t.length+1,m[m.length-1]=new g(n.text.concat(t.text),n.length+1+t.length)):(v+t.lines>l&&k(),v+=t.lines,p+=t.length+1,m.push(t))}function k(){0!=v&&(d.push(1==m.length?m[0]:e.from(m,p)),p=-1,v=m.length=0)}var w,b=(0,o.Z)(t);try{for(b.s();!(w=b.n()).done;){y(w.value)}}catch(x){b.e(x)}finally{b.f()}return k(),1==d.length?d[0]:new e(d,i)}}]),e}(v);function m(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e9,r=0,o=0,s=!0;o<t.length&&r<=i;o++){var a=t[o],h=r+a.length;h>=n&&(h>i&&(a=a.slice(0,i-r)),r<n&&(a=a.slice(n-r)),s?(e[e.length-1]+=a,s=!1):e.push(a)),r=h+1}return e}function y(t,e,n){return m(t,[""],e,n)}v.empty=new g([""],0);var k=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;(0,i.Z)(this,t),this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof g?e.text.length:e.children.length)<<1]}return(0,r.Z)(t,[{key:"nextInner",value:function(t,e){for(this.done=this.lineBreak=!1;;){var n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],o=r>>1,s=i instanceof g?i.text.length:i.children.length;if(o==(e>0?s:0)){if(0==n)return this.done=!0,this.value="",this;e>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(e>0?0:1)){if(this.offsets[n]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(i instanceof g){var a=i.text[o+(e<0?-1:0)];if(this.offsets[n]+=e,a.length>Math.max(0,t))return this.value=0==t?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{var h=i.children[o+(e<0?-1:0)];t>h.length?(t-=h.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(h),this.offsets.push(e>0?1:(h instanceof g?h.text.length:h.children.length)<<1))}}}},{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}]),t}(),w=function(){function t(e,n,r){(0,i.Z)(this,t),this.value="",this.done=!1,this.cursor=new k(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}return(0,r.Z)(t,[{key:"nextInner",value:function(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 n=e<0?this.pos-this.from:this.to-this.pos;t>n&&(t=n),n-=t;var i=this.cursor.next(t).value;return this.pos+=(i.length+t)*e,this.value=i.length<=n?i:e<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}},{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?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(){return this.cursor.lineBreak&&""!=this.value}}]),t}(),b=function(){function t(e){(0,i.Z)(this,t),this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}return(0,r.Z)(t,[{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.inner.next(t),n=e.done,i=e.lineBreak,r=e.value;return n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}},{key:"lineBreak",get:function(){return!1}}]),t}();"undefined"!=typeof Symbol&&(v.prototype[Symbol.iterator]=function(){return this.iter()},k.prototype[Symbol.iterator]=w.prototype[Symbol.iterator]=b.prototype[Symbol.iterator]=function(){return this});for(var x=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.from=e,this.to=n,this.number=r,this.text=o}return(0,r.Z)(t,[{key:"length",get:function(){return this.to-this.from}}]),t}(),S="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})),A=1;A<S.length;A++)S[A]+=S[A-1];function M(t){for(var e=1;e<S.length;e+=2)if(S[e]>t)return S[e-1]<=t;return!1}function Z(t){return t>=127462&&t<=127487}var C=8205;function O(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?T:D)(t,e,!(arguments.length>3&&void 0!==arguments[3])||arguments[3])}function T(t,e,n){if(e==t.length)return e;e&&E(t.charCodeAt(e))&&B(t.charCodeAt(e-1))&&e--;var i=R(t,e);for(e+=I(i);e<t.length;){var r=R(t,e);if(i==C||r==C||n&&M(r))e+=I(r),i=r;else{if(!Z(r))break;for(var o=0,s=e-2;s>=0&&Z(R(t,s));)o++,s-=2;if(o%2==0)break;e+=2}}return e}function D(t,e,n){for(;e>0;){var i=T(t,e-2,n);if(i<e)return i;e--}return 0}function E(t){return t>=56320&&t<57344}function B(t){return t>=55296&&t<56320}function R(t,e){var n=t.charCodeAt(e);if(!B(n)||e+1==t.length)return n;var i=t.charCodeAt(e+1);return E(i)?i-56320+(n-55296<<10)+65536:n}function I(t){return t<65536?1:2}var P=/\r\n?|\n/,N=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(N||(N={})),L=function(){function t(e){(0,i.Z)(this,t),this.sections=e}return(0,r.Z)(t,[{key:"length",get:function(){for(var t=0,e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}},{key:"newLength",get:function(){for(var t=0,e=0;e<this.sections.length;e+=2){var n=this.sections[e+1];t+=n<0?this.sections[e]:n}return t}},{key:"empty",get:function(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}},{key:"iterGaps",value:function(t){for(var e=0,n=0,i=0;e<this.sections.length;){var r=this.sections[e++],o=this.sections[e++];o<0?(t(n,i,r),i+=r):i+=o,n+=r}}},{key:"iterChangedRanges",value:function(t){_(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"invertedDesc",get:function(){for(var e=[],n=0;n<this.sections.length;){var i=this.sections[n++],r=this.sections[n++];r<0?e.push(i,r):e.push(r,i)}return new t(e)}},{key:"composeDesc",value:function(t){return this.empty?t:t.empty?this:F(this,t)}},{key:"mapDesc",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:z(this,t,e)}},{key:"mapPos",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:N.Simple,i=0,r=0,o=0;o<this.sections.length;){var s=this.sections[o++],a=this.sections[o++],h=i+s;if(a<0){if(h>t)return r+(t-i);r+=s}else{if(n!=N.Simple&&h>=t&&(n==N.TrackDel&&i<t&&h>t||n==N.TrackBefore&&i<t||n==N.TrackAfter&&h>t))return null;if(h>t||h==t&&e<0&&!s)return t==i||e<0?r:r+a;r+=a}i=h}if(t>i)throw new RangeError("Position ".concat(t," is out of range for changeset of length ").concat(i));return r}},{key:"touchesRange",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=0,i=0;n<this.sections.length&&i<=e;){var r=i+this.sections[n++];if(this.sections[n++]>=0&&i<=e&&r>=t)return!(i<t&&r>e)||"cover";i=r}return!1}},{key:"toString",value:function(){for(var t="",e=0;e<this.sections.length;){var n=this.sections[e++],i=this.sections[e++];t+=(t?" ":"")+n+(i>=0?":"+i:"")}return t}},{key:"toJSON",value:function(){return this.sections}}],[{key:"fromJSON",value:function(e){if(!Array.isArray(e)||e.length%2||e.some((function(t){return"number"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}},{key:"create",value:function(e){return new t(e)}}]),t}(),V=function(t){function e(t,n){var r;return(0,i.Z)(this,e),(r=(0,c.Z)(this,e,[t])).inserted=n,r}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"apply",value:function(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return _(this,(function(e,n,i,r,o){return t=t.replace(i,i+(n-e),o)}),!1),t}},{key:"mapDesc",value:function(t){return z(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"invert",value:function(t){for(var n=this.sections.slice(),i=[],r=0,o=0;r<n.length;r+=2){var s=n[r],a=n[r+1];if(a>=0){n[r]=a,n[r+1]=s;for(var h=r>>1;i.length<h;)i.push(v.empty);i.push(s?t.slice(o,o+s):v.empty)}o+=s}return new e(n,i)}},{key:"compose",value:function(t){return this.empty?t:t.empty?this:F(this,t,!0)}},{key:"map",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:z(this,t,e,!0)}},{key:"iterChanges",value:function(t){_(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"desc",get:function(){return L.create(this.sections)}},{key:"filter",value:function(t){var n=[],i=[],r=[],o=new q(this);t:for(var s=0,a=0;;){for(var h=s==t.length?1e9:t[s++];a<h||a==h&&0==o.len;){if(o.done)break t;var u=Math.min(o.len,h-a);H(r,u,-1);var l=-1==o.ins?-1:0==o.off?o.ins:0;H(n,u,l),l>0&&W(i,n,o.text),o.forward(u),a+=u}for(var c=t[s++];a<c;){if(o.done)break t;var f=Math.min(o.len,c-a);H(n,f,-1),H(r,f,-1==o.ins?-1:0==o.off?o.ins:0),o.forward(f),a+=f}}return{changes:new e(n,i),filtered:L.create(r)}}},{key:"toJSON",value:function(){for(var t=[],e=0;e<this.sections.length;e+=2){var n=this.sections[e],i=this.sections[e+1];i<0?t.push(n):0==i?t.push([n]):t.push([n].concat(this.inserted[e>>1].toJSON()))}return t}}],[{key:"of",value:function(t,n,i){var r=[],s=[],a=0,h=null;function u(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||r.length){a<n&&H(r,n-a,-1);var t=new e(r,s);h=h?h.compose(t.map(h)):t,r=[],s=[],a=0}}return function t(l){if(Array.isArray(l)){var c,f=(0,o.Z)(l);try{for(f.s();!(c=f.n()).done;){t(c.value)}}catch(w){f.e(w)}finally{f.f()}}else if(l instanceof e){if(l.length!=n)throw new RangeError("Mismatched change set length (got ".concat(l.length,", expected ").concat(n,")"));u(),h=h?h.compose(l.map(h)):l}else{var d=l.from,g=l.to,p=void 0===g?d:g,m=l.insert;if(d>p||d<0||p>n)throw new RangeError("Invalid change range ".concat(d," to ").concat(p," (in doc of length ").concat(n,")"));var y=m?"string"==typeof m?v.of(m.split(i||P)):m:v.empty,k=y.length;if(d==p&&0==k)return;d<a&&u(),d>a&&H(r,d-a,-1),H(r,p-d,k),W(s,r,y),a=p}}(t),u(!h),h}},{key:"empty",value:function(t){return new e(t?[t,-1]:[],[])}},{key:"fromJSON",value:function(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");for(var n=[],i=[],r=0;r<t.length;r++){var o=t[r];if("number"==typeof o)n.push(o,-1);else{if(!Array.isArray(o)||"number"!=typeof o[0]||o.some((function(t,e){return e&&"string"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==o.length)n.push(o[0],0);else{for(;i.length<r;)i.push(v.empty);i[r]=v.of(o.slice(1)),n.push(o[0],i[r].length)}}}return new e(n,i)}},{key:"createSet",value:function(t,n){return new e(t,n)}}]),e}(L);function H(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!(0==e&&n<=0)){var r=t.length-2;r>=0&&n<=0&&n==t[r+1]?t[r]+=e:0==e&&0==t[r]?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}}function W(t,e,n){if(0!=n.length){var i=e.length-2>>1;if(i<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<i;)t.push(v.empty);t.push(n)}}}function _(t,e,n){for(var i=t.inserted,r=0,o=0,s=0;s<t.sections.length;){var a=t.sections[s++],h=t.sections[s++];if(h<0)r+=a,o+=a;else{for(var u=r,l=o,c=v.empty;u+=a,l+=h,h&&i&&(c=c.append(i[s-2>>1])),!(n||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],h=t.sections[s++];e(r,u,o,l,c),r=u,o=l}}}function z(t,e,n){for(var i=[],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3]?[]:null,o=new q(t),s=new q(e),a=-1;;)if(-1==o.ins&&-1==s.ins){var h=Math.min(o.len,s.len);H(i,h,-1),o.forward(h),s.forward(h)}else if(s.ins>=0&&(o.ins<0||a==o.i||0==o.off&&(s.len<o.len||s.len==o.len&&!n))){var u=s.len;for(H(i,s.ins,-1);u;){var l=Math.min(o.len,u);o.ins>=0&&a<o.i&&o.len<=l&&(H(i,0,o.ins),r&&W(r,i,o.text),a=o.i),o.forward(l),u-=l}s.next()}else{if(!(o.ins>=0)){if(o.done&&s.done)return r?V.createSet(i,r):L.create(i);throw new Error("Mismatched change set lengths")}for(var c=0,f=o.len;f;)if(-1==s.ins){var d=Math.min(f,s.len);c+=d,f-=d,s.forward(d)}else{if(!(0==s.ins&&s.len<f))break;f-=s.len,s.next()}H(i,c,a<o.i?o.ins:0),r&&a<o.i&&W(r,i,o.text),a=o.i,o.forward(o.len-f)}}function F(t,e){for(var n=[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2]?[]:null,r=new q(t),o=new q(e),s=!1;;){if(r.done&&o.done)return i?V.createSet(n,i):L.create(n);if(0==r.ins)H(n,r.len,0,s),r.next();else if(0!=o.len||o.done){if(r.done||o.done)throw new Error("Mismatched change set lengths");var a=Math.min(r.len2,o.len),h=n.length;if(-1==r.ins){var u=-1==o.ins?-1:o.off?0:o.ins;H(n,a,u,s),i&&u&&W(i,n,o.text)}else-1==o.ins?(H(n,r.off?0:r.len,a,s),i&&W(i,n,r.textBit(a))):(H(n,r.off?0:r.len,o.off?0:o.ins,s),i&&!o.off&&W(i,n,o.text));s=(r.ins>a||o.ins>=0&&o.len>a)&&(s||n.length>h),r.forward2(a),o.forward(a)}else H(n,0,o.ins,s),i&&W(i,n,o.text),o.next()}}var q=function(){function t(e){(0,i.Z)(this,t),this.set=e,this.i=0,this.next()}return(0,r.Z)(t,[{key:"next",value:function(){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(){return-2==this.ins}},{key:"len2",get:function(){return this.ins<0?this.len:this.ins}},{key:"text",get:function(){var t=this.set.inserted,e=this.i-2>>1;return e>=t.length?v.empty:t[e]}},{key:"textBit",value:function(t){var e=this.set.inserted,n=this.i-2>>1;return n>=e.length&&!t?v.empty:e[n].slice(this.off,null==t?void 0:this.off+t)}},{key:"forward",value:function(t){t==this.len?this.next():(this.len-=t,this.off+=t)}},{key:"forward2",value:function(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}]),t}(),j=function(){function t(e,n,r){(0,i.Z)(this,t),this.from=e,this.to=n,this.flags=r}return(0,r.Z)(t,[{key:"anchor",get:function(){return 16&this.flags?this.to:this.from}},{key:"head",get:function(){return 16&this.flags?this.from:this.to}},{key:"empty",get:function(){return this.from==this.to}},{key:"assoc",get:function(){return 4&this.flags?-1:8&this.flags?1:0}},{key:"bidiLevel",get:function(){var t=3&this.flags;return 3==t?null:t}},{key:"goalColumn",get:function(){var t=this.flags>>5;return 33554431==t?void 0:t}},{key:"map",value:function(e){var n,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return this.empty?n=i=e.mapPos(this.from,r):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new t(n,i,this.flags)}},{key:"extend",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(t<=this.anchor&&e>=this.anchor)return K.range(t,e);var n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return K.range(this.anchor,n)}},{key:"eq",value:function(t){return this.anchor==t.anchor&&this.head==t.head}},{key:"toJSON",value:function(){return{anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return K.range(t.anchor,t.head)}},{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}(),K=function(){function t(e,n){(0,i.Z)(this,t),this.ranges=e,this.mainIndex=n}return(0,r.Z)(t,[{key:"map",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return e.empty?this:t.create(this.ranges.map((function(t){return t.map(e,n)})),this.mainIndex)}},{key:"eq",value:function(t){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].eq(t.ranges[e]))return!1;return!0}},{key:"main",get:function(){return this.ranges[this.mainIndex]}},{key:"asSingle",value:function(){return 1==this.ranges.length?this:new t([this.main],0)}},{key:"addRange",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.create([e].concat(this.ranges),n?0:this.mainIndex+1)}},{key:"replaceRange",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.mainIndex,i=this.ranges.slice();return i[n]=e,t.create(i,this.mainIndex)}},{key:"toJSON",value:function(){return{ranges:this.ranges.map((function(t){return t.toJSON()})),main:this.mainIndex}}}],[{key:"fromJSON",value:function(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t(e.ranges.map((function(t){return j.fromJSON(t)})),e.main)}},{key:"single",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return new t([t.range(e,n)],0)}},{key:"create",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0==e.length)throw new RangeError("A selection needs at least one range");for(var i=0,r=0;r<e.length;r++){var o=e[r];if(o.empty?o.from<=i:o.from<i)return t.normalized(e.slice(),n);i=o.to}return new t(e,n)}},{key:"cursor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;return j.create(t,t,(0==e?0:e<0?4:8)|(null==n?3:Math.min(2,n))|(null!=i?i:33554431)<<5)}},{key:"range",value:function(t,e,n,i){var r=(null!=n?n:33554431)<<5|(null==i?3:Math.min(2,i));return e<t?j.create(e,t,24|r):j.create(t,e,(e>t?4:0)|r)}},{key:"normalized",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e[n];e.sort((function(t,e){return t.from-e.from})),n=e.indexOf(i);for(var r=1;r<e.length;r++){var o=e[r],s=e[r-1];if(o.empty?o.from<=s.to:o.from<s.to){var a=s.from,h=Math.max(o.to,s.to);r<=n&&n--,e.splice(--r,2,o.anchor>o.head?t.range(h,a):t.range(a,h))}}return new t(e,n)}}]),t}();function J(t,e){var n,i=(0,o.Z)(t.ranges);try{for(i.s();!(n=i.n()).done;){if(n.value.to>e)throw new RangeError("Selection points outside of document")}}catch(r){i.e(r)}finally{i.f()}}var U=0,G=function(){function t(e,n,r,o,s){(0,i.Z)(this,t),this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=o,this.id=U++,this.default=e([]),this.extensions="function"==typeof s?s(this):s}return(0,r.Z)(t,[{key:"of",value:function(t){return new X([],this,0,t)}},{key:"compute",value:function(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new X(t,this,1,e)}},{key:"computeN",value:function(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new X(t,this,2,e)}},{key:"from",value:function(t,e){return e||(e=function(t){return t}),this.compute([t],(function(n){return e(n.field(t))}))}}],[{key:"define",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new t(e.combine||function(t){return t},e.compareInput||function(t,e){return t===e},e.compare||(e.combine?function(t,e){return t===e}:$),!!e.static,e.enables)}}]),t}();function $(t,e){return t==e||t.length==e.length&&t.every((function(t,n){return t===e[n]}))}var X=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.dependencies=e,this.facet=n,this.type=r,this.value=o,this.id=U++}return(0,r.Z)(t,[{key:"dynamicSlot",value:function(t){var e,n,i=this,r=this.value,s=this.facet.compareInput,a=this.id,h=t[a]>>1,u=2==this.type,l=!1,c=!1,f=[],d=(0,o.Z)(this.dependencies);try{for(d.s();!(n=d.n()).done;){var v=n.value;"doc"==v?l=!0:"selection"==v?c=!0:0==(1&(null!==(e=t[v.id])&&void 0!==e?e:1))&&f.push(t[v.id])}}catch(g){d.e(g)}finally{d.f()}return{create:function(t){return t.values[h]=r(t),1},update:function(t,e){if(l&&e.docChanged||c&&(e.docChanged||e.selection)||Q(t,f)){var n=r(t);if(u?!Y(n,t.values[h],s):!s(n,t.values[h]))return t.values[h]=n,1}return 0},reconfigure:function(t,e){var n,o=e.config.address[a];if(null!=o){var l=dt(e,o);if(i.dependencies.every((function(n){return n instanceof G?e.facet(n)===t.facet(n):!(n instanceof et)||e.field(n,!1)==t.field(n,!1)}))||(u?Y(n=r(t),l,s):s(n=r(t),l)))return t.values[h]=l,0}else n=r(t);return t.values[h]=n,1}}}}]),t}();function Y(t,e,n){if(t.length!=e.length)return!1;for(var i=0;i<t.length;i++)if(!n(t[i],e[i]))return!1;return!0}function Q(t,e){var n,i=!1,r=(0,o.Z)(e);try{for(r.s();!(n=r.n()).done;){1&ft(t,n.value)&&(i=!0)}}catch(s){r.e(s)}finally{r.f()}return i}var tt=G.define({static:!0}),et=function(){function t(e,n,r,o,s){(0,i.Z)(this,t),this.id=e,this.createF=n,this.updateF=r,this.compareF=o,this.spec=s,this.provides=void 0}return(0,r.Z)(t,[{key:"create",value:function(t){var e=this,n=t.facet(tt).find((function(t){return t.field==e}));return((null==n?void 0:n.create)||this.createF)(t)}},{key:"slot",value:function(t){var e=this,n=t[this.id]>>1;return{create:function(t){return t.values[n]=e.create(t),1},update:function(t,i){var r=t.values[n],o=e.updateF(r,i);return e.compareF(r,o)?0:(t.values[n]=o,1)},reconfigure:function(t,i){return null!=i.config.address[e.id]?(t.values[n]=i.field(e),0):(t.values[n]=e.create(t),1)}}}},{key:"init",value:function(t){return[this,tt.of({field:this,create:t})]}},{key:"extension",get:function(){return this}}],[{key:"define",value:function(e){var n=new t(U++,e.create,e.update,e.compare||function(t,e){return t===e},e);return e.provide&&(n.provides=e.provide(n)),n}}]),t}(),nt=4,it=3,rt=2,ot=1;function st(t){return function(e){return new ht(e,t)}}var at={highest:st(0),high:st(ot),default:st(rt),low:st(it),lowest:st(nt)},ht=(0,r.Z)((function t(e,n){(0,i.Z)(this,t),this.inner=e,this.prec=n})),ut=function(){function t(){(0,i.Z)(this,t)}return(0,r.Z)(t,[{key:"of",value:function(t){return new lt(this,t)}},{key:"reconfigure",value:function(e){return t.reconfigure.of({compartment:this,extension:e})}},{key:"get",value:function(t){return t.config.compartments.get(this)}}]),t}(),lt=(0,r.Z)((function t(e,n){(0,i.Z)(this,t),this.compartment=e,this.inner=n})),ct=function(){function t(e,n,r,o,s,a){for((0,i.Z)(this,t),this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=o,this.staticValues=s,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}return(0,r.Z)(t,[{key:"staticFacet",value:function(t){var e=this.address[t.id];return null==e?t.default:this.staticValues[e>>1]}}],[{key:"resolve",value:function(e,n,i){var r,s=[],a=Object.create(null),h=new Map,u=(0,o.Z)(function(t,e,n){var i=[[],[],[],[],[]],r=new Map;function s(t,a){var h=r.get(t);if(null!=h){if(h<=a)return;var u=i[h].indexOf(t);u>-1&&i[h].splice(u,1),t instanceof lt&&n.delete(t.compartment)}if(r.set(t,a),Array.isArray(t)){var l,c=(0,o.Z)(t);try{for(c.s();!(l=c.n()).done;){s(l.value,a)}}catch(v){c.e(v)}finally{c.f()}}else if(t instanceof lt){if(n.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");var f=e.get(t.compartment)||t.inner;n.set(t.compartment,f),s(f,a)}else if(t instanceof ht)s(t.inner,t.prec);else if(t instanceof et)i[a].push(t),t.provides&&s(t.provides,a);else if(t instanceof X)i[a].push(t),t.facet.extensions&&s(t.facet.extensions,rt);else{var d=t.extension;if(!d)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."));s(d,a)}}return s(t,rt),i.reduce((function(t,e){return t.concat(e)}))}(e,n,h));try{for(u.s();!(r=u.n()).done;){var l=r.value;l instanceof et?s.push(l):(a[l.facet.id]||(a[l.facet.id]=[])).push(l)}}catch(w){u.e(w)}finally{u.f()}for(var c=Object.create(null),f=[],d=[],v=function(){var t=p[g];c[t.id]=d.length<<1,d.push((function(e){return t.slot(e)}))},g=0,p=s;g<p.length;g++)v();var m=null==i?void 0:i.config.facets,y=function(){var t=a[k],e=t[0].facet,n=m&&m[k]||[];if(t.every((function(t){return 0==t.type})))if(c[e.id]=f.length<<1|1,$(n,t))f.push(i.facet(e));else{var r=e.combine(t.map((function(t){return t.value})));f.push(i&&e.compare(r,i.facet(e))?i.facet(e):r)}else{var s,h=(0,o.Z)(t);try{var u=function(){var t=s.value;0==t.type?(c[t.id]=f.length<<1|1,f.push(t.value)):(c[t.id]=d.length<<1,d.push((function(e){return t.dynamicSlot(e)})))};for(h.s();!(s=h.n()).done;)u()}catch(w){h.e(w)}finally{h.f()}c[e.id]=d.length<<1,d.push((function(n){return function(t,e,n){var i=n.map((function(e){return t[e.id]})),r=n.map((function(t){return t.type})),s=i.filter((function(t){return!(1&t)})),a=t[e.id]>>1;function h(t){for(var n=[],s=0;s<i.length;s++){var a=dt(t,i[s]);if(2==r[s]){var h,u=(0,o.Z)(a);try{for(u.s();!(h=u.n()).done;){var l=h.value;n.push(l)}}catch(w){u.e(w)}finally{u.f()}}else n.push(a)}return e.combine(n)}return{create:function(t){var e,n=(0,o.Z)(i);try{for(n.s();!(e=n.n()).done;)ft(t,e.value)}catch(w){n.e(w)}finally{n.f()}return t.values[a]=h(t),1},update:function(t,n){if(!Q(t,s))return 0;var i=h(t);return e.compare(i,t.values[a])?0:(t.values[a]=i,1)},reconfigure:function(t,r){var o=Q(t,i),s=r.config.facets[e.id],u=r.facet(e);if(s&&!o&&$(n,s))return t.values[a]=u,0;var l=h(t);return e.compare(l,u)?(t.values[a]=u,0):(t.values[a]=l,1)}}}(n,e,t)}))}};for(var k in a)y();return new t(e,h,d.map((function(t){return t(c)})),c,f,a)}}]),t}();function ft(t,e){if(1&e)return 2;var n=e>>1,i=t.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;t.status[n]=4;var r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function dt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}var vt=G.define(),gt=G.define({combine:function(t){return t.some((function(t){return t}))},static:!0}),pt=G.define({combine:function(t){return t.length?t[0]:void 0},static:!0}),mt=G.define(),yt=G.define(),kt=G.define(),wt=G.define({combine:function(t){return!!t.length&&t[0]}}),bt=function(){function t(e,n){(0,i.Z)(this,t),this.type=e,this.value=n}return(0,r.Z)(t,null,[{key:"define",value:function(){return new xt}}]),t}(),xt=function(){function t(){(0,i.Z)(this,t)}return(0,r.Z)(t,[{key:"of",value:function(t){return new bt(this,t)}}]),t}(),St=function(){function t(e){(0,i.Z)(this,t),this.map=e}return(0,r.Z)(t,[{key:"of",value:function(t){return new At(this,t)}}]),t}(),At=function(){function t(e,n){(0,i.Z)(this,t),this.type=e,this.value=n}return(0,r.Z)(t,[{key:"map",value:function(e){var n=this.type.map(this.value,e);return void 0===n?void 0:n==this.value?this:new t(this.type,n)}},{key:"is",value:function(t){return this.type==t}}],[{key:"define",value:function(){return new St((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).map||function(t){return t})}},{key:"mapEffects",value:function(t,e){if(!t.length)return t;var n,i=[],r=(0,o.Z)(t);try{for(r.s();!(n=r.n()).done;){var s=n.value.map(e);s&&i.push(s)}}catch(a){r.e(a)}finally{r.f()}return i}}]),t}();At.reconfigure=At.define(),At.appendConfig=At.define();var Mt=function(){function t(e,n,r,o,s,a){(0,i.Z)(this,t),this.startState=e,this.changes=n,this.selection=r,this.effects=o,this.annotations=s,this.scrollIntoView=a,this._doc=null,this._state=null,r&&J(r,n.newLength),s.some((function(e){return e.type==t.time}))||(this.annotations=s.concat(t.time.of(Date.now())))}return(0,r.Z)(t,[{key:"newDoc",get:function(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}},{key:"newSelection",get:function(){return this.selection||this.startState.selection.map(this.changes)}},{key:"state",get:function(){return this._state||this.startState.applyTransaction(this),this._state}},{key:"annotation",value:function(t){var e,n=(0,o.Z)(this.annotations);try{for(n.s();!(e=n.n()).done;){var i=e.value;if(i.type==t)return i.value}}catch(r){n.e(r)}finally{n.f()}}},{key:"docChanged",get:function(){return!this.changes.empty}},{key:"reconfigured",get:function(){return this.startState.config!=this.state.config}},{key:"isUserEvent",value:function(e){var n=this.annotation(t.userEvent);return!(!n||!(n==e||n.length>e.length&&n.slice(0,e.length)==e&&"."==n[e.length]))}}],[{key:"create",value:function(e,n,i,r,o,s){return new t(e,n,i,r,o,s)}}]),t}();function Zt(t,e){for(var n=[],i=0,r=0;;){var o=void 0,s=void 0;if(i<t.length&&(r==e.length||e[r]>=t[i]))o=t[i++],s=t[i++];else{if(!(r<e.length))return n;o=e[r++],s=e[r++]}!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function Ct(t,e,n){var i,r,o,s;return n?(r=e.changes,o=V.empty(e.changes.length),s=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),o=t.changes.mapDesc(e.changes,!0),s=t.changes.compose(r)),{changes:s,selection:e.selection?e.selection.map(o):null===(i=t.selection)||void 0===i?void 0:i.map(r),effects:At.mapEffects(t.effects,r).concat(At.mapEffects(e.effects,o)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Ot(t,e,n){var i=e.selection,r=Et(e.annotations);return e.userEvent&&(r=r.concat(Mt.userEvent.of(e.userEvent))),{changes:e.changes instanceof V?e.changes:V.of(e.changes||[],n,t.facet(pt)),selection:i&&(i instanceof K?i:K.single(i.anchor,i.head)),effects:Et(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Tt(t,e,n){var i=Ot(t,e.length?e[0]:{},t.doc.length);e.length&&!1===e[0].filter&&(n=!1);for(var r=1;r<e.length;r++){!1===e[r].filter&&(n=!1);var s=!!e[r].sequential;i=Ct(i,Ot(t,e[r],s?i.changes.newLength:t.doc.length),s)}var a=Mt.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(t){for(var e=t.startState,n=e.facet(kt),i=t,r=n.length-1;r>=0;r--){var o=n[r](t);o&&Object.keys(o).length&&(i=Ct(i,Ot(e,o,t.changes.newLength),!0))}return i==t?t:Mt.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(t){var e,n=t.startState,i=!0,r=(0,o.Z)(n.facet(mt));try{for(r.s();!(e=r.n()).done;){var s=(0,e.value)(t);if(!1===s){i=!1;break}Array.isArray(s)&&(i=!0===i?s:Zt(i,s))}}catch(d){r.e(d)}finally{r.f()}if(!0!==i){var a,h;if(!1===i)h=t.changes.invertedDesc,a=V.empty(n.doc.length);else{var u=t.changes.filter(i);a=u.changes,h=u.filtered.mapDesc(u.changes).invertedDesc}t=Mt.create(n,a,t.selection&&t.selection.map(h),At.mapEffects(t.effects,h),t.annotations,t.scrollIntoView)}for(var l=n.facet(yt),c=l.length-1;c>=0;c--){var f=l[c](t);t=f instanceof Mt?f:Array.isArray(f)&&1==f.length&&f[0]instanceof Mt?f[0]:Tt(n,Et(f),!1)}return t}(a):a)}Mt.time=bt.define(),Mt.userEvent=bt.define(),Mt.addToHistory=bt.define(),Mt.remote=bt.define();var Dt=[];function Et(t){return null==t?Dt:Array.isArray(t)?t:[t]}var Bt,Rt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Rt||(Rt={})),It=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{Bt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(Fl){}function Pt(t){return function(e){if(!/\S/.test(e))return Rt.Space;if(function(t){if(Bt)return Bt.test(t);for(var e=0;e<t.length;e++){var n=t[e];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||It.test(n)))return!0}return!1}(e))return Rt.Word;for(var n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Rt.Word;return Rt.Other}}var Nt=function(){function t(e,n,r,o,s,a){(0,i.Z)(this,t),this.config=e,this.doc=n,this.selection=r,this.values=o,this.status=e.statusTemplate.slice(),this.computeSlot=s,a&&(a._state=this);for(var h=0;h<this.config.dynamicSlots.length;h++)ft(this,h<<1);this.computeSlot=null}return(0,r.Z)(t,[{key:"field",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.config.address[t.id];if(null!=n)return ft(this,n),dt(this,n);if(e)throw new RangeError("Field is not present in this state")}},{key:"update",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Tt(this,e,!0)}},{key:"applyTransaction",value:function(e){var n,i,r=this,s=this.config,a=s,h=a.base,u=a.compartments,l=(0,o.Z)(e.effects);try{for(l.s();!(n=l.n()).done;){var c=n.value;c.is(ut.reconfigure)?(s&&(u=new Map,s.compartments.forEach((function(t,e){return u.set(e,t)})),s=null),u.set(c.value.compartment,c.value.extension)):c.is(At.reconfigure)?(s=null,h=c.value):c.is(At.appendConfig)&&(s=null,h=Et(h).concat(c.value))}}catch(f){l.e(f)}finally{l.f()}s?i=e.startState.values.slice():i=new t(s=ct.resolve(h,u,this),this.doc,this.selection,s.dynamicSlots.map((function(){return null})),(function(t,e){return e.reconfigure(t,r)}),null).values;new t(s,e.newDoc,e.newSelection,i,(function(t,n){return n.update(t,e)}),e)}},{key:"replaceSelection",value:function(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange((function(e){return{changes:{from:e.from,to:e.to,insert:t},range:K.cursor(e.from+t.length)}}))}},{key:"changeByRange",value:function(t){for(var e=this.selection,n=t(e.ranges[0]),i=this.changes(n.changes),r=[n.range],o=Et(n.effects),s=1;s<e.ranges.length;s++){for(var a=t(e.ranges[s]),h=this.changes(a.changes),u=h.map(i),l=0;l<s;l++)r[l]=r[l].map(u);var c=i.mapDesc(h,!0);r.push(a.range.map(c)),i=i.compose(u),o=At.mapEffects(o,u).concat(At.mapEffects(Et(a.effects),c))}return{changes:i,selection:K.create(r,e.mainIndex),effects:o}}},{key:"changes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e instanceof V?e:V.of(e,this.doc.length,this.facet(t.lineSeparator))}},{key:"toText",value:function(e){return v.of(e.split(this.facet(t.lineSeparator)||P))}},{key:"sliceDoc",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.doc.length;return this.doc.sliceString(t,e,this.lineBreak)}},{key:"facet",value:function(t){var e=this.config.address[t.id];return null==e?t.default:(ft(this,e),dt(this,e))}},{key:"toJSON",value:function(t){var e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(var n in t){var i=t[n];i instanceof et&&null!=this.config.address[i.id]&&(e[n]=i.spec.toJSON(this.field(t[n]),this))}return e}},{key:"tabSize",get:function(){return this.facet(t.tabSize)}},{key:"lineBreak",get:function(){return this.facet(t.lineSeparator)||"\n"}},{key:"readOnly",get:function(){return this.facet(wt)}},{key:"phrase",value:function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];var s,a=(0,o.Z)(this.facet(t.phrases));try{for(a.s();!(s=a.n()).done;){var h=s.value;if(Object.prototype.hasOwnProperty.call(h,e)){e=h[e];break}}}catch(u){a.e(u)}finally{a.f()}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(function(t,e){if("$"==e)return"$";var n=+(e||1);return!n||n>i.length?t:i[n-1]}))),e}},{key:"languageDataAt",value:function(t,e){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=[],s=(0,o.Z)(this.facet(vt));try{for(s.s();!(n=s.n()).done;){var a,h=n.value,u=(0,o.Z)(h(this,e,i));try{for(u.s();!(a=u.n()).done;){var l=a.value;Object.prototype.hasOwnProperty.call(l,t)&&r.push(l[t])}}catch(c){u.e(c)}finally{u.f()}}}catch(c){s.e(c)}finally{s.f()}return r}},{key:"charCategorizer",value:function(t){return Pt(this.languageDataAt("wordChars",t).join(""))}},{key:"wordAt",value:function(t){for(var e=this.doc.lineAt(t),n=e.text,i=e.from,r=e.length,o=this.charCategorizer(t),s=t-i,a=t-i;s>0;){var h=O(n,s,!1);if(o(n.slice(h,s))!=Rt.Word)break;s=h}for(;a<r;){var u=O(n,a);if(o(n.slice(a,u))!=Rt.Word)break;a=u}return s==a?null:K.range(s+i,a+i)}}],[{key:"fromJSON",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");var r=[];if(i){var o=function(){if(Object.prototype.hasOwnProperty.call(e,s)){var t=i[s],n=e[s];r.push(t.init((function(e){return t.spec.fromJSON(n,e)})))}};for(var s in i)o()}return t.create({doc:e.doc,selection:K.fromJSON(e.selection),extensions:n.extensions?r.concat([n.extensions]):r})}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=ct.resolve(e.extensions||[],new Map),i=e.doc instanceof v?e.doc:v.of((e.doc||"").split(n.staticFacet(t.lineSeparator)||P)),r=e.selection?e.selection instanceof K?e.selection:K.single(e.selection.anchor,e.selection.head):K.single(0);return J(r,i.length),n.staticFacet(gt)||(r=r.asSingle()),new t(n,i,r,n.dynamicSlots.map((function(){return null})),(function(t,e){return e.create(t)}),null)}}]),t}();Nt.allowMultipleSelections=gt,Nt.tabSize=G.define({combine:function(t){return t.length?t[0]:4}}),Nt.lineSeparator=pt,Nt.readOnly=wt,Nt.phrases=G.define({compare:function(t,e){var n=Object.keys(t),i=Object.keys(e);return n.length==i.length&&n.every((function(n){return t[n]==e[n]}))}}),Nt.languageData=vt,Nt.changeFilter=mt,Nt.transactionFilter=yt,Nt.transactionExtender=kt,ut.reconfigure=At.define();var Lt=function(){function t(){(0,i.Z)(this,t)}return(0,r.Z)(t,[{key:"eq",value:function(t){return this==t}},{key:"range",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return Vt.create(t,e,this)}}]),t}();Lt.prototype.startSide=Lt.prototype.endSide=0,Lt.prototype.point=!1,Lt.prototype.mapMode=N.TrackDel;var Vt=function(){function t(e,n,r){(0,i.Z)(this,t),this.from=e,this.to=n,this.value=r}return(0,r.Z)(t,null,[{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}();function Ht(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}var Wt=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.from=e,this.to=n,this.value=r,this.maxPoint=o}return(0,r.Z)(t,[{key:"length",get:function(){return this.to[this.to.length-1]}},{key:"findIndex",value:function(t,e,n){for(var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=n?this.to:this.from,o=i,s=r.length;;){if(o==s)return o;var a=o+s>>1,h=r[a]-t||(n?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:s;h>=0?s=a:o=a+1}}},{key:"between",value:function(t,e,n,i){for(var r=this.findIndex(e,-1e9,!0),o=this.findIndex(n,1e9,!1,r);r<o;r++)if(!1===i(this.from[r]+t,this.to[r]+t,this.value[r]))return!1}},{key:"map",value:function(e,n){for(var i=[],r=[],o=[],s=-1,a=-1,h=0;h<this.value.length;h++){var u=this.value[h],l=this.from[h]+e,c=this.to[h]+e,f=void 0,d=void 0;if(l==c){var v=n.mapPos(l,u.startSide,u.mapMode);if(null==v)continue;if(f=d=v,u.startSide!=u.endSide&&(d=n.mapPos(l,u.endSide))<f)continue}else if((f=n.mapPos(l,u.startSide))>(d=n.mapPos(c,u.endSide))||f==d&&u.startSide>0&&u.endSide<=0)continue;(d-f||u.endSide-u.startSide)<0||(s<0&&(s=f),u.point&&(a=Math.max(a,d-f)),i.push(u),r.push(f-s),o.push(d-s))}return{mapped:i.length?new t(r,o,i,a):null,pos:s}}}]),t}(),_t=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=o}return(0,r.Z)(t,[{key:"length",get:function(){var t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}},{key:"size",get:function(){if(this.isEmpty)return 0;var t,e=this.nextLayer.size,n=(0,o.Z)(this.chunk);try{for(n.s();!(t=n.n()).done;){e+=t.value.value.length}}catch(i){n.e(i)}finally{n.f()}return e}},{key:"chunkEnd",value:function(t){return this.chunkPos[t]+this.chunk[t].length}},{key:"update",value:function(e){var n=e.add,i=void 0===n?[]:n,r=e.sort,o=void 0!==r&&r,s=e.filterFrom,a=void 0===s?0:s,h=e.filterTo,u=void 0===h?this.length:h,l=e.filter;if(0==i.length&&!l)return this;if(o&&(i=i.slice().sort(Ht)),this.isEmpty)return i.length?t.of(i):this;for(var c=new qt(this,null,-1).goto(0),f=0,d=[],v=new zt;c.value||f<i.length;)if(f<i.length&&(c.from-i[f].from||c.startSide-i[f].value.startSide)>=0){var g=i[f++];v.addInner(g.from,g.to,g.value)||d.push(g)}else 1==c.rangeIndex&&c.chunkIndex<this.chunk.length&&(f==i.length||this.chunkEnd(c.chunkIndex)<i[f].from)&&(!l||a>this.chunkEnd(c.chunkIndex)||u<this.chunkPos[c.chunkIndex])&&v.addChunk(this.chunkPos[c.chunkIndex],this.chunk[c.chunkIndex])?c.nextChunk():((!l||a>c.to||u<c.from||l(c.from,c.to,c.value))&&(v.addInner(c.from,c.to,c.value)||d.push(Vt.create(c.from,c.to,c.value))),c.next());return v.finishInner(this.nextLayer.isEmpty&&!d.length?t.empty:this.nextLayer.update({add:d,filter:l,filterFrom:a,filterTo:u}))}},{key:"map",value:function(e){if(e.empty||this.isEmpty)return this;for(var n=[],i=[],r=-1,o=0;o<this.chunk.length;o++){var s=this.chunkPos[o],a=this.chunk[o],h=e.touchesRange(s,s+a.length);if(!1===h)r=Math.max(r,a.maxPoint),n.push(a),i.push(e.mapPos(s));else if(!0===h){var u=a.map(s,e),l=u.mapped,c=u.pos;l&&(r=Math.max(r,l.maxPoint),n.push(l),i.push(c))}}var f=this.nextLayer.map(e);return 0==n.length?f:new t(i,n,f||t.empty,r)}},{key:"between",value:function(t,e,n){if(!this.isEmpty){for(var i=0;i<this.chunk.length;i++){var r=this.chunkPos[i],o=this.chunk[i];if(e>=r&&t<=r+o.length&&!1===o.between(r,t-r,e-r,n))return}this.nextLayer.between(t,e,n)}}},{key:"iter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return jt.from([this]).goto(t)}},{key:"isEmpty",get:function(){return this.nextLayer==this}}],[{key:"create",value:function(e,n,i,r){return new t(e,n,i,r)}},{key:"iter",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return jt.from(t).goto(e)}},{key:"compare",value:function(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=t.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r})),s=e.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r})),a=Ft(o,s,n),h=new Jt(o,a,r),u=new Jt(s,a,r);n.iterGaps((function(t,e,n){return Ut(h,t,u,e,n,i)})),n.empty&&0==n.length&&Ut(h,0,u,0,0,i)}},{key:"eq",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0;null==i&&(i=999999999);var r=t.filter((function(t){return!t.isEmpty&&e.indexOf(t)<0})),o=e.filter((function(e){return!e.isEmpty&&t.indexOf(e)<0}));if(r.length!=o.length)return!1;if(!r.length)return!0;for(var s=Ft(r,o),a=new Jt(r,s,0).goto(n),h=new Jt(o,s,0).goto(n);;){if(a.to!=h.to||!Gt(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>i)return!0;a.next(),h.next()}}},{key:"spans",value:function(t,e,n,i){for(var r=new Jt(t,null,arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1).goto(e),o=e,s=r.openStart;;){var a=Math.min(r.to,n);if(r.point){var h=r.activeForPoint(r.to),u=r.pointFrom<e?h.length+1:Math.min(h.length,s);i.point(o,a,r.point,h,u,r.pointRank),s=Math.min(r.openEnd(a),h.length)}else a>o&&(i.span(o,a,r.active,s),s=r.openEnd(a));if(r.to>n)return s+(r.point&&r.to>n?1:0);o=r.to,r.next()}}},{key:"of",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=new zt,r=(0,o.Z)(t instanceof Vt?[t]:n?function(t){if(t.length>1)for(var e=t[0],n=1;n<t.length;n++){var i=t[n];if(Ht(e,i)>0)return t.slice().sort(Ht);e=i}return t}(t):t);try{for(r.s();!(e=r.n()).done;){var s=e.value;i.add(s.from,s.to,s.value)}}catch(a){r.e(a)}finally{r.f()}return i.finish()}}]),t}();_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;var zt=function(){function t(){(0,i.Z)(this,t),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(0,r.Z)(t,[{key:"finishChunk",value:function(t){this.chunks.push(new Wt(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(e,n,i){this.addInner(e,n,i)||(this.nextLayer||(this.nextLayer=new t)).add(e,n,i)}},{key:"addInner",value:function(t,e,n){var i=t-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(t-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<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=n,this.lastFrom=t,this.lastTo=e,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}},{key:"addChunk",value:function(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 n=e.value.length-1;return this.last=e.value[n],this.lastFrom=e.from[n]+t,this.lastTo=e.to[n]+t,!0}},{key:"finish",value:function(){return this.finishInner(_t.empty)}},{key:"finishInner",value:function(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;var e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}]),t}();function Ft(t,e,n){var i,r=new Map,s=(0,o.Z)(t);try{for(s.s();!(i=s.n()).done;)for(var a=i.value,h=0;h<a.chunk.length;h++)a.chunk[h].maxPoint<=0&&r.set(a.chunk[h],a.chunkPos[h])}catch(g){s.e(g)}finally{s.f()}var u,l=new Set,c=(0,o.Z)(e);try{for(c.s();!(u=c.n()).done;)for(var f=u.value,d=0;d<f.chunk.length;d++){var v=r.get(f.chunk[d]);null==v||(n?n.mapPos(v):v)!=f.chunkPos[d]||(null==n?void 0:n.touchesRange(v,v+f.chunk[d].length))||l.add(f.chunk[d])}}catch(g){c.e(g)}finally{c.f()}return l}var qt=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;(0,i.Z)(this,t),this.layer=e,this.skip=n,this.minPoint=r,this.rank=o}return(0,r.Z)(t,[{key:"startSide",get:function(){return this.value?this.value.startSide:0}},{key:"endSide",get:function(){return this.value?this.value.endSide:0}},{key:"goto",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}},{key:"gotoInner",value:function(t,e,n){for(;this.chunkIndex<this.layer.chunk.length;){var i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<t||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){var r=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}},{key:"forward",value:function(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}},{key:"next",value:function(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}var t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],n=t+e.from[this.rangeIndex];if(this.from=n,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}},{key:"setRangeIndex",value:function(t){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(){this.chunkIndex++,this.rangeIndex=0,this.next()}},{key:"compare",value:function(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}]),t}(),jt=function(){function t(e){(0,i.Z)(this,t),this.heap=e}return(0,r.Z)(t,[{key:"startSide",get:function(){return this.value?this.value.startSide:0}},{key:"goto",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9,i=(0,o.Z)(this.heap);try{for(i.s();!(e=i.n()).done;){e.value.goto(t,n)}}catch(s){i.e(s)}finally{i.f()}for(var r=this.heap.length>>1;r>=0;r--)Kt(this.heap,r);return this.next(),this}},{key:"forward",value:function(t,e){var n,i=(0,o.Z)(this.heap);try{for(i.s();!(n=i.n()).done;){n.value.forward(t,e)}}catch(s){i.e(s)}finally{i.f()}for(var r=this.heap.length>>1;r>=0;r--)Kt(this.heap,r);(this.to-t||this.value.endSide-e)<0&&this.next()}},{key:"next",value:function(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Kt(this.heap,0)}}}],[{key:"from",value:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=0;o<e.length;o++)for(var s=e[o];!s.isEmpty;s=s.nextLayer)s.maxPoint>=i&&r.push(new qt(s,n,i,o));return 1==r.length?r[0]:new t(r)}}]),t}();function Kt(t,e){for(var n=t[e];;){var i=1+(e<<1);if(i>=t.length)break;var r=t[i];if(i+1<t.length&&r.compare(t[i+1])>=0&&(r=t[i+1],i++),n.compare(r)<0)break;t[i]=n,t[e]=r,e=i}}var Jt=function(){function t(e,n,r){(0,i.Z)(this,t),this.minPoint=r,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=jt.from(e,n,r)}return(0,r.Z)(t,[{key:"goto",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?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(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(t){$t(this.active,t),$t(this.activeTo,t),$t(this.activeRank,t),this.minActive=Yt(this.active,this.activeTo)}},{key:"addActive",value:function(t){for(var e=0,n=this.cursor,i=n.value,r=n.to,o=n.rank;e<this.activeRank.length&&this.activeRank[e]<=o;)e++;Xt(this.active,e,i),Xt(this.activeTo,e,r),Xt(this.activeRank,e,o),t&&Xt(t,e,this.cursor.from),this.minActive=Yt(this.active,this.activeTo)}},{key:"next",value:function(){var t=this.to,e=this.point;this.point=null;for(var n=this.openStart<0?[]:null;;){var i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>t){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&$t(n,i)}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 r=this.cursor.value;if(r.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}if(n){this.openStart=0;for(var o=n.length-1;o>=0&&n[o]<t;o--)this.openStart++}}},{key:"activeForPoint",value:function(t){if(!this.active.length)return this.active;for(var e=[],n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>t||this.activeTo[n]==t&&this.active[n].endSide>=this.point.endSide)&&e.push(this.active[n]);return e.reverse()}},{key:"openEnd",value:function(t){for(var e=0,n=this.activeTo.length-1;n>=0&&this.activeTo[n]>t;n--)e++;return e}}]),t}();function Ut(t,e,n,i,r,o){t.goto(e),n.goto(i);for(var s=i+r,a=i,h=i-e;;){var u=t.to+h-n.to||t.endSide-n.endSide,l=u<0?t.to+h:n.to,c=Math.min(l,s);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&Gt(t.activeForPoint(t.to),n.activeForPoint(n.to))||o.comparePoint(a,c,t.point,n.point):c>a&&!Gt(t.active,n.active)&&o.compareRange(a,c,t.active,n.active),l>s)break;a=l,u<=0&&t.next(),u>=0&&n.next()}}function Gt(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].eq(e[n]))return!1;return!0}function $t(t,e){for(var n=e,i=t.length-1;n<i;n++)t[n]=t[n+1];t.pop()}function Xt(t,e,n){for(var i=t.length-1;i>=e;i--)t[i+1]=t[i];t[e]=n}function Yt(t,e){for(var n=-1,i=1e9,r=0;r<e.length;r++)(e[r]-i||t[r].endSide-t[n].endSide)<0&&(n=r,i=e[r]);return n}var Qt=n(28450);n(29350);function te(t){return(11==t.nodeType?t.getSelection?t:t.ownerDocument:t).getSelection()}function ee(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function ne(t,e){if(!e.anchorNode)return!1;try{return ee(t,e.anchorNode)}catch(Fl){return!1}}function ie(t){return 3==t.nodeType?ve(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function re(t,e,n,i){return!!n&&(se(t,e,n,i,-1)||se(t,e,n,i,1))}function oe(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function se(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:ae(t))){if("DIV"==t.nodeName)return!1;var o=t.parentNode;if(!o||1!=o.nodeType)return!1;e=oe(t)+(r<0?0:1),t=o}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?ae(t):0}}}function ae(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function he(t,e){var n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function ue(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}var le,ce=function(){function t(){(0,i.Z)(this,t),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return(0,r.Z)(t,[{key:"eq",value:function(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}},{key:"setRange",value:function(t){var e=t.anchorNode,n=t.focusNode;this.set(e,Math.min(t.anchorOffset,e?ae(e):0),n,Math.min(t.focusOffset,n?ae(n):0))}},{key:"set",value:function(t,e,n,i){this.anchorNode=t,this.anchorOffset=e,this.focusNode=n,this.focusOffset=i}}]),t}(),fe=null;function de(t){if(t.setActive)return t.setActive();if(fe)return t.focus(fe);for(var e=[],n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(null==fe?{get preventScroll(){return fe={preventScroll:!0},!0}}:void 0),!fe){fe=!1;for(var i=0;i<e.length;){var r=e[i++],o=e[i++],s=e[i++];r.scrollTop!=o&&(r.scrollTop=o),r.scrollLeft!=s&&(r.scrollLeft=s)}}}function ve(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,i=le||(le=document.createRange());return i.setEnd(t,n),i.setStart(t,e),i}function ge(t,e,n){var i={key:e,code:e,keyCode:n,which:n,cancelable:!0},r=new KeyboardEvent("keydown",i);r.synthetic=!0,t.dispatchEvent(r);var o=new KeyboardEvent("keyup",i);return o.synthetic=!0,t.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function pe(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}var me=function(){function t(e,n){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];(0,i.Z)(this,t),this.node=e,this.offset=n,this.precise=r}return(0,r.Z)(t,null,[{key:"before",value:function(e,n){return new t(e.parentNode,oe(e),n)}},{key:"after",value:function(e,n){return new t(e.parentNode,oe(e)+1,n)}}]),t}(),ye=[],ke=function(){function t(){(0,i.Z)(this,t),this.parent=null,this.dom=null,this.dirty=2}return(0,r.Z)(t,[{key:"overrideDOMText",get:function(){return null}},{key:"posAtStart",get:function(){return this.parent?this.parent.posBefore(this):0}},{key:"posAtEnd",get:function(){return this.posAtStart+this.length}},{key:"posBefore",value:function(t){var e,n=this.posAtStart,i=(0,o.Z)(this.children);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(r==t)return n;n+=r.length+r.breakAfter}}catch(s){i.e(s)}finally{i.f()}throw new RangeError("Invalid child in posBefore")}},{key:"posAfter",value:function(t){return this.posBefore(t)+t.length}},{key:"sync",value:function(e,n){if(2&this.dirty){var i,r,s=this.dom,a=null,h=(0,o.Z)(this.children);try{for(h.s();!(r=h.n()).done;){var u=r.value;if(u.dirty){if(!u.dom&&(i=a?a.nextSibling:s.firstChild)){var l=t.get(i);(!l||!l.parent&&l.canReuseDOM(u))&&u.reuseDOM(i)}u.sync(e,n),u.dirty=0}if(i=a?a.nextSibling:s.firstChild,n&&!n.written&&n.node==s&&i!=u.dom&&(n.written=!0),u.dom.parentNode==s)for(;i&&i!=u.dom;)i=we(i);else s.insertBefore(u.dom,i);a=u.dom}}catch(v){h.e(v)}finally{h.f()}for((i=a?a.nextSibling:s.firstChild)&&n&&n.node==s&&(n.written=!0);i;)i=we(i)}else if(1&this.dirty){var c,f=(0,o.Z)(this.children);try{for(f.s();!(c=f.n()).done;){var d=c.value;d.dirty&&(d.sync(e,n),d.dirty=0)}}catch(v){f.e(v)}finally{f.f()}}}},{key:"reuseDOM",value:function(t){}},{key:"localPosFromDOM",value:function(e,n){var i;if(e==this.dom)i=this.dom.childNodes[n];else{for(var r=0==ae(e)?0:0==n?-1:1;;){var o=e.parentNode;if(o==this.dom)break;0==r&&o.firstChild!=o.lastChild&&(r=e==o.firstChild?-1:1),e=o}i=r<0?e:e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!t.get(i);)i=i.nextSibling;if(!i)return this.length;for(var s=0,a=0;;s++){var h=this.children[s];if(h.dom==i)return a;a+=h.length+h.breakAfter}}},{key:"domBoundsAround",value:function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=-1,r=-1,o=-1,s=-1,a=0,h=n,u=n;a<this.children.length;a++){var l=this.children[a],c=h+l.length;if(h<t&&c>e)return l.domBoundsAround(t,e,h);if(c>=t&&-1==i&&(i=a,r=h),h>e&&l.dom.parentNode==this.dom){o=a,s=u;break}u=c,h=c+l.breakAfter}return{from:r,to:s<0?n+this.length:s,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}},{key:"markDirty",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.dirty|=2,this.markParentsDirty(t)}},{key:"markParentsDirty",value:function(t){for(var e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}},{key:"setParent",value:function(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}},{key:"setDOM",value:function(t){this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this}},{key:"rootView",get:function(){for(var t=this;;){var e=t.parent;if(!e)return t;t=e}}},{key:"replaceChildren",value:function(t,e){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ye;this.markDirty();for(var r=t;r<e;r++){var o=this.children[r];o.parent==this&&o.destroy()}(n=this.children).splice.apply(n,[t,e-t].concat((0,d.Z)(i)));for(var s=0;s<i.length;s++)i[s].setParent(this)}},{key:"ignoreMutation",value:function(t){return!1}},{key:"ignoreEvent",value:function(t){return!1}},{key:"childCursor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length;return new be(this.children,t,this.children.length)}},{key:"childPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.childCursor().findPos(t,e)}},{key:"toString",value:function(){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(){return!0}},{key:"isWidget",get:function(){return!1}},{key:"isHidden",get:function(){return!1}},{key:"merge",value:function(t,e,n,i,r,o){return!1}},{key:"become",value:function(t){return!1}},{key:"canReuseDOM",value:function(t){return t.constructor==this.constructor}},{key:"getSide",value:function(){return 0}},{key:"destroy",value:function(){this.parent=null}}],[{key:"get",value:function(t){return t.cmView}}]),t}();function we(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}ke.prototype.breakAfter=0;var be=function(){function t(e,n,r){(0,i.Z)(this,t),this.children=e,this.pos=n,this.i=r,this.off=0}return(0,r.Z)(t,[{key:"findPos",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;;){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 n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}]),t}();function xe(t,e,n,i,r,o,s,a,h){var u=t.children,l=u.length?u[e]:null,c=o.length?o[o.length-1]:null,f=c?c.breakAfter:s;if(!(e==i&&l&&!s&&!f&&o.length<2&&l.merge(n,r,o.length?c:null,0==n,a,h))){if(i<u.length){var d=u[i];d&&r<d.length?(e==i&&(d=d.split(r),r=0),!f&&c&&d.merge(0,r,c,!0,0,h)?o[o.length-1]=d:(r&&d.merge(0,r,null,!1,0,h),o.push(d))):(null==d?void 0:d.breakAfter)&&(c?c.breakAfter=1:s=1),i++}for(l&&(l.breakAfter=s,n>0&&(!s&&o.length&&l.merge(n,l.length,o[0],!1,a,0)?l.breakAfter=o.shift().breakAfter:(n<l.length||l.children.length&&0==l.children[l.children.length-1].length)&&l.merge(n,l.length,null,!1,a,0),e++));e<i&&o.length;)if(u[i-1].become(o[o.length-1]))i--,o.pop(),h=o.length?0:a;else{if(!u[e].become(o[0]))break;e++,o.shift(),a=o.length?0:h}!o.length&&e&&i<u.length&&!u[e-1].breakAfter&&u[i].merge(0,0,u[e-1],!1,a,h)&&e--,(e<i||o.length)&&t.replaceChildren(e,i,o)}}function Se(t,e,n,i,r,s){var a,h=t.childCursor(),u=h.findPos(n,1),l=u.i,c=u.off,f=h.findPos(e,-1),d=f.i,v=f.off,g=e-n,p=(0,o.Z)(i);try{for(p.s();!(a=p.n()).done;){g+=a.value.length}}catch(m){p.e(m)}finally{p.f()}t.length+=g,xe(t,d,v,l,c,i,0,r,s)}var Ae="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},Me="undefined"!=typeof document?document:{documentElement:{style:{}}},Ze=/Edge\/(\d+)/.exec(Ae.userAgent),Ce=/MSIE \d/.test(Ae.userAgent),Oe=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ae.userAgent),Te=!!(Ce||Oe||Ze),De=!Te&&/gecko\/(\d+)/i.test(Ae.userAgent),Ee=!Te&&/Chrome\/(\d+)/.exec(Ae.userAgent),Be="webkitFontSmoothing"in Me.documentElement.style,Re=!Te&&/Apple Computer/.test(Ae.vendor),Ie=Re&&(/Mobile\/\w+/.test(Ae.userAgent)||Ae.maxTouchPoints>2),Pe={mac:Ie||/Mac/.test(Ae.platform),windows:/Win/.test(Ae.platform),linux:/Linux|X11/.test(Ae.platform),ie:Te,ie_version:Ce?Me.documentMode||6:Oe?+Oe[1]:Ze?+Ze[1]:0,gecko:De,gecko_version:De?+(/Firefox\/(\d+)/.exec(Ae.userAgent)||[0,0])[1]:0,chrome:!!Ee,chrome_version:Ee?+Ee[1]:0,ios:Ie,android:/Android\b/.test(Ae.userAgent),webkit:Be,safari:Re,webkit_version:Be?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Me.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},Ne=function(t){function e(t){var n;return(0,i.Z)(this,e),(n=(0,c.Z)(this,e)).text=t,n}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"length",get:function(){return this.text.length}},{key:"createDOM",value:function(t){this.setDOM(t||document.createTextNode(this.text))}},{key:"sync",value:function(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(t){3==t.nodeType&&this.createDOM(t)}},{key:"merge",value:function(t,n,i){return(!i||i instanceof e&&!(this.length-(n-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(n),this.markDirty(),!0)}},{key:"split",value:function(t){var n=new e(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),n}},{key:"localPosFromDOM",value:function(t,e){return t==this.dom?e:e?this.text.length:0}},{key:"domAtPos",value:function(t){return new me(this.dom,t)}},{key:"domBoundsAround",value:function(t,e,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}},{key:"coordsAt",value:function(t,e){return Ve(this.dom,t,e)}}]),e}(ke),Le=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;(0,i.Z)(this,e),(n=(0,c.Z)(this,e)).mark=t,n.children=r,n.length=s;var a,u=(0,o.Z)(r);try{for(u.s();!(a=u.n()).done;){a.value.setParent((0,h.Z)(n))}}catch(l){u.e(l)}finally{u.f()}return n}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"setAttrs",value:function(t){if(pe(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(var e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}},{key:"reuseDOM",value:function(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}},{key:"sync",value:function(t,n){this.dom?4&this.dirty&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),(0,u.Z)((0,l.Z)(e.prototype),"sync",this).call(this,t,n)}},{key:"merge",value:function(t,n,i,r,o,s){return(!i||!(!(i instanceof e&&i.mark.eq(this.mark))||t&&o<=0||n<this.length&&s<=0))&&(Se(this,t,n,i?i.children:[],o-1,s-1),this.markDirty(),!0)}},{key:"split",value:function(t){var n,i=[],r=0,s=-1,a=0,h=(0,o.Z)(this.children);try{for(h.s();!(n=h.n()).done;){var u=n.value,l=r+u.length;l>t&&i.push(r<t?u.split(t-r):u),s<0&&r>=t&&(s=a),r=l,a++}}catch(f){h.e(f)}finally{h.f()}var c=this.length-t;return this.length=t,s>-1&&(this.children.length=s,this.markDirty()),new e(this.mark,i,c)}},{key:"domAtPos",value:function(t){return Ke(this,t)}},{key:"coordsAt",value:function(t,e){return Ue(this,t,e)}}]),e}(ke);function Ve(t,e,n){var i=t.nodeValue.length;e>i&&(e=i);var r=e,o=e,s=0;0==e&&n<0||e==i&&n>=0?Pe.chrome||Pe.gecko||(e?(r--,s=1):o<i&&(o++,s=-1)):n<0?r--:o<i&&o++;var a=ve(t,r,o).getClientRects();if(!a.length)return null;var h=a[(s?s<0:n>=0)?0:a.length-1];return Pe.safari&&!s&&0==h.width&&(h=Array.prototype.find.call(a,(function(t){return t.width}))||h),s?he(h,s<0):h||null}var He=function(t){function e(t,n,r){var o;return(0,i.Z)(this,e),(o=(0,c.Z)(this,e)).widget=t,o.length=n,o.side=r,o.prevWidget=null,o}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"split",value:function(t){var n=e.create(this.widget,this.length-t,this.side);return this.length-=t,n}},{key:"sync",value:function(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.dom.contentEditable="false")}},{key:"getSide",value:function(){return this.side}},{key:"merge",value:function(t,n,i,r,o,s){return!(i&&(!(i instanceof e&&this.widget.compare(i.widget))||t>0&&o<=0||n<this.length&&s<=0))&&(this.length=t+(i?i.length:0)+(this.length-n),!0)}},{key:"become",value:function(t){return t instanceof e&&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(){return!0}},{key:"ignoreEvent",value:function(t){return this.widget.ignoreEvent(t)}},{key:"overrideDOMText",get:function(){if(0==this.length)return v.empty;for(var t=this;t.parent;)t=t.parent;var e=t.view,n=e&&e.state.doc,i=this.posAtStart;return n?n.slice(i,i+this.length):v.empty}},{key:"domAtPos",value:function(t){return(this.length?0==t:this.side>0)?me.before(this.dom):me.after(this.dom,t==this.length)}},{key:"domBoundsAround",value:function(){return null}},{key:"coordsAt",value:function(t,e){var n=this.widget.coordsAt(this.dom,t,e);if(n)return n;var i=this.dom.getClientRects(),r=null;if(!i.length)return null;for(var o=this.side?this.side<0:t>0,s=o?i.length-1:0;r=i[s],!(t>0?0==s:s==i.length-1||r.top<r.bottom);s+=o?-1:1);return he(r,!o)}},{key:"isEditable",get:function(){return!1}},{key:"isWidget",get:function(){return!0}},{key:"isHidden",get:function(){return this.widget.isHidden}},{key:"destroy",value:function(){(0,u.Z)((0,l.Z)(e.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}],[{key:"create",value:function(t,n,i){return new(t.customView||e)(t,n,i)}}]),e}(ke),We=function(t){function e(){return(0,i.Z)(this,e),(0,c.Z)(this,e,arguments)}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"domAtPos",value:function(t){var e=this.widget,n=e.topView,i=e.text;return n?_e(t,0,n,i,this.length-n.length,(function(t,e){return t.domAtPos(e)}),(function(t,e){return new me(t,Math.min(e,t.nodeValue.length))})):new me(i,Math.min(t,i.nodeValue.length))}},{key:"sync",value:function(){this.setDOM(this.widget.toDOM())}},{key:"localPosFromDOM",value:function(t,e){var n=this.widget,i=n.topView,r=n.text;return i?Fe(t,e,i,r,this.length-i.length):Math.min(e,this.length)}},{key:"ignoreMutation",value:function(){return!1}},{key:"overrideDOMText",get:function(){return null}},{key:"coordsAt",value:function(t,e){var n=this.widget,i=n.topView,r=n.text;return i?_e(t,e,i,r,this.length-i.length,(function(t,e,n){return t.coordsAt(e,n)}),(function(t,e,n){return Ve(t,e,n)})):Ve(r,t,e)}},{key:"destroy",value:function(){var t;(0,u.Z)((0,l.Z)(e.prototype),"destroy",this).call(this),null===(t=this.widget.topView)||void 0===t||t.destroy()}},{key:"isEditable",get:function(){return!0}},{key:"canReuseDOM",value:function(){return!0}}]),e}(He);function _e(t,e,n,i,r,o,s){if(n instanceof Le){for(var a=n.dom.firstChild;a;a=a.nextSibling){var h=ke.get(a);if(h){var u=ee(a,i),l=h.length+(u?r:0);if(t<l||t==l&&h.getSide()<=0)return u?_e(t,e,h,i,r,o,s):o(h,t,e);t-=l}else{var c=ze(t,e,a,s);if("number"!=typeof c)return c;t=c}}return o(n,n.length,-1)}return n.dom==i?s(i,t,e):o(n,t,e)}function ze(t,e,n,i){if(3==n.nodeType){var r=n.nodeValue.length;if(t<=r)return i(n,t,e);t-=r}else if(1==n.nodeType&&"false"!=n.contentEditable)for(var o=n.firstChild;o;o=o.nextSibling){var s=ze(t,e,o,i);if("number"!=typeof s)return s;t=s}return t}function Fe(t,e,n,i,r){if(n instanceof Le)for(var o=0,s=n.dom.firstChild;s;s=s.nextSibling){var a=ke.get(s);if(a){var h=ee(s,i);if(ee(s,t))return o+(h?Fe(t,e,a,i,r):a.localPosFromDOM(t,e));o+=a.length+(h?r:0)}else{var u=qe(t,e,s);if(null!=u.result)return o+u.result;o+=u.size}}else if(n.dom==i)return Math.min(e,i.nodeValue.length);return n.localPosFromDOM(t,e)}function qe(t,e,n){if(3==n.nodeType)return t==n?{result:e}:{size:n.nodeValue.length};if(1!=n.nodeType||"false"==n.contentEditable)return n.contains(t)?{result:0}:{size:0};for(var i=0,r=n.firstChild,o=0;;r=r.nextSibling,o++){if(t==n&&o==e)return{result:i};if(!r)return{size:i};var s=qe(t,e,r);if(null!=s.result)return{result:e+s.result};i+=s.size}}var je=function(t){function e(t){var n;return(0,i.Z)(this,e),(n=(0,c.Z)(this,e)).side=t,n}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"length",get:function(){return 0}},{key:"merge",value:function(){return!1}},{key:"become",value:function(t){return t instanceof e&&t.side==this.side}},{key:"split",value:function(){return new e(this.side)}},{key:"sync",value:function(){if(!this.dom){var t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),this.setDOM(t)}}},{key:"getSide",value:function(){return this.side}},{key:"domAtPos",value:function(t){return this.side>0?me.before(this.dom):me.after(this.dom)}},{key:"localPosFromDOM",value:function(){return 0}},{key:"domBoundsAround",value:function(){return null}},{key:"coordsAt",value:function(t){return this.dom.getBoundingClientRect()}},{key:"overrideDOMText",get:function(){return v.empty}},{key:"isHidden",get:function(){return!0}}]),e}(ke);function Ke(t,e){for(var n=t.dom,i=t.children,r=0,o=0;r<i.length;r++){var s=i[r],a=o+s.length;if(!(a==o&&s.getSide()<=0)){if(e>o&&e<a&&s.dom.parentNode==n)return s.domAtPos(e-o);if(e<=o)break;o=a}}for(var h=r;h>0;h--){var u=i[h-1];if(u.dom.parentNode==n)return u.domAtPos(u.length)}for(var l=r;l<i.length;l++){var c=i[l];if(c.dom.parentNode==n)return c.domAtPos(0)}return new me(n,0)}function Je(t,e,n){var i,r=t.children;n>0&&e instanceof Le&&r.length&&(i=r[r.length-1])instanceof Le&&i.mark.eq(e.mark)?Je(i,e.children[0],n-1):(r.push(e),e.setParent(t)),t.length+=e.length}function Ue(t,e,n){var i=null,r=-1,o=null,s=-1;!function t(e,a){for(var h=0,u=0;h<e.children.length&&u<=a;h++){var l=e.children[h],c=u+l.length;c>=a&&(l.children.length?t(l,a-u):(!o||o.isHidden&&n>0)&&(c>a||u==c&&l.getSide()>0)?(o=l,s=a-u):(u<a||u==c&&l.getSide()<0&&!l.isHidden)&&(i=l,r=a-u)),u=c}}(t,e);var a=(n<0?i:o)||i||o;return a?a.coordsAt(Math.max(0,a==i?r:s),n):function(t){var e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();var n=ie(e);return n[n.length-1]||null}(t)}function Ge(t,e){for(var n in t)"class"==n&&e.class?e.class+=" "+t.class:"style"==n&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}function $e(t,e){if(t==e)return!0;if(!t||!e)return!1;var n=Object.keys(t),i=Object.keys(e);if(n.length!=i.length)return!1;for(var r=0,o=n;r<o.length;r++){var s=o[r];if(-1==i.indexOf(s)||t[s]!==e[s])return!1}return!0}function Xe(t,e,n){var i=null;if(e)for(var r in e)n&&r in n||t.removeAttribute(i=r);if(n)for(var o in n)e&&e[o]==n[o]||t.setAttribute(i=o,n[o]);return!!i}Ne.prototype.children=He.prototype.children=je.prototype.children=ye;var Ye=function(){function t(){(0,i.Z)(this,t)}return(0,r.Z)(t,[{key:"eq",value:function(t){return!1}},{key:"updateDOM",value:function(t,e){return!1}},{key:"compare",value:function(t){return this==t||this.constructor==t.constructor&&this.eq(t)}},{key:"estimatedHeight",get:function(){return-1}},{key:"lineBreaks",get:function(){return 0}},{key:"ignoreEvent",value:function(t){return!0}},{key:"coordsAt",value:function(t,e,n){return null}},{key:"customView",get:function(){return null}},{key:"isHidden",get:function(){return!1}},{key:"destroy",value:function(t){}}]),t}(),Qe=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Qe||(Qe={})),tn=function(t){function e(t,n,r,o){var s;return(0,i.Z)(this,e),(s=(0,c.Z)(this,e)).startSide=t,s.endSide=n,s.widget=r,s.spec=o,s}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"heightRelevant",get:function(){return!1}},{key:"hasHeight",value:function(){return!!this.widget&&this.widget.estimatedHeight>-1}}],[{key:"mark",value:function(t){return new en(t)}},{key:"widget",value:function(t){var e=Math.max(-1e4,Math.min(1e4,t.side||0)),n=!!t.block;return e+=n&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new rn(t,e,e,n,t.widget||null,!1)}},{key:"replace",value:function(t){var e,n,i=!!t.block;if(t.isBlockGap)e=-5e8,n=4e8;else{var r=on(t,i);e=(r.start?i?-3e8:-1:5e8)-1,n=1+(r.end?i?2e8:1:-6e8)}return new rn(t,e,n,i,t.widget||null,!0)}},{key:"line",value:function(t){return new nn(t)}},{key:"set",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return _t.of(t,e)}}]),e}(Lt);tn.none=_t.empty;var en=function(t){function e(t){var n;(0,i.Z)(this,e);var r=on(t),o=r.start,s=r.end;return(n=(0,c.Z)(this,e,[o?-1:5e8,s?1:-6e8,null,t])).tagName=t.tagName||"span",n.class=t.class||"",n.attrs=t.attributes||null,n}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"eq",value:function(t){return this==t||t instanceof e&&this.tagName==t.tagName&&this.class==t.class&&$e(this.attrs,t.attrs)}},{key:"range",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(t>=n)throw new RangeError("Mark decorations may not be empty");return(0,u.Z)((0,l.Z)(e.prototype),"range",this).call(this,t,n)}}]),e}(tn);en.prototype.point=!1;var nn=function(t){function e(t){return(0,i.Z)(this,e),(0,c.Z)(this,e,[-2e8,-2e8,null,t])}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"eq",value:function(t){return t instanceof e&&this.spec.class==t.spec.class&&$e(this.spec.attributes,t.spec.attributes)}},{key:"range",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return(0,u.Z)((0,l.Z)(e.prototype),"range",this).call(this,t,n)}}]),e}(tn);nn.prototype.mapMode=N.TrackBefore,nn.prototype.point=!0;var rn=function(t){function e(t,n,r,o,s,a){var h;return(0,i.Z)(this,e),(h=(0,c.Z)(this,e,[n,r,s,t])).block=o,h.isReplace=a,h.mapMode=o?n<=0?N.TrackBefore:N.TrackAfter:N.TrackDel,h}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"type",get:function(){return this.startSide<this.endSide?Qe.WidgetRange:this.startSide<=0?Qe.WidgetBefore:Qe.WidgetAfter}},{key:"heightRelevant",get:function(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}},{key:"eq",value:function(t){return t instanceof e&&(n=this.widget,i=t.widget,n==i||!!(n&&i&&n.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var n,i}},{key:"range",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return(0,u.Z)((0,l.Z)(e.prototype),"range",this).call(this,t,n)}}]),e}(tn);function on(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.inclusiveStart,i=t.inclusiveEnd;return null==n&&(n=t.inclusive),null==i&&(i=t.inclusive),{start:null!=n?n:e,end:null!=i?i:e}}function sn(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=n.length-1;r>=0&&n[r]+i>=t?n[r]=Math.max(n[r],e):n.push(t,e)}rn.prototype.point=!0;var an=function(t){function e(){var t;return(0,i.Z)(this,e),(t=(0,c.Z)(this,e,arguments)).children=[],t.length=0,t.prevAttrs=void 0,t.attrs=null,t.breakAfter=0,t}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"merge",value:function(t,n,i,r,o,s){if(i){if(!(i instanceof e))return!1;this.dom||i.transferDOM(this)}return r&&this.setDeco(i?i.attrs:null),Se(this,t,n,i?i.children:[],o,s),!0}},{key:"split",value:function(t){var n=new e;if(n.breakAfter=this.breakAfter,0==this.length)return n;var i=this.childPos(t),r=i.i,o=i.off;o&&(n.append(this.children[r].split(o),0),this.children[r].merge(o,this.children[r].length,null,!1,0,0),r++);for(var s=r;s<this.children.length;s++)n.append(this.children[s],0);for(;r>0&&0==this.children[r-1].length;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=t,n}},{key:"transferDOM",value:function(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(t){$e(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}},{key:"append",value:function(t,e){Je(this,t,e)}},{key:"addLineDeco",value:function(t){var e=t.spec.attributes,n=t.spec.class;e&&(this.attrs=Ge(e,this.attrs||{})),n&&(this.attrs=Ge({class:n},this.attrs||{}))}},{key:"domAtPos",value:function(t){return Ke(this,t)}},{key:"reuseDOM",value:function(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}},{key:"sync",value:function(t,n){var i;this.dom?4&this.dirty&&(pe(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&&(Xe(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),(0,u.Z)((0,l.Z)(e.prototype),"sync",this).call(this,t,n);for(var r=this.dom.lastChild;r&&ke.get(r)instanceof Le;)r=r.lastChild;if(!(r&&this.length&&("BR"==r.nodeName||0!=(null===(i=ke.get(r))||void 0===i?void 0:i.isEditable)||Pe.ios&&this.children.some((function(t){return t instanceof Ne}))))){var o=document.createElement("BR");o.cmIgnore=!0,this.dom.appendChild(o)}}},{key:"measureTextSize",value:function(){if(0==this.children.length||this.length>20)return null;var t,e,n=0,i=(0,o.Z)(this.children);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(!(r instanceof Ne)||/[^ -~]/.test(r.text))return null;var s=ie(r.dom);if(1!=s.length)return null;n+=s[0].width,t=s[0].height}}catch(a){i.e(a)}finally{i.f()}return n?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:n/this.length,textHeight:t}:null}},{key:"coordsAt",value:function(t,e){var n=Ue(this,t,e);if(!this.children.length&&n&&this.parent){var i=this.parent.view.viewState.heightOracle,r=n.bottom-n.top;if(Math.abs(r-i.lineHeight)<2&&i.textHeight<r){var o=(r-i.textHeight)/2;return{top:n.top+o,bottom:n.bottom-o,left:n.left,right:n.left}}}return n}},{key:"become",value:function(t){return!1}},{key:"type",get:function(){return Qe.Text}}],[{key:"find",value:function(t,n){for(var i=0,r=0;i<t.children.length;i++){var o=t.children[i],s=r+o.length;if(s>=n){if(o instanceof e)return o;if(s>n)break}r=s+o.breakAfter}return null}}]),e}(ke),hn=function(t){function e(t,n,r){var o;return(0,i.Z)(this,e),(o=(0,c.Z)(this,e)).widget=t,o.length=n,o.type=r,o.breakAfter=0,o.prevWidget=null,o}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"merge",value:function(t,n,i,r,o,s){return!(i&&(!(i instanceof e&&this.widget.compare(i.widget))||t>0&&o<=0||n<this.length&&s<=0))&&(this.length=t+(i?i.length:0)+(this.length-n),!0)}},{key:"domAtPos",value:function(t){return 0==t?me.before(this.dom):me.after(this.dom,t==this.length)}},{key:"split",value:function(t){var n=this.length-t;this.length=t;var i=new e(this.widget,n,this.type);return i.breakAfter=this.breakAfter,i}},{key:"children",get:function(){return ye}},{key:"sync",value:function(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.dom.contentEditable="false")}},{key:"overrideDOMText",get:function(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):v.empty}},{key:"domBoundsAround",value:function(){return null}},{key:"become",value:function(t){return t instanceof e&&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.type=t.type,this.breakAfter=t.breakAfter,!0)}},{key:"ignoreMutation",value:function(){return!0}},{key:"ignoreEvent",value:function(t){return this.widget.ignoreEvent(t)}},{key:"isEditable",get:function(){return!1}},{key:"isWidget",get:function(){return!0}},{key:"coordsAt",value:function(t,e){return this.widget.coordsAt(this.dom,t,e)}},{key:"destroy",value:function(){(0,u.Z)((0,l.Z)(e.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}]),e}(ke),un=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=o,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=e.iter(),this.skip=n}return(0,r.Z)(t,[{key:"posCovered",value:function(){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 hn&&t.type==Qe.WidgetBefore)}},{key:"getLine",value:function(){return this.curLine||(this.content.push(this.curLine=new an),this.atCursorPos=!0),this.curLine}},{key:"flushBuffer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(ln(new je(-1),t),t.length),this.pendingBuffer=0)}},{key:"addBlockWidget",value:function(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}},{key:"finish",value:function(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||this.getLine()}},{key:"buildText",value:function(t,e,n){for(;t>0;){if(this.textOff==this.text.length){var i=this.cursor.next(this.skip),r=i.value,o=i.lineBreak,s=i.done;if(this.skip=0,s)throw new Error("Ran out of text content when drawing inline views");if(o){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=r,this.textOff=0}var a=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-n)),this.getLine().append(ln(new Ne(this.text.slice(this.textOff,this.textOff+a)),e),n),this.atCursorPos=!0,this.textOff+=a,t-=a,n=0}}},{key:"span",value:function(t,e,n,i){this.buildText(e-t,n,i),this.pos=e,this.openStart<0&&(this.openStart=i)}},{key:"point",value:function(t,e,n,i,r,o){if(this.disallowBlockEffectsFor[o]&&n instanceof rn){if(n.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 s=e-t;if(n instanceof rn)if(n.block){var a=n.type;a!=Qe.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new hn(n.widget||new cn("div"),s,a))}else{var h=He.create(n.widget||new cn("span"),s,s?0:n.startSide),u=this.atCursorPos&&!h.isEditable&&r<=i.length&&(t<e||n.startSide>0),l=!h.isEditable&&(t<e||r>i.length||n.startSide<=0),c=this.getLine();2!=this.pendingBuffer||u||h.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),u&&(c.append(ln(new je(1),i),r),r=i.length+Math.max(0,r-i.length)),c.append(ln(h,i),r),this.atCursorPos=l,this.pendingBuffer=l?t<e||r>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);s&&(this.textOff+s<=this.text.length?this.textOff+=s:(this.skip+=s-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}}],[{key:"build",value:function(e,n,i,r,o){var s=new t(e,n,i,o);return s.openEnd=_t.spans(r,n,i,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}]),t}();function ln(t,e){var n,i=(0,o.Z)(e);try{for(i.s();!(n=i.n()).done;){var r=n.value;t=new Le(r,[t],t.length)}}catch(s){i.e(s)}finally{i.f()}return t}var cn=function(t){function e(t){var n;return(0,i.Z)(this,e),(n=(0,c.Z)(this,e)).tag=t,n}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"eq",value:function(t){return t.tag==this.tag}},{key:"toDOM",value:function(){return document.createElement(this.tag)}},{key:"updateDOM",value:function(t){return t.nodeName.toLowerCase()==this.tag}},{key:"isHidden",get:function(){return!0}}]),e}(Ye),fn=G.define(),dn=G.define(),vn=G.define(),gn=G.define(),pn=G.define(),mn=G.define(),yn=G.define(),kn=G.define({combine:function(t){return t.some((function(t){return t}))}}),wn=G.define({combine:function(t){return t.some((function(t){return t}))}}),bn=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"nearest",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"nearest",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5;(0,i.Z)(this,t),this.range=e,this.y=n,this.x=r,this.yMargin=o,this.xMargin=s}return(0,r.Z)(t,[{key:"map",value:function(e){return e.empty?this:new t(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}]),t}(),xn=At.define({map:function(t,e){return t.map(e)}});function Sn(t,e,n){var i=t.facet(gn);i.length?i[0](e):window.onerror?window.onerror(String(e),n,void 0,void 0,e):n?console.error(n+":",e):console.error(e)}var An=G.define({combine:function(t){return!t.length||t[0]}}),Mn=0,Zn=G.define(),Cn=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.id=e,this.create=n,this.domEventHandlers=r,this.extension=o(this)}return(0,r.Z)(t,null,[{key:"define",value:function(e,n){var i=n||{},r=i.eventHandlers,o=i.provide,s=i.decorations;return new t(Mn++,e,r,(function(t){var e=[Zn.of(t)];return s&&e.push(En.of((function(e){var n=e.plugin(t);return n?s(n):tn.none}))),o&&e.push(o(t)),e}))}},{key:"fromClass",value:function(e,n){return t.define((function(t){return new e(t)}),n)}}]),t}(),On=function(){function t(e){(0,i.Z)(this,t),this.spec=e,this.mustUpdate=null,this.value=null}return(0,r.Z)(t,[{key:"update",value:function(t){if(this.value){if(this.mustUpdate){var e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(n){if(Sn(e.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(Fl){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(n){Sn(t.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}},{key:"destroy",value:function(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(n){Sn(t.state,n,"CodeMirror plugin crashed")}}},{key:"deactivate",value:function(){this.spec=this.value=null}}]),t}(),Tn=G.define(),Dn=G.define(),En=G.define(),Bn=G.define(),Rn=G.define();function In(t){var e,n=0,i=0,r=0,s=0,a=(0,o.Z)(t.state.facet(Rn));try{for(a.s();!(e=a.n()).done;){var h=(0,e.value)(t);h&&(null!=h.left&&(n=Math.max(n,h.left)),null!=h.right&&(i=Math.max(i,h.right)),null!=h.top&&(r=Math.max(r,h.top)),null!=h.bottom&&(s=Math.max(s,h.bottom)))}}catch(u){a.e(u)}finally{a.f()}return{left:n,right:i,top:r,bottom:s}}var Pn=G.define(),Nn=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.fromA=e,this.toA=n,this.fromB=r,this.toB=o}return(0,r.Z)(t,[{key:"join",value:function(e){return new t(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}},{key:"addToSet",value:function(t){for(var e=t.length,n=this;e>0;e--){var i=t[e-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),t.splice(e-1,1)}}return t.splice(e,0,n),t}}],[{key:"extendWithRanges",value:function(e,n){if(0==n.length)return e;for(var i=[],r=0,o=0,s=0,a=0;;r++){for(var h=r==e.length?null:e[r],u=s-a,l=h?h.fromB:1e9;o<n.length&&n[o]<l;){var c=n[o],f=n[o+1],d=Math.max(a,c),v=Math.min(l,f);if(d<=v&&new t(d+u,v+u,d,v).addToSet(i),f>l)break;o+=2}if(!h)return i;new t(h.fromA,h.toA,h.fromB,h.toB).addToSet(i),s=h.toA,a=h.toB}}}]),t}(),Ln=function(){function t(e,n,r){(0,i.Z)(this,t),this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=V.empty(this.startState.doc.length);var s,a=(0,o.Z)(r);try{for(a.s();!(s=a.n()).done;){var h=s.value;this.changes=this.changes.compose(h.changes)}}catch(l){a.e(l)}finally{a.f()}var u=[];this.changes.iterChangedRanges((function(t,e,n,i){return u.push(new Nn(t,e,n,i))})),this.changedRanges=u}return(0,r.Z)(t,[{key:"viewportChanged",get:function(){return(4&this.flags)>0}},{key:"heightChanged",get:function(){return(2&this.flags)>0}},{key:"geometryChanged",get:function(){return this.docChanged||(10&this.flags)>0}},{key:"focusChanged",get:function(){return(1&this.flags)>0}},{key:"docChanged",get:function(){return!this.changes.empty}},{key:"selectionSet",get:function(){return this.transactions.some((function(t){return t.selection}))}},{key:"empty",get:function(){return 0==this.flags&&0==this.transactions.length}}],[{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}(),Vn=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Vn||(Vn={})),Hn=Vn.LTR,Wn=Vn.RTL;function _n(t){for(var e=[],n=0;n<t.length;n++)e.push(1<<+t[n]);return e}for(var zn=_n("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Fn=_n("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),qn=Object.create(null),jn=[],Kn=0,Jn=["()","[]","{}"];Kn<Jn.length;Kn++){var Un=Jn[Kn],Gn=Un.charCodeAt(0),$n=Un.charCodeAt(1);qn[Gn]=$n,qn[$n]=-Gn}function Xn(t){return t<=247?zn[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Fn[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203?256:64336<=t&&t<=65023?4:8204==t?256:1}var Yn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Qn=function(){function t(e,n,r){(0,i.Z)(this,t),this.from=e,this.to=n,this.level=r}return(0,r.Z)(t,[{key:"dir",get:function(){return this.level%2?Wn:Hn}},{key:"side",value:function(t,e){return this.dir==e==t?this.to:this.from}}],[{key:"find",value:function(t,e,n,i){for(var r=-1,o=0;o<t.length;o++){var s=t[o];if(s.from<=e&&s.to>=e){if(s.level==n)return o;(r<0||(0!=i?i<0?s.from<e:s.to>e:t[r].level>s.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}]),t}(),ti=[];function ei(t,e){var n=t.length,i=e==Hn?1:2,r=e==Hn?2:1;if(!t||1==i&&!Yn.test(t))return ni(n);for(var o=0,s=i,a=i;o<n;o++){var h=Xn(t.charCodeAt(o));512==h?h=s:8==h&&4==a&&(h=16),ti[o]=4==h?2:h,7&h&&(a=h),s=h}for(var u=0,l=i,c=i;u<n;u++){var f=ti[u];if(128==f)u<n-1&&l==ti[u+1]&&24&l?f=ti[u]=l:ti[u]=256;else if(64==f){for(var d=u+1;d<n&&64==ti[d];)d++;for(var v=u&&8==l||d<n&&8==ti[d]?1==c?1:8:256,g=u;g<d;g++)ti[g]=v;u=d-1}else 8==f&&1==c&&(ti[u]=1);l=f,7&f&&(c=f)}for(var p,m,y,k=0,w=0,b=0;k<n;k++)if(m=qn[p=t.charCodeAt(k)])if(m<0){for(var x=w-3;x>=0;x-=3)if(jn[x+1]==-m){var S=jn[x+2],A=2&S?i:4&S?1&S?r:i:0;A&&(ti[k]=ti[jn[x]]=A),w=x;break}}else{if(189==jn.length)break;jn[w++]=k,jn[w++]=p,jn[w++]=b}else if(2==(y=ti[k])||1==y){var M=y==i;b=M?0:1;for(var Z=w-3;Z>=0;Z-=3){var C=jn[Z+2];if(2&C)break;if(M)jn[Z+2]|=2;else{if(4&C)break;jn[Z+2]|=4}}}for(var O=0;O<n;O++)if(256==ti[O]){for(var T=O+1;T<n&&256==ti[T];)T++;for(var D=1==(O?ti[O-1]:i),E=D==(1==(T<n?ti[T]:i))?D?1:2:i,B=O;B<T;B++)ti[B]=E;O=T-1}var R=[];if(1==i)for(var I=0;I<n;){for(var P=I,N=1!=ti[I++];I<n&&N==(1!=ti[I]);)I++;if(N)for(var L=I;L>P;){for(var V=L,H=2!=ti[--L];L>P&&H==(2!=ti[L-1]);)L--;R.push(new Qn(L,V,H?2:1))}else R.push(new Qn(P,I,0))}else for(var W=0;W<n;){for(var _=W,z=2==ti[W++];W<n&&z==(2==ti[W]);)W++;R.push(new Qn(_,W,z?1:2))}return R}function ni(t){return[new Qn(0,t,0)]}var ii="";function ri(t,e,n,i,r){var o,s=i.head-t.from,a=-1;if(0==s){if(!r||!t.length)return null;e[0].level!=n&&(s=e[0].side(!1,n),a=0)}else if(s==t.length){if(r)return null;var h=e[e.length-1];h.level!=n&&(s=h.side(!0,n),a=e.length-1)}a<0&&(a=Qn.find(e,s,null!==(o=i.bidiLevel)&&void 0!==o?o:-1,i.assoc));var u=e[a];s==u.side(r,n)&&(s=(u=e[a+=r?1:-1]).side(!r,n));var l=r==(u.dir==n),c=O(t.text,s,l);if(ii=t.text.slice(Math.min(s,c),Math.max(s,c)),c!=u.side(r,n))return K.cursor(c+t.from,l?-1:1,u.level);var f=a==(r?e.length-1:0)?null:e[a+(r?1:-1)];return f||u.level==n?f&&f.level<u.level?K.cursor(f.side(!r,n)+t.from,r?1:-1,f.level):K.cursor(c+t.from,r?-1:1,u.level):K.cursor(r?t.to:t.from,r?-1:1,n)}var oi="￿",si=function(){function t(e,n){(0,i.Z)(this,t),this.points=e,this.text="",this.lineSeparator=n.facet(Nt.lineSeparator)}return(0,r.Z)(t,[{key:"append",value:function(t){this.text+=t}},{key:"lineBreak",value:function(){this.text+=oi}},{key:"readRange",value:function(t,e){if(!t)return this;for(var n=t.parentNode,i=t;;){this.findPointBefore(n,i);var r=this.text.length;this.readNode(i);var o=i.nextSibling;if(o==e)break;var s=ke.get(i),a=ke.get(o);(s&&a?s.breakAfter:(s?s.breakAfter:ai(i))||ai(o)&&("BR"!=i.nodeName||i.cmIgnore)&&this.text.length>r)&&this.lineBreak(),i=o}return this.findPointBefore(n,e),this}},{key:"readTextNode",value:function(t){var e,n=t.nodeValue,i=(0,o.Z)(this.points);try{for(i.s();!(e=i.n()).done;){var r=e.value;r.node==t&&(r.pos=this.text.length+Math.min(r.offset,n.length))}}catch(v){i.e(v)}finally{i.f()}for(var s=0,a=this.lineSeparator?null:/\r\n?|\n/g;;){var h=-1,u=1,l=void 0;if(this.lineSeparator?(h=n.indexOf(this.lineSeparator,s),u=this.lineSeparator.length):(l=a.exec(n))&&(h=l.index,u=l[0].length),this.append(n.slice(s,h<0?n.length:h)),h<0)break;if(this.lineBreak(),u>1){var c,f=(0,o.Z)(this.points);try{for(f.s();!(c=f.n()).done;){var d=c.value;d.node==t&&d.pos>this.text.length&&(d.pos-=u-1)}}catch(v){f.e(v)}finally{f.f()}}s=h+u}}},{key:"readNode",value:function(t){if(!t.cmIgnore){var e=ke.get(t),n=e&&e.overrideDOMText;if(null!=n){this.findPointInside(t,n.length);for(var i=n.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.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(t,e){var n,i=(0,o.Z)(this.points);try{for(i.s();!(n=i.n()).done;){var r=n.value;r.node==t&&t.childNodes[r.offset]==e&&(r.pos=this.text.length)}}catch(s){i.e(s)}finally{i.f()}}},{key:"findPointInside",value:function(t,e){var n,i=(0,o.Z)(this.points);try{for(i.s();!(n=i.n()).done;){var r=n.value;(3==t.nodeType?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+Math.min(e,r.offset))}}catch(s){i.e(s)}finally{i.f()}}}]),t}();function ai(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}var hi=(0,r.Z)((function t(e,n){(0,i.Z)(this,t),this.node=e,this.offset=n,this.pos=-1})),ui=function(t){function e(t){var n;return(0,i.Z)(this,e),(n=(0,c.Z)(this,e)).view=t,n.compositionDeco=tn.none,n.decorations=[],n.dynamicDecorationMap=[],n.minWidth=0,n.minWidthFrom=0,n.minWidthTo=0,n.impreciseAnchor=null,n.impreciseHead=null,n.forceSelection=!1,n.lastUpdate=Date.now(),n.setDOM(t.contentDOM),n.children=[new an],n.children[0].setParent((0,h.Z)(n)),n.updateDeco(),n.updateInner([new Nn(0,0,0,t.state.doc.length)],0),n}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"length",get:function(){return this.view.state.doc.length}},{key:"update",value:function(t){var e=this,n=t.changedRanges;this.minWidth>0&&n.length&&(n.every((function(t){var n=t.fromA;return t.toA<e.minWidthFrom||n>e.minWidthTo}))?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=tn.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){var n=ci(t);if(!n)return tn.none;var i=n.from,r=n.to,o=n.node,s=n.text,a=e.mapPos(i,1),h=Math.max(a,e.mapPos(r,-1)),u=t.state,l=new si([],u);3==o.nodeType?l.readTextNode(o):l.readRange(o.firstChild,null);var c=l.text;if(c.indexOf(oi)>-1)return tn.none;if(h-a<c.length)if(u.doc.sliceString(a,Math.min(u.doc.length,a+c.length))==c)h=a+c.length;else{if(u.doc.sliceString(Math.max(0,h-c.length),h)!=c)return tn.none;a=h-c.length}else if(u.doc.sliceString(a,h)!=c)return tn.none;var f=ke.get(o);f instanceof We?f=f.widget.topView:f&&(f.parent=null);return tn.set(tn.replace({widget:new fi(o,s,f),inclusive:!0}).range(a,h))}(this.view,t.changes)),(Pe.ie||Pe.chrome)&&!this.compositionDeco.size&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);var i,r,o,s,a=this.decorations,h=this.updateDeco(),u=(i=a,r=h,o=t.changes,s=new vi,_t.compare(i,r,o,s),s.changes);return n=Nn.extendWithRanges(n,u),(0!=this.dirty||0!=n.length)&&(this.updateInner(n,t.startState.doc.length),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}},{key:"updateInner",value:function(t,e){var n=this;this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e);var i=this.view.observer;i.ignore((function(){n.dom.style.height=n.view.viewState.contentHeight+"px",n.dom.style.flexBasis=n.minWidth?n.minWidth+"px":"";var t=Pe.chrome||Pe.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;n.sync(n.view,t),n.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(n.forceSelection=!0),n.dom.style.height=""}));var r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){var s,a=(0,o.Z)(this.children);try{for(a.s();!(s=a.n()).done;){var h=s.value;h instanceof hn&&h.widget instanceof li&&r.push(h.dom)}}catch(u){a.e(u)}finally{a.f()}}i.updateGaps(r)}},{key:"updateChildren",value:function(t,e){for(var n=this.childCursor(e),i=t.length-1;;i--){var r=i>=0?t[i]:null;if(!r)break;var o=r.fromA,s=r.toA,a=r.fromB,h=r.toB,u=un.build(this.view.state.doc,a,h,this.decorations,this.dynamicDecorationMap),l=u.content,c=u.breakAtStart,f=u.openStart,d=u.openEnd,v=n.findPos(s,1),g=v.i,p=v.off,m=n.findPos(o,-1);xe(this,m.i,m.off,g,p,l,c,f,d)}}},{key:"updateSelection",value:function(){var t=this,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();var n=this.view.root.activeElement,i=n==this.dom,r=!i&&ne(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(i||e||r){var o=this.forceSelection;this.forceSelection=!1;var s,a=this.view.state.selection.main,h=this.domAtPos(a.anchor),u=a.empty?h:this.domAtPos(a.head);if(Pe.gecko&&a.empty&&!this.compositionDeco.size&&(1==(s=h).node.nodeType&&s.node.firstChild&&(0==s.offset||"false"==s.node.childNodes[s.offset-1].contentEditable)&&(s.offset==s.node.childNodes.length||"false"==s.node.childNodes[s.offset].contentEditable))){var l=document.createTextNode("");this.view.observer.ignore((function(){return h.node.insertBefore(l,h.node.childNodes[h.offset]||null)})),h=u=new me(l,0),o=!0}var c=this.view.observer.selectionRange;!o&&c.focusNode&&re(h.node,h.offset,c.anchorNode,c.anchorOffset)&&re(u.node,u.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((function(){Pe.android&&Pe.chrome&&t.dom.contains(c.focusNode)&&function(t,e){for(var n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(c.focusNode,t.dom)&&(t.dom.blur(),t.dom.focus({preventScroll:!0}));var e,i,o=te(t.view.root);if(o)if(a.empty){if(Pe.gecko){var s=(e=h.node,i=h.offset,1!=e.nodeType?0:(i&&"false"==e.childNodes[i-1].contentEditable?1:0)|(i<e.childNodes.length&&"false"==e.childNodes[i].contentEditable?2:0));if(s&&3!=s){var l=di(h.node,h.offset,1==s?1:-1);l&&(h=new me(l,1==s?0:l.nodeValue.length))}}o.collapse(h.node,h.offset),null!=a.bidiLevel&&null!=c.cursorBidiLevel&&(c.cursorBidiLevel=a.bidiLevel)}else if(o.extend){o.collapse(h.node,h.offset);try{o.extend(u.node,u.offset)}catch(Fl){}}else{var f=document.createRange();if(a.anchor>a.head){var d=[u,h];h=d[0],u=d[1]}f.setEnd(u.node,u.offset),f.setStart(h.node,h.offset),o.removeAllRanges(),o.addRange(f)}else;r&&t.view.root.activeElement==t.dom&&(t.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(h,u)),this.impreciseAnchor=h.precise?null:new me(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new me(c.focusNode,c.focusOffset)}}},{key:"enforceCursorAssoc",value:function(){if(!this.compositionDeco.size){var t=this.view,e=t.state.selection.main,n=te(t.root),i=t.observer.selectionRange,r=i.anchorNode,o=i.anchorOffset;if(n&&e.empty&&e.assoc&&n.modify){var s=an.find(this,e.head);if(s){var a=s.posAtStart;if(e.head!=a&&e.head!=a+s.length){var h=this.coordsAt(e.head,-1),u=this.coordsAt(e.head,1);if(h&&u&&!(h.bottom>u.top)){var l=this.domAtPos(e.head+e.assoc);n.collapse(l.node,l.offset),n.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();var c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&n.collapse(r,o)}}}}}}},{key:"nearest",value:function(t){for(var e=t;e;){var n=ke.get(e);if(n&&n.rootView==this)return n;e=e.parentNode}return null}},{key:"posFromDOM",value:function(t,e){var n=this.nearest(t);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(t,e)+n.posAtStart}},{key:"domAtPos",value:function(t){for(var e=this.childCursor().findPos(t,-1),n=e.i,i=e.off;n<this.children.length-1;){var r=this.children[n];if(i<r.length||r instanceof an)break;n++,i=0}return this.children[n].domAtPos(i)}},{key:"coordsAt",value:function(t,e){for(var n=this.length,i=this.children.length-1;;i--){var r=this.children[i],o=n-r.breakAfter-r.length;if(t>o||t==o&&r.type!=Qe.WidgetBefore&&r.type!=Qe.WidgetAfter&&(!i||2==e||this.children[i-1].breakAfter||this.children[i-1].type==Qe.WidgetBefore&&e>-2))return r.coordsAt(t-o,e);n=o}}},{key:"measureVisibleLineHeights",value:function(t){for(var e=[],n=t.from,i=t.to,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==Vn.LTR,h=0,u=0;u<this.children.length;u++){var l=this.children[u],c=h+l.length;if(c>i)break;if(h>=n){var f=l.dom.getBoundingClientRect();if(e.push(f.height),o){var d=l.dom.lastChild,v=d?ie(d):[];if(v.length){var g=v[v.length-1],p=a?g.right-f.left:f.right-g.left;p>s&&(s=p,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=c)}}}h=c+l.breakAfter}return e}},{key:"textDirectionAt",value:function(t){var e=this.childPos(t,1).i;return"rtl"==getComputedStyle(this.children[e].dom).direction?Vn.RTL:Vn.LTR}},{key:"measureTextSize",value:function(){var t,e=this,n=(0,o.Z)(this.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(i instanceof an){var r=i.measureTextSize();if(r)return r}}}catch(l){n.e(l)}finally{n.f()}var s,a,h,u=document.createElement("div");return u.className="cm-line",u.style.width="99999px",u.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((function(){e.dom.appendChild(u);var t=ie(u.firstChild)[0];s=u.getBoundingClientRect().height,a=t?t.width/27:7,h=t?t.height:s,u.remove()})),{lineHeight:s,charWidth:a,textHeight:h}}},{key:"childCursor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length,e=this.children.length;return e&&(t-=this.children[--e].length),new be(this.children,t,e)}},{key:"computeBlockGapDeco",value:function(){for(var t=[],e=this.view.viewState,n=0,i=0;;i++){var r=i==e.viewports.length?null:e.viewports[i],o=r?r.from-1:this.length;if(o>n){var s=e.lineBlockAt(o).bottom-e.lineBlockAt(n).top;t.push(tn.replace({widget:new li(s),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return tn.set(t)}},{key:"updateDeco",value:function(){for(var t=this,e=this.view.state.facet(En).map((function(e,n){return(t.dynamicDecorationMap[n]="function"==typeof e)?e(t.view):e})),n=e.length;n<e.length+3;n++)this.dynamicDecorationMap[n]=!1;return this.decorations=[].concat((0,d.Z)(e),[this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco])}},{key:"scrollIntoView",value:function(t){var e,n=t.range,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(i){!n.empty&&(e=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,e.left),top:Math.min(i.top,e.top),right:Math.max(i.right,e.right),bottom:Math.max(i.bottom,e.bottom)});var r=In(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom};!function(t,e,n,i,r,o,s,a){for(var h=t.ownerDocument,u=h.defaultView||window,l=t;l;)if(1==l.nodeType){var c=void 0,f=l==h.body;if(f)c=ue(u);else{if(l.scrollHeight<=l.clientHeight&&l.scrollWidth<=l.clientWidth){l=l.assignedSlot||l.parentNode;continue}var d=l.getBoundingClientRect();c={left:d.left,right:d.left+l.clientWidth,top:d.top,bottom:d.top+l.clientHeight}}var v=0,g=0;if("nearest"==r)e.top<c.top?(g=-(c.top-e.top+s),n>0&&e.bottom>c.bottom+g&&(g=e.bottom-c.bottom+g+s)):e.bottom>c.bottom&&(g=e.bottom-c.bottom+s,n<0&&e.top-g<c.top&&(g=-(c.top+g-e.top+s)));else{var p=e.bottom-e.top,m=c.bottom-c.top;g=("center"==r&&p<=m?e.top+p/2-m/2:"start"==r||"center"==r&&n<0?e.top-s:e.bottom-m+s)-c.top}if("nearest"==i?e.left<c.left?(v=-(c.left-e.left+o),n>0&&e.right>c.right+v&&(v=e.right-c.right+v+o)):e.right>c.right&&(v=e.right-c.right+o,n<0&&e.left<c.left+v&&(v=-(c.left+v-e.left+o))):v=("center"==i?e.left+(e.right-e.left)/2-(c.right-c.left)/2:"start"==i==a?e.left-o:e.right-(c.right-c.left)+o)-c.left,v||g)if(f)u.scrollBy(v,g);else{var y=0,k=0;if(g){var w=l.scrollTop;l.scrollTop+=g,k=l.scrollTop-w}if(v){var b=l.scrollLeft;l.scrollLeft+=v,y=l.scrollLeft-b}e={left:e.left-y,top:e.top-k,right:e.right-y,bottom:e.bottom-k},y&&Math.abs(y-v)<1&&(i="nearest"),k&&Math.abs(k-g)<1&&(r="nearest")}if(f)break;l=l.assignedSlot||l.parentNode}else{if(11!=l.nodeType)break;l=l.host}}(this.view.scrollDOM,o,n.head<n.anchor?-1:1,t.x,t.y,t.xMargin,t.yMargin,this.view.textDirection==Vn.LTR)}}}]),e}(ke);var li=function(t){function e(t){var n;return(0,i.Z)(this,e),(n=(0,c.Z)(this,e)).height=t,n}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"toDOM",value:function(){var t=document.createElement("div");return this.updateDOM(t),t}},{key:"eq",value:function(t){return t.height==this.height}},{key:"updateDOM",value:function(t){return t.style.height=this.height+"px",!0}},{key:"estimatedHeight",get:function(){return this.height}}]),e}(Ye);function ci(t){var e=t.observer.selectionRange,n=e.focusNode&&di(e.focusNode,e.focusOffset,0);if(!n)return null;var i=t.docView.nearest(n);if(!i)return null;if(i instanceof an){for(var r=n;r.parentNode!=i.dom;)r=r.parentNode;for(var o=r.previousSibling;o&&!ke.get(o);)o=o.previousSibling;var s=o?ke.get(o).posAtEnd:i.posAtStart;return{from:s,to:s,node:r,text:n}}for(;;){var a=i.parent;if(!a)return null;if(a instanceof an)break;i=a}var h=i.posAtStart;return{from:h,to:h+i.length,node:i.dom,text:n}}var fi=function(t){function e(t,n,r){var o;return(0,i.Z)(this,e),(o=(0,c.Z)(this,e)).top=t,o.text=n,o.topView=r,o}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"eq",value:function(t){return this.top==t.top&&this.text==t.text}},{key:"toDOM",value:function(){return this.top}},{key:"ignoreEvent",value:function(){return!1}},{key:"customView",get:function(){return We}}]),e}(Ye);function di(t,e,n){if(n<=0)for(var i=t,r=e;;){if(3==i.nodeType)return i;if(!(1==i.nodeType&&r>0))break;r=ae(i=i.childNodes[r-1])}if(n>=0)for(var o=t,s=e;;){if(3==o.nodeType)return o;if(!(1==o.nodeType&&s<o.childNodes.length&&n>=0))break;o=o.childNodes[s],s=0}return null}var vi=function(){function t(){(0,i.Z)(this,t),this.changes=[]}return(0,r.Z)(t,[{key:"compareRange",value:function(t,e){sn(t,e,this.changes)}},{key:"comparePoint",value:function(t,e){sn(t,e,this.changes)}}]),t}();function gi(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function pi(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function mi(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function yi(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function ki(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function wi(t,e,n){for(var i,r,o,s,a,h,u,l,c=!1,f=t.firstChild;f;f=f.nextSibling)for(var d=ie(f),v=0;v<d.length;v++){var g=d[v];r&&mi(r,g)&&(g=yi(ki(g,r.bottom),r.top));var p=gi(e,g),m=pi(n,g);if(0==p&&0==m)return 3==f.nodeType?bi(f,e,n):wi(f,e,n);if(!i||s>m||s==m&&o>p){i=f,r=g,o=p,s=m;var y=m?n<g.top?-1:1:p?e<g.left?-1:1:0;c=!y||(y>0?v<d.length-1:v>0)}0==p?n>g.bottom&&(!u||u.bottom<g.bottom)?(a=f,u=g):n<g.top&&(!l||l.top>g.top)&&(h=f,l=g):u&&mi(u,g)?u=ki(u,g.bottom):l&&mi(l,g)&&(l=yi(l,g.top))}if(u&&u.bottom>=n?(i=a,r=u):l&&l.top<=n&&(i=h,r=l),!i)return{node:t,offset:0};var k=Math.max(r.left,Math.min(r.right,e));return 3==i.nodeType?bi(i,k,n):c&&"false"!=i.contentEditable?wi(i,k,n):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,i)+(e>=(r.left+r.right)/2?1:0)}}function bi(t,e,n){for(var i=t.nodeValue.length,r=-1,o=1e9,s=0,a=0;a<i;a++)for(var h=ve(t,a,a+1).getClientRects(),u=0;u<h.length;u++){var l=h[u];if(l.top!=l.bottom){s||(s=e-l.left);var c=(l.top>n?l.top-n:n-l.bottom)-1;if(l.left-1<=e&&l.right+1>=e&&c<o){var f=e>=(l.left+l.right)/2,d=f;if(Pe.chrome||Pe.gecko)ve(t,a).getBoundingClientRect().left==l.right&&(d=!f);if(c<=0)return{node:t,offset:a+(d?1:0)};r=a+(d?1:0),o=c}}}return{node:t,offset:r>-1?r:s>0?t.nodeValue.length:0}}function xi(t,e,n){var i,r,o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=t.contentDOM.getBoundingClientRect(),h=a.top+t.viewState.paddingTop,u=t.viewState.docHeight,l=e.x,c=e.y,f=c-h;if(f<0)return 0;if(f>u)return t.state.doc.length;for(var d=t.viewState.heightOracle.textHeight/2,v=!1;(o=t.elementAtHeight(f)).type!=Qe.Text;)for(;!((f=s>0?o.bottom+d:o.top-d)>=0&&f<=u);){if(v)return n?null:0;v=!0,s=-s}c=h+f;var g=o.from;if(g<t.viewport.from)return 0==t.viewport.from?0:n?null:Si(t,a,o,l,c);if(g>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:Si(t,a,o,l,c);var p=t.dom.ownerDocument,m=t.root.elementFromPoint?t.root:p,y=m.elementFromPoint(l,c);y&&!t.contentDOM.contains(y)&&(y=null),y||(l=Math.max(a.left+1,Math.min(a.right-1,l)),(y=m.elementFromPoint(l,c))&&!t.contentDOM.contains(y)&&(y=null));var k,w=-1;if(y&&0!=(null===(i=t.docView.nearest(y))||void 0===i?void 0:i.isEditable))if(p.caretPositionFromPoint){var b=p.caretPositionFromPoint(l,c);b&&(k=b.offsetNode,w=b.offset)}else if(p.caretRangeFromPoint){var x=p.caretRangeFromPoint(l,c);x&&(k=x.startContainer,w=x.startOffset,(!t.contentDOM.contains(k)||Pe.safari&&function(t,e,n){var i;if(3!=t.nodeType||e!=(i=t.nodeValue.length))return!1;for(var r=t.nextSibling;r;r=r.nextSibling)if(1!=r.nodeType||"BR"!=r.nodeName)return!1;return ve(t,i-1,i).getBoundingClientRect().left>n}(k,w,l)||Pe.chrome&&function(t,e,n){if(0!=e)return!1;for(var i=t;;){var r=i.parentNode;if(!r||1!=r.nodeType||r.firstChild!=i)return!1;if(r.classList.contains("cm-line"))break;i=r}var o=1==t.nodeType?t.getBoundingClientRect():ve(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-o.left>5}(k,w,l))&&(k=void 0))}if(!k||!t.docView.dom.contains(k)){var S=an.find(t.docView,g);if(!S)return f>o.top+o.height/2?o.to:o.from;var A=wi(S.dom,l,c);k=A.node,w=A.offset}var M=t.docView.nearest(k);if(!M)return null;if(M.isWidget&&1==(null===(r=M.dom)||void 0===r?void 0:r.nodeType)){var Z=M.dom.getBoundingClientRect();return e.y<Z.top||e.y<=Z.bottom&&e.x<=(Z.left+Z.right)/2?M.posAtStart:M.posAtEnd}return M.localPosFromDOM(k,w)+M.posAtStart}function Si(t,e,n,i,r){var o=Math.round((i-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>1.5*t.defaultLineHeight){var s=t.viewState.heightOracle.textHeight;o+=Math.floor((r-n.top-.5*(t.defaultLineHeight-s))/s)*t.viewState.heightOracle.lineLength}var a=t.state.sliceDoc(n.from,n.to);return n.from+function(t,e,n,i){for(var r=0,o=0;;){if(o>=e)return r;if(r==t.length)break;o+=9==t.charCodeAt(r)?n-o%n:1,r=O(t,r)}return!0===i?-1:t.length}(a,o,t.state.tabSize)}function Ai(t,e){var n=t.lineBlockAt(e);if(Array.isArray(n.type)){var i,r=(0,o.Z)(n.type);try{for(r.s();!(i=r.n()).done;){var s=i.value;if(s.to>e||s.to==e&&(s.to==n.to||s.type==Qe.Text))return s}}catch(a){r.e(a)}finally{r.f()}}return n}function Mi(t,e,n,i){for(var r=t.state.doc.lineAt(e.head),o=t.bidiSpans(r),s=t.textDirectionAt(r.from),a=e,h=null;;){var u=ri(r,o,s,a,n),l=ii;if(!u){if(r.number==(n?t.state.doc.lines:1))return a;l="\n",r=t.state.doc.line(r.number+(n?1:-1)),o=t.bidiSpans(r),u=K.cursor(n?r.from:r.to)}if(h){if(!h(l))return a}else{if(!i)return u;h=i(l)}a=u}}function Zi(t,e,n){for(var i,r=function(){var i,r=0,s=(0,o.Z)(t);try{for(s.s();!(i=s.n()).done;){i.value.between(e-1,e+1,(function(t,i,o){if(e>t&&e<i){var s=r||n||(e-t<i-e?-1:1);e=s<0?t:i,r=s}}))}}catch(a){s.e(a)}finally{s.f()}if(!r)return{v:e}};;)if(i=r())return i.v}function Ci(t,e,n){var i=Zi(t.state.facet(Bn).map((function(e){return e(t)})),n.from,e.head>n.from?-1:1);return i==n.from?n:K.cursor(i,i<n.from?1:-1)}var Oi=function(){function t(e){var n=this;(0,i.Z)(this,t),this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;var r=function(t,i){n.ignoreDuringComposition(i)||"keydown"==i.type&&n.keydown(e,i)||(n.mustFlushObserver(i)&&e.observer.forceFlush(),n.runCustomHandlers(i.type,e,i)?i.preventDefault():t(e,i))},o=function(){var t=Pi[s];e.contentDOM.addEventListener(s,(function(n){Ii(e,n)&&r(t,n)}),Ni[s]),n.registeredEvents.push(s)};for(var s in Pi)o();e.scrollDOM.addEventListener("mousedown",(function(t){if(t.target==e.scrollDOM&&t.clientY>e.contentDOM.getBoundingClientRect().bottom&&(r(Pi.mousedown,t),!t.defaultPrevented&&2==t.button)){var n=e.contentDOM.style.minHeight;e.contentDOM.style.minHeight="100%",setTimeout((function(){return e.contentDOM.style.minHeight=n}),200)}})),e.scrollDOM.addEventListener("drop",(function(t){t.target==e.scrollDOM&&t.clientY>e.contentDOM.getBoundingClientRect().bottom&&r(Pi.drop,t)})),Pe.chrome&&102==Pe.chrome_version&&e.scrollDOM.addEventListener("wheel",(function(){n.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(n.chromeScrollHack),n.chromeScrollHack=setTimeout((function(){n.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""}),100)}),{passive:!0}),this.notifiedFocused=e.hasFocus,Pe.safari&&e.contentDOM.addEventListener("input",(function(){return null}))}return(0,r.Z)(t,[{key:"setSelectionOrigin",value:function(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}},{key:"ensureHandlers",value:function(t,e){var n,i,r=this;this.customHandlers=[];var s,a=(0,o.Z)(e);try{for(a.s();!(s=a.n()).done;){var h=s.value;if(i=null===(n=h.update(t).spec)||void 0===n?void 0:n.domEventHandlers){this.customHandlers.push({plugin:h.value,handlers:i});var u=function(e){r.registeredEvents.indexOf(e)<0&&"scroll"!=e&&(r.registeredEvents.push(e),t.contentDOM.addEventListener(e,(function(n){Ii(t,n)&&r.runCustomHandlers(e,t,n)&&n.preventDefault()})))};for(var l in i)u(l)}}}catch(c){a.e(c)}finally{a.f()}}},{key:"runCustomHandlers",value:function(t,e,n){var i,r=(0,o.Z)(this.customHandlers);try{for(r.s();!(i=r.n()).done;){var s=i.value,a=s.handlers[t];if(a)try{if(a.call(s.plugin,n,e)||n.defaultPrevented)return!0}catch(h){Sn(e.state,h)}}}catch(u){r.e(u)}finally{r.f()}return!1}},{key:"runScrollHandlers",value:function(t,e){this.lastScrollTop=t.scrollDOM.scrollTop,this.lastScrollLeft=t.scrollDOM.scrollLeft;var n,i=(0,o.Z)(this.customHandlers);try{for(i.s();!(n=i.n()).done;){var r=n.value,s=r.handlers.scroll;if(s)try{s.call(r.plugin,e,t)}catch(a){Sn(t.state,a)}}}catch(h){i.e(h)}finally{i.f()}}},{key:"keydown",value:function(t,e){var n,i=this;return this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&Date.now()<this.lastEscPress+2e3||(27!=e.keyCode&&Ei.indexOf(e.keyCode)<0&&(t.inputState.lastEscPress=0),!Pe.android||!Pe.chrome||e.synthetic||13!=e.keyCode&&8!=e.keyCode?!(!Pe.ios||e.synthetic||e.altKey||e.metaKey||!((n=Ti.find((function(t){return t.keyCode==e.keyCode})))&&!e.ctrlKey||Di.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey))&&(this.pendingIOSKey=n||e,setTimeout((function(){return i.flushIOSKey(t)}),250),!0):(t.observer.delayAndroidKey(e.key,e.keyCode),!0))}},{key:"flushIOSKey",value:function(t){var e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,ge(t.contentDOM,e.key,e.keyCode))}},{key:"ignoreDuringComposition",value:function(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Pe.safari&&!Pe.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}},{key:"mustFlushObserver",value:function(t){return"keydown"==t.type&&229!=t.keyCode}},{key:"startMouseSelection",value:function(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}},{key:"update",value:function(t){this.mouseSelection&&this.mouseSelection.update(t),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}},{key:"destroy",value:function(){this.mouseSelection&&this.mouseSelection.destroy()}}]),t}(),Ti=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Di="dthko",Ei=[16,17,18,20,91,92,224,225];function Bi(t){return.7*Math.max(0,t)+8}var Ri=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.view=e,this.style=r,this.mustSelect=o,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParent=function(t){for(var e=t.ownerDocument,n=t.parentNode;n&&n!=e.body;)if(1==n.nodeType){if(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else{if(11!=n.nodeType)break;n=n.host}return null}(e.contentDOM),this.atoms=e.state.facet(Bn).map((function(t){return t(e)}));var s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Nt.allowMultipleSelections)&&function(t,e){var n=t.state.facet(fn);return n.length?n[0](e):Pe.mac?e.metaKey:e.ctrlKey}(e,n),this.dragging=!(!function(t,e){var n=t.state.selection.main;if(n.empty)return!1;var i=te(t.root);if(!i||0==i.rangeCount)return!0;for(var r=i.getRangeAt(0).getClientRects(),o=0;o<r.length;o++){var s=r[o];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}(e,n)||1!=Ui(n))&&null}return(0,r.Z)(t,[{key:"start",value:function(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}},{key:"move",value:function(t){var e;if(0==t.buttons)return this.destroy();if(!1===this.dragging){this.select(this.lastEvent=t);var n=0,i=0,r=(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},o=In(this.view);t.clientX-o.left<=r.left+6?n=-Bi(r.left-t.clientX):t.clientX+o.right>=r.right-6&&(n=Bi(t.clientX-r.right)),t.clientY-o.top<=r.top+6?i=-Bi(r.top-t.clientY):t.clientY+o.bottom>=r.bottom-6&&(i=Bi(t.clientY-r.bottom)),this.setScrollSpeed(n,i)}}},{key:"up",value:function(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}},{key:"destroy",value:function(){this.setScrollSpeed(0,0);var t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}},{key:"setScrollSpeed",value:function(t,e){var n=this;this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval((function(){return n.scroll()}),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}},{key:"scroll",value:function(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}},{key:"skipAtoms",value:function(t){for(var e=null,n=0;n<t.ranges.length;n++){var i=t.ranges[n],r=null;if(i.empty){var o=Zi(this.atoms,i.from,0);o!=i.from&&(r=K.cursor(o,-1))}else{var s=Zi(this.atoms,i.from,-1),a=Zi(this.atoms,i.to,1);s==i.from&&a==i.to||(r=K.range(i.from==i.anchor?s:a,i.from==i.head?s:a))}r&&(e||(e=t.ranges.slice()),e[n]=r)}return e?K.create(e,t.mainIndex):t}},{key:"select",value:function(t){var e=this.view,n=this.skipAtoms(this.style.get(t,this.extend,this.multiple));!this.mustSelect&&n.eq(e.state.selection)&&n.main.assoc==e.state.selection.main.assoc||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}},{key:"update",value:function(t){var e=this;t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((function(){return e.select(e.lastEvent)}),20)}}]),t}();function Ii(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var n,i=e.target;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=ke.get(i))&&n.ignoreEvent(e))return!1;return!0}var Pi=Object.create(null),Ni=Object.create(null),Li=Pe.ie&&Pe.ie_version<15||Pe.ios&&Pe.webkit_version<604;function Vi(t,e){var n,i=t.state,r=1,o=i.toText(e),s=o.lines==i.selection.ranges.length,a=null!=$i&&i.selection.ranges.every((function(t){return t.empty}))&&$i==o.toString();if(a){var h=-1;n=i.changeByRange((function(t){var n=i.doc.lineAt(t.from);if(n.from==h)return{range:t};h=n.from;var a=i.toText((s?o.line(r++).text:e)+i.lineBreak);return{changes:{from:n.from,insert:a},range:K.cursor(t.from+a.length)}}))}else n=s?i.changeByRange((function(t){var e=o.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:K.cursor(t.from+e.length)}})):i.replaceSelection(o);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function Hi(t,e,n,i){if(1==i)return K.cursor(e,n);if(2==i)return function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=t.charCategorizer(e),r=t.doc.lineAt(e),o=e-r.from;if(0==r.length)return K.cursor(e);0==o?n=1:o==r.length&&(n=-1);var s=o,a=o;n<0?s=O(r.text,o,!1):a=O(r.text,o);for(var h=i(r.text.slice(s,a));s>0;){var u=O(r.text,s,!1);if(i(r.text.slice(u,s))!=h)break;s=u}for(;a<r.length;){var l=O(r.text,a);if(i(r.text.slice(a,l))!=h)break;a=l}return K.range(s+r.from,a+r.from)}(t.state,e,n);var r=an.find(t.docView,e),o=t.state.doc.lineAt(r?r.posAtEnd:e),s=r?r.posAtStart:o.from,a=r?r.posAtEnd:o.to;return a<t.state.doc.length&&a==o.to&&a++,K.range(s,a)}Pi.keydown=function(t,e){t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Pi.touchstart=function(t,e){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Pi.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer")},Ni.touchstart=Ni.touchmove={passive:!0},Pi.mousedown=function(t,e){if(t.observer.flush(),!(t.inputState.lastTouchTime>Date.now()-2e3)){var n,i=null,r=(0,o.Z)(t.state.facet(vn));try{for(r.s();!(n=r.n()).done;){if(i=(0,n.value)(t,e))break}}catch(a){r.e(a)}finally{r.f()}if(i||0!=e.button||(i=function(t,e){var n=Fi(t,e),i=Ui(e),r=t.state.selection;return{update:function(t){t.docChanged&&(n.pos=t.changes.mapPos(n.pos),r=r.map(t.changes))},get:function(e,o,s){var a,h=Fi(t,e),u=Hi(t,h.pos,h.bias,i);if(n.pos!=h.pos&&!o){var l=Hi(t,n.pos,n.bias,i),c=Math.min(l.from,u.from),f=Math.max(l.to,u.to);u=c<u.from?K.range(c,f):K.range(f,c)}return o?r.replaceRange(r.main.extend(u.from,u.to)):s&&1==i&&r.ranges.length>1&&(a=function(t,e){for(var n=0;n<t.ranges.length;n++){var i=t.ranges[n],r=i.from,o=i.to;if(r<=e&&o>=e)return K.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}(r,h.pos))?a:s?r.addRange(u):K.create([u])}}}(t,e)),i){var s=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new Ri(t,e,i,s)),s&&t.observer.ignore((function(){return de(t.contentDOM)})),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}}};var Wi=function(t,e){return t>=e.top&&t<=e.bottom},_i=function(t,e,n){return Wi(e,n)&&t>=n.left&&t<=n.right};function zi(t,e,n,i){var r=an.find(t.docView,e);if(!r)return 1;var o=e-r.posAtStart;if(0==o)return 1;if(o==r.length)return-1;var s=r.coordsAt(o,-1);if(s&&_i(n,i,s))return-1;var a=r.coordsAt(o,1);return a&&_i(n,i,a)?1:s&&Wi(i,s)?-1:1}function Fi(t,e){var n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:zi(t,n,e.clientX,e.clientY)}}var qi=Pe.ie&&Pe.ie_version<=11,ji=null,Ki=0,Ji=0;function Ui(t){if(!qi)return t.detail;var e=ji,n=Ji;return ji=t,Ji=Date.now(),Ki=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Ki+1)%3:1}function Gi(t,e,n,i){if(n){var r=t.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();var o=t.inputState.mouseSelection,s=i&&o&&o.dragging&&function(t,e){var n=t.state.facet(dn);return n.length?n[0](e):Pe.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:o.dragging.from,to:o.dragging.to}:null,a={from:r,insert:n},h=t.state.changes(s?[s,a]:a);t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(r,-1),head:h.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"})}}Pi.dragstart=function(t,e){var n=t.state.selection.main,i=t.inputState.mouseSelection;i&&(i.dragging=n),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(n.from,n.to)),e.dataTransfer.effectAllowed="copyMove")},Pi.drop=function(t,e){if(e.dataTransfer){if(t.state.readOnly)return e.preventDefault();var n=e.dataTransfer.files;if(n&&n.length){e.preventDefault();for(var i=Array(n.length),r=0,o=function(){++r==n.length&&Gi(t,e,i.filter((function(t){return null!=t})).join(t.state.lineBreak),!1)},s=function(t){var e=new FileReader;e.onerror=o,e.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(i[t]=e.result),o()},e.readAsText(n[t])},a=0;a<n.length;a++)s(a)}else Gi(t,e,e.dataTransfer.getData("Text"),!0)}},Pi.paste=function(t,e){if(t.state.readOnly)return e.preventDefault();t.observer.flush();var n=Li?null:e.clipboardData;n?(Vi(t,n.getData("text/plain")||n.getData("text/uri-text")),e.preventDefault()):function(t){var e=t.dom.parentNode;if(e){var n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((function(){t.focus(),n.remove(),Vi(t,n.value)}),50)}}(t)};var $i=null;Pi.copy=Pi.cut=function(t,e){var n=function(t){var e,n=[],i=[],r=!1,s=(0,o.Z)(t.selection.ranges);try{for(s.s();!(e=s.n()).done;){var a=e.value;a.empty||(n.push(t.sliceDoc(a.from,a.to)),i.push(a))}}catch(d){s.e(d)}finally{s.f()}if(!n.length){var h,u=-1,l=(0,o.Z)(t.selection.ranges);try{for(l.s();!(h=l.n()).done;){var c=h.value.from,f=t.doc.lineAt(c);f.number>u&&(n.push(f.text),i.push({from:f.from,to:Math.min(t.doc.length,f.to+1)})),u=f.number}}catch(d){l.e(d)}finally{l.f()}r=!0}return{text:n.join(t.lineBreak),ranges:i,linewise:r}}(t.state),i=n.text,r=n.ranges,s=n.linewise;if(i||s){$i=s?i:null;var a=Li?null:e.clipboardData;a?(e.preventDefault(),a.clearData(),a.setData("text/plain",i)):function(t,e){var n=t.dom.parentNode;if(n){var i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout((function(){i.remove(),t.focus()}),50)}}(t,i),"cut"!=e.type||t.state.readOnly||t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"})}};var Xi=bt.define();function Yi(t,e){var n,i=[],r=(0,o.Z)(t.facet(yn));try{for(r.s();!(n=r.n()).done;){var s=(0,n.value)(t,e);s&&i.push(s)}}catch(a){r.e(a)}finally{r.f()}return i?t.update({effects:i,annotations:Xi.of(!0)}):null}function Qi(t){setTimeout((function(){var e=t.hasFocus;if(e!=t.inputState.notifiedFocused){var n=Yi(t.state,e);n?t.dispatch(n):t.update([])}}),10)}Pi.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),Qi(t)},Pi.blur=function(t){t.observer.clearSelectionRange(),Qi(t)},Pi.compositionstart=Pi.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Pi.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,Pe.chrome&&Pe.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((function(){return t.observer.flush()})):setTimeout((function(){t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Pi.contextmenu=function(t){t.inputState.lastContextMenu=Date.now()},Pi.beforeinput=function(t,e){var n,i;if(Pe.chrome&&Pe.android&&(i=Ti.find((function(t){return t.inputType==e.inputType})))&&(t.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){var r=(null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0;setTimeout((function(){var e;((null===(e=window.visualViewport)||void 0===e?void 0:e.height)||0)>r+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)}};var tr=["pre-wrap","normal","pre-line","break-spaces"],er=function(){function t(e){(0,i.Z)(this,t),this.lineWrapping=e,this.doc=v.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}return(0,r.Z)(t,[{key:"heightForGap",value:function(t,e){var n=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((e-t-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}},{key:"heightForLine",value:function(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}},{key:"setDoc",value:function(t){return this.doc=t,this}},{key:"mustRefreshForWrapping",value:function(t){return tr.indexOf(t)>-1!=this.lineWrapping}},{key:"mustRefreshForHeights",value:function(t){for(var e=!1,n=0;n<t.length;n++){var i=t[n];i<0?n++:this.heightSamples[Math.floor(10*i)]||(e=!0,this.heightSamples[Math.floor(10*i)]=!0)}return e}},{key:"refresh",value:function(t,e,n,i,r,o){var s=tr.indexOf(t)>-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=e,this.charWidth=n,this.textHeight=i,this.lineLength=r,a){this.heightSamples={};for(var h=0;h<o.length;h++){var u=o[h];u<0?h++:this.heightSamples[Math.floor(10*u)]=!0}}return a}}]),t}(),nr=function(){function t(e,n){(0,i.Z)(this,t),this.from=e,this.heights=n,this.index=0}return(0,r.Z)(t,[{key:"more",get:function(){return this.index<this.heights.length}}]),t}(),ir=function(){function t(e,n,r,o,s){(0,i.Z)(this,t),this.from=e,this.length=n,this.top=r,this.height=o,this._content=s}return(0,r.Z)(t,[{key:"type",get:function(){return"number"==typeof this._content?Qe.Text:Array.isArray(this._content)?this._content:this._content.type}},{key:"to",get:function(){return this.from+this.length}},{key:"bottom",get:function(){return this.top+this.height}},{key:"widget",get:function(){return this._content instanceof rn?this._content.widget:null}},{key:"widgetLineBreaks",get:function(){return"number"==typeof this._content?this._content:0}},{key:"join",value:function(e){var n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new t(this.from,this.length+e.length,this.top,this.height+e.height,n)}}]),t}(),rr=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(rr||(rr={})),or=.001,sr=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;(0,i.Z)(this,t),this.length=e,this.height=n,this.flags=r}return(0,r.Z)(t,[{key:"outdated",get:function(){return(2&this.flags)>0},set:function(t){this.flags=(t?2:0)|-3&this.flags}},{key:"setHeight",value:function(t,e){this.height!=e&&(Math.abs(this.height-e)>or&&(t.heightChanged=!0),this.height=e)}},{key:"replace",value:function(e,n,i){return t.of(i)}},{key:"decomposeLeft",value:function(t,e){e.push(this)}},{key:"decomposeRight",value:function(t,e){e.push(this)}},{key:"applyChanges",value:function(t,e,n,i){for(var r=this,o=n.doc,s=i.length-1;s>=0;s--){var a=i[s],h=a.fromA,u=a.toA,l=a.fromB,c=a.toB,f=r.lineAt(h,rr.ByPosNoHeight,n.setDoc(e),0,0),d=f.to>=u?f:r.lineAt(u,rr.ByPosNoHeight,n,0,0);for(c+=d.to-u,u=d.to;s>0&&f.from<=i[s-1].toA;)h=i[s-1].fromA,l=i[s-1].fromB,s--,h<f.from&&(f=r.lineAt(h,rr.ByPosNoHeight,n,0,0));l+=f.from-h,h=f.from;var v=fr.build(n.setDoc(o),t,l,c);r=r.replace(h,u,v)}return r.updateHeight(n,0)}}],[{key:"empty",value:function(){return new hr(0,0)}},{key:"of",value:function(e){if(1==e.length)return e[0];for(var n=0,i=e.length,r=0,o=0;;)if(n==i)if(r>2*o){var s=e[n-1];s.break?e.splice(--n,1,s.left,null,s.right):e.splice(--n,1,s.left,s.right),i+=1+s.break,r-=s.size}else{if(!(o>2*r))break;var a=e[i];a.break?e.splice(i,1,a.left,null,a.right):e.splice(i,1,a.left,a.right),i+=2+a.break,o-=a.size}else if(r<o){var h=e[n++];h&&(r+=h.size)}else{var u=e[--i];u&&(o+=u.size)}var l=0;return null==e[n-1]?(l=1,n--):null==e[n]&&(l=1,i++),new lr(t.of(e.slice(0,n)),l,t.of(e.slice(i)))}}]),t}();sr.prototype.size=1;var ar=function(t){function e(t,n,r){var o;return(0,i.Z)(this,e),(o=(0,c.Z)(this,e,[t,n])).deco=r,o}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"blockAt",value:function(t,e,n,i){return new ir(i,this.length,n,this.height,this.deco||0)}},{key:"lineAt",value:function(t,e,n,i,r){return this.blockAt(0,n,i,r)}},{key:"forEachLine",value:function(t,e,n,i,r,o){t<=r+this.length&&e>=r&&o(this.blockAt(0,n,i,r))}},{key:"updateHeight",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>3?arguments[3]:void 0;return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}},{key:"toString",value:function(){return"block(".concat(this.length,")")}}]),e}(sr),hr=function(t){function e(t,n){var r;return(0,i.Z)(this,e),(r=(0,c.Z)(this,e,[t,n,null])).collapsed=0,r.widgetHeight=0,r.breaks=0,r}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"blockAt",value:function(t,e,n,i){return new ir(i,this.length,n,this.height,this.breaks)}},{key:"replace",value:function(t,n,i){var r=i[0];return 1==i.length&&(r instanceof e||r instanceof ur&&4&r.flags)&&Math.abs(this.length-r.length)<10?(r instanceof ur?r=new e(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):sr.of(i)}},{key:"updateHeight",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;return i&&i.from<=e&&i.more?this.setHeight(t,i.heights[i.index++]):(n||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(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}]),e}(ar),ur=function(t){function e(t){return(0,i.Z)(this,e),(0,c.Z)(this,e,[t,0])}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"heightMetrics",value:function(t,e){var n,i=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,o=r-i+1,s=0;if(t.lineWrapping){var a=Math.min(this.height,t.lineHeight*o);n=a/o,this.length>o+1&&(s=(this.height-a)/(this.length-o-1))}else n=this.height/o;return{firstLine:i,lastLine:r,perLine:n,perChar:s}}},{key:"blockAt",value:function(t,e,n,i){var r=this.heightMetrics(e,i),o=r.firstLine,s=r.lastLine,a=r.perLine,h=r.perChar;if(e.lineWrapping){var u=i+Math.round(Math.max(0,Math.min(1,(t-n)/this.height))*this.length),l=e.doc.lineAt(u),c=a+l.length*h,f=Math.max(n,t-c/2);return new ir(l.from,l.length,f,c,0)}var d=Math.max(0,Math.min(s-o,Math.floor((t-n)/a))),v=e.doc.line(o+d),g=v.from,p=v.length;return new ir(g,p,n+a*d,a,0)}},{key:"lineAt",value:function(t,e,n,i,r){if(e==rr.ByHeight)return this.blockAt(t,n,i,r);if(e==rr.ByPosNoHeight){var o=n.doc.lineAt(t),s=o.from,a=o.to;return new ir(s,a-s,0,0,0)}var h=this.heightMetrics(n,r),u=h.firstLine,l=h.perLine,c=h.perChar,f=n.doc.lineAt(t),d=l+f.length*c,v=f.number-u,g=i+l*v+c*(f.from-r-v);return new ir(f.from,f.length,Math.max(i,Math.min(g,i+this.height-d)),d,0)}},{key:"forEachLine",value:function(t,e,n,i,r,o){t=Math.max(t,r),e=Math.min(e,r+this.length);for(var s=this.heightMetrics(n,r),a=s.firstLine,h=s.perLine,u=s.perChar,l=t,c=i;l<=e;){var f=n.doc.lineAt(l);if(l==t){var d=f.number-a;c+=h*d+u*(t-r-d)}var v=h+u*f.length;o(new ir(f.from,f.length,c,v,0)),c+=v,l=f.to+1}}},{key:"replace",value:function(t,n,i){var r=this.length-n;if(r>0){var o=i[i.length-1];o instanceof e?i[i.length-1]=new e(o.length+r):i.push(null,new e(r-1))}if(t>0){var s=i[0];s instanceof e?i[0]=new e(t+s.length):i.unshift(new e(t-1),null)}return sr.of(i)}},{key:"decomposeLeft",value:function(t,n){n.push(new e(t-1),null)}},{key:"decomposeRight",value:function(t,n){n.push(null,new e(this.length-t-1))}},{key:"updateHeight",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,o=n+this.length;if(r&&r.from<=n+this.length&&r.more){var s=[],a=Math.max(n,r.from),h=-1;for(r.from>n&&s.push(new e(r.from-n-1).updateHeight(t,n));a<=o&&r.more;){var u=t.doc.lineAt(a).length;s.length&&s.push(null);var l=r.heights[r.index++];-1==h?h=l:Math.abs(l-h)>=or&&(h=-2);var c=new hr(u,l);c.outdated=!1,s.push(c),a+=u+1}a<=o&&s.push(null,new e(o-a).updateHeight(t,a));var f=sr.of(s);return(h<0||Math.abs(f.height-this.height)>=or||Math.abs(h-this.heightMetrics(t,n).perLine)>=or)&&(t.heightChanged=!0),f}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(n,n+this.length)),this.outdated=!1),this}},{key:"toString",value:function(){return"gap(".concat(this.length,")")}}]),e}(sr),lr=function(t){function e(t,n,r){var o;return(0,i.Z)(this,e),(o=(0,c.Z)(this,e,[t.length+n+r.length,t.height+r.height,n|(t.outdated||r.outdated?2:0)])).left=t,o.right=r,o.size=t.size+r.size,o}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"break",get:function(){return 1&this.flags}},{key:"blockAt",value:function(t,e,n,i){var r=n+this.left.height;return t<r?this.left.blockAt(t,e,n,i):this.right.blockAt(t,e,r,i+this.left.length+this.break)}},{key:"lineAt",value:function(t,e,n,i,r){var o=i+this.left.height,s=r+this.left.length+this.break,a=e==rr.ByHeight?t<o:t<s,h=a?this.left.lineAt(t,e,n,i,r):this.right.lineAt(t,e,n,o,s);if(this.break||(a?h.to<s:h.from>s))return h;var u=e==rr.ByPosNoHeight?rr.ByPosNoHeight:rr.ByPos;return a?h.join(this.right.lineAt(s,u,n,o,s)):this.left.lineAt(s,u,n,i,r).join(h)}},{key:"forEachLine",value:function(t,e,n,i,r,o){var s=i+this.left.height,a=r+this.left.length+this.break;if(this.break)t<a&&this.left.forEachLine(t,e,n,i,r,o),e>=a&&this.right.forEachLine(t,e,n,s,a,o);else{var h=this.lineAt(a,rr.ByPos,n,i,r);t<h.from&&this.left.forEachLine(t,h.from-1,n,i,r,o),h.to>=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,n,s,a,o)}}},{key:"replace",value:function(t,e,n){var i=this.left.length+this.break;if(e<i)return this.balanced(this.left.replace(t,e,n),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-i,e-i,n));var r=[];t>0&&this.decomposeLeft(t,r);var s,a=r.length,h=(0,o.Z)(n);try{for(h.s();!(s=h.n()).done;){var u=s.value;r.push(u)}}catch(c){h.e(c)}finally{h.f()}if(t>0&&cr(r,a-1),e<this.length){var l=r.length;this.decomposeRight(e,r),cr(r,l)}return sr.of(r)}},{key:"decomposeLeft",value:function(t,e){var n=this.left.length;if(t<=n)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&t>=++n&&e.push(null),t>n&&this.right.decomposeLeft(t-n,e)}},{key:"decomposeRight",value:function(t,e){var n=this.left.length,i=n+this.break;if(t>=i)return this.right.decomposeRight(t-i,e);t<n&&this.left.decomposeRight(t,e),this.break&&t<i&&e.push(null),e.push(this.right)}},{key:"balanced",value:function(t,e){return t.size>2*e.size||e.size>2*t.size?sr.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(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0,r=this.left,o=this.right,s=e+r.length+this.break,a=null;return i&&i.from<=e+r.length&&i.more?a=r=r.updateHeight(t,e,n,i):r.updateHeight(t,e,n),i&&i.from<=s+o.length&&i.more?a=o=o.updateHeight(t,s,n,i):o.updateHeight(t,s,n),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}},{key:"toString",value:function(){return this.left+(this.break?" ":"-")+this.right}}]),e}(sr);function cr(t,e){var n,i;null==t[e]&&(n=t[e-1])instanceof ur&&(i=t[e+1])instanceof ur&&t.splice(e-1,3,new ur(n.length+1+i.length))}var fr=function(){function t(e,n){(0,i.Z)(this,t),this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}return(0,r.Z)(t,[{key:"isCovered",get:function(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}},{key:"span",value:function(t,e){if(this.lineStart>-1){var n=Math.min(e,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof hr?i.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new hr(n-this.pos,-1)),this.writtenTo=n,e>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}},{key:"point",value:function(t,e,n){if(t<e||n.heightRelevant){var i=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);var o=e-t;n.block?this.addBlock(new ar(o,i,n)):(o||r||i>=5)&&this.addLineDeco(i,r,o)}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(){if(!(this.lineStart>-1)){var t=this.oracle.doc.lineAt(this.pos),e=t.from,n=t.to;this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new hr(this.pos-e,-1)),this.writtenTo=this.pos}}},{key:"blankContent",value:function(t,e){var n=new ur(e-t);return this.oracle.doc.lineAt(t).to==e&&(n.flags|=4),n}},{key:"ensureLine",value:function(){this.enterLine();var t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof hr)return t;var e=new hr(0,-1);return this.nodes.push(e),e}},{key:"addBlock",value:function(t){var e;this.enterLine();var n=null===(e=t.deco)||void 0===e?void 0:e.type;n!=Qe.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,n!=Qe.WidgetBefore&&(this.covering=t)}},{key:"addLineDeco",value:function(t,e,n){var i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,t),i.breaks+=e,this.writtenTo=this.pos=this.pos+n}},{key:"finish",value:function(t){var e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof hr||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new hr(0,-1));var n,i=t,r=(0,o.Z)(this.nodes);try{for(r.s();!(n=r.n()).done;){var s=n.value;s instanceof hr&&s.updateHeight(this.oracle,i),i+=s?s.length:1}}catch(a){r.e(a)}finally{r.f()}return this.nodes}}],[{key:"build",value:function(e,n,i,r){var o=new t(i,e);return _t.spans(n,i,r,o,0),o.finish(i)}}]),t}();var dr=function(){function t(){(0,i.Z)(this,t),this.changes=[]}return(0,r.Z)(t,[{key:"compareRange",value:function(){}},{key:"comparePoint",value:function(t,e,n,i){(t<e||n&&n.heightRelevant||i&&i.heightRelevant)&&sn(t,e,this.changes,5)}}]),t}();function vr(t,e){for(var n=t.getBoundingClientRect(),i=t.ownerDocument,r=i.defaultView||window,o=Math.max(0,n.left),s=Math.min(r.innerWidth,n.right),a=Math.max(0,n.top),h=Math.min(r.innerHeight,n.bottom),u=t.parentNode;u&&u!=i.body;)if(1==u.nodeType){var l=u,c=window.getComputedStyle(l);if((l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth)&&"visible"!=c.overflow){var f=l.getBoundingClientRect();o=Math.max(o,f.left),s=Math.min(s,f.right),a=Math.max(a,f.top),h=u==t.parentNode?f.bottom:Math.min(h,f.bottom)}u="absolute"==c.position||"fixed"==c.position?l.offsetParent:l.parentNode}else{if(11!=u.nodeType)break;u=u.host}return{left:o-n.left,right:Math.max(o,s)-n.left,top:a-(n.top+e),bottom:Math.max(a,h)-(n.top+e)}}function gr(t,e){var n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}var pr=function(){function t(e,n,r){(0,i.Z)(this,t),this.from=e,this.to=n,this.size=r}return(0,r.Z)(t,[{key:"draw",value:function(t){return tn.replace({widget:new mr(this.size,t)}).range(this.from,this.to)}}],[{key:"same",value:function(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++){var i=t[n],r=e[n];if(i.from!=r.from||i.to!=r.to||i.size!=r.size)return!1}return!0}}]),t}(),mr=function(t){function e(t,n){var r;return(0,i.Z)(this,e),(r=(0,c.Z)(this,e)).size=t,r.vertical=n,r}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"eq",value:function(t){return t.size==this.size&&t.vertical==this.vertical}},{key:"toDOM",value:function(){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(){return this.vertical?this.size:-1}}]),e}(Ye),yr=function(){function t(e){(0,i.Z)(this,t),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=!0,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Sr,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Vn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;var n=e.facet(Dn).some((function(t){return"function"!=typeof t&&"cm-lineWrapping"==t.class}));this.heightOracle=new er(n),this.stateDeco=e.facet(En).filter((function(t){return"function"!=typeof t})),this.heightMap=sr.empty().applyChanges(this.stateDeco,v.empty,this.heightOracle.setDoc(e.doc),[new Nn(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=tn.set(this.lineGaps.map((function(t){return t.draw(!1)}))),this.computeVisibleRanges()}return(0,r.Z)(t,[{key:"updateForViewport",value:function(){for(var t=this,e=[this.viewport],n=this.state.selection.main,i=function(){var i=r?n.head:n.anchor;if(!e.some((function(t){var e=t.from,n=t.to;return i>=e&&i<=n}))){var o=t.lineBlockAt(i),s=o.from,a=o.to;e.push(new kr(s,a))}},r=0;r<=1;r++)i();this.viewports=e.sort((function(t,e){return t.from-e.from})),this.scaler=this.heightMap.height<=7e6?Sr:new Ar(this.heightOracle,this.heightMap,this.viewports)}},{key:"updateViewportLines",value:function(){var t=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(function(e){t.viewportLines.push(1==t.scaler.scale?e:Mr(e,t.scaler))}))}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.state=t.state;var n=this.stateDeco;this.stateDeco=this.state.facet(En).filter((function(t){return"function"!=typeof t}));var i,r,o,s,a=t.changedRanges,h=Nn.extendWithRanges(a,(i=n,r=this.stateDeco,o=t?t.changes:V.empty(this.state.doc.length),s=new dr,_t.compare(i,r,o,s,0),s.changes)),u=this.heightMap.height,l=this.scrolledToBottom?null:this.lineBlockAtHeight(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),h),this.heightMap.height!=u&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);var c=h.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<c.from||e.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,e));var f=!t.changes.empty||2&t.flags||c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,this.updateForViewport(),f&&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(wn)&&(this.mustEnforceCursorAssoc=!0)}},{key:"measure",value:function(t){var e=t.contentDOM,n=window.getComputedStyle(e),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Vn.RTL:Vn.LTR;var s=this.heightOracle.mustRefreshForWrapping(r),a=e.getBoundingClientRect(),h=s||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;var u=0,l=0,c=parseInt(n.paddingTop)||0,f=parseInt(n.paddingBottom)||0;this.paddingTop==c&&this.paddingBottom==f||(this.paddingTop=c,this.paddingBottom=f,u|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(i.lineWrapping&&(h=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=8),this.scrollTop!=t.scrollDOM.scrollTop&&(this.scrollAnchorHeight=-1,this.scrollTop=t.scrollDOM.scrollTop),this.scrolledToBottom=this.scrollTop>t.scrollDOM.scrollHeight-t.scrollDOM.clientHeight-4;var d=(this.printing?gr:vr)(e,this.paddingTop),g=d.top-this.pixelViewport.top,p=d.bottom-this.pixelViewport.bottom;this.pixelViewport=d;var m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(h=!0)),!this.inView&&!this.scrollTarget)return 0;var y=a.width;if(this.contentDOMWidth==y&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,u|=8),h){var k=t.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(k)&&(s=!0),s||i.lineWrapping&&Math.abs(y-this.contentDOMWidth)>i.charWidth){var w=t.docView.measureTextSize(),b=w.lineHeight,x=w.charWidth,S=w.textHeight;(s=b>0&&i.refresh(r,b,x,S,y/x,k))&&(t.docView.minWidth=0,u|=8)}g>0&&p>0?l=Math.max(g,p):g<0&&p<0&&(l=Math.min(g,p)),i.heightChanged=!1;var A,M=(0,o.Z)(this.viewports);try{for(M.s();!(A=M.n()).done;){var Z=A.value,C=Z.from==this.viewport.from?k:t.docView.measureVisibleLineHeights(Z);this.heightMap=(s?sr.empty().applyChanges(this.stateDeco,v.empty,this.heightOracle,[new Nn(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(i,0,s,new nr(Z.from,C))}}catch(T){M.e(T)}finally{M.f()}i.heightChanged&&(u|=2)}var O=!this.viewportIsAppropriate(this.viewport,l)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return O&&(this.viewport=this.getViewport(l,this.scrollTarget)),this.updateForViewport(),(2&u||O)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,t)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),u}},{key:"visibleTop",get:function(){return this.scaler.fromDOM(this.pixelViewport.top)}},{key:"visibleBottom",get:function(){return this.scaler.fromDOM(this.pixelViewport.bottom)}},{key:"getViewport",value:function(t,e){var n=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),i=this.heightMap,r=this.heightOracle,o=this.visibleTop,s=this.visibleBottom,a=new kr(i.lineAt(o-1e3*n,rr.ByHeight,r,0,0).from,i.lineAt(s+1e3*(1-n),rr.ByHeight,r,0,0).to);if(e){var h=e.range.head;if(h<a.from||h>a.to){var u,l=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=i.lineAt(h,rr.ByPos,r,0,0);u="center"==e.y?(c.top+c.bottom)/2-l/2:"start"==e.y||"nearest"==e.y&&h<a.from?c.top:c.bottom-l,a=new kr(i.lineAt(u-500,rr.ByHeight,r,0,0).from,i.lineAt(u+l+500,rr.ByHeight,r,0,0).to)}}return a}},{key:"mapViewport",value:function(t,e){var n=e.mapPos(t.from,-1),i=e.mapPos(t.to,1);return new kr(this.heightMap.lineAt(n,rr.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,rr.ByPos,this.heightOracle,0,0).to)}},{key:"viewportIsAppropriate",value:function(t){var e=t.from,n=t.to,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!this.inView)return!0;var r=this.heightMap.lineAt(e,rr.ByPos,this.heightOracle,0,0).top,o=this.heightMap.lineAt(n,rr.ByPos,this.heightOracle,0,0).bottom,s=this.visibleTop,a=this.visibleBottom;return(0==e||r<=s-Math.max(10,Math.min(-i,250)))&&(n==this.state.doc.length||o>=a+Math.max(10,Math.min(i,250)))&&r>s-2e3&&o<a+2e3}},{key:"mapLineGaps",value:function(t,e){if(!t.length||e.empty)return t;var n,i=[],r=(0,o.Z)(t);try{for(r.s();!(n=r.n()).done;){var s=n.value;e.touchesRange(s.from,s.to)||i.push(new pr(e.mapPos(s.from),e.mapPos(s.to),s.size))}}catch(a){r.e(a)}finally{r.f()}return i}},{key:"ensureLineGaps",value:function(t,e){var n=this,i=this.heightOracle.lineWrapping,r=i?1e4:2e3,s=r>>1,a=r<<1;if(this.defaultTextDirection!=Vn.LTR&&!i)return[];var h,u=[],l=function r(a,h,l,c){if(!(h-a<s)){var f=n.state.selection.main,d=[f.from];f.empty||d.push(f.to);for(var v=0,g=d;v<g.length;v++){var p=g[v];if(p>a&&p<h)return r(a,p-10,l,c),void r(p+10,h,l,c)}var m=function(t,e){var n,i=(0,o.Z)(t);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(e(r))return r}}catch(s){i.e(s)}finally{i.f()}return}(t,(function(t){return t.from>=l.from&&t.to<=l.to&&Math.abs(t.from-a)<s&&Math.abs(t.to-h)<s&&!d.some((function(e){return t.from<e&&t.to>e}))}));if(!m){if(h<l.to&&e&&i&&e.visibleRanges.some((function(t){return t.from<=h&&t.to>=h}))){var y=e.moveToLineBoundary(K.cursor(h),!1,!0).head;y>a&&(h=y)}m=new pr(a,h,n.gapSize(l,a,h,c))}u.push(m)}},c=(0,o.Z)(this.viewportLines);try{for(c.s();!(h=c.n()).done;){var f=h.value;if(!(f.length<a)){var d=wr(f.from,f.to,this.stateDeco);if(!(d.total<a)){var v=this.scrollTarget?this.scrollTarget.range.head:null,g=void 0,p=void 0;if(i){var m=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,y=void 0,k=void 0;if(null!=v){var w=xr(d,v),b=((this.visibleBottom-this.visibleTop)/2+m)/f.height;y=w-b,k=w+b}else y=(this.visibleTop-f.top-m)/f.height,k=(this.visibleBottom-f.top+m)/f.height;g=br(d,y),p=br(d,k)}else{var x=d.total*this.heightOracle.charWidth,S=r*this.heightOracle.charWidth,A=void 0,M=void 0;if(null!=v){var Z=xr(d,v),C=((this.pixelViewport.right-this.pixelViewport.left)/2+S)/x;A=Z-C,M=Z+C}else A=(this.pixelViewport.left-S)/x,M=(this.pixelViewport.right+S)/x;g=br(d,A),p=br(d,M)}g>f.from&&l(f.from,g,f,d),p<f.to&&l(p,f.to,f,d)}}}}catch(O){c.e(O)}finally{c.f()}return u}},{key:"gapSize",value:function(t,e,n,i){var r=xr(i,n)-xr(i,e);return this.heightOracle.lineWrapping?t.height*r:i.total*this.heightOracle.charWidth*r}},{key:"updateLineGaps",value:function(t){var e=this;pr.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=tn.set(t.map((function(t){return t.draw(e.heightOracle.lineWrapping)}))))}},{key:"computeVisibleRanges",value:function(){var t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));var e=[];_t.spans(t,this.viewport.from,this.viewport.to,{span:function(t,n){e.push({from:t,to:n})},point:function(){}},20);var n=e.length!=this.visibleRanges.length||this.visibleRanges.some((function(t,n){return t.from!=e[n].from||t.to!=e[n].to}));return this.visibleRanges=e,n?4:0}},{key:"lineBlockAt",value:function(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find((function(e){return e.from<=t&&e.to>=t}))||Mr(this.heightMap.lineAt(t,rr.ByPos,this.heightOracle,0,0),this.scaler)}},{key:"lineBlockAtHeight",value:function(t){return Mr(this.heightMap.lineAt(this.scaler.fromDOM(t),rr.ByHeight,this.heightOracle,0,0),this.scaler)}},{key:"elementAtHeight",value:function(t){return Mr(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}},{key:"docHeight",get:function(){return this.scaler.toDOM(this.heightMap.height)}},{key:"contentHeight",get:function(){return this.docHeight+this.paddingTop+this.paddingBottom}}]),t}(),kr=(0,r.Z)((function t(e,n){(0,i.Z)(this,t),this.from=e,this.to=n}));function wr(t,e,n){var i=[],r=t,o=0;return _t.spans(n,t,e,{span:function(){},point:function(t,e){t>r&&(i.push({from:r,to:t}),o+=t-r),r=e}},20),r<e&&(i.push({from:r,to:e}),o+=e-r),{total:o,ranges:i}}function br(t,e){var n=t.total,i=t.ranges;if(e<=0)return i[0].from;if(e>=1)return i[i.length-1].to;for(var r=Math.floor(n*e),o=0;;o++){var s=i[o],a=s.from,h=s.to-a;if(r<=h)return a+r;r-=h}}function xr(t,e){var n,i=0,r=(0,o.Z)(t.ranges);try{for(r.s();!(n=r.n()).done;){var s=n.value,a=s.from,h=s.to;if(e<=h){i+=e-a;break}i+=h-a}}catch(u){r.e(u)}finally{r.f()}return i/t.total}var Sr={toDOM:function(t){return t},fromDOM:function(t){return t},scale:1},Ar=function(){function t(e,n,r){(0,i.Z)(this,t);var s=0,a=0,h=0;this.viewports=r.map((function(t){var i=t.from,r=t.to,o=n.lineAt(i,rr.ByPos,e,0,0).top,a=n.lineAt(r,rr.ByPos,e,0,0).bottom;return s+=a-o,{from:i,to:r,top:o,bottom:a,domTop:0,domBottom:0}})),this.scale=(7e6-s)/(n.height-s);var u,l=(0,o.Z)(this.viewports);try{for(l.s();!(u=l.n()).done;){var c=u.value;c.domTop=h+(c.top-a)*this.scale,h=c.domBottom=c.domTop+(c.bottom-c.top),a=c.bottom}}catch(f){l.e(f)}finally{l.f()}}return(0,r.Z)(t,[{key:"toDOM",value:function(t){for(var e=0,n=0,i=0;;e++){var r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.top)return i+(t-n)*this.scale;if(t<=r.bottom)return r.domTop+(t-r.top);n=r.bottom,i=r.domBottom}}},{key:"fromDOM",value:function(t){for(var e=0,n=0,i=0;;e++){var r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.domTop)return n+(t-i)/this.scale;if(t<=r.domBottom)return r.top+(t-r.domTop);n=r.bottom,i=r.domBottom}}}]),t}();function Mr(t,e){if(1==e.scale)return t;var n=e.toDOM(t.top),i=e.toDOM(t.bottom);return new ir(t.from,t.length,n,i-n,Array.isArray(t._content)?t._content.map((function(t){return Mr(t,e)})):t._content)}var Zr=G.define({combine:function(t){return t.join(" ")}}),Cr=G.define({combine:function(t){return t.indexOf(!0)>-1}}),Or=Qt.V.newName(),Tr=Qt.V.newName(),Dr=Qt.V.newName(),Er={"&light":"."+Tr,"&dark":"."+Dr};function Br(t,e,n){return new Qt.V(e,{finish:function(e){return/&/.test(e)?e.replace(/&\w*/,(function(e){if("&"==e)return t;if(!n||!n[e])throw new RangeError("Unsupported selector: ".concat(e));return n[e]})):t+" "+e}})}var Rr=Br("."+Or,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Er),Ir=(0,r.Z)((function t(e,n,r,o){(0,i.Z)(this,t),this.typeOver=o,this.bounds=null,this.text="";var s=e.docView,a=s.impreciseHead,h=s.impreciseAnchor;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){var u=a||h?[]:function(t){var e=[];if(t.root.activeElement!=t.contentDOM)return e;var n=t.observer.selectionRange,i=n.anchorNode,r=n.anchorOffset,o=n.focusNode,s=n.focusOffset;i&&(e.push(new hi(i,r)),o==i&&s==r||e.push(new hi(o,s)));return e}(e),l=new si(u,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=function(t,e){if(0==t.length)return null;var n=t[0].pos,i=2==t.length?t[1].pos:n;return n>-1&&i>-1?K.single(n+e,i+e):null}(u,this.bounds.from)}else{var c=e.observer.selectionRange,f=a&&a.node==c.focusNode&&a.offset==c.focusOffset||!ee(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),d=h&&h.node==c.anchorNode&&h.offset==c.anchorOffset||!ee(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset);this.newSel=K.single(d,f)}}));function Pr(t,e){var n,i=e.newSel,r=t.state.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){var s=e.bounds,a=s.from,h=s.to,u=r.from,l=null;(8===o||Pe.android&&e.text.length<h-a)&&(u=r.to,l="end");var c=function(t,e,n,i){var r=Math.min(t.length,e.length),o=0;for(;o<r&&t.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==r&&t.length==e.length)return null;var s=t.length,a=e.length;for(;s>0&&a>0&&t.charCodeAt(s-1)==e.charCodeAt(a-1);)s--,a--;if("end"==i){n-=s+Math.max(0,o-Math.min(s,a))-o}if(s<o&&t.length<e.length){a=(o-=n<=o&&n>=s?o-n:0)+(a-s),s=o}else if(a<o){s=(o-=n<=o&&n>=a?o-n:0)+(s-a),a=o}return{from:o,toA:s,toB:a}}(t.state.doc.sliceString(a,h,oi),e.text,u-a,l);c&&(Pe.chrome&&13==o&&c.toB==c.from+2&&e.text.slice(c.from,c.toB)==oi+oi&&c.toB--,n={from:a+c.from,to:a+c.toA,insert:v.of(e.text.slice(c.from,c.toB).split(oi))})}else i&&(!t.hasFocus&&t.state.facet(An)||i.main.eq(r))&&(i=null);if(!n&&!i)return!1;if(!n&&e.typeOver&&!r.empty&&i&&i.main.empty?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,r.to)}:n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,r.to))}:(Pe.mac||Pe.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=K.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:v.of([" "])}):Pe.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&t.lineWrapping&&(i&&(i=K.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:v.of([" "])}),n){var f=t.state;if(Pe.ios&&t.inputState.flushIOSKey(t))return!0;if(Pe.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&ge(t.contentDOM,"Enter",13)||(n.from==r.from-1&&n.to==r.to&&0==n.insert.length||8==o&&n.insert.length<n.to-n.from)&&ge(t.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&ge(t.contentDOM,"Delete",46)))return!0;var d,g=n.insert.toString();if(t.state.facet(mn).some((function(e){return e(t,n.from,n.to,g)})))return!0;if(t.inputState.composing>=0&&t.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!i||i.main.empty&&i.main.from==n.from+n.insert.length)&&t.inputState.composing<0){var p=r.from<n.from?f.sliceDoc(r.from,n.from):"",m=r.to>n.to?f.sliceDoc(n.to,r.to):"";d=f.replaceSelection(t.state.toText(p+n.insert.sliceString(0,void 0,t.state.lineBreak)+m))}else{var y=f.changes(n),k=i&&i.main.to<=y.newLength?i.main:void 0;if(f.selection.ranges.length>1&&t.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){var w=t.state.sliceDoc(n.from,n.to),b=ci(t)||t.state.doc.lineAt(r.head),x=r.to-n.to,S=r.to-r.from;d=f.changeByRange((function(e){if(e.from==r.from&&e.to==r.to)return{changes:y,range:k||e.map(y)};var i=e.to-x,o=i-w.length;if(e.to-e.from!=S||t.state.sliceDoc(o,i)!=w||b&&e.to>=b.from&&e.from<=b.to)return{range:e};var s=f.changes({from:o,to:i,insert:n.insert}),a=e.to-r.to;return{changes:s,range:k?K.range(Math.max(0,k.anchor+a),Math.max(0,k.head+a)):e.map(s)}}))}else d={changes:y,selection:k&&f.selection.replaceRange(k)}}var A="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,A+=".compose",t.inputState.compositionFirstChange&&(A+=".start",t.inputState.compositionFirstChange=!1)),t.dispatch(d,{scrollIntoView:!0,userEvent:A}),!0}if(i&&!i.main.eq(r)){var M=!1,Z="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(M=!0),Z=t.inputState.lastSelectionOrigin),t.dispatch({selection:i,scrollIntoView:M,userEvent:Z}),!0}return!1}var Nr={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Lr=Pe.ie&&Pe.ie_version<=11,Vr=function(){function t(e){var n=this;(0,i.Z)(this,t),this.view=e,this.active=!1,this.selectionRange=new ce,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((function(t){var i,r=(0,o.Z)(t);try{for(r.s();!(i=r.n()).done;){var s=i.value;n.queue.push(s)}}catch(a){r.e(a)}finally{r.f()}(Pe.ie&&Pe.ie_version<=11||Pe.ios&&e.composing)&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?n.flushSoon():n.flush()})),Lr&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((function(){var t;(null===(t=n.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&n.onResize()})),this.resizeScroll.observe(e.scrollDOM),this.resizeContent=new ResizeObserver((function(){return n.view.requestMeasure()})),this.resizeContent.observe(e.contentDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((function(t){n.parentCheck<0&&(n.parentCheck=setTimeout(n.listenForScroll.bind(n),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=n.intersecting&&(n.intersecting=!n.intersecting,n.intersecting!=n.view.inView&&n.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&&n.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}return(0,r.Z)(t,[{key:"onScrollChanged",value:function(t){this.view.inputState.runScrollHandlers(this.view,t),this.intersecting&&this.view.measure()}},{key:"onScroll",value:function(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}},{key:"onResize",value:function(){var t=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((function(){t.resizeTimeout=-1,t.view.requestMeasure()}),50))}},{key:"onPrint",value:function(){var t=this;this.view.viewState.printing=!0,this.view.measure(),setTimeout((function(){t.view.viewState.printing=!1,t.view.requestMeasure()}),500)}},{key:"updateGaps",value:function(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((function(e,n){return e!=t[n]})))){this.gapIntersection.disconnect();var e,n=(0,o.Z)(t);try{for(n.s();!(e=n.n()).done;){var i=e.value;this.gapIntersection.observe(i)}}catch(r){n.e(r)}finally{n.f()}this.gaps=t}}},{key:"onSelectionChange",value:function(t){var e=this.selectionChanged;if(this.readSelectionRange()&&!this.delayedAndroidKey){var n=this.view,i=this.selectionRange;if(n.state.facet(An)?n.root.activeElement==this.dom:ne(n.dom,i)){var r=i.anchorNode&&n.docView.nearest(i.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(Pe.ie&&Pe.ie_version<=11||Pe.android&&Pe.chrome)&&!n.state.selection.main.empty&&i.focusNode&&re(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}}}},{key:"readSelectionRange",value:function(){var t=this.view,e=Pe.safari&&11==t.root.nodeType&&function(t){for(var e=t.activeElement;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t){var e=null;function n(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",n,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),!e)return null;var i=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);if(re(a.node,a.offset,o,s)){var h=[o,s,i,r];i=h[0],r=h[1],o=h[2],s=h[3]}return{anchorNode:i,anchorOffset:r,focusNode:o,focusOffset:s}}(this.view)||te(t.root);if(!e||this.selectionRange.eq(e))return!1;var n=ne(this.dom,e);return n&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){var n=e.focusNode,i=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=i)return!1;for(i=Math.min(i,ae(n));;)if(i){if(1!=n.nodeType)return!1;var r=n.childNodes[i-1];"false"==r.contentEditable?i--:i=ae(n=r)}else{if(n==t)return!0;i=oe(n),n=n.parentNode}}(this.dom,e)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(e),n&&(this.selectionChanged=!0),!0)}},{key:"setSelectionRange",value:function(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}},{key:"clearSelectionRange",value:function(){this.selectionRange.set(null,0,null,0)}},{key:"listenForScroll",value:function(){this.parentCheck=-1;for(var t=0,e=null,n=this.dom;n;)if(1==n.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==n?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){var i,r=(0,o.Z)(this.scrollTargets);try{for(r.s();!(i=r.n()).done;){i.value.removeEventListener("scroll",this.onScroll)}}catch(h){r.e(h)}finally{r.f()}var s,a=(0,o.Z)(this.scrollTargets=e);try{for(a.s();!(s=a.n()).done;){s.value.addEventListener("scroll",this.onScroll)}}catch(h){a.e(h)}finally{a.f()}}}},{key:"ignore",value:function(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}},{key:"start",value:function(){this.active||(this.observer.observe(this.dom,Nr),Lr&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}},{key:"stop",value:function(){this.active&&(this.active=!1,this.observer.disconnect(),Lr&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}},{key:"clear",value:function(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}},{key:"delayAndroidKey",value:function(t,e){var n,i=this;if(!this.delayedAndroidKey){this.flushingAndroidKey=this.view.win.requestAnimationFrame((function(){var t=i.delayedAndroidKey;t&&(i.clearDelayedAndroidKey(),i.view.inputState.lastKeyCode=t.keyCode,i.view.inputState.lastKeyTime=Date.now(),!i.flush()&&t.force&&ge(i.dom,t.key,t.keyCode))}))}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}},{key:"clearDelayedAndroidKey",value:function(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}},{key:"flushSoon",value:function(){var t=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame((function(){t.delayedFlush=-1,t.flush()})))}},{key:"forceFlush",value:function(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}},{key:"pendingRecords",value:function(){var t,e=(0,o.Z)(this.observer.takeRecords());try{for(e.s();!(t=e.n()).done;){var n=t.value;this.queue.push(n)}}catch(i){e.e(i)}finally{e.f()}return this.queue}},{key:"processRecords",value:function(){var t=this.pendingRecords();t.length&&(this.queue=[]);var e,n=-1,i=-1,r=!1,s=(0,o.Z)(t);try{for(s.s();!(e=s.n()).done;){var a=e.value,h=this.readMutation(a);h&&(h.typeOver&&(r=!0),-1==n?(n=h.from,i=h.to):(n=Math.min(h.from,n),i=Math.max(h.to,i)))}}catch(u){s.e(u)}finally{s.f()}return{from:n,to:i,typeOver:r}}},{key:"readChange",value:function(){var t=this.processRecords(),e=t.from,n=t.to,i=t.typeOver,r=this.selectionChanged&&ne(this.dom,this.selectionRange);return e<0&&!r?null:(e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ir(this.view,e,n,i))}},{key:"flush",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();var e=this.readChange();if(!e)return!1;var n=this.view.state,i=Pr(this.view,e);return this.view.state==n&&this.view.update([]),i}},{key:"readMutation",value:function(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.dirty|=4),"childList"==t.type){var n=Hr(e,t.previousSibling||t.target.previousSibling,-1),i=Hr(e,t.nextSibling||t.target.nextSibling,1);return{from:n?e.posAfter(n):e.posAtStart,to:i?e.posBefore(i):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(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}},{key:"addWindowListeners",value:function(t){t.addEventListener("resize",this.onResize),t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}},{key:"removeWindowListeners",value:function(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"destroy",value:function(){var t,e,n,i;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect(),null===(i=this.resizeContent)||void 0===i||i.disconnect();var r,s=(0,o.Z)(this.scrollTargets);try{for(s.s();!(r=s.n()).done;){r.value.removeEventListener("scroll",this.onScroll)}}catch(a){s.e(a)}finally{s.f()}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}]),t}();function Hr(t,e,n){for(;e;){var i=ke.get(e);if(i&&i.parent==t)return i;var r=e.parentNode;e=r!=t.dom?r:n>0?e.nextSibling:e.previousSibling}return null}var Wr=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,i.Z)(this,t),this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=n.dispatch||function(t){return e.update([t])},this.dispatch=this.dispatch.bind(this),this._root=n.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(n.parent)||document,this.viewState=new yr(n.state||Nt.create(n)),this.plugins=this.state.facet(Zn).map((function(t){return new On(t)}));var r,s=(0,o.Z)(this.plugins);try{for(s.s();!(r=s.n()).done;){r.value.update(this)}}catch(a){s.e(a)}finally{s.f()}this.observer=new Vr(this),this.inputState=new Oi(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new ui(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),n.parent&&n.parent.appendChild(this.dom)}return(0,r.Z)(t,[{key:"state",get:function(){return this.viewState.state}},{key:"viewport",get:function(){return this.viewState.viewport}},{key:"visibleRanges",get:function(){return this.viewState.visibleRanges}},{key:"inView",get:function(){return this.viewState.inView}},{key:"composing",get:function(){return this.inputState.composing>0}},{key:"compositionStarted",get:function(){return this.inputState.composing>=0}},{key:"root",get:function(){return this._root}},{key:"win",get:function(){return this.dom.ownerDocument.defaultView||window}},{key:"dispatch",value:function(){var t,e=1==arguments.length&&(arguments.length<=0?void 0:arguments[0])instanceof Mt?arguments.length<=0?void 0:arguments[0]:(t=this.state).update.apply(t,arguments);this._dispatch(e,this)}},{key:"update",value:function(t){var e=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");var n,i,r=!1,s=!1,a=this.state,h=(0,o.Z)(t);try{for(h.s();!(i=h.n()).done;){var u=i.value;if(u.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=u.state}}catch(M){h.e(M)}finally{h.f()}if(this.destroyed)this.viewState.state=a;else{var l=this.hasFocus,c=0,f=null;t.some((function(t){return t.annotation(Xi)}))?(this.inputState.notifiedFocused=l,c=1):l!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=l,(f=Yi(a,l))||(c=1));var d=this.observer.delayedAndroidKey,v=null;if(d?(this.observer.clearDelayedAndroidKey(),((v=this.observer.readChange())&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(v=null)):this.observer.clear(),a.facet(Nt.phrases)!=this.state.facet(Nt.phrases))return this.setState(a);n=Ln.create(this,a,t),n.flags|=c;var g=this.viewState.scrollTarget;try{this.updateState=2;var p,m=(0,o.Z)(t);try{for(m.s();!(p=m.n()).done;){var y=p.value;if(g&&(g=g.map(y.changes)),y.scrollIntoView){var k=y.state.selection.main;g=new bn(k.empty?k:K.cursor(k.head,k.head>k.anchor?-1:1))}var w,b=(0,o.Z)(y.effects);try{for(b.s();!(w=b.n()).done;){var x=w.value;x.is(xn)&&(g=x.value)}}catch(M){b.e(M)}finally{b.f()}}}catch(M){m.e(M)}finally{m.f()}this.viewState.update(n,g),this.bidiCache=Fr.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),r=this.docView.update(n),this.state.facet(Pn)!=this.styleModules&&this.mountStyles(),s=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(r,t.some((function(t){return t.isUserEvent("select.pointer")})))}finally{this.updateState=0}if(n.startState.facet(Zr)!=n.state.facet(Zr)&&(this.viewState.mustMeasureContent=!0),(r||s||g||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!n.empty){var S,A=(0,o.Z)(this.state.facet(pn));try{for(A.s();!(S=A.n()).done;){(0,S.value)(n)}}catch(M){A.e(M)}finally{A.f()}}(f||v)&&Promise.resolve().then((function(){f&&e.state==f.startState&&e.dispatch(f),v&&!Pr(e,v)&&d.force&&ge(e.contentDOM,d.key,d.keyCode)}))}}},{key:"setState",value:function(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)this.viewState.state=t;else{this.updateState=2;var e=this.hasFocus;try{var n,i=(0,o.Z)(this.plugins);try{for(i.s();!(n=i.n()).done;){n.value.destroy(this)}}catch(a){i.e(a)}finally{i.f()}this.viewState=new yr(t),this.plugins=t.facet(Zn).map((function(t){return new On(t)})),this.pluginMap.clear();var r,s=(0,o.Z)(this.plugins);try{for(s.s();!(r=s.n()).done;){r.value.update(this)}}catch(a){s.e(a)}finally{s.f()}this.docView=new ui(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}}},{key:"updatePlugins",value:function(t){var e=t.startState.facet(Zn),n=t.state.facet(Zn);if(e!=n){var i,r=[],s=(0,o.Z)(n);try{for(s.s();!(i=s.n()).done;){var a=i.value,h=e.indexOf(a);if(h<0)r.push(new On(a));else{var u=this.plugins[h];u.mustUpdate=t,r.push(u)}}}catch(p){s.e(p)}finally{s.f()}var l,c=(0,o.Z)(this.plugins);try{for(c.s();!(l=c.n()).done;){var f=l.value;f.mustUpdate!=t&&f.destroy(this)}}catch(p){c.e(p)}finally{c.f()}this.plugins=r,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else{var d,v=(0,o.Z)(this.plugins);try{for(v.s();!(d=v.n()).done;){d.value.mustUpdate=t}}catch(p){v.e(p)}finally{v.f()}}for(var g=0;g<this.plugins.length;g++)this.plugins[g].update(this)}},{key:"measure",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(!this.destroyed){this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,e&&this.observer.forceFlush();var n=null,i=this.scrollDOM,r=i.scrollTop,s=this.viewState,a=s.scrollAnchorPos,h=s.scrollAnchorHeight;if(this.viewState.scrollAnchorHeight=-1,h<0||r!=this.viewState.scrollTop)if(r>i.scrollHeight-i.clientHeight-4)a=-1,h=this.viewState.heightMap.height;else{var u=this.viewState.lineBlockAtHeight(r);a=u.from,h=u.top}try{for(var l=0;;l++){this.updateState=1;var c=this.viewport,f=this.viewState.measure(this);if(!f&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}var d=[];if(!(4&f)){var v=[d,this.measureRequests];this.measureRequests=v[0],d=v[1]}var g=d.map((function(e){try{return e.read(t)}catch(n){return Sn(t.state,n),zr}})),p=Ln.create(this,this.state,[]),m=!1,y=!1;p.flags|=f,n?n.flags|=f:n=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),m=this.docView.update(p));for(var k=0;k<d.length;k++)if(g[k]!=zr)try{var w=d[k];w.write&&w.write(g[k],this)}catch(A){Sn(this.state,A)}if(this.viewState.editorHeight)if(this.viewState.scrollTarget)this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,y=!0;else if(h>-1){var b=(a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)-h;(b>1||b<-1)&&(i.scrollTop=r+b,y=!0)}if(m&&this.docView.updateSelection(!0),this.viewport.from==c.from&&this.viewport.to==c.to&&!y&&0==this.measureRequests.length)break;h=-1}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty){var x,S=(0,o.Z)(this.state.facet(pn));try{for(S.s();!(x=S.n()).done;){(0,x.value)(n)}}catch(M){S.e(M)}finally{S.f()}}}}},{key:"themeClasses",get:function(){return Or+" "+(this.state.facet(Cr)?Dr:Tr)+" "+this.state.facet(Zr)}},{key:"updateAttrs",value:function(){var t=this,e=qr(this,Tn,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(An)?"true":"false",class:"cm-content",style:"".concat(Pe.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),qr(this,Dn,n);var i=this.observer.ignore((function(){var i=Xe(t.contentDOM,t.contentAttrs,n),r=Xe(t.dom,t.editorAttrs,e);return i||r}));return this.editorAttrs=e,this.contentAttrs=n,i}},{key:"showAnnouncements",value:function(e){var n,i=!0,r=(0,o.Z)(e);try{for(r.s();!(n=r.n()).done;){var s,a=n.value,h=(0,o.Z)(a.effects);try{for(h.s();!(s=h.n()).done;){var u=s.value;if(u.is(t.announce))i&&(this.announceDOM.textContent=""),i=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=u.value}}catch(l){h.e(l)}finally{h.f()}}}catch(l){r.e(l)}finally{r.f()}}},{key:"mountStyles",value:function(){this.styleModules=this.state.facet(Pn),Qt.V.mount(this.root,this.styleModules.concat(Rr).reverse())}},{key:"readMeasured",value:function(){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(t){var e=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((function(){return e.measure()}))),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(var n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===t.key)return void(this.measureRequests[n]=t);this.measureRequests.push(t)}}},{key:"plugin",value:function(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(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}},{key:"documentPadding",get:function(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}},{key:"elementAtHeight",value:function(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}},{key:"lineBlockAtHeight",value:function(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}},{key:"viewportLineBlocks",get:function(){return this.viewState.viewportLines}},{key:"lineBlockAt",value:function(t){return this.viewState.lineBlockAt(t)}},{key:"contentHeight",get:function(){return this.viewState.contentHeight}},{key:"moveByChar",value:function(t,e,n){return Ci(this,t,Mi(this,t,e,n))}},{key:"moveByGroup",value:function(t,e){var n=this;return Ci(this,t,Mi(this,t,e,(function(e){return function(t,e,n){var i=t.state.charCategorizer(e),r=i(n);return function(t){var e=i(t);return r==Rt.Space&&(r=e),r==e}}(n,t.head,e)})))}},{key:"moveToLineBoundary",value:function(t,e){return function(t,e,n,i){var r=Ai(t,e.head),o=i&&r.type==Qe.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(o){var s=t.dom.getBoundingClientRect(),a=t.textDirectionAt(r.from),h=t.posAtCoords({x:n==(a==Vn.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(null!=h)return K.cursor(h,n?-1:1)}return K.cursor(n?r.to:r.from,n?-1:1)}(this,t,e,!(arguments.length>2&&void 0!==arguments[2])||arguments[2])}},{key:"moveVertically",value:function(t,e,n){return Ci(this,t,function(t,e,n,i){var r=e.head,o=n?1:-1;if(r==(n?t.state.doc.length:0))return K.cursor(r,e.assoc);var s,a=e.goalColumn,h=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(r),l=t.documentTop;if(u)null==a&&(a=u.left-h.left),s=o<0?u.top:u.bottom;else{var c=t.viewState.lineBlockAt(r);null==a&&(a=Math.min(h.right-h.left,t.defaultCharacterWidth*(r-c.from))),s=(o<0?c.top:c.bottom)+l}for(var f=h.left+a,d=null!=i?i:t.viewState.heightOracle.textHeight>>1,v=0;;v+=10){var g=s+(d+v)*o,p=xi(t,{x:f,y:g},!1,o);if(g<h.top||g>h.bottom||(o<0?p<r:p>r))return K.cursor(p,e.assoc,void 0,a)}}(this,t,e,n))}},{key:"domAtPos",value:function(t){return this.docView.domAtPos(t)}},{key:"posAtDOM",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.posFromDOM(t,e)}},{key:"posAtCoords",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.readMeasured(),xi(this,t,e)}},{key:"coordsAtPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.readMeasured();var n=this.docView.coordsAt(t,e);if(!n||n.left==n.right)return n;var i=this.state.doc.lineAt(t),r=this.bidiSpans(i);return he(n,r[Qn.find(r,t-i.from,-1,e)].dir==Vn.LTR==e>0)}},{key:"defaultCharacterWidth",get:function(){return this.viewState.heightOracle.charWidth}},{key:"defaultLineHeight",get:function(){return this.viewState.heightOracle.lineHeight}},{key:"textDirection",get:function(){return this.viewState.defaultTextDirection}},{key:"textDirectionAt",value:function(t){return!this.state.facet(kn)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}},{key:"lineWrapping",get:function(){return this.viewState.heightOracle.lineWrapping}},{key:"bidiSpans",value:function(t){if(t.length>_r)return ni(t.length);var e,n=this.textDirectionAt(t.from),i=(0,o.Z)(this.bidiCache);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(r.from==t.from&&r.dir==n)return r.order}}catch(a){i.e(a)}finally{i.f()}var s=ei(t.text,n);return this.bidiCache.push(new Fr(t.from,t.to,n,s)),s}},{key:"hasFocus",get:function(){var t;return(this.dom.ownerDocument.hasFocus()||Pe.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}},{key:"focus",value:function(){var t=this;this.observer.ignore((function(){de(t.contentDOM),t.docView.updateSelection()}))}},{key:"setRoot",value:function(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}},{key:"destroy",value:function(){var t,e=(0,o.Z)(this.plugins);try{for(e.s();!(t=e.n()).done;){t.value.destroy(this)}}catch(n){e.e(n)}finally{e.f()}this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}}],[{key:"scrollIntoView",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return xn.of(new bn("number"==typeof t?K.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}},{key:"domEventHandlers",value:function(t){return Cn.define((function(){return{}}),{eventHandlers:t})}},{key:"theme",value:function(t,e){var n=Qt.V.newName(),i=[Zr.of(n),Pn.of(Br(".".concat(n),t))];return e&&e.dark&&i.push(Cr.of(!0)),i}},{key:"baseTheme",value:function(t){return at.lowest(Pn.of(Br("."+Or,t,Er)))}},{key:"findFromDOM",value:function(t){var e,n=t.querySelector(".cm-content"),i=n&&ke.get(n)||ke.get(t);return(null===(e=null==i?void 0:i.rootView)||void 0===e?void 0:e.view)||null}}]),t}();Wr.styleModule=Pn,Wr.inputHandler=mn,Wr.focusChangeEffect=yn,Wr.perLineTextDirection=kn,Wr.exceptionSink=gn,Wr.updateListener=pn,Wr.editable=An,Wr.mouseSelectionStyle=vn,Wr.dragMovesSelection=dn,Wr.clickAddsSelectionRange=fn,Wr.decorations=En,Wr.atomicRanges=Bn,Wr.scrollMargins=Rn,Wr.darkTheme=Cr,Wr.contentAttributes=Dn,Wr.editorAttributes=Tn,Wr.lineWrapping=Wr.contentAttributes.of({class:"cm-lineWrapping"}),Wr.announce=At.define();var _r=4096,zr={},Fr=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.from=e,this.to=n,this.dir=r,this.order=o}return(0,r.Z)(t,null,[{key:"update",value:function(e,n){if(n.empty)return e;for(var i=[],r=e.length?e[e.length-1].dir:Vn.LTR,o=Math.max(0,e.length-10);o<e.length;o++){var s=e[o];s.dir!=r||n.touchesRange(s.from,s.to)||i.push(new t(n.mapPos(s.from,1),n.mapPos(s.to,-1),s.dir,s.order))}return i}}]),t}();function qr(t,e,n){for(var i=t.state.facet(e),r=i.length-1;r>=0;r--){var o=i[r],s="function"==typeof o?o(t):o;s&&Ge(s,n)}return n}Pe.mac||Pe.windows||Pe.linux;var jr=!Pe.ios;var Kr={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};jr&&(Kr[".cm-line"].caretColor="transparent !important");"".concat(7,"px"),"".concat(14,"px"),"".concat(7,"px solid transparent"),"".concat(7,"px solid transparent"),"-".concat(7,"px"),"".concat(7,"px solid #bbb"),"".concat(7,"px solid #f5f5f5"),"-".concat(7,"px"),"".concat(7,"px solid #bbb"),"".concat(7,"px solid #f5f5f5");var Jr=function(t){function e(){return(0,i.Z)(this,e),(0,c.Z)(this,e,arguments)}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"compare",value:function(t){return this==t||this.constructor==t.constructor&&this.eq(t)}},{key:"eq",value:function(t){return!1}},{key:"destroy",value:function(t){}}]),e}(Lt);Jr.prototype.elementClass="",Jr.prototype.toDOM=void 0,Jr.prototype.mapMode=N.TrackBefore,Jr.prototype.startSide=Jr.prototype.endSide=-1,Jr.prototype.point=!0;var Ur=n(93359),Gr=(n(76775),n(88770),n(18098),n(7507),n(22481),n(24829),n(12397),n(83868),n(75544),n(33435),n(66657),n(53608),n(42313),n(48112),n(87323),n(39588),n(31871),n(87753),n(91843),n(9979),n(34497),n(39912),n(76751),n(44988),n(32369),n(39832),n(83327),n(47475),n(94010),n(64085),n(56399),n(16149),n(39891),n(20459),n(89664),n(92478),n(60731),n(51964),n(93330),0),$r=(0,r.Z)((function t(e,n){(0,i.Z)(this,t),this.from=e,this.to=n})),Xr=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,i.Z)(this,t),this.id=Gr++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return(0,r.Z)(t,[{key:"add",value:function(t){var e=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=Qr.match(t)),function(n){var i=t(n);return void 0===i?null:[e,i]}}}]),t}();Xr.closedBy=new Xr({deserialize:function(t){return t.split(" ")}}),Xr.openedBy=new Xr({deserialize:function(t){return t.split(" ")}}),Xr.group=new Xr({deserialize:function(t){return t.split(" ")}}),Xr.contextHash=new Xr({perNode:!0}),Xr.lookAhead=new Xr({perNode:!0}),Xr.mounted=new Xr({perNode:!0});var Yr=Object.create(null),Qr=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;(0,i.Z)(this,t),this.name=e,this.props=n,this.id=r,this.flags=o}return(0,r.Z)(t,[{key:"prop",value:function(t){return this.props[t.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(t){if("string"==typeof t){if(this.name==t)return!0;var e=this.prop(Xr.group);return!!e&&e.indexOf(t)>-1}return this.id==t}}],[{key:"define",value:function(e){var n=e.props&&e.props.length?Object.create(null):Yr,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),r=new t(e.name||"",n,e.id,i);if(e.props){var s,a=(0,o.Z)(e.props);try{for(a.s();!(s=a.n()).done;){var h=s.value;if(Array.isArray(h)||(h=h(r)),h){if(h[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[h[0].id]=h[1]}}}catch(u){a.e(u)}finally{a.f()}}return r}},{key:"match",value:function(t){var e=Object.create(null);for(var n in t){var i,r=(0,o.Z)(n.split(" "));try{for(r.s();!(i=r.n()).done;){var s=i.value;e[s]=t[n]}}catch(a){r.e(a)}finally{r.f()}}return function(t){for(var n=t.prop(Xr.group),i=-1;i<(n?n.length:0);i++){var r=e[i<0?t.name:n[i]];if(r)return r}}}}]),t}();Qr.none=new Qr("",Object.create(null),0,8);var to,eo=new WeakMap,no=new WeakMap;!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(to||(to={}));var io=function(){function t(e,n,r,s,h){if((0,i.Z)(this,t),this.type=e,this.children=n,this.positions=r,this.length=s,this.props=null,h&&h.length){this.props=Object.create(null);var u,l=(0,o.Z)(h);try{for(l.s();!(u=l.n()).done;){var c=(0,a.Z)(u.value,2),f=c[0],d=c[1];this.props["number"==typeof f?f:f.id]=d}}catch(v){l.e(v)}finally{l.f()}}}return(0,r.Z)(t,[{key:"toString",value:function(){var t=this.prop(Xr.mounted);if(t&&!t.overlay)return t.tree.toString();var e,n="",i=(0,o.Z)(this.children);try{for(i.s();!(e=i.n()).done;){var r=e.value.toString();r&&(n&&(n+=","),n+=r)}}catch(s){i.e(s)}finally{i.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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new go(this.topNode,t)}},{key:"cursorAt",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=eo.get(this)||this.topNode,i=new go(n);return i.moveTo(t,e),eo.set(this,i._tree),i}},{key:"topNode",get:function(){return new uo(this,0,0,null)}},{key:"resolve",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=ho(eo.get(this)||this.topNode,t,e,!1);return eo.set(this,n),n}},{key:"resolveInner",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=ho(no.get(this)||this.topNode,t,e,!0);return no.set(this,n),n}},{key:"iterate",value:function(t){for(var e=t.enter,n=t.leave,i=t.from,r=void 0===i?0:i,o=t.to,s=void 0===o?this.length:o,a=t.mode||0,h=(a&to.IncludeAnonymous)>0,u=this.cursor(a|to.IncludeAnonymous);;){var l=!1;if(u.from<=s&&u.to>=r&&(!h&&u.type.isAnonymous||!1!==e(u))){if(u.firstChild())continue;l=!0}for(;l&&n&&(h||!u.type.isAnonymous)&&n(u),!u.nextSibling();){if(!u.parent())return;l=!0}}}},{key:"prop",value:function(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}},{key:"propValues",get:function(){var t=[];if(this.props)for(var e in this.props)t.push([+e,this.props[e]]);return t}},{key:"balance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.children.length<=8?this:ko(Qr.none,this.children,this.positions,0,this.children.length,0,this.length,(function(n,i,r){return new t(e.type,n,i,r,e.propValues)}),n.makeTree||function(e,n,i){return new t(Qr.none,e,n,i)})}}],[{key:"build",value:function(t){return function(t){var e,n=t.buffer,i=t.nodeSet,r=t.maxBufferLength,o=void 0===r?1024:r,s=t.reused,a=void 0===s?[]:s,h=t.minRepeatType,u=void 0===h?i.types.length:h,l=Array.isArray(n)?new ro(n,n.length):n,c=i.types,f=0,d=0;function v(t,e,n,r,s){for(var h=l.id,w=l.start,b=l.end,x=l.size,S=d;x<0;){if(l.next(),-1==x){var A=a[h];return n.push(A),void r.push(w-t)}if(-3==x)return void(f=h);if(-4==x)return void(d=h);throw new RangeError("Unrecognized record size: ".concat(x))}var M,Z,C=c[h],O=w-t;if(b-w<=o&&(Z=y(l.pos-e,s))){for(var T=new Uint16Array(Z.size-Z.skip),D=l.pos-Z.size,E=T.length;l.pos>D;)E=k(Z.start,T,E);M=new oo(T,b-Z.start,i),O=Z.start-t}else{var B=l.pos-x;l.next();for(var R=[],I=[],P=h>=u?h:-1,N=0,L=b;l.pos>B;)P>=0&&l.id==P&&l.size>=0?(l.end<=L-o&&(p(R,I,w,N,l.end,L,P,S),N=R.length,L=l.end),l.next()):v(w,B,R,I,P);if(P>=0&&N>0&&N<R.length&&p(R,I,w,N,w,L,P,S),R.reverse(),I.reverse(),P>-1&&N>0){var V=g(C);M=ko(C,R,I,0,R.length,0,b-w,V,V)}else M=m(C,R,I,b-w,S-b)}n.push(M),r.push(O)}function g(t){return function(e,n,i){var r,o,s=0,a=e.length-1;if(a>=0&&(r=e[a])instanceof io){if(!a&&r.type==t&&r.length==i)return r;(o=r.prop(Xr.lookAhead))&&(s=n[a]+r.length+o)}return m(t,e,n,i,s)}}function p(t,e,n,r,o,s,a,h){for(var u=[],l=[];t.length>r;)u.push(t.pop()),l.push(e.pop()+n-o);t.push(m(i.types[a],u,l,s-o,h-s)),e.push(o-n)}function m(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0;if(f){var s=[Xr.contextHash,f];o=o?[s].concat(o):[s]}if(r>25){var a=[Xr.lookAhead,r];o=o?[a].concat(o):[a]}return new io(t,e,n,i,o)}function y(t,e){var n=l.fork(),i=0,r=0,s=0,a=n.end-o,h={size:0,start:0,skip:0};t:for(var c=n.pos-t;n.pos>c;){var f=n.size;if(n.id==e&&f>=0)h.size=i,h.start=r,h.skip=s,s+=4,i+=4,n.next();else{var d=n.pos-f;if(f<0||d<c||n.start<a)break;var v=n.id>=u?4:0,g=n.start;for(n.next();n.pos>d;){if(n.size<0){if(-3!=n.size)break t;v+=4}else n.id>=u&&(v+=4);n.next()}r=g,i+=f,s+=v}}return(e<0||i==t)&&(h.size=i,h.start=r,h.skip=s),h.size>4?h:void 0}function k(t,e,n){var i=l.id,r=l.start,o=l.end,s=l.size;if(l.next(),s>=0&&i<u){var a=n;if(s>4)for(var h=l.pos-(s-4);l.pos>h;)n=k(t,e,n);e[--n]=a,e[--n]=o-t,e[--n]=r-t,e[--n]=i}else-3==s?f=i:-4==s&&(d=i);return n}var w=[],b=[];for(;l.pos>0;)v(t.start||0,t.bufferStart||0,w,b,-1);var x=null!==(e=t.length)&&void 0!==e?e:w.length?b[0]+w[0].length:0;return new io(c[t.topID],w.reverse(),b.reverse(),x)}(t)}}]),t}();io.empty=new io(Qr.none,[],[],0);var ro=function(){function t(e,n){(0,i.Z)(this,t),this.buffer=e,this.index=n}return(0,r.Z)(t,[{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 t(this.buffer,this.index)}}]),t}(),oo=function(){function t(e,n,r){(0,i.Z)(this,t),this.buffer=e,this.length=n,this.set=r}return(0,r.Z)(t,[{key:"type",get:function(){return Qr.none}},{key:"toString",value:function(){for(var t=[],e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}},{key:"childString",value:function(t){var e=this.buffer[t],n=this.buffer[t+3],i=this.set.types[e],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),n==(t+=4))return r;for(var o=[];t<n;)o.push(this.childString(t)),t=this.buffer[t+3];return r+"("+o.join(",")+")"}},{key:"findChild",value:function(t,e,n,i,r){for(var o=this.buffer,s=-1,a=t;a!=e&&!(so(r,i,o[a+1],o[a+2])&&(s=a,n>0));a=o[a+3]);return s}},{key:"slice",value:function(e,n,i){for(var r=this.buffer,o=new Uint16Array(n-e),s=0,a=e,h=0;a<n;){o[h++]=r[a++],o[h++]=r[a++]-i;var u=o[h++]=r[a++]-i;o[h++]=r[a++]-e,s=Math.max(s,u)}return new t(o,s,this.set)}}]),t}();function so(t,e,n,i){switch(t){case-2:return n<e;case-1:return i>=e&&n<e;case 0:return n<e&&i>e;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function ao(t,e){for(var n=t.childBefore(e);n;){var i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(t=n,n=i.prevSibling):n=i}return t}function ho(t,e,n,i){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){var o=!i&&t instanceof uo&&t.index<0?null:t.parent;if(!o)return t;t=o}var s=i?0:to.IgnoreOverlays;if(i)for(var a=t,h=a.parent;h;h=(a=h).parent)a instanceof uo&&a.index<0&&(null===(r=h.enter(e,n,s))||void 0===r?void 0:r.from)!=a.from&&(t=h);for(;;){var u=t.enter(e,n,s);if(!u)return t;t=u}}var uo=function(){function t(e,n,r,o){(0,i.Z)(this,t),this._tree=e,this.from=n,this.index=r,this._parent=o}return(0,r.Z)(t,[{key:"type",get:function(){return this._tree.type}},{key:"name",get:function(){return this._tree.type.name}},{key:"to",get:function(){return this.from+this._tree.length}},{key:"nextChild",value:function(e,n,i,r){for(var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=this;;){for(var a=s._tree,h=a.children,u=a.positions,l=n>0?h.length:-1;e!=l;e+=n){var c=h[e],f=u[e]+s.from;if(so(r,i,f,f+c.length))if(c instanceof oo){if(o&to.ExcludeBuffers)continue;var d=c.findChild(0,c.buffer.length,n,i-f,r);if(d>-1)return new vo(new fo(s,c,e,f),null,d)}else if(o&to.IncludeAnonymous||!c.type.isAnonymous||po(c)){var v=void 0;if(!(o&to.IgnoreMounts)&&c.props&&(v=c.prop(Xr.mounted))&&!v.overlay)return new t(v.tree,f,e,s);var g=new t(c,f,e,s);return o&to.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?c.children.length-1:0,n,i,r)}}if(o&to.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+n:n<0?-1:s._parent._tree.children.length,!(s=s._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(t){return this.nextChild(0,1,t,2)}},{key:"childBefore",value:function(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}},{key:"enter",value:function(e,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(r&to.IgnoreOverlays)&&(i=this._tree.prop(Xr.mounted))&&i.overlay){var s,a=e-this.from,h=(0,o.Z)(i.overlay);try{for(h.s();!(s=h.n()).done;){var u=s.value,l=u.from,c=u.to;if((n>0?l<=a:l<a)&&(n<0?c>=a:c>a))return new t(i.tree,i.overlay[0].from+this.from,-1,this)}}catch(f){h.e(f)}finally{h.f()}}return this.nextChild(0,1,e,n,r)}},{key:"nextSignificantParent",value:function(){for(var t=this;t.type.isAnonymous&&t._parent;)t=t._parent;return t}},{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 go(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(t){return ho(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(t){return ho(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function(t){return ao(this,t)}},{key:"getChild",value:function(t){var e=lo(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return e.length?e[0]:null}},{key:"getChildren",value:function(t){return lo(this,t,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(t){return co(this,t)}}]),t}();function lo(t,e,n,i){var r=t.cursor(),o=[];if(!r.firstChild())return o;if(null!=n)for(;!r.type.is(n);)if(!r.nextSibling())return o;for(;;){if(null!=i&&r.type.is(i))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return null==i?o:[]}}function co(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length-1,i=t.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}var fo=(0,r.Z)((function t(e,n,r,o){(0,i.Z)(this,t),this.parent=e,this.buffer=n,this.index=r,this.start=o})),vo=function(){function t(e,n,r){(0,i.Z)(this,t),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}return(0,r.Z)(t,[{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(e,n,i){var r=this.context.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],e,n-this.context.start,i);return o<0?null:new t(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(t){return this.child(1,t,2)}},{key:"childBefore",value:function(t){return this.child(-1,t,-2)}},{key:"enter",value:function(e,n){if((arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)&to.ExcludeBuffers)return null;var i=this.context.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return r<0?null:new t(this.context,this,r)}},{key:"parent",get:function(){return this._parent||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}},{key:"nextSibling",get:function(){var e=this.context.buffer,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new t(this.context,this._parent,n):this.externalSibling(1)}},{key:"prevSibling",get:function(){var e=this.context.buffer,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new t(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}},{key:"cursor",value:function(){return new go(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function(){return null}},{key:"toTree",value:function(){var t=[],e=[],n=this.context.buffer,i=this.index+4,r=n.buffer[this.index+3];if(r>i){var o=n.buffer[this.index+1];t.push(n.slice(i,r,o)),e.push(0)}return new io(this.type,t,e,this.to-this.from)}},{key:"resolve",value:function(t){return ho(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(t){return ho(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function(t){return ao(this,t)}},{key:"toString",value:function(){return this.context.buffer.childString(this.index)}},{key:"getChild",value:function(t){var e=lo(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return e.length?e[0]:null}},{key:"getChildren",value:function(t){return lo(this,t,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(t){return co(this,t)}}]),t}(),go=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if((0,i.Z)(this,t),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof uo)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(var r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}return(0,r.Z)(t,[{key:"name",get:function(){return this.type.name}},{key:"yieldNode",value:function(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}},{key:"yieldBuf",value:function(t,e){this.index=t;var n=this.buffer,i=n.start,r=n.buffer;return this.type=e||r.set.types[r.buffer[t]],this.from=i+r.buffer[t+1],this.to=i+r.buffer[t+2],!0}},{key:"yield",value:function(t){return!!t&&(t instanceof uo?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}},{key:"toString",value:function(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}},{key:"enterChild",value:function(t,e,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,n,this.mode));var i=this.buffer.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.buffer.start,n);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}},{key:"firstChild",value:function(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function(t){return this.enterChild(1,t,2)}},{key:"childBefore",value:function(t){return this.enterChild(-1,t,-2)}},{key:"enter",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(n&to.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,n))}},{key:"parent",value:function(){if(!this.buffer)return this.yieldNode(this.mode&to.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&to.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}},{key:"sibling",value:function(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,n=this.stack.length-1;if(t<0){var i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(e.findChild(i,this.index,-1,0,4))}else{var r=e.buffer[this.index+3];if(r<(n<0?e.buffer.length:e.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}},{key:"nextSibling",value:function(){return this.sibling(1)}},{key:"prevSibling",value:function(){return this.sibling(-1)}},{key:"atLastNode",value:function(t){var e,n,i=this.buffer;if(i){if(t>0){if(this.index<i.buffer.buffer.length)return!1}else for(var r=0;r<this.index;r++)if(i.buffer.buffer[r+3]<this.index)return!1;e=i.index,n=i.parent}else{var o=this._tree;e=o.index,n=o._parent}for(;n;e=(s=n).index,n=s._parent,s){var s;if(e>-1)for(var a=e+t,h=t<0?-1:n._tree.children.length;a!=h;a+=t){var u=n._tree.children[a];if(this.mode&to.IncludeAnonymous||u instanceof oo||!u.type.isAnonymous||po(u))return!1}}return!0}},{key:"move",value:function(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(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(1,t)}},{key:"prev",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(-1,t)}},{key:"moveTo",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(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(){if(!this.buffer)return this._tree;var t=this.bufferNode,e=null,n=0;if(t&&t.context==this.buffer)t:for(var i=this.index,r=this.stack.length;r>=0;){for(var o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;e=o,n=r+1;break t}i=this.stack[--r]}for(var s=n;s<this.stack.length;s++)e=new vo(this.buffer,e,this.stack[s]);return this.bufferNode=new vo(this.buffer,e,this.index)}},{key:"tree",get:function(){return this.buffer?null:this._tree._tree}},{key:"iterate",value:function(t,e){for(var n=0;;){var i=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;i&&e&&e(this),i=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,i=!0}}}},{key:"matchContext",value:function(t){if(!this.buffer)return co(this.node,t);for(var e=this.buffer.buffer,n=e.set.types,i=t.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return co(this.node,t,i);var o=n[e.buffer[this.stack[r]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}}]),t}();function po(t){return t.children.some((function(t){return t instanceof oo||!t.type.isAnonymous||po(t)}))}var mo=new WeakMap;function yo(t,e){if(!t.isAnonymous||e instanceof oo||e.type!=t)return 1;var n=mo.get(e);if(null==n){n=1;var i,r=(0,o.Z)(e.children);try{for(r.s();!(i=r.n()).done;){var s=i.value;if(s.type!=t||!(s instanceof io)){n=1;break}n+=yo(t,s)}}catch(a){r.e(a)}finally{r.f()}mo.set(e,n)}return n}function ko(t,e,n,i,r,o,s,a,h){for(var u=0,l=i;l<r;l++)u+=yo(t,e[l]);var c=Math.ceil(1.5*u/8),f=[],d=[];return function e(n,i,r,s,a){for(var u=r;u<s;){var l=u,v=i[u],g=yo(t,n[u]);for(u++;u<s;u++){var p=yo(t,n[u]);if(g+p>=c)break;g+=p}if(u==l+1){if(g>c){var m=n[l];e(m.children,m.positions,0,m.children.length,i[l]+a);continue}f.push(n[l])}else{var y=i[u-1]+n[u-1].length-v;f.push(ko(t,n,i,l,u,v,y,null,h))}d.push(v+a-o)}}(e,n,i,r,0),(a||h)(f,d,s)}var wo=function(){function t(e,n,r,o){var s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];(0,i.Z)(this,t),this.from=e,this.to=n,this.tree=r,this.offset=o,this.open=(s?1:0)|(a?2:0)}return(0,r.Z)(t,[{key:"openStart",get:function(){return(1&this.open)>0}},{key:"openEnd",get:function(){return(2&this.open)>0}}],[{key:"addTree",value:function(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=[new t(0,e.length,e,0,!1,r)],a=(0,o.Z)(i);try{for(a.s();!(n=a.n()).done;){var h=n.value;h.to>e.length&&s.push(h)}}catch(u){a.e(u)}finally{a.f()}return s}},{key:"applyChanges",value:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:128;if(!n.length)return e;for(var r=[],o=1,s=e.length?e[0]:null,a=0,h=0,u=0;;a++){var l=a<n.length?n[a]:null,c=l?l.fromA:1e9;if(c-h>=i)for(;s&&s.from<c;){var f=s;if(h>=f.from||c<=f.to||u){var d=Math.max(f.from,h)-u,v=Math.min(f.to,c)-u;f=d>=v?null:new t(d,v,f.tree,f.offset+u,a>0,!!l)}if(f&&r.push(f),s.to>c)break;s=o<e.length?e[o++]:null}if(!l)break;h=l.toA,u=l.toA-l.toB}return r}}]),t}(),bo=function(){function t(){(0,i.Z)(this,t)}return(0,r.Z)(t,[{key:"startParse",value:function(t,e,n){return"string"==typeof t&&(t=new xo(t)),n=n?n.length?n.map((function(t){return new $r(t.from,t.to)})):[new $r(0,0)]:[new $r(0,t.length)],this.createParse(t,e||[],n)}},{key:"parse",value:function(t,e,n){for(var i=this.startParse(t,e,n);;){var r=i.advance();if(r)return r}}}]),t}(),xo=function(){function t(e){(0,i.Z)(this,t),this.string=e}return(0,r.Z)(t,[{key:"length",get:function(){return this.string.length}},{key:"chunk",value:function(t){return this.string.slice(t)}},{key:"lineChunks",get:function(){return!1}},{key:"read",value:function(t,e){return this.string.slice(t,e)}}]),t}();new Xr({perNode:!0});var So=function(){function t(){(0,i.Z)(this,t)}return(0,r.Z)(t,[{key:"lineAt",value:function(t){if(t<0||t>this.length)throw new RangeError("Invalid position ".concat(t," in document of length ").concat(this.length));return this.lineInner(t,!1,1,0)}},{key:"line",value:function(t){if(t<1||t>this.lines)throw new RangeError("Invalid line number ".concat(t," in ").concat(this.lines,"-line document"));return this.lineInner(t,!0,1,0)}},{key:"replace",value:function(t,e,n){var i=[];return this.decompose(0,t,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(e,this.length,i,1),Mo.from(i,this.length-(e-t)+n.length)}},{key:"append",value:function(t){return this.replace(this.length,this.length,t)}},{key:"slice",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=[];return this.decompose(t,e,n,0),Mo.from(n,e-t)}},{key:"eq",value:function(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;for(var e=this.scanIdentical(t,1),n=this.length-this.scanIdentical(t,-1),i=new Oo(this),r=new Oo(t),o=e,s=e;;){if(i.next(o),r.next(o),o=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}},{key:"iter",value:function(){return new Oo(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)}},{key:"iterRange",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return new To(this,t,e)}},{key:"iterLines",value:function(t,e){var n;if(null==t)n=this.iter();else{null==e&&(e=this.lines+1);var i=this.line(t).from;n=this.iterRange(i,Math.max(i,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new Do(n)}},{key:"toString",value:function(){return this.sliceString(0)}},{key:"toJSON",value:function(){var t=[];return this.flatten(t),t}}],[{key:"of",value:function(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new Ao(e):Mo.from(Ao.split(e,[])):t.empty}}]),t}(),Ao=function(t){function e(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){var e,n=-1,i=(0,o.Z)(t);try{for(i.s();!(e=i.n()).done;){n+=e.value.length+1}}catch(r){i.e(r)}finally{i.f()}return n}(t);return(0,i.Z)(this,e),(n=(0,c.Z)(this,e)).text=t,n.length=r,n}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"lines",get:function(){return this.text.length}},{key:"children",get:function(){return null}},{key:"lineInner",value:function(t,e,n,i){for(var r=0;;r++){var o=this.text[r],s=i+o.length;if((e?n:s)>=t)return new Eo(i,s,n,o);i=s+1,n++}}},{key:"decompose",value:function(t,n,i,r){var o=t<=0&&n>=this.length?this:new e(Co(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(1&r){var s=i.pop(),a=Zo(o.text,s.text.slice(),0,o.length);if(a.length<=32)i.push(new e(a,s.length+o.length));else{var h=a.length>>1;i.push(new e(a.slice(0,h)),new e(a.slice(h)))}}else i.push(o)}},{key:"replace",value:function(t,n,i){if(!(i instanceof e))return(0,u.Z)((0,l.Z)(e.prototype),"replace",this).call(this,t,n,i);var r=Zo(this.text,Zo(i.text,Co(this.text,0,t)),n),o=this.length+i.length-(n-t);return r.length<=32?new e(r,o):Mo.from(e.split(r,[]),o)}},{key:"sliceString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",i="",r=0,o=0;r<=e&&o<this.text.length;o++){var s=this.text[o],a=r+s.length;r>t&&o&&(i+=n),t<a&&e>r&&(i+=s.slice(Math.max(0,t-r),e-r)),r=a+1}return i}},{key:"flatten",value:function(t){var e,n=(0,o.Z)(this.text);try{for(n.s();!(e=n.n()).done;){var i=e.value;t.push(i)}}catch(r){n.e(r)}finally{n.f()}}},{key:"scanIdentical",value:function(){return 0}}],[{key:"split",value:function(t,n){var i,r=[],s=-1,a=(0,o.Z)(t);try{for(a.s();!(i=a.n()).done;){var h=i.value;r.push(h),s+=h.length+1,32==r.length&&(n.push(new e(r,s)),r=[],s=-1)}}catch(u){a.e(u)}finally{a.f()}return s>-1&&n.push(new e(r,s)),n}}]),e}(So),Mo=function(t){function e(t,n){var r;(0,i.Z)(this,e),(r=(0,c.Z)(this,e)).children=t,r.length=n,r.lines=0;var s,a=(0,o.Z)(t);try{for(a.s();!(s=a.n()).done;){var h=s.value;r.lines+=h.lines}}catch(u){a.e(u)}finally{a.f()}return r}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"lineInner",value:function(t,e,n,i){for(var r=0;;r++){var o=this.children[r],s=i+o.length,a=n+o.lines-1;if((e?a:s)>=t)return o.lineInner(t,e,n,i);i=s+1,n=a+1}}},{key:"decompose",value:function(t,e,n,i){for(var r=0,o=0;o<=e&&r<this.children.length;r++){var s=this.children[r],a=o+s.length;if(t<=a&&e>=o){var h=i&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?n.push(s):s.decompose(t-o,e-o,n,h)}o=a+1}}},{key:"replace",value:function(t,n,i){if(i.lines<this.lines)for(var r=0,o=0;r<this.children.length;r++){var s=this.children[r],a=o+s.length;if(t>=o&&n<=a){var h=s.replace(t-o,n-o,i),c=this.lines-s.lines+h.lines;if(h.lines<c>>4&&h.lines>c>>6){var f=this.children.slice();return f[r]=h,new e(f,this.length-(n-t)+i.length)}return(0,u.Z)((0,l.Z)(e.prototype),"replace",this).call(this,o,a,h)}o=a+1}return(0,u.Z)((0,l.Z)(e.prototype),"replace",this).call(this,t,n,i)}},{key:"sliceString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",i="",r=0,o=0;r<this.children.length&&o<=e;r++){var s=this.children[r],a=o+s.length;o>t&&r&&(i+=n),t<a&&e>o&&(i+=s.sliceString(t-o,e-o,n)),o=a+1}return i}},{key:"flatten",value:function(t){var e,n=(0,o.Z)(this.children);try{for(n.s();!(e=n.n()).done;){e.value.flatten(t)}}catch(i){n.e(i)}finally{n.f()}}},{key:"scanIdentical",value:function(t,n){if(!(t instanceof e))return 0;for(var i=0,r=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1],o=(0,a.Z)(r,4),s=o[0],h=o[1],u=o[2],l=o[3];;s+=n,h+=n){if(s==u||h==l)return i;var c=this.children[s],f=t.children[h];if(c!=f)return i+c.scanIdentical(f,n);i+=c.length+1}}}],[{key:"from",value:function(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.reduce((function(t,e){return t+e.length+1}),-1),r=0,s=(0,o.Z)(t);try{for(s.s();!(n=s.n()).done;){r+=n.value.lines}}catch(b){s.e(b)}finally{s.f()}if(r<32){var a,h=[],u=(0,o.Z)(t);try{for(u.s();!(a=u.n()).done;){a.value.flatten(h)}}catch(b){u.e(b)}finally{u.f()}return new Ao(h,i)}var l=Math.max(32,r>>5),c=l<<1,f=l>>1,d=[],v=0,g=-1,p=[];function m(t){var n;if(t.lines>c&&t instanceof e){var i,r=(0,o.Z)(t.children);try{for(r.s();!(i=r.n()).done;){m(i.value)}}catch(b){r.e(b)}finally{r.f()}}else t.lines>f&&(v>f||!v)?(y(),d.push(t)):t instanceof Ao&&v&&(n=p[p.length-1])instanceof Ao&&t.lines+n.lines<=32?(v+=t.lines,g+=t.length+1,p[p.length-1]=new Ao(n.text.concat(t.text),n.length+1+t.length)):(v+t.lines>l&&y(),v+=t.lines,g+=t.length+1,p.push(t))}function y(){0!=v&&(d.push(1==p.length?p[0]:e.from(p,g)),g=-1,v=p.length=0)}var k,w=(0,o.Z)(t);try{for(w.s();!(k=w.n()).done;){m(k.value)}}catch(b){w.e(b)}finally{w.f()}return y(),1==d.length?d[0]:new e(d,i)}}]),e}(So);function Zo(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e9,r=0,o=0,s=!0;o<t.length&&r<=i;o++){var a=t[o],h=r+a.length;h>=n&&(h>i&&(a=a.slice(0,i-r)),r<n&&(a=a.slice(n-r)),s?(e[e.length-1]+=a,s=!1):e.push(a)),r=h+1}return e}function Co(t,e,n){return Zo(t,[""],e,n)}So.empty=new Ao([""],0);var Oo=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;(0,i.Z)(this,t),this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof Ao?e.text.length:e.children.length)<<1]}return(0,r.Z)(t,[{key:"nextInner",value:function(t,e){for(this.done=this.lineBreak=!1;;){var n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],o=r>>1,s=i instanceof Ao?i.text.length:i.children.length;if(o==(e>0?s:0)){if(0==n)return this.done=!0,this.value="",this;e>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(e>0?0:1)){if(this.offsets[n]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(i instanceof Ao){var a=i.text[o+(e<0?-1:0)];if(this.offsets[n]+=e,a.length>Math.max(0,t))return this.value=0==t?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{var h=i.children[o+(e<0?-1:0)];t>h.length?(t-=h.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(h),this.offsets.push(e>0?1:(h instanceof Ao?h.text.length:h.children.length)<<1))}}}},{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}]),t}(),To=function(){function t(e,n,r){(0,i.Z)(this,t),this.value="",this.done=!1,this.cursor=new Oo(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}return(0,r.Z)(t,[{key:"nextInner",value:function(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 n=e<0?this.pos-this.from:this.to-this.pos;t>n&&(t=n),n-=t;var i=this.cursor.next(t).value;return this.pos+=(i.length+t)*e,this.value=i.length<=n?i:e<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}},{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?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(){return this.cursor.lineBreak&&""!=this.value}}]),t}(),Do=function(){function t(e){(0,i.Z)(this,t),this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}return(0,r.Z)(t,[{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.inner.next(t),n=e.done,i=e.lineBreak,r=e.value;return n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}},{key:"lineBreak",get:function(){return!1}}]),t}();"undefined"!=typeof Symbol&&(So.prototype[Symbol.iterator]=function(){return this.iter()},Oo.prototype[Symbol.iterator]=To.prototype[Symbol.iterator]=Do.prototype[Symbol.iterator]=function(){return this});for(var Eo=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.from=e,this.to=n,this.number=r,this.text=o}return(0,r.Z)(t,[{key:"length",get:function(){return this.to-this.from}}]),t}(),Bo="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})),Ro=1;Ro<Bo.length;Ro++)Bo[Ro]+=Bo[Ro-1];function Io(t){for(var e=1;e<Bo.length;e+=2)if(Bo[e]>t)return Bo[e-1]<=t;return!1}function Po(t){return t>=127462&&t<=127487}var No=8205;function Lo(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Vo:Ho)(t,e,!(arguments.length>3&&void 0!==arguments[3])||arguments[3])}function Vo(t,e,n){if(e==t.length)return e;e&&Wo(t.charCodeAt(e))&&_o(t.charCodeAt(e-1))&&e--;var i=zo(t,e);for(e+=Fo(i);e<t.length;){var r=zo(t,e);if(i==No||r==No||n&&Io(r))e+=Fo(r),i=r;else{if(!Po(r))break;for(var o=0,s=e-2;s>=0&&Po(zo(t,s));)o++,s-=2;if(o%2==0)break;e+=2}}return e}function Ho(t,e,n){for(;e>0;){var i=Vo(t,e-2,n);if(i<e)return i;e--}return 0}function Wo(t){return t>=56320&&t<57344}function _o(t){return t>=55296&&t<56320}function zo(t,e){var n=t.charCodeAt(e);if(!_o(n)||e+1==t.length)return n;var i=t.charCodeAt(e+1);return Wo(i)?i-56320+(n-55296<<10)+65536:n}function Fo(t){return t<65536?1:2}var qo=/\r\n?|\n/,jo=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(jo||(jo={})),Ko=function(){function t(e){(0,i.Z)(this,t),this.sections=e}return(0,r.Z)(t,[{key:"length",get:function(){for(var t=0,e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}},{key:"newLength",get:function(){for(var t=0,e=0;e<this.sections.length;e+=2){var n=this.sections[e+1];t+=n<0?this.sections[e]:n}return t}},{key:"empty",get:function(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}},{key:"iterGaps",value:function(t){for(var e=0,n=0,i=0;e<this.sections.length;){var r=this.sections[e++],o=this.sections[e++];o<0?(t(n,i,r),i+=r):i+=o,n+=r}}},{key:"iterChangedRanges",value:function(t){$o(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"invertedDesc",get:function(){for(var e=[],n=0;n<this.sections.length;){var i=this.sections[n++],r=this.sections[n++];r<0?e.push(i,r):e.push(r,i)}return new t(e)}},{key:"composeDesc",value:function(t){return this.empty?t:t.empty?this:Yo(this,t)}},{key:"mapDesc",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:Xo(this,t,e)}},{key:"mapPos",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:jo.Simple,i=0,r=0,o=0;o<this.sections.length;){var s=this.sections[o++],a=this.sections[o++],h=i+s;if(a<0){if(h>t)return r+(t-i);r+=s}else{if(n!=jo.Simple&&h>=t&&(n==jo.TrackDel&&i<t&&h>t||n==jo.TrackBefore&&i<t||n==jo.TrackAfter&&h>t))return null;if(h>t||h==t&&e<0&&!s)return t==i||e<0?r:r+a;r+=a}i=h}if(t>i)throw new RangeError("Position ".concat(t," is out of range for changeset of length ").concat(i));return r}},{key:"touchesRange",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=0,i=0;n<this.sections.length&&i<=e;){var r=i+this.sections[n++];if(this.sections[n++]>=0&&i<=e&&r>=t)return!(i<t&&r>e)||"cover";i=r}return!1}},{key:"toString",value:function(){for(var t="",e=0;e<this.sections.length;){var n=this.sections[e++],i=this.sections[e++];t+=(t?" ":"")+n+(i>=0?":"+i:"")}return t}},{key:"toJSON",value:function(){return this.sections}}],[{key:"fromJSON",value:function(e){if(!Array.isArray(e)||e.length%2||e.some((function(t){return"number"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}},{key:"create",value:function(e){return new t(e)}}]),t}(),Jo=function(t){function e(t,n){var r;return(0,i.Z)(this,e),(r=(0,c.Z)(this,e,[t])).inserted=n,r}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"apply",value:function(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return $o(this,(function(e,n,i,r,o){return t=t.replace(i,i+(n-e),o)}),!1),t}},{key:"mapDesc",value:function(t){return Xo(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"invert",value:function(t){for(var n=this.sections.slice(),i=[],r=0,o=0;r<n.length;r+=2){var s=n[r],a=n[r+1];if(a>=0){n[r]=a,n[r+1]=s;for(var h=r>>1;i.length<h;)i.push(So.empty);i.push(s?t.slice(o,o+s):So.empty)}o+=s}return new e(n,i)}},{key:"compose",value:function(t){return this.empty?t:t.empty?this:Yo(this,t,!0)}},{key:"map",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:Xo(this,t,e,!0)}},{key:"iterChanges",value:function(t){$o(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"desc",get:function(){return Ko.create(this.sections)}},{key:"filter",value:function(t){var n=[],i=[],r=[],o=new Qo(this);t:for(var s=0,a=0;;){for(var h=s==t.length?1e9:t[s++];a<h||a==h&&0==o.len;){if(o.done)break t;var u=Math.min(o.len,h-a);Uo(r,u,-1);var l=-1==o.ins?-1:0==o.off?o.ins:0;Uo(n,u,l),l>0&&Go(i,n,o.text),o.forward(u),a+=u}for(var c=t[s++];a<c;){if(o.done)break t;var f=Math.min(o.len,c-a);Uo(n,f,-1),Uo(r,f,-1==o.ins?-1:0==o.off?o.ins:0),o.forward(f),a+=f}}return{changes:new e(n,i),filtered:Ko.create(r)}}},{key:"toJSON",value:function(){for(var t=[],e=0;e<this.sections.length;e+=2){var n=this.sections[e],i=this.sections[e+1];i<0?t.push(n):0==i?t.push([n]):t.push([n].concat(this.inserted[e>>1].toJSON()))}return t}}],[{key:"of",value:function(t,n,i){var r=[],s=[],a=0,h=null;function u(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||r.length){a<n&&Uo(r,n-a,-1);var t=new e(r,s);h=h?h.compose(t.map(h)):t,r=[],s=[],a=0}}return function t(l){if(Array.isArray(l)){var c,f=(0,o.Z)(l);try{for(f.s();!(c=f.n()).done;){t(c.value)}}catch(k){f.e(k)}finally{f.f()}}else if(l instanceof e){if(l.length!=n)throw new RangeError("Mismatched change set length (got ".concat(l.length,", expected ").concat(n,")"));u(),h=h?h.compose(l.map(h)):l}else{var d=l.from,v=l.to,g=void 0===v?d:v,p=l.insert;if(d>g||d<0||g>n)throw new RangeError("Invalid change range ".concat(d," to ").concat(g," (in doc of length ").concat(n,")"));var m=p?"string"==typeof p?So.of(p.split(i||qo)):p:So.empty,y=m.length;if(d==g&&0==y)return;d<a&&u(),d>a&&Uo(r,d-a,-1),Uo(r,g-d,y),Go(s,r,m),a=g}}(t),u(!h),h}},{key:"empty",value:function(t){return new e(t?[t,-1]:[],[])}},{key:"fromJSON",value:function(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");for(var n=[],i=[],r=0;r<t.length;r++){var o=t[r];if("number"==typeof o)n.push(o,-1);else{if(!Array.isArray(o)||"number"!=typeof o[0]||o.some((function(t,e){return e&&"string"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==o.length)n.push(o[0],0);else{for(;i.length<r;)i.push(So.empty);i[r]=So.of(o.slice(1)),n.push(o[0],i[r].length)}}}return new e(n,i)}},{key:"createSet",value:function(t,n){return new e(t,n)}}]),e}(Ko);function Uo(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!(0==e&&n<=0)){var r=t.length-2;r>=0&&n<=0&&n==t[r+1]?t[r]+=e:0==e&&0==t[r]?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}}function Go(t,e,n){if(0!=n.length){var i=e.length-2>>1;if(i<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<i;)t.push(So.empty);t.push(n)}}}function $o(t,e,n){for(var i=t.inserted,r=0,o=0,s=0;s<t.sections.length;){var a=t.sections[s++],h=t.sections[s++];if(h<0)r+=a,o+=a;else{for(var u=r,l=o,c=So.empty;u+=a,l+=h,h&&i&&(c=c.append(i[s-2>>1])),!(n||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],h=t.sections[s++];e(r,u,o,l,c),r=u,o=l}}}function Xo(t,e,n){for(var i=[],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3]?[]:null,o=new Qo(t),s=new Qo(e),a=-1;;)if(-1==o.ins&&-1==s.ins){var h=Math.min(o.len,s.len);Uo(i,h,-1),o.forward(h),s.forward(h)}else if(s.ins>=0&&(o.ins<0||a==o.i||0==o.off&&(s.len<o.len||s.len==o.len&&!n))){var u=s.len;for(Uo(i,s.ins,-1);u;){var l=Math.min(o.len,u);o.ins>=0&&a<o.i&&o.len<=l&&(Uo(i,0,o.ins),r&&Go(r,i,o.text),a=o.i),o.forward(l),u-=l}s.next()}else{if(!(o.ins>=0)){if(o.done&&s.done)return r?Jo.createSet(i,r):Ko.create(i);throw new Error("Mismatched change set lengths")}for(var c=0,f=o.len;f;)if(-1==s.ins){var d=Math.min(f,s.len);c+=d,f-=d,s.forward(d)}else{if(!(0==s.ins&&s.len<f))break;f-=s.len,s.next()}Uo(i,c,a<o.i?o.ins:0),r&&a<o.i&&Go(r,i,o.text),a=o.i,o.forward(o.len-f)}}function Yo(t,e){for(var n=[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2]?[]:null,r=new Qo(t),o=new Qo(e),s=!1;;){if(r.done&&o.done)return i?Jo.createSet(n,i):Ko.create(n);if(0==r.ins)Uo(n,r.len,0,s),r.next();else if(0!=o.len||o.done){if(r.done||o.done)throw new Error("Mismatched change set lengths");var a=Math.min(r.len2,o.len),h=n.length;if(-1==r.ins){var u=-1==o.ins?-1:o.off?0:o.ins;Uo(n,a,u,s),i&&u&&Go(i,n,o.text)}else-1==o.ins?(Uo(n,r.off?0:r.len,a,s),i&&Go(i,n,r.textBit(a))):(Uo(n,r.off?0:r.len,o.off?0:o.ins,s),i&&!o.off&&Go(i,n,o.text));s=(r.ins>a||o.ins>=0&&o.len>a)&&(s||n.length>h),r.forward2(a),o.forward(a)}else Uo(n,0,o.ins,s),i&&Go(i,n,o.text),o.next()}}var Qo=function(){function t(e){(0,i.Z)(this,t),this.set=e,this.i=0,this.next()}return(0,r.Z)(t,[{key:"next",value:function(){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(){return-2==this.ins}},{key:"len2",get:function(){return this.ins<0?this.len:this.ins}},{key:"text",get:function(){var t=this.set.inserted,e=this.i-2>>1;return e>=t.length?So.empty:t[e]}},{key:"textBit",value:function(t){var e=this.set.inserted,n=this.i-2>>1;return n>=e.length&&!t?So.empty:e[n].slice(this.off,null==t?void 0:this.off+t)}},{key:"forward",value:function(t){t==this.len?this.next():(this.len-=t,this.off+=t)}},{key:"forward2",value:function(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}]),t}(),ts=function(){function t(e,n,r){(0,i.Z)(this,t),this.from=e,this.to=n,this.flags=r}return(0,r.Z)(t,[{key:"anchor",get:function(){return 16&this.flags?this.to:this.from}},{key:"head",get:function(){return 16&this.flags?this.from:this.to}},{key:"empty",get:function(){return this.from==this.to}},{key:"assoc",get:function(){return 4&this.flags?-1:8&this.flags?1:0}},{key:"bidiLevel",get:function(){var t=3&this.flags;return 3==t?null:t}},{key:"goalColumn",get:function(){var t=this.flags>>5;return 33554431==t?void 0:t}},{key:"map",value:function(e){var n,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return this.empty?n=i=e.mapPos(this.from,r):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new t(n,i,this.flags)}},{key:"extend",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(t<=this.anchor&&e>=this.anchor)return es.range(t,e);var n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return es.range(this.anchor,n)}},{key:"eq",value:function(t){return this.anchor==t.anchor&&this.head==t.head}},{key:"toJSON",value:function(){return{anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return es.range(t.anchor,t.head)}},{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}(),es=function(){function t(e,n){(0,i.Z)(this,t),this.ranges=e,this.mainIndex=n}return(0,r.Z)(t,[{key:"map",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return e.empty?this:t.create(this.ranges.map((function(t){return t.map(e,n)})),this.mainIndex)}},{key:"eq",value:function(t){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].eq(t.ranges[e]))return!1;return!0}},{key:"main",get:function(){return this.ranges[this.mainIndex]}},{key:"asSingle",value:function(){return 1==this.ranges.length?this:new t([this.main],0)}},{key:"addRange",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.create([e].concat(this.ranges),n?0:this.mainIndex+1)}},{key:"replaceRange",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.mainIndex,i=this.ranges.slice();return i[n]=e,t.create(i,this.mainIndex)}},{key:"toJSON",value:function(){return{ranges:this.ranges.map((function(t){return t.toJSON()})),main:this.mainIndex}}}],[{key:"fromJSON",value:function(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t(e.ranges.map((function(t){return ts.fromJSON(t)})),e.main)}},{key:"single",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return new t([t.range(e,n)],0)}},{key:"create",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0==e.length)throw new RangeError("A selection needs at least one range");for(var i=0,r=0;r<e.length;r++){var o=e[r];if(o.empty?o.from<=i:o.from<i)return t.normalized(e.slice(),n);i=o.to}return new t(e,n)}},{key:"cursor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;return ts.create(t,t,(0==e?0:e<0?4:8)|(null==n?3:Math.min(2,n))|(null!=i?i:33554431)<<5)}},{key:"range",value:function(t,e,n,i){var r=(null!=n?n:33554431)<<5|(null==i?3:Math.min(2,i));return e<t?ts.create(e,t,24|r):ts.create(t,e,(e>t?4:0)|r)}},{key:"normalized",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e[n];e.sort((function(t,e){return t.from-e.from})),n=e.indexOf(i);for(var r=1;r<e.length;r++){var o=e[r],s=e[r-1];if(o.empty?o.from<=s.to:o.from<s.to){var a=s.from,h=Math.max(o.to,s.to);r<=n&&n--,e.splice(--r,2,o.anchor>o.head?t.range(h,a):t.range(a,h))}}return new t(e,n)}}]),t}();function ns(t,e){var n,i=(0,o.Z)(t.ranges);try{for(i.s();!(n=i.n()).done;){if(n.value.to>e)throw new RangeError("Selection points outside of document")}}catch(r){i.e(r)}finally{i.f()}}var is=0,rs=function(){function t(e,n,r,o,s){(0,i.Z)(this,t),this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=o,this.id=is++,this.default=e([]),this.extensions="function"==typeof s?s(this):s}return(0,r.Z)(t,[{key:"of",value:function(t){return new ss([],this,0,t)}},{key:"compute",value:function(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new ss(t,this,1,e)}},{key:"computeN",value:function(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new ss(t,this,2,e)}},{key:"from",value:function(t,e){return e||(e=function(t){return t}),this.compute([t],(function(n){return e(n.field(t))}))}}],[{key:"define",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new t(e.combine||function(t){return t},e.compareInput||function(t,e){return t===e},e.compare||(e.combine?function(t,e){return t===e}:os),!!e.static,e.enables)}}]),t}();function os(t,e){return t==e||t.length==e.length&&t.every((function(t,n){return t===e[n]}))}var ss=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.dependencies=e,this.facet=n,this.type=r,this.value=o,this.id=is++}return(0,r.Z)(t,[{key:"dynamicSlot",value:function(t){var e,n,i=this,r=this.value,s=this.facet.compareInput,a=this.id,h=t[a]>>1,u=2==this.type,l=!1,c=!1,f=[],d=(0,o.Z)(this.dependencies);try{for(d.s();!(n=d.n()).done;){var v=n.value;"doc"==v?l=!0:"selection"==v?c=!0:0==(1&(null!==(e=t[v.id])&&void 0!==e?e:1))&&f.push(t[v.id])}}catch(g){d.e(g)}finally{d.f()}return{create:function(t){return t.values[h]=r(t),1},update:function(t,e){if(l&&e.docChanged||c&&(e.docChanged||e.selection)||hs(t,f)){var n=r(t);if(u?!as(n,t.values[h],s):!s(n,t.values[h]))return t.values[h]=n,1}return 0},reconfigure:function(t,e){var n,o=e.config.address[a];if(null!=o){var l=ms(e,o);if(i.dependencies.every((function(n){return n instanceof rs?e.facet(n)===t.facet(n):!(n instanceof ls)||e.field(n,!1)==t.field(n,!1)}))||(u?as(n=r(t),l,s):s(n=r(t),l)))return t.values[h]=l,0}else n=r(t);return t.values[h]=n,1}}}}]),t}();function as(t,e,n){if(t.length!=e.length)return!1;for(var i=0;i<t.length;i++)if(!n(t[i],e[i]))return!1;return!0}function hs(t,e){var n,i=!1,r=(0,o.Z)(e);try{for(r.s();!(n=r.n()).done;){1&ps(t,n.value)&&(i=!0)}}catch(s){r.e(s)}finally{r.f()}return i}var us=rs.define({static:!0}),ls=function(){function t(e,n,r,o,s){(0,i.Z)(this,t),this.id=e,this.createF=n,this.updateF=r,this.compareF=o,this.spec=s,this.provides=void 0}return(0,r.Z)(t,[{key:"create",value:function(t){var e=this,n=t.facet(us).find((function(t){return t.field==e}));return((null==n?void 0:n.create)||this.createF)(t)}},{key:"slot",value:function(t){var e=this,n=t[this.id]>>1;return{create:function(t){return t.values[n]=e.create(t),1},update:function(t,i){var r=t.values[n],o=e.updateF(r,i);return e.compareF(r,o)?0:(t.values[n]=o,1)},reconfigure:function(t,i){return null!=i.config.address[e.id]?(t.values[n]=i.field(e),0):(t.values[n]=e.create(t),1)}}}},{key:"init",value:function(t){return[this,us.of({field:this,create:t})]}},{key:"extension",get:function(){return this}}],[{key:"define",value:function(e){var n=new t(is++,e.create,e.update,e.compare||function(t,e){return t===e},e);return e.provide&&(n.provides=e.provide(n)),n}}]),t}(),cs=2;var fs=(0,r.Z)((function t(e,n){(0,i.Z)(this,t),this.inner=e,this.prec=n})),ds=function(){function t(){(0,i.Z)(this,t)}return(0,r.Z)(t,[{key:"of",value:function(t){return new vs(this,t)}},{key:"reconfigure",value:function(e){return t.reconfigure.of({compartment:this,extension:e})}},{key:"get",value:function(t){return t.config.compartments.get(this)}}]),t}(),vs=(0,r.Z)((function t(e,n){(0,i.Z)(this,t),this.compartment=e,this.inner=n})),gs=function(){function t(e,n,r,o,s,a){for((0,i.Z)(this,t),this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=o,this.staticValues=s,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}return(0,r.Z)(t,[{key:"staticFacet",value:function(t){var e=this.address[t.id];return null==e?t.default:this.staticValues[e>>1]}}],[{key:"resolve",value:function(e,n,i){var r,s=[],a=Object.create(null),h=new Map,u=(0,o.Z)(function(t,e,n){var i=[[],[],[],[],[]],r=new Map;function s(t,a){var h=r.get(t);if(null!=h){if(h<=a)return;var u=i[h].indexOf(t);u>-1&&i[h].splice(u,1),t instanceof vs&&n.delete(t.compartment)}if(r.set(t,a),Array.isArray(t)){var l,c=(0,o.Z)(t);try{for(c.s();!(l=c.n()).done;){s(l.value,a)}}catch(v){c.e(v)}finally{c.f()}}else if(t instanceof vs){if(n.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");var f=e.get(t.compartment)||t.inner;n.set(t.compartment,f),s(f,a)}else if(t instanceof fs)s(t.inner,t.prec);else if(t instanceof ls)i[a].push(t),t.provides&&s(t.provides,a);else if(t instanceof ss)i[a].push(t),t.facet.extensions&&s(t.facet.extensions,cs);else{var d=t.extension;if(!d)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."));s(d,a)}}return s(t,cs),i.reduce((function(t,e){return t.concat(e)}))}(e,n,h));try{for(u.s();!(r=u.n()).done;){var l=r.value;l instanceof ls?s.push(l):(a[l.facet.id]||(a[l.facet.id]=[])).push(l)}}catch(w){u.e(w)}finally{u.f()}for(var c=Object.create(null),f=[],d=[],v=function(){var t=p[g];c[t.id]=d.length<<1,d.push((function(e){return t.slot(e)}))},g=0,p=s;g<p.length;g++)v();var m=null==i?void 0:i.config.facets,y=function(){var t=a[k],e=t[0].facet,n=m&&m[k]||[];if(t.every((function(t){return 0==t.type})))if(c[e.id]=f.length<<1|1,os(n,t))f.push(i.facet(e));else{var r=e.combine(t.map((function(t){return t.value})));f.push(i&&e.compare(r,i.facet(e))?i.facet(e):r)}else{var s,h=(0,o.Z)(t);try{var u=function(){var t=s.value;0==t.type?(c[t.id]=f.length<<1|1,f.push(t.value)):(c[t.id]=d.length<<1,d.push((function(e){return t.dynamicSlot(e)})))};for(h.s();!(s=h.n()).done;)u()}catch(w){h.e(w)}finally{h.f()}c[e.id]=d.length<<1,d.push((function(n){return function(t,e,n){var i=n.map((function(e){return t[e.id]})),r=n.map((function(t){return t.type})),s=i.filter((function(t){return!(1&t)})),a=t[e.id]>>1;function h(t){for(var n=[],s=0;s<i.length;s++){var a=ms(t,i[s]);if(2==r[s]){var h,u=(0,o.Z)(a);try{for(u.s();!(h=u.n()).done;){var l=h.value;n.push(l)}}catch(w){u.e(w)}finally{u.f()}}else n.push(a)}return e.combine(n)}return{create:function(t){var e,n=(0,o.Z)(i);try{for(n.s();!(e=n.n()).done;)ps(t,e.value)}catch(w){n.e(w)}finally{n.f()}return t.values[a]=h(t),1},update:function(t,n){if(!hs(t,s))return 0;var i=h(t);return e.compare(i,t.values[a])?0:(t.values[a]=i,1)},reconfigure:function(t,r){var o=hs(t,i),s=r.config.facets[e.id],u=r.facet(e);if(s&&!o&&os(n,s))return t.values[a]=u,0;var l=h(t);return e.compare(l,u)?(t.values[a]=u,0):(t.values[a]=l,1)}}}(n,e,t)}))}};for(var k in a)y();return new t(e,h,d.map((function(t){return t(c)})),c,f,a)}}]),t}();function ps(t,e){if(1&e)return 2;var n=e>>1,i=t.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;t.status[n]=4;var r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function ms(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}var ys=rs.define(),ks=rs.define({combine:function(t){return t.some((function(t){return t}))},static:!0}),ws=rs.define({combine:function(t){return t.length?t[0]:void 0},static:!0}),bs=rs.define(),xs=rs.define(),Ss=rs.define(),As=rs.define({combine:function(t){return!!t.length&&t[0]}}),Ms=function(){function t(e,n){(0,i.Z)(this,t),this.type=e,this.value=n}return(0,r.Z)(t,null,[{key:"define",value:function(){return new Zs}}]),t}(),Zs=function(){function t(){(0,i.Z)(this,t)}return(0,r.Z)(t,[{key:"of",value:function(t){return new Ms(this,t)}}]),t}(),Cs=function(){function t(e){(0,i.Z)(this,t),this.map=e}return(0,r.Z)(t,[{key:"of",value:function(t){return new Os(this,t)}}]),t}(),Os=function(){function t(e,n){(0,i.Z)(this,t),this.type=e,this.value=n}return(0,r.Z)(t,[{key:"map",value:function(e){var n=this.type.map(this.value,e);return void 0===n?void 0:n==this.value?this:new t(this.type,n)}},{key:"is",value:function(t){return this.type==t}}],[{key:"define",value:function(){return new Cs((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).map||function(t){return t})}},{key:"mapEffects",value:function(t,e){if(!t.length)return t;var n,i=[],r=(0,o.Z)(t);try{for(r.s();!(n=r.n()).done;){var s=n.value.map(e);s&&i.push(s)}}catch(a){r.e(a)}finally{r.f()}return i}}]),t}();Os.reconfigure=Os.define(),Os.appendConfig=Os.define();var Ts=function(){function t(e,n,r,o,s,a){(0,i.Z)(this,t),this.startState=e,this.changes=n,this.selection=r,this.effects=o,this.annotations=s,this.scrollIntoView=a,this._doc=null,this._state=null,r&&ns(r,n.newLength),s.some((function(e){return e.type==t.time}))||(this.annotations=s.concat(t.time.of(Date.now())))}return(0,r.Z)(t,[{key:"newDoc",get:function(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}},{key:"newSelection",get:function(){return this.selection||this.startState.selection.map(this.changes)}},{key:"state",get:function(){return this._state||this.startState.applyTransaction(this),this._state}},{key:"annotation",value:function(t){var e,n=(0,o.Z)(this.annotations);try{for(n.s();!(e=n.n()).done;){var i=e.value;if(i.type==t)return i.value}}catch(r){n.e(r)}finally{n.f()}}},{key:"docChanged",get:function(){return!this.changes.empty}},{key:"reconfigured",get:function(){return this.startState.config!=this.state.config}},{key:"isUserEvent",value:function(e){var n=this.annotation(t.userEvent);return!(!n||!(n==e||n.length>e.length&&n.slice(0,e.length)==e&&"."==n[e.length]))}}],[{key:"create",value:function(e,n,i,r,o,s){return new t(e,n,i,r,o,s)}}]),t}();function Ds(t,e){for(var n=[],i=0,r=0;;){var o=void 0,s=void 0;if(i<t.length&&(r==e.length||e[r]>=t[i]))o=t[i++],s=t[i++];else{if(!(r<e.length))return n;o=e[r++],s=e[r++]}!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function Es(t,e,n){var i,r,o,s;return n?(r=e.changes,o=Jo.empty(e.changes.length),s=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),o=t.changes.mapDesc(e.changes,!0),s=t.changes.compose(r)),{changes:s,selection:e.selection?e.selection.map(o):null===(i=t.selection)||void 0===i?void 0:i.map(r),effects:Os.mapEffects(t.effects,r).concat(Os.mapEffects(e.effects,o)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Bs(t,e,n){var i=e.selection,r=Ps(e.annotations);return e.userEvent&&(r=r.concat(Ts.userEvent.of(e.userEvent))),{changes:e.changes instanceof Jo?e.changes:Jo.of(e.changes||[],n,t.facet(ws)),selection:i&&(i instanceof es?i:es.single(i.anchor,i.head)),effects:Ps(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Rs(t,e,n){var i=Bs(t,e.length?e[0]:{},t.doc.length);e.length&&!1===e[0].filter&&(n=!1);for(var r=1;r<e.length;r++){!1===e[r].filter&&(n=!1);var s=!!e[r].sequential;i=Es(i,Bs(t,e[r],s?i.changes.newLength:t.doc.length),s)}var a=Ts.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(t){for(var e=t.startState,n=e.facet(Ss),i=t,r=n.length-1;r>=0;r--){var o=n[r](t);o&&Object.keys(o).length&&(i=Es(i,Bs(e,o,t.changes.newLength),!0))}return i==t?t:Ts.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(t){var e,n=t.startState,i=!0,r=(0,o.Z)(n.facet(bs));try{for(r.s();!(e=r.n()).done;){var s=(0,e.value)(t);if(!1===s){i=!1;break}Array.isArray(s)&&(i=!0===i?s:Ds(i,s))}}catch(d){r.e(d)}finally{r.f()}if(!0!==i){var a,h;if(!1===i)h=t.changes.invertedDesc,a=Jo.empty(n.doc.length);else{var u=t.changes.filter(i);a=u.changes,h=u.filtered.mapDesc(u.changes).invertedDesc}t=Ts.create(n,a,t.selection&&t.selection.map(h),Os.mapEffects(t.effects,h),t.annotations,t.scrollIntoView)}for(var l=n.facet(xs),c=l.length-1;c>=0;c--){var f=l[c](t);t=f instanceof Ts?f:Array.isArray(f)&&1==f.length&&f[0]instanceof Ts?f[0]:Rs(n,Ps(f),!1)}return t}(a):a)}Ts.time=Ms.define(),Ts.userEvent=Ms.define(),Ts.addToHistory=Ms.define(),Ts.remote=Ms.define();var Is=[];function Ps(t){return null==t?Is:Array.isArray(t)?t:[t]}var Ns,Ls=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Ls||(Ls={})),Vs=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{Ns=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(Fl){}function Hs(t){return function(e){if(!/\S/.test(e))return Ls.Space;if(function(t){if(Ns)return Ns.test(t);for(var e=0;e<t.length;e++){var n=t[e];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||Vs.test(n)))return!0}return!1}(e))return Ls.Word;for(var n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Ls.Word;return Ls.Other}}var Ws=function(){function t(e,n,r,o,s,a){(0,i.Z)(this,t),this.config=e,this.doc=n,this.selection=r,this.values=o,this.status=e.statusTemplate.slice(),this.computeSlot=s,a&&(a._state=this);for(var h=0;h<this.config.dynamicSlots.length;h++)ps(this,h<<1);this.computeSlot=null}return(0,r.Z)(t,[{key:"field",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.config.address[t.id];if(null!=n)return ps(this,n),ms(this,n);if(e)throw new RangeError("Field is not present in this state")}},{key:"update",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Rs(this,e,!0)}},{key:"applyTransaction",value:function(e){var n,i,r=this,s=this.config,a=s,h=a.base,u=a.compartments,l=(0,o.Z)(e.effects);try{for(l.s();!(n=l.n()).done;){var c=n.value;c.is(ds.reconfigure)?(s&&(u=new Map,s.compartments.forEach((function(t,e){return u.set(e,t)})),s=null),u.set(c.value.compartment,c.value.extension)):c.is(Os.reconfigure)?(s=null,h=c.value):c.is(Os.appendConfig)&&(s=null,h=Ps(h).concat(c.value))}}catch(f){l.e(f)}finally{l.f()}s?i=e.startState.values.slice():i=new t(s=gs.resolve(h,u,this),this.doc,this.selection,s.dynamicSlots.map((function(){return null})),(function(t,e){return e.reconfigure(t,r)}),null).values;new t(s,e.newDoc,e.newSelection,i,(function(t,n){return n.update(t,e)}),e)}},{key:"replaceSelection",value:function(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange((function(e){return{changes:{from:e.from,to:e.to,insert:t},range:es.cursor(e.from+t.length)}}))}},{key:"changeByRange",value:function(t){for(var e=this.selection,n=t(e.ranges[0]),i=this.changes(n.changes),r=[n.range],o=Ps(n.effects),s=1;s<e.ranges.length;s++){for(var a=t(e.ranges[s]),h=this.changes(a.changes),u=h.map(i),l=0;l<s;l++)r[l]=r[l].map(u);var c=i.mapDesc(h,!0);r.push(a.range.map(c)),i=i.compose(u),o=Os.mapEffects(o,u).concat(Os.mapEffects(Ps(a.effects),c))}return{changes:i,selection:es.create(r,e.mainIndex),effects:o}}},{key:"changes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e instanceof Jo?e:Jo.of(e,this.doc.length,this.facet(t.lineSeparator))}},{key:"toText",value:function(e){return So.of(e.split(this.facet(t.lineSeparator)||qo))}},{key:"sliceDoc",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.doc.length;return this.doc.sliceString(t,e,this.lineBreak)}},{key:"facet",value:function(t){var e=this.config.address[t.id];return null==e?t.default:(ps(this,e),ms(this,e))}},{key:"toJSON",value:function(t){var e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(var n in t){var i=t[n];i instanceof ls&&null!=this.config.address[i.id]&&(e[n]=i.spec.toJSON(this.field(t[n]),this))}return e}},{key:"tabSize",get:function(){return this.facet(t.tabSize)}},{key:"lineBreak",get:function(){return this.facet(t.lineSeparator)||"\n"}},{key:"readOnly",get:function(){return this.facet(As)}},{key:"phrase",value:function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];var s,a=(0,o.Z)(this.facet(t.phrases));try{for(a.s();!(s=a.n()).done;){var h=s.value;if(Object.prototype.hasOwnProperty.call(h,e)){e=h[e];break}}}catch(u){a.e(u)}finally{a.f()}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(function(t,e){if("$"==e)return"$";var n=+(e||1);return!n||n>i.length?t:i[n-1]}))),e}},{key:"languageDataAt",value:function(t,e){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=[],s=(0,o.Z)(this.facet(ys));try{for(s.s();!(n=s.n()).done;){var a,h=n.value,u=(0,o.Z)(h(this,e,i));try{for(u.s();!(a=u.n()).done;){var l=a.value;Object.prototype.hasOwnProperty.call(l,t)&&r.push(l[t])}}catch(c){u.e(c)}finally{u.f()}}}catch(c){s.e(c)}finally{s.f()}return r}},{key:"charCategorizer",value:function(t){return Hs(this.languageDataAt("wordChars",t).join(""))}},{key:"wordAt",value:function(t){for(var e=this.doc.lineAt(t),n=e.text,i=e.from,r=e.length,o=this.charCategorizer(t),s=t-i,a=t-i;s>0;){var h=Lo(n,s,!1);if(o(n.slice(h,s))!=Ls.Word)break;s=h}for(;a<r;){var u=Lo(n,a);if(o(n.slice(a,u))!=Ls.Word)break;a=u}return s==a?null:es.range(s+i,a+i)}}],[{key:"fromJSON",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");var r=[];if(i){var o=function(){if(Object.prototype.hasOwnProperty.call(e,s)){var t=i[s],n=e[s];r.push(t.init((function(e){return t.spec.fromJSON(n,e)})))}};for(var s in i)o()}return t.create({doc:e.doc,selection:es.fromJSON(e.selection),extensions:n.extensions?r.concat([n.extensions]):r})}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=gs.resolve(e.extensions||[],new Map),i=e.doc instanceof So?e.doc:So.of((e.doc||"").split(n.staticFacet(t.lineSeparator)||qo)),r=e.selection?e.selection instanceof es?e.selection:es.single(e.selection.anchor,e.selection.head):es.single(0);return ns(r,i.length),n.staticFacet(ks)||(r=r.asSingle()),new t(n,i,r,n.dynamicSlots.map((function(){return null})),(function(t,e){return e.create(t)}),null)}}]),t}();Ws.allowMultipleSelections=ks,Ws.tabSize=rs.define({combine:function(t){return t.length?t[0]:4}}),Ws.lineSeparator=ws,Ws.readOnly=As,Ws.phrases=rs.define({compare:function(t,e){var n=Object.keys(t),i=Object.keys(e);return n.length==i.length&&n.every((function(n){return t[n]==e[n]}))}}),Ws.languageData=ys,Ws.changeFilter=bs,Ws.transactionFilter=xs,Ws.transactionExtender=Ss,ds.reconfigure=Os.define();var _s=function(){function t(){(0,i.Z)(this,t)}return(0,r.Z)(t,[{key:"eq",value:function(t){return this==t}},{key:"range",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return zs.create(t,e,this)}}]),t}();_s.prototype.startSide=_s.prototype.endSide=0,_s.prototype.point=!1,_s.prototype.mapMode=jo.TrackDel;var zs=function(){function t(e,n,r){(0,i.Z)(this,t),this.from=e,this.to=n,this.value=r}return(0,r.Z)(t,null,[{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}();function Fs(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}var qs=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.from=e,this.to=n,this.value=r,this.maxPoint=o}return(0,r.Z)(t,[{key:"length",get:function(){return this.to[this.to.length-1]}},{key:"findIndex",value:function(t,e,n){for(var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=n?this.to:this.from,o=i,s=r.length;;){if(o==s)return o;var a=o+s>>1,h=r[a]-t||(n?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:s;h>=0?s=a:o=a+1}}},{key:"between",value:function(t,e,n,i){for(var r=this.findIndex(e,-1e9,!0),o=this.findIndex(n,1e9,!1,r);r<o;r++)if(!1===i(this.from[r]+t,this.to[r]+t,this.value[r]))return!1}},{key:"map",value:function(e,n){for(var i=[],r=[],o=[],s=-1,a=-1,h=0;h<this.value.length;h++){var u=this.value[h],l=this.from[h]+e,c=this.to[h]+e,f=void 0,d=void 0;if(l==c){var v=n.mapPos(l,u.startSide,u.mapMode);if(null==v)continue;if(f=d=v,u.startSide!=u.endSide&&(d=n.mapPos(l,u.endSide))<f)continue}else if((f=n.mapPos(l,u.startSide))>(d=n.mapPos(c,u.endSide))||f==d&&u.startSide>0&&u.endSide<=0)continue;(d-f||u.endSide-u.startSide)<0||(s<0&&(s=f),u.point&&(a=Math.max(a,d-f)),i.push(u),r.push(f-s),o.push(d-s))}return{mapped:i.length?new t(r,o,i,a):null,pos:s}}}]),t}(),js=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=o}return(0,r.Z)(t,[{key:"length",get:function(){var t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}},{key:"size",get:function(){if(this.isEmpty)return 0;var t,e=this.nextLayer.size,n=(0,o.Z)(this.chunk);try{for(n.s();!(t=n.n()).done;){e+=t.value.value.length}}catch(i){n.e(i)}finally{n.f()}return e}},{key:"chunkEnd",value:function(t){return this.chunkPos[t]+this.chunk[t].length}},{key:"update",value:function(e){var n=e.add,i=void 0===n?[]:n,r=e.sort,o=void 0!==r&&r,s=e.filterFrom,a=void 0===s?0:s,h=e.filterTo,u=void 0===h?this.length:h,l=e.filter;if(0==i.length&&!l)return this;if(o&&(i=i.slice().sort(Fs)),this.isEmpty)return i.length?t.of(i):this;for(var c=new Us(this,null,-1).goto(0),f=0,d=[],v=new Ks;c.value||f<i.length;)if(f<i.length&&(c.from-i[f].from||c.startSide-i[f].value.startSide)>=0){var g=i[f++];v.addInner(g.from,g.to,g.value)||d.push(g)}else 1==c.rangeIndex&&c.chunkIndex<this.chunk.length&&(f==i.length||this.chunkEnd(c.chunkIndex)<i[f].from)&&(!l||a>this.chunkEnd(c.chunkIndex)||u<this.chunkPos[c.chunkIndex])&&v.addChunk(this.chunkPos[c.chunkIndex],this.chunk[c.chunkIndex])?c.nextChunk():((!l||a>c.to||u<c.from||l(c.from,c.to,c.value))&&(v.addInner(c.from,c.to,c.value)||d.push(zs.create(c.from,c.to,c.value))),c.next());return v.finishInner(this.nextLayer.isEmpty&&!d.length?t.empty:this.nextLayer.update({add:d,filter:l,filterFrom:a,filterTo:u}))}},{key:"map",value:function(e){if(e.empty||this.isEmpty)return this;for(var n=[],i=[],r=-1,o=0;o<this.chunk.length;o++){var s=this.chunkPos[o],a=this.chunk[o],h=e.touchesRange(s,s+a.length);if(!1===h)r=Math.max(r,a.maxPoint),n.push(a),i.push(e.mapPos(s));else if(!0===h){var u=a.map(s,e),l=u.mapped,c=u.pos;l&&(r=Math.max(r,l.maxPoint),n.push(l),i.push(c))}}var f=this.nextLayer.map(e);return 0==n.length?f:new t(i,n,f||t.empty,r)}},{key:"between",value:function(t,e,n){if(!this.isEmpty){for(var i=0;i<this.chunk.length;i++){var r=this.chunkPos[i],o=this.chunk[i];if(e>=r&&t<=r+o.length&&!1===o.between(r,t-r,e-r,n))return}this.nextLayer.between(t,e,n)}}},{key:"iter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return Gs.from([this]).goto(t)}},{key:"isEmpty",get:function(){return this.nextLayer==this}}],[{key:"create",value:function(e,n,i,r){return new t(e,n,i,r)}},{key:"iter",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Gs.from(t).goto(e)}},{key:"compare",value:function(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=t.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r})),s=e.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r})),a=Js(o,s,n),h=new Xs(o,a,r),u=new Xs(s,a,r);n.iterGaps((function(t,e,n){return Ys(h,t,u,e,n,i)})),n.empty&&0==n.length&&Ys(h,0,u,0,0,i)}},{key:"eq",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0;null==i&&(i=999999999);var r=t.filter((function(t){return!t.isEmpty&&e.indexOf(t)<0})),o=e.filter((function(e){return!e.isEmpty&&t.indexOf(e)<0}));if(r.length!=o.length)return!1;if(!r.length)return!0;for(var s=Js(r,o),a=new Xs(r,s,0).goto(n),h=new Xs(o,s,0).goto(n);;){if(a.to!=h.to||!Qs(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>i)return!0;a.next(),h.next()}}},{key:"spans",value:function(t,e,n,i){for(var r=new Xs(t,null,arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1).goto(e),o=e,s=r.openStart;;){var a=Math.min(r.to,n);if(r.point){var h=r.activeForPoint(r.to),u=r.pointFrom<e?h.length+1:Math.min(h.length,s);i.point(o,a,r.point,h,u,r.pointRank),s=Math.min(r.openEnd(a),h.length)}else a>o&&(i.span(o,a,r.active,s),s=r.openEnd(a));if(r.to>n)return s+(r.point&&r.to>n?1:0);o=r.to,r.next()}}},{key:"of",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=new Ks,r=(0,o.Z)(t instanceof zs?[t]:n?function(t){if(t.length>1)for(var e=t[0],n=1;n<t.length;n++){var i=t[n];if(Fs(e,i)>0)return t.slice().sort(Fs);e=i}return t}(t):t);try{for(r.s();!(e=r.n()).done;){var s=e.value;i.add(s.from,s.to,s.value)}}catch(a){r.e(a)}finally{r.f()}return i.finish()}}]),t}();js.empty=new js([],[],null,-1),js.empty.nextLayer=js.empty;var Ks=function(){function t(){(0,i.Z)(this,t),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(0,r.Z)(t,[{key:"finishChunk",value:function(t){this.chunks.push(new qs(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(e,n,i){this.addInner(e,n,i)||(this.nextLayer||(this.nextLayer=new t)).add(e,n,i)}},{key:"addInner",value:function(t,e,n){var i=t-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(t-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<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=n,this.lastFrom=t,this.lastTo=e,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}},{key:"addChunk",value:function(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 n=e.value.length-1;return this.last=e.value[n],this.lastFrom=e.from[n]+t,this.lastTo=e.to[n]+t,!0}},{key:"finish",value:function(){return this.finishInner(js.empty)}},{key:"finishInner",value:function(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;var e=js.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}]),t}();function Js(t,e,n){var i,r=new Map,s=(0,o.Z)(t);try{for(s.s();!(i=s.n()).done;)for(var a=i.value,h=0;h<a.chunk.length;h++)a.chunk[h].maxPoint<=0&&r.set(a.chunk[h],a.chunkPos[h])}catch(g){s.e(g)}finally{s.f()}var u,l=new Set,c=(0,o.Z)(e);try{for(c.s();!(u=c.n()).done;)for(var f=u.value,d=0;d<f.chunk.length;d++){var v=r.get(f.chunk[d]);null==v||(n?n.mapPos(v):v)!=f.chunkPos[d]||(null==n?void 0:n.touchesRange(v,v+f.chunk[d].length))||l.add(f.chunk[d])}}catch(g){c.e(g)}finally{c.f()}return l}var Us=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;(0,i.Z)(this,t),this.layer=e,this.skip=n,this.minPoint=r,this.rank=o}return(0,r.Z)(t,[{key:"startSide",get:function(){return this.value?this.value.startSide:0}},{key:"endSide",get:function(){return this.value?this.value.endSide:0}},{key:"goto",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}},{key:"gotoInner",value:function(t,e,n){for(;this.chunkIndex<this.layer.chunk.length;){var i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<t||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){var r=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}},{key:"forward",value:function(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}},{key:"next",value:function(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}var t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],n=t+e.from[this.rangeIndex];if(this.from=n,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}},{key:"setRangeIndex",value:function(t){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(){this.chunkIndex++,this.rangeIndex=0,this.next()}},{key:"compare",value:function(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}]),t}(),Gs=function(){function t(e){(0,i.Z)(this,t),this.heap=e}return(0,r.Z)(t,[{key:"startSide",get:function(){return this.value?this.value.startSide:0}},{key:"goto",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9,i=(0,o.Z)(this.heap);try{for(i.s();!(e=i.n()).done;){e.value.goto(t,n)}}catch(s){i.e(s)}finally{i.f()}for(var r=this.heap.length>>1;r>=0;r--)$s(this.heap,r);return this.next(),this}},{key:"forward",value:function(t,e){var n,i=(0,o.Z)(this.heap);try{for(i.s();!(n=i.n()).done;){n.value.forward(t,e)}}catch(s){i.e(s)}finally{i.f()}for(var r=this.heap.length>>1;r>=0;r--)$s(this.heap,r);(this.to-t||this.value.endSide-e)<0&&this.next()}},{key:"next",value:function(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),$s(this.heap,0)}}}],[{key:"from",value:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=0;o<e.length;o++)for(var s=e[o];!s.isEmpty;s=s.nextLayer)s.maxPoint>=i&&r.push(new Us(s,n,i,o));return 1==r.length?r[0]:new t(r)}}]),t}();function $s(t,e){for(var n=t[e];;){var i=1+(e<<1);if(i>=t.length)break;var r=t[i];if(i+1<t.length&&r.compare(t[i+1])>=0&&(r=t[i+1],i++),n.compare(r)<0)break;t[i]=n,t[e]=r,e=i}}var Xs=function(){function t(e,n,r){(0,i.Z)(this,t),this.minPoint=r,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=Gs.from(e,n,r)}return(0,r.Z)(t,[{key:"goto",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?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(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(t){ta(this.active,t),ta(this.activeTo,t),ta(this.activeRank,t),this.minActive=na(this.active,this.activeTo)}},{key:"addActive",value:function(t){for(var e=0,n=this.cursor,i=n.value,r=n.to,o=n.rank;e<this.activeRank.length&&this.activeRank[e]<=o;)e++;ea(this.active,e,i),ea(this.activeTo,e,r),ea(this.activeRank,e,o),t&&ea(t,e,this.cursor.from),this.minActive=na(this.active,this.activeTo)}},{key:"next",value:function(){var t=this.to,e=this.point;this.point=null;for(var n=this.openStart<0?[]:null;;){var i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>t){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&ta(n,i)}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 r=this.cursor.value;if(r.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}if(n){this.openStart=0;for(var o=n.length-1;o>=0&&n[o]<t;o--)this.openStart++}}},{key:"activeForPoint",value:function(t){if(!this.active.length)return this.active;for(var e=[],n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>t||this.activeTo[n]==t&&this.active[n].endSide>=this.point.endSide)&&e.push(this.active[n]);return e.reverse()}},{key:"openEnd",value:function(t){for(var e=0,n=this.activeTo.length-1;n>=0&&this.activeTo[n]>t;n--)e++;return e}}]),t}();function Ys(t,e,n,i,r,o){t.goto(e),n.goto(i);for(var s=i+r,a=i,h=i-e;;){var u=t.to+h-n.to||t.endSide-n.endSide,l=u<0?t.to+h:n.to,c=Math.min(l,s);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&Qs(t.activeForPoint(t.to),n.activeForPoint(n.to))||o.comparePoint(a,c,t.point,n.point):c>a&&!Qs(t.active,n.active)&&o.compareRange(a,c,t.active,n.active),l>s)break;a=l,u<=0&&t.next(),u>=0&&n.next()}}function Qs(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].eq(e[n]))return!1;return!0}function ta(t,e){for(var n=e,i=t.length-1;n<i;n++)t[n]=t[n+1];t.pop()}function ea(t,e,n){for(var i=t.length-1;i>=e;i--)t[i+1]=t[i];t[e]=n}function na(t,e){for(var n=-1,i=1e9,r=0;r<e.length;r++)(e[r]-i||t[r].endSide-t[n].endSide)<0&&(n=r,i=e[r]);return n}n(10185),n(45882),n(37724);var ia=0,ra=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,i.Z)(this,t),this.id=ia++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return(0,r.Z)(t,[{key:"add",value:function(t){var e=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=sa.match(t)),function(n){var i=t(n);return void 0===i?null:[e,i]}}}]),t}();ra.closedBy=new ra({deserialize:function(t){return t.split(" ")}}),ra.openedBy=new ra({deserialize:function(t){return t.split(" ")}}),ra.group=new ra({deserialize:function(t){return t.split(" ")}}),ra.contextHash=new ra({perNode:!0}),ra.lookAhead=new ra({perNode:!0}),ra.mounted=new ra({perNode:!0});var oa=Object.create(null),sa=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;(0,i.Z)(this,t),this.name=e,this.props=n,this.id=r,this.flags=o}return(0,r.Z)(t,[{key:"prop",value:function(t){return this.props[t.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(t){if("string"==typeof t){if(this.name==t)return!0;var e=this.prop(ra.group);return!!e&&e.indexOf(t)>-1}return this.id==t}}],[{key:"define",value:function(e){var n=e.props&&e.props.length?Object.create(null):oa,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),r=new t(e.name||"",n,e.id,i);if(e.props){var s,a=(0,o.Z)(e.props);try{for(a.s();!(s=a.n()).done;){var h=s.value;if(Array.isArray(h)||(h=h(r)),h){if(h[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[h[0].id]=h[1]}}}catch(u){a.e(u)}finally{a.f()}}return r}},{key:"match",value:function(t){var e=Object.create(null);for(var n in t){var i,r=(0,o.Z)(n.split(" "));try{for(r.s();!(i=r.n()).done;){var s=i.value;e[s]=t[n]}}catch(a){r.e(a)}finally{r.f()}}return function(t){for(var n=t.prop(ra.group),i=-1;i<(n?n.length:0);i++){var r=e[i<0?t.name:n[i]];if(r)return r}}}}]),t}();sa.none=new sa("",Object.create(null),0,8);var aa,ha=new WeakMap,ua=new WeakMap;!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(aa||(aa={}));var la=function(){function t(e,n,r,s,h){if((0,i.Z)(this,t),this.type=e,this.children=n,this.positions=r,this.length=s,this.props=null,h&&h.length){this.props=Object.create(null);var u,l=(0,o.Z)(h);try{for(l.s();!(u=l.n()).done;){var c=(0,a.Z)(u.value,2),f=c[0],d=c[1];this.props["number"==typeof f?f:f.id]=d}}catch(v){l.e(v)}finally{l.f()}}}return(0,r.Z)(t,[{key:"toString",value:function(){var t=this.prop(ra.mounted);if(t&&!t.overlay)return t.tree.toString();var e,n="",i=(0,o.Z)(this.children);try{for(i.s();!(e=i.n()).done;){var r=e.value.toString();r&&(n&&(n+=","),n+=r)}}catch(s){i.e(s)}finally{i.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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new ba(this.topNode,t)}},{key:"cursorAt",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=ha.get(this)||this.topNode,i=new ba(n);return i.moveTo(t,e),ha.set(this,i._tree),i}},{key:"topNode",get:function(){return new pa(this,0,0,null)}},{key:"resolve",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=ga(ha.get(this)||this.topNode,t,e,!1);return ha.set(this,n),n}},{key:"resolveInner",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=ga(ua.get(this)||this.topNode,t,e,!0);return ua.set(this,n),n}},{key:"iterate",value:function(t){for(var e=t.enter,n=t.leave,i=t.from,r=void 0===i?0:i,o=t.to,s=void 0===o?this.length:o,a=t.mode||0,h=(a&aa.IncludeAnonymous)>0,u=this.cursor(a|aa.IncludeAnonymous);;){var l=!1;if(u.from<=s&&u.to>=r&&(!h&&u.type.isAnonymous||!1!==e(u))){if(u.firstChild())continue;l=!0}for(;l&&n&&(h||!u.type.isAnonymous)&&n(u),!u.nextSibling();){if(!u.parent())return;l=!0}}}},{key:"prop",value:function(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}},{key:"propValues",get:function(){var t=[];if(this.props)for(var e in this.props)t.push([+e,this.props[e]]);return t}},{key:"balance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.children.length<=8?this:Ma(sa.none,this.children,this.positions,0,this.children.length,0,this.length,(function(n,i,r){return new t(e.type,n,i,r,e.propValues)}),n.makeTree||function(e,n,i){return new t(sa.none,e,n,i)})}}],[{key:"build",value:function(t){return function(t){var e,n=t.buffer,i=t.nodeSet,r=t.maxBufferLength,o=void 0===r?1024:r,s=t.reused,a=void 0===s?[]:s,h=t.minRepeatType,u=void 0===h?i.types.length:h,l=Array.isArray(n)?new ca(n,n.length):n,c=i.types,f=0,d=0;function v(t,e,n,r,s){for(var h=l.id,w=l.start,b=l.end,x=l.size,S=d;x<0;){if(l.next(),-1==x){var A=a[h];return n.push(A),void r.push(w-t)}if(-3==x)return void(f=h);if(-4==x)return void(d=h);throw new RangeError("Unrecognized record size: ".concat(x))}var M,Z,C=c[h],O=w-t;if(b-w<=o&&(Z=y(l.pos-e,s))){for(var T=new Uint16Array(Z.size-Z.skip),D=l.pos-Z.size,E=T.length;l.pos>D;)E=k(Z.start,T,E);M=new fa(T,b-Z.start,i),O=Z.start-t}else{var B=l.pos-x;l.next();for(var R=[],I=[],P=h>=u?h:-1,N=0,L=b;l.pos>B;)P>=0&&l.id==P&&l.size>=0?(l.end<=L-o&&(p(R,I,w,N,l.end,L,P,S),N=R.length,L=l.end),l.next()):v(w,B,R,I,P);if(P>=0&&N>0&&N<R.length&&p(R,I,w,N,w,L,P,S),R.reverse(),I.reverse(),P>-1&&N>0){var V=g(C);M=Ma(C,R,I,0,R.length,0,b-w,V,V)}else M=m(C,R,I,b-w,S-b)}n.push(M),r.push(O)}function g(t){return function(e,n,i){var r,o,s=0,a=e.length-1;if(a>=0&&(r=e[a])instanceof la){if(!a&&r.type==t&&r.length==i)return r;(o=r.prop(ra.lookAhead))&&(s=n[a]+r.length+o)}return m(t,e,n,i,s)}}function p(t,e,n,r,o,s,a,h){for(var u=[],l=[];t.length>r;)u.push(t.pop()),l.push(e.pop()+n-o);t.push(m(i.types[a],u,l,s-o,h-s)),e.push(o-n)}function m(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0;if(f){var s=[ra.contextHash,f];o=o?[s].concat(o):[s]}if(r>25){var a=[ra.lookAhead,r];o=o?[a].concat(o):[a]}return new la(t,e,n,i,o)}function y(t,e){var n=l.fork(),i=0,r=0,s=0,a=n.end-o,h={size:0,start:0,skip:0};t:for(var c=n.pos-t;n.pos>c;){var f=n.size;if(n.id==e&&f>=0)h.size=i,h.start=r,h.skip=s,s+=4,i+=4,n.next();else{var d=n.pos-f;if(f<0||d<c||n.start<a)break;var v=n.id>=u?4:0,g=n.start;for(n.next();n.pos>d;){if(n.size<0){if(-3!=n.size)break t;v+=4}else n.id>=u&&(v+=4);n.next()}r=g,i+=f,s+=v}}return(e<0||i==t)&&(h.size=i,h.start=r,h.skip=s),h.size>4?h:void 0}function k(t,e,n){var i=l.id,r=l.start,o=l.end,s=l.size;if(l.next(),s>=0&&i<u){var a=n;if(s>4)for(var h=l.pos-(s-4);l.pos>h;)n=k(t,e,n);e[--n]=a,e[--n]=o-t,e[--n]=r-t,e[--n]=i}else-3==s?f=i:-4==s&&(d=i);return n}var w=[],b=[];for(;l.pos>0;)v(t.start||0,t.bufferStart||0,w,b,-1);var x=null!==(e=t.length)&&void 0!==e?e:w.length?b[0]+w[0].length:0;return new la(c[t.topID],w.reverse(),b.reverse(),x)}(t)}}]),t}();la.empty=new la(sa.none,[],[],0);var ca=function(){function t(e,n){(0,i.Z)(this,t),this.buffer=e,this.index=n}return(0,r.Z)(t,[{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 t(this.buffer,this.index)}}]),t}(),fa=function(){function t(e,n,r){(0,i.Z)(this,t),this.buffer=e,this.length=n,this.set=r}return(0,r.Z)(t,[{key:"type",get:function(){return sa.none}},{key:"toString",value:function(){for(var t=[],e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}},{key:"childString",value:function(t){var e=this.buffer[t],n=this.buffer[t+3],i=this.set.types[e],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),n==(t+=4))return r;for(var o=[];t<n;)o.push(this.childString(t)),t=this.buffer[t+3];return r+"("+o.join(",")+")"}},{key:"findChild",value:function(t,e,n,i,r){for(var o=this.buffer,s=-1,a=t;a!=e&&!(da(r,i,o[a+1],o[a+2])&&(s=a,n>0));a=o[a+3]);return s}},{key:"slice",value:function(e,n,i){for(var r=this.buffer,o=new Uint16Array(n-e),s=0,a=e,h=0;a<n;){o[h++]=r[a++],o[h++]=r[a++]-i;var u=o[h++]=r[a++]-i;o[h++]=r[a++]-e,s=Math.max(s,u)}return new t(o,s,this.set)}}]),t}();function da(t,e,n,i){switch(t){case-2:return n<e;case-1:return i>=e&&n<e;case 0:return n<e&&i>e;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function va(t,e){for(var n=t.childBefore(e);n;){var i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(t=n,n=i.prevSibling):n=i}return t}function ga(t,e,n,i){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){var o=!i&&t instanceof pa&&t.index<0?null:t.parent;if(!o)return t;t=o}var s=i?0:aa.IgnoreOverlays;if(i)for(var a=t,h=a.parent;h;h=(a=h).parent)a instanceof pa&&a.index<0&&(null===(r=h.enter(e,n,s))||void 0===r?void 0:r.from)!=a.from&&(t=h);for(;;){var u=t.enter(e,n,s);if(!u)return t;t=u}}var pa=function(){function t(e,n,r,o){(0,i.Z)(this,t),this._tree=e,this.from=n,this.index=r,this._parent=o}return(0,r.Z)(t,[{key:"type",get:function(){return this._tree.type}},{key:"name",get:function(){return this._tree.type.name}},{key:"to",get:function(){return this.from+this._tree.length}},{key:"nextChild",value:function(e,n,i,r){for(var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=this;;){for(var a=s._tree,h=a.children,u=a.positions,l=n>0?h.length:-1;e!=l;e+=n){var c=h[e],f=u[e]+s.from;if(da(r,i,f,f+c.length))if(c instanceof fa){if(o&aa.ExcludeBuffers)continue;var d=c.findChild(0,c.buffer.length,n,i-f,r);if(d>-1)return new wa(new ka(s,c,e,f),null,d)}else if(o&aa.IncludeAnonymous||!c.type.isAnonymous||xa(c)){var v=void 0;if(!(o&aa.IgnoreMounts)&&c.props&&(v=c.prop(ra.mounted))&&!v.overlay)return new t(v.tree,f,e,s);var g=new t(c,f,e,s);return o&aa.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?c.children.length-1:0,n,i,r)}}if(o&aa.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+n:n<0?-1:s._parent._tree.children.length,!(s=s._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(t){return this.nextChild(0,1,t,2)}},{key:"childBefore",value:function(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}},{key:"enter",value:function(e,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(r&aa.IgnoreOverlays)&&(i=this._tree.prop(ra.mounted))&&i.overlay){var s,a=e-this.from,h=(0,o.Z)(i.overlay);try{for(h.s();!(s=h.n()).done;){var u=s.value,l=u.from,c=u.to;if((n>0?l<=a:l<a)&&(n<0?c>=a:c>a))return new t(i.tree,i.overlay[0].from+this.from,-1,this)}}catch(f){h.e(f)}finally{h.f()}}return this.nextChild(0,1,e,n,r)}},{key:"nextSignificantParent",value:function(){for(var t=this;t.type.isAnonymous&&t._parent;)t=t._parent;return t}},{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 ba(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(t){return ga(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(t){return ga(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function(t){return va(this,t)}},{key:"getChild",value:function(t){var e=ma(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return e.length?e[0]:null}},{key:"getChildren",value:function(t){return ma(this,t,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(t){return ya(this,t)}}]),t}();function ma(t,e,n,i){var r=t.cursor(),o=[];if(!r.firstChild())return o;if(null!=n)for(;!r.type.is(n);)if(!r.nextSibling())return o;for(;;){if(null!=i&&r.type.is(i))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return null==i?o:[]}}function ya(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length-1,i=t.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}var ka=(0,r.Z)((function t(e,n,r,o){(0,i.Z)(this,t),this.parent=e,this.buffer=n,this.index=r,this.start=o})),wa=function(){function t(e,n,r){(0,i.Z)(this,t),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}return(0,r.Z)(t,[{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(e,n,i){var r=this.context.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],e,n-this.context.start,i);return o<0?null:new t(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(t){return this.child(1,t,2)}},{key:"childBefore",value:function(t){return this.child(-1,t,-2)}},{key:"enter",value:function(e,n){if((arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)&aa.ExcludeBuffers)return null;var i=this.context.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return r<0?null:new t(this.context,this,r)}},{key:"parent",get:function(){return this._parent||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}},{key:"nextSibling",get:function(){var e=this.context.buffer,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new t(this.context,this._parent,n):this.externalSibling(1)}},{key:"prevSibling",get:function(){var e=this.context.buffer,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new t(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}},{key:"cursor",value:function(){return new ba(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function(){return null}},{key:"toTree",value:function(){var t=[],e=[],n=this.context.buffer,i=this.index+4,r=n.buffer[this.index+3];if(r>i){var o=n.buffer[this.index+1];t.push(n.slice(i,r,o)),e.push(0)}return new la(this.type,t,e,this.to-this.from)}},{key:"resolve",value:function(t){return ga(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(t){return ga(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function(t){return va(this,t)}},{key:"toString",value:function(){return this.context.buffer.childString(this.index)}},{key:"getChild",value:function(t){var e=ma(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return e.length?e[0]:null}},{key:"getChildren",value:function(t){return ma(this,t,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(t){return ya(this,t)}}]),t}(),ba=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if((0,i.Z)(this,t),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof pa)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(var r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}return(0,r.Z)(t,[{key:"name",get:function(){return this.type.name}},{key:"yieldNode",value:function(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}},{key:"yieldBuf",value:function(t,e){this.index=t;var n=this.buffer,i=n.start,r=n.buffer;return this.type=e||r.set.types[r.buffer[t]],this.from=i+r.buffer[t+1],this.to=i+r.buffer[t+2],!0}},{key:"yield",value:function(t){return!!t&&(t instanceof pa?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}},{key:"toString",value:function(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}},{key:"enterChild",value:function(t,e,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,n,this.mode));var i=this.buffer.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.buffer.start,n);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}},{key:"firstChild",value:function(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function(t){return this.enterChild(1,t,2)}},{key:"childBefore",value:function(t){return this.enterChild(-1,t,-2)}},{key:"enter",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(n&aa.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,n))}},{key:"parent",value:function(){if(!this.buffer)return this.yieldNode(this.mode&aa.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&aa.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}},{key:"sibling",value:function(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,n=this.stack.length-1;if(t<0){var i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(e.findChild(i,this.index,-1,0,4))}else{var r=e.buffer[this.index+3];if(r<(n<0?e.buffer.length:e.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}},{key:"nextSibling",value:function(){return this.sibling(1)}},{key:"prevSibling",value:function(){return this.sibling(-1)}},{key:"atLastNode",value:function(t){var e,n,i=this.buffer;if(i){if(t>0){if(this.index<i.buffer.buffer.length)return!1}else for(var r=0;r<this.index;r++)if(i.buffer.buffer[r+3]<this.index)return!1;e=i.index,n=i.parent}else{var o=this._tree;e=o.index,n=o._parent}for(;n;e=(s=n).index,n=s._parent,s){var s;if(e>-1)for(var a=e+t,h=t<0?-1:n._tree.children.length;a!=h;a+=t){var u=n._tree.children[a];if(this.mode&aa.IncludeAnonymous||u instanceof fa||!u.type.isAnonymous||xa(u))return!1}}return!0}},{key:"move",value:function(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(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(1,t)}},{key:"prev",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(-1,t)}},{key:"moveTo",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(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(){if(!this.buffer)return this._tree;var t=this.bufferNode,e=null,n=0;if(t&&t.context==this.buffer)t:for(var i=this.index,r=this.stack.length;r>=0;){for(var o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;e=o,n=r+1;break t}i=this.stack[--r]}for(var s=n;s<this.stack.length;s++)e=new wa(this.buffer,e,this.stack[s]);return this.bufferNode=new wa(this.buffer,e,this.index)}},{key:"tree",get:function(){return this.buffer?null:this._tree._tree}},{key:"iterate",value:function(t,e){for(var n=0;;){var i=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;i&&e&&e(this),i=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,i=!0}}}},{key:"matchContext",value:function(t){if(!this.buffer)return ya(this.node,t);for(var e=this.buffer.buffer,n=e.set.types,i=t.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return ya(this.node,t,i);var o=n[e.buffer[this.stack[r]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}}]),t}();function xa(t){return t.children.some((function(t){return t instanceof fa||!t.type.isAnonymous||xa(t)}))}var Sa=new WeakMap;function Aa(t,e){if(!t.isAnonymous||e instanceof fa||e.type!=t)return 1;var n=Sa.get(e);if(null==n){n=1;var i,r=(0,o.Z)(e.children);try{for(r.s();!(i=r.n()).done;){var s=i.value;if(s.type!=t||!(s instanceof la)){n=1;break}n+=Aa(t,s)}}catch(a){r.e(a)}finally{r.f()}Sa.set(e,n)}return n}function Ma(t,e,n,i,r,o,s,a,h){for(var u=0,l=i;l<r;l++)u+=Aa(t,e[l]);var c=Math.ceil(1.5*u/8),f=[],d=[];return function e(n,i,r,s,a){for(var u=r;u<s;){var l=u,v=i[u],g=Aa(t,n[u]);for(u++;u<s;u++){var p=Aa(t,n[u]);if(g+p>=c)break;g+=p}if(u==l+1){if(g>c){var m=n[l];e(m.children,m.positions,0,m.children.length,i[l]+a);continue}f.push(n[l])}else{var y=i[u-1]+n[u-1].length-v;f.push(Ma(t,n,i,l,u,v,y,null,h))}d.push(v+a-o)}}(e,n,i,r,0),(a||h)(f,d,s)}new ra({perNode:!0});var Za=0,Ca=function(){function t(e,n,r){(0,i.Z)(this,t),this.set=e,this.base=n,this.modified=r,this.id=Za++}return(0,r.Z)(t,null,[{key:"define",value:function(e){if(null==e?void 0:e.base)throw new Error("Can not derive from a modified tag");var n=new t([],null,[]);if(n.set.push(n),e){var i,r=(0,o.Z)(e.set);try{for(r.s();!(i=r.n()).done;){var s=i.value;n.set.push(s)}}catch(a){r.e(a)}finally{r.f()}}return n}},{key:"defineModifier",value:function(){var t=new Ta;return function(e){return e.modified.indexOf(t)>-1?e:Ta.get(e.base||e,e.modified.concat(t).sort((function(t,e){return t.id-e.id})))}}}]),t}(),Oa=0,Ta=function(){function t(){(0,i.Z)(this,t),this.instances=[],this.id=Oa++}return(0,r.Z)(t,null,[{key:"get",value:function(e,n){if(!n.length)return e;var i=n[0].instances.find((function(t){return t.base==e&&(i=n,r=t.modified,i.length==r.length&&i.every((function(t,e){return t==r[e]})));var i,r}));if(i)return i;var r,s=[],a=new Ca(s,e,n),h=(0,o.Z)(n);try{for(h.s();!(r=h.n()).done;){r.value.instances.push(a)}}catch(p){h.e(p)}finally{h.f()}var u,l=function(t){for(var e=[[]],n=0;n<t.length;n++)for(var i=0,r=e.length;i<r;i++)e.push(e[i].concat(t[n]));return e.sort((function(t,e){return e.length-t.length}))}(n),c=(0,o.Z)(e.set);try{for(c.s();!(u=c.n()).done;){var f=u.value;if(!f.modified.length){var d,v=(0,o.Z)(l);try{for(v.s();!(d=v.n()).done;){var g=d.value;s.push(t.get(f,g))}}catch(p){v.e(p)}finally{v.f()}}}}catch(p){c.e(p)}finally{c.f()}return a}}]),t}();function Da(t){var e=Object.create(null);for(var n in t){var i=t[n];Array.isArray(i)||(i=[i]);var r,s=(0,o.Z)(n.split(" "));try{for(s.s();!(r=s.n()).done;){var a=r.value;if(a){for(var h=[],u=2,l=a,c=0;;){if("..."==l&&c>0&&c+3==a.length){u=1;break}var f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+a);if(h.push("*"==f[0]?"":'"'==f[0][0]?JSON.parse(f[0]):f[0]),(c+=f[0].length)==a.length)break;var d=a[c++];if(c==a.length&&"!"==d){u=0;break}if("/"!=d)throw new RangeError("Invalid path: "+a);l=a.slice(c)}var v=h.length-1,g=h[v];if(!g)throw new RangeError("Invalid path: "+a);var p=new Ba(i,u,v>0?h.slice(0,v):null);e[g]=p.sort(e[g])}}}catch(m){s.e(m)}finally{s.f()}}return Ea.add(e)}var Ea=new ra,Ba=function(){function t(e,n,r,o){(0,i.Z)(this,t),this.tags=e,this.mode=n,this.context=r,this.next=o}return(0,r.Z)(t,[{key:"opaque",get:function(){return 0==this.mode}},{key:"inherit",get:function(){return 1==this.mode}},{key:"sort",value:function(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}},{key:"depth",get:function(){return this.context?this.context.length:0}}]),t}();function Ra(t,e){var n,i=Object.create(null),r=(0,o.Z)(t);try{for(r.s();!(n=r.n()).done;){var s=n.value;if(Array.isArray(s.tag)){var a,h=(0,o.Z)(s.tag);try{for(h.s();!(a=h.n()).done;){var u=a.value;i[u.id]=s.class}}catch(v){h.e(v)}finally{h.f()}}else i[s.tag.id]=s.class}}catch(v){r.e(v)}finally{r.f()}var l=e||{},c=l.scope,f=l.all,d=void 0===f?null:f;return{style:function(t){var e,n=d,r=(0,o.Z)(t);try{for(r.s();!(e=r.n()).done;){var s,a=e.value,h=(0,o.Z)(a.set);try{for(h.s();!(s=h.n()).done;){var u=s.value,l=i[u.id];if(l){n=n?n+" "+l:l;break}}}catch(v){h.e(v)}finally{h.f()}}}catch(v){r.e(v)}finally{r.f()}return n},scope:c}}Ba.empty=new Ba([],2,null);var Ia,Pa=Ca.define,Na=Pa(),La=Pa(),Va=Pa(La),Ha=Pa(La),Wa=Pa(),_a=Pa(Wa),za=Pa(Wa),Fa=Pa(),qa=Pa(Fa),ja=Pa(),Ka=Pa(),Ja=Pa(),Ua=Pa(Ja),Ga=Pa(),$a={comment:Na,lineComment:Pa(Na),blockComment:Pa(Na),docComment:Pa(Na),name:La,variableName:Pa(La),typeName:Va,tagName:Pa(Va),propertyName:Ha,attributeName:Pa(Ha),className:Pa(La),labelName:Pa(La),namespace:Pa(La),macroName:Pa(La),literal:Wa,string:_a,docString:Pa(_a),character:Pa(_a),attributeValue:Pa(_a),number:za,integer:Pa(za),float:Pa(za),bool:Pa(Wa),regexp:Pa(Wa),escape:Pa(Wa),color:Pa(Wa),url:Pa(Wa),keyword:ja,self:Pa(ja),null:Pa(ja),atom:Pa(ja),unit:Pa(ja),modifier:Pa(ja),operatorKeyword:Pa(ja),controlKeyword:Pa(ja),definitionKeyword:Pa(ja),moduleKeyword:Pa(ja),operator:Ka,derefOperator:Pa(Ka),arithmeticOperator:Pa(Ka),logicOperator:Pa(Ka),bitwiseOperator:Pa(Ka),compareOperator:Pa(Ka),updateOperator:Pa(Ka),definitionOperator:Pa(Ka),typeOperator:Pa(Ka),controlOperator:Pa(Ka),punctuation:Ja,separator:Pa(Ja),bracket:Ua,angleBracket:Pa(Ua),squareBracket:Pa(Ua),paren:Pa(Ua),brace:Pa(Ua),content:Fa,heading:qa,heading1:Pa(qa),heading2:Pa(qa),heading3:Pa(qa),heading4:Pa(qa),heading5:Pa(qa),heading6:Pa(qa),contentSeparator:Pa(Fa),list:Pa(Fa),quote:Pa(Fa),emphasis:Pa(Fa),strong:Pa(Fa),link:Pa(Fa),monospace:Pa(Fa),strikethrough:Pa(Fa),inserted:Pa(),deleted:Pa(),changed:Pa(),invalid:Pa(),meta:Ga,documentMeta:Pa(Ga),annotation:Pa(Ga),processingInstruction:Pa(Ga),definition:Ca.defineModifier(),constant:Ca.defineModifier(),function:Ca.defineModifier(),standard:Ca.defineModifier(),local:Ca.defineModifier(),special:Ca.defineModifier()},Xa=(Ra([{tag:$a.link,class:"tok-link"},{tag:$a.heading,class:"tok-heading"},{tag:$a.emphasis,class:"tok-emphasis"},{tag:$a.strong,class:"tok-strong"},{tag:$a.keyword,class:"tok-keyword"},{tag:$a.atom,class:"tok-atom"},{tag:$a.bool,class:"tok-bool"},{tag:$a.url,class:"tok-url"},{tag:$a.labelName,class:"tok-labelName"},{tag:$a.inserted,class:"tok-inserted"},{tag:$a.deleted,class:"tok-deleted"},{tag:$a.literal,class:"tok-literal"},{tag:$a.string,class:"tok-string"},{tag:$a.number,class:"tok-number"},{tag:[$a.regexp,$a.escape,$a.special($a.string)],class:"tok-string2"},{tag:$a.variableName,class:"tok-variableName"},{tag:$a.local($a.variableName),class:"tok-variableName tok-local"},{tag:$a.definition($a.variableName),class:"tok-variableName tok-definition"},{tag:$a.special($a.variableName),class:"tok-variableName2"},{tag:$a.definition($a.propertyName),class:"tok-propertyName tok-definition"},{tag:$a.typeName,class:"tok-typeName"},{tag:$a.namespace,class:"tok-namespace"},{tag:$a.className,class:"tok-className"},{tag:$a.macroName,class:"tok-macroName"},{tag:$a.propertyName,class:"tok-propertyName"},{tag:$a.operator,class:"tok-operator"},{tag:$a.comment,class:"tok-comment"},{tag:$a.meta,class:"tok-meta"},{tag:$a.invalid,class:"tok-invalid"},{tag:$a.punctuation,class:"tok-punctuation"}]),new Xr);var Ya=new Xr,Qa=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";(0,i.Z)(this,t),this.data=e,this.name=s,Ws.prototype.hasOwnProperty("tree")||Object.defineProperty(Ws.prototype,"tree",{get:function(){return eh(this)}}),this.parser=n,this.extension=[lh.of(this),Ws.languageData.of((function(t,e,n){var i=th(t,e,n),r=i.type.prop(Xa);if(!r)return[];var s=t.facet(r),a=i.type.prop(Ya);if(a){var h,u=i.resolve(e-i.from,n),l=(0,o.Z)(a);try{for(l.s();!(h=l.n()).done;){var c=h.value;if(c.test(u,t)){var f=t.facet(c.facet);return"replace"==c.type?f:f.concat(s)}}}catch(d){l.e(d)}finally{l.f()}}return s}))].concat(r)}return(0,r.Z)(t,[{key:"isActiveAt",value:function(t,e){return th(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1).type.prop(Xa)==this.data}},{key:"findRegions",value:function(t){var e=this,n=t.facet(lh);if((null==n?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];var i=[];return function t(n,r){if(n.prop(Xa)!=e.data){var s=n.prop(Xr.mounted);if(s){if(s.tree.prop(Xa)==e.data){if(s.overlay){var a,h=(0,o.Z)(s.overlay);try{for(h.s();!(a=h.n()).done;){var u=a.value;i.push({from:u.from+r,to:u.to+r})}}catch(d){h.e(d)}finally{h.f()}}else i.push({from:r,to:r+n.length});return}if(s.overlay){var l=i.length;if(t(s.tree,s.overlay[0].from+r),i.length>l)return}}for(var c=0;c<n.children.length;c++){var f=n.children[c];f instanceof io&&t(f,n.positions[c]+r)}}else i.push({from:r,to:r+n.length})}(eh(t),0),i}},{key:"allowsNesting",get:function(){return!0}}]),t}();function th(t,e,n){var i=t.facet(lh),r=eh(t).topNode;if(!i||i.allowsNesting)for(var o=r;o;o=o.enter(e,n,to.ExcludeBuffers))o.type.isTop&&(r=o);return r}Qa.setState=Os.define();function eh(t){var e=t.field(Qa.state,!1);return e?e.tree:io.empty}var nh=function(){function t(e){(0,i.Z)(this,t),this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}return(0,r.Z)(t,[{key:"length",get:function(){return this.doc.length}},{key:"syncTo",value:function(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(t){return this.syncTo(t),this.string}},{key:"lineChunks",get:function(){return!0}},{key:"read",value:function(t,e){var n=this.cursorPos-this.string.length;return t<n||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-n,e-n)}}]),t}(),ih=null,rh=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,h=arguments.length>6?arguments[6]:void 0,u=arguments.length>7?arguments[7]:void 0;(0,i.Z)(this,t),this.parser=e,this.state=n,this.fragments=r,this.tree=o,this.treeLen=s,this.viewport=a,this.skipped=h,this.scheduleOn=u,this.parse=null,this.tempSkipped=[]}return(0,r.Z)(t,[{key:"startParse",value:function(){return this.parser.startParse(new nh(this.state.doc),this.fragments)}},{key:"work",value:function(t,e){var n=this;return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=io.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext((function(){var i;if("number"==typeof t){var r=Date.now()+t;t=function(){return Date.now()>r}}for(n.parse||(n.parse=n.startParse()),null!=e&&(null==n.parse.stoppedAt||n.parse.stoppedAt>e)&&e<n.state.doc.length&&n.parse.stopAt(e);;){var o=n.parse.advance();if(o){if(n.fragments=n.withoutTempSkipped(wo.addTree(o,n.fragments,null!=n.parse.stoppedAt)),n.treeLen=null!==(i=n.parse.stoppedAt)&&void 0!==i?i:n.state.doc.length,n.tree=o,n.parse=null,!(n.treeLen<(null!=e?e:n.state.doc.length)))return!0;n.parse=n.startParse()}if(t())return!1}}))}},{key:"takeTree",value:function(){var t,e,n=this;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=n.parse.advance()););})),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(wo.addTree(this.tree,this.fragments,!0)),this.parse=null)}},{key:"withContext",value:function(t){var e=ih;ih=this;try{return t()}finally{ih=e}}},{key:"withoutTempSkipped",value:function(t){for(var e;e=this.tempSkipped.pop();)t=oh(t,e.from,e.to);return t}},{key:"changes",value:function(e,n){var i=this.fragments,r=this.tree,s=this.treeLen,a=this.viewport,h=this.skipped;if(this.takeTree(),!e.empty){var u=[];if(e.iterChangedRanges((function(t,e,n,i){return u.push({fromA:t,toA:e,fromB:n,toB:i})})),i=wo.applyChanges(i,u),r=io.empty,s=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){h=[];var l,c=(0,o.Z)(this.skipped);try{for(c.s();!(l=c.n()).done;){var f=l.value,d=e.mapPos(f.from,1),v=e.mapPos(f.to,-1);d<v&&h.push({from:d,to:v})}}catch(g){c.e(g)}finally{c.f()}}}return new t(this.parser,n,i,r,s,a,h,this.scheduleOn)}},{key:"updateViewport",value:function(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;for(var e=this.skipped.length,n=0;n<this.skipped.length;n++){var i=this.skipped[n],r=i.from,o=i.to;r<t.to&&o>t.from&&(this.fragments=oh(this.fragments,r,o),this.skipped.splice(n--,1))}return!(this.skipped.length>=e)&&(this.reset(),!0)}},{key:"reset",value:function(){this.parse&&(this.takeTree(),this.parse=null)}},{key:"skipUntilInView",value:function(t,e){this.skipped.push({from:t,to:e})}},{key:"isDone",value:function(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(e,n,i){return new t(e,n,[],io.empty,0,i,[],null)}},{key:"getSkippingParser",value:function(t){return new(function(e){function n(){return(0,i.Z)(this,n),(0,c.Z)(this,n,arguments)}return(0,f.Z)(n,e),(0,r.Z)(n,[{key:"createParse",value:function(e,n,i){var r=i[0].from,s=i[i.length-1].to,a={parsedPos:r,advance:function(){var e=ih;if(e){var n,a=(0,o.Z)(i);try{for(a.s();!(n=a.n()).done;){var h=n.value;e.tempSkipped.push(h)}}catch(u){a.e(u)}finally{a.f()}t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=s,new io(Qr.none,[],[],s-r)},stoppedAt:null,stopAt:function(){}};return a}}]),n}(bo))}},{key:"get",value:function(){return ih}}]),t}();function oh(t,e,n){return wo.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}var sh=function(){function t(e){(0,i.Z)(this,t),this.context=e,this.tree=e.tree}return(0,r.Z)(t,[{key:"apply",value:function(e){if(!e.docChanged&&this.tree==this.context.tree)return this;var n=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,i)||n.takeTree(),new t(n)}}],[{key:"init",value:function(e){var n=Math.min(3e3,e.doc.length),i=rh.create(e.facet(lh).parser,e,{from:0,to:n});return i.work(20,n)||i.takeTree(),new t(i)}}]),t}();Qa.state=ls.define({create:sh.init,update:function(t,e){var n,i=(0,o.Z)(e.effects);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(r.is(Qa.setState))return r.value}}catch(s){i.e(s)}finally{i.f()}return e.startState.facet(lh)!=e.state.facet(lh)?sh.init(e.state):t.apply(e)}});var ah=function(t){var e=setTimeout((function(){return t()}),500);return function(){return clearTimeout(e)}};"undefined"!=typeof requestIdleCallback&&(ah=function(t){var e=-1,n=setTimeout((function(){e=requestIdleCallback(t,{timeout:400})}),100);return function(){return e<0?clearTimeout(n):cancelIdleCallback(e)}});var hh="undefined"!=typeof navigator&&(null===(Ia=navigator.scheduling)||void 0===Ia?void 0:Ia.isInputPending)?function(){return navigator.scheduling.isInputPending()}:null,uh=Cn.fromClass(function(){function t(e){(0,i.Z)(this,t),this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}return(0,r.Z)(t,[{key:"update",value:function(t){var e=this.view.state.field(Qa.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),t.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}},{key:"scheduleWork",value:function(){if(!this.working){var t=this.view.state,e=t.field(Qa.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=ah(this.work))}}},{key:"work",value:function(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)){var n=this.view,i=n.state,r=n.viewport.to,o=i.field(Qa.state);if(o.tree!=o.context.tree||!o.context.isDone(r+1e5)){var s=Date.now()+Math.min(this.chunkBudget,100,t&&!hh?Math.max(25,t.timeRemaining()-5):1e9),a=o.context.treeLen<r&&i.doc.length>r+1e3,h=o.context.work((function(){return hh&&hh()||Date.now()>s}),r+(a?0:1e5));this.chunkBudget-=Date.now()-e,(h||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Qa.setState.of(new sh(o.context))})),this.chunkBudget>0&&(!h||a)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}}}},{key:"checkAsyncSchedule",value:function(t){var e=this;t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((function(){return e.scheduleWork()})).catch((function(t){return Sn(e.view.state,t)})).then((function(){return e.workScheduled--})),t.scheduleOn=null)}},{key:"destroy",value:function(){this.working&&this.working()}},{key:"isWorking",value:function(){return!!(this.working||this.workScheduled>0)}}]),t}(),{eventHandlers:{focus:function(){this.scheduleWork()}}}),lh=rs.define({combine:function(t){return t.length?t[0]:null},enables:function(t){return[Qa.state,uh,Wr.contentAttributes.compute([t],(function(e){var n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}}))]}}),ch=rs.define(),fh=rs.define({combine:function(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}});function dh(t){var e=t.facet(fh);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function vh(t,e){var n="",i=t.tabSize,r=t.facet(fh)[0];if("\t"==r){for(;e>=i;)n+="\t",e-=i;r=" "}for(var o=0;o<e;o++)n+=r;return n}function gh(t,e){t instanceof Ws&&(t=new ph(t));var n,i=(0,o.Z)(t.state.facet(ch));try{for(i.s();!(n=i.n()).done;){var r=(0,n.value)(t,e);if(void 0!==r)return r}}catch(a){i.e(a)}finally{i.f()}var s=eh(t.state);return s?function(t,e,n){return kh(e.resolveInner(n).enterUnfinishedNodesBefore(n),n,t)}(t,s,e):null}var ph=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,i.Z)(this,t),this.state=e,this.options=n,this.unit=dh(e)}return(0,r.Z)(t,[{key:"lineAt",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.state.doc.lineAt(t),i=this.options,r=i.simulateBreak,o=i.simulateDoubleBreak;return null!=r&&r>=n.from&&r<=n.to?o&&r==t?{text:"",from:t}:(e<0?r<t:r<=t)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}},{key:"textAfterPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";var n=this.lineAt(t,e),i=n.text,r=n.from;return i.slice(t-r,Math.min(i.length,t+100-r))}},{key:"column",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.lineAt(t,e),i=n.text,r=n.from,o=this.countColumn(i,t-r),s=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return s>-1&&(o+=s-this.countColumn(i,i.search(/\S|$/))),o}},{key:"countColumn",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length;return function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=0,r=0;r<n;)9==t.charCodeAt(r)?(i+=e-i%e,r++):(i++,r=Lo(t,r));return i}(t,this.state.tabSize,e)}},{key:"lineIndent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.lineAt(t,e),i=n.text,r=n.from,o=this.options.overrideIndentation;if(o){var s=o(r);if(s>-1)return s}return this.countColumn(i,i.search(/\S|$/))}},{key:"simulatedBreak",get:function(){return this.options.simulateBreak||null}}]),t}(),mh=new Xr;function yh(t){var e=t.type.prop(mh);if(e)return e;var n,i=t.firstChild;if(i&&(n=i.type.prop(Xr.closedBy))){var r=t.lastChild,o=r&&n.indexOf(r.name)>-1;return function(t){return Sh(t,!0,1,void 0,o&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?r.from:void 0)}}return null==t.parent?wh:null}function kh(t,e,n){for(;t;t=t.parent){var i=yh(t);if(i)return i(bh.create(n,e,t))}return null}function wh(){return 0}var bh=function(t){function e(t,n,r){var o;return(0,i.Z)(this,e),(o=(0,c.Z)(this,e,[t.state,t.options])).base=t,o.pos=n,o.node=r,o}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"textAfter",get:function(){return this.textAfterPos(this.pos)}},{key:"baseIndent",get:function(){return this.baseIndentFor(this.node)}},{key:"baseIndentFor",value:function(t){for(var e=this.state.doc.lineAt(t.from);;){for(var n=t.resolve(e.from);n.parent&&n.parent.from==n.from;)n=n.parent;if(xh(n,t))break;e=this.state.doc.lineAt(n.from)}return this.lineIndent(e.from)}},{key:"continue",value:function(){var t=this.node.parent;return t?kh(t,this.pos,this.base):0}}],[{key:"create",value:function(t,n,i){return new e(t,n,i)}}]),e}(ph);function xh(t,e){for(var n=e;n;n=n.parent)if(t==n)return!0;return!1}function Sh(t,e,n,i,r){var o=t.textAfter,s=o.match(/^\s*/)[0].length,a=i&&o.slice(s,s+i.length)==i||r==t.pos+s,h=e?function(t){var e=t.node,n=e.childAfter(e.from),i=e.lastChild;if(!n)return null;for(var r=t.options.simulateBreak,o=t.state.doc.lineAt(n.from),s=null==r||r<=o.from?o.to:Math.min(o.to,r),a=n.to;;){var h=e.childAfter(a);if(!h||h==i)return null;if(!h.type.isSkipped)return h.from<s?n:null;a=h.to}}(t):null;return h?a?t.column(h.from):t.column(h.to):t.baseIndent+(a?0:t.unit*n)}var Ah=function(){function t(e,n){var r;function o(t){var e=Qt.V.newName();return(r||(r=Object.create(null)))["."+e]=t,e}(0,i.Z)(this,t),this.specs=e;var s="string"==typeof n.all?n.all:n.all?o(n.all):void 0,a=n.scope;this.scope=a instanceof Qa?function(t){return t.prop(Xa)==a.data}:a?function(t){return t==a}:void 0,this.style=Ra(e.map((function(t){return{tag:t.tag,class:t.class||o(Object.assign({},t,{tag:null}))}})),{all:s}).style,this.module=r?new Qt.V(r):null,this.themeType=n.themeType}return(0,r.Z)(t,null,[{key:"define",value:function(e,n){return new t(e,n||{})}}]),t}();$a.meta,$a.link,$a.heading,$a.emphasis,$a.strong,$a.strikethrough,$a.keyword,$a.atom,$a.bool,$a.url,$a.contentSeparator,$a.labelName,$a.literal,$a.inserted,$a.string,$a.deleted,$a.regexp,$a.escape,$a.string,$a.variableName,$a.variableName,$a.typeName,$a.namespace,$a.className,$a.variableName,$a.macroName,$a.propertyName,$a.comment,$a.invalid;var Mh=1e4,Zh="()[]{}";var Ch=new Xr;function Oh(t,e,n){var i=t.prop(e<0?Xr.openedBy:Xr.closedBy);if(i)return i;if(1==t.name.length){var r=n.indexOf(t.name);if(r>-1&&r%2==(e<0?1:0))return[n[r+e]]}return null}function Th(t){var e=t.type.prop(Ch);return e?e(t.node):t}function Dh(t,e,n){for(var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i.maxScanDistance||Mh,o=i.brackets||Zh,s=eh(t),a=s.resolveInner(e,n),h=a;h;h=h.parent){var u=Oh(h.type,n,o);if(u&&h.from<h.to){var l=Th(h);if(l&&(n>0?e>=l.from&&e<l.to:e>l.from&&e<=l.to))return Eh(t,e,n,h,l,u,o)}}return function(t,e,n,i,r,o,s){var a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),h=s.indexOf(a);if(h<0||h%2==0!=n>0)return null;for(var u={from:n<0?e-1:e,to:n>0?e+1:e},l=t.doc.iterRange(e,n>0?t.doc.length:0),c=0,f=0;!l.next().done&&f<=o;){var d=l.value;n<0&&(f+=d.length);for(var v=e+f*n,g=n>0?0:d.length-1,p=n>0?d.length:-1;g!=p;g+=n){var m=s.indexOf(d[g]);if(!(m<0||i.resolveInner(v+g,1).type!=r))if(m%2==0==n>0)c++;else{if(1==c)return{start:u,end:{from:v+g,to:v+g+1},matched:m>>1==h>>1};c--}}n>0&&(f+=d.length)}return l.done?{start:u,matched:!1}:null}(t,e,n,s,a.type,r,o)}function Eh(t,e,n,i,r,o,s){var a=i.parent,h={from:r.from,to:r.to},u=0,l=null==a?void 0:a.cursor();if(l&&(n<0?l.childBefore(i.from):l.childAfter(i.to)))do{if(n<0?l.to<=i.from:l.from>=i.to){if(0==u&&o.indexOf(l.type.name)>-1&&l.from<l.to){var c=Th(l);return{start:h,end:c?{from:c.from,to:c.to}:void 0,matched:!0}}if(Oh(l.type,n,s))u++;else if(Oh(l.type,-n,s)){if(0==u){var f=Th(l);return{start:h,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}u--}}}while(n<0?l.prevSibling():l.nextSibling());return{start:h,matched:!1}}for(var Bh=Object.create(null),Rh=[Qr.none],Ih=[],Ph=Object.create(null),Nh=0,Lh=[["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"]];Nh<Lh.length;Nh++){var Vh=(0,a.Z)(Lh[Nh],2),Hh=Vh[0],Wh=Vh[1];Ph[Hh]=zh(Bh,Wh)}function _h(t,e){Ih.indexOf(t)>-1||(Ih.push(t),console.warn(e))}function zh(t,e){var n,i=null,r=(0,o.Z)(e.split("."));try{for(r.s();!(n=r.n()).done;){var s=n.value,a=t[s]||$a[s];a?"function"==typeof a?i?i=a(i):_h(s,"Modifier ".concat(s," used at start of tag")):i?_h(s,"Tag ".concat(s," used as modifier")):i=a:_h(s,"Unknown highlighting tag ".concat(s))}}catch(l){r.e(l)}finally{r.f()}if(!i)return 0;var h=e.replace(/ /g,"_"),u=Qr.define({id:Rh.length,name:h,props:[Da((0,Ur.Z)({},h,i))]});return Rh.push(u),u.id}var Fh=0,qh=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,i.Z)(this,t),this.id=Fh++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return(0,r.Z)(t,[{key:"add",value:function(t){var e=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=Jh.match(t)),function(n){var i=t(n);return void 0===i?null:[e,i]}}}]),t}();qh.closedBy=new qh({deserialize:function(t){return t.split(" ")}}),qh.openedBy=new qh({deserialize:function(t){return t.split(" ")}}),qh.group=new qh({deserialize:function(t){return t.split(" ")}}),qh.isolate=new qh({deserialize:function(t){if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),qh.contextHash=new qh({perNode:!0}),qh.lookAhead=new qh({perNode:!0}),qh.mounted=new qh({perNode:!0});var jh=function(){function t(e,n,r){(0,i.Z)(this,t),this.tree=e,this.overlay=n,this.parser=r}return(0,r.Z)(t,null,[{key:"get",value:function(t){return t&&t.props&&t.props[qh.mounted.id]}}]),t}(),Kh=Object.create(null),Jh=function(){function t(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;(0,i.Z)(this,t),this.name=e,this.props=n,this.id=r,this.flags=o}return(0,r.Z)(t,[{key:"prop",value:function(t){return this.props[t.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(t){if("string"==typeof t){if(this.name==t)return!0;var e=this.prop(qh.group);return!!e&&e.indexOf(t)>-1}return this.id==t}}],[{key:"define",value:function(e){var n=e.props&&e.props.length?Object.create(null):Kh,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),r=new t(e.name||"",n,e.id,i);if(e.props){var s,a=(0,o.Z)(e.props);try{for(a.s();!(s=a.n()).done;){var h=s.value;if(Array.isArray(h)||(h=h(r)),h){if(h[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[h[0].id]=h[1]}}}catch(u){a.e(u)}finally{a.f()}}return r}},{key:"match",value:function(t){var e=Object.create(null);for(var n in t){var i,r=(0,o.Z)(n.split(" "));try{for(r.s();!(i=r.n()).done;){var s=i.value;e[s]=t[n]}}catch(a){r.e(a)}finally{r.f()}}return function(t){for(var n=t.prop(qh.group),i=-1;i<(n?n.length:0);i++){var r=e[i<0?t.name:n[i]];if(r)return r}}}}]),t}();Jh.none=new Jh("",Object.create(null),0,8);var Uh,Gh=new WeakMap,$h=new WeakMap;!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(Uh||(Uh={}));var Xh=function(){function t(e,n,r,s,h){if((0,i.Z)(this,t),this.type=e,this.children=n,this.positions=r,this.length=s,this.props=null,h&&h.length){this.props=Object.create(null);var u,l=(0,o.Z)(h);try{for(l.s();!(u=l.n()).done;){var c=(0,a.Z)(u.value,2),f=c[0],d=c[1];this.props["number"==typeof f?f:f.id]=d}}catch(v){l.e(v)}finally{l.f()}}}return(0,r.Z)(t,[{key:"toString",value:function(){var t=jh.get(this);if(t&&!t.overlay)return t.tree.toString();var e,n="",i=(0,o.Z)(this.children);try{for(i.s();!(e=i.n()).done;){var r=e.value.toString();r&&(n&&(n+=","),n+=r)}}catch(s){i.e(s)}finally{i.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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new lu(this.topNode,t)}},{key:"cursorAt",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Gh.get(this)||this.topNode,i=new lu(n);return i.moveTo(t,e),Gh.set(this,i._tree),i}},{key:"topNode",get:function(){return new iu(this,0,0,null)}},{key:"resolve",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=eu(Gh.get(this)||this.topNode,t,e,!1);return Gh.set(this,n),n}},{key:"resolveInner",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=eu($h.get(this)||this.topNode,t,e,!0);return $h.set(this,n),n}},{key:"resolveStack",value:function(t){return function(t,e,n){for(var i=t.resolveInner(e,n),r=null,o=i instanceof iu?i:i.context.parent;o;o=o.parent)if(o.index<0){var s=o.parent;(r||(r=[i])).push(s.resolve(e,n)),o=s}else{var a=jh.get(o.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){var h=new iu(a.tree,a.overlay[0].from+o.from,-1,o);(r||(r=[i])).push(eu(h,e,n,!1))}}return r?hu(r):i}(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}},{key:"iterate",value:function(t){for(var e=t.enter,n=t.leave,i=t.from,r=void 0===i?0:i,o=t.to,s=void 0===o?this.length:o,a=t.mode||0,h=(a&Uh.IncludeAnonymous)>0,u=this.cursor(a|Uh.IncludeAnonymous);;){var l=!1;if(u.from<=s&&u.to>=r&&(!h&&u.type.isAnonymous||!1!==e(u))){if(u.firstChild())continue;l=!0}for(;l&&n&&(h||!u.type.isAnonymous)&&n(u),!u.nextSibling();){if(!u.parent())return;l=!0}}}},{key:"prop",value:function(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}},{key:"propValues",get:function(){var t=[];if(this.props)for(var e in this.props)t.push([+e,this.props[e]]);return t}},{key:"balance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.children.length<=8?this:vu(Jh.none,this.children,this.positions,0,this.children.length,0,this.length,(function(n,i,r){return new t(e.type,n,i,r,e.propValues)}),n.makeTree||function(e,n,i){return new t(Jh.none,e,n,i)})}}],[{key:"build",value:function(t){return function(t){var e,n=t.buffer,i=t.nodeSet,r=t.maxBufferLength,o=void 0===r?1024:r,s=t.reused,a=void 0===s?[]:s,h=t.minRepeatType,u=void 0===h?i.types.length:h,l=Array.isArray(n)?new Yh(n,n.length):n,c=i.types,f=0,d=0;function v(t,e,n,r,s,h){for(var b=l.id,x=l.start,S=l.end,A=l.size,M=d;A<0;){if(l.next(),-1==A){var Z=a[b];return n.push(Z),void r.push(x-t)}if(-3==A)return void(f=b);if(-4==A)return void(d=b);throw new RangeError("Unrecognized record size: ".concat(A))}var C,O,T=c[b],D=x-t;if(S-x<=o&&(O=k(l.pos-e,s))){for(var E=new Uint16Array(O.size-O.skip),B=l.pos-O.size,R=E.length;l.pos>B;)R=w(O.start,E,R);C=new Qh(E,S-O.start,i),D=O.start-t}else{var I=l.pos-A;l.next();for(var P=[],N=[],L=b>=u?b:-1,V=0,H=S;l.pos>I;)L>=0&&l.id==L&&l.size>=0?(l.end<=H-o&&(m(P,N,x,V,l.end,H,L,M),V=P.length,H=l.end),l.next()):h>2500?g(x,I,P,N):v(x,I,P,N,L,h+1);if(L>=0&&V>0&&V<P.length&&m(P,N,x,V,x,H,L,M),P.reverse(),N.reverse(),L>-1&&V>0){var W=p(T);C=vu(T,P,N,0,P.length,0,S-x,W,W)}else C=y(T,P,N,S-x,M-S)}n.push(C),r.push(D)}function g(t,e,n,r){for(var s=[],a=0,h=-1;l.pos>e;){var u=l.id,c=l.start,f=l.end;if(l.size>4)l.next();else{if(h>-1&&c<h)break;h<0&&(h=f-o),s.push(u,c,f),a++,l.next()}}if(a){for(var d=new Uint16Array(4*a),v=s[s.length-2],g=s.length-3,p=0;g>=0;g-=3)d[p++]=s[g],d[p++]=s[g+1]-v,d[p++]=s[g+2]-v,d[p++]=p;n.push(new Qh(d,s[2]-v,i)),r.push(v-t)}}function p(t){return function(e,n,i){var r,o,s=0,a=e.length-1;if(a>=0&&(r=e[a])instanceof Xh){if(!a&&r.type==t&&r.length==i)return r;(o=r.prop(qh.lookAhead))&&(s=n[a]+r.length+o)}return y(t,e,n,i,s)}}function m(t,e,n,r,o,s,a,h){for(var u=[],l=[];t.length>r;)u.push(t.pop()),l.push(e.pop()+n-o);t.push(y(i.types[a],u,l,s-o,h-s)),e.push(o-n)}function y(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0;if(f){var s=[qh.contextHash,f];o=o?[s].concat(o):[s]}if(r>25){var a=[qh.lookAhead,r];o=o?[a].concat(o):[a]}return new Xh(t,e,n,i,o)}function k(t,e){var n=l.fork(),i=0,r=0,s=0,a=n.end-o,h={size:0,start:0,skip:0};t:for(var c=n.pos-t;n.pos>c;){var f=n.size;if(n.id==e&&f>=0)h.size=i,h.start=r,h.skip=s,s+=4,i+=4,n.next();else{var d=n.pos-f;if(f<0||d<c||n.start<a)break;var v=n.id>=u?4:0,g=n.start;for(n.next();n.pos>d;){if(n.size<0){if(-3!=n.size)break t;v+=4}else n.id>=u&&(v+=4);n.next()}r=g,i+=f,s+=v}}return(e<0||i==t)&&(h.size=i,h.start=r,h.skip=s),h.size>4?h:void 0}function w(t,e,n){var i=l.id,r=l.start,o=l.end,s=l.size;if(l.next(),s>=0&&i<u){var a=n;if(s>4)for(var h=l.pos-(s-4);l.pos>h;)n=w(t,e,n);e[--n]=a,e[--n]=o-t,e[--n]=r-t,e[--n]=i}else-3==s?f=i:-4==s&&(d=i);return n}var b=[],x=[];for(;l.pos>0;)v(t.start||0,t.bufferStart||0,b,x,-1,0);var S=null!==(e=t.length)&&void 0!==e?e:b.length?x[0]+b[0].length:0;return new Xh(c[t.topID],b.reverse(),x.reverse(),S)}(t)}}]),t}();Xh.empty=new Xh(Jh.none,[],[],0);var Yh=function(){function t(e,n){(0,i.Z)(this,t),this.buffer=e,this.index=n}return(0,r.Z)(t,[{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 t(this.buffer,this.index)}}]),t}(),Qh=function(){function t(e,n,r){(0,i.Z)(this,t),this.buffer=e,this.length=n,this.set=r}return(0,r.Z)(t,[{key:"type",get:function(){return Jh.none}},{key:"toString",value:function(){for(var t=[],e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}},{key:"childString",value:function(t){var e=this.buffer[t],n=this.buffer[t+3],i=this.set.types[e],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),n==(t+=4))return r;for(var o=[];t<n;)o.push(this.childString(t)),t=this.buffer[t+3];return r+"("+o.join(",")+")"}},{key:"findChild",value:function(t,e,n,i,r){for(var o=this.buffer,s=-1,a=t;a!=e&&!(tu(r,i,o[a+1],o[a+2])&&(s=a,n>0));a=o[a+3]);return s}},{key:"slice",value:function(e,n,i){for(var r=this.buffer,o=new Uint16Array(n-e),s=0,a=e,h=0;a<n;){o[h++]=r[a++],o[h++]=r[a++]-i;var u=o[h++]=r[a++]-i;o[h++]=r[a++]-e,s=Math.max(s,u)}return new t(o,s,this.set)}}]),t}();function tu(t,e,n,i){switch(t){case-2:return n<e;case-1:return i>=e&&n<e;case 0:return n<e&&i>e;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function eu(t,e,n,i){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){var o=!i&&t instanceof iu&&t.index<0?null:t.parent;if(!o)return t;t=o}var s=i?0:Uh.IgnoreOverlays;if(i)for(var a=t,h=a.parent;h;h=(a=h).parent)a instanceof iu&&a.index<0&&(null===(r=h.enter(e,n,s))||void 0===r?void 0:r.from)!=a.from&&(t=h);for(;;){var u=t.enter(e,n,s);if(!u)return t;t=u}}var nu=function(){function t(){(0,i.Z)(this,t)}return(0,r.Z)(t,[{key:"cursor",value:function(){return new lu(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"getChild",value:function(t){var e=ru(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return e.length?e[0]:null}},{key:"getChildren",value:function(t){return ru(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}},{key:"resolve",value:function(t){return eu(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(t){return eu(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"matchContext",value:function(t){return ou(this,t)}},{key:"enterUnfinishedNodesBefore",value:function(t){for(var e=this.childBefore(t),n=this;e;){var i=e.lastChild;if(!i||i.to!=e.to)break;i.type.isError&&i.from==i.to?(n=e,e=i.prevSibling):e=i}return n}},{key:"node",get:function(){return this}},{key:"next",get:function(){return this.parent}}]),t}(),iu=function(t){function e(t,n,r,o){var s;return(0,i.Z)(this,e),(s=(0,c.Z)(this,e))._tree=t,s.from=n,s.index=r,s._parent=o,s}return(0,f.Z)(e,t),(0,r.Z)(e,[{key:"type",get:function(){return this._tree.type}},{key:"name",get:function(){return this._tree.type.name}},{key:"to",get:function(){return this.from+this._tree.length}},{key:"nextChild",value:function(t,n,i,r){for(var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=this;;){for(var a=s._tree,h=a.children,u=a.positions,l=n>0?h.length:-1;t!=l;t+=n){var c=h[t],f=u[t]+s.from;if(tu(r,i,f,f+c.length))if(c instanceof Qh){if(o&Uh.ExcludeBuffers)continue;var d=c.findChild(0,c.buffer.length,n,i-f,r);if(d>-1)return new au(new su(s,c,t,f),null,d)}else if(o&Uh.IncludeAnonymous||!c.type.isAnonymous||cu(c)){var v=void 0;if(!(o&Uh.IgnoreMounts)&&(v=jh.get(c))&&!v.overlay)return new e(v.tree,f,t,s);var g=new e(c,f,t,s);return o&Uh.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?c.children.length-1:0,n,i,r)}}if(o&Uh.IncludeAnonymous||!s.type.isAnonymous)return null;if(t=s.index>=0?s.index+n:n<0?-1:s._parent._tree.children.length,!(s=s._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(t){return this.nextChild(0,1,t,2)}},{key:"childBefore",value:function(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}},{key:"enter",value:function(t,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(r&Uh.IgnoreOverlays)&&(i=jh.get(this._tree))&&i.overlay){var s,a=t-this.from,h=(0,o.Z)(i.overlay);try{for(h.s();!(s=h.n()).done;){var u=s.value,l=u.from,c=u.to;if((n>0?l<=a:l<a)&&(n<0?c>=a:c>a))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}}catch(f){h.e(f)}finally{h.f()}}return this.nextChild(0,1,t,n,r)}},{key:"nextSignificantParent",value:function(){for(var t=this;t.type.isAnonymous&&t._parent;)t=t._parent;return t}},{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:"tree",get:function(){return this._tree}},{key:"toTree",value:function(){return this._tree}},{key:"toString",value:function(){return this._tree.toString()}}]),e}(nu);function ru(t,e,n,i){var r=t.cursor(),o=[];if(!r.firstChild())return o;if(null!=n)for(;!r.type.is(n);)if(!r.nextSibling())return o;for(;;){if(null!=i&&r.type.is(i))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return null==i?o:[]}}function ou(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length-1,i=t.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}var su=(0,r.Z)((function t(e,n,r,o){(0,i.Z)(this,t),this.parent=e,this.buffer=n,this.index=r,this.start=o})),au=function(t){function e(t,n,r){var o;return(0,i.Z)(this,e),(o=(0,c.Z)(this,e)).context=t,o._parent=n,o.index=r,o.type=t.buffer.set.types[t.buffer.buffer[r]],o}return(0,f.Z)(e,t),(0,r.Z)(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,i){var r=this.context.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.context.start,i);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(t){return this.child(1,t,2)}},{key:"childBefore",value:function(t){return this.child(-1,t,-2)}},{key:"enter",value:function(t,n){if((arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)&Uh.ExcludeBuffers)return null;var i=this.context.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return r<0?null:new e(this.context,this,r)}},{key:"parent",get:function(){return this._parent||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,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:"tree",get:function(){return null}},{key:"toTree",value:function(){var t=[],e=[],n=this.context.buffer,i=this.index+4,r=n.buffer[this.index+3];if(r>i){var o=n.buffer[this.index+1];t.push(n.slice(i,r,o)),e.push(0)}return new Xh(this.type,t,e,this.to-this.from)}},{key:"toString",value:function(){return this.context.buffer.childString(this.index)}}]),e}(nu);function hu(t){if(!t.length)return null;for(var e=0,n=t[0],i=1;i<t.length;i++){var r=t[i];(r.from>n.from||r.to<n.to)&&(n=r,e=i)}var o=n instanceof iu&&n.index<0?null:n.parent,s=t.slice();return o?s[e]=o:s.splice(e,1),new uu(s,n)}var uu=function(){function t(e,n){(0,i.Z)(this,t),this.heads=e,this.node=n}return(0,r.Z)(t,[{key:"next",get:function(){return hu(this.heads)}}]),t}();var lu=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if((0,i.Z)(this,t),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof iu)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(var r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}return(0,r.Z)(t,[{key:"name",get:function(){return this.type.name}},{key:"yieldNode",value:function(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}},{key:"yieldBuf",value:function(t,e){this.index=t;var n=this.buffer,i=n.start,r=n.buffer;return this.type=e||r.set.types[r.buffer[t]],this.from=i+r.buffer[t+1],this.to=i+r.buffer[t+2],!0}},{key:"yield",value:function(t){return!!t&&(t instanceof iu?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}},{key:"toString",value:function(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}},{key:"enterChild",value:function(t,e,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,n,this.mode));var i=this.buffer.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.buffer.start,n);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}},{key:"firstChild",value:function(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function(t){return this.enterChild(1,t,2)}},{key:"childBefore",value:function(t){return this.enterChild(-1,t,-2)}},{key:"enter",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(n&Uh.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,n))}},{key:"parent",value:function(){if(!this.buffer)return this.yieldNode(this.mode&Uh.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&Uh.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}},{key:"sibling",value:function(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,n=this.stack.length-1;if(t<0){var i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(e.findChild(i,this.index,-1,0,4))}else{var r=e.buffer[this.index+3];if(r<(n<0?e.buffer.length:e.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}},{key:"nextSibling",value:function(){return this.sibling(1)}},{key:"prevSibling",value:function(){return this.sibling(-1)}},{key:"atLastNode",value:function(t){var e,n,i=this.buffer;if(i){if(t>0){if(this.index<i.buffer.buffer.length)return!1}else for(var r=0;r<this.index;r++)if(i.buffer.buffer[r+3]<this.index)return!1;e=i.index,n=i.parent}else{var o=this._tree;e=o.index,n=o._parent}for(;n;e=(s=n).index,n=s._parent,s){var s;if(e>-1)for(var a=e+t,h=t<0?-1:n._tree.children.length;a!=h;a+=t){var u=n._tree.children[a];if(this.mode&Uh.IncludeAnonymous||u instanceof Qh||!u.type.isAnonymous||cu(u))return!1}}return!0}},{key:"move",value:function(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(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(1,t)}},{key:"prev",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(-1,t)}},{key:"moveTo",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(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(){if(!this.buffer)return this._tree;var t=this.bufferNode,e=null,n=0;if(t&&t.context==this.buffer)t:for(var i=this.index,r=this.stack.length;r>=0;){for(var o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;e=o,n=r+1;break t}i=this.stack[--r]}for(var s=n;s<this.stack.length;s++)e=new au(this.buffer,e,this.stack[s]);return this.bufferNode=new au(this.buffer,e,this.index)}},{key:"tree",get:function(){return this.buffer?null:this._tree._tree}},{key:"iterate",value:function(t,e){for(var n=0;;){var i=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;i&&e&&e(this),i=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,i=!0}}}},{key:"matchContext",value:function(t){if(!this.buffer)return ou(this.node,t);for(var e=this.buffer.buffer,n=e.set.types,i=t.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return ou(this.node,t,i);var o=n[e.buffer[this.stack[r]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}}]),t}();function cu(t){return t.children.some((function(t){return t instanceof Qh||!t.type.isAnonymous||cu(t)}))}var fu=new WeakMap;function du(t,e){if(!t.isAnonymous||e instanceof Qh||e.type!=t)return 1;var n=fu.get(e);if(null==n){n=1;var i,r=(0,o.Z)(e.children);try{for(r.s();!(i=r.n()).done;){var s=i.value;if(s.type!=t||!(s instanceof Xh)){n=1;break}n+=du(t,s)}}catch(a){r.e(a)}finally{r.f()}fu.set(e,n)}return n}function vu(t,e,n,i,r,o,s,a,h){for(var u=0,l=i;l<r;l++)u+=du(t,e[l]);var c=Math.ceil(1.5*u/8),f=[],d=[];return function e(n,i,r,s,a){for(var u=r;u<s;){var l=u,v=i[u],g=du(t,n[u]);for(u++;u<s;u++){var p=du(t,n[u]);if(g+p>=c)break;g+=p}if(u==l+1){if(g>c){var m=n[l];e(m.children,m.positions,0,m.children.length,i[l]+a);continue}f.push(n[l])}else{var y=i[u-1]+n[u-1].length-v;f.push(vu(t,n,i,l,u,v,y,null,h))}d.push(v+a-o)}}(e,n,i,r,0),(a||h)(f,d,s)}new qh({perNode:!0});function gu(t,e){return function(n){var i=n.state,r=n.dispatch;if(i.readOnly)return!1;var o=t(e,i);return!!o&&(r(i.update(o)),!0)}}var pu=gu(xu,0),mu=gu(bu,0),yu=gu((function(t,e){return bu(t,e,function(t){var e,n=[],i=(0,o.Z)(t.selection.ranges);try{for(i.s();!(e=i.n()).done;){var r=e.value,s=t.doc.lineAt(r.from),a=r.to<=s.to?s:t.doc.lineAt(r.to),h=n.length-1;h>=0&&n[h].to>s.from?n[h].to=a.to:n.push({from:s.from+/^\s*/.exec(s.text)[0].length,to:a.to})}}catch(u){i.e(u)}finally{i.f()}return n}(e))}),0);function ku(t,e){var n=t.languageDataAt("commentTokens",e);return n.length?n[0]:{}}var wu=50;function bu(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.selection.ranges,i=n.map((function(t){return ku(e,t.from).block}));if(!i.every((function(t){return t})))return null;var r=n.map((function(t,n){return function(t,e,n,i){var r,o,s=e.open,a=e.close,h=t.sliceDoc(n-wu,n),u=t.sliceDoc(i,i+wu),l=/\s*$/.exec(h)[0].length,c=/^\s*/.exec(u)[0].length,f=h.length-l;if(h.slice(f-s.length,f)==s&&u.slice(c,c+a.length)==a)return{open:{pos:n-l,margin:l&&1},close:{pos:i+c,margin:c&&1}};i-n<=2*wu?r=o=t.sliceDoc(n,i):(r=t.sliceDoc(n,n+wu),o=t.sliceDoc(i-wu,i));var d=/^\s*/.exec(r)[0].length,v=/\s*$/.exec(o)[0].length,g=o.length-v-a.length;return r.slice(d,d+s.length)==s&&o.slice(g,g+a.length)==a?{open:{pos:n+d+s.length,margin:/\s/.test(r.charAt(d+s.length))?1:0},close:{pos:i-v-a.length,margin:/\s/.test(o.charAt(g-1))?1:0}}:null}(e,i[n],t.from,t.to)}));if(2!=t&&!r.every((function(t){return t})))return{changes:e.changes(n.map((function(t,e){return r[e]?[]:[{from:t.from,insert:i[e].open+" "},{from:t.to,insert:" "+i[e].close}]})))};if(1!=t&&r.some((function(t){return t}))){for(var o,s=[],a=0;a<r.length;a++)if(o=r[a]){var h=i[a],u=o,l=u.open,c=u.close;s.push({from:l.pos-h.open.length,to:l.pos+l.margin},{from:c.pos-c.margin,to:c.pos+h.close.length})}return{changes:s}}return null}function xu(t,e){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.selection.ranges,r=[],s=-1,a=(0,o.Z)(i);try{for(a.s();!(n=a.n()).done;){var h=n.value,u=h.from,l=h.to,c=r.length,f=1e9,d=ku(e,u).line;if(d){for(var v=u;v<=l;){var g=e.doc.lineAt(v);if(g.from>s&&(u==l||l>g.from)){s=g.from;var p=/^\s*/.exec(g.text)[0].length,m=p==g.length,y=g.text.slice(p,p+d.length)==d?p:-1;p<g.text.length&&p<f&&(f=p),r.push({line:g,comment:y,token:d,indent:p,empty:m,single:!1})}v=g.to+1}if(f<1e9)for(var k=c;k<r.length;k++)r[k].indent<r[k].line.text.length&&(r[k].indent=f);r.length==c+1&&(r[c].single=!0)}}}catch(V){a.e(V)}finally{a.f()}if(2!=t&&r.some((function(t){return t.comment<0&&(!t.empty||t.single)}))){var w,b=[],x=(0,o.Z)(r);try{for(x.s();!(w=x.n()).done;){var S=w.value,A=S.line,M=S.token,Z=S.indent,C=S.empty;!S.single&&C||b.push({from:A.from+Z,insert:M+" "})}}catch(V){x.e(V)}finally{x.f()}var O=e.changes(b);return{changes:O,selection:e.selection.map(O,1)}}if(1!=t&&r.some((function(t){return t.comment>=0}))){var T,D=[],E=(0,o.Z)(r);try{for(E.s();!(T=E.n()).done;){var B=T.value,R=B.line,I=B.comment,P=B.token;if(I>=0){var N=R.from+I,L=N+P.length;" "==R.text[L-R.from]&&L++,D.push({from:N,to:L})}}}catch(V){E.e(V)}finally{E.f()}return{changes:D}}return null}var Su=s.q6.define(),Au=s.q6.define(),Mu=s.r$.define(),Zu=s.r$.define({combine:function(t){return(0,s.BO)(t,{minDepth:100,newGroupDelay:500,joinToEvent:function(t,e){return e}},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:function(t,e){return function(n,i){return t(n,i)||e(n,i)}}})}}),Cu=s.QQ.define({create:function(){return qu.empty},update:function(t,e){var n=e.state.facet(Zu),i=e.annotation(Su);if(i){var r=Iu.fromTransaction(e,i.selection),o=i.side,a=0==o?t.undone:t.done;return a=r?Pu(a,a.length,n.minDepth,r):Hu(a,e.startState.selection),new qu(0==o?i.rest:a,0==o?a:i.rest)}var h=e.annotation(Au);if("full"!=h&&"before"!=h||(t=t.isolate()),!1===e.annotation(s.YW.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);var u=Iu.fromTransaction(e),l=e.annotation(s.YW.time),c=e.annotation(s.YW.userEvent);return u?t=t.addChanges(u,l,c,n,e):e.selection&&(t=t.addSelection(e.startState.selection,l,c,n.newGroupDelay)),"full"!=h&&"after"!=h||(t=t.isolate()),t},toJSON:function(t){return{done:t.done.map((function(t){return t.toJSON()})),undone:t.undone.map((function(t){return t.toJSON()}))}},fromJSON:function(t){return new qu(t.done.map(Iu.fromJSON),t.undone.map(Iu.fromJSON))}});function Ou(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Cu,Zu.of(t),Wr.domEventHandlers({beforeinput:function(t,e){var n="historyUndo"==t.inputType?Du:"historyRedo"==t.inputType?Eu:null;return!!n&&(t.preventDefault(),n(e))}})]}function Tu(t,e){return function(n){var i=n.state,r=n.dispatch;if(!e&&i.readOnly)return!1;var o=i.field(Cu,!1);if(!o)return!1;var s=o.pop(t,i,e);return!!s&&(r(s),!0)}}var Du=Tu(0,!1),Eu=Tu(1,!1),Bu=Tu(0,!0),Ru=Tu(1,!0);var Iu=function(){function t(e,n,r,o,s){(0,i.Z)(this,t),this.changes=e,this.effects=n,this.mapped=r,this.startSelection=o,this.selectionsAfter=s}return(0,r.Z)(t,[{key:"setSelAfter",value:function(e){return new t(this.changes,this.effects,this.mapped,this.startSelection,e)}},{key:"toJSON",value:function(){var t,e,n;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===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((function(t){return t.toJSON()}))}}}],[{key:"fromJSON",value:function(e){return new t(e.changes&&s.as.fromJSON(e.changes),[],e.mapped&&s.n0.fromJSON(e.mapped),e.startSelection&&s.jT.fromJSON(e.startSelection),e.selectionsAfter.map(s.jT.fromJSON))}},{key:"fromTransaction",value:function(e,n){var i,r=Lu,s=(0,o.Z)(e.startState.facet(Mu));try{for(s.s();!(i=s.n()).done;){var a=(0,i.value)(e);a.length&&(r=r.concat(a))}}catch(h){s.e(h)}finally{s.f()}return!r.length&&e.changes.empty?null:new t(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Lu)}},{key:"selection",value:function(e){return new t(void 0,Lu,void 0,void 0,e)}}]),t}();function Pu(t,e,n,i){var r=e+1>n+20?e-n-1:0,o=t.slice(r,e);return o.push(i),o}function Nu(t,e){return t.length?e.length?t.concat(e):t:e}var Lu=[],Vu=200;function Hu(t,e){if(t.length){var n=t[t.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Vu));return i.length&&i[i.length-1].eq(e)?t:(i.push(e),Pu(t,t.length-1,1e9,n.setSelAfter(i)))}return[Iu.selection([e])]}function Wu(t){var e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function _u(t,e){if(!t.length)return t;for(var n=t.length,i=Lu;n;){var r=zu(t[n-1],e,i);if(r.changes&&!r.changes.empty||r.effects.length){var o=t.slice(0,n);return o[n-1]=r,o}e=r.mapped,n--,i=r.selectionsAfter}return i.length?[Iu.selection(i)]:Lu}function zu(t,e,n){var i=Nu(t.selectionsAfter.length?t.selectionsAfter.map((function(t){return t.map(e)})):Lu,n);if(!t.changes)return Iu.selection(i);var r=t.changes.map(e),o=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(o):o;return new Iu(r,s.Py.mapEffects(t.effects,e),a,t.startSelection.map(o),i)}var Fu=/^(input\.type|delete)($|\.)/,qu=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;(0,i.Z)(this,t),this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=o}return(0,r.Z)(t,[{key:"isolate",value:function(){return this.prevTime?new t(this.done,this.undone):this}},{key:"addChanges",value:function(e,n,i,r,o){var s=this.done,a=s[s.length-1];return s=a&&a.changes&&!a.changes.empty&&e.changes&&(!i||Fu.test(i))&&(!a.selectionsAfter.length&&n-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,function(t,e){var n=[],i=!1;return t.iterChangedRanges((function(t,e){return n.push(t,e)})),e.iterChangedRanges((function(t,e,r,o){for(var s=0;s<n.length;){var a=n[s++],h=n[s++];o>=a&&r<=h&&(i=!0)}})),i}(a.changes,e.changes))||"input.type.compose"==i)?Pu(s,s.length-1,r.minDepth,new Iu(e.changes.compose(a.changes),Nu(e.effects,a.effects),a.mapped,a.startSelection,Lu)):Pu(s,s.length,r.minDepth,e),new t(s,Lu,n,i)}},{key:"addSelection",value:function(e,n,i,r){var o,s,a=this.done.length?this.done[this.done.length-1].selectionsAfter:Lu;return a.length>0&&n-this.prevTime<r&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&(o=a[a.length-1],s=e,o.ranges.length==s.ranges.length&&0===o.ranges.filter((function(t,e){return t.empty!=s.ranges[e].empty})).length)?this:new t(Hu(this.done,e),this.undone,n,i)}},{key:"addMapping",value:function(e){return new t(_u(this.done,e),_u(this.undone,e),this.prevTime,this.prevUserEvent)}},{key:"pop",value:function(t,e,n){var i=0==t?this.done:this.undone;if(0==i.length)return null;var r=i[i.length-1],o=r.selectionsAfter[0]||e.selection;if(n&&r.selectionsAfter.length)return e.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Su.of({side:t,rest:Wu(i),selection:o}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){var s=1==i.length?Lu:i.slice(0,i.length-1);return r.mapped&&(s=_u(s,r.mapped)),e.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Su.of({side:t,rest:s,selection:o}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}]),t}();qu.empty=new qu(Lu,Lu);var ju=[{key:"Mod-z",run:Du,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Eu,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Eu,preventDefault:!0},{key:"Mod-u",run:Bu,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Ru,preventDefault:!0}];function Ku(t,e){return s.jT.create(t.ranges.map(e),t.mainIndex)}function Ju(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Uu(t,e){var n=t.state,i=t.dispatch,r=Ku(n.selection,e);return!r.eq(n.selection,!0)&&(i(Ju(n,r)),!0)}function Gu(t,e){return s.jT.cursor(e?t.to:t.from)}function $u(t,e){return Uu(t,(function(n){return n.empty?t.moveByChar(n,e):Gu(n,e)}))}function Xu(t){return t.textDirectionAt(t.state.selection.main.head)==Vn.LTR}var Yu=function(t){return $u(t,!Xu(t))},Qu=function(t){return $u(t,Xu(t))};function tl(t,e){return Uu(t,(function(n){return n.empty?t.moveByGroup(n,e):Gu(n,e)}))}"undefined"!=typeof Intl&&Intl.Segmenter;function el(t,e,n){if(e.type.prop(n))return!0;var i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function nl(t,e,n){for(var i=eh(t).resolveInner(e.head),r=n?qh.closedBy:qh.openedBy,o=e.head;;){var a=n?i.childAfter(o):i.childBefore(o);if(!a)break;el(t,a,r)?i=a:o=n?a.to:a.from}var h,u;return u=i.type.prop(r)&&(h=n?Dh(t,i.from,1):Dh(t,i.to,-1))&&h.matched?n?h.end.to:h.end.from:n?i.to:i.from,s.jT.cursor(u,n?-1:1)}function il(t,e){return Uu(t,(function(n){if(!n.empty)return Gu(n,e);var i=t.moveVertically(n,e);return i.head!=n.head?i:t.moveToLineBoundary(n,e)}))}var rl=function(t){return il(t,!1)},ol=function(t){return il(t,!0)};function sl(t){var e,n=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,i=0,r=0;if(n){var s,a=(0,o.Z)(t.state.facet(Wr.scrollMargins));try{for(a.s();!(s=a.n()).done;){var h=(0,s.value)(t);(null==h?void 0:h.top)&&(i=Math.max(null==h?void 0:h.top,i)),(null==h?void 0:h.bottom)&&(r=Math.max(null==h?void 0:h.bottom,r))}}catch(u){a.e(u)}finally{a.f()}e=t.scrollDOM.clientHeight-i-r}else e=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:r,selfScroll:n,height:Math.max(t.defaultLineHeight,e-5)}}function al(t,e){var n,i=sl(t),r=t.state,o=Ku(r.selection,(function(n){return n.empty?t.moveVertically(n,e,i.height):Gu(n,e)}));if(o.eq(r.selection))return!1;if(i.selfScroll){var s=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),h=a.top+i.marginTop,u=a.bottom-i.marginBottom;s&&s.top>h&&s.bottom<u&&(n=Wr.scrollIntoView(o.main.head,{y:"start",yMargin:s.top-h}))}return t.dispatch(Ju(r,o),{effects:n}),!0}var hl=function(t){return al(t,!1)},ul=function(t){return al(t,!0)};function ll(t,e,n){var i=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,n);if(r.head==e.head&&r.head!=(n?i.to:i.from)&&(r=t.moveToLineBoundary(e,n,!1)),!n&&r.head==i.from&&i.length){var o=/^\s*/.exec(t.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;o&&e.head!=i.from+o&&(r=s.jT.cursor(i.from+o))}return r}function cl(t,e,n){var i=!1,r=Ku(t.selection,(function(e){var r=Dh(t,e.head,-1)||Dh(t,e.head,1)||e.head>0&&Dh(t,e.head-1,1)||e.head<t.doc.length&&Dh(t,e.head+1,-1);if(!r||!r.end)return e;i=!0;var o=r.start.from==e.head?r.end.to:r.end.from;return n?s.jT.range(e.anchor,o):s.jT.cursor(o)}));return!!i&&(e(Ju(t,r)),!0)}function fl(t,e){var n=Ku(t.state.selection,(function(t){var n=e(t);return s.jT.range(t.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(t.state.selection)&&(t.dispatch(Ju(t.state,n)),!0)}function dl(t,e){return fl(t,(function(n){return t.moveByChar(n,e)}))}var vl=function(t){return dl(t,!Xu(t))},gl=function(t){return dl(t,Xu(t))};function pl(t,e){return fl(t,(function(n){return t.moveByGroup(n,e)}))}function ml(t,e){return fl(t,(function(n){return t.moveVertically(n,e)}))}var yl=function(t){return ml(t,!1)},kl=function(t){return ml(t,!0)};function wl(t,e){return fl(t,(function(n){return t.moveVertically(n,e,sl(t).height)}))}var bl=function(t){return wl(t,!1)},xl=function(t){return wl(t,!0)},Sl=function(t){var e=t.state;return(0,t.dispatch)(Ju(e,{anchor:0})),!0},Al=function(t){var e=t.state;return(0,t.dispatch)(Ju(e,{anchor:e.doc.length})),!0},Ml=function(t){var e=t.state;return(0,t.dispatch)(Ju(e,{anchor:e.selection.main.anchor,head:0})),!0},Zl=function(t){var e=t.state;return(0,t.dispatch)(Ju(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0};function Cl(t,e){if(t.state.readOnly)return!1;var n="delete.selection",i=t.state,r=i.changeByRange((function(i){var r=i.from,o=i.to;if(r==o){var a=e(i);a<r?(n="delete.backward",a=Ol(t,a,!1)):a>r&&(n="delete.forward",a=Ol(t,a,!0)),r=Math.min(r,a),o=Math.max(o,a)}else r=Ol(t,r,!1),o=Ol(t,o,!0);return r==o?{range:i}:{changes:{from:r,to:o},range:s.jT.cursor(r,r<i.head?-1:1)}}));return!r.changes.empty&&(t.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?Wr.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Ol(t,e,n){if(t instanceof Wr){var i,r=(0,o.Z)(t.state.facet(Wr.atomicRanges).map((function(e){return e(t)})));try{for(r.s();!(i=r.n()).done;){i.value.between(e,e,(function(t,i){t<e&&i>e&&(e=n?i:t)}))}}catch(s){r.e(s)}finally{r.f()}}return e}var Tl=function(t,e){return Cl(t,(function(n){var i,r,o=n.from,a=t.state,h=a.doc.lineAt(o);if(!e&&o>h.from&&o<h.from+200&&!/[^ \t]/.test(i=h.text.slice(0,o-h.from))){if("\t"==i[i.length-1])return o-1;for(var u=(0,s.IS)(i,a.tabSize)%dh(a)||dh(a),l=0;l<u&&" "==i[i.length-1-l];l++)o--;r=o}else(r=(0,s.cp)(h.text,o-h.from,e,e)+h.from)==o&&h.number!=(e?a.doc.lines:1)?r+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(h.text.slice(r-h.from,o-h.from))&&(r=(0,s.cp)(h.text,r-h.from,!1,!1)+h.from);return r}))},Dl=function(t){return Tl(t,!1)},El=function(t){return Tl(t,!0)},Bl=function(t,e){return Cl(t,(function(n){for(var i=n.head,r=t.state,o=r.doc.lineAt(i),a=r.charCategorizer(i),h=null;;){if(i==(e?o.to:o.from)){i==n.head&&o.number!=(e?r.doc.lines:1)&&(i+=e?1:-1);break}var u=(0,s.cp)(o.text,i-o.from,e)+o.from,l=o.text.slice(Math.min(i,u)-o.from,Math.max(i,u)-o.from),c=a(l);if(null!=h&&c!=h)break;" "==l&&i==n.head||(h=c),i=u}return i}))},Rl=function(t){return Bl(t,!1)};function Il(t){var e,n=[],i=-1,r=(0,o.Z)(t.selection.ranges);try{for(r.s();!(e=r.n()).done;){var s=e.value,a=t.doc.lineAt(s.from),h=t.doc.lineAt(s.to);if(s.empty||s.to!=h.from||(h=t.doc.lineAt(s.to-1)),i>=a.number){var u=n[n.length-1];u.to=h.to,u.ranges.push(s)}else n.push({from:a.from,to:h.to,ranges:[s]});i=h.number+1}}catch(l){r.e(l)}finally{r.f()}return n}function Pl(t,e,n){if(t.readOnly)return!1;var i,r=[],a=[],h=(0,o.Z)(Il(t));try{for(h.s();!(i=h.n()).done;){var u=i.value;if(n?u.to!=t.doc.length:0!=u.from){var l=t.doc.lineAt(n?u.to+1:u.from-1),c=l.length+1;if(n){r.push({from:u.to,to:l.to},{from:u.from,insert:l.text+t.lineBreak});var f,d=(0,o.Z)(u.ranges);try{for(d.s();!(f=d.n()).done;){var v=f.value;a.push(s.jT.range(Math.min(t.doc.length,v.anchor+c),Math.min(t.doc.length,v.head+c)))}}catch(y){d.e(y)}finally{d.f()}}else{r.push({from:l.from,to:u.from},{from:u.to,insert:t.lineBreak+l.text});var g,p=(0,o.Z)(u.ranges);try{for(p.s();!(g=p.n()).done;){var m=g.value;a.push(s.jT.range(m.anchor-c,m.head-c))}}catch(y){p.e(y)}finally{p.f()}}}}}catch(y){h.e(y)}finally{h.f()}return!!r.length&&(e(t.update({changes:r,scrollIntoView:!0,selection:s.jT.create(a,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Nl(t,e,n){if(t.readOnly)return!1;var i,r=[],s=(0,o.Z)(Il(t));try{for(s.s();!(i=s.n()).done;){var a=i.value;n?r.push({from:a.from,insert:t.doc.slice(a.from,a.to)+t.lineBreak}):r.push({from:a.to,insert:t.lineBreak+t.doc.slice(a.from,a.to)})}}catch(h){s.e(h)}finally{s.f()}return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}var Ll=Vl(!1);function Vl(t){return function(e){var n=e.state,i=e.dispatch;if(n.readOnly)return!1;var r=n.changeByRange((function(e){var i=e.from,r=e.to,o=n.doc.lineAt(i),a=!t&&i==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};var n,i=eh(t).resolveInner(e),r=i.childBefore(e),o=i.childAfter(e);return r&&o&&r.to<=e&&o.from>=e&&(n=r.type.prop(qh.closedBy))&&n.indexOf(o.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(o.from).from&&!/\S/.test(t.sliceDoc(r.to,o.from))?{from:r.to,to:o.from}:null}(n,i);t&&(i=r=(r<=o.to?o:n.doc.lineAt(r)).to);var h=new ph(n,{simulateBreak:i,simulateDoubleBreak:!!a}),u=gh(h,i);for(null==u&&(u=(0,s.IS)(/^\s*/.exec(n.doc.lineAt(i).text)[0],n.tabSize));r<o.to&&/\s/.test(o.text[r-o.from]);)r++;a?(i=a.from,r=a.to):i>o.from&&i<o.from+100&&!/\S/.test(o.text.slice(0,i))&&(i=o.from);var l=["",vh(n,u)];return a&&l.push(vh(n,h.lineIndent(o.from,-1))),{changes:{from:i,to:r,insert:s.xv.of(l)},range:s.jT.cursor(i+1+l[1].length)}}));return i(n.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Hl(t,e){var n=-1;return t.changeByRange((function(i){for(var r=[],o=i.from;o<=i.to;){var a=t.doc.lineAt(o);a.number>n&&(i.empty||i.to>a.from)&&(e(a,r,i),n=a.number),o=a.to+1}var h=t.changes(r);return{changes:r,range:s.jT.range(h.mapPos(i.anchor,1),h.mapPos(i.head,1))}}))}var Wl=function(t){var e=t.state,n=t.dispatch;return!e.readOnly&&(n(e.update(Hl(e,(function(t,n){n.push({from:t.from,insert:e.facet(fh)})})),{userEvent:"input.indent"})),!0)},_l=function(t){var e=t.state,n=t.dispatch;return!e.readOnly&&(n(e.update(Hl(e,(function(t,n){var i=/^\s*/.exec(t.text)[0];if(i){for(var r=(0,s.IS)(i,e.tabSize),o=0,a=vh(e,Math.max(0,r-dh(e)));o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+i.length,insert:a.slice(o)})}})),{userEvent:"delete.dedent"})),!0)},zl=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:function(t){return Uu(t,(function(e){return nl(t.state,e,!Xu(t))}))},shift:function(t){return fl(t,(function(e){return nl(t.state,e,!Xu(t))}))}},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:function(t){return Uu(t,(function(e){return nl(t.state,e,Xu(t))}))},shift:function(t){return fl(t,(function(e){return nl(t.state,e,Xu(t))}))}},{key:"Alt-ArrowUp",run:function(t){return Pl(t.state,t.dispatch,!1)}},{key:"Shift-Alt-ArrowUp",run:function(t){return Nl(t.state,t.dispatch,!1)}},{key:"Alt-ArrowDown",run:function(t){return Pl(t.state,t.dispatch,!0)}},{key:"Shift-Alt-ArrowDown",run:function(t){return Nl(t.state,t.dispatch,!0)}},{key:"Escape",run:function(t){var e=t.state,n=t.dispatch,i=e.selection,r=null;return i.ranges.length>1?r=s.jT.create([i.main]):i.main.empty||(r=s.jT.create([s.jT.cursor(i.main.head)])),!!r&&(n(Ju(e,r)),!0)}},{key:"Mod-Enter",run:Vl(!0)},{key:"Alt-l",mac:"Ctrl-l",run:function(t){var e=t.state,n=t.dispatch,i=Il(e).map((function(t){var n=t.from,i=t.to;return s.jT.range(n,Math.min(i+1,e.doc.length))}));return n(e.update({selection:s.jT.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:function(t){var e=t.state,n=t.dispatch,i=Ku(e.selection,(function(t){for(var n,i=eh(e).resolveStack(t.from,1);i;i=i.next){var r=i.node;if((r.from<t.from&&r.to>=t.to||r.to>t.to&&r.from<=t.from)&&(null===(n=r.parent)||void 0===n?void 0:n.parent))return s.jT.range(r.to,r.from)}return t}));return n(Ju(e,i)),!0},preventDefault:!0},{key:"Mod-[",run:_l},{key:"Mod-]",run:Wl},{key:"Mod-Alt-\\",run:function(t){var e=t.state,n=t.dispatch;if(e.readOnly)return!1;var i=Object.create(null),r=new ph(e,{overrideIndentation:function(t){var e=i[t];return null==e?-1:e}}),o=Hl(e,(function(t,n,o){var s=gh(r,t.from);if(null!=s){/\S/.test(t.text)||(s=0);var a=/^\s*/.exec(t.text)[0],h=vh(e,s);(a!=h||o.from<t.from+a.length)&&(i[t.from]=s,n.push({from:t.from,to:t.from+a.length,insert:h}))}}));return o.changes.empty||n(e.update(o,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:function(t){if(t.state.readOnly)return!1;var e=t.state,n=e.changes(Il(e).map((function(t){var n=t.from,i=t.to;return n>0?n--:i<e.doc.length&&i++,{from:n,to:i}}))),i=Ku(e.selection,(function(e){return t.moveVertically(e,!0)})).map(n);return t.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:function(t){return cl(t.state,t.dispatch,!1)}},{key:"Mod-/",run:function(t){var e=t.state,n=e.doc.lineAt(e.selection.main.from),i=ku(t.state,n.from);return i.line?pu(t):!!i.block&&yu(t)}},{key:"Alt-A",run:mu}].concat([{key:"ArrowLeft",run:Yu,shift:vl,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:function(t){return tl(t,!Xu(t))},shift:function(t){return pl(t,!Xu(t))},preventDefault:!0},{mac:"Cmd-ArrowLeft",run:function(t){return Uu(t,(function(e){return ll(t,e,!Xu(t))}))},shift:function(t){return fl(t,(function(e){return ll(t,e,!Xu(t))}))},preventDefault:!0},{key:"ArrowRight",run:Qu,shift:gl,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:function(t){return tl(t,Xu(t))},shift:function(t){return pl(t,Xu(t))},preventDefault:!0},{mac:"Cmd-ArrowRight",run:function(t){return Uu(t,(function(e){return ll(t,e,Xu(t))}))},shift:function(t){return fl(t,(function(e){return ll(t,e,Xu(t))}))},preventDefault:!0},{key:"ArrowUp",run:rl,shift:yl,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Sl,shift:Ml},{mac:"Ctrl-ArrowUp",run:hl,shift:bl},{key:"ArrowDown",run:ol,shift:kl,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Al,shift:Zl},{mac:"Ctrl-ArrowDown",run:ul,shift:xl},{key:"PageUp",run:hl,shift:bl},{key:"PageDown",run:ul,shift:xl},{key:"Home",run:function(t){return Uu(t,(function(e){return ll(t,e,!1)}))},shift:function(t){return fl(t,(function(e){return ll(t,e,!1)}))},preventDefault:!0},{key:"Mod-Home",run:Sl,shift:Ml},{key:"End",run:function(t){return Uu(t,(function(e){return ll(t,e,!0)}))},shift:function(t){return fl(t,(function(e){return ll(t,e,!0)}))},preventDefault:!0},{key:"Mod-End",run:Al,shift:Zl},{key:"Enter",run:Ll},{key:"Mod-a",run:function(t){var e=t.state;return(0,t.dispatch)(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0}},{key:"Backspace",run:Dl,shift:Dl},{key:"Delete",run:El},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Rl},{key:"Mod-Delete",mac:"Alt-Delete",run:function(t){return Bl(t,!0)}},{mac:"Mod-Backspace",run:function(t){return Cl(t,(function(e){var n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}))}},{mac:"Mod-Delete",run:function(t){return Cl(t,(function(e){var n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}))}}].concat([{key:"Ctrl-b",run:Yu,shift:vl,preventDefault:!0},{key:"Ctrl-f",run:Qu,shift:gl},{key:"Ctrl-p",run:rl,shift:yl},{key:"Ctrl-n",run:ol,shift:kl},{key:"Ctrl-a",run:function(t){return Uu(t,(function(e){return s.jT.cursor(t.lineBlockAt(e.head).from,1)}))},shift:function(t){return fl(t,(function(e){return s.jT.cursor(t.lineBlockAt(e.head).from)}))}},{key:"Ctrl-e",run:function(t){return Uu(t,(function(e){return s.jT.cursor(t.lineBlockAt(e.head).to,-1)}))},shift:function(t){return fl(t,(function(e){return s.jT.cursor(t.lineBlockAt(e.head).to)}))}},{key:"Ctrl-d",run:El},{key:"Ctrl-h",run:Dl},{key:"Ctrl-k",run:function(t){return Cl(t,(function(e){var n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}))}},{key:"Ctrl-Alt-h",run:Rl},{key:"Ctrl-o",run:function(t){var e=t.state,n=t.dispatch;if(e.readOnly)return!1;var i=e.changeByRange((function(t){return{changes:{from:t.from,to:t.to,insert:s.xv.of(["",""])},range:s.jT.cursor(t.from)}}));return n(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:function(t){var e=t.state,n=t.dispatch;if(e.readOnly)return!1;var i=e.changeByRange((function(t){if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};var n=t.from,i=e.doc.lineAt(n),r=n==i.from?n-1:(0,s.cp)(i.text,n-i.from,!1)+i.from,o=n==i.to?n+1:(0,s.cp)(i.text,n-i.from,!0)+i.from;return{changes:{from:r,to:o,insert:e.doc.slice(n,o).append(e.doc.slice(r,n))},range:s.jT.cursor(o)}}));return!i.changes.empty&&(n(e.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:ul}].map((function(t){return{mac:t.key,run:t.run,shift:t.shift}}))))},67289:function(t,e,n){n.d(e,{Qf:function(){return oi},il:function(){return mi},QN:function(){return li},nF:function(){return ui},qz:function(){return Nn}});var i=n(93359),r=n(62746),o=n(82390),s=n(76775),a=n(68308),h=n(69205),u=n(40039),l=n(71650),c=n(33368),f=(n(97393),n(22859),n(63789),n(99397),n(36513),n(17692),n(41353),n(51358),n(46798),n(47084),n(5239),n(98490),n(51467),n(46349),n(70320),n(56308),n(9849),n(13526),n(32797),n(88770),n(35221),n(18098),n(24074),n(85717),n(7507),n(10999),n(52117),n(82479),n(94570),n(39685),n(22481),n(71779),n(91989),n(24829),n(12397),n(83868),n(75544),n(33435),n(66657),n(53608),n(42313),n(48112),n(87323),n(39588),n(31871),n(87753),n(91843),n(9979),n(34497),n(39912),n(76751),n(44988),n(32369),n(39832),n(83327),n(47475),n(94010),n(64085),n(56399),n(16149),n(39891),n(20459),n(89664),n(92478),n(60731),n(51964),n(93330),n(80628),n(64777),n(96043),n(85472),n(90126),0),d=(0,c.Z)((function t(e,n){(0,l.Z)(this,t),this.from=e,this.to=n})),v=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,l.Z)(this,t),this.id=f++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return(0,c.Z)(t,[{key:"add",value:function(t){var e=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=m.match(t)),function(n){var i=t(n);return void 0===i?null:[e,i]}}}]),t}();v.closedBy=new v({deserialize:function(t){return t.split(" ")}}),v.openedBy=new v({deserialize:function(t){return t.split(" ")}}),v.group=new v({deserialize:function(t){return t.split(" ")}}),v.isolate=new v({deserialize:function(t){if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),v.contextHash=new v({perNode:!0}),v.lookAhead=new v({perNode:!0}),v.mounted=new v({perNode:!0});var g=function(){function t(e,n,i){(0,l.Z)(this,t),this.tree=e,this.overlay=n,this.parser=i}return(0,c.Z)(t,null,[{key:"get",value:function(t){return t&&t.props&&t.props[v.mounted.id]}}]),t}(),p=Object.create(null),m=function(){function t(e,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;(0,l.Z)(this,t),this.name=e,this.props=n,this.id=i,this.flags=r}return(0,c.Z)(t,[{key:"prop",value:function(t){return this.props[t.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(t){if("string"==typeof t){if(this.name==t)return!0;var e=this.prop(v.group);return!!e&&e.indexOf(t)>-1}return this.id==t}}],[{key:"define",value:function(e){var n=e.props&&e.props.length?Object.create(null):p,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),r=new t(e.name||"",n,e.id,i);if(e.props){var o,s=(0,u.Z)(e.props);try{for(s.s();!(o=s.n()).done;){var a=o.value;if(Array.isArray(a)||(a=a(r)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[a[0].id]=a[1]}}}catch(h){s.e(h)}finally{s.f()}}return r}},{key:"match",value:function(t){var e=Object.create(null);for(var n in t){var i,r=(0,u.Z)(n.split(" "));try{for(r.s();!(i=r.n()).done;){var o=i.value;e[o]=t[n]}}catch(s){r.e(s)}finally{r.f()}}return function(t){for(var n=t.prop(v.group),i=-1;i<(n?n.length:0);i++){var r=e[i<0?t.name:n[i]];if(r)return r}}}}]),t}();m.none=new m("",Object.create(null),0,8);var y,k=function(){function t(e){(0,l.Z)(this,t),this.types=e;for(var n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}return(0,c.Z)(t,[{key:"extend",value:function(){for(var e=[],n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];var o,s=(0,u.Z)(this.types);try{for(s.s();!(o=s.n()).done;){var a,h=o.value,l=null,c=(0,u.Z)(i);try{for(c.s();!(a=c.n()).done;){var f=(0,a.value)(h);f&&(l||(l=Object.assign({},h.props)),l[f[0].id]=f[1])}}catch(d){c.e(d)}finally{c.f()}e.push(l?new m(h.name,l,h.id,h.flags):h)}}catch(d){s.e(d)}finally{s.f()}return new t(e)}}]),t}(),w=new WeakMap,b=new WeakMap;!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(y||(y={}));var x=function(){function t(e,n,i,o,s){if((0,l.Z)(this,t),this.type=e,this.children=n,this.positions=i,this.length=o,this.props=null,s&&s.length){this.props=Object.create(null);var a,h=(0,u.Z)(s);try{for(h.s();!(a=h.n()).done;){var c=(0,r.Z)(a.value,2),f=c[0],d=c[1];this.props["number"==typeof f?f:f.id]=d}}catch(v){h.e(v)}finally{h.f()}}}return(0,c.Z)(t,[{key:"toString",value:function(){var t=g.get(this);if(t&&!t.overlay)return t.tree.toString();var e,n="",i=(0,u.Z)(this.children);try{for(i.s();!(e=i.n()).done;){var r=e.value.toString();r&&(n&&(n+=","),n+=r)}}catch(o){i.e(o)}finally{i.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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new P(this.topNode,t)}},{key:"cursorAt",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=w.get(this)||this.topNode,i=new P(n);return i.moveTo(t,e),w.set(this,i._tree),i}},{key:"topNode",get:function(){return new O(this,0,0,null)}},{key:"resolve",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Z(w.get(this)||this.topNode,t,e,!1);return w.set(this,n),n}},{key:"resolveInner",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Z(b.get(this)||this.topNode,t,e,!0);return b.set(this,n),n}},{key:"resolveStack",value:function(t){return function(t,e,n){for(var i=t.resolveInner(e,n),r=null,o=i instanceof O?i:i.context.parent;o;o=o.parent)if(o.index<0){var s=o.parent;(r||(r=[i])).push(s.resolve(e,n)),o=s}else{var a=g.get(o.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){var h=new O(a.tree,a.overlay[0].from+o.from,-1,o);(r||(r=[i])).push(Z(h,e,n,!1))}}return r?R(r):i}(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}},{key:"iterate",value:function(t){for(var e=t.enter,n=t.leave,i=t.from,r=void 0===i?0:i,o=t.to,s=void 0===o?this.length:o,a=t.mode||0,h=(a&y.IncludeAnonymous)>0,u=this.cursor(a|y.IncludeAnonymous);;){var l=!1;if(u.from<=s&&u.to>=r&&(!h&&u.type.isAnonymous||!1!==e(u))){if(u.firstChild())continue;l=!0}for(;l&&n&&(h||!u.type.isAnonymous)&&n(u),!u.nextSibling();){if(!u.parent())return;l=!0}}}},{key:"prop",value:function(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}},{key:"propValues",get:function(){var t=[];if(this.props)for(var e in this.props)t.push([+e,this.props[e]]);return t}},{key:"balance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.children.length<=8?this:W(m.none,this.children,this.positions,0,this.children.length,0,this.length,(function(n,i,r){return new t(e.type,n,i,r,e.propValues)}),n.makeTree||function(e,n,i){return new t(m.none,e,n,i)})}}],[{key:"build",value:function(t){return L(t)}}]),t}();x.empty=new x(m.none,[],[],0);var S=function(){function t(e,n){(0,l.Z)(this,t),this.buffer=e,this.index=n}return(0,c.Z)(t,[{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 t(this.buffer,this.index)}}]),t}(),A=function(){function t(e,n,i){(0,l.Z)(this,t),this.buffer=e,this.length=n,this.set=i}return(0,c.Z)(t,[{key:"type",get:function(){return m.none}},{key:"toString",value:function(){for(var t=[],e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}},{key:"childString",value:function(t){var e=this.buffer[t],n=this.buffer[t+3],i=this.set.types[e],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),n==(t+=4))return r;for(var o=[];t<n;)o.push(this.childString(t)),t=this.buffer[t+3];return r+"("+o.join(",")+")"}},{key:"findChild",value:function(t,e,n,i,r){for(var o=this.buffer,s=-1,a=t;a!=e&&!(M(r,i,o[a+1],o[a+2])&&(s=a,n>0));a=o[a+3]);return s}},{key:"slice",value:function(e,n,i){for(var r=this.buffer,o=new Uint16Array(n-e),s=0,a=e,h=0;a<n;){o[h++]=r[a++],o[h++]=r[a++]-i;var u=o[h++]=r[a++]-i;o[h++]=r[a++]-e,s=Math.max(s,u)}return new t(o,s,this.set)}}]),t}();function M(t,e,n,i){switch(t){case-2:return n<e;case-1:return i>=e&&n<e;case 0:return n<e&&i>e;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function Z(t,e,n,i){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){var o=!i&&t instanceof O&&t.index<0?null:t.parent;if(!o)return t;t=o}var s=i?0:y.IgnoreOverlays;if(i)for(var a=t,h=a.parent;h;h=(a=h).parent)a instanceof O&&a.index<0&&(null===(r=h.enter(e,n,s))||void 0===r?void 0:r.from)!=a.from&&(t=h);for(;;){var u=t.enter(e,n,s);if(!u)return t;t=u}}var C=function(){function t(){(0,l.Z)(this,t)}return(0,c.Z)(t,[{key:"cursor",value:function(){return new P(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"getChild",value:function(t){var e=T(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return e.length?e[0]:null}},{key:"getChildren",value:function(t){return T(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}},{key:"resolve",value:function(t){return Z(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(t){return Z(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"matchContext",value:function(t){return D(this,t)}},{key:"enterUnfinishedNodesBefore",value:function(t){for(var e=this.childBefore(t),n=this;e;){var i=e.lastChild;if(!i||i.to!=e.to)break;i.type.isError&&i.from==i.to?(n=e,e=i.prevSibling):e=i}return n}},{key:"node",get:function(){return this}},{key:"next",get:function(){return this.parent}}]),t}(),O=function(t){function e(t,n,i,r){var o;return(0,l.Z)(this,e),(o=(0,a.Z)(this,e))._tree=t,o.from=n,o.index=i,o._parent=r,o}return(0,h.Z)(e,t),(0,c.Z)(e,[{key:"type",get:function(){return this._tree.type}},{key:"name",get:function(){return this._tree.type.name}},{key:"to",get:function(){return this.from+this._tree.length}},{key:"nextChild",value:function(t,n,i,r){for(var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=this;;){for(var a=s._tree,h=a.children,u=a.positions,l=n>0?h.length:-1;t!=l;t+=n){var c=h[t],f=u[t]+s.from;if(M(r,i,f,f+c.length))if(c instanceof A){if(o&y.ExcludeBuffers)continue;var d=c.findChild(0,c.buffer.length,n,i-f,r);if(d>-1)return new B(new E(s,c,t,f),null,d)}else if(o&y.IncludeAnonymous||!c.type.isAnonymous||N(c)){var v=void 0;if(!(o&y.IgnoreMounts)&&(v=g.get(c))&&!v.overlay)return new e(v.tree,f,t,s);var p=new e(c,f,t,s);return o&y.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?c.children.length-1:0,n,i,r)}}if(o&y.IncludeAnonymous||!s.type.isAnonymous)return null;if(t=s.index>=0?s.index+n:n<0?-1:s._parent._tree.children.length,!(s=s._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(t){return this.nextChild(0,1,t,2)}},{key:"childBefore",value:function(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}},{key:"enter",value:function(t,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(r&y.IgnoreOverlays)&&(i=g.get(this._tree))&&i.overlay){var o,s=t-this.from,a=(0,u.Z)(i.overlay);try{for(a.s();!(o=a.n()).done;){var h=o.value,l=h.from,c=h.to;if((n>0?l<=s:l<s)&&(n<0?c>=s:c>s))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}}catch(f){a.e(f)}finally{a.f()}}return this.nextChild(0,1,t,n,r)}},{key:"nextSignificantParent",value:function(){for(var t=this;t.type.isAnonymous&&t._parent;)t=t._parent;return t}},{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:"tree",get:function(){return this._tree}},{key:"toTree",value:function(){return this._tree}},{key:"toString",value:function(){return this._tree.toString()}}]),e}(C);function T(t,e,n,i){var r=t.cursor(),o=[];if(!r.firstChild())return o;if(null!=n)for(;!r.type.is(n);)if(!r.nextSibling())return o;for(;;){if(null!=i&&r.type.is(i))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return null==i?o:[]}}function D(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length-1,i=t.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}var E=(0,c.Z)((function t(e,n,i,r){(0,l.Z)(this,t),this.parent=e,this.buffer=n,this.index=i,this.start=r})),B=function(t){function e(t,n,i){var r;return(0,l.Z)(this,e),(r=(0,a.Z)(this,e)).context=t,r._parent=n,r.index=i,r.type=t.buffer.set.types[t.buffer.buffer[i]],r}return(0,h.Z)(e,t),(0,c.Z)(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,i){var r=this.context.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.context.start,i);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(t){return this.child(1,t,2)}},{key:"childBefore",value:function(t){return this.child(-1,t,-2)}},{key:"enter",value:function(t,n){if((arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)&y.ExcludeBuffers)return null;var i=this.context.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return r<0?null:new e(this.context,this,r)}},{key:"parent",get:function(){return this._parent||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,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:"tree",get:function(){return null}},{key:"toTree",value:function(){var t=[],e=[],n=this.context.buffer,i=this.index+4,r=n.buffer[this.index+3];if(r>i){var o=n.buffer[this.index+1];t.push(n.slice(i,r,o)),e.push(0)}return new x(this.type,t,e,this.to-this.from)}},{key:"toString",value:function(){return this.context.buffer.childString(this.index)}}]),e}(C);function R(t){if(!t.length)return null;for(var e=0,n=t[0],i=1;i<t.length;i++){var r=t[i];(r.from>n.from||r.to<n.to)&&(n=r,e=i)}var o=n instanceof O&&n.index<0?null:n.parent,s=t.slice();return o?s[e]=o:s.splice(e,1),new I(s,n)}var I=function(){function t(e,n){(0,l.Z)(this,t),this.heads=e,this.node=n}return(0,c.Z)(t,[{key:"next",get:function(){return R(this.heads)}}]),t}();var P=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if((0,l.Z)(this,t),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof O)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(var i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}return(0,c.Z)(t,[{key:"name",get:function(){return this.type.name}},{key:"yieldNode",value:function(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}},{key:"yieldBuf",value:function(t,e){this.index=t;var n=this.buffer,i=n.start,r=n.buffer;return this.type=e||r.set.types[r.buffer[t]],this.from=i+r.buffer[t+1],this.to=i+r.buffer[t+2],!0}},{key:"yield",value:function(t){return!!t&&(t instanceof O?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}},{key:"toString",value:function(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}},{key:"enterChild",value:function(t,e,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,n,this.mode));var i=this.buffer.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.buffer.start,n);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}},{key:"firstChild",value:function(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function(t){return this.enterChild(1,t,2)}},{key:"childBefore",value:function(t){return this.enterChild(-1,t,-2)}},{key:"enter",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(n&y.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,n))}},{key:"parent",value:function(){if(!this.buffer)return this.yieldNode(this.mode&y.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&y.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}},{key:"sibling",value:function(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,n=this.stack.length-1;if(t<0){var i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(e.findChild(i,this.index,-1,0,4))}else{var r=e.buffer[this.index+3];if(r<(n<0?e.buffer.length:e.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}},{key:"nextSibling",value:function(){return this.sibling(1)}},{key:"prevSibling",value:function(){return this.sibling(-1)}},{key:"atLastNode",value:function(t){var e,n,i=this.buffer;if(i){if(t>0){if(this.index<i.buffer.buffer.length)return!1}else for(var r=0;r<this.index;r++)if(i.buffer.buffer[r+3]<this.index)return!1;e=i.index,n=i.parent}else{var o=this._tree;e=o.index,n=o._parent}for(;n;e=(s=n).index,n=s._parent,s){var s;if(e>-1)for(var a=e+t,h=t<0?-1:n._tree.children.length;a!=h;a+=t){var u=n._tree.children[a];if(this.mode&y.IncludeAnonymous||u instanceof A||!u.type.isAnonymous||N(u))return!1}}return!0}},{key:"move",value:function(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(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(1,t)}},{key:"prev",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(-1,t)}},{key:"moveTo",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(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(){if(!this.buffer)return this._tree;var t=this.bufferNode,e=null,n=0;if(t&&t.context==this.buffer)t:for(var i=this.index,r=this.stack.length;r>=0;){for(var o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;e=o,n=r+1;break t}i=this.stack[--r]}for(var s=n;s<this.stack.length;s++)e=new B(this.buffer,e,this.stack[s]);return this.bufferNode=new B(this.buffer,e,this.index)}},{key:"tree",get:function(){return this.buffer?null:this._tree._tree}},{key:"iterate",value:function(t,e){for(var n=0;;){var i=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;i&&e&&e(this),i=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,i=!0}}}},{key:"matchContext",value:function(t){if(!this.buffer)return D(this.node,t);for(var e=this.buffer.buffer,n=e.set.types,i=t.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return D(this.node,t,i);var o=n[e.buffer[this.stack[r]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}}]),t}();function N(t){return t.children.some((function(t){return t instanceof A||!t.type.isAnonymous||N(t)}))}function L(t){var e,n=t.buffer,i=t.nodeSet,r=t.maxBufferLength,o=void 0===r?1024:r,s=t.reused,a=void 0===s?[]:s,h=t.minRepeatType,u=void 0===h?i.types.length:h,l=Array.isArray(n)?new S(n,n.length):n,c=i.types,f=0,d=0;function g(t,e,n,r,s,h){for(var w=l.id,b=l.start,S=l.end,M=l.size,Z=d;M<0;){if(l.next(),-1==M){var C=a[w];return n.push(C),void r.push(b-t)}if(-3==M)return void(f=w);if(-4==M)return void(d=w);throw new RangeError("Unrecognized record size: ".concat(M))}var O,T,D=c[w],E=b-t;if(S-b<=o&&(T=function(t,e){var n=l.fork(),i=0,r=0,s=0,a=n.end-o,h={size:0,start:0,skip:0};t:for(var c=n.pos-t;n.pos>c;){var f=n.size;if(n.id==e&&f>=0)h.size=i,h.start=r,h.skip=s,s+=4,i+=4,n.next();else{var d=n.pos-f;if(f<0||d<c||n.start<a)break;var v=n.id>=u?4:0,g=n.start;for(n.next();n.pos>d;){if(n.size<0){if(-3!=n.size)break t;v+=4}else n.id>=u&&(v+=4);n.next()}r=g,i+=f,s+=v}}(e<0||i==t)&&(h.size=i,h.start=r,h.skip=s);return h.size>4?h:void 0}(l.pos-e,s))){for(var B=new Uint16Array(T.size-T.skip),R=l.pos-T.size,I=B.length;l.pos>R;)I=k(T.start,B,I);O=new A(B,S-T.start,i),E=T.start-t}else{var P=l.pos-M;l.next();for(var N=[],L=[],V=w>=u?w:-1,H=0,_=S;l.pos>P;)V>=0&&l.id==V&&l.size>=0?(l.end<=_-o&&(m(N,L,b,H,l.end,_,V,Z),H=N.length,_=l.end),l.next()):h>2500?p(b,P,N,L):g(b,P,N,L,V,h+1);if(V>=0&&H>0&&H<N.length&&m(N,L,b,H,b,_,V,Z),N.reverse(),L.reverse(),V>-1&&H>0){var z=function(t){return function(e,n,i){var r,o,s=0,a=e.length-1;if(a>=0&&(r=e[a])instanceof x){if(!a&&r.type==t&&r.length==i)return r;(o=r.prop(v.lookAhead))&&(s=n[a]+r.length+o)}return y(t,e,n,i,s)}}(D);O=W(D,N,L,0,N.length,0,S-b,z,z)}else O=y(D,N,L,S-b,Z-S)}n.push(O),r.push(E)}function p(t,e,n,r){for(var s=[],a=0,h=-1;l.pos>e;){var u=l.id,c=l.start,f=l.end;if(l.size>4)l.next();else{if(h>-1&&c<h)break;h<0&&(h=f-o),s.push(u,c,f),a++,l.next()}}if(a){for(var d=new Uint16Array(4*a),v=s[s.length-2],g=s.length-3,p=0;g>=0;g-=3)d[p++]=s[g],d[p++]=s[g+1]-v,d[p++]=s[g+2]-v,d[p++]=p;n.push(new A(d,s[2]-v,i)),r.push(v-t)}}function m(t,e,n,r,o,s,a,h){for(var u=[],l=[];t.length>r;)u.push(t.pop()),l.push(e.pop()+n-o);t.push(y(i.types[a],u,l,s-o,h-s)),e.push(o-n)}function y(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0;if(f){var s=[v.contextHash,f];o=o?[s].concat(o):[s]}if(r>25){var a=[v.lookAhead,r];o=o?[a].concat(o):[a]}return new x(t,e,n,i,o)}function k(t,e,n){var i=l.id,r=l.start,o=l.end,s=l.size;if(l.next(),s>=0&&i<u){var a=n;if(s>4)for(var h=l.pos-(s-4);l.pos>h;)n=k(t,e,n);e[--n]=a,e[--n]=o-t,e[--n]=r-t,e[--n]=i}else-3==s?f=i:-4==s&&(d=i);return n}for(var w=[],b=[];l.pos>0;)g(t.start||0,t.bufferStart||0,w,b,-1,0);var M=null!==(e=t.length)&&void 0!==e?e:w.length?b[0]+w[0].length:0;return new x(c[t.topID],w.reverse(),b.reverse(),M)}var V=new WeakMap;function H(t,e){if(!t.isAnonymous||e instanceof A||e.type!=t)return 1;var n=V.get(e);if(null==n){n=1;var i,r=(0,u.Z)(e.children);try{for(r.s();!(i=r.n()).done;){var o=i.value;if(o.type!=t||!(o instanceof x)){n=1;break}n+=H(t,o)}}catch(s){r.e(s)}finally{r.f()}V.set(e,n)}return n}function W(t,e,n,i,r,o,s,a,h){for(var u=0,l=i;l<r;l++)u+=H(t,e[l]);var c=Math.ceil(1.5*u/8),f=[],d=[];return function e(n,i,r,s,a){for(var u=r;u<s;){var l=u,v=i[u],g=H(t,n[u]);for(u++;u<s;u++){var p=H(t,n[u]);if(g+p>=c)break;g+=p}if(u==l+1){if(g>c){var m=n[l];e(m.children,m.positions,0,m.children.length,i[l]+a);continue}f.push(n[l])}else{var y=i[u-1]+n[u-1].length-v;f.push(W(t,n,i,l,u,v,y,null,h))}d.push(v+a-o)}}(e,n,i,r,0),(a||h)(f,d,s)}var _=function(){function t(e,n,i,r){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];(0,l.Z)(this,t),this.from=e,this.to=n,this.tree=i,this.offset=r,this.open=(o?1:0)|(s?2:0)}return(0,c.Z)(t,[{key:"openStart",get:function(){return(1&this.open)>0}},{key:"openEnd",get:function(){return(2&this.open)>0}}],[{key:"addTree",value:function(e){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=[new t(0,e.length,e,0,!1,r)],s=(0,u.Z)(i);try{for(s.s();!(n=s.n()).done;){var a=n.value;a.to>e.length&&o.push(a)}}catch(h){s.e(h)}finally{s.f()}return o}},{key:"applyChanges",value:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:128;if(!n.length)return e;for(var r=[],o=1,s=e.length?e[0]:null,a=0,h=0,u=0;;a++){var l=a<n.length?n[a]:null,c=l?l.fromA:1e9;if(c-h>=i)for(;s&&s.from<c;){var f=s;if(h>=f.from||c<=f.to||u){var d=Math.max(f.from,h)-u,v=Math.min(f.to,c)-u;f=d>=v?null:new t(d,v,f.tree,f.offset+u,a>0,!!l)}if(f&&r.push(f),s.to>c)break;s=o<e.length?e[o++]:null}if(!l)break;h=l.toA,u=l.toA-l.toB}return r}}]),t}(),z=function(){function t(){(0,l.Z)(this,t)}return(0,c.Z)(t,[{key:"startParse",value:function(t,e,n){return"string"==typeof t&&(t=new F(t)),n=n?n.length?n.map((function(t){return new d(t.from,t.to)})):[new d(0,0)]:[new d(0,t.length)],this.createParse(t,e||[],n)}},{key:"parse",value:function(t,e,n){for(var i=this.startParse(t,e,n);;){var r=i.advance();if(r)return r}}}]),t}(),F=function(){function t(e){(0,l.Z)(this,t),this.string=e}return(0,c.Z)(t,[{key:"length",get:function(){return this.string.length}},{key:"chunk",value:function(t){return this.string.slice(t)}},{key:"lineChunks",get:function(){return!1}},{key:"read",value:function(t,e){return this.string.slice(t,e)}}]),t}();new v({perNode:!0});var q=n(34541),j=n(47838),K=(n(57778),n(34997),n(12148),n(94738),n(98214),n(20254),n(27392),n(54299),n(80641),n(37313),n(49089),n(87438),n(22890),n(65974),n(50289),n(94167),n(86439),n(78399),n(56086),n(47884),n(81912),n(64584),n(41483),n(12367),n(9454),function(){function t(){(0,l.Z)(this,t)}return(0,c.Z)(t,[{key:"lineAt",value:function(t){if(t<0||t>this.length)throw new RangeError("Invalid position ".concat(t," in document of length ").concat(this.length));return this.lineInner(t,!1,1,0)}},{key:"line",value:function(t){if(t<1||t>this.lines)throw new RangeError("Invalid line number ".concat(t," in ").concat(this.lines,"-line document"));return this.lineInner(t,!0,1,0)}},{key:"replace",value:function(t,e,n){var i=[];return this.decompose(0,t,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(e,this.length,i,1),U.from(i,this.length-(e-t)+n.length)}},{key:"append",value:function(t){return this.replace(this.length,this.length,t)}},{key:"slice",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=[];return this.decompose(t,e,n,0),U.from(n,e-t)}},{key:"eq",value:function(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;for(var e=this.scanIdentical(t,1),n=this.length-this.scanIdentical(t,-1),i=new X(this),r=new X(t),o=e,s=e;;){if(i.next(o),r.next(o),o=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}},{key:"iter",value:function(){return new X(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)}},{key:"iterRange",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return new Y(this,t,e)}},{key:"iterLines",value:function(t,e){var n;if(null==t)n=this.iter();else{null==e&&(e=this.lines+1);var i=this.line(t).from;n=this.iterRange(i,Math.max(i,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new Q(n)}},{key:"toString",value:function(){return this.sliceString(0)}},{key:"toJSON",value:function(){var t=[];return this.flatten(t),t}}],[{key:"of",value:function(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new J(e):U.from(J.split(e,[])):t.empty}}]),t}()),J=function(t){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){var e,n=-1,i=(0,u.Z)(t);try{for(i.s();!(e=i.n()).done;){n+=e.value.length+1}}catch(r){i.e(r)}finally{i.f()}return n}(t);return(0,l.Z)(this,e),(n=(0,a.Z)(this,e)).text=t,n.length=i,n}return(0,h.Z)(e,t),(0,c.Z)(e,[{key:"lines",get:function(){return this.text.length}},{key:"children",get:function(){return null}},{key:"lineInner",value:function(t,e,n,i){for(var r=0;;r++){var o=this.text[r],s=i+o.length;if((e?n:s)>=t)return new tt(i,s,n,o);i=s+1,n++}}},{key:"decompose",value:function(t,n,i,r){var o=t<=0&&n>=this.length?this:new e($(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(1&r){var s=i.pop(),a=G(o.text,s.text.slice(),0,o.length);if(a.length<=32)i.push(new e(a,s.length+o.length));else{var h=a.length>>1;i.push(new e(a.slice(0,h)),new e(a.slice(h)))}}else i.push(o)}},{key:"replace",value:function(t,n,i){if(!(i instanceof e))return(0,q.Z)((0,j.Z)(e.prototype),"replace",this).call(this,t,n,i);var r=G(this.text,G(i.text,$(this.text,0,t)),n),o=this.length+i.length-(n-t);return r.length<=32?new e(r,o):U.from(e.split(r,[]),o)}},{key:"sliceString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",i="",r=0,o=0;r<=e&&o<this.text.length;o++){var s=this.text[o],a=r+s.length;r>t&&o&&(i+=n),t<a&&e>r&&(i+=s.slice(Math.max(0,t-r),e-r)),r=a+1}return i}},{key:"flatten",value:function(t){var e,n=(0,u.Z)(this.text);try{for(n.s();!(e=n.n()).done;){var i=e.value;t.push(i)}}catch(r){n.e(r)}finally{n.f()}}},{key:"scanIdentical",value:function(){return 0}}],[{key:"split",value:function(t,n){var i,r=[],o=-1,s=(0,u.Z)(t);try{for(s.s();!(i=s.n()).done;){var a=i.value;r.push(a),o+=a.length+1,32==r.length&&(n.push(new e(r,o)),r=[],o=-1)}}catch(h){s.e(h)}finally{s.f()}return o>-1&&n.push(new e(r,o)),n}}]),e}(K),U=function(t){function e(t,n){var i;(0,l.Z)(this,e),(i=(0,a.Z)(this,e)).children=t,i.length=n,i.lines=0;var r,o=(0,u.Z)(t);try{for(o.s();!(r=o.n()).done;){var s=r.value;i.lines+=s.lines}}catch(h){o.e(h)}finally{o.f()}return i}return(0,h.Z)(e,t),(0,c.Z)(e,[{key:"lineInner",value:function(t,e,n,i){for(var r=0;;r++){var o=this.children[r],s=i+o.length,a=n+o.lines-1;if((e?a:s)>=t)return o.lineInner(t,e,n,i);i=s+1,n=a+1}}},{key:"decompose",value:function(t,e,n,i){for(var r=0,o=0;o<=e&&r<this.children.length;r++){var s=this.children[r],a=o+s.length;if(t<=a&&e>=o){var h=i&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?n.push(s):s.decompose(t-o,e-o,n,h)}o=a+1}}},{key:"replace",value:function(t,n,i){if(i.lines<this.lines)for(var r=0,o=0;r<this.children.length;r++){var s=this.children[r],a=o+s.length;if(t>=o&&n<=a){var h=s.replace(t-o,n-o,i),u=this.lines-s.lines+h.lines;if(h.lines<u>>4&&h.lines>u>>6){var l=this.children.slice();return l[r]=h,new e(l,this.length-(n-t)+i.length)}return(0,q.Z)((0,j.Z)(e.prototype),"replace",this).call(this,o,a,h)}o=a+1}return(0,q.Z)((0,j.Z)(e.prototype),"replace",this).call(this,t,n,i)}},{key:"sliceString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",i="",r=0,o=0;r<this.children.length&&o<=e;r++){var s=this.children[r],a=o+s.length;o>t&&r&&(i+=n),t<a&&e>o&&(i+=s.sliceString(t-o,e-o,n)),o=a+1}return i}},{key:"flatten",value:function(t){var e,n=(0,u.Z)(this.children);try{for(n.s();!(e=n.n()).done;){e.value.flatten(t)}}catch(i){n.e(i)}finally{n.f()}}},{key:"scanIdentical",value:function(t,n){if(!(t instanceof e))return 0;for(var i=0,o=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1],s=(0,r.Z)(o,4),a=s[0],h=s[1],u=s[2],l=s[3];;a+=n,h+=n){if(a==u||h==l)return i;var c=this.children[a],f=t.children[h];if(c!=f)return i+c.scanIdentical(f,n);i+=c.length+1}}}],[{key:"from",value:function(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.reduce((function(t,e){return t+e.length+1}),-1),r=0,o=(0,u.Z)(t);try{for(o.s();!(n=o.n()).done;){r+=n.value.lines}}catch(b){o.e(b)}finally{o.f()}if(r<32){var s,a=[],h=(0,u.Z)(t);try{for(h.s();!(s=h.n()).done;){s.value.flatten(a)}}catch(b){h.e(b)}finally{h.f()}return new J(a,i)}var l=Math.max(32,r>>5),c=l<<1,f=l>>1,d=[],v=0,g=-1,p=[];function m(t){var n;if(t.lines>c&&t instanceof e){var i,r=(0,u.Z)(t.children);try{for(r.s();!(i=r.n()).done;){m(i.value)}}catch(b){r.e(b)}finally{r.f()}}else t.lines>f&&(v>f||!v)?(y(),d.push(t)):t instanceof J&&v&&(n=p[p.length-1])instanceof J&&t.lines+n.lines<=32?(v+=t.lines,g+=t.length+1,p[p.length-1]=new J(n.text.concat(t.text),n.length+1+t.length)):(v+t.lines>l&&y(),v+=t.lines,g+=t.length+1,p.push(t))}function y(){0!=v&&(d.push(1==p.length?p[0]:e.from(p,g)),g=-1,v=p.length=0)}var k,w=(0,u.Z)(t);try{for(w.s();!(k=w.n()).done;){m(k.value)}}catch(b){w.e(b)}finally{w.f()}return y(),1==d.length?d[0]:new e(d,i)}}]),e}(K);function G(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e9,r=0,o=0,s=!0;o<t.length&&r<=i;o++){var a=t[o],h=r+a.length;h>=n&&(h>i&&(a=a.slice(0,i-r)),r<n&&(a=a.slice(n-r)),s?(e[e.length-1]+=a,s=!1):e.push(a)),r=h+1}return e}function $(t,e,n){return G(t,[""],e,n)}K.empty=new J([""],0);var X=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;(0,l.Z)(this,t),this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof J?e.text.length:e.children.length)<<1]}return(0,c.Z)(t,[{key:"nextInner",value:function(t,e){for(this.done=this.lineBreak=!1;;){var n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],o=r>>1,s=i instanceof J?i.text.length:i.children.length;if(o==(e>0?s:0)){if(0==n)return this.done=!0,this.value="",this;e>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(e>0?0:1)){if(this.offsets[n]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(i instanceof J){var a=i.text[o+(e<0?-1:0)];if(this.offsets[n]+=e,a.length>Math.max(0,t))return this.value=0==t?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{var h=i.children[o+(e<0?-1:0)];t>h.length?(t-=h.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(h),this.offsets.push(e>0?1:(h instanceof J?h.text.length:h.children.length)<<1))}}}},{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}]),t}(),Y=function(){function t(e,n,i){(0,l.Z)(this,t),this.value="",this.done=!1,this.cursor=new X(e,n>i?-1:1),this.pos=n>i?e.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}return(0,c.Z)(t,[{key:"nextInner",value:function(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 n=e<0?this.pos-this.from:this.to-this.pos;t>n&&(t=n),n-=t;var i=this.cursor.next(t).value;return this.pos+=(i.length+t)*e,this.value=i.length<=n?i:e<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}},{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?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(){return this.cursor.lineBreak&&""!=this.value}}]),t}(),Q=function(){function t(e){(0,l.Z)(this,t),this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}return(0,c.Z)(t,[{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.inner.next(t),n=e.done,i=e.lineBreak,r=e.value;return n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}},{key:"lineBreak",get:function(){return!1}}]),t}();"undefined"!=typeof Symbol&&(K.prototype[Symbol.iterator]=function(){return this.iter()},X.prototype[Symbol.iterator]=Y.prototype[Symbol.iterator]=Q.prototype[Symbol.iterator]=function(){return this});for(var tt=function(){function t(e,n,i,r){(0,l.Z)(this,t),this.from=e,this.to=n,this.number=i,this.text=r}return(0,c.Z)(t,[{key:"length",get:function(){return this.to-this.from}}]),t}(),et="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})),nt=1;nt<et.length;nt++)et[nt]+=et[nt-1];function it(t){for(var e=1;e<et.length;e+=2)if(et[e]>t)return et[e-1]<=t;return!1}function rt(t){return t>=127462&&t<=127487}var ot=8205;function st(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?at:ht)(t,e,!(arguments.length>3&&void 0!==arguments[3])||arguments[3])}function at(t,e,n){if(e==t.length)return e;e&&ut(t.charCodeAt(e))&&lt(t.charCodeAt(e-1))&&e--;var i=ct(t,e);for(e+=ft(i);e<t.length;){var r=ct(t,e);if(i==ot||r==ot||n&&it(r))e+=ft(r),i=r;else{if(!rt(r))break;for(var o=0,s=e-2;s>=0&&rt(ct(t,s));)o++,s-=2;if(o%2==0)break;e+=2}}return e}function ht(t,e,n){for(;e>0;){var i=at(t,e-2,n);if(i<e)return i;e--}return 0}function ut(t){return t>=56320&&t<57344}function lt(t){return t>=55296&&t<56320}function ct(t,e){var n=t.charCodeAt(e);if(!lt(n)||e+1==t.length)return n;var i=t.charCodeAt(e+1);return ut(i)?i-56320+(n-55296<<10)+65536:n}function ft(t){return t<65536?1:2}var dt=/\r\n?|\n/,vt=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(vt||(vt={})),gt=function(){function t(e){(0,l.Z)(this,t),this.sections=e}return(0,c.Z)(t,[{key:"length",get:function(){for(var t=0,e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}},{key:"newLength",get:function(){for(var t=0,e=0;e<this.sections.length;e+=2){var n=this.sections[e+1];t+=n<0?this.sections[e]:n}return t}},{key:"empty",get:function(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}},{key:"iterGaps",value:function(t){for(var e=0,n=0,i=0;e<this.sections.length;){var r=this.sections[e++],o=this.sections[e++];o<0?(t(n,i,r),i+=r):i+=o,n+=r}}},{key:"iterChangedRanges",value:function(t){kt(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"invertedDesc",get:function(){for(var e=[],n=0;n<this.sections.length;){var i=this.sections[n++],r=this.sections[n++];r<0?e.push(i,r):e.push(r,i)}return new t(e)}},{key:"composeDesc",value:function(t){return this.empty?t:t.empty?this:bt(this,t)}},{key:"mapDesc",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:wt(this,t,e)}},{key:"mapPos",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:vt.Simple,i=0,r=0,o=0;o<this.sections.length;){var s=this.sections[o++],a=this.sections[o++],h=i+s;if(a<0){if(h>t)return r+(t-i);r+=s}else{if(n!=vt.Simple&&h>=t&&(n==vt.TrackDel&&i<t&&h>t||n==vt.TrackBefore&&i<t||n==vt.TrackAfter&&h>t))return null;if(h>t||h==t&&e<0&&!s)return t==i||e<0?r:r+a;r+=a}i=h}if(t>i)throw new RangeError("Position ".concat(t," is out of range for changeset of length ").concat(i));return r}},{key:"touchesRange",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=0,i=0;n<this.sections.length&&i<=e;){var r=i+this.sections[n++];if(this.sections[n++]>=0&&i<=e&&r>=t)return!(i<t&&r>e)||"cover";i=r}return!1}},{key:"toString",value:function(){for(var t="",e=0;e<this.sections.length;){var n=this.sections[e++],i=this.sections[e++];t+=(t?" ":"")+n+(i>=0?":"+i:"")}return t}},{key:"toJSON",value:function(){return this.sections}}],[{key:"fromJSON",value:function(e){if(!Array.isArray(e)||e.length%2||e.some((function(t){return"number"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}},{key:"create",value:function(e){return new t(e)}}]),t}(),pt=function(t){function e(t,n){var i;return(0,l.Z)(this,e),(i=(0,a.Z)(this,e,[t])).inserted=n,i}return(0,h.Z)(e,t),(0,c.Z)(e,[{key:"apply",value:function(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return kt(this,(function(e,n,i,r,o){return t=t.replace(i,i+(n-e),o)}),!1),t}},{key:"mapDesc",value:function(t){return wt(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"invert",value:function(t){for(var n=this.sections.slice(),i=[],r=0,o=0;r<n.length;r+=2){var s=n[r],a=n[r+1];if(a>=0){n[r]=a,n[r+1]=s;for(var h=r>>1;i.length<h;)i.push(K.empty);i.push(s?t.slice(o,o+s):K.empty)}o+=s}return new e(n,i)}},{key:"compose",value:function(t){return this.empty?t:t.empty?this:bt(this,t,!0)}},{key:"map",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:wt(this,t,e,!0)}},{key:"iterChanges",value:function(t){kt(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"desc",get:function(){return gt.create(this.sections)}},{key:"filter",value:function(t){var n=[],i=[],r=[],o=new xt(this);t:for(var s=0,a=0;;){for(var h=s==t.length?1e9:t[s++];a<h||a==h&&0==o.len;){if(o.done)break t;var u=Math.min(o.len,h-a);mt(r,u,-1);var l=-1==o.ins?-1:0==o.off?o.ins:0;mt(n,u,l),l>0&&yt(i,n,o.text),o.forward(u),a+=u}for(var c=t[s++];a<c;){if(o.done)break t;var f=Math.min(o.len,c-a);mt(n,f,-1),mt(r,f,-1==o.ins?-1:0==o.off?o.ins:0),o.forward(f),a+=f}}return{changes:new e(n,i),filtered:gt.create(r)}}},{key:"toJSON",value:function(){for(var t=[],e=0;e<this.sections.length;e+=2){var n=this.sections[e],i=this.sections[e+1];i<0?t.push(n):0==i?t.push([n]):t.push([n].concat(this.inserted[e>>1].toJSON()))}return t}}],[{key:"of",value:function(t,n,i){var r=[],o=[],s=0,a=null;function h(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||r.length){s<n&&mt(r,n-s,-1);var t=new e(r,o);a=a?a.compose(t.map(a)):t,r=[],o=[],s=0}}return function t(l){if(Array.isArray(l)){var c,f=(0,u.Z)(l);try{for(f.s();!(c=f.n()).done;){t(c.value)}}catch(k){f.e(k)}finally{f.f()}}else if(l instanceof e){if(l.length!=n)throw new RangeError("Mismatched change set length (got ".concat(l.length,", expected ").concat(n,")"));h(),a=a?a.compose(l.map(a)):l}else{var d=l.from,v=l.to,g=void 0===v?d:v,p=l.insert;if(d>g||d<0||g>n)throw new RangeError("Invalid change range ".concat(d," to ").concat(g," (in doc of length ").concat(n,")"));var m=p?"string"==typeof p?K.of(p.split(i||dt)):p:K.empty,y=m.length;if(d==g&&0==y)return;d<s&&h(),d>s&&mt(r,d-s,-1),mt(r,g-d,y),yt(o,r,m),s=g}}(t),h(!a),a}},{key:"empty",value:function(t){return new e(t?[t,-1]:[],[])}},{key:"fromJSON",value:function(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");for(var n=[],i=[],r=0;r<t.length;r++){var o=t[r];if("number"==typeof o)n.push(o,-1);else{if(!Array.isArray(o)||"number"!=typeof o[0]||o.some((function(t,e){return e&&"string"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==o.length)n.push(o[0],0);else{for(;i.length<r;)i.push(K.empty);i[r]=K.of(o.slice(1)),n.push(o[0],i[r].length)}}}return new e(n,i)}},{key:"createSet",value:function(t,n){return new e(t,n)}}]),e}(gt);function mt(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!(0==e&&n<=0)){var r=t.length-2;r>=0&&n<=0&&n==t[r+1]?t[r]+=e:0==e&&0==t[r]?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}}function yt(t,e,n){if(0!=n.length){var i=e.length-2>>1;if(i<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<i;)t.push(K.empty);t.push(n)}}}function kt(t,e,n){for(var i=t.inserted,r=0,o=0,s=0;s<t.sections.length;){var a=t.sections[s++],h=t.sections[s++];if(h<0)r+=a,o+=a;else{for(var u=r,l=o,c=K.empty;u+=a,l+=h,h&&i&&(c=c.append(i[s-2>>1])),!(n||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],h=t.sections[s++];e(r,u,o,l,c),r=u,o=l}}}function wt(t,e,n){for(var i=[],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3]?[]:null,o=new xt(t),s=new xt(e),a=-1;;)if(-1==o.ins&&-1==s.ins){var h=Math.min(o.len,s.len);mt(i,h,-1),o.forward(h),s.forward(h)}else if(s.ins>=0&&(o.ins<0||a==o.i||0==o.off&&(s.len<o.len||s.len==o.len&&!n))){var u=s.len;for(mt(i,s.ins,-1);u;){var l=Math.min(o.len,u);o.ins>=0&&a<o.i&&o.len<=l&&(mt(i,0,o.ins),r&&yt(r,i,o.text),a=o.i),o.forward(l),u-=l}s.next()}else{if(!(o.ins>=0)){if(o.done&&s.done)return r?pt.createSet(i,r):gt.create(i);throw new Error("Mismatched change set lengths")}for(var c=0,f=o.len;f;)if(-1==s.ins){var d=Math.min(f,s.len);c+=d,f-=d,s.forward(d)}else{if(!(0==s.ins&&s.len<f))break;f-=s.len,s.next()}mt(i,c,a<o.i?o.ins:0),r&&a<o.i&&yt(r,i,o.text),a=o.i,o.forward(o.len-f)}}function bt(t,e){for(var n=[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2]?[]:null,r=new xt(t),o=new xt(e),s=!1;;){if(r.done&&o.done)return i?pt.createSet(n,i):gt.create(n);if(0==r.ins)mt(n,r.len,0,s),r.next();else if(0!=o.len||o.done){if(r.done||o.done)throw new Error("Mismatched change set lengths");var a=Math.min(r.len2,o.len),h=n.length;if(-1==r.ins){var u=-1==o.ins?-1:o.off?0:o.ins;mt(n,a,u,s),i&&u&&yt(i,n,o.text)}else-1==o.ins?(mt(n,r.off?0:r.len,a,s),i&&yt(i,n,r.textBit(a))):(mt(n,r.off?0:r.len,o.off?0:o.ins,s),i&&!o.off&&yt(i,n,o.text));s=(r.ins>a||o.ins>=0&&o.len>a)&&(s||n.length>h),r.forward2(a),o.forward(a)}else mt(n,0,o.ins,s),i&&yt(i,n,o.text),o.next()}}var xt=function(){function t(e){(0,l.Z)(this,t),this.set=e,this.i=0,this.next()}return(0,c.Z)(t,[{key:"next",value:function(){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(){return-2==this.ins}},{key:"len2",get:function(){return this.ins<0?this.len:this.ins}},{key:"text",get:function(){var t=this.set.inserted,e=this.i-2>>1;return e>=t.length?K.empty:t[e]}},{key:"textBit",value:function(t){var e=this.set.inserted,n=this.i-2>>1;return n>=e.length&&!t?K.empty:e[n].slice(this.off,null==t?void 0:this.off+t)}},{key:"forward",value:function(t){t==this.len?this.next():(this.len-=t,this.off+=t)}},{key:"forward2",value:function(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}]),t}(),St=function(){function t(e,n,i){(0,l.Z)(this,t),this.from=e,this.to=n,this.flags=i}return(0,c.Z)(t,[{key:"anchor",get:function(){return 16&this.flags?this.to:this.from}},{key:"head",get:function(){return 16&this.flags?this.from:this.to}},{key:"empty",get:function(){return this.from==this.to}},{key:"assoc",get:function(){return 4&this.flags?-1:8&this.flags?1:0}},{key:"bidiLevel",get:function(){var t=3&this.flags;return 3==t?null:t}},{key:"goalColumn",get:function(){var t=this.flags>>5;return 33554431==t?void 0:t}},{key:"map",value:function(e){var n,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return this.empty?n=i=e.mapPos(this.from,r):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new t(n,i,this.flags)}},{key:"extend",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(t<=this.anchor&&e>=this.anchor)return At.range(t,e);var n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return At.range(this.anchor,n)}},{key:"eq",value:function(t){return this.anchor==t.anchor&&this.head==t.head}},{key:"toJSON",value:function(){return{anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return At.range(t.anchor,t.head)}},{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}(),At=function(){function t(e,n){(0,l.Z)(this,t),this.ranges=e,this.mainIndex=n}return(0,c.Z)(t,[{key:"map",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return e.empty?this:t.create(this.ranges.map((function(t){return t.map(e,n)})),this.mainIndex)}},{key:"eq",value:function(t){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].eq(t.ranges[e]))return!1;return!0}},{key:"main",get:function(){return this.ranges[this.mainIndex]}},{key:"asSingle",value:function(){return 1==this.ranges.length?this:new t([this.main],0)}},{key:"addRange",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.create([e].concat(this.ranges),n?0:this.mainIndex+1)}},{key:"replaceRange",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.mainIndex,i=this.ranges.slice();return i[n]=e,t.create(i,this.mainIndex)}},{key:"toJSON",value:function(){return{ranges:this.ranges.map((function(t){return t.toJSON()})),main:this.mainIndex}}}],[{key:"fromJSON",value:function(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t(e.ranges.map((function(t){return St.fromJSON(t)})),e.main)}},{key:"single",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return new t([t.range(e,n)],0)}},{key:"create",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0==e.length)throw new RangeError("A selection needs at least one range");for(var i=0,r=0;r<e.length;r++){var o=e[r];if(o.empty?o.from<=i:o.from<i)return t.normalized(e.slice(),n);i=o.to}return new t(e,n)}},{key:"cursor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;return St.create(t,t,(0==e?0:e<0?4:8)|(null==n?3:Math.min(2,n))|(null!=i?i:33554431)<<5)}},{key:"range",value:function(t,e,n,i){var r=(null!=n?n:33554431)<<5|(null==i?3:Math.min(2,i));return e<t?St.create(e,t,24|r):St.create(t,e,(e>t?4:0)|r)}},{key:"normalized",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e[n];e.sort((function(t,e){return t.from-e.from})),n=e.indexOf(i);for(var r=1;r<e.length;r++){var o=e[r],s=e[r-1];if(o.empty?o.from<=s.to:o.from<s.to){var a=s.from,h=Math.max(o.to,s.to);r<=n&&n--,e.splice(--r,2,o.anchor>o.head?t.range(h,a):t.range(a,h))}}return new t(e,n)}}]),t}();function Mt(t,e){var n,i=(0,u.Z)(t.ranges);try{for(i.s();!(n=i.n()).done;){if(n.value.to>e)throw new RangeError("Selection points outside of document")}}catch(r){i.e(r)}finally{i.f()}}var Zt=0,Ct=function(){function t(e,n,i,r,o){(0,l.Z)(this,t),this.combine=e,this.compareInput=n,this.compare=i,this.isStatic=r,this.id=Zt++,this.default=e([]),this.extensions="function"==typeof o?o(this):o}return(0,c.Z)(t,[{key:"of",value:function(t){return new Tt([],this,0,t)}},{key:"compute",value:function(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Tt(t,this,1,e)}},{key:"computeN",value:function(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Tt(t,this,2,e)}},{key:"from",value:function(t,e){return e||(e=function(t){return t}),this.compute([t],(function(n){return e(n.field(t))}))}}],[{key:"define",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new t(e.combine||function(t){return t},e.compareInput||function(t,e){return t===e},e.compare||(e.combine?function(t,e){return t===e}:Ot),!!e.static,e.enables)}}]),t}();function Ot(t,e){return t==e||t.length==e.length&&t.every((function(t,n){return t===e[n]}))}var Tt=function(){function t(e,n,i,r){(0,l.Z)(this,t),this.dependencies=e,this.facet=n,this.type=i,this.value=r,this.id=Zt++}return(0,c.Z)(t,[{key:"dynamicSlot",value:function(t){var e,n,i=this,r=this.value,o=this.facet.compareInput,s=this.id,a=t[s]>>1,h=2==this.type,l=!1,c=!1,f=[],d=(0,u.Z)(this.dependencies);try{for(d.s();!(n=d.n()).done;){var v=n.value;"doc"==v?l=!0:"selection"==v?c=!0:0==(1&(null!==(e=t[v.id])&&void 0!==e?e:1))&&f.push(t[v.id])}}catch(g){d.e(g)}finally{d.f()}return{create:function(t){return t.values[a]=r(t),1},update:function(t,e){if(l&&e.docChanged||c&&(e.docChanged||e.selection)||Et(t,f)){var n=r(t);if(h?!Dt(n,t.values[a],o):!o(n,t.values[a]))return t.values[a]=n,1}return 0},reconfigure:function(t,e){var n,u=e.config.address[s];if(null!=u){var l=jt(e,u);if(i.dependencies.every((function(n){return n instanceof Ct?e.facet(n)===t.facet(n):!(n instanceof Rt)||e.field(n,!1)==t.field(n,!1)}))||(h?Dt(n=r(t),l,o):o(n=r(t),l)))return t.values[a]=l,0}else n=r(t);return t.values[a]=n,1}}}}]),t}();function Dt(t,e,n){if(t.length!=e.length)return!1;for(var i=0;i<t.length;i++)if(!n(t[i],e[i]))return!1;return!0}function Et(t,e){var n,i=!1,r=(0,u.Z)(e);try{for(r.s();!(n=r.n()).done;){1&qt(t,n.value)&&(i=!0)}}catch(o){r.e(o)}finally{r.f()}return i}var Bt=Ct.define({static:!0}),Rt=function(){function t(e,n,i,r,o){(0,l.Z)(this,t),this.id=e,this.createF=n,this.updateF=i,this.compareF=r,this.spec=o,this.provides=void 0}return(0,c.Z)(t,[{key:"create",value:function(t){var e=this,n=t.facet(Bt).find((function(t){return t.field==e}));return((null==n?void 0:n.create)||this.createF)(t)}},{key:"slot",value:function(t){var e=this,n=t[this.id]>>1;return{create:function(t){return t.values[n]=e.create(t),1},update:function(t,i){var r=t.values[n],o=e.updateF(r,i);return e.compareF(r,o)?0:(t.values[n]=o,1)},reconfigure:function(t,i){return null!=i.config.address[e.id]?(t.values[n]=i.field(e),0):(t.values[n]=e.create(t),1)}}}},{key:"init",value:function(t){return[this,Bt.of({field:this,create:t})]}},{key:"extension",get:function(){return this}}],[{key:"define",value:function(e){var n=new t(Zt++,e.create,e.update,e.compare||function(t,e){return t===e},e);return e.provide&&(n.provides=e.provide(n)),n}}]),t}(),It=4,Pt=3,Nt=2,Lt=1;function Vt(t){return function(e){return new Wt(e,t)}}var Ht={highest:Vt(0),high:Vt(Lt),default:Vt(Nt),low:Vt(Pt),lowest:Vt(It)},Wt=(0,c.Z)((function t(e,n){(0,l.Z)(this,t),this.inner=e,this.prec=n})),_t=function(){function t(){(0,l.Z)(this,t)}return(0,c.Z)(t,[{key:"of",value:function(t){return new zt(this,t)}},{key:"reconfigure",value:function(e){return t.reconfigure.of({compartment:this,extension:e})}},{key:"get",value:function(t){return t.config.compartments.get(this)}}]),t}(),zt=(0,c.Z)((function t(e,n){(0,l.Z)(this,t),this.compartment=e,this.inner=n})),Ft=function(){function t(e,n,i,r,o,s){for((0,l.Z)(this,t),this.base=e,this.compartments=n,this.dynamicSlots=i,this.address=r,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}return(0,c.Z)(t,[{key:"staticFacet",value:function(t){var e=this.address[t.id];return null==e?t.default:this.staticValues[e>>1]}}],[{key:"resolve",value:function(e,n,i){var r,o=[],s=Object.create(null),a=new Map,h=(0,u.Z)(function(t,e,n){var i=[[],[],[],[],[]],r=new Map;function o(t,s){var a=r.get(t);if(null!=a){if(a<=s)return;var h=i[a].indexOf(t);h>-1&&i[a].splice(h,1),t instanceof zt&&n.delete(t.compartment)}if(r.set(t,s),Array.isArray(t)){var l,c=(0,u.Z)(t);try{for(c.s();!(l=c.n()).done;){o(l.value,s)}}catch(v){c.e(v)}finally{c.f()}}else if(t instanceof zt){if(n.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");var f=e.get(t.compartment)||t.inner;n.set(t.compartment,f),o(f,s)}else if(t instanceof Wt)o(t.inner,t.prec);else if(t instanceof Rt)i[s].push(t),t.provides&&o(t.provides,s);else if(t instanceof Tt)i[s].push(t),t.facet.extensions&&o(t.facet.extensions,Nt);else{var d=t.extension;if(!d)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."));o(d,s)}}return o(t,Nt),i.reduce((function(t,e){return t.concat(e)}))}(e,n,a));try{for(h.s();!(r=h.n()).done;){var l=r.value;l instanceof Rt?o.push(l):(s[l.facet.id]||(s[l.facet.id]=[])).push(l)}}catch(w){h.e(w)}finally{h.f()}for(var c=Object.create(null),f=[],d=[],v=function(){var t=p[g];c[t.id]=d.length<<1,d.push((function(e){return t.slot(e)}))},g=0,p=o;g<p.length;g++)v();var m=null==i?void 0:i.config.facets,y=function(){var t=s[k],e=t[0].facet,n=m&&m[k]||[];if(t.every((function(t){return 0==t.type})))if(c[e.id]=f.length<<1|1,Ot(n,t))f.push(i.facet(e));else{var r=e.combine(t.map((function(t){return t.value})));f.push(i&&e.compare(r,i.facet(e))?i.facet(e):r)}else{var o,a=(0,u.Z)(t);try{var h=function(){var t=o.value;0==t.type?(c[t.id]=f.length<<1|1,f.push(t.value)):(c[t.id]=d.length<<1,d.push((function(e){return t.dynamicSlot(e)})))};for(a.s();!(o=a.n()).done;)h()}catch(w){a.e(w)}finally{a.f()}c[e.id]=d.length<<1,d.push((function(n){return function(t,e,n){var i=n.map((function(e){return t[e.id]})),r=n.map((function(t){return t.type})),o=i.filter((function(t){return!(1&t)})),s=t[e.id]>>1;function a(t){for(var n=[],o=0;o<i.length;o++){var s=jt(t,i[o]);if(2==r[o]){var a,h=(0,u.Z)(s);try{for(h.s();!(a=h.n()).done;){var l=a.value;n.push(l)}}catch(w){h.e(w)}finally{h.f()}}else n.push(s)}return e.combine(n)}return{create:function(t){var e,n=(0,u.Z)(i);try{for(n.s();!(e=n.n()).done;)qt(t,e.value)}catch(w){n.e(w)}finally{n.f()}return t.values[s]=a(t),1},update:function(t,n){if(!Et(t,o))return 0;var i=a(t);return e.compare(i,t.values[s])?0:(t.values[s]=i,1)},reconfigure:function(t,r){var o=Et(t,i),h=r.config.facets[e.id],u=r.facet(e);if(h&&!o&&Ot(n,h))return t.values[s]=u,0;var l=a(t);return e.compare(l,u)?(t.values[s]=u,0):(t.values[s]=l,1)}}}(n,e,t)}))}};for(var k in s)y();return new t(e,a,d.map((function(t){return t(c)})),c,f,s)}}]),t}();function qt(t,e){if(1&e)return 2;var n=e>>1,i=t.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;t.status[n]=4;var r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function jt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}var Kt=Ct.define(),Jt=Ct.define({combine:function(t){return t.some((function(t){return t}))},static:!0}),Ut=Ct.define({combine:function(t){return t.length?t[0]:void 0},static:!0}),Gt=Ct.define(),$t=Ct.define(),Xt=Ct.define(),Yt=Ct.define({combine:function(t){return!!t.length&&t[0]}}),Qt=function(){function t(e,n){(0,l.Z)(this,t),this.type=e,this.value=n}return(0,c.Z)(t,null,[{key:"define",value:function(){return new te}}]),t}(),te=function(){function t(){(0,l.Z)(this,t)}return(0,c.Z)(t,[{key:"of",value:function(t){return new Qt(this,t)}}]),t}(),ee=function(){function t(e){(0,l.Z)(this,t),this.map=e}return(0,c.Z)(t,[{key:"of",value:function(t){return new ne(this,t)}}]),t}(),ne=function(){function t(e,n){(0,l.Z)(this,t),this.type=e,this.value=n}return(0,c.Z)(t,[{key:"map",value:function(e){var n=this.type.map(this.value,e);return void 0===n?void 0:n==this.value?this:new t(this.type,n)}},{key:"is",value:function(t){return this.type==t}}],[{key:"define",value:function(){return new ee((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).map||function(t){return t})}},{key:"mapEffects",value:function(t,e){if(!t.length)return t;var n,i=[],r=(0,u.Z)(t);try{for(r.s();!(n=r.n()).done;){var o=n.value.map(e);o&&i.push(o)}}catch(s){r.e(s)}finally{r.f()}return i}}]),t}();ne.reconfigure=ne.define(),ne.appendConfig=ne.define();var ie=function(){function t(e,n,i,r,o,s){(0,l.Z)(this,t),this.startState=e,this.changes=n,this.selection=i,this.effects=r,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,i&&Mt(i,n.newLength),o.some((function(e){return e.type==t.time}))||(this.annotations=o.concat(t.time.of(Date.now())))}return(0,c.Z)(t,[{key:"newDoc",get:function(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}},{key:"newSelection",get:function(){return this.selection||this.startState.selection.map(this.changes)}},{key:"state",get:function(){return this._state||this.startState.applyTransaction(this),this._state}},{key:"annotation",value:function(t){var e,n=(0,u.Z)(this.annotations);try{for(n.s();!(e=n.n()).done;){var i=e.value;if(i.type==t)return i.value}}catch(r){n.e(r)}finally{n.f()}}},{key:"docChanged",get:function(){return!this.changes.empty}},{key:"reconfigured",get:function(){return this.startState.config!=this.state.config}},{key:"isUserEvent",value:function(e){var n=this.annotation(t.userEvent);return!(!n||!(n==e||n.length>e.length&&n.slice(0,e.length)==e&&"."==n[e.length]))}}],[{key:"create",value:function(e,n,i,r,o,s){return new t(e,n,i,r,o,s)}}]),t}();function re(t,e){for(var n=[],i=0,r=0;;){var o=void 0,s=void 0;if(i<t.length&&(r==e.length||e[r]>=t[i]))o=t[i++],s=t[i++];else{if(!(r<e.length))return n;o=e[r++],s=e[r++]}!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function oe(t,e,n){var i,r,o,s;return n?(r=e.changes,o=pt.empty(e.changes.length),s=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),o=t.changes.mapDesc(e.changes,!0),s=t.changes.compose(r)),{changes:s,selection:e.selection?e.selection.map(o):null===(i=t.selection)||void 0===i?void 0:i.map(r),effects:ne.mapEffects(t.effects,r).concat(ne.mapEffects(e.effects,o)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function se(t,e,n){var i=e.selection,r=ue(e.annotations);return e.userEvent&&(r=r.concat(ie.userEvent.of(e.userEvent))),{changes:e.changes instanceof pt?e.changes:pt.of(e.changes||[],n,t.facet(Ut)),selection:i&&(i instanceof At?i:At.single(i.anchor,i.head)),effects:ue(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function ae(t,e,n){var i=se(t,e.length?e[0]:{},t.doc.length);e.length&&!1===e[0].filter&&(n=!1);for(var r=1;r<e.length;r++){!1===e[r].filter&&(n=!1);var o=!!e[r].sequential;i=oe(i,se(t,e[r],o?i.changes.newLength:t.doc.length),o)}var s=ie.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(t){for(var e=t.startState,n=e.facet(Xt),i=t,r=n.length-1;r>=0;r--){var o=n[r](t);o&&Object.keys(o).length&&(i=oe(i,se(e,o,t.changes.newLength),!0))}return i==t?t:ie.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(t){var e,n=t.startState,i=!0,r=(0,u.Z)(n.facet(Gt));try{for(r.s();!(e=r.n()).done;){var o=(0,e.value)(t);if(!1===o){i=!1;break}Array.isArray(o)&&(i=!0===i?o:re(i,o))}}catch(d){r.e(d)}finally{r.f()}if(!0!==i){var s,a;if(!1===i)a=t.changes.invertedDesc,s=pt.empty(n.doc.length);else{var h=t.changes.filter(i);s=h.changes,a=h.filtered.mapDesc(h.changes).invertedDesc}t=ie.create(n,s,t.selection&&t.selection.map(a),ne.mapEffects(t.effects,a),t.annotations,t.scrollIntoView)}for(var l=n.facet($t),c=l.length-1;c>=0;c--){var f=l[c](t);t=f instanceof ie?f:Array.isArray(f)&&1==f.length&&f[0]instanceof ie?f[0]:ae(n,ue(f),!1)}return t}(s):s)}ie.time=Qt.define(),ie.userEvent=Qt.define(),ie.addToHistory=Qt.define(),ie.remote=Qt.define();var he=[];function ue(t){return null==t?he:Array.isArray(t)?t:[t]}var le,ce=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(ce||(ce={})),fe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{le=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(Li){}function de(t){return function(e){if(!/\S/.test(e))return ce.Space;if(function(t){if(le)return le.test(t);for(var e=0;e<t.length;e++){var n=t[e];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||fe.test(n)))return!0}return!1}(e))return ce.Word;for(var n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return ce.Word;return ce.Other}}var ve=function(){function t(e,n,i,r,o,s){(0,l.Z)(this,t),this.config=e,this.doc=n,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(var a=0;a<this.config.dynamicSlots.length;a++)qt(this,a<<1);this.computeSlot=null}return(0,c.Z)(t,[{key:"field",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.config.address[t.id];if(null!=n)return qt(this,n),jt(this,n);if(e)throw new RangeError("Field is not present in this state")}},{key:"update",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return ae(this,e,!0)}},{key:"applyTransaction",value:function(e){var n,i,r=this,o=this.config,s=o,a=s.base,h=s.compartments,l=(0,u.Z)(e.effects);try{for(l.s();!(n=l.n()).done;){var c=n.value;c.is(_t.reconfigure)?(o&&(h=new Map,o.compartments.forEach((function(t,e){return h.set(e,t)})),o=null),h.set(c.value.compartment,c.value.extension)):c.is(ne.reconfigure)?(o=null,a=c.value):c.is(ne.appendConfig)&&(o=null,a=ue(a).concat(c.value))}}catch(f){l.e(f)}finally{l.f()}o?i=e.startState.values.slice():i=new t(o=Ft.resolve(a,h,this),this.doc,this.selection,o.dynamicSlots.map((function(){return null})),(function(t,e){return e.reconfigure(t,r)}),null).values;new t(o,e.newDoc,e.newSelection,i,(function(t,n){return n.update(t,e)}),e)}},{key:"replaceSelection",value:function(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange((function(e){return{changes:{from:e.from,to:e.to,insert:t},range:At.cursor(e.from+t.length)}}))}},{key:"changeByRange",value:function(t){for(var e=this.selection,n=t(e.ranges[0]),i=this.changes(n.changes),r=[n.range],o=ue(n.effects),s=1;s<e.ranges.length;s++){for(var a=t(e.ranges[s]),h=this.changes(a.changes),u=h.map(i),l=0;l<s;l++)r[l]=r[l].map(u);var c=i.mapDesc(h,!0);r.push(a.range.map(c)),i=i.compose(u),o=ne.mapEffects(o,u).concat(ne.mapEffects(ue(a.effects),c))}return{changes:i,selection:At.create(r,e.mainIndex),effects:o}}},{key:"changes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e instanceof pt?e:pt.of(e,this.doc.length,this.facet(t.lineSeparator))}},{key:"toText",value:function(e){return K.of(e.split(this.facet(t.lineSeparator)||dt))}},{key:"sliceDoc",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.doc.length;return this.doc.sliceString(t,e,this.lineBreak)}},{key:"facet",value:function(t){var e=this.config.address[t.id];return null==e?t.default:(qt(this,e),jt(this,e))}},{key:"toJSON",value:function(t){var e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(var n in t){var i=t[n];i instanceof Rt&&null!=this.config.address[i.id]&&(e[n]=i.spec.toJSON(this.field(t[n]),this))}return e}},{key:"tabSize",get:function(){return this.facet(t.tabSize)}},{key:"lineBreak",get:function(){return this.facet(t.lineSeparator)||"\n"}},{key:"readOnly",get:function(){return this.facet(Yt)}},{key:"phrase",value:function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];var o,s=(0,u.Z)(this.facet(t.phrases));try{for(s.s();!(o=s.n()).done;){var a=o.value;if(Object.prototype.hasOwnProperty.call(a,e)){e=a[e];break}}}catch(h){s.e(h)}finally{s.f()}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(function(t,e){if("$"==e)return"$";var n=+(e||1);return!n||n>i.length?t:i[n-1]}))),e}},{key:"languageDataAt",value:function(t,e){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=(0,u.Z)(this.facet(Kt));try{for(o.s();!(n=o.n()).done;){var s,a=n.value,h=(0,u.Z)(a(this,e,i));try{for(h.s();!(s=h.n()).done;){var l=s.value;Object.prototype.hasOwnProperty.call(l,t)&&r.push(l[t])}}catch(c){h.e(c)}finally{h.f()}}}catch(c){o.e(c)}finally{o.f()}return r}},{key:"charCategorizer",value:function(t){return de(this.languageDataAt("wordChars",t).join(""))}},{key:"wordAt",value:function(t){for(var e=this.doc.lineAt(t),n=e.text,i=e.from,r=e.length,o=this.charCategorizer(t),s=t-i,a=t-i;s>0;){var h=st(n,s,!1);if(o(n.slice(h,s))!=ce.Word)break;s=h}for(;a<r;){var u=st(n,a);if(o(n.slice(a,u))!=ce.Word)break;a=u}return s==a?null:At.range(s+i,a+i)}}],[{key:"fromJSON",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");var r=[];if(i){var o=function(){if(Object.prototype.hasOwnProperty.call(e,s)){var t=i[s],n=e[s];r.push(t.init((function(e){return t.spec.fromJSON(n,e)})))}};for(var s in i)o()}return t.create({doc:e.doc,selection:At.fromJSON(e.selection),extensions:n.extensions?r.concat([n.extensions]):r})}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Ft.resolve(e.extensions||[],new Map),i=e.doc instanceof K?e.doc:K.of((e.doc||"").split(n.staticFacet(t.lineSeparator)||dt)),r=e.selection?e.selection instanceof At?e.selection:At.single(e.selection.anchor,e.selection.head):At.single(0);return Mt(r,i.length),n.staticFacet(Jt)||(r=r.asSingle()),new t(n,i,r,n.dynamicSlots.map((function(){return null})),(function(t,e){return e.create(t)}),null)}}]),t}();function ge(t,e){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={},o=(0,u.Z)(t);try{for(o.s();!(n=o.n()).done;)for(var s=n.value,a=0,h=Object.keys(s);a<h.length;a++){var l=h[a],c=s[l],f=r[l];if(void 0===f)r[l]=c;else if(f===c||void 0===c);else{if(!Object.hasOwnProperty.call(i,l))throw new Error("Config merge conflict for field "+l);r[l]=i[l](f,c)}}}catch(v){o.e(v)}finally{o.f()}for(var d in e)void 0===r[d]&&(r[d]=e[d]);return r}ve.allowMultipleSelections=Jt,ve.tabSize=Ct.define({combine:function(t){return t.length?t[0]:4}}),ve.lineSeparator=Ut,ve.readOnly=Yt,ve.phrases=Ct.define({compare:function(t,e){var n=Object.keys(t),i=Object.keys(e);return n.length==i.length&&n.every((function(n){return t[n]==e[n]}))}}),ve.languageData=Kt,ve.changeFilter=Gt,ve.transactionFilter=$t,ve.transactionExtender=Xt,_t.reconfigure=ne.define();var pe=function(){function t(){(0,l.Z)(this,t)}return(0,c.Z)(t,[{key:"eq",value:function(t){return this==t}},{key:"range",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return me.create(t,e,this)}}]),t}();pe.prototype.startSide=pe.prototype.endSide=0,pe.prototype.point=!1,pe.prototype.mapMode=vt.TrackDel;var me=function(){function t(e,n,i){(0,l.Z)(this,t),this.from=e,this.to=n,this.value=i}return(0,c.Z)(t,null,[{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}();function ye(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}var ke=function(){function t(e,n,i,r){(0,l.Z)(this,t),this.from=e,this.to=n,this.value=i,this.maxPoint=r}return(0,c.Z)(t,[{key:"length",get:function(){return this.to[this.to.length-1]}},{key:"findIndex",value:function(t,e,n){for(var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=n?this.to:this.from,o=i,s=r.length;;){if(o==s)return o;var a=o+s>>1,h=r[a]-t||(n?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:s;h>=0?s=a:o=a+1}}},{key:"between",value:function(t,e,n,i){for(var r=this.findIndex(e,-1e9,!0),o=this.findIndex(n,1e9,!1,r);r<o;r++)if(!1===i(this.from[r]+t,this.to[r]+t,this.value[r]))return!1}},{key:"map",value:function(e,n){for(var i=[],r=[],o=[],s=-1,a=-1,h=0;h<this.value.length;h++){var u=this.value[h],l=this.from[h]+e,c=this.to[h]+e,f=void 0,d=void 0;if(l==c){var v=n.mapPos(l,u.startSide,u.mapMode);if(null==v)continue;if(f=d=v,u.startSide!=u.endSide&&(d=n.mapPos(l,u.endSide))<f)continue}else if((f=n.mapPos(l,u.startSide))>(d=n.mapPos(c,u.endSide))||f==d&&u.startSide>0&&u.endSide<=0)continue;(d-f||u.endSide-u.startSide)<0||(s<0&&(s=f),u.point&&(a=Math.max(a,d-f)),i.push(u),r.push(f-s),o.push(d-s))}return{mapped:i.length?new t(r,o,i,a):null,pos:s}}}]),t}(),we=function(){function t(e,n,i,r){(0,l.Z)(this,t),this.chunkPos=e,this.chunk=n,this.nextLayer=i,this.maxPoint=r}return(0,c.Z)(t,[{key:"length",get:function(){var t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}},{key:"size",get:function(){if(this.isEmpty)return 0;var t,e=this.nextLayer.size,n=(0,u.Z)(this.chunk);try{for(n.s();!(t=n.n()).done;){e+=t.value.value.length}}catch(i){n.e(i)}finally{n.f()}return e}},{key:"chunkEnd",value:function(t){return this.chunkPos[t]+this.chunk[t].length}},{key:"update",value:function(e){var n=e.add,i=void 0===n?[]:n,r=e.sort,o=void 0!==r&&r,s=e.filterFrom,a=void 0===s?0:s,h=e.filterTo,u=void 0===h?this.length:h,l=e.filter;if(0==i.length&&!l)return this;if(o&&(i=i.slice().sort(ye)),this.isEmpty)return i.length?t.of(i):this;for(var c=new Se(this,null,-1).goto(0),f=0,d=[],v=new be;c.value||f<i.length;)if(f<i.length&&(c.from-i[f].from||c.startSide-i[f].value.startSide)>=0){var g=i[f++];v.addInner(g.from,g.to,g.value)||d.push(g)}else 1==c.rangeIndex&&c.chunkIndex<this.chunk.length&&(f==i.length||this.chunkEnd(c.chunkIndex)<i[f].from)&&(!l||a>this.chunkEnd(c.chunkIndex)||u<this.chunkPos[c.chunkIndex])&&v.addChunk(this.chunkPos[c.chunkIndex],this.chunk[c.chunkIndex])?c.nextChunk():((!l||a>c.to||u<c.from||l(c.from,c.to,c.value))&&(v.addInner(c.from,c.to,c.value)||d.push(me.create(c.from,c.to,c.value))),c.next());return v.finishInner(this.nextLayer.isEmpty&&!d.length?t.empty:this.nextLayer.update({add:d,filter:l,filterFrom:a,filterTo:u}))}},{key:"map",value:function(e){if(e.empty||this.isEmpty)return this;for(var n=[],i=[],r=-1,o=0;o<this.chunk.length;o++){var s=this.chunkPos[o],a=this.chunk[o],h=e.touchesRange(s,s+a.length);if(!1===h)r=Math.max(r,a.maxPoint),n.push(a),i.push(e.mapPos(s));else if(!0===h){var u=a.map(s,e),l=u.mapped,c=u.pos;l&&(r=Math.max(r,l.maxPoint),n.push(l),i.push(c))}}var f=this.nextLayer.map(e);return 0==n.length?f:new t(i,n,f||t.empty,r)}},{key:"between",value:function(t,e,n){if(!this.isEmpty){for(var i=0;i<this.chunk.length;i++){var r=this.chunkPos[i],o=this.chunk[i];if(e>=r&&t<=r+o.length&&!1===o.between(r,t-r,e-r,n))return}this.nextLayer.between(t,e,n)}}},{key:"iter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return Ae.from([this]).goto(t)}},{key:"isEmpty",get:function(){return this.nextLayer==this}}],[{key:"create",value:function(e,n,i,r){return new t(e,n,i,r)}},{key:"iter",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Ae.from(t).goto(e)}},{key:"compare",value:function(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=t.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r})),s=e.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r})),a=xe(o,s,n),h=new Ze(o,a,r),u=new Ze(s,a,r);n.iterGaps((function(t,e,n){return Ce(h,t,u,e,n,i)})),n.empty&&0==n.length&&Ce(h,0,u,0,0,i)}},{key:"eq",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0;null==i&&(i=999999999);var r=t.filter((function(t){return!t.isEmpty&&e.indexOf(t)<0})),o=e.filter((function(e){return!e.isEmpty&&t.indexOf(e)<0}));if(r.length!=o.length)return!1;if(!r.length)return!0;for(var s=xe(r,o),a=new Ze(r,s,0).goto(n),h=new Ze(o,s,0).goto(n);;){if(a.to!=h.to||!Oe(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>i)return!0;a.next(),h.next()}}},{key:"spans",value:function(t,e,n,i){for(var r=new Ze(t,null,arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1).goto(e),o=e,s=r.openStart;;){var a=Math.min(r.to,n);if(r.point){var h=r.activeForPoint(r.to),u=r.pointFrom<e?h.length+1:Math.min(h.length,s);i.point(o,a,r.point,h,u,r.pointRank),s=Math.min(r.openEnd(a),h.length)}else a>o&&(i.span(o,a,r.active,s),s=r.openEnd(a));if(r.to>n)return s+(r.point&&r.to>n?1:0);o=r.to,r.next()}}},{key:"of",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=new be,r=(0,u.Z)(t instanceof me?[t]:n?function(t){if(t.length>1)for(var e=t[0],n=1;n<t.length;n++){var i=t[n];if(ye(e,i)>0)return t.slice().sort(ye);e=i}return t}(t):t);try{for(r.s();!(e=r.n()).done;){var o=e.value;i.add(o.from,o.to,o.value)}}catch(s){r.e(s)}finally{r.f()}return i.finish()}}]),t}();we.empty=new we([],[],null,-1),we.empty.nextLayer=we.empty;var be=function(){function t(){(0,l.Z)(this,t),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(0,c.Z)(t,[{key:"finishChunk",value:function(t){this.chunks.push(new ke(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(e,n,i){this.addInner(e,n,i)||(this.nextLayer||(this.nextLayer=new t)).add(e,n,i)}},{key:"addInner",value:function(t,e,n){var i=t-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(t-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<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=n,this.lastFrom=t,this.lastTo=e,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}},{key:"addChunk",value:function(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 n=e.value.length-1;return this.last=e.value[n],this.lastFrom=e.from[n]+t,this.lastTo=e.to[n]+t,!0}},{key:"finish",value:function(){return this.finishInner(we.empty)}},{key:"finishInner",value:function(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;var e=we.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}]),t}();function xe(t,e,n){var i,r=new Map,o=(0,u.Z)(t);try{for(o.s();!(i=o.n()).done;)for(var s=i.value,a=0;a<s.chunk.length;a++)s.chunk[a].maxPoint<=0&&r.set(s.chunk[a],s.chunkPos[a])}catch(g){o.e(g)}finally{o.f()}var h,l=new Set,c=(0,u.Z)(e);try{for(c.s();!(h=c.n()).done;)for(var f=h.value,d=0;d<f.chunk.length;d++){var v=r.get(f.chunk[d]);null==v||(n?n.mapPos(v):v)!=f.chunkPos[d]||(null==n?void 0:n.touchesRange(v,v+f.chunk[d].length))||l.add(f.chunk[d])}}catch(g){c.e(g)}finally{c.f()}return l}var Se=function(){function t(e,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;(0,l.Z)(this,t),this.layer=e,this.skip=n,this.minPoint=i,this.rank=r}return(0,c.Z)(t,[{key:"startSide",get:function(){return this.value?this.value.startSide:0}},{key:"endSide",get:function(){return this.value?this.value.endSide:0}},{key:"goto",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}},{key:"gotoInner",value:function(t,e,n){for(;this.chunkIndex<this.layer.chunk.length;){var i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<t||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){var r=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}},{key:"forward",value:function(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}},{key:"next",value:function(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}var t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],n=t+e.from[this.rangeIndex];if(this.from=n,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}},{key:"setRangeIndex",value:function(t){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(){this.chunkIndex++,this.rangeIndex=0,this.next()}},{key:"compare",value:function(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}]),t}(),Ae=function(){function t(e){(0,l.Z)(this,t),this.heap=e}return(0,c.Z)(t,[{key:"startSide",get:function(){return this.value?this.value.startSide:0}},{key:"goto",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9,i=(0,u.Z)(this.heap);try{for(i.s();!(e=i.n()).done;){e.value.goto(t,n)}}catch(o){i.e(o)}finally{i.f()}for(var r=this.heap.length>>1;r>=0;r--)Me(this.heap,r);return this.next(),this}},{key:"forward",value:function(t,e){var n,i=(0,u.Z)(this.heap);try{for(i.s();!(n=i.n()).done;){n.value.forward(t,e)}}catch(o){i.e(o)}finally{i.f()}for(var r=this.heap.length>>1;r>=0;r--)Me(this.heap,r);(this.to-t||this.value.endSide-e)<0&&this.next()}},{key:"next",value:function(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Me(this.heap,0)}}}],[{key:"from",value:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=0;o<e.length;o++)for(var s=e[o];!s.isEmpty;s=s.nextLayer)s.maxPoint>=i&&r.push(new Se(s,n,i,o));return 1==r.length?r[0]:new t(r)}}]),t}();function Me(t,e){for(var n=t[e];;){var i=1+(e<<1);if(i>=t.length)break;var r=t[i];if(i+1<t.length&&r.compare(t[i+1])>=0&&(r=t[i+1],i++),n.compare(r)<0)break;t[i]=n,t[e]=r,e=i}}var Ze=function(){function t(e,n,i){(0,l.Z)(this,t),this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Ae.from(e,n,i)}return(0,c.Z)(t,[{key:"goto",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?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(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(t){Te(this.active,t),Te(this.activeTo,t),Te(this.activeRank,t),this.minActive=Ee(this.active,this.activeTo)}},{key:"addActive",value:function(t){for(var e=0,n=this.cursor,i=n.value,r=n.to,o=n.rank;e<this.activeRank.length&&this.activeRank[e]<=o;)e++;De(this.active,e,i),De(this.activeTo,e,r),De(this.activeRank,e,o),t&&De(t,e,this.cursor.from),this.minActive=Ee(this.active,this.activeTo)}},{key:"next",value:function(){var t=this.to,e=this.point;this.point=null;for(var n=this.openStart<0?[]:null;;){var i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>t){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&Te(n,i)}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 r=this.cursor.value;if(r.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}if(n){this.openStart=0;for(var o=n.length-1;o>=0&&n[o]<t;o--)this.openStart++}}},{key:"activeForPoint",value:function(t){if(!this.active.length)return this.active;for(var e=[],n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>t||this.activeTo[n]==t&&this.active[n].endSide>=this.point.endSide)&&e.push(this.active[n]);return e.reverse()}},{key:"openEnd",value:function(t){for(var e=0,n=this.activeTo.length-1;n>=0&&this.activeTo[n]>t;n--)e++;return e}}]),t}();function Ce(t,e,n,i,r,o){t.goto(e),n.goto(i);for(var s=i+r,a=i,h=i-e;;){var u=t.to+h-n.to||t.endSide-n.endSide,l=u<0?t.to+h:n.to,c=Math.min(l,s);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&Oe(t.activeForPoint(t.to),n.activeForPoint(n.to))||o.comparePoint(a,c,t.point,n.point):c>a&&!Oe(t.active,n.active)&&o.compareRange(a,c,t.active,n.active),l>s)break;a=l,u<=0&&t.next(),u>=0&&n.next()}}function Oe(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].eq(e[n]))return!1;return!0}function Te(t,e){for(var n=e,i=t.length-1;n<i;n++)t[n]=t[n+1];t.pop()}function De(t,e,n){for(var i=t.length-1;i>=e;i--)t[i+1]=t[i];t[e]=n}function Ee(t,e){for(var n=-1,i=1e9,r=0;r<e.length;r++)(e[r]-i||t[r].endSide-t[n].endSide)<0&&(n=r,i=e[r]);return n}var Be=n(58626),Re=(n(10185),n(45882),n(37724),0),Ie=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,l.Z)(this,t),this.id=Re++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return(0,c.Z)(t,[{key:"add",value:function(t){var e=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=Ne.match(t)),function(n){var i=t(n);return void 0===i?null:[e,i]}}}]),t}();Ie.closedBy=new Ie({deserialize:function(t){return t.split(" ")}}),Ie.openedBy=new Ie({deserialize:function(t){return t.split(" ")}}),Ie.group=new Ie({deserialize:function(t){return t.split(" ")}}),Ie.contextHash=new Ie({perNode:!0}),Ie.lookAhead=new Ie({perNode:!0}),Ie.mounted=new Ie({perNode:!0});var Pe=Object.create(null),Ne=function(){function t(e,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;(0,l.Z)(this,t),this.name=e,this.props=n,this.id=i,this.flags=r}return(0,c.Z)(t,[{key:"prop",value:function(t){return this.props[t.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(t){if("string"==typeof t){if(this.name==t)return!0;var e=this.prop(Ie.group);return!!e&&e.indexOf(t)>-1}return this.id==t}}],[{key:"define",value:function(e){var n=e.props&&e.props.length?Object.create(null):Pe,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),r=new t(e.name||"",n,e.id,i);if(e.props){var o,s=(0,u.Z)(e.props);try{for(s.s();!(o=s.n()).done;){var a=o.value;if(Array.isArray(a)||(a=a(r)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[a[0].id]=a[1]}}}catch(h){s.e(h)}finally{s.f()}}return r}},{key:"match",value:function(t){var e=Object.create(null);for(var n in t){var i,r=(0,u.Z)(n.split(" "));try{for(r.s();!(i=r.n()).done;){var o=i.value;e[o]=t[n]}}catch(s){r.e(s)}finally{r.f()}}return function(t){for(var n=t.prop(Ie.group),i=-1;i<(n?n.length:0);i++){var r=e[i<0?t.name:n[i]];if(r)return r}}}}]),t}();Ne.none=new Ne("",Object.create(null),0,8);var Le,Ve=new WeakMap,He=new WeakMap;!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(Le||(Le={}));var We=function(){function t(e,n,i,o,s){if((0,l.Z)(this,t),this.type=e,this.children=n,this.positions=i,this.length=o,this.props=null,s&&s.length){this.props=Object.create(null);var a,h=(0,u.Z)(s);try{for(h.s();!(a=h.n()).done;){var c=(0,r.Z)(a.value,2),f=c[0],d=c[1];this.props["number"==typeof f?f:f.id]=d}}catch(v){h.e(v)}finally{h.f()}}}return(0,c.Z)(t,[{key:"toString",value:function(){var t=this.prop(Ie.mounted);if(t&&!t.overlay)return t.tree.toString();var e,n="",i=(0,u.Z)(this.children);try{for(i.s();!(e=i.n()).done;){var r=e.value.toString();r&&(n&&(n+=","),n+=r)}}catch(o){i.e(o)}finally{i.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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Xe(this.topNode,t)}},{key:"cursorAt",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Ve.get(this)||this.topNode,i=new Xe(n);return i.moveTo(t,e),Ve.set(this,i._tree),i}},{key:"topNode",get:function(){return new Ke(this,0,0,null)}},{key:"resolve",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=je(Ve.get(this)||this.topNode,t,e,!1);return Ve.set(this,n),n}},{key:"resolveInner",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=je(He.get(this)||this.topNode,t,e,!0);return He.set(this,n),n}},{key:"iterate",value:function(t){for(var e=t.enter,n=t.leave,i=t.from,r=void 0===i?0:i,o=t.to,s=void 0===o?this.length:o,a=t.mode||0,h=(a&Le.IncludeAnonymous)>0,u=this.cursor(a|Le.IncludeAnonymous);;){var l=!1;if(u.from<=s&&u.to>=r&&(!h&&u.type.isAnonymous||!1!==e(u))){if(u.firstChild())continue;l=!0}for(;l&&n&&(h||!u.type.isAnonymous)&&n(u),!u.nextSibling();){if(!u.parent())return;l=!0}}}},{key:"prop",value:function(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}},{key:"propValues",get:function(){var t=[];if(this.props)for(var e in this.props)t.push([+e,this.props[e]]);return t}},{key:"balance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.children.length<=8?this:en(Ne.none,this.children,this.positions,0,this.children.length,0,this.length,(function(n,i,r){return new t(e.type,n,i,r,e.propValues)}),n.makeTree||function(e,n,i){return new t(Ne.none,e,n,i)})}}],[{key:"build",value:function(t){return function(t){var e,n=t.buffer,i=t.nodeSet,r=t.maxBufferLength,o=void 0===r?1024:r,s=t.reused,a=void 0===s?[]:s,h=t.minRepeatType,u=void 0===h?i.types.length:h,l=Array.isArray(n)?new _e(n,n.length):n,c=i.types,f=0,d=0;function v(t,e,n,r,s){for(var h=l.id,w=l.start,b=l.end,x=l.size,S=d;x<0;){if(l.next(),-1==x){var A=a[h];return n.push(A),void r.push(w-t)}if(-3==x)return void(f=h);if(-4==x)return void(d=h);throw new RangeError("Unrecognized record size: ".concat(x))}var M,Z,C=c[h],O=w-t;if(b-w<=o&&(Z=y(l.pos-e,s))){for(var T=new Uint16Array(Z.size-Z.skip),D=l.pos-Z.size,E=T.length;l.pos>D;)E=k(Z.start,T,E);M=new ze(T,b-Z.start,i),O=Z.start-t}else{var B=l.pos-x;l.next();for(var R=[],I=[],P=h>=u?h:-1,N=0,L=b;l.pos>B;)P>=0&&l.id==P&&l.size>=0?(l.end<=L-o&&(p(R,I,w,N,l.end,L,P,S),N=R.length,L=l.end),l.next()):v(w,B,R,I,P);if(P>=0&&N>0&&N<R.length&&p(R,I,w,N,w,L,P,S),R.reverse(),I.reverse(),P>-1&&N>0){var V=g(C);M=en(C,R,I,0,R.length,0,b-w,V,V)}else M=m(C,R,I,b-w,S-b)}n.push(M),r.push(O)}function g(t){return function(e,n,i){var r,o,s=0,a=e.length-1;if(a>=0&&(r=e[a])instanceof We){if(!a&&r.type==t&&r.length==i)return r;(o=r.prop(Ie.lookAhead))&&(s=n[a]+r.length+o)}return m(t,e,n,i,s)}}function p(t,e,n,r,o,s,a,h){for(var u=[],l=[];t.length>r;)u.push(t.pop()),l.push(e.pop()+n-o);t.push(m(i.types[a],u,l,s-o,h-s)),e.push(o-n)}function m(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0;if(f){var s=[Ie.contextHash,f];o=o?[s].concat(o):[s]}if(r>25){var a=[Ie.lookAhead,r];o=o?[a].concat(o):[a]}return new We(t,e,n,i,o)}function y(t,e){var n=l.fork(),i=0,r=0,s=0,a=n.end-o,h={size:0,start:0,skip:0};t:for(var c=n.pos-t;n.pos>c;){var f=n.size;if(n.id==e&&f>=0)h.size=i,h.start=r,h.skip=s,s+=4,i+=4,n.next();else{var d=n.pos-f;if(f<0||d<c||n.start<a)break;var v=n.id>=u?4:0,g=n.start;for(n.next();n.pos>d;){if(n.size<0){if(-3!=n.size)break t;v+=4}else n.id>=u&&(v+=4);n.next()}r=g,i+=f,s+=v}}return(e<0||i==t)&&(h.size=i,h.start=r,h.skip=s),h.size>4?h:void 0}function k(t,e,n){var i=l.id,r=l.start,o=l.end,s=l.size;if(l.next(),s>=0&&i<u){var a=n;if(s>4)for(var h=l.pos-(s-4);l.pos>h;)n=k(t,e,n);e[--n]=a,e[--n]=o-t,e[--n]=r-t,e[--n]=i}else-3==s?f=i:-4==s&&(d=i);return n}var w=[],b=[];for(;l.pos>0;)v(t.start||0,t.bufferStart||0,w,b,-1);var x=null!==(e=t.length)&&void 0!==e?e:w.length?b[0]+w[0].length:0;return new We(c[t.topID],w.reverse(),b.reverse(),x)}(t)}}]),t}();We.empty=new We(Ne.none,[],[],0);var _e=function(){function t(e,n){(0,l.Z)(this,t),this.buffer=e,this.index=n}return(0,c.Z)(t,[{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 t(this.buffer,this.index)}}]),t}(),ze=function(){function t(e,n,i){(0,l.Z)(this,t),this.buffer=e,this.length=n,this.set=i}return(0,c.Z)(t,[{key:"type",get:function(){return Ne.none}},{key:"toString",value:function(){for(var t=[],e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}},{key:"childString",value:function(t){var e=this.buffer[t],n=this.buffer[t+3],i=this.set.types[e],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),n==(t+=4))return r;for(var o=[];t<n;)o.push(this.childString(t)),t=this.buffer[t+3];return r+"("+o.join(",")+")"}},{key:"findChild",value:function(t,e,n,i,r){for(var o=this.buffer,s=-1,a=t;a!=e&&!(Fe(r,i,o[a+1],o[a+2])&&(s=a,n>0));a=o[a+3]);return s}},{key:"slice",value:function(e,n,i){for(var r=this.buffer,o=new Uint16Array(n-e),s=0,a=e,h=0;a<n;){o[h++]=r[a++],o[h++]=r[a++]-i;var u=o[h++]=r[a++]-i;o[h++]=r[a++]-e,s=Math.max(s,u)}return new t(o,s,this.set)}}]),t}();function Fe(t,e,n,i){switch(t){case-2:return n<e;case-1:return i>=e&&n<e;case 0:return n<e&&i>e;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function qe(t,e){for(var n=t.childBefore(e);n;){var i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(t=n,n=i.prevSibling):n=i}return t}function je(t,e,n,i){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){var o=!i&&t instanceof Ke&&t.index<0?null:t.parent;if(!o)return t;t=o}var s=i?0:Le.IgnoreOverlays;if(i)for(var a=t,h=a.parent;h;h=(a=h).parent)a instanceof Ke&&a.index<0&&(null===(r=h.enter(e,n,s))||void 0===r?void 0:r.from)!=a.from&&(t=h);for(;;){var u=t.enter(e,n,s);if(!u)return t;t=u}}var Ke=function(){function t(e,n,i,r){(0,l.Z)(this,t),this._tree=e,this.from=n,this.index=i,this._parent=r}return(0,c.Z)(t,[{key:"type",get:function(){return this._tree.type}},{key:"name",get:function(){return this._tree.type.name}},{key:"to",get:function(){return this.from+this._tree.length}},{key:"nextChild",value:function(e,n,i,r){for(var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=this;;){for(var a=s._tree,h=a.children,u=a.positions,l=n>0?h.length:-1;e!=l;e+=n){var c=h[e],f=u[e]+s.from;if(Fe(r,i,f,f+c.length))if(c instanceof ze){if(o&Le.ExcludeBuffers)continue;var d=c.findChild(0,c.buffer.length,n,i-f,r);if(d>-1)return new $e(new Ge(s,c,e,f),null,d)}else if(o&Le.IncludeAnonymous||!c.type.isAnonymous||Ye(c)){var v=void 0;if(!(o&Le.IgnoreMounts)&&c.props&&(v=c.prop(Ie.mounted))&&!v.overlay)return new t(v.tree,f,e,s);var g=new t(c,f,e,s);return o&Le.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?c.children.length-1:0,n,i,r)}}if(o&Le.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+n:n<0?-1:s._parent._tree.children.length,!(s=s._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(t){return this.nextChild(0,1,t,2)}},{key:"childBefore",value:function(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}},{key:"enter",value:function(e,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(r&Le.IgnoreOverlays)&&(i=this._tree.prop(Ie.mounted))&&i.overlay){var o,s=e-this.from,a=(0,u.Z)(i.overlay);try{for(a.s();!(o=a.n()).done;){var h=o.value,l=h.from,c=h.to;if((n>0?l<=s:l<s)&&(n<0?c>=s:c>s))return new t(i.tree,i.overlay[0].from+this.from,-1,this)}}catch(f){a.e(f)}finally{a.f()}}return this.nextChild(0,1,e,n,r)}},{key:"nextSignificantParent",value:function(){for(var t=this;t.type.isAnonymous&&t._parent;)t=t._parent;return t}},{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 Xe(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(t){return je(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(t){return je(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function(t){return qe(this,t)}},{key:"getChild",value:function(t){var e=Je(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return e.length?e[0]:null}},{key:"getChildren",value:function(t){return Je(this,t,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(t){return Ue(this,t)}}]),t}();function Je(t,e,n,i){var r=t.cursor(),o=[];if(!r.firstChild())return o;if(null!=n)for(;!r.type.is(n);)if(!r.nextSibling())return o;for(;;){if(null!=i&&r.type.is(i))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return null==i?o:[]}}function Ue(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length-1,i=t.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}var Ge=(0,c.Z)((function t(e,n,i,r){(0,l.Z)(this,t),this.parent=e,this.buffer=n,this.index=i,this.start=r})),$e=function(){function t(e,n,i){(0,l.Z)(this,t),this.context=e,this._parent=n,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}return(0,c.Z)(t,[{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(e,n,i){var r=this.context.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],e,n-this.context.start,i);return o<0?null:new t(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(t){return this.child(1,t,2)}},{key:"childBefore",value:function(t){return this.child(-1,t,-2)}},{key:"enter",value:function(e,n){if((arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)&Le.ExcludeBuffers)return null;var i=this.context.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return r<0?null:new t(this.context,this,r)}},{key:"parent",get:function(){return this._parent||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}},{key:"nextSibling",get:function(){var e=this.context.buffer,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new t(this.context,this._parent,n):this.externalSibling(1)}},{key:"prevSibling",get:function(){var e=this.context.buffer,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new t(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}},{key:"cursor",value:function(){return new Xe(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function(){return null}},{key:"toTree",value:function(){var t=[],e=[],n=this.context.buffer,i=this.index+4,r=n.buffer[this.index+3];if(r>i){var o=n.buffer[this.index+1];t.push(n.slice(i,r,o)),e.push(0)}return new We(this.type,t,e,this.to-this.from)}},{key:"resolve",value:function(t){return je(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(t){return je(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function(t){return qe(this,t)}},{key:"toString",value:function(){return this.context.buffer.childString(this.index)}},{key:"getChild",value:function(t){var e=Je(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return e.length?e[0]:null}},{key:"getChildren",value:function(t){return Je(this,t,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(t){return Ue(this,t)}}]),t}(),Xe=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if((0,l.Z)(this,t),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ke)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(var i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}return(0,c.Z)(t,[{key:"name",get:function(){return this.type.name}},{key:"yieldNode",value:function(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}},{key:"yieldBuf",value:function(t,e){this.index=t;var n=this.buffer,i=n.start,r=n.buffer;return this.type=e||r.set.types[r.buffer[t]],this.from=i+r.buffer[t+1],this.to=i+r.buffer[t+2],!0}},{key:"yield",value:function(t){return!!t&&(t instanceof Ke?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}},{key:"toString",value:function(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}},{key:"enterChild",value:function(t,e,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,n,this.mode));var i=this.buffer.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.buffer.start,n);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}},{key:"firstChild",value:function(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function(t){return this.enterChild(1,t,2)}},{key:"childBefore",value:function(t){return this.enterChild(-1,t,-2)}},{key:"enter",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(n&Le.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,n))}},{key:"parent",value:function(){if(!this.buffer)return this.yieldNode(this.mode&Le.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&Le.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}},{key:"sibling",value:function(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,n=this.stack.length-1;if(t<0){var i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(e.findChild(i,this.index,-1,0,4))}else{var r=e.buffer[this.index+3];if(r<(n<0?e.buffer.length:e.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}},{key:"nextSibling",value:function(){return this.sibling(1)}},{key:"prevSibling",value:function(){return this.sibling(-1)}},{key:"atLastNode",value:function(t){var e,n,i=this.buffer;if(i){if(t>0){if(this.index<i.buffer.buffer.length)return!1}else for(var r=0;r<this.index;r++)if(i.buffer.buffer[r+3]<this.index)return!1;e=i.index,n=i.parent}else{var o=this._tree;e=o.index,n=o._parent}for(;n;e=(s=n).index,n=s._parent,s){var s;if(e>-1)for(var a=e+t,h=t<0?-1:n._tree.children.length;a!=h;a+=t){var u=n._tree.children[a];if(this.mode&Le.IncludeAnonymous||u instanceof ze||!u.type.isAnonymous||Ye(u))return!1}}return!0}},{key:"move",value:function(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(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(1,t)}},{key:"prev",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(-1,t)}},{key:"moveTo",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(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(){if(!this.buffer)return this._tree;var t=this.bufferNode,e=null,n=0;if(t&&t.context==this.buffer)t:for(var i=this.index,r=this.stack.length;r>=0;){for(var o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;e=o,n=r+1;break t}i=this.stack[--r]}for(var s=n;s<this.stack.length;s++)e=new $e(this.buffer,e,this.stack[s]);return this.bufferNode=new $e(this.buffer,e,this.index)}},{key:"tree",get:function(){return this.buffer?null:this._tree._tree}},{key:"iterate",value:function(t,e){for(var n=0;;){var i=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;i&&e&&e(this),i=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,i=!0}}}},{key:"matchContext",value:function(t){if(!this.buffer)return Ue(this.node,t);for(var e=this.buffer.buffer,n=e.set.types,i=t.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return Ue(this.node,t,i);var o=n[e.buffer[this.stack[r]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}}]),t}();function Ye(t){return t.children.some((function(t){return t instanceof ze||!t.type.isAnonymous||Ye(t)}))}var Qe=new WeakMap;function tn(t,e){if(!t.isAnonymous||e instanceof ze||e.type!=t)return 1;var n=Qe.get(e);if(null==n){n=1;var i,r=(0,u.Z)(e.children);try{for(r.s();!(i=r.n()).done;){var o=i.value;if(o.type!=t||!(o instanceof We)){n=1;break}n+=tn(t,o)}}catch(s){r.e(s)}finally{r.f()}Qe.set(e,n)}return n}function en(t,e,n,i,r,o,s,a,h){for(var u=0,l=i;l<r;l++)u+=tn(t,e[l]);var c=Math.ceil(1.5*u/8),f=[],d=[];return function e(n,i,r,s,a){for(var u=r;u<s;){var l=u,v=i[u],g=tn(t,n[u]);for(u++;u<s;u++){var p=tn(t,n[u]);if(g+p>=c)break;g+=p}if(u==l+1){if(g>c){var m=n[l];e(m.children,m.positions,0,m.children.length,i[l]+a);continue}f.push(n[l])}else{var y=i[u-1]+n[u-1].length-v;f.push(en(t,n,i,l,u,v,y,null,h))}d.push(v+a-o)}}(e,n,i,r,0),(a||h)(f,d,s)}new Ie({perNode:!0});var nn=0,rn=function(){function t(e,n,i){(0,l.Z)(this,t),this.set=e,this.base=n,this.modified=i,this.id=nn++}return(0,c.Z)(t,null,[{key:"define",value:function(e){if(null==e?void 0:e.base)throw new Error("Can not derive from a modified tag");var n=new t([],null,[]);if(n.set.push(n),e){var i,r=(0,u.Z)(e.set);try{for(r.s();!(i=r.n()).done;){var o=i.value;n.set.push(o)}}catch(s){r.e(s)}finally{r.f()}}return n}},{key:"defineModifier",value:function(){var t=new sn;return function(e){return e.modified.indexOf(t)>-1?e:sn.get(e.base||e,e.modified.concat(t).sort((function(t,e){return t.id-e.id})))}}}]),t}(),on=0,sn=function(){function t(){(0,l.Z)(this,t),this.instances=[],this.id=on++}return(0,c.Z)(t,null,[{key:"get",value:function(e,n){if(!n.length)return e;var i=n[0].instances.find((function(t){return t.base==e&&(i=n,r=t.modified,i.length==r.length&&i.every((function(t,e){return t==r[e]})));var i,r}));if(i)return i;var r,o=[],s=new rn(o,e,n),a=(0,u.Z)(n);try{for(a.s();!(r=a.n()).done;){r.value.instances.push(s)}}catch(p){a.e(p)}finally{a.f()}var h,l=function(t){for(var e=[[]],n=0;n<t.length;n++)for(var i=0,r=e.length;i<r;i++)e.push(e[i].concat(t[n]));return e.sort((function(t,e){return e.length-t.length}))}(n),c=(0,u.Z)(e.set);try{for(c.s();!(h=c.n()).done;){var f=h.value;if(!f.modified.length){var d,v=(0,u.Z)(l);try{for(v.s();!(d=v.n()).done;){var g=d.value;o.push(t.get(f,g))}}catch(p){v.e(p)}finally{v.f()}}}}catch(p){c.e(p)}finally{c.f()}return s}}]),t}();function an(t){var e=Object.create(null);for(var n in t){var i=t[n];Array.isArray(i)||(i=[i]);var r,o=(0,u.Z)(n.split(" "));try{for(o.s();!(r=o.n()).done;){var s=r.value;if(s){for(var a=[],h=2,l=s,c=0;;){if("..."==l&&c>0&&c+3==s.length){h=1;break}var f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+s);if(a.push("*"==f[0]?"":'"'==f[0][0]?JSON.parse(f[0]):f[0]),(c+=f[0].length)==s.length)break;var d=s[c++];if(c==s.length&&"!"==d){h=0;break}if("/"!=d)throw new RangeError("Invalid path: "+s);l=s.slice(c)}var v=a.length-1,g=a[v];if(!g)throw new RangeError("Invalid path: "+s);var p=new un(i,h,v>0?a.slice(0,v):null);e[g]=p.sort(e[g])}}}catch(m){o.e(m)}finally{o.f()}}return hn.add(e)}var hn=new Ie,un=function(){function t(e,n,i,r){(0,l.Z)(this,t),this.tags=e,this.mode=n,this.context=i,this.next=r}return(0,c.Z)(t,[{key:"opaque",get:function(){return 0==this.mode}},{key:"inherit",get:function(){return 1==this.mode}},{key:"sort",value:function(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}},{key:"depth",get:function(){return this.context?this.context.length:0}}]),t}();function ln(t,e){var n,i=Object.create(null),r=(0,u.Z)(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(Array.isArray(o.tag)){var s,a=(0,u.Z)(o.tag);try{for(a.s();!(s=a.n()).done;){var h=s.value;i[h.id]=o.class}}catch(v){a.e(v)}finally{a.f()}}else i[o.tag.id]=o.class}}catch(v){r.e(v)}finally{r.f()}var l=e||{},c=l.scope,f=l.all,d=void 0===f?null:f;return{style:function(t){var e,n=d,r=(0,u.Z)(t);try{for(r.s();!(e=r.n()).done;){var o,s=e.value,a=(0,u.Z)(s.set);try{for(a.s();!(o=a.n()).done;){var h=o.value,l=i[h.id];if(l){n=n?n+" "+l:l;break}}}catch(v){a.e(v)}finally{a.f()}}}catch(v){r.e(v)}finally{r.f()}return n},scope:c}}function cn(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.length,o=new fn(i,Array.isArray(e)?e:[e],n);o.highlightRange(t.cursor(),i,r,"",o.highlighters),o.flush(r)}un.empty=new un([],2,null);var fn=function(){function t(e,n,i){(0,l.Z)(this,t),this.at=e,this.highlighters=n,this.span=i,this.class=""}return(0,c.Z)(t,[{key:"startSpan",value:function(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}},{key:"flush",value:function(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}},{key:"highlightRange",value:function(t,e,n,i,r){var o=t.type,s=t.from,a=t.to;if(!(s>=n||a<=e)){o.isTop&&(r=this.highlighters.filter((function(t){return!t.scope||t.scope(o)})));var h=i,l=function(t){var e=t.type.prop(hn);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||un.empty,c=function(t,e){var n,i=null,r=(0,u.Z)(t);try{for(r.s();!(n=r.n()).done;){var o=n.value.style(e);o&&(i=i?i+" "+o:o)}}catch(s){r.e(s)}finally{r.f()}return i}(r,l.tags);if(c&&(h&&(h+=" "),h+=c,1==l.mode&&(i+=(i?" ":"")+c)),this.startSpan(Math.max(e,s),h),!l.opaque){var f=t.tree&&t.tree.prop(Ie.mounted);if(f&&f.overlay){for(var d=t.node.enter(f.overlay[0].from+s,1),v=this.highlighters.filter((function(t){return!t.scope||t.scope(f.tree.type)})),g=t.firstChild(),p=0,m=s;;p++){var y=p<f.overlay.length?f.overlay[p]:null,k=y?y.from+s:a,w=Math.max(e,m),b=Math.min(n,k);if(w<b&&g)for(;t.from<b&&(this.highlightRange(t,w,b,i,r),this.startSpan(Math.min(b,t.to),h),!(t.to>=k)&&t.nextSibling()););if(!y||k>n)break;(m=y.to+s)>e&&(this.highlightRange(d.cursor(),Math.max(e,y.from+s),Math.min(n,m),"",v),this.startSpan(Math.min(n,m),h))}g&&t.parent()}else if(t.firstChild()){f&&(i="");do{if(!(t.to<=e)){if(t.from>=n)break;this.highlightRange(t,e,n,i,r),this.startSpan(Math.min(n,t.to),h)}}while(t.nextSibling());t.parent()}}}}}]),t}();var dn,vn=rn.define,gn=vn(),pn=vn(),mn=vn(pn),yn=vn(pn),kn=vn(),wn=vn(kn),bn=vn(kn),xn=vn(),Sn=vn(xn),An=vn(),Mn=vn(),Zn=vn(),Cn=vn(Zn),On=vn(),Tn={comment:gn,lineComment:vn(gn),blockComment:vn(gn),docComment:vn(gn),name:pn,variableName:vn(pn),typeName:mn,tagName:vn(mn),propertyName:yn,attributeName:vn(yn),className:vn(pn),labelName:vn(pn),namespace:vn(pn),macroName:vn(pn),literal:kn,string:wn,docString:vn(wn),character:vn(wn),attributeValue:vn(wn),number:bn,integer:vn(bn),float:vn(bn),bool:vn(kn),regexp:vn(kn),escape:vn(kn),color:vn(kn),url:vn(kn),keyword:An,self:vn(An),null:vn(An),atom:vn(An),unit:vn(An),modifier:vn(An),operatorKeyword:vn(An),controlKeyword:vn(An),definitionKeyword:vn(An),moduleKeyword:vn(An),operator:Mn,derefOperator:vn(Mn),arithmeticOperator:vn(Mn),logicOperator:vn(Mn),bitwiseOperator:vn(Mn),compareOperator:vn(Mn),updateOperator:vn(Mn),definitionOperator:vn(Mn),typeOperator:vn(Mn),controlOperator:vn(Mn),punctuation:Zn,separator:vn(Zn),bracket:Cn,angleBracket:vn(Cn),squareBracket:vn(Cn),paren:vn(Cn),brace:vn(Cn),content:xn,heading:Sn,heading1:vn(Sn),heading2:vn(Sn),heading3:vn(Sn),heading4:vn(Sn),heading5:vn(Sn),heading6:vn(Sn),contentSeparator:vn(xn),list:vn(xn),quote:vn(xn),emphasis:vn(xn),strong:vn(xn),link:vn(xn),monospace:vn(xn),strikethrough:vn(xn),inserted:vn(),deleted:vn(),changed:vn(),invalid:vn(),meta:On,documentMeta:vn(On),annotation:vn(On),processingInstruction:vn(On),definition:rn.defineModifier(),constant:rn.defineModifier(),function:rn.defineModifier(),standard:rn.defineModifier(),local:rn.defineModifier(),special:rn.defineModifier()},Dn=(ln([{tag:Tn.link,class:"tok-link"},{tag:Tn.heading,class:"tok-heading"},{tag:Tn.emphasis,class:"tok-emphasis"},{tag:Tn.strong,class:"tok-strong"},{tag:Tn.keyword,class:"tok-keyword"},{tag:Tn.atom,class:"tok-atom"},{tag:Tn.bool,class:"tok-bool"},{tag:Tn.url,class:"tok-url"},{tag:Tn.labelName,class:"tok-labelName"},{tag:Tn.inserted,class:"tok-inserted"},{tag:Tn.deleted,class:"tok-deleted"},{tag:Tn.literal,class:"tok-literal"},{tag:Tn.string,class:"tok-string"},{tag:Tn.number,class:"tok-number"},{tag:[Tn.regexp,Tn.escape,Tn.special(Tn.string)],class:"tok-string2"},{tag:Tn.variableName,class:"tok-variableName"},{tag:Tn.local(Tn.variableName),class:"tok-variableName tok-local"},{tag:Tn.definition(Tn.variableName),class:"tok-variableName tok-definition"},{tag:Tn.special(Tn.variableName),class:"tok-variableName2"},{tag:Tn.definition(Tn.propertyName),class:"tok-propertyName tok-definition"},{tag:Tn.typeName,class:"tok-typeName"},{tag:Tn.namespace,class:"tok-namespace"},{tag:Tn.className,class:"tok-className"},{tag:Tn.macroName,class:"tok-macroName"},{tag:Tn.propertyName,class:"tok-propertyName"},{tag:Tn.operator,class:"tok-operator"},{tag:Tn.comment,class:"tok-comment"},{tag:Tn.meta,class:"tok-meta"},{tag:Tn.invalid,class:"tok-invalid"},{tag:Tn.punctuation,class:"tok-punctuation"}]),n(28450)),En=new v;function Bn(t){return Ct.define({combine:t?function(e){return e.concat(t)}:void 0})}var Rn=new v,In=function(){function t(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";(0,l.Z)(this,t),this.data=e,this.name=r,ve.prototype.hasOwnProperty("tree")||Object.defineProperty(ve.prototype,"tree",{get:function(){return Nn(this)}}),this.parser=n,this.extension=[jn.of(this),ve.languageData.of((function(t,e,n){var i=Pn(t,e,n),r=i.type.prop(En);if(!r)return[];var o=t.facet(r),s=i.type.prop(Rn);if(s){var a,h=i.resolve(e-i.from,n),l=(0,u.Z)(s);try{for(l.s();!(a=l.n()).done;){var c=a.value;if(c.test(h,t)){var f=t.facet(c.facet);return"replace"==c.type?f:f.concat(o)}}}catch(d){l.e(d)}finally{l.f()}}return o}))].concat(i)}return(0,c.Z)(t,[{key:"isActiveAt",value:function(t,e){return Pn(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1).type.prop(En)==this.data}},{key:"findRegions",value:function(t){var e=this,n=t.facet(jn);if((null==n?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];var i=[];return function t(n,r){if(n.prop(En)!=e.data){var o=n.prop(v.mounted);if(o){if(o.tree.prop(En)==e.data){if(o.overlay){var s,a=(0,u.Z)(o.overlay);try{for(a.s();!(s=a.n()).done;){var h=s.value;i.push({from:h.from+r,to:h.to+r})}}catch(d){a.e(d)}finally{a.f()}}else i.push({from:r,to:r+n.length});return}if(o.overlay){var l=i.length;if(t(o.tree,o.overlay[0].from+r),i.length>l)return}}for(var c=0;c<n.children.length;c++){var f=n.children[c];f instanceof x&&t(f,n.positions[c]+r)}}else i.push({from:r,to:r+n.length})}(Nn(t),0),i}},{key:"allowsNesting",get:function(){return!0}}]),t}();function Pn(t,e,n){var i=t.facet(jn),r=Nn(t).topNode;if(!i||i.allowsNesting)for(var o=r;o;o=o.enter(e,n,y.ExcludeBuffers))o.type.isTop&&(r=o);return r}In.setState=ne.define();function Nn(t){var e=t.field(In.state,!1);return e?e.tree:x.empty}var Ln=function(){function t(e){(0,l.Z)(this,t),this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}return(0,c.Z)(t,[{key:"length",get:function(){return this.doc.length}},{key:"syncTo",value:function(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(t){return this.syncTo(t),this.string}},{key:"lineChunks",get:function(){return!0}},{key:"read",value:function(t,e){var n=this.cursorPos-this.string.length;return t<n||e>=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-n,e-n)}}]),t}(),Vn=null,Hn=function(){function t(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,h=arguments.length>7?arguments[7]:void 0;(0,l.Z)(this,t),this.parser=e,this.state=n,this.fragments=i,this.tree=r,this.treeLen=o,this.viewport=s,this.skipped=a,this.scheduleOn=h,this.parse=null,this.tempSkipped=[]}return(0,c.Z)(t,[{key:"startParse",value:function(){return this.parser.startParse(new Ln(this.state.doc),this.fragments)}},{key:"work",value:function(t,e){var n=this;return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=x.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext((function(){var i;if("number"==typeof t){var r=Date.now()+t;t=function(){return Date.now()>r}}for(n.parse||(n.parse=n.startParse()),null!=e&&(null==n.parse.stoppedAt||n.parse.stoppedAt>e)&&e<n.state.doc.length&&n.parse.stopAt(e);;){var o=n.parse.advance();if(o){if(n.fragments=n.withoutTempSkipped(_.addTree(o,n.fragments,null!=n.parse.stoppedAt)),n.treeLen=null!==(i=n.parse.stoppedAt)&&void 0!==i?i:n.state.doc.length,n.tree=o,n.parse=null,!(n.treeLen<(null!=e?e:n.state.doc.length)))return!0;n.parse=n.startParse()}if(t())return!1}}))}},{key:"takeTree",value:function(){var t,e,n=this;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=n.parse.advance()););})),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(_.addTree(this.tree,this.fragments,!0)),this.parse=null)}},{key:"withContext",value:function(t){var e=Vn;Vn=this;try{return t()}finally{Vn=e}}},{key:"withoutTempSkipped",value:function(t){for(var e;e=this.tempSkipped.pop();)t=Wn(t,e.from,e.to);return t}},{key:"changes",value:function(e,n){var i=this.fragments,r=this.tree,o=this.treeLen,s=this.viewport,a=this.skipped;if(this.takeTree(),!e.empty){var h=[];if(e.iterChangedRanges((function(t,e,n,i){return h.push({fromA:t,toA:e,fromB:n,toB:i})})),i=_.applyChanges(i,h),r=x.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){a=[];var l,c=(0,u.Z)(this.skipped);try{for(c.s();!(l=c.n()).done;){var f=l.value,d=e.mapPos(f.from,1),v=e.mapPos(f.to,-1);d<v&&a.push({from:d,to:v})}}catch(g){c.e(g)}finally{c.f()}}}return new t(this.parser,n,i,r,o,s,a,this.scheduleOn)}},{key:"updateViewport",value:function(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;for(var e=this.skipped.length,n=0;n<this.skipped.length;n++){var i=this.skipped[n],r=i.from,o=i.to;r<t.to&&o>t.from&&(this.fragments=Wn(this.fragments,r,o),this.skipped.splice(n--,1))}return!(this.skipped.length>=e)&&(this.reset(),!0)}},{key:"reset",value:function(){this.parse&&(this.takeTree(),this.parse=null)}},{key:"skipUntilInView",value:function(t,e){this.skipped.push({from:t,to:e})}},{key:"isDone",value:function(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(e,n,i){return new t(e,n,[],x.empty,0,i,[],null)}},{key:"getSkippingParser",value:function(t){return new(function(e){function n(){return(0,l.Z)(this,n),(0,a.Z)(this,n,arguments)}return(0,h.Z)(n,e),(0,c.Z)(n,[{key:"createParse",value:function(e,n,i){var r=i[0].from,o=i[i.length-1].to;return{parsedPos:r,advance:function(){var e=Vn;if(e){var n,s=(0,u.Z)(i);try{for(s.s();!(n=s.n()).done;){var a=n.value;e.tempSkipped.push(a)}}catch(h){s.e(h)}finally{s.f()}t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=o,new x(m.none,[],[],o-r)},stoppedAt:null,stopAt:function(){}}}}]),n}(z))}},{key:"get",value:function(){return Vn}}]),t}();function Wn(t,e,n){return _.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}var _n=function(){function t(e){(0,l.Z)(this,t),this.context=e,this.tree=e.tree}return(0,c.Z)(t,[{key:"apply",value:function(e){if(!e.docChanged&&this.tree==this.context.tree)return this;var n=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,i)||n.takeTree(),new t(n)}}],[{key:"init",value:function(e){var n=Math.min(3e3,e.doc.length),i=Hn.create(e.facet(jn).parser,e,{from:0,to:n});return i.work(20,n)||i.takeTree(),new t(i)}}]),t}();In.state=Rt.define({create:_n.init,update:function(t,e){var n,i=(0,u.Z)(e.effects);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(r.is(In.setState))return r.value}}catch(o){i.e(o)}finally{i.f()}return e.startState.facet(jn)!=e.state.facet(jn)?_n.init(e.state):t.apply(e)}});var zn=function(t){var e=setTimeout((function(){return t()}),500);return function(){return clearTimeout(e)}};"undefined"!=typeof requestIdleCallback&&(zn=function(t){var e=-1,n=setTimeout((function(){e=requestIdleCallback(t,{timeout:400})}),100);return function(){return e<0?clearTimeout(n):cancelIdleCallback(e)}});var Fn="undefined"!=typeof navigator&&(null===(dn=navigator.scheduling)||void 0===dn?void 0:dn.isInputPending)?function(){return navigator.scheduling.isInputPending()}:null,qn=Be.lg.fromClass(function(){function t(e){(0,l.Z)(this,t),this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}return(0,c.Z)(t,[{key:"update",value:function(t){var e=this.view.state.field(In.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(){if(!this.working){var t=this.view.state,e=t.field(In.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=zn(this.work))}}},{key:"work",value:function(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)){var n=this.view,i=n.state,r=n.viewport.to,o=i.field(In.state);if(o.tree!=o.context.tree||!o.context.isDone(r+1e5)){var s=Date.now()+Math.min(this.chunkBudget,100,t&&!Fn?Math.max(25,t.timeRemaining()-5):1e9),a=o.context.treeLen<r&&i.doc.length>r+1e3,h=o.context.work((function(){return Fn&&Fn()||Date.now()>s}),r+(a?0:1e5));this.chunkBudget-=Date.now()-e,(h||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:In.setState.of(new _n(o.context))})),this.chunkBudget>0&&(!h||a)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}}}},{key:"checkAsyncSchedule",value:function(t){var e=this;t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((function(){return e.scheduleWork()})).catch((function(t){return(0,Be.OO)(e.view.state,t)})).then((function(){return e.workScheduled--})),t.scheduleOn=null)}},{key:"destroy",value:function(){this.working&&this.working()}},{key:"isWorking",value:function(){return!!(this.working||this.workScheduled>0)}}]),t}(),{eventHandlers:{focus:function(){this.scheduleWork()}}}),jn=Ct.define({combine:function(t){return t.length?t[0]:null},enables:function(t){return[In.state,qn,Be.tk.contentAttributes.compute([t],(function(e){var n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}}))]}}),Kn=Ct.define(),Jn=Ct.define({combine:function(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}});function Un(t){var e=t.facet(Jn);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Gn(t,e){var n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);return n>=i?void 0:{from:n,to:i}}var $n=ne.define({map:Gn}),Xn=ne.define({map:Gn});var Yn=Rt.define({create:function(){return Be.p.none},update:function(t,e){t=t.map(e.changes);var n,i=(0,u.Z)(e.effects);try{var r=function(){var i=n.value;if(i.is($n)&&!function(t,e,n){var i=!1;return t.between(e,e,(function(t,r){t==e&&r==n&&(i=!0)})),i}(t,i.value.from,i.value.to)){var r=e.state.facet(ei).preparePlaceholder,o=r?Be.p.replace({widget:new ri(r(e.state,i.value))}):ii;t=t.update({add:[o.range(i.value.from,i.value.to)]})}else i.is(Xn)&&(t=t.update({filter:function(t,e){return i.value.from!=t||i.value.to!=e},filterFrom:i.value.from,filterTo:i.value.to}))};for(i.s();!(n=i.n()).done;)r()}catch(a){i.e(a)}finally{i.f()}if(e.selection){var o=!1,s=e.selection.main.head;t.between(s,s,(function(t,e){t<s&&e>s&&(o=!0)})),o&&(t=t.update({filterFrom:s,filterTo:s,filter:function(t,e){return e<=s||t>=s}}))}return t},provide:function(t){return Be.tk.decorations.from(t)},toJSON:function(t,e){var n=[];return t.between(0,e.doc.length,(function(t,e){n.push(t,e)})),n},fromJSON:function(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");for(var e=[],n=0;n<t.length;){var i=t[n++],r=t[n++];if("number"!=typeof i||"number"!=typeof r)throw new RangeError("Invalid JSON for fold state");e.push(ii.range(i,r))}return Be.p.set(e,!0)}});function Qn(t,e,n){var i,r=null;return null===(i=t.field(Yn,!1))||void 0===i||i.between(e,n,(function(t,e){(!r||r.from>t)&&(r={from:t,to:e})})),r}var ti={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},ei=Ct.define({combine:function(t){return ge(t,ti)}});function ni(t,e){var n=t.state,i=n.facet(ei),r=function(e){var n=t.lineBlockAt(t.posAtDOM(e.target)),i=Qn(t.state,n.from,n.to);i&&t.dispatch({effects:Xn.of(i)}),e.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(t,r,e);var o=document.createElement("span");return o.textContent=i.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=r,o}var ii=Be.p.replace({widget:new(function(t){function e(){return(0,l.Z)(this,e),(0,a.Z)(this,e,arguments)}return(0,h.Z)(e,t),(0,c.Z)(e,[{key:"toDOM",value:function(t){return ni(t,null)}}]),e}(Be.l9))}),ri=function(t){function e(t){var n;return(0,l.Z)(this,e),(n=(0,a.Z)(this,e)).value=t,n}return(0,h.Z)(e,t),(0,c.Z)(e,[{key:"eq",value:function(t){return this.value==t.value}},{key:"toDOM",value:function(t){return ni(t,this.value)}}]),e}(Be.l9);var oi=function(){function t(e,n){var i;function r(t){var e=Dn.V.newName();return(i||(i=Object.create(null)))["."+e]=t,e}(0,l.Z)(this,t),this.specs=e;var o="string"==typeof n.all?n.all:n.all?r(n.all):void 0,s=n.scope;this.scope=s instanceof In?function(t){return t.prop(En)==s.data}:s?function(t){return t==s}:void 0,this.style=ln(e.map((function(t){return{tag:t.tag,class:t.class||r(Object.assign({},t,{tag:null}))}})),{all:o}).style,this.module=i?new Dn.V(i):null,this.themeType=n.themeType}return(0,c.Z)(t,null,[{key:"define",value:function(e,n){return new t(e,n||{})}}]),t}(),si=Ct.define(),ai=Ct.define({combine:function(t){return t.length?[t[0]]:null}});function hi(t){var e=t.facet(si);return e.length?e:t.facet(ai)}function ui(t,e){var n,i=[fi];return t instanceof oi&&(t.module&&i.push(Be.tk.styleModule.of(t.module)),n=t.themeType),(null==e?void 0:e.fallback)?i.push(ai.of(t)):n?i.push(si.computeN([Be.tk.darkTheme],(function(e){return e.facet(Be.tk.darkTheme)==("dark"==n)?[t]:[]}))):i.push(si.of(t)),i}function li(t,e,n){var i=hi(t),r=null;if(i){var o,s=(0,u.Z)(i);try{for(s.s();!(o=s.n()).done;){var a=o.value;if(!a.scope||n&&a.scope(n)){var h=a.style(e);h&&(r=r?r+" "+h:h)}}}catch(l){s.e(l)}finally{s.f()}}return r}var ci=function(){function t(e){(0,l.Z)(this,t),this.markCache=Object.create(null),this.tree=Nn(e.state),this.decorations=this.buildDeco(e,hi(e.state))}return(0,c.Z)(t,[{key:"update",value:function(t){var e=Nn(t.state),n=hi(t.state),i=n!=hi(t.startState);e.length<t.view.viewport.to&&!i&&e.type==this.tree.type?this.decorations=this.decorations.map(t.changes):(e!=this.tree||t.viewportChanged||i)&&(this.tree=e,this.decorations=this.buildDeco(t.view,n))}},{key:"buildDeco",value:function(t,e){var n=this;if(!e||!this.tree.length)return Be.p.none;var i,r=new be,o=(0,u.Z)(t.visibleRanges);try{for(o.s();!(i=o.n()).done;){var s=i.value,a=s.from,h=s.to;cn(this.tree,e,(function(t,e,i){r.add(t,e,n.markCache[i]||(n.markCache[i]=Be.p.mark({class:i})))}),a,h)}}catch(l){o.e(l)}finally{o.f()}return r.finish()}}]),t}(),fi=Ht.high(Be.lg.fromClass(ci,{decorations:function(t){return t.decorations}}));Tn.meta,Tn.link,Tn.heading,Tn.emphasis,Tn.strong,Tn.strikethrough,Tn.keyword,Tn.atom,Tn.bool,Tn.url,Tn.contentSeparator,Tn.labelName,Tn.literal,Tn.inserted,Tn.string,Tn.deleted,Tn.regexp,Tn.escape,Tn.string,Tn.variableName,Tn.variableName,Tn.typeName,Tn.namespace,Tn.className,Tn.variableName,Tn.macroName,Tn.propertyName,Tn.comment,Tn.invalid;function di(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;null==e&&-1==(e=t.search(/[^\s\u00a0]/))&&(e=t.length);for(var o=r,s=i;s<e;s++)9==t.charCodeAt(s)?o+=n-o%n:o++;return o}var vi=function(){function t(e,n,i,r){(0,l.Z)(this,t),this.string=e,this.tabSize=n,this.indentUnit=i,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}return(0,c.Z)(t,[{key:"eol",value:function(){return this.pos>=this.string.length}},{key:"sol",value:function(){return 0==this.pos}},{key:"peek",value:function(){return this.string.charAt(this.pos)||void 0}},{key:"next",value:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}},{key:"eat",value:function(t){var e=this.string.charAt(this.pos);if("string"==typeof t?e==t:e&&(t instanceof RegExp?t.test(e):t(e)))return++this.pos,e}},{key:"eatWhile",value:function(t){for(var e=this.pos;this.eat(t););return this.pos>e}},{key:"eatSpace",value:function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}},{key:"skipToEnd",value:function(){this.pos=this.string.length}},{key:"skipTo",value:function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0}},{key:"backUp",value:function(t){this.pos-=t}},{key:"column",value:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=di(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}},{key:"indentation",value:function(){var t;return null!==(t=this.overrideIndent)&&void 0!==t?t:di(this.string,null,this.tabSize)}},{key:"match",value:function(t,e,n){if("string"==typeof t){var i=function(t){return n?t.toLowerCase():t};return i(this.string.substr(this.pos,t.length))==i(t)?(!1!==e&&(this.pos+=t.length),!0):null}var r=this.string.slice(this.pos).match(t);return r&&r.index>0?null:(r&&!1!==e&&(this.pos+=r[0].length),r)}},{key:"current",value:function(){return this.string.slice(this.start,this.pos)}}]),t}();function gi(t){if("object"!=(0,s.Z)(t))return t;var e={};for(var n in t){var i=t[n];e[n]=i instanceof Array?i.slice():i}return e}var pi=new WeakMap,mi=function(t){function e(t){var n;(0,l.Z)(this,e);var i,r,s=Bn(t.languageData),u={name:(r=t).name||"",token:r.token,blankLine:r.blankLine||function(){},startState:r.startState||function(){return!0},copyState:r.copyState||gi,indent:r.indent||function(){return null},languageData:r.languageData||{},tokenTable:r.tokenTable||xi},f=new(function(t){function e(){return(0,l.Z)(this,e),(0,a.Z)(this,e,arguments)}return(0,h.Z)(e,t),(0,c.Z)(e,[{key:"createParse",value:function(t,e,n){return new wi(i,t,e,n)}}]),e}(z));return(n=(0,a.Z)(this,e,[s,f,[Kn.of((function(t,e){return n.getIndent(t,e)}))],t.name])).topNode=function(t){var e=m.define({id:Si.length,name:"Document",props:[En.add((function(){return t}))],top:!0});return Si.push(e),e}(s),i=(0,o.Z)(n),n.streamParser=u,n.stateAfter=new v({perNode:!0}),n.tokenTable=t.tokenTable?new Ri(u.tokenTable):Ii,n}return(0,h.Z)(e,t),(0,c.Z)(e,[{key:"getIndent",value:function(t,e){for(var n=Nn(t.state),i=n.resolve(e);i&&i.type!=this.topNode;)i=i.parent;if(!i)return null;var r=void 0,o=t.options.overrideIndentation;o&&null!=(r=pi.get(t.state))&&r<e-1e4&&(r=void 0);var s,a,h=yi(this,n,0,i.from,null!=r?r:e);if(h?(a=h.state,s=h.pos+1):(a=this.streamParser.startState(t.unit),s=0),e-s>1e4)return null;for(;s<e;){var u=t.state.doc.lineAt(s),l=Math.min(e,u.to);if(u.length)for(var c=o?o(u.from):-1,f=new vi(u.text,t.state.tabSize,t.unit,c<0?void 0:c);f.pos<l-u.from;)bi(this.streamParser.token,f,a);else this.streamParser.blankLine(a,t.unit);if(l==e)break;s=u.to+1}var d=t.lineAt(e);return o&&null==r&&pi.set(t.state,d.from),this.streamParser.indent(a,/^\s*(.*)/.exec(d.text)[1],t)}},{key:"allowsNesting",get:function(){return!1}}],[{key:"define",value:function(t){return new e(t)}}]),e}(In);function yi(t,e,n,i,r){var o=n>=i&&n+e.length<=r&&e.prop(t.stateAfter);if(o)return{state:t.streamParser.copyState(o),pos:n+e.length};for(var s=e.children.length-1;s>=0;s--){var a=e.children[s],h=n+e.positions[s],u=a instanceof x&&h<r&&yi(t,a,h,i,r);if(u)return u}return null}function ki(t,e,n,i,r){if(r&&n<=0&&i>=e.length)return e;r||e.type!=t.topNode||(r=!0);for(var o=e.children.length-1;o>=0;o--){var s=e.positions[o],a=e.children[o],h=void 0;if(s<i&&a instanceof x){if(!(h=ki(t,a,n-s,i-s,r)))break;return r?new x(e.type,e.children.slice(0,o).concat(h),e.positions.slice(0,o+1),s+h.length):h}}return null}var wi=function(){function t(e,n,i,r){(0,l.Z)(this,t),this.lang=e,this.input=n,this.fragments=i,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to;var o=Hn.get(),s=r[0].from,a=function(t,e,n,i){var r,o=(0,u.Z)(e);try{for(o.s();!(r=o.n()).done;){var s=r.value,a=s.from+(s.openStart?25:0),h=s.to-(s.openEnd?25:0),l=a<=n&&h>n&&yi(t,s.tree,0-s.offset,n,h),c=void 0;if(l&&(c=ki(t,s.tree,n+s.offset,l.pos+s.offset,!1)))return{state:l.state,tree:c}}}catch(f){o.e(f)}finally{o.f()}return{state:t.streamParser.startState(i?Un(i):4),tree:x.empty}}(e,i,s,null==o?void 0:o.state),h=a.state,c=a.tree;this.state=h,this.parsedPos=this.chunkStart=s+c.length;for(var f=0;f<c.children.length;f++)this.chunks.push(c.children[f]),this.chunkPos.push(c.positions[f]);o&&this.parsedPos<o.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Un(o.state)),o.skipUntilInView(this.parsedPos,o.viewport.from),this.parsedPos=o.viewport.from),this.moveRangeIndex()}return(0,c.Z)(t,[{key:"advance",value:function(){var t=Hn.get(),e=null==this.stoppedAt?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(e,this.chunkStart+2048);for(t&&(n=Math.min(n,t.viewport.to));this.parsedPos<n;)this.parseLine(t);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=e?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,e),this.finish()):null}},{key:"stopAt",value:function(t){this.stoppedAt=t}},{key:"lineAfter",value:function(t){var e=this.input.chunk(t);if(this.input.lineChunks)"\n"==e&&(e="");else{var n=e.indexOf("\n");n>-1&&(e=e.slice(0,n))}return t+e.length<=this.to?e:e.slice(0,this.to-t)}},{key:"nextLine",value:function(){for(var t=this.parsedPos,e=this.lineAfter(t),n=t+e.length,i=this.rangeIndex;;){var r=this.ranges[i].to;if(r>=n)break;if(e=e.slice(0,r-(n-e.length)),++i==this.ranges.length)break;var o=this.ranges[i].from,s=this.lineAfter(o);e+=s,n=o+s.length}return{line:e,end:n}}},{key:"skipGapsTo",value:function(t,e,n){for(;;){var i=this.ranges[this.rangeIndex].to,r=t+e;if(n>0?i>r:i>=r)break;e+=this.ranges[++this.rangeIndex].from-i}return e}},{key:"moveRangeIndex",value:function(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}},{key:"emitToken",value:function(t,e,n,i,r){if(this.ranges.length>1){e+=r=this.skipGapsTo(e,r,1);var o=this.chunk.length;n+=r=this.skipGapsTo(n,r,-1),i+=this.chunk.length-o}return this.chunk.push(t,e,n,i),r}},{key:"parseLine",value:function(t){var e=this.nextLine(),n=e.line,i=e.end,r=0,o=this.lang.streamParser,s=new vi(n,t?t.state.tabSize:4,t?Un(t.state):2);if(s.eol())o.blankLine(this.state,s.indentUnit);else for(;!s.eol();){var a=bi(o.token,s,this.state);if(a&&(r=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+s.start,this.parsedPos+s.pos,4,r)),s.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}},{key:"finishChunk",value:function(){var t=x.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Ai,topID:0,maxBufferLength:2048,reused:this.chunkReused});t=new x(t.type,t.children,t.positions,t.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(t),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}},{key:"finish",value:function(){return new x(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}]),t}();function bi(t,e,n){e.start=e.pos;for(var i=0;i<10;i++){var r=t(e,n);if(e.pos>e.start)return r}throw new Error("Stream parser failed to advance stream.")}for(var xi=Object.create(null),Si=[m.none],Ai=new k(Si),Mi=[],Zi=Object.create(null),Ci=Object.create(null),Oi=0,Ti=[["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"]];Oi<Ti.length;Oi++){var Di=(0,r.Z)(Ti[Oi],2),Ei=Di[0],Bi=Di[1];Ci[Ei]=Ni(xi,Bi)}var Ri=function(){function t(e){(0,l.Z)(this,t),this.extra=e,this.table=Object.assign(Object.create(null),Ci)}return(0,c.Z)(t,[{key:"resolve",value:function(t){return t?this.table[t]||(this.table[t]=Ni(this.extra,t)):0}}]),t}(),Ii=new Ri(xi);function Pi(t,e){Mi.indexOf(t)>-1||(Mi.push(t),console.warn(e))}function Ni(t,e){var n,r=[],o=(0,u.Z)(e.split(" "));try{for(o.s();!(n=o.n()).done;){var s,a=n.value,h=[],l=(0,u.Z)(a.split("."));try{for(l.s();!(s=l.n()).done;){var c=s.value,f=t[c]||Tn[c];f?"function"==typeof f?h.length?h=h.map(f):Pi(c,"Modifier ".concat(c," used at start of tag")):h.length?Pi(c,"Tag ".concat(c," used as modifier")):h=Array.isArray(f)?f:[f]:Pi(c,"Unknown highlighting tag ".concat(c))}}catch(b){l.e(b)}finally{l.f()}var d,v=(0,u.Z)(h);try{for(v.s();!(d=v.n()).done;){var g=d.value;r.push(g)}}catch(b){v.e(b)}finally{v.f()}}}catch(b){o.e(b)}finally{o.f()}if(!r.length)return 0;var p=e.replace(/ /g,"_"),y=p+" "+r.map((function(t){return t.id})),k=Zi[y];if(k)return k.id;var w=Zi[y]=m.define({id:Si.length,name:p,props:[an((0,i.Z)({},p,r))]});return Si.push(w),w.id}Be.Nm.RTL,Be.Nm.LTR},17429:function(t,e,n){n.d(e,{b:function(){return u}});n(10999),n(52117),n(63789),n(82479),n(94570),n(91989),n(18098);var i=["and","as","block","endblock","by","cycle","debug","else","elif","extends","filter","endfilter","firstof","do","for","endfor","if","endif","ifchanged","endifchanged","ifequal","endifequal","ifnotequal","set","raw","endraw","endifnotequal","in","include","load","not","now","or","parsed","regroup","reversed","spaceless","call","endcall","macro","endmacro","endspaceless","ssi","templatetag","openblock","closeblock","openvariable","closevariable","without","context","openbrace","closebrace","opencomment","closecomment","widthratio","url","with","endwith","get_current_language","trans","endtrans","noop","blocktrans","endblocktrans","get_available_languages","get_current_language_bidi","pluralize","autoescape","endautoescape"],r=/^[+\-*&%=<>!?|~^]/,o=/^[:\[\(\{]/,s=["true","false"],a=/^(\d[+\-\*\/])?\d+(\.\d+)?/;function h(t,e){var n=t.peek();if(e.incomment)return t.skipTo("#}")?(t.eatWhile(/\#|}/),e.incomment=!1):t.skipToEnd(),"comment";if(e.intag){if(e.operator){if(e.operator=!1,t.match(s))return"atom";if(t.match(a))return"number"}if(e.sign){if(e.sign=!1,t.match(s))return"atom";if(t.match(a))return"number"}if(e.instring)return n==e.instring&&(e.instring=!1),t.next(),"string";if("'"==n||'"'==n)return e.instring=n,t.next(),"string";if(e.inbraces>0&&")"==n)t.next(),e.inbraces--;else if("("==n)t.next(),e.inbraces++;else if(e.inbrackets>0&&"]"==n)t.next(),e.inbrackets--;else if("["==n)t.next(),e.inbrackets++;else{if(!e.lineTag&&(t.match(e.intag+"}")||t.eat("-")&&t.match(e.intag+"}")))return e.intag=!1,"tag";if(t.match(r))return e.operator=!0,"operator";if(t.match(o))e.sign=!0;else{if(1==t.column()&&e.lineTag&&t.match(i))return"keyword";if(t.eat(" ")||t.sol()){if(t.match(i))return"keyword";if(t.match(s))return"atom";if(t.match(a))return"number";t.sol()&&t.next()}else t.next()}}return"variable"}if(t.eat("{")){if(t.eat("#"))return e.incomment=!0,t.skipTo("#}")?(t.eatWhile(/\#|}/),e.incomment=!1):t.skipToEnd(),"comment";if(n=t.eat(/\{|%/))return e.intag=n,e.inbraces=0,e.inbrackets=0,"{"==n&&(e.intag="}"),t.eat("-"),"tag"}else if(t.eat("#")){if("#"==t.peek())return t.skipToEnd(),"comment";if(!t.eol())return e.intag=!0,e.lineTag=!0,e.inbraces=0,e.inbrackets=0,"tag"}t.next()}i=new RegExp("(("+i.join(")|(")+"))\\b"),s=new RegExp("(("+s.join(")|(")+"))\\b");var u={name:"jinja2",startState:function(){return{tokenize:h,inbrackets:0,inbraces:0}},token:function(t,e){var n=e.tokenize(t,e);return t.eol()&&e.lineTag&&!e.instring&&0==e.inbraces&&0==e.inbrackets&&(e.intag=!1,e.lineTag=!1),n},languageData:{commentTokens:{block:{open:"{#",close:"#}",line:"##"}}}}},76697:function(t,e,n){n.d(e,{r:function(){return r}});n(10999),n(52117),n(63789),n(82479),n(94570),n(91989),n(99397),n(18098);var i=new RegExp("\\b(("+["true","false","on","off","yes","no"].join(")|(")+"))$","i"),r={name:"yaml",token:function(t,e){var n=t.peek(),r=e.escaped;if(e.escaped=!1,"#"==n&&(0==t.pos||/\s/.test(t.string.charAt(t.pos-1))))return t.skipToEnd(),"comment";if(t.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(e.literal&&t.indentation()>e.keyCol)return t.skipToEnd(),"string";if(e.literal&&(e.literal=!1),t.sol()){if(e.keyCol=0,e.pair=!1,e.pairStart=!1,t.match("---"))return"def";if(t.match("..."))return"def";if(t.match(/^\s*-\s+/))return"meta"}if(t.match(/^(\{|\}|\[|\])/))return"{"==n?e.inlinePairs++:"}"==n?e.inlinePairs--:"["==n?e.inlineList++:e.inlineList--,"meta";if(e.inlineList>0&&!r&&","==n)return t.next(),"meta";if(e.inlinePairs>0&&!r&&","==n)return e.keyCol=0,e.pair=!1,e.pairStart=!1,t.next(),"meta";if(e.pairStart){if(t.match(/^\s*(\||\>)\s*/))return e.literal=!0,"meta";if(t.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable";if(0==e.inlinePairs&&t.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(e.inlinePairs>0&&t.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(t.match(i))return"keyword"}return!e.pair&&t.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(e.pair=!0,e.keyCol=t.indentation(),"atom"):e.pair&&t.match(/^:\s*/)?(e.pairStart=!0,"meta"):(e.pairStart=!1,e.escaped="\\"==n,t.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}},languageData:{commentTokens:{line:"#"}}}},52456:function(t,e,n){n.d(e,{sW:function(){return Do},Lp:function(){return ls}});var i=n(46097),r=n(68308),o=n(69205),s=n(40039),a=n(62746),h=n(71650),u=n(33368),l=(n(63789),n(99397),n(18098),n(41353),n(36513),n(94738),n(98214),n(46798),n(20254),n(51358),n(5239),n(98490),n(10999),n(52117),n(82479),n(94570),n(17692),n(39685),n(71791),n(50617),n(11451),n(46349),n(70320),n(9849),n(13526),n(35221),n(24074),n(86658),n(97393),n(82390)),c=n(34541),f=n(47838),d=(n(51467),n(22859),n(91989),n(57778),n(85472),n(65974),n(56308),n(71779),n(90126),n(49089),n(80641),n(47084),n(75164),n(87438),n(22890),n(80628),n(37313),n(27392),n(96043),n(64777),n(34997),n(12148),n(78399),n(56086),n(47884),n(81912),n(64584),n(41483),n(12367),n(9454),n(85717),n(73855),n(54299),n(50289),n(94167),n(86439),function(){function t(){(0,h.Z)(this,t)}return(0,u.Z)(t,[{key:"lineAt",value:function(t){if(t<0||t>this.length)throw new RangeError("Invalid position ".concat(t," in document of length ").concat(this.length));return this.lineInner(t,!1,1,0)}},{key:"line",value:function(t){if(t<1||t>this.lines)throw new RangeError("Invalid line number ".concat(t," in ").concat(this.lines,"-line document"));return this.lineInner(t,!0,1,0)}},{key:"replace",value:function(t,e,n){var i=[];return this.decompose(0,t,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(e,this.length,i,1),g.from(i,this.length-(e-t)+n.length)}},{key:"append",value:function(t){return this.replace(this.length,this.length,t)}},{key:"slice",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=[];return this.decompose(t,e,n,0),g.from(n,e-t)}},{key:"eq",value:function(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;for(var e=this.scanIdentical(t,1),n=this.length-this.scanIdentical(t,-1),i=new y(this),r=new y(t),o=e,s=e;;){if(i.next(o),r.next(o),o=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}},{key:"iter",value:function(){return new y(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)}},{key:"iterRange",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return new k(this,t,e)}},{key:"iterLines",value:function(t,e){var n;if(null==t)n=this.iter();else{null==e&&(e=this.lines+1);var i=this.line(t).from;n=this.iterRange(i,Math.max(i,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new w(n)}},{key:"toString",value:function(){return this.sliceString(0)}},{key:"toJSON",value:function(){var t=[];return this.flatten(t),t}}],[{key:"of",value:function(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new v(e):g.from(v.split(e,[])):t.empty}}]),t}()),v=function(t){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){var e,n=-1,i=(0,s.Z)(t);try{for(i.s();!(e=i.n()).done;){n+=e.value.length+1}}catch(r){i.e(r)}finally{i.f()}return n}(t);return(0,h.Z)(this,e),(n=(0,r.Z)(this,e)).text=t,n.length=i,n}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"lines",get:function(){return this.text.length}},{key:"children",get:function(){return null}},{key:"lineInner",value:function(t,e,n,i){for(var r=0;;r++){var o=this.text[r],s=i+o.length;if((e?n:s)>=t)return new b(i,s,n,o);i=s+1,n++}}},{key:"decompose",value:function(t,n,i,r){var o=t<=0&&n>=this.length?this:new e(m(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(1&r){var s=i.pop(),a=p(o.text,s.text.slice(),0,o.length);if(a.length<=32)i.push(new e(a,s.length+o.length));else{var h=a.length>>1;i.push(new e(a.slice(0,h)),new e(a.slice(h)))}}else i.push(o)}},{key:"replace",value:function(t,n,i){if(!(i instanceof e))return(0,c.Z)((0,f.Z)(e.prototype),"replace",this).call(this,t,n,i);var r=p(this.text,p(i.text,m(this.text,0,t)),n),o=this.length+i.length-(n-t);return r.length<=32?new e(r,o):g.from(e.split(r,[]),o)}},{key:"sliceString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",i="",r=0,o=0;r<=e&&o<this.text.length;o++){var s=this.text[o],a=r+s.length;r>t&&o&&(i+=n),t<a&&e>r&&(i+=s.slice(Math.max(0,t-r),e-r)),r=a+1}return i}},{key:"flatten",value:function(t){var e,n=(0,s.Z)(this.text);try{for(n.s();!(e=n.n()).done;){var i=e.value;t.push(i)}}catch(r){n.e(r)}finally{n.f()}}},{key:"scanIdentical",value:function(){return 0}}],[{key:"split",value:function(t,n){var i,r=[],o=-1,a=(0,s.Z)(t);try{for(a.s();!(i=a.n()).done;){var h=i.value;r.push(h),o+=h.length+1,32==r.length&&(n.push(new e(r,o)),r=[],o=-1)}}catch(u){a.e(u)}finally{a.f()}return o>-1&&n.push(new e(r,o)),n}}]),e}(d),g=function(t){function e(t,n){var i;(0,h.Z)(this,e),(i=(0,r.Z)(this,e)).children=t,i.length=n,i.lines=0;var o,a=(0,s.Z)(t);try{for(a.s();!(o=a.n()).done;){var u=o.value;i.lines+=u.lines}}catch(l){a.e(l)}finally{a.f()}return i}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"lineInner",value:function(t,e,n,i){for(var r=0;;r++){var o=this.children[r],s=i+o.length,a=n+o.lines-1;if((e?a:s)>=t)return o.lineInner(t,e,n,i);i=s+1,n=a+1}}},{key:"decompose",value:function(t,e,n,i){for(var r=0,o=0;o<=e&&r<this.children.length;r++){var s=this.children[r],a=o+s.length;if(t<=a&&e>=o){var h=i&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?n.push(s):s.decompose(t-o,e-o,n,h)}o=a+1}}},{key:"replace",value:function(t,n,i){if(i.lines<this.lines)for(var r=0,o=0;r<this.children.length;r++){var s=this.children[r],a=o+s.length;if(t>=o&&n<=a){var h=s.replace(t-o,n-o,i),u=this.lines-s.lines+h.lines;if(h.lines<u>>4&&h.lines>u>>6){var l=this.children.slice();return l[r]=h,new e(l,this.length-(n-t)+i.length)}return(0,c.Z)((0,f.Z)(e.prototype),"replace",this).call(this,o,a,h)}o=a+1}return(0,c.Z)((0,f.Z)(e.prototype),"replace",this).call(this,t,n,i)}},{key:"sliceString",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",i="",r=0,o=0;r<this.children.length&&o<=e;r++){var s=this.children[r],a=o+s.length;o>t&&r&&(i+=n),t<a&&e>o&&(i+=s.sliceString(t-o,e-o,n)),o=a+1}return i}},{key:"flatten",value:function(t){var e,n=(0,s.Z)(this.children);try{for(n.s();!(e=n.n()).done;){e.value.flatten(t)}}catch(i){n.e(i)}finally{n.f()}}},{key:"scanIdentical",value:function(t,n){if(!(t instanceof e))return 0;for(var i=0,r=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1],o=(0,a.Z)(r,4),s=o[0],h=o[1],u=o[2],l=o[3];;s+=n,h+=n){if(s==u||h==l)return i;var c=this.children[s],f=t.children[h];if(c!=f)return i+c.scanIdentical(f,n);i+=c.length+1}}}],[{key:"from",value:function(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.reduce((function(t,e){return t+e.length+1}),-1),r=0,o=(0,s.Z)(t);try{for(o.s();!(n=o.n()).done;){r+=n.value.lines}}catch(x){o.e(x)}finally{o.f()}if(r<32){var a,h=[],u=(0,s.Z)(t);try{for(u.s();!(a=u.n()).done;){a.value.flatten(h)}}catch(x){u.e(x)}finally{u.f()}return new v(h,i)}var l=Math.max(32,r>>5),c=l<<1,f=l>>1,d=[],g=0,p=-1,m=[];function y(t){var n;if(t.lines>c&&t instanceof e){var i,r=(0,s.Z)(t.children);try{for(r.s();!(i=r.n()).done;){y(i.value)}}catch(x){r.e(x)}finally{r.f()}}else t.lines>f&&(g>f||!g)?(k(),d.push(t)):t instanceof v&&g&&(n=m[m.length-1])instanceof v&&t.lines+n.lines<=32?(g+=t.lines,p+=t.length+1,m[m.length-1]=new v(n.text.concat(t.text),n.length+1+t.length)):(g+t.lines>l&&k(),g+=t.lines,p+=t.length+1,m.push(t))}function k(){0!=g&&(d.push(1==m.length?m[0]:e.from(m,p)),p=-1,g=m.length=0)}var w,b=(0,s.Z)(t);try{for(b.s();!(w=b.n()).done;){y(w.value)}}catch(x){b.e(x)}finally{b.f()}return k(),1==d.length?d[0]:new e(d,i)}}]),e}(d);function p(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e9,r=0,o=0,s=!0;o<t.length&&r<=i;o++){var a=t[o],h=r+a.length;h>=n&&(h>i&&(a=a.slice(0,i-r)),r<n&&(a=a.slice(n-r)),s?(e[e.length-1]+=a,s=!1):e.push(a)),r=h+1}return e}function m(t,e,n){return p(t,[""],e,n)}d.empty=new v([""],0);var y=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;(0,h.Z)(this,t),this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof v?e.text.length:e.children.length)<<1]}return(0,u.Z)(t,[{key:"nextInner",value:function(t,e){for(this.done=this.lineBreak=!1;;){var n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],o=r>>1,s=i instanceof v?i.text.length:i.children.length;if(o==(e>0?s:0)){if(0==n)return this.done=!0,this.value="",this;e>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(e>0?0:1)){if(this.offsets[n]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(i instanceof v){var a=i.text[o+(e<0?-1:0)];if(this.offsets[n]+=e,a.length>Math.max(0,t))return this.value=0==t?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{var h=i.children[o+(e<0?-1:0)];t>h.length?(t-=h.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(h),this.offsets.push(e>0?1:(h instanceof v?h.text.length:h.children.length)<<1))}}}},{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}]),t}(),k=function(){function t(e,n,i){(0,h.Z)(this,t),this.value="",this.done=!1,this.cursor=new y(e,n>i?-1:1),this.pos=n>i?e.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}return(0,u.Z)(t,[{key:"nextInner",value:function(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 n=e<0?this.pos-this.from:this.to-this.pos;t>n&&(t=n),n-=t;var i=this.cursor.next(t).value;return this.pos+=(i.length+t)*e,this.value=i.length<=n?i:e<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}},{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?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(){return this.cursor.lineBreak&&""!=this.value}}]),t}(),w=function(){function t(e){(0,h.Z)(this,t),this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}return(0,u.Z)(t,[{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.inner.next(t),n=e.done,i=e.lineBreak,r=e.value;return n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}},{key:"lineBreak",get:function(){return!1}}]),t}();"undefined"!=typeof Symbol&&(d.prototype[Symbol.iterator]=function(){return this.iter()},y.prototype[Symbol.iterator]=k.prototype[Symbol.iterator]=w.prototype[Symbol.iterator]=function(){return this});for(var b=function(){function t(e,n,i,r){(0,h.Z)(this,t),this.from=e,this.to=n,this.number=i,this.text=r}return(0,u.Z)(t,[{key:"length",get:function(){return this.to-this.from}}]),t}(),x="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})),S=1;S<x.length;S++)x[S]+=x[S-1];function A(t){for(var e=1;e<x.length;e+=2)if(x[e]>t)return x[e-1]<=t;return!1}function M(t){return t>=127462&&t<=127487}var Z=8205;function C(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?O:T)(t,e,!(arguments.length>3&&void 0!==arguments[3])||arguments[3])}function O(t,e,n){if(e==t.length)return e;e&&D(t.charCodeAt(e))&&E(t.charCodeAt(e-1))&&e--;var i=B(t,e);for(e+=I(i);e<t.length;){var r=B(t,e);if(i==Z||r==Z||n&&A(r))e+=I(r),i=r;else{if(!M(r))break;for(var o=0,s=e-2;s>=0&&M(B(t,s));)o++,s-=2;if(o%2==0)break;e+=2}}return e}function T(t,e,n){for(;e>0;){var i=O(t,e-2,n);if(i<e)return i;e--}return 0}function D(t){return t>=56320&&t<57344}function E(t){return t>=55296&&t<56320}function B(t,e){var n=t.charCodeAt(e);if(!E(n)||e+1==t.length)return n;var i=t.charCodeAt(e+1);return D(i)?i-56320+(n-55296<<10)+65536:n}function R(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function I(t){return t<65536?1:2}var P=/\r\n?|\n/,N=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(N||(N={})),L=function(){function t(e){(0,h.Z)(this,t),this.sections=e}return(0,u.Z)(t,[{key:"length",get:function(){for(var t=0,e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}},{key:"newLength",get:function(){for(var t=0,e=0;e<this.sections.length;e+=2){var n=this.sections[e+1];t+=n<0?this.sections[e]:n}return t}},{key:"empty",get:function(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}},{key:"iterGaps",value:function(t){for(var e=0,n=0,i=0;e<this.sections.length;){var r=this.sections[e++],o=this.sections[e++];o<0?(t(n,i,r),i+=r):i+=o,n+=r}}},{key:"iterChangedRanges",value:function(t){_(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"invertedDesc",get:function(){for(var e=[],n=0;n<this.sections.length;){var i=this.sections[n++],r=this.sections[n++];r<0?e.push(i,r):e.push(r,i)}return new t(e)}},{key:"composeDesc",value:function(t){return this.empty?t:t.empty?this:F(this,t)}},{key:"mapDesc",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:z(this,t,e)}},{key:"mapPos",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:N.Simple,i=0,r=0,o=0;o<this.sections.length;){var s=this.sections[o++],a=this.sections[o++],h=i+s;if(a<0){if(h>t)return r+(t-i);r+=s}else{if(n!=N.Simple&&h>=t&&(n==N.TrackDel&&i<t&&h>t||n==N.TrackBefore&&i<t||n==N.TrackAfter&&h>t))return null;if(h>t||h==t&&e<0&&!s)return t==i||e<0?r:r+a;r+=a}i=h}if(t>i)throw new RangeError("Position ".concat(t," is out of range for changeset of length ").concat(i));return r}},{key:"touchesRange",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=0,i=0;n<this.sections.length&&i<=e;){var r=i+this.sections[n++];if(this.sections[n++]>=0&&i<=e&&r>=t)return!(i<t&&r>e)||"cover";i=r}return!1}},{key:"toString",value:function(){for(var t="",e=0;e<this.sections.length;){var n=this.sections[e++],i=this.sections[e++];t+=(t?" ":"")+n+(i>=0?":"+i:"")}return t}},{key:"toJSON",value:function(){return this.sections}}],[{key:"fromJSON",value:function(e){if(!Array.isArray(e)||e.length%2||e.some((function(t){return"number"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}},{key:"create",value:function(e){return new t(e)}}]),t}(),V=function(t){function e(t,n){var i;return(0,h.Z)(this,e),(i=(0,r.Z)(this,e,[t])).inserted=n,i}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"apply",value:function(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return _(this,(function(e,n,i,r,o){return t=t.replace(i,i+(n-e),o)}),!1),t}},{key:"mapDesc",value:function(t){return z(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"invert",value:function(t){for(var n=this.sections.slice(),i=[],r=0,o=0;r<n.length;r+=2){var s=n[r],a=n[r+1];if(a>=0){n[r]=a,n[r+1]=s;for(var h=r>>1;i.length<h;)i.push(d.empty);i.push(s?t.slice(o,o+s):d.empty)}o+=s}return new e(n,i)}},{key:"compose",value:function(t){return this.empty?t:t.empty?this:F(this,t,!0)}},{key:"map",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:z(this,t,e,!0)}},{key:"iterChanges",value:function(t){_(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"desc",get:function(){return L.create(this.sections)}},{key:"filter",value:function(t){var n=[],i=[],r=[],o=new q(this);t:for(var s=0,a=0;;){for(var h=s==t.length?1e9:t[s++];a<h||a==h&&0==o.len;){if(o.done)break t;var u=Math.min(o.len,h-a);H(r,u,-1);var l=-1==o.ins?-1:0==o.off?o.ins:0;H(n,u,l),l>0&&W(i,n,o.text),o.forward(u),a+=u}for(var c=t[s++];a<c;){if(o.done)break t;var f=Math.min(o.len,c-a);H(n,f,-1),H(r,f,-1==o.ins?-1:0==o.off?o.ins:0),o.forward(f),a+=f}}return{changes:new e(n,i),filtered:L.create(r)}}},{key:"toJSON",value:function(){for(var t=[],e=0;e<this.sections.length;e+=2){var n=this.sections[e],i=this.sections[e+1];i<0?t.push(n):0==i?t.push([n]):t.push([n].concat(this.inserted[e>>1].toJSON()))}return t}}],[{key:"of",value:function(t,n,i){var r=[],o=[],a=0,h=null;function u(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||r.length){a<n&&H(r,n-a,-1);var t=new e(r,o);h=h?h.compose(t.map(h)):t,r=[],o=[],a=0}}return function t(l){if(Array.isArray(l)){var c,f=(0,s.Z)(l);try{for(f.s();!(c=f.n()).done;){t(c.value)}}catch(w){f.e(w)}finally{f.f()}}else if(l instanceof e){if(l.length!=n)throw new RangeError("Mismatched change set length (got ".concat(l.length,", expected ").concat(n,")"));u(),h=h?h.compose(l.map(h)):l}else{var v=l.from,g=l.to,p=void 0===g?v:g,m=l.insert;if(v>p||v<0||p>n)throw new RangeError("Invalid change range ".concat(v," to ").concat(p," (in doc of length ").concat(n,")"));var y=m?"string"==typeof m?d.of(m.split(i||P)):m:d.empty,k=y.length;if(v==p&&0==k)return;v<a&&u(),v>a&&H(r,v-a,-1),H(r,p-v,k),W(o,r,y),a=p}}(t),u(!h),h}},{key:"empty",value:function(t){return new e(t?[t,-1]:[],[])}},{key:"fromJSON",value:function(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");for(var n=[],i=[],r=0;r<t.length;r++){var o=t[r];if("number"==typeof o)n.push(o,-1);else{if(!Array.isArray(o)||"number"!=typeof o[0]||o.some((function(t,e){return e&&"string"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==o.length)n.push(o[0],0);else{for(;i.length<r;)i.push(d.empty);i[r]=d.of(o.slice(1)),n.push(o[0],i[r].length)}}}return new e(n,i)}},{key:"createSet",value:function(t,n){return new e(t,n)}}]),e}(L);function H(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!(0==e&&n<=0)){var r=t.length-2;r>=0&&n<=0&&n==t[r+1]?t[r]+=e:0==e&&0==t[r]?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}}function W(t,e,n){if(0!=n.length){var i=e.length-2>>1;if(i<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<i;)t.push(d.empty);t.push(n)}}}function _(t,e,n){for(var i=t.inserted,r=0,o=0,s=0;s<t.sections.length;){var a=t.sections[s++],h=t.sections[s++];if(h<0)r+=a,o+=a;else{for(var u=r,l=o,c=d.empty;u+=a,l+=h,h&&i&&(c=c.append(i[s-2>>1])),!(n||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],h=t.sections[s++];e(r,u,o,l,c),r=u,o=l}}}function z(t,e,n){for(var i=[],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3]?[]:null,o=new q(t),s=new q(e),a=-1;;)if(-1==o.ins&&-1==s.ins){var h=Math.min(o.len,s.len);H(i,h,-1),o.forward(h),s.forward(h)}else if(s.ins>=0&&(o.ins<0||a==o.i||0==o.off&&(s.len<o.len||s.len==o.len&&!n))){var u=s.len;for(H(i,s.ins,-1);u;){var l=Math.min(o.len,u);o.ins>=0&&a<o.i&&o.len<=l&&(H(i,0,o.ins),r&&W(r,i,o.text),a=o.i),o.forward(l),u-=l}s.next()}else{if(!(o.ins>=0)){if(o.done&&s.done)return r?V.createSet(i,r):L.create(i);throw new Error("Mismatched change set lengths")}for(var c=0,f=o.len;f;)if(-1==s.ins){var d=Math.min(f,s.len);c+=d,f-=d,s.forward(d)}else{if(!(0==s.ins&&s.len<f))break;f-=s.len,s.next()}H(i,c,a<o.i?o.ins:0),r&&a<o.i&&W(r,i,o.text),a=o.i,o.forward(o.len-f)}}function F(t,e){for(var n=[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2]?[]:null,r=new q(t),o=new q(e),s=!1;;){if(r.done&&o.done)return i?V.createSet(n,i):L.create(n);if(0==r.ins)H(n,r.len,0,s),r.next();else if(0!=o.len||o.done){if(r.done||o.done)throw new Error("Mismatched change set lengths");var a=Math.min(r.len2,o.len),h=n.length;if(-1==r.ins){var u=-1==o.ins?-1:o.off?0:o.ins;H(n,a,u,s),i&&u&&W(i,n,o.text)}else-1==o.ins?(H(n,r.off?0:r.len,a,s),i&&W(i,n,r.textBit(a))):(H(n,r.off?0:r.len,o.off?0:o.ins,s),i&&!o.off&&W(i,n,o.text));s=(r.ins>a||o.ins>=0&&o.len>a)&&(s||n.length>h),r.forward2(a),o.forward(a)}else H(n,0,o.ins,s),i&&W(i,n,o.text),o.next()}}var q=function(){function t(e){(0,h.Z)(this,t),this.set=e,this.i=0,this.next()}return(0,u.Z)(t,[{key:"next",value:function(){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(){return-2==this.ins}},{key:"len2",get:function(){return this.ins<0?this.len:this.ins}},{key:"text",get:function(){var t=this.set.inserted,e=this.i-2>>1;return e>=t.length?d.empty:t[e]}},{key:"textBit",value:function(t){var e=this.set.inserted,n=this.i-2>>1;return n>=e.length&&!t?d.empty:e[n].slice(this.off,null==t?void 0:this.off+t)}},{key:"forward",value:function(t){t==this.len?this.next():(this.len-=t,this.off+=t)}},{key:"forward2",value:function(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}]),t}(),j=function(){function t(e,n,i){(0,h.Z)(this,t),this.from=e,this.to=n,this.flags=i}return(0,u.Z)(t,[{key:"anchor",get:function(){return 16&this.flags?this.to:this.from}},{key:"head",get:function(){return 16&this.flags?this.from:this.to}},{key:"empty",get:function(){return this.from==this.to}},{key:"assoc",get:function(){return 4&this.flags?-1:8&this.flags?1:0}},{key:"bidiLevel",get:function(){var t=3&this.flags;return 3==t?null:t}},{key:"goalColumn",get:function(){var t=this.flags>>5;return 33554431==t?void 0:t}},{key:"map",value:function(e){var n,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return this.empty?n=i=e.mapPos(this.from,r):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new t(n,i,this.flags)}},{key:"extend",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(t<=this.anchor&&e>=this.anchor)return K.range(t,e);var n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return K.range(this.anchor,n)}},{key:"eq",value:function(t){return this.anchor==t.anchor&&this.head==t.head}},{key:"toJSON",value:function(){return{anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return K.range(t.anchor,t.head)}},{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}(),K=function(){function t(e,n){(0,h.Z)(this,t),this.ranges=e,this.mainIndex=n}return(0,u.Z)(t,[{key:"map",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return e.empty?this:t.create(this.ranges.map((function(t){return t.map(e,n)})),this.mainIndex)}},{key:"eq",value:function(t){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].eq(t.ranges[e]))return!1;return!0}},{key:"main",get:function(){return this.ranges[this.mainIndex]}},{key:"asSingle",value:function(){return 1==this.ranges.length?this:new t([this.main],0)}},{key:"addRange",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.create([e].concat(this.ranges),n?0:this.mainIndex+1)}},{key:"replaceRange",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.mainIndex,i=this.ranges.slice();return i[n]=e,t.create(i,this.mainIndex)}},{key:"toJSON",value:function(){return{ranges:this.ranges.map((function(t){return t.toJSON()})),main:this.mainIndex}}}],[{key:"fromJSON",value:function(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t(e.ranges.map((function(t){return j.fromJSON(t)})),e.main)}},{key:"single",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return new t([t.range(e,n)],0)}},{key:"create",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0==e.length)throw new RangeError("A selection needs at least one range");for(var i=0,r=0;r<e.length;r++){var o=e[r];if(o.empty?o.from<=i:o.from<i)return t.normalized(e.slice(),n);i=o.to}return new t(e,n)}},{key:"cursor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;return j.create(t,t,(0==e?0:e<0?4:8)|(null==n?3:Math.min(2,n))|(null!=i?i:33554431)<<5)}},{key:"range",value:function(t,e,n,i){var r=(null!=n?n:33554431)<<5|(null==i?3:Math.min(2,i));return e<t?j.create(e,t,24|r):j.create(t,e,(e>t?4:0)|r)}},{key:"normalized",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e[n];e.sort((function(t,e){return t.from-e.from})),n=e.indexOf(i);for(var r=1;r<e.length;r++){var o=e[r],s=e[r-1];if(o.empty?o.from<=s.to:o.from<s.to){var a=s.from,h=Math.max(o.to,s.to);r<=n&&n--,e.splice(--r,2,o.anchor>o.head?t.range(h,a):t.range(a,h))}}return new t(e,n)}}]),t}();function J(t,e){var n,i=(0,s.Z)(t.ranges);try{for(i.s();!(n=i.n()).done;){if(n.value.to>e)throw new RangeError("Selection points outside of document")}}catch(r){i.e(r)}finally{i.f()}}var U=0,G=function(){function t(e,n,i,r,o){(0,h.Z)(this,t),this.combine=e,this.compareInput=n,this.compare=i,this.isStatic=r,this.id=U++,this.default=e([]),this.extensions="function"==typeof o?o(this):o}return(0,u.Z)(t,[{key:"of",value:function(t){return new X([],this,0,t)}},{key:"compute",value:function(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new X(t,this,1,e)}},{key:"computeN",value:function(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new X(t,this,2,e)}},{key:"from",value:function(t,e){return e||(e=function(t){return t}),this.compute([t],(function(n){return e(n.field(t))}))}}],[{key:"define",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new t(e.combine||function(t){return t},e.compareInput||function(t,e){return t===e},e.compare||(e.combine?function(t,e){return t===e}:$),!!e.static,e.enables)}}]),t}();function $(t,e){return t==e||t.length==e.length&&t.every((function(t,n){return t===e[n]}))}var X=function(){function t(e,n,i,r){(0,h.Z)(this,t),this.dependencies=e,this.facet=n,this.type=i,this.value=r,this.id=U++}return(0,u.Z)(t,[{key:"dynamicSlot",value:function(t){var e,n,i=this,r=this.value,o=this.facet.compareInput,a=this.id,h=t[a]>>1,u=2==this.type,l=!1,c=!1,f=[],d=(0,s.Z)(this.dependencies);try{for(d.s();!(n=d.n()).done;){var v=n.value;"doc"==v?l=!0:"selection"==v?c=!0:0==(1&(null!==(e=t[v.id])&&void 0!==e?e:1))&&f.push(t[v.id])}}catch(g){d.e(g)}finally{d.f()}return{create:function(t){return t.values[h]=r(t),1},update:function(t,e){if(l&&e.docChanged||c&&(e.docChanged||e.selection)||Q(t,f)){var n=r(t);if(u?!Y(n,t.values[h],o):!o(n,t.values[h]))return t.values[h]=n,1}return 0},reconfigure:function(t,e){var n,s=e.config.address[a];if(null!=s){var l=dt(e,s);if(i.dependencies.every((function(n){return n instanceof G?e.facet(n)===t.facet(n):!(n instanceof et)||e.field(n,!1)==t.field(n,!1)}))||(u?Y(n=r(t),l,o):o(n=r(t),l)))return t.values[h]=l,0}else n=r(t);return t.values[h]=n,1}}}}]),t}();function Y(t,e,n){if(t.length!=e.length)return!1;for(var i=0;i<t.length;i++)if(!n(t[i],e[i]))return!1;return!0}function Q(t,e){var n,i=!1,r=(0,s.Z)(e);try{for(r.s();!(n=r.n()).done;){1&ft(t,n.value)&&(i=!0)}}catch(o){r.e(o)}finally{r.f()}return i}var tt=G.define({static:!0}),et=function(){function t(e,n,i,r,o){(0,h.Z)(this,t),this.id=e,this.createF=n,this.updateF=i,this.compareF=r,this.spec=o,this.provides=void 0}return(0,u.Z)(t,[{key:"create",value:function(t){var e=this,n=t.facet(tt).find((function(t){return t.field==e}));return((null==n?void 0:n.create)||this.createF)(t)}},{key:"slot",value:function(t){var e=this,n=t[this.id]>>1;return{create:function(t){return t.values[n]=e.create(t),1},update:function(t,i){var r=t.values[n],o=e.updateF(r,i);return e.compareF(r,o)?0:(t.values[n]=o,1)},reconfigure:function(t,i){return null!=i.config.address[e.id]?(t.values[n]=i.field(e),0):(t.values[n]=e.create(t),1)}}}},{key:"init",value:function(t){return[this,tt.of({field:this,create:t})]}},{key:"extension",get:function(){return this}}],[{key:"define",value:function(e){var n=new t(U++,e.create,e.update,e.compare||function(t,e){return t===e},e);return e.provide&&(n.provides=e.provide(n)),n}}]),t}(),nt=4,it=3,rt=2,ot=1;function st(t){return function(e){return new ht(e,t)}}var at={highest:st(0),high:st(ot),default:st(rt),low:st(it),lowest:st(nt)},ht=(0,u.Z)((function t(e,n){(0,h.Z)(this,t),this.inner=e,this.prec=n})),ut=function(){function t(){(0,h.Z)(this,t)}return(0,u.Z)(t,[{key:"of",value:function(t){return new lt(this,t)}},{key:"reconfigure",value:function(e){return t.reconfigure.of({compartment:this,extension:e})}},{key:"get",value:function(t){return t.config.compartments.get(this)}}]),t}(),lt=(0,u.Z)((function t(e,n){(0,h.Z)(this,t),this.compartment=e,this.inner=n})),ct=function(){function t(e,n,i,r,o,s){for((0,h.Z)(this,t),this.base=e,this.compartments=n,this.dynamicSlots=i,this.address=r,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}return(0,u.Z)(t,[{key:"staticFacet",value:function(t){var e=this.address[t.id];return null==e?t.default:this.staticValues[e>>1]}}],[{key:"resolve",value:function(e,n,i){var r,o=[],a=Object.create(null),h=new Map,u=(0,s.Z)(function(t,e,n){var i=[[],[],[],[],[]],r=new Map;function o(t,a){var h=r.get(t);if(null!=h){if(h<=a)return;var u=i[h].indexOf(t);u>-1&&i[h].splice(u,1),t instanceof lt&&n.delete(t.compartment)}if(r.set(t,a),Array.isArray(t)){var l,c=(0,s.Z)(t);try{for(c.s();!(l=c.n()).done;){o(l.value,a)}}catch(v){c.e(v)}finally{c.f()}}else if(t instanceof lt){if(n.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");var f=e.get(t.compartment)||t.inner;n.set(t.compartment,f),o(f,a)}else if(t instanceof ht)o(t.inner,t.prec);else if(t instanceof et)i[a].push(t),t.provides&&o(t.provides,a);else if(t instanceof X)i[a].push(t),t.facet.extensions&&o(t.facet.extensions,rt);else{var d=t.extension;if(!d)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."));o(d,a)}}return o(t,rt),i.reduce((function(t,e){return t.concat(e)}))}(e,n,h));try{for(u.s();!(r=u.n()).done;){var l=r.value;l instanceof et?o.push(l):(a[l.facet.id]||(a[l.facet.id]=[])).push(l)}}catch(w){u.e(w)}finally{u.f()}for(var c=Object.create(null),f=[],d=[],v=function(){var t=p[g];c[t.id]=d.length<<1,d.push((function(e){return t.slot(e)}))},g=0,p=o;g<p.length;g++)v();var m=null==i?void 0:i.config.facets,y=function(){var t=a[k],e=t[0].facet,n=m&&m[k]||[];if(t.every((function(t){return 0==t.type})))if(c[e.id]=f.length<<1|1,$(n,t))f.push(i.facet(e));else{var r=e.combine(t.map((function(t){return t.value})));f.push(i&&e.compare(r,i.facet(e))?i.facet(e):r)}else{var o,h=(0,s.Z)(t);try{var u=function(){var t=o.value;0==t.type?(c[t.id]=f.length<<1|1,f.push(t.value)):(c[t.id]=d.length<<1,d.push((function(e){return t.dynamicSlot(e)})))};for(h.s();!(o=h.n()).done;)u()}catch(w){h.e(w)}finally{h.f()}c[e.id]=d.length<<1,d.push((function(n){return function(t,e,n){var i=n.map((function(e){return t[e.id]})),r=n.map((function(t){return t.type})),o=i.filter((function(t){return!(1&t)})),a=t[e.id]>>1;function h(t){for(var n=[],o=0;o<i.length;o++){var a=dt(t,i[o]);if(2==r[o]){var h,u=(0,s.Z)(a);try{for(u.s();!(h=u.n()).done;){var l=h.value;n.push(l)}}catch(w){u.e(w)}finally{u.f()}}else n.push(a)}return e.combine(n)}return{create:function(t){var e,n=(0,s.Z)(i);try{for(n.s();!(e=n.n()).done;)ft(t,e.value)}catch(w){n.e(w)}finally{n.f()}return t.values[a]=h(t),1},update:function(t,n){if(!Q(t,o))return 0;var i=h(t);return e.compare(i,t.values[a])?0:(t.values[a]=i,1)},reconfigure:function(t,r){var o=Q(t,i),s=r.config.facets[e.id],u=r.facet(e);if(s&&!o&&$(n,s))return t.values[a]=u,0;var l=h(t);return e.compare(l,u)?(t.values[a]=u,0):(t.values[a]=l,1)}}}(n,e,t)}))}};for(var k in a)y();return new t(e,h,d.map((function(t){return t(c)})),c,f,a)}}]),t}();function ft(t,e){if(1&e)return 2;var n=e>>1,i=t.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;t.status[n]=4;var r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function dt(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}var vt=G.define(),gt=G.define({combine:function(t){return t.some((function(t){return t}))},static:!0}),pt=G.define({combine:function(t){return t.length?t[0]:void 0},static:!0}),mt=G.define(),yt=G.define(),kt=G.define(),wt=G.define({combine:function(t){return!!t.length&&t[0]}}),bt=function(){function t(e,n){(0,h.Z)(this,t),this.type=e,this.value=n}return(0,u.Z)(t,null,[{key:"define",value:function(){return new xt}}]),t}(),xt=function(){function t(){(0,h.Z)(this,t)}return(0,u.Z)(t,[{key:"of",value:function(t){return new bt(this,t)}}]),t}(),St=function(){function t(e){(0,h.Z)(this,t),this.map=e}return(0,u.Z)(t,[{key:"of",value:function(t){return new At(this,t)}}]),t}(),At=function(){function t(e,n){(0,h.Z)(this,t),this.type=e,this.value=n}return(0,u.Z)(t,[{key:"map",value:function(e){var n=this.type.map(this.value,e);return void 0===n?void 0:n==this.value?this:new t(this.type,n)}},{key:"is",value:function(t){return this.type==t}}],[{key:"define",value:function(){return new St((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).map||function(t){return t})}},{key:"mapEffects",value:function(t,e){if(!t.length)return t;var n,i=[],r=(0,s.Z)(t);try{for(r.s();!(n=r.n()).done;){var o=n.value.map(e);o&&i.push(o)}}catch(a){r.e(a)}finally{r.f()}return i}}]),t}();At.reconfigure=At.define(),At.appendConfig=At.define();var Mt=function(){function t(e,n,i,r,o,s){(0,h.Z)(this,t),this.startState=e,this.changes=n,this.selection=i,this.effects=r,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,i&&J(i,n.newLength),o.some((function(e){return e.type==t.time}))||(this.annotations=o.concat(t.time.of(Date.now())))}return(0,u.Z)(t,[{key:"newDoc",get:function(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}},{key:"newSelection",get:function(){return this.selection||this.startState.selection.map(this.changes)}},{key:"state",get:function(){return this._state||this.startState.applyTransaction(this),this._state}},{key:"annotation",value:function(t){var e,n=(0,s.Z)(this.annotations);try{for(n.s();!(e=n.n()).done;){var i=e.value;if(i.type==t)return i.value}}catch(r){n.e(r)}finally{n.f()}}},{key:"docChanged",get:function(){return!this.changes.empty}},{key:"reconfigured",get:function(){return this.startState.config!=this.state.config}},{key:"isUserEvent",value:function(e){var n=this.annotation(t.userEvent);return!(!n||!(n==e||n.length>e.length&&n.slice(0,e.length)==e&&"."==n[e.length]))}}],[{key:"create",value:function(e,n,i,r,o,s){return new t(e,n,i,r,o,s)}}]),t}();function Zt(t,e){for(var n=[],i=0,r=0;;){var o=void 0,s=void 0;if(i<t.length&&(r==e.length||e[r]>=t[i]))o=t[i++],s=t[i++];else{if(!(r<e.length))return n;o=e[r++],s=e[r++]}!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function Ct(t,e,n){var i,r,o,s;return n?(r=e.changes,o=V.empty(e.changes.length),s=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),o=t.changes.mapDesc(e.changes,!0),s=t.changes.compose(r)),{changes:s,selection:e.selection?e.selection.map(o):null===(i=t.selection)||void 0===i?void 0:i.map(r),effects:At.mapEffects(t.effects,r).concat(At.mapEffects(e.effects,o)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Ot(t,e,n){var i=e.selection,r=Et(e.annotations);return e.userEvent&&(r=r.concat(Mt.userEvent.of(e.userEvent))),{changes:e.changes instanceof V?e.changes:V.of(e.changes||[],n,t.facet(pt)),selection:i&&(i instanceof K?i:K.single(i.anchor,i.head)),effects:Et(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Tt(t,e,n){var i=Ot(t,e.length?e[0]:{},t.doc.length);e.length&&!1===e[0].filter&&(n=!1);for(var r=1;r<e.length;r++){!1===e[r].filter&&(n=!1);var o=!!e[r].sequential;i=Ct(i,Ot(t,e[r],o?i.changes.newLength:t.doc.length),o)}var a=Mt.create(t,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(t){for(var e=t.startState,n=e.facet(kt),i=t,r=n.length-1;r>=0;r--){var o=n[r](t);o&&Object.keys(o).length&&(i=Ct(i,Ot(e,o,t.changes.newLength),!0))}return i==t?t:Mt.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(t){var e,n=t.startState,i=!0,r=(0,s.Z)(n.facet(mt));try{for(r.s();!(e=r.n()).done;){var o=(0,e.value)(t);if(!1===o){i=!1;break}Array.isArray(o)&&(i=!0===i?o:Zt(i,o))}}catch(d){r.e(d)}finally{r.f()}if(!0!==i){var a,h;if(!1===i)h=t.changes.invertedDesc,a=V.empty(n.doc.length);else{var u=t.changes.filter(i);a=u.changes,h=u.filtered.mapDesc(u.changes).invertedDesc}t=Mt.create(n,a,t.selection&&t.selection.map(h),At.mapEffects(t.effects,h),t.annotations,t.scrollIntoView)}for(var l=n.facet(yt),c=l.length-1;c>=0;c--){var f=l[c](t);t=f instanceof Mt?f:Array.isArray(f)&&1==f.length&&f[0]instanceof Mt?f[0]:Tt(n,Et(f),!1)}return t}(a):a)}Mt.time=bt.define(),Mt.userEvent=bt.define(),Mt.addToHistory=bt.define(),Mt.remote=bt.define();var Dt=[];function Et(t){return null==t?Dt:Array.isArray(t)?t:[t]}var Bt,Rt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Rt||(Rt={})),It=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{Bt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(ys){}function Pt(t){return function(e){if(!/\S/.test(e))return Rt.Space;if(function(t){if(Bt)return Bt.test(t);for(var e=0;e<t.length;e++){var n=t[e];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||It.test(n)))return!0}return!1}(e))return Rt.Word;for(var n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Rt.Word;return Rt.Other}}var Nt=function(){function t(e,n,i,r,o,s){(0,h.Z)(this,t),this.config=e,this.doc=n,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(var a=0;a<this.config.dynamicSlots.length;a++)ft(this,a<<1);this.computeSlot=null}return(0,u.Z)(t,[{key:"field",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.config.address[t.id];if(null!=n)return ft(this,n),dt(this,n);if(e)throw new RangeError("Field is not present in this state")}},{key:"update",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Tt(this,e,!0)}},{key:"applyTransaction",value:function(e){var n,i,r=this,o=this.config,a=o,h=a.base,u=a.compartments,l=(0,s.Z)(e.effects);try{for(l.s();!(n=l.n()).done;){var c=n.value;c.is(ut.reconfigure)?(o&&(u=new Map,o.compartments.forEach((function(t,e){return u.set(e,t)})),o=null),u.set(c.value.compartment,c.value.extension)):c.is(At.reconfigure)?(o=null,h=c.value):c.is(At.appendConfig)&&(o=null,h=Et(h).concat(c.value))}}catch(f){l.e(f)}finally{l.f()}o?i=e.startState.values.slice():i=new t(o=ct.resolve(h,u,this),this.doc,this.selection,o.dynamicSlots.map((function(){return null})),(function(t,e){return e.reconfigure(t,r)}),null).values;new t(o,e.newDoc,e.newSelection,i,(function(t,n){return n.update(t,e)}),e)}},{key:"replaceSelection",value:function(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange((function(e){return{changes:{from:e.from,to:e.to,insert:t},range:K.cursor(e.from+t.length)}}))}},{key:"changeByRange",value:function(t){for(var e=this.selection,n=t(e.ranges[0]),i=this.changes(n.changes),r=[n.range],o=Et(n.effects),s=1;s<e.ranges.length;s++){for(var a=t(e.ranges[s]),h=this.changes(a.changes),u=h.map(i),l=0;l<s;l++)r[l]=r[l].map(u);var c=i.mapDesc(h,!0);r.push(a.range.map(c)),i=i.compose(u),o=At.mapEffects(o,u).concat(At.mapEffects(Et(a.effects),c))}return{changes:i,selection:K.create(r,e.mainIndex),effects:o}}},{key:"changes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e instanceof V?e:V.of(e,this.doc.length,this.facet(t.lineSeparator))}},{key:"toText",value:function(e){return d.of(e.split(this.facet(t.lineSeparator)||P))}},{key:"sliceDoc",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.doc.length;return this.doc.sliceString(t,e,this.lineBreak)}},{key:"facet",value:function(t){var e=this.config.address[t.id];return null==e?t.default:(ft(this,e),dt(this,e))}},{key:"toJSON",value:function(t){var e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(var n in t){var i=t[n];i instanceof et&&null!=this.config.address[i.id]&&(e[n]=i.spec.toJSON(this.field(t[n]),this))}return e}},{key:"tabSize",get:function(){return this.facet(t.tabSize)}},{key:"lineBreak",get:function(){return this.facet(t.lineSeparator)||"\n"}},{key:"readOnly",get:function(){return this.facet(wt)}},{key:"phrase",value:function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];var o,a=(0,s.Z)(this.facet(t.phrases));try{for(a.s();!(o=a.n()).done;){var h=o.value;if(Object.prototype.hasOwnProperty.call(h,e)){e=h[e];break}}}catch(u){a.e(u)}finally{a.f()}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(function(t,e){if("$"==e)return"$";var n=+(e||1);return!n||n>i.length?t:i[n-1]}))),e}},{key:"languageDataAt",value:function(t,e){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=(0,s.Z)(this.facet(vt));try{for(o.s();!(n=o.n()).done;){var a,h=n.value,u=(0,s.Z)(h(this,e,i));try{for(u.s();!(a=u.n()).done;){var l=a.value;Object.prototype.hasOwnProperty.call(l,t)&&r.push(l[t])}}catch(c){u.e(c)}finally{u.f()}}}catch(c){o.e(c)}finally{o.f()}return r}},{key:"charCategorizer",value:function(t){return Pt(this.languageDataAt("wordChars",t).join(""))}},{key:"wordAt",value:function(t){for(var e=this.doc.lineAt(t),n=e.text,i=e.from,r=e.length,o=this.charCategorizer(t),s=t-i,a=t-i;s>0;){var h=C(n,s,!1);if(o(n.slice(h,s))!=Rt.Word)break;s=h}for(;a<r;){var u=C(n,a);if(o(n.slice(a,u))!=Rt.Word)break;a=u}return s==a?null:K.range(s+i,a+i)}}],[{key:"fromJSON",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");var r=[];if(i){var o=function(){if(Object.prototype.hasOwnProperty.call(e,s)){var t=i[s],n=e[s];r.push(t.init((function(e){return t.spec.fromJSON(n,e)})))}};for(var s in i)o()}return t.create({doc:e.doc,selection:K.fromJSON(e.selection),extensions:n.extensions?r.concat([n.extensions]):r})}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=ct.resolve(e.extensions||[],new Map),i=e.doc instanceof d?e.doc:d.of((e.doc||"").split(n.staticFacet(t.lineSeparator)||P)),r=e.selection?e.selection instanceof K?e.selection:K.single(e.selection.anchor,e.selection.head):K.single(0);return J(r,i.length),n.staticFacet(gt)||(r=r.asSingle()),new t(n,i,r,n.dynamicSlots.map((function(){return null})),(function(t,e){return e.create(t)}),null)}}]),t}();function Lt(t,e){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={},o=(0,s.Z)(t);try{for(o.s();!(n=o.n()).done;)for(var a=n.value,h=0,u=Object.keys(a);h<u.length;h++){var l=u[h],c=a[l],f=r[l];if(void 0===f)r[l]=c;else if(f===c||void 0===c);else{if(!Object.hasOwnProperty.call(i,l))throw new Error("Config merge conflict for field "+l);r[l]=i[l](f,c)}}}catch(v){o.e(v)}finally{o.f()}for(var d in e)void 0===r[d]&&(r[d]=e[d]);return r}Nt.allowMultipleSelections=gt,Nt.tabSize=G.define({combine:function(t){return t.length?t[0]:4}}),Nt.lineSeparator=pt,Nt.readOnly=wt,Nt.phrases=G.define({compare:function(t,e){var n=Object.keys(t),i=Object.keys(e);return n.length==i.length&&n.every((function(n){return t[n]==e[n]}))}}),Nt.languageData=vt,Nt.changeFilter=mt,Nt.transactionFilter=yt,Nt.transactionExtender=kt,ut.reconfigure=At.define();var Vt=function(){function t(){(0,h.Z)(this,t)}return(0,u.Z)(t,[{key:"eq",value:function(t){return this==t}},{key:"range",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return Ht.create(t,e,this)}}]),t}();Vt.prototype.startSide=Vt.prototype.endSide=0,Vt.prototype.point=!1,Vt.prototype.mapMode=N.TrackDel;var Ht=function(){function t(e,n,i){(0,h.Z)(this,t),this.from=e,this.to=n,this.value=i}return(0,u.Z)(t,null,[{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}();function Wt(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}var _t=function(){function t(e,n,i,r){(0,h.Z)(this,t),this.from=e,this.to=n,this.value=i,this.maxPoint=r}return(0,u.Z)(t,[{key:"length",get:function(){return this.to[this.to.length-1]}},{key:"findIndex",value:function(t,e,n){for(var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=n?this.to:this.from,o=i,s=r.length;;){if(o==s)return o;var a=o+s>>1,h=r[a]-t||(n?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:s;h>=0?s=a:o=a+1}}},{key:"between",value:function(t,e,n,i){for(var r=this.findIndex(e,-1e9,!0),o=this.findIndex(n,1e9,!1,r);r<o;r++)if(!1===i(this.from[r]+t,this.to[r]+t,this.value[r]))return!1}},{key:"map",value:function(e,n){for(var i=[],r=[],o=[],s=-1,a=-1,h=0;h<this.value.length;h++){var u=this.value[h],l=this.from[h]+e,c=this.to[h]+e,f=void 0,d=void 0;if(l==c){var v=n.mapPos(l,u.startSide,u.mapMode);if(null==v)continue;if(f=d=v,u.startSide!=u.endSide&&(d=n.mapPos(l,u.endSide))<f)continue}else if((f=n.mapPos(l,u.startSide))>(d=n.mapPos(c,u.endSide))||f==d&&u.startSide>0&&u.endSide<=0)continue;(d-f||u.endSide-u.startSide)<0||(s<0&&(s=f),u.point&&(a=Math.max(a,d-f)),i.push(u),r.push(f-s),o.push(d-s))}return{mapped:i.length?new t(r,o,i,a):null,pos:s}}}]),t}(),zt=function(){function t(e,n,i,r){(0,h.Z)(this,t),this.chunkPos=e,this.chunk=n,this.nextLayer=i,this.maxPoint=r}return(0,u.Z)(t,[{key:"length",get:function(){var t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}},{key:"size",get:function(){if(this.isEmpty)return 0;var t,e=this.nextLayer.size,n=(0,s.Z)(this.chunk);try{for(n.s();!(t=n.n()).done;){e+=t.value.value.length}}catch(i){n.e(i)}finally{n.f()}return e}},{key:"chunkEnd",value:function(t){return this.chunkPos[t]+this.chunk[t].length}},{key:"update",value:function(e){var n=e.add,i=void 0===n?[]:n,r=e.sort,o=void 0!==r&&r,s=e.filterFrom,a=void 0===s?0:s,h=e.filterTo,u=void 0===h?this.length:h,l=e.filter;if(0==i.length&&!l)return this;if(o&&(i=i.slice().sort(Wt)),this.isEmpty)return i.length?t.of(i):this;for(var c=new jt(this,null,-1).goto(0),f=0,d=[],v=new Ft;c.value||f<i.length;)if(f<i.length&&(c.from-i[f].from||c.startSide-i[f].value.startSide)>=0){var g=i[f++];v.addInner(g.from,g.to,g.value)||d.push(g)}else 1==c.rangeIndex&&c.chunkIndex<this.chunk.length&&(f==i.length||this.chunkEnd(c.chunkIndex)<i[f].from)&&(!l||a>this.chunkEnd(c.chunkIndex)||u<this.chunkPos[c.chunkIndex])&&v.addChunk(this.chunkPos[c.chunkIndex],this.chunk[c.chunkIndex])?c.nextChunk():((!l||a>c.to||u<c.from||l(c.from,c.to,c.value))&&(v.addInner(c.from,c.to,c.value)||d.push(Ht.create(c.from,c.to,c.value))),c.next());return v.finishInner(this.nextLayer.isEmpty&&!d.length?t.empty:this.nextLayer.update({add:d,filter:l,filterFrom:a,filterTo:u}))}},{key:"map",value:function(e){if(e.empty||this.isEmpty)return this;for(var n=[],i=[],r=-1,o=0;o<this.chunk.length;o++){var s=this.chunkPos[o],a=this.chunk[o],h=e.touchesRange(s,s+a.length);if(!1===h)r=Math.max(r,a.maxPoint),n.push(a),i.push(e.mapPos(s));else if(!0===h){var u=a.map(s,e),l=u.mapped,c=u.pos;l&&(r=Math.max(r,l.maxPoint),n.push(l),i.push(c))}}var f=this.nextLayer.map(e);return 0==n.length?f:new t(i,n,f||t.empty,r)}},{key:"between",value:function(t,e,n){if(!this.isEmpty){for(var i=0;i<this.chunk.length;i++){var r=this.chunkPos[i],o=this.chunk[i];if(e>=r&&t<=r+o.length&&!1===o.between(r,t-r,e-r,n))return}this.nextLayer.between(t,e,n)}}},{key:"iter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return Kt.from([this]).goto(t)}},{key:"isEmpty",get:function(){return this.nextLayer==this}}],[{key:"create",value:function(e,n,i,r){return new t(e,n,i,r)}},{key:"iter",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Kt.from(t).goto(e)}},{key:"compare",value:function(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=t.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r})),s=e.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r})),a=qt(o,s,n),h=new Ut(o,a,r),u=new Ut(s,a,r);n.iterGaps((function(t,e,n){return Gt(h,t,u,e,n,i)})),n.empty&&0==n.length&&Gt(h,0,u,0,0,i)}},{key:"eq",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0;null==i&&(i=999999999);var r=t.filter((function(t){return!t.isEmpty&&e.indexOf(t)<0})),o=e.filter((function(e){return!e.isEmpty&&t.indexOf(e)<0}));if(r.length!=o.length)return!1;if(!r.length)return!0;for(var s=qt(r,o),a=new Ut(r,s,0).goto(n),h=new Ut(o,s,0).goto(n);;){if(a.to!=h.to||!$t(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>i)return!0;a.next(),h.next()}}},{key:"spans",value:function(t,e,n,i){for(var r=new Ut(t,null,arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1).goto(e),o=e,s=r.openStart;;){var a=Math.min(r.to,n);if(r.point){var h=r.activeForPoint(r.to),u=r.pointFrom<e?h.length+1:Math.min(h.length,s);i.point(o,a,r.point,h,u,r.pointRank),s=Math.min(r.openEnd(a),h.length)}else a>o&&(i.span(o,a,r.active,s),s=r.openEnd(a));if(r.to>n)return s+(r.point&&r.to>n?1:0);o=r.to,r.next()}}},{key:"of",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=new Ft,r=(0,s.Z)(t instanceof Ht?[t]:n?function(t){if(t.length>1)for(var e=t[0],n=1;n<t.length;n++){var i=t[n];if(Wt(e,i)>0)return t.slice().sort(Wt);e=i}return t}(t):t);try{for(r.s();!(e=r.n()).done;){var o=e.value;i.add(o.from,o.to,o.value)}}catch(a){r.e(a)}finally{r.f()}return i.finish()}}]),t}();zt.empty=new zt([],[],null,-1),zt.empty.nextLayer=zt.empty;var Ft=function(){function t(){(0,h.Z)(this,t),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(0,u.Z)(t,[{key:"finishChunk",value:function(t){this.chunks.push(new _t(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(e,n,i){this.addInner(e,n,i)||(this.nextLayer||(this.nextLayer=new t)).add(e,n,i)}},{key:"addInner",value:function(t,e,n){var i=t-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(t-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<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=n,this.lastFrom=t,this.lastTo=e,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}},{key:"addChunk",value:function(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 n=e.value.length-1;return this.last=e.value[n],this.lastFrom=e.from[n]+t,this.lastTo=e.to[n]+t,!0}},{key:"finish",value:function(){return this.finishInner(zt.empty)}},{key:"finishInner",value:function(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;var e=zt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}]),t}();function qt(t,e,n){var i,r=new Map,o=(0,s.Z)(t);try{for(o.s();!(i=o.n()).done;)for(var a=i.value,h=0;h<a.chunk.length;h++)a.chunk[h].maxPoint<=0&&r.set(a.chunk[h],a.chunkPos[h])}catch(g){o.e(g)}finally{o.f()}var u,l=new Set,c=(0,s.Z)(e);try{for(c.s();!(u=c.n()).done;)for(var f=u.value,d=0;d<f.chunk.length;d++){var v=r.get(f.chunk[d]);null==v||(n?n.mapPos(v):v)!=f.chunkPos[d]||(null==n?void 0:n.touchesRange(v,v+f.chunk[d].length))||l.add(f.chunk[d])}}catch(g){c.e(g)}finally{c.f()}return l}var jt=function(){function t(e,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;(0,h.Z)(this,t),this.layer=e,this.skip=n,this.minPoint=i,this.rank=r}return(0,u.Z)(t,[{key:"startSide",get:function(){return this.value?this.value.startSide:0}},{key:"endSide",get:function(){return this.value?this.value.endSide:0}},{key:"goto",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}},{key:"gotoInner",value:function(t,e,n){for(;this.chunkIndex<this.layer.chunk.length;){var i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<t||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){var r=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}},{key:"forward",value:function(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}},{key:"next",value:function(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}var t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],n=t+e.from[this.rangeIndex];if(this.from=n,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}},{key:"setRangeIndex",value:function(t){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(){this.chunkIndex++,this.rangeIndex=0,this.next()}},{key:"compare",value:function(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}]),t}(),Kt=function(){function t(e){(0,h.Z)(this,t),this.heap=e}return(0,u.Z)(t,[{key:"startSide",get:function(){return this.value?this.value.startSide:0}},{key:"goto",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9,i=(0,s.Z)(this.heap);try{for(i.s();!(e=i.n()).done;){e.value.goto(t,n)}}catch(o){i.e(o)}finally{i.f()}for(var r=this.heap.length>>1;r>=0;r--)Jt(this.heap,r);return this.next(),this}},{key:"forward",value:function(t,e){var n,i=(0,s.Z)(this.heap);try{for(i.s();!(n=i.n()).done;){n.value.forward(t,e)}}catch(o){i.e(o)}finally{i.f()}for(var r=this.heap.length>>1;r>=0;r--)Jt(this.heap,r);(this.to-t||this.value.endSide-e)<0&&this.next()}},{key:"next",value:function(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Jt(this.heap,0)}}}],[{key:"from",value:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=0;o<e.length;o++)for(var s=e[o];!s.isEmpty;s=s.nextLayer)s.maxPoint>=i&&r.push(new jt(s,n,i,o));return 1==r.length?r[0]:new t(r)}}]),t}();function Jt(t,e){for(var n=t[e];;){var i=1+(e<<1);if(i>=t.length)break;var r=t[i];if(i+1<t.length&&r.compare(t[i+1])>=0&&(r=t[i+1],i++),n.compare(r)<0)break;t[i]=n,t[e]=r,e=i}}var Ut=function(){function t(e,n,i){(0,h.Z)(this,t),this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Kt.from(e,n,i)}return(0,u.Z)(t,[{key:"goto",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?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(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(t){Xt(this.active,t),Xt(this.activeTo,t),Xt(this.activeRank,t),this.minActive=Qt(this.active,this.activeTo)}},{key:"addActive",value:function(t){for(var e=0,n=this.cursor,i=n.value,r=n.to,o=n.rank;e<this.activeRank.length&&this.activeRank[e]<=o;)e++;Yt(this.active,e,i),Yt(this.activeTo,e,r),Yt(this.activeRank,e,o),t&&Yt(t,e,this.cursor.from),this.minActive=Qt(this.active,this.activeTo)}},{key:"next",value:function(){var t=this.to,e=this.point;this.point=null;for(var n=this.openStart<0?[]:null;;){var i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>t){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&Xt(n,i)}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 r=this.cursor.value;if(r.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}if(n){this.openStart=0;for(var o=n.length-1;o>=0&&n[o]<t;o--)this.openStart++}}},{key:"activeForPoint",value:function(t){if(!this.active.length)return this.active;for(var e=[],n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>t||this.activeTo[n]==t&&this.active[n].endSide>=this.point.endSide)&&e.push(this.active[n]);return e.reverse()}},{key:"openEnd",value:function(t){for(var e=0,n=this.activeTo.length-1;n>=0&&this.activeTo[n]>t;n--)e++;return e}}]),t}();function Gt(t,e,n,i,r,o){t.goto(e),n.goto(i);for(var s=i+r,a=i,h=i-e;;){var u=t.to+h-n.to||t.endSide-n.endSide,l=u<0?t.to+h:n.to,c=Math.min(l,s);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&$t(t.activeForPoint(t.to),n.activeForPoint(n.to))||o.comparePoint(a,c,t.point,n.point):c>a&&!$t(t.active,n.active)&&o.compareRange(a,c,t.active,n.active),l>s)break;a=l,u<=0&&t.next(),u>=0&&n.next()}}function $t(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].eq(e[n]))return!1;return!0}function Xt(t,e){for(var n=e,i=t.length-1;n<i;n++)t[n]=t[n+1];t.pop()}function Yt(t,e,n){for(var i=t.length-1;i>=e;i--)t[i+1]=t[i];t[e]=n}function Qt(t,e){for(var n=-1,i=1e9,r=0;r<e.length;r++)(e[r]-i||t[r].endSide-t[n].endSide)<0&&(n=r,i=e[r]);return n}var te=n(28450),ee=n(29350);function ne(t){return(11==t.nodeType?t.getSelection?t:t.ownerDocument:t).getSelection()}function ie(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 ie(t,e.anchorNode)}catch(ys){return!1}}function oe(t){return 3==t.nodeType?pe(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function se(t,e,n,i){return!!n&&(he(t,e,n,i,-1)||he(t,e,n,i,1))}function ae(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function he(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:ue(t))){if("DIV"==t.nodeName)return!1;var o=t.parentNode;if(!o||1!=o.nodeType)return!1;e=ae(t)+(r<0?0:1),t=o}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?ue(t):0}}}function ue(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function le(t,e){var n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function ce(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}var fe,de=function(){function t(){(0,h.Z)(this,t),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return(0,u.Z)(t,[{key:"eq",value:function(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}},{key:"setRange",value:function(t){var e=t.anchorNode,n=t.focusNode;this.set(e,Math.min(t.anchorOffset,e?ue(e):0),n,Math.min(t.focusOffset,n?ue(n):0))}},{key:"set",value:function(t,e,n,i){this.anchorNode=t,this.anchorOffset=e,this.focusNode=n,this.focusOffset=i}}]),t}(),ve=null;function ge(t){if(t.setActive)return t.setActive();if(ve)return t.focus(ve);for(var e=[],n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(null==ve?{get preventScroll(){return ve={preventScroll:!0},!0}}:void 0),!ve){ve=!1;for(var i=0;i<e.length;){var r=e[i++],o=e[i++],s=e[i++];r.scrollTop!=o&&(r.scrollTop=o),r.scrollLeft!=s&&(r.scrollLeft=s)}}}function pe(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,i=fe||(fe=document.createRange());return i.setEnd(t,n),i.setStart(t,e),i}function me(t,e,n){var i={key:e,code:e,keyCode:n,which:n,cancelable:!0},r=new KeyboardEvent("keydown",i);r.synthetic=!0,t.dispatchEvent(r);var o=new KeyboardEvent("keyup",i);return o.synthetic=!0,t.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function ye(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}var ke=function(){function t(e,n){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];(0,h.Z)(this,t),this.node=e,this.offset=n,this.precise=i}return(0,u.Z)(t,null,[{key:"before",value:function(e,n){return new t(e.parentNode,ae(e),n)}},{key:"after",value:function(e,n){return new t(e.parentNode,ae(e)+1,n)}}]),t}(),we=[],be=function(){function t(){(0,h.Z)(this,t),this.parent=null,this.dom=null,this.dirty=2}return(0,u.Z)(t,[{key:"overrideDOMText",get:function(){return null}},{key:"posAtStart",get:function(){return this.parent?this.parent.posBefore(this):0}},{key:"posAtEnd",get:function(){return this.posAtStart+this.length}},{key:"posBefore",value:function(t){var e,n=this.posAtStart,i=(0,s.Z)(this.children);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(r==t)return n;n+=r.length+r.breakAfter}}catch(o){i.e(o)}finally{i.f()}throw new RangeError("Invalid child in posBefore")}},{key:"posAfter",value:function(t){return this.posBefore(t)+t.length}},{key:"sync",value:function(e,n){if(2&this.dirty){var i,r,o=this.dom,a=null,h=(0,s.Z)(this.children);try{for(h.s();!(r=h.n()).done;){var u=r.value;if(u.dirty){if(!u.dom&&(i=a?a.nextSibling:o.firstChild)){var l=t.get(i);(!l||!l.parent&&l.canReuseDOM(u))&&u.reuseDOM(i)}u.sync(e,n),u.dirty=0}if(i=a?a.nextSibling:o.firstChild,n&&!n.written&&n.node==o&&i!=u.dom&&(n.written=!0),u.dom.parentNode==o)for(;i&&i!=u.dom;)i=xe(i);else o.insertBefore(u.dom,i);a=u.dom}}catch(v){h.e(v)}finally{h.f()}for((i=a?a.nextSibling:o.firstChild)&&n&&n.node==o&&(n.written=!0);i;)i=xe(i)}else if(1&this.dirty){var c,f=(0,s.Z)(this.children);try{for(f.s();!(c=f.n()).done;){var d=c.value;d.dirty&&(d.sync(e,n),d.dirty=0)}}catch(v){f.e(v)}finally{f.f()}}}},{key:"reuseDOM",value:function(t){}},{key:"localPosFromDOM",value:function(e,n){var i;if(e==this.dom)i=this.dom.childNodes[n];else{for(var r=0==ue(e)?0:0==n?-1:1;;){var o=e.parentNode;if(o==this.dom)break;0==r&&o.firstChild!=o.lastChild&&(r=e==o.firstChild?-1:1),e=o}i=r<0?e:e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!t.get(i);)i=i.nextSibling;if(!i)return this.length;for(var s=0,a=0;;s++){var h=this.children[s];if(h.dom==i)return a;a+=h.length+h.breakAfter}}},{key:"domBoundsAround",value:function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=-1,r=-1,o=-1,s=-1,a=0,h=n,u=n;a<this.children.length;a++){var l=this.children[a],c=h+l.length;if(h<t&&c>e)return l.domBoundsAround(t,e,h);if(c>=t&&-1==i&&(i=a,r=h),h>e&&l.dom.parentNode==this.dom){o=a,s=u;break}u=c,h=c+l.breakAfter}return{from:r,to:s<0?n+this.length:s,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}},{key:"markDirty",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.dirty|=2,this.markParentsDirty(t)}},{key:"markParentsDirty",value:function(t){for(var e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}},{key:"setParent",value:function(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}},{key:"setDOM",value:function(t){this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this}},{key:"rootView",get:function(){for(var t=this;;){var e=t.parent;if(!e)return t;t=e}}},{key:"replaceChildren",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:we;this.markDirty();for(var o=t;o<e;o++){var s=this.children[o];s.parent==this&&s.destroy()}(n=this.children).splice.apply(n,[t,e-t].concat((0,i.Z)(r)));for(var a=0;a<r.length;a++)r[a].setParent(this)}},{key:"ignoreMutation",value:function(t){return!1}},{key:"ignoreEvent",value:function(t){return!1}},{key:"childCursor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length;return new Se(this.children,t,this.children.length)}},{key:"childPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.childCursor().findPos(t,e)}},{key:"toString",value:function(){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(){return!0}},{key:"isWidget",get:function(){return!1}},{key:"isHidden",get:function(){return!1}},{key:"merge",value:function(t,e,n,i,r,o){return!1}},{key:"become",value:function(t){return!1}},{key:"canReuseDOM",value:function(t){return t.constructor==this.constructor}},{key:"getSide",value:function(){return 0}},{key:"destroy",value:function(){this.parent=null}}],[{key:"get",value:function(t){return t.cmView}}]),t}();function xe(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}be.prototype.breakAfter=0;var Se=function(){function t(e,n,i){(0,h.Z)(this,t),this.children=e,this.pos=n,this.i=i,this.off=0}return(0,u.Z)(t,[{key:"findPos",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;;){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 n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}]),t}();function Ae(t,e,n,i,r,o,s,a,h){var u=t.children,l=u.length?u[e]:null,c=o.length?o[o.length-1]:null,f=c?c.breakAfter:s;if(!(e==i&&l&&!s&&!f&&o.length<2&&l.merge(n,r,o.length?c:null,0==n,a,h))){if(i<u.length){var d=u[i];d&&r<d.length?(e==i&&(d=d.split(r),r=0),!f&&c&&d.merge(0,r,c,!0,0,h)?o[o.length-1]=d:(r&&d.merge(0,r,null,!1,0,h),o.push(d))):(null==d?void 0:d.breakAfter)&&(c?c.breakAfter=1:s=1),i++}for(l&&(l.breakAfter=s,n>0&&(!s&&o.length&&l.merge(n,l.length,o[0],!1,a,0)?l.breakAfter=o.shift().breakAfter:(n<l.length||l.children.length&&0==l.children[l.children.length-1].length)&&l.merge(n,l.length,null,!1,a,0),e++));e<i&&o.length;)if(u[i-1].become(o[o.length-1]))i--,o.pop(),h=o.length?0:a;else{if(!u[e].become(o[0]))break;e++,o.shift(),a=o.length?0:h}!o.length&&e&&i<u.length&&!u[e-1].breakAfter&&u[i].merge(0,0,u[e-1],!1,a,h)&&e--,(e<i||o.length)&&t.replaceChildren(e,i,o)}}function Me(t,e,n,i,r,o){var a,h=t.childCursor(),u=h.findPos(n,1),l=u.i,c=u.off,f=h.findPos(e,-1),d=f.i,v=f.off,g=e-n,p=(0,s.Z)(i);try{for(p.s();!(a=p.n()).done;){g+=a.value.length}}catch(m){p.e(m)}finally{p.f()}t.length+=g,Ae(t,d,v,l,c,i,0,r,o)}var Ze="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},Ce="undefined"!=typeof document?document:{documentElement:{style:{}}},Oe=/Edge\/(\d+)/.exec(Ze.userAgent),Te=/MSIE \d/.test(Ze.userAgent),De=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ze.userAgent),Ee=!!(Te||De||Oe),Be=!Ee&&/gecko\/(\d+)/i.test(Ze.userAgent),Re=!Ee&&/Chrome\/(\d+)/.exec(Ze.userAgent),Ie="webkitFontSmoothing"in Ce.documentElement.style,Pe=!Ee&&/Apple Computer/.test(Ze.vendor),Ne=Pe&&(/Mobile\/\w+/.test(Ze.userAgent)||Ze.maxTouchPoints>2),Le={mac:Ne||/Mac/.test(Ze.platform),windows:/Win/.test(Ze.platform),linux:/Linux|X11/.test(Ze.platform),ie:Ee,ie_version:Te?Ce.documentMode||6:De?+De[1]:Oe?+Oe[1]:0,gecko:Be,gecko_version:Be?+(/Firefox\/(\d+)/.exec(Ze.userAgent)||[0,0])[1]:0,chrome:!!Re,chrome_version:Re?+Re[1]:0,ios:Ne,android:/Android\b/.test(Ze.userAgent),webkit:Ie,safari:Pe,webkit_version:Ie?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Ce.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},Ve=function(t){function e(t){var n;return(0,h.Z)(this,e),(n=(0,r.Z)(this,e)).text=t,n}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"length",get:function(){return this.text.length}},{key:"createDOM",value:function(t){this.setDOM(t||document.createTextNode(this.text))}},{key:"sync",value:function(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(t){3==t.nodeType&&this.createDOM(t)}},{key:"merge",value:function(t,n,i){return(!i||i instanceof e&&!(this.length-(n-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(n),this.markDirty(),!0)}},{key:"split",value:function(t){var n=new e(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),n}},{key:"localPosFromDOM",value:function(t,e){return t==this.dom?e:e?this.text.length:0}},{key:"domAtPos",value:function(t){return new ke(this.dom,t)}},{key:"domBoundsAround",value:function(t,e,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}},{key:"coordsAt",value:function(t,e){return We(this.dom,t,e)}}]),e}(be),He=function(t){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;(0,h.Z)(this,e),(n=(0,r.Z)(this,e)).mark=t,n.children=i,n.length=o;var a,u=(0,s.Z)(i);try{for(u.s();!(a=u.n()).done;){a.value.setParent((0,l.Z)(n))}}catch(c){u.e(c)}finally{u.f()}return n}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"setAttrs",value:function(t){if(ye(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(var e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}},{key:"reuseDOM",value:function(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}},{key:"sync",value:function(t,n){this.dom?4&this.dirty&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),(0,c.Z)((0,f.Z)(e.prototype),"sync",this).call(this,t,n)}},{key:"merge",value:function(t,n,i,r,o,s){return(!i||!(!(i instanceof e&&i.mark.eq(this.mark))||t&&o<=0||n<this.length&&s<=0))&&(Me(this,t,n,i?i.children:[],o-1,s-1),this.markDirty(),!0)}},{key:"split",value:function(t){var n,i=[],r=0,o=-1,a=0,h=(0,s.Z)(this.children);try{for(h.s();!(n=h.n()).done;){var u=n.value,l=r+u.length;l>t&&i.push(r<t?u.split(t-r):u),o<0&&r>=t&&(o=a),r=l,a++}}catch(f){h.e(f)}finally{h.f()}var c=this.length-t;return this.length=t,o>-1&&(this.children.length=o,this.markDirty()),new e(this.mark,i,c)}},{key:"domAtPos",value:function(t){return Ue(this,t)}},{key:"coordsAt",value:function(t,e){return $e(this,t,e)}}]),e}(be);function We(t,e,n){var i=t.nodeValue.length;e>i&&(e=i);var r=e,o=e,s=0;0==e&&n<0||e==i&&n>=0?Le.chrome||Le.gecko||(e?(r--,s=1):o<i&&(o++,s=-1)):n<0?r--:o<i&&o++;var a=pe(t,r,o).getClientRects();if(!a.length)return null;var h=a[(s?s<0:n>=0)?0:a.length-1];return Le.safari&&!s&&0==h.width&&(h=Array.prototype.find.call(a,(function(t){return t.width}))||h),s?le(h,s<0):h||null}var _e=function(t){function e(t,n,i){var o;return(0,h.Z)(this,e),(o=(0,r.Z)(this,e)).widget=t,o.length=n,o.side=i,o.prevWidget=null,o}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"split",value:function(t){var n=e.create(this.widget,this.length-t,this.side);return this.length-=t,n}},{key:"sync",value:function(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.dom.contentEditable="false")}},{key:"getSide",value:function(){return this.side}},{key:"merge",value:function(t,n,i,r,o,s){return!(i&&(!(i instanceof e&&this.widget.compare(i.widget))||t>0&&o<=0||n<this.length&&s<=0))&&(this.length=t+(i?i.length:0)+(this.length-n),!0)}},{key:"become",value:function(t){return t instanceof e&&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(){return!0}},{key:"ignoreEvent",value:function(t){return this.widget.ignoreEvent(t)}},{key:"overrideDOMText",get:function(){if(0==this.length)return d.empty;for(var t=this;t.parent;)t=t.parent;var e=t.view,n=e&&e.state.doc,i=this.posAtStart;return n?n.slice(i,i+this.length):d.empty}},{key:"domAtPos",value:function(t){return(this.length?0==t:this.side>0)?ke.before(this.dom):ke.after(this.dom,t==this.length)}},{key:"domBoundsAround",value:function(){return null}},{key:"coordsAt",value:function(t,e){var n=this.widget.coordsAt(this.dom,t,e);if(n)return n;var i=this.dom.getClientRects(),r=null;if(!i.length)return null;for(var o=this.side?this.side<0:t>0,s=o?i.length-1:0;r=i[s],!(t>0?0==s:s==i.length-1||r.top<r.bottom);s+=o?-1:1);return le(r,!o)}},{key:"isEditable",get:function(){return!1}},{key:"isWidget",get:function(){return!0}},{key:"isHidden",get:function(){return this.widget.isHidden}},{key:"destroy",value:function(){(0,c.Z)((0,f.Z)(e.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}],[{key:"create",value:function(t,n,i){return new(t.customView||e)(t,n,i)}}]),e}(be),ze=function(t){function e(){return(0,h.Z)(this,e),(0,r.Z)(this,e,arguments)}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"domAtPos",value:function(t){var e=this.widget,n=e.topView,i=e.text;return n?Fe(t,0,n,i,this.length-n.length,(function(t,e){return t.domAtPos(e)}),(function(t,e){return new ke(t,Math.min(e,t.nodeValue.length))})):new ke(i,Math.min(t,i.nodeValue.length))}},{key:"sync",value:function(){this.setDOM(this.widget.toDOM())}},{key:"localPosFromDOM",value:function(t,e){var n=this.widget,i=n.topView,r=n.text;return i?je(t,e,i,r,this.length-i.length):Math.min(e,this.length)}},{key:"ignoreMutation",value:function(){return!1}},{key:"overrideDOMText",get:function(){return null}},{key:"coordsAt",value:function(t,e){var n=this.widget,i=n.topView,r=n.text;return i?Fe(t,e,i,r,this.length-i.length,(function(t,e,n){return t.coordsAt(e,n)}),(function(t,e,n){return We(t,e,n)})):We(r,t,e)}},{key:"destroy",value:function(){var t;(0,c.Z)((0,f.Z)(e.prototype),"destroy",this).call(this),null===(t=this.widget.topView)||void 0===t||t.destroy()}},{key:"isEditable",get:function(){return!0}},{key:"canReuseDOM",value:function(){return!0}}]),e}(_e);function Fe(t,e,n,i,r,o,s){if(n instanceof He){for(var a=n.dom.firstChild;a;a=a.nextSibling){var h=be.get(a);if(h){var u=ie(a,i),l=h.length+(u?r:0);if(t<l||t==l&&h.getSide()<=0)return u?Fe(t,e,h,i,r,o,s):o(h,t,e);t-=l}else{var c=qe(t,e,a,s);if("number"!=typeof c)return c;t=c}}return o(n,n.length,-1)}return n.dom==i?s(i,t,e):o(n,t,e)}function qe(t,e,n,i){if(3==n.nodeType){var r=n.nodeValue.length;if(t<=r)return i(n,t,e);t-=r}else if(1==n.nodeType&&"false"!=n.contentEditable)for(var o=n.firstChild;o;o=o.nextSibling){var s=qe(t,e,o,i);if("number"!=typeof s)return s;t=s}return t}function je(t,e,n,i,r){if(n instanceof He)for(var o=0,s=n.dom.firstChild;s;s=s.nextSibling){var a=be.get(s);if(a){var h=ie(s,i);if(ie(s,t))return o+(h?je(t,e,a,i,r):a.localPosFromDOM(t,e));o+=a.length+(h?r:0)}else{var u=Ke(t,e,s);if(null!=u.result)return o+u.result;o+=u.size}}else if(n.dom==i)return Math.min(e,i.nodeValue.length);return n.localPosFromDOM(t,e)}function Ke(t,e,n){if(3==n.nodeType)return t==n?{result:e}:{size:n.nodeValue.length};if(1!=n.nodeType||"false"==n.contentEditable)return n.contains(t)?{result:0}:{size:0};for(var i=0,r=n.firstChild,o=0;;r=r.nextSibling,o++){if(t==n&&o==e)return{result:i};if(!r)return{size:i};var s=Ke(t,e,r);if(null!=s.result)return{result:e+s.result};i+=s.size}}var Je=function(t){function e(t){var n;return(0,h.Z)(this,e),(n=(0,r.Z)(this,e)).side=t,n}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"length",get:function(){return 0}},{key:"merge",value:function(){return!1}},{key:"become",value:function(t){return t instanceof e&&t.side==this.side}},{key:"split",value:function(){return new e(this.side)}},{key:"sync",value:function(){if(!this.dom){var t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),this.setDOM(t)}}},{key:"getSide",value:function(){return this.side}},{key:"domAtPos",value:function(t){return this.side>0?ke.before(this.dom):ke.after(this.dom)}},{key:"localPosFromDOM",value:function(){return 0}},{key:"domBoundsAround",value:function(){return null}},{key:"coordsAt",value:function(t){return this.dom.getBoundingClientRect()}},{key:"overrideDOMText",get:function(){return d.empty}},{key:"isHidden",get:function(){return!0}}]),e}(be);function Ue(t,e){for(var n=t.dom,i=t.children,r=0,o=0;r<i.length;r++){var s=i[r],a=o+s.length;if(!(a==o&&s.getSide()<=0)){if(e>o&&e<a&&s.dom.parentNode==n)return s.domAtPos(e-o);if(e<=o)break;o=a}}for(var h=r;h>0;h--){var u=i[h-1];if(u.dom.parentNode==n)return u.domAtPos(u.length)}for(var l=r;l<i.length;l++){var c=i[l];if(c.dom.parentNode==n)return c.domAtPos(0)}return new ke(n,0)}function Ge(t,e,n){var i,r=t.children;n>0&&e instanceof He&&r.length&&(i=r[r.length-1])instanceof He&&i.mark.eq(e.mark)?Ge(i,e.children[0],n-1):(r.push(e),e.setParent(t)),t.length+=e.length}function $e(t,e,n){var i=null,r=-1,o=null,s=-1;!function t(e,a){for(var h=0,u=0;h<e.children.length&&u<=a;h++){var l=e.children[h],c=u+l.length;c>=a&&(l.children.length?t(l,a-u):(!o||o.isHidden&&n>0)&&(c>a||u==c&&l.getSide()>0)?(o=l,s=a-u):(u<a||u==c&&l.getSide()<0&&!l.isHidden)&&(i=l,r=a-u)),u=c}}(t,e);var a=(n<0?i:o)||i||o;return a?a.coordsAt(Math.max(0,a==i?r:s),n):function(t){var e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();var n=oe(e);return n[n.length-1]||null}(t)}function Xe(t,e){for(var n in t)"class"==n&&e.class?e.class+=" "+t.class:"style"==n&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}function Ye(t,e){if(t==e)return!0;if(!t||!e)return!1;var n=Object.keys(t),i=Object.keys(e);if(n.length!=i.length)return!1;for(var r=0,o=n;r<o.length;r++){var s=o[r];if(-1==i.indexOf(s)||t[s]!==e[s])return!1}return!0}function Qe(t,e,n){var i=null;if(e)for(var r in e)n&&r in n||t.removeAttribute(i=r);if(n)for(var o in n)e&&e[o]==n[o]||t.setAttribute(i=o,n[o]);return!!i}Ve.prototype.children=_e.prototype.children=Je.prototype.children=we;var tn=function(){function t(){(0,h.Z)(this,t)}return(0,u.Z)(t,[{key:"eq",value:function(t){return!1}},{key:"updateDOM",value:function(t,e){return!1}},{key:"compare",value:function(t){return this==t||this.constructor==t.constructor&&this.eq(t)}},{key:"estimatedHeight",get:function(){return-1}},{key:"lineBreaks",get:function(){return 0}},{key:"ignoreEvent",value:function(t){return!0}},{key:"coordsAt",value:function(t,e,n){return null}},{key:"customView",get:function(){return null}},{key:"isHidden",get:function(){return!1}},{key:"destroy",value:function(t){}}]),t}(),en=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(en||(en={})),nn=function(t){function e(t,n,i,o){var s;return(0,h.Z)(this,e),(s=(0,r.Z)(this,e)).startSide=t,s.endSide=n,s.widget=i,s.spec=o,s}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"heightRelevant",get:function(){return!1}},{key:"hasHeight",value:function(){return!!this.widget&&this.widget.estimatedHeight>-1}}],[{key:"mark",value:function(t){return new rn(t)}},{key:"widget",value:function(t){var e=Math.max(-1e4,Math.min(1e4,t.side||0)),n=!!t.block;return e+=n&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new sn(t,e,e,n,t.widget||null,!1)}},{key:"replace",value:function(t){var e,n,i=!!t.block;if(t.isBlockGap)e=-5e8,n=4e8;else{var r=an(t,i);e=(r.start?i?-3e8:-1:5e8)-1,n=1+(r.end?i?2e8:1:-6e8)}return new sn(t,e,n,i,t.widget||null,!0)}},{key:"line",value:function(t){return new on(t)}},{key:"set",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return zt.of(t,e)}}]),e}(Vt);nn.none=zt.empty;var rn=function(t){function e(t){var n;(0,h.Z)(this,e);var i=an(t),o=i.start,s=i.end;return(n=(0,r.Z)(this,e,[o?-1:5e8,s?1:-6e8,null,t])).tagName=t.tagName||"span",n.class=t.class||"",n.attrs=t.attributes||null,n}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"eq",value:function(t){return this==t||t instanceof e&&this.tagName==t.tagName&&this.class==t.class&&Ye(this.attrs,t.attrs)}},{key:"range",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(t>=n)throw new RangeError("Mark decorations may not be empty");return(0,c.Z)((0,f.Z)(e.prototype),"range",this).call(this,t,n)}}]),e}(nn);rn.prototype.point=!1;var on=function(t){function e(t){return(0,h.Z)(this,e),(0,r.Z)(this,e,[-2e8,-2e8,null,t])}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"eq",value:function(t){return t instanceof e&&this.spec.class==t.spec.class&&Ye(this.spec.attributes,t.spec.attributes)}},{key:"range",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return(0,c.Z)((0,f.Z)(e.prototype),"range",this).call(this,t,n)}}]),e}(nn);on.prototype.mapMode=N.TrackBefore,on.prototype.point=!0;var sn=function(t){function e(t,n,i,o,s,a){var u;return(0,h.Z)(this,e),(u=(0,r.Z)(this,e,[n,i,s,t])).block=o,u.isReplace=a,u.mapMode=o?n<=0?N.TrackBefore:N.TrackAfter:N.TrackDel,u}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"type",get:function(){return this.startSide<this.endSide?en.WidgetRange:this.startSide<=0?en.WidgetBefore:en.WidgetAfter}},{key:"heightRelevant",get:function(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}},{key:"eq",value:function(t){return t instanceof e&&(n=this.widget,i=t.widget,n==i||!!(n&&i&&n.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var n,i}},{key:"range",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return(0,c.Z)((0,f.Z)(e.prototype),"range",this).call(this,t,n)}}]),e}(nn);function an(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.inclusiveStart,i=t.inclusiveEnd;return null==n&&(n=t.inclusive),null==i&&(i=t.inclusive),{start:null!=n?n:e,end:null!=i?i:e}}function hn(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=n.length-1;r>=0&&n[r]+i>=t?n[r]=Math.max(n[r],e):n.push(t,e)}sn.prototype.point=!0;var un=function(t){function e(){var t;return(0,h.Z)(this,e),(t=(0,r.Z)(this,e,arguments)).children=[],t.length=0,t.prevAttrs=void 0,t.attrs=null,t.breakAfter=0,t}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"merge",value:function(t,n,i,r,o,s){if(i){if(!(i instanceof e))return!1;this.dom||i.transferDOM(this)}return r&&this.setDeco(i?i.attrs:null),Me(this,t,n,i?i.children:[],o,s),!0}},{key:"split",value:function(t){var n=new e;if(n.breakAfter=this.breakAfter,0==this.length)return n;var i=this.childPos(t),r=i.i,o=i.off;o&&(n.append(this.children[r].split(o),0),this.children[r].merge(o,this.children[r].length,null,!1,0,0),r++);for(var s=r;s<this.children.length;s++)n.append(this.children[s],0);for(;r>0&&0==this.children[r-1].length;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=t,n}},{key:"transferDOM",value:function(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(t){Ye(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}},{key:"append",value:function(t,e){Ge(this,t,e)}},{key:"addLineDeco",value:function(t){var e=t.spec.attributes,n=t.spec.class;e&&(this.attrs=Xe(e,this.attrs||{})),n&&(this.attrs=Xe({class:n},this.attrs||{}))}},{key:"domAtPos",value:function(t){return Ue(this,t)}},{key:"reuseDOM",value:function(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}},{key:"sync",value:function(t,n){var i;this.dom?4&this.dirty&&(ye(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&&(Qe(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),(0,c.Z)((0,f.Z)(e.prototype),"sync",this).call(this,t,n);for(var r=this.dom.lastChild;r&&be.get(r)instanceof He;)r=r.lastChild;if(!(r&&this.length&&("BR"==r.nodeName||0!=(null===(i=be.get(r))||void 0===i?void 0:i.isEditable)||Le.ios&&this.children.some((function(t){return t instanceof Ve}))))){var o=document.createElement("BR");o.cmIgnore=!0,this.dom.appendChild(o)}}},{key:"measureTextSize",value:function(){if(0==this.children.length||this.length>20)return null;var t,e,n=0,i=(0,s.Z)(this.children);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(!(r instanceof Ve)||/[^ -~]/.test(r.text))return null;var o=oe(r.dom);if(1!=o.length)return null;n+=o[0].width,t=o[0].height}}catch(a){i.e(a)}finally{i.f()}return n?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:n/this.length,textHeight:t}:null}},{key:"coordsAt",value:function(t,e){var n=$e(this,t,e);if(!this.children.length&&n&&this.parent){var i=this.parent.view.viewState.heightOracle,r=n.bottom-n.top;if(Math.abs(r-i.lineHeight)<2&&i.textHeight<r){var o=(r-i.textHeight)/2;return{top:n.top+o,bottom:n.bottom-o,left:n.left,right:n.left}}}return n}},{key:"become",value:function(t){return!1}},{key:"type",get:function(){return en.Text}}],[{key:"find",value:function(t,n){for(var i=0,r=0;i<t.children.length;i++){var o=t.children[i],s=r+o.length;if(s>=n){if(o instanceof e)return o;if(s>n)break}r=s+o.breakAfter}return null}}]),e}(be),ln=function(t){function e(t,n,i){var o;return(0,h.Z)(this,e),(o=(0,r.Z)(this,e)).widget=t,o.length=n,o.type=i,o.breakAfter=0,o.prevWidget=null,o}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"merge",value:function(t,n,i,r,o,s){return!(i&&(!(i instanceof e&&this.widget.compare(i.widget))||t>0&&o<=0||n<this.length&&s<=0))&&(this.length=t+(i?i.length:0)+(this.length-n),!0)}},{key:"domAtPos",value:function(t){return 0==t?ke.before(this.dom):ke.after(this.dom,t==this.length)}},{key:"split",value:function(t){var n=this.length-t;this.length=t;var i=new e(this.widget,n,this.type);return i.breakAfter=this.breakAfter,i}},{key:"children",get:function(){return we}},{key:"sync",value:function(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.dom.contentEditable="false")}},{key:"overrideDOMText",get:function(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):d.empty}},{key:"domBoundsAround",value:function(){return null}},{key:"become",value:function(t){return t instanceof e&&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.type=t.type,this.breakAfter=t.breakAfter,!0)}},{key:"ignoreMutation",value:function(){return!0}},{key:"ignoreEvent",value:function(t){return this.widget.ignoreEvent(t)}},{key:"isEditable",get:function(){return!1}},{key:"isWidget",get:function(){return!0}},{key:"coordsAt",value:function(t,e){return this.widget.coordsAt(this.dom,t,e)}},{key:"destroy",value:function(){(0,c.Z)((0,f.Z)(e.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}]),e}(be),cn=function(){function t(e,n,i,r){(0,h.Z)(this,t),this.doc=e,this.pos=n,this.end=i,this.disallowBlockEffectsFor=r,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=e.iter(),this.skip=n}return(0,u.Z)(t,[{key:"posCovered",value:function(){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 ln&&t.type==en.WidgetBefore)}},{key:"getLine",value:function(){return this.curLine||(this.content.push(this.curLine=new un),this.atCursorPos=!0),this.curLine}},{key:"flushBuffer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(fn(new Je(-1),t),t.length),this.pendingBuffer=0)}},{key:"addBlockWidget",value:function(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}},{key:"finish",value:function(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||this.getLine()}},{key:"buildText",value:function(t,e,n){for(;t>0;){if(this.textOff==this.text.length){var i=this.cursor.next(this.skip),r=i.value,o=i.lineBreak,s=i.done;if(this.skip=0,s)throw new Error("Ran out of text content when drawing inline views");if(o){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=r,this.textOff=0}var a=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-n)),this.getLine().append(fn(new Ve(this.text.slice(this.textOff,this.textOff+a)),e),n),this.atCursorPos=!0,this.textOff+=a,t-=a,n=0}}},{key:"span",value:function(t,e,n,i){this.buildText(e-t,n,i),this.pos=e,this.openStart<0&&(this.openStart=i)}},{key:"point",value:function(t,e,n,i,r,o){if(this.disallowBlockEffectsFor[o]&&n instanceof sn){if(n.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 s=e-t;if(n instanceof sn)if(n.block){var a=n.type;a!=en.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ln(n.widget||new dn("div"),s,a))}else{var h=_e.create(n.widget||new dn("span"),s,s?0:n.startSide),u=this.atCursorPos&&!h.isEditable&&r<=i.length&&(t<e||n.startSide>0),l=!h.isEditable&&(t<e||r>i.length||n.startSide<=0),c=this.getLine();2!=this.pendingBuffer||u||h.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),u&&(c.append(fn(new Je(1),i),r),r=i.length+Math.max(0,r-i.length)),c.append(fn(h,i),r),this.atCursorPos=l,this.pendingBuffer=l?t<e||r>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);s&&(this.textOff+s<=this.text.length?this.textOff+=s:(this.skip+=s-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}}],[{key:"build",value:function(e,n,i,r,o){var s=new t(e,n,i,o);return s.openEnd=zt.spans(r,n,i,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}]),t}();function fn(t,e){var n,i=(0,s.Z)(e);try{for(i.s();!(n=i.n()).done;){var r=n.value;t=new He(r,[t],t.length)}}catch(o){i.e(o)}finally{i.f()}return t}var dn=function(t){function e(t){var n;return(0,h.Z)(this,e),(n=(0,r.Z)(this,e)).tag=t,n}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"eq",value:function(t){return t.tag==this.tag}},{key:"toDOM",value:function(){return document.createElement(this.tag)}},{key:"updateDOM",value:function(t){return t.nodeName.toLowerCase()==this.tag}},{key:"isHidden",get:function(){return!0}}]),e}(tn),vn=G.define(),gn=G.define(),pn=G.define(),mn=G.define(),yn=G.define(),kn=G.define(),wn=G.define(),bn=G.define({combine:function(t){return t.some((function(t){return t}))}}),xn=G.define({combine:function(t){return t.some((function(t){return t}))}}),Sn=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"nearest",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"nearest",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5;(0,h.Z)(this,t),this.range=e,this.y=n,this.x=i,this.yMargin=r,this.xMargin=o}return(0,u.Z)(t,[{key:"map",value:function(e){return e.empty?this:new t(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}]),t}(),An=At.define({map:function(t,e){return t.map(e)}});function Mn(t,e,n){var i=t.facet(mn);i.length?i[0](e):window.onerror?window.onerror(String(e),n,void 0,void 0,e):n?console.error(n+":",e):console.error(e)}var Zn=G.define({combine:function(t){return!t.length||t[0]}}),Cn=0,On=G.define(),Tn=function(){function t(e,n,i,r){(0,h.Z)(this,t),this.id=e,this.create=n,this.domEventHandlers=i,this.extension=r(this)}return(0,u.Z)(t,null,[{key:"define",value:function(e,n){var i=n||{},r=i.eventHandlers,o=i.provide,s=i.decorations;return new t(Cn++,e,r,(function(t){var e=[On.of(t)];return s&&e.push(Rn.of((function(e){var n=e.plugin(t);return n?s(n):nn.none}))),o&&e.push(o(t)),e}))}},{key:"fromClass",value:function(e,n){return t.define((function(t){return new e(t)}),n)}}]),t}(),Dn=function(){function t(e){(0,h.Z)(this,t),this.spec=e,this.mustUpdate=null,this.value=null}return(0,u.Z)(t,[{key:"update",value:function(t){if(this.value){if(this.mustUpdate){var e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(n){if(Mn(e.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(ys){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(n){Mn(t.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}},{key:"destroy",value:function(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(n){Mn(t.state,n,"CodeMirror plugin crashed")}}},{key:"deactivate",value:function(){this.spec=this.value=null}}]),t}(),En=G.define(),Bn=G.define(),Rn=G.define(),In=G.define(),Pn=G.define();function Nn(t){var e,n=0,i=0,r=0,o=0,a=(0,s.Z)(t.state.facet(Pn));try{for(a.s();!(e=a.n()).done;){var h=(0,e.value)(t);h&&(null!=h.left&&(n=Math.max(n,h.left)),null!=h.right&&(i=Math.max(i,h.right)),null!=h.top&&(r=Math.max(r,h.top)),null!=h.bottom&&(o=Math.max(o,h.bottom)))}}catch(u){a.e(u)}finally{a.f()}return{left:n,right:i,top:r,bottom:o}}var Ln=G.define(),Vn=function(){function t(e,n,i,r){(0,h.Z)(this,t),this.fromA=e,this.toA=n,this.fromB=i,this.toB=r}return(0,u.Z)(t,[{key:"join",value:function(e){return new t(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}},{key:"addToSet",value:function(t){for(var e=t.length,n=this;e>0;e--){var i=t[e-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),t.splice(e-1,1)}}return t.splice(e,0,n),t}}],[{key:"extendWithRanges",value:function(e,n){if(0==n.length)return e;for(var i=[],r=0,o=0,s=0,a=0;;r++){for(var h=r==e.length?null:e[r],u=s-a,l=h?h.fromB:1e9;o<n.length&&n[o]<l;){var c=n[o],f=n[o+1],d=Math.max(a,c),v=Math.min(l,f);if(d<=v&&new t(d+u,v+u,d,v).addToSet(i),f>l)break;o+=2}if(!h)return i;new t(h.fromA,h.toA,h.fromB,h.toB).addToSet(i),s=h.toA,a=h.toB}}}]),t}(),Hn=function(){function t(e,n,i){(0,h.Z)(this,t),this.view=e,this.state=n,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=V.empty(this.startState.doc.length);var r,o=(0,s.Z)(i);try{for(o.s();!(r=o.n()).done;){var a=r.value;this.changes=this.changes.compose(a.changes)}}catch(l){o.e(l)}finally{o.f()}var u=[];this.changes.iterChangedRanges((function(t,e,n,i){return u.push(new Vn(t,e,n,i))})),this.changedRanges=u}return(0,u.Z)(t,[{key:"viewportChanged",get:function(){return(4&this.flags)>0}},{key:"heightChanged",get:function(){return(2&this.flags)>0}},{key:"geometryChanged",get:function(){return this.docChanged||(10&this.flags)>0}},{key:"focusChanged",get:function(){return(1&this.flags)>0}},{key:"docChanged",get:function(){return!this.changes.empty}},{key:"selectionSet",get:function(){return this.transactions.some((function(t){return t.selection}))}},{key:"empty",get:function(){return 0==this.flags&&0==this.transactions.length}}],[{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}(),Wn=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Wn||(Wn={})),_n=Wn.LTR,zn=Wn.RTL;function Fn(t){for(var e=[],n=0;n<t.length;n++)e.push(1<<+t[n]);return e}for(var qn=Fn("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),jn=Fn("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Kn=Object.create(null),Jn=[],Un=0,Gn=["()","[]","{}"];Un<Gn.length;Un++){var $n=Gn[Un],Xn=$n.charCodeAt(0),Yn=$n.charCodeAt(1);Kn[Xn]=Yn,Kn[Yn]=-Xn}function Qn(t){return t<=247?qn[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?jn[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203?256:64336<=t&&t<=65023?4:8204==t?256:1}var ti=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,ei=function(){function t(e,n,i){(0,h.Z)(this,t),this.from=e,this.to=n,this.level=i}return(0,u.Z)(t,[{key:"dir",get:function(){return this.level%2?zn:_n}},{key:"side",value:function(t,e){return this.dir==e==t?this.to:this.from}}],[{key:"find",value:function(t,e,n,i){for(var r=-1,o=0;o<t.length;o++){var s=t[o];if(s.from<=e&&s.to>=e){if(s.level==n)return o;(r<0||(0!=i?i<0?s.from<e:s.to>e:t[r].level>s.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}]),t}(),ni=[];function ii(t,e){var n=t.length,i=e==_n?1:2,r=e==_n?2:1;if(!t||1==i&&!ti.test(t))return ri(n);for(var o=0,s=i,a=i;o<n;o++){var h=Qn(t.charCodeAt(o));512==h?h=s:8==h&&4==a&&(h=16),ni[o]=4==h?2:h,7&h&&(a=h),s=h}for(var u=0,l=i,c=i;u<n;u++){var f=ni[u];if(128==f)u<n-1&&l==ni[u+1]&&24&l?f=ni[u]=l:ni[u]=256;else if(64==f){for(var d=u+1;d<n&&64==ni[d];)d++;for(var v=u&&8==l||d<n&&8==ni[d]?1==c?1:8:256,g=u;g<d;g++)ni[g]=v;u=d-1}else 8==f&&1==c&&(ni[u]=1);l=f,7&f&&(c=f)}for(var p,m,y,k=0,w=0,b=0;k<n;k++)if(m=Kn[p=t.charCodeAt(k)])if(m<0){for(var x=w-3;x>=0;x-=3)if(Jn[x+1]==-m){var S=Jn[x+2],A=2&S?i:4&S?1&S?r:i:0;A&&(ni[k]=ni[Jn[x]]=A),w=x;break}}else{if(189==Jn.length)break;Jn[w++]=k,Jn[w++]=p,Jn[w++]=b}else if(2==(y=ni[k])||1==y){var M=y==i;b=M?0:1;for(var Z=w-3;Z>=0;Z-=3){var C=Jn[Z+2];if(2&C)break;if(M)Jn[Z+2]|=2;else{if(4&C)break;Jn[Z+2]|=4}}}for(var O=0;O<n;O++)if(256==ni[O]){for(var T=O+1;T<n&&256==ni[T];)T++;for(var D=1==(O?ni[O-1]:i),E=D==(1==(T<n?ni[T]:i))?D?1:2:i,B=O;B<T;B++)ni[B]=E;O=T-1}var R=[];if(1==i)for(var I=0;I<n;){for(var P=I,N=1!=ni[I++];I<n&&N==(1!=ni[I]);)I++;if(N)for(var L=I;L>P;){for(var V=L,H=2!=ni[--L];L>P&&H==(2!=ni[L-1]);)L--;R.push(new ei(L,V,H?2:1))}else R.push(new ei(P,I,0))}else for(var W=0;W<n;){for(var _=W,z=2==ni[W++];W<n&&z==(2==ni[W]);)W++;R.push(new ei(_,W,z?1:2))}return R}function ri(t){return[new ei(0,t,0)]}var oi="";function si(t,e,n,i,r){var o,s=i.head-t.from,a=-1;if(0==s){if(!r||!t.length)return null;e[0].level!=n&&(s=e[0].side(!1,n),a=0)}else if(s==t.length){if(r)return null;var h=e[e.length-1];h.level!=n&&(s=h.side(!0,n),a=e.length-1)}a<0&&(a=ei.find(e,s,null!==(o=i.bidiLevel)&&void 0!==o?o:-1,i.assoc));var u=e[a];s==u.side(r,n)&&(s=(u=e[a+=r?1:-1]).side(!r,n));var l=r==(u.dir==n),c=C(t.text,s,l);if(oi=t.text.slice(Math.min(s,c),Math.max(s,c)),c!=u.side(r,n))return K.cursor(c+t.from,l?-1:1,u.level);var f=a==(r?e.length-1:0)?null:e[a+(r?1:-1)];return f||u.level==n?f&&f.level<u.level?K.cursor(f.side(!r,n)+t.from,r?1:-1,f.level):K.cursor(c+t.from,r?-1:1,u.level):K.cursor(r?t.to:t.from,r?-1:1,n)}var ai="￿",hi=function(){function t(e,n){(0,h.Z)(this,t),this.points=e,this.text="",this.lineSeparator=n.facet(Nt.lineSeparator)}return(0,u.Z)(t,[{key:"append",value:function(t){this.text+=t}},{key:"lineBreak",value:function(){this.text+=ai}},{key:"readRange",value:function(t,e){if(!t)return this;for(var n=t.parentNode,i=t;;){this.findPointBefore(n,i);var r=this.text.length;this.readNode(i);var o=i.nextSibling;if(o==e)break;var s=be.get(i),a=be.get(o);(s&&a?s.breakAfter:(s?s.breakAfter:ui(i))||ui(o)&&("BR"!=i.nodeName||i.cmIgnore)&&this.text.length>r)&&this.lineBreak(),i=o}return this.findPointBefore(n,e),this}},{key:"readTextNode",value:function(t){var e,n=t.nodeValue,i=(0,s.Z)(this.points);try{for(i.s();!(e=i.n()).done;){var r=e.value;r.node==t&&(r.pos=this.text.length+Math.min(r.offset,n.length))}}catch(v){i.e(v)}finally{i.f()}for(var o=0,a=this.lineSeparator?null:/\r\n?|\n/g;;){var h=-1,u=1,l=void 0;if(this.lineSeparator?(h=n.indexOf(this.lineSeparator,o),u=this.lineSeparator.length):(l=a.exec(n))&&(h=l.index,u=l[0].length),this.append(n.slice(o,h<0?n.length:h)),h<0)break;if(this.lineBreak(),u>1){var c,f=(0,s.Z)(this.points);try{for(f.s();!(c=f.n()).done;){var d=c.value;d.node==t&&d.pos>this.text.length&&(d.pos-=u-1)}}catch(v){f.e(v)}finally{f.f()}}o=h+u}}},{key:"readNode",value:function(t){if(!t.cmIgnore){var e=be.get(t),n=e&&e.overrideDOMText;if(null!=n){this.findPointInside(t,n.length);for(var i=n.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.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(t,e){var n,i=(0,s.Z)(this.points);try{for(i.s();!(n=i.n()).done;){var r=n.value;r.node==t&&t.childNodes[r.offset]==e&&(r.pos=this.text.length)}}catch(o){i.e(o)}finally{i.f()}}},{key:"findPointInside",value:function(t,e){var n,i=(0,s.Z)(this.points);try{for(i.s();!(n=i.n()).done;){var r=n.value;(3==t.nodeType?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+Math.min(e,r.offset))}}catch(o){i.e(o)}finally{i.f()}}}]),t}();function ui(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}var li=(0,u.Z)((function t(e,n){(0,h.Z)(this,t),this.node=e,this.offset=n,this.pos=-1})),ci=function(t){function e(t){var n;return(0,h.Z)(this,e),(n=(0,r.Z)(this,e)).view=t,n.compositionDeco=nn.none,n.decorations=[],n.dynamicDecorationMap=[],n.minWidth=0,n.minWidthFrom=0,n.minWidthTo=0,n.impreciseAnchor=null,n.impreciseHead=null,n.forceSelection=!1,n.lastUpdate=Date.now(),n.setDOM(t.contentDOM),n.children=[new un],n.children[0].setParent((0,l.Z)(n)),n.updateDeco(),n.updateInner([new Vn(0,0,0,t.state.doc.length)],0),n}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"length",get:function(){return this.view.state.doc.length}},{key:"update",value:function(t){var e=this,n=t.changedRanges;this.minWidth>0&&n.length&&(n.every((function(t){var n=t.fromA;return t.toA<e.minWidthFrom||n>e.minWidthTo}))?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=nn.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){var n=di(t);if(!n)return nn.none;var i=n.from,r=n.to,o=n.node,s=n.text,a=e.mapPos(i,1),h=Math.max(a,e.mapPos(r,-1)),u=t.state,l=new hi([],u);3==o.nodeType?l.readTextNode(o):l.readRange(o.firstChild,null);var c=l.text;if(c.indexOf(ai)>-1)return nn.none;if(h-a<c.length)if(u.doc.sliceString(a,Math.min(u.doc.length,a+c.length))==c)h=a+c.length;else{if(u.doc.sliceString(Math.max(0,h-c.length),h)!=c)return nn.none;a=h-c.length}else if(u.doc.sliceString(a,h)!=c)return nn.none;var f=be.get(o);f instanceof ze?f=f.widget.topView:f&&(f.parent=null);return nn.set(nn.replace({widget:new vi(o,s,f),inclusive:!0}).range(a,h))}(this.view,t.changes)),(Le.ie||Le.chrome)&&!this.compositionDeco.size&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);var i,r,o,s,a=this.decorations,h=this.updateDeco(),u=(i=a,r=h,o=t.changes,s=new pi,zt.compare(i,r,o,s),s.changes);return n=Vn.extendWithRanges(n,u),(0!=this.dirty||0!=n.length)&&(this.updateInner(n,t.startState.doc.length),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}},{key:"updateInner",value:function(t,e){var n=this;this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e);var i=this.view.observer;i.ignore((function(){n.dom.style.height=n.view.viewState.contentHeight+"px",n.dom.style.flexBasis=n.minWidth?n.minWidth+"px":"";var t=Le.chrome||Le.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;n.sync(n.view,t),n.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(n.forceSelection=!0),n.dom.style.height=""}));var r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){var o,a=(0,s.Z)(this.children);try{for(a.s();!(o=a.n()).done;){var h=o.value;h instanceof ln&&h.widget instanceof fi&&r.push(h.dom)}}catch(u){a.e(u)}finally{a.f()}}i.updateGaps(r)}},{key:"updateChildren",value:function(t,e){for(var n=this.childCursor(e),i=t.length-1;;i--){var r=i>=0?t[i]:null;if(!r)break;var o=r.fromA,s=r.toA,a=r.fromB,h=r.toB,u=cn.build(this.view.state.doc,a,h,this.decorations,this.dynamicDecorationMap),l=u.content,c=u.breakAtStart,f=u.openStart,d=u.openEnd,v=n.findPos(s,1),g=v.i,p=v.off,m=n.findPos(o,-1);Ae(this,m.i,m.off,g,p,l,c,f,d)}}},{key:"updateSelection",value:function(){var t=this,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();var n=this.view.root.activeElement,i=n==this.dom,r=!i&&re(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(i||e||r){var o=this.forceSelection;this.forceSelection=!1;var s,a=this.view.state.selection.main,h=this.domAtPos(a.anchor),u=a.empty?h:this.domAtPos(a.head);if(Le.gecko&&a.empty&&!this.compositionDeco.size&&(1==(s=h).node.nodeType&&s.node.firstChild&&(0==s.offset||"false"==s.node.childNodes[s.offset-1].contentEditable)&&(s.offset==s.node.childNodes.length||"false"==s.node.childNodes[s.offset].contentEditable))){var l=document.createTextNode("");this.view.observer.ignore((function(){return h.node.insertBefore(l,h.node.childNodes[h.offset]||null)})),h=u=new ke(l,0),o=!0}var c=this.view.observer.selectionRange;!o&&c.focusNode&&se(h.node,h.offset,c.anchorNode,c.anchorOffset)&&se(u.node,u.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((function(){Le.android&&Le.chrome&&t.dom.contains(c.focusNode)&&function(t,e){for(var n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(c.focusNode,t.dom)&&(t.dom.blur(),t.dom.focus({preventScroll:!0}));var e,i,o=ne(t.view.root);if(o)if(a.empty){if(Le.gecko){var s=(e=h.node,i=h.offset,1!=e.nodeType?0:(i&&"false"==e.childNodes[i-1].contentEditable?1:0)|(i<e.childNodes.length&&"false"==e.childNodes[i].contentEditable?2:0));if(s&&3!=s){var l=gi(h.node,h.offset,1==s?1:-1);l&&(h=new ke(l,1==s?0:l.nodeValue.length))}}o.collapse(h.node,h.offset),null!=a.bidiLevel&&null!=c.cursorBidiLevel&&(c.cursorBidiLevel=a.bidiLevel)}else if(o.extend){o.collapse(h.node,h.offset);try{o.extend(u.node,u.offset)}catch(ys){}}else{var f=document.createRange();if(a.anchor>a.head){var d=[u,h];h=d[0],u=d[1]}f.setEnd(u.node,u.offset),f.setStart(h.node,h.offset),o.removeAllRanges(),o.addRange(f)}else;r&&t.view.root.activeElement==t.dom&&(t.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(h,u)),this.impreciseAnchor=h.precise?null:new ke(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new ke(c.focusNode,c.focusOffset)}}},{key:"enforceCursorAssoc",value:function(){if(!this.compositionDeco.size){var t=this.view,e=t.state.selection.main,n=ne(t.root),i=t.observer.selectionRange,r=i.anchorNode,o=i.anchorOffset;if(n&&e.empty&&e.assoc&&n.modify){var s=un.find(this,e.head);if(s){var a=s.posAtStart;if(e.head!=a&&e.head!=a+s.length){var h=this.coordsAt(e.head,-1),u=this.coordsAt(e.head,1);if(h&&u&&!(h.bottom>u.top)){var l=this.domAtPos(e.head+e.assoc);n.collapse(l.node,l.offset),n.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();var c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&n.collapse(r,o)}}}}}}},{key:"nearest",value:function(t){for(var e=t;e;){var n=be.get(e);if(n&&n.rootView==this)return n;e=e.parentNode}return null}},{key:"posFromDOM",value:function(t,e){var n=this.nearest(t);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(t,e)+n.posAtStart}},{key:"domAtPos",value:function(t){for(var e=this.childCursor().findPos(t,-1),n=e.i,i=e.off;n<this.children.length-1;){var r=this.children[n];if(i<r.length||r instanceof un)break;n++,i=0}return this.children[n].domAtPos(i)}},{key:"coordsAt",value:function(t,e){for(var n=this.length,i=this.children.length-1;;i--){var r=this.children[i],o=n-r.breakAfter-r.length;if(t>o||t==o&&r.type!=en.WidgetBefore&&r.type!=en.WidgetAfter&&(!i||2==e||this.children[i-1].breakAfter||this.children[i-1].type==en.WidgetBefore&&e>-2))return r.coordsAt(t-o,e);n=o}}},{key:"measureVisibleLineHeights",value:function(t){for(var e=[],n=t.from,i=t.to,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==Wn.LTR,h=0,u=0;u<this.children.length;u++){var l=this.children[u],c=h+l.length;if(c>i)break;if(h>=n){var f=l.dom.getBoundingClientRect();if(e.push(f.height),o){var d=l.dom.lastChild,v=d?oe(d):[];if(v.length){var g=v[v.length-1],p=a?g.right-f.left:f.right-g.left;p>s&&(s=p,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=c)}}}h=c+l.breakAfter}return e}},{key:"textDirectionAt",value:function(t){var e=this.childPos(t,1).i;return"rtl"==getComputedStyle(this.children[e].dom).direction?Wn.RTL:Wn.LTR}},{key:"measureTextSize",value:function(){var t,e=this,n=(0,s.Z)(this.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(i instanceof un){var r=i.measureTextSize();if(r)return r}}}catch(l){n.e(l)}finally{n.f()}var o,a,h,u=document.createElement("div");return u.className="cm-line",u.style.width="99999px",u.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((function(){e.dom.appendChild(u);var t=oe(u.firstChild)[0];o=u.getBoundingClientRect().height,a=t?t.width/27:7,h=t?t.height:o,u.remove()})),{lineHeight:o,charWidth:a,textHeight:h}}},{key:"childCursor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length,e=this.children.length;return e&&(t-=this.children[--e].length),new Se(this.children,t,e)}},{key:"computeBlockGapDeco",value:function(){for(var t=[],e=this.view.viewState,n=0,i=0;;i++){var r=i==e.viewports.length?null:e.viewports[i],o=r?r.from-1:this.length;if(o>n){var s=e.lineBlockAt(o).bottom-e.lineBlockAt(n).top;t.push(nn.replace({widget:new fi(s),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return nn.set(t)}},{key:"updateDeco",value:function(){for(var t=this,e=this.view.state.facet(Rn).map((function(e,n){return(t.dynamicDecorationMap[n]="function"==typeof e)?e(t.view):e})),n=e.length;n<e.length+3;n++)this.dynamicDecorationMap[n]=!1;return this.decorations=[].concat((0,i.Z)(e),[this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco])}},{key:"scrollIntoView",value:function(t){var e,n=t.range,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(i){!n.empty&&(e=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,e.left),top:Math.min(i.top,e.top),right:Math.max(i.right,e.right),bottom:Math.max(i.bottom,e.bottom)});var r=Nn(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom};!function(t,e,n,i,r,o,s,a){for(var h=t.ownerDocument,u=h.defaultView||window,l=t;l;)if(1==l.nodeType){var c=void 0,f=l==h.body;if(f)c=ce(u);else{if(l.scrollHeight<=l.clientHeight&&l.scrollWidth<=l.clientWidth){l=l.assignedSlot||l.parentNode;continue}var d=l.getBoundingClientRect();c={left:d.left,right:d.left+l.clientWidth,top:d.top,bottom:d.top+l.clientHeight}}var v=0,g=0;if("nearest"==r)e.top<c.top?(g=-(c.top-e.top+s),n>0&&e.bottom>c.bottom+g&&(g=e.bottom-c.bottom+g+s)):e.bottom>c.bottom&&(g=e.bottom-c.bottom+s,n<0&&e.top-g<c.top&&(g=-(c.top+g-e.top+s)));else{var p=e.bottom-e.top,m=c.bottom-c.top;g=("center"==r&&p<=m?e.top+p/2-m/2:"start"==r||"center"==r&&n<0?e.top-s:e.bottom-m+s)-c.top}if("nearest"==i?e.left<c.left?(v=-(c.left-e.left+o),n>0&&e.right>c.right+v&&(v=e.right-c.right+v+o)):e.right>c.right&&(v=e.right-c.right+o,n<0&&e.left<c.left+v&&(v=-(c.left+v-e.left+o))):v=("center"==i?e.left+(e.right-e.left)/2-(c.right-c.left)/2:"start"==i==a?e.left-o:e.right-(c.right-c.left)+o)-c.left,v||g)if(f)u.scrollBy(v,g);else{var y=0,k=0;if(g){var w=l.scrollTop;l.scrollTop+=g,k=l.scrollTop-w}if(v){var b=l.scrollLeft;l.scrollLeft+=v,y=l.scrollLeft-b}e={left:e.left-y,top:e.top-k,right:e.right-y,bottom:e.bottom-k},y&&Math.abs(y-v)<1&&(i="nearest"),k&&Math.abs(k-g)<1&&(r="nearest")}if(f)break;l=l.assignedSlot||l.parentNode}else{if(11!=l.nodeType)break;l=l.host}}(this.view.scrollDOM,o,n.head<n.anchor?-1:1,t.x,t.y,t.xMargin,t.yMargin,this.view.textDirection==Wn.LTR)}}}]),e}(be);var fi=function(t){function e(t){var n;return(0,h.Z)(this,e),(n=(0,r.Z)(this,e)).height=t,n}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"toDOM",value:function(){var t=document.createElement("div");return this.updateDOM(t),t}},{key:"eq",value:function(t){return t.height==this.height}},{key:"updateDOM",value:function(t){return t.style.height=this.height+"px",!0}},{key:"estimatedHeight",get:function(){return this.height}}]),e}(tn);function di(t){var e=t.observer.selectionRange,n=e.focusNode&&gi(e.focusNode,e.focusOffset,0);if(!n)return null;var i=t.docView.nearest(n);if(!i)return null;if(i instanceof un){for(var r=n;r.parentNode!=i.dom;)r=r.parentNode;for(var o=r.previousSibling;o&&!be.get(o);)o=o.previousSibling;var s=o?be.get(o).posAtEnd:i.posAtStart;return{from:s,to:s,node:r,text:n}}for(;;){var a=i.parent;if(!a)return null;if(a instanceof un)break;i=a}var h=i.posAtStart;return{from:h,to:h+i.length,node:i.dom,text:n}}var vi=function(t){function e(t,n,i){var o;return(0,h.Z)(this,e),(o=(0,r.Z)(this,e)).top=t,o.text=n,o.topView=i,o}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"eq",value:function(t){return this.top==t.top&&this.text==t.text}},{key:"toDOM",value:function(){return this.top}},{key:"ignoreEvent",value:function(){return!1}},{key:"customView",get:function(){return ze}}]),e}(tn);function gi(t,e,n){if(n<=0)for(var i=t,r=e;;){if(3==i.nodeType)return i;if(!(1==i.nodeType&&r>0))break;r=ue(i=i.childNodes[r-1])}if(n>=0)for(var o=t,s=e;;){if(3==o.nodeType)return o;if(!(1==o.nodeType&&s<o.childNodes.length&&n>=0))break;o=o.childNodes[s],s=0}return null}var pi=function(){function t(){(0,h.Z)(this,t),this.changes=[]}return(0,u.Z)(t,[{key:"compareRange",value:function(t,e){hn(t,e,this.changes)}},{key:"comparePoint",value:function(t,e){hn(t,e,this.changes)}}]),t}();function mi(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function yi(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function ki(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function wi(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function bi(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function xi(t,e,n){for(var i,r,o,s,a,h,u,l,c=!1,f=t.firstChild;f;f=f.nextSibling)for(var d=oe(f),v=0;v<d.length;v++){var g=d[v];r&&ki(r,g)&&(g=wi(bi(g,r.bottom),r.top));var p=mi(e,g),m=yi(n,g);if(0==p&&0==m)return 3==f.nodeType?Si(f,e,n):xi(f,e,n);if(!i||s>m||s==m&&o>p){i=f,r=g,o=p,s=m;var y=m?n<g.top?-1:1:p?e<g.left?-1:1:0;c=!y||(y>0?v<d.length-1:v>0)}0==p?n>g.bottom&&(!u||u.bottom<g.bottom)?(a=f,u=g):n<g.top&&(!l||l.top>g.top)&&(h=f,l=g):u&&ki(u,g)?u=bi(u,g.bottom):l&&ki(l,g)&&(l=wi(l,g.top))}if(u&&u.bottom>=n?(i=a,r=u):l&&l.top<=n&&(i=h,r=l),!i)return{node:t,offset:0};var k=Math.max(r.left,Math.min(r.right,e));return 3==i.nodeType?Si(i,k,n):c&&"false"!=i.contentEditable?xi(i,k,n):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,i)+(e>=(r.left+r.right)/2?1:0)}}function Si(t,e,n){for(var i=t.nodeValue.length,r=-1,o=1e9,s=0,a=0;a<i;a++)for(var h=pe(t,a,a+1).getClientRects(),u=0;u<h.length;u++){var l=h[u];if(l.top!=l.bottom){s||(s=e-l.left);var c=(l.top>n?l.top-n:n-l.bottom)-1;if(l.left-1<=e&&l.right+1>=e&&c<o){var f=e>=(l.left+l.right)/2,d=f;if(Le.chrome||Le.gecko)pe(t,a).getBoundingClientRect().left==l.right&&(d=!f);if(c<=0)return{node:t,offset:a+(d?1:0)};r=a+(d?1:0),o=c}}}return{node:t,offset:r>-1?r:s>0?t.nodeValue.length:0}}function Ai(t,e,n){var i,r,o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=t.contentDOM.getBoundingClientRect(),h=a.top+t.viewState.paddingTop,u=t.viewState.docHeight,l=e.x,c=e.y,f=c-h;if(f<0)return 0;if(f>u)return t.state.doc.length;for(var d=t.viewState.heightOracle.textHeight/2,v=!1;(o=t.elementAtHeight(f)).type!=en.Text;)for(;!((f=s>0?o.bottom+d:o.top-d)>=0&&f<=u);){if(v)return n?null:0;v=!0,s=-s}c=h+f;var g=o.from;if(g<t.viewport.from)return 0==t.viewport.from?0:n?null:Mi(t,a,o,l,c);if(g>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:Mi(t,a,o,l,c);var p=t.dom.ownerDocument,m=t.root.elementFromPoint?t.root:p,y=m.elementFromPoint(l,c);y&&!t.contentDOM.contains(y)&&(y=null),y||(l=Math.max(a.left+1,Math.min(a.right-1,l)),(y=m.elementFromPoint(l,c))&&!t.contentDOM.contains(y)&&(y=null));var k,w=-1;if(y&&0!=(null===(i=t.docView.nearest(y))||void 0===i?void 0:i.isEditable))if(p.caretPositionFromPoint){var b=p.caretPositionFromPoint(l,c);b&&(k=b.offsetNode,w=b.offset)}else if(p.caretRangeFromPoint){var x=p.caretRangeFromPoint(l,c);x&&(k=x.startContainer,w=x.startOffset,(!t.contentDOM.contains(k)||Le.safari&&function(t,e,n){var i;if(3!=t.nodeType||e!=(i=t.nodeValue.length))return!1;for(var r=t.nextSibling;r;r=r.nextSibling)if(1!=r.nodeType||"BR"!=r.nodeName)return!1;return pe(t,i-1,i).getBoundingClientRect().left>n}(k,w,l)||Le.chrome&&function(t,e,n){if(0!=e)return!1;for(var i=t;;){var r=i.parentNode;if(!r||1!=r.nodeType||r.firstChild!=i)return!1;if(r.classList.contains("cm-line"))break;i=r}var o=1==t.nodeType?t.getBoundingClientRect():pe(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-o.left>5}(k,w,l))&&(k=void 0))}if(!k||!t.docView.dom.contains(k)){var S=un.find(t.docView,g);if(!S)return f>o.top+o.height/2?o.to:o.from;var A=xi(S.dom,l,c);k=A.node,w=A.offset}var M=t.docView.nearest(k);if(!M)return null;if(M.isWidget&&1==(null===(r=M.dom)||void 0===r?void 0:r.nodeType)){var Z=M.dom.getBoundingClientRect();return e.y<Z.top||e.y<=Z.bottom&&e.x<=(Z.left+Z.right)/2?M.posAtStart:M.posAtEnd}return M.localPosFromDOM(k,w)+M.posAtStart}function Mi(t,e,n,i,r){var o=Math.round((i-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>1.5*t.defaultLineHeight){var s=t.viewState.heightOracle.textHeight;o+=Math.floor((r-n.top-.5*(t.defaultLineHeight-s))/s)*t.viewState.heightOracle.lineLength}var a=t.state.sliceDoc(n.from,n.to);return n.from+function(t,e,n,i){for(var r=0,o=0;;){if(o>=e)return r;if(r==t.length)break;o+=9==t.charCodeAt(r)?n-o%n:1,r=C(t,r)}return!0===i?-1:t.length}(a,o,t.state.tabSize)}function Zi(t,e){var n=t.lineBlockAt(e);if(Array.isArray(n.type)){var i,r=(0,s.Z)(n.type);try{for(r.s();!(i=r.n()).done;){var o=i.value;if(o.to>e||o.to==e&&(o.to==n.to||o.type==en.Text))return o}}catch(a){r.e(a)}finally{r.f()}}return n}function Ci(t,e,n,i){for(var r=t.state.doc.lineAt(e.head),o=t.bidiSpans(r),s=t.textDirectionAt(r.from),a=e,h=null;;){var u=si(r,o,s,a,n),l=oi;if(!u){if(r.number==(n?t.state.doc.lines:1))return a;l="\n",r=t.state.doc.line(r.number+(n?1:-1)),o=t.bidiSpans(r),u=K.cursor(n?r.from:r.to)}if(h){if(!h(l))return a}else{if(!i)return u;h=i(l)}a=u}}function Oi(t,e,n){for(var i,r=function(){var i,r=0,o=(0,s.Z)(t);try{for(o.s();!(i=o.n()).done;){i.value.between(e-1,e+1,(function(t,i,o){if(e>t&&e<i){var s=r||n||(e-t<i-e?-1:1);e=s<0?t:i,r=s}}))}}catch(a){o.e(a)}finally{o.f()}if(!r)return{v:e}};;)if(i=r())return i.v}function Ti(t,e,n){var i=Oi(t.state.facet(In).map((function(e){return e(t)})),n.from,e.head>n.from?-1:1);return i==n.from?n:K.cursor(i,i<n.from?1:-1)}var Di=function(){function t(e){var n=this;(0,h.Z)(this,t),this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;var i=function(t,i){n.ignoreDuringComposition(i)||"keydown"==i.type&&n.keydown(e,i)||(n.mustFlushObserver(i)&&e.observer.forceFlush(),n.runCustomHandlers(i.type,e,i)?i.preventDefault():t(e,i))},r=function(){var t=Li[o];e.contentDOM.addEventListener(o,(function(n){Ni(e,n)&&i(t,n)}),Vi[o]),n.registeredEvents.push(o)};for(var o in Li)r();e.scrollDOM.addEventListener("mousedown",(function(t){if(t.target==e.scrollDOM&&t.clientY>e.contentDOM.getBoundingClientRect().bottom&&(i(Li.mousedown,t),!t.defaultPrevented&&2==t.button)){var n=e.contentDOM.style.minHeight;e.contentDOM.style.minHeight="100%",setTimeout((function(){return e.contentDOM.style.minHeight=n}),200)}})),e.scrollDOM.addEventListener("drop",(function(t){t.target==e.scrollDOM&&t.clientY>e.contentDOM.getBoundingClientRect().bottom&&i(Li.drop,t)})),Le.chrome&&102==Le.chrome_version&&e.scrollDOM.addEventListener("wheel",(function(){n.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(n.chromeScrollHack),n.chromeScrollHack=setTimeout((function(){n.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""}),100)}),{passive:!0}),this.notifiedFocused=e.hasFocus,Le.safari&&e.contentDOM.addEventListener("input",(function(){return null}))}return(0,u.Z)(t,[{key:"setSelectionOrigin",value:function(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}},{key:"ensureHandlers",value:function(t,e){var n,i,r=this;this.customHandlers=[];var o,a=(0,s.Z)(e);try{for(a.s();!(o=a.n()).done;){var h=o.value;if(i=null===(n=h.update(t).spec)||void 0===n?void 0:n.domEventHandlers){this.customHandlers.push({plugin:h.value,handlers:i});var u=function(e){r.registeredEvents.indexOf(e)<0&&"scroll"!=e&&(r.registeredEvents.push(e),t.contentDOM.addEventListener(e,(function(n){Ni(t,n)&&r.runCustomHandlers(e,t,n)&&n.preventDefault()})))};for(var l in i)u(l)}}}catch(c){a.e(c)}finally{a.f()}}},{key:"runCustomHandlers",value:function(t,e,n){var i,r=(0,s.Z)(this.customHandlers);try{for(r.s();!(i=r.n()).done;){var o=i.value,a=o.handlers[t];if(a)try{if(a.call(o.plugin,n,e)||n.defaultPrevented)return!0}catch(h){Mn(e.state,h)}}}catch(u){r.e(u)}finally{r.f()}return!1}},{key:"runScrollHandlers",value:function(t,e){this.lastScrollTop=t.scrollDOM.scrollTop,this.lastScrollLeft=t.scrollDOM.scrollLeft;var n,i=(0,s.Z)(this.customHandlers);try{for(i.s();!(n=i.n()).done;){var r=n.value,o=r.handlers.scroll;if(o)try{o.call(r.plugin,e,t)}catch(a){Mn(t.state,a)}}}catch(h){i.e(h)}finally{i.f()}}},{key:"keydown",value:function(t,e){var n,i=this;return this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&Date.now()<this.lastEscPress+2e3||(27!=e.keyCode&&Ri.indexOf(e.keyCode)<0&&(t.inputState.lastEscPress=0),!Le.android||!Le.chrome||e.synthetic||13!=e.keyCode&&8!=e.keyCode?!(!Le.ios||e.synthetic||e.altKey||e.metaKey||!((n=Ei.find((function(t){return t.keyCode==e.keyCode})))&&!e.ctrlKey||Bi.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey))&&(this.pendingIOSKey=n||e,setTimeout((function(){return i.flushIOSKey(t)}),250),!0):(t.observer.delayAndroidKey(e.key,e.keyCode),!0))}},{key:"flushIOSKey",value:function(t){var e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,me(t.contentDOM,e.key,e.keyCode))}},{key:"ignoreDuringComposition",value:function(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Le.safari&&!Le.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}},{key:"mustFlushObserver",value:function(t){return"keydown"==t.type&&229!=t.keyCode}},{key:"startMouseSelection",value:function(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}},{key:"update",value:function(t){this.mouseSelection&&this.mouseSelection.update(t),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}},{key:"destroy",value:function(){this.mouseSelection&&this.mouseSelection.destroy()}}]),t}(),Ei=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Bi="dthko",Ri=[16,17,18,20,91,92,224,225];function Ii(t){return.7*Math.max(0,t)+8}var Pi=function(){function t(e,n,i,r){(0,h.Z)(this,t),this.view=e,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParent=function(t){for(var e=t.ownerDocument,n=t.parentNode;n&&n!=e.body;)if(1==n.nodeType){if(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else{if(11!=n.nodeType)break;n=n.host}return null}(e.contentDOM),this.atoms=e.state.facet(In).map((function(t){return t(e)}));var o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Nt.allowMultipleSelections)&&function(t,e){var n=t.state.facet(vn);return n.length?n[0](e):Le.mac?e.metaKey:e.ctrlKey}(e,n),this.dragging=!(!function(t,e){var n=t.state.selection.main;if(n.empty)return!1;var i=ne(t.root);if(!i||0==i.rangeCount)return!0;for(var r=i.getRangeAt(0).getClientRects(),o=0;o<r.length;o++){var s=r[o];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}(e,n)||1!=$i(n))&&null}return(0,u.Z)(t,[{key:"start",value:function(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}},{key:"move",value:function(t){var e;if(0==t.buttons)return this.destroy();if(!1===this.dragging){this.select(this.lastEvent=t);var n=0,i=0,r=(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},o=Nn(this.view);t.clientX-o.left<=r.left+6?n=-Ii(r.left-t.clientX):t.clientX+o.right>=r.right-6&&(n=Ii(t.clientX-r.right)),t.clientY-o.top<=r.top+6?i=-Ii(r.top-t.clientY):t.clientY+o.bottom>=r.bottom-6&&(i=Ii(t.clientY-r.bottom)),this.setScrollSpeed(n,i)}}},{key:"up",value:function(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}},{key:"destroy",value:function(){this.setScrollSpeed(0,0);var t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}},{key:"setScrollSpeed",value:function(t,e){var n=this;this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval((function(){return n.scroll()}),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}},{key:"scroll",value:function(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}},{key:"skipAtoms",value:function(t){for(var e=null,n=0;n<t.ranges.length;n++){var i=t.ranges[n],r=null;if(i.empty){var o=Oi(this.atoms,i.from,0);o!=i.from&&(r=K.cursor(o,-1))}else{var s=Oi(this.atoms,i.from,-1),a=Oi(this.atoms,i.to,1);s==i.from&&a==i.to||(r=K.range(i.from==i.anchor?s:a,i.from==i.head?s:a))}r&&(e||(e=t.ranges.slice()),e[n]=r)}return e?K.create(e,t.mainIndex):t}},{key:"select",value:function(t){var e=this.view,n=this.skipAtoms(this.style.get(t,this.extend,this.multiple));!this.mustSelect&&n.eq(e.state.selection)&&n.main.assoc==e.state.selection.main.assoc||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}},{key:"update",value:function(t){var e=this;t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((function(){return e.select(e.lastEvent)}),20)}}]),t}();function Ni(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var n,i=e.target;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=be.get(i))&&n.ignoreEvent(e))return!1;return!0}var Li=Object.create(null),Vi=Object.create(null),Hi=Le.ie&&Le.ie_version<15||Le.ios&&Le.webkit_version<604;function Wi(t,e){var n,i=t.state,r=1,o=i.toText(e),s=o.lines==i.selection.ranges.length,a=null!=Yi&&i.selection.ranges.every((function(t){return t.empty}))&&Yi==o.toString();if(a){var h=-1;n=i.changeByRange((function(t){var n=i.doc.lineAt(t.from);if(n.from==h)return{range:t};h=n.from;var a=i.toText((s?o.line(r++).text:e)+i.lineBreak);return{changes:{from:n.from,insert:a},range:K.cursor(t.from+a.length)}}))}else n=s?i.changeByRange((function(t){var e=o.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:K.cursor(t.from+e.length)}})):i.replaceSelection(o);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function _i(t,e,n,i){if(1==i)return K.cursor(e,n);if(2==i)return function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=t.charCategorizer(e),r=t.doc.lineAt(e),o=e-r.from;if(0==r.length)return K.cursor(e);0==o?n=1:o==r.length&&(n=-1);var s=o,a=o;n<0?s=C(r.text,o,!1):a=C(r.text,o);for(var h=i(r.text.slice(s,a));s>0;){var u=C(r.text,s,!1);if(i(r.text.slice(u,s))!=h)break;s=u}for(;a<r.length;){var l=C(r.text,a);if(i(r.text.slice(a,l))!=h)break;a=l}return K.range(s+r.from,a+r.from)}(t.state,e,n);var r=un.find(t.docView,e),o=t.state.doc.lineAt(r?r.posAtEnd:e),s=r?r.posAtStart:o.from,a=r?r.posAtEnd:o.to;return a<t.state.doc.length&&a==o.to&&a++,K.range(s,a)}Li.keydown=function(t,e){t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},Li.touchstart=function(t,e){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},Li.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer")},Vi.touchstart=Vi.touchmove={passive:!0},Li.mousedown=function(t,e){if(t.observer.flush(),!(t.inputState.lastTouchTime>Date.now()-2e3)){var n,i=null,r=(0,s.Z)(t.state.facet(pn));try{for(r.s();!(n=r.n()).done;){if(i=(0,n.value)(t,e))break}}catch(a){r.e(a)}finally{r.f()}if(i||0!=e.button||(i=function(t,e){var n=ji(t,e),i=$i(e),r=t.state.selection;return{update:function(t){t.docChanged&&(n.pos=t.changes.mapPos(n.pos),r=r.map(t.changes))},get:function(e,o,s){var a,h=ji(t,e),u=_i(t,h.pos,h.bias,i);if(n.pos!=h.pos&&!o){var l=_i(t,n.pos,n.bias,i),c=Math.min(l.from,u.from),f=Math.max(l.to,u.to);u=c<u.from?K.range(c,f):K.range(f,c)}return o?r.replaceRange(r.main.extend(u.from,u.to)):s&&1==i&&r.ranges.length>1&&(a=function(t,e){for(var n=0;n<t.ranges.length;n++){var i=t.ranges[n],r=i.from,o=i.to;if(r<=e&&o>=e)return K.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}(r,h.pos))?a:s?r.addRange(u):K.create([u])}}}(t,e)),i){var o=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new Pi(t,e,i,o)),o&&t.observer.ignore((function(){return ge(t.contentDOM)})),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}}};var zi=function(t,e){return t>=e.top&&t<=e.bottom},Fi=function(t,e,n){return zi(e,n)&&t>=n.left&&t<=n.right};function qi(t,e,n,i){var r=un.find(t.docView,e);if(!r)return 1;var o=e-r.posAtStart;if(0==o)return 1;if(o==r.length)return-1;var s=r.coordsAt(o,-1);if(s&&Fi(n,i,s))return-1;var a=r.coordsAt(o,1);return a&&Fi(n,i,a)?1:s&&zi(i,s)?-1:1}function ji(t,e){var n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:qi(t,n,e.clientX,e.clientY)}}var Ki=Le.ie&&Le.ie_version<=11,Ji=null,Ui=0,Gi=0;function $i(t){if(!Ki)return t.detail;var e=Ji,n=Gi;return Ji=t,Gi=Date.now(),Ui=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Ui+1)%3:1}function Xi(t,e,n,i){if(n){var r=t.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();var o=t.inputState.mouseSelection,s=i&&o&&o.dragging&&function(t,e){var n=t.state.facet(gn);return n.length?n[0](e):Le.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:o.dragging.from,to:o.dragging.to}:null,a={from:r,insert:n},h=t.state.changes(s?[s,a]:a);t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(r,-1),head:h.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"})}}Li.dragstart=function(t,e){var n=t.state.selection.main,i=t.inputState.mouseSelection;i&&(i.dragging=n),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(n.from,n.to)),e.dataTransfer.effectAllowed="copyMove")},Li.drop=function(t,e){if(e.dataTransfer){if(t.state.readOnly)return e.preventDefault();var n=e.dataTransfer.files;if(n&&n.length){e.preventDefault();for(var i=Array(n.length),r=0,o=function(){++r==n.length&&Xi(t,e,i.filter((function(t){return null!=t})).join(t.state.lineBreak),!1)},s=function(t){var e=new FileReader;e.onerror=o,e.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(i[t]=e.result),o()},e.readAsText(n[t])},a=0;a<n.length;a++)s(a)}else Xi(t,e,e.dataTransfer.getData("Text"),!0)}},Li.paste=function(t,e){if(t.state.readOnly)return e.preventDefault();t.observer.flush();var n=Hi?null:e.clipboardData;n?(Wi(t,n.getData("text/plain")||n.getData("text/uri-text")),e.preventDefault()):function(t){var e=t.dom.parentNode;if(e){var n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((function(){t.focus(),n.remove(),Wi(t,n.value)}),50)}}(t)};var Yi=null;Li.copy=Li.cut=function(t,e){var n=function(t){var e,n=[],i=[],r=!1,o=(0,s.Z)(t.selection.ranges);try{for(o.s();!(e=o.n()).done;){var a=e.value;a.empty||(n.push(t.sliceDoc(a.from,a.to)),i.push(a))}}catch(d){o.e(d)}finally{o.f()}if(!n.length){var h,u=-1,l=(0,s.Z)(t.selection.ranges);try{for(l.s();!(h=l.n()).done;){var c=h.value.from,f=t.doc.lineAt(c);f.number>u&&(n.push(f.text),i.push({from:f.from,to:Math.min(t.doc.length,f.to+1)})),u=f.number}}catch(d){l.e(d)}finally{l.f()}r=!0}return{text:n.join(t.lineBreak),ranges:i,linewise:r}}(t.state),i=n.text,r=n.ranges,o=n.linewise;if(i||o){Yi=o?i:null;var a=Hi?null:e.clipboardData;a?(e.preventDefault(),a.clearData(),a.setData("text/plain",i)):function(t,e){var n=t.dom.parentNode;if(n){var i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout((function(){i.remove(),t.focus()}),50)}}(t,i),"cut"!=e.type||t.state.readOnly||t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"})}};var Qi=bt.define();function tr(t,e){var n,i=[],r=(0,s.Z)(t.facet(wn));try{for(r.s();!(n=r.n()).done;){var o=(0,n.value)(t,e);o&&i.push(o)}}catch(a){r.e(a)}finally{r.f()}return i?t.update({effects:i,annotations:Qi.of(!0)}):null}function er(t){setTimeout((function(){var e=t.hasFocus;if(e!=t.inputState.notifiedFocused){var n=tr(t.state,e);n?t.dispatch(n):t.update([])}}),10)}Li.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),er(t)},Li.blur=function(t){t.observer.clearSelectionRange(),er(t)},Li.compositionstart=Li.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Li.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,Le.chrome&&Le.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((function(){return t.observer.flush()})):setTimeout((function(){t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},Li.contextmenu=function(t){t.inputState.lastContextMenu=Date.now()},Li.beforeinput=function(t,e){var n,i;if(Le.chrome&&Le.android&&(i=Ei.find((function(t){return t.inputType==e.inputType})))&&(t.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){var r=(null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0;setTimeout((function(){var e;((null===(e=window.visualViewport)||void 0===e?void 0:e.height)||0)>r+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)}};var nr=["pre-wrap","normal","pre-line","break-spaces"],ir=function(){function t(e){(0,h.Z)(this,t),this.lineWrapping=e,this.doc=d.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}return(0,u.Z)(t,[{key:"heightForGap",value:function(t,e){var n=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((e-t-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}},{key:"heightForLine",value:function(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}},{key:"setDoc",value:function(t){return this.doc=t,this}},{key:"mustRefreshForWrapping",value:function(t){return nr.indexOf(t)>-1!=this.lineWrapping}},{key:"mustRefreshForHeights",value:function(t){for(var e=!1,n=0;n<t.length;n++){var i=t[n];i<0?n++:this.heightSamples[Math.floor(10*i)]||(e=!0,this.heightSamples[Math.floor(10*i)]=!0)}return e}},{key:"refresh",value:function(t,e,n,i,r,o){var s=nr.indexOf(t)>-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=e,this.charWidth=n,this.textHeight=i,this.lineLength=r,a){this.heightSamples={};for(var h=0;h<o.length;h++){var u=o[h];u<0?h++:this.heightSamples[Math.floor(10*u)]=!0}}return a}}]),t}(),rr=function(){function t(e,n){(0,h.Z)(this,t),this.from=e,this.heights=n,this.index=0}return(0,u.Z)(t,[{key:"more",get:function(){return this.index<this.heights.length}}]),t}(),or=function(){function t(e,n,i,r,o){(0,h.Z)(this,t),this.from=e,this.length=n,this.top=i,this.height=r,this._content=o}return(0,u.Z)(t,[{key:"type",get:function(){return"number"==typeof this._content?en.Text:Array.isArray(this._content)?this._content:this._content.type}},{key:"to",get:function(){return this.from+this.length}},{key:"bottom",get:function(){return this.top+this.height}},{key:"widget",get:function(){return this._content instanceof sn?this._content.widget:null}},{key:"widgetLineBreaks",get:function(){return"number"==typeof this._content?this._content:0}},{key:"join",value:function(e){var n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new t(this.from,this.length+e.length,this.top,this.height+e.height,n)}}]),t}(),sr=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(sr||(sr={})),ar=.001,hr=function(){function t(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;(0,h.Z)(this,t),this.length=e,this.height=n,this.flags=i}return(0,u.Z)(t,[{key:"outdated",get:function(){return(2&this.flags)>0},set:function(t){this.flags=(t?2:0)|-3&this.flags}},{key:"setHeight",value:function(t,e){this.height!=e&&(Math.abs(this.height-e)>ar&&(t.heightChanged=!0),this.height=e)}},{key:"replace",value:function(e,n,i){return t.of(i)}},{key:"decomposeLeft",value:function(t,e){e.push(this)}},{key:"decomposeRight",value:function(t,e){e.push(this)}},{key:"applyChanges",value:function(t,e,n,i){for(var r=this,o=n.doc,s=i.length-1;s>=0;s--){var a=i[s],h=a.fromA,u=a.toA,l=a.fromB,c=a.toB,f=r.lineAt(h,sr.ByPosNoHeight,n.setDoc(e),0,0),d=f.to>=u?f:r.lineAt(u,sr.ByPosNoHeight,n,0,0);for(c+=d.to-u,u=d.to;s>0&&f.from<=i[s-1].toA;)h=i[s-1].fromA,l=i[s-1].fromB,s--,h<f.from&&(f=r.lineAt(h,sr.ByPosNoHeight,n,0,0));l+=f.from-h,h=f.from;var v=vr.build(n.setDoc(o),t,l,c);r=r.replace(h,u,v)}return r.updateHeight(n,0)}}],[{key:"empty",value:function(){return new lr(0,0)}},{key:"of",value:function(e){if(1==e.length)return e[0];for(var n=0,i=e.length,r=0,o=0;;)if(n==i)if(r>2*o){var s=e[n-1];s.break?e.splice(--n,1,s.left,null,s.right):e.splice(--n,1,s.left,s.right),i+=1+s.break,r-=s.size}else{if(!(o>2*r))break;var a=e[i];a.break?e.splice(i,1,a.left,null,a.right):e.splice(i,1,a.left,a.right),i+=2+a.break,o-=a.size}else if(r<o){var h=e[n++];h&&(r+=h.size)}else{var u=e[--i];u&&(o+=u.size)}var l=0;return null==e[n-1]?(l=1,n--):null==e[n]&&(l=1,i++),new fr(t.of(e.slice(0,n)),l,t.of(e.slice(i)))}}]),t}();hr.prototype.size=1;var ur=function(t){function e(t,n,i){var o;return(0,h.Z)(this,e),(o=(0,r.Z)(this,e,[t,n])).deco=i,o}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"blockAt",value:function(t,e,n,i){return new or(i,this.length,n,this.height,this.deco||0)}},{key:"lineAt",value:function(t,e,n,i,r){return this.blockAt(0,n,i,r)}},{key:"forEachLine",value:function(t,e,n,i,r,o){t<=r+this.length&&e>=r&&o(this.blockAt(0,n,i,r))}},{key:"updateHeight",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>3?arguments[3]:void 0;return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}},{key:"toString",value:function(){return"block(".concat(this.length,")")}}]),e}(hr),lr=function(t){function e(t,n){var i;return(0,h.Z)(this,e),(i=(0,r.Z)(this,e,[t,n,null])).collapsed=0,i.widgetHeight=0,i.breaks=0,i}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"blockAt",value:function(t,e,n,i){return new or(i,this.length,n,this.height,this.breaks)}},{key:"replace",value:function(t,n,i){var r=i[0];return 1==i.length&&(r instanceof e||r instanceof cr&&4&r.flags)&&Math.abs(this.length-r.length)<10?(r instanceof cr?r=new e(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):hr.of(i)}},{key:"updateHeight",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;return i&&i.from<=e&&i.more?this.setHeight(t,i.heights[i.index++]):(n||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(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}]),e}(ur),cr=function(t){function e(t){return(0,h.Z)(this,e),(0,r.Z)(this,e,[t,0])}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"heightMetrics",value:function(t,e){var n,i=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,o=r-i+1,s=0;if(t.lineWrapping){var a=Math.min(this.height,t.lineHeight*o);n=a/o,this.length>o+1&&(s=(this.height-a)/(this.length-o-1))}else n=this.height/o;return{firstLine:i,lastLine:r,perLine:n,perChar:s}}},{key:"blockAt",value:function(t,e,n,i){var r=this.heightMetrics(e,i),o=r.firstLine,s=r.lastLine,a=r.perLine,h=r.perChar;if(e.lineWrapping){var u=i+Math.round(Math.max(0,Math.min(1,(t-n)/this.height))*this.length),l=e.doc.lineAt(u),c=a+l.length*h,f=Math.max(n,t-c/2);return new or(l.from,l.length,f,c,0)}var d=Math.max(0,Math.min(s-o,Math.floor((t-n)/a))),v=e.doc.line(o+d),g=v.from,p=v.length;return new or(g,p,n+a*d,a,0)}},{key:"lineAt",value:function(t,e,n,i,r){if(e==sr.ByHeight)return this.blockAt(t,n,i,r);if(e==sr.ByPosNoHeight){var o=n.doc.lineAt(t),s=o.from,a=o.to;return new or(s,a-s,0,0,0)}var h=this.heightMetrics(n,r),u=h.firstLine,l=h.perLine,c=h.perChar,f=n.doc.lineAt(t),d=l+f.length*c,v=f.number-u,g=i+l*v+c*(f.from-r-v);return new or(f.from,f.length,Math.max(i,Math.min(g,i+this.height-d)),d,0)}},{key:"forEachLine",value:function(t,e,n,i,r,o){t=Math.max(t,r),e=Math.min(e,r+this.length);for(var s=this.heightMetrics(n,r),a=s.firstLine,h=s.perLine,u=s.perChar,l=t,c=i;l<=e;){var f=n.doc.lineAt(l);if(l==t){var d=f.number-a;c+=h*d+u*(t-r-d)}var v=h+u*f.length;o(new or(f.from,f.length,c,v,0)),c+=v,l=f.to+1}}},{key:"replace",value:function(t,n,i){var r=this.length-n;if(r>0){var o=i[i.length-1];o instanceof e?i[i.length-1]=new e(o.length+r):i.push(null,new e(r-1))}if(t>0){var s=i[0];s instanceof e?i[0]=new e(t+s.length):i.unshift(new e(t-1),null)}return hr.of(i)}},{key:"decomposeLeft",value:function(t,n){n.push(new e(t-1),null)}},{key:"decomposeRight",value:function(t,n){n.push(null,new e(this.length-t-1))}},{key:"updateHeight",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,o=n+this.length;if(r&&r.from<=n+this.length&&r.more){var s=[],a=Math.max(n,r.from),h=-1;for(r.from>n&&s.push(new e(r.from-n-1).updateHeight(t,n));a<=o&&r.more;){var u=t.doc.lineAt(a).length;s.length&&s.push(null);var l=r.heights[r.index++];-1==h?h=l:Math.abs(l-h)>=ar&&(h=-2);var c=new lr(u,l);c.outdated=!1,s.push(c),a+=u+1}a<=o&&s.push(null,new e(o-a).updateHeight(t,a));var f=hr.of(s);return(h<0||Math.abs(f.height-this.height)>=ar||Math.abs(h-this.heightMetrics(t,n).perLine)>=ar)&&(t.heightChanged=!0),f}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(n,n+this.length)),this.outdated=!1),this}},{key:"toString",value:function(){return"gap(".concat(this.length,")")}}]),e}(hr),fr=function(t){function e(t,n,i){var o;return(0,h.Z)(this,e),(o=(0,r.Z)(this,e,[t.length+n+i.length,t.height+i.height,n|(t.outdated||i.outdated?2:0)])).left=t,o.right=i,o.size=t.size+i.size,o}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"break",get:function(){return 1&this.flags}},{key:"blockAt",value:function(t,e,n,i){var r=n+this.left.height;return t<r?this.left.blockAt(t,e,n,i):this.right.blockAt(t,e,r,i+this.left.length+this.break)}},{key:"lineAt",value:function(t,e,n,i,r){var o=i+this.left.height,s=r+this.left.length+this.break,a=e==sr.ByHeight?t<o:t<s,h=a?this.left.lineAt(t,e,n,i,r):this.right.lineAt(t,e,n,o,s);if(this.break||(a?h.to<s:h.from>s))return h;var u=e==sr.ByPosNoHeight?sr.ByPosNoHeight:sr.ByPos;return a?h.join(this.right.lineAt(s,u,n,o,s)):this.left.lineAt(s,u,n,i,r).join(h)}},{key:"forEachLine",value:function(t,e,n,i,r,o){var s=i+this.left.height,a=r+this.left.length+this.break;if(this.break)t<a&&this.left.forEachLine(t,e,n,i,r,o),e>=a&&this.right.forEachLine(t,e,n,s,a,o);else{var h=this.lineAt(a,sr.ByPos,n,i,r);t<h.from&&this.left.forEachLine(t,h.from-1,n,i,r,o),h.to>=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,n,s,a,o)}}},{key:"replace",value:function(t,e,n){var i=this.left.length+this.break;if(e<i)return this.balanced(this.left.replace(t,e,n),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-i,e-i,n));var r=[];t>0&&this.decomposeLeft(t,r);var o,a=r.length,h=(0,s.Z)(n);try{for(h.s();!(o=h.n()).done;){var u=o.value;r.push(u)}}catch(c){h.e(c)}finally{h.f()}if(t>0&&dr(r,a-1),e<this.length){var l=r.length;this.decomposeRight(e,r),dr(r,l)}return hr.of(r)}},{key:"decomposeLeft",value:function(t,e){var n=this.left.length;if(t<=n)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&t>=++n&&e.push(null),t>n&&this.right.decomposeLeft(t-n,e)}},{key:"decomposeRight",value:function(t,e){var n=this.left.length,i=n+this.break;if(t>=i)return this.right.decomposeRight(t-i,e);t<n&&this.left.decomposeRight(t,e),this.break&&t<i&&e.push(null),e.push(this.right)}},{key:"balanced",value:function(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(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0,r=this.left,o=this.right,s=e+r.length+this.break,a=null;return i&&i.from<=e+r.length&&i.more?a=r=r.updateHeight(t,e,n,i):r.updateHeight(t,e,n),i&&i.from<=s+o.length&&i.more?a=o=o.updateHeight(t,s,n,i):o.updateHeight(t,s,n),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}},{key:"toString",value:function(){return this.left+(this.break?" ":"-")+this.right}}]),e}(hr);function dr(t,e){var n,i;null==t[e]&&(n=t[e-1])instanceof cr&&(i=t[e+1])instanceof cr&&t.splice(e-1,3,new cr(n.length+1+i.length))}var vr=function(){function t(e,n){(0,h.Z)(this,t),this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}return(0,u.Z)(t,[{key:"isCovered",get:function(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}},{key:"span",value:function(t,e){if(this.lineStart>-1){var n=Math.min(e,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof lr?i.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new lr(n-this.pos,-1)),this.writtenTo=n,e>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}},{key:"point",value:function(t,e,n){if(t<e||n.heightRelevant){var i=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);var o=e-t;n.block?this.addBlock(new ur(o,i,n)):(o||r||i>=5)&&this.addLineDeco(i,r,o)}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(){if(!(this.lineStart>-1)){var t=this.oracle.doc.lineAt(this.pos),e=t.from,n=t.to;this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new lr(this.pos-e,-1)),this.writtenTo=this.pos}}},{key:"blankContent",value:function(t,e){var n=new cr(e-t);return this.oracle.doc.lineAt(t).to==e&&(n.flags|=4),n}},{key:"ensureLine",value:function(){this.enterLine();var t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof lr)return t;var e=new lr(0,-1);return this.nodes.push(e),e}},{key:"addBlock",value:function(t){var e;this.enterLine();var n=null===(e=t.deco)||void 0===e?void 0:e.type;n!=en.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,n!=en.WidgetBefore&&(this.covering=t)}},{key:"addLineDeco",value:function(t,e,n){var i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,t),i.breaks+=e,this.writtenTo=this.pos=this.pos+n}},{key:"finish",value:function(t){var e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof lr||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new lr(0,-1));var n,i=t,r=(0,s.Z)(this.nodes);try{for(r.s();!(n=r.n()).done;){var o=n.value;o instanceof lr&&o.updateHeight(this.oracle,i),i+=o?o.length:1}}catch(a){r.e(a)}finally{r.f()}return this.nodes}}],[{key:"build",value:function(e,n,i,r){var o=new t(i,e);return zt.spans(n,i,r,o,0),o.finish(i)}}]),t}();var gr=function(){function t(){(0,h.Z)(this,t),this.changes=[]}return(0,u.Z)(t,[{key:"compareRange",value:function(){}},{key:"comparePoint",value:function(t,e,n,i){(t<e||n&&n.heightRelevant||i&&i.heightRelevant)&&hn(t,e,this.changes,5)}}]),t}();function pr(t,e){for(var n=t.getBoundingClientRect(),i=t.ownerDocument,r=i.defaultView||window,o=Math.max(0,n.left),s=Math.min(r.innerWidth,n.right),a=Math.max(0,n.top),h=Math.min(r.innerHeight,n.bottom),u=t.parentNode;u&&u!=i.body;)if(1==u.nodeType){var l=u,c=window.getComputedStyle(l);if((l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth)&&"visible"!=c.overflow){var f=l.getBoundingClientRect();o=Math.max(o,f.left),s=Math.min(s,f.right),a=Math.max(a,f.top),h=u==t.parentNode?f.bottom:Math.min(h,f.bottom)}u="absolute"==c.position||"fixed"==c.position?l.offsetParent:l.parentNode}else{if(11!=u.nodeType)break;u=u.host}return{left:o-n.left,right:Math.max(o,s)-n.left,top:a-(n.top+e),bottom:Math.max(a,h)-(n.top+e)}}function mr(t,e){var n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}var yr=function(){function t(e,n,i){(0,h.Z)(this,t),this.from=e,this.to=n,this.size=i}return(0,u.Z)(t,[{key:"draw",value:function(t){return nn.replace({widget:new kr(this.size,t)}).range(this.from,this.to)}}],[{key:"same",value:function(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++){var i=t[n],r=e[n];if(i.from!=r.from||i.to!=r.to||i.size!=r.size)return!1}return!0}}]),t}(),kr=function(t){function e(t,n){var i;return(0,h.Z)(this,e),(i=(0,r.Z)(this,e)).size=t,i.vertical=n,i}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"eq",value:function(t){return t.size==this.size&&t.vertical==this.vertical}},{key:"toDOM",value:function(){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(){return this.vertical?this.size:-1}}]),e}(tn),wr=function(){function t(e){(0,h.Z)(this,t),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=!0,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Mr,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Wn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;var n=e.facet(Bn).some((function(t){return"function"!=typeof t&&"cm-lineWrapping"==t.class}));this.heightOracle=new ir(n),this.stateDeco=e.facet(Rn).filter((function(t){return"function"!=typeof t})),this.heightMap=hr.empty().applyChanges(this.stateDeco,d.empty,this.heightOracle.setDoc(e.doc),[new Vn(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=nn.set(this.lineGaps.map((function(t){return t.draw(!1)}))),this.computeVisibleRanges()}return(0,u.Z)(t,[{key:"updateForViewport",value:function(){for(var t=this,e=[this.viewport],n=this.state.selection.main,i=function(){var i=r?n.head:n.anchor;if(!e.some((function(t){var e=t.from,n=t.to;return i>=e&&i<=n}))){var o=t.lineBlockAt(i),s=o.from,a=o.to;e.push(new br(s,a))}},r=0;r<=1;r++)i();this.viewports=e.sort((function(t,e){return t.from-e.from})),this.scaler=this.heightMap.height<=7e6?Mr:new Zr(this.heightOracle,this.heightMap,this.viewports)}},{key:"updateViewportLines",value:function(){var t=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(function(e){t.viewportLines.push(1==t.scaler.scale?e:Cr(e,t.scaler))}))}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.state=t.state;var n=this.stateDeco;this.stateDeco=this.state.facet(Rn).filter((function(t){return"function"!=typeof t}));var i,r,o,s,a=t.changedRanges,h=Vn.extendWithRanges(a,(i=n,r=this.stateDeco,o=t?t.changes:V.empty(this.state.doc.length),s=new gr,zt.compare(i,r,o,s,0),s.changes)),u=this.heightMap.height,l=this.scrolledToBottom?null:this.lineBlockAtHeight(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),h),this.heightMap.height!=u&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);var c=h.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<c.from||e.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,e));var f=!t.changes.empty||2&t.flags||c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,this.updateForViewport(),f&&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(xn)&&(this.mustEnforceCursorAssoc=!0)}},{key:"measure",value:function(t){var e=t.contentDOM,n=window.getComputedStyle(e),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Wn.RTL:Wn.LTR;var o=this.heightOracle.mustRefreshForWrapping(r),a=e.getBoundingClientRect(),h=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;var u=0,l=0,c=parseInt(n.paddingTop)||0,f=parseInt(n.paddingBottom)||0;this.paddingTop==c&&this.paddingBottom==f||(this.paddingTop=c,this.paddingBottom=f,u|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(i.lineWrapping&&(h=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=8),this.scrollTop!=t.scrollDOM.scrollTop&&(this.scrollAnchorHeight=-1,this.scrollTop=t.scrollDOM.scrollTop),this.scrolledToBottom=this.scrollTop>t.scrollDOM.scrollHeight-t.scrollDOM.clientHeight-4;var v=(this.printing?mr:pr)(e,this.paddingTop),g=v.top-this.pixelViewport.top,p=v.bottom-this.pixelViewport.bottom;this.pixelViewport=v;var m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(h=!0)),!this.inView&&!this.scrollTarget)return 0;var y=a.width;if(this.contentDOMWidth==y&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,u|=8),h){var k=t.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(k)&&(o=!0),o||i.lineWrapping&&Math.abs(y-this.contentDOMWidth)>i.charWidth){var w=t.docView.measureTextSize(),b=w.lineHeight,x=w.charWidth,S=w.textHeight;(o=b>0&&i.refresh(r,b,x,S,y/x,k))&&(t.docView.minWidth=0,u|=8)}g>0&&p>0?l=Math.max(g,p):g<0&&p<0&&(l=Math.min(g,p)),i.heightChanged=!1;var A,M=(0,s.Z)(this.viewports);try{for(M.s();!(A=M.n()).done;){var Z=A.value,C=Z.from==this.viewport.from?k:t.docView.measureVisibleLineHeights(Z);this.heightMap=(o?hr.empty().applyChanges(this.stateDeco,d.empty,this.heightOracle,[new Vn(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new rr(Z.from,C))}}catch(T){M.e(T)}finally{M.f()}i.heightChanged&&(u|=2)}var O=!this.viewportIsAppropriate(this.viewport,l)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return O&&(this.viewport=this.getViewport(l,this.scrollTarget)),this.updateForViewport(),(2&u||O)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),u}},{key:"visibleTop",get:function(){return this.scaler.fromDOM(this.pixelViewport.top)}},{key:"visibleBottom",get:function(){return this.scaler.fromDOM(this.pixelViewport.bottom)}},{key:"getViewport",value:function(t,e){var n=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),i=this.heightMap,r=this.heightOracle,o=this.visibleTop,s=this.visibleBottom,a=new br(i.lineAt(o-1e3*n,sr.ByHeight,r,0,0).from,i.lineAt(s+1e3*(1-n),sr.ByHeight,r,0,0).to);if(e){var h=e.range.head;if(h<a.from||h>a.to){var u,l=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=i.lineAt(h,sr.ByPos,r,0,0);u="center"==e.y?(c.top+c.bottom)/2-l/2:"start"==e.y||"nearest"==e.y&&h<a.from?c.top:c.bottom-l,a=new br(i.lineAt(u-500,sr.ByHeight,r,0,0).from,i.lineAt(u+l+500,sr.ByHeight,r,0,0).to)}}return a}},{key:"mapViewport",value:function(t,e){var n=e.mapPos(t.from,-1),i=e.mapPos(t.to,1);return new br(this.heightMap.lineAt(n,sr.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,sr.ByPos,this.heightOracle,0,0).to)}},{key:"viewportIsAppropriate",value:function(t){var e=t.from,n=t.to,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!this.inView)return!0;var r=this.heightMap.lineAt(e,sr.ByPos,this.heightOracle,0,0).top,o=this.heightMap.lineAt(n,sr.ByPos,this.heightOracle,0,0).bottom,s=this.visibleTop,a=this.visibleBottom;return(0==e||r<=s-Math.max(10,Math.min(-i,250)))&&(n==this.state.doc.length||o>=a+Math.max(10,Math.min(i,250)))&&r>s-2e3&&o<a+2e3}},{key:"mapLineGaps",value:function(t,e){if(!t.length||e.empty)return t;var n,i=[],r=(0,s.Z)(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;e.touchesRange(o.from,o.to)||i.push(new yr(e.mapPos(o.from),e.mapPos(o.to),o.size))}}catch(a){r.e(a)}finally{r.f()}return i}},{key:"ensureLineGaps",value:function(t,e){var n=this,i=this.heightOracle.lineWrapping,r=i?1e4:2e3,o=r>>1,a=r<<1;if(this.defaultTextDirection!=Wn.LTR&&!i)return[];var h,u=[],l=function r(a,h,l,c){if(!(h-a<o)){var f=n.state.selection.main,d=[f.from];f.empty||d.push(f.to);for(var v=0,g=d;v<g.length;v++){var p=g[v];if(p>a&&p<h)return r(a,p-10,l,c),void r(p+10,h,l,c)}var m=function(t,e){var n,i=(0,s.Z)(t);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(e(r))return r}}catch(o){i.e(o)}finally{i.f()}return}(t,(function(t){return t.from>=l.from&&t.to<=l.to&&Math.abs(t.from-a)<o&&Math.abs(t.to-h)<o&&!d.some((function(e){return t.from<e&&t.to>e}))}));if(!m){if(h<l.to&&e&&i&&e.visibleRanges.some((function(t){return t.from<=h&&t.to>=h}))){var y=e.moveToLineBoundary(K.cursor(h),!1,!0).head;y>a&&(h=y)}m=new yr(a,h,n.gapSize(l,a,h,c))}u.push(m)}},c=(0,s.Z)(this.viewportLines);try{for(c.s();!(h=c.n()).done;){var f=h.value;if(!(f.length<a)){var d=xr(f.from,f.to,this.stateDeco);if(!(d.total<a)){var v=this.scrollTarget?this.scrollTarget.range.head:null,g=void 0,p=void 0;if(i){var m=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,y=void 0,k=void 0;if(null!=v){var w=Ar(d,v),b=((this.visibleBottom-this.visibleTop)/2+m)/f.height;y=w-b,k=w+b}else y=(this.visibleTop-f.top-m)/f.height,k=(this.visibleBottom-f.top+m)/f.height;g=Sr(d,y),p=Sr(d,k)}else{var x=d.total*this.heightOracle.charWidth,S=r*this.heightOracle.charWidth,A=void 0,M=void 0;if(null!=v){var Z=Ar(d,v),C=((this.pixelViewport.right-this.pixelViewport.left)/2+S)/x;A=Z-C,M=Z+C}else A=(this.pixelViewport.left-S)/x,M=(this.pixelViewport.right+S)/x;g=Sr(d,A),p=Sr(d,M)}g>f.from&&l(f.from,g,f,d),p<f.to&&l(p,f.to,f,d)}}}}catch(O){c.e(O)}finally{c.f()}return u}},{key:"gapSize",value:function(t,e,n,i){var r=Ar(i,n)-Ar(i,e);return this.heightOracle.lineWrapping?t.height*r:i.total*this.heightOracle.charWidth*r}},{key:"updateLineGaps",value:function(t){var e=this;yr.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=nn.set(t.map((function(t){return t.draw(e.heightOracle.lineWrapping)}))))}},{key:"computeVisibleRanges",value:function(){var t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));var e=[];zt.spans(t,this.viewport.from,this.viewport.to,{span:function(t,n){e.push({from:t,to:n})},point:function(){}},20);var n=e.length!=this.visibleRanges.length||this.visibleRanges.some((function(t,n){return t.from!=e[n].from||t.to!=e[n].to}));return this.visibleRanges=e,n?4:0}},{key:"lineBlockAt",value:function(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find((function(e){return e.from<=t&&e.to>=t}))||Cr(this.heightMap.lineAt(t,sr.ByPos,this.heightOracle,0,0),this.scaler)}},{key:"lineBlockAtHeight",value:function(t){return Cr(this.heightMap.lineAt(this.scaler.fromDOM(t),sr.ByHeight,this.heightOracle,0,0),this.scaler)}},{key:"elementAtHeight",value:function(t){return Cr(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}},{key:"docHeight",get:function(){return this.scaler.toDOM(this.heightMap.height)}},{key:"contentHeight",get:function(){return this.docHeight+this.paddingTop+this.paddingBottom}}]),t}(),br=(0,u.Z)((function t(e,n){(0,h.Z)(this,t),this.from=e,this.to=n}));function xr(t,e,n){var i=[],r=t,o=0;return zt.spans(n,t,e,{span:function(){},point:function(t,e){t>r&&(i.push({from:r,to:t}),o+=t-r),r=e}},20),r<e&&(i.push({from:r,to:e}),o+=e-r),{total:o,ranges:i}}function Sr(t,e){var n=t.total,i=t.ranges;if(e<=0)return i[0].from;if(e>=1)return i[i.length-1].to;for(var r=Math.floor(n*e),o=0;;o++){var s=i[o],a=s.from,h=s.to-a;if(r<=h)return a+r;r-=h}}function Ar(t,e){var n,i=0,r=(0,s.Z)(t.ranges);try{for(r.s();!(n=r.n()).done;){var o=n.value,a=o.from,h=o.to;if(e<=h){i+=e-a;break}i+=h-a}}catch(u){r.e(u)}finally{r.f()}return i/t.total}var Mr={toDOM:function(t){return t},fromDOM:function(t){return t},scale:1},Zr=function(){function t(e,n,i){(0,h.Z)(this,t);var r=0,o=0,a=0;this.viewports=i.map((function(t){var i=t.from,o=t.to,s=n.lineAt(i,sr.ByPos,e,0,0).top,a=n.lineAt(o,sr.ByPos,e,0,0).bottom;return r+=a-s,{from:i,to:o,top:s,bottom:a,domTop:0,domBottom:0}})),this.scale=(7e6-r)/(n.height-r);var u,l=(0,s.Z)(this.viewports);try{for(l.s();!(u=l.n()).done;){var c=u.value;c.domTop=a+(c.top-o)*this.scale,a=c.domBottom=c.domTop+(c.bottom-c.top),o=c.bottom}}catch(f){l.e(f)}finally{l.f()}}return(0,u.Z)(t,[{key:"toDOM",value:function(t){for(var e=0,n=0,i=0;;e++){var r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.top)return i+(t-n)*this.scale;if(t<=r.bottom)return r.domTop+(t-r.top);n=r.bottom,i=r.domBottom}}},{key:"fromDOM",value:function(t){for(var e=0,n=0,i=0;;e++){var r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.domTop)return n+(t-i)/this.scale;if(t<=r.domBottom)return r.top+(t-r.domTop);n=r.bottom,i=r.domBottom}}}]),t}();function Cr(t,e){if(1==e.scale)return t;var n=e.toDOM(t.top),i=e.toDOM(t.bottom);return new or(t.from,t.length,n,i-n,Array.isArray(t._content)?t._content.map((function(t){return Cr(t,e)})):t._content)}var Or=G.define({combine:function(t){return t.join(" ")}}),Tr=G.define({combine:function(t){return t.indexOf(!0)>-1}}),Dr=te.V.newName(),Er=te.V.newName(),Br=te.V.newName(),Rr={"&light":"."+Er,"&dark":"."+Br};function Ir(t,e,n){return new te.V(e,{finish:function(e){return/&/.test(e)?e.replace(/&\w*/,(function(e){if("&"==e)return t;if(!n||!n[e])throw new RangeError("Unsupported selector: ".concat(e));return n[e]})):t+" "+e}})}var Pr=Ir("."+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",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Rr),Nr=(0,u.Z)((function t(e,n,i,r){(0,h.Z)(this,t),this.typeOver=r,this.bounds=null,this.text="";var o=e.docView,s=o.impreciseHead,a=o.impreciseAnchor;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,i,0))){var u=s||a?[]:function(t){var e=[];if(t.root.activeElement!=t.contentDOM)return e;var n=t.observer.selectionRange,i=n.anchorNode,r=n.anchorOffset,o=n.focusNode,s=n.focusOffset;i&&(e.push(new li(i,r)),o==i&&s==r||e.push(new li(o,s)));return e}(e),l=new hi(u,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=function(t,e){if(0==t.length)return null;var n=t[0].pos,i=2==t.length?t[1].pos:n;return n>-1&&i>-1?K.single(n+e,i+e):null}(u,this.bounds.from)}else{var c=e.observer.selectionRange,f=s&&s.node==c.focusNode&&s.offset==c.focusOffset||!ie(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),d=a&&a.node==c.anchorNode&&a.offset==c.anchorOffset||!ie(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset);this.newSel=K.single(d,f)}}));function Lr(t,e){var n,i=e.newSel,r=t.state.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){var s=e.bounds,a=s.from,h=s.to,u=r.from,l=null;(8===o||Le.android&&e.text.length<h-a)&&(u=r.to,l="end");var c=function(t,e,n,i){var r=Math.min(t.length,e.length),o=0;for(;o<r&&t.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==r&&t.length==e.length)return null;var s=t.length,a=e.length;for(;s>0&&a>0&&t.charCodeAt(s-1)==e.charCodeAt(a-1);)s--,a--;if("end"==i){n-=s+Math.max(0,o-Math.min(s,a))-o}if(s<o&&t.length<e.length){a=(o-=n<=o&&n>=s?o-n:0)+(a-s),s=o}else if(a<o){s=(o-=n<=o&&n>=a?o-n:0)+(s-a),a=o}return{from:o,toA:s,toB:a}}(t.state.doc.sliceString(a,h,ai),e.text,u-a,l);c&&(Le.chrome&&13==o&&c.toB==c.from+2&&e.text.slice(c.from,c.toB)==ai+ai&&c.toB--,n={from:a+c.from,to:a+c.toA,insert:d.of(e.text.slice(c.from,c.toB).split(ai))})}else i&&(!t.hasFocus&&t.state.facet(Zn)||i.main.eq(r))&&(i=null);if(!n&&!i)return!1;if(!n&&e.typeOver&&!r.empty&&i&&i.main.empty?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,r.to)}:n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,r.to))}:(Le.mac||Le.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=K.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:d.of([" "])}):Le.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&t.lineWrapping&&(i&&(i=K.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:d.of([" "])}),n){var f=t.state;if(Le.ios&&t.inputState.flushIOSKey(t))return!0;if(Le.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&me(t.contentDOM,"Enter",13)||(n.from==r.from-1&&n.to==r.to&&0==n.insert.length||8==o&&n.insert.length<n.to-n.from)&&me(t.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&me(t.contentDOM,"Delete",46)))return!0;var v,g=n.insert.toString();if(t.state.facet(kn).some((function(e){return e(t,n.from,n.to,g)})))return!0;if(t.inputState.composing>=0&&t.inputState.composing++,n.from>=r.from&&n.to<=r.to&&n.to-n.from>=(r.to-r.from)/3&&(!i||i.main.empty&&i.main.from==n.from+n.insert.length)&&t.inputState.composing<0){var p=r.from<n.from?f.sliceDoc(r.from,n.from):"",m=r.to>n.to?f.sliceDoc(n.to,r.to):"";v=f.replaceSelection(t.state.toText(p+n.insert.sliceString(0,void 0,t.state.lineBreak)+m))}else{var y=f.changes(n),k=i&&i.main.to<=y.newLength?i.main:void 0;if(f.selection.ranges.length>1&&t.inputState.composing>=0&&n.to<=r.to&&n.to>=r.to-10){var w=t.state.sliceDoc(n.from,n.to),b=di(t)||t.state.doc.lineAt(r.head),x=r.to-n.to,S=r.to-r.from;v=f.changeByRange((function(e){if(e.from==r.from&&e.to==r.to)return{changes:y,range:k||e.map(y)};var i=e.to-x,o=i-w.length;if(e.to-e.from!=S||t.state.sliceDoc(o,i)!=w||b&&e.to>=b.from&&e.from<=b.to)return{range:e};var s=f.changes({from:o,to:i,insert:n.insert}),a=e.to-r.to;return{changes:s,range:k?K.range(Math.max(0,k.anchor+a),Math.max(0,k.head+a)):e.map(s)}}))}else v={changes:y,selection:k&&f.selection.replaceRange(k)}}var A="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,A+=".compose",t.inputState.compositionFirstChange&&(A+=".start",t.inputState.compositionFirstChange=!1)),t.dispatch(v,{scrollIntoView:!0,userEvent:A}),!0}if(i&&!i.main.eq(r)){var M=!1,Z="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(M=!0),Z=t.inputState.lastSelectionOrigin),t.dispatch({selection:i,scrollIntoView:M,userEvent:Z}),!0}return!1}var Vr={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Hr=Le.ie&&Le.ie_version<=11,Wr=function(){function t(e){var n=this;(0,h.Z)(this,t),this.view=e,this.active=!1,this.selectionRange=new de,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((function(t){var i,r=(0,s.Z)(t);try{for(r.s();!(i=r.n()).done;){var o=i.value;n.queue.push(o)}}catch(a){r.e(a)}finally{r.f()}(Le.ie&&Le.ie_version<=11||Le.ios&&e.composing)&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?n.flushSoon():n.flush()})),Hr&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((function(){var t;(null===(t=n.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&n.onResize()})),this.resizeScroll.observe(e.scrollDOM),this.resizeContent=new ResizeObserver((function(){return n.view.requestMeasure()})),this.resizeContent.observe(e.contentDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((function(t){n.parentCheck<0&&(n.parentCheck=setTimeout(n.listenForScroll.bind(n),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=n.intersecting&&(n.intersecting=!n.intersecting,n.intersecting!=n.view.inView&&n.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&&n.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}return(0,u.Z)(t,[{key:"onScrollChanged",value:function(t){this.view.inputState.runScrollHandlers(this.view,t),this.intersecting&&this.view.measure()}},{key:"onScroll",value:function(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}},{key:"onResize",value:function(){var t=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((function(){t.resizeTimeout=-1,t.view.requestMeasure()}),50))}},{key:"onPrint",value:function(){var t=this;this.view.viewState.printing=!0,this.view.measure(),setTimeout((function(){t.view.viewState.printing=!1,t.view.requestMeasure()}),500)}},{key:"updateGaps",value:function(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((function(e,n){return e!=t[n]})))){this.gapIntersection.disconnect();var e,n=(0,s.Z)(t);try{for(n.s();!(e=n.n()).done;){var i=e.value;this.gapIntersection.observe(i)}}catch(r){n.e(r)}finally{n.f()}this.gaps=t}}},{key:"onSelectionChange",value:function(t){var e=this.selectionChanged;if(this.readSelectionRange()&&!this.delayedAndroidKey){var n=this.view,i=this.selectionRange;if(n.state.facet(Zn)?n.root.activeElement==this.dom:re(n.dom,i)){var r=i.anchorNode&&n.docView.nearest(i.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(Le.ie&&Le.ie_version<=11||Le.android&&Le.chrome)&&!n.state.selection.main.empty&&i.focusNode&&se(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}}}},{key:"readSelectionRange",value:function(){var t=this.view,e=Le.safari&&11==t.root.nodeType&&function(t){for(var e=t.activeElement;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t){var e=null;function n(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",n,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),!e)return null;var i=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);if(se(a.node,a.offset,o,s)){var h=[o,s,i,r];i=h[0],r=h[1],o=h[2],s=h[3]}return{anchorNode:i,anchorOffset:r,focusNode:o,focusOffset:s}}(this.view)||ne(t.root);if(!e||this.selectionRange.eq(e))return!1;var n=re(this.dom,e);return n&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){var n=e.focusNode,i=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=i)return!1;for(i=Math.min(i,ue(n));;)if(i){if(1!=n.nodeType)return!1;var r=n.childNodes[i-1];"false"==r.contentEditable?i--:i=ue(n=r)}else{if(n==t)return!0;i=ae(n),n=n.parentNode}}(this.dom,e)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(e),n&&(this.selectionChanged=!0),!0)}},{key:"setSelectionRange",value:function(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}},{key:"clearSelectionRange",value:function(){this.selectionRange.set(null,0,null,0)}},{key:"listenForScroll",value:function(){this.parentCheck=-1;for(var t=0,e=null,n=this.dom;n;)if(1==n.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==n?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){var i,r=(0,s.Z)(this.scrollTargets);try{for(r.s();!(i=r.n()).done;){i.value.removeEventListener("scroll",this.onScroll)}}catch(h){r.e(h)}finally{r.f()}var o,a=(0,s.Z)(this.scrollTargets=e);try{for(a.s();!(o=a.n()).done;){o.value.addEventListener("scroll",this.onScroll)}}catch(h){a.e(h)}finally{a.f()}}}},{key:"ignore",value:function(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}},{key:"start",value:function(){this.active||(this.observer.observe(this.dom,Vr),Hr&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}},{key:"stop",value:function(){this.active&&(this.active=!1,this.observer.disconnect(),Hr&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}},{key:"clear",value:function(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}},{key:"delayAndroidKey",value:function(t,e){var n,i=this;if(!this.delayedAndroidKey){this.flushingAndroidKey=this.view.win.requestAnimationFrame((function(){var t=i.delayedAndroidKey;t&&(i.clearDelayedAndroidKey(),i.view.inputState.lastKeyCode=t.keyCode,i.view.inputState.lastKeyTime=Date.now(),!i.flush()&&t.force&&me(i.dom,t.key,t.keyCode))}))}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}},{key:"clearDelayedAndroidKey",value:function(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}},{key:"flushSoon",value:function(){var t=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame((function(){t.delayedFlush=-1,t.flush()})))}},{key:"forceFlush",value:function(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}},{key:"pendingRecords",value:function(){var t,e=(0,s.Z)(this.observer.takeRecords());try{for(e.s();!(t=e.n()).done;){var n=t.value;this.queue.push(n)}}catch(i){e.e(i)}finally{e.f()}return this.queue}},{key:"processRecords",value:function(){var t=this.pendingRecords();t.length&&(this.queue=[]);var e,n=-1,i=-1,r=!1,o=(0,s.Z)(t);try{for(o.s();!(e=o.n()).done;){var a=e.value,h=this.readMutation(a);h&&(h.typeOver&&(r=!0),-1==n?(n=h.from,i=h.to):(n=Math.min(h.from,n),i=Math.max(h.to,i)))}}catch(u){o.e(u)}finally{o.f()}return{from:n,to:i,typeOver:r}}},{key:"readChange",value:function(){var t=this.processRecords(),e=t.from,n=t.to,i=t.typeOver,r=this.selectionChanged&&re(this.dom,this.selectionRange);return e<0&&!r?null:(e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Nr(this.view,e,n,i))}},{key:"flush",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();var e=this.readChange();if(!e)return!1;var n=this.view.state,i=Lr(this.view,e);return this.view.state==n&&this.view.update([]),i}},{key:"readMutation",value:function(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.dirty|=4),"childList"==t.type){var n=_r(e,t.previousSibling||t.target.previousSibling,-1),i=_r(e,t.nextSibling||t.target.nextSibling,1);return{from:n?e.posAfter(n):e.posAtStart,to:i?e.posBefore(i):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(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}},{key:"addWindowListeners",value:function(t){t.addEventListener("resize",this.onResize),t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}},{key:"removeWindowListeners",value:function(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"destroy",value:function(){var t,e,n,i;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect(),null===(i=this.resizeContent)||void 0===i||i.disconnect();var r,o=(0,s.Z)(this.scrollTargets);try{for(o.s();!(r=o.n()).done;){r.value.removeEventListener("scroll",this.onScroll)}}catch(a){o.e(a)}finally{o.f()}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}]),t}();function _r(t,e,n){for(;e;){var i=be.get(e);if(i&&i.parent==t)return i;var r=e.parentNode;e=r!=t.dom?r:n>0?e.nextSibling:e.previousSibling}return null}var zr=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,h.Z)(this,t),this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=n.dispatch||function(t){return e.update([t])},this.dispatch=this.dispatch.bind(this),this._root=n.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(n.parent)||document,this.viewState=new wr(n.state||Nt.create(n)),this.plugins=this.state.facet(On).map((function(t){return new Dn(t)}));var i,r=(0,s.Z)(this.plugins);try{for(r.s();!(i=r.n()).done;){i.value.update(this)}}catch(o){r.e(o)}finally{r.f()}this.observer=new Wr(this),this.inputState=new Di(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new ci(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),n.parent&&n.parent.appendChild(this.dom)}return(0,u.Z)(t,[{key:"state",get:function(){return this.viewState.state}},{key:"viewport",get:function(){return this.viewState.viewport}},{key:"visibleRanges",get:function(){return this.viewState.visibleRanges}},{key:"inView",get:function(){return this.viewState.inView}},{key:"composing",get:function(){return this.inputState.composing>0}},{key:"compositionStarted",get:function(){return this.inputState.composing>=0}},{key:"root",get:function(){return this._root}},{key:"win",get:function(){return this.dom.ownerDocument.defaultView||window}},{key:"dispatch",value:function(){var t,e=1==arguments.length&&(arguments.length<=0?void 0:arguments[0])instanceof Mt?arguments.length<=0?void 0:arguments[0]:(t=this.state).update.apply(t,arguments);this._dispatch(e,this)}},{key:"update",value:function(t){var e=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");var n,i,r=!1,o=!1,a=this.state,h=(0,s.Z)(t);try{for(h.s();!(i=h.n()).done;){var u=i.value;if(u.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=u.state}}catch(M){h.e(M)}finally{h.f()}if(this.destroyed)this.viewState.state=a;else{var l=this.hasFocus,c=0,f=null;t.some((function(t){return t.annotation(Qi)}))?(this.inputState.notifiedFocused=l,c=1):l!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=l,(f=tr(a,l))||(c=1));var d=this.observer.delayedAndroidKey,v=null;if(d?(this.observer.clearDelayedAndroidKey(),((v=this.observer.readChange())&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(v=null)):this.observer.clear(),a.facet(Nt.phrases)!=this.state.facet(Nt.phrases))return this.setState(a);n=Hn.create(this,a,t),n.flags|=c;var g=this.viewState.scrollTarget;try{this.updateState=2;var p,m=(0,s.Z)(t);try{for(m.s();!(p=m.n()).done;){var y=p.value;if(g&&(g=g.map(y.changes)),y.scrollIntoView){var k=y.state.selection.main;g=new Sn(k.empty?k:K.cursor(k.head,k.head>k.anchor?-1:1))}var w,b=(0,s.Z)(y.effects);try{for(b.s();!(w=b.n()).done;){var x=w.value;x.is(An)&&(g=x.value)}}catch(M){b.e(M)}finally{b.f()}}}catch(M){m.e(M)}finally{m.f()}this.viewState.update(n,g),this.bidiCache=jr.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),r=this.docView.update(n),this.state.facet(Ln)!=this.styleModules&&this.mountStyles(),o=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(r,t.some((function(t){return t.isUserEvent("select.pointer")})))}finally{this.updateState=0}if(n.startState.facet(Or)!=n.state.facet(Or)&&(this.viewState.mustMeasureContent=!0),(r||o||g||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!n.empty){var S,A=(0,s.Z)(this.state.facet(yn));try{for(A.s();!(S=A.n()).done;){(0,S.value)(n)}}catch(M){A.e(M)}finally{A.f()}}(f||v)&&Promise.resolve().then((function(){f&&e.state==f.startState&&e.dispatch(f),v&&!Lr(e,v)&&d.force&&me(e.contentDOM,d.key,d.keyCode)}))}}},{key:"setState",value:function(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)this.viewState.state=t;else{this.updateState=2;var e=this.hasFocus;try{var n,i=(0,s.Z)(this.plugins);try{for(i.s();!(n=i.n()).done;){n.value.destroy(this)}}catch(a){i.e(a)}finally{i.f()}this.viewState=new wr(t),this.plugins=t.facet(On).map((function(t){return new Dn(t)})),this.pluginMap.clear();var r,o=(0,s.Z)(this.plugins);try{for(o.s();!(r=o.n()).done;){r.value.update(this)}}catch(a){o.e(a)}finally{o.f()}this.docView=new ci(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}}},{key:"updatePlugins",value:function(t){var e=t.startState.facet(On),n=t.state.facet(On);if(e!=n){var i,r=[],o=(0,s.Z)(n);try{for(o.s();!(i=o.n()).done;){var a=i.value,h=e.indexOf(a);if(h<0)r.push(new Dn(a));else{var u=this.plugins[h];u.mustUpdate=t,r.push(u)}}}catch(p){o.e(p)}finally{o.f()}var l,c=(0,s.Z)(this.plugins);try{for(c.s();!(l=c.n()).done;){var f=l.value;f.mustUpdate!=t&&f.destroy(this)}}catch(p){c.e(p)}finally{c.f()}this.plugins=r,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else{var d,v=(0,s.Z)(this.plugins);try{for(v.s();!(d=v.n()).done;){d.value.mustUpdate=t}}catch(p){v.e(p)}finally{v.f()}}for(var g=0;g<this.plugins.length;g++)this.plugins[g].update(this)}},{key:"measure",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(!this.destroyed){this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,e&&this.observer.forceFlush();var n=null,i=this.scrollDOM,r=i.scrollTop,o=this.viewState,a=o.scrollAnchorPos,h=o.scrollAnchorHeight;if(this.viewState.scrollAnchorHeight=-1,h<0||r!=this.viewState.scrollTop)if(r>i.scrollHeight-i.clientHeight-4)a=-1,h=this.viewState.heightMap.height;else{var u=this.viewState.lineBlockAtHeight(r);a=u.from,h=u.top}try{for(var l=0;;l++){this.updateState=1;var c=this.viewport,f=this.viewState.measure(this);if(!f&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}var d=[];if(!(4&f)){var v=[d,this.measureRequests];this.measureRequests=v[0],d=v[1]}var g=d.map((function(e){try{return e.read(t)}catch(n){return Mn(t.state,n),qr}})),p=Hn.create(this,this.state,[]),m=!1,y=!1;p.flags|=f,n?n.flags|=f:n=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),m=this.docView.update(p));for(var k=0;k<d.length;k++)if(g[k]!=qr)try{var w=d[k];w.write&&w.write(g[k],this)}catch(A){Mn(this.state,A)}if(this.viewState.editorHeight)if(this.viewState.scrollTarget)this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,y=!0;else if(h>-1){var b=(a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)-h;(b>1||b<-1)&&(i.scrollTop=r+b,y=!0)}if(m&&this.docView.updateSelection(!0),this.viewport.from==c.from&&this.viewport.to==c.to&&!y&&0==this.measureRequests.length)break;h=-1}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty){var x,S=(0,s.Z)(this.state.facet(yn));try{for(S.s();!(x=S.n()).done;){(0,x.value)(n)}}catch(M){S.e(M)}finally{S.f()}}}}},{key:"themeClasses",get:function(){return Dr+" "+(this.state.facet(Tr)?Br:Er)+" "+this.state.facet(Or)}},{key:"updateAttrs",value:function(){var t=this,e=Kr(this,En,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Zn)?"true":"false",class:"cm-content",style:"".concat(Le.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Kr(this,Bn,n);var i=this.observer.ignore((function(){var i=Qe(t.contentDOM,t.contentAttrs,n),r=Qe(t.dom,t.editorAttrs,e);return i||r}));return this.editorAttrs=e,this.contentAttrs=n,i}},{key:"showAnnouncements",value:function(e){var n,i=!0,r=(0,s.Z)(e);try{for(r.s();!(n=r.n()).done;){var o,a=n.value,h=(0,s.Z)(a.effects);try{for(h.s();!(o=h.n()).done;){var u=o.value;if(u.is(t.announce))i&&(this.announceDOM.textContent=""),i=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=u.value}}catch(l){h.e(l)}finally{h.f()}}}catch(l){r.e(l)}finally{r.f()}}},{key:"mountStyles",value:function(){this.styleModules=this.state.facet(Ln),te.V.mount(this.root,this.styleModules.concat(Pr).reverse())}},{key:"readMeasured",value:function(){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(t){var e=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((function(){return e.measure()}))),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(var n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===t.key)return void(this.measureRequests[n]=t);this.measureRequests.push(t)}}},{key:"plugin",value:function(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(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}},{key:"documentPadding",get:function(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}},{key:"elementAtHeight",value:function(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}},{key:"lineBlockAtHeight",value:function(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}},{key:"viewportLineBlocks",get:function(){return this.viewState.viewportLines}},{key:"lineBlockAt",value:function(t){return this.viewState.lineBlockAt(t)}},{key:"contentHeight",get:function(){return this.viewState.contentHeight}},{key:"moveByChar",value:function(t,e,n){return Ti(this,t,Ci(this,t,e,n))}},{key:"moveByGroup",value:function(t,e){var n=this;return Ti(this,t,Ci(this,t,e,(function(e){return function(t,e,n){var i=t.state.charCategorizer(e),r=i(n);return function(t){var e=i(t);return r==Rt.Space&&(r=e),r==e}}(n,t.head,e)})))}},{key:"moveToLineBoundary",value:function(t,e){return function(t,e,n,i){var r=Zi(t,e.head),o=i&&r.type==en.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(o){var s=t.dom.getBoundingClientRect(),a=t.textDirectionAt(r.from),h=t.posAtCoords({x:n==(a==Wn.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(null!=h)return K.cursor(h,n?-1:1)}return K.cursor(n?r.to:r.from,n?-1:1)}(this,t,e,!(arguments.length>2&&void 0!==arguments[2])||arguments[2])}},{key:"moveVertically",value:function(t,e,n){return Ti(this,t,function(t,e,n,i){var r=e.head,o=n?1:-1;if(r==(n?t.state.doc.length:0))return K.cursor(r,e.assoc);var s,a=e.goalColumn,h=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(r),l=t.documentTop;if(u)null==a&&(a=u.left-h.left),s=o<0?u.top:u.bottom;else{var c=t.viewState.lineBlockAt(r);null==a&&(a=Math.min(h.right-h.left,t.defaultCharacterWidth*(r-c.from))),s=(o<0?c.top:c.bottom)+l}for(var f=h.left+a,d=null!=i?i:t.viewState.heightOracle.textHeight>>1,v=0;;v+=10){var g=s+(d+v)*o,p=Ai(t,{x:f,y:g},!1,o);if(g<h.top||g>h.bottom||(o<0?p<r:p>r))return K.cursor(p,e.assoc,void 0,a)}}(this,t,e,n))}},{key:"domAtPos",value:function(t){return this.docView.domAtPos(t)}},{key:"posAtDOM",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.posFromDOM(t,e)}},{key:"posAtCoords",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.readMeasured(),Ai(this,t,e)}},{key:"coordsAtPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.readMeasured();var n=this.docView.coordsAt(t,e);if(!n||n.left==n.right)return n;var i=this.state.doc.lineAt(t),r=this.bidiSpans(i);return le(n,r[ei.find(r,t-i.from,-1,e)].dir==Wn.LTR==e>0)}},{key:"defaultCharacterWidth",get:function(){return this.viewState.heightOracle.charWidth}},{key:"defaultLineHeight",get:function(){return this.viewState.heightOracle.lineHeight}},{key:"textDirection",get:function(){return this.viewState.defaultTextDirection}},{key:"textDirectionAt",value:function(t){return!this.state.facet(bn)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}},{key:"lineWrapping",get:function(){return this.viewState.heightOracle.lineWrapping}},{key:"bidiSpans",value:function(t){if(t.length>Fr)return ri(t.length);var e,n=this.textDirectionAt(t.from),i=(0,s.Z)(this.bidiCache);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(r.from==t.from&&r.dir==n)return r.order}}catch(a){i.e(a)}finally{i.f()}var o=ii(t.text,n);return this.bidiCache.push(new jr(t.from,t.to,n,o)),o}},{key:"hasFocus",get:function(){var t;return(this.dom.ownerDocument.hasFocus()||Le.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}},{key:"focus",value:function(){var t=this;this.observer.ignore((function(){ge(t.contentDOM),t.docView.updateSelection()}))}},{key:"setRoot",value:function(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}},{key:"destroy",value:function(){var t,e=(0,s.Z)(this.plugins);try{for(e.s();!(t=e.n()).done;){t.value.destroy(this)}}catch(n){e.e(n)}finally{e.f()}this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}}],[{key:"scrollIntoView",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return An.of(new Sn("number"==typeof t?K.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}},{key:"domEventHandlers",value:function(t){return Tn.define((function(){return{}}),{eventHandlers:t})}},{key:"theme",value:function(t,e){var n=te.V.newName(),i=[Or.of(n),Ln.of(Ir(".".concat(n),t))];return e&&e.dark&&i.push(Tr.of(!0)),i}},{key:"baseTheme",value:function(t){return at.lowest(Ln.of(Ir("."+Dr,t,Rr)))}},{key:"findFromDOM",value:function(t){var e,n=t.querySelector(".cm-content"),i=n&&be.get(n)||be.get(t);return(null===(e=null==i?void 0:i.rootView)||void 0===e?void 0:e.view)||null}}]),t}();zr.styleModule=Ln,zr.inputHandler=kn,zr.focusChangeEffect=wn,zr.perLineTextDirection=bn,zr.exceptionSink=mn,zr.updateListener=yn,zr.editable=Zn,zr.mouseSelectionStyle=pn,zr.dragMovesSelection=gn,zr.clickAddsSelectionRange=vn,zr.decorations=Rn,zr.atomicRanges=In,zr.scrollMargins=Pn,zr.darkTheme=Tr,zr.contentAttributes=Bn,zr.editorAttributes=En,zr.lineWrapping=zr.contentAttributes.of({class:"cm-lineWrapping"}),zr.announce=At.define();var Fr=4096,qr={},jr=function(){function t(e,n,i,r){(0,h.Z)(this,t),this.from=e,this.to=n,this.dir=i,this.order=r}return(0,u.Z)(t,null,[{key:"update",value:function(e,n){if(n.empty)return e;for(var i=[],r=e.length?e[e.length-1].dir:Wn.LTR,o=Math.max(0,e.length-10);o<e.length;o++){var s=e[o];s.dir!=r||n.touchesRange(s.from,s.to)||i.push(new t(n.mapPos(s.from,1),n.mapPos(s.to,-1),s.dir,s.order))}return i}}]),t}();function Kr(t,e,n){for(var i=t.state.facet(e),r=i.length-1;r>=0;r--){var o=i[r],s="function"==typeof o?o(t):o;s&&Xe(s,n)}return n}var Jr=Le.mac?"mac":Le.windows?"win":Le.linux?"linux":"key";function Ur(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}var Gr=at.default(zr.domEventHandlers({keydown:function(t,e){return eo(Yr(e.state),t,e,"editor")}})),$r=G.define({enables:Gr}),Xr=new WeakMap;function Yr(t){var e=t.facet($r),n=Xr.get(e);return n||Xr.set(e,n=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Jr,i=Object.create(null),r=Object.create(null),o=function(t,e){var n=r[t];if(null==n)r[t]=e;else if(n!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},a=function(t,e,r,s){for(var a,h,u=i[t]||(i[t]=Object.create(null)),l=e.split(/ (?!$)/).map((function(t){return function(t,e){var n,i,r,o,s=t.split(/-(?!$)/),a=s[s.length-1];"Space"==a&&(a=" ");for(var h=0;h<s.length-1;++h){var u=s[h];if(/^(cmd|meta|m)$/i.test(u))o=!0;else if(/^a(lt)?$/i.test(u))n=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))r=!0;else{if(!/^mod$/i.test(u))throw new Error("Unrecognized modifier name: "+u);"mac"==e?o=!0:i=!0}}return n&&(a="Alt-"+a),i&&(a="Ctrl-"+a),o&&(a="Meta-"+a),r&&(a="Shift-"+a),a}(t,n)})),c=function(){var e=l.slice(0,f).join(" ");o(e,!0),u[e]||(u[e]={preventDefault:!0,run:[function(n){var i=Qr={view:n,prefix:e,scope:t};return setTimeout((function(){Qr==i&&(Qr=null)}),to),!0}]})},f=1;f<l.length;f++)c();var d=l.join(" ");o(d,!1);var v=u[d]||(u[d]={preventDefault:!1,run:(null===(h=null===(a=u._any)||void 0===a?void 0:a.run)||void 0===h?void 0:h.slice())||[]});r&&v.run.push(r),s&&(v.preventDefault=!0)},h=(0,s.Z)(t);try{for(h.s();!(e=h.n()).done;){var u=e.value,l=u.scope?u.scope.split(" "):["editor"];if(u.any){var c,f=(0,s.Z)(l);try{for(f.s();!(c=f.n()).done;){var d=c.value,v=i[d]||(i[d]=Object.create(null));for(var g in v._any||(v._any={preventDefault:!1,run:[]}),v)v[g].run.push(u.any)}}catch(w){f.e(w)}finally{f.f()}}var p=u[n]||u.key;if(p){var m,y=(0,s.Z)(l);try{for(y.s();!(m=y.n()).done;){var k=m.value;a(k,p,u.run,u.preventDefault),u.shift&&a(k,"Shift-"+p,u.shift,u.preventDefault)}}catch(w){y.e(w)}finally{y.f()}}}}catch(w){h.e(w)}finally{h.f()}return i}(e.reduce((function(t,e){return t.concat(e)}),[]))),n}var Qr=null,to=4e3;function eo(t,e,n,i){var r=(0,ee.YG)(e),o=I(B(r,0))==r.length&&" "!=r,a="",h=!1;Qr&&Qr.view==n&&Qr.scope==i&&(a=Qr.prefix+" ",(h=Ri.indexOf(e.keyCode)<0)&&(Qr=null));var u,l,c=new Set,f=function(t){if(t){var i,r=(0,s.Z)(t.run);try{for(r.s();!(i=r.n()).done;){var o=i.value;if(!c.has(o)&&(c.add(o),o(n,e)))return!0}}catch(a){r.e(a)}finally{r.f()}t.preventDefault&&(h=!0)}return!1},d=t[i];if(d){if(f(d[a+Ur(r,e,!o)]))return!0;if(o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Le.windows&&e.ctrlKey&&e.altKey)&&(u=ee.ue[e.keyCode])&&u!=r){if(f(d[a+Ur(u,e,!0)]))return!0;if(e.shiftKey&&(l=ee.uY[e.keyCode])!=r&&l!=u&&f(d[a+Ur(l,e,!1)]))return!0}else if(o&&e.shiftKey&&f(d[a+Ur(r,e,!0)]))return!0;if(f(d._any))return!0}return h}var no=!Le.ios;var io={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};no&&(io[".cm-line"].caretColor="transparent !important");"".concat(7,"px"),"".concat(14,"px"),"".concat(7,"px solid transparent"),"".concat(7,"px solid transparent"),"-".concat(7,"px"),"".concat(7,"px solid #bbb"),"".concat(7,"px solid #f5f5f5"),"-".concat(7,"px"),"".concat(7,"px solid #bbb"),"".concat(7,"px solid #f5f5f5");var ro=G.define({combine:function(t){var e,n,i,r=(0,s.Z)(t);try{for(r.s();!(i=r.n()).done;){var o=i.value;e=e||o.topContainer,n=n||o.bottomContainer}}catch(a){r.e(a)}finally{r.f()}return{topContainer:e,bottomContainer:n}}});function oo(t,e){var n=t.plugin(so),i=n?n.specs.indexOf(e):-1;return i>-1?n.panels[i]:null}var so=Tn.fromClass(function(){function t(e){(0,h.Z)(this,t),this.input=e.state.facet(uo),this.specs=this.input.filter((function(t){return t})),this.panels=this.specs.map((function(t){return t(e)}));var n=e.state.facet(ro);this.top=new ao(e,!0,n.topContainer),this.bottom=new ao(e,!1,n.bottomContainer),this.top.sync(this.panels.filter((function(t){return t.top}))),this.bottom.sync(this.panels.filter((function(t){return!t.top})));var i,r=(0,s.Z)(this.panels);try{for(r.s();!(i=r.n()).done;){var o=i.value;o.dom.classList.add("cm-panel"),o.mount&&o.mount()}}catch(a){r.e(a)}finally{r.f()}}return(0,u.Z)(t,[{key:"update",value:function(t){var e=t.state.facet(ro);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new ao(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new ao(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();var n=t.state.facet(uo);if(n!=this.input){var i,r=n.filter((function(t){return t})),o=[],a=[],h=[],u=[],l=(0,s.Z)(r);try{for(l.s();!(i=l.n()).done;){var c=i.value,f=this.specs.indexOf(c),d=void 0;f<0?(d=c(t.view),u.push(d)):(d=this.panels[f]).update&&d.update(t),o.push(d),(d.top?a:h).push(d)}}catch(w){l.e(w)}finally{l.f()}this.specs=r,this.panels=o,this.top.sync(a),this.bottom.sync(h);for(var v=0,g=u;v<g.length;v++){var p=g[v];p.dom.classList.add("cm-panel"),p.mount&&p.mount()}}else{var m,y=(0,s.Z)(this.panels);try{for(y.s();!(m=y.n()).done;){var k=m.value;k.update&&k.update(t)}}catch(w){y.e(w)}finally{y.f()}}}},{key:"destroy",value:function(){this.top.sync([]),this.bottom.sync([])}}]),t}(),{provide:function(t){return zr.scrollMargins.of((function(e){var n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}}))}}),ao=function(){function t(e,n,i){(0,h.Z)(this,t),this.view=e,this.top=n,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}return(0,u.Z)(t,[{key:"sync",value:function(t){var e,n=(0,s.Z)(this.panels);try{for(n.s();!(e=n.n()).done;){var i=e.value;i.destroy&&t.indexOf(i)<0&&i.destroy()}}catch(r){n.e(r)}finally{n.f()}this.panels=t,this.syncDOM()}},{key:"syncDOM",value:function(){if(0!=this.panels.length){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 t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}var e,n=this.dom.firstChild,i=(0,s.Z)(this.panels);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(r.dom.parentNode==this.dom){for(;n!=r.dom;)n=ho(n);n=n.nextSibling}else this.dom.insertBefore(r.dom,n)}}catch(o){i.e(o)}finally{i.f()}for(;n;)n=ho(n)}else this.dom&&(this.dom.remove(),this.dom=void 0)}},{key:"scrollMargin",value:function(){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(){if(this.container&&this.classes!=this.view.themeClasses){var t,e=(0,s.Z)(this.classes.split(" "));try{for(e.s();!(t=e.n()).done;){var n=t.value;n&&this.container.classList.remove(n)}}catch(a){e.e(a)}finally{e.f()}var i,r=(0,s.Z)((this.classes=this.view.themeClasses).split(" "));try{for(r.s();!(i=r.n()).done;){var o=i.value;o&&this.container.classList.add(o)}}catch(a){r.e(a)}finally{r.f()}}}}]),t}();function ho(t){var e=t.nextSibling;return t.remove(),e}var uo=G.define({enables:so}),lo=function(t){function e(){return(0,h.Z)(this,e),(0,r.Z)(this,e,arguments)}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"compare",value:function(t){return this==t||this.constructor==t.constructor&&this.eq(t)}},{key:"eq",value:function(t){return!1}},{key:"destroy",value:function(t){}}]),e}(Vt);lo.prototype.elementClass="",lo.prototype.toDOM=void 0,lo.prototype.mapMode=N.TrackBefore,lo.prototype.startSide=lo.prototype.endSide=-1,lo.prototype.point=!0;var co=n(76775);function fo(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&"object"==(0,co.Z)(n)&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];"string"==typeof r?t.setAttribute(i,r):null!=r&&(t[i]=r)}e++}for(;e<arguments.length;e++)vo(t,arguments[e]);return t}function vo(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 n=0;n<e.length;n++)vo(t,e[n])}}var go="function"==typeof String.prototype.normalize?function(t){return t.normalize("NFKD")}:function(t){return t},po=function(){function t(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.length,o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0;(0,h.Z)(this,t),this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,r),this.bufferStart=i,this.normalize=o?function(t){return o(go(t))}:go,this.query=this.normalize(n)}return(0,u.Z)(t,[{key:"peek",value:function(){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 B(this.buffer,this.bufferPos)}},{key:"next",value:function(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}},{key:"nextOverlapping",value:function(){for(;;){var t=this.peek();if(t<0)return this.done=!0,this;var e=R(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=I(t);for(var i=this.normalize(e),r=0,o=n;;r++){var s=i.charCodeAt(r),a=this.match(s,o);if(r==i.length-1){if(a)return this.value=a,this;break}o==n&&r<e.length&&e.charCodeAt(r)==s&&o++}}}},{key:"match",value:function(t,e){for(var n=null,i=0;i<this.matches.length;i+=2){var r=this.matches[i],o=!1;this.query.charCodeAt(r)==t&&(r==this.query.length-1?n={from:this.matches[i+1],to:e+1}:(this.matches[i]++,o=!0)),o||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==t&&(1==this.query.length?n={from:e,to:e+1}:this.matches.push(1,e)),n&&this.test&&!this.test(n.from,n.to,this.buffer,this.bufferStart)&&(n=null),n}}]),t}();"undefined"!=typeof Symbol&&(po.prototype[Symbol.iterator]=function(){return this});var mo={from:-1,to:-1,match:/.*/.exec("")},yo="gm"+(null==/x/.unicode?"":"u"),ko=function(){function t(e,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e.length;if((0,h.Z)(this,t),this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=mo,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new xo(e,n,i,r,o);this.re=new RegExp(n,yo+((null==i?void 0:i.ignoreCase)?"i":"")),this.test=null==i?void 0:i.test,this.iter=e.iter();var s=e.lineAt(r);this.curLineStart=s.from,this.matchPos=So(e,r),this.getLine(this.curLineStart)}return(0,u.Z)(t,[{key:"getLine",value:function(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(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}},{key:"next",value:function(){for(var t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;var e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){var n=this.curLineStart+e.index,i=n+e[0].length;if(this.matchPos=So(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<i||n>this.value.to)&&(!this.test||this.test(n,i,e)))return this.value={from:n,to:i,match:e},this;t=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),t=0}}}}]),t}(),wo=new WeakMap,bo=function(){function t(e,n){(0,h.Z)(this,t),this.from=e,this.text=n}return(0,u.Z)(t,[{key:"to",get:function(){return this.from+this.text.length}}],[{key:"get",value:function(e,n,i){var r=wo.get(e);if(!r||r.from>=i||r.to<=n){var o=new t(n,e.sliceString(n,i));return wo.set(e,o),o}if(r.from==n&&r.to==i)return r;var s=r.text,a=r.from;return a>n&&(s=e.sliceString(n,a)+s,a=n),r.to<i&&(s+=e.sliceString(r.to,i)),wo.set(e,new t(a,s)),new t(n,s.slice(n-a,i-a))}}]),t}(),xo=function(){function t(e,n,i,r,o){(0,h.Z)(this,t),this.text=e,this.to=o,this.done=!1,this.value=mo,this.matchPos=So(e,r),this.re=new RegExp(n,yo+((null==i?void 0:i.ignoreCase)?"i":"")),this.test=null==i?void 0:i.test,this.flat=bo.get(e,r,this.chunkEnd(r+5e3))}return(0,u.Z)(t,[{key:"chunkEnd",value:function(t){return t>=this.to?this.to:this.text.lineAt(t).to}},{key:"next",value:function(){for(;;){var t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){var n=this.flat.from+e.index,i=n+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,i,e)))return this.value={from:n,to:i,match:e},this.matchPos=So(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=bo.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}]),t}();function So(t,e){if(e>=t.length)return e;for(var n,i=t.lineAt(e);e<i.to&&(n=i.text.charCodeAt(e-i.from))>=56320&&n<57344;)e++;return e}function Ao(t){var e=fo("input",{class:"cm-textfield",name:"line",value:String(t.state.doc.lineAt(t.state.selection.main.head).number)});function n(){var n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(n){var i=t.state,r=i.doc.lineAt(i.selection.main.head),o=(0,a.Z)(n,5),s=o[1],h=o[2],u=o[3],l=o[4],c=u?+u.slice(1):0,f=h?+h:r.number;if(h&&l){var d=f/100;s&&(d=d*("-"==s?-1:1)+r.number/i.doc.lines),f=Math.round(i.doc.lines*d)}else h&&s&&(f=f*("-"==s?-1:1)+r.number);var v=i.doc.line(Math.max(1,Math.min(i.doc.lines,f))),g=K.cursor(v.from+Math.max(0,Math.min(c,v.length)));t.dispatch({effects:[Mo.of(!1),zr.scrollIntoView(g.from,{y:"center"})],selection:g}),t.focus()}}return{dom:fo("form",{class:"cm-gotoLine",onkeydown:function(e){27==e.keyCode?(e.preventDefault(),t.dispatch({effects:Mo.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),n())},onsubmit:function(t){t.preventDefault(),n()}},fo("label",t.state.phrase("Go to line"),": ",e)," ",fo("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(ko.prototype[Symbol.iterator]=xo.prototype[Symbol.iterator]=function(){return this});var Mo=At.define(),Zo=et.define({create:function(){return!0},update:function(t,e){var n,i=(0,s.Z)(e.effects);try{for(i.s();!(n=i.n()).done;){var r=n.value;r.is(Mo)&&(t=r.value)}}catch(o){i.e(o)}finally{i.f()}return t},provide:function(t){return uo.from(t,(function(t){return t?Ao:null}))}}),Co=zr.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Oo={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},To=G.define({combine:function(t){return Lt(t,Oo,{highlightWordAroundCursor:function(t,e){return t||e},minSelectionLength:Math.min,maxMatches:Math.min})}});function Do(t){var e=[Po,Io];return t&&e.push(To.of(t)),e}var Eo=nn.mark({class:"cm-selectionMatch"}),Bo=nn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ro(t,e,n,i){return!(0!=n&&t(e.sliceDoc(n-1,n))==Rt.Word||i!=e.doc.length&&t(e.sliceDoc(i,i+1))==Rt.Word)}var Io=Tn.fromClass(function(){function t(e){(0,h.Z)(this,t),this.decorations=this.getDeco(e)}return(0,u.Z)(t,[{key:"update",value:function(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}},{key:"getDeco",value:function(t){var e=t.state.facet(To),n=t.state,i=n.selection;if(i.ranges.length>1)return nn.none;var r,o=i.main,a=null;if(o.empty){if(!e.highlightWordAroundCursor)return nn.none;var h=n.wordAt(o.head);if(!h)return nn.none;a=n.charCategorizer(o.head),r=n.sliceDoc(h.from,h.to)}else{var u=o.to-o.from;if(u<e.minSelectionLength||u>200)return nn.none;if(e.wholeWords){if(r=n.sliceDoc(o.from,o.to),!Ro(a=n.charCategorizer(o.head),n,o.from,o.to)||!function(t,e,n,i){return t(e.sliceDoc(n,n+1))==Rt.Word&&t(e.sliceDoc(i-1,i))==Rt.Word}(a,n,o.from,o.to))return nn.none}else if(!(r=n.sliceDoc(o.from,o.to).trim()))return nn.none}var l,c=[],f=(0,s.Z)(t.visibleRanges);try{for(f.s();!(l=f.n()).done;)for(var d=l.value,v=new po(n.doc,r,d.from,d.to);!v.next().done;){var g=v.value,p=g.from,m=g.to;if((!a||Ro(a,n,p,m))&&(o.empty&&p<=o.from&&m>=o.to?c.push(Bo.range(p,m)):(p>=o.to||m<=o.from)&&c.push(Eo.range(p,m)),c.length>e.maxMatches))return nn.none}}catch(y){f.e(y)}finally{f.f()}return nn.set(c)}}]),t}(),{decorations:function(t){return t.decorations}}),Po=zr.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});var No=G.define({combine:function(t){return Lt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:function(t){return new cs(t)},scrollToMatch:function(t){return zr.scrollIntoView(t)}})}});var Lo=function(){function t(e){(0,h.Z)(this,t),this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,yo),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}return(0,u.Z)(t,[{key:"unquote",value:function(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(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(){return this.regexp?new qo(this):new Wo(this)}},{key:"getCursor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,i=t.doc?t:Nt.create({doc:t});return null==n&&(n=i.doc.length),this.regexp?_o(this,i,e,n):Ho(this,i,e,n)}}]),t}(),Vo=(0,u.Z)((function t(e){(0,h.Z)(this,t),this.spec=e}));function Ho(t,e,n,i){return new po(e.doc,t.unquoted,n,i,t.caseSensitive?void 0:function(t){return t.toLowerCase()},t.wholeWord?function(t,e){return function(n,i,r,o){return(o>n||o+r.length<i)&&(o=Math.max(0,n-2),r=t.sliceString(o,Math.min(t.length,i+2))),!(e(zo(r,n-o))==Rt.Word&&e(Fo(r,n-o))==Rt.Word||e(Fo(r,i-o))==Rt.Word&&e(zo(r,i-o))==Rt.Word)}}(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}var Wo=function(t){function e(t){return(0,h.Z)(this,e),(0,r.Z)(this,e,[t])}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"nextMatch",value:function(t,e,n){var i=Ho(this.spec,t,n,t.doc.length).nextOverlapping();return i.done&&(i=Ho(this.spec,t,0,e).nextOverlapping()),i.done?null:i.value}},{key:"prevMatchInRange",value:function(t,e,n){for(var i=n;;){for(var r=Math.max(e,i-1e4-this.spec.unquoted.length),o=Ho(this.spec,t,r,i),s=null;!o.nextOverlapping().done;)s=o.value;if(s)return s;if(r==e)return null;i-=1e4}}},{key:"prevMatch",value:function(t,e,n){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,n,t.doc.length)}},{key:"getReplacement",value:function(t){return this.spec.unquote(this.spec.replace)}},{key:"matchAll",value:function(t,e){for(var n=Ho(this.spec,t,0,t.doc.length),i=[];!n.next().done;){if(i.length>=e)return null;i.push(n.value)}return i}},{key:"highlight",value:function(t,e,n,i){for(var r=Ho(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,t.doc.length));!r.next().done;)i(r.value.from,r.value.to)}}]),e}(Vo);function _o(t,e,n,i){return new ko(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(r=e.charCategorizer(e.selection.main.head),function(t,e,n){return!n[0].length||(r(zo(n.input,n.index))!=Rt.Word||r(Fo(n.input,n.index))!=Rt.Word)&&(r(Fo(n.input,n.index+n[0].length))!=Rt.Word||r(zo(n.input,n.index+n[0].length))!=Rt.Word)}):void 0},n,i);var r}function zo(t,e){return t.slice(C(t,e,!1),e)}function Fo(t,e){return t.slice(e,C(t,e))}var qo=function(t){function e(){return(0,h.Z)(this,e),(0,r.Z)(this,e,arguments)}return(0,o.Z)(e,t),(0,u.Z)(e,[{key:"nextMatch",value:function(t,e,n){var i=_o(this.spec,t,n,t.doc.length).next();return i.done&&(i=_o(this.spec,t,0,e).next()),i.done?null:i.value}},{key:"prevMatchInRange",value:function(t,e,n){for(var i=1;;i++){for(var r=Math.max(e,n-1e4*i),o=_o(this.spec,t,r,n),s=null;!o.next().done;)s=o.value;if(s&&(r==e||s.from>r+10))return s;if(r==e)return null}}},{key:"prevMatch",value:function(t,e,n){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,n,t.doc.length)}},{key:"getReplacement",value:function(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(function(e,n){return"$"==n?"$":"&"==n?t.match[0]:"0"!=n&&+n<t.match.length?t.match[n]:e}))}},{key:"matchAll",value:function(t,e){for(var n=_o(this.spec,t,0,t.doc.length),i=[];!n.next().done;){if(i.length>=e)return null;i.push(n.value)}return i}},{key:"highlight",value:function(t,e,n,i){for(var r=_o(this.spec,t,Math.max(0,e-250),Math.min(n+250,t.doc.length));!r.next().done;)i(r.value.from,r.value.to)}}]),e}(Vo),jo=At.define(),Ko=At.define(),Jo=et.define({create:function(t){return new Uo(os(t).create(),null)},update:function(t,e){var n,i=(0,s.Z)(e.effects);try{for(i.s();!(n=i.n()).done;){var r=n.value;r.is(jo)?t=new Uo(r.value.create(),t.panel):r.is(Ko)&&(t=new Uo(t.query,r.value?rs:null))}}catch(o){i.e(o)}finally{i.f()}return t},provide:function(t){return uo.from(t,(function(t){return t.panel}))}});var Uo=(0,u.Z)((function t(e,n){(0,h.Z)(this,t),this.query=e,this.panel=n})),Go=nn.mark({class:"cm-searchMatch"}),$o=nn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Xo=Tn.fromClass(function(){function t(e){(0,h.Z)(this,t),this.view=e,this.decorations=this.highlight(e.state.field(Jo))}return(0,u.Z)(t,[{key:"update",value:function(t){var e=t.state.field(Jo);(e!=t.startState.field(Jo)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}},{key:"highlight",value:function(t){var e=t.query;if(!t.panel||!e.spec.valid)return nn.none;for(var n=this.view,i=new Ft,r=0,o=n.visibleRanges,s=o.length;r<s;r++){for(var a=o[r],h=a.from,u=a.to;r<s-1&&u>o[r+1].from-500;)u=o[++r].to;e.highlight(n.state,h,u,(function(t,e){var r=n.state.selection.ranges.some((function(n){return n.from==t&&n.to==e}));i.add(t,e,r?$o:Go)}))}return i.finish()}}]),t}(),{decorations:function(t){return t.decorations}});function Yo(t){return function(e){var n=e.state.field(Jo,!1);return n&&n.query.spec.valid?t(e,n):hs(e)}}var Qo=Yo((function(t,e){var n=e.query,i=t.state.selection.main.to,r=n.nextMatch(t.state,i,i);if(!r)return!1;var o=K.single(r.from,r.to),s=t.state.facet(No);return t.dispatch({selection:o,effects:[gs(t,r),s.scrollToMatch(o.main,t)],userEvent:"select.search"}),as(t),!0})),ts=Yo((function(t,e){var n=e.query,i=t.state,r=i.selection.main.from,o=n.prevMatch(i,r,r);if(!o)return!1;var s=K.single(o.from,o.to),a=t.state.facet(No);return t.dispatch({selection:s,effects:[gs(t,o),a.scrollToMatch(s.main,t)],userEvent:"select.search"}),as(t),!0})),es=Yo((function(t,e){var n=e.query.matchAll(t.state,1e3);return!(!n||!n.length)&&(t.dispatch({selection:K.create(n.map((function(t){return K.range(t.from,t.to)}))),userEvent:"select.search.matches"}),!0)})),ns=Yo((function(t,e){var n=e.query,i=t.state,r=i.selection.main,o=r.from,s=r.to;if(i.readOnly)return!1;var a=n.nextMatch(i,o,o);if(!a)return!1;var h,u,l=[],c=[];if(a.from==o&&a.to==s&&(u=i.toText(n.getReplacement(a)),l.push({from:a.from,to:a.to,insert:u}),a=n.nextMatch(i,a.from,a.to),c.push(zr.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(o).number)+"."))),a){var f=0==l.length||l[0].from>=a.to?0:a.to-a.from-u.length;h=K.single(a.from-f,a.to-f),c.push(gs(t,a)),c.push(i.facet(No).scrollToMatch(h.main,t))}return t.dispatch({changes:l,selection:h,effects:c,userEvent:"input.replace"}),!0})),is=Yo((function(t,e){var n=e.query;if(t.state.readOnly)return!1;var i=n.matchAll(t.state,1e9).map((function(t){return{from:t.from,to:t.to,insert:n.getReplacement(t)}}));if(!i.length)return!1;var r=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:zr.announce.of(r),userEvent:"input.replace.all"}),!0}));function rs(t){return t.state.facet(No).createPanel(t)}function os(t,e){var n,i,r,o,s,a=t.selection.main,h=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!h)return e;var u=t.facet(No);return new Lo({search:(null!==(n=null==e?void 0:e.literal)&&void 0!==n?n:u.literal)?h:h.replace(/\n/g,"\\n"),caseSensitive:null!==(i=null==e?void 0:e.caseSensitive)&&void 0!==i?i:u.caseSensitive,literal:null!==(r=null==e?void 0:e.literal)&&void 0!==r?r:u.literal,regexp:null!==(o=null==e?void 0:e.regexp)&&void 0!==o?o:u.regexp,wholeWord:null!==(s=null==e?void 0:e.wholeWord)&&void 0!==s?s:u.wholeWord})}function ss(t){var e=oo(t,rs);return e&&e.dom.querySelector("[main-field]")}function as(t){var e=ss(t);e&&e==t.root.activeElement&&e.select()}var hs=function(t){var e=t.state.field(Jo,!1);if(e&&e.panel){var n=ss(t);if(n&&n!=t.root.activeElement){var i=os(t.state,e.query.spec);i.valid&&t.dispatch({effects:jo.of(i)}),n.focus(),n.select()}}else t.dispatch({effects:[Ko.of(!0),e?jo.of(os(t.state,e.query.spec)):At.appendConfig.of(ms)]});return!0},us=function(t){var e=t.state.field(Jo,!1);if(!e||!e.panel)return!1;var n=oo(t,rs);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Ko.of(!1)}),!0},ls=[{key:"Mod-f",run:hs,scope:"editor search-panel"},{key:"F3",run:Qo,shift:ts,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Qo,shift:ts,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:us,scope:"editor search-panel"},{key:"Mod-Shift-l",run:function(t){var e=t.state,n=t.dispatch,i=e.selection;if(i.ranges.length>1||i.main.empty)return!1;for(var r=i.main,o=r.from,s=r.to,a=[],h=0,u=new po(e.doc,e.sliceDoc(o,s));!u.next().done;){if(a.length>1e3)return!1;u.value.from==o&&(h=a.length),a.push(K.range(u.value.from,u.value.to))}return n(e.update({selection:K.create(a,h),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:function(t){var e=oo(t,Ao);if(!e){var n=[Mo.of(!0)];null==t.state.field(Zo,!1)&&n.push(At.appendConfig.of([Zo,Co])),t.dispatch({effects:n}),e=oo(t,Ao)}return e&&e.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:function(t){var e=t.state,n=t.dispatch,i=e.selection.ranges;if(i.some((function(t){return t.from===t.to})))return function(t){var e=t.state,n=t.dispatch,i=e.selection,r=K.create(i.ranges.map((function(t){return e.wordAt(t.head)||K.cursor(t.head)})),i.mainIndex);return!r.eq(i)&&(n(e.update({selection:r})),!0)}({state:e,dispatch:n});var r=e.sliceDoc(i[0].from,i[0].to);if(e.selection.ranges.some((function(t){return e.sliceDoc(t.from,t.to)!=r})))return!1;var o=function(t,e){for(var n,i=t.selection,r=i.main,o=i.ranges,s=t.wordAt(r.head),a=s&&s.from==r.from&&s.to==r.to,h=function(n,i){if(i.next(),!i.done){if(n&&o.some((function(t){return t.from==i.value.from})))return u=n,l=i,0;if(a){var r=t.wordAt(i.value.from);if(!r||r.from!=i.value.from||r.to!=i.value.to)return u=n,l=i,0}return{v:i.value}}if(n)return{v:null};i=new po(t.doc,e,0,Math.max(0,o[o.length-1].from-1)),u=n=!0,l=i},u=!1,l=new po(t.doc,e,o[o.length-1].to);;)if(0!==(n=h(u,l))&&n)return n.v}(e,r);return!!o&&(n(e.update({selection:e.selection.addRange(K.range(o.from,o.to),!1),effects:zr.scrollIntoView(o.to)})),!0)},preventDefault:!0}],cs=function(){function t(e){var n=this;(0,h.Z)(this,t),this.view=e;var r=this.query=e.state.field(Jo).query.spec;function o(t,e,n){return fo("button",{class:"cm-button",name:t,onclick:e,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=fo("input",{value:r.search,placeholder:fs(e,"Find"),"aria-label":fs(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=fo("input",{value:r.replace,placeholder:fs(e,"Replace"),"aria-label":fs(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=fo("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=fo("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=fo("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit}),this.dom=fo("div",{onkeydown:function(t){return n.keydown(t)},class:"cm-search"},[this.searchField,o("next",(function(){return Qo(e)}),[fs(e,"next")]),o("prev",(function(){return ts(e)}),[fs(e,"previous")]),o("select",(function(){return es(e)}),[fs(e,"all")]),fo("label",null,[this.caseField,fs(e,"match case")]),fo("label",null,[this.reField,fs(e,"regexp")]),fo("label",null,[this.wordField,fs(e,"by word")])].concat((0,i.Z)(e.state.readOnly?[]:[fo("br"),this.replaceField,o("replace",(function(){return ns(e)}),[fs(e,"replace")]),o("replaceAll",(function(){return is(e)}),[fs(e,"replace all")])]),[fo("button",{name:"close",onclick:function(){return us(e)},"aria-label":fs(e,"close"),type:"button"},["×"])]))}return(0,u.Z)(t,[{key:"commit",value:function(){var t=new Lo({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:jo.of(t)}))}},{key:"keydown",value:function(t){var e,n,i;e=this.view,n=t,i="search-panel",eo(Yr(e.state),n,e,i)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ts:Qo)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),ns(this.view))}},{key:"update",value:function(t){var e,n=(0,s.Z)(t.transactions);try{for(n.s();!(e=n.n()).done;){var i,r=e.value,o=(0,s.Z)(r.effects);try{for(o.s();!(i=o.n()).done;){var a=i.value;a.is(jo)&&!a.value.eq(this.query)&&this.setQuery(a.value)}}catch(h){o.e(h)}finally{o.f()}}}catch(h){n.e(h)}finally{n.f()}}},{key:"setQuery",value:function(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(){this.searchField.select()}},{key:"pos",get:function(){return 80}},{key:"top",get:function(){return this.view.state.facet(No).top}}]),t}();function fs(t,e){return t.state.phrase(e)}var ds=30,vs=/[\s\.,:;?!]/;function gs(t,e){var n=e.from,i=e.to,r=t.state.doc.lineAt(n),o=t.state.doc.lineAt(i).to,s=Math.max(r.from,n-ds),a=Math.min(o,i+ds),h=t.state.sliceDoc(s,a);if(s!=r.from)for(var u=0;u<ds;u++)if(!vs.test(h[u+1])&&vs.test(h[u])){h=h.slice(u);break}if(a!=o)for(var l=h.length-1;l>h.length-ds;l--)if(!vs.test(h[l-1])&&vs.test(h[l])){h=h.slice(0,l);break}return zr.announce.of("".concat(t.state.phrase("current match"),". ").concat(h," ").concat(t.state.phrase("on line")," ").concat(r.number,"."))}var ps=zr.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"}}),ms=[Jo,at.low(Xo),ps]},74075:function(t,e,n){n.d(e,{BO:function(){return Nt},D0:function(){return Bt},F6:function(){return ht},Gz:function(){return te},IS:function(){return Qt},Py:function(){return St},QQ:function(){return tt},Wl:function(){return st},Xs:function(){return _t},YW:function(){return At},as:function(){return L},bg:function(){return B},cp:function(){return Z},f_:function(){return zt},gc:function(){return P},gm:function(){return E},jT:function(){return j},n0:function(){return N},nZ:function(){return R},q6:function(){return wt},r$:function(){return U},uU:function(){return Lt},xv:function(){return c},yy:function(){return Pt}});var i=n(40039),r=n(68308),o=n(34541),s=n(47838),a=n(69205),h=n(62746),u=n(71650),l=n(33368),c=(n(51467),n(97393),n(63789),n(24074),n(57778),n(17692),n(36513),n(34997),n(46798),n(9849),n(12148),n(94738),n(98214),n(20254),n(51358),n(5239),n(98490),n(46349),n(70320),n(27392),n(13526),n(54299),n(71779),n(80641),n(37313),n(56308),n(41353),n(49089),n(87438),n(22890),n(85472),n(90126),n(96043),n(65974),n(10999),n(52117),n(82479),n(94570),n(99397),n(50289),n(94167),n(91989),n(86439),n(78399),n(56086),n(47884),n(81912),n(64584),n(41483),n(12367),n(9454),n(64777),function(){function t(){(0,u.Z)(this,t)}return(0,l.Z)(t,[{key:"lineAt",value:function(t){if(t<0||t>this.length)throw new RangeError("Invalid position ".concat(t," in document of length ").concat(this.length));return this.lineInner(t,!1,1,0)}},{key:"line",value:function(t){if(t<1||t>this.lines)throw new RangeError("Invalid line number ".concat(t," in ").concat(this.lines,"-line document"));return this.lineInner(t,!0,1,0)}},{key:"replace",value:function(t,e,n){var i=w(this,t,e),r=(0,h.Z)(i,2);t=r[0],e=r[1];var o=[];return this.decompose(0,t,o,2),n.length&&n.decompose(0,n.length,o,3),this.decompose(e,this.length,o,1),d.from(o,this.length-(e-t)+n.length)}},{key:"append",value:function(t){return this.replace(this.length,this.length,t)}},{key:"slice",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=w(this,t,e),i=(0,h.Z)(n,2);t=i[0],e=i[1];var r=[];return this.decompose(t,e,r,0),d.from(r,e-t)}},{key:"eq",value:function(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;for(var e=this.scanIdentical(t,1),n=this.length-this.scanIdentical(t,-1),i=new p(this),r=new p(t),o=e,s=e;;){if(i.next(o),r.next(o),o=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}},{key:"iter",value:function(){return new p(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)}},{key:"iterRange",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return new m(this,t,e)}},{key:"iterLines",value:function(t,e){var n;if(null==t)n=this.iter();else{null==e&&(e=this.lines+1);var i=this.line(t).from;n=this.iterRange(i,Math.max(i,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new y(n)}},{key:"toString",value:function(){return this.sliceString(0)}},{key:"toJSON",value:function(){var t=[];return this.flatten(t),t}}],[{key:"of",value:function(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new f(e):d.from(f.split(e,[])):t.empty}}]),t}()),f=function(t){function e(t){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){var e,n=-1,r=(0,i.Z)(t);try{for(r.s();!(e=r.n()).done;){n+=e.value.length+1}}catch(o){r.e(o)}finally{r.f()}return n}(t);return(0,u.Z)(this,e),(n=(0,r.Z)(this,e)).text=t,n.length=o,n}return(0,a.Z)(e,t),(0,l.Z)(e,[{key:"lines",get:function(){return this.text.length}},{key:"children",get:function(){return null}},{key:"lineInner",value:function(t,e,n,i){for(var r=0;;r++){var o=this.text[r],s=i+o.length;if((e?n:s)>=t)return new k(i,s,n,o);i=s+1,n++}}},{key:"decompose",value:function(t,n,i,r){var o=t<=0&&n>=this.length?this:new e(g(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(1&r){var s=i.pop(),a=v(o.text,s.text.slice(),0,o.length);if(a.length<=32)i.push(new e(a,s.length+o.length));else{var h=a.length>>1;i.push(new e(a.slice(0,h)),new e(a.slice(h)))}}else i.push(o)}},{key:"replace",value:function(t,n,i){if(!(i instanceof e))return(0,o.Z)((0,s.Z)(e.prototype),"replace",this).call(this,t,n,i);var r=w(this,t,n),a=(0,h.Z)(r,2);t=a[0],n=a[1];var u=v(this.text,v(i.text,g(this.text,0,t)),n),l=this.length+i.length-(n-t);return u.length<=32?new e(u,l):d.from(e.split(u,[]),l)}},{key:"sliceString",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",i=w(this,t,e),r=(0,h.Z)(i,2);t=r[0],e=r[1];for(var o="",s=0,a=0;s<=e&&a<this.text.length;a++){var u=this.text[a],l=s+u.length;s>t&&a&&(o+=n),t<l&&e>s&&(o+=u.slice(Math.max(0,t-s),e-s)),s=l+1}return o}},{key:"flatten",value:function(t){var e,n=(0,i.Z)(this.text);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.push(r)}}catch(o){n.e(o)}finally{n.f()}}},{key:"scanIdentical",value:function(){return 0}}],[{key:"split",value:function(t,n){var r,o=[],s=-1,a=(0,i.Z)(t);try{for(a.s();!(r=a.n()).done;){var h=r.value;o.push(h),s+=h.length+1,32==o.length&&(n.push(new e(o,s)),o=[],s=-1)}}catch(u){a.e(u)}finally{a.f()}return s>-1&&n.push(new e(o,s)),n}}]),e}(c),d=function(t){function e(t,n){var o;(0,u.Z)(this,e),(o=(0,r.Z)(this,e)).children=t,o.length=n,o.lines=0;var s,a=(0,i.Z)(t);try{for(a.s();!(s=a.n()).done;){var h=s.value;o.lines+=h.lines}}catch(l){a.e(l)}finally{a.f()}return o}return(0,a.Z)(e,t),(0,l.Z)(e,[{key:"lineInner",value:function(t,e,n,i){for(var r=0;;r++){var o=this.children[r],s=i+o.length,a=n+o.lines-1;if((e?a:s)>=t)return o.lineInner(t,e,n,i);i=s+1,n=a+1}}},{key:"decompose",value:function(t,e,n,i){for(var r=0,o=0;o<=e&&r<this.children.length;r++){var s=this.children[r],a=o+s.length;if(t<=a&&e>=o){var h=i&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?n.push(s):s.decompose(t-o,e-o,n,h)}o=a+1}}},{key:"replace",value:function(t,n,i){var r=w(this,t,n),a=(0,h.Z)(r,2);if(t=a[0],n=a[1],i.lines<this.lines)for(var u=0,l=0;u<this.children.length;u++){var c=this.children[u],f=l+c.length;if(t>=l&&n<=f){var d=c.replace(t-l,n-l,i),v=this.lines-c.lines+d.lines;if(d.lines<v>>4&&d.lines>v>>6){var g=this.children.slice();return g[u]=d,new e(g,this.length-(n-t)+i.length)}return(0,o.Z)((0,s.Z)(e.prototype),"replace",this).call(this,l,f,d)}l=f+1}return(0,o.Z)((0,s.Z)(e.prototype),"replace",this).call(this,t,n,i)}},{key:"sliceString",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",i=w(this,t,e),r=(0,h.Z)(i,2);t=r[0],e=r[1];for(var o="",s=0,a=0;s<this.children.length&&a<=e;s++){var u=this.children[s],l=a+u.length;a>t&&s&&(o+=n),t<l&&e>a&&(o+=u.sliceString(t-a,e-a,n)),a=l+1}return o}},{key:"flatten",value:function(t){var e,n=(0,i.Z)(this.children);try{for(n.s();!(e=n.n()).done;){e.value.flatten(t)}}catch(r){n.e(r)}finally{n.f()}}},{key:"scanIdentical",value:function(t,n){if(!(t instanceof e))return 0;for(var i=0,r=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1],o=(0,h.Z)(r,4),s=o[0],a=o[1],u=o[2],l=o[3];;s+=n,a+=n){if(s==u||a==l)return i;var c=this.children[s],f=t.children[a];if(c!=f)return i+c.scanIdentical(f,n);i+=c.length+1}}}],[{key:"from",value:function(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.reduce((function(t,e){return t+e.length+1}),-1),o=0,s=(0,i.Z)(t);try{for(s.s();!(n=s.n()).done;){o+=n.value.lines}}catch(x){s.e(x)}finally{s.f()}if(o<32){var a,h=[],u=(0,i.Z)(t);try{for(u.s();!(a=u.n()).done;){a.value.flatten(h)}}catch(x){u.e(x)}finally{u.f()}return new f(h,r)}var l=Math.max(32,o>>5),c=l<<1,d=l>>1,v=[],g=0,p=-1,m=[];function y(t){var n;if(t.lines>c&&t instanceof e){var r,o=(0,i.Z)(t.children);try{for(o.s();!(r=o.n()).done;){y(r.value)}}catch(x){o.e(x)}finally{o.f()}}else t.lines>d&&(g>d||!g)?(k(),v.push(t)):t instanceof f&&g&&(n=m[m.length-1])instanceof f&&t.lines+n.lines<=32?(g+=t.lines,p+=t.length+1,m[m.length-1]=new f(n.text.concat(t.text),n.length+1+t.length)):(g+t.lines>l&&k(),g+=t.lines,p+=t.length+1,m.push(t))}function k(){0!=g&&(v.push(1==m.length?m[0]:e.from(m,p)),p=-1,g=m.length=0)}var w,b=(0,i.Z)(t);try{for(b.s();!(w=b.n()).done;){y(w.value)}}catch(x){b.e(x)}finally{b.f()}return k(),1==v.length?v[0]:new e(v,r)}}]),e}(c);function v(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e9,r=0,o=0,s=!0;o<t.length&&r<=i;o++){var a=t[o],h=r+a.length;h>=n&&(h>i&&(a=a.slice(0,i-r)),r<n&&(a=a.slice(n-r)),s?(e[e.length-1]+=a,s=!1):e.push(a)),r=h+1}return e}function g(t,e,n){return v(t,[""],e,n)}c.empty=new f([""],0);var p=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;(0,u.Z)(this,t),this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof f?e.text.length:e.children.length)<<1]}return(0,l.Z)(t,[{key:"nextInner",value:function(t,e){for(this.done=this.lineBreak=!1;;){var n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],o=r>>1,s=i instanceof f?i.text.length:i.children.length;if(o==(e>0?s:0)){if(0==n)return this.done=!0,this.value="",this;e>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(e>0?0:1)){if(this.offsets[n]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(i instanceof f){var a=i.text[o+(e<0?-1:0)];if(this.offsets[n]+=e,a.length>Math.max(0,t))return this.value=0==t?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{var h=i.children[o+(e<0?-1:0)];t>h.length?(t-=h.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(h),this.offsets.push(e>0?1:(h instanceof f?h.text.length:h.children.length)<<1))}}}},{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}]),t}(),m=function(){function t(e,n,i){(0,u.Z)(this,t),this.value="",this.done=!1,this.cursor=new p(e,n>i?-1:1),this.pos=n>i?e.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}return(0,l.Z)(t,[{key:"nextInner",value:function(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 n=e<0?this.pos-this.from:this.to-this.pos;t>n&&(t=n),n-=t;var i=this.cursor.next(t).value;return this.pos+=(i.length+t)*e,this.value=i.length<=n?i:e<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}},{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?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(){return this.cursor.lineBreak&&""!=this.value}}]),t}(),y=function(){function t(e){(0,u.Z)(this,t),this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}return(0,l.Z)(t,[{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.inner.next(t),n=e.done,i=e.lineBreak,r=e.value;return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}},{key:"lineBreak",get:function(){return!1}}]),t}();"undefined"!=typeof Symbol&&(c.prototype[Symbol.iterator]=function(){return this.iter()},p.prototype[Symbol.iterator]=m.prototype[Symbol.iterator]=y.prototype[Symbol.iterator]=function(){return this});var k=function(){function t(e,n,i,r){(0,u.Z)(this,t),this.from=e,this.to=n,this.number=i,this.text=r}return(0,l.Z)(t,[{key:"length",get:function(){return this.to-this.from}}]),t}();function w(t,e,n){return[e=Math.max(0,Math.min(t.length,e)),Math.max(e,Math.min(t.length,n))]}for(var b="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})),x=1;x<b.length;x++)b[x]+=b[x-1];function S(t){for(var e=1;e<b.length;e+=2)if(b[e]>t)return b[e-1]<=t;return!1}function A(t){return t>=127462&&t<=127487}var M=8205;function Z(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?C:O)(t,e,!(arguments.length>3&&void 0!==arguments[3])||arguments[3])}function C(t,e,n){if(e==t.length)return e;e&&T(t.charCodeAt(e))&&D(t.charCodeAt(e-1))&&e--;var i=E(t,e);for(e+=R(i);e<t.length;){var r=E(t,e);if(i==M||r==M||n&&S(r))e+=R(r),i=r;else{if(!A(r))break;for(var o=0,s=e-2;s>=0&&A(E(t,s));)o++,s-=2;if(o%2==0)break;e+=2}}return e}function O(t,e,n){for(;e>0;){var i=C(t,e-2,n);if(i<e)return i;e--}return 0}function T(t){return t>=56320&&t<57344}function D(t){return t>=55296&&t<56320}function E(t,e){var n=t.charCodeAt(e);if(!D(n)||e+1==t.length)return n;var i=t.charCodeAt(e+1);return T(i)?i-56320+(n-55296<<10)+65536:n}function B(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function R(t){return t<65536?1:2}var I=/\r\n?|\n/,P=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(P||(P={})),N=function(){function t(e){(0,u.Z)(this,t),this.sections=e}return(0,l.Z)(t,[{key:"length",get:function(){for(var t=0,e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}},{key:"newLength",get:function(){for(var t=0,e=0;e<this.sections.length;e+=2){var n=this.sections[e+1];t+=n<0?this.sections[e]:n}return t}},{key:"empty",get:function(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}},{key:"iterGaps",value:function(t){for(var e=0,n=0,i=0;e<this.sections.length;){var r=this.sections[e++],o=this.sections[e++];o<0?(t(n,i,r),i+=r):i+=o,n+=r}}},{key:"iterChangedRanges",value:function(t){W(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"invertedDesc",get:function(){for(var e=[],n=0;n<this.sections.length;){var i=this.sections[n++],r=this.sections[n++];r<0?e.push(i,r):e.push(r,i)}return new t(e)}},{key:"composeDesc",value:function(t){return this.empty?t:t.empty?this:z(this,t)}},{key:"mapDesc",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:_(this,t,e)}},{key:"mapPos",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:P.Simple,i=0,r=0,o=0;o<this.sections.length;){var s=this.sections[o++],a=this.sections[o++],h=i+s;if(a<0){if(h>t)return r+(t-i);r+=s}else{if(n!=P.Simple&&h>=t&&(n==P.TrackDel&&i<t&&h>t||n==P.TrackBefore&&i<t||n==P.TrackAfter&&h>t))return null;if(h>t||h==t&&e<0&&!s)return t==i||e<0?r:r+a;r+=a}i=h}if(t>i)throw new RangeError("Position ".concat(t," is out of range for changeset of length ").concat(i));return r}},{key:"touchesRange",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=0,i=0;n<this.sections.length&&i<=e;){var r=i+this.sections[n++];if(this.sections[n++]>=0&&i<=e&&r>=t)return!(i<t&&r>e)||"cover";i=r}return!1}},{key:"toString",value:function(){for(var t="",e=0;e<this.sections.length;){var n=this.sections[e++],i=this.sections[e++];t+=(t?" ":"")+n+(i>=0?":"+i:"")}return t}},{key:"toJSON",value:function(){return this.sections}}],[{key:"fromJSON",value:function(e){if(!Array.isArray(e)||e.length%2||e.some((function(t){return"number"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}},{key:"create",value:function(e){return new t(e)}}]),t}(),L=function(t){function e(t,n){var i;return(0,u.Z)(this,e),(i=(0,r.Z)(this,e,[t])).inserted=n,i}return(0,a.Z)(e,t),(0,l.Z)(e,[{key:"apply",value:function(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return W(this,(function(e,n,i,r,o){return t=t.replace(i,i+(n-e),o)}),!1),t}},{key:"mapDesc",value:function(t){return _(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"invert",value:function(t){for(var n=this.sections.slice(),i=[],r=0,o=0;r<n.length;r+=2){var s=n[r],a=n[r+1];if(a>=0){n[r]=a,n[r+1]=s;for(var h=r>>1;i.length<h;)i.push(c.empty);i.push(s?t.slice(o,o+s):c.empty)}o+=s}return new e(n,i)}},{key:"compose",value:function(t){return this.empty?t:t.empty?this:z(this,t,!0)}},{key:"map",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:_(this,t,e,!0)}},{key:"iterChanges",value:function(t){W(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"desc",get:function(){return N.create(this.sections)}},{key:"filter",value:function(t){var n=[],i=[],r=[],o=new F(this);t:for(var s=0,a=0;;){for(var h=s==t.length?1e9:t[s++];a<h||a==h&&0==o.len;){if(o.done)break t;var u=Math.min(o.len,h-a);V(r,u,-1);var l=-1==o.ins?-1:0==o.off?o.ins:0;V(n,u,l),l>0&&H(i,n,o.text),o.forward(u),a+=u}for(var c=t[s++];a<c;){if(o.done)break t;var f=Math.min(o.len,c-a);V(n,f,-1),V(r,f,-1==o.ins?-1:0==o.off?o.ins:0),o.forward(f),a+=f}}return{changes:new e(n,i),filtered:N.create(r)}}},{key:"toJSON",value:function(){for(var t=[],e=0;e<this.sections.length;e+=2){var n=this.sections[e],i=this.sections[e+1];i<0?t.push(n):0==i?t.push([n]):t.push([n].concat(this.inserted[e>>1].toJSON()))}return t}}],[{key:"of",value:function(t,n,r){var o=[],s=[],a=0,h=null;function u(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||o.length){a<n&&V(o,n-a,-1);var t=new e(o,s);h=h?h.compose(t.map(h)):t,o=[],s=[],a=0}}return function t(l){if(Array.isArray(l)){var f,d=(0,i.Z)(l);try{for(d.s();!(f=d.n()).done;){t(f.value)}}catch(w){d.e(w)}finally{d.f()}}else if(l instanceof e){if(l.length!=n)throw new RangeError("Mismatched change set length (got ".concat(l.length,", expected ").concat(n,")"));u(),h=h?h.compose(l.map(h)):l}else{var v=l.from,g=l.to,p=void 0===g?v:g,m=l.insert;if(v>p||v<0||p>n)throw new RangeError("Invalid change range ".concat(v," to ").concat(p," (in doc of length ").concat(n,")"));var y=m?"string"==typeof m?c.of(m.split(r||I)):m:c.empty,k=y.length;if(v==p&&0==k)return;v<a&&u(),v>a&&V(o,v-a,-1),V(o,p-v,k),H(s,o,y),a=p}}(t),u(!h),h}},{key:"empty",value:function(t){return new e(t?[t,-1]:[],[])}},{key:"fromJSON",value:function(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");for(var n=[],i=[],r=0;r<t.length;r++){var o=t[r];if("number"==typeof o)n.push(o,-1);else{if(!Array.isArray(o)||"number"!=typeof o[0]||o.some((function(t,e){return e&&"string"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==o.length)n.push(o[0],0);else{for(;i.length<r;)i.push(c.empty);i[r]=c.of(o.slice(1)),n.push(o[0],i[r].length)}}}return new e(n,i)}},{key:"createSet",value:function(t,n){return new e(t,n)}}]),e}(N);function V(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!(0==e&&n<=0)){var r=t.length-2;r>=0&&n<=0&&n==t[r+1]?t[r]+=e:0==e&&0==t[r]?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}}function H(t,e,n){if(0!=n.length){var i=e.length-2>>1;if(i<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<i;)t.push(c.empty);t.push(n)}}}function W(t,e,n){for(var i=t.inserted,r=0,o=0,s=0;s<t.sections.length;){var a=t.sections[s++],h=t.sections[s++];if(h<0)r+=a,o+=a;else{for(var u=r,l=o,f=c.empty;u+=a,l+=h,h&&i&&(f=f.append(i[s-2>>1])),!(n||s==t.sections.length||t.sections[s+1]<0);)a=t.sections[s++],h=t.sections[s++];e(r,u,o,l,f),r=u,o=l}}}function _(t,e,n){for(var i=[],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3]?[]:null,o=new F(t),s=new F(e),a=-1;;)if(-1==o.ins&&-1==s.ins){var h=Math.min(o.len,s.len);V(i,h,-1),o.forward(h),s.forward(h)}else if(s.ins>=0&&(o.ins<0||a==o.i||0==o.off&&(s.len<o.len||s.len==o.len&&!n))){var u=s.len;for(V(i,s.ins,-1);u;){var l=Math.min(o.len,u);o.ins>=0&&a<o.i&&o.len<=l&&(V(i,0,o.ins),r&&H(r,i,o.text),a=o.i),o.forward(l),u-=l}s.next()}else{if(!(o.ins>=0)){if(o.done&&s.done)return r?L.createSet(i,r):N.create(i);throw new Error("Mismatched change set lengths")}for(var c=0,f=o.len;f;)if(-1==s.ins){var d=Math.min(f,s.len);c+=d,f-=d,s.forward(d)}else{if(!(0==s.ins&&s.len<f))break;f-=s.len,s.next()}V(i,c,a<o.i?o.ins:0),r&&a<o.i&&H(r,i,o.text),a=o.i,o.forward(o.len-f)}}function z(t,e){for(var n=[],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2]?[]:null,r=new F(t),o=new F(e),s=!1;;){if(r.done&&o.done)return i?L.createSet(n,i):N.create(n);if(0==r.ins)V(n,r.len,0,s),r.next();else if(0!=o.len||o.done){if(r.done||o.done)throw new Error("Mismatched change set lengths");var a=Math.min(r.len2,o.len),h=n.length;if(-1==r.ins){var u=-1==o.ins?-1:o.off?0:o.ins;V(n,a,u,s),i&&u&&H(i,n,o.text)}else-1==o.ins?(V(n,r.off?0:r.len,a,s),i&&H(i,n,r.textBit(a))):(V(n,r.off?0:r.len,o.off?0:o.ins,s),i&&!o.off&&H(i,n,o.text));s=(r.ins>a||o.ins>=0&&o.len>a)&&(s||n.length>h),r.forward2(a),o.forward(a)}else V(n,0,o.ins,s),i&&H(i,n,o.text),o.next()}}var F=function(){function t(e){(0,u.Z)(this,t),this.set=e,this.i=0,this.next()}return(0,l.Z)(t,[{key:"next",value:function(){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(){return-2==this.ins}},{key:"len2",get:function(){return this.ins<0?this.len:this.ins}},{key:"text",get:function(){var t=this.set.inserted,e=this.i-2>>1;return e>=t.length?c.empty:t[e]}},{key:"textBit",value:function(t){var e=this.set.inserted,n=this.i-2>>1;return n>=e.length&&!t?c.empty:e[n].slice(this.off,null==t?void 0:this.off+t)}},{key:"forward",value:function(t){t==this.len?this.next():(this.len-=t,this.off+=t)}},{key:"forward2",value:function(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}]),t}(),q=function(){function t(e,n,i){(0,u.Z)(this,t),this.from=e,this.to=n,this.flags=i}return(0,l.Z)(t,[{key:"anchor",get:function(){return 32&this.flags?this.to:this.from}},{key:"head",get:function(){return 32&this.flags?this.from:this.to}},{key:"empty",get:function(){return this.from==this.to}},{key:"assoc",get:function(){return 8&this.flags?-1:16&this.flags?1:0}},{key:"bidiLevel",get:function(){var t=7&this.flags;return 7==t?null:t}},{key:"goalColumn",get:function(){var t=this.flags>>6;return 16777215==t?void 0:t}},{key:"map",value:function(e){var n,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return this.empty?n=i=e.mapPos(this.from,r):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new t(n,i,this.flags)}},{key:"extend",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(t<=this.anchor&&e>=this.anchor)return j.range(t,e);var n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return j.range(this.anchor,n)}},{key:"eq",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!(this.anchor!=t.anchor||this.head!=t.head||e&&this.empty&&this.assoc!=t.assoc)}},{key:"toJSON",value:function(){return{anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return j.range(t.anchor,t.head)}},{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}(),j=function(){function t(e,n){(0,u.Z)(this,t),this.ranges=e,this.mainIndex=n}return(0,l.Z)(t,[{key:"map",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return e.empty?this:t.create(this.ranges.map((function(t){return t.map(e,n)})),this.mainIndex)}},{key:"eq",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(var n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(t.ranges[n],e))return!1;return!0}},{key:"main",get:function(){return this.ranges[this.mainIndex]}},{key:"asSingle",value:function(){return 1==this.ranges.length?this:new t([this.main],0)}},{key:"addRange",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.create([e].concat(this.ranges),n?0:this.mainIndex+1)}},{key:"replaceRange",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.mainIndex,i=this.ranges.slice();return i[n]=e,t.create(i,this.mainIndex)}},{key:"toJSON",value:function(){return{ranges:this.ranges.map((function(t){return t.toJSON()})),main:this.mainIndex}}}],[{key:"fromJSON",value:function(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t(e.ranges.map((function(t){return q.fromJSON(t)})),e.main)}},{key:"single",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return new t([t.range(e,n)],0)}},{key:"create",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0==e.length)throw new RangeError("A selection needs at least one range");for(var i=0,r=0;r<e.length;r++){var o=e[r];if(o.empty?o.from<=i:o.from<i)return t.normalized(e.slice(),n);i=o.to}return new t(e,n)}},{key:"cursor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;return q.create(t,t,(0==e?0:e<0?8:16)|(null==n?7:Math.min(6,n))|(null!=i?i:16777215)<<6)}},{key:"range",value:function(t,e,n,i){var r=(null!=n?n:16777215)<<6|(null==i?7:Math.min(6,i));return e<t?q.create(e,t,48|r):q.create(t,e,(e>t?8:0)|r)}},{key:"normalized",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e[n];e.sort((function(t,e){return t.from-e.from})),n=e.indexOf(i);for(var r=1;r<e.length;r++){var o=e[r],s=e[r-1];if(o.empty?o.from<=s.to:o.from<s.to){var a=s.from,h=Math.max(o.to,s.to);r<=n&&n--,e.splice(--r,2,o.anchor>o.head?t.range(h,a):t.range(a,h))}}return new t(e,n)}}]),t}();function K(t,e){var n,r=(0,i.Z)(t.ranges);try{for(r.s();!(n=r.n()).done;){if(n.value.to>e)throw new RangeError("Selection points outside of document")}}catch(o){r.e(o)}finally{r.f()}}var J=0,U=function(){function t(e,n,i,r,o){(0,u.Z)(this,t),this.combine=e,this.compareInput=n,this.compare=i,this.isStatic=r,this.id=J++,this.default=e([]),this.extensions="function"==typeof o?o(this):o}return(0,l.Z)(t,[{key:"reader",get:function(){return this}},{key:"of",value:function(t){return new $([],this,0,t)}},{key:"compute",value:function(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new $(t,this,1,e)}},{key:"computeN",value:function(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new $(t,this,2,e)}},{key:"from",value:function(t,e){return e||(e=function(t){return t}),this.compute([t],(function(n){return e(n.field(t))}))}}],[{key:"define",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new t(e.combine||function(t){return t},e.compareInput||function(t,e){return t===e},e.compare||(e.combine?function(t,e){return t===e}:G),!!e.static,e.enables)}}]),t}();function G(t,e){return t==e||t.length==e.length&&t.every((function(t,n){return t===e[n]}))}var $=function(){function t(e,n,i,r){(0,u.Z)(this,t),this.dependencies=e,this.facet=n,this.type=i,this.value=r,this.id=J++}return(0,l.Z)(t,[{key:"dynamicSlot",value:function(t){var e,n,r=this,o=this.value,s=this.facet.compareInput,a=this.id,h=t[a]>>1,u=2==this.type,l=!1,c=!1,f=[],d=(0,i.Z)(this.dependencies);try{for(d.s();!(n=d.n()).done;){var v=n.value;"doc"==v?l=!0:"selection"==v?c=!0:0==(1&(null!==(e=t[v.id])&&void 0!==e?e:1))&&f.push(t[v.id])}}catch(g){d.e(g)}finally{d.f()}return{create:function(t){return t.values[h]=o(t),1},update:function(t,e){if(l&&e.docChanged||c&&(e.docChanged||e.selection)||Y(t,f)){var n=o(t);if(u?!X(n,t.values[h],s):!s(n,t.values[h]))return t.values[h]=n,1}return 0},reconfigure:function(t,e){var n,i=e.config.address[a];if(null!=i){var l=ft(e,i);if(r.dependencies.every((function(n){return n instanceof U?e.facet(n)===t.facet(n):!(n instanceof tt)||e.field(n,!1)==t.field(n,!1)}))||(u?X(n=o(t),l,s):s(n=o(t),l)))return t.values[h]=l,0}else n=o(t);return t.values[h]=n,1}}}}]),t}();function X(t,e,n){if(t.length!=e.length)return!1;for(var i=0;i<t.length;i++)if(!n(t[i],e[i]))return!1;return!0}function Y(t,e){var n,r=!1,o=(0,i.Z)(e);try{for(o.s();!(n=o.n()).done;){1&ct(t,n.value)&&(r=!0)}}catch(s){o.e(s)}finally{o.f()}return r}var Q=U.define({static:!0}),tt=function(){function t(e,n,i,r,o){(0,u.Z)(this,t),this.id=e,this.createF=n,this.updateF=i,this.compareF=r,this.spec=o,this.provides=void 0}return(0,l.Z)(t,[{key:"create",value:function(t){var e=this,n=t.facet(Q).find((function(t){return t.field==e}));return((null==n?void 0:n.create)||this.createF)(t)}},{key:"slot",value:function(t){var e=this,n=t[this.id]>>1;return{create:function(t){return t.values[n]=e.create(t),1},update:function(t,i){var r=t.values[n],o=e.updateF(r,i);return e.compareF(r,o)?0:(t.values[n]=o,1)},reconfigure:function(t,i){return null!=i.config.address[e.id]?(t.values[n]=i.field(e),0):(t.values[n]=e.create(t),1)}}}},{key:"init",value:function(t){return[this,Q.of({field:this,create:t})]}},{key:"extension",get:function(){return this}}],[{key:"define",value:function(e){var n=new t(J++,e.create,e.update,e.compare||function(t,e){return t===e},e);return e.provide&&(n.provides=e.provide(n)),n}}]),t}(),et=4,nt=3,it=2,rt=1;function ot(t){return function(e){return new at(e,t)}}var st={highest:ot(0),high:ot(rt),default:ot(it),low:ot(nt),lowest:ot(et)},at=(0,l.Z)((function t(e,n){(0,u.Z)(this,t),this.inner=e,this.prec=n})),ht=function(){function t(){(0,u.Z)(this,t)}return(0,l.Z)(t,[{key:"of",value:function(t){return new ut(this,t)}},{key:"reconfigure",value:function(e){return t.reconfigure.of({compartment:this,extension:e})}},{key:"get",value:function(t){return t.config.compartments.get(this)}}]),t}(),ut=(0,l.Z)((function t(e,n){(0,u.Z)(this,t),this.compartment=e,this.inner=n})),lt=function(){function t(e,n,i,r,o,s){for((0,u.Z)(this,t),this.base=e,this.compartments=n,this.dynamicSlots=i,this.address=r,this.staticValues=o,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}return(0,l.Z)(t,[{key:"staticFacet",value:function(t){var e=this.address[t.id];return null==e?t.default:this.staticValues[e>>1]}}],[{key:"resolve",value:function(e,n,r){var o,s=[],a=Object.create(null),h=new Map,u=(0,i.Z)(function(t,e,n){var r=[[],[],[],[],[]],o=new Map;function s(t,a){var h=o.get(t);if(null!=h){if(h<=a)return;var u=r[h].indexOf(t);u>-1&&r[h].splice(u,1),t instanceof ut&&n.delete(t.compartment)}if(o.set(t,a),Array.isArray(t)){var l,c=(0,i.Z)(t);try{for(c.s();!(l=c.n()).done;){s(l.value,a)}}catch(v){c.e(v)}finally{c.f()}}else if(t instanceof ut){if(n.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");var f=e.get(t.compartment)||t.inner;n.set(t.compartment,f),s(f,a)}else if(t instanceof at)s(t.inner,t.prec);else if(t instanceof tt)r[a].push(t),t.provides&&s(t.provides,a);else if(t instanceof $)r[a].push(t),t.facet.extensions&&s(t.facet.extensions,it);else{var d=t.extension;if(!d)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."));s(d,a)}}return s(t,it),r.reduce((function(t,e){return t.concat(e)}))}(e,n,h));try{for(u.s();!(o=u.n()).done;){var l=o.value;l instanceof tt?s.push(l):(a[l.facet.id]||(a[l.facet.id]=[])).push(l)}}catch(w){u.e(w)}finally{u.f()}for(var c=Object.create(null),f=[],d=[],v=function(){var t=p[g];c[t.id]=d.length<<1,d.push((function(e){return t.slot(e)}))},g=0,p=s;g<p.length;g++)v();var m=null==r?void 0:r.config.facets,y=function(){var t=a[k],e=t[0].facet,n=m&&m[k]||[];if(t.every((function(t){return 0==t.type})))if(c[e.id]=f.length<<1|1,G(n,t))f.push(r.facet(e));else{var o=e.combine(t.map((function(t){return t.value})));f.push(r&&e.compare(o,r.facet(e))?r.facet(e):o)}else{var s,h=(0,i.Z)(t);try{var u=function(){var t=s.value;0==t.type?(c[t.id]=f.length<<1|1,f.push(t.value)):(c[t.id]=d.length<<1,d.push((function(e){return t.dynamicSlot(e)})))};for(h.s();!(s=h.n()).done;)u()}catch(w){h.e(w)}finally{h.f()}c[e.id]=d.length<<1,d.push((function(n){return function(t,e,n){var r=n.map((function(e){return t[e.id]})),o=n.map((function(t){return t.type})),s=r.filter((function(t){return!(1&t)})),a=t[e.id]>>1;function h(t){for(var n=[],s=0;s<r.length;s++){var a=ft(t,r[s]);if(2==o[s]){var h,u=(0,i.Z)(a);try{for(u.s();!(h=u.n()).done;){var l=h.value;n.push(l)}}catch(w){u.e(w)}finally{u.f()}}else n.push(a)}return e.combine(n)}return{create:function(t){var e,n=(0,i.Z)(r);try{for(n.s();!(e=n.n()).done;)ct(t,e.value)}catch(w){n.e(w)}finally{n.f()}return t.values[a]=h(t),1},update:function(t,n){if(!Y(t,s))return 0;var i=h(t);return e.compare(i,t.values[a])?0:(t.values[a]=i,1)},reconfigure:function(t,i){var o=Y(t,r),s=i.config.facets[e.id],u=i.facet(e);if(s&&!o&&G(n,s))return t.values[a]=u,0;var l=h(t);return e.compare(l,u)?(t.values[a]=u,0):(t.values[a]=l,1)}}}(n,e,t)}))}};for(var k in a)y();return new t(e,h,d.map((function(t){return t(c)})),c,f,a)}}]),t}();function ct(t,e){if(1&e)return 2;var n=e>>1,i=t.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;t.status[n]=4;var r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function ft(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}var dt=U.define(),vt=U.define({combine:function(t){return t.some((function(t){return t}))},static:!0}),gt=U.define({combine:function(t){return t.length?t[0]:void 0},static:!0}),pt=U.define(),mt=U.define(),yt=U.define(),kt=U.define({combine:function(t){return!!t.length&&t[0]}}),wt=function(){function t(e,n){(0,u.Z)(this,t),this.type=e,this.value=n}return(0,l.Z)(t,null,[{key:"define",value:function(){return new bt}}]),t}(),bt=function(){function t(){(0,u.Z)(this,t)}return(0,l.Z)(t,[{key:"of",value:function(t){return new wt(this,t)}}]),t}(),xt=function(){function t(e){(0,u.Z)(this,t),this.map=e}return(0,l.Z)(t,[{key:"of",value:function(t){return new St(this,t)}}]),t}(),St=function(){function t(e,n){(0,u.Z)(this,t),this.type=e,this.value=n}return(0,l.Z)(t,[{key:"map",value:function(e){var n=this.type.map(this.value,e);return void 0===n?void 0:n==this.value?this:new t(this.type,n)}},{key:"is",value:function(t){return this.type==t}}],[{key:"define",value:function(){return new xt((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).map||function(t){return t})}},{key:"mapEffects",value:function(t,e){if(!t.length)return t;var n,r=[],o=(0,i.Z)(t);try{for(o.s();!(n=o.n()).done;){var s=n.value.map(e);s&&r.push(s)}}catch(a){o.e(a)}finally{o.f()}return r}}]),t}();St.reconfigure=St.define(),St.appendConfig=St.define();var At=function(){function t(e,n,i,r,o,s){(0,u.Z)(this,t),this.startState=e,this.changes=n,this.selection=i,this.effects=r,this.annotations=o,this.scrollIntoView=s,this._doc=null,this._state=null,i&&K(i,n.newLength),o.some((function(e){return e.type==t.time}))||(this.annotations=o.concat(t.time.of(Date.now())))}return(0,l.Z)(t,[{key:"newDoc",get:function(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}},{key:"newSelection",get:function(){return this.selection||this.startState.selection.map(this.changes)}},{key:"state",get:function(){return this._state||this.startState.applyTransaction(this),this._state}},{key:"annotation",value:function(t){var e,n=(0,i.Z)(this.annotations);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.type==t)return r.value}}catch(o){n.e(o)}finally{n.f()}}},{key:"docChanged",get:function(){return!this.changes.empty}},{key:"reconfigured",get:function(){return this.startState.config!=this.state.config}},{key:"isUserEvent",value:function(e){var n=this.annotation(t.userEvent);return!(!n||!(n==e||n.length>e.length&&n.slice(0,e.length)==e&&"."==n[e.length]))}}],[{key:"create",value:function(e,n,i,r,o,s){return new t(e,n,i,r,o,s)}}]),t}();function Mt(t,e){for(var n=[],i=0,r=0;;){var o=void 0,s=void 0;if(i<t.length&&(r==e.length||e[r]>=t[i]))o=t[i++],s=t[i++];else{if(!(r<e.length))return n;o=e[r++],s=e[r++]}!n.length||n[n.length-1]<o?n.push(o,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function Zt(t,e,n){var i,r,o,s;return n?(r=e.changes,o=L.empty(e.changes.length),s=t.changes.compose(e.changes)):(r=e.changes.map(t.changes),o=t.changes.mapDesc(e.changes,!0),s=t.changes.compose(r)),{changes:s,selection:e.selection?e.selection.map(o):null===(i=t.selection)||void 0===i?void 0:i.map(r),effects:St.mapEffects(t.effects,r).concat(St.mapEffects(e.effects,o)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Ct(t,e,n){var i=e.selection,r=Dt(e.annotations);return e.userEvent&&(r=r.concat(At.userEvent.of(e.userEvent))),{changes:e.changes instanceof L?e.changes:L.of(e.changes||[],n,t.facet(gt)),selection:i&&(i instanceof j?i:j.single(i.anchor,i.head)),effects:Dt(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Ot(t,e,n){var r=Ct(t,e.length?e[0]:{},t.doc.length);e.length&&!1===e[0].filter&&(n=!1);for(var o=1;o<e.length;o++){!1===e[o].filter&&(n=!1);var s=!!e[o].sequential;r=Zt(r,Ct(t,e[o],s?r.changes.newLength:t.doc.length),s)}var a=At.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return function(t){for(var e=t.startState,n=e.facet(yt),i=t,r=n.length-1;r>=0;r--){var o=n[r](t);o&&Object.keys(o).length&&(i=Zt(i,Ct(e,o,t.changes.newLength),!0))}return i==t?t:At.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(t){var e,n=t.startState,r=!0,o=(0,i.Z)(n.facet(pt));try{for(o.s();!(e=o.n()).done;){var s=(0,e.value)(t);if(!1===s){r=!1;break}Array.isArray(s)&&(r=!0===r?s:Mt(r,s))}}catch(d){o.e(d)}finally{o.f()}if(!0!==r){var a,h;if(!1===r)h=t.changes.invertedDesc,a=L.empty(n.doc.length);else{var u=t.changes.filter(r);a=u.changes,h=u.filtered.mapDesc(u.changes).invertedDesc}t=At.create(n,a,t.selection&&t.selection.map(h),St.mapEffects(t.effects,h),t.annotations,t.scrollIntoView)}for(var l=n.facet(mt),c=l.length-1;c>=0;c--){var f=l[c](t);t=f instanceof At?f:Array.isArray(f)&&1==f.length&&f[0]instanceof At?f[0]:Ot(n,Dt(f),!1)}return t}(a):a)}At.time=wt.define(),At.userEvent=wt.define(),At.addToHistory=wt.define(),At.remote=wt.define();var Tt=[];function Dt(t){return null==t?Tt:Array.isArray(t)?t:[t]}var Et,Bt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Bt||(Bt={})),Rt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{Et=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(ee){}function It(t){return function(e){if(!/\S/.test(e))return Bt.Space;if(function(t){if(Et)return Et.test(t);for(var e=0;e<t.length;e++){var n=t[e];if(/\w/.test(n)||n>"€"&&(n.toUpperCase()!=n.toLowerCase()||Rt.test(n)))return!0}return!1}(e))return Bt.Word;for(var n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Bt.Word;return Bt.Other}}var Pt=function(){function t(e,n,i,r,o,s){(0,u.Z)(this,t),this.config=e,this.doc=n,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,s&&(s._state=this);for(var a=0;a<this.config.dynamicSlots.length;a++)ct(this,a<<1);this.computeSlot=null}return(0,l.Z)(t,[{key:"field",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.config.address[t.id];if(null!=n)return ct(this,n),ft(this,n);if(e)throw new RangeError("Field is not present in this state")}},{key:"update",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Ot(this,e,!0)}},{key:"applyTransaction",value:function(e){var n,r,o=this,s=this.config,a=s,h=a.base,u=a.compartments,l=(0,i.Z)(e.effects);try{for(l.s();!(n=l.n()).done;){var c=n.value;c.is(ht.reconfigure)?(s&&(u=new Map,s.compartments.forEach((function(t,e){return u.set(e,t)})),s=null),u.set(c.value.compartment,c.value.extension)):c.is(St.reconfigure)?(s=null,h=c.value):c.is(St.appendConfig)&&(s=null,h=Dt(h).concat(c.value))}}catch(d){l.e(d)}finally{l.f()}s?r=e.startState.values.slice():r=new t(s=lt.resolve(h,u,this),this.doc,this.selection,s.dynamicSlots.map((function(){return null})),(function(t,e){return e.reconfigure(t,o)}),null).values;var f=e.startState.facet(vt)?e.newSelection:e.newSelection.asSingle();new t(s,e.newDoc,f,r,(function(t,n){return n.update(t,e)}),e)}},{key:"replaceSelection",value:function(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange((function(e){return{changes:{from:e.from,to:e.to,insert:t},range:j.cursor(e.from+t.length)}}))}},{key:"changeByRange",value:function(t){for(var e=this.selection,n=t(e.ranges[0]),i=this.changes(n.changes),r=[n.range],o=Dt(n.effects),s=1;s<e.ranges.length;s++){for(var a=t(e.ranges[s]),h=this.changes(a.changes),u=h.map(i),l=0;l<s;l++)r[l]=r[l].map(u);var c=i.mapDesc(h,!0);r.push(a.range.map(c)),i=i.compose(u),o=St.mapEffects(o,u).concat(St.mapEffects(Dt(a.effects),c))}return{changes:i,selection:j.create(r,e.mainIndex),effects:o}}},{key:"changes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e instanceof L?e:L.of(e,this.doc.length,this.facet(t.lineSeparator))}},{key:"toText",value:function(e){return c.of(e.split(this.facet(t.lineSeparator)||I))}},{key:"sliceDoc",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.doc.length;return this.doc.sliceString(t,e,this.lineBreak)}},{key:"facet",value:function(t){var e=this.config.address[t.id];return null==e?t.default:(ct(this,e),ft(this,e))}},{key:"toJSON",value:function(t){var e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(var n in t){var i=t[n];i instanceof tt&&null!=this.config.address[i.id]&&(e[n]=i.spec.toJSON(this.field(t[n]),this))}return e}},{key:"tabSize",get:function(){return this.facet(t.tabSize)}},{key:"lineBreak",get:function(){return this.facet(t.lineSeparator)||"\n"}},{key:"readOnly",get:function(){return this.facet(kt)}},{key:"phrase",value:function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var s,a=(0,i.Z)(this.facet(t.phrases));try{for(a.s();!(s=a.n()).done;){var h=s.value;if(Object.prototype.hasOwnProperty.call(h,e)){e=h[e];break}}}catch(u){a.e(u)}finally{a.f()}return r.length&&(e=e.replace(/\$(\$|\d*)/g,(function(t,e){if("$"==e)return"$";var n=+(e||1);return!n||n>r.length?t:r[n-1]}))),e}},{key:"languageDataAt",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,o=[],s=(0,i.Z)(this.facet(dt));try{for(s.s();!(n=s.n()).done;){var a,h=n.value,u=(0,i.Z)(h(this,e,r));try{for(u.s();!(a=u.n()).done;){var l=a.value;Object.prototype.hasOwnProperty.call(l,t)&&o.push(l[t])}}catch(c){u.e(c)}finally{u.f()}}}catch(c){s.e(c)}finally{s.f()}return o}},{key:"charCategorizer",value:function(t){return It(this.languageDataAt("wordChars",t).join(""))}},{key:"wordAt",value:function(t){for(var e=this.doc.lineAt(t),n=e.text,i=e.from,r=e.length,o=this.charCategorizer(t),s=t-i,a=t-i;s>0;){var h=Z(n,s,!1);if(o(n.slice(h,s))!=Bt.Word)break;s=h}for(;a<r;){var u=Z(n,a);if(o(n.slice(a,u))!=Bt.Word)break;a=u}return s==a?null:j.range(s+i,a+i)}}],[{key:"fromJSON",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");var r=[];if(i){var o=function(){if(Object.prototype.hasOwnProperty.call(e,s)){var t=i[s],n=e[s];r.push(t.init((function(e){return t.spec.fromJSON(n,e)})))}};for(var s in i)o()}return t.create({doc:e.doc,selection:j.fromJSON(e.selection),extensions:n.extensions?r.concat([n.extensions]):r})}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=lt.resolve(e.extensions||[],new Map),i=e.doc instanceof c?e.doc:c.of((e.doc||"").split(n.staticFacet(t.lineSeparator)||I)),r=e.selection?e.selection instanceof j?e.selection:j.single(e.selection.anchor,e.selection.head):j.single(0);return K(r,i.length),n.staticFacet(vt)||(r=r.asSingle()),new t(n,i,r,n.dynamicSlots.map((function(){return null})),(function(t,e){return e.create(t)}),null)}}]),t}();function Nt(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o={},s=(0,i.Z)(t);try{for(s.s();!(n=s.n()).done;)for(var a=n.value,h=0,u=Object.keys(a);h<u.length;h++){var l=u[h],c=a[l],f=o[l];if(void 0===f)o[l]=c;else if(f===c||void 0===c);else{if(!Object.hasOwnProperty.call(r,l))throw new Error("Config merge conflict for field "+l);o[l]=r[l](f,c)}}}catch(v){s.e(v)}finally{s.f()}for(var d in e)void 0===o[d]&&(o[d]=e[d]);return o}Pt.allowMultipleSelections=vt,Pt.tabSize=U.define({combine:function(t){return t.length?t[0]:4}}),Pt.lineSeparator=gt,Pt.readOnly=kt,Pt.phrases=U.define({compare:function(t,e){var n=Object.keys(t),i=Object.keys(e);return n.length==i.length&&n.every((function(n){return t[n]==e[n]}))}}),Pt.languageData=dt,Pt.changeFilter=pt,Pt.transactionFilter=mt,Pt.transactionExtender=yt,ht.reconfigure=St.define();var Lt=function(){function t(){(0,u.Z)(this,t)}return(0,l.Z)(t,[{key:"eq",value:function(t){return this==t}},{key:"range",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return Vt.create(t,e,this)}}]),t}();Lt.prototype.startSide=Lt.prototype.endSide=0,Lt.prototype.point=!1,Lt.prototype.mapMode=P.TrackDel;var Vt=function(){function t(e,n,i){(0,u.Z)(this,t),this.from=e,this.to=n,this.value=i}return(0,l.Z)(t,null,[{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}();function Ht(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}var Wt=function(){function t(e,n,i,r){(0,u.Z)(this,t),this.from=e,this.to=n,this.value=i,this.maxPoint=r}return(0,l.Z)(t,[{key:"length",get:function(){return this.to[this.to.length-1]}},{key:"findIndex",value:function(t,e,n){for(var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=n?this.to:this.from,o=i,s=r.length;;){if(o==s)return o;var a=o+s>>1,h=r[a]-t||(n?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:s;h>=0?s=a:o=a+1}}},{key:"between",value:function(t,e,n,i){for(var r=this.findIndex(e,-1e9,!0),o=this.findIndex(n,1e9,!1,r);r<o;r++)if(!1===i(this.from[r]+t,this.to[r]+t,this.value[r]))return!1}},{key:"map",value:function(e,n){for(var i=[],r=[],o=[],s=-1,a=-1,h=0;h<this.value.length;h++){var u=this.value[h],l=this.from[h]+e,c=this.to[h]+e,f=void 0,d=void 0;if(l==c){var v=n.mapPos(l,u.startSide,u.mapMode);if(null==v)continue;if(f=d=v,u.startSide!=u.endSide&&(d=n.mapPos(l,u.endSide))<f)continue}else if((f=n.mapPos(l,u.startSide))>(d=n.mapPos(c,u.endSide))||f==d&&u.startSide>0&&u.endSide<=0)continue;(d-f||u.endSide-u.startSide)<0||(s<0&&(s=f),u.point&&(a=Math.max(a,d-f)),i.push(u),r.push(f-s),o.push(d-s))}return{mapped:i.length?new t(r,o,i,a):null,pos:s}}}]),t}(),_t=function(){function t(e,n,i,r){(0,u.Z)(this,t),this.chunkPos=e,this.chunk=n,this.nextLayer=i,this.maxPoint=r}return(0,l.Z)(t,[{key:"length",get:function(){var t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}},{key:"size",get:function(){if(this.isEmpty)return 0;var t,e=this.nextLayer.size,n=(0,i.Z)(this.chunk);try{for(n.s();!(t=n.n()).done;){e+=t.value.value.length}}catch(r){n.e(r)}finally{n.f()}return e}},{key:"chunkEnd",value:function(t){return this.chunkPos[t]+this.chunk[t].length}},{key:"update",value:function(e){var n=e.add,i=void 0===n?[]:n,r=e.sort,o=void 0!==r&&r,s=e.filterFrom,a=void 0===s?0:s,h=e.filterTo,u=void 0===h?this.length:h,l=e.filter;if(0==i.length&&!l)return this;if(o&&(i=i.slice().sort(Ht)),this.isEmpty)return i.length?t.of(i):this;for(var c=new qt(this,null,-1).goto(0),f=0,d=[],v=new zt;c.value||f<i.length;)if(f<i.length&&(c.from-i[f].from||c.startSide-i[f].value.startSide)>=0){var g=i[f++];v.addInner(g.from,g.to,g.value)||d.push(g)}else 1==c.rangeIndex&&c.chunkIndex<this.chunk.length&&(f==i.length||this.chunkEnd(c.chunkIndex)<i[f].from)&&(!l||a>this.chunkEnd(c.chunkIndex)||u<this.chunkPos[c.chunkIndex])&&v.addChunk(this.chunkPos[c.chunkIndex],this.chunk[c.chunkIndex])?c.nextChunk():((!l||a>c.to||u<c.from||l(c.from,c.to,c.value))&&(v.addInner(c.from,c.to,c.value)||d.push(Vt.create(c.from,c.to,c.value))),c.next());return v.finishInner(this.nextLayer.isEmpty&&!d.length?t.empty:this.nextLayer.update({add:d,filter:l,filterFrom:a,filterTo:u}))}},{key:"map",value:function(e){if(e.empty||this.isEmpty)return this;for(var n=[],i=[],r=-1,o=0;o<this.chunk.length;o++){var s=this.chunkPos[o],a=this.chunk[o],h=e.touchesRange(s,s+a.length);if(!1===h)r=Math.max(r,a.maxPoint),n.push(a),i.push(e.mapPos(s));else if(!0===h){var u=a.map(s,e),l=u.mapped,c=u.pos;l&&(r=Math.max(r,l.maxPoint),n.push(l),i.push(c))}}var f=this.nextLayer.map(e);return 0==n.length?f:new t(i,n,f||t.empty,r)}},{key:"between",value:function(t,e,n){if(!this.isEmpty){for(var i=0;i<this.chunk.length;i++){var r=this.chunkPos[i],o=this.chunk[i];if(e>=r&&t<=r+o.length&&!1===o.between(r,t-r,e-r,n))return}this.nextLayer.between(t,e,n)}}},{key:"iter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return jt.from([this]).goto(t)}},{key:"isEmpty",get:function(){return this.nextLayer==this}}],[{key:"create",value:function(e,n,i,r){return new t(e,n,i,r)}},{key:"iter",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return jt.from(t).goto(e)}},{key:"compare",value:function(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=t.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r})),s=e.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r})),a=Ft(o,s,n),h=new Jt(o,a,r),u=new Jt(s,a,r);n.iterGaps((function(t,e,n){return Ut(h,t,u,e,n,i)})),n.empty&&0==n.length&&Ut(h,0,u,0,0,i)}},{key:"eq",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0;null==i&&(i=999999999);var r=t.filter((function(t){return!t.isEmpty&&e.indexOf(t)<0})),o=e.filter((function(e){return!e.isEmpty&&t.indexOf(e)<0}));if(r.length!=o.length)return!1;if(!r.length)return!0;for(var s=Ft(r,o),a=new Jt(r,s,0).goto(n),h=new Jt(o,s,0).goto(n);;){if(a.to!=h.to||!Gt(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>i)return!0;a.next(),h.next()}}},{key:"spans",value:function(t,e,n,i){for(var r=new Jt(t,null,arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1).goto(e),o=e,s=r.openStart;;){var a=Math.min(r.to,n);if(r.point){var h=r.activeForPoint(r.to),u=r.pointFrom<e?h.length+1:Math.min(h.length,s);i.point(o,a,r.point,h,u,r.pointRank),s=Math.min(r.openEnd(a),h.length)}else a>o&&(i.span(o,a,r.active,s),s=r.openEnd(a));if(r.to>n)return s+(r.point&&r.to>n?1:0);o=r.to,r.next()}}},{key:"of",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=new zt,o=(0,i.Z)(t instanceof Vt?[t]:n?function(t){if(t.length>1)for(var e=t[0],n=1;n<t.length;n++){var i=t[n];if(Ht(e,i)>0)return t.slice().sort(Ht);e=i}return t}(t):t);try{for(o.s();!(e=o.n()).done;){var s=e.value;r.add(s.from,s.to,s.value)}}catch(a){o.e(a)}finally{o.f()}return r.finish()}},{key:"join",value:function(e){if(!e.length)return t.empty;for(var n=e[e.length-1],i=e.length-2;i>=0;i--)for(var r=e[i];r!=t.empty;r=r.nextLayer)n=new t(r.chunkPos,r.chunk,n,Math.max(r.maxPoint,n.maxPoint));return n}}]),t}();_t.empty=new _t([],[],null,-1),_t.empty.nextLayer=_t.empty;var zt=function(){function t(){(0,u.Z)(this,t),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(0,l.Z)(t,[{key:"finishChunk",value:function(t){this.chunks.push(new Wt(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(e,n,i){this.addInner(e,n,i)||(this.nextLayer||(this.nextLayer=new t)).add(e,n,i)}},{key:"addInner",value:function(t,e,n){var i=t-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(t-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<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=n,this.lastFrom=t,this.lastTo=e,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}},{key:"addChunk",value:function(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 n=e.value.length-1;return this.last=e.value[n],this.lastFrom=e.from[n]+t,this.lastTo=e.to[n]+t,!0}},{key:"finish",value:function(){return this.finishInner(_t.empty)}},{key:"finishInner",value:function(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;var e=_t.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}]),t}();function Ft(t,e,n){var r,o=new Map,s=(0,i.Z)(t);try{for(s.s();!(r=s.n()).done;)for(var a=r.value,h=0;h<a.chunk.length;h++)a.chunk[h].maxPoint<=0&&o.set(a.chunk[h],a.chunkPos[h])}catch(g){s.e(g)}finally{s.f()}var u,l=new Set,c=(0,i.Z)(e);try{for(c.s();!(u=c.n()).done;)for(var f=u.value,d=0;d<f.chunk.length;d++){var v=o.get(f.chunk[d]);null==v||(n?n.mapPos(v):v)!=f.chunkPos[d]||(null==n?void 0:n.touchesRange(v,v+f.chunk[d].length))||l.add(f.chunk[d])}}catch(g){c.e(g)}finally{c.f()}return l}var qt=function(){function t(e,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;(0,u.Z)(this,t),this.layer=e,this.skip=n,this.minPoint=i,this.rank=r}return(0,l.Z)(t,[{key:"startSide",get:function(){return this.value?this.value.startSide:0}},{key:"endSide",get:function(){return this.value?this.value.endSide:0}},{key:"goto",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}},{key:"gotoInner",value:function(t,e,n){for(;this.chunkIndex<this.layer.chunk.length;){var i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<t||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){var r=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}},{key:"forward",value:function(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}},{key:"next",value:function(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}var t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],n=t+e.from[this.rangeIndex];if(this.from=n,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}},{key:"setRangeIndex",value:function(t){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(){this.chunkIndex++,this.rangeIndex=0,this.next()}},{key:"compare",value:function(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}}]),t}(),jt=function(){function t(e){(0,u.Z)(this,t),this.heap=e}return(0,l.Z)(t,[{key:"startSide",get:function(){return this.value?this.value.startSide:0}},{key:"goto",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9,r=(0,i.Z)(this.heap);try{for(r.s();!(e=r.n()).done;){e.value.goto(t,n)}}catch(s){r.e(s)}finally{r.f()}for(var o=this.heap.length>>1;o>=0;o--)Kt(this.heap,o);return this.next(),this}},{key:"forward",value:function(t,e){var n,r=(0,i.Z)(this.heap);try{for(r.s();!(n=r.n()).done;){n.value.forward(t,e)}}catch(s){r.e(s)}finally{r.f()}for(var o=this.heap.length>>1;o>=0;o--)Kt(this.heap,o);(this.to-t||this.value.endSide-e)<0&&this.next()}},{key:"next",value:function(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Kt(this.heap,0)}}}],[{key:"from",value:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=0;o<e.length;o++)for(var s=e[o];!s.isEmpty;s=s.nextLayer)s.maxPoint>=i&&r.push(new qt(s,n,i,o));return 1==r.length?r[0]:new t(r)}}]),t}();function Kt(t,e){for(var n=t[e];;){var i=1+(e<<1);if(i>=t.length)break;var r=t[i];if(i+1<t.length&&r.compare(t[i+1])>=0&&(r=t[i+1],i++),n.compare(r)<0)break;t[i]=n,t[e]=r,e=i}}var Jt=function(){function t(e,n,i){(0,u.Z)(this,t),this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=jt.from(e,n,i)}return(0,l.Z)(t,[{key:"goto",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?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(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(t){$t(this.active,t),$t(this.activeTo,t),$t(this.activeRank,t),this.minActive=Yt(this.active,this.activeTo)}},{key:"addActive",value:function(t){for(var e=0,n=this.cursor,i=n.value,r=n.to,o=n.rank;e<this.activeRank.length&&(o-this.activeRank[e]||r-this.activeTo[e])>0;)e++;Xt(this.active,e,i),Xt(this.activeTo,e,r),Xt(this.activeRank,e,o),t&&Xt(t,e,this.cursor.from),this.minActive=Yt(this.active,this.activeTo)}},{key:"next",value:function(){var t=this.to,e=this.point;this.point=null;for(var n=this.openStart<0?[]:null;;){var i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>t){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&$t(n,i)}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 r=this.cursor.value;if(r.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}if(n){this.openStart=0;for(var o=n.length-1;o>=0&&n[o]<t;o--)this.openStart++}}},{key:"activeForPoint",value:function(t){if(!this.active.length)return this.active;for(var e=[],n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>t||this.activeTo[n]==t&&this.active[n].endSide>=this.point.endSide)&&e.push(this.active[n]);return e.reverse()}},{key:"openEnd",value:function(t){for(var e=0,n=this.activeTo.length-1;n>=0&&this.activeTo[n]>t;n--)e++;return e}}]),t}();function Ut(t,e,n,i,r,o){t.goto(e),n.goto(i);for(var s=i+r,a=i,h=i-e;;){var u=t.to+h-n.to||t.endSide-n.endSide,l=u<0?t.to+h:n.to,c=Math.min(l,s);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&Gt(t.activeForPoint(t.to),n.activeForPoint(n.to))||o.comparePoint(a,c,t.point,n.point):c>a&&!Gt(t.active,n.active)&&o.compareRange(a,c,t.active,n.active),l>s)break;a=l,u<=0&&t.next(),u>=0&&n.next()}}function Gt(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].eq(e[n]))return!1;return!0}function $t(t,e){for(var n=e,i=t.length-1;n<i;n++)t[n]=t[n+1];t.pop()}function Xt(t,e,n){for(var i=t.length-1;i>=e;i--)t[i+1]=t[i];t[e]=n}function Yt(t,e){for(var n=-1,i=1e9,r=0;r<e.length;r++)(e[r]-i||t[r].endSide-t[n].endSide)<0&&(n=r,i=e[r]);return n}function Qt(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=0,r=0;r<n;)9==t.charCodeAt(r)?(i+=e-i%e,r++):(i++,r=Z(t,r));return i}function te(t,e,n,i){for(var r=0,o=0;;){if(o>=e)return r;if(r==t.length)break;o+=9==t.charCodeAt(r)?n-o%n:1,r=Z(t,r)}return!0===i?-1:t.length}},58626:function(t,e,n){n.d(e,{p:function(){return xt},Nm:function(){return Et},tk:function(){return gi},lg:function(){return me},l9:function(){return wt},S2:function(){return tr},Uw:function(){return Vi},gB:function(){return lr},ZO:function(){return ji},$f:function(){return Si},Eu:function(){return Cr},OO:function(){return de},Zs:function(){return Xi},hJ:function(){return ur}});var i=n(62746),r=n(82390),o=n(34541),s=n(47838),a=n(68308),h=n(69205),u=n(46097),l=n(40039),c=n(71650),f=n(33368),d=(n(63789),n(99397),n(36513),n(71779),n(51467),n(56308),n(41353),n(97393),n(24074),n(22859),n(91989),n(57778),n(17692),n(85472),n(46798),n(65974),n(9849),n(13526),n(90126),n(46349),n(70320),n(51358),n(78399),n(5239),n(56086),n(47884),n(81912),n(64584),n(41483),n(12367),n(9454),n(98490),n(49089),n(50289),n(94167),n(80641),n(94570),n(47084),n(75164),n(87438),n(22890),n(80628),n(37313),n(27392),n(96043),n(64777),n(39685),n(34997),n(12148),n(10999),n(52117),n(82479),n(86439),n(85717),n(73855),n(74075)),v=n(76775),g=(n(94738),n(98214),n(89802),"undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ")),p="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),m="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{},y=function(){function t(e,n){(0,c.Z)(this,t),this.rules=[];var i=(n||{}).finish;function r(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function o(t,e,n,s){var a=[],h=/^@(\w+)\b/.exec(t[0]),u=h&&"keyframes"==h[1];if(h&&null==e)return n.push(t[0]+";");for(var l in e){var c=e[l];if(/&/.test(l))o(l.split(/,\s*/).map((function(e){return t.map((function(t){return e.replace(/&/,t)}))})).reduce((function(t,e){return t.concat(e)})),c,n);else if(c&&"object"==(0,v.Z)(c)){if(!h)throw new RangeError("The value of a property ("+l+") should be a primitive value.");o(r(l),c,a,u)}else null!=c&&a.push(l.replace(/_.*/,"").replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}))+": "+c+";")}(a.length||u)&&n.push((!i||h||s?t:t.map(i)).join(", ")+" {"+a.join(" ")+"}")}for(var s in e)o(r(s),e[s],this.rules)}return(0,f.Z)(t,[{key:"getRules",value:function(){return this.rules.join("\n")}}],[{key:"newName",value:function(){var t=m[g]||1;return m[g]=t+1,"ͼ"+t.toString(36)}},{key:"mount",value:function(t,e,n){var i=t[p],r=n&&n.nonce;i?r&&i.setNonce(r):i=new w(t,r),i.mount(Array.isArray(e)?e:[e])}}]),t}(),k=new Map,w=function(){function t(e,n){(0,c.Z)(this,t);var i=e.ownerDocument||e,r=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){var o=k.get(i);if(o)return e.adoptedStyleSheets=[o.sheet].concat((0,u.Z)(e.adoptedStyleSheets)),e[p]=o;this.sheet=new r.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet].concat((0,u.Z)(e.adoptedStyleSheets)),k.set(i,this)}else{this.styleTag=i.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);var s=e.head||e;s.insertBefore(this.styleTag,s.firstChild)}this.modules=[],e[p]=this}return(0,f.Z)(t,[{key:"mount",value:function(t){for(var e=this.sheet,n=0,i=0,r=0;r<t.length;r++){var o=t[r],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),i--,s=-1),-1==s){if(this.modules.splice(i++,0,o),e)for(var a=0;a<o.rules.length;a++)e.insertRule(o.rules[a],n++)}else{for(;i<s;)n+=this.modules[i++].rules.length;n+=o.rules.length,i++}}if(!e){for(var h="",u=0;u<this.modules.length;u++)h+=this.modules[u].getRules()+"\n";this.styleTag.textContent=h}}},{key:"setNonce",value:function(t){this.styleTag&&this.styleTag.getAttribute("nonce")!=t&&this.styleTag.setAttribute("nonce",t)}}]),t}(),b=n(29350);function x(t){return(11==t.nodeType?t.getSelection?t:t.ownerDocument:t).getSelection()}function S(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function A(t,e){if(!e.anchorNode)return!1;try{return S(t,e.anchorNode)}catch(n){return!1}}function M(t){return 3==t.nodeType?L(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function Z(t,e,n,i){return!!n&&(O(t,e,n,i,-1)||O(t,e,n,i,1))}function C(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function O(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:T(t))){if("DIV"==t.nodeName)return!1;var o=t.parentNode;if(!o||1!=o.nodeType)return!1;e=C(t)+(r<0?0:1),t=o}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?T(t):0}}}function T(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function D(t,e){var n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function E(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function B(t,e){var n=e.width/t.offsetWidth,i=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-t.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}var R,I=function(){function t(){(0,c.Z)(this,t),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return(0,f.Z)(t,[{key:"eq",value:function(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}},{key:"setRange",value:function(t){var e=t.anchorNode,n=t.focusNode;this.set(e,Math.min(t.anchorOffset,e?T(e):0),n,Math.min(t.focusOffset,n?T(n):0))}},{key:"set",value:function(t,e,n,i){this.anchorNode=t,this.anchorOffset=e,this.focusNode=n,this.focusOffset=i}}]),t}(),P=null;function N(t){if(t.setActive)return t.setActive();if(P)return t.focus(P);for(var e=[],n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(null==P?{get preventScroll(){return P={preventScroll:!0},!0}}:void 0),!P){P=!1;for(var i=0;i<e.length;){var r=e[i++],o=e[i++],s=e[i++];r.scrollTop!=o&&(r.scrollTop=o),r.scrollLeft!=s&&(r.scrollLeft=s)}}}function L(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,i=R||(R=document.createRange());return i.setEnd(t,n),i.setStart(t,e),i}function V(t,e,n){var i={key:e,code:e,keyCode:n,which:n,cancelable:!0},r=new KeyboardEvent("keydown",i);r.synthetic=!0,t.dispatchEvent(r);var o=new KeyboardEvent("keyup",i);return o.synthetic=!0,t.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function H(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function W(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}var _=function(){function t(e,n){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];(0,c.Z)(this,t),this.node=e,this.offset=n,this.precise=i}return(0,f.Z)(t,null,[{key:"before",value:function(e,n){return new t(e.parentNode,C(e),n)}},{key:"after",value:function(e,n){return new t(e.parentNode,C(e)+1,n)}}]),t}(),z=[],F=function(){function t(){(0,c.Z)(this,t),this.parent=null,this.dom=null,this.flags=2}return(0,f.Z)(t,[{key:"overrideDOMText",get:function(){return null}},{key:"posAtStart",get:function(){return this.parent?this.parent.posBefore(this):0}},{key:"posAtEnd",get:function(){return this.posAtStart+this.length}},{key:"posBefore",value:function(t){var e,n=this.posAtStart,i=(0,l.Z)(this.children);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(r==t)return n;n+=r.length+r.breakAfter}}catch(o){i.e(o)}finally{i.f()}throw new RangeError("Invalid child in posBefore")}},{key:"posAfter",value:function(t){return this.posBefore(t)+t.length}},{key:"sync",value:function(e,n){if(2&this.flags){var i,r,o=this.dom,s=null,a=(0,l.Z)(this.children);try{for(a.s();!(r=a.n()).done;){var h=r.value;if(7&h.flags){if(!h.dom&&(i=s?s.nextSibling:o.firstChild)){var u=t.get(i);(!u||!u.parent&&u.canReuseDOM(h))&&h.reuseDOM(i)}h.sync(e,n),h.flags&=-8}if(i=s?s.nextSibling:o.firstChild,n&&!n.written&&n.node==o&&i!=h.dom&&(n.written=!0),h.dom.parentNode==o)for(;i&&i!=h.dom;)i=q(i);else o.insertBefore(h.dom,i);s=h.dom}}catch(v){a.e(v)}finally{a.f()}for((i=s?s.nextSibling:o.firstChild)&&n&&n.node==o&&(n.written=!0);i;)i=q(i)}else if(1&this.flags){var c,f=(0,l.Z)(this.children);try{for(f.s();!(c=f.n()).done;){var d=c.value;7&d.flags&&(d.sync(e,n),d.flags&=-8)}}catch(v){f.e(v)}finally{f.f()}}}},{key:"reuseDOM",value:function(t){}},{key:"localPosFromDOM",value:function(e,n){var i;if(e==this.dom)i=this.dom.childNodes[n];else{for(var r=0==T(e)?0:0==n?-1:1;;){var o=e.parentNode;if(o==this.dom)break;0==r&&o.firstChild!=o.lastChild&&(r=e==o.firstChild?-1:1),e=o}i=r<0?e:e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!t.get(i);)i=i.nextSibling;if(!i)return this.length;for(var s=0,a=0;;s++){var h=this.children[s];if(h.dom==i)return a;a+=h.length+h.breakAfter}}},{key:"domBoundsAround",value:function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=-1,r=-1,o=-1,s=-1,a=0,h=n,u=n;a<this.children.length;a++){var l=this.children[a],c=h+l.length;if(h<t&&c>e)return l.domBoundsAround(t,e,h);if(c>=t&&-1==i&&(i=a,r=h),h>e&&l.dom.parentNode==this.dom){o=a,s=u;break}u=c,h=c+l.breakAfter}return{from:r,to:s<0?n+this.length:s,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}},{key:"markDirty",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.flags|=2,this.markParentsDirty(t)}},{key:"markParentsDirty",value:function(t){for(var e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),1&e.flags)return;e.flags|=1,t=!1}}},{key:"setParent",value:function(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0))}},{key:"setDOM",value:function(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}},{key:"rootView",get:function(){for(var t=this;;){var e=t.parent;if(!e)return t;t=e}}},{key:"replaceChildren",value:function(t,e){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:z;this.markDirty();for(var r=t;r<e;r++){var o=this.children[r];o.parent==this&&i.indexOf(o)<0&&o.destroy()}(n=this.children).splice.apply(n,[t,e-t].concat((0,u.Z)(i)));for(var s=0;s<i.length;s++)i[s].setParent(this)}},{key:"ignoreMutation",value:function(t){return!1}},{key:"ignoreEvent",value:function(t){return!1}},{key:"childCursor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length;return new j(this.children,t,this.children.length)}},{key:"childPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.childCursor().findPos(t,e)}},{key:"toString",value:function(){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(){return!0}},{key:"isWidget",get:function(){return!1}},{key:"isHidden",get:function(){return!1}},{key:"merge",value:function(t,e,n,i,r,o){return!1}},{key:"become",value:function(t){return!1}},{key:"canReuseDOM",value:function(t){return t.constructor==this.constructor&&!(8&(this.flags|t.flags))}},{key:"getSide",value:function(){return 0}},{key:"destroy",value:function(){var t,e=(0,l.Z)(this.children);try{for(e.s();!(t=e.n()).done;){var n=t.value;n.parent==this&&n.destroy()}}catch(i){e.e(i)}finally{e.f()}this.parent=null}}],[{key:"get",value:function(t){return t.cmView}}]),t}();function q(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}F.prototype.breakAfter=0;var j=function(){function t(e,n,i){(0,c.Z)(this,t),this.children=e,this.pos=n,this.i=i,this.off=0}return(0,f.Z)(t,[{key:"findPos",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;;){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 n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}]),t}();function K(t,e,n,i,r,o,s,a,h){var u=t.children,l=u.length?u[e]:null,c=o.length?o[o.length-1]:null,f=c?c.breakAfter:s;if(!(e==i&&l&&!s&&!f&&o.length<2&&l.merge(n,r,o.length?c:null,0==n,a,h))){if(i<u.length){var d=u[i];d&&(r<d.length||d.breakAfter&&(null==c?void 0:c.breakAfter))?(e==i&&(d=d.split(r),r=0),!f&&c&&d.merge(0,r,c,!0,0,h)?o[o.length-1]=d:((r||d.children.length&&!d.children[0].length)&&d.merge(0,r,null,!1,0,h),o.push(d))):(null==d?void 0:d.breakAfter)&&(c?c.breakAfter=1:s=1),i++}for(l&&(l.breakAfter=s,n>0&&(!s&&o.length&&l.merge(n,l.length,o[0],!1,a,0)?l.breakAfter=o.shift().breakAfter:(n<l.length||l.children.length&&0==l.children[l.children.length-1].length)&&l.merge(n,l.length,null,!1,a,0),e++));e<i&&o.length;)if(u[i-1].become(o[o.length-1]))i--,o.pop(),h=o.length?0:a;else{if(!u[e].become(o[0]))break;e++,o.shift(),a=o.length?0:h}!o.length&&e&&i<u.length&&!u[e-1].breakAfter&&u[i].merge(0,0,u[e-1],!1,a,h)&&e--,(e<i||o.length)&&t.replaceChildren(e,i,o)}}function J(t,e,n,i,r,o){var s,a=t.childCursor(),h=a.findPos(n,1),u=h.i,c=h.off,f=a.findPos(e,-1),d=f.i,v=f.off,g=e-n,p=(0,l.Z)(i);try{for(p.s();!(s=p.n()).done;){g+=s.value.length}}catch(m){p.e(m)}finally{p.f()}t.length+=g,K(t,d,v,u,c,i,0,r,o)}var U="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},G="undefined"!=typeof document?document:{documentElement:{style:{}}},$=/Edge\/(\d+)/.exec(U.userAgent),X=/MSIE \d/.test(U.userAgent),Y=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(U.userAgent),Q=!!(X||Y||$),tt=!Q&&/gecko\/(\d+)/i.test(U.userAgent),et=!Q&&/Chrome\/(\d+)/.exec(U.userAgent),nt="webkitFontSmoothing"in G.documentElement.style,it=!Q&&/Apple Computer/.test(U.vendor),rt=it&&(/Mobile\/\w+/.test(U.userAgent)||U.maxTouchPoints>2),ot={mac:rt||/Mac/.test(U.platform),windows:/Win/.test(U.platform),linux:/Linux|X11/.test(U.platform),ie:Q,ie_version:X?G.documentMode||6:Y?+Y[1]:$?+$[1]:0,gecko:tt,gecko_version:tt?+(/Firefox\/(\d+)/.exec(U.userAgent)||[0,0])[1]:0,chrome:!!et,chrome_version:et?+et[1]:0,ios:rt,android:/Android\b/.test(U.userAgent),webkit:nt,safari:it,webkit_version:nt?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=G.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},st=function(t){function e(t){var n;return(0,c.Z)(this,e),(n=(0,a.Z)(this,e)).text=t,n}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"length",get:function(){return this.text.length}},{key:"createDOM",value:function(t){this.setDOM(t||document.createTextNode(this.text))}},{key:"sync",value:function(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(t){3==t.nodeType&&this.createDOM(t)}},{key:"merge",value:function(t,n,i){return!(8&this.flags||i&&(!(i instanceof e)||this.length-(n-t)+i.length>256||8&i.flags))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(n),this.markDirty(),!0)}},{key:"split",value:function(t){var n=new e(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),n.flags|=8&this.flags,n}},{key:"localPosFromDOM",value:function(t,e){return t==this.dom?e:e?this.text.length:0}},{key:"domAtPos",value:function(t){return new _(this.dom,t)}},{key:"domBoundsAround",value:function(t,e,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}},{key:"coordsAt",value:function(t,e){return function(t,e,n){var i=t.nodeValue.length;e>i&&(e=i);var r=e,o=e,s=0;0==e&&n<0||e==i&&n>=0?ot.chrome||ot.gecko||(e?(r--,s=1):o<i&&(o++,s=-1)):n<0?r--:o<i&&o++;var a=L(t,r,o).getClientRects();if(!a.length)return null;var h=a[(s?s<0:n>=0)?0:a.length-1];ot.safari&&!s&&0==h.width&&(h=Array.prototype.find.call(a,(function(t){return t.width}))||h);return s?D(h,s<0):h||null}(this.dom,t,e)}}]),e}(F),at=function(t){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;(0,c.Z)(this,e),(n=(0,a.Z)(this,e)).mark=t,n.children=i,n.length=o;var s,h=(0,l.Z)(i);try{for(h.s();!(s=h.n()).done;){s.value.setParent((0,r.Z)(n))}}catch(u){h.e(u)}finally{h.f()}return n}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"setAttrs",value:function(t){if(H(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(var e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}},{key:"canReuseDOM",value:function(t){return(0,o.Z)((0,s.Z)(e.prototype),"canReuseDOM",this).call(this,t)&&!(8&(this.flags|t.flags))}},{key:"reuseDOM",value:function(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}},{key:"sync",value:function(t,n){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),(0,o.Z)((0,s.Z)(e.prototype),"sync",this).call(this,t,n)}},{key:"merge",value:function(t,n,i,r,o,s){return(!i||!(!(i instanceof e&&i.mark.eq(this.mark))||t&&o<=0||n<this.length&&s<=0))&&(J(this,t,n,i?i.children.slice():[],o-1,s-1),this.markDirty(),!0)}},{key:"split",value:function(t){var n,i=[],r=0,o=-1,s=0,a=(0,l.Z)(this.children);try{for(a.s();!(n=a.n()).done;){var h=n.value,u=r+h.length;u>t&&i.push(r<t?h.split(t-r):h),o<0&&r>=t&&(o=s),r=u,s++}}catch(f){a.e(f)}finally{a.f()}var c=this.length-t;return this.length=t,o>-1&&(this.children.length=o,this.markDirty()),new e(this.mark,i,c)}},{key:"domAtPos",value:function(t){return lt(this,t)}},{key:"coordsAt",value:function(t,e){return ft(this,t,e)}}]),e}(F);var ht=function(t){function e(t,n,i){var r;return(0,c.Z)(this,e),(r=(0,a.Z)(this,e)).widget=t,r.length=n,r.side=i,r.prevWidget=null,r}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"split",value:function(t){var n=e.create(this.widget,this.length-t,this.side);return this.length-=t,n}},{key:"sync",value:function(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(){return this.side}},{key:"merge",value:function(t,n,i,r,o,s){return!(i&&(!(i instanceof e&&this.widget.compare(i.widget))||t>0&&o<=0||n<this.length&&s<=0))&&(this.length=t+(i?i.length:0)+(this.length-n),!0)}},{key:"become",value:function(t){return t instanceof e&&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(){return!0}},{key:"ignoreEvent",value:function(t){return this.widget.ignoreEvent(t)}},{key:"overrideDOMText",get:function(){if(0==this.length)return d.xv.empty;for(var t=this;t.parent;)t=t.parent;var e=t.view,n=e&&e.state.doc,i=this.posAtStart;return n?n.slice(i,i+this.length):d.xv.empty}},{key:"domAtPos",value:function(t){return(this.length?0==t:this.side>0)?_.before(this.dom):_.after(this.dom,t==this.length)}},{key:"domBoundsAround",value:function(){return null}},{key:"coordsAt",value:function(t,e){var n=this.widget.coordsAt(this.dom,t,e);if(n)return n;var i=this.dom.getClientRects(),r=null;if(!i.length)return null;for(var o=this.side?this.side<0:t>0,s=o?i.length-1:0;r=i[s],!(t>0?0==s:s==i.length-1||r.top<r.bottom);s+=o?-1:1);return D(r,!o)}},{key:"isEditable",get:function(){return!1}},{key:"isWidget",get:function(){return!0}},{key:"isHidden",get:function(){return this.widget.isHidden}},{key:"destroy",value:function(){(0,o.Z)((0,s.Z)(e.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}],[{key:"create",value:function(t,n,i){return new e(t,n,i)}}]),e}(F),ut=function(t){function e(t){var n;return(0,c.Z)(this,e),(n=(0,a.Z)(this,e)).side=t,n}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"length",get:function(){return 0}},{key:"merge",value:function(){return!1}},{key:"become",value:function(t){return t instanceof e&&t.side==this.side}},{key:"split",value:function(){return new e(this.side)}},{key:"sync",value:function(){if(!this.dom){var t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),this.setDOM(t)}}},{key:"getSide",value:function(){return this.side}},{key:"domAtPos",value:function(t){return this.side>0?_.before(this.dom):_.after(this.dom)}},{key:"localPosFromDOM",value:function(){return 0}},{key:"domBoundsAround",value:function(){return null}},{key:"coordsAt",value:function(t){return this.dom.getBoundingClientRect()}},{key:"overrideDOMText",get:function(){return d.xv.empty}},{key:"isHidden",get:function(){return!0}}]),e}(F);function lt(t,e){for(var n=t.dom,i=t.children,r=0,o=0;r<i.length;r++){var s=i[r],a=o+s.length;if(!(a==o&&s.getSide()<=0)){if(e>o&&e<a&&s.dom.parentNode==n)return s.domAtPos(e-o);if(e<=o)break;o=a}}for(var h=r;h>0;h--){var u=i[h-1];if(u.dom.parentNode==n)return u.domAtPos(u.length)}for(var l=r;l<i.length;l++){var c=i[l];if(c.dom.parentNode==n)return c.domAtPos(0)}return new _(n,0)}function ct(t,e,n){var i,r=t.children;n>0&&e instanceof at&&r.length&&(i=r[r.length-1])instanceof at&&i.mark.eq(e.mark)?ct(i,e.children[0],n-1):(r.push(e),e.setParent(t)),t.length+=e.length}function ft(t,e,n){var i=null,r=-1,o=null,s=-1;!function t(e,a){for(var h=0,u=0;h<e.children.length&&u<=a;h++){var l=e.children[h],c=u+l.length;c>=a&&(l.children.length?t(l,a-u):(!o||o.isHidden&&n>0)&&(c>a||u==c&&l.getSide()>0)?(o=l,s=a-u):(u<a||u==c&&l.getSide()<0&&!l.isHidden)&&(i=l,r=a-u)),u=c}}(t,e);var a=(n<0?i:o)||i||o;return a?a.coordsAt(Math.max(0,a==i?r:s),n):function(t){var e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();var n=M(e);return n[n.length-1]||null}(t)}function dt(t,e){for(var n in t)"class"==n&&e.class?e.class+=" "+t.class:"style"==n&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}st.prototype.children=ht.prototype.children=ut.prototype.children=z;var vt=Object.create(null);function gt(t,e,n){if(t==e)return!0;t||(t=vt),e||(e=vt);var i=Object.keys(t),r=Object.keys(e);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(var o=0,s=i;o<s.length;o++){var a=s[o];if(a!=n&&(-1==r.indexOf(a)||t[a]!==e[a]))return!1}return!0}function pt(t,e,n){var i=!1;if(e)for(var r in e)n&&r in n||(i=!0,"style"==r?t.style.cssText="":t.removeAttribute(r));if(n)for(var o in n)e&&e[o]==n[o]||(i=!0,"style"==o?t.style.cssText=n[o]:t.setAttribute(o,n[o]));return i}function mt(t){for(var e=Object.create(null),n=0;n<t.attributes.length;n++){var i=t.attributes[n];e[i.name]=i.value}return e}var yt=function(t){function e(){var t;return(0,c.Z)(this,e),(t=(0,a.Z)(this,e,arguments)).children=[],t.length=0,t.prevAttrs=void 0,t.attrs=null,t.breakAfter=0,t}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"merge",value:function(t,n,i,r,o,s){if(i){if(!(i instanceof e))return!1;this.dom||i.transferDOM(this)}return r&&this.setDeco(i?i.attrs:null),J(this,t,n,i?i.children.slice():[],o,s),!0}},{key:"split",value:function(t){var n=new e;if(n.breakAfter=this.breakAfter,0==this.length)return n;var i=this.childPos(t),r=i.i,o=i.off;o&&(n.append(this.children[r].split(o),0),this.children[r].merge(o,this.children[r].length,null,!1,0,0),r++);for(var s=r;s<this.children.length;s++)n.append(this.children[s],0);for(;r>0&&0==this.children[r-1].length;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=t,n}},{key:"transferDOM",value:function(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(t){gt(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}},{key:"append",value:function(t,e){ct(this,t,e)}},{key:"addLineDeco",value:function(t){var e=t.spec.attributes,n=t.spec.class;e&&(this.attrs=dt(e,this.attrs||{})),n&&(this.attrs=dt({class:n},this.attrs||{}))}},{key:"domAtPos",value:function(t){return lt(this,t)}},{key:"reuseDOM",value:function(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}},{key:"sync",value:function(t,n){var i;this.dom?4&this.flags&&(H(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&&(pt(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),(0,o.Z)((0,s.Z)(e.prototype),"sync",this).call(this,t,n);for(var r=this.dom.lastChild;r&&F.get(r)instanceof at;)r=r.lastChild;if(!(r&&this.length&&("BR"==r.nodeName||0!=(null===(i=F.get(r))||void 0===i?void 0:i.isEditable)||ot.ios&&this.children.some((function(t){return t instanceof st}))))){var a=document.createElement("BR");a.cmIgnore=!0,this.dom.appendChild(a)}}},{key:"measureTextSize",value:function(){if(0==this.children.length||this.length>20)return null;var t,e,n=0,i=(0,l.Z)(this.children);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(!(r instanceof st)||/[^ -~]/.test(r.text))return null;var o=M(r.dom);if(1!=o.length)return null;n+=o[0].width,t=o[0].height}}catch(s){i.e(s)}finally{i.f()}return n?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:n/this.length,textHeight:t}:null}},{key:"coordsAt",value:function(t,e){var n=ft(this,t,e);if(!this.children.length&&n&&this.parent){var i=this.parent.view.viewState.heightOracle,r=n.bottom-n.top;if(Math.abs(r-i.lineHeight)<2&&i.textHeight<r){var o=(r-i.textHeight)/2;return{top:n.top+o,bottom:n.bottom-o,left:n.left,right:n.left}}}return n}},{key:"become",value:function(t){return!1}},{key:"covers",value:function(){return!0}}],[{key:"find",value:function(t,n){for(var i=0,r=0;i<t.children.length;i++){var o=t.children[i],s=r+o.length;if(s>=n){if(o instanceof e)return o;if(s>n)break}r=s+o.breakAfter}return null}}]),e}(F),kt=function(t){function e(t,n,i){var r;return(0,c.Z)(this,e),(r=(0,a.Z)(this,e)).widget=t,r.length=n,r.deco=i,r.breakAfter=0,r.prevWidget=null,r}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"merge",value:function(t,n,i,r,o,s){return!(i&&(!(i instanceof e&&this.widget.compare(i.widget))||t>0&&o<=0||n<this.length&&s<=0))&&(this.length=t+(i?i.length:0)+(this.length-n),!0)}},{key:"domAtPos",value:function(t){return 0==t?_.before(this.dom):_.after(this.dom,t==this.length)}},{key:"split",value:function(t){var n=this.length-t;this.length=t;var i=new e(this.widget,n,this.deco);return i.breakAfter=this.breakAfter,i}},{key:"children",get:function(){return z}},{key:"sync",value:function(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(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):d.xv.empty}},{key:"domBoundsAround",value:function(){return null}},{key:"become",value:function(t){return t instanceof e&&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(){return!0}},{key:"ignoreEvent",value:function(t){return this.widget.ignoreEvent(t)}},{key:"isEditable",get:function(){return!1}},{key:"isWidget",get:function(){return!0}},{key:"coordsAt",value:function(t,e){return this.widget.coordsAt(this.dom,t,e)}},{key:"destroy",value:function(){(0,o.Z)((0,s.Z)(e.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}},{key:"covers",value:function(t){var e=this.deco,n=e.startSide,i=e.endSide;return n!=i&&(t<0?n<0:i>0)}}]),e}(F),wt=function(){function t(){(0,c.Z)(this,t)}return(0,f.Z)(t,[{key:"eq",value:function(t){return!1}},{key:"updateDOM",value:function(t,e){return!1}},{key:"compare",value:function(t){return this==t||this.constructor==t.constructor&&this.eq(t)}},{key:"estimatedHeight",get:function(){return-1}},{key:"lineBreaks",get:function(){return 0}},{key:"ignoreEvent",value:function(t){return!0}},{key:"coordsAt",value:function(t,e,n){return null}},{key:"isHidden",get:function(){return!1}},{key:"editable",get:function(){return!1}},{key:"destroy",value:function(t){}}]),t}(),bt=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(bt||(bt={})),xt=function(t){function e(t,n,i,r){var o;return(0,c.Z)(this,e),(o=(0,a.Z)(this,e)).startSide=t,o.endSide=n,o.widget=i,o.spec=r,o}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"heightRelevant",get:function(){return!1}},{key:"hasHeight",value:function(){return!!this.widget&&this.widget.estimatedHeight>-1}}],[{key:"mark",value:function(t){return new St(t)}},{key:"widget",value:function(t){var e=Math.max(-1e4,Math.min(1e4,t.side||0)),n=!!t.block;return e+=n&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new Mt(t,e,e,n,t.widget||null,!1)}},{key:"replace",value:function(t){var e,n,i=!!t.block;if(t.isBlockGap)e=-5e8,n=4e8;else{var r=Zt(t,i);e=(r.start?i?-3e8:-1:5e8)-1,n=1+(r.end?i?2e8:1:-6e8)}return new Mt(t,e,n,i,t.widget||null,!0)}},{key:"line",value:function(t){return new At(t)}},{key:"set",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return d.Xs.of(t,e)}}]),e}(d.uU);xt.none=d.Xs.empty;var St=function(t){function e(t){var n;(0,c.Z)(this,e);var i=Zt(t),r=i.start,o=i.end;return(n=(0,a.Z)(this,e,[r?-1:5e8,o?1:-6e8,null,t])).tagName=t.tagName||"span",n.class=t.class||"",n.attrs=t.attributes||null,n}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"eq",value:function(t){var n,i;return this==t||t instanceof e&&this.tagName==t.tagName&&(this.class||(null===(n=this.attrs)||void 0===n?void 0:n.class))==(t.class||(null===(i=t.attrs)||void 0===i?void 0:i.class))&&gt(this.attrs,t.attrs,"class")}},{key:"range",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(t>=n)throw new RangeError("Mark decorations may not be empty");return(0,o.Z)((0,s.Z)(e.prototype),"range",this).call(this,t,n)}}]),e}(xt);St.prototype.point=!1;var At=function(t){function e(t){return(0,c.Z)(this,e),(0,a.Z)(this,e,[-2e8,-2e8,null,t])}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"eq",value:function(t){return t instanceof e&&this.spec.class==t.spec.class&&gt(this.spec.attributes,t.spec.attributes)}},{key:"range",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return(0,o.Z)((0,s.Z)(e.prototype),"range",this).call(this,t,n)}}]),e}(xt);At.prototype.mapMode=d.gc.TrackBefore,At.prototype.point=!0;var Mt=function(t){function e(t,n,i,r,o,s){var h;return(0,c.Z)(this,e),(h=(0,a.Z)(this,e,[n,i,o,t])).block=r,h.isReplace=s,h.mapMode=r?n<=0?d.gc.TrackBefore:d.gc.TrackAfter:d.gc.TrackDel,h}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"type",get:function(){return this.startSide!=this.endSide?bt.WidgetRange:this.startSide<=0?bt.WidgetBefore:bt.WidgetAfter}},{key:"heightRelevant",get:function(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}},{key:"eq",value:function(t){return t instanceof e&&(n=this.widget,i=t.widget,n==i||!!(n&&i&&n.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var n,i}},{key:"range",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return(0,o.Z)((0,s.Z)(e.prototype),"range",this).call(this,t,n)}}]),e}(xt);function Zt(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.inclusiveStart,i=t.inclusiveEnd;return null==n&&(n=t.inclusive),null==i&&(i=t.inclusive),{start:null!=n?n:e,end:null!=i?i:e}}function Ct(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=n.length-1;r>=0&&n[r]+i>=t?n[r]=Math.max(n[r],e):n.push(t,e)}Mt.prototype.point=!0;var Ot=function(){function t(e,n,i,r){(0,c.Z)(this,t),this.doc=e,this.pos=n,this.end=i,this.disallowBlockEffectsFor=r,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=e.iter(),this.skip=n}return(0,f.Z)(t,[{key:"posCovered",value:function(){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 kt&&t.deco.endSide<0)}},{key:"getLine",value:function(){return this.curLine||(this.content.push(this.curLine=new yt),this.atCursorPos=!0),this.curLine}},{key:"flushBuffer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(Tt(new ut(-1),t),t.length),this.pendingBuffer=0)}},{key:"addBlockWidget",value:function(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}},{key:"finish",value:function(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 kt||this.getLine()}},{key:"buildText",value:function(t,e,n){for(;t>0;){if(this.textOff==this.text.length){var i=this.cursor.next(this.skip),r=i.value,o=i.lineBreak,s=i.done;if(this.skip=0,s)throw new Error("Ran out of text content when drawing inline views");if(o){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=r,this.textOff=0}var a=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-n)),this.getLine().append(Tt(new st(this.text.slice(this.textOff,this.textOff+a)),e),n),this.atCursorPos=!0,this.textOff+=a,t-=a,n=0}}},{key:"span",value:function(t,e,n,i){this.buildText(e-t,n,i),this.pos=e,this.openStart<0&&(this.openStart=i)}},{key:"point",value:function(t,e,n,i,r,o){if(this.disallowBlockEffectsFor[o]&&n instanceof Mt){if(n.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 s=e-t;if(n instanceof Mt)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new kt(n.widget||new Dt("div"),s,n));else{var a=ht.create(n.widget||new Dt("span"),s,s?0:n.startSide),h=this.atCursorPos&&!a.isEditable&&r<=i.length&&(t<e||n.startSide>0),u=!a.isEditable&&(t<e||r>i.length||n.startSide<=0),l=this.getLine();2!=this.pendingBuffer||h||a.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),h&&(l.append(Tt(new ut(1),i),r),r=i.length+Math.max(0,r-i.length)),l.append(Tt(a,i),r),this.atCursorPos=u,this.pendingBuffer=u?t<e||r>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);s&&(this.textOff+s<=this.text.length?this.textOff+=s:(this.skip+=s-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}}],[{key:"build",value:function(e,n,i,r,o){var s=new t(e,n,i,o);return s.openEnd=d.Xs.spans(r,n,i,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}]),t}();function Tt(t,e){var n,i=(0,l.Z)(e);try{for(i.s();!(n=i.n()).done;){var r=n.value;t=new at(r,[t],t.length)}}catch(o){i.e(o)}finally{i.f()}return t}var Dt=function(t){function e(t){var n;return(0,c.Z)(this,e),(n=(0,a.Z)(this,e)).tag=t,n}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"eq",value:function(t){return t.tag==this.tag}},{key:"toDOM",value:function(){return document.createElement(this.tag)}},{key:"updateDOM",value:function(t){return t.nodeName.toLowerCase()==this.tag}},{key:"isHidden",get:function(){return!0}}]),e}(wt),Et=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Et||(Et={})),Bt=Et.LTR,Rt=Et.RTL;function It(t){for(var e=[],n=0;n<t.length;n++)e.push(1<<+t[n]);return e}for(var Pt=It("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Nt=It("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Lt=Object.create(null),Vt=[],Ht=0,Wt=["()","[]","{}"];Ht<Wt.length;Ht++){var _t=Wt[Ht],zt=_t.charCodeAt(0),Ft=_t.charCodeAt(1);Lt[zt]=Ft,Lt[Ft]=-zt}function qt(t){return t<=247?Pt[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Nt[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}var jt=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Kt=function(){function t(e,n,i){(0,c.Z)(this,t),this.from=e,this.to=n,this.level=i}return(0,f.Z)(t,[{key:"dir",get:function(){return this.level%2?Rt:Bt}},{key:"side",value:function(t,e){return this.dir==e==t?this.to:this.from}},{key:"forward",value:function(t,e){return t==(this.dir==e)}}],[{key:"find",value:function(t,e,n,i){for(var r=-1,o=0;o<t.length;o++){var s=t[o];if(s.from<=e&&s.to>=e){if(s.level==n)return o;(r<0||(0!=i?i<0?s.from<e:s.to>e:t[r].level>s.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}]),t}();function Jt(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++){var i=t[n],r=e[n];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!Jt(i.inner,r.inner))return!1}return!0}var Ut=[];function Gt(t,e,n,i,r,o,s){var a=i%2?2:1;if(i%2==r%2)for(var h=e,u=0;h<n;){var l=!0,c=!1;if(u==o.length||h<o[u].from){var f=Ut[h];f!=a&&(l=!1,c=16==f)}var d=l||1!=a?null:[],v=l?i:i+1,g=h;t:for(;;)if(u<o.length&&g==o[u].from){if(c)break t;var p=o[u];if(!l)for(var m=p.to,y=u+1;;){if(m==n)break t;if(!(y<o.length&&o[y].from==m)){if(Ut[m]==a)break t;break}m=o[y++].to}if(u++,d)d.push(p);else p.from>h&&s.push(new Kt(h,p.from,v)),$t(t,p.direction==Bt!=!(v%2)?i+1:i,r,p.inner,p.from,p.to,s),h=p.to;g=p.to}else{if(g==n||(l?Ut[g]!=a:Ut[g]==a))break;g++}d?Gt(t,h,g,i+1,r,d,s):h<g&&s.push(new Kt(h,g,v)),h=g}else for(var k=n,w=o.length;k>e;){var b=!0,x=!1;if(!w||k>o[w-1].to){var S=Ut[k-1];S!=a&&(b=!1,x=16==S)}var A=b||1!=a?null:[],M=b?i:i+1,Z=k;t:for(;;)if(w&&Z==o[w-1].to){if(x)break t;var C=o[--w];if(!b)for(var O=C.from,T=w;;){if(O==e)break t;if(!T||o[T-1].to!=O){if(Ut[O-1]==a)break t;break}O=o[--T].from}if(A)A.push(C);else C.to<k&&s.push(new Kt(C.to,k,M)),$t(t,C.direction==Bt!=!(M%2)?i+1:i,r,C.inner,C.from,C.to,s),k=C.from;Z=C.from}else{if(Z==e||(b?Ut[Z-1]!=a:Ut[Z-1]==a))break;Z--}A?Gt(t,Z,k,i+1,r,A,s):Z<k&&s.push(new Kt(Z,k,M)),k=Z}}function $t(t,e,n,i,r,o,s){var a=e%2?2:1;!function(t,e,n,i,r){for(var o=0;o<=i.length;o++){for(var s=o?i[o-1].to:e,a=o<i.length?i[o].from:n,h=o?256:r,u=s,l=h,c=h;u<a;u++){var f=qt(t.charCodeAt(u));512==f?f=l:8==f&&4==c&&(f=16),Ut[u]=4==f?2:f,7&f&&(c=f),l=f}for(var d=s,v=h,g=h;d<a;d++){var p=Ut[d];if(128==p)d<a-1&&v==Ut[d+1]&&24&v?p=Ut[d]=v:Ut[d]=256;else if(64==p){for(var m=d+1;m<a&&64==Ut[m];)m++;for(var y=d&&8==v||m<n&&8==Ut[m]?1==g?1:8:256,k=d;k<m;k++)Ut[k]=y;d=m-1}else 8==p&&1==g&&(Ut[d]=1);v=p,7&p&&(g=p)}}}(t,r,o,i,a),function(t,e,n,i,r){for(var o=1==r?2:1,s=0,a=0,h=0;s<=i.length;s++)for(var u,l,c,f=s?i[s-1].to:e,d=s<i.length?i[s].from:n,v=f;v<d;v++)if(l=Lt[u=t.charCodeAt(v)])if(l<0){for(var g=a-3;g>=0;g-=3)if(Vt[g+1]==-l){var p=Vt[g+2],m=2&p?r:4&p?1&p?o:r:0;m&&(Ut[v]=Ut[Vt[g]]=m),a=g;break}}else{if(189==Vt.length)break;Vt[a++]=v,Vt[a++]=u,Vt[a++]=h}else if(2==(c=Ut[v])||1==c){var y=c==r;h=y?0:1;for(var k=a-3;k>=0;k-=3){var w=Vt[k+2];if(2&w)break;if(y)Vt[k+2]|=2;else{if(4&w)break;Vt[k+2]|=4}}}}(t,r,o,i,a),function(t,e,n,i){for(var r=0,o=i;r<=n.length;r++)for(var s=r?n[r-1].to:t,a=r<n.length?n[r].from:e,h=s;h<a;){var u=Ut[h];if(256==u){for(var l=h+1;;)if(l==a){if(r==n.length)break;l=n[r++].to,a=r<n.length?n[r].from:e}else{if(256!=Ut[l])break;l++}for(var c=1==o,f=c==(1==(l<e?Ut[l]:i))?c?1:2:i,d=l,v=r,g=v?n[v-1].to:t;d>h;)d==g&&(d=n[--v].from,g=v?n[v-1].to:t),Ut[--d]=f;h=l}else o=u,h++}}(r,o,i,a),Gt(t,r,o,e,n,i,s)}function Xt(t,e,n){if(!t)return[new Kt(0,0,e==Rt?1:0)];if(e==Bt&&!n.length&&!jt.test(t))return Yt(t.length);if(n.length)for(;t.length>Ut.length;)Ut[Ut.length]=256;var i=[],r=e==Bt?0:1;return $t(t,r,r,n,0,t.length,i),i}function Yt(t){return[new Kt(0,t,0)]}var Qt="";function te(t,e,n,i,r){var o,s=i.head-t.from,a=Kt.find(e,s,null!==(o=i.bidiLevel)&&void 0!==o?o:-1,i.assoc),h=e[a],u=h.side(r,n);if(s==u){var l=a+=r?1:-1;if(l<0||l>=e.length)return null;s=(h=e[a=l]).side(!r,n),u=h.side(r,n)}var c=(0,d.cp)(t.text,s,h.forward(r,n));(c<h.from||c>h.to)&&(c=u),Qt=t.text.slice(Math.min(s,c),Math.max(s,c));var f=a==(r?e.length-1:0)?null:e[a+(r?1:-1)];return f&&c==u&&f.level+(r?0:1)<h.level?d.jT.cursor(f.side(!r,n)+t.from,f.forward(r,n)?1:-1,f.level):d.jT.cursor(c+t.from,h.forward(r,n)?-1:1,h.level)}function ee(t,e,n){for(var i=e;i<n;i++){var r=qt(t.charCodeAt(i));if(1==r)return Bt;if(2==r||4==r)return Rt}return Bt}var ne=d.r$.define(),ie=d.r$.define(),re=d.r$.define(),oe=d.r$.define(),se=d.r$.define(),ae=d.r$.define(),he=d.r$.define(),ue=d.r$.define({combine:function(t){return t.some((function(t){return t}))}}),le=d.r$.define({combine:function(t){return t.some((function(t){return t}))}}),ce=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"nearest",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"nearest",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5];(0,c.Z)(this,t),this.range=e,this.y=n,this.x=i,this.yMargin=r,this.xMargin=o,this.isSnapshot=s}return(0,f.Z)(t,[{key:"map",value:function(e){return e.empty?this:new t(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},{key:"clip",value:function(e){return this.range.to<=e.doc.length?this:new t(d.jT.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}]),t}(),fe=d.Py.define({map:function(t,e){return t.map(e)}});function de(t,e,n){var i=t.facet(oe);i.length?i[0](e):window.onerror?window.onerror(String(e),n,void 0,void 0,e):n?console.error(n+":",e):console.error(e)}var ve=d.r$.define({combine:function(t){return!t.length||t[0]}}),ge=0,pe=d.r$.define(),me=function(){function t(e,n,i,r,o){(0,c.Z)(this,t),this.id=e,this.create=n,this.domEventHandlers=i,this.domEventObservers=r,this.extension=o(this)}return(0,f.Z)(t,null,[{key:"define",value:function(e,n){var i=n||{},r=i.eventHandlers,o=i.eventObservers,s=i.provide,a=i.decorations;return new t(ge++,e,r,o,(function(t){var e=[pe.of(t)];return a&&e.push(be.of((function(e){var n=e.plugin(t);return n?a(n):xt.none}))),s&&e.push(s(t)),e}))}},{key:"fromClass",value:function(e,n){return t.define((function(t){return new e(t)}),n)}}]),t}(),ye=function(){function t(e){(0,c.Z)(this,t),this.spec=e,this.mustUpdate=null,this.value=null}return(0,f.Z)(t,[{key:"update",value:function(t){if(this.value){if(this.mustUpdate){var e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(n){if(de(e.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(i){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(n){de(t.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}},{key:"destroy",value:function(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(n){de(t.state,n,"CodeMirror plugin crashed")}}},{key:"deactivate",value:function(){this.spec=this.value=null}}]),t}(),ke=d.r$.define(),we=d.r$.define(),be=d.r$.define(),xe=d.r$.define(),Se=d.r$.define(),Ae=d.r$.define();function Me(t,e){var n=t.state.facet(Ae);if(!n.length)return n;var i=n.map((function(e){return e instanceof Function?e(t):e})),r=[];return d.Xs.spans(i,e.from,e.to,{point:function(){},span:function(t,n,i,o){for(var s=t-e.from,a=n-e.from,h=r,u=i.length-1;u>=0;u--,o--){var l=i[u].spec.bidiIsolate,c=void 0;if(null==l&&(l=ee(e.text,s,a)),o>0&&h.length&&(c=h[h.length-1]).to==s&&c.direction==l)c.to=a,h=c.inner;else{var f={from:s,to:a,direction:l,inner:[]};h.push(f),h=f.inner}}}}),r}var Ze=d.r$.define();function Ce(t){var e,n=0,i=0,r=0,o=0,s=(0,l.Z)(t.state.facet(Ze));try{for(s.s();!(e=s.n()).done;){var a=(0,e.value)(t);a&&(null!=a.left&&(n=Math.max(n,a.left)),null!=a.right&&(i=Math.max(i,a.right)),null!=a.top&&(r=Math.max(r,a.top)),null!=a.bottom&&(o=Math.max(o,a.bottom)))}}catch(h){s.e(h)}finally{s.f()}return{left:n,right:i,top:r,bottom:o}}var Oe=d.r$.define(),Te=function(){function t(e,n,i,r){(0,c.Z)(this,t),this.fromA=e,this.toA=n,this.fromB=i,this.toB=r}return(0,f.Z)(t,[{key:"join",value:function(e){return new t(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}},{key:"addToSet",value:function(t){for(var e=t.length,n=this;e>0;e--){var i=t[e-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),t.splice(e-1,1)}}return t.splice(e,0,n),t}}],[{key:"extendWithRanges",value:function(e,n){if(0==n.length)return e;for(var i=[],r=0,o=0,s=0,a=0;;r++){for(var h=r==e.length?null:e[r],u=s-a,l=h?h.fromB:1e9;o<n.length&&n[o]<l;){var c=n[o],f=n[o+1],d=Math.max(a,c),v=Math.min(l,f);if(d<=v&&new t(d+u,v+u,d,v).addToSet(i),f>l)break;o+=2}if(!h)return i;new t(h.fromA,h.toA,h.fromB,h.toB).addToSet(i),s=h.toA,a=h.toB}}}]),t}(),De=function(){function t(e,n,i){(0,c.Z)(this,t),this.view=e,this.state=n,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=d.as.empty(this.startState.doc.length);var r,o=(0,l.Z)(i);try{for(o.s();!(r=o.n()).done;){var s=r.value;this.changes=this.changes.compose(s.changes)}}catch(h){o.e(h)}finally{o.f()}var a=[];this.changes.iterChangedRanges((function(t,e,n,i){return a.push(new Te(t,e,n,i))})),this.changedRanges=a}return(0,f.Z)(t,[{key:"viewportChanged",get:function(){return(4&this.flags)>0}},{key:"heightChanged",get:function(){return(2&this.flags)>0}},{key:"geometryChanged",get:function(){return this.docChanged||(10&this.flags)>0}},{key:"focusChanged",get:function(){return(1&this.flags)>0}},{key:"docChanged",get:function(){return!this.changes.empty}},{key:"selectionSet",get:function(){return this.transactions.some((function(t){return t.selection}))}},{key:"empty",get:function(){return 0==this.flags&&0==this.transactions.length}}],[{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}(),Ee=function(t){function e(t){var n;return(0,c.Z)(this,e),(n=(0,a.Z)(this,e)).view=t,n.decorations=[],n.dynamicDecorationMap=[],n.domChanged=null,n.hasComposition=null,n.markedForComposition=new Set,n.minWidth=0,n.minWidthFrom=0,n.minWidthTo=0,n.impreciseAnchor=null,n.impreciseHead=null,n.forceSelection=!1,n.lastUpdate=Date.now(),n.setDOM(t.contentDOM),n.children=[new yt],n.children[0].setParent((0,r.Z)(n)),n.updateDeco(),n.updateInner([new Te(0,0,0,t.state.doc.length)],0,null),n}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"length",get:function(){return this.view.state.doc.length}},{key:"update",value:function(t){var e,n=this,i=t.changedRanges;this.minWidth>0&&i.length&&(i.every((function(t){var e=t.fromA;return t.toA<n.minWidthFrom||e>n.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 r=-1;this.view.inputState.composing>=0&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?r=this.domChanged.newSel.head:function(t,e){var n=!1;e&&t.iterChangedRanges((function(t,i){t<e.to&&i>e.from&&(n=!0)}));return n}(t.changes,this.hasComposition)||t.selectionSet||(r=t.state.selection.main.head));var o=r>-1?function(t,e,n){var i=Re(t,n);if(!i)return null;var r=i.node,o=i.from,s=i.to,a=r.nodeValue;if(/[\n\r]/.test(a))return null;if(t.state.doc.sliceString(i.from,i.to)!=a)return null;for(var h=e.invertedDesc,u=new Te(h.mapPos(o),h.mapPos(s),o,s),l=[],c=r.parentNode;;c=c.parentNode){var f=F.get(c);if(f instanceof at)l.push({node:c,deco:f.mark});else{if(f instanceof yt||"DIV"==c.nodeName&&c.parentNode==t.contentDOM)return{range:u,text:r,marks:l,line:c};if(c==t.contentDOM)return null;l.push({node:c,deco:new St({inclusive:!0,attributes:mt(c),tagName:c.tagName.toLowerCase()})})}}}(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();var s=this.hasComposition,a=s.from,h=s.to;i=new Te(a,h,t.changes.mapPos(a,-1),t.changes.mapPos(h,1)).addToSet(i.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(ot.ie||ot.chrome)&&!o&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);var u,l,c,f,v=this.decorations,g=this.updateDeco(),p=(u=v,l=g,c=t.changes,f=new Pe,d.Xs.compare(u,l,c,f),f.changes);return i=Te.extendWithRanges(i,p),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,t.startState.doc.length,o),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}},{key:"updateInner",value:function(t,e,n){var i=this;this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,n);var r=this.view.observer;r.ignore((function(){i.dom.style.height=i.view.viewState.contentHeight/i.view.scaleY+"px",i.dom.style.flexBasis=i.minWidth?i.minWidth+"px":"";var t=ot.chrome||ot.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;i.sync(i.view,t),i.flags&=-8,t&&(t.written||r.selectionRange.focusNode!=t.node)&&(i.forceSelection=!0),i.dom.style.height=""})),this.markedForComposition.forEach((function(t){return t.flags&=-9}));var o=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){var s,a=(0,l.Z)(this.children);try{for(a.s();!(s=a.n()).done;){var h=s.value;h instanceof kt&&h.widget instanceof Be&&o.push(h.dom)}}catch(u){a.e(u)}finally{a.f()}}r.updateGaps(o)}},{key:"updateChildren",value:function(t,e,n){for(var i=n?n.range.addToSet(t.slice()):t,r=this.childCursor(e),o=i.length-1;;o--){var s=o>=0?i[o]:null;if(!s)break;var a=s.fromA,h=s.toA,u=s.fromB,l=s.toB,c=void 0,f=void 0,d=void 0,v=void 0;if(n&&n.range.fromB<l&&n.range.toB>u){var g=Ot.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),p=Ot.build(this.view.state.doc,n.range.toB,l,this.decorations,this.dynamicDecorationMap);f=g.breakAtStart,d=g.openStart,v=p.openEnd;var m=this.compositionView(n);p.breakAtStart?m.breakAfter=1:p.content.length&&m.merge(m.length,m.length,p.content[0],!1,p.openStart,0)&&(m.breakAfter=p.content[0].breakAfter,p.content.shift()),g.content.length&&m.merge(0,0,g.content[g.content.length-1],!0,0,g.openEnd)&&g.content.pop(),c=g.content.concat(m).concat(p.content)}else{var y=Ot.build(this.view.state.doc,u,l,this.decorations,this.dynamicDecorationMap);c=y.content,f=y.breakAtStart,d=y.openStart,v=y.openEnd}var k=r.findPos(h,1),w=k.i,b=k.off,x=r.findPos(a,-1);K(this,x.i,x.off,w,b,c,f,d,v)}n&&this.fixCompositionDOM(n)}},{key:"compositionView",value:function(t){var e=new st(t.text.nodeValue);e.flags|=8;var n,i=(0,l.Z)(t.marks);try{for(i.s();!(n=i.n()).done;){var r=n.value.deco;e=new at(r,[e],e.length)}}catch(s){i.e(s)}finally{i.f()}var o=new yt;return o.append(e,0),o}},{key:"fixCompositionDOM",value:function(t){var e=this,n=function(t,n){n.flags|=8|(n.children.some((function(t){return 7&t.flags}))?1:0),e.markedForComposition.add(n);var i=F.get(t);i&&i!=n&&(i.dom=null),n.setDOM(t)},i=this.childPos(t.range.fromB,1),r=this.children[i.i];n(t.line,r);for(var o=t.marks.length-1;o>=-1;o--)i=r.childPos(i.off,1),r=r.children[i.i],n(o>=0?t.marks[o].node:t.text,r)}},{key:"updateSelection",value:function(){var t=this,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();var n=this.view.root.activeElement,i=n==this.dom,r=!i&&A(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(i||e||r){var o=this.forceSelection;this.forceSelection=!1;var s,a=this.view.state.selection.main,h=this.moveToLine(this.domAtPos(a.anchor)),u=a.empty?h:this.moveToLine(this.domAtPos(a.head));if(ot.gecko&&a.empty&&!this.hasComposition&&(1==(s=h).node.nodeType&&s.node.firstChild&&(0==s.offset||"false"==s.node.childNodes[s.offset-1].contentEditable)&&(s.offset==s.node.childNodes.length||"false"==s.node.childNodes[s.offset].contentEditable))){var l=document.createTextNode("");this.view.observer.ignore((function(){return h.node.insertBefore(l,h.node.childNodes[h.offset]||null)})),h=u=new _(l,0),o=!0}var c=this.view.observer.selectionRange;!o&&c.focusNode&&(Z(h.node,h.offset,c.anchorNode,c.anchorOffset)&&Z(u.node,u.offset,c.focusNode,c.focusOffset)||this.suppressWidgetCursorChange(c,a))||(this.view.observer.ignore((function(){ot.android&&ot.chrome&&t.dom.contains(c.focusNode)&&function(t,e){for(var n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(c.focusNode,t.dom)&&(t.dom.blur(),t.dom.focus({preventScroll:!0}));var e,i,o=x(t.view.root);if(o)if(a.empty){if(ot.gecko){var s=(e=h.node,i=h.offset,1!=e.nodeType?0:(i&&"false"==e.childNodes[i-1].contentEditable?1:0)|(i<e.childNodes.length&&"false"==e.childNodes[i].contentEditable?2:0));if(s&&3!=s){var l=Ie(h.node,h.offset,1==s?1:-1);l&&(h=new _(l.node,l.offset))}}o.collapse(h.node,h.offset),null!=a.bidiLevel&&void 0!==o.caretBidiLevel&&(o.caretBidiLevel=a.bidiLevel)}else if(o.extend){o.collapse(h.node,h.offset);try{o.extend(u.node,u.offset)}catch(v){}}else{var f=document.createRange();if(a.anchor>a.head){var d=[u,h];h=d[0],u=d[1]}f.setEnd(u.node,u.offset),f.setStart(h.node,h.offset),o.removeAllRanges(),o.addRange(f)}else;r&&t.view.root.activeElement==t.dom&&(t.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(h,u)),this.impreciseAnchor=h.precise?null:new _(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new _(c.focusNode,c.focusOffset)}}},{key:"suppressWidgetCursorChange",value:function(t,e){return this.hasComposition&&e.empty&&Z(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}},{key:"enforceCursorAssoc",value:function(){if(!this.hasComposition){var t=this.view,e=t.state.selection.main,n=x(t.root),i=t.observer.selectionRange,r=i.anchorNode,o=i.anchorOffset;if(n&&e.empty&&e.assoc&&n.modify){var s=yt.find(this,e.head);if(s){var a=s.posAtStart;if(e.head!=a&&e.head!=a+s.length){var h=this.coordsAt(e.head,-1),u=this.coordsAt(e.head,1);if(h&&u&&!(h.bottom>u.top)){var l=this.domAtPos(e.head+e.assoc);n.collapse(l.node,l.offset),n.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();var c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&n.collapse(r,o)}}}}}}},{key:"moveToLine",value:function(t){var e,n=this.dom;if(t.node!=n)return t;for(var i=t.offset;!e&&i<n.childNodes.length;i++){var r=F.get(n.childNodes[i]);r instanceof yt&&(e=r.domAtPos(0))}for(var o=t.offset-1;!e&&o>=0;o--){var s=F.get(n.childNodes[o]);s instanceof yt&&(e=s.domAtPos(s.length))}return e?new _(e.node,e.offset,!0):t}},{key:"nearest",value:function(t){for(var e=t;e;){var n=F.get(e);if(n&&n.rootView==this)return n;e=e.parentNode}return null}},{key:"posFromDOM",value:function(t,e){var n=this.nearest(t);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(t,e)+n.posAtStart}},{key:"domAtPos",value:function(t){for(var e=this.childCursor().findPos(t,-1),n=e.i,i=e.off;n<this.children.length-1;){var r=this.children[n];if(i<r.length||r instanceof yt)break;n++,i=0}return this.children[n].domAtPos(i)}},{key:"coordsAt",value:function(t,e){for(var n=null,i=0,r=this.length,o=this.children.length-1;o>=0;o--){var s=this.children[o],a=r-s.breakAfter,h=a-s.length;if(a<t)break;h<=t&&(h<t||s.covers(-1))&&(a>t||s.covers(1))&&(!n||s instanceof yt&&!(n instanceof yt&&e>=0))&&(n=s,i=h),r=h}return n?n.coordsAt(t-i,e):null}},{key:"coordsForChar",value:function(t){var e=this.childPos(t,1),n=e.i,i=e.off,r=this.children[n];if(!(r instanceof yt))return null;for(;r.children.length;){for(var o=r.childPos(i,1),s=o.i,a=o.off;;s++){if(s==r.children.length)return null;if((r=r.children[s]).length)break}i=a}if(!(r instanceof st))return null;var h=(0,d.cp)(r.text,i);if(h==i)return null;for(var u=L(r.dom,i,h).getClientRects(),l=0;l<u.length;l++){var c=u[l];if(l==u.length-1||c.top<c.bottom&&c.left<c.right)return c}return null}},{key:"measureVisibleLineHeights",value:function(t){for(var e=[],n=t.from,i=t.to,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==Et.LTR,h=0,u=0;u<this.children.length;u++){var l=this.children[u],c=h+l.length;if(c>i)break;if(h>=n){var f=l.dom.getBoundingClientRect();if(e.push(f.height),o){var d=l.dom.lastChild,v=d?M(d):[];if(v.length){var g=v[v.length-1],p=a?g.right-f.left:f.right-g.left;p>s&&(s=p,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=c)}}}h=c+l.breakAfter}return e}},{key:"textDirectionAt",value:function(t){var e=this.childPos(t,1).i;return"rtl"==getComputedStyle(this.children[e].dom).direction?Et.RTL:Et.LTR}},{key:"measureTextSize",value:function(){var t,e=this,n=(0,l.Z)(this.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(i instanceof yt){var r=i.measureTextSize();if(r)return r}}}catch(u){n.e(u)}finally{n.f()}var o,s,a,h=document.createElement("div");return h.className="cm-line",h.style.width="99999px",h.style.position="absolute",h.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((function(){e.dom.appendChild(h);var t=M(h.firstChild)[0];o=h.getBoundingClientRect().height,s=t?t.width/27:7,a=t?t.height:o,h.remove()})),{lineHeight:o,charWidth:s,textHeight:a}}},{key:"childCursor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length,e=this.children.length;return e&&(t-=this.children[--e].length),new j(this.children,t,e)}},{key:"computeBlockGapDeco",value:function(){for(var t=[],e=this.view.viewState,n=0,i=0;;i++){var r=i==e.viewports.length?null:e.viewports[i],o=r?r.from-1:this.length;if(o>n){var s=(e.lineBlockAt(o).bottom-e.lineBlockAt(n).top)/this.view.scaleY;t.push(xt.replace({widget:new Be(s),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return xt.set(t)}},{key:"updateDeco",value:function(){var t=this,e=this.view.state.facet(be).map((function(e,n){return(t.dynamicDecorationMap[n]="function"==typeof e)?e(t.view):e})),n=!1,i=this.view.state.facet(xe).map((function(e,i){var r="function"==typeof e;return r&&(n=!0),r?e(t.view):e}));i.length&&(this.dynamicDecorationMap[e.length]=n,e.push(d.Xs.join(i)));for(var r=e.length;r<e.length+3;r++)this.dynamicDecorationMap[r]=!1;return this.decorations=[].concat((0,u.Z)(e),[this.computeBlockGapDeco(),this.view.viewState.lineGapDeco])}},{key:"scrollIntoView",value:function(t){if(t.isSnapshot){var e=this.view.viewState.lineBlockAt(t.range.head);return this.view.scrollDOM.scrollTop=e.top-t.yMargin,void(this.view.scrollDOM.scrollLeft=t.xMargin)}var n,i=t.range,r=this.coordsAt(i.head,i.empty?i.assoc:i.head>i.anchor?-1:1);if(r){!i.empty&&(n=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(r={left:Math.min(r.left,n.left),top:Math.min(r.top,n.top),right:Math.max(r.right,n.right),bottom:Math.max(r.bottom,n.bottom)});var o=Ce(this.view),s={left:r.left-o.left,top:r.top-o.top,right:r.right+o.right,bottom:r.bottom+o.bottom},a=this.view.scrollDOM,h=a.offsetWidth,u=a.offsetHeight;!function(t,e,n,i,r,o,s,a){for(var h=t.ownerDocument,u=h.defaultView||window,l=t,c=!1;l&&!c;)if(1==l.nodeType){var f=void 0,d=l==h.body,v=1,g=1;if(d)f=E(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(l).position)&&(c=!0),l.scrollHeight<=l.clientHeight&&l.scrollWidth<=l.clientWidth){l=l.assignedSlot||l.parentNode;continue}var p=l.getBoundingClientRect(),m=B(l,p);v=m.scaleX,g=m.scaleY,f={left:p.left,right:p.left+l.clientWidth*v,top:p.top,bottom:p.top+l.clientHeight*g}}var y=0,k=0;if("nearest"==r)e.top<f.top?(k=-(f.top-e.top+s),n>0&&e.bottom>f.bottom+k&&(k=e.bottom-f.bottom+k+s)):e.bottom>f.bottom&&(k=e.bottom-f.bottom+s,n<0&&e.top-k<f.top&&(k=-(f.top+k-e.top+s)));else{var w=e.bottom-e.top,b=f.bottom-f.top;k=("center"==r&&w<=b?e.top+w/2-b/2:"start"==r||"center"==r&&n<0?e.top-s:e.bottom-b+s)-f.top}if("nearest"==i?e.left<f.left?(y=-(f.left-e.left+o),n>0&&e.right>f.right+y&&(y=e.right-f.right+y+o)):e.right>f.right&&(y=e.right-f.right+o,n<0&&e.left<f.left+y&&(y=-(f.left+y-e.left+o))):y=("center"==i?e.left+(e.right-e.left)/2-(f.right-f.left)/2:"start"==i==a?e.left-o:e.right-(f.right-f.left)+o)-f.left,y||k)if(d)u.scrollBy(y,k);else{var x=0,S=0;if(k){var A=l.scrollTop;l.scrollTop+=k/g,S=(l.scrollTop-A)*g}if(y){var M=l.scrollLeft;l.scrollLeft+=y/v,x=(l.scrollLeft-M)*v}e={left:e.left-x,top:e.top-S,right:e.right-x,bottom:e.bottom-S},x&&Math.abs(x-y)<1&&(i="nearest"),S&&Math.abs(S-k)<1&&(r="nearest")}if(d)break;l=l.assignedSlot||l.parentNode}else{if(11!=l.nodeType)break;l=l.host}}(this.view.scrollDOM,s,i.head<i.anchor?-1:1,t.x,t.y,Math.max(Math.min(t.xMargin,h),-h),Math.max(Math.min(t.yMargin,u),-u),this.view.textDirection==Et.LTR)}}}]),e}(F);var Be=function(t){function e(t){var n;return(0,c.Z)(this,e),(n=(0,a.Z)(this,e)).height=t,n}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"toDOM",value:function(){var t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}},{key:"eq",value:function(t){return t.height==this.height}},{key:"updateDOM",value:function(t){return t.style.height=this.height+"px",!0}},{key:"editable",get:function(){return!0}},{key:"estimatedHeight",get:function(){return this.height}}]),e}(wt);function Re(t,e){var n=t.observer.selectionRange,i=n.focusNode&&Ie(n.focusNode,n.focusOffset,0);if(!i)return null;var r=e-i.offset;return{from:r,to:r+i.node.nodeValue.length,node:i.node}}function Ie(t,e,n){if(n<=0)for(var i=t,r=e;;){if(3==i.nodeType)return{node:i,offset:r};if(!(1==i.nodeType&&r>0))break;r=T(i=i.childNodes[r-1])}if(n>=0)for(var o=t,s=e;;){if(3==o.nodeType)return{node:o,offset:s};if(!(1==o.nodeType&&s<o.childNodes.length&&n>=0))break;o=o.childNodes[s],s=0}return null}var Pe=function(){function t(){(0,c.Z)(this,t),this.changes=[]}return(0,f.Z)(t,[{key:"compareRange",value:function(t,e){Ct(t,e,this.changes)}},{key:"comparePoint",value:function(t,e){Ct(t,e,this.changes)}}]),t}();function Ne(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function Le(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function Ve(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function He(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function We(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function _e(t,e,n){for(var i,r,o,s,a,h,u,l,c=!1,f=t.firstChild;f;f=f.nextSibling)for(var d=M(f),v=0;v<d.length;v++){var g=d[v];r&&Ve(r,g)&&(g=He(We(g,r.bottom),r.top));var p=Ne(e,g),m=Le(n,g);if(0==p&&0==m)return 3==f.nodeType?ze(f,e,n):_e(f,e,n);if(!i||s>m||s==m&&o>p){i=f,r=g,o=p,s=m;var y=m?n<g.top?-1:1:p?e<g.left?-1:1:0;c=!y||(y>0?v<d.length-1:v>0)}0==p?n>g.bottom&&(!u||u.bottom<g.bottom)?(a=f,u=g):n<g.top&&(!l||l.top>g.top)&&(h=f,l=g):u&&Ve(u,g)?u=We(u,g.bottom):l&&Ve(l,g)&&(l=He(l,g.top))}if(u&&u.bottom>=n?(i=a,r=u):l&&l.top<=n&&(i=h,r=l),!i)return{node:t,offset:0};var k=Math.max(r.left,Math.min(r.right,e));return 3==i.nodeType?ze(i,k,n):c&&"false"!=i.contentEditable?_e(i,k,n):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,i)+(e>=(r.left+r.right)/2?1:0)}}function ze(t,e,n){for(var i=t.nodeValue.length,r=-1,o=1e9,s=0,a=0;a<i;a++)for(var h=L(t,a,a+1).getClientRects(),u=0;u<h.length;u++){var l=h[u];if(l.top!=l.bottom){s||(s=e-l.left);var c=(l.top>n?l.top-n:n-l.bottom)-1;if(l.left-1<=e&&l.right+1>=e&&c<o){var f=e>=(l.left+l.right)/2,d=f;if(ot.chrome||ot.gecko)L(t,a).getBoundingClientRect().left==l.right&&(d=!f);if(c<=0)return{node:t,offset:a+(d?1:0)};r=a+(d?1:0),o=c}}}return{node:t,offset:r>-1?r:s>0?t.nodeValue.length:0}}function Fe(t,e,n){var i,r,o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=t.contentDOM.getBoundingClientRect(),h=a.top+t.viewState.paddingTop,u=t.viewState.docHeight,l=e.x,c=e.y,f=c-h;if(f<0)return 0;if(f>u)return t.state.doc.length;for(var d=t.viewState.heightOracle.textHeight/2,v=!1;(o=t.elementAtHeight(f)).type!=bt.Text;)for(;!((f=s>0?o.bottom+d:o.top-d)>=0&&f<=u);){if(v)return n?null:0;v=!0,s=-s}c=h+f;var g=o.from;if(g<t.viewport.from)return 0==t.viewport.from?0:n?null:qe(t,a,o,l,c);if(g>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:qe(t,a,o,l,c);var p=t.dom.ownerDocument,m=t.root.elementFromPoint?t.root:p,y=m.elementFromPoint(l,c);y&&!t.contentDOM.contains(y)&&(y=null),y||(l=Math.max(a.left+1,Math.min(a.right-1,l)),(y=m.elementFromPoint(l,c))&&!t.contentDOM.contains(y)&&(y=null));var k,w=-1;if(y&&0!=(null===(i=t.docView.nearest(y))||void 0===i?void 0:i.isEditable))if(p.caretPositionFromPoint){var b=p.caretPositionFromPoint(l,c);b&&(k=b.offsetNode,w=b.offset)}else if(p.caretRangeFromPoint){var x=p.caretRangeFromPoint(l,c);x&&(k=x.startContainer,w=x.startOffset,(!t.contentDOM.contains(k)||ot.safari&&function(t,e,n){var i;if(3!=t.nodeType||e!=(i=t.nodeValue.length))return!1;for(var r=t.nextSibling;r;r=r.nextSibling)if(1!=r.nodeType||"BR"!=r.nodeName)return!1;return L(t,i-1,i).getBoundingClientRect().left>n}(k,w,l)||ot.chrome&&function(t,e,n){if(0!=e)return!1;for(var i=t;;){var r=i.parentNode;if(!r||1!=r.nodeType||r.firstChild!=i)return!1;if(r.classList.contains("cm-line"))break;i=r}var o=1==t.nodeType?t.getBoundingClientRect():L(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-o.left>5}(k,w,l))&&(k=void 0))}if(!k||!t.docView.dom.contains(k)){var S=yt.find(t.docView,g);if(!S)return f>o.top+o.height/2?o.to:o.from;var A=_e(S.dom,l,c);k=A.node,w=A.offset}var M=t.docView.nearest(k);if(!M)return null;if(M.isWidget&&1==(null===(r=M.dom)||void 0===r?void 0:r.nodeType)){var Z=M.dom.getBoundingClientRect();return e.y<Z.top||e.y<=Z.bottom&&e.x<=(Z.left+Z.right)/2?M.posAtStart:M.posAtEnd}return M.localPosFromDOM(k,w)+M.posAtStart}function qe(t,e,n,i,r){var o=Math.round((i-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>1.5*t.defaultLineHeight){var s=t.viewState.heightOracle.textHeight;o+=Math.floor((r-n.top-.5*(t.defaultLineHeight-s))/s)*t.viewState.heightOracle.lineLength}var a=t.state.sliceDoc(n.from,n.to);return n.from+(0,d.Gz)(a,o,t.state.tabSize)}function je(t,e){var n=t.lineBlockAt(e);if(Array.isArray(n.type)){var i,r=(0,l.Z)(n.type);try{for(r.s();!(i=r.n()).done;){var o=i.value;if(o.to>e||o.to==e&&(o.to==n.to||o.type==bt.Text))return o}}catch(s){r.e(s)}finally{r.f()}}return n}function Ke(t,e,n,i){for(var r=t.state.doc.lineAt(e.head),o=t.bidiSpans(r),s=t.textDirectionAt(r.from),a=e,h=null;;){var u=te(r,o,s,a,n),l=Qt;if(!u){if(r.number==(n?t.state.doc.lines:1))return a;l="\n",r=t.state.doc.line(r.number+(n?1:-1)),o=t.bidiSpans(r),u=t.visualLineSide(r,!n)}if(h){if(!h(l))return a}else{if(!i)return u;h=i(l)}a=u}}function Je(t,e,n){for(var i,r=function(){var i,r=0,o=(0,l.Z)(t);try{for(o.s();!(i=o.n()).done;){i.value.between(e-1,e+1,(function(t,i,o){if(e>t&&e<i){var s=r||n||(e-t<i-e?-1:1);e=s<0?t:i,r=s}}))}}catch(s){o.e(s)}finally{o.f()}if(!r)return{v:e}};;)if(i=r())return i.v}function Ue(t,e,n){var i=Je(t.state.facet(Se).map((function(e){return e(t)})),n.from,e.head>n.from?-1:1);return i==n.from?n:d.jT.cursor(i,i<n.from?1:-1)}var Ge=function(){function t(e){(0,c.Z)(this,t),this.view=e,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=e.hasFocus,ot.safari&&e.contentDOM.addEventListener("input",(function(){return null})),ot.gecko&&function(t){Sn.has(t)||(Sn.add(t),t.addEventListener("copy",(function(){})),t.addEventListener("cut",(function(){})))}(e.contentDOM.ownerDocument)}return(0,f.Z)(t,[{key:"setSelectionOrigin",value:function(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}},{key:"handleEvent",value:function(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var n,i=e.target;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=F.get(i))&&n.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(t,e){var n=this.handlers[t];if(n){var i,r=(0,l.Z)(n.observers);try{for(r.s();!(i=r.n()).done;){(0,i.value)(this.view,e)}}catch(h){r.e(h)}finally{r.f()}var o,s=(0,l.Z)(n.handlers);try{for(s.s();!(o=s.n()).done;){var a=o.value;if(e.defaultPrevented)break;if(a(this.view,e)){e.preventDefault();break}}}catch(h){s.e(h)}finally{s.f()}}}},{key:"ensureHandlers",value:function(t){var e=Xe(t),n=this.handlers,i=this.view.contentDOM;for(var r in e)if("scroll"!=r){var o=!e[r].handlers.length,s=n[r];s&&o!=!s.handlers.length&&(i.removeEventListener(r,this.handleEvent),s=null),s||i.addEventListener(r,this.handleEvent,{passive:o})}for(var a in n)"scroll"==a||e[a]||i.removeEventListener(a,this.handleEvent);this.handlers=e}},{key:"keydown",value:function(t){var e,n=this;return this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&Date.now()<this.lastEscPress+2e3||(27!=t.keyCode&&tn.indexOf(t.keyCode)<0&&(this.view.inputState.lastEscPress=0),!ot.android||!ot.chrome||t.synthetic||13!=t.keyCode&&8!=t.keyCode?!ot.ios||t.synthetic||t.altKey||t.metaKey||!((e=Ye.find((function(e){return e.keyCode==t.keyCode})))&&!t.ctrlKey||Qe.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout((function(){return n.flushIOSKey()}),250),!0):(this.view.observer.delayAndroidKey(t.key,t.keyCode),!0))}},{key:"flushIOSKey",value:function(){var t=this.pendingIOSKey;return!!t&&(this.pendingIOSKey=void 0,V(this.view.contentDOM,t.key,t.keyCode))}},{key:"ignoreDuringComposition",value:function(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(ot.safari&&!ot.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}},{key:"startMouseSelection",value:function(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}},{key:"update",value:function(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(){this.mouseSelection&&this.mouseSelection.destroy()}}]),t}();function $e(t,e){return function(n,i){try{return e.call(t,i,n)}catch(r){de(n.state,r)}}}function Xe(t){var e=Object.create(null);function n(t){return e[t]||(e[t]={observers:[],handlers:[]})}var i,r=(0,l.Z)(t);try{for(r.s();!(i=r.n()).done;){var o=i.value,s=o.spec;if(s&&s.domEventHandlers)for(var a in s.domEventHandlers){var h=s.domEventHandlers[a];h&&n(a).handlers.push($e(o.value,h))}if(s&&s.domEventObservers)for(var u in s.domEventObservers){var c=s.domEventObservers[u];c&&n(u).observers.push($e(o.value,c))}}}catch(v){r.e(v)}finally{r.f()}for(var f in rn)n(f).handlers.push(rn[f]);for(var d in on)n(d).observers.push(on[d]);return e}var Ye=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Qe="dthko",tn=[16,17,18,20,91,92,224,225];function en(t){return.7*Math.max(0,t)+8}var nn=function(){function t(e,n,i,r){(0,c.Z)(this,t),this.view=e,this.startEvent=n,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParent=function(t){for(var e=t.ownerDocument,n=t.parentNode;n&&n!=e.body;)if(1==n.nodeType){if(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else{if(11!=n.nodeType)break;n=n.host}return null}(e.contentDOM),this.atoms=e.state.facet(Se).map((function(t){return t(e)}));var o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(d.yy.allowMultipleSelections)&&function(t,e){var n=t.state.facet(ne);return n.length?n[0](e):ot.mac?e.metaKey:e.ctrlKey}(e,n),this.dragging=!(!function(t,e){var n=t.state.selection.main;if(n.empty)return!1;var i=x(t.root);if(!i||0==i.rangeCount)return!0;for(var r=i.getRangeAt(0).getClientRects(),o=0;o<r.length;o++){var s=r[o];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}(e,n)||1!=mn(n))&&null}return(0,f.Z)(t,[{key:"start",value:function(t){!1===this.dragging&&this.select(t)}},{key:"move",value:function(t){var e;if(0==t.buttons)return this.destroy();if(!(this.dragging||null==this.dragging&&(n=this.startEvent,i=t,Math.max(Math.abs(n.clientX-i.clientX),Math.abs(n.clientY-i.clientY))<10))){var n,i;this.select(this.lastEvent=t);var r=0,o=0,s=(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},a=Ce(this.view);t.clientX-a.left<=s.left+6?r=-en(s.left-t.clientX):t.clientX+a.right>=s.right-6&&(r=en(t.clientX-s.right)),t.clientY-a.top<=s.top+6?o=-en(s.top-t.clientY):t.clientY+a.bottom>=s.bottom-6&&(o=en(t.clientY-s.bottom)),this.setScrollSpeed(r,o)}}},{key:"up",value:function(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}},{key:"destroy",value:function(){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(t,e){var n=this;this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval((function(){return n.scroll()}),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}},{key:"scroll",value:function(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}},{key:"skipAtoms",value:function(t){for(var e=null,n=0;n<t.ranges.length;n++){var i=t.ranges[n],r=null;if(i.empty){var o=Je(this.atoms,i.from,0);o!=i.from&&(r=d.jT.cursor(o,-1))}else{var s=Je(this.atoms,i.from,-1),a=Je(this.atoms,i.to,1);s==i.from&&a==i.to||(r=d.jT.range(i.from==i.anchor?s:a,i.from==i.head?s:a))}r&&(e||(e=t.ranges.slice()),e[n]=r)}return e?d.jT.create(e,t.mainIndex):t}},{key:"select",value:function(t){var e=this.view,n=this.skipAtoms(this.style.get(t,this.extend,this.multiple));!this.mustSelect&&n.eq(e.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}},{key:"update",value:function(t){var e=this;this.style.update(t)&&setTimeout((function(){return e.select(e.lastEvent)}),20)}}]),t}();var rn=Object.create(null),on=Object.create(null),sn=ot.ie&&ot.ie_version<15||ot.ios&&ot.webkit_version<604;function an(t,e){var n,i=t.state,r=1,o=i.toText(e),s=o.lines==i.selection.ranges.length,a=null!=kn&&i.selection.ranges.every((function(t){return t.empty}))&&kn==o.toString();if(a){var h=-1;n=i.changeByRange((function(t){var n=i.doc.lineAt(t.from);if(n.from==h)return{range:t};h=n.from;var a=i.toText((s?o.line(r++).text:e)+i.lineBreak);return{changes:{from:n.from,insert:a},range:d.jT.cursor(t.from+a.length)}}))}else n=s?i.changeByRange((function(t){var e=o.line(r++);return{changes:{from:t.from,to:t.to,insert:e.text},range:d.jT.cursor(t.from+e.length)}})):i.replaceSelection(o);t.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function hn(t,e,n,i){if(1==i)return d.jT.cursor(e,n);if(2==i)return function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=t.charCategorizer(e),r=t.doc.lineAt(e),o=e-r.from;if(0==r.length)return d.jT.cursor(e);0==o?n=1:o==r.length&&(n=-1);var s=o,a=o;n<0?s=(0,d.cp)(r.text,o,!1):a=(0,d.cp)(r.text,o);for(var h=i(r.text.slice(s,a));s>0;){var u=(0,d.cp)(r.text,s,!1);if(i(r.text.slice(u,s))!=h)break;s=u}for(;a<r.length;){var l=(0,d.cp)(r.text,a);if(i(r.text.slice(a,l))!=h)break;a=l}return d.jT.range(s+r.from,a+r.from)}(t.state,e,n);var r=yt.find(t.docView,e),o=t.state.doc.lineAt(r?r.posAtEnd:e),s=r?r.posAtStart:o.from,a=r?r.posAtEnd:o.to;return a<t.state.doc.length&&a==o.to&&a++,d.jT.range(s,a)}on.scroll=function(t){t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft},rn.keydown=function(t,e){return t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now()),!1},on.touchstart=function(t,e){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},on.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer")},rn.mousedown=function(t,e){if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;var n,i=null,r=(0,l.Z)(t.state.facet(re));try{for(r.s();!(n=r.n()).done;){if(i=(0,n.value)(t,e))break}}catch(a){r.e(a)}finally{r.f()}if(i||0!=e.button||(i=function(t,e){var n=fn(t,e),i=mn(e),r=t.state.selection;return{update:function(t){t.docChanged&&(n.pos=t.changes.mapPos(n.pos),r=r.map(t.changes))},get:function(e,o,s){var a,h=fn(t,e),u=hn(t,h.pos,h.bias,i);if(n.pos!=h.pos&&!o){var l=hn(t,n.pos,n.bias,i),c=Math.min(l.from,u.from),f=Math.max(l.to,u.to);u=c<u.from?d.jT.range(c,f):d.jT.range(f,c)}return o?r.replaceRange(r.main.extend(u.from,u.to)):s&&1==i&&r.ranges.length>1&&(a=function(t,e){for(var n=0;n<t.ranges.length;n++){var i=t.ranges[n],r=i.from,o=i.to;if(r<=e&&o>=e)return d.jT.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}(r,h.pos))?a:s?r.addRange(u):d.jT.create([u])}}}(t,e)),i){var o=!t.hasFocus;t.inputState.startMouseSelection(new nn(t,e,i,o)),o&&t.observer.ignore((function(){return N(t.contentDOM)}));var s=t.inputState.mouseSelection;if(s)return s.start(e),!1===s.dragging}return!1};var un=function(t,e){return t>=e.top&&t<=e.bottom},ln=function(t,e,n){return un(e,n)&&t>=n.left&&t<=n.right};function cn(t,e,n,i){var r=yt.find(t.docView,e);if(!r)return 1;var o=e-r.posAtStart;if(0==o)return 1;if(o==r.length)return-1;var s=r.coordsAt(o,-1);if(s&&ln(n,i,s))return-1;var a=r.coordsAt(o,1);return a&&ln(n,i,a)?1:s&&un(i,s)?-1:1}function fn(t,e){var n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:cn(t,n,e.clientX,e.clientY)}}var dn=ot.ie&&ot.ie_version<=11,vn=null,gn=0,pn=0;function mn(t){if(!dn)return t.detail;var e=vn,n=pn;return vn=t,pn=Date.now(),gn=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(gn+1)%3:1}function yn(t,e,n,i){if(n){var r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),o=t.inputState.draggedContent,s=i&&o&&function(t,e){var n=t.state.facet(ie);return n.length?n[0](e):ot.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:o.from,to:o.to}:null,a={from:r,insert:n},h=t.state.changes(s?[s,a]:a);t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(r,-1),head:h.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"}),t.inputState.draggedContent=null}}rn.dragstart=function(t,e){var n=t.state.selection.main;if(e.target.draggable){var i=t.docView.nearest(e.target);if(i&&i.isWidget){var r=i.posAtStart,o=r+i.length;(r>=n.to||o<=n.from)&&(n=d.jT.range(r,o))}}var s=t.inputState;return s.mouseSelection&&(s.mouseSelection.dragging=!0),s.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(n.from,n.to)),e.dataTransfer.effectAllowed="copyMove"),!1},rn.dragend=function(t){return t.inputState.draggedContent=null,!1},rn.drop=function(t,e){if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;var n=e.dataTransfer.files;if(n&&n.length){for(var i=Array(n.length),r=0,o=function(){++r==n.length&&yn(t,e,i.filter((function(t){return null!=t})).join(t.state.lineBreak),!1)},s=function(t){var e=new FileReader;e.onerror=o,e.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(i[t]=e.result),o()},e.readAsText(n[t])},a=0;a<n.length;a++)s(a);return!0}var h=e.dataTransfer.getData("Text");return!!h&&(yn(t,e,h,!0),!0)},rn.paste=function(t,e){if(t.state.readOnly)return!0;t.observer.flush();var n=sn?null:e.clipboardData;return n?(an(t,n.getData("text/plain")||n.getData("text/uri-text")),!0):(function(t){var e=t.dom.parentNode;if(e){var n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((function(){t.focus(),n.remove(),an(t,n.value)}),50)}}(t),!1)};var kn=null;rn.copy=rn.cut=function(t,e){var n=function(t){var e,n=[],i=[],r=!1,o=(0,l.Z)(t.selection.ranges);try{for(o.s();!(e=o.n()).done;){var s=e.value;s.empty||(n.push(t.sliceDoc(s.from,s.to)),i.push(s))}}catch(d){o.e(d)}finally{o.f()}if(!n.length){var a,h=-1,u=(0,l.Z)(t.selection.ranges);try{for(u.s();!(a=u.n()).done;){var c=a.value.from,f=t.doc.lineAt(c);f.number>h&&(n.push(f.text),i.push({from:f.from,to:Math.min(t.doc.length,f.to+1)})),h=f.number}}catch(d){u.e(d)}finally{u.f()}r=!0}return{text:n.join(t.lineBreak),ranges:i,linewise:r}}(t.state),i=n.text,r=n.ranges,o=n.linewise;if(!i&&!o)return!1;kn=o?i:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});var s=sn?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",i),!0):(function(t,e){var n=t.dom.parentNode;if(n){var i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout((function(){i.remove(),t.focus()}),50)}}(t,i),!1)};var wn=d.q6.define();function bn(t,e){var n,i=[],r=(0,l.Z)(t.facet(he));try{for(r.s();!(n=r.n()).done;){var o=(0,n.value)(t,e);o&&i.push(o)}}catch(s){r.e(s)}finally{r.f()}return i?t.update({effects:i,annotations:wn.of(!0)}):null}function xn(t){setTimeout((function(){var e=t.hasFocus;if(e!=t.inputState.notifiedFocused){var n=bn(t.state,e);n?t.dispatch(n):t.update([])}}),10)}on.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),xn(t)},on.blur=function(t){t.observer.clearSelectionRange(),xn(t)},on.compositionstart=on.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},on.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,ot.chrome&&ot.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)},on.contextmenu=function(t){t.inputState.lastContextMenu=Date.now()},rn.beforeinput=function(t,e){var n,i;if(ot.chrome&&ot.android&&(i=Ye.find((function(t){return t.inputType==e.inputType})))&&(t.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){var r=(null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0;setTimeout((function(){var e;((null===(e=window.visualViewport)||void 0===e?void 0:e.height)||0)>r+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)}return!1};var Sn=new Set;var An=["pre-wrap","normal","pre-line","break-spaces"],Mn=function(){function t(e){(0,c.Z)(this,t),this.lineWrapping=e,this.doc=d.xv.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}return(0,f.Z)(t,[{key:"heightForGap",value:function(t,e){var n=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((e-t-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}},{key:"heightForLine",value:function(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}},{key:"setDoc",value:function(t){return this.doc=t,this}},{key:"mustRefreshForWrapping",value:function(t){return An.indexOf(t)>-1!=this.lineWrapping}},{key:"mustRefreshForHeights",value:function(t){for(var e=!1,n=0;n<t.length;n++){var i=t[n];i<0?n++:this.heightSamples[Math.floor(10*i)]||(e=!0,this.heightSamples[Math.floor(10*i)]=!0)}return e}},{key:"refresh",value:function(t,e,n,i,r,o){var s=An.indexOf(t)>-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=e,this.charWidth=n,this.textHeight=i,this.lineLength=r,a){this.heightSamples={};for(var h=0;h<o.length;h++){var u=o[h];u<0?h++:this.heightSamples[Math.floor(10*u)]=!0}}return a}}]),t}(),Zn=function(){function t(e,n){(0,c.Z)(this,t),this.from=e,this.heights=n,this.index=0}return(0,f.Z)(t,[{key:"more",get:function(){return this.index<this.heights.length}}]),t}(),Cn=function(){function t(e,n,i,r,o){(0,c.Z)(this,t),this.from=e,this.length=n,this.top=i,this.height=r,this._content=o}return(0,f.Z)(t,[{key:"type",get:function(){return"number"==typeof this._content?bt.Text:Array.isArray(this._content)?this._content:this._content.type}},{key:"to",get:function(){return this.from+this.length}},{key:"bottom",get:function(){return this.top+this.height}},{key:"widget",get:function(){return this._content instanceof Mt?this._content.widget:null}},{key:"widgetLineBreaks",get:function(){return"number"==typeof this._content?this._content:0}},{key:"join",value:function(e){var n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new t(this.from,this.length+e.length,this.top,this.height+e.height,n)}}]),t}(),On=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(On||(On={})),Tn=.001,Dn=function(){function t(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;(0,c.Z)(this,t),this.length=e,this.height=n,this.flags=i}return(0,f.Z)(t,[{key:"outdated",get:function(){return(2&this.flags)>0},set:function(t){this.flags=(t?2:0)|-3&this.flags}},{key:"setHeight",value:function(t,e){this.height!=e&&(Math.abs(this.height-e)>Tn&&(t.heightChanged=!0),this.height=e)}},{key:"replace",value:function(e,n,i){return t.of(i)}},{key:"decomposeLeft",value:function(t,e){e.push(this)}},{key:"decomposeRight",value:function(t,e){e.push(this)}},{key:"applyChanges",value:function(t,e,n,i){for(var r=this,o=n.doc,s=i.length-1;s>=0;s--){var a=i[s],h=a.fromA,u=a.toA,l=a.fromB,c=a.toB,f=r.lineAt(h,On.ByPosNoHeight,n.setDoc(e),0,0),d=f.to>=u?f:r.lineAt(u,On.ByPosNoHeight,n,0,0);for(c+=d.to-u,u=d.to;s>0&&f.from<=i[s-1].toA;)h=i[s-1].fromA,l=i[s-1].fromB,s--,h<f.from&&(f=r.lineAt(h,On.ByPosNoHeight,n,0,0));l+=f.from-h,h=f.from;var v=Nn.build(n.setDoc(o),t,l,c);r=r.replace(h,u,v)}return r.updateHeight(n,0)}}],[{key:"empty",value:function(){return new Bn(0,0)}},{key:"of",value:function(e){if(1==e.length)return e[0];for(var n=0,i=e.length,r=0,o=0;;)if(n==i)if(r>2*o){var s=e[n-1];s.break?e.splice(--n,1,s.left,null,s.right):e.splice(--n,1,s.left,s.right),i+=1+s.break,r-=s.size}else{if(!(o>2*r))break;var a=e[i];a.break?e.splice(i,1,a.left,null,a.right):e.splice(i,1,a.left,a.right),i+=2+a.break,o-=a.size}else if(r<o){var h=e[n++];h&&(r+=h.size)}else{var u=e[--i];u&&(o+=u.size)}var l=0;return null==e[n-1]?(l=1,n--):null==e[n]&&(l=1,i++),new In(t.of(e.slice(0,n)),l,t.of(e.slice(i)))}}]),t}();Dn.prototype.size=1;var En=function(t){function e(t,n,i){var r;return(0,c.Z)(this,e),(r=(0,a.Z)(this,e,[t,n])).deco=i,r}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"blockAt",value:function(t,e,n,i){return new Cn(i,this.length,n,this.height,this.deco||0)}},{key:"lineAt",value:function(t,e,n,i,r){return this.blockAt(0,n,i,r)}},{key:"forEachLine",value:function(t,e,n,i,r,o){t<=r+this.length&&e>=r&&o(this.blockAt(0,n,i,r))}},{key:"updateHeight",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>3?arguments[3]:void 0;return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}},{key:"toString",value:function(){return"block(".concat(this.length,")")}}]),e}(Dn),Bn=function(t){function e(t,n){var i;return(0,c.Z)(this,e),(i=(0,a.Z)(this,e,[t,n,null])).collapsed=0,i.widgetHeight=0,i.breaks=0,i}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"blockAt",value:function(t,e,n,i){return new Cn(i,this.length,n,this.height,this.breaks)}},{key:"replace",value:function(t,n,i){var r=i[0];return 1==i.length&&(r instanceof e||r instanceof Rn&&4&r.flags)&&Math.abs(this.length-r.length)<10?(r instanceof Rn?r=new e(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):Dn.of(i)}},{key:"updateHeight",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;return i&&i.from<=e&&i.more?this.setHeight(t,i.heights[i.index++]):(n||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(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}]),e}(En),Rn=function(t){function e(t){return(0,c.Z)(this,e),(0,a.Z)(this,e,[t,0])}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"heightMetrics",value:function(t,e){var n,i=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,o=r-i+1,s=0;if(t.lineWrapping){var a=Math.min(this.height,t.lineHeight*o);n=a/o,this.length>o+1&&(s=(this.height-a)/(this.length-o-1))}else n=this.height/o;return{firstLine:i,lastLine:r,perLine:n,perChar:s}}},{key:"blockAt",value:function(t,e,n,i){var r=this.heightMetrics(e,i),o=r.firstLine,s=r.lastLine,a=r.perLine,h=r.perChar;if(e.lineWrapping){var u=i+Math.round(Math.max(0,Math.min(1,(t-n)/this.height))*this.length),l=e.doc.lineAt(u),c=a+l.length*h,f=Math.max(n,t-c/2);return new Cn(l.from,l.length,f,c,0)}var d=Math.max(0,Math.min(s-o,Math.floor((t-n)/a))),v=e.doc.line(o+d),g=v.from,p=v.length;return new Cn(g,p,n+a*d,a,0)}},{key:"lineAt",value:function(t,e,n,i,r){if(e==On.ByHeight)return this.blockAt(t,n,i,r);if(e==On.ByPosNoHeight){var o=n.doc.lineAt(t),s=o.from,a=o.to;return new Cn(s,a-s,0,0,0)}var h=this.heightMetrics(n,r),u=h.firstLine,l=h.perLine,c=h.perChar,f=n.doc.lineAt(t),d=l+f.length*c,v=f.number-u,g=i+l*v+c*(f.from-r-v);return new Cn(f.from,f.length,Math.max(i,Math.min(g,i+this.height-d)),d,0)}},{key:"forEachLine",value:function(t,e,n,i,r,o){t=Math.max(t,r),e=Math.min(e,r+this.length);for(var s=this.heightMetrics(n,r),a=s.firstLine,h=s.perLine,u=s.perChar,l=t,c=i;l<=e;){var f=n.doc.lineAt(l);if(l==t){var d=f.number-a;c+=h*d+u*(t-r-d)}var v=h+u*f.length;o(new Cn(f.from,f.length,c,v,0)),c+=v,l=f.to+1}}},{key:"replace",value:function(t,n,i){var r=this.length-n;if(r>0){var o=i[i.length-1];o instanceof e?i[i.length-1]=new e(o.length+r):i.push(null,new e(r-1))}if(t>0){var s=i[0];s instanceof e?i[0]=new e(t+s.length):i.unshift(new e(t-1),null)}return Dn.of(i)}},{key:"decomposeLeft",value:function(t,n){n.push(new e(t-1),null)}},{key:"decomposeRight",value:function(t,n){n.push(null,new e(this.length-t-1))}},{key:"updateHeight",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,o=n+this.length;if(r&&r.from<=n+this.length&&r.more){var s=[],a=Math.max(n,r.from),h=-1;for(r.from>n&&s.push(new e(r.from-n-1).updateHeight(t,n));a<=o&&r.more;){var u=t.doc.lineAt(a).length;s.length&&s.push(null);var l=r.heights[r.index++];-1==h?h=l:Math.abs(l-h)>=Tn&&(h=-2);var c=new Bn(u,l);c.outdated=!1,s.push(c),a+=u+1}a<=o&&s.push(null,new e(o-a).updateHeight(t,a));var f=Dn.of(s);return(h<0||Math.abs(f.height-this.height)>=Tn||Math.abs(h-this.heightMetrics(t,n).perLine)>=Tn)&&(t.heightChanged=!0),f}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(n,n+this.length)),this.outdated=!1),this}},{key:"toString",value:function(){return"gap(".concat(this.length,")")}}]),e}(Dn),In=function(t){function e(t,n,i){var r;return(0,c.Z)(this,e),(r=(0,a.Z)(this,e,[t.length+n+i.length,t.height+i.height,n|(t.outdated||i.outdated?2:0)])).left=t,r.right=i,r.size=t.size+i.size,r}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"break",get:function(){return 1&this.flags}},{key:"blockAt",value:function(t,e,n,i){var r=n+this.left.height;return t<r?this.left.blockAt(t,e,n,i):this.right.blockAt(t,e,r,i+this.left.length+this.break)}},{key:"lineAt",value:function(t,e,n,i,r){var o=i+this.left.height,s=r+this.left.length+this.break,a=e==On.ByHeight?t<o:t<s,h=a?this.left.lineAt(t,e,n,i,r):this.right.lineAt(t,e,n,o,s);if(this.break||(a?h.to<s:h.from>s))return h;var u=e==On.ByPosNoHeight?On.ByPosNoHeight:On.ByPos;return a?h.join(this.right.lineAt(s,u,n,o,s)):this.left.lineAt(s,u,n,i,r).join(h)}},{key:"forEachLine",value:function(t,e,n,i,r,o){var s=i+this.left.height,a=r+this.left.length+this.break;if(this.break)t<a&&this.left.forEachLine(t,e,n,i,r,o),e>=a&&this.right.forEachLine(t,e,n,s,a,o);else{var h=this.lineAt(a,On.ByPos,n,i,r);t<h.from&&this.left.forEachLine(t,h.from-1,n,i,r,o),h.to>=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,n,s,a,o)}}},{key:"replace",value:function(t,e,n){var i=this.left.length+this.break;if(e<i)return this.balanced(this.left.replace(t,e,n),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-i,e-i,n));var r=[];t>0&&this.decomposeLeft(t,r);var o,s=r.length,a=(0,l.Z)(n);try{for(a.s();!(o=a.n()).done;){var h=o.value;r.push(h)}}catch(c){a.e(c)}finally{a.f()}if(t>0&&Pn(r,s-1),e<this.length){var u=r.length;this.decomposeRight(e,r),Pn(r,u)}return Dn.of(r)}},{key:"decomposeLeft",value:function(t,e){var n=this.left.length;if(t<=n)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&t>=++n&&e.push(null),t>n&&this.right.decomposeLeft(t-n,e)}},{key:"decomposeRight",value:function(t,e){var n=this.left.length,i=n+this.break;if(t>=i)return this.right.decomposeRight(t-i,e);t<n&&this.left.decomposeRight(t,e),this.break&&t<i&&e.push(null),e.push(this.right)}},{key:"balanced",value:function(t,e){return t.size>2*e.size||e.size>2*t.size?Dn.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(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0,r=this.left,o=this.right,s=e+r.length+this.break,a=null;return i&&i.from<=e+r.length&&i.more?a=r=r.updateHeight(t,e,n,i):r.updateHeight(t,e,n),i&&i.from<=s+o.length&&i.more?a=o=o.updateHeight(t,s,n,i):o.updateHeight(t,s,n),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}},{key:"toString",value:function(){return this.left+(this.break?" ":"-")+this.right}}]),e}(Dn);function Pn(t,e){var n,i;null==t[e]&&(n=t[e-1])instanceof Rn&&(i=t[e+1])instanceof Rn&&t.splice(e-1,3,new Rn(n.length+1+i.length))}var Nn=function(){function t(e,n){(0,c.Z)(this,t),this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}return(0,f.Z)(t,[{key:"isCovered",get:function(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}},{key:"span",value:function(t,e){if(this.lineStart>-1){var n=Math.min(e,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Bn?i.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new Bn(n-this.pos,-1)),this.writtenTo=n,e>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}},{key:"point",value:function(t,e,n){if(t<e||n.heightRelevant){var i=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);var o=e-t;n.block?this.addBlock(new En(o,i,n)):(o||r||i>=5)&&this.addLineDeco(i,r,o)}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(){if(!(this.lineStart>-1)){var t=this.oracle.doc.lineAt(this.pos),e=t.from,n=t.to;this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Bn(this.pos-e,-1)),this.writtenTo=this.pos}}},{key:"blankContent",value:function(t,e){var n=new Rn(e-t);return this.oracle.doc.lineAt(t).to==e&&(n.flags|=4),n}},{key:"ensureLine",value:function(){this.enterLine();var t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Bn)return t;var e=new Bn(0,-1);return this.nodes.push(e),e}},{key:"addBlock",value:function(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(t,e,n){var i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,t),i.breaks+=e,this.writtenTo=this.pos=this.pos+n}},{key:"finish",value:function(t){var e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof Bn||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Bn(0,-1));var n,i=t,r=(0,l.Z)(this.nodes);try{for(r.s();!(n=r.n()).done;){var o=n.value;o instanceof Bn&&o.updateHeight(this.oracle,i),i+=o?o.length:1}}catch(s){r.e(s)}finally{r.f()}return this.nodes}}],[{key:"build",value:function(e,n,i,r){var o=new t(i,e);return d.Xs.spans(n,i,r,o,0),o.finish(i)}}]),t}();var Ln=function(){function t(){(0,c.Z)(this,t),this.changes=[]}return(0,f.Z)(t,[{key:"compareRange",value:function(){}},{key:"comparePoint",value:function(t,e,n,i){(t<e||n&&n.heightRelevant||i&&i.heightRelevant)&&Ct(t,e,this.changes,5)}}]),t}();function Vn(t,e){for(var n=t.getBoundingClientRect(),i=t.ownerDocument,r=i.defaultView||window,o=Math.max(0,n.left),s=Math.min(r.innerWidth,n.right),a=Math.max(0,n.top),h=Math.min(r.innerHeight,n.bottom),u=t.parentNode;u&&u!=i.body;)if(1==u.nodeType){var l=u,c=window.getComputedStyle(l);if((l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth)&&"visible"!=c.overflow){var f=l.getBoundingClientRect();o=Math.max(o,f.left),s=Math.min(s,f.right),a=Math.max(a,f.top),h=u==t.parentNode?f.bottom:Math.min(h,f.bottom)}u="absolute"==c.position||"fixed"==c.position?l.offsetParent:l.parentNode}else{if(11!=u.nodeType)break;u=u.host}return{left:o-n.left,right:Math.max(o,s)-n.left,top:a-(n.top+e),bottom:Math.max(a,h)-(n.top+e)}}function Hn(t,e){var n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}var Wn=function(){function t(e,n,i){(0,c.Z)(this,t),this.from=e,this.to=n,this.size=i}return(0,f.Z)(t,[{key:"draw",value:function(t,e){return xt.replace({widget:new _n(this.size*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}}],[{key:"same",value:function(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++){var i=t[n],r=e[n];if(i.from!=r.from||i.to!=r.to||i.size!=r.size)return!1}return!0}}]),t}(),_n=function(t){function e(t,n){var i;return(0,c.Z)(this,e),(i=(0,a.Z)(this,e)).size=t,i.vertical=n,i}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"eq",value:function(t){return t.size==this.size&&t.vertical==this.vertical}},{key:"toDOM",value:function(){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(){return this.vertical?this.size:-1}}]),e}(wt),zn=function(){function t(e){var n=this;(0,c.Z)(this,t),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=!0,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Jn,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Et.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;var i=e.facet(we).some((function(t){return"function"!=typeof t&&"cm-lineWrapping"==t.class}));this.heightOracle=new Mn(i),this.stateDeco=e.facet(be).filter((function(t){return"function"!=typeof t})),this.heightMap=Dn.empty().applyChanges(this.stateDeco,d.xv.empty,this.heightOracle.setDoc(e.doc),[new Te(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=xt.set(this.lineGaps.map((function(t){return t.draw(n,!1)}))),this.computeVisibleRanges()}return(0,f.Z)(t,[{key:"updateForViewport",value:function(){for(var t=this,e=[this.viewport],n=this.state.selection.main,i=function(){var i=r?n.head:n.anchor;if(!e.some((function(t){var e=t.from,n=t.to;return i>=e&&i<=n}))){var o=t.lineBlockAt(i),s=o.from,a=o.to;e.push(new Fn(s,a))}},r=0;r<=1;r++)i();this.viewports=e.sort((function(t,e){return t.from-e.from})),this.scaler=this.heightMap.height<=7e6?Jn:new Un(this.heightOracle,this.heightMap,this.viewports)}},{key:"updateViewportLines",value:function(){var t=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(function(e){t.viewportLines.push(1==t.scaler.scale?e:Gn(e,t.scaler))}))}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.state=t.state;var n=this.stateDeco;this.stateDeco=this.state.facet(be).filter((function(t){return"function"!=typeof t}));var i,r,o,s,a=t.changedRanges,h=Te.extendWithRanges(a,(i=n,r=this.stateDeco,o=t?t.changes:d.as.empty(this.state.doc.length),s=new Ln,d.Xs.compare(i,r,o,s,0),s.changes)),u=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),h),this.heightMap.height!=u&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);var c=h.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<c.from||e.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,e));var f=!t.changes.empty||2&t.flags||c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,this.updateForViewport(),f&&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(le)&&(this.mustEnforceCursorAssoc=!0)}},{key:"measure",value:function(t){var e=t.contentDOM,n=window.getComputedStyle(e),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Et.RTL:Et.LTR;var o=this.heightOracle.mustRefreshForWrapping(r),s=e.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;var h=0,u=0;if(s.width&&s.height){var c=B(e,s),f=c.scaleX,v=c.scaleY;this.scaleX==f&&this.scaleY==v||(this.scaleX=f,this.scaleY=v,h|=8,o=a=!0)}var g=(parseInt(n.paddingTop)||0)*this.scaleY,p=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==g&&this.paddingBottom==p||(this.paddingTop=g,this.paddingBottom=p,h|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=8);var m=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=m&&(this.scrollAnchorHeight=-1,this.scrollTop=m),this.scrolledToBottom=W(t.scrollDOM);var y=(this.printing?Hn:Vn)(e,this.paddingTop),k=y.top-this.pixelViewport.top,w=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;var b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;var x=s.width;if(this.contentDOMWidth==x&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=t.scrollDOM.clientHeight,h|=8),a){var S=t.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(S)&&(o=!0),o||i.lineWrapping&&Math.abs(x-this.contentDOMWidth)>i.charWidth){var A=t.docView.measureTextSize(),M=A.lineHeight,Z=A.charWidth,C=A.textHeight;(o=M>0&&i.refresh(r,M,Z,C,x/Z,S))&&(t.docView.minWidth=0,h|=8)}k>0&&w>0?u=Math.max(k,w):k<0&&w<0&&(u=Math.min(k,w)),i.heightChanged=!1;var O,T=(0,l.Z)(this.viewports);try{for(T.s();!(O=T.n()).done;){var D=O.value,E=D.from==this.viewport.from?S:t.docView.measureVisibleLineHeights(D);this.heightMap=(o?Dn.empty().applyChanges(this.stateDeco,d.xv.empty,this.heightOracle,[new Te(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new Zn(D.from,E))}}catch(I){T.e(I)}finally{T.f()}i.heightChanged&&(h|=2)}var R=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return R&&(this.viewport=this.getViewport(u,this.scrollTarget)),this.updateForViewport(),(2&h||R)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}},{key:"visibleTop",get:function(){return this.scaler.fromDOM(this.pixelViewport.top)}},{key:"visibleBottom",get:function(){return this.scaler.fromDOM(this.pixelViewport.bottom)}},{key:"getViewport",value:function(t,e){var n=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),i=this.heightMap,r=this.heightOracle,o=this.visibleTop,s=this.visibleBottom,a=new Fn(i.lineAt(o-1e3*n,On.ByHeight,r,0,0).from,i.lineAt(s+1e3*(1-n),On.ByHeight,r,0,0).to);if(e){var h=e.range.head;if(h<a.from||h>a.to){var u,l=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=i.lineAt(h,On.ByPos,r,0,0);u="center"==e.y?(c.top+c.bottom)/2-l/2:"start"==e.y||"nearest"==e.y&&h<a.from?c.top:c.bottom-l,a=new Fn(i.lineAt(u-500,On.ByHeight,r,0,0).from,i.lineAt(u+l+500,On.ByHeight,r,0,0).to)}}return a}},{key:"mapViewport",value:function(t,e){var n=e.mapPos(t.from,-1),i=e.mapPos(t.to,1);return new Fn(this.heightMap.lineAt(n,On.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,On.ByPos,this.heightOracle,0,0).to)}},{key:"viewportIsAppropriate",value:function(t){var e=t.from,n=t.to,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!this.inView)return!0;var r=this.heightMap.lineAt(e,On.ByPos,this.heightOracle,0,0).top,o=this.heightMap.lineAt(n,On.ByPos,this.heightOracle,0,0).bottom,s=this.visibleTop,a=this.visibleBottom;return(0==e||r<=s-Math.max(10,Math.min(-i,250)))&&(n==this.state.doc.length||o>=a+Math.max(10,Math.min(i,250)))&&r>s-2e3&&o<a+2e3}},{key:"mapLineGaps",value:function(t,e){if(!t.length||e.empty)return t;var n,i=[],r=(0,l.Z)(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;e.touchesRange(o.from,o.to)||i.push(new Wn(e.mapPos(o.from),e.mapPos(o.to),o.size))}}catch(s){r.e(s)}finally{r.f()}return i}},{key:"ensureLineGaps",value:function(t,e){var n=this,i=this.heightOracle.lineWrapping,r=i?1e4:2e3,o=r>>1,s=r<<1;if(this.defaultTextDirection!=Et.LTR&&!i)return[];var a,h=[],u=function r(s,a,u,c){if(!(a-s<o)){var f=n.state.selection.main,v=[f.from];f.empty||v.push(f.to);for(var g=0,p=v;g<p.length;g++){var m=p[g];if(m>s&&m<a)return r(s,m-10,u,c),void r(m+10,a,u,c)}var y=function(t,e){var n,i=(0,l.Z)(t);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(e(r))return r}}catch(o){i.e(o)}finally{i.f()}return}(t,(function(t){return t.from>=u.from&&t.to<=u.to&&Math.abs(t.from-s)<o&&Math.abs(t.to-a)<o&&!v.some((function(e){return t.from<e&&t.to>e}))}));if(!y){if(a<u.to&&e&&i&&e.visibleRanges.some((function(t){return t.from<=a&&t.to>=a}))){var k=e.moveToLineBoundary(d.jT.cursor(a),!1,!0).head;k>s&&(a=k)}y=new Wn(s,a,n.gapSize(u,s,a,c))}h.push(y)}},c=(0,l.Z)(this.viewportLines);try{for(c.s();!(a=c.n()).done;){var f=a.value;if(!(f.length<s)){var v=qn(f.from,f.to,this.stateDeco);if(!(v.total<s)){var g=this.scrollTarget?this.scrollTarget.range.head:null,p=void 0,m=void 0;if(i){var y=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,k=void 0,w=void 0;if(null!=g){var b=Kn(v,g),x=((this.visibleBottom-this.visibleTop)/2+y)/f.height;k=b-x,w=b+x}else k=(this.visibleTop-f.top-y)/f.height,w=(this.visibleBottom-f.top+y)/f.height;p=jn(v,k),m=jn(v,w)}else{var S=v.total*this.heightOracle.charWidth,A=r*this.heightOracle.charWidth,M=void 0,Z=void 0;if(null!=g){var C=Kn(v,g),O=((this.pixelViewport.right-this.pixelViewport.left)/2+A)/S;M=C-O,Z=C+O}else M=(this.pixelViewport.left-A)/S,Z=(this.pixelViewport.right+A)/S;p=jn(v,M),m=jn(v,Z)}p>f.from&&u(f.from,p,f,v),m<f.to&&u(m,f.to,f,v)}}}}catch(T){c.e(T)}finally{c.f()}return h}},{key:"gapSize",value:function(t,e,n,i){var r=Kn(i,n)-Kn(i,e);return this.heightOracle.lineWrapping?t.height*r:i.total*this.heightOracle.charWidth*r}},{key:"updateLineGaps",value:function(t){var e=this;Wn.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=xt.set(t.map((function(t){return t.draw(e,e.heightOracle.lineWrapping)}))))}},{key:"computeVisibleRanges",value:function(){var t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));var e=[];d.Xs.spans(t,this.viewport.from,this.viewport.to,{span:function(t,n){e.push({from:t,to:n})},point:function(){}},20);var n=e.length!=this.visibleRanges.length||this.visibleRanges.some((function(t,n){return t.from!=e[n].from||t.to!=e[n].to}));return this.visibleRanges=e,n?4:0}},{key:"lineBlockAt",value:function(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find((function(e){return e.from<=t&&e.to>=t}))||Gn(this.heightMap.lineAt(t,On.ByPos,this.heightOracle,0,0),this.scaler)}},{key:"lineBlockAtHeight",value:function(t){return Gn(this.heightMap.lineAt(this.scaler.fromDOM(t),On.ByHeight,this.heightOracle,0,0),this.scaler)}},{key:"scrollAnchorAt",value:function(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(t){return Gn(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}},{key:"docHeight",get:function(){return this.scaler.toDOM(this.heightMap.height)}},{key:"contentHeight",get:function(){return this.docHeight+this.paddingTop+this.paddingBottom}}]),t}(),Fn=(0,f.Z)((function t(e,n){(0,c.Z)(this,t),this.from=e,this.to=n}));function qn(t,e,n){var i=[],r=t,o=0;return d.Xs.spans(n,t,e,{span:function(){},point:function(t,e){t>r&&(i.push({from:r,to:t}),o+=t-r),r=e}},20),r<e&&(i.push({from:r,to:e}),o+=e-r),{total:o,ranges:i}}function jn(t,e){var n=t.total,i=t.ranges;if(e<=0)return i[0].from;if(e>=1)return i[i.length-1].to;for(var r=Math.floor(n*e),o=0;;o++){var s=i[o],a=s.from,h=s.to-a;if(r<=h)return a+r;r-=h}}function Kn(t,e){var n,i=0,r=(0,l.Z)(t.ranges);try{for(r.s();!(n=r.n()).done;){var o=n.value,s=o.from,a=o.to;if(e<=a){i+=e-s;break}i+=a-s}}catch(h){r.e(h)}finally{r.f()}return i/t.total}var Jn={toDOM:function(t){return t},fromDOM:function(t){return t},scale:1},Un=function(){function t(e,n,i){(0,c.Z)(this,t);var r=0,o=0,s=0;this.viewports=i.map((function(t){var i=t.from,o=t.to,s=n.lineAt(i,On.ByPos,e,0,0).top,a=n.lineAt(o,On.ByPos,e,0,0).bottom;return r+=a-s,{from:i,to:o,top:s,bottom:a,domTop:0,domBottom:0}})),this.scale=(7e6-r)/(n.height-r);var a,h=(0,l.Z)(this.viewports);try{for(h.s();!(a=h.n()).done;){var u=a.value;u.domTop=s+(u.top-o)*this.scale,s=u.domBottom=u.domTop+(u.bottom-u.top),o=u.bottom}}catch(f){h.e(f)}finally{h.f()}}return(0,f.Z)(t,[{key:"toDOM",value:function(t){for(var e=0,n=0,i=0;;e++){var r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.top)return i+(t-n)*this.scale;if(t<=r.bottom)return r.domTop+(t-r.top);n=r.bottom,i=r.domBottom}}},{key:"fromDOM",value:function(t){for(var e=0,n=0,i=0;;e++){var r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.domTop)return n+(t-i)/this.scale;if(t<=r.domBottom)return r.top+(t-r.domTop);n=r.bottom,i=r.domBottom}}}]),t}();function Gn(t,e){if(1==e.scale)return t;var n=e.toDOM(t.top),i=e.toDOM(t.bottom);return new Cn(t.from,t.length,n,i-n,Array.isArray(t._content)?t._content.map((function(t){return Gn(t,e)})):t._content)}var $n=d.r$.define({combine:function(t){return t.join(" ")}}),Xn=d.r$.define({combine:function(t){return t.indexOf(!0)>-1}}),Yn=y.newName(),Qn=y.newName(),ti=y.newName(),ei={"&light":"."+Qn,"&dark":"."+ti};function ni(t,e,n){return new y(e,{finish:function(e){return/&/.test(e)?e.replace(/&\w*/,(function(e){if("&"==e)return t;if(!n||!n[e])throw new RangeError("Unsupported selector: ".concat(e));return n[e]})):t+" "+e}})}var ii=ni("."+Yn,{"&":{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"}},ei),ri="￿",oi=function(){function t(e,n){(0,c.Z)(this,t),this.points=e,this.text="",this.lineSeparator=n.facet(d.yy.lineSeparator)}return(0,f.Z)(t,[{key:"append",value:function(t){this.text+=t}},{key:"lineBreak",value:function(){this.text+=ri}},{key:"readRange",value:function(t,e){if(!t)return this;for(var n=t.parentNode,i=t;;){this.findPointBefore(n,i);var r=this.text.length;this.readNode(i);var o=i.nextSibling;if(o==e)break;var s=F.get(i),a=F.get(o);(s&&a?s.breakAfter:(s?s.breakAfter:ai(i))||ai(o)&&("BR"!=i.nodeName||i.cmIgnore)&&this.text.length>r)&&this.lineBreak(),i=o}return this.findPointBefore(n,e),this}},{key:"readTextNode",value:function(t){var e,n=t.nodeValue,i=(0,l.Z)(this.points);try{for(i.s();!(e=i.n()).done;){var r=e.value;r.node==t&&(r.pos=this.text.length+Math.min(r.offset,n.length))}}catch(v){i.e(v)}finally{i.f()}for(var o=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){var a=-1,h=1,u=void 0;if(this.lineSeparator?(a=n.indexOf(this.lineSeparator,o),h=this.lineSeparator.length):(u=s.exec(n))&&(a=u.index,h=u[0].length),this.append(n.slice(o,a<0?n.length:a)),a<0)break;if(this.lineBreak(),h>1){var c,f=(0,l.Z)(this.points);try{for(f.s();!(c=f.n()).done;){var d=c.value;d.node==t&&d.pos>this.text.length&&(d.pos-=h-1)}}catch(v){f.e(v)}finally{f.f()}}o=a+h}}},{key:"readNode",value:function(t){if(!t.cmIgnore){var e=F.get(t),n=e&&e.overrideDOMText;if(null!=n){this.findPointInside(t,n.length);for(var i=n.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.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(t,e){var n,i=(0,l.Z)(this.points);try{for(i.s();!(n=i.n()).done;){var r=n.value;r.node==t&&t.childNodes[r.offset]==e&&(r.pos=this.text.length)}}catch(o){i.e(o)}finally{i.f()}}},{key:"findPointInside",value:function(t,e){var n,i=(0,l.Z)(this.points);try{for(i.s();!(n=i.n()).done;){var r=n.value;(3==t.nodeType?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+(si(t,r.node,r.offset)?e:0))}}catch(o){i.e(o)}finally{i.f()}}}]),t}();function si(t,e,n){for(;;){if(!e||n<T(e))return!1;if(e==t)return!0;n=C(e)+1,e=e.parentNode}}function ai(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}var hi=(0,f.Z)((function t(e,n){(0,c.Z)(this,t),this.node=e,this.offset=n,this.pos=-1})),ui=(0,f.Z)((function t(e,n,i,r){(0,c.Z)(this,t),this.typeOver=r,this.bounds=null,this.text="";var o=e.docView,s=o.impreciseHead,a=o.impreciseAnchor;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,i,0))){var h=s||a?[]:function(t){var e=[];if(t.root.activeElement!=t.contentDOM)return e;var n=t.observer.selectionRange,i=n.anchorNode,r=n.anchorOffset,o=n.focusNode,s=n.focusOffset;i&&(e.push(new hi(i,r)),o==i&&s==r||e.push(new hi(o,s)));return e}(e),u=new oi(h,e.state);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=function(t,e){if(0==t.length)return null;var n=t[0].pos,i=2==t.length?t[1].pos:n;return n>-1&&i>-1?d.jT.single(n+e,i+e):null}(h,this.bounds.from)}else{var l=e.observer.selectionRange,f=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!S(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),v=a&&a.node==l.anchorNode&&a.offset==l.anchorOffset||!S(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),g=e.viewport;if(ot.ios&&e.state.selection.main.empty&&f!=v&&(g.from>0||g.to<e.state.doc.length)){var p=g.from-Math.min(f,v),m=g.to-Math.max(f,v);0!=p&&1!=p||0!=m&&-1!=m||(f=0,v=e.state.doc.length)}this.newSel=d.jT.single(v,f)}}));function li(t,e){var n,i=e.newSel,r=t.state.selection.main,o=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){var s=e.bounds,a=s.from,h=s.to,u=r.from,l=null;(8===o||ot.android&&e.text.length<h-a)&&(u=r.to,l="end");var c=function(t,e,n,i){var r=Math.min(t.length,e.length),o=0;for(;o<r&&t.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==r&&t.length==e.length)return null;var s=t.length,a=e.length;for(;s>0&&a>0&&t.charCodeAt(s-1)==e.charCodeAt(a-1);)s--,a--;if("end"==i){n-=s+Math.max(0,o-Math.min(s,a))-o}if(s<o&&t.length<e.length){a=(o-=n<=o&&n>=s?o-n:0)+(a-s),s=o}else if(a<o){s=(o-=n<=o&&n>=a?o-n:0)+(s-a),a=o}return{from:o,toA:s,toB:a}}(t.state.doc.sliceString(a,h,ri),e.text,u-a,l);c&&(ot.chrome&&13==o&&c.toB==c.from+2&&e.text.slice(c.from,c.toB)==ri+ri&&c.toB--,n={from:a+c.from,to:a+c.toA,insert:d.xv.of(e.text.slice(c.from,c.toB).split(ri))})}else i&&(!t.hasFocus&&t.state.facet(ve)||i.main.eq(r))&&(i=null);if(!n&&!i)return!1;if(!n&&e.typeOver&&!r.empty&&i&&i.main.empty?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,r.to)}:n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,r.to))}:(ot.mac||ot.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=d.jT.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:d.xv.of([" "])}):ot.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&t.lineWrapping&&(i&&(i=d.jT.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:d.xv.of([" "])}),n){if(ot.ios&&t.inputState.flushIOSKey())return!0;if(ot.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&V(t.contentDOM,"Enter",13)||(n.from==r.from-1&&n.to==r.to&&0==n.insert.length||8==o&&n.insert.length<n.to-n.from&&n.to>r.head)&&V(t.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&V(t.contentDOM,"Delete",46)))return!0;var f,v=n.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;var g=function(){return f||(f=function(t,e,n){var i,r=t.state,o=r.selection.main;if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){var s=o.from<e.from?r.sliceDoc(o.from,e.from):"",a=o.to>e.to?r.sliceDoc(e.to,o.to):"";i=r.replaceSelection(t.state.toText(s+e.insert.sliceString(0,void 0,t.state.lineBreak)+a))}else{var h=r.changes(e),u=n&&n.main.to<=h.newLength?n.main:void 0;if(r.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){var l,c=t.state.sliceDoc(e.from,e.to),f=n&&Re(t,n.main.head);if(f){var v=e.insert.length-(e.to-e.from);l={from:f.from,to:f.to-v}}else l=t.state.doc.lineAt(o.head);var g=o.to-e.to,p=o.to-o.from;i=r.changeByRange((function(n){if(n.from==o.from&&n.to==o.to)return{changes:h,range:u||n.map(h)};var i=n.to-g,s=i-c.length;if(n.to-n.from!=p||t.state.sliceDoc(s,i)!=c||n.to>=l.from&&n.from<=l.to)return{range:n};var a=r.changes({from:s,to:i,insert:e.insert}),f=n.to-o.to;return{changes:a,range:u?d.jT.range(Math.max(0,u.anchor+f),Math.max(0,u.head+f)):n.map(a)}}))}else i={changes:h,selection:u&&r.selection.replaceRange(u)}}var m="input.type";(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,m+=".compose",t.inputState.compositionFirstChange&&(m+=".start",t.inputState.compositionFirstChange=!1));return r.update(i,{userEvent:m,scrollIntoView:!0})}(t,n,i))};return t.state.facet(ae).some((function(e){return e(t,n.from,n.to,v,g)}))||t.dispatch(g()),!0}if(i&&!i.main.eq(r)){var p=!1,m="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(p=!0),m=t.inputState.lastSelectionOrigin),t.dispatch({selection:i,scrollIntoView:p,userEvent:m}),!0}return!1}var ci={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},fi=ot.ie&&ot.ie_version<=11,di=function(){function t(e){var n=this;(0,c.Z)(this,t),this.view=e,this.active=!1,this.selectionRange=new I,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.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((function(t){var i,r=(0,l.Z)(t);try{for(r.s();!(i=r.n()).done;){var o=i.value;n.queue.push(o)}}catch(s){r.e(s)}finally{r.f()}(ot.ie&&ot.ie_version<=11||ot.ios&&e.composing)&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?n.flushSoon():n.flush()})),fi&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((function(){var t;(null===(t=n.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&n.onResize()})),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((function(t){n.parentCheck<0&&(n.parentCheck=setTimeout(n.listenForScroll.bind(n),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=n.intersecting&&(n.intersecting=!n.intersecting,n.intersecting!=n.view.inView&&n.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&&n.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}return(0,f.Z)(t,[{key:"onScrollChanged",value:function(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}},{key:"onScroll",value:function(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}},{key:"onResize",value:function(){var t=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((function(){t.resizeTimeout=-1,t.view.requestMeasure()}),50))}},{key:"onPrint",value:function(){var t=this;this.view.viewState.printing=!0,this.view.measure(),setTimeout((function(){t.view.viewState.printing=!1,t.view.requestMeasure()}),500)}},{key:"updateGaps",value:function(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((function(e,n){return e!=t[n]})))){this.gapIntersection.disconnect();var e,n=(0,l.Z)(t);try{for(n.s();!(e=n.n()).done;){var i=e.value;this.gapIntersection.observe(i)}}catch(r){n.e(r)}finally{n.f()}this.gaps=t}}},{key:"onSelectionChange",value:function(t){var e=this.selectionChanged;if(this.readSelectionRange()&&!this.delayedAndroidKey){var n=this.view,i=this.selectionRange;if(n.state.facet(ve)?n.root.activeElement==this.dom:A(n.dom,i)){var r=i.anchorNode&&n.docView.nearest(i.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(ot.ie&&ot.ie_version<=11||ot.android&&ot.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Z(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}}}},{key:"readSelectionRange",value:function(){var t=this.view,e=ot.safari&&11==t.root.nodeType&&function(t){for(var e=t.activeElement;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t){var e=null;function n(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",n,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),!e)return null;var i=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);if(Z(a.node,a.offset,o,s)){var h=[o,s,i,r];i=h[0],r=h[1],o=h[2],s=h[3]}return{anchorNode:i,anchorOffset:r,focusNode:o,focusOffset:s}}(this.view)||x(t.root);if(!e||this.selectionRange.eq(e))return!1;var n=A(this.dom,e);return n&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){var n=e.focusNode,i=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=i)return!1;for(i=Math.min(i,T(n));;)if(i){if(1!=n.nodeType)return!1;var r=n.childNodes[i-1];"false"==r.contentEditable?i--:i=T(n=r)}else{if(n==t)return!0;i=C(n),n=n.parentNode}}(this.dom,e)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(e),n&&(this.selectionChanged=!0),!0)}},{key:"setSelectionRange",value:function(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}},{key:"clearSelectionRange",value:function(){this.selectionRange.set(null,0,null,0)}},{key:"listenForScroll",value:function(){this.parentCheck=-1;for(var t=0,e=null,n=this.dom;n;)if(1==n.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==n?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){var i,r=(0,l.Z)(this.scrollTargets);try{for(r.s();!(i=r.n()).done;){i.value.removeEventListener("scroll",this.onScroll)}}catch(a){r.e(a)}finally{r.f()}var o,s=(0,l.Z)(this.scrollTargets=e);try{for(s.s();!(o=s.n()).done;){o.value.addEventListener("scroll",this.onScroll)}}catch(a){s.e(a)}finally{s.f()}}}},{key:"ignore",value:function(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}},{key:"start",value:function(){this.active||(this.observer.observe(this.dom,ci),fi&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}},{key:"stop",value:function(){this.active&&(this.active=!1,this.observer.disconnect(),fi&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}},{key:"clear",value:function(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}},{key:"delayAndroidKey",value:function(t,e){var n,i=this;if(!this.delayedAndroidKey){this.flushingAndroidKey=this.view.win.requestAnimationFrame((function(){var t=i.delayedAndroidKey;t&&(i.clearDelayedAndroidKey(),i.view.inputState.lastKeyCode=t.keyCode,i.view.inputState.lastKeyTime=Date.now(),!i.flush()&&t.force&&V(i.dom,t.key,t.keyCode))}))}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}},{key:"clearDelayedAndroidKey",value:function(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}},{key:"flushSoon",value:function(){var t=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame((function(){t.delayedFlush=-1,t.flush()})))}},{key:"forceFlush",value:function(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}},{key:"pendingRecords",value:function(){var t,e=(0,l.Z)(this.observer.takeRecords());try{for(e.s();!(t=e.n()).done;){var n=t.value;this.queue.push(n)}}catch(i){e.e(i)}finally{e.f()}return this.queue}},{key:"processRecords",value:function(){var t=this.pendingRecords();t.length&&(this.queue=[]);var e,n=-1,i=-1,r=!1,o=(0,l.Z)(t);try{for(o.s();!(e=o.n()).done;){var s=e.value,a=this.readMutation(s);a&&(a.typeOver&&(r=!0),-1==n?(n=a.from,i=a.to):(n=Math.min(a.from,n),i=Math.max(a.to,i)))}}catch(h){o.e(h)}finally{o.f()}return{from:n,to:i,typeOver:r}}},{key:"readChange",value:function(){var t=this.processRecords(),e=t.from,n=t.to,i=t.typeOver,r=this.selectionChanged&&A(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;var o=new ui(this.view,e,n,i);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}},{key:"flush",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();var e=this.readChange();if(!e)return this.view.requestMeasure(),!1;var n=this.view.state,i=li(this.view,e);return this.view.state==n&&this.view.update([]),i}},{key:"readMutation",value:function(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 n=vi(e,t.previousSibling||t.target.previousSibling,-1),i=vi(e,t.nextSibling||t.target.nextSibling,1);return{from:n?e.posAfter(n):e.posAtStart,to:i?e.posBefore(i):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(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}},{key:"addWindowListeners",value:function(t){t.addEventListener("resize",this.onResize),t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}},{key:"removeWindowListeners",value:function(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"destroy",value:function(){var t,e,n;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();var i,r=(0,l.Z)(this.scrollTargets);try{for(r.s();!(i=r.n()).done;){i.value.removeEventListener("scroll",this.onScroll)}}catch(o){r.e(o)}finally{r.f()}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}]),t}();function vi(t,e,n){for(;e;){var i=F.get(e);if(i&&i.parent==t)return i;var r=e.parentNode;e=r!=t.dom?r:n>0?e.nextSibling:e.previousSibling}return null}var gi=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,c.Z)(this,t),this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),n.parent&&n.parent.appendChild(this.dom);var i=n.dispatch;this.dispatchTransactions=n.dispatchTransactions||i&&function(t){return t.forEach((function(t){return i(t,e)}))}||function(t){return e.update(t)},this.dispatch=this.dispatch.bind(this),this._root=n.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(n.parent)||document,this.viewState=new zn(n.state||d.yy.create(n)),n.scrollTo&&n.scrollTo.is(fe)&&(this.viewState.scrollTarget=n.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(pe).map((function(t){return new ye(t)}));var r,o=(0,l.Z)(this.plugins);try{for(o.s();!(r=o.n()).done;){r.value.update(this)}}catch(s){o.e(s)}finally{o.f()}this.observer=new di(this),this.inputState=new Ge(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Ee(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}return(0,f.Z)(t,[{key:"state",get:function(){return this.viewState.state}},{key:"viewport",get:function(){return this.viewState.viewport}},{key:"visibleRanges",get:function(){return this.viewState.visibleRanges}},{key:"inView",get:function(){return this.viewState.inView}},{key:"composing",get:function(){return this.inputState.composing>0}},{key:"compositionStarted",get:function(){return this.inputState.composing>=0}},{key:"root",get:function(){return this._root}},{key:"win",get:function(){return this.dom.ownerDocument.defaultView||window}},{key:"dispatch",value:function(){for(var t,e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var r=1==n.length&&n[0]instanceof d.YW?n:1==n.length&&Array.isArray(n[0])?n[0]:[(t=this.state).update.apply(t,n)];this.dispatchTransactions(r,this)}},{key:"update",value:function(t){var e=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");var n,i,r=!1,o=!1,s=this.state,a=(0,l.Z)(t);try{for(a.s();!(i=a.n()).done;){var h=i.value;if(h.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=h.state}}catch(C){a.e(C)}finally{a.f()}if(this.destroyed)this.viewState.state=s;else{var u=this.hasFocus,c=0,f=null;t.some((function(t){return t.annotation(wn)}))?(this.inputState.notifiedFocused=u,c=1):u!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=u,(f=bn(s,u))||(c=1));var v=this.observer.delayedAndroidKey,g=null;if(v?(this.observer.clearDelayedAndroidKey(),((g=this.observer.readChange())&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(g=null)):this.observer.clear(),s.facet(d.yy.phrases)!=this.state.facet(d.yy.phrases))return this.setState(s);n=De.create(this,s,t),n.flags|=c;var p=this.viewState.scrollTarget;try{this.updateState=2;var m,y=(0,l.Z)(t);try{for(y.s();!(m=y.n()).done;){var k=m.value;if(p&&(p=p.map(k.changes)),k.scrollIntoView){var w=k.state.selection.main;p=new ce(w.empty?w:d.jT.cursor(w.head,w.head>w.anchor?-1:1))}var b,x=(0,l.Z)(k.effects);try{for(x.s();!(b=x.n()).done;){var S=b.value;S.is(fe)&&(p=S.value.clip(this.state))}}catch(C){x.e(C)}finally{x.f()}}}catch(C){y.e(C)}finally{y.f()}this.viewState.update(n,p),this.bidiCache=yi.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),r=this.docView.update(n),this.state.facet(Oe)!=this.styleModules&&this.mountStyles(),o=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(r,t.some((function(t){return t.isUserEvent("select.pointer")})))}finally{this.updateState=0}if(n.startState.facet($n)!=n.state.facet($n)&&(this.viewState.mustMeasureContent=!0),(r||o||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!n.empty){var A,M=(0,l.Z)(this.state.facet(se));try{for(M.s();!(A=M.n()).done;){var Z=A.value;try{Z(n)}catch(S){de(this.state,S,"update listener")}}}catch(C){M.e(C)}finally{M.f()}}(f||g)&&Promise.resolve().then((function(){f&&e.state==f.startState&&e.dispatch(f),g&&!li(e,g)&&v.force&&V(e.contentDOM,v.key,v.keyCode)}))}}},{key:"setState",value:function(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)this.viewState.state=t;else{this.updateState=2;var e=this.hasFocus;try{var n,i=(0,l.Z)(this.plugins);try{for(i.s();!(n=i.n()).done;){n.value.destroy(this)}}catch(s){i.e(s)}finally{i.f()}this.viewState=new zn(t),this.plugins=t.facet(pe).map((function(t){return new ye(t)})),this.pluginMap.clear();var r,o=(0,l.Z)(this.plugins);try{for(o.s();!(r=o.n()).done;){r.value.update(this)}}catch(s){o.e(s)}finally{o.f()}this.docView.destroy(),this.docView=new Ee(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(t){var e=t.startState.facet(pe),n=t.state.facet(pe);if(e!=n){var i,r=[],o=(0,l.Z)(n);try{for(o.s();!(i=o.n()).done;){var s=i.value,a=e.indexOf(s);if(a<0)r.push(new ye(s));else{var h=this.plugins[a];h.mustUpdate=t,r.push(h)}}}catch(p){o.e(p)}finally{o.f()}var u,c=(0,l.Z)(this.plugins);try{for(c.s();!(u=c.n()).done;){var f=u.value;f.mustUpdate!=t&&f.destroy(this)}}catch(p){c.e(p)}finally{c.f()}this.plugins=r,this.pluginMap.clear()}else{var d,v=(0,l.Z)(this.plugins);try{for(v.s();!(d=v.n()).done;){d.value.mustUpdate=t}}catch(p){v.e(p)}finally{v.f()}}for(var g=0;g<this.plugins.length;g++)this.plugins[g].update(this);e!=n&&this.inputState.ensureHandlers(this.plugins)}},{key:"measure",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(!this.destroyed){if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();var n=null,i=this.scrollDOM,r=i.scrollTop*this.scaleY,o=this.viewState,s=o.scrollAnchorPos,a=o.scrollAnchorHeight;Math.abs(r-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(var h=0;;h++){if(a<0)if(W(i))s=-1,a=this.viewState.heightMap.height;else{var u=this.viewState.scrollAnchorAt(r);s=u.from,a=u.top}this.updateState=1;var c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(h>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}var f=[];if(!(4&c)){var d=[f,this.measureRequests];this.measureRequests=d[0],f=d[1]}var v=f.map((function(e){try{return e.read(t)}catch(n){return de(t.state,n),mi}})),g=De.create(this,this.state,[]),p=!1;g.flags|=c,n?n.flags|=c:n=g,this.updateState=2,g.empty||(this.updatePlugins(g),this.inputState.update(g),this.updateAttrs(),p=this.docView.update(g));for(var m=0;m<f.length;m++)if(v[m]!=mi)try{var y=f[m];y.write&&y.write(v[m],this)}catch(x){de(this.state,x)}if(p&&this.docView.updateSelection(!0),!g.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}var k=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-a;if(k>1||k<-1){r+=k,i.scrollTop=r/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty){var w,b=(0,l.Z)(this.state.facet(se));try{for(b.s();!(w=b.n()).done;){(0,w.value)(n)}}catch(S){b.e(S)}finally{b.f()}}}}},{key:"themeClasses",get:function(){return Yn+" "+(this.state.facet(Xn)?ti:Qn)+" "+this.state.facet($n)}},{key:"updateAttrs",value:function(){var t=this,e=ki(this,ke,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(ve)?"true":"false",class:"cm-content",style:"".concat(ot.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),ki(this,we,n);var i=this.observer.ignore((function(){var i=pt(t.contentDOM,t.contentAttrs,n),r=pt(t.dom,t.editorAttrs,e);return i||r}));return this.editorAttrs=e,this.contentAttrs=n,i}},{key:"showAnnouncements",value:function(e){var n,i=!0,r=(0,l.Z)(e);try{for(r.s();!(n=r.n()).done;){var o,s=n.value,a=(0,l.Z)(s.effects);try{for(a.s();!(o=a.n()).done;){var h=o.value;if(h.is(t.announce))i&&(this.announceDOM.textContent=""),i=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=h.value}}catch(u){a.e(u)}finally{a.f()}}}catch(u){r.e(u)}finally{r.f()}}},{key:"mountStyles",value:function(){this.styleModules=this.state.facet(Oe);var e=this.state.facet(t.cspNonce);y.mount(this.root,this.styleModules.concat(ii).reverse(),e?{nonce:e}:void 0)}},{key:"readMeasured",value:function(){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(t){var e=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((function(){return e.measure()}))),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(var n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===t.key)return void(this.measureRequests[n]=t);this.measureRequests.push(t)}}},{key:"plugin",value:function(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(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}},{key:"documentPadding",get:function(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}},{key:"scaleX",get:function(){return this.viewState.scaleX}},{key:"scaleY",get:function(){return this.viewState.scaleY}},{key:"elementAtHeight",value:function(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}},{key:"lineBlockAtHeight",value:function(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}},{key:"viewportLineBlocks",get:function(){return this.viewState.viewportLines}},{key:"lineBlockAt",value:function(t){return this.viewState.lineBlockAt(t)}},{key:"contentHeight",get:function(){return this.viewState.contentHeight}},{key:"moveByChar",value:function(t,e,n){return Ue(this,t,Ke(this,t,e,n))}},{key:"moveByGroup",value:function(t,e){var n=this;return Ue(this,t,Ke(this,t,e,(function(e){return function(t,e,n){var i=t.state.charCategorizer(e),r=i(n);return function(t){var e=i(t);return r==d.D0.Space&&(r=e),r==e}}(n,t.head,e)})))}},{key:"visualLineSide",value:function(t,e){var n=this.bidiSpans(t),i=this.textDirectionAt(t.from),r=n[e?n.length-1:0];return d.jT.cursor(r.side(e,i)+t.from,r.forward(!e,i)?1:-1)}},{key:"moveToLineBoundary",value:function(t,e){return function(t,e,n,i){var r=je(t,e.head),o=i&&r.type==bt.Text&&(t.lineWrapping||r.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head):null;if(o){var s=t.dom.getBoundingClientRect(),a=t.textDirectionAt(r.from),h=t.posAtCoords({x:n==(a==Et.LTR)?s.right-1:s.left+1,y:(o.top+o.bottom)/2});if(null!=h)return d.jT.cursor(h,n?-1:1)}return d.jT.cursor(n?r.to:r.from,n?-1:1)}(this,t,e,!(arguments.length>2&&void 0!==arguments[2])||arguments[2])}},{key:"moveVertically",value:function(t,e,n){return Ue(this,t,function(t,e,n,i){var r=e.head,o=n?1:-1;if(r==(n?t.state.doc.length:0))return d.jT.cursor(r,e.assoc);var s,a=e.goalColumn,h=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(r,e.assoc||-1),l=t.documentTop;if(u)null==a&&(a=u.left-h.left),s=o<0?u.top:u.bottom;else{var c=t.viewState.lineBlockAt(r);null==a&&(a=Math.min(h.right-h.left,t.defaultCharacterWidth*(r-c.from))),s=(o<0?c.top:c.bottom)+l}for(var f=h.left+a,v=null!=i?i:t.viewState.heightOracle.textHeight>>1,g=0;;g+=10){var p=s+(v+g)*o,m=Fe(t,{x:f,y:p},!1,o);if(p<h.top||p>h.bottom||(o<0?m<r:m>r)){var y=t.docView.coordsForChar(m),k=!y||p<y.top?-1:1;return d.jT.cursor(m,k,void 0,a)}}}(this,t,e,n))}},{key:"domAtPos",value:function(t){return this.docView.domAtPos(t)}},{key:"posAtDOM",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.posFromDOM(t,e)}},{key:"posAtCoords",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.readMeasured(),Fe(this,t,e)}},{key:"coordsAtPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.readMeasured();var n=this.docView.coordsAt(t,e);if(!n||n.left==n.right)return n;var i=this.state.doc.lineAt(t),r=this.bidiSpans(i);return D(n,r[Kt.find(r,t-i.from,-1,e)].dir==Et.LTR==e>0)}},{key:"coordsForChar",value:function(t){return this.readMeasured(),this.docView.coordsForChar(t)}},{key:"defaultCharacterWidth",get:function(){return this.viewState.heightOracle.charWidth}},{key:"defaultLineHeight",get:function(){return this.viewState.heightOracle.lineHeight}},{key:"textDirection",get:function(){return this.viewState.defaultTextDirection}},{key:"textDirectionAt",value:function(t){return!this.state.facet(ue)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}},{key:"lineWrapping",get:function(){return this.viewState.heightOracle.lineWrapping}},{key:"bidiSpans",value:function(t){if(t.length>pi)return Yt(t.length);var e,n,i=this.textDirectionAt(t.from),r=(0,l.Z)(this.bidiCache);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.from==t.from&&o.dir==i&&(o.fresh||Jt(o.isolates,e=Me(this,t))))return o.order}}catch(a){r.e(a)}finally{r.f()}e||(e=Me(this,t));var s=Xt(t.text,i,e);return this.bidiCache.push(new yi(t.from,t.to,i,e,!0,s)),s}},{key:"hasFocus",get:function(){var t;return(this.dom.ownerDocument.hasFocus()||ot.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}},{key:"focus",value:function(){var t=this;this.observer.ignore((function(){N(t.contentDOM),t.docView.updateSelection()}))}},{key:"setRoot",value:function(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}},{key:"destroy",value:function(){var t,e=(0,l.Z)(this.plugins);try{for(e.s();!(t=e.n()).done;){t.value.destroy(this)}}catch(n){e.e(n)}finally{e.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(){var t=this.scrollDOM,e=t.scrollTop,n=t.scrollLeft,i=this.viewState.scrollAnchorAt(e);return fe.of(new ce(d.jT.cursor(i.from),"start","start",i.top-e,n,!0))}}],[{key:"scrollIntoView",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fe.of(new ce("number"==typeof t?d.jT.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}},{key:"domEventHandlers",value:function(t){return me.define((function(){return{}}),{eventHandlers:t})}},{key:"domEventObservers",value:function(t){return me.define((function(){return{}}),{eventObservers:t})}},{key:"theme",value:function(t,e){var n=y.newName(),i=[$n.of(n),Oe.of(ni(".".concat(n),t))];return e&&e.dark&&i.push(Xn.of(!0)),i}},{key:"baseTheme",value:function(t){return d.Wl.lowest(Oe.of(ni("."+Yn,t,ei)))}},{key:"findFromDOM",value:function(t){var e,n=t.querySelector(".cm-content"),i=n&&F.get(n)||F.get(t);return(null===(e=null==i?void 0:i.rootView)||void 0===e?void 0:e.view)||null}}]),t}();gi.styleModule=Oe,gi.inputHandler=ae,gi.focusChangeEffect=he,gi.perLineTextDirection=ue,gi.exceptionSink=oe,gi.updateListener=se,gi.editable=ve,gi.mouseSelectionStyle=re,gi.dragMovesSelection=ie,gi.clickAddsSelectionRange=ne,gi.decorations=be,gi.outerDecorations=xe,gi.atomicRanges=Se,gi.bidiIsolatedRanges=Ae,gi.scrollMargins=Ze,gi.darkTheme=Xn,gi.cspNonce=d.r$.define({combine:function(t){return t.length?t[0]:""}}),gi.contentAttributes=we,gi.editorAttributes=ke,gi.lineWrapping=gi.contentAttributes.of({class:"cm-lineWrapping"}),gi.announce=d.Py.define();var pi=4096,mi={},yi=function(){function t(e,n,i,r,o,s){(0,c.Z)(this,t),this.from=e,this.to=n,this.dir=i,this.isolates=r,this.fresh=o,this.order=s}return(0,f.Z)(t,null,[{key:"update",value:function(e,n){if(n.empty&&!e.some((function(t){return t.fresh})))return e;for(var i=[],r=e.length?e[e.length-1].dir:Et.LTR,o=Math.max(0,e.length-10);o<e.length;o++){var s=e[o];s.dir!=r||n.touchesRange(s.from,s.to)||i.push(new t(n.mapPos(s.from,1),n.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return i}}]),t}();function ki(t,e,n){for(var i=t.state.facet(e),r=i.length-1;r>=0;r--){var o=i[r],s="function"==typeof o?o(t):o;s&&dt(s,n)}return n}var wi=ot.mac?"mac":ot.windows?"win":ot.linux?"linux":"key";function bi(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}var xi=d.Wl.default(gi.domEventHandlers({keydown:function(t,e){return Oi(Mi(e.state),t,e,"editor")}})),Si=d.r$.define({enables:xi}),Ai=new WeakMap;function Mi(t){var e=t.facet(Si),n=Ai.get(e);return n||Ai.set(e,n=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wi,i=Object.create(null),r=Object.create(null),o=function(t,e){var n=r[t];if(null==n)r[t]=e;else if(n!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},s=function(t,e,r,s,a){for(var h,u,l=i[t]||(i[t]=Object.create(null)),c=e.split(/ (?!$)/).map((function(t){return function(t,e){var n,i,r,o,s=t.split(/-(?!$)/),a=s[s.length-1];"Space"==a&&(a=" ");for(var h=0;h<s.length-1;++h){var u=s[h];if(/^(cmd|meta|m)$/i.test(u))o=!0;else if(/^a(lt)?$/i.test(u))n=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))r=!0;else{if(!/^mod$/i.test(u))throw new Error("Unrecognized modifier name: "+u);"mac"==e?o=!0:i=!0}}return n&&(a="Alt-"+a),i&&(a="Ctrl-"+a),o&&(a="Meta-"+a),r&&(a="Shift-"+a),a}(t,n)})),f=function(){var e=c.slice(0,d).join(" ");o(e,!0),l[e]||(l[e]={preventDefault:!0,stopPropagation:!1,run:[function(n){var i=Zi={view:n,prefix:e,scope:t};return setTimeout((function(){Zi==i&&(Zi=null)}),Ci),!0}]})},d=1;d<c.length;d++)f();var v=c.join(" ");o(v,!1);var g=l[v]||(l[v]={preventDefault:!1,stopPropagation:!1,run:(null===(u=null===(h=l._any)||void 0===h?void 0:h.run)||void 0===u?void 0:u.slice())||[]});r&&g.run.push(r),s&&(g.preventDefault=!0),a&&(g.stopPropagation=!0)},a=(0,l.Z)(t);try{for(a.s();!(e=a.n()).done;){var h=e.value,u=h.scope?h.scope.split(" "):["editor"];if(h.any){var c,f=(0,l.Z)(u);try{for(f.s();!(c=f.n()).done;){var d=c.value,v=i[d]||(i[d]=Object.create(null));for(var g in v._any||(v._any={preventDefault:!1,stopPropagation:!1,run:[]}),v)v[g].run.push(h.any)}}catch(w){f.e(w)}finally{f.f()}}var p=h[n]||h.key;if(p){var m,y=(0,l.Z)(u);try{for(y.s();!(m=y.n()).done;){var k=m.value;s(k,p,h.run,h.preventDefault,h.stopPropagation),h.shift&&s(k,"Shift-"+p,h.shift,h.preventDefault,h.stopPropagation)}}catch(w){y.e(w)}finally{y.f()}}}}catch(w){a.e(w)}finally{a.f()}return i}(e.reduce((function(t,e){return t.concat(e)}),[]))),n}var Zi=null,Ci=4e3;function Oi(t,e,n,i){var r=(0,b.YG)(e),o=(0,d.gm)(r,0),s=(0,d.nZ)(o)==r.length&&" "!=r,a="",h=!1,u=!1,c=!1;Zi&&Zi.view==n&&Zi.scope==i&&(a=Zi.prefix+" ",tn.indexOf(e.keyCode)<0&&(u=!0,Zi=null));var f,v,g=new Set,p=function(t){if(t){var i,r=(0,l.Z)(t.run);try{for(r.s();!(i=r.n()).done;){var o=i.value;if(!g.has(o)&&(g.add(o),o(n,e)))return t.stopPropagation&&(c=!0),!0}}catch(s){r.e(s)}finally{r.f()}t.preventDefault&&(t.stopPropagation&&(c=!0),u=!0)}return!1},m=t[i];return m&&(p(m[a+bi(r,e,!s)])?h=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ot.windows&&e.ctrlKey&&e.altKey)&&(f=b.ue[e.keyCode])&&f!=r?(p(m[a+bi(f,e,!0)])||e.shiftKey&&(v=b.uY[e.keyCode])!=r&&v!=f&&p(m[a+bi(v,e,!1)]))&&(h=!0):s&&e.shiftKey&&p(m[a+bi(r,e,!0)])&&(h=!0),!h&&p(m._any)&&(h=!0)),u&&(h=!0),h&&c&&e.stopPropagation(),h}var Ti=function(){function t(e,n,i,r,o){(0,c.Z)(this,t),this.className=e,this.left=n,this.top=i,this.width=r,this.height=o}return(0,f.Z)(t,[{key:"draw",value:function(){var t=document.createElement("div");return t.className=this.className,this.adjust(t),t}},{key:"update",value:function(t,e){return e.className==this.className&&(this.adjust(t),!0)}},{key:"adjust",value:function(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(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(e,n,i){if(i.empty){var r=e.coordsAtPos(i.head,i.assoc||1);if(!r)return[];var o=Di(e);return[new t(n,r.left-o.left,r.top-o.top,null,r.bottom-r.top)]}return Bi(e,n,i)}}]),t}();function Di(t){var e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Et.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function Ei(t,e,n){var i=d.jT.cursor(e);return{from:Math.max(n.from,t.moveToLineBoundary(i,!1,!0).from),to:Math.min(n.to,t.moveToLineBoundary(i,!0,!0).from),type:bt.Text}}function Bi(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];var i=Math.max(n.from,t.viewport.from),r=Math.min(n.to,t.viewport.to),o=t.textDirection==Et.LTR,s=t.contentDOM,a=s.getBoundingClientRect(),h=Di(t),u=s.querySelector(".cm-line"),c=u&&window.getComputedStyle(u),f=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=a.right-(c?parseInt(c.paddingRight):0),v=je(t,i),g=je(t,r),p=v.type==bt.Text?v:null,m=g.type==bt.Text?g:null;if(p&&(t.lineWrapping||v.widgetLineBreaks)&&(p=Ei(t,i,p)),m&&(t.lineWrapping||g.widgetLineBreaks)&&(m=Ei(t,r,m)),p&&m&&p.from==m.from)return x(S(n.from,n.to,p));var y=p?S(n.from,null,p):A(v,!1),k=m?S(null,n.to,m):A(g,!0),w=[];return(p||v).to<(m||g).from-(p&&m?1:0)||v.widgetLineBreaks>1&&y.bottom+t.defaultLineHeight/2<k.top?w.push(b(f,y.bottom,d,k.top)):y.bottom<k.top&&t.elementAtHeight((y.bottom+k.top)/2).type==bt.Text&&(y.bottom=k.top=(y.bottom+k.top)/2),x(y).concat(w).concat(x(k));function b(t,n,i,r){return new Ti(e,t-h.left,n-h.top-.01,i-t,r-n+.01)}function x(t){for(var e=t.top,n=t.bottom,i=t.horizontal,r=[],o=0;o<i.length;o+=2)r.push(b(i[o],e,i[o+1],n));return r}function S(e,n,i){var r=1e9,s=-1e9,a=[];function h(e,n,h,u,l){var c=t.coordsAtPos(e,e==i.to?-2:2),v=t.coordsAtPos(h,h==i.from?2:-2);c&&v&&(r=Math.min(c.top,v.top,r),s=Math.max(c.bottom,v.bottom,s),l==Et.LTR?a.push(o&&n?f:c.left,o&&u?d:v.right):a.push(!o&&u?f:v.left,!o&&n?d:c.right))}var u,c=null!=e?e:i.from,v=null!=n?n:i.to,g=(0,l.Z)(t.visibleRanges);try{for(g.s();!(u=g.n()).done;){var p=u.value;if(p.to>c&&p.from<v)for(var m=Math.max(p.from,c),y=Math.min(p.to,v);;){var k,w=t.state.doc.lineAt(m),b=(0,l.Z)(t.bidiSpans(w));try{for(b.s();!(k=b.n()).done;){var x=k.value,S=x.from+w.from,A=x.to+w.from;if(S>=y)break;A>m&&h(Math.max(S,m),null==e&&S<=c,Math.min(A,y),null==n&&A>=v,x.dir)}}catch(M){b.e(M)}finally{b.f()}if((m=w.to+1)>=y)break}}}catch(M){g.e(M)}finally{g.f()}return 0==a.length&&h(c,null==e,v,null==n,t.textDirection),{top:r,bottom:s,horizontal:a}}function A(t,e){var n=a.top+(e?t.top:t.bottom);return{top:n,bottom:n,horizontal:[]}}}var Ri=function(){function t(e,n){(0,c.Z)(this,t),this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}return(0,f.Z)(t,[{key:"update",value:function(t){t.startState.facet(Ii)!=t.state.facet(Ii)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}},{key:"setOrder",value:function(t){for(var e=0,n=t.facet(Ii);e<n.length&&n[e]!=this.layer;)e++;this.dom.style.zIndex=String((this.layer.above?150:-1)-e)}},{key:"measure",value:function(){return this.layer.markers(this.view)}},{key:"scale",value:function(){var t=this.view,e=t.scaleX,n=t.scaleY;e==this.scaleX&&n==this.scaleY||(this.scaleX=e,this.scaleY=n,this.dom.style.transform="scale(".concat(1/e,", ").concat(1/n,")"))}},{key:"draw",value:function(t){var e=this;if(t.length!=this.drawn.length||t.some((function(t,n){return i=t,r=e.drawn[n],!(i.constructor==r.constructor&&i.eq(r));var i,r}))){var n,i=this.dom.firstChild,r=0,o=(0,l.Z)(t);try{for(o.s();!(n=o.n()).done;){var s=n.value;s.update&&i&&s.constructor&&this.drawn[r].constructor&&s.update(i,this.drawn[r])?(i=i.nextSibling,r++):this.dom.insertBefore(s.draw(),i)}}catch(h){o.e(h)}finally{o.f()}for(;i;){var a=i.nextSibling;i.remove(),i=a}this.drawn=t}}},{key:"destroy",value:function(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}]),t}(),Ii=d.r$.define();function Pi(t){return[me.define((function(e){return new Ri(e,t)})),Ii.of(t)]}var Ni=!ot.ios,Li=d.r$.define({combine:function(t){return(0,d.BO)(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:function(t,e){return Math.min(t,e)},drawRangeCursor:function(t,e){return t||e}})}});function Vi(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Li.of(t),Wi,zi,qi,le.of(!0)]}function Hi(t){return t.startState.facet(Li)!=t.state.facet(Li)}var Wi=Pi({above:!0,markers:function(t){var e,n=t.state,i=n.facet(Li),r=[],o=(0,l.Z)(n.selection.ranges);try{for(o.s();!(e=o.n()).done;){var s=e.value,a=s==n.selection.main;if(s.empty?!a||Ni:i.drawRangeCursor){var h,u=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=s.empty?s:d.jT.cursor(s.head,s.head>s.anchor?-1:1),f=(0,l.Z)(Ti.forRange(t,u,c));try{for(f.s();!(h=f.n()).done;){var v=h.value;r.push(v)}}catch(g){f.e(g)}finally{f.f()}}}}catch(g){o.e(g)}finally{o.f()}return r},update:function(t,e){t.transactions.some((function(t){return t.selection}))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");var n=Hi(t);return n&&_i(t.state,e),t.docChanged||t.selectionSet||n},mount:function(t,e){_i(e.state,t)},class:"cm-cursorLayer"});function _i(t,e){e.style.animationDuration=t.facet(Li).cursorBlinkRate+"ms"}var zi=Pi({above:!1,markers:function(t){return t.state.selection.ranges.map((function(e){return e.empty?[]:Ti.forRange(t,"cm-selectionBackground",e)})).reduce((function(t,e){return t.concat(e)}))},update:function(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||Hi(t)},class:"cm-selectionLayer"}),Fi={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Ni&&(Fi[".cm-line"].caretColor="transparent !important",Fi[".cm-content"]={caretColor:"transparent !important"});var qi=d.Wl.highest(gi.theme(Fi));function ji(){return Ji}var Ki=xt.line({class:"cm-activeLine"}),Ji=me.fromClass(function(){function t(e){(0,c.Z)(this,t),this.decorations=this.getDeco(e)}return(0,f.Z)(t,[{key:"update",value:function(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}},{key:"getDeco",value:function(t){var e,n=-1,i=[],r=(0,l.Z)(t.state.selection.ranges);try{for(r.s();!(e=r.n()).done;){var o=e.value,s=t.lineBlockAt(o.head);s.from>n&&(i.push(Ki.range(s.from)),n=s.from)}}catch(a){r.e(a)}finally{r.f()}return xt.set(i)}}]),t}(),{decorations:function(t){return t.decorations}});var Ui=2e3;function Gi(t,e){var n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),i=t.state.doc.lineAt(n),r=n-i.from,o=r>Ui?-1:r==i.length?function(t,e){var n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}(t,e.clientX):(0,d.IS)(i.text,t.state.tabSize,n-i.from);return{line:i.number,col:o,off:r}}function $i(t,e){var n=Gi(t,e),i=t.state.selection;return n?{update:function(t){if(t.docChanged){var e=t.changes.mapPos(t.startState.doc.line(n.line).from),r=t.state.doc.lineAt(e);n={line:r.number,col:n.col,off:Math.min(n.off,r.length)},i=i.map(t.changes)}},get:function(e,r,o){var s=Gi(t,e);if(!s)return i;var a=function(t,e,n){var i=Math.min(e.line,n.line),r=Math.max(e.line,n.line),o=[];if(e.off>Ui||n.off>Ui||e.col<0||n.col<0)for(var s=Math.min(e.off,n.off),a=Math.max(e.off,n.off),h=i;h<=r;h++){var u=t.doc.line(h);u.length<=a&&o.push(d.jT.range(u.from+s,u.to+a))}else for(var l=Math.min(e.col,n.col),c=Math.max(e.col,n.col),f=i;f<=r;f++){var v=t.doc.line(f),g=(0,d.Gz)(v.text,l,t.tabSize,!0);if(g<0)o.push(d.jT.cursor(v.to));else{var p=(0,d.Gz)(v.text,c,t.tabSize);o.push(d.jT.range(v.from+g,v.from+p))}}return o}(t.state,n,s);return a.length?o?d.jT.create(a.concat(i.ranges)):d.jT.create(a):i}}:null}function Xi(t){var e=(null==t?void 0:t.eventFilter)||function(t){return t.altKey&&0==t.button};return gi.mouseSelectionStyle.of((function(t,n){return e(n)?$i(t,n):null}))}var Yi={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}]},Qi={style:"cursor: crosshair"};function tr(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=(0,i.Z)(Yi[t.key||"Alt"],2),n=e[0],r=e[1],o=me.fromClass(function(){function t(e){(0,c.Z)(this,t),this.view=e,this.isDown=!1}return(0,f.Z)(t,[{key:"set",value:function(t){this.isDown!=t&&(this.isDown=t,this.view.update([]))}}]),t}(),{eventObservers:{keydown:function(t){this.set(t.keyCode==n||r(t))},keyup:function(t){t.keyCode!=n&&r(t)||this.set(!1)},mousemove:function(t){this.set(r(t))}}});return[o,gi.contentAttributes.of((function(t){var e;return(null===(e=t.plugin(o))||void 0===e?void 0:e.isDown)?Qi:null}))]}var er="-10000px",nr=function(){function t(e,n,i){(0,c.Z)(this,t),this.facet=n,this.createTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter((function(t){return t})),this.tooltipViews=this.tooltips.map(i)}return(0,f.Z)(t,[{key:"update",value:function(t,e){var n,i=t.state.facet(this.facet),r=i.filter((function(t){return t}));if(i===this.input){var o,s=(0,l.Z)(this.tooltipViews);try{for(s.s();!(o=s.n()).done;){var a=o.value;a.update&&a.update(t)}}catch(w){s.e(w)}finally{s.f()}return!1}for(var h=[],u=e?[]:null,c=0;c<r.length;c++){var f=r[c],d=-1;if(f){for(var v=0;v<this.tooltips.length;v++){var g=this.tooltips[v];g&&g.create==f.create&&(d=v)}if(d<0)h[c]=this.createTooltipView(f),u&&(u[c]=!!f.above);else{var p=h[c]=this.tooltipViews[d];u&&(u[c]=e[d]),p.update&&p.update(t)}}}var m,y=(0,l.Z)(this.tooltipViews);try{for(y.s();!(m=y.n()).done;){var k=m.value;h.indexOf(k)<0&&(k.dom.remove(),null===(n=k.destroy)||void 0===n||n.call(k))}}catch(w){y.e(w)}finally{y.f()}return e&&(u.forEach((function(t,n){return e[n]=t})),e.length=u.length),this.input=i,this.tooltips=r,this.tooltipViews=h,!0}}]),t}();function ir(t){var e=t.win;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}var rr=d.r$.define({combine:function(t){var e,n,i;return{position:ot.ios?"absolute":(null===(e=t.find((function(t){return t.position})))||void 0===e?void 0:e.position)||"fixed",parent:(null===(n=t.find((function(t){return t.parent})))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=t.find((function(t){return t.tooltipSpace})))||void 0===i?void 0:i.tooltipSpace)||ir}}}),or=new WeakMap,sr=me.fromClass(function(){function t(e){var n=this;(0,c.Z)(this,t),this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;var i=e.state.facet(rr);this.position=i.position,this.parent=i.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new nr(e,ur,(function(t){return n.createTooltip(t)})),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((function(t){Date.now()>n.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&n.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}return(0,f.Z)(t,[{key:"createContainer",value:function(){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(){if(this.intersectionObserver){this.intersectionObserver.disconnect();var t,e=(0,l.Z)(this.manager.tooltipViews);try{for(e.s();!(t=e.n()).done;){var n=t.value;this.intersectionObserver.observe(n.dom)}}catch(i){e.e(i)}finally{e.f()}}}},{key:"measureSoon",value:function(){var t=this;this.measureTimeout<0&&(this.measureTimeout=setTimeout((function(){t.measureTimeout=-1,t.maybeMeasure()}),50))}},{key:"update",value:function(t){t.transactions.length&&(this.lastTransaction=Date.now());var e=this.manager.update(t,this.above);e&&this.observeIntersection();var n=e||t.geometryChanged,i=t.state.facet(rr);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;var r,o=(0,l.Z)(this.manager.tooltipViews);try{for(o.s();!(r=o.n()).done;){r.value.dom.style.position=this.position}}catch(u){o.e(u)}finally{o.f()}n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();var s,a=(0,l.Z)(this.manager.tooltipViews);try{for(a.s();!(s=a.n()).done;){var h=s.value;this.container.appendChild(h.dom)}}catch(u){a.e(u)}finally{a.f()}n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}},{key:"createTooltip",value:function(t){var e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){var n=document.createElement("div");n.className="cm-tooltip-arrow",e.dom.appendChild(n)}return e.dom.style.position=this.position,e.dom.style.top=er,e.dom.style.left="0px",this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}},{key:"destroy",value:function(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);var n,i=(0,l.Z)(this.manager.tooltipViews);try{for(i.s();!(n=i.n()).done;){var r=n.value;r.dom.remove(),null===(t=r.destroy)||void 0===t||t.call(r)}}catch(o){i.e(o)}finally{i.f()}this.parent&&this.container.remove(),null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}},{key:"readMeasure",value:function(){var t=this,e=this.view.dom.getBoundingClientRect(),n=1,i=1,r=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){var o=this.manager.tooltipViews[0].dom;if(ot.gecko)r=o.offsetParent!=this.container.ownerDocument.body;else if(o.style.top==er&&"0px"==o.style.left){var s=o.getBoundingClientRect();r=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(r||"absolute"==this.position)if(this.parent){var a=this.parent.getBoundingClientRect();a.width&&a.height&&(n=a.width/this.parent.offsetWidth,i=a.height/this.parent.offsetHeight)}else{var h=this.view.viewState;n=h.scaleX,i=h.scaleY}return{editor:e,parent:this.parent?this.container.getBoundingClientRect():e,pos:this.manager.tooltips.map((function(e,n){var i=t.manager.tooltipViews[n];return i.getCoords?i.getCoords(e.pos):t.view.coordsAtPos(e.pos)})),size:this.manager.tooltipViews.map((function(t){return t.dom.getBoundingClientRect()})),space:this.view.state.facet(rr).tooltipSpace(this.view),scaleX:n,scaleY:i,makeAbsolute:r}}},{key:"writeMeasure",value:function(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";var n,i=(0,l.Z)(this.manager.tooltipViews);try{for(i.s();!(n=i.n()).done;){n.value.dom.style.position="absolute"}}catch(E){i.e(E)}finally{i.f()}}for(var r=t.editor,o=t.space,s=t.scaleX,a=t.scaleY,h=[],u=0;u<this.manager.tooltips.length;u++){var c=this.manager.tooltips[u],f=this.manager.tooltipViews[u],d=f.dom,v=t.pos[u],g=t.size[u];if(!v||v.bottom<=Math.max(r.top,o.top)||v.top>=Math.min(r.bottom,o.bottom)||v.right<Math.max(r.left,o.left)-.1||v.left>Math.min(r.right,o.right)+.1)d.style.top=er;else{var p=c.arrow?f.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,y=g.right-g.left,k=null!==(e=or.get(f))&&void 0!==e?e:g.bottom-g.top,w=f.offset||hr,b=this.view.textDirection==Et.LTR,x=g.width>o.right-o.left?b?o.left:o.right-g.width:b?Math.min(v.left-(p?14:0)+w.x,o.right-y):Math.max(o.left,v.left-y+(p?14:0)-w.x),S=this.above[u];!c.strictSide&&(S?v.top-(g.bottom-g.top)-w.y<o.top:v.bottom+(g.bottom-g.top)+w.y>o.bottom)&&S==o.bottom-v.bottom>v.top-o.top&&(S=this.above[u]=!S);var A=(S?v.top-o.top:o.bottom-v.bottom)-m;if(A<k&&!1!==f.resize){if(A<this.view.defaultLineHeight){d.style.top=er;continue}or.set(f,k),d.style.height=(k=A)/a+"px"}else d.style.height&&(d.style.height="");var M=S?v.top-k-m-w.y:v.bottom+m+w.y,Z=x+y;if(!0!==f.overlap){var C,O=(0,l.Z)(h);try{for(O.s();!(C=O.n()).done;){var T=C.value;T.left<Z&&T.right>x&&T.top<M+k&&T.bottom>M&&(M=S?T.top-k-2-m:T.bottom+m+2)}}catch(E){O.e(E)}finally{O.f()}}if("absolute"==this.position?(d.style.top=(M-t.parent.top)/a+"px",d.style.left=(x-t.parent.left)/s+"px"):(d.style.top=M/a+"px",d.style.left=x/s+"px"),p){var D=v.left+(b?w.x:-w.x)-(x+14-7);p.style.left=D/s+"px"}!0!==f.overlap&&h.push({left:x,top:M,right:Z,bottom:M+k}),d.classList.toggle("cm-tooltip-above",S),d.classList.toggle("cm-tooltip-below",!S),f.positioned&&f.positioned(t.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 t,e=(0,l.Z)(this.manager.tooltipViews);try{for(e.s();!(t=e.n()).done;){t.value.dom.style.top=er}}catch(n){e.e(n)}finally{e.f()}}}}]),t}(),{eventObservers:{scroll:function(){this.maybeMeasure()}}}),ar=gi.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"}}}),hr={x:0,y:0},ur=d.r$.define({enables:[sr,ar]});function lr(t,e){var n=t.plugin(sr);if(!n)return null;var i=n.manager.tooltips.indexOf(e);return i<0?null:n.manager.tooltipViews[i]}var cr=function(t){function e(){return(0,c.Z)(this,e),(0,a.Z)(this,e,arguments)}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"compare",value:function(t){return this==t||this.constructor==t.constructor&&this.eq(t)}},{key:"eq",value:function(t){return!1}},{key:"destroy",value:function(t){}}]),e}(d.uU);cr.prototype.elementClass="",cr.prototype.toDOM=void 0,cr.prototype.mapMode=d.gc.TrackBefore,cr.prototype.startSide=cr.prototype.endSide=-1,cr.prototype.point=!0;var fr=d.r$.define(),dr=d.r$.define();var vr=d.r$.define({combine:function(t){return t.some((function(t){return t}))}});function gr(t){var e=[pr];return t&&!1===t.fixed&&e.push(vr.of(!0)),e}var pr=me.fromClass(function(){function t(e){(0,c.Z)(this,t),this.view=e,this.prevViewport=e.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=e.state.facet(dr).map((function(t){return new wr(e,t)}));var n,i=(0,l.Z)(this.gutters);try{for(i.s();!(n=i.n()).done;){var r=n.value;this.dom.appendChild(r.dom)}}catch(o){i.e(o)}finally{i.f()}this.fixed=!e.state.facet(vr),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}return(0,f.Z)(t,[{key:"update",value:function(t){if(this.updateGutters(t)){var e=this.prevViewport,n=t.view.viewport,i=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(i<.8*(n.to-n.from))}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(vr)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}},{key:"syncGutters",value:function(t){var e=this,n=this.dom.nextSibling;t&&this.dom.remove();var i,r=d.Xs.iter(this.view.state.facet(fr),this.view.viewport.from),o=[],s=this.gutters.map((function(t){return new kr(t,e.view.viewport,-e.view.documentPadding.top)})),a=(0,l.Z)(this.view.viewportLineBlocks);try{for(a.s();!(i=a.n()).done;){var h=i.value;if(o.length&&(o=[]),Array.isArray(h.type)){var u,c=!0,f=(0,l.Z)(h.type);try{for(f.s();!(u=f.n()).done;){var v=u.value;if(v.type==bt.Text&&c){yr(r,o,v.from);var g,p=(0,l.Z)(s);try{for(p.s();!(g=p.n()).done;){g.value.line(this.view,v,o)}}catch(M){p.e(M)}finally{p.f()}c=!1}else if(v.widget){var m,y=(0,l.Z)(s);try{for(y.s();!(m=y.n()).done;){m.value.widget(this.view,v)}}catch(M){y.e(M)}finally{y.f()}}}}catch(M){f.e(M)}finally{f.f()}}else if(h.type==bt.Text){yr(r,o,h.from);var k,w=(0,l.Z)(s);try{for(w.s();!(k=w.n()).done;){k.value.line(this.view,h,o)}}catch(M){w.e(M)}finally{w.f()}}else if(h.widget){var b,x=(0,l.Z)(s);try{for(x.s();!(b=x.n()).done;){b.value.widget(this.view,h)}}catch(M){x.e(M)}finally{x.f()}}}}catch(M){a.e(M)}finally{a.f()}var S,A=(0,l.Z)(s);try{for(A.s();!(S=A.n()).done;){S.value.finish()}}catch(M){A.e(M)}finally{A.f()}t&&this.view.scrollDOM.insertBefore(this.dom,n)}},{key:"updateGutters",value:function(t){var e=t.startState.facet(dr),n=t.state.facet(dr),i=t.docChanged||t.heightChanged||t.viewportChanged||!d.Xs.eq(t.startState.facet(fr),t.state.facet(fr),t.view.viewport.from,t.view.viewport.to);if(e==n){var r,o=(0,l.Z)(this.gutters);try{for(o.s();!(r=o.n()).done;){r.value.update(t)&&(i=!0)}}catch(k){o.e(k)}finally{o.f()}}else{i=!0;var s,a=[],h=(0,l.Z)(n);try{for(h.s();!(s=h.n()).done;){var u=s.value,c=e.indexOf(u);c<0?a.push(new wr(this.view,u)):(this.gutters[c].update(t),a.push(this.gutters[c]))}}catch(k){h.e(k)}finally{h.f()}var f,v=(0,l.Z)(this.gutters);try{for(v.s();!(f=v.n()).done;){var g=f.value;g.dom.remove(),a.indexOf(g)<0&&g.destroy()}}catch(k){v.e(k)}finally{v.f()}for(var p=0,m=a;p<m.length;p++){var y=m[p];this.dom.appendChild(y.dom)}this.gutters=a}return i}},{key:"destroy",value:function(){var t,e=(0,l.Z)(this.gutters);try{for(e.s();!(t=e.n()).done;){t.value.destroy()}}catch(n){e.e(n)}finally{e.f()}this.dom.remove()}}]),t}(),{provide:function(t){return gi.scrollMargins.of((function(e){var n=e.plugin(t);return n&&0!=n.gutters.length&&n.fixed?e.textDirection==Et.LTR?{left:n.dom.offsetWidth*e.scaleX}:{right:n.dom.offsetWidth*e.scaleX}:null}))}});function mr(t){return Array.isArray(t)?t:[t]}function yr(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}var kr=function(){function t(e,n,i){(0,c.Z)(this,t),this.gutter=e,this.height=i,this.i=0,this.cursor=d.Xs.iter(e.markers,n.from)}return(0,f.Z)(t,[{key:"addElement",value:function(t,e,n){var i=this.gutter,r=(e.top-this.height)/t.scaleY,o=e.height/t.scaleY;if(this.i==i.elements.length){var s=new br(t,o,r,n);i.elements.push(s),i.dom.appendChild(s.dom)}else i.elements[this.i].update(t,o,r,n);this.height=e.bottom,this.i++}},{key:"line",value:function(t,e,n){var i=[];yr(this.cursor,i,e.from),n.length&&(i=i.concat(n));var r=this.gutter.config.lineMarker(t,e,i);r&&i.unshift(r);var o=this.gutter;(0!=i.length||o.config.renderEmptyElements)&&this.addElement(t,e,i)}},{key:"widget",value:function(t,e){var n=this.gutter.config.widgetMarker(t,e.widget,e);n&&this.addElement(t,e,[n])}},{key:"finish",value:function(){for(var t=this.gutter;t.elements.length>this.i;){var e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}]),t}(),wr=function(){function t(e,n){var i=this;(0,c.Z)(this,t),this.view=e,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 r=function(t){i.dom.addEventListener(t,(function(r){var o,s=r.target;if(s!=i.dom&&i.dom.contains(s)){for(;s.parentNode!=i.dom;)s=s.parentNode;var a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=r.clientY;var h=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[t](e,h,r)&&r.preventDefault()}))};for(var o in n.domEventHandlers)r(o);this.markers=mr(n.markers(e)),n.initialSpacer&&(this.spacer=new br(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}return(0,f.Z)(t,[{key:"update",value:function(t){var e=this.markers;if(this.markers=mr(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){var n=this.config.updateSpacer(this.spacer.markers[0],t);n!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[n])}var i=t.view.viewport;return!d.Xs.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}},{key:"destroy",value:function(){var t,e=(0,l.Z)(this.elements);try{for(e.s();!(t=e.n()).done;){t.value.destroy()}}catch(n){e.e(n)}finally{e.f()}}}]),t}(),br=function(){function t(e,n,i,r){(0,c.Z)(this,t),this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,i,r)}return(0,f.Z)(t,[{key:"update",value:function(t,e,n,i){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(t,e){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}(this.markers,i)||this.setMarkers(t,i)}},{key:"setMarkers",value:function(t,e){for(var n="cm-gutterElement",i=this.dom.firstChild,r=0,o=0;;){var s=o,a=r<e.length?e[r++]:null,h=!1;if(a){var u=a.elementClass;u&&(n+=" "+u);for(var l=o;l<this.markers.length;l++)if(this.markers[l].compare(a)){s=l,h=!0;break}}else s=this.markers.length;for(;o<s;){var c=this.markers[o++];if(c.toDOM){c.destroy(i);var f=i.nextSibling;i.remove(),i=f}}if(!a)break;a.toDOM&&(h?i=i.nextSibling:this.dom.insertBefore(a.toDOM(t),i)),h&&o++}this.dom.className=n,this.markers=e}},{key:"destroy",value:function(){this.setMarkers(null,[])}}]),t}();var xr=d.r$.define(),Sr=d.r$.define({combine:function(t){return(0,d.BO)(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers:function(t,e){var n=Object.assign({},t),i=function(){var t=n[r],i=e[r];n[r]=t?function(e,n,r){return t(e,n,r)||i(e,n,r)}:i};for(var r in e)i();return n}})}}),Ar=function(t){function e(t){var n;return(0,c.Z)(this,e),(n=(0,a.Z)(this,e)).number=t,n}return(0,h.Z)(e,t),(0,f.Z)(e,[{key:"eq",value:function(t){return this.number==t.number}},{key:"toDOM",value:function(){return document.createTextNode(this.number)}}]),e}(cr);function Mr(t,e){return t.state.facet(Sr).formatNumber(e,t.state)}var Zr=dr.compute([Sr],(function(t){return{class:"cm-lineNumbers",renderEmptyElements:!1,markers:function(t){return t.state.facet(xr)},lineMarker:function(t,e,n){return n.some((function(t){return t.toDOM}))?null:new Ar(Mr(t,t.state.doc.lineAt(e.from).number))},widgetMarker:function(){return null},lineMarkerChange:function(t){return t.startState.facet(Sr)!=t.state.facet(Sr)},initialSpacer:function(t){return new Ar(Mr(t,Or(t.state.doc.lines)))},updateSpacer:function(t,e){var n=Mr(e.view,Or(e.view.state.doc.lines));return n==t.number?t:new Ar(n)},domEventHandlers:t.facet(Sr).domEventHandlers}}));function Cr(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Sr.of(t),gr(),Zr]}function Or(t){for(var e=9;e<t;)e=10*e+9;return e}},35905:function(t,e,n){n.d(e,{pJ:function(){return X}});var i=n(40039),r=n(71650),o=n(33368),s=(n(51467),n(36513),n(56308),n(37313),n(97393),n(85472),n(46798),n(9849),n(90126),n(49089),n(63789),n(65974),n(10185),n(17692),n(45882),n(37724),n(87438),n(22890),n(7507),n(62746)),a=(n(18098),n(22481),n(22859),n(71779),n(85717),n(51358),n(5239),n(39685),n(98490),n(94570),n(99397),n(88770),n(91989),n(24829),n(12397),n(83868),n(75544),n(33435),n(66657),n(53608),n(42313),n(48112),n(87323),n(39588),n(31871),n(87753),n(91843),n(9979),n(34497),n(39912),n(76751),n(44988),n(32369),n(39832),n(83327),n(47475),n(94010),n(64085),n(56399),n(16149),n(39891),n(20459),n(89664),n(92478),n(60731),n(51964),n(93330),n(80628),n(13526),n(64777),n(46349),n(70320),n(96043),n(41353),0),h=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,r.Z)(this,t),this.id=a++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return(0,o.Z)(t,[{key:"add",value:function(t){var e=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=l.match(t)),function(n){var i=t(n);return void 0===i?null:[e,i]}}}]),t}();h.closedBy=new h({deserialize:function(t){return t.split(" ")}}),h.openedBy=new h({deserialize:function(t){return t.split(" ")}}),h.group=new h({deserialize:function(t){return t.split(" ")}}),h.contextHash=new h({perNode:!0}),h.lookAhead=new h({perNode:!0}),h.mounted=new h({perNode:!0});var u=Object.create(null),l=function(){function t(e,n,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;(0,r.Z)(this,t),this.name=e,this.props=n,this.id=i,this.flags=o}return(0,o.Z)(t,[{key:"prop",value:function(t){return this.props[t.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(t){if("string"==typeof t){if(this.name==t)return!0;var e=this.prop(h.group);return!!e&&e.indexOf(t)>-1}return this.id==t}}],[{key:"define",value:function(e){var n=e.props&&e.props.length?Object.create(null):u,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),o=new t(e.name||"",n,e.id,r);if(e.props){var s,a=(0,i.Z)(e.props);try{for(a.s();!(s=a.n()).done;){var h=s.value;if(Array.isArray(h)||(h=h(o)),h){if(h[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[h[0].id]=h[1]}}}catch(l){a.e(l)}finally{a.f()}}return o}},{key:"match",value:function(t){var e=Object.create(null);for(var n in t){var r,o=(0,i.Z)(n.split(" "));try{for(o.s();!(r=o.n()).done;){var s=r.value;e[s]=t[n]}}catch(a){o.e(a)}finally{o.f()}}return function(t){for(var n=t.prop(h.group),i=-1;i<(n?n.length:0);i++){var r=e[i<0?t.name:n[i]];if(r)return r}}}}]),t}();l.none=new l("",Object.create(null),0,8);var c,f=new WeakMap,d=new WeakMap;!function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(c||(c={}));var v=function(){function t(e,n,o,a,h){if((0,r.Z)(this,t),this.type=e,this.children=n,this.positions=o,this.length=a,this.props=null,h&&h.length){this.props=Object.create(null);var u,l=(0,i.Z)(h);try{for(l.s();!(u=l.n()).done;){var c=(0,s.Z)(u.value,2),f=c[0],d=c[1];this.props["number"==typeof f?f:f.id]=d}}catch(v){l.e(v)}finally{l.f()}}}return(0,o.Z)(t,[{key:"toString",value:function(){var t=this.prop(h.mounted);if(t&&!t.overlay)return t.tree.toString();var e,n="",r=(0,i.Z)(this.children);try{for(r.s();!(e=r.n()).done;){var o=e.value.toString();o&&(n&&(n+=","),n+=o)}}catch(s){r.e(s)}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 t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new M(this.topNode,t)}},{key:"cursorAt",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=f.get(this)||this.topNode,i=new M(n);return i.moveTo(t,e),f.set(this,i._tree),i}},{key:"topNode",get:function(){return new w(this,0,0,null)}},{key:"resolve",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=k(f.get(this)||this.topNode,t,e,!1);return f.set(this,n),n}},{key:"resolveInner",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=k(d.get(this)||this.topNode,t,e,!0);return d.set(this,n),n}},{key:"iterate",value:function(t){for(var e=t.enter,n=t.leave,i=t.from,r=void 0===i?0:i,o=t.to,s=void 0===o?this.length:o,a=t.mode||0,h=(a&c.IncludeAnonymous)>0,u=this.cursor(a|c.IncludeAnonymous);;){var l=!1;if(u.from<=s&&u.to>=r&&(!h&&u.type.isAnonymous||!1!==e(u))){if(u.firstChild())continue;l=!0}for(;l&&n&&(h||!u.type.isAnonymous)&&n(u),!u.nextSibling();){if(!u.parent())return;l=!0}}}},{key:"prop",value:function(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}},{key:"propValues",get:function(){var t=[];if(this.props)for(var e in this.props)t.push([+e,this.props[e]]);return t}},{key:"balance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.children.length<=8?this:D(l.none,this.children,this.positions,0,this.children.length,0,this.length,(function(n,i,r){return new t(e.type,n,i,r,e.propValues)}),n.makeTree||function(e,n,i){return new t(l.none,e,n,i)})}}],[{key:"build",value:function(t){return C(t)}}]),t}();v.empty=new v(l.none,[],[],0);var g=function(){function t(e,n){(0,r.Z)(this,t),this.buffer=e,this.index=n}return(0,o.Z)(t,[{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 t(this.buffer,this.index)}}]),t}(),p=function(){function t(e,n,i){(0,r.Z)(this,t),this.buffer=e,this.length=n,this.set=i}return(0,o.Z)(t,[{key:"type",get:function(){return l.none}},{key:"toString",value:function(){for(var t=[],e=0;e<this.buffer.length;)t.push(this.childString(e)),e=this.buffer[e+3];return t.join(",")}},{key:"childString",value:function(t){var e=this.buffer[t],n=this.buffer[t+3],i=this.set.types[e],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),n==(t+=4))return r;for(var o=[];t<n;)o.push(this.childString(t)),t=this.buffer[t+3];return r+"("+o.join(",")+")"}},{key:"findChild",value:function(t,e,n,i,r){for(var o=this.buffer,s=-1,a=t;a!=e&&!(m(r,i,o[a+1],o[a+2])&&(s=a,n>0));a=o[a+3]);return s}},{key:"slice",value:function(e,n,i){for(var r=this.buffer,o=new Uint16Array(n-e),s=0,a=e,h=0;a<n;){o[h++]=r[a++],o[h++]=r[a++]-i;var u=o[h++]=r[a++]-i;o[h++]=r[a++]-e,s=Math.max(s,u)}return new t(o,s,this.set)}}]),t}();function m(t,e,n,i){switch(t){case-2:return n<e;case-1:return i>=e&&n<e;case 0:return n<e&&i>e;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function y(t,e){for(var n=t.childBefore(e);n;){var i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(t=n,n=i.prevSibling):n=i}return t}function k(t,e,n,i){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){var o=!i&&t instanceof w&&t.index<0?null:t.parent;if(!o)return t;t=o}var s=i?0:c.IgnoreOverlays;if(i)for(var a=t,h=a.parent;h;h=(a=h).parent)a instanceof w&&a.index<0&&(null===(r=h.enter(e,n,s))||void 0===r?void 0:r.from)!=a.from&&(t=h);for(;;){var u=t.enter(e,n,s);if(!u)return t;t=u}}var w=function(){function t(e,n,i,o){(0,r.Z)(this,t),this._tree=e,this.from=n,this.index=i,this._parent=o}return(0,o.Z)(t,[{key:"type",get:function(){return this._tree.type}},{key:"name",get:function(){return this._tree.type.name}},{key:"to",get:function(){return this.from+this._tree.length}},{key:"nextChild",value:function(e,n,i,r){for(var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=this;;){for(var a=s._tree,u=a.children,l=a.positions,f=n>0?u.length:-1;e!=f;e+=n){var d=u[e],v=l[e]+s.from;if(m(r,i,v,v+d.length))if(d instanceof p){if(o&c.ExcludeBuffers)continue;var g=d.findChild(0,d.buffer.length,n,i-v,r);if(g>-1)return new A(new S(s,d,e,v),null,g)}else if(o&c.IncludeAnonymous||!d.type.isAnonymous||Z(d)){var y=void 0;if(!(o&c.IgnoreMounts)&&d.props&&(y=d.prop(h.mounted))&&!y.overlay)return new t(y.tree,v,e,s);var k=new t(d,v,e,s);return o&c.IncludeAnonymous||!k.type.isAnonymous?k:k.nextChild(n<0?d.children.length-1:0,n,i,r)}}if(o&c.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+n:n<0?-1:s._parent._tree.children.length,!(s=s._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(t){return this.nextChild(0,1,t,2)}},{key:"childBefore",value:function(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}},{key:"enter",value:function(e,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(o&c.IgnoreOverlays)&&(r=this._tree.prop(h.mounted))&&r.overlay){var s,a=e-this.from,u=(0,i.Z)(r.overlay);try{for(u.s();!(s=u.n()).done;){var l=s.value,f=l.from,d=l.to;if((n>0?f<=a:f<a)&&(n<0?d>=a:d>a))return new t(r.tree,r.overlay[0].from+this.from,-1,this)}}catch(v){u.e(v)}finally{u.f()}}return this.nextChild(0,1,e,n,o)}},{key:"nextSignificantParent",value:function(){for(var t=this;t.type.isAnonymous&&t._parent;)t=t._parent;return t}},{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 M(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(t){return k(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(t){return k(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function(t){return y(this,t)}},{key:"getChild",value:function(t){var e=b(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return e.length?e[0]:null}},{key:"getChildren",value:function(t){return b(this,t,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(t){return x(this,t)}}]),t}();function b(t,e,n,i){var r=t.cursor(),o=[];if(!r.firstChild())return o;if(null!=n)for(;!r.type.is(n);)if(!r.nextSibling())return o;for(;;){if(null!=i&&r.type.is(i))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return null==i?o:[]}}function x(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length-1,i=t.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}var S=(0,o.Z)((function t(e,n,i,o){(0,r.Z)(this,t),this.parent=e,this.buffer=n,this.index=i,this.start=o})),A=function(){function t(e,n,i){(0,r.Z)(this,t),this.context=e,this._parent=n,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}return(0,o.Z)(t,[{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(e,n,i){var r=this.context.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],e,n-this.context.start,i);return o<0?null:new t(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(t){return this.child(1,t,2)}},{key:"childBefore",value:function(t){return this.child(-1,t,-2)}},{key:"enter",value:function(e,n){if((arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)&c.ExcludeBuffers)return null;var i=this.context.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return r<0?null:new t(this.context,this,r)}},{key:"parent",get:function(){return this._parent||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}},{key:"nextSibling",get:function(){var e=this.context.buffer,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new t(this.context,this._parent,n):this.externalSibling(1)}},{key:"prevSibling",get:function(){var e=this.context.buffer,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new t(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}},{key:"cursor",value:function(){return new M(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function(){return null}},{key:"toTree",value:function(){var t=[],e=[],n=this.context.buffer,i=this.index+4,r=n.buffer[this.index+3];if(r>i){var o=n.buffer[this.index+1];t.push(n.slice(i,r,o)),e.push(0)}return new v(this.type,t,e,this.to-this.from)}},{key:"resolve",value:function(t){return k(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(t){return k(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function(t){return y(this,t)}},{key:"toString",value:function(){return this.context.buffer.childString(this.index)}},{key:"getChild",value:function(t){var e=b(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return e.length?e[0]:null}},{key:"getChildren",value:function(t){return b(this,t,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(t){return x(this,t)}}]),t}(),M=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if((0,r.Z)(this,t),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof w)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(var i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}return(0,o.Z)(t,[{key:"name",get:function(){return this.type.name}},{key:"yieldNode",value:function(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}},{key:"yieldBuf",value:function(t,e){this.index=t;var n=this.buffer,i=n.start,r=n.buffer;return this.type=e||r.set.types[r.buffer[t]],this.from=i+r.buffer[t+1],this.to=i+r.buffer[t+2],!0}},{key:"yield",value:function(t){return!!t&&(t instanceof w?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}},{key:"toString",value:function(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}},{key:"enterChild",value:function(t,e,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,n,this.mode));var i=this.buffer.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.buffer.start,n);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}},{key:"firstChild",value:function(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function(t){return this.enterChild(1,t,2)}},{key:"childBefore",value:function(t){return this.enterChild(-1,t,-2)}},{key:"enter",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(n&c.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,n))}},{key:"parent",value:function(){if(!this.buffer)return this.yieldNode(this.mode&c.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&c.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}},{key:"sibling",value:function(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,n=this.stack.length-1;if(t<0){var i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(e.findChild(i,this.index,-1,0,4))}else{var r=e.buffer[this.index+3];if(r<(n<0?e.buffer.length:e.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}},{key:"nextSibling",value:function(){return this.sibling(1)}},{key:"prevSibling",value:function(){return this.sibling(-1)}},{key:"atLastNode",value:function(t){var e,n,i=this.buffer;if(i){if(t>0){if(this.index<i.buffer.buffer.length)return!1}else for(var r=0;r<this.index;r++)if(i.buffer.buffer[r+3]<this.index)return!1;e=i.index,n=i.parent}else{var o=this._tree;e=o.index,n=o._parent}for(;n;e=(s=n).index,n=s._parent,s){var s;if(e>-1)for(var a=e+t,h=t<0?-1:n._tree.children.length;a!=h;a+=t){var u=n._tree.children[a];if(this.mode&c.IncludeAnonymous||u instanceof p||!u.type.isAnonymous||Z(u))return!1}}return!0}},{key:"move",value:function(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(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(1,t)}},{key:"prev",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(-1,t)}},{key:"moveTo",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(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(){if(!this.buffer)return this._tree;var t=this.bufferNode,e=null,n=0;if(t&&t.context==this.buffer)t:for(var i=this.index,r=this.stack.length;r>=0;){for(var o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;e=o,n=r+1;break t}i=this.stack[--r]}for(var s=n;s<this.stack.length;s++)e=new A(this.buffer,e,this.stack[s]);return this.bufferNode=new A(this.buffer,e,this.index)}},{key:"tree",get:function(){return this.buffer?null:this._tree._tree}},{key:"iterate",value:function(t,e){for(var n=0;;){var i=!1;if(this.type.isAnonymous||!1!==t(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;i&&e&&e(this),i=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,i=!0}}}},{key:"matchContext",value:function(t){if(!this.buffer)return x(this.node,t);for(var e=this.buffer.buffer,n=e.set.types,i=t.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return x(this.node,t,i);var o=n[e.buffer[this.stack[r]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}}]),t}();function Z(t){return t.children.some((function(t){return t instanceof p||!t.type.isAnonymous||Z(t)}))}function C(t){var e,n=t.buffer,i=t.nodeSet,r=t.maxBufferLength,o=void 0===r?1024:r,s=t.reused,a=void 0===s?[]:s,u=t.minRepeatType,l=void 0===u?i.types.length:u,c=Array.isArray(n)?new g(n,n.length):n,f=i.types,d=0,m=0;function y(t,e,n,r,s){for(var u=c.id,g=c.start,x=c.end,S=c.size,A=m;S<0;){if(c.next(),-1==S){var M=a[u];return n.push(M),void r.push(g-t)}if(-3==S)return void(d=u);if(-4==S)return void(m=u);throw new RangeError("Unrecognized record size: ".concat(S))}var Z,C,O=f[u],T=g-t;if(x-g<=o&&(C=function(t,e){var n=c.fork(),i=0,r=0,s=0,a=n.end-o,h={size:0,start:0,skip:0};t:for(var u=n.pos-t;n.pos>u;){var f=n.size;if(n.id==e&&f>=0)h.size=i,h.start=r,h.skip=s,s+=4,i+=4,n.next();else{var d=n.pos-f;if(f<0||d<u||n.start<a)break;var v=n.id>=l?4:0,g=n.start;for(n.next();n.pos>d;){if(n.size<0){if(-3!=n.size)break t;v+=4}else n.id>=l&&(v+=4);n.next()}r=g,i+=f,s+=v}}(e<0||i==t)&&(h.size=i,h.start=r,h.skip=s);return h.size>4?h:void 0}(c.pos-e,s))){for(var E=new Uint16Array(C.size-C.skip),B=c.pos-C.size,R=E.length;c.pos>B;)R=b(C.start,E,R);Z=new p(E,x-C.start,i),T=C.start-t}else{var I=c.pos-S;c.next();for(var P=[],N=[],L=u>=l?u:-1,V=0,H=x;c.pos>I;)L>=0&&c.id==L&&c.size>=0?(c.end<=H-o&&(k(P,N,g,V,c.end,H,L,A),V=P.length,H=c.end),c.next()):y(g,I,P,N,L);if(L>=0&&V>0&&V<P.length&&k(P,N,g,V,g,H,L,A),P.reverse(),N.reverse(),L>-1&&V>0){var W=function(t){return function(e,n,i){var r,o,s=0,a=e.length-1;if(a>=0&&(r=e[a])instanceof v){if(!a&&r.type==t&&r.length==i)return r;(o=r.prop(h.lookAhead))&&(s=n[a]+r.length+o)}return w(t,e,n,i,s)}}(O);Z=D(O,P,N,0,P.length,0,x-g,W,W)}else Z=w(O,P,N,x-g,A-x)}n.push(Z),r.push(T)}function k(t,e,n,r,o,s,a,h){for(var u=[],l=[];t.length>r;)u.push(t.pop()),l.push(e.pop()+n-o);t.push(w(i.types[a],u,l,s-o,h-s)),e.push(o-n)}function w(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0;if(d){var s=[h.contextHash,d];o=o?[s].concat(o):[s]}if(r>25){var a=[h.lookAhead,r];o=o?[a].concat(o):[a]}return new v(t,e,n,i,o)}function b(t,e,n){var i=c.id,r=c.start,o=c.end,s=c.size;if(c.next(),s>=0&&i<l){var a=n;if(s>4)for(var h=c.pos-(s-4);c.pos>h;)n=b(t,e,n);e[--n]=a,e[--n]=o-t,e[--n]=r-t,e[--n]=i}else-3==s?d=i:-4==s&&(m=i);return n}for(var x=[],S=[];c.pos>0;)y(t.start||0,t.bufferStart||0,x,S,-1);var A=null!==(e=t.length)&&void 0!==e?e:x.length?S[0]+x[0].length:0;return new v(f[t.topID],x.reverse(),S.reverse(),A)}var O=new WeakMap;function T(t,e){if(!t.isAnonymous||e instanceof p||e.type!=t)return 1;var n=O.get(e);if(null==n){n=1;var r,o=(0,i.Z)(e.children);try{for(o.s();!(r=o.n()).done;){var s=r.value;if(s.type!=t||!(s instanceof v)){n=1;break}n+=T(t,s)}}catch(a){o.e(a)}finally{o.f()}O.set(e,n)}return n}function D(t,e,n,i,r,o,s,a,h){for(var u=0,l=i;l<r;l++)u+=T(t,e[l]);var c=Math.ceil(1.5*u/8),f=[],d=[];return function e(n,i,r,s,a){for(var u=r;u<s;){var l=u,v=i[u],g=T(t,n[u]);for(u++;u<s;u++){var p=T(t,n[u]);if(g+p>=c)break;g+=p}if(u==l+1){if(g>c){var m=n[l];e(m.children,m.positions,0,m.children.length,i[l]+a);continue}f.push(n[l])}else{var y=i[u-1]+n[u-1].length-v;f.push(D(t,n,i,l,u,v,y,null,h))}d.push(v+a-o)}}(e,n,i,r,0),(a||h)(f,d,s)}new h({perNode:!0});var E=0,B=function(){function t(e,n,i){(0,r.Z)(this,t),this.set=e,this.base=n,this.modified=i,this.id=E++}return(0,o.Z)(t,null,[{key:"define",value:function(e){if(null==e?void 0:e.base)throw new Error("Can not derive from a modified tag");var n=new t([],null,[]);if(n.set.push(n),e){var r,o=(0,i.Z)(e.set);try{for(o.s();!(r=o.n()).done;){var s=r.value;n.set.push(s)}}catch(a){o.e(a)}finally{o.f()}}return n}},{key:"defineModifier",value:function(){var t=new I;return function(e){return e.modified.indexOf(t)>-1?e:I.get(e.base||e,e.modified.concat(t).sort((function(t,e){return t.id-e.id})))}}}]),t}(),R=0,I=function(){function t(){(0,r.Z)(this,t),this.instances=[],this.id=R++}return(0,o.Z)(t,null,[{key:"get",value:function(e,n){if(!n.length)return e;var r=n[0].instances.find((function(t){return t.base==e&&(i=n,r=t.modified,i.length==r.length&&i.every((function(t,e){return t==r[e]})));var i,r}));if(r)return r;var o,s=[],a=new B(s,e,n),h=(0,i.Z)(n);try{for(h.s();!(o=h.n()).done;){o.value.instances.push(a)}}catch(p){h.e(p)}finally{h.f()}var u,l=function(t){for(var e=[[]],n=0;n<t.length;n++)for(var i=0,r=e.length;i<r;i++)e.push(e[i].concat(t[n]));return e.sort((function(t,e){return e.length-t.length}))}(n),c=(0,i.Z)(e.set);try{for(c.s();!(u=c.n()).done;){var f=u.value;if(!f.modified.length){var d,v=(0,i.Z)(l);try{for(v.s();!(d=v.n()).done;){var g=d.value;s.push(t.get(f,g))}}catch(p){v.e(p)}finally{v.f()}}}}catch(p){c.e(p)}finally{c.f()}return a}}]),t}();new h;var P=function(){function t(e,n,i,o){(0,r.Z)(this,t),this.tags=e,this.mode=n,this.context=i,this.next=o}return(0,o.Z)(t,[{key:"opaque",get:function(){return 0==this.mode}},{key:"inherit",get:function(){return 1==this.mode}},{key:"sort",value:function(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}},{key:"depth",get:function(){return this.context?this.context.length:0}}]),t}();P.empty=new P([],2,null);var N=B.define,L=N(),V=N(),H=N(V),W=N(V),_=N(),z=N(_),F=N(_),q=N(),j=N(q),K=N(),J=N(),U=N(),G=N(U),$=N(),X={comment:L,lineComment:N(L),blockComment:N(L),docComment:N(L),name:V,variableName:N(V),typeName:H,tagName:N(H),propertyName:W,attributeName:N(W),className:N(V),labelName:N(V),namespace:N(V),macroName:N(V),literal:_,string:z,docString:N(z),character:N(z),attributeValue:N(z),number:F,integer:N(F),float:N(F),bool:N(_),regexp:N(_),escape:N(_),color:N(_),url:N(_),keyword:K,self:N(K),null:N(K),atom:N(K),unit:N(K),modifier:N(K),operatorKeyword:N(K),controlKeyword:N(K),definitionKeyword:N(K),moduleKeyword:N(K),operator:J,derefOperator:N(J),arithmeticOperator:N(J),logicOperator:N(J),bitwiseOperator:N(J),compareOperator:N(J),updateOperator:N(J),definitionOperator:N(J),typeOperator:N(J),controlOperator:N(J),punctuation:U,separator:N(U),bracket:G,angleBracket:N(G),squareBracket:N(G),paren:N(G),brace:N(G),content:q,heading:j,heading1:N(j),heading2:N(j),heading3:N(j),heading4:N(j),heading5:N(j),heading6:N(j),contentSeparator:N(q),list:N(q),quote:N(q),emphasis:N(q),strong:N(q),link:N(q),monospace:N(q),strikethrough:N(q),inserted:N(),deleted:N(),changed:N(),invalid:N(),meta:$,documentMeta:N($),annotation:N($),processingInstruction:N($),definition:B.defineModifier(),constant:B.defineModifier(),function:B.defineModifier(),standard:B.defineModifier(),local:B.defineModifier(),special:B.defineModifier()};!function(t,e){var n,r=Object.create(null),o=(0,i.Z)(t);try{for(o.s();!(n=o.n()).done;){var s=n.value;if(Array.isArray(s.tag)){var a,h=(0,i.Z)(s.tag);try{for(h.s();!(a=h.n()).done;){var u=a.value;r[u.id]=s.class}}catch(v){h.e(v)}finally{h.f()}}else r[s.tag.id]=s.class}}catch(v){o.e(v)}finally{o.f()}var l=e||{},c=l.scope,f=l.all,d=void 0===f?null:f}([{tag:X.link,class:"tok-link"},{tag:X.heading,class:"tok-heading"},{tag:X.emphasis,class:"tok-emphasis"},{tag:X.strong,class:"tok-strong"},{tag:X.keyword,class:"tok-keyword"},{tag:X.atom,class:"tok-atom"},{tag:X.bool,class:"tok-bool"},{tag:X.url,class:"tok-url"},{tag:X.labelName,class:"tok-labelName"},{tag:X.inserted,class:"tok-inserted"},{tag:X.deleted,class:"tok-deleted"},{tag:X.literal,class:"tok-literal"},{tag:X.string,class:"tok-string"},{tag:X.number,class:"tok-number"},{tag:[X.regexp,X.escape,X.special(X.string)],class:"tok-string2"},{tag:X.variableName,class:"tok-variableName"},{tag:X.local(X.variableName),class:"tok-variableName tok-local"},{tag:X.definition(X.variableName),class:"tok-variableName tok-definition"},{tag:X.special(X.variableName),class:"tok-variableName2"},{tag:X.definition(X.propertyName),class:"tok-propertyName tok-definition"},{tag:X.typeName,class:"tok-typeName"},{tag:X.namespace,class:"tok-namespace"},{tag:X.className,class:"tok-className"},{tag:X.macroName,class:"tok-macroName"},{tag:X.propertyName,class:"tok-propertyName"},{tag:X.operator,class:"tok-operator"},{tag:X.comment,class:"tok-comment"},{tag:X.meta,class:"tok-meta"},{tag:X.invalid,class:"tok-invalid"},{tag:X.punctuation,class:"tok-punctuation"}])},28450:function(t,e,n){n.d(e,{V:function(){return l}});var i=n(46097),r=n(76775),o=n(71650),s=n(33368),a=(n(94738),n(98214),n(46798),n(89802),n(63789),n(99397),n(57778),n(36513),n(34997),n(9849),n(12148),n(46349),n(70320),n(24074),n(97393),n(51467),n(91989),n(94570),n(51358),n(96043),n(5239),n(98490),n(56308),n(41353),"undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ")),h="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{},l=function(){function t(e,n){(0,o.Z)(this,t),this.rules=[];var i=(n||{}).finish;function s(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function a(t,e,n,o){var h=[],u=/^@(\w+)\b/.exec(t[0]),l=u&&"keyframes"==u[1];if(u&&null==e)return n.push(t[0]+";");for(var c in e){var f=e[c];if(/&/.test(c))a(c.split(/,\s*/).map((function(e){return t.map((function(t){return e.replace(/&/,t)}))})).reduce((function(t,e){return t.concat(e)})),f,n);else if(f&&"object"==(0,r.Z)(f)){if(!u)throw new RangeError("The value of a property ("+c+") should be a primitive value.");a(s(c),f,h,l)}else null!=f&&h.push(c.replace(/_.*/,"").replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}))+": "+f+";")}(h.length||l)&&n.push((!i||u||o?t:t.map(i)).join(", ")+" {"+h.join(" ")+"}")}for(var h in e)a(s(h),e[h],this.rules)}return(0,s.Z)(t,[{key:"getRules",value:function(){return this.rules.join("\n")}}],[{key:"newName",value:function(){var t=u[a]||1;return u[a]=t+1,"ͼ"+t.toString(36)}},{key:"mount",value:function(t,e){(t[h]||new f(t)).mount(Array.isArray(e)?e:[e])}}]),t}(),c=new Map,f=function(){function t(e){(0,o.Z)(this,t);var n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){var s=c.get(n);if(s)return e.adoptedStyleSheets=[s.sheet].concat((0,i.Z)(e.adoptedStyleSheets)),e[h]=s;this.sheet=new r.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet].concat((0,i.Z)(e.adoptedStyleSheets)),c.set(n,this)}else{this.styleTag=n.createElement("style");var a=e.head||e;a.insertBefore(this.styleTag,a.firstChild)}this.modules=[],e[h]=this}return(0,s.Z)(t,[{key:"mount",value:function(t){for(var e=this.sheet,n=0,i=0,r=0;r<t.length;r++){var o=t[r],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),i--,s=-1),-1==s){if(this.modules.splice(i++,0,o),e)for(var a=0;a<o.rules.length;a++)e.insertRule(o.rules[a],n++)}else{for(;i<s;)n+=this.modules[i++].rules.length;n+=o.rules.length,i++}}if(!e){for(var h="",u=0;u<this.modules.length;u++)h+=this.modules[u].getRules()+"\n";this.styleTag.textContent=h}}}]),t}()},29350:function(t,e,n){n.d(e,{YG:function(){return u},uY:function(){return r},ue:function(){return i}});n(63789),n(99397);for(var i={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},r={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},o="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),s="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),a=0;a<10;a++)i[48+a]=i[96+a]=String(a);for(a=1;a<=24;a++)i[a+111]="F"+a;for(a=65;a<=90;a++)i[a]=String.fromCharCode(a+32),r[a]=String.fromCharCode(a);for(var h in i)r.hasOwnProperty(h)||(r[h]=i[h]);function u(t){var e=!(o&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||s&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?r:i)[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}}}]);
//# sourceMappingURL=2562.Ciqv7fC2yh4.js.map