84 lines
836 KiB
JavaScript
84 lines
836 KiB
JavaScript
var Yn=Object.defineProperty;var Dn=(s,e,r)=>e in s?Yn(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var z=(s,e,r)=>(Dn(s,typeof e!="symbol"?e+"":e,r),r),zr=(s,e,r)=>{if(!e.has(s))throw TypeError("Cannot "+r)};var N=(s,e,r)=>(zr(s,e,"read from private field"),r?r.call(s):e.get(s)),rt=(s,e,r)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,r)},Ue=(s,e,r,n)=>(zr(s,e,"write to private field"),n?n.call(s,r):e.set(s,r),r);var xr=(s,e,r,n)=>({set _(o){Ue(s,e,o,r)},get _(){return N(s,e,n)}}),_e=(s,e,r)=>(zr(s,e,"access private method"),r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&n(l)}).observe(document,{childList:!0,subtree:!0});function r(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(o){if(o.ep)return;o.ep=!0;const a=r(o);fetch(o.href,a)}})();const output="",style="";class Text{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,r,n){let o=[];return this.decompose(0,e,o,2),n.length&&n.decompose(0,n.length,o,3),this.decompose(r,this.length,o,1),TextNode.from(o,this.length-(r-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,r=this.length){let n=[];return this.decompose(e,r,n,0),TextNode.from(n,r-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let r=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),o=new RawTextCursor(this),a=new RawTextCursor(e);for(let l=r,c=r;;){if(o.next(l),a.next(l),l=0,o.lineBreak!=a.lineBreak||o.done!=a.done||o.value!=a.value)return!1;if(c+=o.value.length,o.done||c>=n)return!0}}iter(e=1){return new RawTextCursor(this,e)}iterRange(e,r=this.length){return new PartialTextCursor(this,e,r)}iterLines(e,r){let n;if(e==null)n=this.iter();else{r==null&&(r=this.lines+1);let o=this.line(e).from;n=this.iterRange(o,Math.max(o,r==this.lines+1?this.length:r<=1?0:this.line(r-1).to))}return new LineCursor(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Text.empty:e.length<=32?new TextLeaf(e):TextNode.from(TextLeaf.split(e,[]))}}class TextLeaf extends Text{constructor(e,r=textLength(e)){super(),this.text=e,this.length=r}get lines(){return this.text.length}get children(){return null}lineInner(e,r,n,o){for(let a=0;;a++){let l=this.text[a],c=o+l.length;if((r?n:c)>=e)return new Line$1(o,c,n,l);o=c+1,n++}}decompose(e,r,n,o){let a=e<=0&&r>=this.length?this:new TextLeaf(sliceText(this.text,e,r),Math.min(r,this.length)-Math.max(0,e));if(o&1){let l=n.pop(),c=appendText(a.text,l.text.slice(),0,a.length);if(c.length<=32)n.push(new TextLeaf(c,l.length+a.length));else{let h=c.length>>1;n.push(new TextLeaf(c.slice(0,h)),new TextLeaf(c.slice(h)))}}else n.push(a)}replace(e,r,n){if(!(n instanceof TextLeaf))return super.replace(e,r,n);let o=appendText(this.text,appendText(n.text,sliceText(this.text,0,e)),r),a=this.length+n.length-(r-e);return o.length<=32?new TextLeaf(o,a):TextNode.from(TextLeaf.split(o,[]),a)}sliceString(e,r=this.length,n=`
|
||
`){let o="";for(let a=0,l=0;a<=r&&l<this.text.length;l++){let c=this.text[l],h=a+c.length;a>e&&l&&(o+=n),e<h&&r>a&&(o+=c.slice(Math.max(0,e-a),r-a)),a=h+1}return o}flatten(e){for(let r of this.text)e.push(r)}scanIdentical(){return 0}static split(e,r){let n=[],o=-1;for(let a of e)n.push(a),o+=a.length+1,n.length==32&&(r.push(new TextLeaf(n,o)),n=[],o=-1);return o>-1&&r.push(new TextLeaf(n,o)),r}}class TextNode extends Text{constructor(e,r){super(),this.children=e,this.length=r,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,r,n,o){for(let a=0;;a++){let l=this.children[a],c=o+l.length,h=n+l.lines-1;if((r?h:c)>=e)return l.lineInner(e,r,n,o);o=c+1,n=h+1}}decompose(e,r,n,o){for(let a=0,l=0;l<=r&&a<this.children.length;a++){let c=this.children[a],h=l+c.length;if(e<=h&&r>=l){let f=o&((l<=e?1:0)|(h>=r?2:0));l>=e&&h<=r&&!f?n.push(c):c.decompose(e-l,r-l,n,f)}l=h+1}}replace(e,r,n){if(n.lines<this.lines)for(let o=0,a=0;o<this.children.length;o++){let l=this.children[o],c=a+l.length;if(e>=a&&r<=c){let h=l.replace(e-a,r-a,n),f=this.lines-l.lines+h.lines;if(h.lines<f>>5-1&&h.lines>f>>5+1){let d=this.children.slice();return d[o]=h,new TextNode(d,this.length-(r-e)+n.length)}return super.replace(a,c,h)}a=c+1}return super.replace(e,r,n)}sliceString(e,r=this.length,n=`
|
||
`){let o="";for(let a=0,l=0;a<this.children.length&&l<=r;a++){let c=this.children[a],h=l+c.length;l>e&&a&&(o+=n),e<h&&r>l&&(o+=c.sliceString(e-l,r-l,n)),l=h+1}return o}flatten(e){for(let r of this.children)r.flatten(e)}scanIdentical(e,r){if(!(e instanceof TextNode))return 0;let n=0,[o,a,l,c]=r>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;o+=r,a+=r){if(o==l||a==c)return n;let h=this.children[o],f=e.children[a];if(h!=f)return n+h.scanIdentical(f,r);n+=h.length+1}}static from(e,r=e.reduce((n,o)=>n+o.length+1,-1)){let n=0;for(let A of e)n+=A.lines;if(n<32){let A=[];for(let T of e)T.flatten(A);return new TextLeaf(A,r)}let o=Math.max(32,n>>5),a=o<<1,l=o>>1,c=[],h=0,f=-1,d=[];function m(A){let T;if(A.lines>a&&A instanceof TextNode)for(let B of A.children)m(B);else A.lines>l&&(h>l||!h)?(v(),c.push(A)):A instanceof TextLeaf&&h&&(T=d[d.length-1])instanceof TextLeaf&&A.lines+T.lines<=32?(h+=A.lines,f+=A.length+1,d[d.length-1]=new TextLeaf(T.text.concat(A.text),T.length+1+A.length)):(h+A.lines>o&&v(),h+=A.lines,f+=A.length+1,d.push(A))}function v(){h!=0&&(c.push(d.length==1?d[0]:TextNode.from(d,f)),f=-1,h=d.length=0)}for(let A of e)m(A);return v(),c.length==1?c[0]:new TextNode(c,r)}}Text.empty=new TextLeaf([""],0);function textLength(s){let e=-1;for(let r of s)e+=r.length+1;return e}function appendText(s,e,r=0,n=1e9){for(let o=0,a=0,l=!0;a<s.length&&o<=n;a++){let c=s[a],h=o+c.length;h>=r&&(h>n&&(c=c.slice(0,n-o)),o<r&&(c=c.slice(r-o)),l?(e[e.length-1]+=c,l=!1):e.push(c)),o=h+1}return e}function sliceText(s,e,r){return appendText(s,[""],e,r)}class RawTextCursor{constructor(e,r=1){this.dir=r,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[r>0?1:(e instanceof TextLeaf?e.text.length:e.children.length)<<1]}nextInner(e,r){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,o=this.nodes[n],a=this.offsets[n],l=a>>1,c=o instanceof TextLeaf?o.text.length:o.children.length;if(l==(r>0?c:0)){if(n==0)return this.done=!0,this.value="",this;r>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(r>0?0:1)){if(this.offsets[n]+=r,e==0)return this.lineBreak=!0,this.value=`
|
||
`,this;e--}else if(o instanceof TextLeaf){let h=o.text[l+(r<0?-1:0)];if(this.offsets[n]+=r,h.length>Math.max(0,e))return this.value=e==0?h:r>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=o.children[l+(r<0?-1:0)];e>h.length?(e-=h.length,this.offsets[n]+=r):(r<0&&this.offsets[n]--,this.nodes.push(h),this.offsets.push(r>0?1:(h instanceof TextLeaf?h.text.length:h.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class PartialTextCursor{constructor(e,r,n){this.value="",this.done=!1,this.cursor=new RawTextCursor(e,r>n?-1:1),this.pos=r>n?e.length:0,this.from=Math.min(r,n),this.to=Math.max(r,n)}nextInner(e,r){if(r<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,r<0?this.pos-this.to:this.from-this.pos);let n=r<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:o}=this.cursor.next(e);return this.pos+=(o.length+e)*r,this.value=o.length<=n?o:r<0?o.slice(o.length-n):o.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class LineCursor{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:r,lineBreak:n,value:o}=this.inner.next(e);return r?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=o,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Text.prototype[Symbol.iterator]=function(){return this.iter()},RawTextCursor.prototype[Symbol.iterator]=PartialTextCursor.prototype[Symbol.iterator]=LineCursor.prototype[Symbol.iterator]=function(){return this});let Line$1=class{constructor(e,r,n,o){this.from=e,this.to=r,this.number=n,this.text=o}get length(){return this.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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(s=>s?parseInt(s,36):1);for(let s=1;s<extend.length;s++)extend[s]+=extend[s-1];function isExtendingChar(s){for(let e=1;e<extend.length;e+=2)if(extend[e]>s)return extend[e-1]<=s;return!1}function isRegionalIndicator(s){return s>=127462&&s<=127487}const ZWJ=8205;function findClusterBreak(s,e,r=!0,n=!0){return(r?nextClusterBreak:prevClusterBreak)(s,e,n)}function nextClusterBreak(s,e,r){if(e==s.length)return e;e&&surrogateLow(s.charCodeAt(e))&&surrogateHigh(s.charCodeAt(e-1))&&e--;let n=codePointAt(s,e);for(e+=codePointSize(n);e<s.length;){let o=codePointAt(s,e);if(n==ZWJ||o==ZWJ||r&&isExtendingChar(o))e+=codePointSize(o),n=o;else if(isRegionalIndicator(o)){let a=0,l=e-2;for(;l>=0&&isRegionalIndicator(codePointAt(s,l));)a++,l-=2;if(a%2==0)break;e+=2}else break}return e}function prevClusterBreak(s,e,r){for(;e>0;){let n=nextClusterBreak(s,e-2,r);if(n<e)return n;e--}return 0}function surrogateLow(s){return s>=56320&&s<57344}function surrogateHigh(s){return s>=55296&&s<56320}function codePointAt(s,e){let r=s.charCodeAt(e);if(!surrogateHigh(r)||e+1==s.length)return r;let n=s.charCodeAt(e+1);return surrogateLow(n)?(r-55296<<10)+(n-56320)+65536:r}function fromCodePoint(s){return s<=65535?String.fromCharCode(s):(s-=65536,String.fromCharCode((s>>10)+55296,(s&1023)+56320))}function codePointSize(s){return s<65536?1:2}const DefaultSplit=/\r\n?|\n/;var MapMode=function(s){return s[s.Simple=0]="Simple",s[s.TrackDel=1]="TrackDel",s[s.TrackBefore=2]="TrackBefore",s[s.TrackAfter=3]="TrackAfter",s}(MapMode||(MapMode={}));class ChangeDesc{constructor(e){this.sections=e}get length(){let e=0;for(let r=0;r<this.sections.length;r+=2)e+=this.sections[r];return e}get newLength(){let e=0;for(let r=0;r<this.sections.length;r+=2){let n=this.sections[r+1];e+=n<0?this.sections[r]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let r=0,n=0,o=0;r<this.sections.length;){let a=this.sections[r++],l=this.sections[r++];l<0?(e(n,o,a),o+=a):o+=l,n+=a}}iterChangedRanges(e,r=!1){iterChanges(this,e,r)}get invertedDesc(){let e=[];for(let r=0;r<this.sections.length;){let n=this.sections[r++],o=this.sections[r++];o<0?e.push(n,o):e.push(o,n)}return new ChangeDesc(e)}composeDesc(e){return this.empty?e:e.empty?this:composeSets(this,e)}mapDesc(e,r=!1){return e.empty?this:mapSet(this,e,r)}mapPos(e,r=-1,n=MapMode.Simple){let o=0,a=0;for(let l=0;l<this.sections.length;){let c=this.sections[l++],h=this.sections[l++],f=o+c;if(h<0){if(f>e)return a+(e-o);a+=c}else{if(n!=MapMode.Simple&&f>=e&&(n==MapMode.TrackDel&&o<e&&f>e||n==MapMode.TrackBefore&&o<e||n==MapMode.TrackAfter&&f>e))return null;if(f>e||f==e&&r<0&&!c)return e==o||r<0?a:a+h;a+=h}o=f}if(e>o)throw new RangeError(`Position ${e} is out of range for changeset of length ${o}`);return a}touchesRange(e,r=e){for(let n=0,o=0;n<this.sections.length&&o<=r;){let a=this.sections[n++],l=this.sections[n++],c=o+a;if(l>=0&&o<=r&&c>=e)return o<e&&c>r?"cover":!0;o=c}return!1}toString(){let e="";for(let r=0;r<this.sections.length;){let n=this.sections[r++],o=this.sections[r++];e+=(e?" ":"")+n+(o>=0?":"+o:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(r=>typeof r!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ChangeDesc(e)}static create(e){return new ChangeDesc(e)}}class ChangeSet extends ChangeDesc{constructor(e,r){super(e),this.inserted=r}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return iterChanges(this,(r,n,o,a,l)=>e=e.replace(o,o+(n-r),l),!1),e}mapDesc(e,r=!1){return mapSet(this,e,r,!0)}invert(e){let r=this.sections.slice(),n=[];for(let o=0,a=0;o<r.length;o+=2){let l=r[o],c=r[o+1];if(c>=0){r[o]=c,r[o+1]=l;let h=o>>1;for(;n.length<h;)n.push(Text.empty);n.push(l?e.slice(a,a+l):Text.empty)}a+=l}return new ChangeSet(r,n)}compose(e){return this.empty?e:e.empty?this:composeSets(this,e,!0)}map(e,r=!1){return e.empty?this:mapSet(this,e,r,!0)}iterChanges(e,r=!1){iterChanges(this,e,r)}get desc(){return ChangeDesc.create(this.sections)}filter(e){let r=[],n=[],o=[],a=new SectionIter(this);e:for(let l=0,c=0;;){let h=l==e.length?1e9:e[l++];for(;c<h||c==h&&a.len==0;){if(a.done)break e;let d=Math.min(a.len,h-c);addSection(o,d,-1);let m=a.ins==-1?-1:a.off==0?a.ins:0;addSection(r,d,m),m>0&&addInsert(n,r,a.text),a.forward(d),c+=d}let f=e[l++];for(;c<f;){if(a.done)break e;let d=Math.min(a.len,f-c);addSection(r,d,-1),addSection(o,d,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(d),c+=d}}return{changes:new ChangeSet(r,n),filtered:ChangeDesc.create(o)}}toJSON(){let e=[];for(let r=0;r<this.sections.length;r+=2){let n=this.sections[r],o=this.sections[r+1];o<0?e.push(n):o==0?e.push([n]):e.push([n].concat(this.inserted[r>>1].toJSON()))}return e}static of(e,r,n){let o=[],a=[],l=0,c=null;function h(d=!1){if(!d&&!o.length)return;l<r&&addSection(o,r-l,-1);let m=new ChangeSet(o,a);c=c?c.compose(m.map(c)):m,o=[],a=[],l=0}function f(d){if(Array.isArray(d))for(let m of d)f(m);else if(d instanceof ChangeSet){if(d.length!=r)throw new RangeError(`Mismatched change set length (got ${d.length}, expected ${r})`);h(),c=c?c.compose(d.map(c)):d}else{let{from:m,to:v=m,insert:A}=d;if(m>v||m<0||v>r)throw new RangeError(`Invalid change range ${m} to ${v} (in doc of length ${r})`);let T=A?typeof A=="string"?Text.of(A.split(n||DefaultSplit)):A:Text.empty,B=T.length;if(m==v&&B==0)return;m<l&&h(),m>l&&addSection(o,m-l,-1),addSection(o,v-m,B),addInsert(a,o,T),l=v}}return f(e),h(!c),c}static empty(e){return new ChangeSet(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let r=[],n=[];for(let o=0;o<e.length;o++){let a=e[o];if(typeof a=="number")r.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((l,c)=>c&&typeof l!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)r.push(a[0],0);else{for(;n.length<o;)n.push(Text.empty);n[o]=Text.of(a.slice(1)),r.push(a[0],n[o].length)}}}return new ChangeSet(r,n)}static createSet(e,r){return new ChangeSet(e,r)}}function addSection(s,e,r,n=!1){if(e==0&&r<=0)return;let o=s.length-2;o>=0&&r<=0&&r==s[o+1]?s[o]+=e:e==0&&s[o]==0?s[o+1]+=r:n?(s[o]+=e,s[o+1]+=r):s.push(e,r)}function addInsert(s,e,r){if(r.length==0)return;let n=e.length-2>>1;if(n<s.length)s[s.length-1]=s[s.length-1].append(r);else{for(;s.length<n;)s.push(Text.empty);s.push(r)}}function iterChanges(s,e,r){let n=s.inserted;for(let o=0,a=0,l=0;l<s.sections.length;){let c=s.sections[l++],h=s.sections[l++];if(h<0)o+=c,a+=c;else{let f=o,d=a,m=Text.empty;for(;f+=c,d+=h,h&&n&&(m=m.append(n[l-2>>1])),!(r||l==s.sections.length||s.sections[l+1]<0);)c=s.sections[l++],h=s.sections[l++];e(o,f,a,d,m),o=f,a=d}}}function mapSet(s,e,r,n=!1){let o=[],a=n?[]:null,l=new SectionIter(s),c=new SectionIter(e);for(let h=-1;;)if(l.ins==-1&&c.ins==-1){let f=Math.min(l.len,c.len);addSection(o,f,-1),l.forward(f),c.forward(f)}else if(c.ins>=0&&(l.ins<0||h==l.i||l.off==0&&(c.len<l.len||c.len==l.len&&!r))){let f=c.len;for(addSection(o,c.ins,-1);f;){let d=Math.min(l.len,f);l.ins>=0&&h<l.i&&l.len<=d&&(addSection(o,0,l.ins),a&&addInsert(a,o,l.text),h=l.i),l.forward(d),f-=d}c.next()}else if(l.ins>=0){let f=0,d=l.len;for(;d;)if(c.ins==-1){let m=Math.min(d,c.len);f+=m,d-=m,c.forward(m)}else if(c.ins==0&&c.len<d)d-=c.len,c.next();else break;addSection(o,f,h<l.i?l.ins:0),a&&h<l.i&&addInsert(a,o,l.text),h=l.i,l.forward(l.len-d)}else{if(l.done&&c.done)return a?ChangeSet.createSet(o,a):ChangeDesc.create(o);throw new Error("Mismatched change set lengths")}}function composeSets(s,e,r=!1){let n=[],o=r?[]:null,a=new SectionIter(s),l=new SectionIter(e);for(let c=!1;;){if(a.done&&l.done)return o?ChangeSet.createSet(n,o):ChangeDesc.create(n);if(a.ins==0)addSection(n,a.len,0,c),a.next();else if(l.len==0&&!l.done)addSection(n,0,l.ins,c),o&&addInsert(o,n,l.text),l.next();else{if(a.done||l.done)throw new Error("Mismatched change set lengths");{let h=Math.min(a.len2,l.len),f=n.length;if(a.ins==-1){let d=l.ins==-1?-1:l.off?0:l.ins;addSection(n,h,d,c),o&&d&&addInsert(o,n,l.text)}else l.ins==-1?(addSection(n,a.off?0:a.len,h,c),o&&addInsert(o,n,a.textBit(h))):(addSection(n,a.off?0:a.len,l.off?0:l.ins,c),o&&!l.off&&addInsert(o,n,l.text));c=(a.ins>h||l.ins>=0&&l.len>h)&&(c||n.length>f),a.forward2(h),l.forward(h)}}}}class SectionIter{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,r=this.i-2>>1;return r>=e.length?Text.empty:e[r]}textBit(e){let{inserted:r}=this.set,n=this.i-2>>1;return n>=r.length&&!e?Text.empty:r[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class SelectionRange{constructor(e,r,n){this.from=e,this.to=r,this.flags=n}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,r=-1){let n,o;return this.empty?n=o=e.mapPos(this.from,r):(n=e.mapPos(this.from,1),o=e.mapPos(this.to,-1)),n==this.from&&o==this.to?this:new SelectionRange(n,o,this.flags)}extend(e,r=e){if(e<=this.anchor&&r>=this.anchor)return EditorSelection.range(e,r);let n=Math.abs(e-this.anchor)>Math.abs(r-this.anchor)?e:r;return EditorSelection.range(this.anchor,n)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return EditorSelection.range(e.anchor,e.head)}static create(e,r,n){return new SelectionRange(e,r,n)}}class EditorSelection{constructor(e,r){this.ranges=e,this.mainIndex=r}map(e,r=-1){return e.empty?this:EditorSelection.create(this.ranges.map(n=>n.map(e,r)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new EditorSelection([this.main],0)}addRange(e,r=!0){return EditorSelection.create([e].concat(this.ranges),r?0:this.mainIndex+1)}replaceRange(e,r=this.mainIndex){let n=this.ranges.slice();return n[r]=e,EditorSelection.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new EditorSelection(e.ranges.map(r=>SelectionRange.fromJSON(r)),e.main)}static single(e,r=e){return new EditorSelection([EditorSelection.range(e,r)],0)}static create(e,r=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,o=0;o<e.length;o++){let a=e[o];if(a.empty?a.from<=n:a.from<n)return EditorSelection.normalized(e.slice(),r);n=a.to}return new EditorSelection(e,r)}static cursor(e,r=0,n,o){return SelectionRange.create(e,e,(r==0?0:r<0?4:8)|(n==null?3:Math.min(2,n))|(o??33554431)<<5)}static range(e,r,n,o){let a=(n??33554431)<<5|(o==null?3:Math.min(2,o));return r<e?SelectionRange.create(r,e,24|a):SelectionRange.create(e,r,(r>e?4:0)|a)}static normalized(e,r=0){let n=e[r];e.sort((o,a)=>o.from-a.from),r=e.indexOf(n);for(let o=1;o<e.length;o++){let a=e[o],l=e[o-1];if(a.empty?a.from<=l.to:a.from<l.to){let c=l.from,h=Math.max(a.to,l.to);o<=r&&r--,e.splice(--o,2,a.anchor>a.head?EditorSelection.range(h,c):EditorSelection.range(c,h))}}return new EditorSelection(e,r)}}function checkSelection(s,e){for(let r of s.ranges)if(r.to>e)throw new RangeError("Selection points outside of document")}let nextID=0;class Facet{constructor(e,r,n,o,a){this.combine=e,this.compareInput=r,this.compare=n,this.isStatic=o,this.id=nextID++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}static define(e={}){return new Facet(e.combine||(r=>r),e.compareInput||((r,n)=>r===n),e.compare||(e.combine?(r,n)=>r===n:sameArray$1),!!e.static,e.enables)}of(e){return new FacetProvider([],this,0,e)}compute(e,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new FacetProvider(e,this,1,r)}computeN(e,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new FacetProvider(e,this,2,r)}from(e,r){return r||(r=n=>n),this.compute([e],n=>r(n.field(e)))}}function sameArray$1(s,e){return s==e||s.length==e.length&&s.every((r,n)=>r===e[n])}class FacetProvider{constructor(e,r,n,o){this.dependencies=e,this.facet=r,this.type=n,this.value=o,this.id=nextID++}dynamicSlot(e){var r;let n=this.value,o=this.facet.compareInput,a=this.id,l=e[a]>>1,c=this.type==2,h=!1,f=!1,d=[];for(let m of this.dependencies)m=="doc"?h=!0:m=="selection"?f=!0:((r=e[m.id])!==null&&r!==void 0?r:1)&1||d.push(e[m.id]);return{create(m){return m.values[l]=n(m),1},update(m,v){if(h&&v.docChanged||f&&(v.docChanged||v.selection)||ensureAll(m,d)){let A=n(m);if(c?!compareArray(A,m.values[l],o):!o(A,m.values[l]))return m.values[l]=A,1}return 0},reconfigure:(m,v)=>{let A,T=v.config.address[a];if(T!=null){let B=getAddr(v,T);if(this.dependencies.every(Y=>Y instanceof Facet?v.facet(Y)===m.facet(Y):Y instanceof StateField?v.field(Y,!1)==m.field(Y,!1):!0)||(c?compareArray(A=n(m),B,o):o(A=n(m),B)))return m.values[l]=B,0}else A=n(m);return m.values[l]=A,1}}}}function compareArray(s,e,r){if(s.length!=e.length)return!1;for(let n=0;n<s.length;n++)if(!r(s[n],e[n]))return!1;return!0}function ensureAll(s,e){let r=!1;for(let n of e)ensureAddr(s,n)&1&&(r=!0);return r}function dynamicFacetSlot(s,e,r){let n=r.map(h=>s[h.id]),o=r.map(h=>h.type),a=n.filter(h=>!(h&1)),l=s[e.id]>>1;function c(h){let f=[];for(let d=0;d<n.length;d++){let m=getAddr(h,n[d]);if(o[d]==2)for(let v of m)f.push(v);else f.push(m)}return e.combine(f)}return{create(h){for(let f of n)ensureAddr(h,f);return h.values[l]=c(h),1},update(h,f){if(!ensureAll(h,a))return 0;let d=c(h);return e.compare(d,h.values[l])?0:(h.values[l]=d,1)},reconfigure(h,f){let d=ensureAll(h,n),m=f.config.facets[e.id],v=f.facet(e);if(m&&!d&&sameArray$1(r,m))return h.values[l]=v,0;let A=c(h);return e.compare(A,v)?(h.values[l]=v,0):(h.values[l]=A,1)}}}const initField=Facet.define({static:!0});class StateField{constructor(e,r,n,o,a){this.id=e,this.createF=r,this.updateF=n,this.compareF=o,this.spec=a,this.provides=void 0}static define(e){let r=new StateField(nextID++,e.create,e.update,e.compare||((n,o)=>n===o),e);return e.provide&&(r.provides=e.provide(r)),r}create(e){let r=e.facet(initField).find(n=>n.field==this);return((r==null?void 0:r.create)||this.createF)(e)}slot(e){let r=e[this.id]>>1;return{create:n=>(n.values[r]=this.create(n),1),update:(n,o)=>{let a=n.values[r],l=this.updateF(a,o);return this.compareF(a,l)?0:(n.values[r]=l,1)},reconfigure:(n,o)=>o.config.address[this.id]!=null?(n.values[r]=o.field(this),0):(n.values[r]=this.create(n),1)}}init(e){return[this,initField.of({field:this,create:e})]}get extension(){return this}}const Prec_={lowest:4,low:3,default:2,high:1,highest:0};function prec(s){return e=>new PrecExtension(e,s)}const Prec={highest:prec(Prec_.highest),high:prec(Prec_.high),default:prec(Prec_.default),low:prec(Prec_.low),lowest:prec(Prec_.lowest)};class PrecExtension{constructor(e,r){this.inner=e,this.prec=r}}class Compartment{of(e){return new CompartmentInstance(this,e)}reconfigure(e){return Compartment.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class CompartmentInstance{constructor(e,r){this.compartment=e,this.inner=r}}class Configuration{constructor(e,r,n,o,a,l){for(this.base=e,this.compartments=r,this.dynamicSlots=n,this.address=o,this.staticValues=a,this.facets=l,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let r=this.address[e.id];return r==null?e.default:this.staticValues[r>>1]}static resolve(e,r,n){let o=[],a=Object.create(null),l=new Map;for(let v of flatten(e,r,l))v instanceof StateField?o.push(v):(a[v.facet.id]||(a[v.facet.id]=[])).push(v);let c=Object.create(null),h=[],f=[];for(let v of o)c[v.id]=f.length<<1,f.push(A=>v.slot(A));let d=n==null?void 0:n.config.facets;for(let v in a){let A=a[v],T=A[0].facet,B=d&&d[v]||[];if(A.every(Y=>Y.type==0))if(c[T.id]=h.length<<1|1,sameArray$1(B,A))h.push(n.facet(T));else{let Y=T.combine(A.map(F=>F.value));h.push(n&&T.compare(Y,n.facet(T))?n.facet(T):Y)}else{for(let Y of A)Y.type==0?(c[Y.id]=h.length<<1|1,h.push(Y.value)):(c[Y.id]=f.length<<1,f.push(F=>Y.dynamicSlot(F)));c[T.id]=f.length<<1,f.push(Y=>dynamicFacetSlot(Y,T,A))}}let m=f.map(v=>v(c));return new Configuration(e,l,m,c,h,a)}}function flatten(s,e,r){let n=[[],[],[],[],[]],o=new Map;function a(l,c){let h=o.get(l);if(h!=null){if(h<=c)return;let f=n[h].indexOf(l);f>-1&&n[h].splice(f,1),l instanceof CompartmentInstance&&r.delete(l.compartment)}if(o.set(l,c),Array.isArray(l))for(let f of l)a(f,c);else if(l instanceof CompartmentInstance){if(r.has(l.compartment))throw new RangeError("Duplicate use of compartment in extensions");let f=e.get(l.compartment)||l.inner;r.set(l.compartment,f),a(f,c)}else if(l instanceof PrecExtension)a(l.inner,l.prec);else if(l instanceof StateField)n[c].push(l),l.provides&&a(l.provides,c);else if(l instanceof FacetProvider)n[c].push(l),l.facet.extensions&&a(l.facet.extensions,Prec_.default);else{let f=l.extension;if(!f)throw new Error(`Unrecognized extension value in extension set (${l}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(f,c)}}return a(s,Prec_.default),n.reduce((l,c)=>l.concat(c))}function ensureAddr(s,e){if(e&1)return 2;let r=e>>1,n=s.status[r];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;s.status[r]=4;let o=s.computeSlot(s,s.config.dynamicSlots[r]);return s.status[r]=2|o}function getAddr(s,e){return e&1?s.config.staticValues[e>>1]:s.values[e>>1]}const languageData=Facet.define(),allowMultipleSelections=Facet.define({combine:s=>s.some(e=>e),static:!0}),lineSeparator=Facet.define({combine:s=>s.length?s[0]:void 0,static:!0}),changeFilter=Facet.define(),transactionFilter=Facet.define(),transactionExtender=Facet.define(),readOnly=Facet.define({combine:s=>s.length?s[0]:!1});class Annotation{constructor(e,r){this.type=e,this.value=r}static define(){return new AnnotationType}}class AnnotationType{of(e){return new Annotation(this,e)}}class StateEffectType{constructor(e){this.map=e}of(e){return new StateEffect(this,e)}}class StateEffect{constructor(e,r){this.type=e,this.value=r}map(e){let r=this.type.map(this.value,e);return r===void 0?void 0:r==this.value?this:new StateEffect(this.type,r)}is(e){return this.type==e}static define(e={}){return new StateEffectType(e.map||(r=>r))}static mapEffects(e,r){if(!e.length)return e;let n=[];for(let o of e){let a=o.map(r);a&&n.push(a)}return n}}StateEffect.reconfigure=StateEffect.define();StateEffect.appendConfig=StateEffect.define();class Transaction{constructor(e,r,n,o,a,l){this.startState=e,this.changes=r,this.selection=n,this.effects=o,this.annotations=a,this.scrollIntoView=l,this._doc=null,this._state=null,n&&checkSelection(n,r.newLength),a.some(c=>c.type==Transaction.time)||(this.annotations=a.concat(Transaction.time.of(Date.now())))}static create(e,r,n,o,a,l){return new Transaction(e,r,n,o,a,l)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let r of this.annotations)if(r.type==e)return r.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let r=this.annotation(Transaction.userEvent);return!!(r&&(r==e||r.length>e.length&&r.slice(0,e.length)==e&&r[e.length]=="."))}}Transaction.time=Annotation.define();Transaction.userEvent=Annotation.define();Transaction.addToHistory=Annotation.define();Transaction.remote=Annotation.define();function joinRanges(s,e){let r=[];for(let n=0,o=0;;){let a,l;if(n<s.length&&(o==e.length||e[o]>=s[n]))a=s[n++],l=s[n++];else if(o<e.length)a=e[o++],l=e[o++];else return r;!r.length||r[r.length-1]<a?r.push(a,l):r[r.length-1]<l&&(r[r.length-1]=l)}}function mergeTransaction(s,e,r){var n;let o,a,l;return r?(o=e.changes,a=ChangeSet.empty(e.changes.length),l=s.changes.compose(e.changes)):(o=e.changes.map(s.changes),a=s.changes.mapDesc(e.changes,!0),l=s.changes.compose(o)),{changes:l,selection:e.selection?e.selection.map(a):(n=s.selection)===null||n===void 0?void 0:n.map(o),effects:StateEffect.mapEffects(s.effects,o).concat(StateEffect.mapEffects(e.effects,a)),annotations:s.annotations.length?s.annotations.concat(e.annotations):e.annotations,scrollIntoView:s.scrollIntoView||e.scrollIntoView}}function resolveTransactionInner(s,e,r){let n=e.selection,o=asArray$1(e.annotations);return e.userEvent&&(o=o.concat(Transaction.userEvent.of(e.userEvent))),{changes:e.changes instanceof ChangeSet?e.changes:ChangeSet.of(e.changes||[],r,s.facet(lineSeparator)),selection:n&&(n instanceof EditorSelection?n:EditorSelection.single(n.anchor,n.head)),effects:asArray$1(e.effects),annotations:o,scrollIntoView:!!e.scrollIntoView}}function resolveTransaction(s,e,r){let n=resolveTransactionInner(s,e.length?e[0]:{},s.doc.length);e.length&&e[0].filter===!1&&(r=!1);for(let a=1;a<e.length;a++){e[a].filter===!1&&(r=!1);let l=!!e[a].sequential;n=mergeTransaction(n,resolveTransactionInner(s,e[a],l?n.changes.newLength:s.doc.length),l)}let o=Transaction.create(s,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return extendTransaction(r?filterTransaction(o):o)}function filterTransaction(s){let e=s.startState,r=!0;for(let o of e.facet(changeFilter)){let a=o(s);if(a===!1){r=!1;break}Array.isArray(a)&&(r=r===!0?a:joinRanges(r,a))}if(r!==!0){let o,a;if(r===!1)a=s.changes.invertedDesc,o=ChangeSet.empty(e.doc.length);else{let l=s.changes.filter(r);o=l.changes,a=l.filtered.mapDesc(l.changes).invertedDesc}s=Transaction.create(e,o,s.selection&&s.selection.map(a),StateEffect.mapEffects(s.effects,a),s.annotations,s.scrollIntoView)}let n=e.facet(transactionFilter);for(let o=n.length-1;o>=0;o--){let a=n[o](s);a instanceof Transaction?s=a:Array.isArray(a)&&a.length==1&&a[0]instanceof Transaction?s=a[0]:s=resolveTransaction(e,asArray$1(a),!1)}return s}function extendTransaction(s){let e=s.startState,r=e.facet(transactionExtender),n=s;for(let o=r.length-1;o>=0;o--){let a=r[o](s);a&&Object.keys(a).length&&(n=mergeTransaction(n,resolveTransactionInner(e,a,s.changes.newLength),!0))}return n==s?s:Transaction.create(e,s.changes,s.selection,n.effects,n.annotations,n.scrollIntoView)}const none$3=[];function asArray$1(s){return s==null?none$3:Array.isArray(s)?s:[s]}var CharCategory=function(s){return s[s.Word=0]="Word",s[s.Space=1]="Space",s[s.Other=2]="Other",s}(CharCategory||(CharCategory={}));const nonASCIISingleCaseWordChar=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let wordChar$1;try{wordChar$1=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function hasWordChar(s){if(wordChar$1)return wordChar$1.test(s);for(let e=0;e<s.length;e++){let r=s[e];if(/\w/.test(r)||r>""&&(r.toUpperCase()!=r.toLowerCase()||nonASCIISingleCaseWordChar.test(r)))return!0}return!1}function makeCategorizer(s){return e=>{if(!/\S/.test(e))return CharCategory.Space;if(hasWordChar(e))return CharCategory.Word;for(let r=0;r<s.length;r++)if(e.indexOf(s[r])>-1)return CharCategory.Word;return CharCategory.Other}}class EditorState{constructor(e,r,n,o,a,l){this.config=e,this.doc=r,this.selection=n,this.values=o,this.status=e.statusTemplate.slice(),this.computeSlot=a,l&&(l._state=this);for(let c=0;c<this.config.dynamicSlots.length;c++)ensureAddr(this,c<<1);this.computeSlot=null}field(e,r=!0){let n=this.config.address[e.id];if(n==null){if(r)throw new RangeError("Field is not present in this state");return}return ensureAddr(this,n),getAddr(this,n)}update(...e){return resolveTransaction(this,e,!0)}applyTransaction(e){let r=this.config,{base:n,compartments:o}=r;for(let l of e.effects)l.is(Compartment.reconfigure)?(r&&(o=new Map,r.compartments.forEach((c,h)=>o.set(h,c)),r=null),o.set(l.value.compartment,l.value.extension)):l.is(StateEffect.reconfigure)?(r=null,n=l.value):l.is(StateEffect.appendConfig)&&(r=null,n=asArray$1(n).concat(l.value));let a;r?a=e.startState.values.slice():(r=Configuration.resolve(n,o,this),a=new EditorState(r,this.doc,this.selection,r.dynamicSlots.map(()=>null),(c,h)=>h.reconfigure(c,this),null).values),new EditorState(r,e.newDoc,e.newSelection,a,(l,c)=>c.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:e},range:EditorSelection.cursor(r.from+e.length)}))}changeByRange(e){let r=this.selection,n=e(r.ranges[0]),o=this.changes(n.changes),a=[n.range],l=asArray$1(n.effects);for(let c=1;c<r.ranges.length;c++){let h=e(r.ranges[c]),f=this.changes(h.changes),d=f.map(o);for(let v=0;v<c;v++)a[v]=a[v].map(d);let m=o.mapDesc(f,!0);a.push(h.range.map(m)),o=o.compose(d),l=StateEffect.mapEffects(l,d).concat(StateEffect.mapEffects(asArray$1(h.effects),m))}return{changes:o,selection:EditorSelection.create(a,r.mainIndex),effects:l}}changes(e=[]){return e instanceof ChangeSet?e:ChangeSet.of(e,this.doc.length,this.facet(EditorState.lineSeparator))}toText(e){return Text.of(e.split(this.facet(EditorState.lineSeparator)||DefaultSplit))}sliceDoc(e=0,r=this.doc.length){return this.doc.sliceString(e,r,this.lineBreak)}facet(e){let r=this.config.address[e.id];return r==null?e.default:(ensureAddr(this,r),getAddr(this,r))}toJSON(e){let r={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let o=e[n];o instanceof StateField&&this.config.address[o.id]!=null&&(r[n]=o.spec.toJSON(this.field(e[n]),this))}return r}static fromJSON(e,r={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let o=[];if(n){for(let a in n)if(Object.prototype.hasOwnProperty.call(e,a)){let l=n[a],c=e[a];o.push(l.init(h=>l.spec.fromJSON(c,h)))}}return EditorState.create({doc:e.doc,selection:EditorSelection.fromJSON(e.selection),extensions:r.extensions?o.concat([r.extensions]):o})}static create(e={}){let r=Configuration.resolve(e.extensions||[],new Map),n=e.doc instanceof Text?e.doc:Text.of((e.doc||"").split(r.staticFacet(EditorState.lineSeparator)||DefaultSplit)),o=e.selection?e.selection instanceof EditorSelection?e.selection:EditorSelection.single(e.selection.anchor,e.selection.head):EditorSelection.single(0);return checkSelection(o,n.length),r.staticFacet(allowMultipleSelections)||(o=o.asSingle()),new EditorState(r,n,o,r.dynamicSlots.map(()=>null),(a,l)=>l.create(a),null)}get tabSize(){return this.facet(EditorState.tabSize)}get lineBreak(){return this.facet(EditorState.lineSeparator)||`
|
||
`}get readOnly(){return this.facet(readOnly)}phrase(e,...r){for(let n of this.facet(EditorState.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return r.length&&(e=e.replace(/\$(\$|\d*)/g,(n,o)=>{if(o=="$")return"$";let a=+(o||1);return!a||a>r.length?n:r[a-1]})),e}languageDataAt(e,r,n=-1){let o=[];for(let a of this.facet(languageData))for(let l of a(this,r,n))Object.prototype.hasOwnProperty.call(l,e)&&o.push(l[e]);return o}charCategorizer(e){return makeCategorizer(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:r,from:n,length:o}=this.doc.lineAt(e),a=this.charCategorizer(e),l=e-n,c=e-n;for(;l>0;){let h=findClusterBreak(r,l,!1);if(a(r.slice(h,l))!=CharCategory.Word)break;l=h}for(;c<o;){let h=findClusterBreak(r,c);if(a(r.slice(c,h))!=CharCategory.Word)break;c=h}return l==c?null:EditorSelection.range(l+n,c+n)}}EditorState.allowMultipleSelections=allowMultipleSelections;EditorState.tabSize=Facet.define({combine:s=>s.length?s[0]:4});EditorState.lineSeparator=lineSeparator;EditorState.readOnly=readOnly;EditorState.phrases=Facet.define({compare(s,e){let r=Object.keys(s),n=Object.keys(e);return r.length==n.length&&r.every(o=>s[o]==e[o])}});EditorState.languageData=languageData;EditorState.changeFilter=changeFilter;EditorState.transactionFilter=transactionFilter;EditorState.transactionExtender=transactionExtender;Compartment.reconfigure=StateEffect.define();function combineConfig(s,e,r={}){let n={};for(let o of s)for(let a of Object.keys(o)){let l=o[a],c=n[a];if(c===void 0)n[a]=l;else if(!(c===l||l===void 0))if(Object.hasOwnProperty.call(r,a))n[a]=r[a](c,l);else throw new Error("Config merge conflict for field "+a)}for(let o in e)n[o]===void 0&&(n[o]=e[o]);return n}class RangeValue{eq(e){return this==e}range(e,r=e){return Range$1.create(e,r,this)}}RangeValue.prototype.startSide=RangeValue.prototype.endSide=0;RangeValue.prototype.point=!1;RangeValue.prototype.mapMode=MapMode.TrackDel;let Range$1=class Sn{constructor(e,r,n){this.from=e,this.to=r,this.value=n}static create(e,r,n){return new Sn(e,r,n)}};function cmpRange(s,e){return s.from-e.from||s.value.startSide-e.value.startSide}class Chunk{constructor(e,r,n,o){this.from=e,this.to=r,this.value=n,this.maxPoint=o}get length(){return this.to[this.to.length-1]}findIndex(e,r,n,o=0){let a=n?this.to:this.from;for(let l=o,c=a.length;;){if(l==c)return l;let h=l+c>>1,f=a[h]-e||(n?this.value[h].endSide:this.value[h].startSide)-r;if(h==l)return f>=0?l:c;f>=0?c=h:l=h+1}}between(e,r,n,o){for(let a=this.findIndex(r,-1e9,!0),l=this.findIndex(n,1e9,!1,a);a<l;a++)if(o(this.from[a]+e,this.to[a]+e,this.value[a])===!1)return!1}map(e,r){let n=[],o=[],a=[],l=-1,c=-1;for(let h=0;h<this.value.length;h++){let f=this.value[h],d=this.from[h]+e,m=this.to[h]+e,v,A;if(d==m){let T=r.mapPos(d,f.startSide,f.mapMode);if(T==null||(v=A=T,f.startSide!=f.endSide&&(A=r.mapPos(d,f.endSide),A<v)))continue}else if(v=r.mapPos(d,f.startSide),A=r.mapPos(m,f.endSide),v>A||v==A&&f.startSide>0&&f.endSide<=0)continue;(A-v||f.endSide-f.startSide)<0||(l<0&&(l=v),f.point&&(c=Math.max(c,A-v)),n.push(f),o.push(v-l),a.push(A-l))}return{mapped:n.length?new Chunk(o,a,n,c):null,pos:l}}}class RangeSet{constructor(e,r,n,o){this.chunkPos=e,this.chunk=r,this.nextLayer=n,this.maxPoint=o}static create(e,r,n,o){return new RangeSet(e,r,n,o)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let r of this.chunk)e+=r.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:r=[],sort:n=!1,filterFrom:o=0,filterTo:a=this.length}=e,l=e.filter;if(r.length==0&&!l)return this;if(n&&(r=r.slice().sort(cmpRange)),this.isEmpty)return r.length?RangeSet.of(r):this;let c=new LayerCursor(this,null,-1).goto(0),h=0,f=[],d=new RangeSetBuilder;for(;c.value||h<r.length;)if(h<r.length&&(c.from-r[h].from||c.startSide-r[h].value.startSide)>=0){let m=r[h++];d.addInner(m.from,m.to,m.value)||f.push(m)}else c.rangeIndex==1&&c.chunkIndex<this.chunk.length&&(h==r.length||this.chunkEnd(c.chunkIndex)<r[h].from)&&(!l||o>this.chunkEnd(c.chunkIndex)||a<this.chunkPos[c.chunkIndex])&&d.addChunk(this.chunkPos[c.chunkIndex],this.chunk[c.chunkIndex])?c.nextChunk():((!l||o>c.to||a<c.from||l(c.from,c.to,c.value))&&(d.addInner(c.from,c.to,c.value)||f.push(Range$1.create(c.from,c.to,c.value))),c.next());return d.finishInner(this.nextLayer.isEmpty&&!f.length?RangeSet.empty:this.nextLayer.update({add:f,filter:l,filterFrom:o,filterTo:a}))}map(e){if(e.empty||this.isEmpty)return this;let r=[],n=[],o=-1;for(let l=0;l<this.chunk.length;l++){let c=this.chunkPos[l],h=this.chunk[l],f=e.touchesRange(c,c+h.length);if(f===!1)o=Math.max(o,h.maxPoint),r.push(h),n.push(e.mapPos(c));else if(f===!0){let{mapped:d,pos:m}=h.map(c,e);d&&(o=Math.max(o,d.maxPoint),r.push(d),n.push(m))}}let a=this.nextLayer.map(e);return r.length==0?a:new RangeSet(n,r,a||RangeSet.empty,o)}between(e,r,n){if(!this.isEmpty){for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o];if(r>=a&&e<=a+l.length&&l.between(a,e-a,r-a,n)===!1)return}this.nextLayer.between(e,r,n)}}iter(e=0){return HeapCursor.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,r=0){return HeapCursor.from(e).goto(r)}static compare(e,r,n,o,a=-1){let l=e.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=a),c=r.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=a),h=findSharedChunks(l,c,n),f=new SpanCursor(l,h,a),d=new SpanCursor(c,h,a);n.iterGaps((m,v,A)=>compare(f,m,d,v,A,o)),n.empty&&n.length==0&&compare(f,0,d,0,0,o)}static eq(e,r,n=0,o){o==null&&(o=1e9-1);let a=e.filter(d=>!d.isEmpty&&r.indexOf(d)<0),l=r.filter(d=>!d.isEmpty&&e.indexOf(d)<0);if(a.length!=l.length)return!1;if(!a.length)return!0;let c=findSharedChunks(a,l),h=new SpanCursor(a,c,0).goto(n),f=new SpanCursor(l,c,0).goto(n);for(;;){if(h.to!=f.to||!sameValues(h.active,f.active)||h.point&&(!f.point||!h.point.eq(f.point)))return!1;if(h.to>o)return!0;h.next(),f.next()}}static spans(e,r,n,o,a=-1){let l=new SpanCursor(e,null,a).goto(r),c=r,h=l.openStart;for(;;){let f=Math.min(l.to,n);if(l.point){let d=l.activeForPoint(l.to),m=l.pointFrom<r?d.length+1:Math.min(d.length,h);o.point(c,f,l.point,d,m,l.pointRank),h=Math.min(l.openEnd(f),d.length)}else f>c&&(o.span(c,f,l.active,h),h=l.openEnd(f));if(l.to>n)return h+(l.point&&l.to>n?1:0);c=l.to,l.next()}}static of(e,r=!1){let n=new RangeSetBuilder;for(let o of e instanceof Range$1?[e]:r?lazySort(e):e)n.add(o.from,o.to,o.value);return n.finish()}}RangeSet.empty=new RangeSet([],[],null,-1);function lazySort(s){if(s.length>1)for(let e=s[0],r=1;r<s.length;r++){let n=s[r];if(cmpRange(e,n)>0)return s.slice().sort(cmpRange);e=n}return s}RangeSet.empty.nextLayer=RangeSet.empty;class RangeSetBuilder{finishChunk(e){this.chunks.push(new Chunk(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,e&&(this.from=[],this.to=[],this.value=[])}constructor(){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}add(e,r,n){this.addInner(e,r,n)||(this.nextLayer||(this.nextLayer=new RangeSetBuilder)).add(e,r,n)}addInner(e,r,n){let o=e-this.lastTo||n.startSide-this.last.endSide;if(o<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return o<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(r-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=r,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,r-e)),!0)}addChunk(e,r){if((e-this.lastTo||r.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,r.maxPoint),this.chunks.push(r),this.chunkPos.push(e);let n=r.value.length-1;return this.last=r.value[n],this.lastFrom=r.from[n]+e,this.lastTo=r.to[n]+e,!0}finish(){return this.finishInner(RangeSet.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let r=RangeSet.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,r}}function findSharedChunks(s,e,r){let n=new Map;for(let a of s)for(let l=0;l<a.chunk.length;l++)a.chunk[l].maxPoint<=0&&n.set(a.chunk[l],a.chunkPos[l]);let o=new Set;for(let a of e)for(let l=0;l<a.chunk.length;l++){let c=n.get(a.chunk[l]);c!=null&&(r?r.mapPos(c):c)==a.chunkPos[l]&&!(r!=null&&r.touchesRange(c,c+a.chunk[l].length))&&o.add(a.chunk[l])}return o}class LayerCursor{constructor(e,r,n,o=0){this.layer=e,this.skip=r,this.minPoint=n,this.rank=o}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,r=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,r,!1),this}gotoInner(e,r,n){for(;this.chunkIndex<this.layer.chunk.length;){let o=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(o)||this.layer.chunkEnd(this.chunkIndex)<e||o.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let o=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],r,!0);(!n||this.rangeIndex<o)&&this.setRangeIndex(o)}this.next()}forward(e,r){(this.to-e||this.endSide-r)<0&&this.gotoInner(e,r,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],r=this.layer.chunk[this.chunkIndex],n=e+r.from[this.rangeIndex];if(this.from=n,this.to=e+r.to[this.rangeIndex],this.value=r.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==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=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class HeapCursor{constructor(e){this.heap=e}static from(e,r=null,n=-1){let o=[];for(let a=0;a<e.length;a++)for(let l=e[a];!l.isEmpty;l=l.nextLayer)l.maxPoint>=n&&o.push(new LayerCursor(l,r,n,a));return o.length==1?o[0]:new HeapCursor(o)}get startSide(){return this.value?this.value.startSide:0}goto(e,r=-1e9){for(let n of this.heap)n.goto(e,r);for(let n=this.heap.length>>1;n>=0;n--)heapBubble(this.heap,n);return this.next(),this}forward(e,r){for(let n of this.heap)n.forward(e,r);for(let n=this.heap.length>>1;n>=0;n--)heapBubble(this.heap,n);(this.to-e||this.value.endSide-r)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),heapBubble(this.heap,0)}}}function heapBubble(s,e){for(let r=s[e];;){let n=(e<<1)+1;if(n>=s.length)break;let o=s[n];if(n+1<s.length&&o.compare(s[n+1])>=0&&(o=s[n+1],n++),r.compare(o)<0)break;s[n]=r,s[e]=o,e=n}}class SpanCursor{constructor(e,r,n){this.minPoint=n,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=HeapCursor.from(e,r,n)}goto(e,r=-1e9){return this.cursor.goto(e,r),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=r,this.openStart=-1,this.next(),this}forward(e,r){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-r)<0;)this.removeActive(this.minActive);this.cursor.forward(e,r)}removeActive(e){remove(this.active,e),remove(this.activeTo,e),remove(this.activeRank,e),this.minActive=findMinIndex(this.active,this.activeTo)}addActive(e){let r=0,{value:n,to:o,rank:a}=this.cursor;for(;r<this.activeRank.length&&this.activeRank[r]<=a;)r++;insert(this.active,r,n),insert(this.activeTo,r,o),insert(this.activeRank,r,a),e&&insert(e,r,this.cursor.from),this.minActive=findMinIndex(this.active,this.activeTo)}next(){let e=this.to,r=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let o=this.minActive;if(o>-1&&(this.activeTo[o]-this.cursor.from||this.active[o].endSide-this.cursor.startSide)<0){if(this.activeTo[o]>e){this.to=this.activeTo[o],this.endSide=this.active[o].endSide;break}this.removeActive(o),n&&remove(n,o)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let a=this.cursor.value;if(!a.point)this.addActive(n),this.cursor.next();else if(r&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=a,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=a.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let o=n.length-1;o>=0&&n[o]<e;o--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let r=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&r.push(this.active[n]);return r.reverse()}openEnd(e){let r=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)r++;return r}}function compare(s,e,r,n,o,a){s.goto(e),r.goto(n);let l=n+o,c=n,h=n-e;for(;;){let f=s.to+h-r.to||s.endSide-r.endSide,d=f<0?s.to+h:r.to,m=Math.min(d,l);if(s.point||r.point?s.point&&r.point&&(s.point==r.point||s.point.eq(r.point))&&sameValues(s.activeForPoint(s.to),r.activeForPoint(r.to))||a.comparePoint(c,m,s.point,r.point):m>c&&!sameValues(s.active,r.active)&&a.compareRange(c,m,s.active,r.active),d>l)break;c=d,f<=0&&s.next(),f>=0&&r.next()}}function sameValues(s,e){if(s.length!=e.length)return!1;for(let r=0;r<s.length;r++)if(s[r]!=e[r]&&!s[r].eq(e[r]))return!1;return!0}function remove(s,e){for(let r=e,n=s.length-1;r<n;r++)s[r]=s[r+1];s.pop()}function insert(s,e,r){for(let n=s.length-1;n>=e;n--)s[n+1]=s[n];s[e]=r}function findMinIndex(s,e){let r=-1,n=1e9;for(let o=0;o<e.length;o++)(e[o]-n||s[o].endSide-s[r].endSide)<0&&(r=o,n=e[o]);return r}function countColumn(s,e,r=s.length){let n=0;for(let o=0;o<r;)s.charCodeAt(o)==9?(n+=e-n%e,o++):(n++,o=findClusterBreak(s,o));return n}function findColumn(s,e,r,n){for(let o=0,a=0;;){if(a>=e)return o;if(o==s.length)break;a+=s.charCodeAt(o)==9?r-a%r:1,o=findClusterBreak(s,o)}return n===!0?-1:s.length}const C$1="ͼ",COUNT=typeof Symbol>"u"?"__"+C$1:Symbol.for(C$1),SET=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),top=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class StyleModule{constructor(e,r){this.rules=[];let{finish:n}=r||{};function o(l){return/^@/.test(l)?[l]:l.split(/,\s*/)}function a(l,c,h,f){let d=[],m=/^@(\w+)\b/.exec(l[0]),v=m&&m[1]=="keyframes";if(m&&c==null)return h.push(l[0]+";");for(let A in c){let T=c[A];if(/&/.test(A))a(A.split(/,\s*/).map(B=>l.map(Y=>B.replace(/&/,Y))).reduce((B,Y)=>B.concat(Y)),T,h);else if(T&&typeof T=="object"){if(!m)throw new RangeError("The value of a property ("+A+") should be a primitive value.");a(o(A),T,d,v)}else T!=null&&d.push(A.replace(/_.*/,"").replace(/[A-Z]/g,B=>"-"+B.toLowerCase())+": "+T+";")}(d.length||v)&&h.push((n&&!m&&!f?l.map(n):l).join(", ")+" {"+d.join(" ")+"}")}for(let l in e)a(o(l),e[l],this.rules)}getRules(){return this.rules.join(`
|
||
`)}static newName(){let e=top[COUNT]||1;return top[COUNT]=e+1,C$1+e.toString(36)}static mount(e,r){(e[SET]||new StyleSet(e)).mount(Array.isArray(r)?r:[r])}}let adoptedSet=new Map;class StyleSet{constructor(e){let r=e.ownerDocument||e,n=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let o=adoptedSet.get(r);if(o)return e.adoptedStyleSheets=[o.sheet,...e.adoptedStyleSheets],e[SET]=o;this.sheet=new n.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],adoptedSet.set(r,this)}else{this.styleTag=r.createElement("style");let o=e.head||e;o.insertBefore(this.styleTag,o.firstChild)}this.modules=[],e[SET]=this}mount(e){let r=this.sheet,n=0,o=0;for(let a=0;a<e.length;a++){let l=e[a],c=this.modules.indexOf(l);if(c<o&&c>-1&&(this.modules.splice(c,1),o--,c=-1),c==-1){if(this.modules.splice(o++,0,l),r)for(let h=0;h<l.rules.length;h++)r.insertRule(l.rules[h],n++)}else{for(;o<c;)n+=this.modules[o++].rules.length;n+=l.rules.length,o++}}if(!r){let a="";for(let l=0;l<this.modules.length;l++)a+=this.modules[l].getRules()+`
|
||
`;this.styleTag.textContent=a}}}var base={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:"'"},shift={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},mac=typeof navigator<"u"&&/Mac/.test(navigator.platform),ie$2=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var i=0;i<10;i++)base[48+i]=base[96+i]=String(i);for(var i=1;i<=24;i++)base[i+111]="F"+i;for(var i=65;i<=90;i++)base[i]=String.fromCharCode(i+32),shift[i]=String.fromCharCode(i);for(var code in base)shift.hasOwnProperty(code)||(shift[code]=base[code]);function keyName(s){var e=mac&&s.metaKey&&s.shiftKey&&!s.ctrlKey&&!s.altKey||ie$2&&s.shiftKey&&s.key&&s.key.length==1||s.key=="Unidentified",r=!e&&s.key||(s.shiftKey?shift:base)[s.keyCode]||s.key||"Unidentified";return r=="Esc"&&(r="Escape"),r=="Del"&&(r="Delete"),r=="Left"&&(r="ArrowLeft"),r=="Up"&&(r="ArrowUp"),r=="Right"&&(r="ArrowRight"),r=="Down"&&(r="ArrowDown"),r}function getSelection(s){let e;return s.nodeType==11?e=s.getSelection?s:s.ownerDocument:e=s,e.getSelection()}function contains(s,e){return e?s==e||s.contains(e.nodeType!=1?e.parentNode:e):!1}function deepActiveElement(s){let e=s.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function hasSelection(s,e){if(!e.anchorNode)return!1;try{return contains(s,e.anchorNode)}catch{return!1}}function clientRectsFor(s){return s.nodeType==3?textRange(s,0,s.nodeValue.length).getClientRects():s.nodeType==1?s.getClientRects():[]}function isEquivalentPosition(s,e,r,n){return r?scanFor(s,e,r,n,-1)||scanFor(s,e,r,n,1):!1}function domIndex(s){for(var e=0;;e++)if(s=s.previousSibling,!s)return e}function scanFor(s,e,r,n,o){for(;;){if(s==r&&e==n)return!0;if(e==(o<0?0:maxOffset(s))){if(s.nodeName=="DIV")return!1;let a=s.parentNode;if(!a||a.nodeType!=1)return!1;e=domIndex(s)+(o<0?0:1),s=a}else if(s.nodeType==1){if(s=s.childNodes[e+(o<0?-1:0)],s.nodeType==1&&s.contentEditable=="false")return!1;e=o<0?maxOffset(s):0}else return!1}}function maxOffset(s){return s.nodeType==3?s.nodeValue.length:s.childNodes.length}function flattenRect(s,e){let r=e?s.left:s.right;return{left:r,right:r,top:s.top,bottom:s.bottom}}function windowRect(s){return{left:0,right:s.innerWidth,top:0,bottom:s.innerHeight}}function scrollRectIntoView(s,e,r,n,o,a,l,c){let h=s.ownerDocument,f=h.defaultView||window;for(let d=s,m=!1;d&&!m;)if(d.nodeType==1){let v,A=d==h.body;if(A)v=windowRect(f);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(m=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let Y=d.getBoundingClientRect();v={left:Y.left,right:Y.left+d.clientWidth,top:Y.top,bottom:Y.top+d.clientHeight}}let T=0,B=0;if(o=="nearest")e.top<v.top?(B=-(v.top-e.top+l),r>0&&e.bottom>v.bottom+B&&(B=e.bottom-v.bottom+B+l)):e.bottom>v.bottom&&(B=e.bottom-v.bottom+l,r<0&&e.top-B<v.top&&(B=-(v.top+B-e.top+l)));else{let Y=e.bottom-e.top,F=v.bottom-v.top;B=(o=="center"&&Y<=F?e.top+Y/2-F/2:o=="start"||o=="center"&&r<0?e.top-l:e.bottom-F+l)-v.top}if(n=="nearest"?e.left<v.left?(T=-(v.left-e.left+a),r>0&&e.right>v.right+T&&(T=e.right-v.right+T+a)):e.right>v.right&&(T=e.right-v.right+a,r<0&&e.left<v.left+T&&(T=-(v.left+T-e.left+a))):T=(n=="center"?e.left+(e.right-e.left)/2-(v.right-v.left)/2:n=="start"==c?e.left-a:e.right-(v.right-v.left)+a)-v.left,T||B)if(A)f.scrollBy(T,B);else{let Y=0,F=0;if(B){let ke=d.scrollTop;d.scrollTop+=B,F=d.scrollTop-ke}if(T){let ke=d.scrollLeft;d.scrollLeft+=T,Y=d.scrollLeft-ke}e={left:e.left-Y,top:e.top-F,right:e.right-Y,bottom:e.bottom-F},Y&&Math.abs(Y-T)<1&&(n="nearest"),F&&Math.abs(F-B)<1&&(o="nearest")}if(A)break;d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function scrollableParent(s){let e=s.ownerDocument;for(let r=s.parentNode;r&&r!=e.body;)if(r.nodeType==1){if(r.scrollHeight>r.clientHeight||r.scrollWidth>r.clientWidth)return r;r=r.assignedSlot||r.parentNode}else if(r.nodeType==11)r=r.host;else break;return null}class DOMSelectionState{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:r,focusNode:n}=e;this.set(r,Math.min(e.anchorOffset,r?maxOffset(r):0),n,Math.min(e.focusOffset,n?maxOffset(n):0))}set(e,r,n,o){this.anchorNode=e,this.anchorOffset=r,this.focusNode=n,this.focusOffset=o}}let preventScrollSupported=null;function focusPreventScroll(s){if(s.setActive)return s.setActive();if(preventScrollSupported)return s.focus(preventScrollSupported);let e=[];for(let r=s;r&&(e.push(r,r.scrollTop,r.scrollLeft),r!=r.ownerDocument);r=r.parentNode);if(s.focus(preventScrollSupported==null?{get preventScroll(){return preventScrollSupported={preventScroll:!0},!0}}:void 0),!preventScrollSupported){preventScrollSupported=!1;for(let r=0;r<e.length;){let n=e[r++],o=e[r++],a=e[r++];n.scrollTop!=o&&(n.scrollTop=o),n.scrollLeft!=a&&(n.scrollLeft=a)}}}let scratchRange;function textRange(s,e,r=e){let n=scratchRange||(scratchRange=document.createRange());return n.setEnd(s,r),n.setStart(s,e),n}function dispatchKey(s,e,r){let n={key:e,code:e,keyCode:r,which:r,cancelable:!0},o=new KeyboardEvent("keydown",n);o.synthetic=!0,s.dispatchEvent(o);let a=new KeyboardEvent("keyup",n);return a.synthetic=!0,s.dispatchEvent(a),o.defaultPrevented||a.defaultPrevented}function getRoot(s){for(;s;){if(s&&(s.nodeType==9||s.nodeType==11&&s.host))return s;s=s.assignedSlot||s.parentNode}return null}function clearAttributes(s){for(;s.attributes.length;)s.removeAttributeNode(s.attributes[0])}function atElementStart(s,e){let r=e.focusNode,n=e.focusOffset;if(!r||e.anchorNode!=r||e.anchorOffset!=n)return!1;for(n=Math.min(n,maxOffset(r));;)if(n){if(r.nodeType!=1)return!1;let o=r.childNodes[n-1];o.contentEditable=="false"?n--:(r=o,n=maxOffset(r))}else{if(r==s)return!0;n=domIndex(r),r=r.parentNode}}function isScrolledToBottom(s){return s.scrollTop>Math.max(1,s.scrollHeight-s.clientHeight-4)}class DOMPos{constructor(e,r,n=!0){this.node=e,this.offset=r,this.precise=n}static before(e,r){return new DOMPos(e.parentNode,domIndex(e),r)}static after(e,r){return new DOMPos(e.parentNode,domIndex(e)+1,r)}}const noChildren=[];class ContentView{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let r=this.posAtStart;for(let n of this.children){if(n==e)return r;r+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,r){if(this.flags&2){let n=this.dom,o=null,a;for(let l of this.children){if(l.flags&7){if(!l.dom&&(a=o?o.nextSibling:n.firstChild)){let c=ContentView.get(a);(!c||!c.parent&&c.canReuseDOM(l))&&l.reuseDOM(a)}l.sync(e,r),l.flags&=-8}if(a=o?o.nextSibling:n.firstChild,r&&!r.written&&r.node==n&&a!=l.dom&&(r.written=!0),l.dom.parentNode==n)for(;a&&a!=l.dom;)a=rm$1(a);else n.insertBefore(l.dom,a);o=l.dom}for(a=o?o.nextSibling:n.firstChild,a&&r&&r.node==n&&(r.written=!0);a;)a=rm$1(a)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,r),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,r){let n;if(e==this.dom)n=this.dom.childNodes[r];else{let o=maxOffset(e)==0?0:r==0?-1:1;for(;;){let a=e.parentNode;if(a==this.dom)break;o==0&&a.firstChild!=a.lastChild&&(e==a.firstChild?o=-1:o=1),e=a}o<0?n=e:n=e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!ContentView.get(n);)n=n.nextSibling;if(!n)return this.length;for(let o=0,a=0;;o++){let l=this.children[o];if(l.dom==n)return a;a+=l.length+l.breakAfter}}domBoundsAround(e,r,n=0){let o=-1,a=-1,l=-1,c=-1;for(let h=0,f=n,d=n;h<this.children.length;h++){let m=this.children[h],v=f+m.length;if(f<e&&v>r)return m.domBoundsAround(e,r,f);if(v>=e&&o==-1&&(o=h,a=f),f>r&&m.dom.parentNode==this.dom){l=h,c=d;break}d=v,f=v+m.breakAfter}return{from:a,to:c<0?n+this.length:c,startDOM:(o?this.children[o-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:l<this.children.length&&l>=0?this.children[l].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let r=this.parent;r;r=r.parent){if(e&&(r.flags|=2),r.flags&1)return;r.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this}get rootView(){for(let e=this;;){let r=e.parent;if(!r)return e;e=r}}replaceChildren(e,r,n=noChildren){this.markDirty();for(let o=e;o<r;o++){let a=this.children[o];a.parent==this&&a.destroy()}this.children.splice(e,r-e,...n);for(let o=0;o<n.length;o++)n[o].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new ChildCursor(this.children,e,this.children.length)}childPos(e,r=1){return this.childCursor().findPos(e,r)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,r,n,o,a,l){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){this.parent=null}}ContentView.prototype.breakAfter=0;function rm$1(s){let e=s.nextSibling;return s.parentNode.removeChild(s),e}class ChildCursor{constructor(e,r,n){this.children=e,this.pos=r,this.i=n,this.off=0}findPos(e,r=1){for(;;){if(e>this.pos||e==this.pos&&(r>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function replaceRange(s,e,r,n,o,a,l,c,h){let{children:f}=s,d=f.length?f[e]:null,m=a.length?a[a.length-1]:null,v=m?m.breakAfter:l;if(!(e==n&&d&&!l&&!v&&a.length<2&&d.merge(r,o,a.length?m:null,r==0,c,h))){if(n<f.length){let A=f[n];A&&o<A.length?(e==n&&(A=A.split(o),o=0),!v&&m&&A.merge(0,o,m,!0,0,h)?a[a.length-1]=A:(o&&A.merge(0,o,null,!1,0,h),a.push(A))):A!=null&&A.breakAfter&&(m?m.breakAfter=1:l=1),n++}for(d&&(d.breakAfter=l,r>0&&(!l&&a.length&&d.merge(r,d.length,a[0],!1,c,0)?d.breakAfter=a.shift().breakAfter:(r<d.length||d.children.length&&d.children[d.children.length-1].length==0)&&d.merge(r,d.length,null,!1,c,0),e++));e<n&&a.length;)if(f[n-1].become(a[a.length-1]))n--,a.pop(),h=a.length?0:c;else if(f[e].become(a[0]))e++,a.shift(),c=a.length?0:h;else break;!a.length&&e&&n<f.length&&!f[e-1].breakAfter&&f[n].merge(0,0,f[e-1],!1,c,h)&&e--,(e<n||a.length)&&s.replaceChildren(e,n,a)}}function mergeChildrenInto(s,e,r,n,o,a){let l=s.childCursor(),{i:c,off:h}=l.findPos(r,1),{i:f,off:d}=l.findPos(e,-1),m=e-r;for(let v of n)m+=v.length;s.length+=m,replaceRange(s,f,d,c,h,n,0,o,a)}const LineBreakPlaceholder="";class DOMReader{constructor(e,r){this.points=e,this.text="",this.lineSeparator=r.facet(EditorState.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=LineBreakPlaceholder}readRange(e,r){if(!e)return this;let n=e.parentNode;for(let o=e;;){this.findPointBefore(n,o);let a=this.text.length;this.readNode(o);let l=o.nextSibling;if(l==r)break;let c=ContentView.get(o),h=ContentView.get(l);(c&&h?c.breakAfter:(c?c.breakAfter:isBlockElement(o))||isBlockElement(l)&&(o.nodeName!="BR"||o.cmIgnore)&&this.text.length>a)&&this.lineBreak(),o=l}return this.findPointBefore(n,r),this}readTextNode(e){let r=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,r.length));for(let n=0,o=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,l=1,c;if(this.lineSeparator?(a=r.indexOf(this.lineSeparator,n),l=this.lineSeparator.length):(c=o.exec(r))&&(a=c.index,l=c[0].length),this.append(r.slice(n,a<0?r.length:a)),a<0)break;if(this.lineBreak(),l>1)for(let h of this.points)h.node==e&&h.pos>this.text.length&&(h.pos-=l-1);n=a+l}}readNode(e){if(e.cmIgnore)return;let r=ContentView.get(e),n=r&&r.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let o=n.iter();!o.next().done;)o.lineBreak?this.lineBreak():this.append(o.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,r){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==r&&(n.pos=this.text.length)}findPointInside(e,r){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+Math.min(r,n.offset))}}function isBlockElement(s){return s.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(s.nodeName)}class DOMPoint{constructor(e,r){this.node=e,this.offset=r,this.pos=-1}}let nav=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},doc=typeof document<"u"?document:{documentElement:{style:{}}};const ie_edge=/Edge\/(\d+)/.exec(nav.userAgent),ie_upto10=/MSIE \d/.test(nav.userAgent),ie_11up=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nav.userAgent),ie$1=!!(ie_upto10||ie_11up||ie_edge),gecko=!ie$1&&/gecko\/(\d+)/i.test(nav.userAgent),chrome=!ie$1&&/Chrome\/(\d+)/.exec(nav.userAgent),webkit="webkitFontSmoothing"in doc.documentElement.style,safari=!ie$1&&/Apple Computer/.test(nav.vendor),ios=safari&&(/Mobile\/\w+/.test(nav.userAgent)||nav.maxTouchPoints>2);var browser={mac:ios||/Mac/.test(nav.platform),windows:/Win/.test(nav.platform),linux:/Linux|X11/.test(nav.platform),ie:ie$1,ie_version:ie_upto10?doc.documentMode||6:ie_11up?+ie_11up[1]:ie_edge?+ie_edge[1]:0,gecko,gecko_version:gecko?+(/Firefox\/(\d+)/.exec(nav.userAgent)||[0,0])[1]:0,chrome:!!chrome,chrome_version:chrome?+chrome[1]:0,ios,android:/Android\b/.test(nav.userAgent),webkit,safari,webkit_version:webkit?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:doc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const MaxJoinLen=256;class TextView extends ContentView{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,r){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(r&&r.node==this.dom&&(r.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,r,n){return this.flags&8||n&&(!(n instanceof TextView)||this.length-(r-e)+n.length>MaxJoinLen||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(r),this.markDirty(),!0)}split(e){let r=new TextView(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),r.flags|=this.flags&8,r}localPosFromDOM(e,r){return e==this.dom?r:r?this.text.length:0}domAtPos(e){return new DOMPos(this.dom,e)}domBoundsAround(e,r,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,r){return textCoords(this.dom,e,r)}}class MarkView extends ContentView{constructor(e,r=[],n=0){super(),this.mark=e,this.children=r,this.length=n;for(let o of r)o.setParent(this)}setAttrs(e){if(clearAttributes(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let r in this.mark.attrs)e.setAttribute(r,this.mark.attrs[r]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,r){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,r)}merge(e,r,n,o,a,l){return n&&(!(n instanceof MarkView&&n.mark.eq(this.mark))||e&&a<=0||r<this.length&&l<=0)?!1:(mergeChildrenInto(this,e,r,n?n.children:[],a-1,l-1),this.markDirty(),!0)}split(e){let r=[],n=0,o=-1,a=0;for(let c of this.children){let h=n+c.length;h>e&&r.push(n<e?c.split(e-n):c),o<0&&n>=e&&(o=a),n=h,a++}let l=this.length-e;return this.length=e,o>-1&&(this.children.length=o,this.markDirty()),new MarkView(this.mark,r,l)}domAtPos(e){return inlineDOMAtPos(this,e)}coordsAt(e,r){return coordsInChildren(this,e,r)}}function textCoords(s,e,r){let n=s.nodeValue.length;e>n&&(e=n);let o=e,a=e,l=0;e==0&&r<0||e==n&&r>=0?browser.chrome||browser.gecko||(e?(o--,l=1):a<n&&(a++,l=-1)):r<0?o--:a<n&&a++;let c=textRange(s,o,a).getClientRects();if(!c.length)return null;let h=c[(l?l<0:r>=0)?0:c.length-1];return browser.safari&&!l&&h.width==0&&(h=Array.prototype.find.call(c,f=>f.width)||h),l?flattenRect(h,l<0):h||null}class WidgetView extends ContentView{constructor(e,r,n){super(),this.widget=e,this.length=r,this.side=n,this.prevWidget=null}static create(e,r,n){return new WidgetView(e,r,n)}split(e){let r=WidgetView.create(this.widget,this.length-e,this.side);return this.length-=e,r}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,r,n,o,a,l){return n&&(!(n instanceof WidgetView)||!this.widget.compare(n.widget)||e>0&&a<=0||r<this.length&&l<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-r),!0)}become(e){return e instanceof WidgetView&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return Text.empty;let e=this;for(;e.parent;)e=e.parent;let{view:r}=e,n=r&&r.state.doc,o=this.posAtStart;return n?n.slice(o,o+this.length):Text.empty}domAtPos(e){return(this.length?e==0:this.side>0)?DOMPos.before(this.dom):DOMPos.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,r){let n=this.widget.coordsAt(this.dom,e,r);if(n)return n;let o=this.dom.getClientRects(),a=null;if(!o.length)return null;let l=this.side?this.side<0:e>0;for(let c=l?o.length-1:0;a=o[c],!(e>0?c==0:c==o.length-1||a.top<a.bottom);c+=l?-1:1);return flattenRect(a,!l)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class WidgetBufferView extends ContentView{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof WidgetBufferView&&e.side==this.side}split(){return new WidgetBufferView(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?DOMPos.before(this.dom):DOMPos.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Text.empty}get isHidden(){return!0}}TextView.prototype.children=WidgetView.prototype.children=WidgetBufferView.prototype.children=noChildren;function inlineDOMAtPos(s,e){let r=s.dom,{children:n}=s,o=0;for(let a=0;o<n.length;o++){let l=n[o],c=a+l.length;if(!(c==a&&l.getSide()<=0)){if(e>a&&e<c&&l.dom.parentNode==r)return l.domAtPos(e-a);if(e<=a)break;a=c}}for(let a=o;a>0;a--){let l=n[a-1];if(l.dom.parentNode==r)return l.domAtPos(l.length)}for(let a=o;a<n.length;a++){let l=n[a];if(l.dom.parentNode==r)return l.domAtPos(0)}return new DOMPos(r,0)}function joinInlineInto(s,e,r){let n,{children:o}=s;r>0&&e instanceof MarkView&&o.length&&(n=o[o.length-1])instanceof MarkView&&n.mark.eq(e.mark)?joinInlineInto(n,e.children[0],r-1):(o.push(e),e.setParent(s)),s.length+=e.length}function coordsInChildren(s,e,r){let n=null,o=-1,a=null,l=-1;function c(f,d){for(let m=0,v=0;m<f.children.length&&v<=d;m++){let A=f.children[m],T=v+A.length;T>=d&&(A.children.length?c(A,d-v):(!a||a.isHidden&&r>0)&&(T>d||v==T&&A.getSide()>0)?(a=A,l=d-v):(v<d||v==T&&A.getSide()<0&&!A.isHidden)&&(n=A,o=d-v)),v=T}}c(s,e);let h=(r<0?n:a)||n||a;return h?h.coordsAt(Math.max(0,h==n?o:l),r):fallbackRect(s)}function fallbackRect(s){let e=s.dom.lastChild;if(!e)return s.dom.getBoundingClientRect();let r=clientRectsFor(e);return r[r.length-1]||null}function combineAttrs(s,e){for(let r in s)r=="class"&&e.class?e.class+=" "+s.class:r=="style"&&e.style?e.style+=";"+s.style:e[r]=s[r];return e}const noAttrs=Object.create(null);function attrsEq(s,e,r){if(s==e)return!0;s||(s=noAttrs),e||(e=noAttrs);let n=Object.keys(s),o=Object.keys(e);if(n.length-(r&&n.indexOf(r)>-1?1:0)!=o.length-(r&&o.indexOf(r)>-1?1:0))return!1;for(let a of n)if(a!=r&&(o.indexOf(a)==-1||s[a]!==e[a]))return!1;return!0}function updateAttrs(s,e,r){let n=null;if(e)for(let o in e)r&&o in r||s.removeAttribute(n=o);if(r)for(let o in r)e&&e[o]==r[o]||s.setAttribute(n=o,r[o]);return!!n}function getAttrs$1(s){let e=Object.create(null);for(let r=0;r<s.attributes.length;r++){let n=s.attributes[r];e[n.name]=n.value}return e}class WidgetType{eq(e){return!1}updateDOM(e,r){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,r,n){return null}get isHidden(){return!1}destroy(e){}}var BlockType=function(s){return s[s.Text=0]="Text",s[s.WidgetBefore=1]="WidgetBefore",s[s.WidgetAfter=2]="WidgetAfter",s[s.WidgetRange=3]="WidgetRange",s}(BlockType||(BlockType={}));class Decoration extends RangeValue{constructor(e,r,n,o){super(),this.startSide=e,this.endSide=r,this.widget=n,this.spec=o}get heightRelevant(){return!1}static mark(e){return new MarkDecoration(e)}static widget(e){let r=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return r+=n&&!e.inlineOrder?r>0?3e8:-4e8:r>0?1e8:-1e8,new PointDecoration(e,r,r,n,e.widget||null,!1)}static replace(e){let r=!!e.block,n,o;if(e.isBlockGap)n=-5e8,o=4e8;else{let{start:a,end:l}=getInclusive(e,r);n=(a?r?-3e8:-1:5e8)-1,o=(l?r?2e8:1:-6e8)+1}return new PointDecoration(e,n,o,r,e.widget||null,!0)}static line(e){return new LineDecoration(e)}static set(e,r=!1){return RangeSet.of(e,r)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Decoration.none=RangeSet.empty;class MarkDecoration extends Decoration{constructor(e){let{start:r,end:n}=getInclusive(e);super(r?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var r,n;return this==e||e instanceof MarkDecoration&&this.tagName==e.tagName&&(this.class||((r=this.attrs)===null||r===void 0?void 0:r.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&attrsEq(this.attrs,e.attrs,"class")}range(e,r=e){if(e>=r)throw new RangeError("Mark decorations may not be empty");return super.range(e,r)}}MarkDecoration.prototype.point=!1;class LineDecoration extends Decoration{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof LineDecoration&&this.spec.class==e.spec.class&&attrsEq(this.spec.attributes,e.spec.attributes)}range(e,r=e){if(r!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,r)}}LineDecoration.prototype.mapMode=MapMode.TrackBefore;LineDecoration.prototype.point=!0;class PointDecoration extends Decoration{constructor(e,r,n,o,a,l){super(r,n,a,e),this.block=o,this.isReplace=l,this.mapMode=o?r<=0?MapMode.TrackBefore:MapMode.TrackAfter:MapMode.TrackDel}get type(){return this.startSide<this.endSide?BlockType.WidgetRange:this.startSide<=0?BlockType.WidgetBefore:BlockType.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof PointDecoration&&widgetsEq(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,r=e){if(this.isReplace&&(e>r||e==r&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&r!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,r)}}PointDecoration.prototype.point=!0;function getInclusive(s,e=!1){let{inclusiveStart:r,inclusiveEnd:n}=s;return r==null&&(r=s.inclusive),n==null&&(n=s.inclusive),{start:r??e,end:n??e}}function widgetsEq(s,e){return s==e||!!(s&&e&&s.compare(e))}function addRange(s,e,r,n=0){let o=r.length-1;o>=0&&r[o]+n>=s?r[o]=Math.max(r[o],e):r.push(s,e)}class LineView extends ContentView{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,r,n,o,a,l){if(n){if(!(n instanceof LineView))return!1;this.dom||n.transferDOM(this)}return o&&this.setDeco(n?n.attrs:null),mergeChildrenInto(this,e,r,n?n.children:[],a,l),!0}split(e){let r=new LineView;if(r.breakAfter=this.breakAfter,this.length==0)return r;let{i:n,off:o}=this.childPos(e);o&&(r.append(this.children[n].split(o),0),this.children[n].merge(o,this.children[n].length,null,!1,0,0),n++);for(let a=n;a<this.children.length;a++)r.append(this.children[a],0);for(;n>0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,r}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){attrsEq(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,r){joinInlineInto(this,e,r)}addLineDeco(e){let r=e.spec.attributes,n=e.spec.class;r&&(this.attrs=combineAttrs(r,this.attrs||{})),n&&(this.attrs=combineAttrs({class:n},this.attrs||{}))}domAtPos(e){return inlineDOMAtPos(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,r){var n;this.dom?this.flags&4&&(clearAttributes(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),this.prevAttrs!==void 0&&(updateAttrs(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,r);let o=this.dom.lastChild;for(;o&&ContentView.get(o)instanceof MarkView;)o=o.lastChild;if(!o||!this.length||o.nodeName!="BR"&&((n=ContentView.get(o))===null||n===void 0?void 0:n.isEditable)==!1&&(!browser.ios||!this.children.some(a=>a instanceof TextView))){let a=document.createElement("BR");a.cmIgnore=!0,this.dom.appendChild(a)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,r;for(let n of this.children){if(!(n instanceof TextView)||/[^ -~]/.test(n.text))return null;let o=clientRectsFor(n.dom);if(o.length!=1)return null;e+=o[0].width,r=o[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:r}:null}coordsAt(e,r){let n=coordsInChildren(this,e,r);if(!this.children.length&&n&&this.parent){let{heightOracle:o}=this.parent.view.viewState,a=n.bottom-n.top;if(Math.abs(a-o.lineHeight)<2&&o.textHeight<a){let l=(a-o.textHeight)/2;return{top:n.top+l,bottom:n.bottom-l,left:n.left,right:n.left}}}return n}become(e){return!1}get type(){return BlockType.Text}static find(e,r){for(let n=0,o=0;n<e.children.length;n++){let a=e.children[n],l=o+a.length;if(l>=r){if(a instanceof LineView)return a;if(l>r)break}o=l+a.breakAfter}return null}}class BlockWidgetView extends ContentView{constructor(e,r,n){super(),this.widget=e,this.length=r,this.type=n,this.breakAfter=0,this.prevWidget=null}merge(e,r,n,o,a,l){return n&&(!(n instanceof BlockWidgetView)||!this.widget.compare(n.widget)||e>0&&a<=0||r<this.length&&l<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-r),!0)}domAtPos(e){return e==0?DOMPos.before(this.dom):DOMPos.after(this.dom,e==this.length)}split(e){let r=this.length-e;this.length=e;let n=new BlockWidgetView(this.widget,r,this.type);return n.breakAfter=this.breakAfter,n}get children(){return noChildren}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Text.empty}domBoundsAround(){return null}become(e){return e instanceof BlockWidgetView&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.type=e.type,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,r){return this.widget.coordsAt(this.dom,e,r)}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class ContentBuilder{constructor(e,r,n,o){this.doc=e,this.pos=r,this.end=n,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=r}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!e.breakAfter&&!(e instanceof BlockWidgetView&&e.type==BlockType.WidgetBefore)}getLine(){return this.curLine||(this.content.push(this.curLine=new LineView),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(wrapMarks(new WidgetBufferView(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||this.getLine()}buildText(e,r,n){for(;e>0;){if(this.textOff==this.text.length){let{value:a,lineBreak:l,done:c}=this.cursor.next(this.skip);if(this.skip=0,c)throw new Error("Ran out of text content when drawing inline views");if(l){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,e--;continue}else this.text=a,this.textOff=0}let o=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(r.slice(r.length-n)),this.getLine().append(wrapMarks(new TextView(this.text.slice(this.textOff,this.textOff+o)),r),n),this.atCursorPos=!0,this.textOff+=o,e-=o,n=0}}span(e,r,n,o){this.buildText(r-e,n,o),this.pos=r,this.openStart<0&&(this.openStart=o)}point(e,r,n,o,a,l){if(this.disallowBlockEffectsFor[l]&&n instanceof PointDecoration){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(r>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let c=r-e;if(n instanceof PointDecoration)if(n.block){let{type:h}=n;h==BlockType.WidgetAfter&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new BlockWidgetView(n.widget||new NullWidget("div"),c,h))}else{let h=WidgetView.create(n.widget||new NullWidget("span"),c,c?0:n.startSide),f=this.atCursorPos&&!h.isEditable&&a<=o.length&&(e<r||n.startSide>0),d=!h.isEditable&&(e<r||a>o.length||n.startSide<=0),m=this.getLine();this.pendingBuffer==2&&!f&&!h.isEditable&&(this.pendingBuffer=0),this.flushBuffer(o),f&&(m.append(wrapMarks(new WidgetBufferView(1),o),a),a=o.length+Math.max(0,a-o.length)),m.append(wrapMarks(h,o),a),this.atCursorPos=d,this.pendingBuffer=d?e<r||a>o.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=o.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);c&&(this.textOff+c<=this.text.length?this.textOff+=c:(this.skip+=c-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=r),this.openStart<0&&(this.openStart=a)}static build(e,r,n,o,a){let l=new ContentBuilder(e,r,n,a);return l.openEnd=RangeSet.spans(o,r,n,l),l.openStart<0&&(l.openStart=l.openEnd),l.finish(l.openEnd),l}}function wrapMarks(s,e){for(let r of e)s=new MarkView(r,[s],s.length);return s}class NullWidget extends WidgetType{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}const clickAddsSelectionRange=Facet.define(),dragMovesSelection$1=Facet.define(),mouseSelectionStyle=Facet.define(),exceptionSink=Facet.define(),updateListener=Facet.define(),inputHandler$1=Facet.define(),focusChangeEffect=Facet.define(),perLineTextDirection=Facet.define({combine:s=>s.some(e=>e)}),nativeSelectionHidden=Facet.define({combine:s=>s.some(e=>e)});class ScrollTarget{constructor(e,r="nearest",n="nearest",o=5,a=5){this.range=e,this.y=r,this.x=n,this.yMargin=o,this.xMargin=a}map(e){return e.empty?this:new ScrollTarget(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const scrollIntoView$1=StateEffect.define({map:(s,e)=>s.map(e)});function logException(s,e,r){let n=s.facet(exceptionSink);n.length?n[0](e):window.onerror?window.onerror(String(e),r,void 0,void 0,e):r?console.error(r+":",e):console.error(e)}const editable=Facet.define({combine:s=>s.length?s[0]:!0});let nextPluginID=0;const viewPlugin=Facet.define();class ViewPlugin{constructor(e,r,n,o){this.id=e,this.create=r,this.domEventHandlers=n,this.extension=o(this)}static define(e,r){const{eventHandlers:n,provide:o,decorations:a}=r||{};return new ViewPlugin(nextPluginID++,e,n,l=>{let c=[viewPlugin.of(l)];return a&&c.push(decorations.of(h=>{let f=h.plugin(l);return f?a(f):Decoration.none})),o&&c.push(o(l)),c})}static fromClass(e,r){return ViewPlugin.define(n=>new e(n),r)}}class PluginInstance{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let r=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(r)}catch(n){if(logException(r.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(r){logException(e.state,r,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var r;if(!((r=this.value)===null||r===void 0)&&r.destroy)try{this.value.destroy()}catch(n){logException(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const editorAttributes=Facet.define(),contentAttributes=Facet.define(),decorations=Facet.define(),atomicRanges=Facet.define(),scrollMargins=Facet.define();function getScrollMargins(s){let e=0,r=0,n=0,o=0;for(let a of s.state.facet(scrollMargins)){let l=a(s);l&&(l.left!=null&&(e=Math.max(e,l.left)),l.right!=null&&(r=Math.max(r,l.right)),l.top!=null&&(n=Math.max(n,l.top)),l.bottom!=null&&(o=Math.max(o,l.bottom)))}return{left:e,right:r,top:n,bottom:o}}const styleModule=Facet.define();class ChangedRange{constructor(e,r,n,o){this.fromA=e,this.toA=r,this.fromB=n,this.toB=o}join(e){return new ChangedRange(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let r=e.length,n=this;for(;r>0;r--){let o=e[r-1];if(!(o.fromA>n.toA)){if(o.toA<n.fromA)break;n=n.join(o),e.splice(r-1,1)}}return e.splice(r,0,n),e}static extendWithRanges(e,r){if(r.length==0)return e;let n=[];for(let o=0,a=0,l=0,c=0;;o++){let h=o==e.length?null:e[o],f=l-c,d=h?h.fromB:1e9;for(;a<r.length&&r[a]<d;){let m=r[a],v=r[a+1],A=Math.max(c,m),T=Math.min(d,v);if(A<=T&&new ChangedRange(A+f,T+f,A,T).addToSet(n),v>d)break;a+=2}if(!h)return n;new ChangedRange(h.fromA,h.toA,h.fromB,h.toB).addToSet(n),l=h.toA,c=h.toB}}}class ViewUpdate{constructor(e,r,n){this.view=e,this.state=r,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=ChangeSet.empty(this.startState.doc.length);for(let a of n)this.changes=this.changes.compose(a.changes);let o=[];this.changes.iterChangedRanges((a,l,c,h)=>o.push(new ChangedRange(a,l,c,h))),this.changedRanges=o}static create(e,r,n){return new ViewUpdate(e,r,n)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}var Direction=function(s){return s[s.LTR=0]="LTR",s[s.RTL=1]="RTL",s}(Direction||(Direction={}));const LTR=Direction.LTR,RTL=Direction.RTL;function dec(s){let e=[];for(let r=0;r<s.length;r++)e.push(1<<+s[r]);return e}const LowTypes=dec("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),ArabicTypes=dec("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Brackets=Object.create(null),BracketStack=[];for(let s of["()","[]","{}"]){let e=s.charCodeAt(0),r=s.charCodeAt(1);Brackets[e]=r,Brackets[r]=-e}function charType(s){return s<=247?LowTypes[s]:1424<=s&&s<=1524?2:1536<=s&&s<=1785?ArabicTypes[s-1536]:1774<=s&&s<=2220?4:8192<=s&&s<=8203?256:64336<=s&&s<=65023?4:s==8204?256:1}const BidiRE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class BidiSpan{constructor(e,r,n){this.from=e,this.to=r,this.level=n}get dir(){return this.level%2?RTL:LTR}side(e,r){return this.dir==r==e?this.to:this.from}static find(e,r,n,o){let a=-1;for(let l=0;l<e.length;l++){let c=e[l];if(c.from<=r&&c.to>=r){if(c.level==n)return l;(a<0||(o!=0?o<0?c.from<r:c.to>r:e[a].level>c.level))&&(a=l)}}if(a<0)throw new RangeError("Index out of range");return a}}const types=[];function computeOrder(s,e){let r=s.length,n=e==LTR?1:2,o=e==LTR?2:1;if(!s||n==1&&!BidiRE.test(s))return trivialOrder(r);for(let l=0,c=n,h=n;l<r;l++){let f=charType(s.charCodeAt(l));f==512?f=c:f==8&&h==4&&(f=16),types[l]=f==4?2:f,f&7&&(h=f),c=f}for(let l=0,c=n,h=n;l<r;l++){let f=types[l];if(f==128)l<r-1&&c==types[l+1]&&c&24?f=types[l]=c:types[l]=256;else if(f==64){let d=l+1;for(;d<r&&types[d]==64;)d++;let m=l&&c==8||d<r&&types[d]==8?h==1?1:8:256;for(let v=l;v<d;v++)types[v]=m;l=d-1}else f==8&&h==1&&(types[l]=1);c=f,f&7&&(h=f)}for(let l=0,c=0,h=0,f,d,m;l<r;l++)if(d=Brackets[f=s.charCodeAt(l)])if(d<0){for(let v=c-3;v>=0;v-=3)if(BracketStack[v+1]==-d){let A=BracketStack[v+2],T=A&2?n:A&4?A&1?o:n:0;T&&(types[l]=types[BracketStack[v]]=T),c=v;break}}else{if(BracketStack.length==189)break;BracketStack[c++]=l,BracketStack[c++]=f,BracketStack[c++]=h}else if((m=types[l])==2||m==1){let v=m==n;h=v?0:1;for(let A=c-3;A>=0;A-=3){let T=BracketStack[A+2];if(T&2)break;if(v)BracketStack[A+2]|=2;else{if(T&4)break;BracketStack[A+2]|=4}}}for(let l=0;l<r;l++)if(types[l]==256){let c=l+1;for(;c<r&&types[c]==256;)c++;let h=(l?types[l-1]:n)==1,f=(c<r?types[c]:n)==1,d=h==f?h?1:2:n;for(let m=l;m<c;m++)types[m]=d;l=c-1}let a=[];if(n==1)for(let l=0;l<r;){let c=l,h=types[l++]!=1;for(;l<r&&h==(types[l]!=1);)l++;if(h)for(let f=l;f>c;){let d=f,m=types[--f]!=2;for(;f>c&&m==(types[f-1]!=2);)f--;a.push(new BidiSpan(f,d,m?2:1))}else a.push(new BidiSpan(c,l,0))}else for(let l=0;l<r;){let c=l,h=types[l++]==2;for(;l<r&&h==(types[l]==2);)l++;a.push(new BidiSpan(c,l,h?1:2))}return a}function trivialOrder(s){return[new BidiSpan(0,s,0)]}let movedOver="";function moveVisually(s,e,r,n,o){var a;let l=n.head-s.from,c=-1;if(l==0){if(!o||!s.length)return null;e[0].level!=r&&(l=e[0].side(!1,r),c=0)}else if(l==s.length){if(o)return null;let v=e[e.length-1];v.level!=r&&(l=v.side(!0,r),c=e.length-1)}c<0&&(c=BidiSpan.find(e,l,(a=n.bidiLevel)!==null&&a!==void 0?a:-1,n.assoc));let h=e[c];l==h.side(o,r)&&(h=e[c+=o?1:-1],l=h.side(!o,r));let f=o==(h.dir==r),d=findClusterBreak(s.text,l,f);if(movedOver=s.text.slice(Math.min(l,d),Math.max(l,d)),d!=h.side(o,r))return EditorSelection.cursor(d+s.from,f?-1:1,h.level);let m=c==(o?e.length-1:0)?null:e[c+(o?1:-1)];return!m&&h.level!=r?EditorSelection.cursor(o?s.to:s.from,o?-1:1,r):m&&m.level<h.level?EditorSelection.cursor(m.side(!o,r)+s.from,o?1:-1,m.level):EditorSelection.cursor(d+s.from,o?-1:1,h.level)}class DocView extends ContentView{constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[],this.hasComposition=null,this.markedForComposition=new Set,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new LineView],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ChangedRange(0,0,0,e.state.doc.length)],0,null)}get length(){return this.view.state.doc.length}update(e){let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:c,toA:h})=>h<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=this.view.inputState.composing<0?null:findCompositionRange(this.view,e.changes);if(this.hasComposition){this.markedForComposition.clear();let{from:c,to:h}=this.hasComposition;r=new ChangedRange(c,h,e.changes.mapPos(c,-1),e.changes.mapPos(h,1)).addToSet(r.slice())}this.hasComposition=n?{from:n.range.fromB,to:n.range.toB}:null,(browser.ie||browser.chrome)&&!n&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),l=findChangedDeco(o,a,e.changes);return r=ChangedRange.extendWithRanges(r,l),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,n),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,r,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,r,n);let{observer:o}=this.view;o.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let l=browser.chrome||browser.ios?{node:o.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,l),this.flags&=-8,l&&(l.written||o.selectionRange.focusNode!=l.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(l=>l.flags&=-9);let a=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let l of this.children)l instanceof BlockWidgetView&&l.widget instanceof BlockGapWidget&&a.push(l.dom);o.updateGaps(a)}updateChildren(e,r,n){let o=n?n.range.addToSet(e.slice()):e,a=this.childCursor(r);for(let l=o.length-1;;l--){let c=l>=0?o[l]:null;if(!c)break;let{fromA:h,toA:f,fromB:d,toB:m}=c,v,A,T,B;if(n&&n.range.fromB<m&&n.range.toB>d){let xe=ContentBuilder.build(this.view.state.doc,d,n.range.fromB,this.decorations,this.dynamicDecorationMap),Te=ContentBuilder.build(this.view.state.doc,n.range.toB,m,this.decorations,this.dynamicDecorationMap);A=xe.breakAtStart,T=xe.openStart,B=Te.openEnd;let Le=this.compositionView(n);Te.breakAtStart?Le.breakAfter=1:Te.content.length&&Le.merge(Le.length,Le.length,Te.content[0],!1,Te.openStart,0)&&(Le.breakAfter=Te.content[0].breakAfter,Te.content.shift()),xe.content.length&&Le.merge(0,0,xe.content[xe.content.length-1],!0,0,xe.openEnd)&&xe.content.pop(),v=xe.content.concat(Le).concat(Te.content)}else({content:v,breakAtStart:A,openStart:T,openEnd:B}=ContentBuilder.build(this.view.state.doc,d,m,this.decorations,this.dynamicDecorationMap));let{i:Y,off:F}=a.findPos(f,1),{i:ke,off:Qe}=a.findPos(h,-1);replaceRange(this,ke,Qe,Y,F,v,A,T,B)}n&&this.fixCompositionDOM(n)}compositionView(e){let r=new TextView(e.text.nodeValue);r.flags|=8;for(let{deco:o}of e.marks)r=new MarkView(o,[r],r.length);let n=new LineView;return n.append(r,0),n}fixCompositionDOM(e){let r=(a,l)=>{l.flags|=8,this.markedForComposition.add(l);let c=ContentView.get(a);c!=l&&(c&&(c.dom=null),l.setDOM(a))},n=this.childPos(e.range.fromB,1),o=this.children[n.i];r(e.line,o);for(let a=e.marks.length-1;a>=-1;a--)n=o.childPos(n.off,1),o=o.children[n.i],r(a>=0?e.marks[a].node:e.text,o)}updateSelection(e=!1,r=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,o=n==this.dom,a=!o&&hasSelection(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(o||r||a))return;let l=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,h=this.domAtPos(c.anchor),f=c.empty?h:this.domAtPos(c.head);if(browser.gecko&&c.empty&&!this.hasComposition&&betweenUneditable(h)){let m=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(m,h.node.childNodes[h.offset]||null)),h=f=new DOMPos(m,0),l=!0}let d=this.view.observer.selectionRange;(l||!d.focusNode||!isEquivalentPosition(h.node,h.offset,d.anchorNode,d.anchorOffset)||!isEquivalentPosition(f.node,f.offset,d.focusNode,d.focusOffset))&&(this.view.observer.ignore(()=>{browser.android&&browser.chrome&&this.dom.contains(d.focusNode)&&inUneditable(d.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let m=getSelection(this.view.root);if(m)if(c.empty){if(browser.gecko){let v=nextToUneditable(h.node,h.offset);if(v&&v!=3){let A=nearbyTextNode(h.node,h.offset,v==1?1:-1);A&&(h=new DOMPos(A,v==1?0:A.nodeValue.length))}}m.collapse(h.node,h.offset),c.bidiLevel!=null&&d.cursorBidiLevel!=null&&(d.cursorBidiLevel=c.bidiLevel)}else if(m.extend){m.collapse(h.node,h.offset);try{m.extend(f.node,f.offset)}catch{}}else{let v=document.createRange();c.anchor>c.head&&([h,f]=[f,h]),v.setEnd(f.node,f.offset),v.setStart(h.node,h.offset),m.removeAllRanges(),m.addRange(v)}a&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(h,f)),this.impreciseAnchor=h.precise?null:new DOMPos(d.anchorNode,d.anchorOffset),this.impreciseHead=f.precise?null:new DOMPos(d.focusNode,d.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,r=e.state.selection.main,n=getSelection(e.root),{anchorNode:o,anchorOffset:a}=e.observer.selectionRange;if(!n||!r.empty||!r.assoc||!n.modify)return;let l=LineView.find(this,r.head);if(!l)return;let c=l.posAtStart;if(r.head==c||r.head==c+l.length)return;let h=this.coordsAt(r.head,-1),f=this.coordsAt(r.head,1);if(!h||!f||h.bottom>f.top)return;let d=this.domAtPos(r.head+r.assoc);n.collapse(d.node,d.offset),n.modify("move",r.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let m=e.observer.selectionRange;e.docView.posFromDOM(m.anchorNode,m.anchorOffset)!=r.from&&n.collapse(o,a)}nearest(e){for(let r=e;r;){let n=ContentView.get(r);if(n&&n.rootView==this)return n;r=r.parentNode}return null}posFromDOM(e,r){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,r)+n.posAtStart}domAtPos(e){let{i:r,off:n}=this.childCursor().findPos(e,-1);for(;r<this.children.length-1;){let o=this.children[r];if(n<o.length||o instanceof LineView)break;r++,n=0}return this.children[r].domAtPos(n)}coordsAt(e,r){for(let n=this.length,o=this.children.length-1;;o--){let a=this.children[o],l=n-a.breakAfter-a.length;if(e>l||e==l&&a.type!=BlockType.WidgetBefore&&a.type!=BlockType.WidgetAfter&&(!o||r==2||this.children[o-1].breakAfter||this.children[o-1].type==BlockType.WidgetBefore&&r>-2))return a.coordsAt(e-l,r);n=l}}coordsForChar(e){let{i:r,off:n}=this.childPos(e,1),o=this.children[r];if(!(o instanceof LineView))return null;for(;o.children.length;){let{i:c,off:h}=o.childPos(n,1);for(;;c++){if(c==o.children.length)return null;if((o=o.children[c]).length)break}n=h}if(!(o instanceof TextView))return null;let a=findClusterBreak(o.text,n);if(a==n)return null;let l=textRange(o.dom,n,a).getClientRects();return!l.length||l[0].top>=l[0].bottom?null:l[0]}measureVisibleLineHeights(e){let r=[],{from:n,to:o}=e,a=this.view.contentDOM.clientWidth,l=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,h=this.view.textDirection==Direction.LTR;for(let f=0,d=0;d<this.children.length;d++){let m=this.children[d],v=f+m.length;if(v>o)break;if(f>=n){let A=m.dom.getBoundingClientRect();if(r.push(A.height),l){let T=m.dom.lastChild,B=T?clientRectsFor(T):[];if(B.length){let Y=B[B.length-1],F=h?Y.right-A.left:A.right-Y.left;F>c&&(c=F,this.minWidth=a,this.minWidthFrom=f,this.minWidthTo=v)}}}f=v+m.breakAfter}return r}textDirectionAt(e){let{i:r}=this.childPos(e,1);return getComputedStyle(this.children[r].dom).direction=="rtl"?Direction.RTL:Direction.LTR}measureTextSize(){for(let a of this.children)if(a instanceof LineView){let l=a.measureTextSize();if(l)return l}let e=document.createElement("div"),r,n,o;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let a=clientRectsFor(e.firstChild)[0];r=e.getBoundingClientRect().height,n=a?a.width/27:7,o=a?a.height:r,e.remove()}),{lineHeight:r,charWidth:n,textHeight:o}}childCursor(e=this.length){let r=this.children.length;return r&&(e-=this.children[--r].length),new ChildCursor(this.children,e,r)}computeBlockGapDeco(){let e=[],r=this.view.viewState;for(let n=0,o=0;;o++){let a=o==r.viewports.length?null:r.viewports[o],l=a?a.from-1:this.length;if(l>n){let c=r.lineBlockAt(l).bottom-r.lineBlockAt(n).top;e.push(Decoration.replace({widget:new BlockGapWidget(c),block:!0,inclusive:!0,isBlockGap:!0}).range(n,l))}if(!a)break;n=a.to+1}return Decoration.set(e)}updateDeco(){let e=this.view.state.facet(decorations).map((r,n)=>(this.dynamicDecorationMap[n]=typeof r=="function")?r(this.view):r);for(let r=e.length;r<e.length+3;r++)this.dynamicDecorationMap[r]=!1;return this.decorations=[...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollIntoView(e){let{range:r}=e,n=this.coordsAt(r.head,r.empty?r.assoc:r.head>r.anchor?-1:1),o;if(!n)return;!r.empty&&(o=this.coordsAt(r.anchor,r.anchor>r.head?-1:1))&&(n={left:Math.min(n.left,o.left),top:Math.min(n.top,o.top),right:Math.max(n.right,o.right),bottom:Math.max(n.bottom,o.bottom)});let a=getScrollMargins(this.view),l={left:n.left-a.left,top:n.top-a.top,right:n.right+a.right,bottom:n.bottom+a.bottom};scrollRectIntoView(this.view.scrollDOM,l,r.head<r.anchor?-1:1,e.x,e.y,e.xMargin,e.yMargin,this.view.textDirection==Direction.LTR)}}function betweenUneditable(s){return s.node.nodeType==1&&s.node.firstChild&&(s.offset==0||s.node.childNodes[s.offset-1].contentEditable=="false")&&(s.offset==s.node.childNodes.length||s.node.childNodes[s.offset].contentEditable=="false")}class BlockGapWidget extends WidgetType{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}}function findCompositionNode(s){let e=s.observer.selectionRange,r=e.focusNode&&nearbyTextNode(e.focusNode,e.focusOffset,0);if(!r)return null;let n=ContentView.get(r),o,a;if(n instanceof TextView)o=n.posAtStart,a=o+n.length;else e:for(let l=0,c=r;;){for(let f=c.previousSibling,d;f;f=f.previousSibling){if(d=ContentView.get(f)){o=a=d.posAtEnd+l;break e}let m=new DOMReader([],s.state);if(m.readNode(f),m.text.indexOf(LineBreakPlaceholder)>-1)return null;l+=m.text.length}if(c=c.parentNode,!c)return null;let h=ContentView.get(c);if(h){o=a=h.posAtStart+l;break}}return{from:o,to:a,node:r}}function findCompositionRange(s,e){let r=findCompositionNode(s);if(!r)return null;let{from:n,to:o,node:a}=r,l=e.mapPos(n,-1),c=e.mapPos(o,1),h=a.nodeValue;if(/[\n\r]/.test(h))return null;if(c-l!=h.length){let v=e.mapPos(n,1),A=e.mapPos(o,-1);if(A-v==h.length)l=v,c=A;else if(s.state.doc.sliceString(c-h.length,c)==h)l=c-h.length;else if(s.state.doc.sliceString(l,l+h.length)==h)c=l+h.length;else return null}let{main:f}=s.state.selection;if(s.state.doc.sliceString(l,c)!=h||l>f.head||c<f.head)return null;let d=[],m=new ChangedRange(n,o,l,c);for(let v=a.parentNode;;v=v.parentNode){let A=ContentView.get(v);if(A instanceof MarkView)d.push({node:v,deco:A.mark});else{if(A instanceof LineView||v.nodeName=="DIV"&&v.parentNode==s.contentDOM)return{range:m,text:a,marks:d,line:v};if(v!=s.contentDOM)d.push({node:v,deco:new MarkDecoration({inclusive:!0,attributes:getAttrs$1(v),tagName:v.tagName.toLowerCase()})});else return null}}}function nearbyTextNode(s,e,r){if(r<=0)for(let n=s,o=e;;){if(n.nodeType==3)return n;if(n.nodeType==1&&o>0)n=n.childNodes[o-1],o=maxOffset(n);else break}if(r>=0)for(let n=s,o=e;;){if(n.nodeType==3)return n;if(n.nodeType==1&&o<n.childNodes.length&&r>=0)n=n.childNodes[o],o=0;else break}return null}function nextToUneditable(s,e){return s.nodeType!=1?0:(e&&s.childNodes[e-1].contentEditable=="false"?1:0)|(e<s.childNodes.length&&s.childNodes[e].contentEditable=="false"?2:0)}class DecorationComparator$1{constructor(){this.changes=[]}compareRange(e,r){addRange(e,r,this.changes)}comparePoint(e,r){addRange(e,r,this.changes)}}function findChangedDeco(s,e,r){let n=new DecorationComparator$1;return RangeSet.compare(s,e,r,n),n.changes}function inUneditable(s,e){for(let r=s;r&&r!=e;r=r.assignedSlot||r.parentNode)if(r.nodeType==1&&r.contentEditable=="false")return!0;return!1}function groupAt(s,e,r=1){let n=s.charCategorizer(e),o=s.doc.lineAt(e),a=e-o.from;if(o.length==0)return EditorSelection.cursor(e);a==0?r=1:a==o.length&&(r=-1);let l=a,c=a;r<0?l=findClusterBreak(o.text,a,!1):c=findClusterBreak(o.text,a);let h=n(o.text.slice(l,c));for(;l>0;){let f=findClusterBreak(o.text,l,!1);if(n(o.text.slice(f,l))!=h)break;l=f}for(;c<o.length;){let f=findClusterBreak(o.text,c);if(n(o.text.slice(c,f))!=h)break;c=f}return EditorSelection.range(l+o.from,c+o.from)}function getdx(s,e){return e.left>s?e.left-s:Math.max(0,s-e.right)}function getdy(s,e){return e.top>s?e.top-s:Math.max(0,s-e.bottom)}function yOverlap(s,e){return s.top<e.bottom-1&&s.bottom>e.top+1}function upTop(s,e){return e<s.top?{top:e,left:s.left,right:s.right,bottom:s.bottom}:s}function upBot(s,e){return e>s.bottom?{top:s.top,left:s.left,right:s.right,bottom:e}:s}function domPosAtCoords(s,e,r){let n,o,a,l,c=!1,h,f,d,m;for(let T=s.firstChild;T;T=T.nextSibling){let B=clientRectsFor(T);for(let Y=0;Y<B.length;Y++){let F=B[Y];o&&yOverlap(o,F)&&(F=upTop(upBot(F,o.bottom),o.top));let ke=getdx(e,F),Qe=getdy(r,F);if(ke==0&&Qe==0)return T.nodeType==3?domPosInText(T,e,r):domPosAtCoords(T,e,r);if(!n||l>Qe||l==Qe&&a>ke){n=T,o=F,a=ke,l=Qe;let xe=Qe?r<F.top?-1:1:ke?e<F.left?-1:1:0;c=!xe||(xe>0?Y<B.length-1:Y>0)}ke==0?r>F.bottom&&(!d||d.bottom<F.bottom)?(h=T,d=F):r<F.top&&(!m||m.top>F.top)&&(f=T,m=F):d&&yOverlap(d,F)?d=upBot(d,F.bottom):m&&yOverlap(m,F)&&(m=upTop(m,F.top))}}if(d&&d.bottom>=r?(n=h,o=d):m&&m.top<=r&&(n=f,o=m),!n)return{node:s,offset:0};let v=Math.max(o.left,Math.min(o.right,e));if(n.nodeType==3)return domPosInText(n,v,r);if(c&&n.contentEditable!="false")return domPosAtCoords(n,v,r);let A=Array.prototype.indexOf.call(s.childNodes,n)+(e>=(o.left+o.right)/2?1:0);return{node:s,offset:A}}function domPosInText(s,e,r){let n=s.nodeValue.length,o=-1,a=1e9,l=0;for(let c=0;c<n;c++){let h=textRange(s,c,c+1).getClientRects();for(let f=0;f<h.length;f++){let d=h[f];if(d.top==d.bottom)continue;l||(l=e-d.left);let m=(d.top>r?d.top-r:r-d.bottom)-1;if(d.left-1<=e&&d.right+1>=e&&m<a){let v=e>=(d.left+d.right)/2,A=v;if((browser.chrome||browser.gecko)&&textRange(s,c).getBoundingClientRect().left==d.right&&(A=!v),m<=0)return{node:s,offset:c+(A?1:0)};o=c+(A?1:0),a=m}}}return{node:s,offset:o>-1?o:l>0?s.nodeValue.length:0}}function posAtCoords(s,e,r,n=-1){var o,a;let l=s.contentDOM.getBoundingClientRect(),c=l.top+s.viewState.paddingTop,h,{docHeight:f}=s.viewState,{x:d,y:m}=e,v=m-c;if(v<0)return 0;if(v>f)return s.state.doc.length;for(let xe=s.viewState.heightOracle.textHeight/2,Te=!1;h=s.elementAtHeight(v),h.type!=BlockType.Text;)for(;v=n>0?h.bottom+xe:h.top-xe,!(v>=0&&v<=f);){if(Te)return r?null:0;Te=!0,n=-n}m=c+v;let A=h.from;if(A<s.viewport.from)return s.viewport.from==0?0:r?null:posAtCoordsImprecise(s,l,h,d,m);if(A>s.viewport.to)return s.viewport.to==s.state.doc.length?s.state.doc.length:r?null:posAtCoordsImprecise(s,l,h,d,m);let T=s.dom.ownerDocument,B=s.root.elementFromPoint?s.root:T,Y=B.elementFromPoint(d,m);Y&&!s.contentDOM.contains(Y)&&(Y=null),Y||(d=Math.max(l.left+1,Math.min(l.right-1,d)),Y=B.elementFromPoint(d,m),Y&&!s.contentDOM.contains(Y)&&(Y=null));let F,ke=-1;if(Y&&((o=s.docView.nearest(Y))===null||o===void 0?void 0:o.isEditable)!=!1){if(T.caretPositionFromPoint){let xe=T.caretPositionFromPoint(d,m);xe&&({offsetNode:F,offset:ke}=xe)}else if(T.caretRangeFromPoint){let xe=T.caretRangeFromPoint(d,m);xe&&({startContainer:F,startOffset:ke}=xe,(!s.contentDOM.contains(F)||browser.safari&&isSuspiciousSafariCaretResult(F,ke,d)||browser.chrome&&isSuspiciousChromeCaretResult(F,ke,d))&&(F=void 0))}}if(!F||!s.docView.dom.contains(F)){let xe=LineView.find(s.docView,A);if(!xe)return v>h.top+h.height/2?h.to:h.from;({node:F,offset:ke}=domPosAtCoords(xe.dom,d,m))}let Qe=s.docView.nearest(F);if(!Qe)return null;if(Qe.isWidget&&((a=Qe.dom)===null||a===void 0?void 0:a.nodeType)==1){let xe=Qe.dom.getBoundingClientRect();return e.y<xe.top||e.y<=xe.bottom&&e.x<=(xe.left+xe.right)/2?Qe.posAtStart:Qe.posAtEnd}else return Qe.localPosFromDOM(F,ke)+Qe.posAtStart}function posAtCoordsImprecise(s,e,r,n,o){let a=Math.round((n-e.left)*s.defaultCharacterWidth);if(s.lineWrapping&&r.height>s.defaultLineHeight*1.5){let c=s.viewState.heightOracle.textHeight,h=Math.floor((o-r.top-(s.defaultLineHeight-c)*.5)/c);a+=h*s.viewState.heightOracle.lineLength}let l=s.state.sliceDoc(r.from,r.to);return r.from+findColumn(l,a,s.state.tabSize)}function isSuspiciousSafariCaretResult(s,e,r){let n;if(s.nodeType!=3||e!=(n=s.nodeValue.length))return!1;for(let o=s.nextSibling;o;o=o.nextSibling)if(o.nodeType!=1||o.nodeName!="BR")return!1;return textRange(s,n-1,n).getBoundingClientRect().left>r}function isSuspiciousChromeCaretResult(s,e,r){if(e!=0)return!1;for(let o=s;;){let a=o.parentNode;if(!a||a.nodeType!=1||a.firstChild!=o)return!1;if(a.classList.contains("cm-line"))break;o=a}let n=s.nodeType==1?s.getBoundingClientRect():textRange(s,0,Math.max(s.nodeValue.length,1)).getBoundingClientRect();return r-n.left>5}function blockAt(s,e){let r=s.lineBlockAt(e);if(Array.isArray(r.type)){for(let n of r.type)if(n.to>e||n.to==e&&(n.to==r.to||n.type==BlockType.Text))return n}return r}function moveToLineBoundary(s,e,r,n){let o=blockAt(s,e.head),a=!n||o.type!=BlockType.Text||!(s.lineWrapping||o.widgetLineBreaks)?null:s.coordsAtPos(e.assoc<0&&e.head>o.from?e.head-1:e.head);if(a){let l=s.dom.getBoundingClientRect(),c=s.textDirectionAt(o.from),h=s.posAtCoords({x:r==(c==Direction.LTR)?l.right-1:l.left+1,y:(a.top+a.bottom)/2});if(h!=null)return EditorSelection.cursor(h,r?-1:1)}return EditorSelection.cursor(r?o.to:o.from,r?-1:1)}function moveByChar(s,e,r,n){let o=s.state.doc.lineAt(e.head),a=s.bidiSpans(o),l=s.textDirectionAt(o.from);for(let c=e,h=null;;){let f=moveVisually(o,a,l,c,r),d=movedOver;if(!f){if(o.number==(r?s.state.doc.lines:1))return c;d=`
|
||
`,o=s.state.doc.line(o.number+(r?1:-1)),a=s.bidiSpans(o),f=EditorSelection.cursor(r?o.from:o.to)}if(h){if(!h(d))return c}else{if(!n)return f;h=n(d)}c=f}}function byGroup(s,e,r){let n=s.state.charCategorizer(e),o=n(r);return a=>{let l=n(a);return o==CharCategory.Space&&(o=l),o==l}}function moveVertically(s,e,r,n){let o=e.head,a=r?1:-1;if(o==(r?s.state.doc.length:0))return EditorSelection.cursor(o,e.assoc);let l=e.goalColumn,c,h=s.contentDOM.getBoundingClientRect(),f=s.coordsAtPos(o),d=s.documentTop;if(f)l==null&&(l=f.left-h.left),c=a<0?f.top:f.bottom;else{let A=s.viewState.lineBlockAt(o);l==null&&(l=Math.min(h.right-h.left,s.defaultCharacterWidth*(o-A.from))),c=(a<0?A.top:A.bottom)+d}let m=h.left+l,v=n??s.viewState.heightOracle.textHeight>>1;for(let A=0;;A+=10){let T=c+(v+A)*a,B=posAtCoords(s,{x:m,y:T},!1,a);if(T<h.top||T>h.bottom||(a<0?B<o:B>o))return EditorSelection.cursor(B,e.assoc,void 0,l)}}function skipAtomicRanges(s,e,r){for(;;){let n=0;for(let o of s)o.between(e-1,e+1,(a,l,c)=>{if(e>a&&e<l){let h=n||r||(e-a<l-e?-1:1);e=h<0?a:l,n=h}});if(!n)return e}}function skipAtoms(s,e,r){let n=skipAtomicRanges(s.state.facet(atomicRanges).map(o=>o(s)),r.from,e.head>r.from?-1:1);return n==r.from?r:EditorSelection.cursor(n,n<r.from?1:-1)}class InputState{constructor(e){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;let r=(n,o)=>{this.ignoreDuringComposition(o)||o.type=="keydown"&&this.keydown(e,o)||(this.mustFlushObserver(o)&&e.observer.forceFlush(),this.runCustomHandlers(o.type,e,o)?o.preventDefault():n(e,o))};for(let n in handlers){let o=handlers[n];e.contentDOM.addEventListener(n,a=>{eventBelongsToEditor(e,a)&&r(o,a)},handlerOptions[n]),this.registeredEvents.push(n)}e.scrollDOM.addEventListener("mousedown",n=>{if(n.target==e.scrollDOM&&n.clientY>e.contentDOM.getBoundingClientRect().bottom&&(r(handlers.mousedown,n),!n.defaultPrevented&&n.button==2)){let o=e.contentDOM.style.minHeight;e.contentDOM.style.minHeight="100%",setTimeout(()=>e.contentDOM.style.minHeight=o,200)}}),e.scrollDOM.addEventListener("drop",n=>{n.target==e.scrollDOM&&n.clientY>e.contentDOM.getBoundingClientRect().bottom&&r(handlers.drop,n)}),browser.chrome&&browser.chrome_version==102&&e.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,browser.safari&&e.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}ensureHandlers(e,r){var n;let o;this.customHandlers=[];for(let a of r)if(o=(n=a.update(e).spec)===null||n===void 0?void 0:n.domEventHandlers){this.customHandlers.push({plugin:a.value,handlers:o});for(let l in o)this.registeredEvents.indexOf(l)<0&&l!="scroll"&&(this.registeredEvents.push(l),e.contentDOM.addEventListener(l,c=>{eventBelongsToEditor(e,c)&&this.runCustomHandlers(l,e,c)&&c.preventDefault()}))}}runCustomHandlers(e,r,n){for(let o of this.customHandlers){let a=o.handlers[e];if(a)try{if(a.call(o.plugin,n,r)||n.defaultPrevented)return!0}catch(l){logException(r.state,l)}}return!1}runScrollHandlers(e,r){this.lastScrollTop=e.scrollDOM.scrollTop,this.lastScrollLeft=e.scrollDOM.scrollLeft;for(let n of this.customHandlers){let o=n.handlers.scroll;if(o)try{o.call(n.plugin,r,e)}catch(a){logException(e.state,a)}}}keydown(e,r){if(this.lastKeyCode=r.keyCode,this.lastKeyTime=Date.now(),r.keyCode==9&&Date.now()<this.lastEscPress+2e3)return!0;if(r.keyCode!=27&&modifierCodes.indexOf(r.keyCode)<0&&(e.inputState.lastEscPress=0),browser.android&&browser.chrome&&!r.synthetic&&(r.keyCode==13||r.keyCode==8))return e.observer.delayAndroidKey(r.key,r.keyCode),!0;let n;return browser.ios&&!r.synthetic&&!r.altKey&&!r.metaKey&&((n=PendingKeys.find(o=>o.keyCode==r.keyCode))&&!r.ctrlKey||EmacsyPendingKeys.indexOf(r.key)>-1&&r.ctrlKey&&!r.shiftKey)?(this.pendingIOSKey=n||r,setTimeout(()=>this.flushIOSKey(e),250),!0):!1}flushIOSKey(e){let r=this.pendingIOSKey;return r?(this.pendingIOSKey=void 0,dispatchKey(e.contentDOM,r.key,r.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:browser.safari&&!browser.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}mustFlushObserver(e){return e.type=="keydown"&&e.keyCode!=229}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const PendingKeys=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],EmacsyPendingKeys="dthko",modifierCodes=[16,17,18,20,91,92,224,225],dragScrollMargin=6;function dragScrollSpeed(s){return Math.max(0,s)*.7+8}function dist(s,e){return Math.max(Math.abs(s.clientX-e.clientX),Math.abs(s.clientY-e.clientY))}class MouseSelection{constructor(e,r,n,o){this.view=e,this.startEvent=r,this.style=n,this.mustSelect=o,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=r,this.scrollParent=scrollableParent(e.contentDOM),this.atoms=e.state.facet(atomicRanges).map(l=>l(e));let a=e.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=r.shiftKey,this.multiple=e.state.facet(EditorState.allowMultipleSelections)&&addsSelectionRange(e,r),this.dragging=isInPrimarySelection(e,r)&&getClickType(r)==1?null:!1}start(e){this.dragging===!1&&(e.preventDefault(),this.select(e))}move(e){var r;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&dist(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,o=0,a=((r=this.scrollParent)===null||r===void 0?void 0:r.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},l=getScrollMargins(this.view);e.clientX-l.left<=a.left+dragScrollMargin?n=-dragScrollSpeed(a.left-e.clientX):e.clientX+l.right>=a.right-dragScrollMargin&&(n=dragScrollSpeed(e.clientX-a.right)),e.clientY-l.top<=a.top+dragScrollMargin?o=-dragScrollSpeed(a.top-e.clientY):e.clientY+l.bottom>=a.bottom-dragScrollMargin&&(o=dragScrollSpeed(e.clientY-a.bottom)),this.setScrollSpeed(n,o)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}setScrollSpeed(e,r){this.scrollSpeed={x:e,y:r},e||r?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let r=null;for(let n=0;n<e.ranges.length;n++){let o=e.ranges[n],a=null;if(o.empty){let l=skipAtomicRanges(this.atoms,o.from,0);l!=o.from&&(a=EditorSelection.cursor(l,-1))}else{let l=skipAtomicRanges(this.atoms,o.from,-1),c=skipAtomicRanges(this.atoms,o.to,1);(l!=o.from||c!=o.to)&&(a=EditorSelection.range(o.from==o.anchor?l:c,o.from==o.head?l:c))}a&&(r||(r=e.ranges.slice()),r[n]=a)}return r?EditorSelection.create(r,e.mainIndex):e}select(e){let{view:r}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(r.state.selection)||n.main.assoc!=r.state.selection.main.assoc&&this.dragging===!1)&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.docChanged&&this.dragging&&(this.dragging=this.dragging.map(e.changes)),this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function addsSelectionRange(s,e){let r=s.state.facet(clickAddsSelectionRange);return r.length?r[0](e):browser.mac?e.metaKey:e.ctrlKey}function dragMovesSelection(s,e){let r=s.state.facet(dragMovesSelection$1);return r.length?r[0](e):browser.mac?!e.altKey:!e.ctrlKey}function isInPrimarySelection(s,e){let{main:r}=s.state.selection;if(r.empty)return!1;let n=getSelection(s.root);if(!n||n.rangeCount==0)return!0;let o=n.getRangeAt(0).getClientRects();for(let a=0;a<o.length;a++){let l=o[a];if(l.left<=e.clientX&&l.right>=e.clientX&&l.top<=e.clientY&&l.bottom>=e.clientY)return!0}return!1}function eventBelongsToEditor(s,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let r=e.target,n;r!=s.contentDOM;r=r.parentNode)if(!r||r.nodeType==11||(n=ContentView.get(r))&&n.ignoreEvent(e))return!1;return!0}const handlers=Object.create(null),handlerOptions=Object.create(null),brokenClipboardAPI=browser.ie&&browser.ie_version<15||browser.ios&&browser.webkit_version<604;function capturePaste(s){let e=s.dom.parentNode;if(!e)return;let r=e.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(()=>{s.focus(),r.remove(),doPaste(s,r.value)},50)}function doPaste(s,e){let{state:r}=s,n,o=1,a=r.toText(e),l=a.lines==r.selection.ranges.length;if(lastLinewiseCopy!=null&&r.selection.ranges.every(h=>h.empty)&&lastLinewiseCopy==a.toString()){let h=-1;n=r.changeByRange(f=>{let d=r.doc.lineAt(f.from);if(d.from==h)return{range:f};h=d.from;let m=r.toText((l?a.line(o++).text:e)+r.lineBreak);return{changes:{from:d.from,insert:m},range:EditorSelection.cursor(f.from+m.length)}})}else l?n=r.changeByRange(h=>{let f=a.line(o++);return{changes:{from:h.from,to:h.to,insert:f.text},range:EditorSelection.cursor(h.from+f.length)}}):n=r.replaceSelection(a);s.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}handlers.keydown=(s,e)=>{s.inputState.setSelectionOrigin("select"),e.keyCode==27&&(s.inputState.lastEscPress=Date.now())};handlers.touchstart=(s,e)=>{s.inputState.lastTouchTime=Date.now(),s.inputState.setSelectionOrigin("select.pointer")};handlers.touchmove=s=>{s.inputState.setSelectionOrigin("select.pointer")};handlerOptions.touchstart=handlerOptions.touchmove={passive:!0};handlers.mousedown=(s,e)=>{if(s.observer.flush(),s.inputState.lastTouchTime>Date.now()-2e3)return;let r=null;for(let n of s.state.facet(mouseSelectionStyle))if(r=n(s,e),r)break;if(!r&&e.button==0&&(r=basicMouseSelection(s,e)),r){let n=!s.hasFocus;s.inputState.startMouseSelection(new MouseSelection(s,e,r,n)),n&&s.observer.ignore(()=>focusPreventScroll(s.contentDOM)),s.inputState.mouseSelection&&s.inputState.mouseSelection.start(e)}};function rangeForClick(s,e,r,n){if(n==1)return EditorSelection.cursor(e,r);if(n==2)return groupAt(s.state,e,r);{let o=LineView.find(s.docView,e),a=s.state.doc.lineAt(o?o.posAtEnd:e),l=o?o.posAtStart:a.from,c=o?o.posAtEnd:a.to;return c<s.state.doc.length&&c==a.to&&c++,EditorSelection.range(l,c)}}let insideY=(s,e)=>s>=e.top&&s<=e.bottom,inside=(s,e,r)=>insideY(e,r)&&s>=r.left&&s<=r.right;function findPositionSide(s,e,r,n){let o=LineView.find(s.docView,e);if(!o)return 1;let a=e-o.posAtStart;if(a==0)return 1;if(a==o.length)return-1;let l=o.coordsAt(a,-1);if(l&&inside(r,n,l))return-1;let c=o.coordsAt(a,1);return c&&inside(r,n,c)?1:l&&insideY(n,l)?-1:1}function queryPos(s,e){let r=s.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:r,bias:findPositionSide(s,r,e.clientX,e.clientY)}}const BadMouseDetail=browser.ie&&browser.ie_version<=11;let lastMouseDown=null,lastMouseDownCount=0,lastMouseDownTime=0;function getClickType(s){if(!BadMouseDetail)return s.detail;let e=lastMouseDown,r=lastMouseDownTime;return lastMouseDown=s,lastMouseDownTime=Date.now(),lastMouseDownCount=!e||r>Date.now()-400&&Math.abs(e.clientX-s.clientX)<2&&Math.abs(e.clientY-s.clientY)<2?(lastMouseDownCount+1)%3:1}function basicMouseSelection(s,e){let r=queryPos(s,e),n=getClickType(e),o=s.state.selection;return{update(a){a.docChanged&&(r.pos=a.changes.mapPos(r.pos),o=o.map(a.changes))},get(a,l,c){let h=queryPos(s,a),f,d=rangeForClick(s,h.pos,h.bias,n);if(r.pos!=h.pos&&!l){let m=rangeForClick(s,r.pos,r.bias,n),v=Math.min(m.from,d.from),A=Math.max(m.to,d.to);d=v<d.from?EditorSelection.range(v,A):EditorSelection.range(A,v)}return l?o.replaceRange(o.main.extend(d.from,d.to)):c&&n==1&&o.ranges.length>1&&(f=removeRangeAround(o,h.pos))?f:c?o.addRange(d):EditorSelection.create([d])}}}function removeRangeAround(s,e){for(let r=0;r<s.ranges.length;r++){let{from:n,to:o}=s.ranges[r];if(n<=e&&o>=e)return EditorSelection.create(s.ranges.slice(0,r).concat(s.ranges.slice(r+1)),s.mainIndex==r?0:s.mainIndex-(s.mainIndex>r?1:0))}return null}handlers.dragstart=(s,e)=>{let{selection:{main:r}}=s.state,{mouseSelection:n}=s.inputState;n&&(n.dragging=r),e.dataTransfer&&(e.dataTransfer.setData("Text",s.state.sliceDoc(r.from,r.to)),e.dataTransfer.effectAllowed="copyMove")};function dropText(s,e,r,n){if(!r)return;let o=s.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:a}=s.inputState,l=n&&a&&a.dragging&&dragMovesSelection(s,e)?{from:a.dragging.from,to:a.dragging.to}:null,c={from:o,insert:r},h=s.state.changes(l?[l,c]:c);s.focus(),s.dispatch({changes:h,selection:{anchor:h.mapPos(o,-1),head:h.mapPos(o,1)},userEvent:l?"move.drop":"input.drop"})}handlers.drop=(s,e)=>{if(!e.dataTransfer)return;if(s.state.readOnly)return e.preventDefault();let r=e.dataTransfer.files;if(r&&r.length){e.preventDefault();let n=Array(r.length),o=0,a=()=>{++o==r.length&&dropText(s,e,n.filter(l=>l!=null).join(s.state.lineBreak),!1)};for(let l=0;l<r.length;l++){let c=new FileReader;c.onerror=a,c.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(n[l]=c.result),a()},c.readAsText(r[l])}}else dropText(s,e,e.dataTransfer.getData("Text"),!0)};handlers.paste=(s,e)=>{if(s.state.readOnly)return e.preventDefault();s.observer.flush();let r=brokenClipboardAPI?null:e.clipboardData;r?(doPaste(s,r.getData("text/plain")||r.getData("text/uri-text")),e.preventDefault()):capturePaste(s)};function captureCopy(s,e){let r=s.dom.parentNode;if(!r)return;let n=r.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),s.focus()},50)}function copiedRange(s){let e=[],r=[],n=!1;for(let o of s.selection.ranges)o.empty||(e.push(s.sliceDoc(o.from,o.to)),r.push(o));if(!e.length){let o=-1;for(let{from:a}of s.selection.ranges){let l=s.doc.lineAt(a);l.number>o&&(e.push(l.text),r.push({from:l.from,to:Math.min(s.doc.length,l.to+1)})),o=l.number}n=!0}return{text:e.join(s.lineBreak),ranges:r,linewise:n}}let lastLinewiseCopy=null;handlers.copy=handlers.cut=(s,e)=>{let{text:r,ranges:n,linewise:o}=copiedRange(s.state);if(!r&&!o)return;lastLinewiseCopy=o?r:null;let a=brokenClipboardAPI?null:e.clipboardData;a?(e.preventDefault(),a.clearData(),a.setData("text/plain",r)):captureCopy(s,r),e.type=="cut"&&!s.state.readOnly&&s.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"})};const isFocusChange=Annotation.define();function focusChangeTransaction(s,e){let r=[];for(let n of s.facet(focusChangeEffect)){let o=n(s,e);o&&r.push(o)}return r?s.update({effects:r,annotations:isFocusChange.of(!0)}):null}function updateForFocusChange(s){setTimeout(()=>{let e=s.hasFocus;if(e!=s.inputState.notifiedFocused){let r=focusChangeTransaction(s.state,e);r?s.dispatch(r):s.update([])}},10)}handlers.focus=s=>{s.inputState.lastFocusTime=Date.now(),!s.scrollDOM.scrollTop&&(s.inputState.lastScrollTop||s.inputState.lastScrollLeft)&&(s.scrollDOM.scrollTop=s.inputState.lastScrollTop,s.scrollDOM.scrollLeft=s.inputState.lastScrollLeft),updateForFocusChange(s)};handlers.blur=s=>{s.observer.clearSelectionRange(),updateForFocusChange(s)};handlers.compositionstart=handlers.compositionupdate=s=>{s.inputState.compositionFirstChange==null&&(s.inputState.compositionFirstChange=!0),s.inputState.composing<0&&(s.inputState.composing=0)};handlers.compositionend=s=>{s.inputState.composing=-1,s.inputState.compositionEndedAt=Date.now(),s.inputState.compositionPendingKey=!0,s.inputState.compositionPendingChange=s.observer.pendingRecords().length>0,s.inputState.compositionFirstChange=null,browser.chrome&&browser.android?s.observer.flushSoon():s.inputState.compositionPendingChange?Promise.resolve().then(()=>s.observer.flush()):setTimeout(()=>{s.inputState.composing<0&&s.docView.hasComposition&&s.update([])},50)};handlers.contextmenu=s=>{s.inputState.lastContextMenu=Date.now()};handlers.beforeinput=(s,e)=>{var r;let n;if(browser.chrome&&browser.android&&(n=PendingKeys.find(o=>o.inputType==e.inputType))&&(s.observer.delayAndroidKey(n.key,n.keyCode),n.key=="Backspace"||n.key=="Delete")){let o=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>o+10&&s.hasFocus&&(s.contentDOM.blur(),s.focus())},100)}};const wrappingWhiteSpace=["pre-wrap","normal","pre-line","break-spaces"];class HeightOracle{constructor(e){this.lineWrapping=e,this.doc=Text.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,r){let n=this.doc.lineAt(r).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((r-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return wrappingWhiteSpace.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let r=!1;for(let n=0;n<e.length;n++){let o=e[n];o<0?n++:this.heightSamples[Math.floor(o*10)]||(r=!0,this.heightSamples[Math.floor(o*10)]=!0)}return r}refresh(e,r,n,o,a,l){let c=wrappingWhiteSpace.indexOf(e)>-1,h=Math.round(r)!=Math.round(this.lineHeight)||this.lineWrapping!=c;if(this.lineWrapping=c,this.lineHeight=r,this.charWidth=n,this.textHeight=o,this.lineLength=a,h){this.heightSamples={};for(let f=0;f<l.length;f++){let d=l[f];d<0?f++:this.heightSamples[Math.floor(d*10)]=!0}}return h}}class MeasuredHeights{constructor(e,r){this.from=e,this.heights=r,this.index=0}get more(){return this.index<this.heights.length}}class BlockInfo{constructor(e,r,n,o,a){this.from=e,this.length=r,this.top=n,this.height=o,this._content=a}get type(){return typeof this._content=="number"?BlockType.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof PointDecoration?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let r=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new BlockInfo(this.from,this.length+e.length,this.top,this.height+e.height,r)}}var QueryType$1=function(s){return s[s.ByPos=0]="ByPos",s[s.ByHeight=1]="ByHeight",s[s.ByPosNoHeight=2]="ByPosNoHeight",s}(QueryType$1||(QueryType$1={}));const Epsilon=.001;class HeightMap{constructor(e,r,n=2){this.length=e,this.height=r,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,r){this.height!=r&&(Math.abs(this.height-r)>Epsilon&&(e.heightChanged=!0),this.height=r)}replace(e,r,n){return HeightMap.of(n)}decomposeLeft(e,r){r.push(this)}decomposeRight(e,r){r.push(this)}applyChanges(e,r,n,o){let a=this,l=n.doc;for(let c=o.length-1;c>=0;c--){let{fromA:h,toA:f,fromB:d,toB:m}=o[c],v=a.lineAt(h,QueryType$1.ByPosNoHeight,n.setDoc(r),0,0),A=v.to>=f?v:a.lineAt(f,QueryType$1.ByPosNoHeight,n,0,0);for(m+=A.to-f,f=A.to;c>0&&v.from<=o[c-1].toA;)h=o[c-1].fromA,d=o[c-1].fromB,c--,h<v.from&&(v=a.lineAt(h,QueryType$1.ByPosNoHeight,n,0,0));d+=v.from-h,h=v.from;let T=NodeBuilder.build(n.setDoc(l),e,d,m);a=a.replace(h,f,T)}return a.updateHeight(n,0)}static empty(){return new HeightMapText(0,0)}static of(e){if(e.length==1)return e[0];let r=0,n=e.length,o=0,a=0;for(;;)if(r==n)if(o>a*2){let c=e[r-1];c.break?e.splice(--r,1,c.left,null,c.right):e.splice(--r,1,c.left,c.right),n+=1+c.break,o-=c.size}else if(a>o*2){let c=e[n];c.break?e.splice(n,1,c.left,null,c.right):e.splice(n,1,c.left,c.right),n+=2+c.break,a-=c.size}else break;else if(o<a){let c=e[r++];c&&(o+=c.size)}else{let c=e[--n];c&&(a+=c.size)}let l=0;return e[r-1]==null?(l=1,r--):e[r]==null&&(l=1,n++),new HeightMapBranch(HeightMap.of(e.slice(0,r)),l,HeightMap.of(e.slice(n)))}}HeightMap.prototype.size=1;class HeightMapBlock extends HeightMap{constructor(e,r,n){super(e,r),this.deco=n}blockAt(e,r,n,o){return new BlockInfo(o,this.length,n,this.height,this.deco||0)}lineAt(e,r,n,o,a){return this.blockAt(0,n,o,a)}forEachLine(e,r,n,o,a,l){e<=a+this.length&&r>=a&&l(this.blockAt(0,n,o,a))}updateHeight(e,r=0,n=!1,o){return o&&o.from<=r&&o.more&&this.setHeight(e,o.heights[o.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class HeightMapText extends HeightMapBlock{constructor(e,r){super(e,r,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,r,n,o){return new BlockInfo(o,this.length,n,this.height,this.breaks)}replace(e,r,n){let o=n[0];return n.length==1&&(o instanceof HeightMapText||o instanceof HeightMapGap&&o.flags&4)&&Math.abs(this.length-o.length)<10?(o instanceof HeightMapGap?o=new HeightMapText(o.length,this.height):o.height=this.height,this.outdated||(o.outdated=!1),o):HeightMap.of(n)}updateHeight(e,r=0,n=!1,o){return o&&o.from<=r&&o.more?this.setHeight(e,o.heights[o.index++]):(n||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class HeightMapGap extends HeightMap{constructor(e){super(e,0)}heightMetrics(e,r){let n=e.doc.lineAt(r).number,o=e.doc.lineAt(r+this.length).number,a=o-n+1,l,c=0;if(e.lineWrapping){let h=Math.min(this.height,e.lineHeight*a);l=h/a,this.length>a+1&&(c=(this.height-h)/(this.length-a-1))}else l=this.height/a;return{firstLine:n,lastLine:o,perLine:l,perChar:c}}blockAt(e,r,n,o){let{firstLine:a,lastLine:l,perLine:c,perChar:h}=this.heightMetrics(r,o);if(r.lineWrapping){let f=o+Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length),d=r.doc.lineAt(f),m=c+d.length*h,v=Math.max(n,e-m/2);return new BlockInfo(d.from,d.length,v,m,0)}else{let f=Math.max(0,Math.min(l-a,Math.floor((e-n)/c))),{from:d,length:m}=r.doc.line(a+f);return new BlockInfo(d,m,n+c*f,c,0)}}lineAt(e,r,n,o,a){if(r==QueryType$1.ByHeight)return this.blockAt(e,n,o,a);if(r==QueryType$1.ByPosNoHeight){let{from:A,to:T}=n.doc.lineAt(e);return new BlockInfo(A,T-A,0,0,0)}let{firstLine:l,perLine:c,perChar:h}=this.heightMetrics(n,a),f=n.doc.lineAt(e),d=c+f.length*h,m=f.number-l,v=o+c*m+h*(f.from-a-m);return new BlockInfo(f.from,f.length,Math.max(o,Math.min(v,o+this.height-d)),d,0)}forEachLine(e,r,n,o,a,l){e=Math.max(e,a),r=Math.min(r,a+this.length);let{firstLine:c,perLine:h,perChar:f}=this.heightMetrics(n,a);for(let d=e,m=o;d<=r;){let v=n.doc.lineAt(d);if(d==e){let T=v.number-c;m+=h*T+f*(e-a-T)}let A=h+f*v.length;l(new BlockInfo(v.from,v.length,m,A,0)),m+=A,d=v.to+1}}replace(e,r,n){let o=this.length-r;if(o>0){let a=n[n.length-1];a instanceof HeightMapGap?n[n.length-1]=new HeightMapGap(a.length+o):n.push(null,new HeightMapGap(o-1))}if(e>0){let a=n[0];a instanceof HeightMapGap?n[0]=new HeightMapGap(e+a.length):n.unshift(new HeightMapGap(e-1),null)}return HeightMap.of(n)}decomposeLeft(e,r){r.push(new HeightMapGap(e-1),null)}decomposeRight(e,r){r.push(null,new HeightMapGap(this.length-e-1))}updateHeight(e,r=0,n=!1,o){let a=r+this.length;if(o&&o.from<=r+this.length&&o.more){let l=[],c=Math.max(r,o.from),h=-1;for(o.from>r&&l.push(new HeightMapGap(o.from-r-1).updateHeight(e,r));c<=a&&o.more;){let d=e.doc.lineAt(c).length;l.length&&l.push(null);let m=o.heights[o.index++];h==-1?h=m:Math.abs(m-h)>=Epsilon&&(h=-2);let v=new HeightMapText(d,m);v.outdated=!1,l.push(v),c+=d+1}c<=a&&l.push(null,new HeightMapGap(a-c).updateHeight(e,c));let f=HeightMap.of(l);return(h<0||Math.abs(f.height-this.height)>=Epsilon||Math.abs(h-this.heightMetrics(e,r).perLine)>=Epsilon)&&(e.heightChanged=!0),f}else(n||this.outdated)&&(this.setHeight(e,e.heightForGap(r,r+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class HeightMapBranch extends HeightMap{constructor(e,r,n){super(e.length+r+n.length,e.height+n.height,r|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,r,n,o){let a=n+this.left.height;return e<a?this.left.blockAt(e,r,n,o):this.right.blockAt(e,r,a,o+this.left.length+this.break)}lineAt(e,r,n,o,a){let l=o+this.left.height,c=a+this.left.length+this.break,h=r==QueryType$1.ByHeight?e<l:e<c,f=h?this.left.lineAt(e,r,n,o,a):this.right.lineAt(e,r,n,l,c);if(this.break||(h?f.to<c:f.from>c))return f;let d=r==QueryType$1.ByPosNoHeight?QueryType$1.ByPosNoHeight:QueryType$1.ByPos;return h?f.join(this.right.lineAt(c,d,n,l,c)):this.left.lineAt(c,d,n,o,a).join(f)}forEachLine(e,r,n,o,a,l){let c=o+this.left.height,h=a+this.left.length+this.break;if(this.break)e<h&&this.left.forEachLine(e,r,n,o,a,l),r>=h&&this.right.forEachLine(e,r,n,c,h,l);else{let f=this.lineAt(h,QueryType$1.ByPos,n,o,a);e<f.from&&this.left.forEachLine(e,f.from-1,n,o,a,l),f.to>=e&&f.from<=r&&l(f),r>f.to&&this.right.forEachLine(f.to+1,r,n,c,h,l)}}replace(e,r,n){let o=this.left.length+this.break;if(r<o)return this.balanced(this.left.replace(e,r,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-o,r-o,n));let a=[];e>0&&this.decomposeLeft(e,a);let l=a.length;for(let c of n)a.push(c);if(e>0&&mergeGaps(a,l-1),r<this.length){let c=a.length;this.decomposeRight(r,a),mergeGaps(a,c)}return HeightMap.of(a)}decomposeLeft(e,r){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,r);r.push(this.left),this.break&&(n++,e>=n&&r.push(null)),e>n&&this.right.decomposeLeft(e-n,r)}decomposeRight(e,r){let n=this.left.length,o=n+this.break;if(e>=o)return this.right.decomposeRight(e-o,r);e<n&&this.left.decomposeRight(e,r),this.break&&e<o&&r.push(null),r.push(this.right)}balanced(e,r){return e.size>2*r.size||r.size>2*e.size?HeightMap.of(this.break?[e,null,r]:[e,r]):(this.left=e,this.right=r,this.height=e.height+r.height,this.outdated=e.outdated||r.outdated,this.size=e.size+r.size,this.length=e.length+this.break+r.length,this)}updateHeight(e,r=0,n=!1,o){let{left:a,right:l}=this,c=r+a.length+this.break,h=null;return o&&o.from<=r+a.length&&o.more?h=a=a.updateHeight(e,r,n,o):a.updateHeight(e,r,n),o&&o.from<=c+l.length&&o.more?h=l=l.updateHeight(e,c,n,o):l.updateHeight(e,c,n),h?this.balanced(a,l):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function mergeGaps(s,e){let r,n;s[e]==null&&(r=s[e-1])instanceof HeightMapGap&&(n=s[e+1])instanceof HeightMapGap&&s.splice(e-1,3,new HeightMapGap(r.length+1+n.length))}const relevantWidgetHeight=5;class NodeBuilder{constructor(e,r){this.pos=e,this.oracle=r,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,r){if(this.lineStart>-1){let n=Math.min(r,this.lineEnd),o=this.nodes[this.nodes.length-1];o instanceof HeightMapText?o.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new HeightMapText(n-this.pos,-1)),this.writtenTo=n,r>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=r}point(e,r,n){if(e<r||n.heightRelevant){let o=n.widget?n.widget.estimatedHeight:0,a=n.widget?n.widget.lineBreaks:0;o<0&&(o=this.oracle.lineHeight);let l=r-e;n.block?this.addBlock(new HeightMapBlock(l,o,n)):(l||a||o>=relevantWidgetHeight)&&this.addLineDeco(o,a,l)}else r>e&&this.span(e,r);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:r}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=r,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new HeightMapText(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,r){let n=new HeightMapGap(r-e);return this.oracle.doc.lineAt(e).to==r&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof HeightMapText)return e;let r=new HeightMapText(0,-1);return this.nodes.push(r),r}addBlock(e){var r;this.enterLine();let n=(r=e.deco)===null||r===void 0?void 0:r.type;n==BlockType.WidgetAfter&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n!=BlockType.WidgetBefore&&(this.covering=e)}addLineDeco(e,r,n){let o=this.ensureLine();o.length+=n,o.collapsed+=n,o.widgetHeight=Math.max(o.widgetHeight,e),o.breaks+=r,this.writtenTo=this.pos=this.pos+n}finish(e){let r=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(r instanceof HeightMapText)&&!this.isCovered?this.nodes.push(new HeightMapText(0,-1)):(this.writtenTo<this.pos||r==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let o of this.nodes)o instanceof HeightMapText&&o.updateHeight(this.oracle,n),n+=o?o.length:1;return this.nodes}static build(e,r,n,o){let a=new NodeBuilder(n,e);return RangeSet.spans(r,n,o,a,0),a.finish(n)}}function heightRelevantDecoChanges(s,e,r){let n=new DecorationComparator;return RangeSet.compare(s,e,r,n,0),n.changes}class DecorationComparator{constructor(){this.changes=[]}compareRange(){}comparePoint(e,r,n,o){(e<r||n&&n.heightRelevant||o&&o.heightRelevant)&&addRange(e,r,this.changes,5)}}function visiblePixelRange(s,e){let r=s.getBoundingClientRect(),n=s.ownerDocument,o=n.defaultView||window,a=Math.max(0,r.left),l=Math.min(o.innerWidth,r.right),c=Math.max(0,r.top),h=Math.min(o.innerHeight,r.bottom);for(let f=s.parentNode;f&&f!=n.body;)if(f.nodeType==1){let d=f,m=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&m.overflow!="visible"){let v=d.getBoundingClientRect();a=Math.max(a,v.left),l=Math.min(l,v.right),c=Math.max(c,v.top),h=f==s.parentNode?v.bottom:Math.min(h,v.bottom)}f=m.position=="absolute"||m.position=="fixed"?d.offsetParent:d.parentNode}else if(f.nodeType==11)f=f.host;else break;return{left:a-r.left,right:Math.max(a,l)-r.left,top:c-(r.top+e),bottom:Math.max(c,h)-(r.top+e)}}function fullPixelRange(s,e){let r=s.getBoundingClientRect();return{left:0,right:r.right-r.left,top:e,bottom:r.bottom-(r.top+e)}}class LineGap{constructor(e,r,n){this.from=e,this.to=r,this.size=n}static same(e,r){if(e.length!=r.length)return!1;for(let n=0;n<e.length;n++){let o=e[n],a=r[n];if(o.from!=a.from||o.to!=a.to||o.size!=a.size)return!1}return!0}draw(e){return Decoration.replace({widget:new LineGapWidget(this.size,e)}).range(this.from,this.to)}}class LineGapWidget extends WidgetType{constructor(e,r){super(),this.size=e,this.vertical=r}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class ViewState{constructor(e){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=IdScaler,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Direction.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=e.facet(contentAttributes).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new HeightOracle(r),this.stateDeco=e.facet(decorations).filter(n=>typeof n!="function"),this.heightMap=HeightMap.empty().applyChanges(this.stateDeco,Text.empty,this.heightOracle.setDoc(e.doc),[new ChangedRange(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Decoration.set(this.lineGaps.map(n=>n.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:r}=this.state.selection;for(let n=0;n<=1;n++){let o=n?r.head:r.anchor;if(!e.some(({from:a,to:l})=>o>=a&&o<=l)){let{from:a,to:l}=this.lineBlockAt(o);e.push(new Viewport(a,l))}}this.viewports=e.sort((n,o)=>n.from-o.from),this.scaler=this.heightMap.height<=7e6?IdScaler:new BigScaler(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:scaleBlock(e,this.scaler))})}update(e,r=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(decorations).filter(d=>typeof d!="function");let o=e.changedRanges,a=ChangedRange.extendWithRanges(o,heightRelevantDecoChanges(n,this.stateDeco,e?e.changes:ChangeSet.empty(this.state.doc.length))),l=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),a),this.heightMap.height!=l&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let h=a.length?this.mapViewport(this.viewport,e.changes):this.viewport;(r&&(r.range.head<h.from||r.range.head>h.to)||!this.viewportIsAppropriate(h))&&(h=this.getViewport(0,r));let f=!e.changes.empty||e.flags&2||h.from!=this.viewport.from||h.to!=this.viewport.to;this.viewport=h,this.updateForViewport(),f&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),r&&(this.scrollTarget=r),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(nativeSelectionHidden)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let r=e.contentDOM,n=window.getComputedStyle(r),o=this.heightOracle,a=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?Direction.RTL:Direction.LTR;let l=this.heightOracle.mustRefreshForWrapping(a),c=r.getBoundingClientRect(),h=l||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let f=0,d=0,m=parseInt(n.paddingTop)||0,v=parseInt(n.paddingBottom)||0;(this.paddingTop!=m||this.paddingBottom!=v)&&(this.paddingTop=m,this.paddingBottom=v,f|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(o.lineWrapping&&(h=!0),this.editorWidth=e.scrollDOM.clientWidth,f|=8),this.scrollTop!=e.scrollDOM.scrollTop&&(this.scrollAnchorHeight=-1,this.scrollTop=e.scrollDOM.scrollTop),this.scrolledToBottom=isScrolledToBottom(e.scrollDOM);let A=(this.printing?fullPixelRange:visiblePixelRange)(r,this.paddingTop),T=A.top-this.pixelViewport.top,B=A.bottom-this.pixelViewport.bottom;this.pixelViewport=A;let Y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(Y!=this.inView&&(this.inView=Y,Y&&(h=!0)),!this.inView&&!this.scrollTarget)return 0;let F=c.width;if((this.contentDOMWidth!=F||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,f|=8),h){let Qe=e.docView.measureVisibleLineHeights(this.viewport);if(o.mustRefreshForHeights(Qe)&&(l=!0),l||o.lineWrapping&&Math.abs(F-this.contentDOMWidth)>o.charWidth){let{lineHeight:xe,charWidth:Te,textHeight:Le}=e.docView.measureTextSize();l=xe>0&&o.refresh(a,xe,Te,Le,F/Te,Qe),l&&(e.docView.minWidth=0,f|=8)}T>0&&B>0?d=Math.max(T,B):T<0&&B<0&&(d=Math.min(T,B)),o.heightChanged=!1;for(let xe of this.viewports){let Te=xe.from==this.viewport.from?Qe:e.docView.measureVisibleLineHeights(xe);this.heightMap=(l?HeightMap.empty().applyChanges(this.stateDeco,Text.empty,this.heightOracle,[new ChangedRange(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(o,0,l,new MeasuredHeights(xe.from,Te))}o.heightChanged&&(f|=2)}let ke=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return ke&&(this.viewport=this.getViewport(d,this.scrollTarget)),this.updateForViewport(),(f&2||ke)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(l?[]:this.lineGaps,e)),f|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),f}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,r){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),o=this.heightMap,a=this.heightOracle,{visibleTop:l,visibleBottom:c}=this,h=new Viewport(o.lineAt(l-n*1e3,QueryType$1.ByHeight,a,0,0).from,o.lineAt(c+(1-n)*1e3,QueryType$1.ByHeight,a,0,0).to);if(r){let{head:f}=r.range;if(f<h.from||f>h.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),m=o.lineAt(f,QueryType$1.ByPos,a,0,0),v;r.y=="center"?v=(m.top+m.bottom)/2-d/2:r.y=="start"||r.y=="nearest"&&f<h.from?v=m.top:v=m.bottom-d,h=new Viewport(o.lineAt(v-1e3/2,QueryType$1.ByHeight,a,0,0).from,o.lineAt(v+d+1e3/2,QueryType$1.ByHeight,a,0,0).to)}}return h}mapViewport(e,r){let n=r.mapPos(e.from,-1),o=r.mapPos(e.to,1);return new Viewport(this.heightMap.lineAt(n,QueryType$1.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(o,QueryType$1.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:r},n=0){if(!this.inView)return!0;let{top:o}=this.heightMap.lineAt(e,QueryType$1.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(r,QueryType$1.ByPos,this.heightOracle,0,0),{visibleTop:l,visibleBottom:c}=this;return(e==0||o<=l-Math.max(10,Math.min(-n,250)))&&(r==this.state.doc.length||a>=c+Math.max(10,Math.min(n,250)))&&o>l-2*1e3&&a<c+2*1e3}mapLineGaps(e,r){if(!e.length||r.empty)return e;let n=[];for(let o of e)r.touchesRange(o.from,o.to)||n.push(new LineGap(r.mapPos(o.from),r.mapPos(o.to),o.size));return n}ensureLineGaps(e,r){let n=this.heightOracle.lineWrapping,o=n?1e4:2e3,a=o>>1,l=o<<1;if(this.defaultTextDirection!=Direction.LTR&&!n)return[];let c=[],h=(f,d,m,v)=>{if(d-f<a)return;let A=this.state.selection.main,T=[A.from];A.empty||T.push(A.to);for(let Y of T)if(Y>f&&Y<d){h(f,Y-10,m,v),h(Y+10,d,m,v);return}let B=find(e,Y=>Y.from>=m.from&&Y.to<=m.to&&Math.abs(Y.from-f)<a&&Math.abs(Y.to-d)<a&&!T.some(F=>Y.from<F&&Y.to>F));if(!B){if(d<m.to&&r&&n&&r.visibleRanges.some(Y=>Y.from<=d&&Y.to>=d)){let Y=r.moveToLineBoundary(EditorSelection.cursor(d),!1,!0).head;Y>f&&(d=Y)}B=new LineGap(f,d,this.gapSize(m,f,d,v))}c.push(B)};for(let f of this.viewportLines){if(f.length<l)continue;let d=lineStructure(f.from,f.to,this.stateDeco);if(d.total<l)continue;let m=this.scrollTarget?this.scrollTarget.range.head:null,v,A;if(n){let T=o/this.heightOracle.lineLength*this.heightOracle.lineHeight,B,Y;if(m!=null){let F=findFraction(d,m),ke=((this.visibleBottom-this.visibleTop)/2+T)/f.height;B=F-ke,Y=F+ke}else B=(this.visibleTop-f.top-T)/f.height,Y=(this.visibleBottom-f.top+T)/f.height;v=findPosition(d,B),A=findPosition(d,Y)}else{let T=d.total*this.heightOracle.charWidth,B=o*this.heightOracle.charWidth,Y,F;if(m!=null){let ke=findFraction(d,m),Qe=((this.pixelViewport.right-this.pixelViewport.left)/2+B)/T;Y=ke-Qe,F=ke+Qe}else Y=(this.pixelViewport.left-B)/T,F=(this.pixelViewport.right+B)/T;v=findPosition(d,Y),A=findPosition(d,F)}v>f.from&&h(f.from,v,f,d),A<f.to&&h(A,f.to,f,d)}return c}gapSize(e,r,n,o){let a=findFraction(o,n)-findFraction(o,r);return this.heightOracle.lineWrapping?e.height*a:o.total*this.heightOracle.charWidth*a}updateLineGaps(e){LineGap.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Decoration.set(e.map(r=>r.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let r=[];RangeSet.spans(e,this.viewport.from,this.viewport.to,{span(o,a){r.push({from:o,to:a})},point(){}},20);let n=r.length!=this.visibleRanges.length||this.visibleRanges.some((o,a)=>o.from!=r[a].from||o.to!=r[a].to);return this.visibleRanges=r,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(r=>r.from<=e&&r.to>=e)||scaleBlock(this.heightMap.lineAt(e,QueryType$1.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return scaleBlock(this.heightMap.lineAt(this.scaler.fromDOM(e),QueryType$1.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let r=this.lineBlockAtHeight(e+8);return r.from>=this.viewport.from||this.viewportLines[0].top-e>200?r:this.viewportLines[0]}elementAtHeight(e){return scaleBlock(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Viewport{constructor(e,r){this.from=e,this.to=r}}function lineStructure(s,e,r){let n=[],o=s,a=0;return RangeSet.spans(r,s,e,{span(){},point(l,c){l>o&&(n.push({from:o,to:l}),a+=l-o),o=c}},20),o<e&&(n.push({from:o,to:e}),a+=e-o),{total:a,ranges:n}}function findPosition({total:s,ranges:e},r){if(r<=0)return e[0].from;if(r>=1)return e[e.length-1].to;let n=Math.floor(s*r);for(let o=0;;o++){let{from:a,to:l}=e[o],c=l-a;if(n<=c)return a+n;n-=c}}function findFraction(s,e){let r=0;for(let{from:n,to:o}of s.ranges){if(e<=o){r+=e-n;break}r+=o-n}return r/s.total}function find(s,e){for(let r of s)if(e(r))return r}const IdScaler={toDOM(s){return s},fromDOM(s){return s},scale:1};class BigScaler{constructor(e,r,n){let o=0,a=0,l=0;this.viewports=n.map(({from:c,to:h})=>{let f=r.lineAt(c,QueryType$1.ByPos,e,0,0).top,d=r.lineAt(h,QueryType$1.ByPos,e,0,0).bottom;return o+=d-f,{from:c,to:h,top:f,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-o)/(r.height-o);for(let c of this.viewports)c.domTop=l+(c.top-a)*this.scale,l=c.domBottom=c.domTop+(c.bottom-c.top),a=c.bottom}toDOM(e){for(let r=0,n=0,o=0;;r++){let a=r<this.viewports.length?this.viewports[r]:null;if(!a||e<a.top)return o+(e-n)*this.scale;if(e<=a.bottom)return a.domTop+(e-a.top);n=a.bottom,o=a.domBottom}}fromDOM(e){for(let r=0,n=0,o=0;;r++){let a=r<this.viewports.length?this.viewports[r]:null;if(!a||e<a.domTop)return n+(e-o)/this.scale;if(e<=a.domBottom)return a.top+(e-a.domTop);n=a.bottom,o=a.domBottom}}}function scaleBlock(s,e){if(e.scale==1)return s;let r=e.toDOM(s.top),n=e.toDOM(s.bottom);return new BlockInfo(s.from,s.length,r,n-r,Array.isArray(s._content)?s._content.map(o=>scaleBlock(o,e)):s._content)}const theme=Facet.define({combine:s=>s.join(" ")}),darkTheme=Facet.define({combine:s=>s.indexOf(!0)>-1}),baseThemeID=StyleModule.newName(),baseLightID=StyleModule.newName(),baseDarkID=StyleModule.newName(),lightDarkIDs={"&light":"."+baseLightID,"&dark":"."+baseDarkID};function buildTheme(s,e,r){return new StyleModule(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,o=>{if(o=="&")return s;if(!r||!r[o])throw new RangeError(`Unsupported selector: ${o}`);return r[o]}):s+" "+n}})}const baseTheme$1$2=buildTheme("."+baseThemeID,{"&":{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",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"}},lightDarkIDs);class DOMChange{constructor(e,r,n,o){this.typeOver=o,this.bounds=null,this.text="";let{impreciseHead:a,impreciseAnchor:l}=e.docView;if(e.state.readOnly&&r>-1)this.newSel=null;else if(r>-1&&(this.bounds=e.docView.domBoundsAround(r,n,0))){let c=a||l?[]:selectionPoints(e),h=new DOMReader(c,e.state);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=selectionFromPoints(c,this.bounds.from)}else{let c=e.observer.selectionRange,h=a&&a.node==c.focusNode&&a.offset==c.focusOffset||!contains(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),f=l&&l.node==c.anchorNode&&l.offset==c.anchorOffset||!contains(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset);this.newSel=EditorSelection.single(f,h)}}}function applyDOMChange(s,e){let r,{newSel:n}=e,o=s.state.selection.main,a=s.inputState.lastKeyTime>Date.now()-100?s.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:c}=e.bounds,h=o.from,f=null;(a===8||browser.android&&e.text.length<c-l)&&(h=o.to,f="end");let d=findDiff(s.state.doc.sliceString(l,c,LineBreakPlaceholder),e.text,h-l,f);d&&(browser.chrome&&a==13&&d.toB==d.from+2&&e.text.slice(d.from,d.toB)==LineBreakPlaceholder+LineBreakPlaceholder&&d.toB--,r={from:l+d.from,to:l+d.toA,insert:Text.of(e.text.slice(d.from,d.toB).split(LineBreakPlaceholder))})}else n&&(!s.hasFocus&&s.state.facet(editable)||n.main.eq(o))&&(n=null);if(!r&&!n)return!1;if(!r&&e.typeOver&&!o.empty&&n&&n.main.empty?r={from:o.from,to:o.to,insert:s.state.doc.slice(o.from,o.to)}:r&&r.from>=o.from&&r.to<=o.to&&(r.from!=o.from||r.to!=o.to)&&o.to-o.from-(r.to-r.from)<=4?r={from:o.from,to:o.to,insert:s.state.doc.slice(o.from,r.from).append(r.insert).append(s.state.doc.slice(r.to,o.to))}:(browser.mac||browser.android)&&r&&r.from==r.to&&r.from==o.head-1&&/^\. ?$/.test(r.insert.toString())&&s.contentDOM.getAttribute("autocorrect")=="off"?(n&&r.insert.length==2&&(n=EditorSelection.single(n.main.anchor-1,n.main.head-1)),r={from:o.from,to:o.to,insert:Text.of([" "])}):browser.chrome&&r&&r.from==r.to&&r.from==o.head&&r.insert.toString()==`
|
||
`&&s.lineWrapping&&(n&&(n=EditorSelection.single(n.main.anchor-1,n.main.head-1)),r={from:o.from,to:o.to,insert:Text.of([" "])}),r){let l=s.state;if(browser.ios&&s.inputState.flushIOSKey(s)||browser.android&&(r.from==o.from&&r.to==o.to&&r.insert.length==1&&r.insert.lines==2&&dispatchKey(s.contentDOM,"Enter",13)||(r.from==o.from-1&&r.to==o.to&&r.insert.length==0||a==8&&r.insert.length<r.to-r.from)&&dispatchKey(s.contentDOM,"Backspace",8)||r.from==o.from&&r.to==o.to+1&&r.insert.length==0&&dispatchKey(s.contentDOM,"Delete",46)))return!0;let c=r.insert.toString();if(s.state.facet(inputHandler$1).some(d=>d(s,r.from,r.to,c)))return!0;s.inputState.composing>=0&&s.inputState.composing++;let h;if(r.from>=o.from&&r.to<=o.to&&r.to-r.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==r.from+r.insert.length)&&s.inputState.composing<0){let d=o.from<r.from?l.sliceDoc(o.from,r.from):"",m=o.to>r.to?l.sliceDoc(r.to,o.to):"";h=l.replaceSelection(s.state.toText(d+r.insert.sliceString(0,void 0,s.state.lineBreak)+m))}else{let d=l.changes(r),m=n&&n.main.to<=d.newLength?n.main:void 0;if(l.selection.ranges.length>1&&s.inputState.composing>=0&&r.to<=o.to&&r.to>=o.to-10){let v=s.state.sliceDoc(r.from,r.to),A=findCompositionNode(s)||s.state.doc.lineAt(o.head),T=o.to-r.to,B=o.to-o.from;h=l.changeByRange(Y=>{if(Y.from==o.from&&Y.to==o.to)return{changes:d,range:m||Y.map(d)};let F=Y.to-T,ke=F-v.length;if(Y.to-Y.from!=B||s.state.sliceDoc(ke,F)!=v||A&&Y.to>=A.from&&Y.from<=A.to)return{range:Y};let Qe=l.changes({from:ke,to:F,insert:r.insert}),xe=Y.to-o.to;return{changes:Qe,range:m?EditorSelection.range(Math.max(0,m.anchor+xe),Math.max(0,m.head+xe)):Y.map(Qe)}})}else h={changes:d,selection:m&&l.selection.replaceRange(m)}}let f="input.type";return(s.composing||s.inputState.compositionPendingChange&&s.inputState.compositionEndedAt>Date.now()-50)&&(s.inputState.compositionPendingChange=!1,f+=".compose",s.inputState.compositionFirstChange&&(f+=".start",s.inputState.compositionFirstChange=!1)),s.dispatch(h,{scrollIntoView:!0,userEvent:f}),!0}else if(n&&!n.main.eq(o)){let l=!1,c="select";return s.inputState.lastSelectionTime>Date.now()-50&&(s.inputState.lastSelectionOrigin=="select"&&(l=!0),c=s.inputState.lastSelectionOrigin),s.dispatch({selection:n,scrollIntoView:l,userEvent:c}),!0}else return!1}function findDiff(s,e,r,n){let o=Math.min(s.length,e.length),a=0;for(;a<o&&s.charCodeAt(a)==e.charCodeAt(a);)a++;if(a==o&&s.length==e.length)return null;let l=s.length,c=e.length;for(;l>0&&c>0&&s.charCodeAt(l-1)==e.charCodeAt(c-1);)l--,c--;if(n=="end"){let h=Math.max(0,a-Math.min(l,c));r-=l+h-a}if(l<a&&s.length<e.length){let h=r<=a&&r>=l?a-r:0;a-=h,c=a+(c-l),l=a}else if(c<a){let h=r<=a&&r>=c?a-r:0;a-=h,l=a+(l-c),c=a}return{from:a,toA:l,toB:c}}function selectionPoints(s){let e=[];if(s.root.activeElement!=s.contentDOM)return e;let{anchorNode:r,anchorOffset:n,focusNode:o,focusOffset:a}=s.observer.selectionRange;return r&&(e.push(new DOMPoint(r,n)),(o!=r||a!=n)&&e.push(new DOMPoint(o,a))),e}function selectionFromPoints(s,e){if(s.length==0)return null;let r=s[0].pos,n=s.length==2?s[1].pos:r;return r>-1&&n>-1?EditorSelection.single(r+e,n+e):null}const observeOptions={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},useCharData=browser.ie&&browser.ie_version<=11;class DOMObserver{constructor(e){this.view=e,this.active=!1,this.selectionRange=new DOMSelectionState,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(r=>{for(let n of r)this.queue.push(n);(browser.ie&&browser.ie_version<=11||browser.ios&&e.composing)&&r.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),useCharData&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.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),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var r;((r=this.view.docView)===null||r===void 0?void 0:r.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM),this.resizeContent=new ResizeObserver(()=>this.view.requestMeasure()),this.resizeContent.observe(e.contentDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(r=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),r.length>0&&r[r.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(r=>{r.length>0&&r[r.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runScrollHandlers(this.view,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((r,n)=>r!=e[n]))){this.gapIntersection.disconnect();for(let r of e)this.gapIntersection.observe(r);this.gaps=e}}onSelectionChange(e){let r=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,o=this.selectionRange;if(n.state.facet(editable)?n.root.activeElement!=this.dom:!hasSelection(n.dom,o))return;let a=o.anchorNode&&n.docView.nearest(o.anchorNode);if(a&&a.ignoreEvent(e)){r||(this.selectionChanged=!1);return}(browser.ie&&browser.ie_version<=11||browser.android&&browser.chrome)&&!n.state.selection.main.empty&&o.focusNode&&isEquivalentPosition(o.focusNode,o.focusOffset,o.anchorNode,o.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,r=browser.safari&&e.root.nodeType==11&&deepActiveElement(this.dom.ownerDocument)==this.dom&&safariSelectionRangeHack(this.view)||getSelection(e.root);if(!r||this.selectionRange.eq(r))return!1;let n=hasSelection(this.dom,r);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&atElementStart(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),n&&(this.selectionChanged=!0),!0)}setSelectionRange(e,r){this.selectionRange.set(e.node,e.offset,r.node,r.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,r=null;for(let n=this.dom;n;)if(n.nodeType==1)!r&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:r||(r=this.scrollTargets.slice(0,e)),r&&r.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!r&&(r=this.scrollTargets.slice(0,e)),r){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=r)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,observeOptions),useCharData&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),useCharData&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,r){var n;if(!this.delayedAndroidKey){let o=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&dispatchKey(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(o)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:r,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let r=-1,n=-1,o=!1;for(let a of e){let l=this.readMutation(a);l&&(l.typeOver&&(o=!0),r==-1?{from:r,to:n}=l:(r=Math.min(l.from,r),n=Math.max(l.to,n)))}return{from:r,to:n,typeOver:o}}readChange(){let{from:e,to:r,typeOver:n}=this.processRecords(),o=this.selectionChanged&&hasSelection(this.dom,this.selectionRange);return e<0&&!o?null:(e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new DOMChange(this.view,e,r,n))}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let r=this.readChange();if(!r)return!1;let n=this.view.state,o=applyDOMChange(this.view,r);return this.view.state==n&&this.view.update([]),o}readMutation(e){let r=this.view.docView.nearest(e.target);if(!r||r.ignoreMutation(e))return null;if(r.markDirty(e.type=="attributes"),e.type=="attributes"&&(r.flags|=4),e.type=="childList"){let n=findChild(r,e.previousSibling||e.target.previousSibling,-1),o=findChild(r,e.nextSibling||e.target.nextSibling,1);return{from:n?r.posAfter(n):r.posAtStart,to:o?r.posBefore(o):r.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,r,n,o;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(r=this.gapIntersection)===null||r===void 0||r.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect(),(o=this.resizeContent)===null||o===void 0||o.disconnect();for(let a of this.scrollTargets)a.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function findChild(s,e,r){for(;e;){let n=ContentView.get(e);if(n&&n.parent==s)return n;let o=e.parentNode;e=o!=s.dom?o:r>0?e.nextSibling:e.previousSibling}return null}function safariSelectionRangeHack(s){let e=null;function r(h){h.preventDefault(),h.stopImmediatePropagation(),e=h.getTargetRanges()[0]}if(s.contentDOM.addEventListener("beforeinput",r,!0),s.dom.ownerDocument.execCommand("indent"),s.contentDOM.removeEventListener("beforeinput",r,!0),!e)return null;let n=e.startContainer,o=e.startOffset,a=e.endContainer,l=e.endOffset,c=s.docView.domAtPos(s.state.selection.main.anchor);return isEquivalentPosition(c.node,c.offset,a,l)&&([n,o,a,l]=[a,l,n,o]),{anchorNode:n,anchorOffset:o,focusNode:a,focusOffset:l}}class EditorView{constructor(e={}){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=e.dispatch||(r=>this.update([r])),this.dispatch=this.dispatch.bind(this),this._root=e.root||getRoot(e.parent)||document,this.viewState=new ViewState(e.state||EditorState.create(e)),this.plugins=this.state.facet(viewPlugin).map(r=>new PluginInstance(r));for(let r of this.plugins)r.update(this);this.observer=new DOMObserver(this),this.inputState=new InputState(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new DocView(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...e){let r=e.length==1&&e[0]instanceof Transaction?e[0]:this.state.update(...e);this._dispatch(r,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let r=!1,n=!1,o,a=this.state;for(let v of e){if(v.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=v.state}if(this.destroyed){this.viewState.state=a;return}let l=this.hasFocus,c=0,h=null;e.some(v=>v.annotation(isFocusChange))?(this.inputState.notifiedFocused=l,c=1):l!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=l,h=focusChangeTransaction(a,l),h||(c=1));let f=this.observer.delayedAndroidKey,d=null;if(f?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(d=null)):this.observer.clear(),a.facet(EditorState.phrases)!=this.state.facet(EditorState.phrases))return this.setState(a);o=ViewUpdate.create(this,a,e),o.flags|=c;let m=this.viewState.scrollTarget;try{this.updateState=2;for(let v of e){if(m&&(m=m.map(v.changes)),v.scrollIntoView){let{main:A}=v.state.selection;m=new ScrollTarget(A.empty?A:EditorSelection.cursor(A.head,A.head>A.anchor?-1:1))}for(let A of v.effects)A.is(scrollIntoView$1)&&(m=A.value)}this.viewState.update(o,m),this.bidiCache=CachedOrder.update(this.bidiCache,o.changes),o.empty||(this.updatePlugins(o),this.inputState.update(o)),r=this.docView.update(o),this.state.facet(styleModule)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(r,e.some(v=>v.isUserEvent("select.pointer")))}finally{this.updateState=0}if(o.startState.facet(theme)!=o.state.facet(theme)&&(this.viewState.mustMeasureContent=!0),(r||n||m||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!o.empty)for(let v of this.state.facet(updateListener))v(o);(h||d)&&Promise.resolve().then(()=>{h&&this.state==h.startState&&this.dispatch(h),d&&!applyDOMChange(this,d)&&f.force&&dispatchKey(this.contentDOM,f.key,f.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let r=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new ViewState(e),this.plugins=e.facet(viewPlugin).map(n=>new PluginInstance(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView=new DocView(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}r&&this.focus(),this.requestMeasure()}updatePlugins(e){let r=e.startState.facet(viewPlugin),n=e.state.facet(viewPlugin);if(r!=n){let o=[];for(let a of n){let l=r.indexOf(a);if(l<0)o.push(new PluginInstance(a));else{let c=this.plugins[l];c.mustUpdate=e,o.push(c)}}for(let a of this.plugins)a.mustUpdate!=e&&a.destroy(this);this.plugins=o,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let o of this.plugins)o.mustUpdate=e;for(let o=0;o<this.plugins.length;o++)this.plugins[o].update(this)}measure(e=!0){if(this.destroyed)return;this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,e&&this.observer.forceFlush();let r=null,n=this.scrollDOM,{scrollTop:o}=n,{scrollAnchorPos:a,scrollAnchorHeight:l}=this.viewState;o!=this.viewState.scrollTop&&(l=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(l<0)if(isScrolledToBottom(n))a=-1,l=this.viewState.heightMap.height;else{let A=this.viewState.scrollAnchorAt(o);a=A.from,l=A.top}this.updateState=1;let h=this.viewState.measure(this);if(!h&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let f=[];h&4||([this.measureRequests,f]=[f,this.measureRequests]);let d=f.map(A=>{try{return A.read(this)}catch(T){return logException(this.state,T),BadMeasure}}),m=ViewUpdate.create(this,this.state,[]),v=!1;m.flags|=h,r?r.flags|=h:r=m,this.updateState=2,m.empty||(this.updatePlugins(m),this.inputState.update(m),this.updateAttrs(),v=this.docView.update(m));for(let A=0;A<f.length;A++)if(d[A]!=BadMeasure)try{let T=f[A];T.write&&T.write(d[A],this)}catch(T){logException(this.state,T)}if(v&&this.docView.updateSelection(!0),!m.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null;continue}else{let T=(a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)-l;if(T>1||T<-1){o=n.scrollTop=o+T,l=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(r&&!r.empty)for(let c of this.state.facet(updateListener))c(r)}get themeClasses(){return baseThemeID+" "+(this.state.facet(darkTheme)?baseDarkID:baseLightID)+" "+this.state.facet(theme)}updateAttrs(){let e=attrsFromFacet(this,editorAttributes,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),r={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(editable)?"true":"false",class:"cm-content",style:`${browser.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(r["aria-readonly"]="true"),attrsFromFacet(this,contentAttributes,r);let n=this.observer.ignore(()=>{let o=updateAttrs(this.contentDOM,this.contentAttrs,r),a=updateAttrs(this.dom,this.editorAttrs,e);return o||a});return this.editorAttrs=e,this.contentAttrs=r,n}showAnnouncements(e){let r=!0;for(let n of e)for(let o of n.effects)if(o.is(EditorView.announce)){r&&(this.announceDOM.textContent=""),r=!1;let a=this.announceDOM.appendChild(document.createElement("div"));a.textContent=o.value}}mountStyles(){this.styleModules=this.state.facet(styleModule),StyleModule.mount(this.root,this.styleModules.concat(baseTheme$1$2).reverse())}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let r=0;r<this.measureRequests.length;r++)if(this.measureRequests[r].key===e.key){this.measureRequests[r]=e;return}}this.measureRequests.push(e)}}plugin(e){let r=this.pluginMap.get(e);return(r===void 0||r&&r.spec!=e)&&this.pluginMap.set(e,r=this.plugins.find(n=>n.spec==e)||null),r&&r.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,r,n){return skipAtoms(this,e,moveByChar(this,e,r,n))}moveByGroup(e,r){return skipAtoms(this,e,moveByChar(this,e,r,n=>byGroup(this,e.head,n)))}moveToLineBoundary(e,r,n=!0){return moveToLineBoundary(this,e,r,n)}moveVertically(e,r,n){return skipAtoms(this,e,moveVertically(this,e,r,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,r=0){return this.docView.posFromDOM(e,r)}posAtCoords(e,r=!0){return this.readMeasured(),posAtCoords(this,e,r)}coordsAtPos(e,r=1){this.readMeasured();let n=this.docView.coordsAt(e,r);if(!n||n.left==n.right)return n;let o=this.state.doc.lineAt(e),a=this.bidiSpans(o),l=a[BidiSpan.find(a,e-o.from,-1,r)];return flattenRect(n,l.dir==Direction.LTR==r>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(perLineTextDirection)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>MaxBidiLine)return trivialOrder(e.length);let r=this.textDirectionAt(e.from);for(let o of this.bidiCache)if(o.from==e.from&&o.dir==r)return o.order;let n=computeOrder(e.text,r);return this.bidiCache.push(new CachedOrder(e.from,e.to,r,n)),n}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||browser.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{focusPreventScroll(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,r={}){return scrollIntoView$1.of(new ScrollTarget(typeof e=="number"?EditorSelection.cursor(e):e,r.y,r.x,r.yMargin,r.xMargin))}static domEventHandlers(e){return ViewPlugin.define(()=>({}),{eventHandlers:e})}static theme(e,r){let n=StyleModule.newName(),o=[theme.of(n),styleModule.of(buildTheme(`.${n}`,e))];return r&&r.dark&&o.push(darkTheme.of(!0)),o}static baseTheme(e){return Prec.lowest(styleModule.of(buildTheme("."+baseThemeID,e,lightDarkIDs)))}static findFromDOM(e){var r;let n=e.querySelector(".cm-content"),o=n&&ContentView.get(n)||ContentView.get(e);return((r=o==null?void 0:o.rootView)===null||r===void 0?void 0:r.view)||null}}EditorView.styleModule=styleModule;EditorView.inputHandler=inputHandler$1;EditorView.focusChangeEffect=focusChangeEffect;EditorView.perLineTextDirection=perLineTextDirection;EditorView.exceptionSink=exceptionSink;EditorView.updateListener=updateListener;EditorView.editable=editable;EditorView.mouseSelectionStyle=mouseSelectionStyle;EditorView.dragMovesSelection=dragMovesSelection$1;EditorView.clickAddsSelectionRange=clickAddsSelectionRange;EditorView.decorations=decorations;EditorView.atomicRanges=atomicRanges;EditorView.scrollMargins=scrollMargins;EditorView.darkTheme=darkTheme;EditorView.contentAttributes=contentAttributes;EditorView.editorAttributes=editorAttributes;EditorView.lineWrapping=EditorView.contentAttributes.of({class:"cm-lineWrapping"});EditorView.announce=StateEffect.define();const MaxBidiLine=4096,BadMeasure={};class CachedOrder{constructor(e,r,n,o){this.from=e,this.to=r,this.dir=n,this.order=o}static update(e,r){if(r.empty)return e;let n=[],o=e.length?e[e.length-1].dir:Direction.LTR;for(let a=Math.max(0,e.length-10);a<e.length;a++){let l=e[a];l.dir==o&&!r.touchesRange(l.from,l.to)&&n.push(new CachedOrder(r.mapPos(l.from,1),r.mapPos(l.to,-1),l.dir,l.order))}return n}}function attrsFromFacet(s,e,r){for(let n=s.state.facet(e),o=n.length-1;o>=0;o--){let a=n[o],l=typeof a=="function"?a(s):a;l&&combineAttrs(l,r)}return r}const currentPlatform=browser.mac?"mac":browser.windows?"win":browser.linux?"linux":"key";function normalizeKeyName(s,e){const r=s.split(/-(?!$)/);let n=r[r.length-1];n=="Space"&&(n=" ");let o,a,l,c;for(let h=0;h<r.length-1;++h){const f=r[h];if(/^(cmd|meta|m)$/i.test(f))c=!0;else if(/^a(lt)?$/i.test(f))o=!0;else if(/^(c|ctrl|control)$/i.test(f))a=!0;else if(/^s(hift)?$/i.test(f))l=!0;else if(/^mod$/i.test(f))e=="mac"?c=!0:a=!0;else throw new Error("Unrecognized modifier name: "+f)}return o&&(n="Alt-"+n),a&&(n="Ctrl-"+n),c&&(n="Meta-"+n),l&&(n="Shift-"+n),n}function modifiers(s,e,r){return e.altKey&&(s="Alt-"+s),e.ctrlKey&&(s="Ctrl-"+s),e.metaKey&&(s="Meta-"+s),r!==!1&&e.shiftKey&&(s="Shift-"+s),s}const handleKeyEvents=Prec.default(EditorView.domEventHandlers({keydown(s,e){return runHandlers(getKeymap(e.state),s,e,"editor")}})),keymap=Facet.define({enables:handleKeyEvents}),Keymaps=new WeakMap;function getKeymap(s){let e=s.facet(keymap),r=Keymaps.get(e);return r||Keymaps.set(e,r=buildKeymap(e.reduce((n,o)=>n.concat(o),[]))),r}let storedPrefix=null;const PrefixTimeout=4e3;function buildKeymap(s,e=currentPlatform){let r=Object.create(null),n=Object.create(null),o=(l,c)=>{let h=n[l];if(h==null)n[l]=c;else if(h!=c)throw new Error("Key binding "+l+" is used both as a regular binding and as a multi-stroke prefix")},a=(l,c,h,f,d)=>{var m,v;let A=r[l]||(r[l]=Object.create(null)),T=c.split(/ (?!$)/).map(F=>normalizeKeyName(F,e));for(let F=1;F<T.length;F++){let ke=T.slice(0,F).join(" ");o(ke,!0),A[ke]||(A[ke]={preventDefault:!0,stopPropagation:!1,run:[Qe=>{let xe=storedPrefix={view:Qe,prefix:ke,scope:l};return setTimeout(()=>{storedPrefix==xe&&(storedPrefix=null)},PrefixTimeout),!0}]})}let B=T.join(" ");o(B,!1);let Y=A[B]||(A[B]={preventDefault:!1,stopPropagation:!1,run:((v=(m=A._any)===null||m===void 0?void 0:m.run)===null||v===void 0?void 0:v.slice())||[]});h&&Y.run.push(h),f&&(Y.preventDefault=!0),d&&(Y.stopPropagation=!0)};for(let l of s){let c=l.scope?l.scope.split(" "):["editor"];if(l.any)for(let f of c){let d=r[f]||(r[f]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let m in d)d[m].run.push(l.any)}let h=l[e]||l.key;if(h)for(let f of c)a(f,h,l.run,l.preventDefault,l.stopPropagation),l.shift&&a(f,"Shift-"+h,l.shift,l.preventDefault,l.stopPropagation)}return r}function runHandlers(s,e,r,n){let o=keyName(e),a=codePointAt(o,0),l=codePointSize(a)==o.length&&o!=" ",c="",h=!1,f=!1,d=!1;storedPrefix&&storedPrefix.view==r&&storedPrefix.scope==n&&(c=storedPrefix.prefix+" ",modifierCodes.indexOf(e.keyCode)<0&&(f=!0,storedPrefix=null));let m=new Set,v=Y=>{if(Y){for(let F of Y.run)if(!m.has(F)&&(m.add(F),F(r,e)))return Y.stopPropagation&&(d=!0),!0;Y.preventDefault&&(Y.stopPropagation&&(d=!0),f=!0)}return!1},A=s[n],T,B;return A&&(v(A[c+modifiers(o,e,!l)])?h=!0:l&&(e.altKey||e.metaKey||e.ctrlKey)&&!(browser.windows&&e.ctrlKey&&e.altKey)&&(T=base[e.keyCode])&&T!=o?(v(A[c+modifiers(T,e,!0)])||e.shiftKey&&(B=shift[e.keyCode])!=o&&B!=T&&v(A[c+modifiers(B,e,!1)]))&&(h=!0):l&&e.shiftKey&&v(A[c+modifiers(o,e,!0)])&&(h=!0),!h&&v(A._any)&&(h=!0)),f&&(h=!0),h&&d&&e.stopPropagation(),h}class RectangleMarker{constructor(e,r,n,o,a){this.className=e,this.left=r,this.top=n,this.width=o,this.height=a}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,r){return r.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,r,n){if(n.empty){let o=e.coordsAtPos(n.head,n.assoc||1);if(!o)return[];let a=getBase$1(e);return[new RectangleMarker(r,o.left-a.left,o.top-a.top,null,o.bottom-o.top)]}else return rectanglesForRange(e,r,n)}}function getBase$1(s){let e=s.scrollDOM.getBoundingClientRect();return{left:(s.textDirection==Direction.LTR?e.left:e.right-s.scrollDOM.clientWidth)-s.scrollDOM.scrollLeft,top:e.top-s.scrollDOM.scrollTop}}function wrappedLine(s,e,r){let n=EditorSelection.cursor(e);return{from:Math.max(r.from,s.moveToLineBoundary(n,!1,!0).from),to:Math.min(r.to,s.moveToLineBoundary(n,!0,!0).from),type:BlockType.Text}}function rectanglesForRange(s,e,r){if(r.to<=s.viewport.from||r.from>=s.viewport.to)return[];let n=Math.max(r.from,s.viewport.from),o=Math.min(r.to,s.viewport.to),a=s.textDirection==Direction.LTR,l=s.contentDOM,c=l.getBoundingClientRect(),h=getBase$1(s),f=l.querySelector(".cm-line"),d=f&&window.getComputedStyle(f),m=c.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),v=c.right-(d?parseInt(d.paddingRight):0),A=blockAt(s,n),T=blockAt(s,o),B=A.type==BlockType.Text?A:null,Y=T.type==BlockType.Text?T:null;if(B&&(s.lineWrapping||A.widgetLineBreaks)&&(B=wrappedLine(s,n,B)),Y&&(s.lineWrapping||T.widgetLineBreaks)&&(Y=wrappedLine(s,o,Y)),B&&Y&&B.from==Y.from)return ke(Qe(r.from,r.to,B));{let Te=B?Qe(r.from,null,B):xe(A,!1),Le=Y?Qe(null,r.to,Y):xe(T,!0),Me=[];return(B||A).to<(Y||T).from-(B&&Y?1:0)||A.widgetLineBreaks>1&&Te.bottom+s.defaultLineHeight/2<Le.top?Me.push(F(m,Te.bottom,v,Le.top)):Te.bottom<Le.top&&s.elementAtHeight((Te.bottom+Le.top)/2).type==BlockType.Text&&(Te.bottom=Le.top=(Te.bottom+Le.top)/2),ke(Te).concat(Me).concat(ke(Le))}function F(Te,Le,Me,ot){return new RectangleMarker(e,Te-h.left,Le-h.top-.01,Me-Te,ot-Le+.01)}function ke({top:Te,bottom:Le,horizontal:Me}){let ot=[];for(let Fe=0;Fe<Me.length;Fe+=2)ot.push(F(Me[Fe],Te,Me[Fe+1],Le));return ot}function Qe(Te,Le,Me){let ot=1e9,Fe=-1e9,Ve=[];function at(nt,ft,it,pt,lt){let st=s.coordsAtPos(nt,nt==Me.to?-2:2),mt=s.coordsAtPos(it,it==Me.from?2:-2);!st||!mt||(ot=Math.min(st.top,mt.top,ot),Fe=Math.max(st.bottom,mt.bottom,Fe),lt==Direction.LTR?Ve.push(a&&ft?m:st.left,a&&pt?v:mt.right):Ve.push(!a&&pt?m:mt.left,!a&&ft?v:st.right))}let dt=Te??Me.from,ct=Le??Me.to;for(let nt of s.visibleRanges)if(nt.to>dt&&nt.from<ct)for(let ft=Math.max(nt.from,dt),it=Math.min(nt.to,ct);;){let pt=s.state.doc.lineAt(ft);for(let lt of s.bidiSpans(pt)){let st=lt.from+pt.from,mt=lt.to+pt.from;if(st>=it)break;mt>ft&&at(Math.max(st,ft),Te==null&&st<=dt,Math.min(mt,it),Le==null&&mt>=ct,lt.dir)}if(ft=pt.to+1,ft>=it)break}return Ve.length==0&&at(dt,Te==null,ct,Le==null,s.textDirection),{top:ot,bottom:Fe,horizontal:Ve}}function xe(Te,Le){let Me=c.top+(Le?Te.top:Te.bottom);return{top:Me,bottom:Me,horizontal:[]}}}function sameMarker(s,e){return s.constructor==e.constructor&&s.eq(e)}class LayerView{constructor(e,r){this.view=e,this.layer=r,this.drawn=[],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"),r.above&&this.dom.classList.add("cm-layer-above"),r.class&&this.dom.classList.add(r.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),r.mount&&r.mount(this.dom,e)}update(e){e.startState.facet(layerOrder)!=e.state.facet(layerOrder)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&e.view.requestMeasure(this.measureReq)}setOrder(e){let r=0,n=e.facet(layerOrder);for(;r<n.length&&n[r]!=this.layer;)r++;this.dom.style.zIndex=String((this.layer.above?150:-1)-r)}measure(){return this.layer.markers(this.view)}draw(e){if(e.length!=this.drawn.length||e.some((r,n)=>!sameMarker(r,this.drawn[n]))){let r=this.dom.firstChild,n=0;for(let o of e)o.update&&r&&o.constructor&&this.drawn[n].constructor&&o.update(r,this.drawn[n])?(r=r.nextSibling,n++):this.dom.insertBefore(o.draw(),r);for(;r;){let o=r.nextSibling;r.remove(),r=o}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const layerOrder=Facet.define();function layer(s){return[ViewPlugin.define(e=>new LayerView(e,s)),layerOrder.of(s)]}const CanHidePrimary=!browser.ios,selectionConfig=Facet.define({combine(s){return combineConfig(s,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,r)=>Math.min(e,r),drawRangeCursor:(e,r)=>e||r})}});function drawSelection(s={}){return[selectionConfig.of(s),cursorLayer,selectionLayer,hideNativeSelection$1,nativeSelectionHidden.of(!0)]}function configChanged(s){return s.startState.facet(selectionConfig)!=s.state.facet(selectionConfig)}const cursorLayer=layer({above:!0,markers(s){let{state:e}=s,r=e.facet(selectionConfig),n=[];for(let o of e.selection.ranges){let a=o==e.selection.main;if(o.empty?!a||CanHidePrimary:r.drawRangeCursor){let l=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=o.empty?o:EditorSelection.cursor(o.head,o.head>o.anchor?-1:1);for(let h of RectangleMarker.forRange(s,l,c))n.push(h)}}return n},update(s,e){s.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let r=configChanged(s);return r&&setBlinkRate(s.state,e),s.docChanged||s.selectionSet||r},mount(s,e){setBlinkRate(e.state,s)},class:"cm-cursorLayer"});function setBlinkRate(s,e){e.style.animationDuration=s.facet(selectionConfig).cursorBlinkRate+"ms"}const selectionLayer=layer({above:!1,markers(s){return s.state.selection.ranges.map(e=>e.empty?[]:RectangleMarker.forRange(s,"cm-selectionBackground",e)).reduce((e,r)=>e.concat(r))},update(s,e){return s.docChanged||s.selectionSet||s.viewportChanged||configChanged(s)},class:"cm-selectionLayer"}),themeSpec$1={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};CanHidePrimary&&(themeSpec$1[".cm-line"].caretColor="transparent !important");const hideNativeSelection$1=Prec.highest(EditorView.theme(themeSpec$1)),setDropCursorPos=StateEffect.define({map(s,e){return s==null?null:e.mapPos(s)}}),dropCursorPos=StateField.define({create(){return null},update(s,e){return s!=null&&(s=e.changes.mapPos(s)),e.effects.reduce((r,n)=>n.is(setDropCursorPos)?n.value:r,s)}}),drawDropCursor=ViewPlugin.fromClass(class{constructor(s){this.view=s,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(s){var e;let r=s.state.field(dropCursorPos);r==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(s.startState.field(dropCursorPos)!=r||s.docChanged||s.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let s=this.view.state.field(dropCursorPos),e=s!=null&&this.view.coordsAtPos(s);if(!e)return null;let r=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-r.left+this.view.scrollDOM.scrollLeft,top:e.top-r.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(s){this.cursor&&(s?(this.cursor.style.left=s.left+"px",this.cursor.style.top=s.top+"px",this.cursor.style.height=s.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(s){this.view.state.field(dropCursorPos)!=s&&this.view.dispatch({effects:setDropCursorPos.of(s)})}},{eventHandlers:{dragover(s){this.setDropPos(this.view.posAtCoords({x:s.clientX,y:s.clientY}))},dragleave(s){(s.target==this.view.contentDOM||!this.view.contentDOM.contains(s.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function dropCursor(){return[dropCursorPos,drawDropCursor]}function iterMatches(s,e,r,n,o){e.lastIndex=0;for(let a=s.iterRange(r,n),l=r,c;!a.next().done;l+=a.value.length)if(!a.lineBreak)for(;c=e.exec(a.value);)o(l+c.index,c)}function matchRanges(s,e){let r=s.visibleRanges;if(r.length==1&&r[0].from==s.viewport.from&&r[0].to==s.viewport.to)return r;let n=[];for(let{from:o,to:a}of r)o=Math.max(s.state.doc.lineAt(o).from,o-e),a=Math.min(s.state.doc.lineAt(a).to,a+e),n.length&&n[n.length-1].to>=o?n[n.length-1].to=a:n.push({from:o,to:a});return n}class MatchDecorator{constructor(e){const{regexp:r,decoration:n,decorate:o,boundary:a,maxLength:l=1e3}=e;if(!r.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=r,o)this.addMatch=(c,h,f,d)=>o(d,f,f+c[0].length,c,h);else if(typeof n=="function")this.addMatch=(c,h,f,d)=>{let m=n(c,h,f);m&&d(f,f+c[0].length,m)};else if(n)this.addMatch=(c,h,f,d)=>d(f,f+c[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=a,this.maxLength=l}createDeco(e){let r=new RangeSetBuilder,n=r.add.bind(r);for(let{from:o,to:a}of matchRanges(e,this.maxLength))iterMatches(e.state.doc,this.regexp,o,a,(l,c)=>this.addMatch(c,e,l,n));return r.finish()}updateDeco(e,r){let n=1e9,o=-1;return e.docChanged&&e.changes.iterChanges((a,l,c,h)=>{h>e.view.viewport.from&&c<e.view.viewport.to&&(n=Math.min(c,n),o=Math.max(h,o))}),e.viewportChanged||o-n>1e3?this.createDeco(e.view):o>-1?this.updateRange(e.view,r.map(e.changes),n,o):r}updateRange(e,r,n,o){for(let a of e.visibleRanges){let l=Math.max(a.from,n),c=Math.min(a.to,o);if(c>l){let h=e.state.doc.lineAt(l),f=h.to<c?e.state.doc.lineAt(c):h,d=Math.max(a.from,h.from),m=Math.min(a.to,f.to);if(this.boundary){for(;l>h.from;l--)if(this.boundary.test(h.text[l-1-h.from])){d=l;break}for(;c<f.to;c++)if(this.boundary.test(f.text[c-f.from])){m=c;break}}let v=[],A,T=(B,Y,F)=>v.push(F.range(B,Y));if(h==f)for(this.regexp.lastIndex=d-h.from;(A=this.regexp.exec(h.text))&&A.index<m-h.from;)this.addMatch(A,e,A.index+h.from,T);else iterMatches(e.state.doc,this.regexp,d,m,(B,Y)=>this.addMatch(Y,e,B,T));r=r.update({filterFrom:d,filterTo:m,filter:(B,Y)=>B<d||Y>m,add:v})}}return r}}const UnicodeRegexpSupport=/x/.unicode!=null?"gu":"g",Specials=new RegExp(`[\0-\b
|
||
--\u2028\u2029\uFEFF-]`,UnicodeRegexpSupport),Names={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let _supportsTabSize=null;function supportsTabSize(){var s;if(_supportsTabSize==null&&typeof document<"u"&&document.body){let e=document.body.style;_supportsTabSize=((s=e.tabSize)!==null&&s!==void 0?s:e.MozTabSize)!=null}return _supportsTabSize||!1}const specialCharConfig=Facet.define({combine(s){let e=combineConfig(s,{render:null,specialChars:Specials,addSpecialChars:null});return(e.replaceTabs=!supportsTabSize())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,UnicodeRegexpSupport)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,UnicodeRegexpSupport)),e}});function highlightSpecialChars(s={}){return[specialCharConfig.of(s),specialCharPlugin()]}let _plugin=null;function specialCharPlugin(){return _plugin||(_plugin=ViewPlugin.fromClass(class{constructor(s){this.view=s,this.decorations=Decoration.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(s.state.facet(specialCharConfig)),this.decorations=this.decorator.createDeco(s)}makeDecorator(s){return new MatchDecorator({regexp:s.specialChars,decoration:(e,r,n)=>{let{doc:o}=r.state,a=codePointAt(e[0],0);if(a==9){let l=o.lineAt(n),c=r.state.tabSize,h=countColumn(l.text,c,n-l.from);return Decoration.replace({widget:new TabWidget((c-h%c)*this.view.defaultCharacterWidth)})}return this.decorationCache[a]||(this.decorationCache[a]=Decoration.replace({widget:new SpecialCharWidget(s,a)}))},boundary:s.replaceTabs?void 0:/[^]/})}update(s){let e=s.state.facet(specialCharConfig);s.startState.facet(specialCharConfig)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(s.view)):this.decorations=this.decorator.updateDeco(s,this.decorations)}},{decorations:s=>s.decorations}))}const DefaultPlaceholder="•";function placeholder$1(s){return s>=32?DefaultPlaceholder:s==10?"":String.fromCharCode(9216+s)}class SpecialCharWidget extends WidgetType{constructor(e,r){super(),this.options=e,this.code=r}eq(e){return e.code==this.code}toDOM(e){let r=placeholder$1(this.code),n=e.state.phrase("Control character")+" "+(Names[this.code]||"0x"+this.code.toString(16)),o=this.options.render&&this.options.render(this.code,n,r);if(o)return o;let a=document.createElement("span");return a.textContent=r,a.title=n,a.setAttribute("aria-label",n),a.className="cm-specialChar",a}ignoreEvent(){return!1}}class TabWidget extends WidgetType{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function highlightActiveLine(){return activeLineHighlighter}const lineDeco=Decoration.line({class:"cm-activeLine"}),activeLineHighlighter=ViewPlugin.fromClass(class{constructor(s){this.decorations=this.getDeco(s)}update(s){(s.docChanged||s.selectionSet)&&(this.decorations=this.getDeco(s.view))}getDeco(s){let e=-1,r=[];for(let n of s.state.selection.ranges){let o=s.lineBlockAt(n.head);o.from>e&&(r.push(lineDeco.range(o.from)),e=o.from)}return Decoration.set(r)}},{decorations:s=>s.decorations}),MaxOff=2e3;function rectangleFor(s,e,r){let n=Math.min(e.line,r.line),o=Math.max(e.line,r.line),a=[];if(e.off>MaxOff||r.off>MaxOff||e.col<0||r.col<0){let l=Math.min(e.off,r.off),c=Math.max(e.off,r.off);for(let h=n;h<=o;h++){let f=s.doc.line(h);f.length<=c&&a.push(EditorSelection.range(f.from+l,f.to+c))}}else{let l=Math.min(e.col,r.col),c=Math.max(e.col,r.col);for(let h=n;h<=o;h++){let f=s.doc.line(h),d=findColumn(f.text,l,s.tabSize,!0);if(d<0)a.push(EditorSelection.cursor(f.to));else{let m=findColumn(f.text,c,s.tabSize);a.push(EditorSelection.range(f.from+d,f.from+m))}}}return a}function absoluteColumn(s,e){let r=s.coordsAtPos(s.viewport.from);return r?Math.round(Math.abs((r.left-e)/s.defaultCharacterWidth)):-1}function getPos(s,e){let r=s.posAtCoords({x:e.clientX,y:e.clientY},!1),n=s.state.doc.lineAt(r),o=r-n.from,a=o>MaxOff?-1:o==n.length?absoluteColumn(s,e.clientX):countColumn(n.text,s.state.tabSize,r-n.from);return{line:n.number,col:a,off:o}}function rectangleSelectionStyle(s,e){let r=getPos(s,e),n=s.state.selection;return r?{update(o){if(o.docChanged){let a=o.changes.mapPos(o.startState.doc.line(r.line).from),l=o.state.doc.lineAt(a);r={line:l.number,col:r.col,off:Math.min(r.off,l.length)},n=n.map(o.changes)}},get(o,a,l){let c=getPos(s,o);if(!c)return n;let h=rectangleFor(s.state,r,c);return h.length?l?EditorSelection.create(h.concat(n.ranges)):EditorSelection.create(h):n}}:null}function rectangularSelection(s){let e=(s==null?void 0:s.eventFilter)||(r=>r.altKey&&r.button==0);return EditorView.mouseSelectionStyle.of((r,n)=>e(n)?rectangleSelectionStyle(r,n):null)}const keys$1={Alt:[18,s=>!!s.altKey],Control:[17,s=>!!s.ctrlKey],Shift:[16,s=>!!s.shiftKey],Meta:[91,s=>!!s.metaKey]},showCrosshair={style:"cursor: crosshair"};function crosshairCursor(s={}){let[e,r]=keys$1[s.key||"Alt"],n=ViewPlugin.fromClass(class{constructor(o){this.view=o,this.isDown=!1}set(o){this.isDown!=o&&(this.isDown=o,this.view.update([]))}},{eventHandlers:{keydown(o){this.set(o.keyCode==e||r(o))},keyup(o){(o.keyCode==e||!r(o))&&this.set(!1)},mousemove(o){this.set(r(o))}}});return[n,EditorView.contentAttributes.of(o=>{var a;return!((a=o.plugin(n))===null||a===void 0)&&a.isDown?showCrosshair:null})]}const Outside="-10000px";class TooltipViewManager{constructor(e,r,n){this.facet=r,this.createTooltipView=n,this.input=e.state.facet(r),this.tooltips=this.input.filter(o=>o),this.tooltipViews=this.tooltips.map(n)}update(e){var r;let n=e.state.facet(this.facet),o=n.filter(l=>l);if(n===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let a=[];for(let l=0;l<o.length;l++){let c=o[l],h=-1;if(c){for(let f=0;f<this.tooltips.length;f++){let d=this.tooltips[f];d&&d.create==c.create&&(h=f)}if(h<0)a[l]=this.createTooltipView(c);else{let f=a[l]=this.tooltipViews[h];f.update&&f.update(e)}}}for(let l of this.tooltipViews)a.indexOf(l)<0&&(l.dom.remove(),(r=l.destroy)===null||r===void 0||r.call(l));return this.input=n,this.tooltips=o,this.tooltipViews=a,!0}}function windowSpace(s){let{win:e}=s;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const tooltipConfig=Facet.define({combine:s=>{var e,r,n;return{position:browser.ios?"absolute":((e=s.find(o=>o.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((r=s.find(o=>o.parent))===null||r===void 0?void 0:r.parent)||null,tooltipSpace:((n=s.find(o=>o.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||windowSpace}}}),knownHeight=new WeakMap,tooltipPlugin=ViewPlugin.fromClass(class{constructor(s){this.view=s,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=s.state.facet(tooltipConfig);this.position=e.position,this.parent=e.parent,this.classes=s.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new TooltipViewManager(s,showTooltip,r=>this.createTooltip(r)),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(r=>{Date.now()>this.lastTransaction-50&&r.length>0&&r[r.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),s.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let s of this.manager.tooltipViews)this.intersectionObserver.observe(s.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(s){s.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(s);e&&this.observeIntersection();let r=e||s.geometryChanged,n=s.state.facet(tooltipConfig);if(n.position!=this.position){this.position=n.position;for(let o of this.manager.tooltipViews)o.dom.style.position=this.position;r=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let o of this.manager.tooltipViews)this.container.appendChild(o.dom);r=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);r&&this.maybeMeasure()}createTooltip(s){let e=s.create(this.view);if(e.dom.classList.add("cm-tooltip"),s.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",e.dom.appendChild(r)}return e.dom.style.position=this.position,e.dom.style.top=Outside,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var s,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(s=r.destroy)===null||s===void 0||s.call(r);(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let s=this.view.dom.getBoundingClientRect();return{editor:s,parent:this.parent?this.container.getBoundingClientRect():s,pos:this.manager.tooltips.map((e,r)=>{let n=this.manager.tooltipViews[r];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(tooltipConfig).tooltipSpace(this.view)}}writeMeasure(s){var e;let{editor:r,space:n}=s,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:h}=c,f=s.pos[a],d=s.size[a];if(!f||f.bottom<=Math.max(r.top,n.top)||f.top>=Math.min(r.bottom,n.bottom)||f.right<Math.max(r.left,n.left)-.1||f.left>Math.min(r.right,n.right)+.1){h.style.top=Outside;continue}let m=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,v=m?7:0,A=d.right-d.left,T=(e=knownHeight.get(c))!==null&&e!==void 0?e:d.bottom-d.top,B=c.offset||noOffset,Y=this.view.textDirection==Direction.LTR,F=d.width>n.right-n.left?Y?n.left:n.right-d.width:Y?Math.min(f.left-(m?14:0)+B.x,n.right-A):Math.max(n.left,f.left-A+(m?14:0)-B.x),ke=!!l.above;!l.strictSide&&(ke?f.top-(d.bottom-d.top)-B.y<n.top:f.bottom+(d.bottom-d.top)+B.y>n.bottom)&&ke==n.bottom-f.bottom>f.top-n.top&&(ke=!ke);let Qe=(ke?f.top-n.top:n.bottom-f.bottom)-v;if(Qe<T&&c.resize!==!1){if(Qe<this.view.defaultLineHeight){h.style.top=Outside;continue}knownHeight.set(c,T),h.style.height=(T=Qe)+"px"}else h.style.height&&(h.style.height="");let xe=ke?f.top-T-v-B.y:f.bottom+v+B.y,Te=F+A;if(c.overlap!==!0)for(let Le of o)Le.left<Te&&Le.right>F&&Le.top<xe+T&&Le.bottom>xe&&(xe=ke?Le.top-T-2-v:Le.bottom+v+2);this.position=="absolute"?(h.style.top=xe-s.parent.top+"px",h.style.left=F-s.parent.left+"px"):(h.style.top=xe+"px",h.style.left=F+"px"),m&&(m.style.left=`${f.left+(Y?B.x:-B.x)-(F+14-7)}px`),c.overlap!==!0&&o.push({left:F,top:xe,right:Te,bottom:xe+T}),h.classList.toggle("cm-tooltip-above",ke),h.classList.toggle("cm-tooltip-below",!ke),c.positioned&&c.positioned(s.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let s of this.manager.tooltipViews)s.dom.style.top=Outside}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),baseTheme$3=EditorView.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),noOffset={x:0,y:0},showTooltip=Facet.define({enables:[tooltipPlugin,baseTheme$3]}),showHoverTooltip=Facet.define();class HoverTooltipHost{constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new TooltipViewManager(e,showHoverTooltip,r=>this.createHostedView(r))}static create(e){return new HoverTooltipHost(e)}createHostedView(e){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(r.dom),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let r of this.manager.tooltipViews)r.mount&&r.mount(e);this.mounted=!0}positioned(e){for(let r of this.manager.tooltipViews)r.positioned&&r.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let r of this.manager.tooltipViews)(e=r.destroy)===null||e===void 0||e.call(r)}}const showHoverTooltipHost=showTooltip.compute([showHoverTooltip],s=>{let e=s.facet(showHoverTooltip).filter(r=>r);return e.length===0?null:{pos:Math.min(...e.map(r=>r.pos)),end:Math.max(...e.filter(r=>r.end!=null).map(r=>r.end)),create:HoverTooltipHost.create,above:e[0].above,arrow:e.some(r=>r.arrow)}});class HoverPlugin{constructor(e,r,n,o,a){this.view=e,this.source=r,this.field=n,this.setHover=o,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{lastMove:e}=this,r=this.view.contentDOM.contains(e.target)?this.view.posAtCoords(e):null;if(r==null)return;let n=this.view.coordsAtPos(r);if(n==null||e.y<n.top||e.y>n.bottom||e.x<n.left-this.view.defaultCharacterWidth||e.x>n.right+this.view.defaultCharacterWidth)return;let o=this.view.bidiSpans(this.view.state.doc.lineAt(r)).find(c=>c.from<=r&&c.to>=r),a=o&&o.dir==Direction.RTL?-1:1,l=this.source(this.view,r,e.x<n.left?-a:a);if(l!=null&&l.then){let c=this.pending={pos:r};l.then(h=>{this.pending==c&&(this.pending=null,h&&this.view.dispatch({effects:this.setHover.of(h)}))},h=>logException(this.view.state,h,"hover tooltip"))}else l&&this.view.dispatch({effects:this.setHover.of(l)})}mousemove(e){var r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let n=this.active;if(n&&!isInTooltip(this.lastMove.target)||this.pending){let{pos:o}=n||this.pending,a=(r=n==null?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!isOverRange(this.view,o,a,e.clientX,e.clientY,6))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!isInTooltip(e.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function isInTooltip(s){for(let e=s;e;e=e.parentNode)if(e.nodeType==1&&e.classList.contains("cm-tooltip"))return!0;return!1}function isOverRange(s,e,r,n,o,a){let l=document.createRange(),c=s.domAtPos(e),h=s.domAtPos(r);l.setEnd(h.node,h.offset),l.setStart(c.node,c.offset);let f=l.getClientRects();l.detach();for(let d=0;d<f.length;d++){let m=f[d];if(Math.max(m.top-o,o-m.bottom,m.left-n,n-m.right)<=a)return!0}return!1}function hoverTooltip(s,e={}){let r=StateEffect.define(),n=StateField.define({create(){return null},update(o,a){if(o&&(e.hideOnChange&&(a.docChanged||a.selection)||e.hideOn&&e.hideOn(a,o)))return null;if(o&&a.docChanged){let l=a.changes.mapPos(o.pos,-1,MapMode.TrackDel);if(l==null)return null;let c=Object.assign(Object.create(null),o);c.pos=l,o.end!=null&&(c.end=a.changes.mapPos(o.end)),o=c}for(let l of a.effects)l.is(r)&&(o=l.value),l.is(closeHoverTooltipEffect)&&(o=null);return o},provide:o=>showHoverTooltip.from(o)});return[n,ViewPlugin.define(o=>new HoverPlugin(o,s,n,r,e.hoverTime||300)),showHoverTooltipHost]}function getTooltip(s,e){let r=s.plugin(tooltipPlugin);if(!r)return null;let n=r.manager.tooltips.indexOf(e);return n<0?null:r.manager.tooltipViews[n]}const closeHoverTooltipEffect=StateEffect.define(),panelConfig=Facet.define({combine(s){let e,r;for(let n of s)e=e||n.topContainer,r=r||n.bottomContainer;return{topContainer:e,bottomContainer:r}}});function getPanel(s,e){let r=s.plugin(panelPlugin),n=r?r.specs.indexOf(e):-1;return n>-1?r.panels[n]:null}const panelPlugin=ViewPlugin.fromClass(class{constructor(s){this.input=s.state.facet(showPanel),this.specs=this.input.filter(r=>r),this.panels=this.specs.map(r=>r(s));let e=s.state.facet(panelConfig);this.top=new PanelGroup(s,!0,e.topContainer),this.bottom=new PanelGroup(s,!1,e.bottomContainer),this.top.sync(this.panels.filter(r=>r.top)),this.bottom.sync(this.panels.filter(r=>!r.top));for(let r of this.panels)r.dom.classList.add("cm-panel"),r.mount&&r.mount()}update(s){let e=s.state.facet(panelConfig);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new PanelGroup(s.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new PanelGroup(s.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let r=s.state.facet(showPanel);if(r!=this.input){let n=r.filter(h=>h),o=[],a=[],l=[],c=[];for(let h of n){let f=this.specs.indexOf(h),d;f<0?(d=h(s.view),c.push(d)):(d=this.panels[f],d.update&&d.update(s)),o.push(d),(d.top?a:l).push(d)}this.specs=n,this.panels=o,this.top.sync(a),this.bottom.sync(l);for(let h of c)h.dom.classList.add("cm-panel"),h.mount&&h.mount()}else for(let n of this.panels)n.update&&n.update(s)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:s=>EditorView.scrollMargins.of(e=>{let r=e.plugin(s);return r&&{top:r.top.scrollMargin(),bottom:r.bottom.scrollMargin()}})});class PanelGroup{constructor(e,r,n){this.view=e,this.top=r,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let r of this.panels)r.destroy&&e.indexOf(r)<0&&r.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}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";let r=this.container||this.view.dom;r.insertBefore(this.dom,this.top?r.firstChild:null)}let e=this.dom.firstChild;for(let r of this.panels)if(r.dom.parentNode==this.dom){for(;e!=r.dom;)e=rm(e);e=e.nextSibling}else this.dom.insertBefore(r.dom,e);for(;e;)e=rm(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function rm(s){let e=s.nextSibling;return s.remove(),e}const showPanel=Facet.define({enables:panelPlugin});class GutterMarker extends RangeValue{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}GutterMarker.prototype.elementClass="";GutterMarker.prototype.toDOM=void 0;GutterMarker.prototype.mapMode=MapMode.TrackBefore;GutterMarker.prototype.startSide=GutterMarker.prototype.endSide=-1;GutterMarker.prototype.point=!0;const gutterLineClass=Facet.define(),activeGutters=Facet.define(),unfixGutters=Facet.define({combine:s=>s.some(e=>e)});function gutters(s){let e=[gutterView];return s&&s.fixed===!1&&e.push(unfixGutters.of(!0)),e}const gutterView=ViewPlugin.fromClass(class{constructor(s){this.view=s,this.prevViewport=s.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=s.state.facet(activeGutters).map(e=>new SingleGutterView(s,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!s.state.facet(unfixGutters),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),s.scrollDOM.insertBefore(this.dom,s.contentDOM)}update(s){if(this.updateGutters(s)){let e=this.prevViewport,r=s.view.viewport,n=Math.min(e.to,r.to)-Math.max(e.from,r.from);this.syncGutters(n<(r.to-r.from)*.8)}s.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(unfixGutters)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=s.view.viewport}syncGutters(s){let e=this.dom.nextSibling;s&&this.dom.remove();let r=RangeSet.iter(this.view.state.facet(gutterLineClass),this.view.viewport.from),n=[],o=this.gutters.map(a=>new UpdateContext(a,this.view.viewport,-this.view.documentPadding.top));for(let a of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(a.type)){let l=!0;for(let c of a.type)if(c.type==BlockType.Text&&l){advanceCursor(r,n,c.from);for(let h of o)h.line(this.view,c,n);l=!1}else if(c.widget)for(let h of o)h.widget(this.view,c)}else if(a.type==BlockType.Text){advanceCursor(r,n,a.from);for(let l of o)l.line(this.view,a,n)}for(let a of o)a.finish();s&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(s){let e=s.startState.facet(activeGutters),r=s.state.facet(activeGutters),n=s.docChanged||s.heightChanged||s.viewportChanged||!RangeSet.eq(s.startState.facet(gutterLineClass),s.state.facet(gutterLineClass),s.view.viewport.from,s.view.viewport.to);if(e==r)for(let o of this.gutters)o.update(s)&&(n=!0);else{n=!0;let o=[];for(let a of r){let l=e.indexOf(a);l<0?o.push(new SingleGutterView(this.view,a)):(this.gutters[l].update(s),o.push(this.gutters[l]))}for(let a of this.gutters)a.dom.remove(),o.indexOf(a)<0&&a.destroy();for(let a of o)this.dom.appendChild(a.dom);this.gutters=o}return n}destroy(){for(let s of this.gutters)s.destroy();this.dom.remove()}},{provide:s=>EditorView.scrollMargins.of(e=>{let r=e.plugin(s);return!r||r.gutters.length==0||!r.fixed?null:e.textDirection==Direction.LTR?{left:r.dom.offsetWidth}:{right:r.dom.offsetWidth}})});function asArray(s){return Array.isArray(s)?s:[s]}function advanceCursor(s,e,r){for(;s.value&&s.from<=r;)s.from==r&&e.push(s.value),s.next()}class UpdateContext{constructor(e,r,n){this.gutter=e,this.height=n,this.i=0,this.cursor=RangeSet.iter(e.markers,r.from)}addElement(e,r,n){let{gutter:o}=this,a=r.top-this.height;if(this.i==o.elements.length){let l=new GutterElement(e,r.height,a,n);o.elements.push(l),o.dom.appendChild(l.dom)}else o.elements[this.i].update(e,r.height,a,n);this.height=r.bottom,this.i++}line(e,r,n){let o=[];advanceCursor(this.cursor,o,r.from),n.length&&(o=o.concat(n));let a=this.gutter.config.lineMarker(e,r,o);a&&o.unshift(a);let l=this.gutter;o.length==0&&!l.config.renderEmptyElements||this.addElement(e,r,o)}widget(e,r){let n=this.gutter.config.widgetMarker(e,r.widget,r);n&&this.addElement(e,r,[n])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let r=e.elements.pop();e.dom.removeChild(r.dom),r.destroy()}}}class SingleGutterView{constructor(e,r){this.view=e,this.config=r,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in r.domEventHandlers)this.dom.addEventListener(n,o=>{let a=o.target,l;if(a!=this.dom&&this.dom.contains(a)){for(;a.parentNode!=this.dom;)a=a.parentNode;let h=a.getBoundingClientRect();l=(h.top+h.bottom)/2}else l=o.clientY;let c=e.lineBlockAtHeight(l-e.documentTop);r.domEventHandlers[n](e,c,o)&&o.preventDefault()});this.markers=asArray(r.markers(e)),r.initialSpacer&&(this.spacer=new GutterElement(e,0,0,[r.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let r=this.markers;if(this.markers=asArray(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let o=this.config.updateSpacer(this.spacer.markers[0],e);o!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[o])}let n=e.view.viewport;return!RangeSet.eq(this.markers,r,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class GutterElement{constructor(e,r,n,o){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,r,n,o)}update(e,r,n,o){this.height!=r&&(this.dom.style.height=(this.height=r)+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),sameMarkers(this.markers,o)||this.setMarkers(e,o)}setMarkers(e,r){let n="cm-gutterElement",o=this.dom.firstChild;for(let a=0,l=0;;){let c=l,h=a<r.length?r[a++]:null,f=!1;if(h){let d=h.elementClass;d&&(n+=" "+d);for(let m=l;m<this.markers.length;m++)if(this.markers[m].compare(h)){c=m,f=!0;break}}else c=this.markers.length;for(;l<c;){let d=this.markers[l++];if(d.toDOM){d.destroy(o);let m=o.nextSibling;o.remove(),o=m}}if(!h)break;h.toDOM&&(f?o=o.nextSibling:this.dom.insertBefore(h.toDOM(e),o)),f&&l++}this.dom.className=n,this.markers=r}destroy(){this.setMarkers(null,[])}}function sameMarkers(s,e){if(s.length!=e.length)return!1;for(let r=0;r<s.length;r++)if(!s[r].compare(e[r]))return!1;return!0}const lineNumberMarkers=Facet.define(),lineNumberConfig=Facet.define({combine(s){return combineConfig(s,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,r){let n=Object.assign({},e);for(let o in r){let a=n[o],l=r[o];n[o]=a?(c,h,f)=>a(c,h,f)||l(c,h,f):l}return n}})}});class NumberMarker extends GutterMarker{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function formatNumber(s,e){return s.state.facet(lineNumberConfig).formatNumber(e,s.state)}const lineNumberGutter=activeGutters.compute([lineNumberConfig],s=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(lineNumberMarkers)},lineMarker(e,r,n){return n.some(o=>o.toDOM)?null:new NumberMarker(formatNumber(e,e.state.doc.lineAt(r.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(lineNumberConfig)!=e.state.facet(lineNumberConfig),initialSpacer(e){return new NumberMarker(formatNumber(e,maxLineNumber(e.state.doc.lines)))},updateSpacer(e,r){let n=formatNumber(r.view,maxLineNumber(r.view.state.doc.lines));return n==e.number?e:new NumberMarker(n)},domEventHandlers:s.facet(lineNumberConfig).domEventHandlers}));function lineNumbers(s={}){return[lineNumberConfig.of(s),gutters(),lineNumberGutter]}function maxLineNumber(s){let e=9;for(;e<s;)e=e*10+9;return e}const activeLineGutterMarker=new class extends GutterMarker{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},activeLineGutterHighlighter=gutterLineClass.compute(["selection"],s=>{let e=[],r=-1;for(let n of s.selection.ranges){let o=s.doc.lineAt(n.head).from;o>r&&(r=o,e.push(activeLineGutterMarker.range(o)))}return RangeSet.of(e)});function highlightActiveLineGutter(){return activeLineGutterHighlighter}const DefaultBufferLength=1024;let nextPropID=0;class Range{constructor(e,r){this.from=e,this.to=r}}class NodeProp{constructor(e={}){this.id=nextPropID++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=NodeType.match(e)),r=>{let n=e(r);return n===void 0?null:[this,n]}}}NodeProp.closedBy=new NodeProp({deserialize:s=>s.split(" ")});NodeProp.openedBy=new NodeProp({deserialize:s=>s.split(" ")});NodeProp.group=new NodeProp({deserialize:s=>s.split(" ")});NodeProp.contextHash=new NodeProp({perNode:!0});NodeProp.lookAhead=new NodeProp({perNode:!0});NodeProp.mounted=new NodeProp({perNode:!0});class MountedTree{constructor(e,r,n){this.tree=e,this.overlay=r,this.parser=n}}const noProps=Object.create(null);class NodeType{constructor(e,r,n,o=0){this.name=e,this.props=r,this.id=n,this.flags=o}static define(e){let r=e.props&&e.props.length?Object.create(null):noProps,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),o=new NodeType(e.name||"",r,e.id,n);if(e.props){for(let a of e.props)if(Array.isArray(a)||(a=a(o)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[a[0].id]=a[1]}}return o}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let r=this.prop(NodeProp.group);return r?r.indexOf(e)>-1:!1}return this.id==e}static match(e){let r=Object.create(null);for(let n in e)for(let o of n.split(" "))r[o]=e[n];return n=>{for(let o=n.prop(NodeProp.group),a=-1;a<(o?o.length:0);a++){let l=r[a<0?n.name:o[a]];if(l)return l}}}}NodeType.none=new NodeType("",Object.create(null),0,8);class NodeSet{constructor(e){this.types=e;for(let r=0;r<e.length;r++)if(e[r].id!=r)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let r=[];for(let n of this.types){let o=null;for(let a of e){let l=a(n);l&&(o||(o=Object.assign({},n.props)),o[l[0].id]=l[1])}r.push(o?new NodeType(n.name,o,n.id,n.flags):n)}return new NodeSet(r)}}const CachedNode=new WeakMap,CachedInnerNode=new WeakMap;var IterMode;(function(s){s[s.ExcludeBuffers=1]="ExcludeBuffers",s[s.IncludeAnonymous=2]="IncludeAnonymous",s[s.IgnoreMounts=4]="IgnoreMounts",s[s.IgnoreOverlays=8]="IgnoreOverlays"})(IterMode||(IterMode={}));class Tree{constructor(e,r,n,o,a){if(this.type=e,this.children=r,this.positions=n,this.length=o,this.props=null,a&&a.length){this.props=Object.create(null);for(let[l,c]of a)this.props[typeof l=="number"?l:l.id]=c}}toString(){let e=this.prop(NodeProp.mounted);if(e&&!e.overlay)return e.tree.toString();let r="";for(let n of this.children){let o=n.toString();o&&(r&&(r+=","),r+=o)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(e=0){return new TreeCursor(this.topNode,e)}cursorAt(e,r=0,n=0){let o=CachedNode.get(this)||this.topNode,a=new TreeCursor(o);return a.moveTo(e,r),CachedNode.set(this,a._tree),a}get topNode(){return new TreeNode(this,0,0,null)}resolve(e,r=0){let n=resolveNode(CachedNode.get(this)||this.topNode,e,r,!1);return CachedNode.set(this,n),n}resolveInner(e,r=0){let n=resolveNode(CachedInnerNode.get(this)||this.topNode,e,r,!0);return CachedInnerNode.set(this,n),n}iterate(e){let{enter:r,leave:n,from:o=0,to:a=this.length}=e,l=e.mode||0,c=(l&IterMode.IncludeAnonymous)>0;for(let h=this.cursor(l|IterMode.IncludeAnonymous);;){let f=!1;if(h.from<=a&&h.to>=o&&(!c&&h.type.isAnonymous||r(h)!==!1)){if(h.firstChild())continue;f=!0}for(;f&&n&&(c||!h.type.isAnonymous)&&n(h),!h.nextSibling();){if(!h.parent())return;f=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let r in this.props)e.push([+r,this.props[r]]);return e}balance(e={}){return this.children.length<=8?this:balanceRange(NodeType.none,this.children,this.positions,0,this.children.length,0,this.length,(r,n,o)=>new Tree(this.type,r,n,o,this.propValues),e.makeTree||((r,n,o)=>new Tree(NodeType.none,r,n,o)))}static build(e){return buildTree(e)}}Tree.empty=new Tree(NodeType.none,[],[],0);class FlatBufferCursor{constructor(e,r){this.buffer=e,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new FlatBufferCursor(this.buffer,this.index)}}class TreeBuffer{constructor(e,r,n){this.buffer=e,this.length=r,this.set=n}get type(){return NodeType.none}toString(){let e=[];for(let r=0;r<this.buffer.length;)e.push(this.childString(r)),r=this.buffer[r+3];return e.join(",")}childString(e){let r=this.buffer[e],n=this.buffer[e+3],o=this.set.types[r],a=o.name;if(/\W/.test(a)&&!o.isError&&(a=JSON.stringify(a)),e+=4,n==e)return a;let l=[];for(;e<n;)l.push(this.childString(e)),e=this.buffer[e+3];return a+"("+l.join(",")+")"}findChild(e,r,n,o,a){let{buffer:l}=this,c=-1;for(let h=e;h!=r&&!(checkSide(a,o,l[h+1],l[h+2])&&(c=h,n>0));h=l[h+3]);return c}slice(e,r,n){let o=this.buffer,a=new Uint16Array(r-e),l=0;for(let c=e,h=0;c<r;){a[h++]=o[c++],a[h++]=o[c++]-n;let f=a[h++]=o[c++]-n;a[h++]=o[c++]-e,l=Math.max(l,f)}return new TreeBuffer(a,l,this.set)}}function checkSide(s,e,r,n){switch(s){case-2:return r<e;case-1:return n>=e&&r<e;case 0:return r<e&&n>e;case 1:return r<=e&&n>e;case 2:return n>e;case 4:return!0}}function enterUnfinishedNodesBefore(s,e){let r=s.childBefore(e);for(;r;){let n=r.lastChild;if(!n||n.to!=r.to)break;n.type.isError&&n.from==n.to?(s=r,r=n.prevSibling):r=n}return s}function resolveNode(s,e,r,n){for(var o;s.from==s.to||(r<1?s.from>=e:s.from>e)||(r>-1?s.to<=e:s.to<e);){let l=!n&&s instanceof TreeNode&&s.index<0?null:s.parent;if(!l)return s;s=l}let a=n?0:IterMode.IgnoreOverlays;if(n)for(let l=s,c=l.parent;c;l=c,c=l.parent)l instanceof TreeNode&&l.index<0&&((o=c.enter(e,r,a))===null||o===void 0?void 0:o.from)!=l.from&&(s=c);for(;;){let l=s.enter(e,r,a);if(!l)return s;s=l}}class TreeNode{constructor(e,r,n,o){this._tree=e,this.from=r,this.index=n,this._parent=o}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,r,n,o,a=0){for(let l=this;;){for(let{children:c,positions:h}=l._tree,f=r>0?c.length:-1;e!=f;e+=r){let d=c[e],m=h[e]+l.from;if(checkSide(o,n,m,m+d.length)){if(d instanceof TreeBuffer){if(a&IterMode.ExcludeBuffers)continue;let v=d.findChild(0,d.buffer.length,r,n-m,o);if(v>-1)return new BufferNode(new BufferContext(l,d,e,m),null,v)}else if(a&IterMode.IncludeAnonymous||!d.type.isAnonymous||hasChild(d)){let v;if(!(a&IterMode.IgnoreMounts)&&d.props&&(v=d.prop(NodeProp.mounted))&&!v.overlay)return new TreeNode(v.tree,m,e,l);let A=new TreeNode(d,m,e,l);return a&IterMode.IncludeAnonymous||!A.type.isAnonymous?A:A.nextChild(r<0?d.children.length-1:0,r,n,o)}}}if(a&IterMode.IncludeAnonymous||!l.type.isAnonymous||(l.index>=0?e=l.index+r:e=r<0?-1:l._parent._tree.children.length,l=l._parent,!l))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,r,n=0){let o;if(!(n&IterMode.IgnoreOverlays)&&(o=this._tree.prop(NodeProp.mounted))&&o.overlay){let a=e-this.from;for(let{from:l,to:c}of o.overlay)if((r>0?l<=a:l<a)&&(r<0?c>=a:c>a))return new TreeNode(o.tree,o.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,r,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(e=0){return new TreeCursor(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,r=0){return resolveNode(this,e,r,!1)}resolveInner(e,r=0){return resolveNode(this,e,r,!0)}enterUnfinishedNodesBefore(e){return enterUnfinishedNodesBefore(this,e)}getChild(e,r=null,n=null){let o=getChildren(this,e,r,n);return o.length?o[0]:null}getChildren(e,r=null,n=null){return getChildren(this,e,r,n)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return matchNodeContext(this,e)}}function getChildren(s,e,r,n){let o=s.cursor(),a=[];if(!o.firstChild())return a;if(r!=null){for(;!o.type.is(r);)if(!o.nextSibling())return a}for(;;){if(n!=null&&o.type.is(n))return a;if(o.type.is(e)&&a.push(o.node),!o.nextSibling())return n==null?a:[]}}function matchNodeContext(s,e,r=e.length-1){for(let n=s.parent;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[r]&&e[r]!=n.name)return!1;r--}}return!0}class BufferContext{constructor(e,r,n,o){this.parent=e,this.buffer=r,this.index=n,this.start=o}}class BufferNode{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,r,n){this.context=e,this._parent=r,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,r,n){let{buffer:o}=this.context,a=o.findChild(this.index+4,o.buffer[this.index+3],e,r-this.context.start,n);return a<0?null:new BufferNode(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,r,n=0){if(n&IterMode.ExcludeBuffers)return null;let{buffer:o}=this.context,a=o.findChild(this.index+4,o.buffer[this.index+3],r>0?1:-1,e-this.context.start,r);return a<0?null:new BufferNode(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,r=e.buffer[this.index+3];return r<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new BufferNode(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new BufferNode(this.context,this._parent,e.findChild(r,this.index,-1,0,4))}cursor(e=0){return new TreeCursor(this,e)}get tree(){return null}toTree(){let e=[],r=[],{buffer:n}=this.context,o=this.index+4,a=n.buffer[this.index+3];if(a>o){let l=n.buffer[this.index+1];e.push(n.slice(o,a,l)),r.push(0)}return new Tree(this.type,e,r,this.to-this.from)}resolve(e,r=0){return resolveNode(this,e,r,!1)}resolveInner(e,r=0){return resolveNode(this,e,r,!0)}enterUnfinishedNodesBefore(e){return enterUnfinishedNodesBefore(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,r=null,n=null){let o=getChildren(this,e,r,n);return o.length?o[0]:null}getChildren(e,r=null,n=null){return getChildren(this,e,r,n)}get node(){return this}matchContext(e){return matchNodeContext(this,e)}}class TreeCursor{get name(){return this.type.name}constructor(e,r=0){if(this.mode=r,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof TreeNode)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,r){this.index=e;let{start:n,buffer:o}=this.buffer;return this.type=r||o.set.types[o.buffer[e]],this.from=n+o.buffer[e+1],this.to=n+o.buffer[e+2],!0}yield(e){return e?e instanceof TreeNode?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,r,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,r,n,this.mode));let{buffer:o}=this.buffer,a=o.findChild(this.index+4,o.buffer[this.index+3],e,r-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,r,n=this.mode){return this.buffer?n&IterMode.ExcludeBuffers?!1:this.enterChild(1,e,r):this.yield(this._tree.enter(e,r,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&IterMode.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&IterMode.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:r}=this.buffer,n=this.stack.length-1;if(e<0){let o=n<0?0:this.stack[n]+4;if(this.index!=o)return this.yieldBuf(r.findChild(o,this.index,-1,0,4))}else{let o=r.buffer[this.index+3];if(o<(n<0?r.buffer.length:r.buffer[this.stack[n]+3]))return this.yieldBuf(o)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let r,n,{buffer:o}=this;if(o){if(e>0){if(this.index<o.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(o.buffer.buffer[a+3]<this.index)return!1;({index:r,parent:n}=o)}else({index:r,_parent:n}=this._tree);for(;n;{index:r,_parent:n}=n)if(r>-1)for(let a=r+e,l=e<0?-1:n._tree.children.length;a!=l;a+=e){let c=n._tree.children[a];if(this.mode&IterMode.IncludeAnonymous||c instanceof TreeBuffer||!c.type.isAnonymous||hasChild(c))return!1}return!0}move(e,r){if(r&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,r=0){for(;(this.from==this.to||(r<1?this.from>=e:this.from>e)||(r>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,r););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,r=null,n=0;if(e&&e.context==this.buffer)e:for(let o=this.index,a=this.stack.length;a>=0;){for(let l=e;l;l=l._parent)if(l.index==o){if(o==this.index)return l;r=l,n=a+1;break e}o=this.stack[--a]}for(let o=n;o<this.stack.length;o++)r=new BufferNode(this.buffer,r,this.stack[o]);return this.bufferNode=new BufferNode(this.buffer,r,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,r){for(let n=0;;){let o=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(o=!0)}for(;o&&r&&r(this),o=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,o=!0}}}matchContext(e){if(!this.buffer)return matchNodeContext(this.node,e);let{buffer:r}=this.buffer,{types:n}=r.set;for(let o=e.length-1,a=this.stack.length-1;o>=0;a--){if(a<0)return matchNodeContext(this.node,e,o);let l=n[r.buffer[this.stack[a]]];if(!l.isAnonymous){if(e[o]&&e[o]!=l.name)return!1;o--}}return!0}}function hasChild(s){return s.children.some(e=>e instanceof TreeBuffer||!e.type.isAnonymous||hasChild(e))}function buildTree(s){var e;let{buffer:r,nodeSet:n,maxBufferLength:o=DefaultBufferLength,reused:a=[],minRepeatType:l=n.types.length}=s,c=Array.isArray(r)?new FlatBufferCursor(r,r.length):r,h=n.types,f=0,d=0;function m(xe,Te,Le,Me,ot){let{id:Fe,start:Ve,end:at,size:dt}=c,ct=d;for(;dt<0;)if(c.next(),dt==-1){let lt=a[Fe];Le.push(lt),Me.push(Ve-xe);return}else if(dt==-3){f=Fe;return}else if(dt==-4){d=Fe;return}else throw new RangeError(`Unrecognized record size: ${dt}`);let nt=h[Fe],ft,it,pt=Ve-xe;if(at-Ve<=o&&(it=B(c.pos-Te,ot))){let lt=new Uint16Array(it.size-it.skip),st=c.pos-it.size,mt=lt.length;for(;c.pos>st;)mt=Y(it.start,lt,mt);ft=new TreeBuffer(lt,at-it.start,n),pt=it.start-xe}else{let lt=c.pos-dt;c.next();let st=[],mt=[],Vt=Fe>=l?Fe:-1,Yt=0,gi=at;for(;c.pos>lt;)Vt>=0&&c.id==Vt&&c.size>=0?(c.end<=gi-o&&(A(st,mt,Ve,Yt,c.end,gi,Vt,ct),Yt=st.length,gi=c.end),c.next()):m(Ve,lt,st,mt,Vt);if(Vt>=0&&Yt>0&&Yt<st.length&&A(st,mt,Ve,Yt,Ve,gi,Vt,ct),st.reverse(),mt.reverse(),Vt>-1&&Yt>0){let Oi=v(nt);ft=balanceRange(nt,st,mt,0,st.length,0,at-Ve,Oi,Oi)}else ft=T(nt,st,mt,at-Ve,ct-at)}Le.push(ft),Me.push(pt)}function v(xe){return(Te,Le,Me)=>{let ot=0,Fe=Te.length-1,Ve,at;if(Fe>=0&&(Ve=Te[Fe])instanceof Tree){if(!Fe&&Ve.type==xe&&Ve.length==Me)return Ve;(at=Ve.prop(NodeProp.lookAhead))&&(ot=Le[Fe]+Ve.length+at)}return T(xe,Te,Le,Me,ot)}}function A(xe,Te,Le,Me,ot,Fe,Ve,at){let dt=[],ct=[];for(;xe.length>Me;)dt.push(xe.pop()),ct.push(Te.pop()+Le-ot);xe.push(T(n.types[Ve],dt,ct,Fe-ot,at-Fe)),Te.push(ot-Le)}function T(xe,Te,Le,Me,ot=0,Fe){if(f){let Ve=[NodeProp.contextHash,f];Fe=Fe?[Ve].concat(Fe):[Ve]}if(ot>25){let Ve=[NodeProp.lookAhead,ot];Fe=Fe?[Ve].concat(Fe):[Ve]}return new Tree(xe,Te,Le,Me,Fe)}function B(xe,Te){let Le=c.fork(),Me=0,ot=0,Fe=0,Ve=Le.end-o,at={size:0,start:0,skip:0};e:for(let dt=Le.pos-xe;Le.pos>dt;){let ct=Le.size;if(Le.id==Te&&ct>=0){at.size=Me,at.start=ot,at.skip=Fe,Fe+=4,Me+=4,Le.next();continue}let nt=Le.pos-ct;if(ct<0||nt<dt||Le.start<Ve)break;let ft=Le.id>=l?4:0,it=Le.start;for(Le.next();Le.pos>nt;){if(Le.size<0)if(Le.size==-3)ft+=4;else break e;else Le.id>=l&&(ft+=4);Le.next()}ot=it,Me+=ct,Fe+=ft}return(Te<0||Me==xe)&&(at.size=Me,at.start=ot,at.skip=Fe),at.size>4?at:void 0}function Y(xe,Te,Le){let{id:Me,start:ot,end:Fe,size:Ve}=c;if(c.next(),Ve>=0&&Me<l){let at=Le;if(Ve>4){let dt=c.pos-(Ve-4);for(;c.pos>dt;)Le=Y(xe,Te,Le)}Te[--Le]=at,Te[--Le]=Fe-xe,Te[--Le]=ot-xe,Te[--Le]=Me}else Ve==-3?f=Me:Ve==-4&&(d=Me);return Le}let F=[],ke=[];for(;c.pos>0;)m(s.start||0,s.bufferStart||0,F,ke,-1);let Qe=(e=s.length)!==null&&e!==void 0?e:F.length?ke[0]+F[0].length:0;return new Tree(h[s.topID],F.reverse(),ke.reverse(),Qe)}const nodeSizeCache=new WeakMap;function nodeSize(s,e){if(!s.isAnonymous||e instanceof TreeBuffer||e.type!=s)return 1;let r=nodeSizeCache.get(e);if(r==null){r=1;for(let n of e.children){if(n.type!=s||!(n instanceof Tree)){r=1;break}r+=nodeSize(s,n)}nodeSizeCache.set(e,r)}return r}function balanceRange(s,e,r,n,o,a,l,c,h){let f=0;for(let T=n;T<o;T++)f+=nodeSize(s,e[T]);let d=Math.ceil(f*1.5/8),m=[],v=[];function A(T,B,Y,F,ke){for(let Qe=Y;Qe<F;){let xe=Qe,Te=B[Qe],Le=nodeSize(s,T[Qe]);for(Qe++;Qe<F;Qe++){let Me=nodeSize(s,T[Qe]);if(Le+Me>=d)break;Le+=Me}if(Qe==xe+1){if(Le>d){let Me=T[xe];A(Me.children,Me.positions,0,Me.children.length,B[xe]+ke);continue}m.push(T[xe])}else{let Me=B[Qe-1]+T[Qe-1].length-Te;m.push(balanceRange(s,T,B,xe,Qe,Te,Me,null,h))}v.push(Te+ke-a)}}return A(e,r,n,o,0),(c||h)(m,v,l)}class NodeWeakMap{constructor(){this.map=new WeakMap}setBuffer(e,r,n){let o=this.map.get(e);o||this.map.set(e,o=new Map),o.set(r,n)}getBuffer(e,r){let n=this.map.get(e);return n&&n.get(r)}set(e,r){e instanceof BufferNode?this.setBuffer(e.context.buffer,e.index,r):e instanceof TreeNode&&this.map.set(e.tree,r)}get(e){return e instanceof BufferNode?this.getBuffer(e.context.buffer,e.index):e instanceof TreeNode?this.map.get(e.tree):void 0}cursorSet(e,r){e.buffer?this.setBuffer(e.buffer.buffer,e.index,r):this.map.set(e.tree,r)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class TreeFragment{constructor(e,r,n,o,a=!1,l=!1){this.from=e,this.to=r,this.tree=n,this.offset=o,this.open=(a?1:0)|(l?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,r=[],n=!1){let o=[new TreeFragment(0,e.length,e,0,!1,n)];for(let a of r)a.to>e.length&&o.push(a);return o}static applyChanges(e,r,n=128){if(!r.length)return e;let o=[],a=1,l=e.length?e[0]:null;for(let c=0,h=0,f=0;;c++){let d=c<r.length?r[c]:null,m=d?d.fromA:1e9;if(m-h>=n)for(;l&&l.from<m;){let v=l;if(h>=v.from||m<=v.to||f){let A=Math.max(v.from,h)-f,T=Math.min(v.to,m)-f;v=A>=T?null:new TreeFragment(A,T,v.tree,v.offset+f,c>0,!!d)}if(v&&o.push(v),l.to>m)break;l=a<e.length?e[a++]:null}if(!d)break;h=d.toA,f=d.toA-d.toB}return o}}class Parser{startParse(e,r,n){return typeof e=="string"&&(e=new StringInput(e)),n=n?n.length?n.map(o=>new Range(o.from,o.to)):[new Range(0,0)]:[new Range(0,e.length)],this.createParse(e,r||[],n)}parse(e,r,n){let o=this.startParse(e,r,n);for(;;){let a=o.advance();if(a)return a}}}class StringInput{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,r){return this.string.slice(e,r)}}function parseMixed(s){return(e,r,n,o)=>new MixedParse(e,s,r,n,o)}class InnerParse{constructor(e,r,n,o,a){if(this.parser=e,this.parse=r,this.overlay=n,this.target=o,this.ranges=a,!a.length||a.some(l=>l.from>=l.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(a))}}class ActiveOverlay{constructor(e,r,n,o,a,l,c){this.parser=e,this.predicate=r,this.mounts=n,this.index=o,this.start=a,this.target=l,this.prev=c,this.depth=0,this.ranges=[]}}const stoppedInner=new NodeProp({perNode:!0});class MixedParse{constructor(e,r,n,o,a){this.nest=r,this.input=n,this.fragments=o,this.ranges=a,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let o of this.inner)o.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new Tree(n.type,n.children,n.positions,n.length,n.propValues.concat([[stoppedInner,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],r=e.parse.advance();if(r){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[NodeProp.mounted.id]=new MountedTree(r,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let r=this.innerDone;r<this.inner.length;r++)this.inner[r].ranges[0].from<e&&(e=Math.min(e,this.inner[r].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let r=this.innerDone;r<this.inner.length;r++)this.inner[r].parse.stopAt(e)}startInner(){let e=new FragmentCursor$2(this.fragments),r=null,n=null,o=new TreeCursor(new TreeNode(this.baseTree,this.ranges[0].from,0,null),IterMode.IncludeAnonymous|IterMode.IgnoreMounts);e:for(let a,l;this.stoppedAt==null||o.from<this.stoppedAt;){let c=!0,h;if(e.hasNode(o)){if(r){let f=r.mounts.find(d=>d.frag.from<=o.from&&d.frag.to>=o.to&&d.mount.overlay);if(f)for(let d of f.mount.overlay){let m=d.from+f.pos,v=d.to+f.pos;m>=o.from&&v<=o.to&&!r.ranges.some(A=>A.from<v&&A.to>m)&&r.ranges.push({from:m,to:v})}}c=!1}else if(n&&(l=checkCover(n.ranges,o.from,o.to)))c=l!=2;else if(!o.type.isAnonymous&&o.from<o.to&&(a=this.nest(o,this.input))){o.tree||materialize(o);let f=e.findMounts(o.from,a.parser);if(typeof a.overlay=="function")r=new ActiveOverlay(a.parser,a.overlay,f,this.inner.length,o.from,o.tree,r);else{let d=punchRanges(this.ranges,a.overlay||[new Range(o.from,o.to)]);d.length&&this.inner.push(new InnerParse(a.parser,a.parser.startParse(this.input,enterFragments(f,d),d),a.overlay?a.overlay.map(m=>new Range(m.from-o.from,m.to-o.from)):null,o.tree,d)),a.overlay?d.length&&(n={ranges:d,depth:0,prev:n}):c=!1}}else r&&(h=r.predicate(o))&&(h===!0&&(h=new Range(o.from,o.to)),h.from<h.to&&r.ranges.push(h));if(c&&o.firstChild())r&&r.depth++,n&&n.depth++;else for(;!o.nextSibling();){if(!o.parent())break e;if(r&&!--r.depth){let f=punchRanges(this.ranges,r.ranges);f.length&&this.inner.splice(r.index,0,new InnerParse(r.parser,r.parser.startParse(this.input,enterFragments(r.mounts,f),f),r.ranges.map(d=>new Range(d.from-r.start,d.to-r.start)),r.target,f)),r=r.prev}n&&!--n.depth&&(n=n.prev)}}}}function checkCover(s,e,r){for(let n of s){if(n.from>=r)break;if(n.to>e)return n.from<=e&&n.to>=r?2:1}return 0}function sliceBuf(s,e,r,n,o,a){if(e<r){let l=s.buffer[e+1];n.push(s.slice(e,r,l)),o.push(l-a)}}function materialize(s){let{node:e}=s,r=0;do s.parent(),r++;while(!s.tree);let n=0,o=s.tree,a=0;for(;a=o.positions[n]+s.from,!(a<=e.from&&a+o.children[n].length>=e.to);n++);let l=o.children[n],c=l.buffer;function h(f,d,m,v,A){let T=f;for(;c[T+2]+a<=e.from;)T=c[T+3];let B=[],Y=[];sliceBuf(l,f,T,B,Y,v);let F=c[T+1],ke=c[T+2],Qe=F+a==e.from&&ke+a==e.to&&c[T]==e.type.id;return B.push(Qe?e.toTree():h(T+4,c[T+3],l.set.types[c[T]],F,ke-F)),Y.push(F-v),sliceBuf(l,c[T+3],d,B,Y,v),new Tree(m,B,Y,A)}o.children[n]=h(0,c.length,NodeType.none,0,l.length);for(let f=0;f<=r;f++)s.childAfter(e.from)}class StructureCursor{constructor(e,r){this.offset=r,this.done=!1,this.cursor=e.cursor(IterMode.IncludeAnonymous|IterMode.IgnoreMounts)}moveTo(e){let{cursor:r}=this,n=e-this.offset;for(;!this.done&&r.from<n;)r.to>=e&&r.enter(n,1,IterMode.IgnoreOverlays|IterMode.ExcludeBuffers)||r.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let r=this.cursor.tree;;){if(r==e.tree)return!0;if(r.children.length&&r.positions[0]==0&&r.children[0]instanceof Tree)r=r.children[0];else break}return!1}}let FragmentCursor$2=class{constructor(e){var r;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(r=n.tree.prop(stoppedInner))!==null&&r!==void 0?r:n.to,this.inner=new StructureCursor(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let r=this.curFrag=this.fragments[this.fragI];this.curTo=(e=r.tree.prop(stoppedInner))!==null&&e!==void 0?e:r.to,this.inner=new StructureCursor(r.tree,-r.offset)}}findMounts(e,r){var n;let o=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let a=this.inner.cursor.node;a;a=a.parent){let l=(n=a.tree)===null||n===void 0?void 0:n.prop(NodeProp.mounted);if(l&&l.parser==r)for(let c=this.fragI;c<this.fragments.length;c++){let h=this.fragments[c];if(h.from>=a.to)break;h.tree==this.curFrag.tree&&o.push({frag:h,pos:a.from-h.offset,mount:l})}}}return o}};function punchRanges(s,e){let r=null,n=e;for(let o=1,a=0;o<s.length;o++){let l=s[o-1].to,c=s[o].from;for(;a<n.length;a++){let h=n[a];if(h.from>=c)break;h.to<=l||(r||(n=r=e.slice()),h.from<l?(r[a]=new Range(h.from,l),h.to>c&&r.splice(a+1,0,new Range(c,h.to))):h.to>c?r[a--]=new Range(c,h.to):r.splice(a--,1))}}return n}function findCoverChanges(s,e,r,n){let o=0,a=0,l=!1,c=!1,h=-1e9,f=[];for(;;){let d=o==s.length?1e9:l?s[o].to:s[o].from,m=a==e.length?1e9:c?e[a].to:e[a].from;if(l!=c){let v=Math.max(h,r),A=Math.min(d,m,n);v<A&&f.push(new Range(v,A))}if(h=Math.min(d,m),h==1e9)break;d==h&&(l?(l=!1,o++):l=!0),m==h&&(c?(c=!1,a++):c=!0)}return f}function enterFragments(s,e){let r=[];for(let{pos:n,mount:o,frag:a}of s){let l=n+(o.overlay?o.overlay[0].from:0),c=l+o.tree.length,h=Math.max(a.from,l),f=Math.min(a.to,c);if(o.overlay){let d=o.overlay.map(v=>new Range(v.from+n,v.to+n)),m=findCoverChanges(e,d,h,f);for(let v=0,A=h;;v++){let T=v==m.length,B=T?f:m[v].from;if(B>A&&r.push(new TreeFragment(A,B,o.tree,-l,a.from>=A||a.openStart,a.to<=B||a.openEnd)),T)break;A=m[v].to}}else r.push(new TreeFragment(h,f,o.tree,-l,a.from>=l||a.openStart,a.to<=c||a.openEnd))}return r}let nextTagID=0;class Tag{constructor(e,r,n){this.set=e,this.base=r,this.modified=n,this.id=nextTagID++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let r=new Tag([],null,[]);if(r.set.push(r),e)for(let n of e.set)r.set.push(n);return r}static defineModifier(){let e=new Modifier;return r=>r.modified.indexOf(e)>-1?r:Modifier.get(r.base||r,r.modified.concat(e).sort((n,o)=>n.id-o.id))}}let nextModifierID=0;class Modifier{constructor(){this.instances=[],this.id=nextModifierID++}static get(e,r){if(!r.length)return e;let n=r[0].instances.find(c=>c.base==e&&sameArray(r,c.modified));if(n)return n;let o=[],a=new Tag(o,e,r);for(let c of r)c.instances.push(a);let l=powerSet(r);for(let c of e.set)if(!c.modified.length)for(let h of l)o.push(Modifier.get(c,h));return a}}function sameArray(s,e){return s.length==e.length&&s.every((r,n)=>r==e[n])}function powerSet(s){let e=[[]];for(let r=0;r<s.length;r++)for(let n=0,o=e.length;n<o;n++)e.push(e[n].concat(s[r]));return e.sort((r,n)=>n.length-r.length)}function styleTags(s){let e=Object.create(null);for(let r in s){let n=s[r];Array.isArray(n)||(n=[n]);for(let o of r.split(" "))if(o){let a=[],l=2,c=o;for(let m=0;;){if(c=="..."&&m>0&&m+3==o.length){l=1;break}let v=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!v)throw new RangeError("Invalid path: "+o);if(a.push(v[0]=="*"?"":v[0][0]=='"'?JSON.parse(v[0]):v[0]),m+=v[0].length,m==o.length)break;let A=o[m++];if(m==o.length&&A=="!"){l=0;break}if(A!="/")throw new RangeError("Invalid path: "+o);c=o.slice(m)}let h=a.length-1,f=a[h];if(!f)throw new RangeError("Invalid path: "+o);let d=new Rule(n,l,h>0?a.slice(0,h):null);e[f]=d.sort(e[f])}}return ruleNodeProp.add(e)}const ruleNodeProp=new NodeProp;class Rule{constructor(e,r,n,o){this.tags=e,this.mode=r,this.context=n,this.next=o}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Rule.empty=new Rule([],2,null);function tagHighlighter(s,e){let r=Object.create(null);for(let a of s)if(!Array.isArray(a.tag))r[a.tag.id]=a.class;else for(let l of a.tag)r[l.id]=a.class;let{scope:n,all:o=null}=e||{};return{style:a=>{let l=o;for(let c of a)for(let h of c.set){let f=r[h.id];if(f){l=l?l+" "+f:f;break}}return l},scope:n}}function highlightTags(s,e){let r=null;for(let n of s){let o=n.style(e);o&&(r=r?r+" "+o:o)}return r}function highlightTree(s,e,r,n=0,o=s.length){let a=new HighlightBuilder(n,Array.isArray(e)?e:[e],r);a.highlightRange(s.cursor(),n,o,"",a.highlighters),a.flush(o)}class HighlightBuilder{constructor(e,r,n){this.at=e,this.highlighters=r,this.span=n,this.class=""}startSpan(e,r){r!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=r)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,r,n,o,a){let{type:l,from:c,to:h}=e;if(c>=n||h<=r)return;l.isTop&&(a=this.highlighters.filter(A=>!A.scope||A.scope(l)));let f=o,d=getStyleTags(e)||Rule.empty,m=highlightTags(a,d.tags);if(m&&(f&&(f+=" "),f+=m,d.mode==1&&(o+=(o?" ":"")+m)),this.startSpan(Math.max(r,c),f),d.opaque)return;let v=e.tree&&e.tree.prop(NodeProp.mounted);if(v&&v.overlay){let A=e.node.enter(v.overlay[0].from+c,1),T=this.highlighters.filter(Y=>!Y.scope||Y.scope(v.tree.type)),B=e.firstChild();for(let Y=0,F=c;;Y++){let ke=Y<v.overlay.length?v.overlay[Y]:null,Qe=ke?ke.from+c:h,xe=Math.max(r,F),Te=Math.min(n,Qe);if(xe<Te&&B)for(;e.from<Te&&(this.highlightRange(e,xe,Te,o,a),this.startSpan(Math.min(Te,e.to),f),!(e.to>=Qe||!e.nextSibling())););if(!ke||Qe>n)break;F=ke.to+c,F>r&&(this.highlightRange(A.cursor(),Math.max(r,ke.from+c),Math.min(n,F),"",T),this.startSpan(Math.min(n,F),f))}B&&e.parent()}else if(e.firstChild()){v&&(o="");do if(!(e.to<=r)){if(e.from>=n)break;this.highlightRange(e,r,n,o,a),this.startSpan(Math.min(n,e.to),f)}while(e.nextSibling());e.parent()}}}function getStyleTags(s){let e=s.type.prop(ruleNodeProp);for(;e&&e.context&&!s.matchContext(e.context);)e=e.next;return e||null}const t=Tag.define,comment=t(),name=t(),typeName=t(name),propertyName=t(name),literal=t(),string=t(literal),number=t(literal),content=t(),heading=t(content),keyword=t(),operator=t(),punctuation=t(),bracket=t(punctuation),meta=t(),tags$1={comment,lineComment:t(comment),blockComment:t(comment),docComment:t(comment),name,variableName:t(name),typeName,tagName:t(typeName),propertyName,attributeName:t(propertyName),className:t(name),labelName:t(name),namespace:t(name),macroName:t(name),literal,string,docString:t(string),character:t(string),attributeValue:t(string),number,integer:t(number),float:t(number),bool:t(literal),regexp:t(literal),escape:t(literal),color:t(literal),url:t(literal),keyword,self:t(keyword),null:t(keyword),atom:t(keyword),unit:t(keyword),modifier:t(keyword),operatorKeyword:t(keyword),controlKeyword:t(keyword),definitionKeyword:t(keyword),moduleKeyword:t(keyword),operator,derefOperator:t(operator),arithmeticOperator:t(operator),logicOperator:t(operator),bitwiseOperator:t(operator),compareOperator:t(operator),updateOperator:t(operator),definitionOperator:t(operator),typeOperator:t(operator),controlOperator:t(operator),punctuation,separator:t(punctuation),bracket,angleBracket:t(bracket),squareBracket:t(bracket),paren:t(bracket),brace:t(bracket),content,heading,heading1:t(heading),heading2:t(heading),heading3:t(heading),heading4:t(heading),heading5:t(heading),heading6:t(heading),contentSeparator:t(content),list:t(content),quote:t(content),emphasis:t(content),strong:t(content),link:t(content),monospace:t(content),strikethrough:t(content),inserted:t(),deleted:t(),changed:t(),invalid:t(),meta,documentMeta:t(meta),annotation:t(meta),processingInstruction:t(meta),definition:Tag.defineModifier(),constant:Tag.defineModifier(),function:Tag.defineModifier(),standard:Tag.defineModifier(),local:Tag.defineModifier(),special:Tag.defineModifier()};tagHighlighter([{tag:tags$1.link,class:"tok-link"},{tag:tags$1.heading,class:"tok-heading"},{tag:tags$1.emphasis,class:"tok-emphasis"},{tag:tags$1.strong,class:"tok-strong"},{tag:tags$1.keyword,class:"tok-keyword"},{tag:tags$1.atom,class:"tok-atom"},{tag:tags$1.bool,class:"tok-bool"},{tag:tags$1.url,class:"tok-url"},{tag:tags$1.labelName,class:"tok-labelName"},{tag:tags$1.inserted,class:"tok-inserted"},{tag:tags$1.deleted,class:"tok-deleted"},{tag:tags$1.literal,class:"tok-literal"},{tag:tags$1.string,class:"tok-string"},{tag:tags$1.number,class:"tok-number"},{tag:[tags$1.regexp,tags$1.escape,tags$1.special(tags$1.string)],class:"tok-string2"},{tag:tags$1.variableName,class:"tok-variableName"},{tag:tags$1.local(tags$1.variableName),class:"tok-variableName tok-local"},{tag:tags$1.definition(tags$1.variableName),class:"tok-variableName tok-definition"},{tag:tags$1.special(tags$1.variableName),class:"tok-variableName2"},{tag:tags$1.definition(tags$1.propertyName),class:"tok-propertyName tok-definition"},{tag:tags$1.typeName,class:"tok-typeName"},{tag:tags$1.namespace,class:"tok-namespace"},{tag:tags$1.className,class:"tok-className"},{tag:tags$1.macroName,class:"tok-macroName"},{tag:tags$1.propertyName,class:"tok-propertyName"},{tag:tags$1.operator,class:"tok-operator"},{tag:tags$1.comment,class:"tok-comment"},{tag:tags$1.meta,class:"tok-meta"},{tag:tags$1.invalid,class:"tok-invalid"},{tag:tags$1.punctuation,class:"tok-punctuation"}]);var _a;const languageDataProp=new NodeProp;function defineLanguageFacet(s){return Facet.define({combine:s?e=>e.concat(s):void 0})}const sublanguageProp=new NodeProp;class Language{constructor(e,r,n=[],o=""){this.data=e,this.name=o,EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(EditorState.prototype,"tree",{get(){return syntaxTree(this)}}),this.parser=r,this.extension=[language.of(this),EditorState.languageData.of((a,l,c)=>{let h=topNodeAt(a,l,c),f=h.type.prop(languageDataProp);if(!f)return[];let d=a.facet(f),m=h.type.prop(sublanguageProp);if(m){let v=h.resolve(l-h.from,c);for(let A of m)if(A.test(v,a)){let T=a.facet(A.facet);return A.type=="replace"?T:T.concat(d)}}return d})].concat(n)}isActiveAt(e,r,n=-1){return topNodeAt(e,r,n).type.prop(languageDataProp)==this.data}findRegions(e){let r=e.facet(language);if((r==null?void 0:r.data)==this.data)return[{from:0,to:e.doc.length}];if(!r||!r.allowsNesting)return[];let n=[],o=(a,l)=>{if(a.prop(languageDataProp)==this.data){n.push({from:l,to:l+a.length});return}let c=a.prop(NodeProp.mounted);if(c){if(c.tree.prop(languageDataProp)==this.data){if(c.overlay)for(let h of c.overlay)n.push({from:h.from+l,to:h.to+l});else n.push({from:l,to:l+a.length});return}else if(c.overlay){let h=n.length;if(o(c.tree,c.overlay[0].from+l),n.length>h)return}}for(let h=0;h<a.children.length;h++){let f=a.children[h];f instanceof Tree&&o(f,a.positions[h]+l)}};return o(syntaxTree(e),0),n}get allowsNesting(){return!0}}Language.setState=StateEffect.define();function topNodeAt(s,e,r){let n=s.facet(language),o=syntaxTree(s).topNode;if(!n||n.allowsNesting)for(let a=o;a;a=a.enter(e,r,IterMode.ExcludeBuffers))a.type.isTop&&(o=a);return o}class LRLanguage extends Language{constructor(e,r,n){super(e,r,[],n),this.parser=r}static define(e){let r=defineLanguageFacet(e.languageData);return new LRLanguage(r,e.parser.configure({props:[languageDataProp.add(n=>n.isTop?r:void 0)]}),e.name)}configure(e,r){return new LRLanguage(this.data,this.parser.configure(e),r||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function syntaxTree(s){let e=s.field(Language.state,!1);return e?e.tree:Tree.empty}function ensureSyntaxTree(s,e,r=50){var n;let o=(n=s.field(Language.state,!1))===null||n===void 0?void 0:n.context;if(!o)return null;let a=o.viewport;o.updateViewport({from:0,to:e});let l=o.isDone(e)||o.work(r,e)?o.tree:null;return o.updateViewport(a),l}class DocInput{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,r){let n=this.cursorPos-this.string.length;return e<n||r>=this.cursorPos?this.doc.sliceString(e,r):this.string.slice(e-n,r-n)}}let currentContext=null;class ParseContext{constructor(e,r,n=[],o,a,l,c,h){this.parser=e,this.state=r,this.fragments=n,this.tree=o,this.treeLen=a,this.viewport=l,this.skipped=c,this.scheduleOn=h,this.parse=null,this.tempSkipped=[]}static create(e,r,n){return new ParseContext(e,r,[],Tree.empty,0,n,[],null)}startParse(){return this.parser.startParse(new DocInput(this.state.doc),this.fragments)}work(e,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=Tree.empty&&this.isDone(r??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let o=Date.now()+e;e=()=>Date.now()>o}for(this.parse||(this.parse=this.startParse()),r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r<this.state.doc.length&&this.parse.stopAt(r);;){let o=this.parse.advance();if(o)if(this.fragments=this.withoutTempSkipped(TreeFragment.addTree(o,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=o,this.parse=null,this.treeLen<(r??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,r;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(r=this.parse.advance()););}),this.treeLen=e,this.tree=r,this.fragments=this.withoutTempSkipped(TreeFragment.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let r=currentContext;currentContext=this;try{return e()}finally{currentContext=r}}withoutTempSkipped(e){for(let r;r=this.tempSkipped.pop();)e=cutFragments(e,r.from,r.to);return e}changes(e,r){let{fragments:n,tree:o,treeLen:a,viewport:l,skipped:c}=this;if(this.takeTree(),!e.empty){let h=[];if(e.iterChangedRanges((f,d,m,v)=>h.push({fromA:f,toA:d,fromB:m,toB:v})),n=TreeFragment.applyChanges(n,h),o=Tree.empty,a=0,l={from:e.mapPos(l.from,-1),to:e.mapPos(l.to,1)},this.skipped.length){c=[];for(let f of this.skipped){let d=e.mapPos(f.from,1),m=e.mapPos(f.to,-1);d<m&&c.push({from:d,to:m})}}}return new ParseContext(this.parser,r,n,o,a,l,c,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let r=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:o,to:a}=this.skipped[n];o<e.to&&a>e.from&&(this.fragments=cutFragments(this.fragments,o,a),this.skipped.splice(n--,1))}return this.skipped.length>=r?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,r){this.skipped.push({from:e,to:r})}static getSkippingParser(e){return new class extends Parser{createParse(r,n,o){let a=o[0].from,l=o[o.length-1].to;return{parsedPos:a,advance(){let h=currentContext;if(h){for(let f of o)h.tempSkipped.push(f);e&&(h.scheduleOn=h.scheduleOn?Promise.all([h.scheduleOn,e]):e)}return this.parsedPos=l,new Tree(NodeType.none,[],[],l-a)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let r=this.fragments;return this.treeLen>=e&&r.length&&r[0].from==0&&r[0].to>=e}static get(){return currentContext}}function cutFragments(s,e,r){return TreeFragment.applyChanges(s,[{fromA:e,toA:r,fromB:e,toB:r}])}class LanguageState{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),r.viewport.to);return r.work(20,n)||r.takeTree(),new LanguageState(r)}static init(e){let r=Math.min(3e3,e.doc.length),n=ParseContext.create(e.facet(language).parser,e,{from:0,to:r});return n.work(20,r)||n.takeTree(),new LanguageState(n)}}Language.state=StateField.define({create:LanguageState.init,update(s,e){for(let r of e.effects)if(r.is(Language.setState))return r.value;return e.startState.facet(language)!=e.state.facet(language)?LanguageState.init(e.state):s.apply(e)}});let requestIdle=s=>{let e=setTimeout(()=>s(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(requestIdle=s=>{let e=-1,r=setTimeout(()=>{e=requestIdleCallback(s,{timeout:500-100})},100);return()=>e<0?clearTimeout(r):cancelIdleCallback(e)});const isInputPending=typeof navigator<"u"&&(!((_a=navigator.scheduling)===null||_a===void 0)&&_a.isInputPending)?()=>navigator.scheduling.isInputPending():null,parseWorker=ViewPlugin.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let r=this.view.state.field(Language.state).context;(r.updateViewport(e.view.viewport)||this.view.viewport.to>r.treeLen)&&this.scheduleWork(),e.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(r)}scheduleWork(){if(this.working)return;let{state:e}=this.view,r=e.field(Language.state);(r.tree!=r.context.tree||!r.context.isDone(e.doc.length))&&(this.working=requestIdle(this.work))}work(e){this.working=null;let r=Date.now();if(this.chunkEnd<r&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=r+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:o}}=this.view,a=n.field(Language.state);if(a.tree==a.context.tree&&a.context.isDone(o+1e5))return;let l=Date.now()+Math.min(this.chunkBudget,100,e&&!isInputPending?Math.max(25,e.timeRemaining()-5):1e9),c=a.context.treeLen<o&&n.doc.length>o+1e3,h=a.context.work(()=>isInputPending&&isInputPending()||Date.now()>l,o+(c?0:1e5));this.chunkBudget-=Date.now()-r,(h||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:Language.setState.of(new LanguageState(a.context))})),this.chunkBudget>0&&!(h&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(r=>logException(this.view.state,r)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),language=Facet.define({combine(s){return s.length?s[0]:null},enables:s=>[Language.state,parseWorker,EditorView.contentAttributes.compute([s],e=>{let r=e.facet(s);return r&&r.name?{"data-language":r.name}:{}})]});class LanguageSupport{constructor(e,r=[]){this.language=e,this.support=r,this.extension=[e,r]}}class LanguageDescription{constructor(e,r,n,o,a,l=void 0){this.name=e,this.alias=r,this.extensions=n,this.filename=o,this.loadFunc=a,this.support=l,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:r,support:n}=e;if(!r){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");r=()=>Promise.resolve(n)}return new LanguageDescription(e.name,(e.alias||[]).concat(e.name).map(o=>o.toLowerCase()),e.extensions||[],e.filename,r,n)}static matchFilename(e,r){for(let o of e)if(o.filename&&o.filename.test(r))return o;let n=/\.([^.]+)$/.exec(r);if(n){for(let o of e)if(o.extensions.indexOf(n[1])>-1)return o}return null}static matchLanguageName(e,r,n=!0){r=r.toLowerCase();for(let o of e)if(o.alias.some(a=>a==r))return o;if(n)for(let o of e)for(let a of o.alias){let l=r.indexOf(a);if(l>-1&&(a.length>2||!/\w/.test(r[l-1])&&!/\w/.test(r[l+a.length])))return o}return null}}const indentService=Facet.define(),indentUnit=Facet.define({combine:s=>{if(!s.length)return" ";let e=s[0];if(!e||/\S/.test(e)||Array.from(e).some(r=>r!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(s[0]));return e}});function getIndentUnit(s){let e=s.facet(indentUnit);return e.charCodeAt(0)==9?s.tabSize*e.length:e.length}function indentString(s,e){let r="",n=s.tabSize,o=s.facet(indentUnit)[0];if(o==" "){for(;e>=n;)r+=" ",e-=n;o=" "}for(let a=0;a<e;a++)r+=o;return r}function getIndentation(s,e){s instanceof EditorState&&(s=new IndentContext(s));for(let n of s.state.facet(indentService)){let o=n(s,e);if(o!==void 0)return o}let r=syntaxTree(s.state);return r?syntaxIndentation(s,r,e):null}class IndentContext{constructor(e,r={}){this.state=e,this.options=r,this.unit=getIndentUnit(e)}lineAt(e,r=1){let n=this.state.doc.lineAt(e),{simulateBreak:o,simulateDoubleBreak:a}=this.options;return o!=null&&o>=n.from&&o<=n.to?a&&o==e?{text:"",from:e}:(r<0?o<e:o<=e)?{text:n.text.slice(o-n.from),from:o}:{text:n.text.slice(0,o-n.from),from:n.from}:n}textAfterPos(e,r=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:o}=this.lineAt(e,r);return n.slice(e-o,Math.min(n.length,e+100-o))}column(e,r=1){let{text:n,from:o}=this.lineAt(e,r),a=this.countColumn(n,e-o),l=this.options.overrideIndentation?this.options.overrideIndentation(o):-1;return l>-1&&(a+=l-this.countColumn(n,n.search(/\S|$/))),a}countColumn(e,r=e.length){return countColumn(e,this.state.tabSize,r)}lineIndent(e,r=1){let{text:n,from:o}=this.lineAt(e,r),a=this.options.overrideIndentation;if(a){let l=a(o);if(l>-1)return l}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const indentNodeProp=new NodeProp;function syntaxIndentation(s,e,r){return indentFrom(e.resolveInner(r).enterUnfinishedNodesBefore(r),r,s)}function ignoreClosed(s){return s.pos==s.options.simulateBreak&&s.options.simulateDoubleBreak}function indentStrategy(s){let e=s.type.prop(indentNodeProp);if(e)return e;let r=s.firstChild,n;if(r&&(n=r.type.prop(NodeProp.closedBy))){let o=s.lastChild,a=o&&n.indexOf(o.name)>-1;return l=>delimitedStrategy(l,!0,1,void 0,a&&!ignoreClosed(l)?o.from:void 0)}return s.parent==null?topIndent:null}function indentFrom(s,e,r){for(;s;s=s.parent){let n=indentStrategy(s);if(n)return n(TreeIndentContext.create(r,e,s))}return null}function topIndent(){return 0}class TreeIndentContext extends IndentContext{constructor(e,r,n){super(e.state,e.options),this.base=e,this.pos=r,this.node=n}static create(e,r,n){return new TreeIndentContext(e,r,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let r=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(r.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(isParent(n,e))break;r=this.state.doc.lineAt(n.from)}return this.lineIndent(r.from)}continue(){let e=this.node.parent;return e?indentFrom(e,this.pos,this.base):0}}function isParent(s,e){for(let r=e;r;r=r.parent)if(s==r)return!0;return!1}function bracketedAligned(s){let e=s.node,r=e.childAfter(e.from),n=e.lastChild;if(!r)return null;let o=s.options.simulateBreak,a=s.state.doc.lineAt(r.from),l=o==null||o<=a.from?a.to:Math.min(a.to,o);for(let c=r.to;;){let h=e.childAfter(c);if(!h||h==n)return null;if(!h.type.isSkipped)return h.from<l?r:null;c=h.to}}function delimitedIndent({closing:s,align:e=!0,units:r=1}){return n=>delimitedStrategy(n,e,r,s)}function delimitedStrategy(s,e,r,n,o){let a=s.textAfter,l=a.match(/^\s*/)[0].length,c=n&&a.slice(l,l+n.length)==n||o==s.pos+l,h=e?bracketedAligned(s):null;return h?c?s.column(h.from):s.column(h.to):s.baseIndent+(c?0:s.unit*r)}const flatIndent=s=>s.baseIndent;function continuedIndent({except:s,units:e=1}={}){return r=>{let n=s&&s.test(r.textAfter);return r.baseIndent+(n?0:e*r.unit)}}const DontIndentBeyond=200;function indentOnInput(){return EditorState.transactionFilter.of(s=>{if(!s.docChanged||!s.isUserEvent("input.type")&&!s.isUserEvent("input.complete"))return s;let e=s.startState.languageDataAt("indentOnInput",s.startState.selection.main.head);if(!e.length)return s;let r=s.newDoc,{head:n}=s.newSelection.main,o=r.lineAt(n);if(n>o.from+DontIndentBeyond)return s;let a=r.sliceString(o.from,n);if(!e.some(f=>f.test(a)))return s;let{state:l}=s,c=-1,h=[];for(let{head:f}of l.selection.ranges){let d=l.doc.lineAt(f);if(d.from==c)continue;c=d.from;let m=getIndentation(l,d.from);if(m==null)continue;let v=/^\s*/.exec(d.text)[0],A=indentString(l,m);v!=A&&h.push({from:d.from,to:d.from+v.length,insert:A})}return h.length?[s,{changes:h,sequential:!0}]:s})}const foldService=Facet.define(),foldNodeProp=new NodeProp;function foldInside(s){let e=s.firstChild,r=s.lastChild;return e&&e.to<r.from?{from:e.to,to:r.type.isError?s.to:r.from}:null}function syntaxFolding(s,e,r){let n=syntaxTree(s);if(n.length<r)return null;let o=n.resolveInner(r,1),a=null;for(let l=o;l;l=l.parent){if(l.to<=r||l.from>r)continue;if(a&&l.from<e)break;let c=l.type.prop(foldNodeProp);if(c&&(l.to<n.length-50||n.length==s.doc.length||!isUnfinished(l))){let h=c(l,s);h&&h.from<=r&&h.from>=e&&h.to>r&&(a=h)}}return a}function isUnfinished(s){let e=s.lastChild;return e&&e.to==s.to&&e.type.isError}function foldable(s,e,r){for(let n of s.facet(foldService)){let o=n(s,e,r);if(o)return o}return syntaxFolding(s,e,r)}function mapRange(s,e){let r=e.mapPos(s.from,1),n=e.mapPos(s.to,-1);return r>=n?void 0:{from:r,to:n}}const foldEffect=StateEffect.define({map:mapRange}),unfoldEffect=StateEffect.define({map:mapRange});function selectedLines(s){let e=[];for(let{head:r}of s.state.selection.ranges)e.some(n=>n.from<=r&&n.to>=r)||e.push(s.lineBlockAt(r));return e}const foldState=StateField.define({create(){return Decoration.none},update(s,e){s=s.map(e.changes);for(let r of e.effects)r.is(foldEffect)&&!foldExists(s,r.value.from,r.value.to)?s=s.update({add:[foldWidget.range(r.value.from,r.value.to)]}):r.is(unfoldEffect)&&(s=s.update({filter:(n,o)=>r.value.from!=n||r.value.to!=o,filterFrom:r.value.from,filterTo:r.value.to}));if(e.selection){let r=!1,{head:n}=e.selection.main;s.between(n,n,(o,a)=>{o<n&&a>n&&(r=!0)}),r&&(s=s.update({filterFrom:n,filterTo:n,filter:(o,a)=>a<=n||o>=n}))}return s},provide:s=>EditorView.decorations.from(s),toJSON(s,e){let r=[];return s.between(0,e.doc.length,(n,o)=>{r.push(n,o)}),r},fromJSON(s){if(!Array.isArray(s)||s.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let r=0;r<s.length;){let n=s[r++],o=s[r++];if(typeof n!="number"||typeof o!="number")throw new RangeError("Invalid JSON for fold state");e.push(foldWidget.range(n,o))}return Decoration.set(e,!0)}});function findFold(s,e,r){var n;let o=null;return(n=s.field(foldState,!1))===null||n===void 0||n.between(e,r,(a,l)=>{(!o||o.from>a)&&(o={from:a,to:l})}),o}function foldExists(s,e,r){let n=!1;return s.between(e,e,(o,a)=>{o==e&&a==r&&(n=!0)}),n}function maybeEnable(s,e){return s.field(foldState,!1)?e:e.concat(StateEffect.appendConfig.of(codeFolding()))}const foldCode=s=>{for(let e of selectedLines(s)){let r=foldable(s.state,e.from,e.to);if(r)return s.dispatch({effects:maybeEnable(s.state,[foldEffect.of(r),announceFold(s,r)])}),!0}return!1};function announceFold(s,e,r=!0){let n=s.state.doc.lineAt(e.from).number,o=s.state.doc.lineAt(e.to).number;return EditorView.announce.of(`${s.state.phrase(r?"Folded lines":"Unfolded lines")} ${n} ${s.state.phrase("to")} ${o}.`)}const defaultConfig={placeholderDOM:null,placeholderText:"…"},foldConfig=Facet.define({combine(s){return combineConfig(s,defaultConfig)}});function codeFolding(s){let e=[foldState,baseTheme$1$1];return s&&e.push(foldConfig.of(s)),e}const foldWidget=Decoration.replace({widget:new class extends WidgetType{toDOM(s){let{state:e}=s,r=e.facet(foldConfig),n=a=>{let l=s.lineBlockAt(s.posAtDOM(a.target)),c=findFold(s.state,l.from,l.to);c&&s.dispatch({effects:unfoldEffect.of(c)}),a.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(s,n);let o=document.createElement("span");return o.textContent=r.placeholderText,o.setAttribute("aria-label",e.phrase("folded code")),o.title=e.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=n,o}}}),baseTheme$1$1=EditorView.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class HighlightStyle{constructor(e,r){this.specs=e;let n;function o(c){let h=StyleModule.newName();return(n||(n=Object.create(null)))["."+h]=c,h}const a=typeof r.all=="string"?r.all:r.all?o(r.all):void 0,l=r.scope;this.scope=l instanceof Language?c=>c.prop(languageDataProp)==l.data:l?c=>c==l:void 0,this.style=tagHighlighter(e.map(c=>({tag:c.tag,class:c.class||o(Object.assign({},c,{tag:null}))})),{all:a}).style,this.module=n?new StyleModule(n):null,this.themeType=r.themeType}static define(e,r){return new HighlightStyle(e,r||{})}}const highlighterFacet=Facet.define(),fallbackHighlighter=Facet.define({combine(s){return s.length?[s[0]]:null}});function getHighlighters(s){let e=s.facet(highlighterFacet);return e.length?e:s.facet(fallbackHighlighter)}function syntaxHighlighting(s,e){let r=[treeHighlighter],n;return s instanceof HighlightStyle&&(s.module&&r.push(EditorView.styleModule.of(s.module)),n=s.themeType),e!=null&&e.fallback?r.push(fallbackHighlighter.of(s)):n?r.push(highlighterFacet.computeN([EditorView.darkTheme],o=>o.facet(EditorView.darkTheme)==(n=="dark")?[s]:[])):r.push(highlighterFacet.of(s)),r}class TreeHighlighter{constructor(e){this.markCache=Object.create(null),this.tree=syntaxTree(e.state),this.decorations=this.buildDeco(e,getHighlighters(e.state))}update(e){let r=syntaxTree(e.state),n=getHighlighters(e.state),o=n!=getHighlighters(e.startState);r.length<e.view.viewport.to&&!o&&r.type==this.tree.type?this.decorations=this.decorations.map(e.changes):(r!=this.tree||e.viewportChanged||o)&&(this.tree=r,this.decorations=this.buildDeco(e.view,n))}buildDeco(e,r){if(!r||!this.tree.length)return Decoration.none;let n=new RangeSetBuilder;for(let{from:o,to:a}of e.visibleRanges)highlightTree(this.tree,r,(l,c,h)=>{n.add(l,c,this.markCache[h]||(this.markCache[h]=Decoration.mark({class:h})))},o,a);return n.finish()}}const treeHighlighter=Prec.high(ViewPlugin.fromClass(TreeHighlighter,{decorations:s=>s.decorations})),defaultHighlightStyle=HighlightStyle.define([{tag:tags$1.meta,color:"#404740"},{tag:tags$1.link,textDecoration:"underline"},{tag:tags$1.heading,textDecoration:"underline",fontWeight:"bold"},{tag:tags$1.emphasis,fontStyle:"italic"},{tag:tags$1.strong,fontWeight:"bold"},{tag:tags$1.strikethrough,textDecoration:"line-through"},{tag:tags$1.keyword,color:"#708"},{tag:[tags$1.atom,tags$1.bool,tags$1.url,tags$1.contentSeparator,tags$1.labelName],color:"#219"},{tag:[tags$1.literal,tags$1.inserted],color:"#164"},{tag:[tags$1.string,tags$1.deleted],color:"#a11"},{tag:[tags$1.regexp,tags$1.escape,tags$1.special(tags$1.string)],color:"#e40"},{tag:tags$1.definition(tags$1.variableName),color:"#00f"},{tag:tags$1.local(tags$1.variableName),color:"#30a"},{tag:[tags$1.typeName,tags$1.namespace],color:"#085"},{tag:tags$1.className,color:"#167"},{tag:[tags$1.special(tags$1.variableName),tags$1.macroName],color:"#256"},{tag:tags$1.definition(tags$1.propertyName),color:"#00c"},{tag:tags$1.comment,color:"#940"},{tag:tags$1.invalid,color:"#f00"}]),baseTheme$2=EditorView.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),DefaultScanDist=1e4,DefaultBrackets="()[]{}",bracketMatchingConfig=Facet.define({combine(s){return combineConfig(s,{afterCursor:!0,brackets:DefaultBrackets,maxScanDistance:DefaultScanDist,renderMatch:defaultRenderMatch})}}),matchingMark=Decoration.mark({class:"cm-matchingBracket"}),nonmatchingMark=Decoration.mark({class:"cm-nonmatchingBracket"});function defaultRenderMatch(s){let e=[],r=s.matched?matchingMark:nonmatchingMark;return e.push(r.range(s.start.from,s.start.to)),s.end&&e.push(r.range(s.end.from,s.end.to)),e}const bracketMatchingState=StateField.define({create(){return Decoration.none},update(s,e){if(!e.docChanged&&!e.selection)return s;let r=[],n=e.state.facet(bracketMatchingConfig);for(let o of e.state.selection.ranges){if(!o.empty)continue;let a=matchBrackets(e.state,o.head,-1,n)||o.head>0&&matchBrackets(e.state,o.head-1,1,n)||n.afterCursor&&(matchBrackets(e.state,o.head,1,n)||o.head<e.state.doc.length&&matchBrackets(e.state,o.head+1,-1,n));a&&(r=r.concat(n.renderMatch(a,e.state)))}return Decoration.set(r,!0)},provide:s=>EditorView.decorations.from(s)}),bracketMatchingUnique=[bracketMatchingState,baseTheme$2];function bracketMatching(s={}){return[bracketMatchingConfig.of(s),bracketMatchingUnique]}const bracketMatchingHandle=new NodeProp;function matchingNodes(s,e,r){let n=s.prop(e<0?NodeProp.openedBy:NodeProp.closedBy);if(n)return n;if(s.name.length==1){let o=r.indexOf(s.name);if(o>-1&&o%2==(e<0?1:0))return[r[o+e]]}return null}function findHandle(s){let e=s.type.prop(bracketMatchingHandle);return e?e(s.node):s}function matchBrackets(s,e,r,n={}){let o=n.maxScanDistance||DefaultScanDist,a=n.brackets||DefaultBrackets,l=syntaxTree(s),c=l.resolveInner(e,r);for(let h=c;h;h=h.parent){let f=matchingNodes(h.type,r,a);if(f&&h.from<h.to){let d=findHandle(h);if(d&&(r>0?e>=d.from&&e<d.to:e>d.from&&e<=d.to))return matchMarkedBrackets(s,e,r,h,d,f,a)}}return matchPlainBrackets(s,e,r,l,c.type,o,a)}function matchMarkedBrackets(s,e,r,n,o,a,l){let c=n.parent,h={from:o.from,to:o.to},f=0,d=c==null?void 0:c.cursor();if(d&&(r<0?d.childBefore(n.from):d.childAfter(n.to)))do if(r<0?d.to<=n.from:d.from>=n.to){if(f==0&&a.indexOf(d.type.name)>-1&&d.from<d.to){let m=findHandle(d);return{start:h,end:m?{from:m.from,to:m.to}:void 0,matched:!0}}else if(matchingNodes(d.type,r,l))f++;else if(matchingNodes(d.type,-r,l)){if(f==0){let m=findHandle(d);return{start:h,end:m&&m.from<m.to?{from:m.from,to:m.to}:void 0,matched:!1}}f--}}while(r<0?d.prevSibling():d.nextSibling());return{start:h,matched:!1}}function matchPlainBrackets(s,e,r,n,o,a,l){let c=r<0?s.sliceDoc(e-1,e):s.sliceDoc(e,e+1),h=l.indexOf(c);if(h<0||h%2==0!=r>0)return null;let f={from:r<0?e-1:e,to:r>0?e+1:e},d=s.doc.iterRange(e,r>0?s.doc.length:0),m=0;for(let v=0;!d.next().done&&v<=a;){let A=d.value;r<0&&(v+=A.length);let T=e+v*r;for(let B=r>0?0:A.length-1,Y=r>0?A.length:-1;B!=Y;B+=r){let F=l.indexOf(A[B]);if(!(F<0||n.resolveInner(T+B,1).type!=o))if(F%2==0==r>0)m++;else{if(m==1)return{start:f,end:{from:T+B,to:T+B+1},matched:F>>1==h>>1};m--}}r>0&&(v+=A.length)}return d.done?{start:f,matched:!1}:null}function countCol(s,e,r,n=0,o=0){e==null&&(e=s.search(/[^\s\u00a0]/),e==-1&&(e=s.length));let a=o;for(let l=n;l<e;l++)s.charCodeAt(l)==9?a+=r-a%r:a++;return a}class StringStream{constructor(e,r,n,o){this.string=e,this.tabSize=r,this.indentUnit=n,this.overrideIndent=o,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let r=this.string.charAt(this.pos),n;if(typeof e=="string"?n=r==e:n=r&&(e instanceof RegExp?e.test(r):e(r)),n)return++this.pos,r}eatWhile(e){let r=this.pos;for(;this.eat(e););return this.pos>r}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let r=this.string.indexOf(e,this.pos);if(r>-1)return this.pos=r,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=countCol(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:countCol(this.string,null,this.tabSize)}match(e,r,n){if(typeof e=="string"){let o=l=>n?l.toLowerCase():l,a=this.string.substr(this.pos,e.length);return o(a)==o(e)?(r!==!1&&(this.pos+=e.length),!0):null}else{let o=this.string.slice(this.pos).match(e);return o&&o.index>0?null:(o&&r!==!1&&(this.pos+=o[0].length),o)}}current(){return this.string.slice(this.start,this.pos)}}const noTokens=Object.create(null),typeArray=[NodeType.none],warned$1=[],defaultTable=Object.create(null);for(let[s,e]of[["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"]])defaultTable[s]=createTokenType(noTokens,e);function warnForPart(s,e){warned$1.indexOf(s)>-1||(warned$1.push(s),console.warn(e))}function createTokenType(s,e){let r=null;for(let a of e.split(".")){let l=s[a]||tags$1[a];l?typeof l=="function"?r?r=l(r):warnForPart(a,`Modifier ${a} used at start of tag`):r?warnForPart(a,`Tag ${a} used as modifier`):r=l:warnForPart(a,`Unknown highlighting tag ${a}`)}if(!r)return 0;let n=e.replace(/ /g,"_"),o=NodeType.define({id:typeArray.length,name:n,props:[styleTags({[n]:r})]});return typeArray.push(o),o.id}const toggleComment=s=>{let{state:e}=s,r=e.doc.lineAt(e.selection.main.from),n=getConfig(s.state,r.from);return n.line?toggleLineComment(s):n.block?toggleBlockCommentByLine(s):!1};function command(s,e){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let o=s(e,r);return o?(n(r.update(o)),!0):!1}}const toggleLineComment=command(changeLineComment,0),toggleBlockComment=command(changeBlockComment,0),toggleBlockCommentByLine=command((s,e)=>changeBlockComment(s,e,selectedLineRanges(e)),0);function getConfig(s,e){let r=s.languageDataAt("commentTokens",e);return r.length?r[0]:{}}const SearchMargin=50;function findBlockComment(s,{open:e,close:r},n,o){let a=s.sliceDoc(n-SearchMargin,n),l=s.sliceDoc(o,o+SearchMargin),c=/\s*$/.exec(a)[0].length,h=/^\s*/.exec(l)[0].length,f=a.length-c;if(a.slice(f-e.length,f)==e&&l.slice(h,h+r.length)==r)return{open:{pos:n-c,margin:c&&1},close:{pos:o+h,margin:h&&1}};let d,m;o-n<=2*SearchMargin?d=m=s.sliceDoc(n,o):(d=s.sliceDoc(n,n+SearchMargin),m=s.sliceDoc(o-SearchMargin,o));let v=/^\s*/.exec(d)[0].length,A=/\s*$/.exec(m)[0].length,T=m.length-A-r.length;return d.slice(v,v+e.length)==e&&m.slice(T,T+r.length)==r?{open:{pos:n+v+e.length,margin:/\s/.test(d.charAt(v+e.length))?1:0},close:{pos:o-A-r.length,margin:/\s/.test(m.charAt(T-1))?1:0}}:null}function selectedLineRanges(s){let e=[];for(let r of s.selection.ranges){let n=s.doc.lineAt(r.from),o=r.to<=n.to?n:s.doc.lineAt(r.to),a=e.length-1;a>=0&&e[a].to>n.from?e[a].to=o.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:o.to})}return e}function changeBlockComment(s,e,r=e.selection.ranges){let n=r.map(a=>getConfig(e,a.from).block);if(!n.every(a=>a))return null;let o=r.map((a,l)=>findBlockComment(e,n[l],a.from,a.to));if(s!=2&&!o.every(a=>a))return{changes:e.changes(r.map((a,l)=>o[l]?[]:[{from:a.from,insert:n[l].open+" "},{from:a.to,insert:" "+n[l].close}]))};if(s!=1&&o.some(a=>a)){let a=[];for(let l=0,c;l<o.length;l++)if(c=o[l]){let h=n[l],{open:f,close:d}=c;a.push({from:f.pos-h.open.length,to:f.pos+f.margin},{from:d.pos-d.margin,to:d.pos+h.close.length})}return{changes:a}}return null}function changeLineComment(s,e,r=e.selection.ranges){let n=[],o=-1;for(let{from:a,to:l}of r){let c=n.length,h=1e9,f=getConfig(e,a).line;if(f){for(let d=a;d<=l;){let m=e.doc.lineAt(d);if(m.from>o&&(a==l||l>m.from)){o=m.from;let v=/^\s*/.exec(m.text)[0].length,A=v==m.length,T=m.text.slice(v,v+f.length)==f?v:-1;v<m.text.length&&v<h&&(h=v),n.push({line:m,comment:T,token:f,indent:v,empty:A,single:!1})}d=m.to+1}if(h<1e9)for(let d=c;d<n.length;d++)n[d].indent<n[d].line.text.length&&(n[d].indent=h);n.length==c+1&&(n[c].single=!0)}}if(s!=2&&n.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:c,token:h,indent:f,empty:d,single:m}of n)(m||!d)&&a.push({from:c.from+f,insert:h+" "});let l=e.changes(a);return{changes:l,selection:e.selection.map(l,1)}}else if(s!=1&&n.some(a=>a.comment>=0)){let a=[];for(let{line:l,comment:c,token:h}of n)if(c>=0){let f=l.from+c,d=f+h.length;l.text[d-l.from]==" "&&d++,a.push({from:f,to:d})}return{changes:a}}return null}const fromHistory=Annotation.define(),isolateHistory=Annotation.define(),invertedEffects=Facet.define(),historyConfig=Facet.define({combine(s){return combineConfig(s,{minDepth:100,newGroupDelay:500,joinToEvent:(e,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,r)=>(n,o)=>e(n,o)||r(n,o)})}});function changeEnd(s){let e=0;return s.iterChangedRanges((r,n)=>e=n),e}const historyField_=StateField.define({create(){return HistoryState.empty},update(s,e){let r=e.state.facet(historyConfig),n=e.annotation(fromHistory);if(n){let h=e.docChanged?EditorSelection.single(changeEnd(e.changes)):void 0,f=HistEvent.fromTransaction(e,h),d=n.side,m=d==0?s.undone:s.done;return f?m=updateBranch(m,m.length,r.minDepth,f):m=addSelection(m,e.startState.selection),new HistoryState(d==0?n.rest:m,d==0?m:n.rest)}let o=e.annotation(isolateHistory);if((o=="full"||o=="before")&&(s=s.isolate()),e.annotation(Transaction.addToHistory)===!1)return e.changes.empty?s:s.addMapping(e.changes.desc);let a=HistEvent.fromTransaction(e),l=e.annotation(Transaction.time),c=e.annotation(Transaction.userEvent);return a?s=s.addChanges(a,l,c,r,e):e.selection&&(s=s.addSelection(e.startState.selection,l,c,r.newGroupDelay)),(o=="full"||o=="after")&&(s=s.isolate()),s},toJSON(s){return{done:s.done.map(e=>e.toJSON()),undone:s.undone.map(e=>e.toJSON())}},fromJSON(s){return new HistoryState(s.done.map(HistEvent.fromJSON),s.undone.map(HistEvent.fromJSON))}});function history(s={}){return[historyField_,historyConfig.of(s),EditorView.domEventHandlers({beforeinput(e,r){let n=e.inputType=="historyUndo"?undo:e.inputType=="historyRedo"?redo:null;return n?(e.preventDefault(),n(r)):!1}})]}function cmd(s,e){return function({state:r,dispatch:n}){if(!e&&r.readOnly)return!1;let o=r.field(historyField_,!1);if(!o)return!1;let a=o.pop(s,r,e);return a?(n(a),!0):!1}}const undo=cmd(0,!1),redo=cmd(1,!1),undoSelection=cmd(0,!0),redoSelection=cmd(1,!0);class HistEvent{constructor(e,r,n,o,a){this.changes=e,this.effects=r,this.mapped=n,this.startSelection=o,this.selectionsAfter=a}setSelAfter(e){return new HistEvent(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,r,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(o=>o.toJSON())}}static fromJSON(e){return new HistEvent(e.changes&&ChangeSet.fromJSON(e.changes),[],e.mapped&&ChangeDesc.fromJSON(e.mapped),e.startSelection&&EditorSelection.fromJSON(e.startSelection),e.selectionsAfter.map(EditorSelection.fromJSON))}static fromTransaction(e,r){let n=none$2;for(let o of e.startState.facet(invertedEffects)){let a=o(e);a.length&&(n=n.concat(a))}return!n.length&&e.changes.empty?null:new HistEvent(e.changes.invert(e.startState.doc),n,void 0,r||e.startState.selection,none$2)}static selection(e){return new HistEvent(void 0,none$2,void 0,void 0,e)}}function updateBranch(s,e,r,n){let o=e+1>r+20?e-r-1:0,a=s.slice(o,e);return a.push(n),a}function isAdjacent(s,e){let r=[],n=!1;return s.iterChangedRanges((o,a)=>r.push(o,a)),e.iterChangedRanges((o,a,l,c)=>{for(let h=0;h<r.length;){let f=r[h++],d=r[h++];c>=f&&l<=d&&(n=!0)}}),n}function eqSelectionShape(s,e){return s.ranges.length==e.ranges.length&&s.ranges.filter((r,n)=>r.empty!=e.ranges[n].empty).length===0}function conc(s,e){return s.length?e.length?s.concat(e):s:e}const none$2=[],MaxSelectionsPerEvent=200;function addSelection(s,e){if(s.length){let r=s[s.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-MaxSelectionsPerEvent));return n.length&&n[n.length-1].eq(e)?s:(n.push(e),updateBranch(s,s.length-1,1e9,r.setSelAfter(n)))}else return[HistEvent.selection([e])]}function popSelection(s){let e=s[s.length-1],r=s.slice();return r[s.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),r}function addMappingToBranch(s,e){if(!s.length)return s;let r=s.length,n=none$2;for(;r;){let o=mapEvent(s[r-1],e,n);if(o.changes&&!o.changes.empty||o.effects.length){let a=s.slice(0,r);return a[r-1]=o,a}else e=o.mapped,r--,n=o.selectionsAfter}return n.length?[HistEvent.selection(n)]:none$2}function mapEvent(s,e,r){let n=conc(s.selectionsAfter.length?s.selectionsAfter.map(c=>c.map(e)):none$2,r);if(!s.changes)return HistEvent.selection(n);let o=s.changes.map(e),a=e.mapDesc(s.changes,!0),l=s.mapped?s.mapped.composeDesc(a):a;return new HistEvent(o,StateEffect.mapEffects(s.effects,e),l,s.startSelection.map(a),n)}const joinableUserEvent=/^(input\.type|delete)($|\.)/;class HistoryState{constructor(e,r,n=0,o=void 0){this.done=e,this.undone=r,this.prevTime=n,this.prevUserEvent=o}isolate(){return this.prevTime?new HistoryState(this.done,this.undone):this}addChanges(e,r,n,o,a){let l=this.done,c=l[l.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!n||joinableUserEvent.test(n))&&(!c.selectionsAfter.length&&r-this.prevTime<o.newGroupDelay&&o.joinToEvent(a,isAdjacent(c.changes,e.changes))||n=="input.type.compose")?l=updateBranch(l,l.length-1,o.minDepth,new HistEvent(e.changes.compose(c.changes),conc(e.effects,c.effects),c.mapped,c.startSelection,none$2)):l=updateBranch(l,l.length,o.minDepth,e),new HistoryState(l,none$2,r,n)}addSelection(e,r,n,o){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:none$2;return a.length>0&&r-this.prevTime<o&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&eqSelectionShape(a[a.length-1],e)?this:new HistoryState(addSelection(this.done,e),this.undone,r,n)}addMapping(e){return new HistoryState(addMappingToBranch(this.done,e),addMappingToBranch(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,r,n){let o=e==0?this.done:this.undone;if(o.length==0)return null;let a=o[o.length-1];if(n&&a.selectionsAfter.length)return r.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:fromHistory.of({side:e,rest:popSelection(o)}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let l=o.length==1?none$2:o.slice(0,o.length-1);return a.mapped&&(l=addMappingToBranch(l,a.mapped)),r.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:fromHistory.of({side:e,rest:l}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}HistoryState.empty=new HistoryState(none$2,none$2);const historyKeymap=[{key:"Mod-z",run:undo,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:redo,preventDefault:!0},{linux:"Ctrl-Shift-z",run:redo,preventDefault:!0},{key:"Mod-u",run:undoSelection,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:redoSelection,preventDefault:!0}];function updateSel(s,e){return EditorSelection.create(s.ranges.map(e),s.mainIndex)}function setSel(s,e){return s.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function moveSel({state:s,dispatch:e},r){let n=updateSel(s.selection,r);return n.eq(s.selection)?!1:(e(setSel(s,n)),!0)}function rangeEnd(s,e){return EditorSelection.cursor(e?s.to:s.from)}function cursorByChar(s,e){return moveSel(s,r=>r.empty?s.moveByChar(r,e):rangeEnd(r,e))}function ltrAtCursor(s){return s.textDirectionAt(s.state.selection.main.head)==Direction.LTR}const cursorCharLeft=s=>cursorByChar(s,!ltrAtCursor(s)),cursorCharRight=s=>cursorByChar(s,ltrAtCursor(s)),cursorCharBackward=s=>cursorByChar(s,!1);function cursorByGroup(s,e){return moveSel(s,r=>r.empty?s.moveByGroup(r,e):rangeEnd(r,e))}const cursorGroupLeft=s=>cursorByGroup(s,!ltrAtCursor(s)),cursorGroupRight=s=>cursorByGroup(s,ltrAtCursor(s));function interestingNode(s,e,r){if(e.type.prop(r))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(s.sliceDoc(e.from,e.to)))||e.firstChild}function moveBySyntax(s,e,r){let n=syntaxTree(s).resolveInner(e.head),o=r?NodeProp.closedBy:NodeProp.openedBy;for(let h=e.head;;){let f=r?n.childAfter(h):n.childBefore(h);if(!f)break;interestingNode(s,f,o)?n=f:h=r?f.to:f.from}let a=n.type.prop(o),l,c;return a&&(l=r?matchBrackets(s,n.from,1):matchBrackets(s,n.to,-1))&&l.matched?c=r?l.end.to:l.end.from:c=r?n.to:n.from,EditorSelection.cursor(c,r?-1:1)}const cursorSyntaxLeft=s=>moveSel(s,e=>moveBySyntax(s.state,e,!ltrAtCursor(s))),cursorSyntaxRight=s=>moveSel(s,e=>moveBySyntax(s.state,e,ltrAtCursor(s)));function cursorByLine(s,e){return moveSel(s,r=>{if(!r.empty)return rangeEnd(r,e);let n=s.moveVertically(r,e);return n.head!=r.head?n:s.moveToLineBoundary(r,e)})}const cursorLineUp=s=>cursorByLine(s,!1),cursorLineDown=s=>cursorByLine(s,!0);function pageInfo(s){let e=s.scrollDOM.clientHeight<s.scrollDOM.scrollHeight-2,r=0,n=0,o;if(e){for(let a of s.state.facet(EditorView.scrollMargins)){let l=a(s);l!=null&&l.top&&(r=Math.max(l==null?void 0:l.top,r)),l!=null&&l.bottom&&(n=Math.max(l==null?void 0:l.bottom,n))}o=s.scrollDOM.clientHeight-r-n}else o=(s.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:n,selfScroll:e,height:Math.max(s.defaultLineHeight,o-5)}}function cursorByPage(s,e){let r=pageInfo(s),{state:n}=s,o=updateSel(n.selection,l=>l.empty?s.moveVertically(l,e,r.height):rangeEnd(l,e));if(o.eq(n.selection))return!1;let a;if(r.selfScroll){let l=s.coordsAtPos(n.selection.main.head),c=s.scrollDOM.getBoundingClientRect(),h=c.top+r.marginTop,f=c.bottom-r.marginBottom;l&&l.top>h&&l.bottom<f&&(a=EditorView.scrollIntoView(o.main.head,{y:"start",yMargin:l.top-h}))}return s.dispatch(setSel(n,o),{effects:a}),!0}const cursorPageUp=s=>cursorByPage(s,!1),cursorPageDown=s=>cursorByPage(s,!0);function moveByLineBoundary(s,e,r){let n=s.lineBlockAt(e.head),o=s.moveToLineBoundary(e,r);if(o.head==e.head&&o.head!=(r?n.to:n.from)&&(o=s.moveToLineBoundary(e,r,!1)),!r&&o.head==n.from&&n.length){let a=/^\s*/.exec(s.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;a&&e.head!=n.from+a&&(o=EditorSelection.cursor(n.from+a))}return o}const cursorLineBoundaryForward=s=>moveSel(s,e=>moveByLineBoundary(s,e,!0)),cursorLineBoundaryBackward=s=>moveSel(s,e=>moveByLineBoundary(s,e,!1)),cursorLineBoundaryLeft=s=>moveSel(s,e=>moveByLineBoundary(s,e,!ltrAtCursor(s))),cursorLineBoundaryRight=s=>moveSel(s,e=>moveByLineBoundary(s,e,ltrAtCursor(s))),cursorLineStart=s=>moveSel(s,e=>EditorSelection.cursor(s.lineBlockAt(e.head).from,1)),cursorLineEnd=s=>moveSel(s,e=>EditorSelection.cursor(s.lineBlockAt(e.head).to,-1));function toMatchingBracket(s,e,r){let n=!1,o=updateSel(s.selection,a=>{let l=matchBrackets(s,a.head,-1)||matchBrackets(s,a.head,1)||a.head>0&&matchBrackets(s,a.head-1,1)||a.head<s.doc.length&&matchBrackets(s,a.head+1,-1);if(!l||!l.end)return a;n=!0;let c=l.start.from==a.head?l.end.to:l.end.from;return r?EditorSelection.range(a.anchor,c):EditorSelection.cursor(c)});return n?(e(setSel(s,o)),!0):!1}const cursorMatchingBracket=({state:s,dispatch:e})=>toMatchingBracket(s,e,!1);function extendSel(s,e){let r=updateSel(s.state.selection,n=>{let o=e(n);return EditorSelection.range(n.anchor,o.head,o.goalColumn,o.bidiLevel||void 0)});return r.eq(s.state.selection)?!1:(s.dispatch(setSel(s.state,r)),!0)}function selectByChar(s,e){return extendSel(s,r=>s.moveByChar(r,e))}const selectCharLeft=s=>selectByChar(s,!ltrAtCursor(s)),selectCharRight=s=>selectByChar(s,ltrAtCursor(s));function selectByGroup(s,e){return extendSel(s,r=>s.moveByGroup(r,e))}const selectGroupLeft=s=>selectByGroup(s,!ltrAtCursor(s)),selectGroupRight=s=>selectByGroup(s,ltrAtCursor(s)),selectSyntaxLeft=s=>extendSel(s,e=>moveBySyntax(s.state,e,!ltrAtCursor(s))),selectSyntaxRight=s=>extendSel(s,e=>moveBySyntax(s.state,e,ltrAtCursor(s)));function selectByLine(s,e){return extendSel(s,r=>s.moveVertically(r,e))}const selectLineUp=s=>selectByLine(s,!1),selectLineDown=s=>selectByLine(s,!0);function selectByPage(s,e){return extendSel(s,r=>s.moveVertically(r,e,pageInfo(s).height))}const selectPageUp=s=>selectByPage(s,!1),selectPageDown=s=>selectByPage(s,!0),selectLineBoundaryForward=s=>extendSel(s,e=>moveByLineBoundary(s,e,!0)),selectLineBoundaryBackward=s=>extendSel(s,e=>moveByLineBoundary(s,e,!1)),selectLineBoundaryLeft=s=>extendSel(s,e=>moveByLineBoundary(s,e,!ltrAtCursor(s))),selectLineBoundaryRight=s=>extendSel(s,e=>moveByLineBoundary(s,e,ltrAtCursor(s))),selectLineStart=s=>extendSel(s,e=>EditorSelection.cursor(s.lineBlockAt(e.head).from)),selectLineEnd=s=>extendSel(s,e=>EditorSelection.cursor(s.lineBlockAt(e.head).to)),cursorDocStart=({state:s,dispatch:e})=>(e(setSel(s,{anchor:0})),!0),cursorDocEnd=({state:s,dispatch:e})=>(e(setSel(s,{anchor:s.doc.length})),!0),selectDocStart=({state:s,dispatch:e})=>(e(setSel(s,{anchor:s.selection.main.anchor,head:0})),!0),selectDocEnd=({state:s,dispatch:e})=>(e(setSel(s,{anchor:s.selection.main.anchor,head:s.doc.length})),!0),selectAll=({state:s,dispatch:e})=>(e(s.update({selection:{anchor:0,head:s.doc.length},userEvent:"select"})),!0),selectLine=({state:s,dispatch:e})=>{let r=selectedLineBlocks(s).map(({from:n,to:o})=>EditorSelection.range(n,Math.min(o+1,s.doc.length)));return e(s.update({selection:EditorSelection.create(r),userEvent:"select"})),!0},selectParentSyntax=({state:s,dispatch:e})=>{let r=updateSel(s.selection,n=>{var o;let a=syntaxTree(s).resolveInner(n.head,1);for(;!(a.from<n.from&&a.to>=n.to||a.to>n.to&&a.from<=n.from||!(!((o=a.parent)===null||o===void 0)&&o.parent));)a=a.parent;return EditorSelection.range(a.to,a.from)});return e(setSel(s,r)),!0},simplifySelection=({state:s,dispatch:e})=>{let r=s.selection,n=null;return r.ranges.length>1?n=EditorSelection.create([r.main]):r.main.empty||(n=EditorSelection.create([EditorSelection.cursor(r.main.head)])),n?(e(setSel(s,n)),!0):!1};function deleteBy(s,e){if(s.state.readOnly)return!1;let r="delete.selection",{state:n}=s,o=n.changeByRange(a=>{let{from:l,to:c}=a;if(l==c){let h=e(l);h<l?(r="delete.backward",h=skipAtomic(s,h,!1)):h>l&&(r="delete.forward",h=skipAtomic(s,h,!0)),l=Math.min(l,h),c=Math.max(c,h)}else l=skipAtomic(s,l,!1),c=skipAtomic(s,c,!0);return l==c?{range:a}:{changes:{from:l,to:c},range:EditorSelection.cursor(l)}});return o.changes.empty?!1:(s.dispatch(n.update(o,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?EditorView.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function skipAtomic(s,e,r){if(s instanceof EditorView)for(let n of s.state.facet(EditorView.atomicRanges).map(o=>o(s)))n.between(e,e,(o,a)=>{o<e&&a>e&&(e=r?a:o)});return e}const deleteByChar=(s,e)=>deleteBy(s,r=>{let{state:n}=s,o=n.doc.lineAt(r),a,l;if(!e&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,r-o.from))){if(a[a.length-1]==" ")return r-1;let c=countColumn(a,n.tabSize),h=c%getIndentUnit(n)||getIndentUnit(n);for(let f=0;f<h&&a[a.length-1-f]==" ";f++)r--;l=r}else l=findClusterBreak(o.text,r-o.from,e,e)+o.from,l==r&&o.number!=(e?n.doc.lines:1)&&(l+=e?1:-1);return l}),deleteCharBackward=s=>deleteByChar(s,!1),deleteCharForward=s=>deleteByChar(s,!0),deleteByGroup=(s,e)=>deleteBy(s,r=>{let n=r,{state:o}=s,a=o.doc.lineAt(n),l=o.charCategorizer(n);for(let c=null;;){if(n==(e?a.to:a.from)){n==r&&a.number!=(e?o.doc.lines:1)&&(n+=e?1:-1);break}let h=findClusterBreak(a.text,n-a.from,e)+a.from,f=a.text.slice(Math.min(n,h)-a.from,Math.max(n,h)-a.from),d=l(f);if(c!=null&&d!=c)break;(f!=" "||n!=r)&&(c=d),n=h}return n}),deleteGroupBackward=s=>deleteByGroup(s,!1),deleteGroupForward=s=>deleteByGroup(s,!0),deleteToLineEnd=s=>deleteBy(s,e=>{let r=s.lineBlockAt(e).to;return e<r?r:Math.min(s.state.doc.length,e+1)}),deleteToLineStart=s=>deleteBy(s,e=>{let r=s.lineBlockAt(e).from;return e>r?r:Math.max(0,e-1)}),splitLine=({state:s,dispatch:e})=>{if(s.readOnly)return!1;let r=s.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Text.of(["",""])},range:EditorSelection.cursor(n.from)}));return e(s.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},transposeChars=({state:s,dispatch:e})=>{if(s.readOnly)return!1;let r=s.changeByRange(n=>{if(!n.empty||n.from==0||n.from==s.doc.length)return{range:n};let o=n.from,a=s.doc.lineAt(o),l=o==a.from?o-1:findClusterBreak(a.text,o-a.from,!1)+a.from,c=o==a.to?o+1:findClusterBreak(a.text,o-a.from,!0)+a.from;return{changes:{from:l,to:c,insert:s.doc.slice(o,c).append(s.doc.slice(l,o))},range:EditorSelection.cursor(c)}});return r.changes.empty?!1:(e(s.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function selectedLineBlocks(s){let e=[],r=-1;for(let n of s.selection.ranges){let o=s.doc.lineAt(n.from),a=s.doc.lineAt(n.to);if(!n.empty&&n.to==a.from&&(a=s.doc.lineAt(n.to-1)),r>=o.number){let l=e[e.length-1];l.to=a.to,l.ranges.push(n)}else e.push({from:o.from,to:a.to,ranges:[n]});r=a.number+1}return e}function moveLine(s,e,r){if(s.readOnly)return!1;let n=[],o=[];for(let a of selectedLineBlocks(s)){if(r?a.to==s.doc.length:a.from==0)continue;let l=s.doc.lineAt(r?a.to+1:a.from-1),c=l.length+1;if(r){n.push({from:a.to,to:l.to},{from:a.from,insert:l.text+s.lineBreak});for(let h of a.ranges)o.push(EditorSelection.range(Math.min(s.doc.length,h.anchor+c),Math.min(s.doc.length,h.head+c)))}else{n.push({from:l.from,to:a.from},{from:a.to,insert:s.lineBreak+l.text});for(let h of a.ranges)o.push(EditorSelection.range(h.anchor-c,h.head-c))}}return n.length?(e(s.update({changes:n,scrollIntoView:!0,selection:EditorSelection.create(o,s.selection.mainIndex),userEvent:"move.line"})),!0):!1}const moveLineUp=({state:s,dispatch:e})=>moveLine(s,e,!1),moveLineDown=({state:s,dispatch:e})=>moveLine(s,e,!0);function copyLine(s,e,r){if(s.readOnly)return!1;let n=[];for(let o of selectedLineBlocks(s))r?n.push({from:o.from,insert:s.doc.slice(o.from,o.to)+s.lineBreak}):n.push({from:o.to,insert:s.lineBreak+s.doc.slice(o.from,o.to)});return e(s.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const copyLineUp=({state:s,dispatch:e})=>copyLine(s,e,!1),copyLineDown=({state:s,dispatch:e})=>copyLine(s,e,!0),deleteLine=s=>{if(s.state.readOnly)return!1;let{state:e}=s,r=e.changes(selectedLineBlocks(e).map(({from:o,to:a})=>(o>0?o--:a<e.doc.length&&a++,{from:o,to:a}))),n=updateSel(e.selection,o=>s.moveVertically(o,!0)).map(r);return s.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function isBetweenBrackets(s,e){if(/\(\)|\[\]|\{\}/.test(s.sliceDoc(e-1,e+1)))return{from:e,to:e};let r=syntaxTree(s).resolveInner(e),n=r.childBefore(e),o=r.childAfter(e),a;return n&&o&&n.to<=e&&o.from>=e&&(a=n.type.prop(NodeProp.closedBy))&&a.indexOf(o.name)>-1&&s.doc.lineAt(n.to).from==s.doc.lineAt(o.from).from?{from:n.to,to:o.from}:null}const insertNewlineAndIndent=newlineAndIndent(!1),insertBlankLine=newlineAndIndent(!0);function newlineAndIndent(s){return({state:e,dispatch:r})=>{if(e.readOnly)return!1;let n=e.changeByRange(o=>{let{from:a,to:l}=o,c=e.doc.lineAt(a),h=!s&&a==l&&isBetweenBrackets(e,a);s&&(a=l=(l<=c.to?c:e.doc.lineAt(l)).to);let f=new IndentContext(e,{simulateBreak:a,simulateDoubleBreak:!!h}),d=getIndentation(f,a);for(d==null&&(d=/^\s*/.exec(e.doc.lineAt(a).text)[0].length);l<c.to&&/\s/.test(c.text[l-c.from]);)l++;h?{from:a,to:l}=h:a>c.from&&a<c.from+100&&!/\S/.test(c.text.slice(0,a))&&(a=c.from);let m=["",indentString(e,d)];return h&&m.push(indentString(e,f.lineIndent(c.from,-1))),{changes:{from:a,to:l,insert:Text.of(m)},range:EditorSelection.cursor(a+1+m[1].length)}});return r(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function changeBySelectedLine(s,e){let r=-1;return s.changeByRange(n=>{let o=[];for(let l=n.from;l<=n.to;){let c=s.doc.lineAt(l);c.number>r&&(n.empty||n.to>c.from)&&(e(c,o,n),r=c.number),l=c.to+1}let a=s.changes(o);return{changes:o,range:EditorSelection.range(a.mapPos(n.anchor,1),a.mapPos(n.head,1))}})}const indentSelection=({state:s,dispatch:e})=>{if(s.readOnly)return!1;let r=Object.create(null),n=new IndentContext(s,{overrideIndentation:a=>{let l=r[a];return l??-1}}),o=changeBySelectedLine(s,(a,l,c)=>{let h=getIndentation(n,a.from);if(h==null)return;/\S/.test(a.text)||(h=0);let f=/^\s*/.exec(a.text)[0],d=indentString(s,h);(f!=d||c.from<a.from+f.length)&&(r[a.from]=h,l.push({from:a.from,to:a.from+f.length,insert:d}))});return o.changes.empty||e(s.update(o,{userEvent:"indent"})),!0},indentMore=({state:s,dispatch:e})=>s.readOnly?!1:(e(s.update(changeBySelectedLine(s,(r,n)=>{n.push({from:r.from,insert:s.facet(indentUnit)})}),{userEvent:"input.indent"})),!0),indentLess=({state:s,dispatch:e})=>s.readOnly?!1:(e(s.update(changeBySelectedLine(s,(r,n)=>{let o=/^\s*/.exec(r.text)[0];if(!o)return;let a=countColumn(o,s.tabSize),l=0,c=indentString(s,Math.max(0,a-getIndentUnit(s)));for(;l<o.length&&l<c.length&&o.charCodeAt(l)==c.charCodeAt(l);)l++;n.push({from:r.from+l,to:r.from+o.length,insert:c.slice(l)})}),{userEvent:"delete.dedent"})),!0),emacsStyleKeymap=[{key:"Ctrl-b",run:cursorCharLeft,shift:selectCharLeft,preventDefault:!0},{key:"Ctrl-f",run:cursorCharRight,shift:selectCharRight},{key:"Ctrl-p",run:cursorLineUp,shift:selectLineUp},{key:"Ctrl-n",run:cursorLineDown,shift:selectLineDown},{key:"Ctrl-a",run:cursorLineStart,shift:selectLineStart},{key:"Ctrl-e",run:cursorLineEnd,shift:selectLineEnd},{key:"Ctrl-d",run:deleteCharForward},{key:"Ctrl-h",run:deleteCharBackward},{key:"Ctrl-k",run:deleteToLineEnd},{key:"Ctrl-Alt-h",run:deleteGroupBackward},{key:"Ctrl-o",run:splitLine},{key:"Ctrl-t",run:transposeChars},{key:"Ctrl-v",run:cursorPageDown}],standardKeymap=[{key:"ArrowLeft",run:cursorCharLeft,shift:selectCharLeft,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:cursorGroupLeft,shift:selectGroupLeft,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:cursorLineBoundaryLeft,shift:selectLineBoundaryLeft,preventDefault:!0},{key:"ArrowRight",run:cursorCharRight,shift:selectCharRight,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:cursorGroupRight,shift:selectGroupRight,preventDefault:!0},{mac:"Cmd-ArrowRight",run:cursorLineBoundaryRight,shift:selectLineBoundaryRight,preventDefault:!0},{key:"ArrowUp",run:cursorLineUp,shift:selectLineUp,preventDefault:!0},{mac:"Cmd-ArrowUp",run:cursorDocStart,shift:selectDocStart},{mac:"Ctrl-ArrowUp",run:cursorPageUp,shift:selectPageUp},{key:"ArrowDown",run:cursorLineDown,shift:selectLineDown,preventDefault:!0},{mac:"Cmd-ArrowDown",run:cursorDocEnd,shift:selectDocEnd},{mac:"Ctrl-ArrowDown",run:cursorPageDown,shift:selectPageDown},{key:"PageUp",run:cursorPageUp,shift:selectPageUp},{key:"PageDown",run:cursorPageDown,shift:selectPageDown},{key:"Home",run:cursorLineBoundaryBackward,shift:selectLineBoundaryBackward,preventDefault:!0},{key:"Mod-Home",run:cursorDocStart,shift:selectDocStart},{key:"End",run:cursorLineBoundaryForward,shift:selectLineBoundaryForward,preventDefault:!0},{key:"Mod-End",run:cursorDocEnd,shift:selectDocEnd},{key:"Enter",run:insertNewlineAndIndent},{key:"Mod-a",run:selectAll},{key:"Backspace",run:deleteCharBackward,shift:deleteCharBackward},{key:"Delete",run:deleteCharForward},{key:"Mod-Backspace",mac:"Alt-Backspace",run:deleteGroupBackward},{key:"Mod-Delete",mac:"Alt-Delete",run:deleteGroupForward},{mac:"Mod-Backspace",run:deleteToLineStart},{mac:"Mod-Delete",run:deleteToLineEnd}].concat(emacsStyleKeymap.map(s=>({mac:s.key,run:s.run,shift:s.shift}))),defaultKeymap=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:cursorSyntaxLeft,shift:selectSyntaxLeft},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:cursorSyntaxRight,shift:selectSyntaxRight},{key:"Alt-ArrowUp",run:moveLineUp},{key:"Shift-Alt-ArrowUp",run:copyLineUp},{key:"Alt-ArrowDown",run:moveLineDown},{key:"Shift-Alt-ArrowDown",run:copyLineDown},{key:"Escape",run:simplifySelection},{key:"Mod-Enter",run:insertBlankLine},{key:"Alt-l",mac:"Ctrl-l",run:selectLine},{key:"Mod-i",run:selectParentSyntax,preventDefault:!0},{key:"Mod-[",run:indentLess},{key:"Mod-]",run:indentMore},{key:"Mod-Alt-\\",run:indentSelection},{key:"Shift-Mod-k",run:deleteLine},{key:"Shift-Mod-\\",run:cursorMatchingBracket},{key:"Mod-/",run:toggleComment},{key:"Alt-A",run:toggleBlockComment}].concat(standardKeymap);function crelt(){var s=arguments[0];typeof s=="string"&&(s=document.createElement(s));var e=1,r=arguments[1];if(r&&typeof r=="object"&&r.nodeType==null&&!Array.isArray(r)){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){var o=r[n];typeof o=="string"?s.setAttribute(n,o):o!=null&&(s[n]=o)}e++}for(;e<arguments.length;e++)add(s,arguments[e]);return s}function add(s,e){if(typeof e=="string")s.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)s.appendChild(e);else if(Array.isArray(e))for(var r=0;r<e.length;r++)add(s,e[r]);else throw new RangeError("Unsupported child node: "+e)}const basicNormalize=typeof String.prototype.normalize=="function"?s=>s.normalize("NFKD"):s=>s;class SearchCursor{constructor(e,r,n=0,o=e.length,a,l){this.test=l,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,o),this.bufferStart=n,this.normalize=a?c=>a(basicNormalize(c)):basicNormalize,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return codePointAt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let r=fromCodePoint(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=codePointSize(e);let o=this.normalize(r);for(let a=0,l=n;;a++){let c=o.charCodeAt(a),h=this.match(c,l);if(h)return this.value=h,this;if(a==o.length-1)break;l==n&&a<r.length&&r.charCodeAt(a)==c&&l++}}}match(e,r){let n=null;for(let o=0;o<this.matches.length;o+=2){let a=this.matches[o],l=!1;this.query.charCodeAt(a)==e&&(a==this.query.length-1?n={from:this.matches[o+1],to:r+1}:(this.matches[o]++,l=!0)),l||(this.matches.splice(o,2),o-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?n={from:r,to:r+1}:this.matches.push(1,r)),n&&this.test&&!this.test(n.from,n.to,this.buffer,this.bufferPos)&&(n=null),n}}typeof Symbol<"u"&&(SearchCursor.prototype[Symbol.iterator]=function(){return this});const empty={from:-1,to:-1,match:/.*/.exec("")},baseFlags="gm"+(/x/.unicode==null?"":"u");class RegExpCursor{constructor(e,r,n,o=0,a=e.length){if(this.text=e,this.to=a,this.curLine="",this.done=!1,this.value=empty,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new MultilineRegExpCursor(e,r,n,o,a);this.re=new RegExp(r,baseFlags+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.iter=e.iter();let l=e.lineAt(o);this.curLineStart=l.from,this.matchPos=toCharEnd(e,o),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),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())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,o=n+r[0].length;if(this.matchPos=toCharEnd(this.text,o+(n==o?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<o||n>this.value.to)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,match:r},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const flattened=new WeakMap;class FlattenedDoc{constructor(e,r){this.from=e,this.text=r}get to(){return this.from+this.text.length}static get(e,r,n){let o=flattened.get(e);if(!o||o.from>=n||o.to<=r){let c=new FlattenedDoc(r,e.sliceString(r,n));return flattened.set(e,c),c}if(o.from==r&&o.to==n)return o;let{text:a,from:l}=o;return l>r&&(a=e.sliceString(r,l)+a,l=r),o.to<n&&(a+=e.sliceString(o.to,n)),flattened.set(e,new FlattenedDoc(l,a)),new FlattenedDoc(r,a.slice(r-l,n-l))}}class MultilineRegExpCursor{constructor(e,r,n,o,a){this.text=e,this.to=a,this.done=!1,this.value=empty,this.matchPos=toCharEnd(e,o),this.re=new RegExp(r,baseFlags+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=FlattenedDoc.get(e,o,this.chunkEnd(o+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,o=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,match:r},this.matchPos=toCharEnd(this.text,o+(n==o?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=FlattenedDoc.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(RegExpCursor.prototype[Symbol.iterator]=MultilineRegExpCursor.prototype[Symbol.iterator]=function(){return this});function validRegExp(s){try{return new RegExp(s,baseFlags),!0}catch{return!1}}function toCharEnd(s,e){if(e>=s.length)return e;let r=s.lineAt(e),n;for(;e<r.to&&(n=r.text.charCodeAt(e-r.from))>=56320&&n<57344;)e++;return e}const defaultHighlightOptions={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},highlightConfig=Facet.define({combine(s){return combineConfig(s,defaultHighlightOptions,{highlightWordAroundCursor:(e,r)=>e||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function highlightSelectionMatches(s){let e=[defaultTheme,matchHighlighter];return s&&e.push(highlightConfig.of(s)),e}const matchDeco=Decoration.mark({class:"cm-selectionMatch"}),mainMatchDeco=Decoration.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function insideWordBoundaries(s,e,r,n){return(r==0||s(e.sliceDoc(r-1,r))!=CharCategory.Word)&&(n==e.doc.length||s(e.sliceDoc(n,n+1))!=CharCategory.Word)}function insideWord(s,e,r,n){return s(e.sliceDoc(r,r+1))==CharCategory.Word&&s(e.sliceDoc(n-1,n))==CharCategory.Word}const matchHighlighter=ViewPlugin.fromClass(class{constructor(s){this.decorations=this.getDeco(s)}update(s){(s.selectionSet||s.docChanged||s.viewportChanged)&&(this.decorations=this.getDeco(s.view))}getDeco(s){let e=s.state.facet(highlightConfig),{state:r}=s,n=r.selection;if(n.ranges.length>1)return Decoration.none;let o=n.main,a,l=null;if(o.empty){if(!e.highlightWordAroundCursor)return Decoration.none;let h=r.wordAt(o.head);if(!h)return Decoration.none;l=r.charCategorizer(o.head),a=r.sliceDoc(h.from,h.to)}else{let h=o.to-o.from;if(h<e.minSelectionLength||h>200)return Decoration.none;if(e.wholeWords){if(a=r.sliceDoc(o.from,o.to),l=r.charCategorizer(o.head),!(insideWordBoundaries(l,r,o.from,o.to)&&insideWord(l,r,o.from,o.to)))return Decoration.none}else if(a=r.sliceDoc(o.from,o.to).trim(),!a)return Decoration.none}let c=[];for(let h of s.visibleRanges){let f=new SearchCursor(r.doc,a,h.from,h.to);for(;!f.next().done;){let{from:d,to:m}=f.value;if((!l||insideWordBoundaries(l,r,d,m))&&(o.empty&&d<=o.from&&m>=o.to?c.push(mainMatchDeco.range(d,m)):(d>=o.to||m<=o.from)&&c.push(matchDeco.range(d,m)),c.length>e.maxMatches))return Decoration.none}}return Decoration.set(c)}},{decorations:s=>s.decorations}),defaultTheme=EditorView.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});class SearchQuery{constructor(e){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||validRegExp(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
|
||
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new RegExpQuery(this):new StringQuery(this)}getCursor(e,r=0,n){let o=e.doc?e:EditorState.create({doc:e});return n==null&&(n=o.doc.length),this.regexp?regexpCursor(this,o,r,n):stringCursor(this,o,r,n)}}class QueryType{constructor(e){this.spec=e}}function stringCursor(s,e,r,n){return new SearchCursor(e.doc,s.unquoted,r,n,s.caseSensitive?void 0:o=>o.toLowerCase(),s.wholeWord?stringWordTest(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function stringWordTest(s,e){return(r,n,o,a)=>((a>r||a+o.length<n)&&(a=Math.max(0,r-2),o=s.sliceString(a,Math.min(s.length,n+2))),(e(charBefore(o,r-a))!=CharCategory.Word||e(charAfter(o,r-a))!=CharCategory.Word)&&(e(charAfter(o,n-a))!=CharCategory.Word||e(charBefore(o,n-a))!=CharCategory.Word))}class StringQuery extends QueryType{constructor(e){super(e)}nextMatch(e,r,n){let o=stringCursor(this.spec,e,n,e.doc.length).nextOverlapping();return o.done&&(o=stringCursor(this.spec,e,0,r).nextOverlapping()),o.done?null:o.value}prevMatchInRange(e,r,n){for(let o=n;;){let a=Math.max(r,o-1e4-this.spec.unquoted.length),l=stringCursor(this.spec,e,a,o),c=null;for(;!l.nextOverlapping().done;)c=l.value;if(c)return c;if(a==r)return null;o-=1e4}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,r){let n=stringCursor(this.spec,e,0,e.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(e,r,n,o){let a=stringCursor(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!a.next().done;)o(a.value.from,a.value.to)}}function regexpCursor(s,e,r,n){return new RegExpCursor(e.doc,s.search,{ignoreCase:!s.caseSensitive,test:s.wholeWord?regexpWordTest(e.charCategorizer(e.selection.main.head)):void 0},r,n)}function charBefore(s,e){return s.slice(findClusterBreak(s,e,!1),e)}function charAfter(s,e){return s.slice(e,findClusterBreak(s,e))}function regexpWordTest(s){return(e,r,n)=>!n[0].length||(s(charBefore(n.input,n.index))!=CharCategory.Word||s(charAfter(n.input,n.index))!=CharCategory.Word)&&(s(charAfter(n.input,n.index+n[0].length))!=CharCategory.Word||s(charBefore(n.input,n.index+n[0].length))!=CharCategory.Word)}class RegExpQuery extends QueryType{nextMatch(e,r,n){let o=regexpCursor(this.spec,e,n,e.doc.length).next();return o.done&&(o=regexpCursor(this.spec,e,0,r).next()),o.done?null:o.value}prevMatchInRange(e,r,n){for(let o=1;;o++){let a=Math.max(r,n-o*1e4),l=regexpCursor(this.spec,e,a,n),c=null;for(;!l.next().done;)c=l.value;if(c&&(a==r||c.from>a+10))return c;if(a==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,(r,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:r))}matchAll(e,r){let n=regexpCursor(this.spec,e,0,e.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(e,r,n,o){let a=regexpCursor(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!a.next().done;)o(a.value.from,a.value.to)}}const setSearchQuery=StateEffect.define();class CompletionContext{constructor(e,r,n){this.state=e,this.pos=r,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let r=syntaxTree(this.state).resolveInner(this.pos,-1);for(;r&&e.indexOf(r.name)<0;)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(e){let r=this.state.doc.lineAt(this.pos),n=Math.max(r.from,this.pos-250),o=r.text.slice(n-r.from,this.pos-r.from),a=o.search(ensureAnchor(e,!1));return a<0?null:{from:n+a,to:this.pos,text:o.slice(a)}}get aborted(){return this.abortListeners==null}addEventListener(e,r){e=="abort"&&this.abortListeners&&this.abortListeners.push(r)}}function toSet(s){let e=Object.keys(s).join(""),r=/\w/.test(e);return r&&(e=e.replace(/\w/g,"")),`[${r?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function prefixMatch(s){let e=Object.create(null),r=Object.create(null);for(let{label:o}of s){e[o[0]]=!0;for(let a=1;a<o.length;a++)r[o[a]]=!0}let n=toSet(e)+toSet(r)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function completeFromList(s){let e=s.map(o=>typeof o=="string"?{label:o}:o),[r,n]=e.every(o=>/^\w+$/.test(o.label))?[/\w*$/,/\w+$/]:prefixMatch(e);return o=>{let a=o.matchBefore(n);return a||o.explicit?{from:a?a.from:o.pos,options:e,validFor:r}:null}}function ifNotIn(s,e){return r=>{for(let n=syntaxTree(r.state).resolveInner(r.pos,-1);n;n=n.parent){if(s.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(r)}}class Option{constructor(e,r,n,o){this.completion=e,this.source=r,this.match=n,this.score=o}}function cur(s){return s.selection.main.from}function ensureAnchor(s,e){var r;let{source:n}=s,o=e&&n[0]!="^",a=n[n.length-1]!="$";return!o&&!a?s:new RegExp(`${o?"^":""}(?:${n})${a?"$":""}`,(r=s.flags)!==null&&r!==void 0?r:s.ignoreCase?"i":"")}const pickedCompletion=Annotation.define();function insertCompletionText(s,e,r,n){let{main:o}=s.selection,a=r-o.from,l=n-o.from;return Object.assign(Object.assign({},s.changeByRange(c=>c!=o&&r!=n&&s.sliceDoc(c.from+a,c.from+l)!=s.sliceDoc(r,n)?{range:c}:{changes:{from:c.from+a,to:n==o.from?c.to:c.from+l,insert:e},range:EditorSelection.cursor(c.from+a+e.length)})),{userEvent:"input.complete"})}const SourceCache=new WeakMap;function asSource(s){if(!Array.isArray(s))return s;let e=SourceCache.get(s);return e||SourceCache.set(s,e=completeFromList(s)),e}const startCompletionEffect=StateEffect.define(),closeCompletionEffect=StateEffect.define();class FuzzyMatcher{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r<e.length;){let n=codePointAt(e,r),o=codePointSize(n);this.chars.push(n);let a=e.slice(r,r+o),l=a.toUpperCase();this.folded.push(codePointAt(l==a?a.toLowerCase():l,0)),r+=o}this.astral=e.length!=this.chars.length}ret(e,r){return this.score=e,this.matched=r,!0}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return!1;let{chars:r,folded:n,any:o,precise:a,byWord:l}=this;if(r.length==1){let ke=codePointAt(e,0),Qe=codePointSize(ke),xe=Qe==e.length?0:-100;if(ke!=r[0])if(ke==n[0])xe+=-200;else return!1;return this.ret(xe,[0,Qe])}let c=e.indexOf(this.pattern);if(c==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let h=r.length,f=0;if(c<0){for(let ke=0,Qe=Math.min(e.length,200);ke<Qe&&f<h;){let xe=codePointAt(e,ke);(xe==r[f]||xe==n[f])&&(o[f++]=ke),ke+=codePointSize(xe)}if(f<h)return!1}let d=0,m=0,v=!1,A=0,T=-1,B=-1,Y=/[a-z]/.test(e),F=!0;for(let ke=0,Qe=Math.min(e.length,200),xe=0;ke<Qe&&m<h;){let Te=codePointAt(e,ke);c<0&&(d<h&&Te==r[d]&&(a[d++]=ke),A<h&&(Te==r[A]||Te==n[A]?(A==0&&(T=ke),B=ke+1,A++):A=0));let Le,Me=Te<255?Te>=48&&Te<=57||Te>=97&&Te<=122?2:Te>=65&&Te<=90?1:0:(Le=fromCodePoint(Te))!=Le.toLowerCase()?1:Le!=Le.toUpperCase()?2:0;(!ke||Me==1&&Y||xe==0&&Me!=0)&&(r[m]==Te||n[m]==Te&&(v=!0)?l[m++]=ke:l.length&&(F=!1)),xe=Me,ke+=codePointSize(Te)}return m==h&&l[0]==0&&F?this.result(-100+(v?-200:0),l,e):A==h&&T==0?this.ret(-200-e.length+(B==e.length?0:-100),[0,B]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):A==h?this.ret(-200+-700-e.length,[T,B]):m==h?this.result(-100+(v?-200:0)+-700+(F?0:-1100),l,e):r.length==2?!1:this.result((o[0]?-700:0)+-200+-1100,o,e)}result(e,r,n){let o=[],a=0;for(let l of r){let c=l+(this.astral?codePointSize(codePointAt(n,l)):1);a&&o[a-1]==l?o[a-1]=c:(o[a++]=l,o[a++]=c)}return this.ret(e-n.length,o)}}const completionConfig=Facet.define({combine(s){return combineConfig(s,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:defaultPositionInfo,compareCompletions:(e,r)=>e.label.localeCompare(r.label),interactionDelay:75},{defaultKeymap:(e,r)=>e&&r,closeOnBlur:(e,r)=>e&&r,icons:(e,r)=>e&&r,tooltipClass:(e,r)=>n=>joinClass(e(n),r(n)),optionClass:(e,r)=>n=>joinClass(e(n),r(n)),addToOptions:(e,r)=>e.concat(r)})}});function joinClass(s,e){return s?e?s+" "+e:s:e}function defaultPositionInfo(s,e,r,n,o){let a=s.textDirection==Direction.RTL,l=a,c=!1,h="top",f,d,m=e.left-o.left,v=o.right-e.right,A=n.right-n.left,T=n.bottom-n.top;if(l&&m<Math.min(A,v)?l=!1:!l&&v<Math.min(A,m)&&(l=!0),A<=(l?m:v))f=Math.max(o.top,Math.min(r.top,o.bottom-T))-e.top,d=Math.min(400,l?m:v);else{c=!0,d=Math.min(400,(a?e.right:o.right-e.left)-30);let B=o.bottom-e.bottom;B>=T||B>e.top?f=r.bottom-e.top:(h="bottom",f=e.bottom-r.top)}return{style:`${h}: ${f}px; max-width: ${d}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":l?"left":"right")}}function optionContent(s){let e=s.addToOptions.slice();return s.icons&&e.push({render(r){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),r.type&&n.classList.add(...r.type.split(/\s+/g).map(o=>"cm-completionIcon-"+o)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(r,n,o){let a=document.createElement("span");a.className="cm-completionLabel";let l=r.displayLabel||r.label,c=0;for(let h=0;h<o.length;){let f=o[h++],d=o[h++];f>c&&a.appendChild(document.createTextNode(l.slice(c,f)));let m=a.appendChild(document.createElement("span"));m.appendChild(document.createTextNode(l.slice(f,d))),m.className="cm-completionMatchedText",c=d}return c<l.length&&a.appendChild(document.createTextNode(l.slice(c))),a},position:50},{render(r){if(!r.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=r.detail,n},position:80}),e.sort((r,n)=>r.position-n.position).map(r=>r.render)}function rangeAroundSelected(s,e,r){if(s<=r)return{from:0,to:s};if(e<0&&(e=0),e<=s>>1){let o=Math.floor(e/r);return{from:o*r,to:(o+1)*r}}let n=Math.floor((s-e)/r);return{from:s-(n+1)*r,to:s-n*r}}class CompletionTooltip{constructor(e,r,n){this.view=e,this.stateField=r,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:h=>this.placeInfo(h),key:this},this.space=null,this.currentClass="";let o=e.state.field(r),{options:a,selected:l}=o.open,c=e.state.facet(completionConfig);this.optionContent=optionContent(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=rangeAroundSelected(a.length,l,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",h=>{for(let f=h.target,d;f&&f!=this.dom;f=f.parentNode)if(f.nodeName=="LI"&&(d=/-(\d+)$/.exec(f.id))&&+d[1]<a.length){this.applyCompletion(e,a[+d[1]]),h.preventDefault();return}}),this.dom.addEventListener("focusout",h=>{let f=e.state.field(this.stateField,!1);f&&f.tooltip&&e.state.facet(completionConfig).closeOnBlur&&h.relatedTarget!=e.contentDOM&&e.dispatch({effects:closeCompletionEffect.of(null)})}),this.list=this.dom.appendChild(this.createListBox(a,o.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}mount(){this.updateSel()}update(e){var r,n,o;let a=e.state.field(this.stateField),l=e.startState.field(this.stateField);this.updateTooltipClass(e.state),a!=l&&(this.updateSel(),((r=a.open)===null||r===void 0?void 0:r.disabled)!=((n=l.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(!((o=a.open)===null||o===void 0)&&o.disabled)))}updateTooltipClass(e){let r=this.tooltipClass(e);if(r!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of r.split(" "))n&&this.dom.classList.add(n);this.currentClass=r}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),r=e.open;if((r.selected>-1&&r.selected<this.range.from||r.selected>=this.range.to)&&(this.range=rangeAroundSelected(r.options.length,r.selected,this.view.state.facet(completionConfig).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(r.options,e.id,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})),this.updateSelectedOption(r.selected)){this.destroyInfo();let{completion:n}=r.options[r.selected],{info:o}=n;if(!o)return;let a=typeof o=="string"?document.createTextNode(o):o(n);if(!a)return;"then"in a?a.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,n)}).catch(l=>logException(this.view.state,l,"completion info")):this.addInfoPane(a,n)}}addInfoPane(e,r){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:o,destroy:a}=e;n.appendChild(o),this.infoDestroy=a||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let r=null;for(let n=this.list.firstChild,o=this.range.from;n;n=n.nextSibling,o++)n.nodeName!="LI"||!n.id?o--:o==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),r=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return r&&scrollIntoView(this.list,r),r}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let r=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),o=e.getBoundingClientRect(),a=this.space;if(!a){let l=this.dom.ownerDocument.defaultView||window;a={left:0,top:0,right:l.innerWidth,bottom:l.innerHeight}}return o.top>Math.min(a.bottom,r.bottom)-10||o.bottom<Math.max(a.top,r.top)+10?null:this.view.state.facet(completionConfig).positionInfo(this.view,r,o,n,a)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,r,n){const o=document.createElement("ul");o.id=r,o.setAttribute("role","listbox"),o.setAttribute("aria-expanded","true"),o.setAttribute("aria-label",this.view.state.phrase("Completions"));let a=null;for(let l=n.from;l<n.to;l++){let{completion:c,match:h}=e[l],{section:f}=c;if(f){let v=typeof f=="string"?f:f.name;if(v!=a&&(l>n.from||n.from==0))if(a=v,typeof f!="string"&&f.header)o.appendChild(f.header(f));else{let A=o.appendChild(document.createElement("completion-section"));A.textContent=v}}const d=o.appendChild(document.createElement("li"));d.id=r+"-"+l,d.setAttribute("role","option");let m=this.optionClass(c);m&&(d.className=m);for(let v of this.optionContent){let A=v(c,this.view.state,h);A&&d.appendChild(A)}}return n.from&&o.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&o.classList.add("cm-completionListIncompleteBottom"),o}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function completionTooltip(s,e){return r=>new CompletionTooltip(r,s,e)}function scrollIntoView(s,e){let r=s.getBoundingClientRect(),n=e.getBoundingClientRect();n.top<r.top?s.scrollTop-=r.top-n.top:n.bottom>r.bottom&&(s.scrollTop+=n.bottom-r.bottom)}function score(s){return(s.boost||0)*100+(s.apply?10:0)+(s.info?5:0)+(s.type?1:0)}function sortOptions(s,e){let r=[],n=null,o=h=>{r.push(h);let{section:f}=h.completion;if(f){n||(n=[]);let d=typeof f=="string"?f:f.name;n.some(m=>m.name==d)||n.push(typeof f=="string"?{name:d}:f)}};for(let h of s)if(h.hasResult()){let f=h.result.getMatch;if(h.result.filter===!1)for(let d of h.result.options)o(new Option(d,h.source,f?f(d):[],1e9-r.length));else{let d=new FuzzyMatcher(e.sliceDoc(h.from,h.to));for(let m of h.result.options)if(d.match(m.label)){let v=m.displayLabel?f?f(m,d.matched):[]:d.matched;o(new Option(m,h.source,v,d.score+(m.boost||0)))}}}if(n){let h=Object.create(null),f=0,d=(m,v)=>{var A,T;return((A=m.rank)!==null&&A!==void 0?A:1e9)-((T=v.rank)!==null&&T!==void 0?T:1e9)||(m.name<v.name?-1:1)};for(let m of n.sort(d))f-=1e5,h[m.name]=f;for(let m of r){let{section:v}=m.completion;v&&(m.score+=h[typeof v=="string"?v:v.name])}}let a=[],l=null,c=e.facet(completionConfig).compareCompletions;for(let h of r.sort((f,d)=>d.score-f.score||c(f.completion,d.completion))){let f=h.completion;!l||l.label!=f.label||l.detail!=f.detail||l.type!=null&&f.type!=null&&l.type!=f.type||l.apply!=f.apply||l.boost!=f.boost?a.push(h):score(h.completion)>score(l)&&(a[a.length-1]=h),l=h.completion}return a}class CompletionDialog{constructor(e,r,n,o,a,l){this.options=e,this.attrs=r,this.tooltip=n,this.timestamp=o,this.selected=a,this.disabled=l}setSelected(e,r){return e==this.selected||e>=this.options.length?this:new CompletionDialog(this.options,makeAttrs(r,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,r,n,o,a){let l=sortOptions(e,r);if(!l.length)return o&&e.some(h=>h.state==1)?new CompletionDialog(o.options,o.attrs,o.tooltip,o.timestamp,o.selected,!0):null;let c=r.facet(completionConfig).selectOnOpen?0:-1;if(o&&o.selected!=c&&o.selected!=-1){let h=o.options[o.selected].completion;for(let f=0;f<l.length;f++)if(l[f].completion==h){c=f;break}}return new CompletionDialog(l,makeAttrs(n,c),{pos:e.reduce((h,f)=>f.hasResult()?Math.min(h,f.from):h,1e8),create:completionTooltip(completionState,applyCompletion),above:a.aboveCursor},o?o.timestamp:Date.now(),c,!1)}map(e){return new CompletionDialog(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class CompletionState{constructor(e,r,n){this.active=e,this.id=r,this.open=n}static start(){return new CompletionState(none$1,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:r}=e,n=r.facet(completionConfig),a=(n.override||r.languageDataAt("autocomplete",cur(r)).map(asSource)).map(c=>(this.active.find(f=>f.source==c)||new ActiveSource(c,this.active.some(f=>f.state!=0)?1:0)).update(e,n));a.length==this.active.length&&a.every((c,h)=>c==this.active[h])&&(a=this.active);let l=this.open;l&&e.docChanged&&(l=l.map(e.changes)),e.selection||a.some(c=>c.hasResult()&&e.changes.touchesRange(c.from,c.to))||!sameResults(a,this.active)?l=CompletionDialog.build(a,r,this.id,l,n):l&&l.disabled&&!a.some(c=>c.state==1)&&(l=null),!l&&a.every(c=>c.state!=1)&&a.some(c=>c.hasResult())&&(a=a.map(c=>c.hasResult()?new ActiveSource(c.source,0):c));for(let c of e.effects)c.is(setSelectedEffect)&&(l=l&&l.setSelected(c.value,this.id));return a==this.active&&l==this.open?this:new CompletionState(a,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:baseAttrs}}function sameResults(s,e){if(s==e)return!0;for(let r=0,n=0;;){for(;r<s.length&&!s[r].hasResult;)r++;for(;n<e.length&&!e[n].hasResult;)n++;let o=r==s.length,a=n==e.length;if(o||a)return o==a;if(s[r++].result!=e[n++].result)return!1}}const baseAttrs={"aria-autocomplete":"list"};function makeAttrs(s,e){let r={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":s};return e>-1&&(r["aria-activedescendant"]=s+"-"+e),r}const none$1=[];function getUserEvent(s){return s.isUserEvent("input.type")?"input":s.isUserEvent("delete.backward")?"delete":null}class ActiveSource{constructor(e,r,n=-1){this.source=e,this.state=r,this.explicitPos=n}hasResult(){return!1}update(e,r){let n=getUserEvent(e),o=this;n?o=o.handleUserEvent(e,n,r):e.docChanged?o=o.handleChange(e):e.selection&&o.state!=0&&(o=new ActiveSource(o.source,0));for(let a of e.effects)if(a.is(startCompletionEffect))o=new ActiveSource(o.source,1,a.value?cur(e.state):-1);else if(a.is(closeCompletionEffect))o=new ActiveSource(o.source,0);else if(a.is(setActiveEffect))for(let l of a.value)l.source==o.source&&(o=l);return o}handleUserEvent(e,r,n){return r=="delete"||!n.activateOnTyping?this.map(e.changes):new ActiveSource(this.source,1)}handleChange(e){return e.changes.touchesRange(cur(e.startState))?new ActiveSource(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new ActiveSource(this.source,this.state,e.mapPos(this.explicitPos))}}class ActiveResult extends ActiveSource{constructor(e,r,n,o,a){super(e,2,r),this.result=n,this.from=o,this.to=a}hasResult(){return!0}handleUserEvent(e,r,n){var o;let a=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),c=cur(e.state);if((this.explicitPos<0?c<=a:c<this.from)||c>l||r=="delete"&&cur(e.startState)==this.from)return new ActiveSource(this.source,r=="input"&&n.activateOnTyping?1:0);let h=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),f;return checkValid(this.result.validFor,e.state,a,l)?new ActiveResult(this.source,h,this.result,a,l):this.result.update&&(f=this.result.update(this.result,a,l,new CompletionContext(e.state,c,h>=0)))?new ActiveResult(this.source,h,f,f.from,(o=f.to)!==null&&o!==void 0?o:cur(e.state)):new ActiveSource(this.source,1,h)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new ActiveSource(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new ActiveResult(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function checkValid(s,e,r,n){if(!s)return!1;let o=e.sliceDoc(r,n);return typeof s=="function"?s(o,r,n,e):ensureAnchor(s,!0).test(o)}const setActiveEffect=StateEffect.define({map(s,e){return s.map(r=>r.map(e))}}),setSelectedEffect=StateEffect.define(),completionState=StateField.define({create(){return CompletionState.start()},update(s,e){return s.update(e)},provide:s=>[showTooltip.from(s,e=>e.tooltip),EditorView.contentAttributes.from(s,e=>e.attrs)]});function applyCompletion(s,e){const r=e.completion.apply||e.completion.label;let n=s.state.field(completionState).active.find(o=>o.source==e.source);return n instanceof ActiveResult?(typeof r=="string"?s.dispatch(Object.assign(Object.assign({},insertCompletionText(s.state,r,n.from,n.to)),{annotations:pickedCompletion.of(e.completion)})):r(s,e.completion,n.from,n.to),!0):!1}function moveCompletionSelection(s,e="option"){return r=>{let n=r.state.field(completionState,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<r.state.facet(completionConfig).interactionDelay)return!1;let o=1,a;e=="page"&&(a=getTooltip(r,n.open.tooltip))&&(o=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector("li").offsetHeight)-1));let{length:l}=n.open.options,c=n.open.selected>-1?n.open.selected+o*(s?1:-1):s?0:l-1;return c<0?c=e=="page"?0:l-1:c>=l&&(c=e=="page"?l-1:0),r.dispatch({effects:setSelectedEffect.of(c)}),!0}}const acceptCompletion=s=>{let e=s.state.field(completionState,!1);return s.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<s.state.facet(completionConfig).interactionDelay?!1:applyCompletion(s,e.open.options[e.open.selected])},startCompletion=s=>s.state.field(completionState,!1)?(s.dispatch({effects:startCompletionEffect.of(!0)}),!0):!1,closeCompletion=s=>{let e=s.state.field(completionState,!1);return!e||!e.active.some(r=>r.state!=0)?!1:(s.dispatch({effects:closeCompletionEffect.of(null)}),!0)};class RunningQuery{constructor(e,r){this.active=e,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}}const DebounceTime=50,MaxUpdateCount=50,MinAbortTime=1e3,completionPlugin=ViewPlugin.fromClass(class{constructor(s){this.view=s,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of s.state.field(completionState).active)e.state==1&&this.startQuery(e)}update(s){let e=s.state.field(completionState);if(!s.selectionSet&&!s.docChanged&&s.startState.field(completionState)==e)return;let r=s.transactions.some(n=>(n.selection||n.docChanged)&&!getUserEvent(n));for(let n=0;n<this.running.length;n++){let o=this.running[n];if(r||o.updates.length+s.transactions.length>MaxUpdateCount&&Date.now()-o.time>MinAbortTime){for(let a of o.context.abortListeners)try{a()}catch(l){logException(this.view.state,l)}o.context.abortListeners=null,this.running.splice(n--,1)}else o.updates.push(...s.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(n=>n.state==1&&!this.running.some(o=>o.active.source==n.source))?setTimeout(()=>this.startUpdate(),DebounceTime):-1,this.composing!=0)for(let n of s.transactions)getUserEvent(n)=="input"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:s}=this.view,e=s.field(completionState);for(let r of e.active)r.state==1&&!this.running.some(n=>n.active.source==r.source)&&this.startQuery(r)}startQuery(s){let{state:e}=this.view,r=cur(e),n=new CompletionContext(e,r,s.explicitPos==r),o=new RunningQuery(s,n);this.running.push(o),Promise.resolve(s.source(n)).then(a=>{o.context.aborted||(o.done=a||null,this.scheduleAccept())},a=>{this.view.dispatch({effects:closeCompletionEffect.of(null)}),logException(this.view.state,a)})}scheduleAccept(){this.running.every(s=>s.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),DebounceTime))}accept(){var s;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],r=this.view.state.facet(completionConfig);for(let n=0;n<this.running.length;n++){let o=this.running[n];if(o.done===void 0)continue;if(this.running.splice(n--,1),o.done){let l=new ActiveResult(o.active.source,o.active.explicitPos,o.done,o.done.from,(s=o.done.to)!==null&&s!==void 0?s:cur(o.updates.length?o.updates[0].startState:this.view.state));for(let c of o.updates)l=l.update(c,r);if(l.hasResult()){e.push(l);continue}}let a=this.view.state.field(completionState).active.find(l=>l.source==o.active.source);if(a&&a.state==1)if(o.done==null){let l=new ActiveSource(o.active.source,0);for(let c of o.updates)l=l.update(c,r);l.state!=1&&e.push(l)}else this.startQuery(a)}e.length&&this.view.dispatch({effects:setActiveEffect.of(e)})}},{eventHandlers:{blur(s){let e=this.view.state.field(completionState,!1);if(e&&e.tooltip&&this.view.state.facet(completionConfig).closeOnBlur){let r=e.open&&getTooltip(this.view,e.open.tooltip);(!r||!r.dom.contains(s.relatedTarget))&&this.view.dispatch({effects:closeCompletionEffect.of(null)})}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:startCompletionEffect.of(!1)}),20),this.composing=0}}}),baseTheme$1=EditorView.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class FieldPos{constructor(e,r,n,o){this.field=e,this.line=r,this.from=n,this.to=o}}class FieldRange{constructor(e,r,n){this.field=e,this.from=r,this.to=n}map(e){let r=e.mapPos(this.from,-1,MapMode.TrackDel),n=e.mapPos(this.to,1,MapMode.TrackDel);return r==null||n==null?null:new FieldRange(this.field,r,n)}}class Snippet{constructor(e,r){this.lines=e,this.fieldPositions=r}instantiate(e,r){let n=[],o=[r],a=e.doc.lineAt(r),l=/^\s*/.exec(a.text)[0];for(let h of this.lines){if(n.length){let f=l,d=/^\t*/.exec(h)[0].length;for(let m=0;m<d;m++)f+=e.facet(indentUnit);o.push(r+f.length-d),h=f+h.slice(d)}n.push(h),r+=h.length+1}let c=this.fieldPositions.map(h=>new FieldRange(h.field,o[h.line]+h.from,o[h.line]+h.to));return{text:n,ranges:c}}static parse(e){let r=[],n=[],o=[],a;for(let l of e.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(l);){let c=a[1]?+a[1]:null,h=a[2]||a[3]||"",f=-1;for(let d=0;d<r.length;d++)(c!=null?r[d].seq==c:h&&r[d].name==h)&&(f=d);if(f<0){let d=0;for(;d<r.length&&(c==null||r[d].seq!=null&&r[d].seq<c);)d++;r.splice(d,0,{seq:c,name:h}),f=d;for(let m of o)m.field>=f&&m.field++}o.push(new FieldPos(f,n.length,a.index,a.index+h.length)),l=l.slice(0,a.index)+h+l.slice(a.index+a[0].length)}for(let c;c=/\\([{}])/.exec(l);){l=l.slice(0,c.index)+c[1]+l.slice(c.index+c[0].length);for(let h of o)h.line==n.length&&h.from>c.index&&(h.from--,h.to--)}n.push(l)}return new Snippet(n,o)}}let fieldMarker=Decoration.widget({widget:new class extends WidgetType{toDOM(){let s=document.createElement("span");return s.className="cm-snippetFieldPosition",s}ignoreEvent(){return!1}}}),fieldRange=Decoration.mark({class:"cm-snippetField"});class ActiveSnippet{constructor(e,r){this.ranges=e,this.active=r,this.deco=Decoration.set(e.map(n=>(n.from==n.to?fieldMarker:fieldRange).range(n.from,n.to)))}map(e){let r=[];for(let n of this.ranges){let o=n.map(e);if(!o)return null;r.push(o)}return new ActiveSnippet(r,this.active)}selectionInsideField(e){return e.ranges.every(r=>this.ranges.some(n=>n.field==this.active&&n.from<=r.from&&n.to>=r.to))}}const setActive=StateEffect.define({map(s,e){return s&&s.map(e)}}),moveToField=StateEffect.define(),snippetState=StateField.define({create(){return null},update(s,e){for(let r of e.effects){if(r.is(setActive))return r.value;if(r.is(moveToField)&&s)return new ActiveSnippet(s.ranges,r.value)}return s&&e.docChanged&&(s=s.map(e.changes)),s&&e.selection&&!s.selectionInsideField(e.selection)&&(s=null),s},provide:s=>EditorView.decorations.from(s,e=>e?e.deco:Decoration.none)});function fieldSelection(s,e){return EditorSelection.create(s.filter(r=>r.field==e).map(r=>EditorSelection.range(r.from,r.to)))}function snippet(s){let e=Snippet.parse(s);return(r,n,o,a)=>{let{text:l,ranges:c}=e.instantiate(r.state,o),h={changes:{from:o,to:a,insert:Text.of(l)},scrollIntoView:!0,annotations:n?pickedCompletion.of(n):void 0};if(c.length&&(h.selection=fieldSelection(c,0)),c.length>1){let f=new ActiveSnippet(c,0),d=h.effects=[setActive.of(f)];r.state.field(snippetState,!1)===void 0&&d.push(StateEffect.appendConfig.of([snippetState,addSnippetKeymap,snippetPointerHandler,baseTheme$1]))}r.dispatch(r.state.update(h))}}function moveField(s){return({state:e,dispatch:r})=>{let n=e.field(snippetState,!1);if(!n||s<0&&n.active==0)return!1;let o=n.active+s,a=s>0&&!n.ranges.some(l=>l.field==o+s);return r(e.update({selection:fieldSelection(n.ranges,o),effects:setActive.of(a?null:new ActiveSnippet(n.ranges,o))})),!0}}const clearSnippet=({state:s,dispatch:e})=>s.field(snippetState,!1)?(e(s.update({effects:setActive.of(null)})),!0):!1,nextSnippetField=moveField(1),prevSnippetField=moveField(-1),defaultSnippetKeymap=[{key:"Tab",run:nextSnippetField,shift:prevSnippetField},{key:"Escape",run:clearSnippet}],snippetKeymap=Facet.define({combine(s){return s.length?s[0]:defaultSnippetKeymap}}),addSnippetKeymap=Prec.highest(keymap.compute([snippetKeymap],s=>s.facet(snippetKeymap)));function snippetCompletion(s,e){return Object.assign(Object.assign({},e),{apply:snippet(s)})}const snippetPointerHandler=EditorView.domEventHandlers({mousedown(s,e){let r=e.state.field(snippetState,!1),n;if(!r||(n=e.posAtCoords({x:s.clientX,y:s.clientY}))==null)return!1;let o=r.ranges.find(a=>a.from<=n&&a.to>=n);return!o||o.field==r.active?!1:(e.dispatch({selection:fieldSelection(r.ranges,o.field),effects:setActive.of(r.ranges.some(a=>a.field>o.field)?new ActiveSnippet(r.ranges,o.field):null)}),!0)}}),defaults={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},closeBracketEffect=StateEffect.define({map(s,e){let r=e.mapPos(s,-1,MapMode.TrackAfter);return r??void 0}}),closedBracket=new class extends RangeValue{};closedBracket.startSide=1;closedBracket.endSide=-1;const bracketState=StateField.define({create(){return RangeSet.empty},update(s,e){if(e.selection){let r=e.state.doc.lineAt(e.selection.main.head).from,n=e.startState.doc.lineAt(e.startState.selection.main.head).from;r!=e.changes.mapPos(n,-1)&&(s=RangeSet.empty)}s=s.map(e.changes);for(let r of e.effects)r.is(closeBracketEffect)&&(s=s.update({add:[closedBracket.range(r.value,r.value+1)]}));return s}});function closeBrackets(){return[inputHandler,bracketState]}const definedClosing="()[]{}<>";function closing(s){for(let e=0;e<definedClosing.length;e+=2)if(definedClosing.charCodeAt(e)==s)return definedClosing.charAt(e+1);return fromCodePoint(s<128?s:s+1)}function config(s,e){return s.languageDataAt("closeBrackets",e)[0]||defaults}const android$1=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),inputHandler=EditorView.inputHandler.of((s,e,r,n)=>{if((android$1?s.composing:s.compositionStarted)||s.state.readOnly)return!1;let o=s.state.selection.main;if(n.length>2||n.length==2&&codePointSize(codePointAt(n,0))==1||e!=o.from||r!=o.to)return!1;let a=insertBracket(s.state,n);return a?(s.dispatch(a),!0):!1}),deleteBracketPair=({state:s,dispatch:e})=>{if(s.readOnly)return!1;let n=config(s,s.selection.main.head).brackets||defaults.brackets,o=null,a=s.changeByRange(l=>{if(l.empty){let c=prevChar(s.doc,l.head);for(let h of n)if(h==c&&nextChar(s.doc,l.head)==closing(codePointAt(h,0)))return{changes:{from:l.head-h.length,to:l.head+h.length},range:EditorSelection.cursor(l.head-h.length)}}return{range:o=l}});return o||e(s.update(a,{scrollIntoView:!0,userEvent:"delete.backward"})),!o},closeBracketsKeymap=[{key:"Backspace",run:deleteBracketPair}];function insertBracket(s,e){let r=config(s,s.selection.main.head),n=r.brackets||defaults.brackets;for(let o of n){let a=closing(codePointAt(o,0));if(e==o)return a==o?handleSame(s,o,n.indexOf(o+o+o)>-1,r):handleOpen(s,o,a,r.before||defaults.before);if(e==a&&closedBracketAt(s,s.selection.main.from))return handleClose(s,o,a)}return null}function closedBracketAt(s,e){let r=!1;return s.field(bracketState).between(0,s.doc.length,n=>{n==e&&(r=!0)}),r}function nextChar(s,e){let r=s.sliceString(e,e+2);return r.slice(0,codePointSize(codePointAt(r,0)))}function prevChar(s,e){let r=s.sliceString(e-2,e);return codePointSize(codePointAt(r,0))==r.length?r:r.slice(1)}function handleOpen(s,e,r,n){let o=null,a=s.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:r,from:l.to}],effects:closeBracketEffect.of(l.to+e.length),range:EditorSelection.range(l.anchor+e.length,l.head+e.length)};let c=nextChar(s.doc,l.head);return!c||/\s/.test(c)||n.indexOf(c)>-1?{changes:{insert:e+r,from:l.head},effects:closeBracketEffect.of(l.head+e.length),range:EditorSelection.cursor(l.head+e.length)}:{range:o=l}});return o?null:s.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function handleClose(s,e,r){let n=null,o=s.changeByRange(a=>a.empty&&nextChar(s.doc,a.head)==r?{changes:{from:a.head,to:a.head+r.length,insert:r},range:EditorSelection.cursor(a.head+r.length)}:n={range:a});return n?null:s.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function handleSame(s,e,r,n){let o=n.stringPrefixes||defaults.stringPrefixes,a=null,l=s.changeByRange(c=>{if(!c.empty)return{changes:[{insert:e,from:c.from},{insert:e,from:c.to}],effects:closeBracketEffect.of(c.to+e.length),range:EditorSelection.range(c.anchor+e.length,c.head+e.length)};let h=c.head,f=nextChar(s.doc,h),d;if(f==e){if(nodeStart(s,h))return{changes:{insert:e+e,from:h},effects:closeBracketEffect.of(h+e.length),range:EditorSelection.cursor(h+e.length)};if(closedBracketAt(s,h)){let v=r&&s.sliceDoc(h,h+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:h,to:h+v.length,insert:v},range:EditorSelection.cursor(h+v.length)}}}else{if(r&&s.sliceDoc(h-2*e.length,h)==e+e&&(d=canStartStringAt(s,h-2*e.length,o))>-1&&nodeStart(s,d))return{changes:{insert:e+e+e+e,from:h},effects:closeBracketEffect.of(h+e.length),range:EditorSelection.cursor(h+e.length)};if(s.charCategorizer(h)(f)!=CharCategory.Word&&canStartStringAt(s,h,o)>-1&&!probablyInString(s,h,e,o))return{changes:{insert:e+e,from:h},effects:closeBracketEffect.of(h+e.length),range:EditorSelection.cursor(h+e.length)}}return{range:a=c}});return a?null:s.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function nodeStart(s,e){let r=syntaxTree(s).resolveInner(e+1);return r.parent&&r.from==e}function probablyInString(s,e,r,n){let o=syntaxTree(s).resolveInner(e,-1),a=n.reduce((l,c)=>Math.max(l,c.length),0);for(let l=0;l<5;l++){let c=s.sliceDoc(o.from,Math.min(o.to,o.from+r.length+a)),h=c.indexOf(r);if(!h||h>-1&&n.indexOf(c.slice(0,h))>-1){let d=o.firstChild;for(;d&&d.from==o.from&&d.to-d.from>r.length+h;){if(s.sliceDoc(d.to-r.length,d.to)==r)return!1;d=d.firstChild}return!0}let f=o.to==e&&o.parent;if(!f)break;o=f}return!1}function canStartStringAt(s,e,r){let n=s.charCategorizer(e);if(n(s.sliceDoc(e-1,e))!=CharCategory.Word)return e;for(let o of r){let a=e-o.length;if(s.sliceDoc(a,e)==o&&n(s.sliceDoc(a-1,a))!=CharCategory.Word)return a}return-1}function autocompletion(s={}){return[completionState,completionConfig.of(s),completionPlugin,completionKeymapExt,baseTheme$1]}const completionKeymap=[{key:"Ctrl-Space",run:startCompletion},{key:"Escape",run:closeCompletion},{key:"ArrowDown",run:moveCompletionSelection(!0)},{key:"ArrowUp",run:moveCompletionSelection(!1)},{key:"PageDown",run:moveCompletionSelection(!0,"page")},{key:"PageUp",run:moveCompletionSelection(!1,"page")},{key:"Enter",run:acceptCompletion}],completionKeymapExt=Prec.highest(keymap.computeN([completionConfig],s=>s.facet(completionConfig).defaultKeymap?[completionKeymap]:[]));class SelectedDiagnostic{constructor(e,r,n){this.from=e,this.to=r,this.diagnostic=n}}class LintState{constructor(e,r,n){this.diagnostics=e,this.panel=r,this.selected=n}static init(e,r,n){let o=e,a=n.facet(lintConfig).markerFilter;a&&(o=a(o));let l=Decoration.set(o.map(c=>c.from==c.to||c.from==c.to-1&&n.doc.lineAt(c.from).to==c.from?Decoration.widget({widget:new DiagnosticWidget(c),diagnostic:c}).range(c.from):Decoration.mark({attributes:{class:"cm-lintRange cm-lintRange-"+c.severity+(c.markClass?" "+c.markClass:"")},diagnostic:c}).range(c.from,c.to)),!0);return new LintState(l,r,findDiagnostic(l))}}function findDiagnostic(s,e=null,r=0){let n=null;return s.between(r,1e9,(o,a,{spec:l})=>{if(!(e&&l.diagnostic!=e))return n=new SelectedDiagnostic(o,a,l.diagnostic),!1}),n}function hideTooltip(s,e){let r=s.startState.doc.lineAt(e.pos);return!!(s.effects.some(n=>n.is(setDiagnosticsEffect))||s.changes.touchesRange(r.from,r.to))}function maybeEnableLint(s,e){return s.field(lintState,!1)?e:e.concat(StateEffect.appendConfig.of(lintExtensions))}const setDiagnosticsEffect=StateEffect.define(),togglePanel=StateEffect.define(),movePanelSelection=StateEffect.define(),lintState=StateField.define({create(){return new LintState(Decoration.none,null,null)},update(s,e){if(e.docChanged){let r=s.diagnostics.map(e.changes),n=null;if(s.selected){let o=e.changes.mapPos(s.selected.from,1);n=findDiagnostic(r,s.selected.diagnostic,o)||findDiagnostic(r,null,o)}s=new LintState(r,s.panel,n)}for(let r of e.effects)r.is(setDiagnosticsEffect)?s=LintState.init(r.value,s.panel,e.state):r.is(togglePanel)?s=new LintState(s.diagnostics,r.value?LintPanel.open:null,s.selected):r.is(movePanelSelection)&&(s=new LintState(s.diagnostics,s.panel,r.value));return s},provide:s=>[showPanel.from(s,e=>e.panel),EditorView.decorations.from(s,e=>e.diagnostics)]}),activeMark=Decoration.mark({class:"cm-lintRange cm-lintRange-active"});function lintTooltip(s,e,r){let{diagnostics:n}=s.state.field(lintState),o=[],a=2e8,l=0;n.between(e-(r<0?1:0),e+(r>0?1:0),(h,f,{spec:d})=>{e>=h&&e<=f&&(h==f||(e>h||r>0)&&(e<f||r<0))&&(o.push(d.diagnostic),a=Math.min(h,a),l=Math.max(f,l))});let c=s.state.facet(lintConfig).tooltipFilter;return c&&(o=c(o)),o.length?{pos:a,end:l,above:s.state.doc.lineAt(a).to<l,create(){return{dom:diagnosticsTooltip(s,o)}}}:null}function diagnosticsTooltip(s,e){return crelt("ul",{class:"cm-tooltip-lint"},e.map(r=>renderDiagnostic(s,r,!1)))}const openLintPanel=s=>{let e=s.state.field(lintState,!1);(!e||!e.panel)&&s.dispatch({effects:maybeEnableLint(s.state,[togglePanel.of(!0)])});let r=getPanel(s,LintPanel.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0},closeLintPanel=s=>{let e=s.state.field(lintState,!1);return!e||!e.panel?!1:(s.dispatch({effects:togglePanel.of(!1)}),!0)},nextDiagnostic=s=>{let e=s.state.field(lintState,!1);if(!e)return!1;let r=s.state.selection.main,n=e.diagnostics.iter(r.to+1);return!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==r.from&&n.to==r.to)?!1:(s.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},lintKeymap=[{key:"Mod-Shift-m",run:openLintPanel,preventDefault:!0},{key:"F8",run:nextDiagnostic}],lintConfig=Facet.define({combine(s){return Object.assign({sources:s.map(e=>e.source)},combineConfig(s.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,r)=>e?r?n=>e(n)||r(n):e:r}))}});function assignKeys(s){let e=[];if(s)e:for(let{name:r}of s){for(let n=0;n<r.length;n++){let o=r[n];if(/[a-zA-Z]/.test(o)&&!e.some(a=>a.toLowerCase()==o.toLowerCase())){e.push(o);continue e}}e.push("")}return e}function renderDiagnostic(s,e,r){var n;let o=r?assignKeys(e.actions):[];return crelt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},crelt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(n=e.actions)===null||n===void 0?void 0:n.map((a,l)=>{let c=!1,h=v=>{if(v.preventDefault(),c)return;c=!0;let A=findDiagnostic(s.state.field(lintState).diagnostics,e);A&&a.apply(s,A.from,A.to)},{name:f}=a,d=o[l]?f.indexOf(o[l]):-1,m=d<0?f:[f.slice(0,d),crelt("u",f.slice(d,d+1)),f.slice(d+1)];return crelt("button",{type:"button",class:"cm-diagnosticAction",onclick:h,onmousedown:h,"aria-label":` Action: ${f}${d<0?"":` (access key "${o[l]})"`}.`},m)}),e.source&&crelt("div",{class:"cm-diagnosticSource"},e.source))}class DiagnosticWidget extends WidgetType{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return crelt("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class PanelItem{constructor(e,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=renderDiagnostic(e,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class LintPanel{constructor(e){this.view=e,this.items=[];let r=o=>{if(o.keyCode==27)closeLintPanel(this.view),this.view.focus();else if(o.keyCode==38||o.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(o.keyCode==40||o.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(o.keyCode==36)this.moveSelection(0);else if(o.keyCode==35)this.moveSelection(this.items.length-1);else if(o.keyCode==13)this.view.focus();else if(o.keyCode>=65&&o.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:a}=this.items[this.selectedIndex],l=assignKeys(a.actions);for(let c=0;c<l.length;c++)if(l[c].toUpperCase().charCodeAt(0)==o.keyCode){let h=findDiagnostic(this.view.state.field(lintState).diagnostics,a);h&&a.actions[c].apply(e,h.from,h.to)}}else return;o.preventDefault()},n=o=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(o.target)&&this.moveSelection(a)};this.list=crelt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:n}),this.dom=crelt("div",{class:"cm-panel-lint"},this.list,crelt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>closeLintPanel(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(lintState).selected;if(!e)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==e.diagnostic)return r;return-1}update(){let{diagnostics:e,selected:r}=this.view.state.field(lintState),n=0,o=!1,a=null;for(e.between(0,this.view.state.doc.length,(l,c,{spec:h})=>{let f=-1,d;for(let m=n;m<this.items.length;m++)if(this.items[m].diagnostic==h.diagnostic){f=m;break}f<0?(d=new PanelItem(this.view,h.diagnostic),this.items.splice(n,0,d),o=!0):(d=this.items[f],f>n&&(this.items.splice(n,f-n),o=!0)),r&&d.diagnostic==r.diagnostic?d.dom.hasAttribute("aria-selected")||(d.dom.setAttribute("aria-selected","true"),a=d):d.dom.hasAttribute("aria-selected")&&d.dom.removeAttribute("aria-selected"),n++});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)o=!0,this.items.pop();this.items.length==0&&(this.items.push(new PanelItem(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),o=!0),a?(this.list.setAttribute("aria-activedescendant",a.id),this.view.requestMeasure({key:this,read:()=>({sel:a.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{l.top<c.top?this.list.scrollTop-=c.top-l.top:l.bottom>c.bottom&&(this.list.scrollTop+=l.bottom-c.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}sync(){let e=this.list.firstChild;function r(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)r();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)r()}moveSelection(e){if(this.selectedIndex<0)return;let r=this.view.state.field(lintState),n=findDiagnostic(r.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:movePanelSelection.of(n)})}static open(e){return new LintPanel(e)}}function svg(s,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(s)}</svg>')`}function underline(s){return svg(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${s}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const baseTheme=EditorView.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:underline("#d11")},".cm-lintRange-warning":{backgroundImage:underline("orange")},".cm-lintRange-info":{backgroundImage:underline("#999")},".cm-lintRange-hint":{backgroundImage:underline("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),lintExtensions=[lintState,EditorView.decorations.compute([lintState],s=>{let{selected:e,panel:r}=s.field(lintState);return!e||!r||e.from==e.to?Decoration.none:Decoration.set([activeMark.range(e.from,e.to)])}),hoverTooltip(lintTooltip,{hideOn:hideTooltip}),baseTheme],editorSetup=(()=>[highlightActiveLineGutter(),highlightSpecialChars(),history(),drawSelection(),dropCursor(),EditorState.allowMultipleSelections.of(!0),indentOnInput(),syntaxHighlighting(defaultHighlightStyle,{fallback:!0}),bracketMatching(),closeBrackets(),autocompletion(),rectangularSelection(),crosshairCursor(),highlightActiveLine(),highlightSelectionMatches(),keymap.of([...closeBracketsKeymap,...defaultKeymap,...historyKeymap,...lintKeymap])])();let Stack$1=class jr{constructor(e,r,n,o,a,l,c,h,f,d=0,m){this.p=e,this.stack=r,this.state=n,this.reducePos=o,this.pos=a,this.score=l,this.buffer=c,this.bufferBase=h,this.curContext=f,this.lookAhead=d,this.parent=m}toString(){return`[${this.stack.filter((e,r)=>r%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,r,n=0){let o=e.parser.context;return new jr(e,[],r,n,n,0,[],0,o?new StackContext(o,o.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,r){this.stack.push(this.state,r,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var r;let n=e>>19,o=e&65535,{parser:a}=this.p,l=a.dynamicPrecedence(o);if(l&&(this.score+=l),n==0){this.pushState(a.getGoto(this.state,o,!0),this.reducePos),o<a.minRepeatTerm&&this.storeNode(o,this.reducePos,this.reducePos,4,!0),this.reduceContext(o,this.reducePos);return}let c=this.stack.length-(n-1)*3-(e&262144?6:0),h=c?this.stack[c-2]:this.p.ranges[0].from,f=this.reducePos-h;f>=2e3&&!(!((r=this.p.parser.nodeSet.types[o])===null||r===void 0)&&r.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSize<f&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=f));let d=c?this.stack[c-1]:0,m=this.bufferBase+this.buffer.length-d;if(o<a.minRepeatTerm||e&131072){let v=a.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(o,h,v,m+4,!0)}if(e&262144)this.state=this.stack[c];else{let v=this.stack[c-3];this.state=a.getGoto(v,o,!0)}for(;this.stack.length>c;)this.stack.pop();this.reduceContext(o,h)}storeNode(e,r,n,o=4,a=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let l=this,c=this.buffer.length;if(c==0&&l.parent&&(c=l.bufferBase-l.parent.bufferBase,l=l.parent),c>0&&l.buffer[c-4]==0&&l.buffer[c-1]>-1){if(r==n)return;if(l.buffer[c-2]>=r){l.buffer[c-2]=n;return}}}if(!a||this.pos==n)this.buffer.push(e,r,n,o);else{let l=this.buffer.length;if(l>0&&this.buffer[l-4]!=0)for(;l>0&&this.buffer[l-2]>n;)this.buffer[l]=this.buffer[l-4],this.buffer[l+1]=this.buffer[l-3],this.buffer[l+2]=this.buffer[l-2],this.buffer[l+3]=this.buffer[l-1],l-=4,o>4&&(o-=4);this.buffer[l]=e,this.buffer[l+1]=r,this.buffer[l+2]=n,this.buffer[l+3]=o}}shift(e,r,n){let o=this.pos;if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=n,this.shiftContext(r,o),r<=this.p.parser.maxNode&&this.buffer.push(r,o,n,4);else{let a=e,{parser:l}=this.p;(n>this.pos||r<=l.maxNode)&&(this.pos=n,l.stateFlag(a,1)||(this.reducePos=n)),this.pushState(a,o),this.shiftContext(r,o),r<=l.maxNode&&this.buffer.push(r,o,n,4)}}apply(e,r,n){e&65536?this.reduce(e):this.shift(e,r,n)}useNode(e,r){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let o=this.pos;this.reducePos=this.pos=o+e.length,this.pushState(r,o),this.buffer.push(n,o,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,r=e.buffer.length;for(;r>0&&e.buffer[r-2]>e.reducePos;)r-=4;let n=e.buffer.slice(r),o=e.bufferBase+r;for(;e&&o==e.bufferBase;)e=e.parent;return new jr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,o,this.curContext,this.lookAhead,e)}recoverByDelete(e,r){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,r,4),this.storeNode(0,this.pos,r,n?8:4),this.pos=this.reducePos=r,this.score-=190}canShift(e){for(let r=new SimulatedStack(this);;){let n=this.p.parser.stateSlot(r.state,4)||this.p.parser.hasAction(r.state,e);if(n==0)return!1;if(!(n&65536))return!0;r.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let r=this.p.parser.nextStates(this.state);if(r.length>8||this.stack.length>=120){let o=[];for(let a=0,l;a<r.length;a+=2)(l=r[a+1])!=this.state&&this.p.parser.hasAction(l,e)&&o.push(r[a],l);if(this.stack.length<120)for(let a=0;o.length<8&&a<r.length;a+=2){let l=r[a+1];o.some((c,h)=>h&1&&c==l)||o.push(r[a],l)}r=o}let n=[];for(let o=0;o<r.length&&n.length<4;o+=2){let a=r[o+1];if(a==this.state)continue;let l=this.split();l.pushState(a,this.pos),l.storeNode(0,l.pos,l.pos,4,!0),l.shiftContext(r[o],this.pos),l.score-=200,n.push(l)}return n}forceReduce(){let{parser:e}=this.p,r=e.stateSlot(this.state,5);if(!(r&65536))return!1;if(!e.validAction(this.state,r)){let n=r>>19,o=r&65535,a=this.stack.length-n*3;if(a<0||e.getGoto(this.stack[a],o,!1)<0){let l=this.findForcedReduction();if(l==null)return!1;r=l}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(r),!0}findForcedReduction(){let{parser:e}=this.p,r=[],n=(o,a)=>{if(!r.includes(o))return r.push(o),e.allActions(o,l=>{if(!(l&393216))if(l&65536){let c=(l>>19)-a;if(c>1){let h=l&65535,f=this.stack.length-c*3;if(f>=0&&e.getGoto(this.stack[f],h,!1)>=0)return c<<19|65536|h}}else{let c=n(l,a+1);if(c!=null)return c}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let r=0;r<this.stack.length;r+=3)if(this.stack[r]!=e.stack[r])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,r){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(r)))}reduceContext(e,r){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(r)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let r=new StackContext(this.curContext.tracker,e);r.hash!=this.curContext.hash&&this.emitContext(),this.curContext=r}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}};class StackContext{constructor(e,r){this.tracker=e,this.context=r,this.hash=e.strict?e.hash(r):0}}var Recover;(function(s){s[s.Insert=200]="Insert",s[s.Delete=190]="Delete",s[s.Reduce=100]="Reduce",s[s.MaxNext=4]="MaxNext",s[s.MaxInsertStackDepth=300]="MaxInsertStackDepth",s[s.DampenInsertStackDepth=120]="DampenInsertStackDepth",s[s.MinBigReduction=2e3]="MinBigReduction"})(Recover||(Recover={}));class SimulatedStack{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let r=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let o=this.start.p.parser.getGoto(this.stack[this.base-3],r,!0);this.state=o}}class StackBufferCursor{constructor(e,r,n){this.stack=e,this.pos=r,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,r=e.bufferBase+e.buffer.length){return new StackBufferCursor(e,r,r-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new StackBufferCursor(this.stack,this.pos,this.index)}}function decodeArray(s,e=Uint16Array){if(typeof s!="string")return s;let r=null;for(let n=0,o=0;n<s.length;){let a=0;for(;;){let l=s.charCodeAt(n++),c=!1;if(l==126){a=65535;break}l>=92&&l--,l>=34&&l--;let h=l-32;if(h>=46&&(h-=46,c=!0),a+=h,c)break;a*=46}r?r[o++]=a:r=new e(a)}return r}class CachedToken{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const nullToken=new CachedToken;class InputStream{constructor(e,r){this.input=e,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=nullToken,this.rangeIndex=0,this.pos=this.chunkPos=r[0].from,this.range=r[0],this.end=r[r.length-1].to,this.readNext()}resolveOffset(e,r){let n=this.range,o=this.rangeIndex,a=this.pos+e;for(;a<n.from;){if(!o)return null;let l=this.ranges[--o];a-=n.from-l.to,n=l}for(;r<0?a>n.to:a>=n.to;){if(o==this.ranges.length-1)return null;let l=this.ranges[++o];a+=l.from-n.to,n=l}return a}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let r of this.ranges)if(r.to>e)return Math.max(e,r.from);return this.end}peek(e){let r=this.chunkOff+e,n,o;if(r>=0&&r<this.chunk.length)n=this.pos+e,o=this.chunk.charCodeAt(r);else{let a=this.resolveOffset(e,1);if(a==null)return-1;if(n=a,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)o=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let l=this.rangeIndex,c=this.range;for(;c.to<=n;)c=this.ranges[++l];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>c.to&&(this.chunk2=this.chunk2.slice(0,c.to-n)),o=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),o}acceptToken(e,r=0){let n=r?this.resolveOffset(r,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:r}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=r,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),r=this.pos+e.length;this.chunk=r>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,r){if(r?(this.token=r,r.start=e,r.lookAhead=e+1,r.value=r.extended=-1):this.token=nullToken,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,r){if(e>=this.chunkPos&&r<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,r-this.chunkPos);if(e>=this.chunk2Pos&&r<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,r-this.chunk2Pos);if(e>=this.range.from&&r<=this.range.to)return this.input.read(e,r);let n="";for(let o of this.ranges){if(o.from>=r)break;o.to>e&&(n+=this.input.read(Math.max(o.from,e),Math.min(o.to,r)))}return n}}class TokenGroup{constructor(e,r){this.data=e,this.id=r}token(e,r){let{parser:n}=r.p;readToken(this.data,e,r,this.id,n.data,n.tokenPrecTable)}}TokenGroup.prototype.contextual=TokenGroup.prototype.fallback=TokenGroup.prototype.extend=!1;class LocalTokenGroup{constructor(e,r,n){this.precTable=r,this.elseToken=n,this.data=typeof e=="string"?decodeArray(e):e}token(e,r){let n=e.pos,o=0;for(;;){let a=e.next<0,l=e.resolveOffset(1,1);if(readToken(this.data,e,r,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(a||o++,l==null)break;e.reset(l,e.token)}o&&(e.reset(n,e.token),e.acceptToken(this.elseToken,o))}}LocalTokenGroup.prototype.contextual=TokenGroup.prototype.fallback=TokenGroup.prototype.extend=!1;class ExternalTokenizer{constructor(e,r={}){this.token=e,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}}function readToken(s,e,r,n,o,a){let l=0,c=1<<n,{dialect:h}=r.p.parser;e:for(;c&s[l];){let f=s[l+1];for(let A=l+3;A<f;A+=2)if((s[A+1]&c)>0){let T=s[A];if(h.allows(T)&&(e.token.value==-1||e.token.value==T||overrides(T,e.token.value,o,a))){e.acceptToken(T);break}}let d=e.next,m=0,v=s[l+2];if(e.next<0&&v>m&&s[f+v*3-3]==65535&&s[f+v*3-3]==65535){l=s[f+v*3-1];continue e}for(;m<v;){let A=m+v>>1,T=f+A+(A<<1),B=s[T],Y=s[T+1]||65536;if(d<B)v=A;else if(d>=Y)m=A+1;else{l=s[T+2],e.advance();continue e}}break}}function findOffset(s,e,r){for(let n=e,o;(o=s[n])!=65535;n++)if(o==r)return n-e;return-1}function overrides(s,e,r,n){let o=findOffset(r,n,e);return o<0||findOffset(r,n,s)<o}const verbose=typeof process<"u"&&process.env&&/\bparse\b/.test({}.LOG);let stackIDs=null;var Safety;(function(s){s[s.Margin=25]="Margin"})(Safety||(Safety={}));function cutAt(s,e,r){let n=s.cursor(IterMode.IncludeAnonymous);for(n.moveTo(e);;)if(!(r<0?n.childBefore(e):n.childAfter(e)))for(;;){if((r<0?n.to<e:n.from>e)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(s.length,Math.max(n.from+1,e+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:s.length}}let FragmentCursor$1=class{constructor(e,r){this.fragments=e,this.nodeSet=r,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?cutAt(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?cutAt(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let r=this.trees.length-1;if(r<0)return this.nextFragment(),null;let n=this.trees[r],o=this.index[r];if(o==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let a=n.children[o],l=this.start[r]+n.positions[o];if(l>e)return this.nextStart=l,null;if(a instanceof Tree){if(l==e){if(l<this.safeFrom)return null;let c=l+a.length;if(c<=this.safeTo){let h=a.prop(NodeProp.lookAhead);if(!h||c+h<this.fragment.to)return a}}this.index[r]++,l+a.length>=Math.max(this.safeFrom,e)&&(this.trees.push(a),this.start.push(l),this.index.push(0))}else this.index[r]++,this.nextStart=l+a.length}}};class TokenCache{constructor(e,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new CachedToken)}getActions(e){let r=0,n=null,{parser:o}=e.p,{tokenizers:a}=o,l=o.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,h=0;for(let f=0;f<a.length;f++){if(!(1<<f&l))continue;let d=a[f],m=this.tokens[f];if(!(n&&!d.fallback)&&((d.contextual||m.start!=e.pos||m.mask!=l||m.context!=c)&&(this.updateCachedToken(m,d,e),m.mask=l,m.context=c),m.lookAhead>m.end+25&&(h=Math.max(m.lookAhead,h)),m.value!=0)){let v=r;if(m.extended>-1&&(r=this.addActions(e,m.extended,m.end,r)),r=this.addActions(e,m.value,m.end,r),!d.extend&&(n=m,r>v))break}}for(;this.actions.length>r;)this.actions.pop();return h&&e.setLookAhead(h),!n&&e.pos==this.stream.end&&(n=new CachedToken,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,r=this.addActions(e,n.value,n.end,r)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let r=new CachedToken,{pos:n,p:o}=e;return r.start=n,r.end=Math.min(n+1,o.stream.end),r.value=n==o.stream.end?o.parser.eofTerm:0,r}updateCachedToken(e,r,n){let o=this.stream.clipPos(n.pos);if(r.token(this.stream.reset(o,e),n),e.value>-1){let{parser:a}=n.p;for(let l=0;l<a.specialized.length;l++)if(a.specialized[l]==e.value){let c=a.specializers[l](this.stream.read(e.start,e.end),n);if(c>=0&&n.p.parser.dialect.allows(c>>1)){c&1?e.extended=c>>1:e.value=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(o+1)}putAction(e,r,n,o){for(let a=0;a<o;a+=3)if(this.actions[a]==e)return o;return this.actions[o++]=e,this.actions[o++]=r,this.actions[o++]=n,o}addActions(e,r,n,o){let{state:a}=e,{parser:l}=e.p,{data:c}=l;for(let h=0;h<2;h++)for(let f=l.stateSlot(a,h?2:1);;f+=3){if(c[f]==65535)if(c[f+1]==1)f=pair(c,f+2);else{o==0&&c[f+1]==2&&(o=this.putAction(pair(c,f+2),r,n,o));break}c[f]==r&&(o=this.putAction(pair(c,f+1),r,n,o))}return o}}var Rec;(function(s){s[s.Distance=5]="Distance",s[s.MaxRemainingPerStep=3]="MaxRemainingPerStep",s[s.MinBufferLengthPrune=500]="MinBufferLengthPrune",s[s.ForceReduceLimit=10]="ForceReduceLimit",s[s.CutDepth=15e3]="CutDepth",s[s.CutTo=9e3]="CutTo",s[s.MaxLeftAssociativeReductionCount=300]="MaxLeftAssociativeReductionCount",s[s.MaxStackCount=12]="MaxStackCount"})(Rec||(Rec={}));class Parse{constructor(e,r,n,o){this.parser=e,this.input=r,this.ranges=o,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new InputStream(r,o),this.tokens=new TokenCache(e,this.stream),this.topTerm=e.top[1];let{from:a}=o[0];this.stacks=[Stack$1.start(this,e.top[0],a)],this.fragments=n.length&&this.stream.end-a>e.bufferLength*4?new FragmentCursor$1(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,r=this.minStackPos,n=this.stacks=[],o,a;if(this.bigReductionCount>300&&e.length==1){let[l]=e;for(;l.forceReduce()&&l.stack.length&&l.stack[l.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let l=0;l<e.length;l++){let c=e[l];for(;;){if(this.tokens.mainToken=null,c.pos>r)n.push(c);else{if(this.advanceStack(c,n,e))continue;{o||(o=[],a=[]),o.push(c);let h=this.tokens.getMainToken(c);a.push(h.value,h.end)}}break}}if(!n.length){let l=o&&findFinished(o);if(l)return this.stackToTree(l);if(this.parser.strict)throw verbose&&o&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&o){let l=this.stoppedAt!=null&&o[0].pos>this.stoppedAt?o[0]:this.runRecovery(o,a,n);if(l)return this.stackToTree(l.forceAll())}if(this.recovering){let l=this.recovering==1?1:this.recovering*3;if(n.length>l)for(n.sort((c,h)=>h.score-c.score);n.length>l;)n.pop();n.some(c=>c.reducePos>r)&&this.recovering--}else if(n.length>1){e:for(let l=0;l<n.length-1;l++){let c=n[l];for(let h=l+1;h<n.length;h++){let f=n[h];if(c.sameState(f)||c.buffer.length>500&&f.buffer.length>500)if((c.score-f.score||c.buffer.length-f.buffer.length)>0)n.splice(h--,1);else{n.splice(l--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let l=1;l<n.length;l++)n[l].pos<this.minStackPos&&(this.minStackPos=n[l].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,r,n){let o=e.pos,{parser:a}=this,l=verbose?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&o>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let f=e.curContext&&e.curContext.tracker.strict,d=f?e.curContext.hash:0;for(let m=this.fragments.nodeAt(o);m;){let v=this.parser.nodeSet.types[m.type.id]==m.type?a.getGoto(e.state,m.type.id):-1;if(v>-1&&m.length&&(!f||(m.prop(NodeProp.contextHash)||0)==d))return e.useNode(m,v),verbose&&console.log(l+this.stackID(e)+` (via reuse of ${a.getName(m.type.id)})`),!0;if(!(m instanceof Tree)||m.children.length==0||m.positions[0]>0)break;let A=m.children[0];if(A instanceof Tree&&m.positions[0]==0)m=A;else break}}let c=a.stateSlot(e.state,4);if(c>0)return e.reduce(c),verbose&&console.log(l+this.stackID(e)+` (via always-reduce ${a.getName(c&65535)})`),!0;if(e.stack.length>=15e3)for(;e.stack.length>9e3&&e.forceReduce(););let h=this.tokens.getActions(e);for(let f=0;f<h.length;){let d=h[f++],m=h[f++],v=h[f++],A=f==h.length||!n,T=A?e:e.split();if(T.apply(d,m,v),verbose&&console.log(l+this.stackID(T)+` (via ${d&65536?`reduce of ${a.getName(d&65535)}`:"shift"} for ${a.getName(m)} @ ${o}${T==e?"":", split"})`),A)return!0;T.pos>o?r.push(T):n.push(T)}return!1}advanceFully(e,r){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return pushStackDedup(e,r),!0}}runRecovery(e,r,n){let o=null,a=!1;for(let l=0;l<e.length;l++){let c=e[l],h=r[l<<1],f=r[(l<<1)+1],d=verbose?this.stackID(c)+" -> ":"";if(c.deadEnd&&(a||(a=!0,c.restart(),verbose&&console.log(d+this.stackID(c)+" (restarted)"),this.advanceFully(c,n))))continue;let m=c.split(),v=d;for(let A=0;m.forceReduce()&&A<10&&(verbose&&console.log(v+this.stackID(m)+" (via force-reduce)"),!this.advanceFully(m,n));A++)verbose&&(v=this.stackID(m)+" -> ");for(let A of c.recoverByInsert(h))verbose&&console.log(d+this.stackID(A)+" (via recover-insert)"),this.advanceFully(A,n);this.stream.end>c.pos?(f==c.pos&&(f++,h=0),c.recoverByDelete(h,f),verbose&&console.log(d+this.stackID(c)+` (via recover-delete ${this.parser.getName(h)})`),pushStackDedup(c,n)):(!o||o.score<c.score)&&(o=c)}return o}stackToTree(e){return e.close(),Tree.build({buffer:StackBufferCursor.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let r=(stackIDs||(stackIDs=new WeakMap)).get(e);return r||stackIDs.set(e,r=String.fromCodePoint(this.nextStackID++)),r+e}}function pushStackDedup(s,e){for(let r=0;r<e.length;r++){let n=e[r];if(n.pos==s.pos&&n.sameState(s)){e[r].score<s.score&&(e[r]=s);return}}e.push(s)}class Dialect{constructor(e,r,n){this.source=e,this.flags=r,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}const id=s=>s;class ContextTracker{constructor(e){this.start=e.start,this.shift=e.shift||id,this.reduce=e.reduce||id,this.reuse=e.reuse||id,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class LRParser extends Parser{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let r=e.nodeNames.split(" ");this.minRepeatTerm=r.length;for(let c=0;c<e.repeatNodeCount;c++)r.push("");let n=Object.keys(e.topRules).map(c=>e.topRules[c][1]),o=[];for(let c=0;c<r.length;c++)o.push([]);function a(c,h,f){o[c].push([h,h.deserialize(String(f))])}if(e.nodeProps)for(let c of e.nodeProps){let h=c[0];typeof h=="string"&&(h=NodeProp[h]);for(let f=1;f<c.length;){let d=c[f++];if(d>=0)a(d,h,c[f++]);else{let m=c[f+-d];for(let v=-d;v>0;v--)a(c[f++],h,m);f++}}}this.nodeSet=new NodeSet(r.map((c,h)=>NodeType.define({name:h>=this.minRepeatTerm?void 0:c,id:h,props:o[h],top:n.indexOf(h)>-1,error:h==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(h)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=DefaultBufferLength;let l=decodeArray(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;c<this.specializerSpecs.length;c++)this.specialized[c]=this.specializerSpecs[c].term;this.specializers=this.specializerSpecs.map(getSpecializer),this.states=decodeArray(e.states,Uint32Array),this.data=decodeArray(e.stateData),this.goto=decodeArray(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(c=>typeof c=="number"?new TokenGroup(l,c):c),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,r,n){let o=new Parse(this,e,r,n);for(let a of this.wrappers)o=a(o,e,r,n);return o}getGoto(e,r,n=!1){let o=this.goto;if(r>=o[0])return-1;for(let a=o[r+1];;){let l=o[a++],c=l&1,h=o[a++];if(c&&n)return h;for(let f=a+(l>>1);a<f;a++)if(o[a]==e)return h;if(c)return-1}}hasAction(e,r){let n=this.data;for(let o=0;o<2;o++)for(let a=this.stateSlot(e,o?2:1),l;;a+=3){if((l=n[a])==65535)if(n[a+1]==1)l=n[a=pair(n,a+2)];else{if(n[a+1]==2)return pair(n,a+2);break}if(l==r||l==0)return pair(n,a+1)}return 0}stateSlot(e,r){return this.states[e*6+r]}stateFlag(e,r){return(this.stateSlot(e,0)&r)>0}validAction(e,r){return!!this.allActions(e,n=>n==r?!0:null)}allActions(e,r){let n=this.stateSlot(e,4),o=n?r(n):void 0;for(let a=this.stateSlot(e,1);o==null;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=pair(this.data,a+2);else break;o=r(pair(this.data,a+1))}return o}nextStates(e){let r=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=pair(this.data,n+2);else break;if(!(this.data[n+2]&1)){let o=this.data[n+1];r.some((a,l)=>l&1&&a==o)||r.push(this.data[n],o)}}return r}configure(e){let r=Object.assign(Object.create(LRParser.prototype),this);if(e.props&&(r.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);r.top=n}return e.tokenizers&&(r.tokenizers=this.tokenizers.map(n=>{let o=e.tokenizers.find(a=>a.from==n);return o?o.to:n})),e.specializers&&(r.specializers=this.specializers.slice(),r.specializerSpecs=this.specializerSpecs.map((n,o)=>{let a=e.specializers.find(c=>c.from==n.external);if(!a)return n;let l=Object.assign(Object.assign({},n),{external:a.to});return r.specializers[o]=getSpecializer(l),l})),e.contextTracker&&(r.context=e.contextTracker),e.dialect&&(r.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(r.strict=e.strict),e.wrap&&(r.wrappers=r.wrappers.concat(e.wrap)),e.bufferLength!=null&&(r.bufferLength=e.bufferLength),r}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let r=this.dynamicPrecedences;return r==null?0:r[e]||0}parseDialect(e){let r=Object.keys(this.dialects),n=r.map(()=>!1);if(e)for(let a of e.split(" ")){let l=r.indexOf(a);l>=0&&(n[l]=!0)}let o=null;for(let a=0;a<r.length;a++)if(!n[a])for(let l=this.dialects[r[a]],c;(c=this.data[l++])!=65535;)(o||(o=new Uint8Array(this.maxTerm+1)))[c]=1;return new Dialect(e,n,o)}static deserialize(e){return new LRParser(e)}}function pair(s,e){return s[e]|s[e+1]<<16}function findFinished(s){let e=null;for(let r of s){let n=r.p.stoppedAt;(r.pos==r.p.stream.end||n!=null&&r.pos>n)&&r.p.parser.stateFlag(r.state,2)&&(!e||e.score<r.score)&&(e=r)}return e}function getSpecializer(s){if(s.external){let e=s.extend?1:0;return(r,n)=>s.external(r,n)<<1|e}return s.get}const noSemi=303,incdec=1,incdecPrefix=2,insertSemi=304,spaces=306,newline=307,LineComment=3,BlockComment=4,space$2=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],braceR=125,semicolon=59,slash$1=47,star=42,plus=43,minus=45,trackNewline=new ContextTracker({start:!1,shift(s,e){return e==LineComment||e==BlockComment||e==spaces?s:e==newline},strict:!1}),insertSemicolon=new ExternalTokenizer((s,e)=>{let{next:r}=s;(r==braceR||r==-1||e.context)&&s.acceptToken(insertSemi)},{contextual:!0,fallback:!0}),noSemicolon=new ExternalTokenizer((s,e)=>{let{next:r}=s,n;space$2.indexOf(r)>-1||r==slash$1&&((n=s.peek(1))==slash$1||n==star)||r!=braceR&&r!=semicolon&&r!=-1&&!e.context&&s.acceptToken(noSemi)},{contextual:!0}),incdecToken=new ExternalTokenizer((s,e)=>{let{next:r}=s;if((r==plus||r==minus)&&(s.advance(),r==s.next)){s.advance();let n=!e.context&&e.canShift(incdec);s.acceptToken(n?incdec:incdecPrefix)}},{contextual:!0}),jsHighlight=styleTags({"get set async static":tags$1.modifier,"for while do if else switch try catch finally return throw break continue default case":tags$1.controlKeyword,"in of await yield void typeof delete instanceof":tags$1.operatorKeyword,"let var const function class extends":tags$1.definitionKeyword,"import export from":tags$1.moduleKeyword,"with debugger as new":tags$1.keyword,TemplateString:tags$1.special(tags$1.string),super:tags$1.atom,BooleanLiteral:tags$1.bool,this:tags$1.self,null:tags$1.null,Star:tags$1.modifier,VariableName:tags$1.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":tags$1.function(tags$1.variableName),VariableDefinition:tags$1.definition(tags$1.variableName),Label:tags$1.labelName,PropertyName:tags$1.propertyName,PrivatePropertyName:tags$1.special(tags$1.propertyName),"CallExpression/MemberExpression/PropertyName":tags$1.function(tags$1.propertyName),"FunctionDeclaration/VariableDefinition":tags$1.function(tags$1.definition(tags$1.variableName)),"ClassDeclaration/VariableDefinition":tags$1.definition(tags$1.className),PropertyDefinition:tags$1.definition(tags$1.propertyName),PrivatePropertyDefinition:tags$1.definition(tags$1.special(tags$1.propertyName)),UpdateOp:tags$1.updateOperator,LineComment:tags$1.lineComment,BlockComment:tags$1.blockComment,Number:tags$1.number,String:tags$1.string,Escape:tags$1.escape,ArithOp:tags$1.arithmeticOperator,LogicOp:tags$1.logicOperator,BitOp:tags$1.bitwiseOperator,CompareOp:tags$1.compareOperator,RegExp:tags$1.regexp,Equals:tags$1.definitionOperator,Arrow:tags$1.function(tags$1.punctuation),": Spread":tags$1.punctuation,"( )":tags$1.paren,"[ ]":tags$1.squareBracket,"{ }":tags$1.brace,"InterpolationStart InterpolationEnd":tags$1.special(tags$1.brace),".":tags$1.derefOperator,", ;":tags$1.separator,"@":tags$1.meta,TypeName:tags$1.typeName,TypeDefinition:tags$1.definition(tags$1.typeName),"type enum interface implements namespace module declare":tags$1.definitionKeyword,"abstract global Privacy readonly override":tags$1.modifier,"is keyof unique infer":tags$1.operatorKeyword,JSXAttributeValue:tags$1.attributeValue,JSXText:tags$1.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":tags$1.angleBracket,"JSXIdentifier JSXNameSpacedName":tags$1.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":tags$1.attributeName,"JSXBuiltin/JSXIdentifier":tags$1.standard(tags$1.tagName)}),spec_identifier$1={__proto__:null,export:14,as:19,from:27,default:30,async:35,function:36,extends:46,this:50,true:58,false:58,null:70,void:74,typeof:78,super:96,new:130,delete:146,yield:155,await:159,class:164,public:221,private:221,protected:221,readonly:223,instanceof:242,satisfies:245,in:246,const:248,import:280,keyof:335,unique:339,infer:345,is:381,abstract:401,implements:403,type:405,let:408,var:410,using:413,interface:419,enum:423,namespace:429,module:431,declare:435,global:439,for:458,of:467,while:470,with:474,do:478,if:482,else:484,switch:488,case:494,try:500,catch:504,finally:508,return:512,throw:516,break:520,continue:524,debugger:528},spec_word={__proto__:null,async:117,get:119,set:121,declare:181,public:183,private:183,protected:183,static:185,abstract:187,override:189,readonly:195,accessor:197,new:385},spec_LessThan={__proto__:null,"<":137},parser$3=LRParser.deserialize({version:14,states:"$6tO`QUOOO%TQUOOO'WQWOOP(eOSOOO*sQ(CjO'#CfO*zOpO'#CgO+YO!bO'#CgO+hO07`O'#DZO-yQUO'#DaO.ZQUO'#DlO%TQUO'#DvO0_QUO'#EOOOQ(CY'#EW'#EWO0xQSO'#ETOOQO'#Ei'#EiOOQO'#Ic'#IcO1QQSO'#GkO1]QSO'#EhO1bQSO'#EhO3dQ(CjO'#JdO6TQ(CjO'#JeO6qQSO'#FWO6vQ#tO'#FoOOQ(CY'#F`'#F`O7RO&jO'#F`O7aQ,UO'#FvO8wQSO'#FuOOQ(CY'#Je'#JeOOQ(CW'#Jd'#JdO8|QSO'#GoOOQQ'#KP'#KPO9XQSO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ineComment BlockComment Script ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:366,context:trackNewline,nodeProps:[["group",-26,6,14,16,62,199,203,207,208,210,213,216,226,228,234,236,238,240,243,249,255,257,259,261,263,265,266,"Statement",-32,10,11,25,28,29,35,45,48,49,51,56,64,72,76,78,80,81,103,104,113,114,131,134,136,137,138,139,141,142,162,163,165,"Expression",-23,24,26,30,34,36,38,166,168,170,171,173,174,175,177,178,179,181,182,183,193,195,197,198,"Type",-3,84,96,102,"ClassItem"],["openedBy",31,"InterpolationStart",50,"[",54,"{",69,"(",143,"JSXStartTag",155,"JSXStartTag JSXStartCloseTag"],["closedBy",33,"InterpolationEnd",44,"]",55,"}",70,")",144,"JSXSelfCloseEndTag JSXEndTag",160,"JSXEndTag"]],propSources:[jsHighlight],skippedNodes:[0,3,4,269],repeatNodeCount:33,tokenData:"$>y(CSR!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tu>PuvBavwDxwxGgxyMvyz! Qz{!![{|!%O|}!&]}!O!%O!O!P!'g!P!Q!1w!Q!R#0t!R![#3T![!]#@T!]!^#Aa!^!_#Bk!_!`#GS!`!a#In!a!b#N{!b!c$$z!c!}>P!}#O$&U#O#P$'`#P#Q$,w#Q#R$.R#R#S>P#S#T$/`#T#o$0j#o#p$4z#p#q$5p#q#r$7Q#r#s$8^#s$f%Z$f$g+g$g#BY>P#BY#BZ$9h#BZ$IS>P$IS$I_$9h$I_$I|>P$I|$I}$<s$I}$JO$<s$JO$JT>P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h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$9h$I_$JT>P$JT$JU$9h$JU$KV>P$KV$KW$9h$KW&FU>P&FU&FV$9h&FV;'S>P;'S;=`BZ<%l?HT>P?HT?HU$9h?HUO>P(CS$=Uk$d&j'xp'{!b'o(;d(V!LY'u&;d$W#tOY%ZYZ&cZr%Zrs&}st%Ztu>Puw%Zwx(rx}%Z}!O@T!O!Q%Z!Q![>P![!^%Z!^!_*g!_!c%Z!c!}>P!}#O%Z#O#P&c#P#R%Z#R#S>P#S#T%Z#T#o>P#o#p*g#p$g%Z$g;'S>P;'S;=`BZ<%lO>P",tokenizers:[noSemicolon,incdecToken,2,3,4,5,6,7,8,9,10,11,12,13,insertSemicolon,new LocalTokenGroup("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOq~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!O~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(U~~",141,327),new LocalTokenGroup("j~RQYZXz{^~^O'r~~aP!P!Qd~iO's~~",25,309)],topRules:{Script:[0,5],SingleExpression:[1,267],SingleClassItem:[2,268]},dialects:{jsx:12810,ts:12812},dynamicPrecedences:{76:1,78:1,163:1,191:1},specialized:[{term:313,get:s=>spec_identifier$1[s]||-1},{term:329,get:s=>spec_word[s]||-1},{term:67,get:s=>spec_LessThan[s]||-1}],tokenPrec:12836}),snippets=[snippetCompletion("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),snippetCompletion("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),snippetCompletion("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),snippetCompletion("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),snippetCompletion("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),snippetCompletion(`try {
|
||
\${}
|
||
} catch (\${error}) {
|
||
\${}
|
||
}`,{label:"try",detail:"/ catch block",type:"keyword"}),snippetCompletion("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),snippetCompletion(`if (\${}) {
|
||
\${}
|
||
} else {
|
||
\${}
|
||
}`,{label:"if",detail:"/ else block",type:"keyword"}),snippetCompletion(`class \${name} {
|
||
constructor(\${params}) {
|
||
\${}
|
||
}
|
||
}`,{label:"class",detail:"definition",type:"keyword"}),snippetCompletion('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),snippetCompletion('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],cache$1=new NodeWeakMap,ScopeNodes=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function defID(s){return(e,r)=>{let n=e.node.getChild("VariableDefinition");return n&&r(n,s),!0}}const functionContext=["FunctionDeclaration"],gatherCompletions={FunctionDeclaration:defID("function"),ClassDeclaration:defID("class"),ClassExpression:()=>!0,EnumDeclaration:defID("constant"),TypeAliasDeclaration:defID("type"),NamespaceDeclaration:defID("namespace"),VariableDefinition(s,e){s.matchContext(functionContext)||e(s,"variable")},TypeDefinition(s,e){e(s,"type")},__proto__:null};function getScope(s,e){let r=cache$1.get(e);if(r)return r;let n=[],o=!0;function a(l,c){let h=s.sliceString(l.from,l.to);n.push({label:h,type:c})}return e.cursor(IterMode.IncludeAnonymous).iterate(l=>{if(o)o=!1;else if(l.name){let c=gatherCompletions[l.name];if(c&&c(l,a)||ScopeNodes.has(l.name))return!1}else if(l.to-l.from>8192){for(let c of getScope(s,l.node))n.push(c);return!1}}),cache$1.set(e,n),n}const Identifier=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,dontComplete=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function localCompletionSource(s){let e=syntaxTree(s.state).resolveInner(s.pos,-1);if(dontComplete.indexOf(e.name)>-1)return null;let r=e.name=="VariableName"||e.to-e.from<20&&Identifier.test(s.state.sliceDoc(e.from,e.to));if(!r&&!s.explicit)return null;let n=[];for(let o=e;o;o=o.parent)ScopeNodes.has(o.name)&&(n=n.concat(getScope(s.state.doc,o)));return{options:n,from:r?e.from:s.pos,validFor:Identifier}}const javascriptLanguage=LRLanguage.define({name:"javascript",parser:parser$3.configure({props:[indentNodeProp.add({IfStatement:continuedIndent({except:/^\s*({|else\b)/}),TryStatement:continuedIndent({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:flatIndent,SwitchBody:s=>{let e=s.textAfter,r=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return s.baseIndent+(r?0:n?1:2)*s.unit},Block:delimitedIndent({closing:"}"}),ArrowFunction:s=>s.baseIndent+s.unit,"TemplateString BlockComment":()=>null,"Statement Property":continuedIndent({except:/^{/}),JSXElement(s){let e=/^\s*<\//.test(s.textAfter);return s.lineIndent(s.node.from)+(e?0:s.unit)},JSXEscape(s){let e=/\s*\}/.test(s.textAfter);return s.lineIndent(s.node.from)+(e?0:s.unit)},"JSXOpenTag JSXSelfClosingTag"(s){return s.column(s.node.from)+s.unit}}),foldNodeProp.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":foldInside,BlockComment(s){return{from:s.from+2,to:s.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),jsxSublanguage={test:s=>/^JSX/.test(s.name),facet:defineLanguageFacet({commentTokens:{block:{open:"{/*",close:"*/}"}}})},typescriptLanguage=javascriptLanguage.configure({dialect:"ts"},"typescript"),jsxLanguage=javascriptLanguage.configure({dialect:"jsx",props:[sublanguageProp.add(s=>s.isTop?[jsxSublanguage]:void 0)]}),tsxLanguage=javascriptLanguage.configure({dialect:"jsx ts",props:[sublanguageProp.add(s=>s.isTop?[jsxSublanguage]:void 0)]},"typescript"),keywords="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(s=>({label:s,type:"keyword"}));function javascript(s={}){let e=s.jsx?s.typescript?tsxLanguage:jsxLanguage:s.typescript?typescriptLanguage:javascriptLanguage;return new LanguageSupport(e,[javascriptLanguage.data.of({autocomplete:ifNotIn(dontComplete,completeFromList(snippets.concat(keywords)))}),javascriptLanguage.data.of({autocomplete:localCompletionSource}),s.jsx?autoCloseTags$1:[]])}function findOpenTag(s){for(;;){if(s.name=="JSXOpenTag"||s.name=="JSXSelfClosingTag"||s.name=="JSXFragmentTag")return s;if(s.name=="JSXEscape"||!s.parent)return null;s=s.parent}}function elementName$1(s,e,r=s.length){for(let n=e==null?void 0:e.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return s.sliceString(n.from,Math.min(n.to,r));return""}function isEndTag(s){return s&&(s.name=="JSXEndTag"||s.name=="JSXSelfCloseEndTag")}const android=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),autoCloseTags$1=EditorView.inputHandler.of((s,e,r,n)=>{if((android?s.composing:s.compositionStarted)||s.state.readOnly||e!=r||n!=">"&&n!="/"||!javascriptLanguage.isActiveAt(s.state,e,-1))return!1;let{state:o}=s,a=o.changeByRange(l=>{var c;let{head:h}=l,f=syntaxTree(o).resolveInner(h,-1),d;if(f.name=="JSXStartTag"&&(f=f.parent),!(f.name=="JSXAttributeValue"&&f.to>h)){if(n==">"&&f.name=="JSXFragmentTag")return{range:EditorSelection.cursor(h+1),changes:{from:h,insert:"></>"}};if(n=="/"&&f.name=="JSXFragmentTag"){let m=f.parent,v=m==null?void 0:m.parent;if(m.from==h-1&&((c=v.lastChild)===null||c===void 0?void 0:c.name)!="JSXEndTag"&&(d=elementName$1(o.doc,v==null?void 0:v.firstChild,h))){let A=`/${d}>`;return{range:EditorSelection.cursor(h+A.length),changes:{from:h,insert:A}}}}else if(n==">"){let m=findOpenTag(f);if(m&&!isEndTag(m.lastChild)&&o.sliceDoc(h,h+2)!="</"&&(d=elementName$1(o.doc,m,h)))return{range:EditorSelection.cursor(h+1),changes:{from:h,insert:`></${d}>`}}}}return{range:l}});return a.changes.empty?!1:(s.dispatch(a,{userEvent:"input.type",scrollIntoView:!0}),!0)});class CompositeBlock{static create(e,r,n,o,a){let l=o+(o<<8)+e+(r<<4)|0;return new CompositeBlock(e,r,n,l,a,[],[])}constructor(e,r,n,o,a,l,c){this.type=e,this.value=r,this.from=n,this.hash=o,this.end=a,this.children=l,this.positions=c,this.hashProp=[[NodeProp.contextHash,o]]}addChild(e,r){e.prop(NodeProp.contextHash)!=this.hash&&(e=new Tree(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(r)}toTree(e,r=this.end){let n=this.children.length-1;return n>=0&&(r=Math.max(r,this.positions[n]+this.children[n].length+this.from)),new Tree(e.types[this.type],this.children,this.positions,r-this.from).balance({makeTree:(o,a,l)=>new Tree(NodeType.none,o,a,l,this.hashProp)})}}var Type;(function(s){s[s.Document=1]="Document",s[s.CodeBlock=2]="CodeBlock",s[s.FencedCode=3]="FencedCode",s[s.Blockquote=4]="Blockquote",s[s.HorizontalRule=5]="HorizontalRule",s[s.BulletList=6]="BulletList",s[s.OrderedList=7]="OrderedList",s[s.ListItem=8]="ListItem",s[s.ATXHeading1=9]="ATXHeading1",s[s.ATXHeading2=10]="ATXHeading2",s[s.ATXHeading3=11]="ATXHeading3",s[s.ATXHeading4=12]="ATXHeading4",s[s.ATXHeading5=13]="ATXHeading5",s[s.ATXHeading6=14]="ATXHeading6",s[s.SetextHeading1=15]="SetextHeading1",s[s.SetextHeading2=16]="SetextHeading2",s[s.HTMLBlock=17]="HTMLBlock",s[s.LinkReference=18]="LinkReference",s[s.Paragraph=19]="Paragraph",s[s.CommentBlock=20]="CommentBlock",s[s.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",s[s.Escape=22]="Escape",s[s.Entity=23]="Entity",s[s.HardBreak=24]="HardBreak",s[s.Emphasis=25]="Emphasis",s[s.StrongEmphasis=26]="StrongEmphasis",s[s.Link=27]="Link",s[s.Image=28]="Image",s[s.InlineCode=29]="InlineCode",s[s.HTMLTag=30]="HTMLTag",s[s.Comment=31]="Comment",s[s.ProcessingInstruction=32]="ProcessingInstruction",s[s.URL=33]="URL",s[s.HeaderMark=34]="HeaderMark",s[s.QuoteMark=35]="QuoteMark",s[s.ListMark=36]="ListMark",s[s.LinkMark=37]="LinkMark",s[s.EmphasisMark=38]="EmphasisMark",s[s.CodeMark=39]="CodeMark",s[s.CodeText=40]="CodeText",s[s.CodeInfo=41]="CodeInfo",s[s.LinkTitle=42]="LinkTitle",s[s.LinkLabel=43]="LinkLabel"})(Type||(Type={}));class LeafBlock{constructor(e,r){this.start=e,this.content=r,this.marks=[],this.parsers=[]}}class Line{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return skipSpace(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,r=0,n=0){for(let o=r;o<e;o++)n+=this.text.charCodeAt(o)==9?4-n%4:1;return n}findColumn(e){let r=0;for(let n=0;r<this.text.length&&n<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return r}scrub(){if(!this.baseIndent)return this.text;let e="";for(let r=0;r<this.basePos;r++)e+=" ";return e+this.text.slice(this.basePos)}}function skipForList(s,e,r){if(r.pos==r.text.length||s!=e.block&&r.indent>=e.stack[r.depth+1].value+r.baseIndent)return!0;if(r.indent>=r.baseIndent+4)return!1;let n=(s.type==Type.OrderedList?isOrderedList:isBulletList)(r,e,!1);return n>0&&(s.type!=Type.BulletList||isHorizontalRule(r,e,!1)<0)&&r.text.charCodeAt(r.pos+n-1)==s.value}const DefaultSkipMarkup={[Type.Blockquote](s,e,r){return r.next!=62?!1:(r.markers.push(elt(Type.QuoteMark,e.lineStart+r.pos,e.lineStart+r.pos+1)),r.moveBase(r.pos+(space$1(r.text.charCodeAt(r.pos+1))?2:1)),s.end=e.lineStart+r.text.length,!0)},[Type.ListItem](s,e,r){return r.indent<r.baseIndent+s.value&&r.next>-1?!1:(r.moveBaseColumn(r.baseIndent+s.value),!0)},[Type.OrderedList]:skipForList,[Type.BulletList]:skipForList,[Type.Document](){return!0}};function space$1(s){return s==32||s==9||s==10||s==13}function skipSpace(s,e=0){for(;e<s.length&&space$1(s.charCodeAt(e));)e++;return e}function skipSpaceBack(s,e,r){for(;e>r&&space$1(s.charCodeAt(e-1));)e--;return e}function isFencedCode(s){if(s.next!=96&&s.next!=126)return-1;let e=s.pos+1;for(;e<s.text.length&&s.text.charCodeAt(e)==s.next;)e++;if(e<s.pos+3)return-1;if(s.next==96){for(let r=e;r<s.text.length;r++)if(s.text.charCodeAt(r)==96)return-1}return e}function isBlockquote(s){return s.next!=62?-1:s.text.charCodeAt(s.pos+1)==32?2:1}function isHorizontalRule(s,e,r){if(s.next!=42&&s.next!=45&&s.next!=95)return-1;let n=1;for(let o=s.pos+1;o<s.text.length;o++){let a=s.text.charCodeAt(o);if(a==s.next)n++;else if(!space$1(a))return-1}return r&&s.next==45&&isSetextUnderline(s)>-1&&s.depth==e.stack.length||n<3?-1:1}function inList(s,e){for(let r=s.stack.length-1;r>=0;r--)if(s.stack[r].type==e)return!0;return!1}function isBulletList(s,e,r){return(s.next==45||s.next==43||s.next==42)&&(s.pos==s.text.length-1||space$1(s.text.charCodeAt(s.pos+1)))&&(!r||inList(e,Type.BulletList)||s.skipSpace(s.pos+2)<s.text.length)?1:-1}function isOrderedList(s,e,r){let n=s.pos,o=s.next;for(;o>=48&&o<=57;){n++;if(n==s.text.length)return-1;o=s.text.charCodeAt(n)}return n==s.pos||n>s.pos+9||o!=46&&o!=41||n<s.text.length-1&&!space$1(s.text.charCodeAt(n+1))||r&&!inList(e,Type.OrderedList)&&(s.skipSpace(n+1)==s.text.length||n>s.pos+1||s.next!=49)?-1:n+1-s.pos}function isAtxHeading(s){if(s.next!=35)return-1;let e=s.pos+1;for(;e<s.text.length&&s.text.charCodeAt(e)==35;)e++;if(e<s.text.length&&s.text.charCodeAt(e)!=32)return-1;let r=e-s.pos;return r>6?-1:r}function isSetextUnderline(s){if(s.next!=45&&s.next!=61||s.indent>=s.baseIndent+4)return-1;let e=s.pos+1;for(;e<s.text.length&&s.text.charCodeAt(e)==s.next;)e++;let r=e;for(;e<s.text.length&&space$1(s.text.charCodeAt(e));)e++;return e==s.text.length?r:-1}const EmptyLine=/^[ \t]*$/,CommentEnd=/-->/,ProcessingEnd=/\?>/,HTMLBlockStyle=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,CommentEnd],[/^\s*<\?/,ProcessingEnd],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,EmptyLine],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,EmptyLine]];function isHTMLBlock(s,e,r){if(s.next!=60)return-1;let n=s.text.slice(s.pos);for(let o=0,a=HTMLBlockStyle.length-(r?1:0);o<a;o++)if(HTMLBlockStyle[o][0].test(n))return o;return-1}function getListIndent(s,e){let r=s.countIndent(e,s.pos,s.indent),n=s.countIndent(s.skipSpace(e),e,r);return n>=r+5?r+1:n}function addCodeText(s,e,r){let n=s.length-1;n>=0&&s[n].to==e&&s[n].type==Type.CodeText?s[n].to=r:s.push(elt(Type.CodeText,e,r))}const DefaultBlockParsers={LinkReference:void 0,IndentedCode(s,e){let r=e.baseIndent+4;if(e.indent<r)return!1;let n=e.findColumn(r),o=s.lineStart+n,a=s.lineStart+e.text.length,l=[],c=[];for(addCodeText(l,o,a);s.nextLine()&&e.depth>=s.stack.length;)if(e.pos==e.text.length){addCodeText(c,s.lineStart-1,s.lineStart);for(let h of e.markers)c.push(h)}else{if(e.indent<r)break;{if(c.length){for(let f of c)f.type==Type.CodeText?addCodeText(l,f.from,f.to):l.push(f);c=[]}addCodeText(l,s.lineStart-1,s.lineStart);for(let f of e.markers)l.push(f);a=s.lineStart+e.text.length;let h=s.lineStart+e.findColumn(e.baseIndent+4);h<a&&addCodeText(l,h,a)}}return c.length&&(c=c.filter(h=>h.type!=Type.CodeText),c.length&&(e.markers=c.concat(e.markers))),s.addNode(s.buffer.writeElements(l,-o).finish(Type.CodeBlock,a-o),o),!0},FencedCode(s,e){let r=isFencedCode(e);if(r<0)return!1;let n=s.lineStart+e.pos,o=e.next,a=r-e.pos,l=e.skipSpace(r),c=skipSpaceBack(e.text,e.text.length,l),h=[elt(Type.CodeMark,n,n+a)];l<c&&h.push(elt(Type.CodeInfo,s.lineStart+l,s.lineStart+c));for(let f=!0;s.nextLine()&&e.depth>=s.stack.length;f=!1){let d=e.pos;if(e.indent-e.baseIndent<4)for(;d<e.text.length&&e.text.charCodeAt(d)==o;)d++;if(d-e.pos>=a&&e.skipSpace(d)==e.text.length){for(let m of e.markers)h.push(m);h.push(elt(Type.CodeMark,s.lineStart+e.pos,s.lineStart+d)),s.nextLine();break}else{f||addCodeText(h,s.lineStart-1,s.lineStart);for(let A of e.markers)h.push(A);let m=s.lineStart+e.basePos,v=s.lineStart+e.text.length;m<v&&addCodeText(h,m,v)}}return s.addNode(s.buffer.writeElements(h,-n).finish(Type.FencedCode,s.prevLineEnd()-n),n),!0},Blockquote(s,e){let r=isBlockquote(e);return r<0?!1:(s.startContext(Type.Blockquote,e.pos),s.addNode(Type.QuoteMark,s.lineStart+e.pos,s.lineStart+e.pos+1),e.moveBase(e.pos+r),null)},HorizontalRule(s,e){if(isHorizontalRule(e,s,!1)<0)return!1;let r=s.lineStart+e.pos;return s.nextLine(),s.addNode(Type.HorizontalRule,r),!0},BulletList(s,e){let r=isBulletList(e,s,!1);if(r<0)return!1;s.block.type!=Type.BulletList&&s.startContext(Type.BulletList,e.basePos,e.next);let n=getListIndent(e,e.pos+1);return s.startContext(Type.ListItem,e.basePos,n-e.baseIndent),s.addNode(Type.ListMark,s.lineStart+e.pos,s.lineStart+e.pos+r),e.moveBaseColumn(n),null},OrderedList(s,e){let r=isOrderedList(e,s,!1);if(r<0)return!1;s.block.type!=Type.OrderedList&&s.startContext(Type.OrderedList,e.basePos,e.text.charCodeAt(e.pos+r-1));let n=getListIndent(e,e.pos+r);return s.startContext(Type.ListItem,e.basePos,n-e.baseIndent),s.addNode(Type.ListMark,s.lineStart+e.pos,s.lineStart+e.pos+r),e.moveBaseColumn(n),null},ATXHeading(s,e){let r=isAtxHeading(e);if(r<0)return!1;let n=e.pos,o=s.lineStart+n,a=skipSpaceBack(e.text,e.text.length,n),l=a;for(;l>n&&e.text.charCodeAt(l-1)==e.next;)l--;(l==a||l==n||!space$1(e.text.charCodeAt(l-1)))&&(l=e.text.length);let c=s.buffer.write(Type.HeaderMark,0,r).writeElements(s.parser.parseInline(e.text.slice(n+r+1,l),o+r+1),-o);l<e.text.length&&c.write(Type.HeaderMark,l-n,a-n);let h=c.finish(Type.ATXHeading1-1+r,e.text.length-n);return s.nextLine(),s.addNode(h,o),!0},HTMLBlock(s,e){let r=isHTMLBlock(e,s,!1);if(r<0)return!1;let n=s.lineStart+e.pos,o=HTMLBlockStyle[r][1],a=[],l=o!=EmptyLine;for(;!o.test(e.text)&&s.nextLine();){if(e.depth<s.stack.length){l=!1;break}for(let f of e.markers)a.push(f)}l&&s.nextLine();let c=o==CommentEnd?Type.CommentBlock:o==ProcessingEnd?Type.ProcessingInstructionBlock:Type.HTMLBlock,h=s.prevLineEnd();return s.addNode(s.buffer.writeElements(a,-n).finish(c,h-n),n),!0},SetextHeading:void 0};class LinkReferenceParser{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,r,n){if(this.stage==-1)return!1;let o=n.content+`
|
||
`+r.scrub(),a=this.advance(o);return a>-1&&a<o.length?this.complete(e,n,a):!1}finish(e,r){return(this.stage==2||this.stage==3)&&skipSpace(r.content,this.pos)==r.content.length?this.complete(e,r,r.content.length):!1}complete(e,r,n){return e.addLeafElement(r,elt(Type.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(parseLinkLabel(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(elt(Type.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(parseURL(e,skipSpace(e,this.pos),this.start)))return-1}else if(this.stage==2){let r=skipSpace(e,this.pos),n=0;if(r>this.pos){let o=parseLinkTitle(e,r,this.start);if(o){let a=lineEnd(e,o.to-this.start);a>0&&(this.nextStage(o),n=a)}}return n||(n=lineEnd(e,this.pos)),n>0&&n<e.length?n:-1}else return lineEnd(e,this.pos)}}}function lineEnd(s,e){for(;e<s.length;e++){let r=s.charCodeAt(e);if(r==10)break;if(!space$1(r))return-1}return e}class SetextHeadingParser{nextLine(e,r,n){let o=r.depth<e.stack.length?-1:isSetextUnderline(r),a=r.next;if(o<0)return!1;let l=elt(Type.HeaderMark,e.lineStart+r.pos,e.lineStart+o);return e.nextLine(),e.addLeafElement(n,elt(a==61?Type.SetextHeading1:Type.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),l])),!0}finish(){return!1}}const DefaultLeafBlocks={LinkReference(s,e){return e.content.charCodeAt(0)==91?new LinkReferenceParser(e):null},SetextHeading(){return new SetextHeadingParser}},DefaultEndLeaf=[(s,e)=>isAtxHeading(e)>=0,(s,e)=>isFencedCode(e)>=0,(s,e)=>isBlockquote(e)>=0,(s,e)=>isBulletList(e,s,!0)>=0,(s,e)=>isOrderedList(e,s,!0)>=0,(s,e)=>isHorizontalRule(e,s,!0)>=0,(s,e)=>isHTMLBlock(e,s,!0)>=0],scanLineResult={text:"",end:0};class BlockContext{constructor(e,r,n,o){this.parser=e,this.input=r,this.ranges=o,this.line=new Line,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=o[o.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=o[0].from,this.block=CompositeBlock.create(Type.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new FragmentCursor(n,r):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(;e.depth<this.stack.length;)this.finishContext();for(let n of e.markers)this.addNode(n.type,n.from,n.to);if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let n of this.parser.blockParsers)if(n){let o=n(this,e);if(o!=!1){if(o==!0)return null;e.forward();continue e}}break}let r=new LeafBlock(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let o=n(this,r);o&&r.parsers.push(o)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,r))break e}for(let n of r.parsers)if(n.nextLine(this,e,r))return null;r.content+=`
|
||
`+e.scrub();for(let n of e.markers)r.marks.push(n)}return this.finishLeaf(r),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let r=this.fragments.takeNodes(this);return r?(this.absoluteLineStart+=r,this.lineStart=toRelative(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let r=scanLineResult;if(r.end=e,e>=this.to)r.text="";else if(r.text=this.lineChunkAt(e),r.end+=r.text.length,this.ranges.length>1){let n=this.absoluteLineStart,o=this.rangeI;for(;this.ranges[o].to<r.end;){o++;let a=this.ranges[o].from,l=this.lineChunkAt(a);r.end=a+l.length,r.text=r.text.slice(0,this.ranges[o-1].to-n)+l,n=r.end-r.text.length}}return r}readLine(){let{line:e}=this,{text:r,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(r);e.depth<this.stack.length;e.depth++){let o=this.stack[e.depth],a=this.parser.skipContextMarkup[o.type];if(!a)throw new Error("Unhandled block context "+Type[o.type]);if(!a(o,this,e))break;e.forward()}}lineChunkAt(e){let r=this.input.chunk(e),n;if(this.input.lineChunks)n=r==`
|
||
`?"":r;else{let o=r.indexOf(`
|
||
`);n=o<0?r:r.slice(0,o)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,r,n=0){this.block=CompositeBlock.create(e,n,this.lineStart+r,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,r,n=0){this.startContext(this.parser.getNodeType(e),r,n)}addNode(e,r,n){typeof e=="number"&&(e=new Tree(this.parser.nodeSet.types[e],none,none,(n??this.prevLineEnd())-r)),this.block.addChild(e,r-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,r){this.addNode(this.buffer.writeElements(injectMarks(r.children,e.marks),-r.from).finish(r.type,r.to-r.from),r.from)}finishContext(){let e=this.stack.pop(),r=this.stack[this.stack.length-1];r.addChild(e.toTree(this.parser.nodeSet),e.from-r.from),this.block=r}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?injectGaps(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let r=injectMarks(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(r,-e.start).finish(Type.Paragraph,e.content.length),e.start)}elt(e,r,n,o){return typeof e=="string"?elt(this.parser.getNodeType(e),r,n,o):new TreeElement(e,r)}get buffer(){return new Buffer(this.parser.nodeSet)}}function injectGaps(s,e,r,n,o){let a=s[e].to,l=[],c=[],h=r.from+n;function f(d,m){for(;m?d>=a:d>a;){let v=s[e+1].from-a;n+=v,d+=v,e++,a=s[e].to}}for(let d=r.firstChild;d;d=d.nextSibling){f(d.from+n,!0);let m=d.from+n,v,A=o.get(d.tree);A?v=A:d.to+n>a?(v=injectGaps(s,e,d,n,o),f(d.to+n,!1)):v=d.toTree(),l.push(v),c.push(m-h)}return f(r.to+n,!1),new Tree(r.type,l,c,r.to+n-h,r.tree?r.tree.propValues:void 0)}class MarkdownParser extends Parser{constructor(e,r,n,o,a,l,c,h,f){super(),this.nodeSet=e,this.blockParsers=r,this.leafBlockParsers=n,this.blockNames=o,this.endLeafBlock=a,this.skipContextMarkup=l,this.inlineParsers=c,this.inlineNames=h,this.wrappers=f,this.nodeTypes=Object.create(null);for(let d of e.types)this.nodeTypes[d.name]=d.id}createParse(e,r,n){let o=new BlockContext(this,e,r,n);for(let a of this.wrappers)o=a(o,e,r,n);return o}configure(e){let r=resolveConfig(e);if(!r)return this;let{nodeSet:n,skipContextMarkup:o}=this,a=this.blockParsers.slice(),l=this.leafBlockParsers.slice(),c=this.blockNames.slice(),h=this.inlineParsers.slice(),f=this.inlineNames.slice(),d=this.endLeafBlock.slice(),m=this.wrappers;if(nonEmpty(r.defineNodes)){o=Object.assign({},o);let v=n.types.slice(),A;for(let T of r.defineNodes){let{name:B,block:Y,composite:F,style:ke}=typeof T=="string"?{name:T}:T;if(v.some(Te=>Te.name==B))continue;F&&(o[v.length]=(Te,Le,Me)=>F(Le,Me,Te.value));let Qe=v.length,xe=F?["Block","BlockContext"]:Y?Qe>=Type.ATXHeading1&&Qe<=Type.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;v.push(NodeType.define({id:Qe,name:B,props:xe&&[[NodeProp.group,xe]]})),ke&&(A||(A={}),Array.isArray(ke)||ke instanceof Tag?A[B]=ke:Object.assign(A,ke))}n=new NodeSet(v),A&&(n=n.extend(styleTags(A)))}if(nonEmpty(r.props)&&(n=n.extend(...r.props)),nonEmpty(r.remove))for(let v of r.remove){let A=this.blockNames.indexOf(v),T=this.inlineNames.indexOf(v);A>-1&&(a[A]=l[A]=void 0),T>-1&&(h[T]=void 0)}if(nonEmpty(r.parseBlock))for(let v of r.parseBlock){let A=c.indexOf(v.name);if(A>-1)a[A]=v.parse,l[A]=v.leaf;else{let T=v.before?findName(c,v.before):v.after?findName(c,v.after)+1:c.length-1;a.splice(T,0,v.parse),l.splice(T,0,v.leaf),c.splice(T,0,v.name)}v.endLeaf&&d.push(v.endLeaf)}if(nonEmpty(r.parseInline))for(let v of r.parseInline){let A=f.indexOf(v.name);if(A>-1)h[A]=v.parse;else{let T=v.before?findName(f,v.before):v.after?findName(f,v.after)+1:f.length-1;h.splice(T,0,v.parse),f.splice(T,0,v.name)}}return r.wrap&&(m=m.concat(r.wrap)),new MarkdownParser(n,a,l,c,d,o,h,f,m)}getNodeType(e){let r=this.nodeTypes[e];if(r==null)throw new RangeError(`Unknown node type '${e}'`);return r}parseInline(e,r){let n=new InlineContext(this,e,r);e:for(let o=r;o<n.end;){let a=n.char(o);for(let l of this.inlineParsers)if(l){let c=l(n,a,o);if(c>=0){o=c;continue e}}o++}return n.resolveMarkers(0)}}function nonEmpty(s){return s!=null&&s.length>0}function resolveConfig(s){if(!Array.isArray(s))return s;if(s.length==0)return null;let e=resolveConfig(s[0]);if(s.length==1)return e;let r=resolveConfig(s.slice(1));if(!r||!e)return e||r;let n=(l,c)=>(l||none).concat(c||none),o=e.wrap,a=r.wrap;return{props:n(e.props,r.props),defineNodes:n(e.defineNodes,r.defineNodes),parseBlock:n(e.parseBlock,r.parseBlock),parseInline:n(e.parseInline,r.parseInline),remove:n(e.remove,r.remove),wrap:o?a?(l,c,h,f)=>o(a(l,c,h,f),c,h,f):o:a}}function findName(s,e){let r=s.indexOf(e);if(r<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return r}let nodeTypes=[NodeType.none];for(let s=1,e;e=Type[s];s++)nodeTypes[s]=NodeType.define({id:s,name:e,props:s>=Type.Escape?[]:[[NodeProp.group,s in DefaultSkipMarkup?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});const none=[];class Buffer{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,r,n,o=0){return this.content.push(e,r,n,4+o*4),this}writeElements(e,r=0){for(let n of e)n.writeTo(this,r);return this}finish(e,r){return Tree.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:e,length:r})}}let Element$1=class{constructor(e,r,n,o=none){this.type=e,this.from=r,this.to=n,this.children=o}writeTo(e,r){let n=e.content.length;e.writeElements(this.children,r),e.content.push(this.type,this.from+r,this.to+r,e.content.length+4-n)}toTree(e){return new Buffer(e).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};class TreeElement{constructor(e,r){this.tree=e,this.from=r}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return none}writeTo(e,r){e.nodes.push(this.tree),e.content.push(e.nodes.length-1,this.from+r,this.to+r,-1)}toTree(){return this.tree}}function elt(s,e,r,n){return new Element$1(s,e,r,n)}const EmphasisUnderscore={resolve:"Emphasis",mark:"EmphasisMark"},EmphasisAsterisk={resolve:"Emphasis",mark:"EmphasisMark"},LinkStart={},ImageStart={};class InlineDelimiter{constructor(e,r,n,o){this.type=e,this.from=r,this.to=n,this.side=o}}const Escapable="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let Punctuation=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{Punctuation=new RegExp("[\\p{Pc}|\\p{Pd}|\\p{Pe}|\\p{Pf}|\\p{Pi}|\\p{Po}|\\p{Ps}]","u")}catch{}const DefaultInline={Escape(s,e,r){if(e!=92||r==s.end-1)return-1;let n=s.char(r+1);for(let o=0;o<Escapable.length;o++)if(Escapable.charCodeAt(o)==n)return s.append(elt(Type.Escape,r,r+2));return-1},Entity(s,e,r){if(e!=38)return-1;let n=/^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(s.slice(r+1,r+31));return n?s.append(elt(Type.Entity,r,r+1+n[0].length)):-1},InlineCode(s,e,r){if(e!=96||r&&s.char(r-1)==96)return-1;let n=r+1;for(;n<s.end&&s.char(n)==96;)n++;let o=n-r,a=0;for(;n<s.end;n++)if(s.char(n)==96){if(a++,a==o&&s.char(n+1)!=96)return s.append(elt(Type.InlineCode,r,n+1,[elt(Type.CodeMark,r,r+o),elt(Type.CodeMark,n+1-o,n+1)]))}else a=0;return-1},HTMLTag(s,e,r){if(e!=60||r==s.end-1)return-1;let n=s.slice(r+1,s.end),o=/^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(n);if(o)return s.append(elt(Type.URL,r,r+1+o[0].length));let a=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(n);if(a)return s.append(elt(Type.Comment,r,r+1+a[0].length));let l=/^\?[^]*?\?>/.exec(n);if(l)return s.append(elt(Type.ProcessingInstruction,r,r+1+l[0].length));let c=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(n);return c?s.append(elt(Type.HTMLTag,r,r+1+c[0].length)):-1},Emphasis(s,e,r){if(e!=95&&e!=42)return-1;let n=r+1;for(;s.char(n)==e;)n++;let o=s.slice(r-1,r),a=s.slice(n,n+1),l=Punctuation.test(o),c=Punctuation.test(a),h=/\s|^$/.test(o),f=/\s|^$/.test(a),d=!f&&(!c||h||l),m=!h&&(!l||f||c),v=d&&(e==42||!m||l),A=m&&(e==42||!d||c);return s.append(new InlineDelimiter(e==95?EmphasisUnderscore:EmphasisAsterisk,r,n,(v?1:0)|(A?2:0)))},HardBreak(s,e,r){if(e==92&&s.char(r+1)==10)return s.append(elt(Type.HardBreak,r,r+2));if(e==32){let n=r+1;for(;s.char(n)==32;)n++;if(s.char(n)==10&&n>=r+2)return s.append(elt(Type.HardBreak,r,n+1))}return-1},Link(s,e,r){return e==91?s.append(new InlineDelimiter(LinkStart,r,r+1,1)):-1},Image(s,e,r){return e==33&&s.char(r+1)==91?s.append(new InlineDelimiter(ImageStart,r,r+2,1)):-1},LinkEnd(s,e,r){if(e!=93)return-1;for(let n=s.parts.length-1;n>=0;n--){let o=s.parts[n];if(o instanceof InlineDelimiter&&(o.type==LinkStart||o.type==ImageStart)){if(!o.side||s.skipSpace(o.to)==r&&!/[(\[]/.test(s.slice(r+1,r+2)))return s.parts[n]=null,-1;let a=s.takeContent(n),l=s.parts[n]=finishLink(s,a,o.type==LinkStart?Type.Link:Type.Image,o.from,r+1);if(o.type==LinkStart)for(let c=0;c<n;c++){let h=s.parts[c];h instanceof InlineDelimiter&&h.type==LinkStart&&(h.side=0)}return l.to}}return-1}};function finishLink(s,e,r,n,o){let{text:a}=s,l=s.char(o),c=o;if(e.unshift(elt(Type.LinkMark,n,n+(r==Type.Image?2:1))),e.push(elt(Type.LinkMark,o-1,o)),l==40){let h=s.skipSpace(o+1),f=parseURL(a,h-s.offset,s.offset),d;f&&(h=s.skipSpace(f.to),d=parseLinkTitle(a,h-s.offset,s.offset),d&&(h=s.skipSpace(d.to))),s.char(h)==41&&(e.push(elt(Type.LinkMark,o,o+1)),c=h+1,f&&e.push(f),d&&e.push(d),e.push(elt(Type.LinkMark,h,c)))}else if(l==91){let h=parseLinkLabel(a,o-s.offset,s.offset,!1);h&&(e.push(h),c=h.to)}return elt(r,n,c,e)}function parseURL(s,e,r){if(s.charCodeAt(e)==60){for(let o=e+1;o<s.length;o++){let a=s.charCodeAt(o);if(a==62)return elt(Type.URL,e+r,o+1+r);if(a==60||a==10)return!1}return null}else{let o=0,a=e;for(let l=!1;a<s.length;a++){let c=s.charCodeAt(a);if(space$1(c))break;if(l)l=!1;else if(c==40)o++;else if(c==41){if(!o)break;o--}else c==92&&(l=!0)}return a>e?elt(Type.URL,e+r,a+r):a==s.length?null:!1}}function parseLinkTitle(s,e,r){let n=s.charCodeAt(e);if(n!=39&&n!=34&&n!=40)return!1;let o=n==40?41:n;for(let a=e+1,l=!1;a<s.length;a++){let c=s.charCodeAt(a);if(l)l=!1;else{if(c==o)return elt(Type.LinkTitle,e+r,a+1+r);c==92&&(l=!0)}}return null}function parseLinkLabel(s,e,r,n){for(let o=!1,a=e+1,l=Math.min(s.length,a+999);a<l;a++){let c=s.charCodeAt(a);if(o)o=!1;else{if(c==93)return n?!1:elt(Type.LinkLabel,e+r,a+1+r);if(n&&!space$1(c)&&(n=!1),c==91)return!1;c==92&&(o=!0)}}return null}class InlineContext{constructor(e,r,n){this.parser=e,this.text=r,this.offset=n,this.parts=[]}char(e){return e>=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,r){return this.text.slice(e-this.offset,r-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,r,n,o,a){return this.append(new InlineDelimiter(e,r,n,(o?1:0)|(a?2:0)))}addElement(e){return this.append(e)}resolveMarkers(e){for(let n=e;n<this.parts.length;n++){let o=this.parts[n];if(!(o instanceof InlineDelimiter&&o.type.resolve&&o.side&2))continue;let a=o.type==EmphasisUnderscore||o.type==EmphasisAsterisk,l=o.to-o.from,c,h=n-1;for(;h>=e;h--){let B=this.parts[h];if(B instanceof InlineDelimiter&&B.side&1&&B.type==o.type&&!(a&&(o.side&1||B.side&2)&&(B.to-B.from+l)%3==0&&((B.to-B.from)%3||l%3))){c=B;break}}if(!c)continue;let f=o.type.resolve,d=[],m=c.from,v=o.to;if(a){let B=Math.min(2,c.to-c.from,l);m=c.to-B,v=o.from+B,f=B==1?"Emphasis":"StrongEmphasis"}c.type.mark&&d.push(this.elt(c.type.mark,m,c.to));for(let B=h+1;B<n;B++)this.parts[B]instanceof Element$1&&d.push(this.parts[B]),this.parts[B]=null;o.type.mark&&d.push(this.elt(o.type.mark,o.from,v));let A=this.elt(f,m,v,d);this.parts[h]=a&&c.from!=m?new InlineDelimiter(c.type,c.from,m,c.side):null,(this.parts[n]=a&&o.to!=v?new InlineDelimiter(o.type,v,o.to,o.side):null)?this.parts.splice(n,0,A):this.parts[n]=A}let r=[];for(let n=e;n<this.parts.length;n++){let o=this.parts[n];o instanceof Element$1&&r.push(o)}return r}findOpeningDelimiter(e){for(let r=this.parts.length-1;r>=0;r--){let n=this.parts[r];if(n instanceof InlineDelimiter&&n.type==e)return r}return null}takeContent(e){let r=this.resolveMarkers(e);return this.parts.length=e,r}skipSpace(e){return skipSpace(this.text,e-this.offset)+this.offset}elt(e,r,n,o){return typeof e=="string"?elt(this.parser.getNodeType(e),r,n,o):new TreeElement(e,r)}}function injectMarks(s,e){if(!e.length)return s;if(!s.length)return e;let r=s.slice(),n=0;for(let o of e){for(;n<r.length&&r[n].to<o.to;)n++;if(n<r.length&&r[n].from<o.from){let a=r[n];a instanceof Element$1&&(r[n]=new Element$1(a.type,a.from,a.to,injectMarks(a.children,[o])))}else r.splice(n++,0,o)}return r}const NotLast=[Type.CodeBlock,Type.ListItem,Type.OrderedList,Type.BulletList];class FragmentCursor{constructor(e,r){this.fragments=e,this.input=r,this.i=0,this.fragment=null,this.fragmentEnd=-1,this.cursor=null,e.length&&(this.fragment=e[this.i++])}nextFragment(){this.fragment=this.i<this.fragments.length?this.fragments[this.i++]:null,this.cursor=null,this.fragmentEnd=-1}moveTo(e,r){for(;this.fragment&&this.fragment.to<=e;)this.nextFragment();if(!this.fragment||this.fragment.from>(e?e-1:0))return!1;if(this.fragmentEnd<0){let a=this.fragment.to;for(;a>0&&this.input.read(a-1,a)!=`
|
||
`;)a--;this.fragmentEnd=a?a-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let o=e+this.fragment.offset;for(;n.to<=o;)if(!n.parent())return!1;for(;;){if(n.from>=o)return this.fragment.from<=r;if(!n.childAfter(o))return!1}}matches(e){let r=this.cursor.tree;return r&&r.prop(NodeProp.contextHash)==e}takeNodes(e){let r=this.cursor,n=this.fragment.offset,o=this.fragmentEnd-(this.fragment.openEnd?1:0),a=e.absoluteLineStart,l=a,c=e.block.children.length,h=l,f=c;for(;;){if(r.to-n>o){if(r.type.isAnonymous&&r.firstChild())continue;break}let d=toRelative(r.from-n,e.ranges);if(r.to-n<=e.ranges[e.rangeI].to)e.addNode(r.tree,d);else{let m=new Tree(e.parser.nodeSet.types[Type.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(m,r.tree),e.addNode(m,d)}if(r.type.is("Block")&&(NotLast.indexOf(r.type.id)<0?(l=r.to-n,c=e.block.children.length):(l=h,c=f,h=r.to-n,f=e.block.children.length)),!r.nextSibling())break}for(;e.block.children.length>c;)e.block.children.pop(),e.block.positions.pop();return l-a}}function toRelative(s,e){let r=s;for(let n=1;n<e.length;n++){let o=e[n-1].to,a=e[n].from;o<s&&(r-=a-o)}return r}const markdownHighlighting=styleTags({"Blockquote/...":tags$1.quote,HorizontalRule:tags$1.contentSeparator,"ATXHeading1/... SetextHeading1/...":tags$1.heading1,"ATXHeading2/... SetextHeading2/...":tags$1.heading2,"ATXHeading3/...":tags$1.heading3,"ATXHeading4/...":tags$1.heading4,"ATXHeading5/...":tags$1.heading5,"ATXHeading6/...":tags$1.heading6,"Comment CommentBlock":tags$1.comment,Escape:tags$1.escape,Entity:tags$1.character,"Emphasis/...":tags$1.emphasis,"StrongEmphasis/...":tags$1.strong,"Link/... Image/...":tags$1.link,"OrderedList/... BulletList/...":tags$1.list,"BlockQuote/...":tags$1.quote,"InlineCode CodeText":tags$1.monospace,URL:tags$1.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":tags$1.processingInstruction,"CodeInfo LinkLabel":tags$1.labelName,LinkTitle:tags$1.string,Paragraph:tags$1.content}),parser$2=new MarkdownParser(new NodeSet(nodeTypes).extend(markdownHighlighting),Object.keys(DefaultBlockParsers).map(s=>DefaultBlockParsers[s]),Object.keys(DefaultBlockParsers).map(s=>DefaultLeafBlocks[s]),Object.keys(DefaultBlockParsers),DefaultEndLeaf,DefaultSkipMarkup,Object.keys(DefaultInline).map(s=>DefaultInline[s]),Object.keys(DefaultInline),[]);function leftOverSpace(s,e,r){let n=[];for(let o=s.firstChild,a=e;;o=o.nextSibling){let l=o?o.from:r;if(l>a&&n.push({from:a,to:l}),!o)break;a=o.to}return n}function parseCode(s){let{codeParser:e,htmlParser:r}=s;return{wrap:parseMixed((o,a)=>{let l=o.type.id;if(e&&(l==Type.CodeBlock||l==Type.FencedCode)){let c="";if(l==Type.FencedCode){let f=o.node.getChild(Type.CodeInfo);f&&(c=a.read(f.from,f.to))}let h=e(c);if(h)return{parser:h,overlay:f=>f.type.id==Type.CodeText}}else if(r&&(l==Type.HTMLBlock||l==Type.HTMLTag))return{parser:r,overlay:leftOverSpace(o.node,o.from,o.to)};return null})}}const StrikethroughDelim={resolve:"Strikethrough",mark:"StrikethroughMark"},Strikethrough={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":tags$1.strikethrough}},{name:"StrikethroughMark",style:tags$1.processingInstruction}],parseInline:[{name:"Strikethrough",parse(s,e,r){if(e!=126||s.char(r+1)!=126||s.char(r+2)==126)return-1;let n=s.slice(r-1,r),o=s.slice(r+2,r+3),a=/\s|^$/.test(n),l=/\s|^$/.test(o),c=Punctuation.test(n),h=Punctuation.test(o);return s.addDelimiter(StrikethroughDelim,r,r+2,!l&&(!h||a||c),!a&&(!c||l||h))},after:"Emphasis"}]};function parseRow(s,e,r=0,n,o=0){let a=0,l=!0,c=-1,h=-1,f=!1,d=()=>{n.push(s.elt("TableCell",o+c,o+h,s.parser.parseInline(e.slice(c,h),o+c)))};for(let m=r;m<e.length;m++){let v=e.charCodeAt(m);v==124&&!f?((!l||c>-1)&&a++,l=!1,n&&(c>-1&&d(),n.push(s.elt("TableDelimiter",m+o,m+o+1))),c=h=-1):(f||v!=32&&v!=9)&&(c<0&&(c=m),h=m+1),f=!f&&v==92}return c>-1&&(a++,n&&d()),a}function hasPipe(s,e){for(let r=e;r<s.length;r++){let n=s.charCodeAt(r);if(n==124)return!0;n==92&&r++}return!1}const delimiterLine=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class TableParser{constructor(){this.rows=null}nextLine(e,r,n){if(this.rows==null){this.rows=!1;let o;if((r.next==45||r.next==58||r.next==124)&&delimiterLine.test(o=r.text.slice(r.pos))){let a=[];parseRow(e,n.content,0,a,n.start)==parseRow(e,o,r.pos)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,a),e.elt("TableDelimiter",e.lineStart+r.pos,e.lineStart+r.text.length)])}}else if(this.rows){let o=[];parseRow(e,r.text,r.pos,o,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+r.pos,e.lineStart+r.text.length,o))}return!1}finish(e,r){return this.rows?(e.addLeafElement(r,e.elt("Table",r.start,r.start+r.content.length,this.rows)),!0):!1}}const Table={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":tags$1.heading}},"TableRow",{name:"TableCell",style:tags$1.content},{name:"TableDelimiter",style:tags$1.processingInstruction}],parseBlock:[{name:"Table",leaf(s,e){return hasPipe(e.content,0)?new TableParser:null},endLeaf(s,e,r){if(r.parsers.some(o=>o instanceof TableParser)||!hasPipe(e.text,e.basePos))return!1;let n=s.scanLine(s.absoluteLineEnd+1).text;return delimiterLine.test(n)&&parseRow(s,e.text,e.basePos)==parseRow(s,n,e.basePos)},before:"SetextHeading"}]};class TaskParser{nextLine(){return!1}finish(e,r){return e.addLeafElement(r,e.elt("Task",r.start,r.start+r.content.length,[e.elt("TaskMarker",r.start,r.start+3),...e.parser.parseInline(r.content.slice(3),r.start+3)])),!0}}const TaskList={defineNodes:[{name:"Task",block:!0,style:tags$1.list},{name:"TaskMarker",style:tags$1.atom}],parseBlock:[{name:"TaskList",leaf(s,e){return/^\[[ xX]\][ \t]/.test(e.content)&&s.parentType().name=="ListItem"?new TaskParser:null},after:"SetextHeading"}]},autolinkRE=/(www\.)|(https?:\/\/)|([\w.+-]+@)|(mailto:|xmpp:)/gy,urlRE=/[\w-]+(\.\w+(\.\w+)?)(\/[^\s<]*)?/gy,emailRE=/[\w.+-]+@[\w-]+\.[\w.-]+/gy,xmppResourceRE=/\/[a-zA-Z\d@.]+/gy;function count(s,e,r,n){let o=0;for(let a=e;a<r;a++)s[a]==n&&o++;return o}function autolinkURLEnd(s,e){urlRE.lastIndex=e;let r=urlRE.exec(s);if(!r)return-1;let n=e+r[0].length;for(;;){let o=s[n-1],a;if(/[?!.,:*_~]/.test(o)||o==")"&&count(s,e,n,")")>count(s,e,n,"("))n--;else if(o==";"&&(a=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(s.slice(e,n))))n=e+a.index;else break}return n}function autolinkEmailEnd(s,e){emailRE.lastIndex=e;let r=emailRE.exec(s);if(!r)return-1;let n=r[0][r[0].length-1];return n=="_"||n=="-"?-1:e+r[0].length-(n=="."?1:0)}const Autolink={parseInline:[{name:"Autolink",parse(s,e,r){let n=r-s.offset;autolinkRE.lastIndex=n;let o=autolinkRE.exec(s.text),a=-1;return!o||(o[1]||o[2]?a=autolinkURLEnd(s.text,n+o[0].length):o[3]?a=autolinkEmailEnd(s.text,n):(a=autolinkEmailEnd(s.text,n+o[0].length),a>-1&&o[0]=="xmpp:"&&(xmppResourceRE.lastIndex=a,o=xmppResourceRE.exec(s.text),o&&(a=o.index+o[0].length))),a<0)?-1:(s.addElement(s.elt("URL",r,a+s.offset)),a+s.offset)}}]},GFM=[Table,TaskList,Strikethrough,Autolink];function parseSubSuper(s,e,r){return(n,o,a)=>{if(o!=s||n.char(a+1)==s)return-1;let l=[n.elt(r,a,a+1)];for(let c=a+1;c<n.end;c++){let h=n.char(c);if(h==s)return n.addElement(n.elt(e,a,c+1,l.concat(n.elt(r,c,c+1))));if(h==92&&l.push(n.elt("Escape",c,c+++2)),space$1(h))break}return-1}}const Superscript={defineNodes:[{name:"Superscript",style:tags$1.special(tags$1.content)},{name:"SuperscriptMark",style:tags$1.processingInstruction}],parseInline:[{name:"Superscript",parse:parseSubSuper(94,"Superscript","SuperscriptMark")}]},Subscript={defineNodes:[{name:"Subscript",style:tags$1.special(tags$1.content)},{name:"SubscriptMark",style:tags$1.processingInstruction}],parseInline:[{name:"Subscript",parse:parseSubSuper(126,"Subscript","SubscriptMark")}]},Emoji={defineNodes:[{name:"Emoji",style:tags$1.character}],parseInline:[{name:"Emoji",parse(s,e,r){let n;return e!=58||!(n=/^[a-zA-Z_0-9]+:/.exec(s.slice(r+1,s.end)))?-1:s.addElement(s.elt("Emoji",r,r+1+n[0].length))}}]},scriptText=54,StartCloseScriptTag=1,styleText=55,StartCloseStyleTag=2,textareaText=56,StartCloseTextareaTag=3,EndTag=4,SelfClosingEndTag=5,StartTag=6,StartScriptTag=7,StartStyleTag=8,StartTextareaTag=9,StartSelfClosingTag=10,StartCloseTag=11,NoMatchStartCloseTag=12,MismatchedStartCloseTag=13,missingCloseTag=57,IncompleteCloseTag=14,commentContent$1=58,Element=20,TagName=22,Attribute=23,AttributeName=24,AttributeValue=26,UnquotedAttributeValue=27,ScriptText=28,StyleText=31,TextareaText=34,OpenTag=36,CloseTag=37,Dialect_noMatch=0,Dialect_selfClosing=1,selfClosers$1={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},closeOnOpen={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function nameChar(s){return s==45||s==46||s==58||s>=65&&s<=90||s==95||s>=97&&s<=122||s>=161}function isSpace(s){return s==9||s==10||s==13||s==32}let cachedName=null,cachedInput=null,cachedPos=0;function tagNameAfter(s,e){let r=s.pos+e;if(cachedPos==r&&cachedInput==s)return cachedName;let n=s.peek(e);for(;isSpace(n);)n=s.peek(++e);let o="";for(;nameChar(n);)o+=String.fromCharCode(n),n=s.peek(++e);return cachedInput=s,cachedPos=r,cachedName=o?o.toLowerCase():n==question||n==bang?void 0:null}const lessThan=60,greaterThan=62,slash=47,question=63,bang=33,dash$1=45;function ElementContext(s,e){this.name=s,this.parent=e,this.hash=e?e.hash:0;for(let r=0;r<s.length;r++)this.hash+=(this.hash<<4)+s.charCodeAt(r)+(s.charCodeAt(r)<<8)}const startTagTerms=[StartTag,StartSelfClosingTag,StartScriptTag,StartStyleTag,StartTextareaTag],elementContext=new ContextTracker({start:null,shift(s,e,r,n){return startTagTerms.indexOf(e)>-1?new ElementContext(tagNameAfter(n,1)||"",s):s},reduce(s,e){return e==Element&&s?s.parent:s},reuse(s,e,r,n){let o=e.type.id;return o==StartTag||o==OpenTag?new ElementContext(tagNameAfter(n,1)||"",s):s},hash(s){return s?s.hash:0},strict:!1}),tagStart=new ExternalTokenizer((s,e)=>{if(s.next!=lessThan){s.next<0&&e.context&&s.acceptToken(missingCloseTag);return}s.advance();let r=s.next==slash;r&&s.advance();let n=tagNameAfter(s,0);if(n===void 0)return;if(!n)return s.acceptToken(r?IncompleteCloseTag:StartTag);let o=e.context?e.context.name:null;if(r){if(n==o)return s.acceptToken(StartCloseTag);if(o&&implicitlyClosed[o])return s.acceptToken(missingCloseTag,-2);if(e.dialectEnabled(Dialect_noMatch))return s.acceptToken(NoMatchStartCloseTag);for(let a=e.context;a;a=a.parent)if(a.name==n)return;s.acceptToken(MismatchedStartCloseTag)}else{if(n=="script")return s.acceptToken(StartScriptTag);if(n=="style")return s.acceptToken(StartStyleTag);if(n=="textarea")return s.acceptToken(StartTextareaTag);if(selfClosers$1.hasOwnProperty(n))return s.acceptToken(StartSelfClosingTag);o&&closeOnOpen[o]&&closeOnOpen[o][n]?s.acceptToken(missingCloseTag,-1):s.acceptToken(StartTag)}},{contextual:!0}),commentContent=new ExternalTokenizer(s=>{for(let e=0,r=0;;r++){if(s.next<0){r&&s.acceptToken(commentContent$1);break}if(s.next==dash$1)e++;else if(s.next==greaterThan&&e>=2){r>3&&s.acceptToken(commentContent$1,-2);break}else e=0;s.advance()}});function inForeignElement(s){for(;s;s=s.parent)if(s.name=="svg"||s.name=="math")return!0;return!1}const endTag=new ExternalTokenizer((s,e)=>{if(s.next==slash&&s.peek(1)==greaterThan){let r=e.dialectEnabled(Dialect_selfClosing)||inForeignElement(e.context);s.acceptToken(r?SelfClosingEndTag:EndTag,2)}else s.next==greaterThan&&s.acceptToken(EndTag,1)});function contentTokenizer(s,e,r){let n=2+s.length;return new ExternalTokenizer(o=>{for(let a=0,l=0,c=0;;c++){if(o.next<0){c&&o.acceptToken(e);break}if(a==0&&o.next==lessThan||a==1&&o.next==slash||a>=2&&a<n&&o.next==s.charCodeAt(a-2))a++,l++;else if((a==2||a==n)&&isSpace(o.next))l++;else if(a==n&&o.next==greaterThan){c>l?o.acceptToken(e,-l):o.acceptToken(r,-(l-2));break}else if((o.next==10||o.next==13)&&c){o.acceptToken(e,1);break}else a=l=0;o.advance()}})}const scriptTokens=contentTokenizer("script",scriptText,StartCloseScriptTag),styleTokens=contentTokenizer("style",styleText,StartCloseStyleTag),textareaTokens=contentTokenizer("textarea",textareaText,StartCloseTextareaTag),htmlHighlighting=styleTags({"Text RawText":tags$1.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":tags$1.angleBracket,TagName:tags$1.tagName,"MismatchedCloseTag/TagName":[tags$1.tagName,tags$1.invalid],AttributeName:tags$1.attributeName,"AttributeValue UnquotedAttributeValue":tags$1.attributeValue,Is:tags$1.definitionOperator,"EntityReference CharacterReference":tags$1.character,Comment:tags$1.blockComment,ProcessingInst:tags$1.processingInstruction,DoctypeDecl:tags$1.documentMeta}),parser$1=LRParser.deserialize({version:14,states:",xOVO!rOOO!WQ#tO'#CqO!]Q#tO'#CzO!bQ#tO'#C}O!gQ#tO'#DQO!lQ#tO'#DSO!qOaO'#CpO!|ObO'#CpO#XOdO'#CpO$eO!rO'#CpOOO`'#Cp'#CpO$lO$fO'#DTO$tQ#tO'#DVO$yQ#tO'#DWOOO`'#Dk'#DkOOO`'#DY'#DYQVO!rOOO%OQ&rO,59]O%WQ&rO,59fO%`Q&rO,59iO%hQ&rO,59lO%sQ&rO,59nOOOa'#D^'#D^O%{OaO'#CxO&WOaO,59[OOOb'#D_'#D_O&`ObO'#C{O&kObO,59[OOOd'#D`'#D`O&sOdO'#DOO'OOdO,59[OOO`'#Da'#DaO'WO!rO,59[O'_Q#tO'#DROOO`,59[,59[OOOp'#Db'#DbO'dO$fO,59oOOO`,59o,59oO'lQ#|O,59qO'qQ#|O,59rOOO`-E7W-E7WO'vQ&rO'#CsOOQW'#DZ'#DZO(UQ&rO1G.wOOOa1G.w1G.wO(^Q&rO1G/QOOOb1G/Q1G/QO(fQ&rO1G/TOOOd1G/T1G/TO(nQ&rO1G/WOOO`1G/W1G/WOOO`1G/Y1G/YO(yQ&rO1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oa!xOb!xOc!xO!b!{O!c!xO~OT~bac!dx{!d~",goto:"%p!`PPPPPPPPPPPPPPPPPPPP!a!gP!mPP!yP!|#P#S#Y#]#`#f#i#l#r#x!aP!a!aP$O$U$l$r$x%O%U%[%bPPPPPPPP%hX^OX`pXUOX`pezabcde{}!P!R!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ}bQ!PcQ!RdQ!UeZ!e{}!P!R!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:67,context:elementContext,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,21,30,33,36,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,29,32,35,37,"OpenTag"],["group",-9,14,17,18,19,20,39,40,41,42,"Entity",16,"Entity TextContent",-3,28,31,34,"TextContent Entity"]],propSources:[htmlHighlighting],skippedNodes:[0],repeatNodeCount:9,tokenData:"!<p!aR!YOX$qXY,QYZ,QZ[$q[]&X]^,Q^p$qpq,Qqr-_rs3_sv-_vw3}wxHYx}-_}!OH{!O!P-_!P!Q$q!Q![-_![!]Mz!]!^-_!^!_!$S!_!`!;x!`!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz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R!;]V!a`!cpxPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!<TXiS`P!a`!cpOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X",tokenizers:[scriptTokens,styleTokens,textareaTokens,endTag,tagStart,commentContent,0,1,2,3,4,5],topRules:{Document:[0,15]},dialects:{noMatch:0,selfClosing:485},tokenPrec:487});function getAttrs(s,e){let r=Object.create(null);for(let n of s.getChildren(Attribute)){let o=n.getChild(AttributeName),a=n.getChild(AttributeValue)||n.getChild(UnquotedAttributeValue);o&&(r[e.read(o.from,o.to)]=a?a.type.id==AttributeValue?e.read(a.from+1,a.to-1):e.read(a.from,a.to):"")}return r}function findTagName(s,e){let r=s.getChild(TagName);return r?e.read(r.from,r.to):" "}function maybeNest(s,e,r){let n;for(let o of r)if(!o.attrs||o.attrs(n||(n=getAttrs(s.node.parent.firstChild,e))))return{parser:o.parser};return null}function configureNesting(s=[],e=[]){let r=[],n=[],o=[],a=[];for(let c of s)(c.tag=="script"?r:c.tag=="style"?n:c.tag=="textarea"?o:a).push(c);let l=e.length?Object.create(null):null;for(let c of e)(l[c.name]||(l[c.name]=[])).push(c);return parseMixed((c,h)=>{let f=c.type.id;if(f==ScriptText)return maybeNest(c,h,r);if(f==StyleText)return maybeNest(c,h,n);if(f==TextareaText)return maybeNest(c,h,o);if(f==Element&&a.length){let d=c.node,m=d.firstChild,v=m&&findTagName(m,h),A;if(v){for(let T of a)if(T.tag==v&&(!T.attrs||T.attrs(A||(A=getAttrs(d,h))))){let B=d.lastChild;return{parser:T.parser,overlay:[{from:m.to,to:B.type.id==CloseTag?B.from:d.to}]}}}}if(l&&f==Attribute){let d=c.node,m;if(m=d.firstChild){let v=l[h.read(m.from,m.to)];if(v)for(let A of v){if(A.tagName&&A.tagName!=findTagName(d.parent,h))continue;let T=d.lastChild;if(T.type.id==AttributeValue){let B=T.from+1,Y=T.lastChild,F=T.to-(Y&&Y.isError?0:1);if(F>B)return{parser:A.parser,overlay:[{from:B,to:F}]}}else if(T.type.id==UnquotedAttributeValue)return{parser:A.parser,overlay:[{from:T.from,to:T.to}]}}}}return null})}const descendantOp=96,Unit=1,callee=97,identifier$2=98,VariableName=2,space=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],colon=58,parenL=40,underscore=95,bracketL=91,dash=45,period=46,hash=35,percent=37;function isAlpha(s){return s>=65&&s<=90||s>=97&&s<=122||s>=161}function isDigit(s){return s>=48&&s<=57}const identifiers=new ExternalTokenizer((s,e)=>{for(let r=!1,n=0,o=0;;o++){let{next:a}=s;if(isAlpha(a)||a==dash||a==underscore||r&&isDigit(a))!r&&(a!=dash||o>0)&&(r=!0),n===o&&a==dash&&n++,s.advance();else{r&&s.acceptToken(a==parenL?callee:n==2&&e.canShift(VariableName)?VariableName:identifier$2);break}}}),descendant=new ExternalTokenizer(s=>{if(space.includes(s.peek(-1))){let{next:e}=s;(isAlpha(e)||e==underscore||e==hash||e==period||e==bracketL||e==colon||e==dash)&&s.acceptToken(descendantOp)}}),unitToken=new ExternalTokenizer(s=>{if(!space.includes(s.peek(-1))){let{next:e}=s;if(e==percent&&(s.advance(),s.acceptToken(Unit)),isAlpha(e)){do s.advance();while(isAlpha(s.next));s.acceptToken(Unit)}}}),cssHighlighting=styleTags({"AtKeyword import charset namespace keyframes media supports":tags$1.definitionKeyword,"from to selector":tags$1.keyword,NamespaceName:tags$1.namespace,KeyframeName:tags$1.labelName,KeyframeRangeName:tags$1.operatorKeyword,TagName:tags$1.tagName,ClassName:tags$1.className,PseudoClassName:tags$1.constant(tags$1.className),IdName:tags$1.labelName,"FeatureName PropertyName":tags$1.propertyName,AttributeName:tags$1.attributeName,NumberLiteral:tags$1.number,KeywordQuery:tags$1.keyword,UnaryQueryOp:tags$1.operatorKeyword,"CallTag ValueName":tags$1.atom,VariableName:tags$1.variableName,Callee:tags$1.operatorKeyword,Unit:tags$1.unit,"UniversalSelector NestingSelector":tags$1.definitionOperator,MatchOp:tags$1.compareOperator,"ChildOp SiblingOp, LogicOp":tags$1.logicOperator,BinOp:tags$1.arithmeticOperator,Important:tags$1.modifier,Comment:tags$1.blockComment,ColorLiteral:tags$1.color,"ParenthesizedContent StringLiteral":tags$1.string,":":tags$1.punctuation,"PseudoOp #":tags$1.derefOperator,"; ,":tags$1.separator,"( )":tags$1.paren,"[ ]":tags$1.squareBracket,"{ }":tags$1.brace}),spec_callee={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},spec_AtKeyword={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},spec_identifier={__proto__:null,not:128,only:128},parser=LRParser.deserialize({version:14,states:"9bQYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ[O'#CfO$_QXO'#CaO$fQ[O'#ChO$qQ[O'#DPO$vQ[O'#DTOOQP'#Ej'#EjO${QdO'#DeO%gQ[O'#DrO${QdO'#DtO%xQ[O'#DvO&TQ[O'#DyO&]Q[O'#EPO&kQ[O'#EROOQS'#Ei'#EiOOQS'#EU'#EUQYQ[OOO&rQXO'#CdO'gQWO'#DaO'lQWO'#EpO'wQ[O'#EpQOQWOOP(RO#tO'#C_POOO)C@X)C@XOOQP'#Cg'#CgOOQP,59Q,59QO#kQ[O,59QO(^Q[O'#EXO(xQWO,58{O)QQ[O,59SO$qQ[O,59kO$vQ[O,59oO(^Q[O,59sO(^Q[O,59uO(^Q[O,59vO)]Q[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO)dQWO,59SO)iQWO,59SOOQP'#DR'#DROOQP,59k,59kOOQO'#DV'#DVO)nQ`O,59oOOQS'#Cp'#CpO${QdO'#CqO)vQvO'#CsO+TQ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udoClassName ) ( ArgList ValueName ParenthesizedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee CallLiteral CallTag ParenthesizedContent , PseudoClassName ArgList IdSelector # IdName ] AttributeSelector [ AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp } { Block Declaration PropertyName Important ; ImportStatement AtKeyword import KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports AtRule Styles",maxTerm:114,nodeProps:[["openedBy",17,"(",48,"{"],["closedBy",18,")",49,"}"]],propSources:[cssHighlighting],skippedNodes:[0,3,85],repeatNodeCount:10,tokenData:"J^~R!^OX$}X^%u^p$}pq%uqr)Xrs.Rst/utu6duv$}vw7^wx7oxy9^yz9oz{9t{|:_|}?Q}!O?c!O!P@Q!P!Q@i!Q![Ab![!]B]!]!^CX!^!_$}!_!`Cj!`!aC{!a!b$}!b!cDw!c!}$}!}#OFa#O#P$}#P#QFr#Q#R6d#R#T$}#T#UGT#U#c$}#c#dHf#d#o$}#o#pH{#p#q6d#q#rI^#r#sIo#s#y$}#y#z%u#z$f$}$f$g%u$g#BY$}#BY#BZ%u#BZ$IS$}$IS$I_%u$I_$I|$}$I|$JO%u$JO$JT$}$JT$JU%u$JU$KV$}$KV$KW%u$KW&FU$}&FU&FV%u&FV;'S$};'S;=`JW<%lO$}`%QSOy%^z;'S%^;'S;=`%o<%lO%^`%cSo`Oy%^z;'S%^;'S;=`%o<%lO%^`%rP;=`<%l%^~%zh#W~OX%^X^'f^p%^pq'fqy%^z#y%^#y#z'f#z$f%^$f$g'f$g#BY%^#BY#BZ'f#BZ$IS%^$IS$I_'f$I_$I|%^$I|$JO'f$JO$JT%^$JT$JU'f$JU$KV%^$KV$KW'f$KW&FU%^&FU&FV'f&FV;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LocalTokenGroup("m~RRYZ[z{a~~g~aO#Z~~dP!P!Qg~lO#[~~",28,102)],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:97,get:s=>spec_callee[s]||-1},{term:56,get:s=>spec_AtKeyword[s]||-1},{term:98,get:s=>spec_identifier[s]||-1}],tokenPrec:1169});let _properties=null;function properties(){if(!_properties&&typeof document=="object"&&document.body){let{style:s}=document.body,e=[],r=new Set;for(let n in s)n!="cssText"&&n!="cssFloat"&&typeof s[n]=="string"&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,o=>"-"+o.toLowerCase())),r.has(n)||(e.push(n),r.add(n)));_properties=e.sort().map(n=>({type:"property",label:n}))}return _properties||[]}const pseudoClasses=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(s=>({type:"class",label:s})),values=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(s=>({type:"keyword",label:s})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(s=>({type:"constant",label:s}))),tags=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(s=>({type:"type",label:s})),identifier$1=/^(\w[\w-]*|-\w[\w-]*|)$/,variable=/^-(-[\w-]*)?$/;function isVarArg(s,e){var r;if((s.name=="("||s.type.isError)&&(s=s.parent||s),s.name!="ArgList")return!1;let n=(r=s.parent)===null||r===void 0?void 0:r.firstChild;return(n==null?void 0:n.name)!="Callee"?!1:e.sliceString(n.from,n.to)=="var"}const VariablesByNode=new NodeWeakMap,declSelector=["Declaration"];function astTop(s){for(let e=s;;){if(e.type.isTop)return e;if(!(e=e.parent))return s}}function variableNames(s,e,r){if(e.to-e.from>4096){let n=VariablesByNode.get(e);if(n)return n;let o=[],a=new Set,l=e.cursor(IterMode.IncludeAnonymous);if(l.firstChild())do for(let c of variableNames(s,l.node,r))a.has(c.label)||(a.add(c.label),o.push(c));while(l.nextSibling());return VariablesByNode.set(e,o),o}else{let n=[],o=new Set;return e.cursor().iterate(a=>{var l;if(r(a)&&a.matchContext(declSelector)&&((l=a.node.nextSibling)===null||l===void 0?void 0:l.name)==":"){let c=s.sliceString(a.from,a.to);o.has(c)||(o.add(c),n.push({label:c,type:"variable"}))}}),n}}const defineCSSCompletionSource=s=>e=>{let{state:r,pos:n}=e,o=syntaxTree(r).resolveInner(n,-1),a=o.type.isError&&o.from==o.to-1&&r.doc.sliceString(o.from,o.to)=="-";if(o.name=="PropertyName"||(a||o.name=="TagName")&&/^(Block|Styles)$/.test(o.resolve(o.to).name))return{from:o.from,options:properties(),validFor:identifier$1};if(o.name=="ValueName")return{from:o.from,options:values,validFor:identifier$1};if(o.name=="PseudoClassName")return{from:o.from,options:pseudoClasses,validFor:identifier$1};if(s(o)||(e.explicit||a)&&isVarArg(o,r.doc))return{from:s(o)||a?o.from:n,options:variableNames(r.doc,astTop(o),s),validFor:variable};if(o.name=="TagName"){for(let{parent:h}=o;h;h=h.parent)if(h.name=="Block")return{from:o.from,options:properties(),validFor:identifier$1};return{from:o.from,options:tags,validFor:identifier$1}}if(!e.explicit)return null;let l=o.resolve(n),c=l.childBefore(n);return c&&c.name==":"&&l.name=="PseudoClassSelector"?{from:n,options:pseudoClasses,validFor:identifier$1}:c&&c.name==":"&&l.name=="Declaration"||l.name=="ArgList"?{from:n,options:values,validFor:identifier$1}:l.name=="Block"||l.name=="Styles"?{from:n,options:properties(),validFor:identifier$1}:null},cssCompletionSource=defineCSSCompletionSource(s=>s.name=="VariableName"),cssLanguage=LRLanguage.define({name:"css",parser:parser.configure({props:[indentNodeProp.add({Declaration:continuedIndent()}),foldNodeProp.add({Block:foldInside})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function css(){return new LanguageSupport(cssLanguage,cssLanguage.data.of({autocomplete:cssCompletionSource}))}const Targets=["_blank","_self","_top","_parent"],Charsets=["ascii","utf-8","utf-16","latin1","latin1"],Methods=["get","post","put","delete"],Encs=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Bool=["true","false"],S={},Tags={a:{attrs:{href:null,ping:null,type:null,media:null,target:Targets,hreflang:null}},abbr:S,address:S,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:S,aside:S,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:S,base:{attrs:{href:null,target:Targets}},bdi:S,bdo:S,blockquote:{attrs:{cite:null}},body:S,br:S,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:Encs,formmethod:Methods,formnovalidate:["novalidate"],formtarget:Targets,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:S,center:S,cite:S,code:S,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:S,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:S,div:S,dl:S,dt:S,em:S,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:S,figure:S,footer:S,form:{attrs:{action:null,name:null,"accept-charset":Charsets,autocomplete:["on","off"],enctype:Encs,method:Methods,novalidate:["novalidate"],target:Targets}},h1:S,h2:S,h3:S,h4:S,h5:S,h6:S,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:S,hgroup:S,hr:S,html:{attrs:{manifest:null}},i:S,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:Encs,formmethod:Methods,formnovalidate:["novalidate"],formtarget:Targets,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:S,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:S,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:S,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Charsets,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:S,noscript:S,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:S,param:{attrs:{name:null,value:null}},pre:S,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:S,rt:S,ruby:S,samp:S,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Charsets}},section:S,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:S,source:{attrs:{src:null,type:null,media:null}},span:S,strong:S,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:S,summary:S,sup:S,table:S,tbody:S,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:S,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:S,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:S,time:{attrs:{datetime:null}},title:S,tr:S,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:S,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:S},GlobalAttrs={accesskey:null,class:null,contenteditable:Bool,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Bool,autocorrect:Bool,autocapitalize:Bool,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Bool,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Bool,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Bool,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Bool,"aria-hidden":Bool,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Bool,"aria-multiselectable":Bool,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Bool,"aria-relevant":null,"aria-required":Bool,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},eventAttributes="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(s=>"on"+s);for(let s of eventAttributes)GlobalAttrs[s]=null;class Schema{constructor(e,r){this.tags=Object.assign(Object.assign({},Tags),e),this.globalAttrs=Object.assign(Object.assign({},GlobalAttrs),r),this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Schema.default=new Schema;function elementName(s,e,r=s.length){if(!e)return"";let n=e.firstChild,o=n&&n.getChild("TagName");return o?s.sliceString(o.from,Math.min(o.to,r)):""}function findParentElement(s,e=!1){for(;s;s=s.parent)if(s.name=="Element")if(e)e=!1;else return s;return null}function allowedChildren(s,e,r){let n=r.tags[elementName(s,findParentElement(e))];return(n==null?void 0:n.children)||r.allTags}function openTags(s,e){let r=[];for(let n=findParentElement(e);n&&!n.type.isTop;n=findParentElement(n.parent)){let o=elementName(s,n);if(o&&n.lastChild.name=="CloseTag")break;o&&r.indexOf(o)<0&&(e.name=="EndTag"||e.from>=n.firstChild.to)&&r.push(o)}return r}const identifier=/^[:\-\.\w\u00b7-\uffff]*$/;function completeTag(s,e,r,n,o){let a=/\s*>/.test(s.sliceDoc(o,o+5))?"":">",l=findParentElement(r,!0);return{from:n,to:o,options:allowedChildren(s.doc,l,e).map(c=>({label:c,type:"type"})).concat(openTags(s.doc,r).map((c,h)=>({label:"/"+c,apply:"/"+c+a,type:"type",boost:99-h}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function completeCloseTag(s,e,r,n){let o=/\s*>/.test(s.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:openTags(s.doc,e).map((a,l)=>({label:a,apply:a+o,type:"type",boost:99-l})),validFor:identifier}}function completeStartTag(s,e,r,n){let o=[],a=0;for(let l of allowedChildren(s.doc,r,e))o.push({label:"<"+l,type:"type"});for(let l of openTags(s.doc,r))o.push({label:"</"+l+">",type:"type",boost:99-a++});return{from:n,to:n,options:o,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function completeAttrName(s,e,r,n,o){let a=findParentElement(r),l=a?e.tags[elementName(s.doc,a)]:null,c=l&&l.attrs?Object.keys(l.attrs):[],h=l&&l.globalAttrs===!1?c:c.length?c.concat(e.globalAttrNames):e.globalAttrNames;return{from:n,to:o,options:h.map(f=>({label:f,type:"property"})),validFor:identifier}}function completeAttrValue(s,e,r,n,o){var a;let l=(a=r.parent)===null||a===void 0?void 0:a.getChild("AttributeName"),c=[],h;if(l){let f=s.sliceDoc(l.from,l.to),d=e.globalAttrs[f];if(!d){let m=findParentElement(r),v=m?e.tags[elementName(s.doc,m)]:null;d=(v==null?void 0:v.attrs)&&v.attrs[f]}if(d){let m=s.sliceDoc(n,o).toLowerCase(),v='"',A='"';/^['"]/.test(m)?(h=m[0]=='"'?/^[^"]*$/:/^[^']*$/,v="",A=s.sliceDoc(o,o+1)==m[0]?"":m[0],m=m.slice(1),n++):h=/^[^\s<>='"]*$/;for(let T of d)c.push({label:T,apply:v+T+A,type:"constant"})}}return{from:n,to:o,options:c,validFor:h}}function htmlCompletionFor(s,e){let{state:r,pos:n}=e,o=syntaxTree(r).resolveInner(n,-1),a=o.resolve(n);for(let l=n,c;a==o&&(c=o.childBefore(l));){let h=c.lastChild;if(!h||!h.type.isError||h.from<h.to)break;a=o=c,l=h.from}return o.name=="TagName"?o.parent&&/CloseTag$/.test(o.parent.name)?completeCloseTag(r,o,o.from,n):completeTag(r,s,o,o.from,n):o.name=="StartTag"?completeTag(r,s,o,n,n):o.name=="StartCloseTag"||o.name=="IncompleteCloseTag"?completeCloseTag(r,o,n,n):e.explicit&&(o.name=="OpenTag"||o.name=="SelfClosingTag")||o.name=="AttributeName"?completeAttrName(r,s,o,o.name=="AttributeName"?o.from:n,n):o.name=="Is"||o.name=="AttributeValue"||o.name=="UnquotedAttributeValue"?completeAttrValue(r,s,o,o.name=="Is"?n:o.from,n):e.explicit&&(a.name=="Element"||a.name=="Text"||a.name=="Document")?completeStartTag(r,s,o,n):null}function htmlCompletionSource(s){return htmlCompletionFor(Schema.default,s)}function htmlCompletionSourceWith(s){let{extraTags:e,extraGlobalAttributes:r}=s,n=r||e?new Schema(e,r):Schema.default;return o=>htmlCompletionFor(n,o)}const defaultNesting=[{tag:"script",attrs:s=>s.type=="text/typescript"||s.lang=="ts",parser:typescriptLanguage.parser},{tag:"script",attrs:s=>s.type=="text/babel"||s.type=="text/jsx",parser:jsxLanguage.parser},{tag:"script",attrs:s=>s.type=="text/typescript-jsx",parser:tsxLanguage.parser},{tag:"script",attrs(s){return!s.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(s.type)},parser:javascriptLanguage.parser},{tag:"style",attrs(s){return(!s.lang||s.lang=="css")&&(!s.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(s.type))},parser:cssLanguage.parser}],defaultAttrs=[{name:"style",parser:cssLanguage.parser.configure({top:"Styles"})}].concat(eventAttributes.map(s=>({name:s,parser:javascriptLanguage.parser}))),htmlPlain=LRLanguage.define({name:"html",parser:parser$1.configure({props:[indentNodeProp.add({Element(s){let e=/^(\s*)(<\/)?/.exec(s.textAfter);return s.node.to<=s.pos+e[0].length?s.continue():s.lineIndent(s.node.from)+(e[2]?0:s.unit)},"OpenTag CloseTag SelfClosingTag"(s){return s.column(s.node.from)+s.unit},Document(s){if(s.pos+/\s*/.exec(s.textAfter)[0].length<s.node.to)return s.continue();let e=null,r;for(let n=s.node;;){let o=n.lastChild;if(!o||o.name!="Element"||o.to!=n.to)break;e=n=o}return e&&!((r=e.lastChild)&&(r.name=="CloseTag"||r.name=="SelfClosingTag"))?s.lineIndent(e.from)+s.unit:null}}),foldNodeProp.add({Element(s){let e=s.firstChild,r=s.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:r.name=="CloseTag"?r.from:s.to}}}),bracketMatchingHandle.add({"OpenTag CloseTag":s=>s.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}}),htmlLanguage=htmlPlain.configure({wrap:configureNesting(defaultNesting,defaultAttrs)});function html(s={}){let e="",r;s.matchClosingTags===!1&&(e="noMatch"),s.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(s.nestedLanguages&&s.nestedLanguages.length||s.nestedAttributes&&s.nestedAttributes.length)&&(r=configureNesting((s.nestedLanguages||[]).concat(defaultNesting),(s.nestedAttributes||[]).concat(defaultAttrs)));let n=r?htmlPlain.configure({wrap:r,dialect:e}):e?htmlLanguage.configure({dialect:e}):htmlLanguage;return new LanguageSupport(n,[htmlLanguage.data.of({autocomplete:htmlCompletionSourceWith(s)}),s.autoCloseTags!==!1?autoCloseTags:[],javascript().support,css().support])}const selfClosers=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),autoCloseTags=EditorView.inputHandler.of((s,e,r,n)=>{if(s.composing||s.state.readOnly||e!=r||n!=">"&&n!="/"||!htmlLanguage.isActiveAt(s.state,e,-1))return!1;let{state:o}=s,a=o.changeByRange(l=>{var c,h,f;let{head:d}=l,m=syntaxTree(o).resolveInner(d,-1),v;if((m.name=="TagName"||m.name=="StartTag")&&(m=m.parent),n==">"&&m.name=="OpenTag"){if(((h=(c=m.parent)===null||c===void 0?void 0:c.lastChild)===null||h===void 0?void 0:h.name)!="CloseTag"&&(v=elementName(o.doc,m.parent,d))&&!selfClosers.has(v)){let A=s.state.doc.sliceString(d,d+1)===">",T=`${A?"":">"}</${v}>`;return{range:EditorSelection.cursor(d+1),changes:{from:d+(A?1:0),insert:T}}}}else if(n=="/"&&m.name=="OpenTag"){let A=m.parent,T=A==null?void 0:A.parent;if(A.from==d-1&&((f=T.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(v=elementName(o.doc,T,d))&&!selfClosers.has(v)){let B=s.state.doc.sliceString(d,d+1)===">",Y=`/${v}${B?"":">"}`,F=d+Y.length+(B?1:0);return{range:EditorSelection.cursor(F),changes:{from:d,insert:Y}}}}return{range:l}});return a.changes.empty?!1:(s.dispatch(a,{userEvent:"input.type",scrollIntoView:!0}),!0)}),data=defineLanguageFacet({commentTokens:{block:{open:"<!--",close:"-->"}}}),headingProp=new NodeProp,commonmark=parser$2.configure({props:[foldNodeProp.add(s=>!s.is("Block")||s.is("Document")||isHeading(s)!=null?void 0:(e,r)=>({from:r.doc.lineAt(e.from).to,to:e.to})),headingProp.add(isHeading),indentNodeProp.add({Document:()=>null}),languageDataProp.add({Document:data})]});function isHeading(s){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(s.name);return e?+e[1]:void 0}function findSectionEnd(s,e){let r=s;for(;;){let n=r.nextSibling,o;if(!n||(o=isHeading(n.type))!=null&&o<=e)break;r=n}return r.to}const headerIndent=foldService.of((s,e,r)=>{for(let n=syntaxTree(s).resolveInner(r,-1);n&&!(n.from<e);n=n.parent){let o=n.type.prop(headingProp);if(o==null)continue;let a=findSectionEnd(n,o);if(a>r)return{from:r,to:a}}return null});function mkLang(s){return new Language(data,s,[headerIndent],"markdown")}const commonmarkLanguage=mkLang(commonmark),extended=commonmark.configure([GFM,Subscript,Superscript,Emoji]),markdownLanguage=mkLang(extended);function getCodeParser(s,e){return r=>{if(r&&s){let n=null;if(r=/\S*/.exec(r)[0],typeof s=="function"?n=s(r):n=LanguageDescription.matchLanguageName(s,r,!0),n instanceof LanguageDescription)return n.support?n.support.language.parser:ParseContext.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}class Context{constructor(e,r,n,o,a,l,c){this.node=e,this.from=r,this.to=n,this.spaceBefore=o,this.spaceAfter=a,this.type=l,this.item=c}blank(e,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length<e;)n+=" ";return n}else{for(let o=this.to-this.from-n.length-this.spaceAfter.length;o>0;o--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(e,r){let n=this.node.name=="OrderedList"?String(+itemNumber(this.item,e)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}}function getContext(s,e){let r=[];for(let o=s;o&&o.name!="Document";o=o.parent)(o.name=="ListItem"||o.name=="Blockquote"||o.name=="FencedCode")&&r.push(o);let n=[];for(let o=r.length-1;o>=0;o--){let a=r[o],l,c=e.lineAt(a.from),h=a.from-c.from;if(a.name=="FencedCode")n.push(new Context(a,h,h,"","","",null));else if(a.name=="Blockquote"&&(l=/^[ \t]*>( ?)/.exec(c.text.slice(h))))n.push(new Context(a,h,h+l[0].length,"",l[1],">",null));else if(a.name=="ListItem"&&a.parent.name=="OrderedList"&&(l=/^([ \t]*)\d+([.)])([ \t]*)/.exec(c.text.slice(h)))){let f=l[3],d=l[0].length;f.length>=4&&(f=f.slice(0,f.length-4),d-=4),n.push(new Context(a.parent,h,h+d,l[1],f,l[2],a))}else if(a.name=="ListItem"&&a.parent.name=="BulletList"&&(l=/^([ \t]*)([-+*])([ \t]{1,4}\[[ xX]\])?([ \t]+)/.exec(c.text.slice(h)))){let f=l[4],d=l[0].length;f.length>4&&(f=f.slice(0,f.length-4),d-=4);let m=l[2];l[3]&&(m+=l[3].replace(/[xX]/," ")),n.push(new Context(a.parent,h,h+d,l[1],f,m,a))}}return n}function itemNumber(s,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(s.from,s.from+10))}function renumberList(s,e,r,n=0){for(let o=-1,a=s;;){if(a.name=="ListItem"){let c=itemNumber(a,e),h=+c[2];if(o>=0){if(h!=o+1)return;r.push({from:a.from+c[1].length,to:a.from+c[0].length,insert:String(o+2+n)})}o=h}let l=a.nextSibling;if(!l)break;a=l}}const insertNewlineContinueMarkup=({state:s,dispatch:e})=>{let r=syntaxTree(s),{doc:n}=s,o=null,a=s.changeByRange(l=>{if(!l.empty||!markdownLanguage.isActiveAt(s,l.from))return o={range:l};let c=l.from,h=n.lineAt(c),f=getContext(r.resolveInner(c,-1),n);for(;f.length&&f[f.length-1].from>c-h.from;)f.pop();if(!f.length)return o={range:l};let d=f[f.length-1];if(d.to-d.spaceAfter.length>c-h.from)return o={range:l};let m=c>=d.to-d.spaceAfter.length&&!/\S/.test(h.text.slice(d.to));if(d.item&&m)if(d.node.firstChild.to>=c||h.from>0&&!/[^\s>]/.test(n.lineAt(h.from-1).text)){let Y=f.length>1?f[f.length-2]:null,F,ke="";Y&&Y.item?(F=h.from+Y.from,ke=Y.marker(n,1)):F=h.from+(Y?Y.to:0);let Qe=[{from:F,to:c,insert:ke}];return d.node.name=="OrderedList"&&renumberList(d.item,n,Qe,-2),Y&&Y.node.name=="OrderedList"&&renumberList(Y.item,n,Qe),{range:EditorSelection.cursor(F+ke.length),changes:Qe}}else{let Y="";for(let F=0,ke=f.length-2;F<=ke;F++)Y+=f[F].blank(F<ke?f[F+1].from-Y.length:null,F<ke);return Y+=s.lineBreak,{range:EditorSelection.cursor(c+Y.length),changes:{from:h.from,insert:Y}}}if(d.node.name=="Blockquote"&&m&&h.from){let Y=n.lineAt(h.from-1),F=/>\s*$/.exec(Y.text);if(F&&F.index==d.from){let ke=s.changes([{from:Y.from+F.index,to:Y.to},{from:h.from+d.from,to:h.to}]);return{range:l.map(ke),changes:ke}}}let v=[];d.node.name=="OrderedList"&&renumberList(d.item,n,v);let A=d.item&&d.item.from<h.from,T="";if(!A||/^[\s\d.)\-+*>]*/.exec(h.text)[0].length>=d.to)for(let Y=0,F=f.length-1;Y<=F;Y++)T+=Y==F&&!A?f[Y].marker(n,1):f[Y].blank(Y<F?f[Y+1].from-T.length:null);let B=c;for(;B>h.from&&/\s/.test(h.text.charAt(B-h.from-1));)B--;return T=s.lineBreak+T,v.push({from:B,to:c,insert:T}),{range:EditorSelection.cursor(B+T.length),changes:v}});return o?!1:(e(s.update(a,{scrollIntoView:!0,userEvent:"input"})),!0)};function isMark(s){return s.name=="QuoteMark"||s.name=="ListMark"}function contextNodeForDelete(s,e){let r=s.resolveInner(e,-1),n=e;isMark(r)&&(n=r.from,r=r.parent);for(let o;o=r.childBefore(n);)if(isMark(o))n=o.from;else if(o.name=="OrderedList"||o.name=="BulletList")r=o.lastChild,n=r.to;else break;return r}const deleteMarkupBackward=({state:s,dispatch:e})=>{let r=syntaxTree(s),n=null,o=s.changeByRange(a=>{let l=a.from,{doc:c}=s;if(a.empty&&markdownLanguage.isActiveAt(s,a.from)){let h=c.lineAt(l),f=getContext(contextNodeForDelete(r,l),c);if(f.length){let d=f[f.length-1],m=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(l-h.from>m&&!/\S/.test(h.text.slice(m,l-h.from)))return{range:EditorSelection.cursor(h.from+m),changes:{from:h.from+m,to:l}};if(l-h.from==m&&(!d.item||h.from<=d.item.from||!/\S/.test(h.text.slice(0,d.to)))){let v=h.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(h.text.slice(d.from,d.to)))return{range:a,changes:{from:v,to:h.from+d.to,insert:d.blank(d.to-d.from)}};if(v<l)return{range:EditorSelection.cursor(v),changes:{from:v,to:l}}}}}return n={range:a}});return n?!1:(e(s.update(o,{scrollIntoView:!0,userEvent:"delete"})),!0)},markdownKeymap=[{key:"Enter",run:insertNewlineContinueMarkup},{key:"Backspace",run:deleteMarkupBackward}],htmlNoMatch=html({matchClosingTags:!1});function markdown(s={}){let{codeLanguages:e,defaultCodeLanguage:r,addKeymap:n=!0,base:{parser:o}=commonmarkLanguage,completeHTMLTags:a=!0}=s;if(!(o instanceof MarkdownParser))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let l=s.extensions?[s.extensions]:[],c=[htmlNoMatch.support],h;r instanceof LanguageSupport?(c.push(r.support),h=r.language):r&&(h=r);let f=e||h?getCodeParser(e,h):void 0;l.push(parseCode({codeParser:f,htmlParser:htmlNoMatch.language.parser})),n&&c.push(Prec.high(keymap.of(markdownKeymap)));let d=mkLang(o.configure(l));return a&&c.push(d.data.of({autocomplete:htmlTagCompletion})),new LanguageSupport(d,c)}function htmlTagCompletion(s){let{state:e,pos:r}=s,n=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(r-25,r));if(!n)return null;let o=syntaxTree(e).resolveInner(r,-1);for(;o&&!o.type.isTop;){if(o.name=="CodeBlock"||o.name=="FencedCode"||o.name=="ProcessingInstructionBlock"||o.name=="CommentBlock"||o.name=="Link"||o.name=="Image")return null;o=o.parent}return{from:r-n[0].length,to:r,options:htmlTagCompletions(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let _tagCompletions=null;function htmlTagCompletions(){if(_tagCompletions)return _tagCompletions;let s=htmlCompletionSource(new CompletionContext(EditorState.create({extensions:htmlNoMatch}),0,!0));return _tagCompletions=s?s.options:[]}const chalky="#e5c07b",coral="#e06c75",cyan="#56b6c2",invalid="#ffffff",ivory="#abb2bf",stone="#7d8799",malibu="#61afef",sage="#98c379",whiskey="#d19a66",violet="#c678dd",darkBackground="#21252b",highlightBackground="#2c313a",background="#282c34",tooltipBackground="#353a42",selection="#3E4451",cursor="#528bff",oneDarkTheme=EditorView.theme({"&":{color:ivory,backgroundColor:background},".cm-content":{caretColor:cursor},".cm-cursor, .cm-dropCursor":{borderLeftColor:cursor},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:selection},".cm-panels":{backgroundColor:darkBackground,color:ivory},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:background,color:stone,border:"none"},".cm-activeLineGutter":{backgroundColor:highlightBackground},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:tooltipBackground},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:tooltipBackground,borderBottomColor:tooltipBackground},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:highlightBackground,color:ivory}}},{dark:!0}),oneDarkHighlightStyle=HighlightStyle.define([{tag:tags$1.keyword,color:violet},{tag:[tags$1.name,tags$1.deleted,tags$1.character,tags$1.propertyName,tags$1.macroName],color:coral},{tag:[tags$1.function(tags$1.variableName),tags$1.labelName],color:malibu},{tag:[tags$1.color,tags$1.constant(tags$1.name),tags$1.standard(tags$1.name)],color:whiskey},{tag:[tags$1.definition(tags$1.name),tags$1.separator],color:ivory},{tag:[tags$1.typeName,tags$1.className,tags$1.number,tags$1.changed,tags$1.annotation,tags$1.modifier,tags$1.self,tags$1.namespace],color:chalky},{tag:[tags$1.operator,tags$1.operatorKeyword,tags$1.url,tags$1.escape,tags$1.regexp,tags$1.link,tags$1.special(tags$1.string)],color:cyan},{tag:[tags$1.meta,tags$1.comment],color:stone},{tag:tags$1.strong,fontWeight:"bold"},{tag:tags$1.emphasis,fontStyle:"italic"},{tag:tags$1.strikethrough,textDecoration:"line-through"},{tag:tags$1.link,color:stone,textDecoration:"underline"},{tag:tags$1.heading,fontWeight:"bold",color:coral},{tag:[tags$1.atom,tags$1.bool,tags$1.special(tags$1.variableName)],color:whiskey},{tag:[tags$1.processingInstruction,tags$1.string,tags$1.inserted],color:sage},{tag:tags$1.invalid,color:invalid}]),oneDark=[oneDarkTheme,syntaxHighlighting(oneDarkHighlightStyle)];function initVim(s){var e=s.Pos;function r(u,p){var g=u.state.vim;if(!g||g.insertMode)return p.head;var y=g.sel.head;if(!y)return p.head;if(!(g.visualBlock&&p.head.line!=y.line))return p.from()==p.anchor&&!p.empty()&&p.head.line==y.line&&p.head.ch!=y.ch?new e(p.head.line,p.head.ch-1):p.head}function n(u,p,g){if(p.line===g.line&&p.ch>=g.ch-1){var y=u.getLine(p.line),b=y.charCodeAt(p.ch);55296<=b&&b<=55551&&(g.ch+=1)}return{start:p,end:g}}var o=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"g<Up>",type:"keyToKey",toKeys:"gk"},{keys:"g<Down>",type:"keyToKey",toKeys:"gj"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"<Del>",type:"keyToKey",toKeys:"x",context:"normal"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-Esc>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"keyToKey",toKeys:"i",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"(",type:"motion",motion:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"g$",type:"motion",motion:"moveToEndOfDisplayLine"},{keys:"g^",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"g0",type:"motion",motion:"moveToStartOfDisplayLine"},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:"=",type:"operator",operator:"indentAuto"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"gn",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!0}},{keys:"gN",type:"motion",motion:"findAndSelectNextInclusive",motionArgs:{forward:!1}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"expandToLine",motionArgs:{linewise:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"<C-u>",type:"operatorMotion",operator:"delete",motion:"moveToStartOfLine",context:"insert"},{keys:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-w>",type:"idle",context:"normal"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"gi",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"lastEdit"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"gI",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"bol"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"gJ",type:"action",action:"joinLines",actionArgs:{keepSpaces:!0},isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<character>",type:"action",action:"replayMacro"},{keys:"q<character>",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0},context:"normal"},{keys:"R",type:"operator",operator:"change",operatorArgs:{linewise:!0,fullLine:!0},context:"visual",exitVisualBlock:!0},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"<C-r>",type:"action",action:"redo"},{keys:"m<character>",type:"action",action:"setMark"},{keys:'"<character>',type:"action",action:"setRegister"},{keys:"<C-r><character>",type:"action",action:"insertRegister",context:"insert",isEdit:!0},{keys:"<C-o>",type:"action",action:"oneNormalCommand",context:"insert"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z<CR>",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<character>",type:"motion",motion:"textObjectManipulation"},{keys:"i<character>",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],a=o.length,l=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"omap",shortName:"om"},{name:"noremap",shortName:"no"},{name:"nnoremap",shortName:"nn"},{name:"vnoremap",shortName:"vn"},{name:"inoremap",shortName:"ino"},{name:"onoremap",shortName:"ono"},{name:"unmap"},{name:"mapclear",shortName:"mapc"},{name:"nmapclear",shortName:"nmapc"},{name:"vmapclear",shortName:"vmapc"},{name:"imapclear",shortName:"imapc"},{name:"omapclear",shortName:"omapc"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"vglobal",shortName:"v"},{name:"delete",shortName:"d"},{name:"join",shortName:"j"},{name:"normal",shortName:"norm"},{name:"global",shortName:"g"}];function c(u){u.setOption("disableInput",!0),u.setOption("showCursorWhenSelecting",!1),s.signal(u,"vim-mode-change",{mode:"normal"}),u.on("cursorActivity",un),$i(u),s.on(u.getInputField(),"paste",Y(u))}function h(u){u.setOption("disableInput",!1),u.off("cursorActivity",un),s.off(u.getInputField(),"paste",Y(u)),u.state.vim=null,kr&&clearTimeout(kr)}function f(u,p){this==s.keyMap.vim&&(u.options.$customCursor=null,s.rmClass(u.getWrapperElement(),"cm-fat-cursor")),(!p||p.attach!=d)&&h(u)}function d(u,p){this==s.keyMap.vim&&(u.curOp&&(u.curOp.selectionChanged=!0),u.options.$customCursor=r,s.addClass(u.getWrapperElement(),"cm-fat-cursor")),(!p||p.attach!=d)&&c(u)}s.defineOption("vimMode",!1,function(u,p,g){p&&u.getOption("keyMap")!="vim"?u.setOption("keyMap","vim"):!p&&g!=s.Init&&/^vim/.test(u.getOption("keyMap"))&&u.setOption("keyMap","default")});function m(u,p){if(p){if(this[u])return this[u];var g=B(u);if(!g)return!1;var y=Tt.findKey(p,g);return typeof y=="function"&&s.signal(p,"vim-keypress",g),y}}var v={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A",CapsLock:""},A={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"},T={};"Left|Right|Up|Down|End|Home".split("|").concat(Object.keys(A)).forEach(function(u){T[(A[u]||"").toLowerCase()]=T[u.toLowerCase()]=u});function B(u){if(u.charAt(0)=="'")return u.charAt(1);var p=u.split(/-(?!$)/),g=p[p.length-1];if(p.length==1&&p[0].length==1)return!1;if(p.length==2&&p[0]=="Shift"&&g.length==1)return!1;for(var y=!1,b=0;b<p.length;b++){var I=p[b];I in v?p[b]=v[I]:y=!0,I in A&&(p[b]=A[I])}return y?(ft(g)&&(p[p.length-1]=g.toLowerCase()),"<"+p.join("-")+">"):!1}function Y(u){var p=u.state.vim;return p.onPasteFn||(p.onPasteFn=function(){p.insertMode||(u.setCursor(wt(u.getCursor(),0,1)),mi.enterInsertMode(u,{},p))}),p.onPasteFn}var F=/[\d]/,ke=[s.isWordChar,function(u){return u&&!s.isWordChar(u)&&!/\s/.test(u)}],Qe=[function(u){return/\S/.test(u)}];function xe(u,p){for(var g=[],y=u;y<u+p;y++)g.push(String.fromCharCode(y));return g}var Te=xe(65,26),Le=xe(97,26),Me=xe(48,10),ot=[].concat(Te,Le,Me,["<",">"]),Fe=[].concat(Te,Le,Me,["-",'"',".",":","_","/","+"]),Ve;try{Ve=new RegExp("^[\\p{Lu}]$","u")}catch{Ve=/^[A-Z]$/}function at(u,p){return p>=u.firstLine()&&p<=u.lastLine()}function dt(u){return/^[a-z]$/.test(u)}function ct(u){return"()[]{}".indexOf(u)!=-1}function nt(u){return F.test(u)}function ft(u){return Ve.test(u)}function it(u){return/^\s*$/.test(u)}function pt(u){return".?!".indexOf(u)!=-1}function lt(u,p){for(var g=0;g<p.length;g++)if(p[g]==u)return!0;return!1}var st={};function mt(u,p,g,y,b){if(p===void 0&&!b)throw Error("defaultValue is required unless callback is provided");if(g||(g="string"),st[u]={type:g,defaultValue:p,callback:b},y)for(var I=0;I<y.length;I++)st[y[I]]=st[u];p&&Vt(u,p)}function Vt(u,p,g,y){var b=st[u];y=y||{};var I=y.scope;if(!b)return new Error("Unknown option: "+u);if(b.type=="boolean"){if(p&&p!==!0)return new Error("Invalid argument: "+u+"="+p);p!==!1&&(p=!0)}b.callback?(I!=="local"&&b.callback(p,void 0),I!=="global"&&g&&b.callback(p,g)):(I!=="local"&&(b.value=b.type=="boolean"?!!p:p),I!=="global"&&g&&(g.state.vim.options[u]={value:p}))}function Yt(u,p,g){var y=st[u];g=g||{};var b=g.scope;if(!y)return new Error("Unknown option: "+u);if(y.callback){var I=p&&y.callback(void 0,p);return b!=="global"&&I!==void 0?I:b!=="local"?y.callback():void 0}else{var I=b!=="global"&&p&&p.state.vim.options[u];return(I||b!=="local"&&y||{}).value}}mt("filetype",void 0,"string",["ft"],function(u,p){if(p!==void 0)if(u===void 0){var g=p.getOption("mode");return g=="null"?"":g}else{var g=u==""?"null":u;p.setOption("mode",g)}});var gi=function(){var u=100,p=-1,g=0,y=0,b=new Array(u);function I(R,V,Z){var $e=p%u,Pe=b[$e];function Oe(Ne){var Re=++p%u,He=b[Re];He&&He.clear(),b[Re]=R.setBookmark(Ne)}if(Pe){var oe=Pe.find();oe&&!H(oe,V)&&Oe(V)}else Oe(V);Oe(Z),g=p,y=p-u+1,y<0&&(y=0)}function P(R,V){p+=V,p>g?p=g:p<y&&(p=y);var Z=b[(u+p)%u];if(Z&&!Z.find()){var $e=V>0?1:-1,Pe,Oe=R.getCursor();do if(p+=$e,Z=b[(u+p)%u],Z&&(Pe=Z.find())&&!H(Oe,Pe))break;while(p<g&&p>y)}return Z}function M(R,V){var Z=p,$e=P(R,V);return p=Z,$e&&$e.find()}return{cachedCursor:void 0,add:I,find:M,move:P}},Oi=function(u){return u?{changes:u.changes,expectCursorActivityForChange:u.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};function Fi(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=Oi()}Fi.prototype={exitMacroRecordMode:function(){var u=Ye.macroModeState;u.onRecordingDone&&u.onRecordingDone(),u.onRecordingDone=void 0,u.isRecording=!1},enterMacroRecordMode:function(u,p){var g=Ye.registerController.getRegister(p);if(g){if(g.clear(),this.latestRegister=p,u.openDialog){var y=vi("span",{class:"cm-vim-message"},"recording @"+p);this.onRecordingDone=u.openDialog(y,null,{bottom:!0})}this.isRecording=!0}}};function $i(u){return u.state.vim||(u.state.vim={inputState:new Mi,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),u.state.vim}var Ye;function hr(){Ye={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:gi(),macroModeState:new Fi,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new fr({}),searchHistoryController:new qi,exCommandHistoryController:new qi};for(var u in st){var p=st[u];p.value=p.defaultValue}}var xi,Tt={enterVimMode:c,leaveVimMode:h,buildKeyMap:function(){},getRegisterController:function(){return Ye.registerController},resetVimGlobalState_:hr,getVimGlobalState_:function(){return Ye},maybeInitVimState_:$i,suppressErrorLogging:!1,InsertModeKey:Wr,map:function(u,p,g){ei.map(u,p,g)},unmap:function(u,p){return ei.unmap(u,p)},noremap:function(u,p,g){ei.map(u,p,g,!0)},mapclear:function(u){var p=o.length,g=a,y=o.slice(0,p-g);if(o=o.slice(p-g),u)for(var b=y.length-1;b>=0;b--){var I=y[b];if(u!==I.context)if(I.context)this._mapCommand(I);else{var P=["normal","insert","visual"];for(var M in P)if(P[M]!==u){var R={};for(var V in I)R[V]=I[V];R.context=P[M],this._mapCommand(R)}}}},setOption:Vt,getOption:Yt,defineOption:mt,defineEx:function(u,p,g){if(!p)p=u;else if(u.indexOf(p)!==0)throw new Error('(Vim.defineEx) "'+p+'" is not a prefix of "'+u+'", command not registered');ln[u]=g,ei.commandMap_[p]={name:u,shortName:p,type:"api"}},handleKey:function(u,p,g){var y=this.findKey(u,p,g);if(typeof y=="function")return y()},multiSelectHandleKey:Mn,findKey:function(u,p,g){var y=$i(u);function b(){var V=Ye.macroModeState;if(V.isRecording){if(p=="q")return V.exitMacroRecordMode(),Lt(u),!0;g!="mapping"&&Ln(V,p)}}function I(){if(p=="<Esc>"){if(y.visualMode)Ht(u);else if(y.insertMode)Ci(u);else return;return Lt(u),!0}}function P(){if(I())return!0;y.inputState.keyBuffer.push(p);var V=y.inputState.keyBuffer.join(""),Z=p.length==1,$e=ui.matchCommand(V,o,y.inputState,"insert"),Pe=y.inputState.changeQueue;if($e.type=="none")return Lt(u),!1;if($e.type=="partial"){if(xi&&window.clearTimeout(xi),xi=Z&&window.setTimeout(function(){y.insertMode&&y.inputState.keyBuffer.length&&Lt(u)},Yt("insertModeEscKeysTimeout")),Z){var Oe=u.listSelections();(!Pe||Pe.removed.length!=Oe.length)&&(Pe=y.inputState.changeQueue=new ur),Pe.inserted+=p;for(var oe=0;oe<Oe.length;oe++){var Ne=Qt(Oe[oe].anchor,Oe[oe].head),Re=kt(Oe[oe].anchor,Oe[oe].head),He=u.getRange(Ne,u.state.overwrite?wt(Re,0,1):Re);Pe.removed[oe]=(Pe.removed[oe]||"")+He}}return!Z}if(xi&&window.clearTimeout(xi),$e.command&&Pe){for(var Oe=u.listSelections(),oe=0;oe<Oe.length;oe++){var ze=Oe[oe].head;u.replaceRange(Pe.removed[oe]||"",wt(ze,0,-Pe.inserted.length),ze,"+input")}Ye.macroModeState.lastInsertModeChanges.changes.pop()}return $e.command||Lt(u),$e.command}function M(){if(b()||I())return!0;y.inputState.keyBuffer.push(p);var V=y.inputState.keyBuffer.join("");if(/^[1-9]\d*$/.test(V))return!0;var Z=/^(\d*)(.*)$/.exec(V);if(!Z)return Lt(u),!1;var $e=y.visualMode?"visual":"normal",Pe=Z[2]||Z[1];y.inputState.operatorShortcut&&y.inputState.operatorShortcut.slice(-1)==Pe&&(Pe=y.inputState.operatorShortcut);var Oe=ui.matchCommand(Pe,o,y.inputState,$e);return Oe.type=="none"?(Lt(u),!1):Oe.type=="partial"?!0:Oe.type=="clear"?(Lt(u),!0):(y.inputState.keyBuffer.length=0,Z=/^(\d*)(.*)$/.exec(V),Z[1]&&Z[1]!="0"&&y.inputState.pushRepeatDigit(Z[1]),Oe.command)}var R;return y.insertMode?R=P():R=M(),R===!1?!y.insertMode&&p.length===1?function(){return!0}:void 0:R===!0?function(){return!0}:function(){return u.operation(function(){u.curOp.isVimOp=!0;try{R.type=="keyToKey"?ji(u,R.toKeys,R):ui.processCommand(u,y,R)}catch(V){throw u.state.vim=void 0,$i(u),Tt.suppressErrorLogging||console.log(V),V}return!0})}},handleEx:function(u,p){ei.processCommand(u,p)},defineMotion:Qr,defineAction:Mr,defineOperator:Rr,mapCommand:Pn,_mapCommand:cn,defineRegister:Lr,exitVisualMode:Ht,exitInsertMode:Ci},Ui=[],zi=!1;function ji(u,p,g){if(g){if(Ui.indexOf(g)!=-1)return;Ui.push(g),zi=g.noremap}try{for(var y=$i(u),b=/<(?:[CSMA]-)*\w+>|./gi,I;I=b.exec(p);){var P=I[0],M=y.insertMode,R=Tt.handleKey(u,P,"mapping");if(!R&&M&&y.insertMode){if(P[0]=="<"){var Z=P.toLowerCase().slice(1,-1),V=Z.split("-"),Z=V.pop();if(Z=="lt")P="<";else if(Z=="space")P=" ";else if(Z=="cr")P=`
|
||
`;else if(T.hasOwnProperty(Z)){P=T[Z],gn(u,P);continue}else P=P[0],b.lastIndex=I.index+1}u.replaceSelection(P)}}}finally{zi=!1,Ui.length=0}}function Mi(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null,this.changeQueue=null}Mi.prototype.pushRepeatDigit=function(u){this.operator?this.motionRepeat=this.motionRepeat.concat(u):this.prefixRepeat=this.prefixRepeat.concat(u)},Mi.prototype.getRepeat=function(){var u=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(u=1,this.prefixRepeat.length>0&&(u*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(u*=parseInt(this.motionRepeat.join(""),10))),u};function Lt(u,p){u.state.vim.inputState=new Mi,s.signal(u,"vim-command-done",p)}function ur(){this.removed=[],this.inserted=""}function Gt(u,p,g){this.clear(),this.keyBuffer=[u||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!p,this.blockwise=!!g}Gt.prototype={setText:function(u,p,g){this.keyBuffer=[u||""],this.linewise=!!p,this.blockwise=!!g},pushText:function(u,p){p&&(this.linewise||this.keyBuffer.push(`
|
||
`),this.linewise=!0),this.keyBuffer.push(u)},pushInsertModeChanges:function(u){this.insertModeChanges.push(Oi(u))},pushSearchQuery:function(u){this.searchQueries.push(u)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}};function Lr(u,p){var g=Ye.registerController.registers;if(!u||u.length!=1)throw Error("Register name must be 1 character");if(g[u])throw Error("Register already defined "+u);g[u]=p,Fe.push(u)}function fr(u){this.registers=u,this.unnamedRegister=u['"']=new Gt,u["."]=new Gt,u[":"]=new Gt,u["/"]=new Gt,u["+"]=new Gt}fr.prototype={pushText:function(u,p,g,y,b){if(u!=="_"){y&&g.charAt(g.length-1)!==`
|
||
`&&(g+=`
|
||
`);var I=this.isValidRegister(u)?this.getRegister(u):null;if(!I){switch(p){case"yank":this.registers[0]=new Gt(g,y,b);break;case"delete":case"change":g.indexOf(`
|
||
`)==-1?this.registers["-"]=new Gt(g,y):(this.shiftNumericRegisters_(),this.registers[1]=new Gt(g,y));break}this.unnamedRegister.setText(g,y,b);return}var P=ft(u);P?I.pushText(g,y):I.setText(g,y,b),u==="+"&&navigator.clipboard.writeText(g),this.unnamedRegister.setText(I.toString(),y)}},getRegister:function(u){return this.isValidRegister(u)?(u=u.toLowerCase(),this.registers[u]||(this.registers[u]=new Gt),this.registers[u]):this.unnamedRegister},isValidRegister:function(u){return u&<(u,Fe)},shiftNumericRegisters_:function(){for(var u=9;u>=2;u--)this.registers[u]=this.getRegister(""+(u-1))}};function qi(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}qi.prototype={nextMatch:function(u,p){var g=this.historyBuffer,y=p?-1:1;this.initialPrefix===null&&(this.initialPrefix=u);for(var b=this.iterator+y;p?b>=0:b<g.length;b+=y)for(var I=g[b],P=0;P<=I.length;P++)if(this.initialPrefix==I.substring(0,P))return this.iterator=b,I;if(b>=g.length)return this.iterator=g.length,this.initialPrefix;if(b<0)return u},pushInput:function(u){var p=this.historyBuffer.indexOf(u);p>-1&&this.historyBuffer.splice(p,1),u.length&&this.historyBuffer.push(u)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var ui={matchCommand:function(u,p,g,y){var b=Er(u,p,y,g);if(!b.full&&!b.partial)return{type:"none"};if(!b.full&&b.partial)return{type:"partial"};for(var I,P=0;P<b.full.length;P++){var M=b.full[P];I||(I=M)}if(I.keys.slice(-11)=="<character>"){var R=Yr(u);if(!R||R.length>1)return{type:"clear"};g.selectedCharacter=R}return{type:"full",command:I}},processCommand:function(u,p,g){switch(p.inputState.repeatOverride=g.repeatOverride,g.type){case"motion":this.processMotion(u,p,g);break;case"operator":this.processOperator(u,p,g);break;case"operatorMotion":this.processOperatorMotion(u,p,g);break;case"action":this.processAction(u,p,g);break;case"search":this.processSearch(u,p,g);break;case"ex":case"keyToEx":this.processEx(u,p,g);break}},processMotion:function(u,p,g){p.inputState.motion=g.motion,p.inputState.motionArgs=Ei(g.motionArgs),this.evalInput(u,p)},processOperator:function(u,p,g){var y=p.inputState;if(y.operator)if(y.operator==g.operator){y.motion="expandToLine",y.motionArgs={linewise:!0},this.evalInput(u,p);return}else Lt(u);y.operator=g.operator,y.operatorArgs=Ei(g.operatorArgs),g.keys.length>1&&(y.operatorShortcut=g.keys),g.exitVisualBlock&&(p.visualBlock=!1,li(u)),p.visualMode&&this.evalInput(u,p)},processOperatorMotion:function(u,p,g){var y=p.visualMode,b=Ei(g.operatorMotionArgs);b&&y&&b.visualLine&&(p.visualLine=!0),this.processOperator(u,p,g),y||this.processMotion(u,p,g)},processAction:function(u,p,g){var y=p.inputState,b=y.getRepeat(),I=!!b,P=Ei(g.actionArgs)||{};y.selectedCharacter&&(P.selectedCharacter=y.selectedCharacter),g.operator&&this.processOperator(u,p,g),g.motion&&this.processMotion(u,p,g),(g.motion||g.operator)&&this.evalInput(u,p),P.repeat=b||1,P.repeatIsExplicit=I,P.registerName=y.registerName,Lt(u),p.lastMotion=null,g.isEdit&&this.recordLastEdit(p,y,g),mi[g.action](u,P,p)},processSearch:function(u,p,g){if(!u.getSearchCursor)return;var y=g.searchArgs.forward,b=g.searchArgs.wholeWordOnly;Se(u).setReversed(!y);var I=y?"/":"?",P=Se(u).getQuery(),M=u.getScrollInfo();function R(Re,He,ze){Ye.searchHistoryController.pushInput(Re),Ye.searchHistoryController.reset();try{rr(u,Re,He,ze)}catch{Ot(u,"Invalid regex: "+Re),Lt(u);return}ui.processMotion(u,p,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:g.searchArgs.toJumplist}})}function V(Re){u.scrollTo(M.left,M.top),R(Re,!0,!0);var He=Ye.macroModeState;He.isRecording&&Rn(He,Re)}function Z(Re,He,ze){var Ze=s.keyName(Re),yt,Dt;Ze=="Up"||Ze=="Down"?(yt=Ze=="Up",Dt=Re.target?Re.target.selectionEnd:0,He=Ye.searchHistoryController.nextMatch(He,yt)||"",ze(He),Dt&&Re.target&&(Re.target.selectionEnd=Re.target.selectionStart=Math.min(Dt,Re.target.value.length))):Ze!="Left"&&Ze!="Right"&&Ze!="Ctrl"&&Ze!="Alt"&&Ze!="Shift"&&Ye.searchHistoryController.reset();var It;try{It=rr(u,He,!0,!0)}catch{}It?u.scrollIntoView(nn(u,!y,It),30):(Gr(u),u.scrollTo(M.left,M.top))}function $e(Re,He,ze){var Ze=s.keyName(Re);Ze=="Esc"||Ze=="Ctrl-C"||Ze=="Ctrl-["||Ze=="Backspace"&&He==""?(Ye.searchHistoryController.pushInput(He),Ye.searchHistoryController.reset(),rr(u,P),Gr(u),u.scrollTo(M.left,M.top),s.e_stop(Re),Lt(u),ze(),u.focus()):Ze=="Up"||Ze=="Down"?s.e_stop(Re):Ze=="Ctrl-U"&&(s.e_stop(Re),ze(""))}switch(g.searchArgs.querySrc){case"prompt":var Pe=Ye.macroModeState;if(Pe.isPlaying){var Ne=Pe.replaySearchQueries.shift();R(Ne,!0,!1)}else wr(u,{onClose:V,prefix:I,desc:"(JavaScript regexp)",onKeyUp:Z,onKeyDown:$e});break;case"wordUnderCursor":var Oe=Bi(u,!1,!1,!1,!0),oe=!0;if(Oe||(Oe=Bi(u,!1,!1,!1,!1),oe=!1),!Oe)return;var Ne=u.getLine(Oe.start.line).substring(Oe.start.ch,Oe.end.ch);oe&&b?Ne="\\b"+Ne+"\\b":Ne=Yi(Ne),Ye.jumpList.cachedCursor=u.getCursor(),u.setCursor(Oe.start),R(Ne,!0,!1);break}},processEx:function(u,p,g){function y(I){Ye.exCommandHistoryController.pushInput(I),Ye.exCommandHistoryController.reset(),ei.processCommand(u,I),u.state.vim&&Lt(u)}function b(I,P,M){var R=s.keyName(I),V,Z;(R=="Esc"||R=="Ctrl-C"||R=="Ctrl-["||R=="Backspace"&&P=="")&&(Ye.exCommandHistoryController.pushInput(P),Ye.exCommandHistoryController.reset(),s.e_stop(I),Lt(u),M(),u.focus()),R=="Up"||R=="Down"?(s.e_stop(I),V=R=="Up",Z=I.target?I.target.selectionEnd:0,P=Ye.exCommandHistoryController.nextMatch(P,V)||"",M(P),Z&&I.target&&(I.target.selectionEnd=I.target.selectionStart=Math.min(Z,I.target.value.length))):R=="Ctrl-U"?(s.e_stop(I),M("")):R!="Left"&&R!="Right"&&R!="Ctrl"&&R!="Alt"&&R!="Shift"&&Ye.exCommandHistoryController.reset()}g.type=="keyToEx"?ei.processCommand(u,g.exArgs.input):p.visualMode?wr(u,{onClose:y,prefix:":",value:"'<,'>",onKeyDown:b,selectValueOnOpen:!1}):wr(u,{onClose:y,prefix:":",onKeyDown:b})},evalInput:function(u,p){var g=p.inputState,y=g.motion,b=g.motionArgs||{},I=g.operator,P=g.operatorArgs||{},M=g.registerName,R=p.sel,V=gt(p.visualMode?Nt(u,R.head):u.getCursor("head")),Z=gt(p.visualMode?Nt(u,R.anchor):u.getCursor("anchor")),$e=gt(V),Pe=gt(Z),Oe,oe,Ne;if(I&&this.recordLastEdit(p,g),g.repeatOverride!==void 0?Ne=g.repeatOverride:Ne=g.getRepeat(),Ne>0&&b.explicitRepeat?b.repeatIsExplicit=!0:(b.noRepeat||!b.explicitRepeat&&Ne===0)&&(Ne=1,b.repeatIsExplicit=!1),g.selectedCharacter&&(b.selectedCharacter=P.selectedCharacter=g.selectedCharacter),b.repeat=Ne,Lt(u),y){var Re=Kt[y](u,V,b,p,g);if(p.lastMotion=Kt[y],!Re)return;if(b.toJumplist){var He=Ye.jumpList,ze=He.cachedCursor;ze?(Xi(u,ze,Re),delete He.cachedCursor):Xi(u,V,Re)}Re instanceof Array?(oe=Re[0],Oe=Re[1]):Oe=Re,Oe||(Oe=gt(V)),p.visualMode?(p.visualBlock&&Oe.ch===1/0||(Oe=Nt(u,Oe,$e)),oe&&(oe=Nt(u,oe)),oe=oe||Pe,R.anchor=oe,R.head=Oe,li(u),qt(u,p,"<",qe(oe,Oe)?oe:Oe),qt(u,p,">",qe(oe,Oe)?Oe:oe)):I||(Oe=Nt(u,Oe,$e),u.setCursor(Oe.line,Oe.ch))}if(I){if(P.lastSel){oe=Pe;var Ze=P.lastSel,yt=Math.abs(Ze.head.line-Ze.anchor.line),Dt=Math.abs(Ze.head.ch-Ze.anchor.ch);Ze.visualLine?Oe=new e(Pe.line+yt,Pe.ch):Ze.visualBlock?Oe=new e(Pe.line+yt,Pe.ch+Dt):Ze.head.line==Ze.anchor.line?Oe=new e(Pe.line,Pe.ch+Dt):Oe=new e(Pe.line+yt,Pe.ch),p.visualMode=!0,p.visualLine=Ze.visualLine,p.visualBlock=Ze.visualBlock,R=p.sel={anchor:oe,head:Oe},li(u)}else p.visualMode&&(P.lastSel={anchor:gt(R.anchor),head:gt(R.head),visualBlock:p.visualBlock,visualLine:p.visualLine});var It,Rt,ht,ut,Xt;if(p.visualMode){It=Qt(R.head,R.anchor),Rt=kt(R.head,R.anchor),ht=p.visualLine||P.linewise,ut=p.visualBlock?"block":ht?"line":"char";var $t=n(u,It,Rt);if(Xt=et(u,{anchor:$t.start,head:$t.end},ut),ht){var xt=Xt.ranges;if(ut=="block")for(var bi=0;bi<xt.length;bi++)xt[bi].head.ch=De(u,xt[bi].head.line);else ut=="line"&&(xt[0].head=new e(xt[0].head.line+1,0))}}else{if(It=gt(oe||Pe),Rt=gt(Oe||$e),qe(Rt,It)){var En=It;It=Rt,Rt=En}ht=b.linewise||P.linewise,ht?Di(u,It,Rt):b.forward&&Xr(u,It,Rt),ut="char";var Nn=!b.inclusive||ht,$t=n(u,It,Rt);Xt=et(u,{anchor:$t.start,head:$t.end},ut,Nn)}u.setSelections(Xt.ranges,Xt.primary),p.lastMotion=null,P.repeat=Ne,P.registerName=M,P.linewise=ht;var Ur=Ki[I](u,P,Xt.ranges,Pe,Oe);p.visualMode&&Ht(u,Ur!=null),Ur&&u.setCursor(Ur)}},recordLastEdit:function(u,p,g){var y=Ye.macroModeState;y.isPlaying||(u.lastEditInputState=p,u.lastEditActionCommand=g,y.lastInsertModeChanges.changes=[],y.lastInsertModeChanges.expectCursorActivityForChange=!1,y.lastInsertModeChanges.visualBlock=u.visualBlock?u.sel.head.line-u.sel.anchor.line:0)}},Kt={moveToTopLine:function(u,p,g){var y=Hr(u).top+g.repeat-1;return new e(y,Jt(u.getLine(y)))},moveToMiddleLine:function(u){var p=Hr(u),g=Math.floor((p.top+p.bottom)*.5);return new e(g,Jt(u.getLine(g)))},moveToBottomLine:function(u,p,g){var y=Hr(u).bottom-g.repeat+1;return new e(y,Jt(u.getLine(y)))},expandToLine:function(u,p,g){var y=p;return new e(y.line+g.repeat-1,1/0)},findNext:function(u,p,g){var y=Se(u),b=y.getQuery();if(b){var I=!g.forward;return I=y.isReversed()?!I:I,rn(u,b),nn(u,I,b,g.repeat)}},findAndSelectNextInclusive:function(u,p,g,y,b){var I=Se(u),P=I.getQuery();if(P){var M=!g.forward;M=I.isReversed()?!M:M;var R=$n(u,M,P,g.repeat,y);if(R){if(b.operator)return R;var V=R[0],Z=new e(R[1].line,R[1].ch-1);if(y.visualMode){(y.visualLine||y.visualBlock)&&(y.visualLine=!1,y.visualBlock=!1,s.signal(u,"vim-mode-change",{mode:"visual",subMode:""}));var $e=y.sel.anchor;if($e)return I.isReversed()?g.forward?[$e,V]:[$e,Z]:g.forward?[$e,Z]:[$e,V]}else y.visualMode=!0,y.visualLine=!1,y.visualBlock=!1,s.signal(u,"vim-mode-change",{mode:"visual",subMode:""});return M?[Z,V]:[V,Z]}}},goToMark:function(u,p,g,y){var b=$r(u,y,g.selectedCharacter);return b?g.linewise?{line:b.line,ch:Jt(u.getLine(b.line))}:b:null},moveToOtherHighlightedEnd:function(u,p,g,y){if(y.visualBlock&&g.sameLine){var b=y.sel;return[Nt(u,new e(b.anchor.line,b.head.ch)),Nt(u,new e(b.head.line,b.anchor.ch))]}else return[y.sel.head,y.sel.anchor]},jumpToMark:function(u,p,g,y){for(var b=p,I=0;I<g.repeat;I++){var P=b;for(var M in y.marks)if(dt(M)){var R=y.marks[M].find(),V=g.forward?qe(R,P):qe(P,R);if(!V&&!(g.linewise&&R.line==P.line)){var Z=H(P,b),$e=g.forward?Ni(P,R,b):Ni(b,R,P);(Z||$e)&&(b=R)}}}return g.linewise&&(b=new e(b.line,Jt(u.getLine(b.line)))),b},moveByCharacters:function(u,p,g){var y=p,b=g.repeat,I=g.forward?y.ch+b:y.ch-b;return new e(y.line,I)},moveByLines:function(u,p,g,y){var b=p,I=b.ch;switch(y.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:I=y.lastHPos;break;default:y.lastHPos=I}var P=g.repeat+(g.repeatOffset||0),M=g.forward?b.line+P:b.line-P,R=u.firstLine(),V=u.lastLine(),Z=u.findPosV(b,g.forward?P:-P,"line",y.lastHSPos),$e=g.forward?Z.line>M:Z.line<M;return $e&&(M=Z.line,I=Z.ch),M<R&&b.line==R?this.moveToStartOfLine(u,p,g,y):M>V&&b.line==V?tr(u,p,g,y,!0):(g.toFirstChar&&(I=Jt(u.getLine(M)),y.lastHPos=I),y.lastHSPos=u.charCoords(new e(M,I),"div").left,new e(M,I))},moveByDisplayLines:function(u,p,g,y){var b=p;switch(y.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:y.lastHSPos=u.charCoords(b,"div").left}var I=g.repeat,P=u.findPosV(b,g.forward?I:-I,"line",y.lastHSPos);if(P.hitSide)if(g.forward)var M=u.charCoords(P,"div"),R={top:M.top+8,left:y.lastHSPos},P=u.coordsChar(R,"div");else{var V=u.charCoords(new e(u.firstLine(),0),"div");V.left=y.lastHSPos,P=u.coordsChar(V,"div")}return y.lastHPos=P.ch,P},moveByPage:function(u,p,g){var y=p,b=g.repeat;return u.findPosV(y,g.forward?b:-b,"page")},moveByParagraph:function(u,p,g){var y=g.forward?1:-1;return Pi(u,p,g.repeat,y)},moveBySentence:function(u,p,g){var y=g.forward?1:-1;return Ir(u,p,g.repeat,y)},moveByScroll:function(u,p,g,y){var b=u.getScrollInfo(),I=null,P=g.repeat;P||(P=b.clientHeight/(2*u.defaultTextHeight()));var M=u.charCoords(p,"local");if(g.repeat=P,I=Kt.moveByDisplayLines(u,p,g,y),!I)return null;var R=u.charCoords(I,"local");return u.scrollTo(null,b.top+R.top-M.top),I},moveByWords:function(u,p,g){return Zr(u,p,g.repeat,!!g.forward,!!g.wordEnd,!!g.bigWord)},moveTillCharacter:function(u,p,g){var y=g.repeat,b=ir(u,y,g.forward,g.selectedCharacter,p),I=g.forward?-1:1;return Si(I,g),b?(b.ch+=I,b):null},moveToCharacter:function(u,p,g){var y=g.repeat;return Si(0,g),ir(u,y,g.forward,g.selectedCharacter,p)||p},moveToSymbol:function(u,p,g){var y=g.repeat;return er(u,y,g.forward,g.selectedCharacter)||p},moveToColumn:function(u,p,g,y){var b=g.repeat;return y.lastHPos=b-1,y.lastHSPos=u.charCoords(p,"div").left,_r(u,b)},moveToEol:function(u,p,g,y){return tr(u,p,g,y,!1)},moveToFirstNonWhiteSpaceCharacter:function(u,p){var g=p;return new e(g.line,Jt(u.getLine(g.line)))},moveToMatchedSymbol:function(u,p){for(var g=p,y=g.line,b=g.ch,I=u.getLine(y),P;b<I.length;b++)if(P=I.charAt(b),P&&ct(P)){var M=u.getTokenTypeAt(new e(y,b+1));if(M!=="string"&&M!=="comment")break}if(b<I.length){var R=b==="<"||b===">"?/[(){}[\]<>]/:/[(){}[\]]/,V=u.findMatchingBracket(new e(y,b),{bracketRegex:R});return V.to}else return g},moveToStartOfLine:function(u,p){return new e(p.line,0)},moveToLineOrEdgeOfDocument:function(u,p,g){var y=g.forward?u.lastLine():u.firstLine();return g.repeatIsExplicit&&(y=g.repeat-u.getOption("firstLineNumber")),new e(y,Jt(u.getLine(y)))},moveToStartOfDisplayLine:function(u){return u.execCommand("goLineLeft"),u.getCursor()},moveToEndOfDisplayLine:function(u){u.execCommand("goLineRight");var p=u.getCursor();return p.sticky=="before"&&p.ch--,p},textObjectManipulation:function(u,p,g,y){var b={"(":")",")":"(","{":"}","}":"{","[":"]","]":"[","<":">",">":"<"},I={"'":!0,'"':!0,"`":!0},P=g.selectedCharacter;P=="b"?P="(":P=="B"&&(P="{");var M=!g.textObjectInner,R,V;if(b[P]){if(V=!0,R=Wt(u,p,P,M),!R){var Z=u.getSearchCursor(new RegExp("\\"+P,"g"),p);Z.find()&&(R=Wt(u,Z.from(),P,M))}}else if(I[P])V=!0,R=X(u,p,P,M);else if(P==="W")R=Bi(u,M,!M,!0);else if(P==="w")R=Bi(u,M,!M,!1);else if(P==="p")if(R=Pi(u,p,g.repeat,0,M),g.linewise=!0,y.visualMode)y.visualLine||(y.visualLine=!0);else{var $e=y.inputState.operatorArgs;$e&&($e.linewise=!0),R.end.line--}else if(P==="t")R=Sr(u,p,M);else if(P==="s"){var Pe=u.getLine(p.line);p.ch>0&&pt(Pe[p.ch])&&(p.ch-=1);var Oe=br(u,p,g.repeat,1,M),oe=br(u,p,g.repeat,-1,M);it(u.getLine(oe.line)[oe.ch])&&it(u.getLine(Oe.line)[Oe.ch-1])&&(oe={line:oe.line,ch:oe.ch+1}),R={start:oe,end:Oe}}return R?u.state.vim.visualMode?mr(u,R.start,R.end,V):[R.start,R.end]:null},repeatLastCharacterSearch:function(u,p,g){var y=Ye.lastCharacterSearch,b=g.repeat,I=g.forward===y.forward,P=(y.increment?1:0)*(I?-1:1);u.moveH(-P,"char"),g.inclusive=!!I;var M=ir(u,b,I,y.selectedCharacter);return M?(M.ch+=P,M):(u.moveH(P,"char"),p)}};function Qr(u,p){Kt[u]=p}function dr(u,p){for(var g=[],y=0;y<p;y++)g.push(u);return g}var Ki={change:function(u,p,g){var y,b,I=u.state.vim,P=g[0].anchor,M=g[0].head;if(I.visualMode)if(p.fullLine)M.ch=Number.MAX_VALUE,M.line--,u.setSelection(P,M),b=u.getSelection(),u.replaceSelection(""),y=P;else{b=u.getSelection();var Pe=dr("",g.length);u.replaceSelections(Pe),y=Qt(g[0].head,g[0].anchor)}else{b=u.getRange(P,M);var R=I.lastEditInputState||{};if(R.motion=="moveByWords"&&!it(b)){var V=/\s+$/.exec(b);V&&R.motionArgs&&R.motionArgs.forward&&(M=wt(M,0,-V[0].length),b=b.slice(0,-V[0].length))}var Z=new e(P.line-1,Number.MAX_VALUE),$e=u.firstLine()==u.lastLine();M.line>u.lastLine()&&p.linewise&&!$e?u.replaceRange("",Z,M):u.replaceRange("",P,M),p.linewise&&($e||(u.setCursor(Z),s.commands.newlineAndIndent(u)),P.ch=Number.MAX_VALUE),y=P}Ye.registerController.pushText(p.registerName,"change",b,p.linewise,g.length>1),mi.enterInsertMode(u,{head:y},u.state.vim)},delete:function(u,p,g){var y,b,I=u.state.vim;if(I.visualBlock){b=u.getSelection();var R=dr("",g.length);u.replaceSelections(R),y=Qt(g[0].head,g[0].anchor)}else{var P=g[0].anchor,M=g[0].head;p.linewise&&M.line!=u.firstLine()&&P.line==u.lastLine()&&P.line==M.line-1&&(P.line==u.firstLine()?P.ch=0:P=new e(P.line-1,De(u,P.line-1))),b=u.getRange(P,M),u.replaceRange("",P,M),y=P,p.linewise&&(y=Kt.moveToFirstNonWhiteSpaceCharacter(u,P))}return Ye.registerController.pushText(p.registerName,"delete",b,p.linewise,I.visualBlock),Nt(u,y)},indent:function(u,p,g){var y=u.state.vim;if(u.indentMore)for(var b=y.visualMode?p.repeat:1,I=0;I<b;I++)p.indentRight?u.indentMore():u.indentLess();else{var P=g[0].anchor.line,M=y.visualBlock?g[g.length-1].anchor.line:g[0].head.line,b=y.visualMode?p.repeat:1;p.linewise&&M--;for(var R=P;R<=M;R++)for(var I=0;I<b;I++)u.indentLine(R,p.indentRight)}return Kt.moveToFirstNonWhiteSpaceCharacter(u,g[0].anchor)},indentAuto:function(u,p,g){return u.execCommand("indentAuto"),Kt.moveToFirstNonWhiteSpaceCharacter(u,g[0].anchor)},changeCase:function(u,p,g,y,b){for(var I=u.getSelections(),P=[],M=p.toLower,R=0;R<I.length;R++){var V=I[R],Z="";if(M===!0)Z=V.toLowerCase();else if(M===!1)Z=V.toUpperCase();else for(var $e=0;$e<V.length;$e++){var Pe=V.charAt($e);Z+=ft(Pe)?Pe.toLowerCase():Pe.toUpperCase()}P.push(Z)}return u.replaceSelections(P),p.shouldMoveCursor?b:!u.state.vim.visualMode&&p.linewise&&g[0].anchor.line+1==g[0].head.line?Kt.moveToFirstNonWhiteSpaceCharacter(u,y):p.linewise?y:Qt(g[0].anchor,g[0].head)},yank:function(u,p,g,y){var b=u.state.vim,I=u.getSelection(),P=b.visualMode?Qt(b.sel.anchor,b.sel.head,g[0].head,g[0].anchor):y;return Ye.registerController.pushText(p.registerName,"yank",I,p.linewise,b.visualBlock),P}};function Rr(u,p){Ki[u]=p}var mi={jumpListWalk:function(u,p,g){if(!g.visualMode){var y=p.repeat,b=p.forward,I=Ye.jumpList,P=I.move(u,b?y:-y),M=P?P.find():void 0;M=M||u.getCursor(),u.setCursor(M)}},scroll:function(u,p,g){if(!g.visualMode){var y=p.repeat||1,b=u.defaultTextHeight(),I=u.getScrollInfo().top,P=b*y,M=p.forward?I+P:I-P,R=gt(u.getCursor()),V=u.charCoords(R,"local");if(p.forward)M>V.top?(R.line+=(M-V.top)/b,R.line=Math.ceil(R.line),u.setCursor(R),V=u.charCoords(R,"local"),u.scrollTo(null,V.top)):u.scrollTo(null,M);else{var Z=M+u.getScrollInfo().clientHeight;Z<V.bottom?(R.line-=(V.bottom-Z)/b,R.line=Math.floor(R.line),u.setCursor(R),V=u.charCoords(R,"local"),u.scrollTo(null,V.bottom-u.getScrollInfo().clientHeight)):u.scrollTo(null,M)}}},scrollToCursor:function(u,p){var g=u.getCursor().line,y=u.charCoords(new e(g,0),"local"),b=u.getScrollInfo().clientHeight,I=y.top;switch(p.position){case"center":I=y.bottom-b/2;break;case"bottom":var P=new e(g,u.getLine(g).length-1),M=u.charCoords(P,"local"),R=M.bottom-I;I=I-b+R;break}u.scrollTo(null,I)},replayMacro:function(u,p,g){var y=p.selectedCharacter,b=p.repeat,I=Ye.macroModeState;for(y=="@"?y=I.latestRegister:I.latestRegister=y;b--;)Tn(u,g,I,y)},enterMacroRecordMode:function(u,p){var g=Ye.macroModeState,y=p.selectedCharacter;Ye.registerController.isValidRegister(y)&&g.enterMacroRecordMode(u,y)},toggleOverwrite:function(u){u.state.overwrite?(u.toggleOverwrite(!1),u.setOption("keyMap","vim-insert"),s.signal(u,"vim-mode-change",{mode:"insert"})):(u.toggleOverwrite(!0),u.setOption("keyMap","vim-replace"),s.signal(u,"vim-mode-change",{mode:"replace"}))},enterInsertMode:function(u,p,g){if(!u.getOption("readOnly")){g.insertMode=!0,g.insertModeRepeat=p&&p.repeat||1;var y=p?p.insertAt:null,b=g.sel,I=p.head||u.getCursor("head"),P=u.listSelections().length;if(y=="eol")I=new e(I.line,De(u,I.line));else if(y=="bol")I=new e(I.line,0);else if(y=="charAfter"){var M=n(u,I,wt(I,0,1));I=M.end}else if(y=="firstNonBlank"){var M=n(u,I,Kt.moveToFirstNonWhiteSpaceCharacter(u,I));I=M.end}else if(y=="startOfSelectedArea"){if(!g.visualMode)return;g.visualBlock?(I=new e(Math.min(b.head.line,b.anchor.line),Math.min(b.head.ch,b.anchor.ch)),P=Math.abs(b.head.line-b.anchor.line)+1):b.head.line<b.anchor.line?I=b.head:I=new e(b.anchor.line,0)}else if(y=="endOfSelectedArea"){if(!g.visualMode)return;g.visualBlock?(I=new e(Math.min(b.head.line,b.anchor.line),Math.max(b.head.ch,b.anchor.ch)+1),P=Math.abs(b.head.line-b.anchor.line)+1):b.head.line>=b.anchor.line?I=wt(b.head,0,1):I=new e(b.anchor.line,0)}else if(y=="inplace"){if(g.visualMode)return}else y=="lastEdit"&&(I=sn(u)||I);u.setOption("disableInput",!1),p&&p.replace?(u.toggleOverwrite(!0),u.setOption("keyMap","vim-replace"),s.signal(u,"vim-mode-change",{mode:"replace"})):(u.toggleOverwrite(!1),u.setOption("keyMap","vim-insert"),s.signal(u,"vim-mode-change",{mode:"insert"})),Ye.macroModeState.isPlaying||(u.on("change",hn),g.insertEnd&&g.insertEnd.clear(),g.insertEnd=u.setBookmark(I,{insertLeft:!0}),s.on(u.getInputField(),"keydown",dn)),g.visualMode&&Ht(u),bt(u,I,P)}},toggleVisualMode:function(u,p,g){var y=p.repeat,b=u.getCursor(),I;if(g.visualMode)g.visualLine^p.linewise||g.visualBlock^p.blockwise?(g.visualLine=!!p.linewise,g.visualBlock=!!p.blockwise,s.signal(u,"vim-mode-change",{mode:"visual",subMode:g.visualLine?"linewise":g.visualBlock?"blockwise":""}),li(u)):Ht(u);else{g.visualMode=!0,g.visualLine=!!p.linewise,g.visualBlock=!!p.blockwise,I=Nt(u,new e(b.line,b.ch+y-1));var P=n(u,b,I);g.sel={anchor:P.start,head:P.end},s.signal(u,"vim-mode-change",{mode:"visual",subMode:g.visualLine?"linewise":g.visualBlock?"blockwise":""}),li(u),qt(u,g,"<",Qt(b,I)),qt(u,g,">",kt(b,I))}},reselectLastSelection:function(u,p,g){var y=g.lastSelection;if(g.visualMode&&Or(u,g),y){var b=y.anchorMark.find(),I=y.headMark.find();if(!b||!I)return;g.sel={anchor:b,head:I},g.visualMode=!0,g.visualLine=y.visualLine,g.visualBlock=y.visualBlock,li(u),qt(u,g,"<",Qt(b,I)),qt(u,g,">",kt(b,I)),s.signal(u,"vim-mode-change",{mode:"visual",subMode:g.visualLine?"linewise":g.visualBlock?"blockwise":""})}},joinLines:function(u,p,g){var y,b;if(g.visualMode){if(y=u.getCursor("anchor"),b=u.getCursor("head"),qe(b,y)){var I=b;b=y,y=I}b.ch=De(u,b.line)-1}else{var P=Math.max(p.repeat,2);y=u.getCursor(),b=Nt(u,new e(y.line+P-1,1/0))}for(var M=0,R=y.line;R<b.line;R++){M=De(u,y.line);var V="",Z=0;if(!p.keepSpaces){var $e=u.getLine(y.line+1);Z=$e.search(/\S/),Z==-1?Z=$e.length:V=" "}u.replaceRange(V,new e(y.line,M),new e(y.line+1,Z))}var Pe=Nt(u,new e(y.line,M));g.visualMode&&Ht(u,!1),u.setCursor(Pe)},newLineAndEnterInsertMode:function(u,p,g){g.insertMode=!0;var y=gt(u.getCursor());if(y.line===u.firstLine()&&!p.after)u.replaceRange(`
|
||
`,new e(u.firstLine(),0)),u.setCursor(u.firstLine(),0);else{y.line=p.after?y.line:y.line-1,y.ch=De(u,y.line),u.setCursor(y);var b=s.commands.newlineAndIndentContinueComment||s.commands.newlineAndIndent;b(u)}this.enterInsertMode(u,{repeat:p.repeat},g)},paste:function(u,p,g){var y=Ye.registerController.getRegister(p.registerName);if(p.registerName==="+")navigator.clipboard.readText().then(I=>{this.continuePaste(u,p,g,I,y)});else{var b=y.toString();this.continuePaste(u,p,g,b,y)}},continuePaste:function(u,p,g,y,b){var I=gt(u.getCursor());if(y){if(p.matchIndent){var P=u.getOption("tabSize"),M=function($t){var xt=$t.split(" ").length-1,bi=$t.split(" ").length-1;return xt*P+bi*1},R=u.getLine(u.getCursor().line),V=M(R.match(/^\s*/)[0]),Z=y.replace(/\n$/,""),$e=y!==Z,Pe=M(y.match(/^\s*/)[0]),y=Z.replace(/^\s*/gm,function($t){var xt=V+(M($t)-Pe);if(xt<0)return"";if(u.getOption("indentWithTabs")){var bi=Math.floor(xt/P);return Array(bi+1).join(" ")}else return Array(xt+1).join(" ")});y+=$e?`
|
||
`:""}if(p.repeat>1)var y=Array(p.repeat+1).join(y);var Oe=b.linewise,oe=b.blockwise;if(oe){y=y.split(`
|
||
`),Oe&&y.pop();for(var Ne=0;Ne<y.length;Ne++)y[Ne]=y[Ne]==""?" ":y[Ne];I.ch+=p.after?1:0,I.ch=Math.min(De(u,I.line),I.ch)}else Oe?g.visualMode?y=g.visualLine?y.slice(0,-1):`
|
||
`+y.slice(0,y.length-1)+`
|
||
`:p.after?(y=`
|
||
`+y.slice(0,y.length-1),I.ch=De(u,I.line)):I.ch=0:I.ch+=p.after?1:0;var Re;if(g.visualMode){g.lastPastedText=y;var He,ze=Dr(u,g),Ze=ze[0],yt=ze[1],Dt=u.getSelection(),It=u.listSelections(),Rt=new Array(It.length).join("1").split("1");g.lastSelection&&(He=g.lastSelection.headMark.find()),Ye.registerController.unnamedRegister.setText(Dt),oe?(u.replaceSelections(Rt),yt=new e(Ze.line+y.length-1,Ze.ch),u.setCursor(Ze),gr(u,yt),u.replaceSelections(y),Re=Ze):g.visualBlock?(u.replaceSelections(Rt),u.setCursor(Ze),u.replaceRange(y,Ze,Ze),Re=Ze):(u.replaceRange(y,Ze,yt),Re=u.posFromIndex(u.indexFromPos(Ze)+y.length-1)),He&&(g.lastSelection.headMark=u.setBookmark(He)),Oe&&(Re.ch=0)}else if(oe){u.setCursor(I);for(var Ne=0;Ne<y.length;Ne++){var ht=I.line+Ne;ht>u.lastLine()&&u.replaceRange(`
|
||
`,new e(ht,0));var ut=De(u,ht);ut<I.ch&&Ai(u,ht,I.ch)}u.setCursor(I),gr(u,new e(I.line+y.length-1,I.ch)),u.replaceSelections(y),Re=I}else if(u.replaceRange(y,I),Oe){var ht=p.after?I.line+1:I.line;Re=new e(ht,Jt(u.getLine(ht)))}else Re=gt(I),/\n/.test(y)||(Re.ch+=y.length-(p.after?1:0));g.visualMode&&Ht(u,!1),u.setCursor(Re)}},undo:function(u,p){u.operation(function(){pr(u,s.commands.undo,p.repeat)(),u.setCursor(Nt(u,u.getCursor("start")))})},redo:function(u,p){pr(u,s.commands.redo,p.repeat)()},setRegister:function(u,p,g){g.inputState.registerName=p.selectedCharacter},insertRegister:function(u,p,g){var y=p.selectedCharacter,b=Ye.registerController.getRegister(y),I=b&&b.toString();I&&u.replaceSelection(I)},oneNormalCommand:function(u,p,g){Ci(u,!0),g.insertModeReturn=!0,s.on(u,"vim-command-done",function y(){g.visualMode||(g.insertModeReturn&&(g.insertModeReturn=!1,g.insertMode||mi.enterInsertMode(u,{},g)),s.off(u,"vim-command-done",y))})},setMark:function(u,p,g){var y=p.selectedCharacter;qt(u,g,y,u.getCursor())},replace:function(u,p,g){var y=p.selectedCharacter,b=u.getCursor(),I,P,M=u.listSelections();if(g.visualMode)b=u.getCursor("start"),P=u.getCursor("end");else{var R=u.getLine(b.line);I=b.ch+p.repeat,I>R.length&&(I=R.length),P=new e(b.line,I)}var V=n(u,b,P);if(b=V.start,P=V.end,y==`
|
||
`)g.visualMode||u.replaceRange("",b,P),(s.commands.newlineAndIndentContinueComment||s.commands.newlineAndIndent)(u);else{var Z=u.getRange(b,P);if(Z=Z.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,y),Z=Z.replace(/[^\n]/g,y),g.visualBlock){var $e=new Array(u.getOption("tabSize")+1).join(" ");Z=u.getSelection(),Z=Z.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,y),Z=Z.replace(/\t/g,$e).replace(/[^\n]/g,y).split(`
|
||
`),u.replaceSelections(Z)}else u.replaceRange(Z,b,P);g.visualMode?(b=qe(M[0].anchor,M[0].head)?M[0].anchor:M[0].head,u.setCursor(b),Ht(u,!1)):u.setCursor(wt(P,0,-1))}},incrementNumberToken:function(u,p){for(var g=u.getCursor(),y=u.getLine(g.line),b=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi,I,P,M,R;(I=b.exec(y))!==null&&(P=I.index,M=P+I[0].length,!(g.ch<M)););if(!(!p.backtrack&&M<=g.ch)){if(I){var V=I[2]||I[4],Z=I[3]||I[5],$e=p.increase?1:-1,Pe={"0b":2,0:8,"":10,"0x":16}[V.toLowerCase()],Oe=parseInt(I[1]+Z,Pe)+$e*p.repeat;R=Oe.toString(Pe);var oe=V?new Array(Z.length-R.length+1+I[1].length).join("0"):"";R.charAt(0)==="-"?R="-"+V+oe+R.substr(1):R=V+oe+R;var Ne=new e(g.line,P),Re=new e(g.line,M);u.replaceRange(R,Ne,Re)}else return;u.setCursor(new e(g.line,P+R.length-1))}},repeatLastEdit:function(u,p,g){var y=g.lastEditInputState;if(y){var b=p.repeat;b&&p.repeatIsExplicit?g.lastEditInputState.repeatOverride=b:b=g.lastEditInputState.repeatOverride||b,pn(u,g,b,!1)}},indent:function(u,p){u.indentLine(u.getCursor().line,p.indentRight)},exitInsertMode:Ci};function Mr(u,p){mi[u]=p}function Nt(u,p,g){var y=u.state.vim,b=y.insertMode||y.visualMode,I=Math.min(Math.max(u.firstLine(),p.line),u.lastLine()),P=u.getLine(I),M=P.length-1+ +!!b,R=Math.min(Math.max(0,p.ch),M),V=P.charCodeAt(R);if(56320<=V&&V<=57343){var Z=1;g&&g.line==I&&g.ch>R&&(Z=-1),R+=Z,R>M&&(R-=2)}return new e(I,R)}function Ei(u){var p={};for(var g in u)u.hasOwnProperty(g)&&(p[g]=u[g]);return p}function wt(u,p,g){return typeof p=="object"&&(g=p.ch,p=p.line),new e(u.line+p,u.ch+g)}function Er(u,p,g,y){for(var b=y.operator,I,P=[],M=[],R=zi?p.length-a:0,V=R;V<p.length;V++){var Z=p[V];g=="insert"&&Z.context!="insert"||(Z.context=="operatorPending"?!b:Z.context&&Z.context!=g)||y.operator&&Z.type=="action"||!(I=Nr(u,Z.keys))||(I=="partial"&&P.push(Z),I=="full"&&M.push(Z))}return{partial:P.length&&P,full:M.length&&M}}function Nr(u,p){if(p.slice(-11)=="<character>"){var g=p.length-11,y=u.slice(0,g),b=p.slice(0,g);return y==b&&u.length>g?"full":b.indexOf(y)==0?"partial":!1}else return u==p?"full":p.indexOf(u)==0?"partial":!1}function Yr(u){var p=/^.*(<[^>]+>)$/.exec(u),g=p?p[1]:u.slice(-1);if(g.length>1)switch(g){case"<CR>":g=`
|
||
`;break;case"<Space>":g=" ";break;default:g="";break}return g}function pr(u,p,g){return function(){for(var y=0;y<g;y++)p(u)}}function gt(u){return new e(u.line,u.ch)}function H(u,p){return u.ch==p.ch&&u.line==p.line}function qe(u,p){return u.line<p.line||u.line==p.line&&u.ch<p.ch}function Qt(u,p){return arguments.length>2&&(p=Qt.apply(void 0,Array.prototype.slice.call(arguments,1))),qe(u,p)?u:p}function kt(u,p){return arguments.length>2&&(p=kt.apply(void 0,Array.prototype.slice.call(arguments,1))),qe(u,p)?p:u}function Ni(u,p,g){var y=qe(u,p),b=qe(p,g);return y&&b}function De(u,p){return u.getLine(p).length}function je(u){return u.trim?u.trim():u.replace(/^\s+|\s+$/g,"")}function Yi(u){return u.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function Ai(u,p,g){var y=De(u,p),b=new Array(g-y+1).join(" ");u.setCursor(new e(p,y)),u.replaceRange(b,u.getCursor())}function gr(u,p){var g=[],y=u.listSelections(),b=gt(u.clipPos(p)),I=!H(p,b),P=u.getCursor("head"),M=Ji(y,P),R=H(y[M].head,y[M].anchor),V=y.length-1,Z=V-M>M?V:0,$e=y[Z].anchor,Pe=Math.min($e.line,b.line),Oe=Math.max($e.line,b.line),oe=$e.ch,Ne=b.ch,Re=y[Z].head.ch-oe,He=Ne-oe;Re>0&&He<=0?(oe++,I||Ne--):Re<0&&He>=0?(oe--,R||Ne++):Re<0&&He==-1&&(oe--,Ne++);for(var ze=Pe;ze<=Oe;ze++){var Ze={anchor:new e(ze,oe),head:new e(ze,Ne)};g.push(Ze)}return u.setSelections(g),p.ch=Ne,$e.ch=oe,$e}function bt(u,p,g){for(var y=[],b=0;b<g;b++){var I=wt(p,b,0);y.push({anchor:I,head:I})}u.setSelections(y,0)}function Ji(u,p,g){for(var y=0;y<u.length;y++){var b=g!="head"&&H(u[y].anchor,p),I=g!="anchor"&&H(u[y].head,p);if(b||I)return y}return-1}function Dr(u,p){var g=p.lastSelection,y=function(){var I=u.listSelections(),P=I[0],M=I[I.length-1],R=qe(P.anchor,P.head)?P.anchor:P.head,V=qe(M.anchor,M.head)?M.head:M.anchor;return[R,V]},b=function(){var I=u.getCursor(),P=u.getCursor(),M=g.visualBlock;if(M){var R=M.width,V=M.height;P=new e(I.line+V,I.ch+R);for(var Z=[],$e=I.line;$e<P.line;$e++){var Pe=new e($e,I.ch),Oe=new e($e,P.ch),oe={anchor:Pe,head:Oe};Z.push(oe)}u.setSelections(Z)}else{var Ne=g.anchorMark.find(),Re=g.headMark.find(),He=Re.line-Ne.line,ze=Re.ch-Ne.ch;P={line:P.line+He,ch:He?P.ch:ze+P.ch},g.visualLine&&(I=new e(I.line,0),P=new e(P.line,De(u,P.line))),u.setSelection(I,P)}return[I,P]};return p.visualMode?y():b()}function Or(u,p){var g=p.sel.anchor,y=p.sel.head;p.lastPastedText&&(y=u.posFromIndex(u.indexFromPos(g)+p.lastPastedText.length),p.lastPastedText=null),p.lastSelection={anchorMark:u.setBookmark(g),headMark:u.setBookmark(y),anchor:gt(g),head:gt(y),visualMode:p.visualMode,visualLine:p.visualLine,visualBlock:p.visualBlock}}function mr(u,p,g,y){var b=u.state.vim.sel,I=y?p:b.head,P=y?p:b.anchor,M;return qe(g,p)&&(M=g,g=p,p=M),qe(I,P)?(I=Qt(p,I),P=kt(P,g)):(P=Qt(p,P),I=kt(I,g),I=wt(I,0,-1),I.ch==-1&&I.line!=u.firstLine()&&(I=new e(I.line-1,De(u,I.line-1)))),[P,I]}function li(u,p,b){var y=u.state.vim;p=p||y.sel;var b=b||y.visualLine?"line":y.visualBlock?"block":"char",I=et(u,p,b);u.setSelections(I.ranges,I.primary)}function et(u,p,g,y){var b=gt(p.head),I=gt(p.anchor);if(g=="char"){var P=!y&&!qe(p.head,p.anchor)?1:0,M=qe(p.head,p.anchor)?1:0;return b=wt(p.head,0,P),I=wt(p.anchor,0,M),{ranges:[{anchor:I,head:b}],primary:0}}else if(g=="line"){if(qe(p.head,p.anchor))b.ch=0,I.ch=De(u,I.line);else{I.ch=0;var R=u.lastLine();b.line>R&&(b.line=R),b.ch=De(u,b.line)}return{ranges:[{anchor:I,head:b}],primary:0}}else if(g=="block"){var V=Math.min(I.line,b.line),Z=I.ch,$e=Math.max(I.line,b.line),Pe=b.ch;Z<Pe?Pe+=1:Z+=1;for(var Oe=$e-V+1,oe=b.line==V?0:Oe-1,Ne=[],Re=0;Re<Oe;Re++)Ne.push({anchor:new e(V+Re,Z),head:new e(V+Re,Pe)});return{ranges:Ne,primary:oe}}}function Br(u){var p=u.getCursor("head");return u.getSelection().length==1&&(p=Qt(p,u.getCursor("anchor"))),p}function Ht(u,p){var g=u.state.vim;p!==!1&&u.setCursor(Nt(u,g.sel.head)),Or(u,g),g.visualMode=!1,g.visualLine=!1,g.visualBlock=!1,g.insertMode||s.signal(u,"vim-mode-change",{mode:"normal"})}function Xr(u,p,g){var y=u.getRange(p,g);if(/\n\s*$/.test(y)){var b=y.split(`
|
||
`);b.pop();for(var I,I=b.pop();b.length>0&&I&&it(I);I=b.pop())g.line--,g.ch=0;I?(g.line--,g.ch=De(u,g.line)):g.ch=0}}function Di(u,p,g){p.ch=0,g.ch=0,g.line++}function Jt(u){if(!u)return 0;var p=u.search(/\S/);return p==-1?u.length:p}function Bi(u,p,g,y,b){var I=Br(u),P=u.getLine(I.line),M=I.ch,R=b?ke[0]:Qe[0];if(g&&/\s/.test(P.charAt(M)))R=function(Oe){return/\s/.test(Oe)};else{for(;!R(P.charAt(M));)if(M++,M>=P.length)return null;y?R=Qe[0]:(R=ke[0],R(P.charAt(M))||(R=ke[1]))}for(var V=M,Z=M;R(P.charAt(V))&&V<P.length;)V++;for(;R(P.charAt(Z))&&Z>=0;)Z--;if(Z++,p){for(var $e=V;/\s/.test(P.charAt(V))&&V<P.length;)V++;if($e==V){for(var Pe=Z;/\s/.test(P.charAt(Z-1))&&Z>0;)Z--;Z||(Z=Pe)}}return{start:new e(I.line,Z),end:new e(I.line,V)}}function Sr(u,p,g){var y=p;if(!s.findMatchingTag||!s.findEnclosingTag)return{start:y,end:y};var b=s.findMatchingTag(u,p)||s.findEnclosingTag(u,p);return!b||!b.open||!b.close?{start:y,end:y}:g?{start:b.open.from,end:b.close.to}:{start:b.open.to,end:b.close.from}}function Xi(u,p,g){H(p,g)||Ye.jumpList.add(u,p,g)}function Si(u,p){Ye.lastCharacterSearch.increment=u,Ye.lastCharacterSearch.forward=p.forward,Ye.lastCharacterSearch.selectedCharacter=p.selectedCharacter}var yr={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},vr={bracket:{isComplete:function(u){if(u.nextCh===u.symb){if(u.depth++,u.depth>=1)return!0}else u.nextCh===u.reverseSymb&&u.depth--;return!1}},section:{init:function(u){u.curMoveThrough=!0,u.symb=(u.forward?"]":"[")===u.symb?"{":"}"},isComplete:function(u){return u.index===0&&u.nextCh===u.symb}},comment:{isComplete:function(u){var p=u.lastCh==="*"&&u.nextCh==="/";return u.lastCh=u.nextCh,p}},method:{init:function(u){u.symb=u.symb==="m"?"{":"}",u.reverseSymb=u.symb==="{"?"}":"{"},isComplete:function(u){return u.nextCh===u.symb}},preprocess:{init:function(u){u.index=0},isComplete:function(u){if(u.nextCh==="#"){var p=u.lineText.match(/^#(\w+)/)[1];if(p==="endif"){if(u.forward&&u.depth===0)return!0;u.depth++}else if(p==="if"){if(!u.forward&&u.depth===0)return!0;u.depth--}if(p==="else"&&u.depth===0)return!0}return!1}}};function er(u,p,g,y){var b=gt(u.getCursor()),I=g?1:-1,P=g?u.lineCount():-1,M=b.ch,R=b.line,V=u.getLine(R),Z={lineText:V,nextCh:V.charAt(M),lastCh:null,index:M,symb:y,reverseSymb:(g?{")":"(","}":"{"}:{"(":")","{":"}"})[y],forward:g,depth:0,curMoveThrough:!1},$e=yr[y];if(!$e)return b;var Pe=vr[$e].init,Oe=vr[$e].isComplete;for(Pe&&Pe(Z);R!==P&&p;){if(Z.index+=I,Z.nextCh=Z.lineText.charAt(Z.index),!Z.nextCh){if(R+=I,Z.lineText=u.getLine(R)||"",I>0)Z.index=0;else{var oe=Z.lineText.length;Z.index=oe>0?oe-1:0}Z.nextCh=Z.lineText.charAt(Z.index)}Oe(Z)&&(b.line=R,b.ch=Z.index,p--)}return Z.nextCh||Z.curMoveThrough?new e(R,Z.index):b}function Cr(u,p,g,y,b){var I=p.line,P=p.ch,M=u.getLine(I),R=g?1:-1,V=y?Qe:ke;if(b&&M==""){if(I+=R,M=u.getLine(I),!at(u,I))return null;P=g?0:M.length}for(;;){if(b&&M=="")return{from:0,to:0,line:I};for(var Z=R>0?M.length:-1,$e=Z,Pe=Z;P!=Z;){for(var Oe=!1,oe=0;oe<V.length&&!Oe;++oe)if(V[oe](M.charAt(P))){for($e=P;P!=Z&&V[oe](M.charAt(P));)P+=R;if(Pe=P,Oe=$e!=Pe,$e==p.ch&&I==p.line&&Pe==$e+R)continue;return{from:Math.min($e,Pe+1),to:Math.max($e,Pe),line:I}}Oe||(P+=R)}if(I+=R,!at(u,I))return null;M=u.getLine(I),P=R>0?0:M.length}}function Zr(u,p,g,y,b,I){var P=gt(p),M=[];(y&&!b||!y&&b)&&g++;for(var R=!(y&&b),V=0;V<g;V++){var Z=Cr(u,p,y,I,R);if(!Z){var $e=De(u,u.lastLine());M.push(y?{line:u.lastLine(),from:$e,to:$e}:{line:0,from:0,to:0});break}M.push(Z),p=new e(Z.line,y?Z.to-1:Z.from)}var Pe=M.length!=g,Oe=M[0],oe=M.pop();return y&&!b?(!Pe&&(Oe.from!=P.ch||Oe.line!=P.line)&&(oe=M.pop()),new e(oe.line,oe.from)):y&&b?new e(oe.line,oe.to-1):!y&&b?(!Pe&&(Oe.to!=P.ch||Oe.line!=P.line)&&(oe=M.pop()),new e(oe.line,oe.to)):new e(oe.line,oe.from)}function tr(u,p,g,y,b){var I=p,P=new e(I.line+g.repeat-1,1/0),M=u.clipPos(P);return M.ch--,b||(y.lastHPos=1/0,y.lastHSPos=u.charCoords(M,"div").left),P}function ir(u,p,g,y,b){for(var I=b||u.getCursor(),P=I.ch,M,R=0;R<p;R++){var V=u.getLine(I.line);if(M=Vr(P,V,y,g,!0),M==-1)return null;P=M}return new e(u.getCursor().line,M)}function _r(u,p){var g=u.getCursor().line;return Nt(u,new e(g,p-1))}function qt(u,p,g,y){lt(g,ot)&&(p.marks[g]&&p.marks[g].clear(),p.marks[g]=u.setBookmark(y))}function Vr(u,p,g,y,b){var I;return y?(I=p.indexOf(g,u+1),I!=-1&&!b&&(I-=1)):(I=p.lastIndexOf(g,u-1),I!=-1&&!b&&(I+=1)),I}function Pi(u,p,g,y,b){var I=p.line,P=u.firstLine(),M=u.lastLine(),R,V,Z=I;function $e(Re){return!u.getLine(Re)}function Pe(Re,He,ze){return ze?$e(Re)!=$e(Re+He):!$e(Re)&&$e(Re+He)}if(y){for(;P<=Z&&Z<=M&&g>0;)Pe(Z,y)&&g--,Z+=y;return new e(Z,0)}var Oe=u.state.vim;if(Oe.visualLine&&Pe(I,1,!0)){var oe=Oe.sel.anchor;Pe(oe.line,-1,!0)&&(!b||oe.line!=I)&&(I+=1)}var Ne=$e(I);for(Z=I;Z<=M&&g;Z++)Pe(Z,1,!0)&&(!b||$e(Z)!=Ne)&&g--;for(V=new e(Z,0),Z>M&&!Ne?Ne=!0:b=!1,Z=I;Z>P&&!((!b||$e(Z)==Ne||Z==I)&&Pe(Z,-1,!0));Z--);return R=new e(Z,0),{start:R,end:V}}function br(u,p,g,y,b){function I(V){V.pos+V.dir<0||V.pos+V.dir>=V.line.length?V.line=null:V.pos+=V.dir}function P(V,Z,$e,Pe){var Oe=V.getLine(Z),oe={line:Oe,ln:Z,pos:$e,dir:Pe};if(oe.line==="")return{ln:oe.ln,pos:oe.pos};var Ne=oe.pos;for(I(oe);oe.line!==null;){if(Ne=oe.pos,pt(oe.line[oe.pos]))if(b){for(I(oe);oe.line!==null&&it(oe.line[oe.pos]);)Ne=oe.pos,I(oe);return{ln:oe.ln,pos:Ne+1}}else return{ln:oe.ln,pos:oe.pos+1};I(oe)}return{ln:oe.ln,pos:Ne+1}}function M(V,Z,$e,Pe){var Oe=V.getLine(Z),oe={line:Oe,ln:Z,pos:$e,dir:Pe};if(oe.line==="")return{ln:oe.ln,pos:oe.pos};var Ne=oe.pos;for(I(oe);oe.line!==null;){if(!it(oe.line[oe.pos])&&!pt(oe.line[oe.pos]))Ne=oe.pos;else if(pt(oe.line[oe.pos]))return b?it(oe.line[oe.pos+1])?{ln:oe.ln,pos:oe.pos+1}:{ln:oe.ln,pos:Ne}:{ln:oe.ln,pos:Ne};I(oe)}return oe.line=Oe,b&&it(oe.line[oe.pos])?{ln:oe.ln,pos:oe.pos}:{ln:oe.ln,pos:Ne}}for(var R={ln:p.line,pos:p.ch};g>0;)y<0?R=M(u,R.ln,R.pos,y):R=P(u,R.ln,R.pos,y),g--;return new e(R.ln,R.pos)}function Ir(u,p,g,y){function b(R,V){if(V.pos+V.dir<0||V.pos+V.dir>=V.line.length){if(V.ln+=V.dir,!at(R,V.ln)){V.line=null,V.ln=null,V.pos=null;return}V.line=R.getLine(V.ln),V.pos=V.dir>0?0:V.line.length-1}else V.pos+=V.dir}function I(R,V,Z,$e){var Re=R.getLine(V),Pe=Re==="",Oe={line:Re,ln:V,pos:Z,dir:$e},oe={ln:Oe.ln,pos:Oe.pos},Ne=Oe.line==="";for(b(R,Oe);Oe.line!==null;){if(oe.ln=Oe.ln,oe.pos=Oe.pos,Oe.line===""&&!Ne)return{ln:Oe.ln,pos:Oe.pos};if(Pe&&Oe.line!==""&&!it(Oe.line[Oe.pos]))return{ln:Oe.ln,pos:Oe.pos};pt(Oe.line[Oe.pos])&&!Pe&&(Oe.pos===Oe.line.length-1||it(Oe.line[Oe.pos+1]))&&(Pe=!0),b(R,Oe)}var Re=R.getLine(oe.ln);oe.pos=0;for(var He=Re.length-1;He>=0;--He)if(!it(Re[He])){oe.pos=He;break}return oe}function P(R,V,Z,$e){var Ne=R.getLine(V),Pe={line:Ne,ln:V,pos:Z,dir:$e},Oe={ln:Pe.ln,pos:null},oe=Pe.line==="";for(b(R,Pe);Pe.line!==null;){if(Pe.line===""&&!oe)return Oe.pos!==null?Oe:{ln:Pe.ln,pos:Pe.pos};if(pt(Pe.line[Pe.pos])&&Oe.pos!==null&&!(Pe.ln===Oe.ln&&Pe.pos+1===Oe.pos))return Oe;Pe.line!==""&&!it(Pe.line[Pe.pos])&&(oe=!1,Oe={ln:Pe.ln,pos:Pe.pos}),b(R,Pe)}var Ne=R.getLine(Oe.ln);Oe.pos=0;for(var Re=0;Re<Ne.length;++Re)if(!it(Ne[Re])){Oe.pos=Re;break}return Oe}for(var M={ln:p.line,pos:p.ch};g>0;)y<0?M=P(u,M.ln,M.pos,y):M=I(u,M.ln,M.pos,y),g--;return new e(M.ln,M.pos)}function Wt(u,p,g,y){var b=p,I,P,M={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[g],R={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{","<":"<",">":"<"}[g],V=u.getLine(b.line).charAt(b.ch),Z=V===R?1:0;if(I=u.scanForBracket(new e(b.line,b.ch+Z),-1,void 0,{bracketRegex:M}),P=u.scanForBracket(new e(b.line,b.ch+Z),1,void 0,{bracketRegex:M}),!I||!P)return null;if(I=I.pos,P=P.pos,I.line==P.line&&I.ch>P.ch||I.line>P.line){var $e=I;I=P,P=$e}return y?P.ch+=1:I.ch+=1,{start:I,end:P}}function X(u,p,g,y){var b=gt(p),I=u.getLine(b.line),P=I.split(""),M,R,V,Z,$e=P.indexOf(g);if(b.ch<$e)b.ch=$e;else if($e<b.ch&&P[b.ch]==g){var Pe=/string/.test(u.getTokenTypeAt(wt(p,0,1))),Oe=/string/.test(u.getTokenTypeAt(p)),oe=Pe&&!Oe;oe||(R=b.ch,--b.ch)}if(P[b.ch]==g&&!R)M=b.ch+1;else for(V=b.ch;V>-1&&!M;V--)P[V]==g&&(M=V+1);if(M&&!R)for(V=M,Z=P.length;V<Z&&!R;V++)P[V]==g&&(R=V);return!M||!R?{start:b,end:b}:(y&&(--M,++R),{start:new e(b.line,M),end:new e(b.line,R)})}mt("pcre",!0,"boolean");function K(){}K.prototype={getQuery:function(){return Ye.query},setQuery:function(u){Ye.query=u},getOverlay:function(){return this.searchOverlay},setOverlay:function(u){this.searchOverlay=u},isReversed:function(){return Ye.isReversed},setReversed:function(u){Ye.isReversed=u},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(u){this.annotate=u}};function Se(u){var p=u.state.vim;return p.searchState_||(p.searchState_=new K)}function Ee(u){return tt(u,"/")}function We(u){return Ft(u,"/")}function tt(u,p){var g=Ft(u,p)||[];if(!g.length)return[];var y=[];if(g[0]===0){for(var b=0;b<g.length;b++)typeof g[b]=="number"&&y.push(u.substring(g[b]+1,g[b+1]));return y}}function Ft(u,p){p||(p="/");for(var g=!1,y=[],b=0;b<u.length;b++){var I=u.charAt(b);!g&&I==p&&y.push(b),g=!g&&I=="\\"}return y}function yi(u){for(var p="|(){",g="}",y=!1,b=[],I=-1;I<u.length;I++){var P=u.charAt(I)||"",M=u.charAt(I+1)||"",R=M&&p.indexOf(M)!=-1;y?((P!=="\\"||!R)&&b.push(P),y=!1):P==="\\"?(y=!0,M&&g.indexOf(M)!=-1&&(R=!0),(!R||M==="\\")&&b.push(P)):(b.push(P),R&&M!=="\\"&&b.push("\\"))}return b.join("")}var Zi={"\\n":`
|
||
`,"\\r":"\r","\\t":" "};function vn(u){for(var p=!1,g=[],y=-1;y<u.length;y++){var b=u.charAt(y)||"",I=u.charAt(y+1)||"";Zi[b+I]?(g.push(Zi[b+I]),y++):p?(g.push(b),p=!1):b==="\\"?(p=!0,nt(I)||I==="$"?g.push("$"):I!=="/"&&I!=="\\"&&g.push("\\")):(b==="$"&&g.push("$"),g.push(b),I==="/"&&g.push("\\"))}return g.join("")}var tn={"\\/":"/","\\\\":"\\","\\n":`
|
||
`,"\\r":"\r","\\t":" ","\\&":"&"};function Cn(u){for(var p=new s.StringStream(u),g=[];!p.eol();){for(;p.peek()&&p.peek()!="\\";)g.push(p.next());var y=!1;for(var b in tn)if(p.match(b,!0)){y=!0,g.push(tn[b]);break}y||g.push(p.next())}return g.join("")}function bn(u,p,g){var y=Ye.registerController.getRegister("/");if(y.setText(u),u instanceof RegExp)return u;var b=We(u),I,P;if(!b.length)I=u;else{I=u.substring(0,b[0]);var M=u.substring(b[0]);P=M.indexOf("i")!=-1}if(!I)return null;Yt("pcre")||(I=yi(I)),g&&(p=/^[^A-Z]*$/.test(I));var R=new RegExp(I,p||P?"im":"m");return R}function vi(u){typeof u=="string"&&(u=document.createElement(u));for(var p,g=1;g<arguments.length;g++)if(p=arguments[g])if(typeof p!="object"&&(p=document.createTextNode(p)),p.nodeType)u.appendChild(p);else for(var y in p)Object.prototype.hasOwnProperty.call(p,y)&&(y[0]==="$"?u.style[y.slice(1)]=p[y]:u.setAttribute(y,p[y]));return u}function Ot(u,p){var g=vi("div",{$color:"red",$whiteSpace:"pre",class:"cm-vim-message"},p);u.openNotification?u.openNotification(g,{bottom:!0,duration:5e3}):alert(g.innerText)}function In(u,p){return vi("div",{$display:"flex"},vi("span",{$fontFamily:"monospace",$whiteSpace:"pre",$flex:1},u,vi("input",{type:"text",autocorrect:"off",autocapitalize:"off",spellcheck:"false",$width:"100%"})),p&&vi("span",{$color:"#888"},p))}function wr(u,p){var g=In(p.prefix,p.desc);if(u.openDialog)u.openDialog(g,p.onClose,{onKeyDown:p.onKeyDown,onKeyUp:p.onKeyUp,bottom:!0,selectValueOnOpen:!1,value:p.value});else{var y="";typeof p.prefix!="string"&&p.prefix&&(y+=p.prefix.textContent),p.desc&&(y+=" "+p.desc),p.onClose(prompt(y,""))}}function wn(u,p){if(u instanceof RegExp&&p instanceof RegExp){for(var g=["global","multiline","ignoreCase","source"],y=0;y<g.length;y++){var b=g[y];if(u[b]!==p[b])return!1}return!0}return!1}function rr(u,p,g,y){if(p){var b=Se(u),I=bn(p,!!g,!!y);if(I)return rn(u,I),wn(I,b.getQuery())||b.setQuery(I),I}}function kn(u){if(u.source.charAt(0)=="^")var p=!0;return{token:function(g){if(p&&!g.sol()){g.skipToEnd();return}var y=g.match(u,!1);if(y)return y[0].length==0?(g.next(),"searching"):!g.sol()&&(g.backUp(1),!u.exec(g.next()+y[0]))?(g.next(),null):(g.match(u),"searching");for(;!g.eol()&&(g.next(),!g.match(u,!1)););},query:u}}var kr=0;function rn(u,p){clearTimeout(kr),kr=setTimeout(function(){if(u.state.vim){var g=Se(u),y=g.getOverlay();(!y||p!=y.query)&&(y&&u.removeOverlay(y),y=kn(p),u.addOverlay(y),u.showMatchesOnScrollbar&&(g.getScrollbarAnnotate()&&g.getScrollbarAnnotate().clear(),g.setScrollbarAnnotate(u.showMatchesOnScrollbar(p))),g.setOverlay(y))}},50)}function nn(u,p,g,y){return y===void 0&&(y=1),u.operation(function(){for(var b=u.getCursor(),I=u.getSearchCursor(g,b),P=0;P<y;P++){var M=I.find(p);if(P==0&&M&&H(I.from(),b)){var R=p?I.from():I.to();M=I.find(p),M&&!M[0]&&H(I.from(),R)&&u.getLine(R.line).length==R.ch&&(M=I.find(p))}if(!M&&(I=u.getSearchCursor(g,p?new e(u.lastLine()):new e(u.firstLine(),0)),!I.find(p)))return}return I.from()})}function $n(u,p,g,y,b){return y===void 0&&(y=1),u.operation(function(){var I=u.getCursor(),P=u.getSearchCursor(g,I),M=P.find(!p);!b.visualMode&&M&&H(P.from(),I)&&P.find(!p);for(var R=0;R<y;R++)if(M=P.find(p),!M&&(P=u.getSearchCursor(g,p?new e(u.lastLine()):new e(u.firstLine(),0)),!P.find(p)))return;return[P.from(),P.to()]})}function Gr(u){var p=Se(u);u.removeOverlay(Se(u).getOverlay()),p.setOverlay(null),p.getScrollbarAnnotate()&&(p.getScrollbarAnnotate().clear(),p.setScrollbarAnnotate(null))}function xn(u,p,g){return typeof u!="number"&&(u=u.line),p instanceof Array?lt(u,p):typeof g=="number"?u>=p&&u<=g:u==p}function Hr(u){var p=u.getScrollInfo(),g=6,y=10,b=u.coordsChar({left:0,top:g+p.top},"local"),I=p.clientHeight-y+p.top,P=u.coordsChar({left:0,top:I},"local");return{top:b.line,bottom:P.line}}function $r(u,p,g){if(g=="'"||g=="`")return Ye.jumpList.find(u,-1)||new e(0,0);if(g==".")return sn(u);var y=p.marks[g];return y&&y.find()}function sn(u){if(u.getLastEditEnd)return u.getLastEditEnd();for(var p=u.doc.history.done,g=p.length;g--;)if(p[g].changes)return gt(p[g].changes[0].to)}var an=function(){this.buildCommandMap_()};an.prototype={processCommand:function(u,p,g){var y=this;u.operation(function(){u.curOp.isVimOp=!0,y._processCommand(u,p,g)})},_processCommand:function(u,p,g){var y=u.state.vim,b=Ye.registerController.getRegister(":"),I=b.toString(),P=new s.StringStream(p);b.setText(p);var M=g||{};M.input=p;try{this.parseInput_(u,P,M)}catch($e){throw Ot(u,$e.toString()),$e}y.visualMode&&Ht(u);var R,V;if(!M.commandName)M.line!==void 0&&(V="move");else if(R=this.matchCommand_(M.commandName),R){if(V=R.name,R.excludeFromCommandHistory&&b.setText(I),this.parseCommandArgs_(P,M,R),R.type=="exToKey"){for(var Z=0;Z<R.toKeys.length;Z++)Tt.handleKey(u,R.toKeys[Z],"mapping");return}else if(R.type=="exToEx"){this.processCommand(u,R.toInput);return}}if(!V){Ot(u,'Not an editor command ":'+p+'"');return}try{ln[V](u,M),(!R||!R.possiblyAsync)&&M.callback&&M.callback()}catch($e){throw Ot(u,$e.toString()),$e}},parseInput_:function(u,p,g){var b,I;p.eatWhile(":"),p.eat("%")?(g.line=u.firstLine(),g.lineEnd=u.lastLine()):(g.line=this.parseLineSpec_(u,p),g.line!==void 0&&p.eat(",")&&(g.lineEnd=this.parseLineSpec_(u,p))),g.line==null?u.state.vim.visualMode?(g.selectionLine=(b=$r(u,u.state.vim,"<"))==null?void 0:b.line,g.selectionLineEnd=(I=$r(u,u.state.vim,">"))==null?void 0:I.line):g.selectionLine=u.getCursor().line:(g.selectionLine=g.line,g.selectionLineEnd=g.lineEnd);var y=p.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return y?g.commandName=y[1]:g.commandName=p.match(/.*/)[0],g},parseLineSpec_:function(u,p){var g=p.match(/^(\d+)/);if(g)return parseInt(g[1],10)-1;switch(p.next()){case".":return this.parseLineSpecOffset_(p,u.getCursor().line);case"$":return this.parseLineSpecOffset_(p,u.lastLine());case"'":var y=p.next(),b=$r(u,u.state.vim,y);if(!b)throw new Error("Mark not set");return this.parseLineSpecOffset_(p,b.line);case"-":case"+":return p.backUp(1),this.parseLineSpecOffset_(p,u.getCursor().line);default:p.backUp(1);return}},parseLineSpecOffset_:function(u,p){var g=u.match(/^([+-])?(\d+)/);if(g){var y=parseInt(g[2],10);g[1]=="-"?p-=y:p+=y}return p},parseCommandArgs_:function(u,p,g){if(!u.eol()){p.argString=u.match(/.*/)[0];var y=g.argDelimiter||/\s+/,b=je(p.argString).split(y);b.length&&b[0]&&(p.args=b)}},matchCommand_:function(u){for(var p=u.length;p>0;p--){var g=u.substring(0,p);if(this.commandMap_[g]){var y=this.commandMap_[g];if(y.name.indexOf(u)===0)return y}}return null},buildCommandMap_:function(){this.commandMap_={};for(var u=0;u<l.length;u++){var p=l[u],g=p.shortName||p.name;this.commandMap_[g]=p}},map:function(u,p,g,y){if(u!=":"&&u.charAt(0)==":"){if(g)throw Error("Mode not supported for ex mappings");var b=u.substring(1);p!=":"&&p.charAt(0)==":"?this.commandMap_[b]={name:b,type:"exToEx",toInput:p.substring(1),user:!0}:this.commandMap_[b]={name:b,type:"exToKey",toKeys:p,user:!0}}else if(p!=":"&&p.charAt(0)==":"){var I={keys:u,type:"keyToEx",exArgs:{input:p.substring(1)}};g&&(I.context=g),o.unshift(I)}else{var I={keys:u,type:"keyToKey",toKeys:p,noremap:y};g&&(I.context=g),o.unshift(I)}},unmap:function(u,p){if(u!=":"&&u.charAt(0)==":"){if(p)throw Error("Mode not supported for ex mappings");var g=u.substring(1);if(this.commandMap_[g]&&this.commandMap_[g].user)return delete this.commandMap_[g],!0}else for(var y=u,b=0;b<o.length;b++)if(y==o[b].keys&&o[b].context===p)return o.splice(b,1),!0}};var ln={colorscheme:function(u,p){if(!p.args||p.args.length<1){Ot(u,u.getOption("theme"));return}u.setOption("theme",p.args[0])},map:function(u,p,g,y){var b=p.args;if(!b||b.length<2){u&&Ot(u,"Invalid mapping: "+p.input);return}ei.map(b[0],b[1],g,y)},imap:function(u,p){this.map(u,p,"insert")},nmap:function(u,p){this.map(u,p,"normal")},vmap:function(u,p){this.map(u,p,"visual")},omap:function(u,p){this.map(u,p,"operatorPending")},noremap:function(u,p){this.map(u,p,void 0,!0)},inoremap:function(u,p){this.map(u,p,"insert",!0)},nnoremap:function(u,p){this.map(u,p,"normal",!0)},vnoremap:function(u,p){this.map(u,p,"visual",!0)},onoremap:function(u,p){this.map(u,p,"operatorPending",!0)},unmap:function(u,p,g){var y=p.args;(!y||y.length<1||!ei.unmap(y[0],g))&&u&&Ot(u,"No such mapping: "+p.input)},mapclear:function(u,p){Tt.mapclear()},imapclear:function(u,p){Tt.mapclear("insert")},nmapclear:function(u,p){Tt.mapclear("normal")},vmapclear:function(u,p){Tt.mapclear("visual")},omapclear:function(u,p){Tt.mapclear("operatorPending")},move:function(u,p){ui.processCommand(u,u.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:p.line+1})},set:function(u,p){var g=p.args,y=p.setCfg||{};if(!g||g.length<1){u&&Ot(u,"Invalid mapping: "+p.input);return}var b=g[0].split("="),I=b[0],P=b[1],M=!1;if(I.charAt(I.length-1)=="?"){if(P)throw Error("Trailing characters: "+p.argString);I=I.substring(0,I.length-1),M=!0}P===void 0&&I.substring(0,2)=="no"&&(I=I.substring(2),P=!1);var R=st[I]&&st[I].type=="boolean";if(R&&P==null&&(P=!0),!R&&P===void 0||M){var V=Yt(I,u,y);V instanceof Error?Ot(u,V.message):V===!0||V===!1?Ot(u," "+(V?"":"no")+I):Ot(u," "+I+"="+V)}else{var Z=Vt(I,P,u,y);Z instanceof Error&&Ot(u,Z.message)}},setlocal:function(u,p){p.setCfg={scope:"local"},this.set(u,p)},setglobal:function(u,p){p.setCfg={scope:"global"},this.set(u,p)},registers:function(u,p){var g=p.args,y=Ye.registerController.registers,b=`----------Registers----------
|
||
|
||
`;if(g){var I;g=g.join("");for(var M=0;M<g.length;M++)if(I=g.charAt(M),!!Ye.registerController.isValidRegister(I)){var R=y[I]||new Gt;b+='"'+I+" "+R.toString()+`
|
||
`}}else for(var I in y){var P=y[I].toString();P.length&&(b+='"'+I+" "+P+`
|
||
`)}Ot(u,b)},sort:function(u,p){var g,y,b,I,P;function M(){if(p.argString){var ht=new s.StringStream(p.argString);if(ht.eat("!")&&(g=!0),ht.eol())return;if(!ht.eatSpace())return"Invalid arguments";var ut=ht.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!ut&&!ht.eol())return"Invalid arguments";if(ut[1]){y=ut[1].indexOf("i")!=-1,b=ut[1].indexOf("u")!=-1;var Xt=ut[1].indexOf("d")!=-1||ut[1].indexOf("n")!=-1&&1,$t=ut[1].indexOf("x")!=-1&&1,xt=ut[1].indexOf("o")!=-1&&1;if(Xt+$t+xt>1)return"Invalid arguments";I=Xt&&"decimal"||$t&&"hex"||xt&&"octal"}ut[2]&&(P=new RegExp(ut[2].substr(1,ut[2].length-2),y?"i":""))}}var R=M();if(R){Ot(u,R+": "+p.argString);return}var V=p.line||u.firstLine(),Z=p.lineEnd||p.line||u.lastLine();if(V==Z)return;var $e=new e(V,0),Pe=new e(Z,De(u,Z)),Oe=u.getRange($e,Pe).split(`
|
||
`),oe=P||(I=="decimal"?/(-?)([\d]+)/:I=="hex"?/(-?)(?:0x)?([0-9a-f]+)/i:I=="octal"?/([0-7]+)/:null),Ne=I=="decimal"?10:I=="hex"?16:I=="octal"?8:null,Re=[],He=[];if(I||P)for(var ze=0;ze<Oe.length;ze++){var Ze=P?Oe[ze].match(P):null;Ze&&Ze[0]!=""?Re.push(Ze):!P&&oe.exec(Oe[ze])?Re.push(Oe[ze]):He.push(Oe[ze])}else He=Oe;function yt(ht,ut){if(g){var Xt;Xt=ht,ht=ut,ut=Xt}y&&(ht=ht.toLowerCase(),ut=ut.toLowerCase());var $t=I&&oe.exec(ht),xt=I&&oe.exec(ut);return $t?($t=parseInt(($t[1]+$t[2]).toLowerCase(),Ne),xt=parseInt((xt[1]+xt[2]).toLowerCase(),Ne),$t-xt):ht<ut?-1:1}function Dt(ht,ut){if(g){var Xt;Xt=ht,ht=ut,ut=Xt}return y&&(ht[0]=ht[0].toLowerCase(),ut[0]=ut[0].toLowerCase()),ht[0]<ut[0]?-1:1}if(Re.sort(P?Dt:yt),P)for(var ze=0;ze<Re.length;ze++)Re[ze]=Re[ze].input;else I||He.sort(yt);if(Oe=g?Re.concat(He):He.concat(Re),b){var It=Oe,Rt;Oe=[];for(var ze=0;ze<It.length;ze++)It[ze]!=Rt&&Oe.push(It[ze]),Rt=It[ze]}u.replaceRange(Oe.join(`
|
||
`),$e,Pe)},vglobal:function(u,p){this.global(u,p)},normal:function(u,p){var g=p.argString&&p.argString.trimStart();if(!g){Ot(u,"Argument is required.");return}var y=p.line;if(typeof y=="number")for(var b=isNaN(p.lineEnd)?y:p.lineEnd,I=y;I<=b;I++)u.setCursor(I,0),ji(u,p.argString.trimStart()),u.state.vim.insertMode&&Ci(u,!0);else ji(u,p.argString.trimStart()),u.state.vim.insertMode&&Ci(u,!0)},global:function(u,p){var g=p.argString;if(!g){Ot(u,"Regular Expression missing from global");return}var y=p.commandName[0]==="v";g[0]==="!"&&p.commandName[0]==="g"&&(y=!0,g=g.slice(1));var b=p.line!==void 0?p.line:u.firstLine(),I=p.lineEnd||p.line||u.lastLine(),P=Ee(g),M=g,R;if(P.length&&(M=P[0],R=P.slice(1,P.length).join("/")),M)try{rr(u,M,!0,!0)}catch{Ot(u,"Invalid regex: "+M);return}for(var V=Se(u).getQuery(),Z=[],$e=b;$e<=I;$e++){var Pe=u.getLine($e),Oe=V.test(Pe);Oe!==y&&Z.push(R?u.getLineHandle($e):Pe)}if(!R){Ot(u,Z.join(`
|
||
`));return}var oe=0,Ne=function(){if(oe<Z.length){var Re=Z[oe++],He=u.getLineNumber(Re);if(He==null){Ne();return}var ze=He+1+R;ei.processCommand(u,ze,{callback:Ne})}else u.releaseLineHandles&&u.releaseLineHandles()};Ne()},substitute:function(u,p){if(!u.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var g=p.argString,y=g?tt(g,g[0]):[],b,I="",P,M,R,V=!1,Z=!1;if(y.length)b=y[0],Yt("pcre")&&b!==""&&(b=new RegExp(b).source),I=y[1],I!==void 0&&(Yt("pcre")?I=Cn(I.replace(/([^\\])&/g,"$1$$&")):I=vn(I),Ye.lastSubstituteReplacePart=I),P=y[2]?y[2].split(" "):[];else if(g&&g.length){Ot(u,"Substitutions should be of the form :s/pattern/replace/");return}if(P&&(M=P[0],R=parseInt(P[1]),M&&(M.indexOf("c")!=-1&&(V=!0),M.indexOf("g")!=-1&&(Z=!0),Yt("pcre")?b=b+"/"+M:b=b.replace(/\//g,"\\/")+"/"+M)),b)try{rr(u,b,!0,!0)}catch{Ot(u,"Invalid regex: "+b);return}if(I=I||Ye.lastSubstituteReplacePart,I===void 0){Ot(u,"No previous substitute regular expression");return}var $e=Se(u),Pe=$e.getQuery(),Oe=p.line!==void 0?p.line:u.getCursor().line,oe=p.lineEnd||Oe;Oe==u.firstLine()&&oe==u.lastLine()&&(oe=1/0),R&&(Oe=oe,oe=Oe+R-1);var Ne=Nt(u,new e(Oe,0)),Re=u.getSearchCursor(Pe,Ne);An(u,V,Z,Oe,oe,Re,Pe,I,p.callback)},redo:s.commands.redo,undo:s.commands.undo,write:function(u){s.commands.save?s.commands.save(u):u.save&&u.save()},nohlsearch:function(u){Gr(u)},yank:function(u){var p=gt(u.getCursor()),g=p.line,y=u.getLine(g);Ye.registerController.pushText("0","yank",y,!0,!0)},delete:function(u,p){var g=p.selectionLine,y=isNaN(p.selectionLineEnd)?g:p.selectionLineEnd;Ki.delete(u,{linewise:!0},[{anchor:new e(g,0),head:new e(y+1,0)}])},join:function(u,p){var g=p.selectionLine,y=isNaN(p.selectionLineEnd)?g:p.selectionLineEnd;u.setCursor(new e(g,0)),mi.joinLines(u,{repeat:y-g},u.state.vim)},delmarks:function(u,p){if(!p.argString||!je(p.argString)){Ot(u,"Argument required");return}for(var g=u.state.vim,y=new s.StringStream(je(p.argString));!y.eol();){y.eatSpace();var b=y.pos;if(!y.match(/[a-zA-Z]/,!1)){Ot(u,"Invalid argument: "+p.argString.substring(b));return}var I=y.next();if(y.match("-",!0)){if(!y.match(/[a-zA-Z]/,!1)){Ot(u,"Invalid argument: "+p.argString.substring(b));return}var P=I,M=y.next();if(dt(P)&&dt(M)||ft(P)&&ft(M)){var R=P.charCodeAt(0),V=M.charCodeAt(0);if(R>=V){Ot(u,"Invalid argument: "+p.argString.substring(b));return}for(var Z=0;Z<=V-R;Z++){var $e=String.fromCharCode(R+Z);delete g.marks[$e]}}else{Ot(u,"Invalid argument: "+P+"-");return}}else delete g.marks[I]}}},ei=new an;function An(u,p,g,y,b,I,P,M,R){u.state.vim.exMode=!0;var V=!1,Z,$e,Pe;function Oe(){u.operation(function(){for(;!V;)oe(),Re();He()})}function oe(){var Ze=u.getRange(I.from(),I.to()),yt=Ze.replace(P,M),Dt=I.to().line;I.replace(yt),$e=I.to().line,b+=$e-Dt,Pe=$e<Dt}function Ne(){var Ze=Z&>(I.to()),yt=I.findNext();return yt&&!yt[0]&&Ze&&H(I.from(),Ze)&&(yt=I.findNext()),yt}function Re(){for(;Ne()&&xn(I.from(),y,b);)if(!(!g&&I.from().line==$e&&!Pe)){u.scrollIntoView(I.from(),30),u.setSelection(I.from(),I.to()),Z=I.from(),V=!1;return}V=!0}function He(Ze){if(Ze&&Ze(),u.focus(),Z){u.setCursor(Z);var yt=u.state.vim;yt.exMode=!1,yt.lastHPos=yt.lastHSPos=Z.ch}R&&R()}function ze(Ze,yt,Dt){s.e_stop(Ze);var It=s.keyName(Ze);switch(It){case"Y":oe(),Re();break;case"N":Re();break;case"A":var Rt=R;R=void 0,u.operation(Oe),R=Rt;break;case"L":oe();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":He(Dt);break}return V&&He(Dt),!0}if(Re(),V){Ot(u,"No matches for "+P.source);return}if(!p){Oe(),R&&R();return}wr(u,{prefix:vi("span","replace with ",vi("strong",M)," (y/n/a/q/l)"),onKeyDown:ze})}s.keyMap.vim={attach:d,detach:f,call:m};function Ci(u,p){var g=u.state.vim,y=Ye.macroModeState,b=Ye.registerController.getRegister("."),I=y.isPlaying,P=y.lastInsertModeChanges;I||(u.off("change",hn),g.insertEnd&&g.insertEnd.clear(),g.insertEnd=null,s.off(u.getInputField(),"keydown",dn)),!I&&g.insertModeRepeat>1&&(pn(u,g,g.insertModeRepeat-1,!0),g.lastEditInputState.repeatOverride=g.insertModeRepeat),delete g.insertModeRepeat,g.insertMode=!1,p||u.setCursor(u.getCursor().line,u.getCursor().ch-1),u.setOption("keyMap","vim"),u.setOption("disableInput",!0),u.toggleOverwrite(!1),b.setText(P.changes.join("")),s.signal(u,"vim-mode-change",{mode:"normal"}),y.isRecording&&Qn(y)}function cn(u){o.unshift(u)}function Pn(u,p,g,y,b){var I={keys:u,type:p};I[p]=g,I[p+"Args"]=y;for(var P in b)I[P]=b[P];cn(I)}mt("insertModeEscKeysTimeout",200,"number"),s.keyMap["vim-insert"]={fallthrough:["default"],attach:d,detach:f,call:m},s.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:d,detach:f};function Tn(u,p,g,y){var b=Ye.registerController.getRegister(y);if(y==":"){b.keyBuffer[0]&&ei.processCommand(u,b.keyBuffer[0]),g.isPlaying=!1;return}var I=b.keyBuffer,P=0;g.isPlaying=!0,g.replaySearchQueries=b.searchQueries.slice(0);for(var M=0;M<I.length;M++)for(var R=I[M],V,Z;R;)if(V=/<\w+-.+?>|<\w+>|./.exec(R),Z=V[0],R=R.substring(V.index+Z.length),Tt.handleKey(u,Z,"macro"),p.insertMode){var $e=b.insertModeChanges[P++].changes;Ye.macroModeState.lastInsertModeChanges.changes=$e,On(u,$e,1),Ci(u)}g.isPlaying=!1}function Ln(u,p){if(!u.isPlaying){var g=u.latestRegister,y=Ye.registerController.getRegister(g);y&&y.pushText(p)}}function Qn(u){if(!u.isPlaying){var p=u.latestRegister,g=Ye.registerController.getRegister(p);g&&g.pushInsertModeChanges&&g.pushInsertModeChanges(u.lastInsertModeChanges)}}function Rn(u,p){if(!u.isPlaying){var g=u.latestRegister,y=Ye.registerController.getRegister(g);y&&y.pushSearchQuery&&y.pushSearchQuery(p)}}function hn(u,p){var g=Ye.macroModeState,y=g.lastInsertModeChanges;if(!g.isPlaying)for(var b=u.state.vim;p;){if(y.expectCursorActivityForChange=!0,y.ignoreCount>1)y.ignoreCount--;else if(p.origin=="+input"||p.origin=="paste"||p.origin===void 0){var I=u.listSelections().length;I>1&&(y.ignoreCount=I);var P=p.text.join(`
|
||
`);if(y.maybeReset&&(y.changes=[],y.maybeReset=!1),P)if(u.state.overwrite&&!/\n/.test(P))y.changes.push([P]);else{if(P.length>1){var M=b&&b.insertEnd&&b.insertEnd.find(),R=u.getCursor();if(M&&M.line==R.line){var V=M.ch-R.ch;V>0&&V<P.length&&(y.changes.push([P,V]),P="")}}P&&y.changes.push(P)}}p=p.next}}function un(u){var p=u.state.vim;if(p.insertMode){var g=Ye.macroModeState;if(g.isPlaying)return;var y=g.lastInsertModeChanges;y.expectCursorActivityForChange?y.expectCursorActivityForChange=!1:(y.maybeReset=!0,p.insertEnd&&p.insertEnd.clear(),p.insertEnd=u.setBookmark(u.getCursor(),{insertLeft:!0}))}else u.curOp.isVimOp||fn(u,p)}function fn(u,p){var g=u.getCursor("anchor"),y=u.getCursor("head");if(p.visualMode&&!u.somethingSelected()?Ht(u,!1):!p.visualMode&&!p.insertMode&&u.somethingSelected()&&(p.visualMode=!0,p.visualLine=!1,s.signal(u,"vim-mode-change",{mode:"visual"})),p.visualMode){var b=qe(y,g)?0:-1,I=qe(y,g)?-1:0;y=wt(y,0,b),g=wt(g,0,I),p.sel={anchor:g,head:y},qt(u,p,"<",Qt(y,g)),qt(u,p,">",kt(y,g))}else p.insertMode||(p.lastHPos=u.getCursor().ch)}function Wr(u){this.keyName=u}function dn(u){var p=Ye.macroModeState,g=p.lastInsertModeChanges,y=s.keyName(u);if(!y)return;function b(){return g.maybeReset&&(g.changes=[],g.maybeReset=!1),g.changes.push(new Wr(y)),!0}(y.indexOf("Delete")!=-1||y.indexOf("Backspace")!=-1)&&s.lookupKey(y,"vim-insert",b)}function pn(u,p,g,y){var b=Ye.macroModeState;b.isPlaying=!0;var I=!!p.lastEditActionCommand,P=p.inputState;function M(){I?ui.processAction(u,p,p.lastEditActionCommand):ui.evalInput(u,p)}function R(Z){if(b.lastInsertModeChanges.changes.length>0){Z=p.lastEditActionCommand?Z:1;var $e=b.lastInsertModeChanges;On(u,$e.changes,Z)}}if(p.inputState=p.lastEditInputState,I&&p.lastEditActionCommand.interlaceInsertRepeat)for(var V=0;V<g;V++)M(),R(1);else y||M(),R(g);p.inputState=P,p.insertMode&&!y&&Ci(u),b.isPlaying=!1}function gn(u,p){s.lookupKey(p,"vim-insert",function(y){return typeof y=="string"?s.commands[y](u):y(u),!0})}function On(u,p,g){var y=u.getCursor("head"),b=Ye.macroModeState.lastInsertModeChanges.visualBlock;b&&(bt(u,y,b+1),g=u.listSelections().length,u.setCursor(y));for(var I=0;I<g;I++){b&&u.setCursor(wt(y,I,0));for(var P=0;P<p.length;P++){var M=p[P];if(M instanceof Wr)gn(u,M.keyName);else if(typeof M=="string")u.replaceSelection(M);else{var R=u.getCursor(),V=wt(R,0,M[0].length-(M[1]||0));u.replaceRange(M[0],R,M[1]?R:V),u.setCursor(V)}}}b&&u.setCursor(wt(y,0,1))}function Fr(u){var p=new u.constructor;return Object.keys(u).forEach(function(g){if(g!="insertEnd"){var y=u[g];Array.isArray(y)?y=y.slice():y&&typeof y=="object"&&y.constructor!=Object&&(y=Fr(y)),p[g]=y}}),u.sel&&(p.sel={head:u.sel.head&>(u.sel.head),anchor:u.sel.anchor&>(u.sel.anchor)}),p}function Mn(u,p,g){var y=!1,b=Tt.maybeInitVimState_(u),I=b.visualBlock||b.wasInVisualBlock,P=u.isInMultiSelectMode();if(b.wasInVisualBlock&&!P?b.wasInVisualBlock=!1:P&&b.visualBlock&&(b.wasInVisualBlock=!0),p=="<Esc>"&&!b.insertMode&&!b.visualMode&&P&&b.status=="<Esc>")Lt(u);else if(I||!P||u.inVirtualSelectionMode)y=Tt.handleKey(u,p,g);else{var M=Fr(b),R=b.inputState.changeQueueList||[];u.operation(function(){u.curOp.isVimOp=!0;var V=0;u.forEachSelection(function(){u.state.vim.inputState.changeQueue=R[V];var Z=u.getCursor("head"),$e=u.getCursor("anchor"),Pe=qe(Z,$e)?0:-1,Oe=qe(Z,$e)?-1:0;Z=wt(Z,0,Pe),$e=wt($e,0,Oe),u.state.vim.sel.head=Z,u.state.vim.sel.anchor=$e,y=Tt.handleKey(u,p,g),u.virtualSelection&&(R[V]=u.state.vim.inputState.changeQueue,u.state.vim=Fr(M)),V++}),u.curOp.cursorActivity&&!y&&(u.curOp.cursorActivity=!1),u.state.vim=b,b.inputState.changeQueueList=R,b.inputState.changeQueue=null},!0)}return y&&!b.visualMode&&!b.insert&&b.visualMode!=u.somethingSelected()&&fn(u,b),y}return hr(),Tt}function indexFromPos(s,e){var r=e.ch,n=e.line+1;n<1&&(n=1,r=0),n>s.lines&&(n=s.lines,r=Number.MAX_VALUE);var o=s.line(n);return Math.min(o.from+Math.max(0,r),o.to)}function posFromIndex(s,e){let r=s.lineAt(e);return{line:r.number-1,ch:e-r.from}}class Pos{constructor(e,r){this.line=e,this.ch=r}}function on(s,e,r){if(s.addEventListener)s.addEventListener(e,r,!1);else{var n=s._handlers||(s._handlers={});n[e]=(n[e]||[]).concat(r)}}function off(s,e,r){if(s.removeEventListener)s.removeEventListener(e,r,!1);else{var n=s._handlers,o=n&&n[e];if(o){var a=o.indexOf(r);a>-1&&(n[e]=o.slice(0,a).concat(o.slice(a+1)))}}}function signal(s,e,...r){var n,o=(n=s._handlers)===null||n===void 0?void 0:n[e];if(o)for(var a=0;a<o.length;++a)o[a](...r)}function signalTo(s,...e){if(s)for(var r=0;r<s.length;++r)s[r](...e)}var specialKey={Return:"CR",Backspace:"BS",Delete:"Del",Escape:"Esc",Insert:"Ins",ArrowLeft:"Left",ArrowRight:"Right",ArrowUp:"Up",ArrowDown:"Down",Enter:"CR"," ":"Space"},ignoredKeys={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1};let wordChar;try{wordChar=new RegExp("[\\w\\p{Alphabetic}\\p{Number}_]","u")}catch{wordChar=/[\w]/}function dispatchChange(s,e){var r=s.cm6,n="input.type.compose";if(s.curOp&&(s.curOp.lastChange||(n="input.type.compose.start")),e.annotations)try{e.annotations.some(function(o){o.value=="input"&&(o.value=n)})}catch(o){console.error(o)}else e.userEvent=n;return r.dispatch(e)}function runHistoryCommand(s,e){var r;s.curOp&&(s.curOp.$changeStart=void 0),(e?undo:redo)(s.cm6);let n=(r=s.curOp)===null||r===void 0?void 0:r.$changeStart;n!=null&&s.cm6.dispatch({selection:{anchor:n}})}var keys={};class CodeMirror{constructor(e){this.state={},this.marks=Object.create(null),this.$mid=0,this.options={},this._handlers={},this.$lastChangeEndOffset=0,this.virtualSelection=null,this.cm6=e,this.onChange=this.onChange.bind(this),this.onSelectionChange=this.onSelectionChange.bind(this)}openDialog(e,r,n){return openDialog(this,e,r,n)}openNotification(e,r){return openNotification(this,e,r)}on(e,r){on(this,e,r)}off(e,r){off(this,e,r)}signal(e,r,n){signal(this,e,r,n)}indexFromPos(e){return indexFromPos(this.cm6.state.doc,e)}posFromIndex(e){return posFromIndex(this.cm6.state.doc,e)}foldCode(e){let r=this.cm6,n=r.state.selection.ranges,o=this.cm6.state.doc,a=indexFromPos(o,e),l=EditorSelection.create([EditorSelection.range(a,a)],0).ranges;r.state.selection.ranges=l,foldCode(r),r.state.selection.ranges=n}firstLine(){return 0}lastLine(){return this.cm6.state.doc.lines-1}lineCount(){return this.cm6.state.doc.lines}setCursor(e,r){typeof e=="object"&&(r=e.ch,e=e.line);var n=indexFromPos(this.cm6.state.doc,{line:e,ch:r});this.cm6.dispatch({selection:{anchor:n}},{scrollIntoView:!this.curOp}),this.curOp&&!this.curOp.isVimOp&&this.onBeforeEndOperation()}getCursor(e){var r=this.cm6.state.selection.main,n=e=="head"||!e?r.head:e=="anchor"?r.anchor:e=="start"?r.from:e=="end"?r.to:null;if(n==null)throw new Error("Invalid cursor type");return this.posFromIndex(n)}listSelections(){var e=this.cm6.state.doc;return this.cm6.state.selection.ranges.map(r=>({anchor:posFromIndex(e,r.anchor),head:posFromIndex(e,r.head)}))}setSelections(e,r){var n=this.cm6.state.doc,o=e.map(a=>EditorSelection.range(indexFromPos(n,a.anchor),indexFromPos(n,a.head)));this.cm6.dispatch({selection:EditorSelection.create(o,r)})}setSelection(e,r,n){var o=this.cm6.state.doc,a=[EditorSelection.range(indexFromPos(o,e),indexFromPos(o,r))];this.cm6.dispatch({selection:EditorSelection.create(a,0)}),n&&n.origin=="*mouse"&&this.onBeforeEndOperation()}getLine(e){var r=this.cm6.state.doc;return e<0||e>=r.lines?"":this.cm6.state.doc.line(e+1).text}getLineHandle(e){return this.$lineHandleChanges||(this.$lineHandleChanges=[]),{row:e,index:this.indexFromPos(new Pos(e,0))}}getLineNumber(e){var r=this.$lineHandleChanges;if(!r)return null;for(var n=e.index,o=0;o<r.length;o++)if(n=r[o].changes.mapPos(n,1,MapMode.TrackAfter),n==null)return null;var a=this.posFromIndex(n);return a.ch==0?a.line:null}releaseLineHandles(){this.$lineHandleChanges=void 0}getRange(e,r){var n=this.cm6.state.doc;return this.cm6.state.sliceDoc(indexFromPos(n,e),indexFromPos(n,r))}replaceRange(e,r,n){n||(n=r);var o=this.cm6.state.doc,a=indexFromPos(o,r),l=indexFromPos(o,n);dispatchChange(this,{changes:{from:a,to:l,insert:e}})}replaceSelection(e){dispatchChange(this,this.cm6.state.replaceSelection(e))}replaceSelections(e){var r=this.cm6.state.selection.ranges,n=r.map((o,a)=>({from:o.from,to:o.to,insert:e[a]||""}));dispatchChange(this,{changes:n})}getSelection(){return this.getSelections().join(`
|
||
`)}getSelections(){var e=this.cm6;return e.state.selection.ranges.map(r=>e.state.sliceDoc(r.from,r.to))}somethingSelected(){return this.cm6.state.selection.ranges.some(e=>!e.empty)}getInputField(){return this.cm6.contentDOM}clipPos(e){var r=this.cm6.state.doc,n=e.ch,o=e.line+1;o<1&&(o=1,n=0),o>r.lines&&(o=r.lines,n=Number.MAX_VALUE);var a=r.line(o);return n=Math.min(Math.max(0,n),a.to-a.from),new Pos(o-1,n)}getValue(){return this.cm6.state.doc.toString()}setValue(e){var r=this.cm6;return r.dispatch({changes:{from:0,to:r.state.doc.length,insert:e},selection:EditorSelection.range(0,0)})}focus(){return this.cm6.focus()}blur(){return this.cm6.contentDOM.blur()}defaultTextHeight(){return this.cm6.defaultLineHeight}findMatchingBracket(e){var r=this.cm6.state,n=indexFromPos(r.doc,e),o=matchBrackets(r,n+1,-1);return o&&o.end?{to:posFromIndex(r.doc,o.end.from)}:(o=matchBrackets(r,n,1),o&&o.end?{to:posFromIndex(r.doc,o.end.from)}:{to:void 0})}scanForBracket(e,r,n,o){return scanForBracket(this,e,r,n,o)}indentLine(e,r){r?this.indentMore():this.indentLess()}indentMore(){indentMore(this.cm6)}indentLess(){indentLess(this.cm6)}execCommand(e){e=="indentAuto"?CodeMirror.commands.indentAuto(this):e=="goLineLeft"?cursorLineBoundaryBackward(this.cm6):e=="goLineRight"?(cursorLineBoundaryForward(this.cm6),cursorCharBackward(this.cm6)):console.log(e+" is not implemented")}setBookmark(e,r){var n=r!=null&&r.insertLeft?1:-1,o=this.indexFromPos(e),a=new Marker(this,o,n);return a}addOverlay({query:e}){let r=new SearchQuery({regexp:!0,search:e.source,caseSensitive:!/i/.test(e.flags)});if(r.valid){r.forVim=!0,this.cm6Query=r;let n=setSearchQuery.of(r);return this.cm6.dispatch({effects:n}),r}}removeOverlay(e){if(!this.cm6Query)return;this.cm6Query.forVim=!1;let r=setSearchQuery.of(this.cm6Query);this.cm6.dispatch({effects:r})}getSearchCursor(e,r){var n=this,o=null,a=null;r.ch==null&&(r.ch=Number.MAX_VALUE);var l=indexFromPos(n.cm6.state.doc,r),c=e.source.replace(/(\\.|{(?:\d+(?:,\d*)?|,\d+)})|[{}]/g,function(v,A){return A||"\\"+v});function h(v,A=0,T=v.length){return new RegExpCursor(v,c,{ignoreCase:e.ignoreCase},A,T)}function f(v){var A=n.cm6.state.doc;if(v>A.length)return null;let T=h(A,v).next();return T.done?null:T.value}var d=1e4;function m(v,A){var T=n.cm6.state.doc;for(let B=1;;B++){let Y=Math.max(v,A-B*d),F=h(T,Y,A),ke=null;for(;!F.next().done;)ke=F.value;if(ke&&(Y==v||ke.from>Y+10))return ke;if(Y==v)return null}}return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(v){var A=n.cm6.state.doc;if(v){let T=o?o.from==o.to?o.to-1:o.from:l;o=m(0,T)}else{let T=o?o.from==o.to?o.to+1:o.to:l;o=f(T)}return a=o&&{from:posFromIndex(A,o.from),to:posFromIndex(A,o.to),match:o.match},o&&o.match},from:function(){return a==null?void 0:a.from},to:function(){return a==null?void 0:a.to},replace:function(v){o&&(dispatchChange(n,{changes:{from:o.from,to:o.to,insert:v}}),o.to=o.from+v.length,a&&(a.to=posFromIndex(n.cm6.state.doc,o.to)))}}}findPosV(e,r,n,o){let{cm6:a}=this;const l=a.state.doc;let c=n=="page"?a.dom.clientHeight:0;const h=indexFromPos(l,e);let f=EditorSelection.range(h,h,o),d=Math.round(Math.abs(r));for(let v=0;v<d;v++)n=="page"?f=a.moveVertically(f,r>0,c):n=="line"&&(f=a.moveVertically(f,r>0));let m=posFromIndex(l,f.head);return(r<0&&f.head==0&&o!=0&&e.line==0&&e.ch!=0||r>0&&f.head==l.length&&m.ch!=o&&e.line==m.line)&&(m.hitSide=!0),m}charCoords(e,r){var n=this.cm6.contentDOM.getBoundingClientRect(),o=indexFromPos(this.cm6.state.doc,e),a=this.cm6.coordsAtPos(o),l=-n.top;return{left:((a==null?void 0:a.left)||0)-n.left,top:((a==null?void 0:a.top)||0)+l,bottom:((a==null?void 0:a.bottom)||0)+l}}coordsChar(e,r){var n=this.cm6.contentDOM.getBoundingClientRect(),o=this.cm6.posAtCoords({x:e.left+n.left,y:e.top+n.top})||0;return posFromIndex(this.cm6.state.doc,o)}getScrollInfo(){var e=this.cm6.scrollDOM;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight,width:e.scrollWidth,clientHeight:e.clientHeight,clientWidth:e.clientWidth}}scrollTo(e,r){e!=null&&(this.cm6.scrollDOM.scrollLeft=e),r!=null&&(this.cm6.scrollDOM.scrollTop=r)}scrollIntoView(e,r){if(e){var n=this.indexFromPos(e);this.cm6.dispatch({effects:EditorView.scrollIntoView(n)})}else this.cm6.dispatch({scrollIntoView:!0,userEvent:"scroll"})}getWrapperElement(){return this.cm6.dom}getMode(){return{name:this.getOption("mode")}}setSize(e,r){this.cm6.dom.style.width=e+4+"px",this.cm6.dom.style.height=r+"px",this.refresh()}refresh(){this.cm6.measure()}destroy(){this.removeOverlay()}getLastEditEnd(){return this.posFromIndex(this.$lastChangeEndOffset)}onChange(e){this.$lineHandleChanges&&this.$lineHandleChanges.push(e);for(let n in this.marks)this.marks[n].update(e.changes);this.virtualSelection&&(this.virtualSelection.ranges=this.virtualSelection.ranges.map(n=>n.map(e.changes)));var r=this.curOp=this.curOp||{};e.changes.iterChanges((n,o,a,l,c)=>{(r.$changeStart==null||r.$changeStart>a)&&(r.$changeStart=a),this.$lastChangeEndOffset=l;var h={text:c.toJSON()};r.lastChange?r.lastChange.next=r.lastChange=h:r.lastChange=r.change=h},!0),r.changeHandlers||(r.changeHandlers=this._handlers.change&&this._handlers.change.slice())}onSelectionChange(){var e=this.curOp=this.curOp||{};e.cursorActivityHandlers||(e.cursorActivityHandlers=this._handlers.cursorActivity&&this._handlers.cursorActivity.slice()),this.curOp.cursorActivity=!0}operation(e){this.curOp||(this.curOp={$d:0}),this.curOp.$d++;try{var r=e()}finally{this.curOp&&(this.curOp.$d--,this.curOp.$d||this.onBeforeEndOperation())}return r}onBeforeEndOperation(){var e=this.curOp,r=!1;e&&(e.change&&signalTo(e.changeHandlers,this,e.change),e&&e.cursorActivity&&(signalTo(e.cursorActivityHandlers,this,null),e.isVimOp&&(r=!0)),this.curOp=null),r&&this.scrollIntoView()}moveH(e,r){if(r=="char"){var n=this.getCursor();this.setCursor(n.line,n.ch+e)}}setOption(e,r){switch(e){case"keyMap":this.state.keyMap=r;break}}getOption(e){switch(e){case"firstLineNumber":return 1;case"tabSize":return this.cm6.state.tabSize||4;case"readonly":return this.cm6.state.readOnly;case"indentWithTabs":return this.cm6.state.facet(indentUnit)==" ";case"indentUnit":return this.cm6.state.facet(indentUnit).length||2;case"keyMap":return this.state.keyMap||"vim"}}toggleOverwrite(e){this.state.overwrite=e}getTokenTypeAt(e){var r,n=this.indexFromPos(e),o=ensureSyntaxTree(this.cm6.state,n),a=o==null?void 0:o.resolve(n),l=((r=a==null?void 0:a.type)===null||r===void 0?void 0:r.name)||"";return/comment/i.test(l)?"comment":/string/i.test(l)?"string":""}overWriteSelection(e){var r=this.cm6.state.doc,n=this.cm6.state.selection,o=n.ranges.map(a=>{if(a.empty){var l=a.to<r.length?r.sliceString(a.from,a.to+1):"";if(l&&!/\n/.test(l))return EditorSelection.range(a.from,a.to+1)}return a});this.cm6.dispatch({selection:EditorSelection.create(o,n.mainIndex)}),this.replaceSelection(e)}isInMultiSelectMode(){return this.cm6.state.selection.ranges.length>1}virtualSelectionMode(){return!!this.virtualSelection}forEachSelection(e){var r=this.cm6.state.selection;this.virtualSelection=EditorSelection.create(r.ranges,r.mainIndex);for(var n=0;n<this.virtualSelection.ranges.length;n++){var o=this.virtualSelection.ranges[n];o&&(this.cm6.dispatch({selection:EditorSelection.create([o])}),e(),this.virtualSelection.ranges[n]=this.cm6.state.selection.ranges[0])}this.cm6.dispatch({selection:this.virtualSelection}),this.virtualSelection=null}}CodeMirror.isMac=typeof navigator<"u"&&/Mac/.test(navigator.platform);CodeMirror.Pos=Pos;CodeMirror.StringStream=StringStream;CodeMirror.commands={cursorCharLeft:function(s){cursorCharLeft(s.cm6)},redo:function(s){runHistoryCommand(s,!1)},undo:function(s){runHistoryCommand(s,!0)},newlineAndIndent:function(s){insertNewlineAndIndent({state:s.cm6.state,dispatch:e=>dispatchChange(s,e)})},indentAuto:function(s){indentSelection(s.cm6)}};CodeMirror.defineOption=function(s,e,r){};CodeMirror.isWordChar=function(s){return wordChar.test(s)};CodeMirror.keys=keys;CodeMirror.keyMap={};CodeMirror.addClass=function(){};CodeMirror.rmClass=function(){};CodeMirror.e_preventDefault=function(s){s.preventDefault()};CodeMirror.e_stop=function(s){var e,r;(e=s==null?void 0:s.stopPropagation)===null||e===void 0||e.call(s),(r=s==null?void 0:s.preventDefault)===null||r===void 0||r.call(s)};CodeMirror.keyName=function(s){var e=s.key;if(!ignoredKeys[e]){e=="Escape"&&(e="Esc"),e==" "&&(e="Space"),e.length>1&&(e=e.replace(/Numpad|Arrow/,"")),e.length==1&&(e=e.toUpperCase());var r="";return s.ctrlKey&&(r+="Ctrl-"),s.altKey&&(r+="Alt-"),(r||e.length>1)&&s.shiftKey&&(r+="Shift-"),r+=e,r}};CodeMirror.vimKey=function(e){var r=e.key;if(!ignoredKeys[r]){r.length>1&&r[0]=="n"&&(r=r.replace("Numpad","")),r=specialKey[r]||r;var n="";return e.ctrlKey&&(n+="C-"),e.altKey&&(n+="A-"),e.metaKey&&(n+="M-"),CodeMirror.isMac&&e.altKey&&!e.metaKey&&!e.ctrlKey&&(n=n.slice(2)),(n||r.length>1)&&e.shiftKey&&(n+="S-"),n+=r,n.length>1&&(n="<"+n+">"),n}};CodeMirror.lookupKey=function(e,r,n){var o=CodeMirror.keys[e];o&&n(o)};CodeMirror.on=on;CodeMirror.off=off;CodeMirror.signal=signal;CodeMirror.findMatchingTag=findMatchingTag;CodeMirror.findEnclosingTag=findEnclosingTag;function dialogDiv(s,e,r){var n=document.createElement("div");return n.appendChild(e),n}function closeNotification(s,e){s.state.currentNotificationClose&&s.state.currentNotificationClose(),s.state.currentNotificationClose=e}function openNotification(s,e,r){closeNotification(s,c);var n=dialogDiv(s,e,r&&r.bottom),o=!1,a,l=r&&typeof r.duration<"u"?r.duration:5e3;function c(){o||(o=!0,clearTimeout(a),n.remove(),hideDialog(s,n))}return n.onclick=function(h){h.preventDefault(),c()},showDialog(s,n),l&&(a=setTimeout(c,l)),c}function showDialog(s,e){var r=s.state.dialog;s.state.dialog=e,e&&r!==e&&(r&&r.contains(document.activeElement)&&s.focus(),r&&r.parentElement?r.parentElement.replaceChild(e,r):r&&r.remove(),CodeMirror.signal(s,"dialog"))}function hideDialog(s,e){s.state.dialog==e&&(s.state.dialog=null,CodeMirror.signal(s,"dialog"))}function openDialog(s,e,r,n){n||(n={}),closeNotification(s,void 0);var o=dialogDiv(s,e,n.bottom),a=!1;showDialog(s,o);function l(h){if(typeof h=="string")c.value=h;else{if(a)return;a=!0,hideDialog(s,o),s.state.dialog||s.focus(),n.onClose&&n.onClose(o)}}var c=o.getElementsByTagName("input")[0];return c&&(n.value&&(c.value=n.value,n.selectValueOnOpen!==!1&&c.select()),n.onInput&&CodeMirror.on(c,"input",function(h){n.onInput(h,c.value,l)}),n.onKeyUp&&CodeMirror.on(c,"keyup",function(h){n.onKeyUp(h,c.value,l)}),CodeMirror.on(c,"keydown",function(h){n&&n.onKeyDown&&n.onKeyDown(h,c.value,l)||(h.keyCode==13&&r(c.value),(h.keyCode==27||n.closeOnEnter!==!1&&h.keyCode==13)&&(c.blur(),CodeMirror.e_stop(h),l()))}),n.closeOnBlur!==!1&&CodeMirror.on(c,"blur",function(){setTimeout(function(){document.activeElement!==c&&l()})}),c.focus()),l}var matching={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function bracketRegex(s){return s&&s.bracketRegex||/[(){}[\]]/}function scanForBracket(s,e,r,n,o){for(var a=o&&o.maxScanLineLength||1e4,l=o&&o.maxScanLines||1e3,c=[],h=bracketRegex(o),f=r>0?Math.min(e.line+l,s.lastLine()+1):Math.max(s.firstLine()-1,e.line-l),d=e.line;d!=f;d+=r){var m=s.getLine(d);if(m){var v=r>0?0:m.length-1,A=r>0?m.length:-1;if(!(m.length>a))for(d==e.line&&(v=e.ch-(r<0?1:0));v!=A;v+=r){var T=m.charAt(v);if(h.test(T)){var B=matching[T];if(B&&B.charAt(1)==">"==r>0)c.push(T);else if(c.length)c.pop();else return{pos:new Pos(d,v),ch:T}}}}}return d-r==(r>0?s.lastLine():s.firstLine())?!1:null}function findMatchingTag(s,e){}function findEnclosingTag(s,e){var r,n,o=s.cm6.state,a=s.indexFromPos(e);if(a<o.doc.length){var l=o.sliceDoc(a,a+1);l=="<"&&a++}for(var c=ensureSyntaxTree(o,a),h=(c==null?void 0:c.resolve(a))||null;h;){if(((r=h.firstChild)===null||r===void 0?void 0:r.type.name)=="OpenTag"&&((n=h.lastChild)===null||n===void 0?void 0:n.type.name)=="CloseTag")return{open:convertRange(o.doc,h.firstChild),close:convertRange(o.doc,h.lastChild)};h=h.parent}}function convertRange(s,e){return{from:posFromIndex(s,e.from),to:posFromIndex(s,e.to)}}class Marker{constructor(e,r,n){this.cm=e,this.id=e.$mid++,this.offset=r,this.assoc=n,e.marks[this.id]=this}clear(){delete this.cm.marks[this.id]}find(){return this.offset==null?null:this.cm.posFromIndex(this.offset)}update(e){this.offset!=null&&(this.offset=e.mapPos(this.offset,this.assoc,MapMode.TrackDel))}}class Piece{constructor(e,r,n,o,a,l,c,h,f,d){this.left=e,this.top=r,this.height=n,this.fontFamily=o,this.fontSize=a,this.fontWeight=l,this.color=c,this.className=h,this.letter=f,this.partial=d}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",e.style.height=this.height+"px",e.style.lineHeight=this.height+"px",e.style.fontFamily=this.fontFamily,e.style.fontSize=this.fontSize,e.style.fontWeight=this.fontWeight,e.style.color=this.partial?"transparent":this.color,e.className=this.className,e.textContent=this.letter}eq(e){return this.left==e.left&&this.top==e.top&&this.height==e.height&&this.fontFamily==e.fontFamily&&this.fontSize==e.fontSize&&this.fontWeight==e.fontWeight&&this.color==e.color&&this.className==e.className&&this.letter==e.letter}}class BlockCursorPlugin{constructor(e,r){this.view=e,this.rangePieces=[],this.cursors=[],this.cm=r,this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.cursorLayer=e.scrollDOM.appendChild(document.createElement("div")),this.cursorLayer.className="cm-cursorLayer cm-vimCursorLayer",this.cursorLayer.setAttribute("aria-hidden","true"),e.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){this.cursorLayer.style.animationDuration="1200ms"}update(e){(e.selectionSet||e.geometryChanged||e.viewportChanged)&&(this.view.requestMeasure(this.measureReq),this.cursorLayer.style.animationName=this.cursorLayer.style.animationName=="cm-blink"?"cm-blink2":"cm-blink")}scheduleRedraw(){this.view.requestMeasure(this.measureReq)}readPos(){let{state:e}=this.view,r=[];for(let n of e.selection.ranges){let o=n==e.selection.main,a=measureCursor(this.cm,this.view,n,o);a&&r.push(a)}return{cursors:r}}drawSel({cursors:e}){if(e.length!=this.cursors.length||e.some((r,n)=>!r.eq(this.cursors[n]))){let r=this.cursorLayer.children;if(r.length!==e.length){this.cursorLayer.textContent="";for(const n of e)this.cursorLayer.appendChild(n.draw())}else e.forEach((n,o)=>n.adjust(r[o]));this.cursors=e}}destroy(){this.cursorLayer.remove()}}const themeSpec={".cm-vimMode .cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-fat-cursor":{position:"absolute",background:"#ff9696",border:"none",whiteSpace:"pre"},"&:not(.cm-focused) .cm-fat-cursor":{background:"none",outline:"solid 1px #ff9696",color:"transparent !important"}},hideNativeSelection=Prec.highest(EditorView.theme(themeSpec));function getBase(s){let e=s.scrollDOM.getBoundingClientRect();return{left:(s.textDirection==Direction.LTR?e.left:e.right-s.scrollDOM.clientWidth)-s.scrollDOM.scrollLeft,top:e.top-s.scrollDOM.scrollTop}}function measureCursor(s,e,r,n){let o=r.head,a=!1,l=1,c=s.state.vim;if(c&&(!c.insertMode||s.state.overwrite)){if(a=!0,c.visualBlock&&!n)return null;r.anchor<r.head&&o--,s.state.overwrite?l=.2:c.status&&(l=.5)}if(a){let f=o<e.state.doc.length&&e.state.sliceDoc(o,o+1);f&&/[\uDC00-\uDFFF]/.test(f)&&o>1&&(o--,f=e.state.sliceDoc(o,o+1));let d=e.coordsAtPos(o,1);if(!d)return null;let m=getBase(e),v=e.domAtPos(o),A=v?v.node:e.contentDOM;for(;v&&v.node instanceof HTMLElement;)A=v.node,v={node:v.node.childNodes[v.offset],offset:0};if(!(A instanceof HTMLElement)){if(!A.parentNode)return null;A=A.parentNode}let T=getComputedStyle(A),B=d.left;if(!f||f==`
|
||
`||f=="\r")f=" ";else if(f==" "){f=" ";var h=e.coordsAtPos(o+1,-1);h&&(B=h.left-(h.left-d.left)/parseInt(T.tabSize))}else/[\uD800-\uDBFF]/.test(f)&&o<e.state.doc.length-1&&(f+=e.state.sliceDoc(o+1,o+2));let Y=d.bottom-d.top;return new Piece(B-m.left,d.top-m.top+Y*(1-l),Y*l,T.fontFamily,T.fontSize,T.fontWeight,T.color,n?"cm-fat-cursor cm-cursor-primary":"cm-fat-cursor cm-cursor-secondary",f,l!=1)}else return null}var FIREFOX_LINUX=typeof navigator<"u"&&/linux/i.test(navigator.platform)&&/ Gecko\/\d+/.exec(navigator.userAgent);const Vim=initVim(CodeMirror),HighlightMargin=250,vimStyle=EditorView.baseTheme({".cm-vimMode .cm-cursorLayer:not(.cm-vimCursorLayer)":{display:"none"},".cm-vim-panel":{padding:"0px 10px",fontFamily:"monospace",minHeight:"1.3em"},".cm-vim-panel input":{border:"none",outline:"none",backgroundColor:"inherit"},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"}}),vimPlugin=ViewPlugin.fromClass(class{constructor(s){this.status="",this.query=null,this.decorations=Decoration.none,this.waitForCopy=!1,this.lastKeydown="",this.useNextTextInput=!1,this.view=s;const e=this.cm=new CodeMirror(s);Vim.enterVimMode(this.cm),this.view.cm=this.cm,this.cm.state.vimPlugin=this,this.blockCursor=new BlockCursorPlugin(s,e),this.updateClass(),this.cm.on("vim-command-done",()=>{e.state.vim&&(e.state.vim.status=""),this.blockCursor.scheduleRedraw(),this.updateStatus()}),this.cm.on("vim-mode-change",r=>{e.state.vim.mode=r.mode,r.subMode&&(e.state.vim.mode+=" block"),e.state.vim.status="",this.blockCursor.scheduleRedraw(),this.updateClass(),this.updateStatus()}),this.cm.on("dialog",()=>{this.cm.state.statusbar?this.updateStatus():s.dispatch({effects:showVimPanel.of(!!this.cm.state.dialog)})}),this.dom=document.createElement("span"),this.dom.style.cssText="position: absolute; right: 10px; top: 1px",this.statusButton=document.createElement("span"),this.statusButton.onclick=r=>{Vim.handleKey(this.cm,"<Esc>","user"),this.cm.focus()},this.statusButton.style.cssText="cursor: pointer"}update(s){var e;if((s.viewportChanged||s.docChanged)&&this.query&&this.highlight(this.query),s.docChanged&&this.cm.onChange(s),s.selectionSet&&this.cm.onSelectionChange(),s.viewportChanged,this.cm.curOp&&!this.cm.curOp.isVimOp&&this.cm.onBeforeEndOperation(),s.transactions){for(let r of s.transactions)for(let n of r.effects)if(n.is(setSearchQuery))if(!((e=n.value)===null||e===void 0?void 0:e.forVim))this.highlight(null);else{let a=n.value.create();this.highlight(a)}}this.blockCursor.update(s)}updateClass(){const s=this.cm.state;!s.vim||s.vim.insertMode&&!s.overwrite?this.view.scrollDOM.classList.remove("cm-vimMode"):this.view.scrollDOM.classList.add("cm-vimMode")}updateStatus(){let s=this.cm.state.statusbar,e=this.cm.state.vim;if(!s||!e)return;let r=this.cm.state.dialog;if(r)r.parentElement!=s&&(s.textContent="",s.appendChild(r));else{s.textContent="";var n=(e.mode||"normal").toUpperCase();e.insertModeReturn&&(n+="(C-O)"),this.statusButton.textContent=`--${n}--`,s.appendChild(this.statusButton)}this.dom.textContent=e.status,s.appendChild(this.dom)}destroy(){Vim.leaveVimMode(this.cm),this.updateClass(),this.blockCursor.destroy(),delete this.view.cm}highlight(s){if(this.query=s,!s)return this.decorations=Decoration.none;let{view:e}=this,r=new RangeSetBuilder;for(let n=0,o=e.visibleRanges,a=o.length;n<a;n++){let{from:l,to:c}=o[n];for(;n<a-1&&c>o[n+1].from-2*HighlightMargin;)c=o[++n].to;s.highlight(e.state,l,c,(h,f)=>{r.add(h,f,matchMark)})}return this.decorations=r.finish()}handleKey(s,e){const r=CodeMirror.vimKey(s),n=this.cm;if(!r)return;let o=n.state.vim;if(!o)return;if(r=="<Esc>"&&!o.insertMode&&!o.visualMode&&this.query){const c=o.searchState_;c&&(n.removeOverlay(c.getOverlay()),c.setOverlay(null))}if(r==="<C-c>"&&!CodeMirror.isMac&&n.somethingSelected())return this.waitForCopy=!0,!0;o.status=(o.status||"")+r;let l=Vim.multiSelectHandleKey(n,r,"user");return o=n.state.vim,!l&&o.insertMode&&n.state.overwrite&&(s.key&&s.key.length==1&&!/\n/.test(s.key)?(l=!0,n.overWriteSelection(s.key)):s.key=="Backspace"&&(l=!0,CodeMirror.commands.cursorCharLeft(n))),l&&(CodeMirror.signal(this.cm,"vim-keypress",r),s.preventDefault(),s.stopPropagation(),this.blockCursor.scheduleRedraw()),this.updateStatus(),!!l}},{eventHandlers:{copy:function(s,e){this.waitForCopy&&(this.waitForCopy=!1,Promise.resolve().then(()=>{var r=this.cm,n=r.state.vim;n&&(n.insertMode?r.setSelection(r.getCursor(),r.getCursor()):r.operation(()=>{r.curOp&&(r.curOp.isVimOp=!0),Vim.handleKey(r,"<Esc>","user")}))}))},compositionstart:function(s,e){this.useNextTextInput=!0},keypress:function(s,e){this.lastKeydown=="Dead"&&this.handleKey(s,e)},keydown:function(s,e){this.lastKeydown=s.key,this.lastKeydown=="Unidentified"||this.lastKeydown=="Process"||this.lastKeydown=="Dead"?this.useNextTextInput=!0:(this.useNextTextInput=!1,this.handleKey(s,e))}},provide:()=>[EditorView.inputHandler.of((s,e,r,n)=>{var o,a,l=getCM(s);if(!l)return!1;var c=(o=l.state)===null||o===void 0?void 0:o.vim,h=l.state.vimPlugin;return c&&!c.insertMode&&!(!((a=l.curOp)===null||a===void 0)&&a.isVimOp)?(n==="\0\0"||(n.length==1&&h.useNextTextInput&&h.handleKey({key:n,preventDefault:()=>{},stopPropagation:()=>{}}),forceEndComposition(s)),!0):!1})],decorations:s=>s.decorations});function forceEndComposition(s){var e=s.scrollDOM.parentElement;if(e){if(FIREFOX_LINUX){s.contentDOM.textContent="\0\0",s.contentDOM.dispatchEvent(new CustomEvent("compositionend"));return}var r=s.scrollDOM.nextSibling,n=window.getSelection(),o=n&&{anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset};s.scrollDOM.remove(),e.insertBefore(s.scrollDOM,r);try{o&&n&&(n.setPosition(o.anchorNode,o.anchorOffset),o.focusNode&&n.extend(o.focusNode,o.focusOffset))}catch(a){console.error(a)}s.focus(),s.contentDOM.dispatchEvent(new CustomEvent("compositionend"))}}const matchMark=Decoration.mark({class:"cm-searchMatch"}),showVimPanel=StateEffect.define(),vimPanelState=StateField.define({create:()=>!1,update(s,e){for(let r of e.effects)r.is(showVimPanel)&&(s=r.value);return s},provide:s=>showPanel.from(s,e=>e?createVimPanel:null)});function createVimPanel(s){let e=document.createElement("div");e.className="cm-vim-panel";let r=s.cm;return r.state.dialog&&e.appendChild(r.state.dialog),{top:!1,dom:e}}function statusPanel(s){let e=document.createElement("div");e.className="cm-vim-panel";let r=s.cm;return r.state.statusbar=e,r.state.vimPlugin.updateStatus(),{dom:e}}function vim(s={}){return[vimStyle,vimPlugin,hideNativeSelection,s.status?showPanel.of(statusPanel):vimPanelState]}function getCM(s){return s.cm||null}const delay=s=>new Promise((e,r)=>setTimeout(()=>r(new Error("Operation took too long")),s)),tryCatchWrapper=(s,e)=>new Promise((r,n)=>{try{Function(`with (this) {try{${e}} catch (e) {console.log(e)}};`).call(s.api),r(!0)}catch(o){console.log(o),r(!1)}}),tryEvaluate=async(s,e,r=5e3)=>{try{e.evaluations++,await Promise.race([tryCatchWrapper(s,`let i = ${e.evaluations};`+e.candidate),delay(r)])?e.committed=e.candidate:await evaluate(s,e,r)}catch(n){console.log(n)}},evaluate=async(s,e,r=1e3)=>{try{await Promise.race([tryCatchWrapper(s,e.committed),delay(r)]),e.evaluations&&e.evaluations++}catch(n){console.log(n)}},zeroPad=(s,e)=>String(s).padStart(e,"0");class TransportNode extends AudioWorkletNode{constructor(r,n,o){super(r,"transport",n);z(this,"handleMessage",r=>{if(r.data&&r.data.type==="bang"){this.startTime===null&&(this.startTime=r.data.currentTime),this.elapsedTime=r.data.currentTime-this.startTime,this.prevCurrentTime=r.data.currentTime;let{futureTimeStamp:n,timeToNextPulse:o,nextPulsePosition:a}=this.convertTimeToNextBarsBeats(this.elapsedTime);this.nextPulsePosition!==a&&(this.nextPulsePosition=a,setTimeout(()=>{const l=performance.now();this.app.clock.time_position=n,this.$clock.innerHTML=`[${n.bar}:${n.beat}:${zeroPad(n.pulse,"2")}]`,tryEvaluate(this.app,this.app.global_buffer),this.hasBeenEvaluated=!0,this.currentPulsePosition=a;const c=performance.now();this.lastLatencies[this.indexOfLastLatencies]=c-l,this.indexOfLastLatencies=(this.indexOfLastLatencies+1)%this.lastLatencies.length;const h=this.lastLatencies.reduce((f,d)=>f+d)/this.lastLatencies.length;this.executionLatency=h/1e3},(o+this.executionLatency)*1e3))}});this.app=o,this.port.addEventListener("message",this.handleMessage),this.port.start(),this.$clock=document.getElementById("clockviewer"),this.hasBeenEvaluated=!1,this.currentPulsePosition=0,this.nextPulsePosition=-1,this.executionLatency=0,this.lastLatencies=[0,0,0,0,0,0,0,0,0,0],this.indexOfLastLatencies=0,this.startTime=null,this.elapsedTime=0}start(){this.port.postMessage("start")}pause(){this.port.postMessage("pause")}stop(){this.startTime=null,this.elapsedTime=null,this.app.clock.tick=0,this.$clock.innerHTML=`[1 | 1 | ${zeroPad(1,"2")}]`,this.port.postMessage("stop")}convertTimeToBarsBeats(r){const n=60/this.app.clock.bpm,o=r/n,a=this.app.clock.time_signature[0],l=Math.floor(o/a)+1,c=Math.floor(o%a)+1,h=Math.floor(o%1*this.app.clock.ppqn);return this.app.clock.tick++,{bar:l,beat:c,ppqn:h}}convertTimeToNextBarsBeats(r){const n=60/this.app.clock.bpm,o=r/n,a=this.app.clock.time_signature[0];this.currentPulsePosition=o*this.app.clock.ppqn;const l=Math.ceil(this.currentPulsePosition),c=this.app.clock.convertPulseToSecond(this.nextPulsePosition-this.currentPulsePosition),h=this.nextPulsePosition/this.app.clock.ppqn,f=h/a,d={bar:Math.floor(f)+1,beat:Math.floor(h)%a+1,pulse:Math.floor(this.nextPulsePosition)%this.app.clock.ppqn};return this.app.clock.tick++,{futureTimeStamp:d,timeToNextPulse:c,nextPulsePosition:l}}}const TransportProcessor="/assets/TransportProcessor-9e6f56da.js";class Clock{constructor(e,r){z(this,"ctx");z(this,"transportNode");z(this,"bpm");z(this,"time_signature");z(this,"time_position");z(this,"ppqn");z(this,"tick");this.app=e,this.time_position={bar:0,beat:0,pulse:0},this.time_signature=[4,4],this.tick=0,this.bpm=120,this.ppqn=48,this.transportNode=null,this.ctx=r,r.audioWorklet.addModule(TransportProcessor).then(n=>(this.transportNode=new TransportNode(r,{},this.app),this.transportNode.connect(r.destination),n)).catch(n=>{console.log("Error loading TransportProcessor.js:",n)})}get ticks_before_new_bar(){const e=(this.app.clock.beats_since_origin-1)*48+this.time_position.pulse+1;return this.beats_per_bar*this.ppqn*this.time_position.bar+1-e}get beats_per_bar(){return this.time_signature[0]}get beats_since_origin(){return(this.time_position.bar-1)*this.beats_per_bar+this.time_position.beat}get pulses_since_origin(){return this.beats_since_origin*this.ppqn+this.time_position.pulse}get pulse_duration(){return 60/this.bpm/this.ppqn}convertPulseToSecond(e){return e*this.pulse_duration}start(){var e,r;((e=this.transportNode)==null?void 0:e.state)==="running"?console.log("Already started"):(this.app.audioContext.resume(),(r=this.transportNode)==null||r.start())}pause(){var e;(e=this.transportNode)==null||e.pause()}stop(){var e;(e=this.transportNode)==null||e.stop()}}const global_text=`
|
||
// Global buffer: a central buffer to command them all.
|
||
// ====================================================
|
||
// The global buffer is a special buffer used to control
|
||
// the general behavior of your universe. It is meant to
|
||
// be used as a "control room" for your universe. You can
|
||
// make use of several commands to control the execution
|
||
// flow of all the files:
|
||
// - script(universe/universes: number): run script(s)
|
||
`,local_buffer=`
|
||
// Local buffer: nine buffers to write your algorithms.
|
||
`,init_buffer=`
|
||
// Init buffer: a buffer to initialize the universe.
|
||
// This universe is runned once when the universe is
|
||
// loaded!
|
||
`,note_buffer="// Notes buffer: a buffer to write your notes.",tutorial_universe={global:{candidate:global_text,committed:global_text,evaluations:0},locals:{1:{candidate:local_buffer,committed:local_buffer,evaluations:0},2:{candidate:local_buffer,committed:local_buffer,evaluations:0},3:{candidate:local_buffer,committed:local_buffer,evaluations:0},4:{candidate:local_buffer,committed:local_buffer,evaluations:0},5:{candidate:local_buffer,committed:local_buffer,evaluations:0},6:{candidate:local_buffer,committed:local_buffer,evaluations:0},7:{candidate:local_buffer,committed:local_buffer,evaluations:0},8:{candidate:local_buffer,committed:local_buffer,evaluations:0},9:{candidate:local_buffer,committed:local_buffer,evaluations:0}},init:{candidate:init_buffer,committed:init_buffer,evaluations:0},notes:{candidate:note_buffer}},template_universe={global:{candidate:"",committed:"",evaluations:0},locals:{1:{candidate:"",committed:"",evaluations:0},2:{candidate:"",committed:"",evaluations:0},3:{candidate:"",committed:"",evaluations:0},4:{candidate:"",committed:"",evaluations:0},5:{candidate:"",committed:"",evaluations:0},6:{candidate:"",committed:"",evaluations:0},7:{candidate:"",committed:"",evaluations:0},8:{candidate:"",committed:"",evaluations:0},9:{candidate:"",committed:"",evaluations:0}},init:{candidate:"",committed:"",evaluations:0},notes:{candidate:""}},template_universes={Default:{global:{candidate:"",committed:"",evaluations:0},locals:{1:{candidate:"",committed:"",evaluations:0},2:{candidate:"",committed:"",evaluations:0},3:{candidate:"",committed:"",evaluations:0},4:{candidate:"",committed:"",evaluations:0},5:{candidate:"",committed:"",evaluations:0},6:{candidate:"",committed:"",evaluations:0},7:{candidate:"",committed:"",evaluations:0},8:{candidate:"",committed:"",evaluations:0},9:{candidate:"",committed:"",evaluations:0}},init:{candidate:"",committed:"",evaluations:0},notes:{candidate:"// NOTES"}},Help:tutorial_universe};class AppSettings{constructor(){z(this,"vimMode",!1);z(this,"theme","materialDark");z(this,"font","SpaceMono");z(this,"font_size",22);z(this,"universes");z(this,"selected_universe","Default");z(this,"line_numbers",!0);const e=JSON.parse(localStorage.getItem("topos")||"{}");e&&Object.keys(e).length!==0?(this.vimMode=e.vimMode,this.theme=e.theme,this.font=e.font,this.font_size=e.font_size,this.universes=e.universes,this.selected_universe=e.selected_universe,this.line_numbers=e.line_numbers):this.universes=template_universes}get data(){return{vimMode:this.vimMode,theme:this.theme,font:this.font,font_size:this.font_size,universes:this.universes,selected_universe:this.selected_universe,line_numbers:this.line_numbers}}saveApplicationToLocalStorage(e,r){this.universes=e,this.vimMode=r.vimMode,this.font=r.font,this.font_size=r.font_size,this.selected_universe=r.selected_universe,this.line_numbers=r.line_numbers,localStorage.setItem("topos",JSON.stringify(this.data))}}const OPERATORS={"+":(s,e)=>s+e,"-":(s,e)=>s-e,"*":(s,e)=>s*e,"/":(s,e)=>s/e,"%":(s,e)=>s%e,"^":(s,e)=>s**e,"<<":(s,e)=>s<<e,">>":(s,e)=>s>>e,"&":(s,e)=>s&e,"|":(s,e)=>s|e},DEFAULT_OPTIONS={octave:0,duration:.25,key:"C4",scale:"IONIAN",measure:0,degrees:!1},DEFAULT_DURS={m:8,k:10240/1920,l:4,"d.":3,p:5120/1920,d:2,"w.":1.5,c:2560/1920,w:1,"h..":.875,"h.":.75,y:1280/1920,h:.5,"q..":840/1920,"q.":.375,n:640/1920,q:.25,"e..":420/1920,"e.":.1875,a:320/1920,e:.125,"s..":210/1920,"s.":180/1920,f:160/1920,s:.0625,"t..":105/1920,"t.":90/1920,x:80/1920,t:60/1920,"u.":45/1920,g:40/1920,u:30/1920,j:15/1920,o:8/1920,z:0},NOTES_TO_INTERVALS={C:0,Cs:1,D:2,Eb:3,E:4,F:5,Fs:6,G:7,Ab:8,A:9,Bb:10,B:11},MODIFIERS={"#":1,b:-1,s:1},scales=()=>{const s=[2,1,2,2,1,2,2],e=[2,2,1,2,2,2,1],r=[2,1,2,2,1,3,1],n=[2,2,1,2,1,3,1],o=[3,2,2,3,2],a=[2,3,2,3,2],l=[2,2,2,2,2,2],c=[2,1,1,3,2,3],h=[3,2,1,1,3,2],f=[2,1,2,2,2,2,1],d=[2,2,1,2,1,2,2];return{MAJOR:e,MINOR:s,"HARMONIC MINOR":r,"HARMONIC MAJOR":n,"MINOR PENTATONIC":o,"SUSPENDED PENTATONIC":a,"BLUES MAJOR":c,"BLUES MINOR":h,WHOLE:l,"MELODIC MINOR":f,"MELODIC MAJOR":d,MINORIC:[4,4,4],THAPTIC:[4,3,4,1],LOTHIC:[3,4,1,4],PHRATIC:[4,1,4,3],AERATHIC:[1,4,3,4],EPATHIC:[4,3,2,3],MYNIC:[3,2,3,4],ROTHIC:[2,3,4,3],EPORIC:[3,4,3,2],ZYPHIC:[4,4,3,1],EPOGIC:[4,3,1,4],LANIC:[3,1,4,4],PYRRIC:[1,4,4,3],AEOLORIC:[4,4,1,3],GONIC:[4,1,3,4],DALIC:[1,3,4,4],DYGIC:[3,4,4,1],DARIC:[4,3,3,2],LONIC:[3,3,2,4],PHRADIC:[3,2,4,3],BOLIC:[2,4,3,3],SARIC:[4,2,3,3],ZOPTIC:[2,3,3,4],AERAPHIC:[3,3,4,2],BYPTIC:[3,4,2,3],AEOLIC:[4,4,2,2],KOPTIC:[4,2,2,4],MIXOLYRIC:[2,2,4,4],LYDIC:[2,4,4,2],STATHIC:[4,2,4,2],DADIC:[2,4,2,4],PHRYNIC:[3,3,3,3],EPATHITONIC:[3,2,3,2,2],MYNITONIC:[2,3,2,2,3],ROCRITONIC:o,PENTATONIC:[2,2,3,2,3],THAPTITONIC:a,MAGITONIC:[4,3,2,2,1],DADITONIC:[3,2,2,1,4],AEOLYPHRITONIC:[2,2,1,4,3],GYCRITONIC:[2,1,4,3,2],PYRITONIC:[1,4,3,2,2],GATHITONIC:[4,2,3,2,1],IONITONIC:[2,3,2,1,4],PHRYNITONIC:[3,2,1,4,2],STATHITONIC:[2,1,4,2,3],THALITONIC:[1,4,2,3,2],ZOLITONIC:[4,2,1,4,1],EPOGITONIC:[2,1,4,1,4],LANITONIC:[1,4,1,4,2],PAPTITONIC:[4,1,4,2,1],IONACRITONIC:[1,4,2,1,4],PHRADITONIC:[4,1,4,1,2],AEOLORITONIC:[1,4,1,2,4],GONITONIC:[4,1,2,4,1],DALITONIC:[1,2,4,1,4],DYGITONIC:[2,4,1,4,1],AERACRITONIC:[4,1,2,3,2],BYPTITONIC:[1,2,3,2,4],DARITONIC:[2,3,2,4,1],LONITONIC:[3,2,4,1,2],IONYCRITONIC:[2,4,1,2,3],LOTHITONIC:[4,1,2,2,3],PHRATONIC:[1,2,2,3,4],AERATHITONIC:[2,2,3,4,1],SARITONIC:[2,3,4,1,2],ZOPTITONIC:[3,4,1,2,2],DOLITONIC:[4,4,1,2,1],PORITONIC:[4,1,2,1,4],AERYLITONIC:[1,2,1,4,4],ZAGITONIC:[2,1,4,4,1],LAGITONIC:[1,4,4,1,2],MOLITONIC:[4,3,3,1,1],STAPTITONIC:[3,3,1,1,4],MOTHITONIC:[3,1,1,4,3],AERITONIC:[1,1,4,3,3],RAGITONIC:[1,4,3,3,1],IONADITONIC:[4,3,2,1,2],BOCRITONIC:[3,2,1,2,4],GYTHITONIC:[2,1,2,4,3],PAGITONIC:[1,2,4,3,2],AEOLYTHITONIC:[2,4,3,2,1],ZACRITONIC:[4,3,1,3,1],LARITONIC:[3,1,3,1,4],THACRITONIC:[1,3,1,4,3],STYDITONIC:[3,1,4,3,1],LORITONIC:[1,4,3,1,3],AEOLYRITONIC:[4,3,1,1,3],GORITONIC:[3,1,1,3,4],AEOLODITONIC:[1,1,3,4,3],DOPTITONIC:[1,3,4,3,1],AERAPHITONIC:[3,4,3,1,1],ZATHITONIC:[4,2,4,1,1],RADITONIC:[2,4,1,1,4],STONITONIC:[4,1,1,4,2],SYPTITONIC:[1,1,4,2,4],IONYTHITONIC:[1,4,2,4,1],AEOLANITONIC:[4,2,2,3,1],DANITONIC:[2,2,3,1,4],IONARITONIC:[2,3,1,4,2],DYNITONIC:[3,1,4,2,2],ZYDITONIC:[1,4,2,2,3],AEOLACRITONIC:[4,2,1,2,3],ZYTHITONIC:[2,1,2,3,4],DYRITONIC:[1,2,3,4,2],KOPTITONIC:[2,3,4,2,1],THOCRITONIC:[3,4,2,1,2],LYCRITONIC:[4,1,3,3,1],DAPTITONIC:[1,3,3,1,4],KYGITONIC:[3,3,1,4,1],MOCRITONIC:[3,1,4,1,3],ZYNITONIC:[1,4,1,3,3],EPYGITONIC:[4,1,3,2,2],ZAPTITONIC:[1,3,2,2,4],KAGITONIC:[3,2,2,4,1],ZOGITONIC:[2,2,4,1,3],EPYRITONIC:[2,4,1,3,2],ZOTHITONIC:[4,1,3,1,3],PHROLITONIC:[1,3,1,3,4],IONAGITONIC:[3,1,3,4,1],AEOLAPRITONIC:[1,3,4,1,3],KYRITONIC:[3,4,1,3,1],IONYPTITONIC:[4,1,1,3,3],GYRITONIC:[1,1,3,3,4],ZALITONIC:[1,3,3,4,1],STOLITONIC:[3,3,4,1,1],BYLITONIC:[3,4,1,1,3],THODITONIC:[3,3,2,3,1],DOGITONIC:[3,2,3,1,3],PHRALITONIC:[2,3,1,3,3],GARITONIC:[3,1,3,3,2],SOPTITONIC:[1,3,3,2,3],KATARITONIC:[3,3,2,2,2],SYLITONIC:[3,2,2,2,3],THONITONIC:[2,2,2,3,3],PHROPITONIC:[2,2,3,3,2],STADITONIC:[2,3,3,2,2],LYDITONIC:[3,3,1,3,2],MYTHITONIC:[3,1,3,2,3],SOGITONIC:[1,3,2,3,3],GOTHITONIC:[3,2,3,3,1],ROTHITONIC:[2,3,3,1,3],ZYLITONIC:[4,4,2,1,1],ZODITONIC:[4,2,1,1,4],ZARITONIC:[2,1,1,4,4],PHRYTHITONIC:[1,1,4,4,2],ROLITONIC:[1,4,4,2,1],RANITONIC:[4,4,1,1,2],LADITONIC:[4,1,1,2,4],PODITONIC:[1,1,2,4,4],IONOTHITONIC:[1,2,4,4,1],KANITONIC:[2,4,4,1,1],RYPHITONIC:[4,3,1,2,2],GYLITONIC:[3,1,2,2,4],AEOLYCRITONIC:[1,2,2,4,3],PYNITONIC:[2,2,4,3,1],ZANITONIC:[2,4,3,1,2],PHRONITONIC:[4,2,3,1,2],BANITONIC:[2,3,1,2,4],AERONITONIC:[3,1,2,4,2],GOLITONIC:[1,2,4,2,3],DYPTITONIC:[2,4,2,3,1],AERYNITONIC:[4,2,2,1,3],PALITONIC:[2,2,1,3,4],STOTHITONIC:[2,1,3,4,2],AEROPHITONIC:[1,3,4,2,2],KATAGITONIC:[3,4,2,2,1],IONODITONIC:[4,2,1,3,2],BOGITONIC:[2,1,3,2,4],MOGITONIC:[1,3,2,4,2],DOCRITONIC:[3,2,4,2,1],EPADITONIC:[2,4,2,1,3],MIXITONIC:[3,3,3,2,1],PHROTHITONIC:[3,3,2,1,3],KATYCRITONIC:[3,2,1,3,3],IONALITONIC:[2,1,3,3,3],LOPTITONIC:[1,3,3,3,2],THYRITONIC:[3,3,3,1,2],THOPTITONIC:[3,3,1,2,3],BYCRITONIC:[3,1,2,3,3],PATHITONIC:[1,2,3,3,3],MYDITONIC:[2,3,3,3,1],BOLITONIC:[4,2,2,2,2],BOTHITONIC:[2,2,2,2,4],KATADITONIC:[2,2,2,4,2],KODITONIC:[2,2,4,2,2],THOLITONIC:[2,4,2,2,2],EPATHIMIC:[3,2,2,1,2,2],MYNIMIC:[2,2,1,2,2,3],ROCRIMIC:[2,1,2,2,3,2],EPORIMIC:[1,2,2,3,2,2],THAPTIMIC:[2,2,3,2,2,1],LOTHIMIC:[2,3,2,2,1,2],DYRIMIC:[4,2,1,2,2,1],KOPTIMIC:[2,1,2,2,1,4],THOCRIMIC:[1,2,2,1,4,2],AEOLANIMIC:[2,2,1,4,2,1],DANIMIC:[2,1,4,2,1,2],IONARIMIC:[1,4,2,1,2,2],DAPTIMIC:[4,1,4,1,1,1],KYGIMIC:[1,4,1,1,1,4],MOCRIMIC:[4,1,1,1,4,1],ZYNIMIC:[1,1,1,4,1,4],AEOLIMIC:[1,1,4,1,4,1],ZYTHIMIC:[1,4,1,4,1,1],EPYGIMIC:[4,1,2,3,1,1],ZAPTIMIC:[1,2,3,1,1,4],KAGIMIC:[2,3,1,1,4,1],ZOGIMIC:[3,1,1,4,1,2],EPYRIMIC:[1,1,4,1,2,3],LYCRIMIC:[1,4,1,2,3,1],BYLIMIC:[4,1,2,2,2,1],ZOTHIMIC:[1,2,2,2,1,4],PHROLIMIC:[2,2,2,1,4,1],IONAGIMIC:[2,2,1,4,1,2],AEOLAPHIMIC:[2,1,4,1,2,2],KYCRIMIC:[1,4,1,2,2,2],GARIMIC:[4,1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ATIC:[1,1,1,1,1,1,1,2,1,1,1],SORATIC:[1,1,1,1,1,1,2,1,1,1,1],GODATIC:[1,1,1,1,1,2,1,1,1,1,1],EPTATIC:[1,1,1,1,2,1,1,1,1,1,1],IONATIC:[1,1,1,2,1,1,1,1,1,1,1],AEOLATIC:[1,1,2,1,1,1,1,1,1,1,1],THYDATIC:[1,2,1,1,1,1,1,1,1,1,1],CHROMATIC:[1,1,1,1,1,1,1,1,1,1,1,1]}},SCALES$1=scales(),getRandomScale=()=>{const s=Object.keys(SCALES$1),e=s[Math.floor(Math.random()*s.length)];return SCALES$1[e]},getScale=s=>SCALES$1[s.toUpperCase()],isScale=s=>s.toUpperCase()in SCALES$1;function noteFromPc(s,e,r,n=0,o=0,a=!1){e=a&&e>0?e-1:e,s=typeof s=="string"?noteNameToMidi(s):s;const l=typeof r=="string"?getScale(r):r,c=l.length;(e>=c||e<0)&&(n+=Math.floor(e/c),e=e<0?c-Math.abs(e)%c:e%c,e===c&&(e=0));let h=s+l.slice(0,e).reduce((f,d)=>f+d,0);return h=h+n*l.reduce((f,d)=>f+d,0)+o,Number.isInteger(h)?[h,void 0]:resolvePitchBend(h)}function noteNameToMidi(s){const e=s.match(/^([a-gA-G])([#bs])?([1-9])?$/);if(e===null)return 60;const[,r,n,o]=e,a=o?parseInt(o,10):4,l=MODIFIERS[n]||0,c=NOTES_TO_INTERVALS[r.toUpperCase()];return 12+a*12+c+l}function resolvePitchBend(s,e=1){let r=8192;if(s%1!==0){const n=s>Math.round(s)?s:Math.round(s),o=s>Math.round(s)?Math.round(s):s,a=midiToFreq(n)/midiToFreq(o),l=1200*Math.log2(a);r=r+Math.floor(8191*(l/(100*e)))}return[s,r]}function midiToFreq(s){return 440/32*2**((s-9)/12)}function ratioToCents(s){return 1200*Math.log2(s)}function*primeSieve(){var r;const s={};let e=2;for(;;){if(!(e in s))yield e,s[e*e]=[e];else{for(const n of s[e])(s[r=n+e]||(s[r]=[])).push(n);delete s[e]}e++}}function getPrimes(s){const e=primeSieve();return Array.from({length:s},()=>e.next().value)}function monzoToCents(s){const e=s.length,r=getPrimes(e+1);let n=1;for(let o=0;o<e;o++)n*=Math.pow(r[o],s[o]);return ratioToCents(n)}function centsToSemitones(s){s[0]!==0&&(s=[0,...s]);const e=[];for(let r=0;r<s.length-1;r++){const n=(s[r+1]-s[r])/100;e.push(n)}return e}function scaleLength(s){return typeof s=="string"?getScale(s).length:s.length}function seededRandom(s=""){let e=0,r=0,n=0,o=0;function a(){const l=(e^e<<11)>>>0;return e=r,r=n,n=o,o^=(o>>>19^l^l>>>8)>>>0,(o>>>0)/4294967296}for(let l=0;l<s.length+64;l++)e^=s.charCodeAt(l)|0,a();return a}function deepClone(s){return Array.isArray(s)?s.map(e=>deepClone(e)):s&&typeof s=="object"?Object.getOwnPropertyNames(s).reduce((e,r)=>(Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(s,r)),e[r]=deepClone(s[r]),e),Object.create(Object.getPrototypeOf(s))):s}class Base{constructor(e){z(this,"text");z(this,"location");Object.assign(this,e)}clone(){return deepClone(this)}collect(e){return this[e]}refresh(){}evaluate(e={}){}}class Event extends Base{constructor(r){super(r);z(this,"duration");z(this,"_next");z(this,"_prev");z(this,"modifiedEvent");Object.assign(this,r)}next(){return this._next}previous(){return this._prev}collect(r){return this[r]}sometimesBy(r,n){return Math.random()<r?this.modify(n):this}sometimes(r){return this.sometimesBy(.5,r)}rarely(r){return this.sometimesBy(.1,r)}often(r){return this.sometimesBy(.9,r)}update(r){return r(this),this.refresh(),this}modify(r){return this.modifiedEvent=this.clone(),r(this.modifiedEvent),this.modifiedEvent.refresh(),this.modifiedEvent}skip(){return this}scale(r){}randomScale(){}seed(r){}}class Pitch extends Event{constructor(r){super(r);z(this,"pitch");z(this,"freq");z(this,"note");z(this,"octave");z(this,"bend");z(this,"key");z(this,"parsedScale");z(this,"scaleName");Object.assign(this,r)}static createTracked(r){const n={set(a,l,c){return a[l]!==c&&(a[l]=c,(l==="pitch"||l==="key"||l==="parsedScale"||l==="octave")&&(console.log(`${l} has changed to ${c}`),a.refresh())),!0}},o=new Pitch(r);return new Proxy(o,n)}refresh(){this.evaluate()}evaluate(r={}){r.octave&&(this.octave=r.octave+(this.octave||0)),r.duration&&(this.duration=r.duration);const[n,o]=noteFromPc(this.key,this.pitch,this.parsedScale,this.octave);return this.note=n,this.freq=midiToFreq(this.note),o&&(this.bend=o),this}collect(r){return this[r]}scale(r){return this.scaleName!==r?(this.scaleName=r,this.parsedScale=getScale(r),this.evaluate()):this}randomScale(){return this.parsedScale=getRandomScale(),this.evaluate()}}class Chord extends Event{constructor(r){super(r);z(this,"pitches");Object.assign(this,r),this.duration=Math.max(...this.pitches.map(n=>n.duration))}evaluate(r={}){return this.pitches.map(n=>n.evaluate(r))}collect(r){return this.pitches.map(o=>o.collect(r))}scale(r){return this.pitches.forEach(n=>n.scale(r)),this}}class RandomPitch extends Pitch{constructor(r){super(r);z(this,"min");z(this,"max");z(this,"randomSeed");z(this,"seededRandom");z(this,"random");Object.assign(this,r),r.min||(this.min=0),r.max||(this.max=scaleLength(this.parsedScale)),this.seededRandom?(console.log("SEEDED RANDOM GEN!"),this.random=this.seededRandom):this.random=Math.random}evaluate(r={}){const n=this.random();return console.log(n),this.pitch=Math.floor(n*(this.max-this.min+1))+this.min,super.evaluate(r)}seed(r){this.randomSeed=r,this.seededRandom=seededRandom(r)}}class OctaveChange extends Base{constructor(r){super(r);z(this,"octave");Object.assign(this,r)}evaluate(r={}){r.octave=this.octave}}class DurationChange extends Base{constructor(r){super(r);z(this,"duration");Object.assign(this,r)}evaluate(r={}){r.duration=this.duration}}class Repeat extends Base{constructor(r){super(r);z(this,"times");z(this,"item");Object.assign(this,r)}evaluate(r={}){return[...Array(this.times)].map(()=>this.item).flat(1/0).map(o=>o.evaluate(r))}}class List extends Base{constructor(r){super(r);z(this,"items");Object.assign(this,r)}evaluate(r={}){return this.items.map(n=>n.evaluate(r))}}class ListOperation extends Base{constructor(r){super(r);z(this,"left");z(this,"right");z(this,"operation");Object.assign(this,r)}evaluate(r={}){this.left.evaluate(),this.right.evaluate();const n=OPERATORS[this.operation];return this.right.items.flatMap(l=>this.left.items.map(c=>[l.clone(),c.clone()])).map(l=>(l[0].pitch=n(l[0].pitch,l[1].pitch),l[0].evaluate(r)))}}class Cycle extends Event{constructor(r){super(r);z(this,"items");z(this,"index");Object.assign(this,r),this.index=0}nextItem(r={}){let n=this.items[this.index%this.items.length];for(;n instanceof Cycle;)n=n.nextItem(r);return this.index=this.index+1,n instanceof Base?n.evaluate(r):n}evaluate(r={}){return this.nextItem(r)}}const peggyParser$1=function(){function s(o,a){function l(){this.constructor=o}l.prototype=a.prototype,o.prototype=new l}function e(o,a,l,c){var h=Error.call(this,o);return Object.setPrototypeOf&&Object.setPrototypeOf(h,e.prototype),h.expected=a,h.found=l,h.location=c,h.name="SyntaxError",h}s(e,Error);function r(o,a,l){return l=l||" ",o.length>a?o:(a-=o.length,l+=l.repeat(a),o+l.slice(0,a))}e.prototype.format=function(o){var a="Error: "+this.message;if(this.location){var l=null,c;for(c=0;c<o.length;c++)if(o[c].source===this.location.source){l=o[c].text.split(/\r\n|\n|\r/g);break}var h=this.location.start,f=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(h):h,d=this.location.source+":"+f.line+":"+f.column;if(l){var m=this.location.end,v=r("",f.line.toString().length," "),A=l[h.line-1],T=h.line===m.line?m.column:A.length+1,B=T-h.column||1;a+=`
|
||
--> `+d+`
|
||
`+v+` |
|
||
`+f.line+" | "+A+`
|
||
`+v+" | "+r("",h.column-1," ")+r("",B,"^")}else a+=`
|
||
at `+d}return a},e.buildMessage=function(o,a){var l={literal:function(A){return'"'+h(A.text)+'"'},class:function(A){var T=A.parts.map(function(B){return Array.isArray(B)?f(B[0])+"-"+f(B[1]):f(B)});return"["+(A.inverted?"^":"")+T.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(A){return A.description}};function c(A){return A.charCodeAt(0).toString(16).toUpperCase()}function h(A){return A.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(T){return"\\x0"+c(T)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(T){return"\\x"+c(T)})}function f(A){return A.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(T){return"\\x0"+c(T)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(T){return"\\x"+c(T)})}function d(A){return l[A.type](A)}function m(A){var T=A.map(d),B,Y;if(T.sort(),T.length>0){for(B=1,Y=1;B<T.length;B++)T[B-1]!==T[B]&&(T[Y]=T[B],Y++);T.length=Y}switch(T.length){case 1:return T[0];case 2:return T[0]+" or "+T[1];default:return T.slice(0,-1).join(", ")+", or "+T[T.length-1]}}function v(A){return A?'"'+h(A)+'"':"end of input"}return"Expected "+m(o)+" but "+v(a)+" found."};function n(o,a){a=a!==void 0?a:{};var l={},c=a.grammarSource,h={start:Ht},f=Ht,d="-",m=".",v=",",A="|",T="(",B=")",Y="+",F="*",ke="/",Qe="%",xe="^",Te="&",Le=">>",Me="<<",ot="<",Fe=">",Ve="_",at="?",dt=":",ct=/^[0-9]/,nt=/^[ \n\r\t]/,ft=/^[a-z]/,it=bt("-",!1),pt=Ji([["0","9"]],!1,!1),lt=bt(".",!1),st=Or("whitespace"),mt=Ji([" ",`
|
||
`,"\r"," "],!1,!1),Vt=bt(",",!1),Yt=bt("|",!1),gi=Ji([["a","z"]],!1,!1),Oi=bt("(",!1),Fi=bt(")",!1),$i=bt("+",!1),Ye=bt("*",!1),hr=bt("/",!1),xi=bt("%",!1),Tt=bt("^",!1),Ui=bt("&",!1),zi=bt(">>",!1),ji=bt("<<",!1),Mi=bt("<",!1),Lt=bt(">",!1),ur=bt("_",!1),Gt=bt("?",!1),Lr=bt(":",!1),fr=function(X){return X.filter(K=>K)},qi=function(){return parseFloat(Ai())},ui=function(){return parseInt(Ai())},Kt=function(){},Qr=function(){return DEFAULT_DURS[Ai()]},dr=function(X){return X.filter(K=>K)},Ki=function(X){return Wt(List,{items:X})},Rr=function(X,K,Se){return Wt(ListOperation,{left:X,operation:K,right:Se})},mi=function(X){return X},Mr=function(X){return Wt(Cycle,{items:X})},Nt=function(X){return a.nodeOptions.octave=X,Wt(OctaveChange,{octave:X})},Ei=function(){return Ai().split("").reduce((X,K)=>X+(K==="^"?1:-1),0)},wt=function(){return Wt(RandomPitch,{seededRandom:a.seededRandom})},Er=function(X,K){return Wt(RandomPitch,{min:X,max:K,seededRandom:a.seededRandom})},Nr=function(X,K){return Wt(Repeat,{item:X,times:K})},Yr=function(X){return a.nodeOptions.duration=X,Wt(DurationChange,{duration:X})},pr=function(X,K,Se){const Ee=X?a.nodeOptions.octave+X:a.nodeOptions.octave;return Wt(Pitch,{duration:K,pitch:Se,octave:Ee})},gt=function(X,K){return Wt(Chord,{pitches:[X].concat(K)})},H=0,qe=0,Qt=[{line:1,column:1}],kt=0,Ni=[],De=0,je={},Yi;if("startRule"in a){if(!(a.startRule in h))throw new Error(`Can't start parsing from rule "`+a.startRule+'".');f=h[a.startRule]}function Ai(){return o.substring(qe,H)}function gr(){return li(qe,H)}function bt(X,K){return{type:"literal",text:X,ignoreCase:K}}function Ji(X,K,Se){return{type:"class",parts:X,inverted:K,ignoreCase:Se}}function Dr(){return{type:"end"}}function Or(X){return{type:"other",description:X}}function mr(X){var K=Qt[X],Se;if(K)return K;for(Se=X-1;!Qt[Se];)Se--;for(K=Qt[Se],K={line:K.line,column:K.column};Se<X;)o.charCodeAt(Se)===10?(K.line++,K.column=1):K.column++,Se++;return Qt[X]=K,K}function li(X,K,Se){var Ee=mr(X),We=mr(K),tt={source:c,start:{offset:X,line:Ee.line,column:Ee.column},end:{offset:K,line:We.line,column:We.column}};return Se&&c&&typeof c.offset=="function"&&(tt.start=c.offset(tt.start),tt.end=c.offset(tt.end)),tt}function et(X){H<kt||(H>kt&&(kt=H,Ni=[]),Ni.push(X))}function Br(X,K,Se){return new e(e.buildMessage(X,K),X,K,Se)}function Ht(){var X,K,Se=H*23+0,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,K=Xi(),K!==l&&(qe=X,K=fr(K)),X=K,je[Se]={nextPos:H,result:X},X)}function Xr(){var X,K,Se,Ee,We,tt,Ft,yi=H*23+1,Zi=je[yi];if(Zi)return H=Zi.nextPos,Zi.result;for(X=H,K=H,o.charCodeAt(H)===45?(Se=d,H++):(Se=l,De===0&&et(it)),Se===l&&(Se=null),Ee=[],ct.test(o.charAt(H))?(We=o.charAt(H),H++):(We=l,De===0&&et(pt));We!==l;)Ee.push(We),ct.test(o.charAt(H))?(We=o.charAt(H),H++):(We=l,De===0&&et(pt));if(o.charCodeAt(H)===46?(We=m,H++):(We=l,De===0&&et(lt)),We!==l){if(tt=[],ct.test(o.charAt(H))?(Ft=o.charAt(H),H++):(Ft=l,De===0&&et(pt)),Ft!==l)for(;Ft!==l;)tt.push(Ft),ct.test(o.charAt(H))?(Ft=o.charAt(H),H++):(Ft=l,De===0&&et(pt));else tt=l;tt!==l?(Se=[Se,Ee,We,tt],K=Se):(H=K,K=l)}else H=K,K=l;if(K===l)if(K=H,o.charCodeAt(H)===46?(Se=m,H++):(Se=l,De===0&&et(lt)),Se!==l){if(Ee=[],ct.test(o.charAt(H))?(We=o.charAt(H),H++):(We=l,De===0&&et(pt)),We!==l)for(;We!==l;)Ee.push(We),ct.test(o.charAt(H))?(We=o.charAt(H),H++):(We=l,De===0&&et(pt));else Ee=l;Ee!==l?(Se=[Se,Ee],K=Se):(H=K,K=l)}else H=K,K=l;return K!==l&&(qe=X,K=qi()),X=K,je[yi]={nextPos:H,result:X},X}function Di(){var X,K,Se=H*23+2,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,o.charCodeAt(H)===45?H++:De===0&&et(it),ct.test(o.charAt(H))?(K=o.charAt(H),H++):(K=l,De===0&&et(pt)),K!==l?(qe=X,X=ui()):(H=X,X=l),je[Se]={nextPos:H,result:X},X)}function Jt(){var X,K,Se=H*23+3,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(De++,X=H,nt.test(o.charAt(H))?(K=o.charAt(H),H++):(K=l,De===0&&et(mt)),K!==l&&(qe=X,K=Kt()),X=K,De--,X===l&&(K=l,De===0&&et(st)),je[Se]={nextPos:H,result:X},X)}function Bi(){var X,K,Se=H*23+7,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,ft.test(o.charAt(H))?(K=o.charAt(H),H++):(K=l,De===0&&et(gi)),K!==l&&(qe=X,K=Qr()),X=K,je[Se]={nextPos:H,result:X},X)}function Sr(){var X,K=H*23+8,Se=je[K];return Se?(H=Se.nextPos,Se.result):(X=Bi(),X===l&&(X=Xr()),je[K]={nextPos:H,result:X},X)}function Xi(){var X,K,Se,Ee=H*23+9,We=je[Ee];if(We)return H=We.nextPos,We.result;if(X=H,K=[],Se=qt(),Se===l&&(Se=yr(),Se===l&&(Se=Si(),Se===l&&(Se=er(),Se===l&&(Se=Cr())))),Se!==l)for(;Se!==l;)K.push(Se),Se=qt(),Se===l&&(Se=yr(),Se===l&&(Se=Si(),Se===l&&(Se=er(),Se===l&&(Se=Cr()))));else K=l;return K!==l&&(qe=X,K=dr(K)),X=K,je[Ee]={nextPos:H,result:X},X}function Si(){var X,K,Se,Ee,We=H*23+10,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,o.charCodeAt(H)===40?(K=T,H++):(K=l,De===0&&et(Oi)),K!==l?(Se=Xi(),Se!==l?(o.charCodeAt(H)===41?(Ee=B,H++):(Ee=l,De===0&&et(Fi)),Ee!==l?(qe=X,X=Ki(Se)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function yr(){var X,K,Se,Ee,We=H*23+11,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,K=Si(),K!==l?(Se=vr(),Se!==l?(Ee=Si(),Ee!==l?(qe=X,X=Rr(K,Se,Ee)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function vr(){var X,K=H*23+12,Se=je[K];return Se?(H=Se.nextPos,Se.result):(o.charCodeAt(H)===43?(X=Y,H++):(X=l,De===0&&et($i)),X===l&&(o.charCodeAt(H)===45?(X=d,H++):(X=l,De===0&&et(it)),X===l&&(o.charCodeAt(H)===42?(X=F,H++):(X=l,De===0&&et(Ye)),X===l&&(o.charCodeAt(H)===47?(X=ke,H++):(X=l,De===0&&et(hr)),X===l&&(o.charCodeAt(H)===37?(X=Qe,H++):(X=l,De===0&&et(xi)),X===l&&(o.charCodeAt(H)===94?(X=xe,H++):(X=l,De===0&&et(Tt)),X===l&&(o.charCodeAt(H)===124?(X=A,H++):(X=l,De===0&&et(Yt)),X===l&&(o.charCodeAt(H)===38?(X=Te,H++):(X=l,De===0&&et(Ui)),X===l&&(o.substr(H,2)===Le?(X=Le,H+=2):(X=l,De===0&&et(zi)),X===l&&(o.substr(H,2)===Me?(X=Me,H+=2):(X=l,De===0&&et(ji))))))))))),je[K]={nextPos:H,result:X},X)}function er(){var X,K,Se=H*23+13,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,K=br(),K===l&&(K=Pi(),K===l&&(K=Zr(),K===l&&(K=Jt(),K===l&&(K=Vr(),K===l&&(K=ir(),K===l&&(K=_r(),K===l&&(K=Si()))))))),K!==l&&(qe=X,K=mi(K)),X=K,je[Se]={nextPos:H,result:X},X)}function Cr(){var X,K,Se,Ee,We=H*23+14,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,o.charCodeAt(H)===60?(K=ot,H++):(K=l,De===0&&et(Mi)),K!==l?(Se=Xi(),Se!==l?(o.charCodeAt(H)===62?(Ee=Fe,H++):(Ee=l,De===0&&et(Lt)),Ee!==l?(qe=X,X=Mr(Se)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function Zr(){var X,K,Se=H*23+15,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,K=tr(),K!==l&&(qe=X,K=Nt(K)),X=K,je[Se]={nextPos:H,result:X},X)}function tr(){var X,K,Se,Ee=H*23+16,We=je[Ee];if(We)return H=We.nextPos,We.result;if(X=H,K=[],o.charCodeAt(H)===94?(Se=xe,H++):(Se=l,De===0&&et(Tt)),Se===l&&(o.charCodeAt(H)===95?(Se=Ve,H++):(Se=l,De===0&&et(ur))),Se!==l)for(;Se!==l;)K.push(Se),o.charCodeAt(H)===94?(Se=xe,H++):(Se=l,De===0&&et(Tt)),Se===l&&(o.charCodeAt(H)===95?(Se=Ve,H++):(Se=l,De===0&&et(ur)));else K=l;return K!==l&&(qe=X,K=Ei()),X=K,je[Ee]={nextPos:H,result:X},X}function ir(){var X,K,Se=H*23+17,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,o.charCodeAt(H)===63?(K=at,H++):(K=l,De===0&&et(Gt)),K!==l&&(qe=X,K=wt()),X=K,je[Se]={nextPos:H,result:X},X)}function _r(){var X,K,Se,Ee,We,tt,Ft=H*23+18,yi=je[Ft];return yi?(H=yi.nextPos,yi.result):(X=H,o.charCodeAt(H)===40?(K=T,H++):(K=l,De===0&&et(Oi)),K!==l?(Se=Di(),Se!==l?(o.charCodeAt(H)===44?(Ee=v,H++):(Ee=l,De===0&&et(Vt)),Ee!==l?(We=Di(),We!==l?(o.charCodeAt(H)===41?(tt=B,H++):(tt=l,De===0&&et(Fi)),tt!==l?(qe=X,X=Er(Se,We)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[Ft]={nextPos:H,result:X},X)}function qt(){var X,K,Se,Ee,We=H*23+19,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,K=er(),K!==l?(o.charCodeAt(H)===58?(Se=dt,H++):(Se=l,De===0&&et(Lr)),Se!==l?(Ee=Di(),Ee!==l?(qe=X,X=Nr(K,Ee)):(H=X,X=l)):(H=X,X=l)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function Vr(){var X,K,Se=H*23+20,Ee=je[Se];return Ee?(H=Ee.nextPos,Ee.result):(X=H,K=Sr(),K!==l&&(qe=X,K=Yr(K)),X=K,je[Se]={nextPos:H,result:X},X)}function Pi(){var X,K,Se,Ee,We=H*23+21,tt=je[We];return tt?(H=tt.nextPos,tt.result):(X=H,K=tr(),K===l&&(K=null),Se=Sr(),Se===l&&(Se=null),Ee=Di(),Ee!==l?(qe=X,X=pr(K,Se,Ee)):(H=X,X=l),je[We]={nextPos:H,result:X},X)}function br(){var X,K,Se,Ee,We=H*23+22,tt=je[We];if(tt)return H=tt.nextPos,tt.result;if(X=H,K=Pi(),K!==l){if(Se=[],Ee=Pi(),Ee!==l)for(;Ee!==l;)Se.push(Ee),Ee=Pi();else Se=l;Se!==l?(qe=X,X=gt(K,Se)):(H=X,X=l)}else H=X,X=l;return je[We]={nextPos:H,result:X},X}var Ir=a.nodeOptions||{};function Wt(X,K){K.text=Ai(),K.location=gr();for(var Se in Ir)(K[Se]===void 0||K[Se]===null)&&(K[Se]=Ir[Se]);return new X(K)}if(Yi=f(),Yi!==l&&H===o.length)return Yi;throw Yi!==l&&H<o.length&&et(Dr()),Br(Ni,kt<o.length?o.charAt(kt):null,kt<o.length?li(kt,kt+1):li(kt,kt))}return{SyntaxError:e,parse:n}}();peggyParser$1.SyntaxError.prototype.name="PeggySyntaxError";const parse$1=peggyParser$1.parse,peggyParser=function(){function peg$subclass(s,e){function r(){this.constructor=s}r.prototype=e.prototype,s.prototype=new r}function peg$SyntaxError(s,e,r,n){var o=Error.call(this,s);return Object.setPrototypeOf&&Object.setPrototypeOf(o,peg$SyntaxError.prototype),o.expected=e,o.found=r,o.location=n,o.name="SyntaxError",o}peg$subclass(peg$SyntaxError,Error);function peg$padEnd(s,e,r){return r=r||" ",s.length>e?s:(e-=s.length,r+=r.repeat(e),s+r.slice(0,e))}peg$SyntaxError.prototype.format=function(s){var e="Error: "+this.message;if(this.location){var r=null,n;for(n=0;n<s.length;n++)if(s[n].source===this.location.source){r=s[n].text.split(/\r\n|\n|\r/g);break}var o=this.location.start,a=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(o):o,l=this.location.source+":"+a.line+":"+a.column;if(r){var c=this.location.end,h=peg$padEnd("",a.line.toString().length," "),f=r[o.line-1],d=o.line===c.line?c.column:f.length+1,m=d-o.column||1;e+=`
|
||
--> `+l+`
|
||
`+h+` |
|
||
`+a.line+" | "+f+`
|
||
`+h+" | "+peg$padEnd("",o.column-1," ")+peg$padEnd("",m,"^")}else e+=`
|
||
at `+l}return e},peg$SyntaxError.buildMessage=function(s,e){var r={literal:function(f){return'"'+o(f.text)+'"'},class:function(f){var d=f.parts.map(function(m){return Array.isArray(m)?a(m[0])+"-"+a(m[1]):a(m)});return"["+(f.inverted?"^":"")+d.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(f){return f.description}};function n(f){return f.charCodeAt(0).toString(16).toUpperCase()}function o(f){return f.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+n(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+n(d)})}function a(f){return f.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(d){return"\\x0"+n(d)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(d){return"\\x"+n(d)})}function l(f){return r[f.type](f)}function c(f){var d=f.map(l),m,v;if(d.sort(),d.length>0){for(m=1,v=1;m<d.length;m++)d[m-1]!==d[m]&&(d[v]=d[m],v++);d.length=v}switch(d.length){case 1:return d[0];case 2:return d[0]+" or "+d[1];default:return d.slice(0,-1).join(", ")+", or "+d[d.length-1]}}function h(f){return f?'"'+o(f)+'"':"end of input"}return"Expected "+c(s)+" but "+h(e)+" found."};function peg$parse(input,options){options=options!==void 0?options:{};var peg$FAILED={},peg$source=options.grammarSource,peg$startRuleFunctions={lines:peg$parselines},peg$startRuleFunction=peg$parselines,peg$c0="(",peg$c1=",",peg$c2=")",peg$c3=".",peg$c4="-",peg$c5="/",peg$c6="\\",peg$c7="<",peg$c8=">",peg$c9="[",peg$c10="+",peg$c11="*",peg$c12="%",peg$c13="&",peg$c14="|",peg$c15="<<",peg$c16=">>",peg$r0=/^[' '\t\r\n]/,peg$r1=/^[0-9]/,peg$e0=peg$classExpectation(["'"," ","'"," ","\r",`
|
||
`],!1,!1),peg$e1=peg$literalExpectation("(",!1),peg$e2=peg$literalExpectation(",",!1),peg$e3=peg$literalExpectation(")",!1),peg$e4=peg$classExpectation([["0","9"]],!1,!1),peg$e5=peg$literalExpectation(".",!1),peg$e6=peg$literalExpectation("-",!1),peg$e7=peg$literalExpectation("/",!1),peg$e8=peg$literalExpectation("\\",!1),peg$e9=peg$literalExpectation("<",!1),peg$e10=peg$literalExpectation(">",!1),peg$e11=peg$literalExpectation("[",!1),peg$e12=peg$literalExpectation("+",!1),peg$e13=peg$literalExpectation("*",!1),peg$e14=peg$literalExpectation("%",!1),peg$e15=peg$literalExpectation("&",!1),peg$e16=peg$literalExpectation("|",!1),peg$e17=peg$literalExpectation("<<",!1),peg$e18=peg$literalExpectation(">>",!1),peg$f0=function(s){return centsToSemitones(s.filter(e=>e))},peg$f1=function(){},peg$f2=function(s,e){return Math.floor(Math.random()*(e-s+1)+s)},peg$f3=function(s,e){return Math.random()*(e-s)+s},peg$f4=function(){return parseFloat(text())},peg$f5=function(){return parseInt(text())},peg$f6=function(s){return ratioToCents(s)},peg$f7=function(s,e){return s/e},peg$f8=function(s,e){return Math.pow(2,s/e)},peg$f9=function(s,e,r,n){var o=n?r/n:r;return Math.pow(o,s/e)},peg$f10=function(s,e){return parseFloat(s.toString()+"."+e.toString())},peg$f11=function(s){return s.filter(e=>e)},peg$f12=function(s){return monzoToCents(s)},peg$f13=function(){return eval(text())},peg$currPos=0,peg$savedPos=0,peg$posDetailsCache=[{line:1,column:1}],peg$maxFailPos=0,peg$maxFailExpected=[],peg$resultsCache={},peg$result;if("startRule"in options){if(!(options.startRule in peg$startRuleFunctions))throw new Error(`Can't start parsing from rule "`+options.startRule+'".');peg$startRuleFunction=peg$startRuleFunctions[options.startRule]}function text(){return input.substring(peg$savedPos,peg$currPos)}function peg$literalExpectation(s,e){return{type:"literal",text:s,ignoreCase:e}}function peg$classExpectation(s,e,r){return{type:"class",parts:s,inverted:e,ignoreCase:r}}function peg$endExpectation(){return{type:"end"}}function peg$computePosDetails(s){var e=peg$posDetailsCache[s],r;if(e)return e;for(r=s-1;!peg$posDetailsCache[r];)r--;for(e=peg$posDetailsCache[r],e={line:e.line,column:e.column};r<s;)input.charCodeAt(r)===10?(e.line++,e.column=1):e.column++,r++;return peg$posDetailsCache[s]=e,e}function peg$computeLocation(s,e,r){var n=peg$computePosDetails(s),o=peg$computePosDetails(e),a={source:peg$source,start:{offset:s,line:n.line,column:n.column},end:{offset:e,line:o.line,column:o.column}};return r&&peg$source&&typeof peg$source.offset=="function"&&(a.start=peg$source.offset(a.start),a.end=peg$source.offset(a.end)),a}function peg$fail(s){peg$currPos<peg$maxFailPos||(peg$currPos>peg$maxFailPos&&(peg$maxFailPos=peg$currPos,peg$maxFailExpected=[]),peg$maxFailExpected.push(s))}function peg$buildStructuredError(s,e,r){return new peg$SyntaxError(peg$SyntaxError.buildMessage(s,e),s,e,r)}function peg$parselines(){var s,e,r,n=peg$currPos*17+0,o=peg$resultsCache[n];if(o)return peg$currPos=o.nextPos,o.result;if(s=peg$currPos,e=[],r=peg$parseratio(),r===peg$FAILED&&(r=peg$parsevalue(),r===peg$FAILED&&(r=peg$parsemonzo(),r===peg$FAILED&&(r=peg$parseoperation(),r===peg$FAILED&&(r=peg$parsesep())))),r!==peg$FAILED)for(;r!==peg$FAILED;)e.push(r),r=peg$parseratio(),r===peg$FAILED&&(r=peg$parsevalue(),r===peg$FAILED&&(r=peg$parsemonzo(),r===peg$FAILED&&(r=peg$parseoperation(),r===peg$FAILED&&(r=peg$parsesep()))));else e=peg$FAILED;return e!==peg$FAILED&&(peg$savedPos=s,e=peg$f0(e)),s=e,peg$resultsCache[n]={nextPos:peg$currPos,result:s},s}function peg$parsesep(){var s,e,r=peg$currPos*17+1,n=peg$resultsCache[r];return n?(peg$currPos=n.nextPos,n.result):(s=peg$currPos,peg$r0.test(input.charAt(peg$currPos))?(e=input.charAt(peg$currPos),peg$currPos++):(e=peg$FAILED,peg$fail(peg$e0)),e!==peg$FAILED&&(peg$savedPos=s,e=peg$f1()),s=e,peg$resultsCache[r]={nextPos:peg$currPos,result:s},s)}function peg$parsevalue(){var s,e=peg$currPos*17+2,r=peg$resultsCache[e];return r?(peg$currPos=r.nextPos,r.result):(s=peg$parsefloat(),s===peg$FAILED&&(s=peg$parseint(),s===peg$FAILED&&(s=peg$parserandom_int(),s===peg$FAILED&&(s=peg$parserandom_float()))),peg$resultsCache[e]={nextPos:peg$currPos,result:s},s)}function peg$parserandom_int(){var s,e,r,n,o,a,l=peg$currPos*17+3,c=peg$resultsCache[l];return c?(peg$currPos=c.nextPos,c.result):(s=peg$currPos,input.charCodeAt(peg$currPos)===40?(e=peg$c0,peg$currPos++):(e=peg$FAILED,peg$fail(peg$e1)),e!==peg$FAILED?(r=peg$parseint(),r!==peg$FAILED?(input.charCodeAt(peg$currPos)===44?(n=peg$c1,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e2)),n!==peg$FAILED?(o=peg$parseint(),o!==peg$FAILED?(input.charCodeAt(peg$currPos)===41?(a=peg$c2,peg$currPos++):(a=peg$FAILED,peg$fail(peg$e3)),a!==peg$FAILED?(peg$savedPos=s,s=peg$f2(r,o)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[l]={nextPos:peg$currPos,result:s},s)}function peg$parserandom_float(){var s,e,r,n,o,a,l=peg$currPos*17+4,c=peg$resultsCache[l];return c?(peg$currPos=c.nextPos,c.result):(s=peg$currPos,input.charCodeAt(peg$currPos)===40?(e=peg$c0,peg$currPos++):(e=peg$FAILED,peg$fail(peg$e1)),e!==peg$FAILED?(r=peg$parsefloat(),r!==peg$FAILED?(input.charCodeAt(peg$currPos)===44?(n=peg$c1,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e2)),n!==peg$FAILED?(o=peg$parsefloat(),o!==peg$FAILED?(input.charCodeAt(peg$currPos)===41?(a=peg$c2,peg$currPos++):(a=peg$FAILED,peg$fail(peg$e3)),a!==peg$FAILED?(peg$savedPos=s,s=peg$f3(r,o)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[l]={nextPos:peg$currPos,result:s},s)}function peg$parsefloat(){var s,e,r,n,o,a,l,c=peg$currPos*17+5,h=peg$resultsCache[c];if(h)return peg$currPos=h.nextPos,h.result;if(s=peg$currPos,e=peg$currPos,r=[],peg$r1.test(input.charAt(peg$currPos))?(n=input.charAt(peg$currPos),peg$currPos++):(n=peg$FAILED,peg$fail(peg$e4)),n!==peg$FAILED)for(;n!==peg$FAILED;)r.push(n),peg$r1.test(input.charAt(peg$currPos))?(n=input.charAt(peg$currPos),peg$currPos++):(n=peg$FAILED,peg$fail(peg$e4));else r=peg$FAILED;if(r!==peg$FAILED?(input.charCodeAt(peg$currPos)===46?(n=peg$c3,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e5)),n!==peg$FAILED?(r=[r,n],e=r):(peg$currPos=e,e=peg$FAILED)):(peg$currPos=e,e=peg$FAILED),e===peg$FAILED){for(e=peg$currPos,input.charCodeAt(peg$currPos)===45?(r=peg$c4,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e6)),r===peg$FAILED&&(r=null),n=[],peg$r1.test(input.charAt(peg$currPos))?(o=input.charAt(peg$currPos),peg$currPos++):(o=peg$FAILED,peg$fail(peg$e4));o!==peg$FAILED;)n.push(o),peg$r1.test(input.charAt(peg$currPos))?(o=input.charAt(peg$currPos),peg$currPos++):(o=peg$FAILED,peg$fail(peg$e4));if(input.charCodeAt(peg$currPos)===46?(o=peg$c3,peg$currPos++):(o=peg$FAILED,peg$fail(peg$e5)),o!==peg$FAILED){if(a=[],peg$r1.test(input.charAt(peg$currPos))?(l=input.charAt(peg$currPos),peg$currPos++):(l=peg$FAILED,peg$fail(peg$e4)),l!==peg$FAILED)for(;l!==peg$FAILED;)a.push(l),peg$r1.test(input.charAt(peg$currPos))?(l=input.charAt(peg$currPos),peg$currPos++):(l=peg$FAILED,peg$fail(peg$e4));else a=peg$FAILED;a!==peg$FAILED?(r=[r,n,o,a],e=r):(peg$currPos=e,e=peg$FAILED)}else peg$currPos=e,e=peg$FAILED;if(e===peg$FAILED)if(e=peg$currPos,input.charCodeAt(peg$currPos)===46?(r=peg$c3,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e5)),r!==peg$FAILED){if(n=[],peg$r1.test(input.charAt(peg$currPos))?(o=input.charAt(peg$currPos),peg$currPos++):(o=peg$FAILED,peg$fail(peg$e4)),o!==peg$FAILED)for(;o!==peg$FAILED;)n.push(o),peg$r1.test(input.charAt(peg$currPos))?(o=input.charAt(peg$currPos),peg$currPos++):(o=peg$FAILED,peg$fail(peg$e4));else n=peg$FAILED;n!==peg$FAILED?(r=[r,n],e=r):(peg$currPos=e,e=peg$FAILED)}else peg$currPos=e,e=peg$FAILED}return e!==peg$FAILED&&(peg$savedPos=s,e=peg$f4()),s=e,peg$resultsCache[c]={nextPos:peg$currPos,result:s},s}function peg$parseint(){var s,e,r,n=peg$currPos*17+6,o=peg$resultsCache[n];if(o)return peg$currPos=o.nextPos,o.result;if(s=peg$currPos,input.charCodeAt(peg$currPos)===45?peg$currPos++:peg$fail(peg$e6),e=[],peg$r1.test(input.charAt(peg$currPos))?(r=input.charAt(peg$currPos),peg$currPos++):(r=peg$FAILED,peg$fail(peg$e4)),r!==peg$FAILED)for(;r!==peg$FAILED;)e.push(r),peg$r1.test(input.charAt(peg$currPos))?(r=input.charAt(peg$currPos),peg$currPos++):(r=peg$FAILED,peg$fail(peg$e4));else e=peg$FAILED;return e!==peg$FAILED?(peg$savedPos=s,s=peg$f5()):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[n]={nextPos:peg$currPos,result:s},s}function peg$parseratio(){var s,e,r=peg$currPos*17+7,n=peg$resultsCache[r];return n?(peg$currPos=n.nextPos,n.result):(s=peg$currPos,e=peg$parseedji_ratio(),e===peg$FAILED&&(e=peg$parseedo_ratio(),e===peg$FAILED&&(e=peg$parsefrac_ratio(),e===peg$FAILED&&(e=peg$parsedecimal_ratio()))),e!==peg$FAILED&&(peg$savedPos=s,e=peg$f6(e)),s=e,peg$resultsCache[r]={nextPos:peg$currPos,result:s},s)}function peg$parsefrac_ratio(){var s,e,r,n,o=peg$currPos*17+8,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,e=peg$parseint(),e===peg$FAILED&&(e=peg$parserandom_int()),e!==peg$FAILED?(input.charCodeAt(peg$currPos)===47?(r=peg$c5,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e7)),r!==peg$FAILED?(n=peg$parseint(),n===peg$FAILED&&(n=peg$parserandom_int()),n!==peg$FAILED?(peg$savedPos=s,s=peg$f7(e,n)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}function peg$parseedo_ratio(){var s,e,r,n,o=peg$currPos*17+9,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,e=peg$parseint(),e===peg$FAILED&&(e=peg$parserandom_int()),e!==peg$FAILED?(input.charCodeAt(peg$currPos)===92?(r=peg$c6,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e8)),r!==peg$FAILED?(n=peg$parseint(),n===peg$FAILED&&(n=peg$parserandom_int()),n!==peg$FAILED?(peg$savedPos=s,s=peg$f8(e,n)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}function peg$parseedji_ratio(){var s,e,r,n,o,a,l,c,h=peg$currPos*17+10,f=peg$resultsCache[h];return f?(peg$currPos=f.nextPos,f.result):(s=peg$currPos,e=peg$parseint(),e===peg$FAILED&&(e=peg$parserandom_int()),e!==peg$FAILED?(input.charCodeAt(peg$currPos)===92?(r=peg$c6,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e8)),r!==peg$FAILED?(n=peg$parseint(),n===peg$FAILED&&(n=peg$parserandom_int()),n!==peg$FAILED?(input.charCodeAt(peg$currPos)===60?(o=peg$c7,peg$currPos++):(o=peg$FAILED,peg$fail(peg$e9)),o!==peg$FAILED?(a=peg$parseint(),a===peg$FAILED&&(a=peg$parserandom_int()),a!==peg$FAILED?(input.charCodeAt(peg$currPos)===47?peg$currPos++:peg$fail(peg$e7),l=peg$parseint(),l===peg$FAILED&&(l=peg$parserandom_int()),l===peg$FAILED&&(l=null),input.charCodeAt(peg$currPos)===62?(c=peg$c8,peg$currPos++):(c=peg$FAILED,peg$fail(peg$e10)),c!==peg$FAILED?(peg$savedPos=s,s=peg$f9(e,n,a,l)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[h]={nextPos:peg$currPos,result:s},s)}function peg$parsedecimal_ratio(){var s,e,r,n,o=peg$currPos*17+11,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,e=peg$parseint(),e!==peg$FAILED?(input.charCodeAt(peg$currPos)===44?(r=peg$c1,peg$currPos++):(r=peg$FAILED,peg$fail(peg$e2)),r!==peg$FAILED?(n=peg$parseint(),n!==peg$FAILED?(peg$savedPos=s,s=peg$f10(e,n)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}function peg$parseints(){var s,e,r,n=peg$currPos*17+12,o=peg$resultsCache[n];if(o)return peg$currPos=o.nextPos,o.result;if(s=peg$currPos,e=[],r=peg$parseint(),r===peg$FAILED&&(r=peg$parsesep()),r!==peg$FAILED)for(;r!==peg$FAILED;)e.push(r),r=peg$parseint(),r===peg$FAILED&&(r=peg$parsesep());else e=peg$FAILED;return e!==peg$FAILED&&(peg$savedPos=s,e=peg$f11(e)),s=e,peg$resultsCache[n]={nextPos:peg$currPos,result:s},s}function peg$parsemonzo(){var s,e,r,n,o=peg$currPos*17+13,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,input.charCodeAt(peg$currPos)===91?(e=peg$c9,peg$currPos++):(e=peg$FAILED,peg$fail(peg$e11)),e!==peg$FAILED?(r=peg$parseints(),r!==peg$FAILED?(input.charCodeAt(peg$currPos)===62?(n=peg$c8,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e10)),n!==peg$FAILED?(peg$savedPos=s,s=peg$f12(r)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}function peg$parseoperation(){var s,e,r,n,o,a,l,c=peg$currPos*17+14,h=peg$resultsCache[c];if(h)return peg$currPos=h.nextPos,h.result;if(s=peg$currPos,e=peg$parsevalue(),e===peg$FAILED&&(e=peg$parseratio(),e===peg$FAILED&&(e=peg$parsemonzo(),e===peg$FAILED)))for(e=[],r=peg$parsesep();r!==peg$FAILED;)e.push(r),r=peg$parsesep();if(e!==peg$FAILED){if(r=[],n=peg$currPos,o=peg$parseoperator(),o!==peg$FAILED){if(a=peg$parsevalue(),a===peg$FAILED&&(a=peg$parseratio(),a===peg$FAILED&&(a=peg$parsemonzo(),a===peg$FAILED&&(a=peg$parsesub_operations(),a===peg$FAILED&&(a=peg$parseoperation(),a===peg$FAILED)))))for(a=[],l=peg$parsesep();l!==peg$FAILED;)a.push(l),l=peg$parsesep();a!==peg$FAILED?(o=[o,a],n=o):(peg$currPos=n,n=peg$FAILED)}else peg$currPos=n,n=peg$FAILED;if(n!==peg$FAILED)for(;n!==peg$FAILED;)if(r.push(n),n=peg$currPos,o=peg$parseoperator(),o!==peg$FAILED){if(a=peg$parsevalue(),a===peg$FAILED&&(a=peg$parseratio(),a===peg$FAILED&&(a=peg$parsemonzo(),a===peg$FAILED&&(a=peg$parsesub_operations(),a===peg$FAILED&&(a=peg$parseoperation(),a===peg$FAILED)))))for(a=[],l=peg$parsesep();l!==peg$FAILED;)a.push(l),l=peg$parsesep();a!==peg$FAILED?(o=[o,a],n=o):(peg$currPos=n,n=peg$FAILED)}else peg$currPos=n,n=peg$FAILED;else r=peg$FAILED;r!==peg$FAILED?(peg$savedPos=s,s=peg$f13()):(peg$currPos=s,s=peg$FAILED)}else peg$currPos=s,s=peg$FAILED;return peg$resultsCache[c]={nextPos:peg$currPos,result:s},s}function peg$parseoperator(){var s,e=peg$currPos*17+15,r=peg$resultsCache[e];return r?(peg$currPos=r.nextPos,r.result):(input.charCodeAt(peg$currPos)===43?(s=peg$c10,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e12)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===45?(s=peg$c4,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e6)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===42?(s=peg$c11,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e13)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===37?(s=peg$c12,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e14)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===38?(s=peg$c13,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e15)),s===peg$FAILED&&(input.charCodeAt(peg$currPos)===124?(s=peg$c14,peg$currPos++):(s=peg$FAILED,peg$fail(peg$e16)),s===peg$FAILED&&(input.substr(peg$currPos,2)===peg$c15?(s=peg$c15,peg$currPos+=2):(s=peg$FAILED,peg$fail(peg$e17)),s===peg$FAILED&&(input.substr(peg$currPos,2)===peg$c16?(s=peg$c16,peg$currPos+=2):(s=peg$FAILED,peg$fail(peg$e18))))))))),peg$resultsCache[e]={nextPos:peg$currPos,result:s},s)}function peg$parsesub_operations(){var s,e,r,n,o=peg$currPos*17+16,a=peg$resultsCache[o];return a?(peg$currPos=a.nextPos,a.result):(s=peg$currPos,input.charCodeAt(peg$currPos)===40?(e=peg$c0,peg$currPos++):(e=peg$FAILED,peg$fail(peg$e1)),e!==peg$FAILED?(r=peg$parseoperation(),r!==peg$FAILED?(input.charCodeAt(peg$currPos)===41?(n=peg$c2,peg$currPos++):(n=peg$FAILED,peg$fail(peg$e3)),n!==peg$FAILED?(e=[e,r,n],s=e):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED)):(peg$currPos=s,s=peg$FAILED),peg$resultsCache[o]={nextPos:peg$currPos,result:s},s)}if(peg$result=peg$startRuleFunction(),peg$result!==peg$FAILED&&peg$currPos===input.length)return peg$result;throw peg$result!==peg$FAILED&&peg$currPos<input.length&&peg$fail(peg$endExpectation()),peg$buildStructuredError(peg$maxFailExpected,peg$maxFailPos<input.length?input.charAt(peg$maxFailPos):null,peg$maxFailPos<input.length?peg$computeLocation(peg$maxFailPos,peg$maxFailPos+1):peg$computeLocation(peg$maxFailPos,peg$maxFailPos))}return{SyntaxError:peg$SyntaxError,parse:peg$parse}}();peggyParser.SyntaxError.prototype.name="PeggySyntaxError";const parse=peggyParser.parse,perf=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,warned=new Set,PROCESS=typeof process=="object"&&process?process:{},emitWarning=(s,e,r,n)=>{typeof PROCESS.emitWarning=="function"?PROCESS.emitWarning(s,e,r,n):console.error(`[${r}] ${e}: ${s}`)};let AC=globalThis.AbortController,AS=globalThis.AbortSignal;var mn;if(typeof AC>"u"){AS=class{constructor(){z(this,"onabort");z(this,"_onabort",[]);z(this,"reason");z(this,"aborted",!1)}addEventListener(n,o){this._onabort.push(o)}},AC=class{constructor(){z(this,"signal",new AS);e()}abort(n){var o,a;if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(const l of this.signal._onabort)l(n);(a=(o=this.signal).onabort)==null||a.call(o,n)}}};let s=((mn=PROCESS.env)==null?void 0:mn.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const e=()=>{s&&(s=!1,emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}const shouldWarn=s=>!warned.has(s),isPosInt=s=>s&&s===Math.floor(s)&&s>0&&isFinite(s),getUintArray=s=>isPosInt(s)?s<=Math.pow(2,8)?Uint8Array:s<=Math.pow(2,16)?Uint16Array:s<=Math.pow(2,32)?Uint32Array:s<=Number.MAX_SAFE_INTEGER?ZeroArray:null:null;class ZeroArray extends Array{constructor(e){super(e),this.fill(0)}}var _i;const Ti=class Ti{constructor(e,r){z(this,"heap");z(this,"length");if(!N(Ti,_i))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}static create(e){const r=getUintArray(e);if(!r)return[];Ue(Ti,_i,!0);const n=new Ti(e,r);return Ue(Ti,_i,!1),n}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};_i=new WeakMap,rt(Ti,_i,!1);let Stack=Ti;var ti,Ut,ii,ri,Vi,At,ni,Pt,vt,Je,Zt,zt,Bt,Mt,si,Et,fi,di,oi,ai,ki,_t,sr,qr,Li,pi,or,jt,Tr,yn,Qi,Gi,ar,ci,Ii,hi,wi,lr,Kr,Hi,Ar,Wi,Pr,St,Ct,cr,Jr,Ri,nr;const en=class en{constructor(e){rt(this,sr);rt(this,Tr);rt(this,ci);rt(this,hi);rt(this,lr);rt(this,Hi);rt(this,Wi);rt(this,St);rt(this,cr);rt(this,Ri);rt(this,ti,void 0);rt(this,Ut,void 0);rt(this,ii,void 0);rt(this,ri,void 0);rt(this,Vi,void 0);z(this,"ttl");z(this,"ttlResolution");z(this,"ttlAutopurge");z(this,"updateAgeOnGet");z(this,"updateAgeOnHas");z(this,"allowStale");z(this,"noDisposeOnSet");z(this,"noUpdateTTL");z(this,"maxEntrySize");z(this,"sizeCalculation");z(this,"noDeleteOnFetchRejection");z(this,"noDeleteOnStaleGet");z(this,"allowStaleOnFetchAbort");z(this,"allowStaleOnFetchRejection");z(this,"ignoreFetchAbort");rt(this,At,void 0);rt(this,ni,void 0);rt(this,Pt,void 0);rt(this,vt,void 0);rt(this,Je,void 0);rt(this,Zt,void 0);rt(this,zt,void 0);rt(this,Bt,void 0);rt(this,Mt,void 0);rt(this,si,void 0);rt(this,Et,void 0);rt(this,fi,void 0);rt(this,di,void 0);rt(this,oi,void 0);rt(this,ai,void 0);rt(this,ki,void 0);rt(this,_t,void 0);rt(this,Li,()=>{});rt(this,pi,()=>{});rt(this,or,()=>{});rt(this,jt,()=>!1);rt(this,Qi,e=>{});rt(this,Gi,(e,r,n)=>{});rt(this,ar,(e,r,n,o)=>{if(n||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});const{max:r=0,ttl:n,ttlResolution:o=1,ttlAutopurge:a,updateAgeOnGet:l,updateAgeOnHas:c,allowStale:h,dispose:f,disposeAfter:d,noDisposeOnSet:m,noUpdateTTL:v,maxSize:A=0,maxEntrySize:T=0,sizeCalculation:B,fetchMethod:Y,noDeleteOnFetchRejection:F,noDeleteOnStaleGet:ke,allowStaleOnFetchRejection:Qe,allowStaleOnFetchAbort:xe,ignoreFetchAbort:Te}=e;if(r!==0&&!isPosInt(r))throw new TypeError("max option must be a nonnegative integer");const Le=r?getUintArray(r):Array;if(!Le)throw new Error("invalid max value: "+r);if(Ue(this,ti,r),Ue(this,Ut,A),this.maxEntrySize=T||N(this,Ut),this.sizeCalculation=B,this.sizeCalculation){if(!N(this,Ut)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(Y!==void 0&&typeof Y!="function")throw new TypeError("fetchMethod must be a function if specified");if(Ue(this,Vi,Y),Ue(this,ki,!!Y),Ue(this,Pt,new Map),Ue(this,vt,new Array(r).fill(void 0)),Ue(this,Je,new Array(r).fill(void 0)),Ue(this,Zt,new Le(r)),Ue(this,zt,new Le(r)),Ue(this,Bt,0),Ue(this,Mt,0),Ue(this,si,Stack.create(r)),Ue(this,At,0),Ue(this,ni,0),typeof f=="function"&&Ue(this,ii,f),typeof d=="function"?(Ue(this,ri,d),Ue(this,Et,[])):(Ue(this,ri,void 0),Ue(this,Et,void 0)),Ue(this,ai,!!N(this,ii)),Ue(this,_t,!!N(this,ri)),this.noDisposeOnSet=!!m,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!F,this.allowStaleOnFetchRejection=!!Qe,this.allowStaleOnFetchAbort=!!xe,this.ignoreFetchAbort=!!Te,this.maxEntrySize!==0){if(N(this,Ut)!==0&&!isPosInt(N(this,Ut)))throw new TypeError("maxSize must be a positive integer if specified");if(!isPosInt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");_e(this,Tr,yn).call(this)}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!ke,this.updateAgeOnGet=!!l,this.updateAgeOnHas=!!c,this.ttlResolution=isPosInt(o)||o===0?o:1,this.ttlAutopurge=!!a,this.ttl=n||0,this.ttl){if(!isPosInt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");_e(this,sr,qr).call(this)}if(N(this,ti)===0&&this.ttl===0&&N(this,Ut)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!N(this,ti)&&!N(this,Ut)){const Me="LRU_CACHE_UNBOUNDED";shouldWarn(Me)&&(warned.add(Me),emitWarning("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Me,en))}}static unsafeExposeInternals(e){return{starts:N(e,di),ttls:N(e,oi),sizes:N(e,fi),keyMap:N(e,Pt),keyList:N(e,vt),valList:N(e,Je),next:N(e,Zt),prev:N(e,zt),get head(){return N(e,Bt)},get tail(){return N(e,Mt)},free:N(e,si),isBackgroundFetch:r=>{var n;return _e(n=e,St,Ct).call(n,r)},backgroundFetch:(r,n,o,a)=>{var l;return _e(l=e,Wi,Pr).call(l,r,n,o,a)},moveToTail:r=>{var n;return _e(n=e,Ri,nr).call(n,r)},indexes:r=>{var n;return _e(n=e,ci,Ii).call(n,r)},rindexes:r=>{var n;return _e(n=e,hi,wi).call(n,r)},isStale:r=>{var n;return N(n=e,jt).call(n,r)}}}get max(){return N(this,ti)}get maxSize(){return N(this,Ut)}get calculatedSize(){return N(this,ni)}get size(){return N(this,At)}get fetchMethod(){return N(this,Vi)}get dispose(){return N(this,ii)}get disposeAfter(){return N(this,ri)}getRemainingTTL(e){return N(this,Pt).has(e)?1/0:0}*entries(){for(const e of _e(this,ci,Ii).call(this))N(this,Je)[e]!==void 0&&N(this,vt)[e]!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield[N(this,vt)[e],N(this,Je)[e]])}*rentries(){for(const e of _e(this,hi,wi).call(this))N(this,Je)[e]!==void 0&&N(this,vt)[e]!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield[N(this,vt)[e],N(this,Je)[e]])}*keys(){for(const e of _e(this,ci,Ii).call(this)){const r=N(this,vt)[e];r!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield r)}}*rkeys(){for(const e of _e(this,hi,wi).call(this)){const r=N(this,vt)[e];r!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield r)}}*values(){for(const e of _e(this,ci,Ii).call(this))N(this,Je)[e]!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield N(this,Je)[e])}*rvalues(){for(const e of _e(this,hi,wi).call(this))N(this,Je)[e]!==void 0&&!_e(this,St,Ct).call(this,N(this,Je)[e])&&(yield N(this,Je)[e])}[Symbol.iterator](){return this.entries()}find(e,r={}){for(const n of _e(this,ci,Ii).call(this)){const o=N(this,Je)[n],a=_e(this,St,Ct).call(this,o)?o.__staleWhileFetching:o;if(a!==void 0&&e(a,N(this,vt)[n],this))return this.get(N(this,vt)[n],r)}}forEach(e,r=this){for(const n of _e(this,ci,Ii).call(this)){const o=N(this,Je)[n],a=_e(this,St,Ct).call(this,o)?o.__staleWhileFetching:o;a!==void 0&&e.call(r,a,N(this,vt)[n],this)}}rforEach(e,r=this){for(const n of _e(this,hi,wi).call(this)){const o=N(this,Je)[n],a=_e(this,St,Ct).call(this,o)?o.__staleWhileFetching:o;a!==void 0&&e.call(r,a,N(this,vt)[n],this)}}purgeStale(){let e=!1;for(const r of _e(this,hi,wi).call(this,{allowStale:!0}))N(this,jt).call(this,r)&&(this.delete(N(this,vt)[r]),e=!0);return e}dump(){const e=[];for(const r of _e(this,ci,Ii).call(this,{allowStale:!0})){const n=N(this,vt)[r],o=N(this,Je)[r],a=_e(this,St,Ct).call(this,o)?o.__staleWhileFetching:o;if(a===void 0||n===void 0)continue;const l={value:a};if(N(this,oi)&&N(this,di)){l.ttl=N(this,oi)[r];const c=perf.now()-N(this,di)[r];l.start=Math.floor(Date.now()-c)}N(this,fi)&&(l.size=N(this,fi)[r]),e.unshift([n,l])}return e}load(e){this.clear();for(const[r,n]of e){if(n.start){const o=Date.now()-n.start;n.start=perf.now()-o}this.set(r,n.value,n)}}set(e,r,n={}){var v,A,T,B,Y;if(r===void 0)return this.delete(e),this;const{ttl:o=this.ttl,start:a,noDisposeOnSet:l=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:h}=n;let{noUpdateTTL:f=this.noUpdateTTL}=n;const d=N(this,ar).call(this,e,r,n.size||0,c);if(this.maxEntrySize&&d>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.delete(e),this;let m=N(this,At)===0?void 0:N(this,Pt).get(e);if(m===void 0)m=N(this,At)===0?N(this,Mt):N(this,si).length!==0?N(this,si).pop():N(this,At)===N(this,ti)?_e(this,Hi,Ar).call(this,!1):N(this,At),N(this,vt)[m]=e,N(this,Je)[m]=r,N(this,Pt).set(e,m),N(this,Zt)[N(this,Mt)]=m,N(this,zt)[m]=N(this,Mt),Ue(this,Mt,m),xr(this,At)._++,N(this,Gi).call(this,m,d,h),h&&(h.set="add"),f=!1;else{_e(this,Ri,nr).call(this,m);const F=N(this,Je)[m];if(r!==F){if(N(this,ki)&&_e(this,St,Ct).call(this,F)){F.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:ke}=F;ke!==void 0&&!l&&(N(this,ai)&&((v=N(this,ii))==null||v.call(this,ke,e,"set")),N(this,_t)&&((A=N(this,Et))==null||A.push([ke,e,"set"])))}else l||(N(this,ai)&&((T=N(this,ii))==null||T.call(this,F,e,"set")),N(this,_t)&&((B=N(this,Et))==null||B.push([F,e,"set"])));if(N(this,Qi).call(this,m),N(this,Gi).call(this,m,d,h),N(this,Je)[m]=r,h){h.set="replace";const ke=F&&_e(this,St,Ct).call(this,F)?F.__staleWhileFetching:F;ke!==void 0&&(h.oldValue=ke)}}else h&&(h.set="update")}if(o!==0&&!N(this,oi)&&_e(this,sr,qr).call(this),N(this,oi)&&(f||N(this,or).call(this,m,o,a),h&&N(this,pi).call(this,h,m)),!l&&N(this,_t)&&N(this,Et)){const F=N(this,Et);let ke;for(;ke=F==null?void 0:F.shift();)(Y=N(this,ri))==null||Y.call(this,...ke)}return this}pop(){var e;try{for(;N(this,At);){const r=N(this,Je)[N(this,Bt)];if(_e(this,Hi,Ar).call(this,!0),_e(this,St,Ct).call(this,r)){if(r.__staleWhileFetching)return r.__staleWhileFetching}else if(r!==void 0)return r}}finally{if(N(this,_t)&&N(this,Et)){const r=N(this,Et);let n;for(;n=r==null?void 0:r.shift();)(e=N(this,ri))==null||e.call(this,...n)}}}has(e,r={}){const{updateAgeOnHas:n=this.updateAgeOnHas,status:o}=r,a=N(this,Pt).get(e);if(a!==void 0){const l=N(this,Je)[a];if(_e(this,St,Ct).call(this,l)&&l.__staleWhileFetching===void 0)return!1;if(N(this,jt).call(this,a))o&&(o.has="stale",N(this,pi).call(this,o,a));else return n&&N(this,Li).call(this,a),o&&(o.has="hit",N(this,pi).call(this,o,a)),!0}else o&&(o.has="miss");return!1}peek(e,r={}){const{allowStale:n=this.allowStale}=r,o=N(this,Pt).get(e);if(o!==void 0&&(n||!N(this,jt).call(this,o))){const a=N(this,Je)[o];return _e(this,St,Ct).call(this,a)?a.__staleWhileFetching:a}}async fetch(e,r={}){const{allowStale:n=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:l=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:h=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:v=this.allowStaleOnFetchRejection,ignoreFetchAbort:A=this.ignoreFetchAbort,allowStaleOnFetchAbort:T=this.allowStaleOnFetchAbort,context:B,forceRefresh:Y=!1,status:F,signal:ke}=r;if(!N(this,ki))return F&&(F.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:o,noDeleteOnStaleGet:a,status:F});const Qe={allowStale:n,updateAgeOnGet:o,noDeleteOnStaleGet:a,ttl:l,noDisposeOnSet:c,size:h,sizeCalculation:f,noUpdateTTL:d,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:T,ignoreFetchAbort:A,status:F,signal:ke};let xe=N(this,Pt).get(e);if(xe===void 0){F&&(F.fetch="miss");const Te=_e(this,Wi,Pr).call(this,e,xe,Qe,B);return Te.__returned=Te}else{const Te=N(this,Je)[xe];if(_e(this,St,Ct).call(this,Te)){const Ve=n&&Te.__staleWhileFetching!==void 0;return F&&(F.fetch="inflight",Ve&&(F.returnedStale=!0)),Ve?Te.__staleWhileFetching:Te.__returned=Te}const Le=N(this,jt).call(this,xe);if(!Y&&!Le)return F&&(F.fetch="hit"),_e(this,Ri,nr).call(this,xe),o&&N(this,Li).call(this,xe),F&&N(this,pi).call(this,F,xe),Te;const Me=_e(this,Wi,Pr).call(this,e,xe,Qe,B),Fe=Me.__staleWhileFetching!==void 0&&n;return F&&(F.fetch=Le?"stale":"refresh",Fe&&Le&&(F.returnedStale=!0)),Fe?Me.__staleWhileFetching:Me.__returned=Me}}get(e,r={}){const{allowStale:n=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:l}=r,c=N(this,Pt).get(e);if(c!==void 0){const h=N(this,Je)[c],f=_e(this,St,Ct).call(this,h);return l&&N(this,pi).call(this,l,c),N(this,jt).call(this,c)?(l&&(l.get="stale"),f?(l&&n&&h.__staleWhileFetching!==void 0&&(l.returnedStale=!0),n?h.__staleWhileFetching:void 0):(a||this.delete(e),l&&n&&(l.returnedStale=!0),n?h:void 0)):(l&&(l.get="hit"),f?h.__staleWhileFetching:(_e(this,Ri,nr).call(this,c),o&&N(this,Li).call(this,c),h))}else l&&(l.get="miss")}delete(e){var n,o,a,l;let r=!1;if(N(this,At)!==0){const c=N(this,Pt).get(e);if(c!==void 0)if(r=!0,N(this,At)===1)this.clear();else{N(this,Qi).call(this,c);const h=N(this,Je)[c];_e(this,St,Ct).call(this,h)?h.__abortController.abort(new Error("deleted")):(N(this,ai)||N(this,_t))&&(N(this,ai)&&((n=N(this,ii))==null||n.call(this,h,e,"delete")),N(this,_t)&&((o=N(this,Et))==null||o.push([h,e,"delete"]))),N(this,Pt).delete(e),N(this,vt)[c]=void 0,N(this,Je)[c]=void 0,c===N(this,Mt)?Ue(this,Mt,N(this,zt)[c]):c===N(this,Bt)?Ue(this,Bt,N(this,Zt)[c]):(N(this,Zt)[N(this,zt)[c]]=N(this,Zt)[c],N(this,zt)[N(this,Zt)[c]]=N(this,zt)[c]),xr(this,At)._--,N(this,si).push(c)}}if(N(this,_t)&&((a=N(this,Et))!=null&&a.length)){const c=N(this,Et);let h;for(;h=c==null?void 0:c.shift();)(l=N(this,ri))==null||l.call(this,...h)}return r}clear(){var e,r,n;for(const o of _e(this,hi,wi).call(this,{allowStale:!0})){const a=N(this,Je)[o];if(_e(this,St,Ct).call(this,a))a.__abortController.abort(new Error("deleted"));else{const l=N(this,vt)[o];N(this,ai)&&((e=N(this,ii))==null||e.call(this,a,l,"delete")),N(this,_t)&&((r=N(this,Et))==null||r.push([a,l,"delete"]))}}if(N(this,Pt).clear(),N(this,Je).fill(void 0),N(this,vt).fill(void 0),N(this,oi)&&N(this,di)&&(N(this,oi).fill(0),N(this,di).fill(0)),N(this,fi)&&N(this,fi).fill(0),Ue(this,Bt,0),Ue(this,Mt,0),N(this,si).length=0,Ue(this,ni,0),Ue(this,At,0),N(this,_t)&&N(this,Et)){const o=N(this,Et);let a;for(;a=o==null?void 0:o.shift();)(n=N(this,ri))==null||n.call(this,...a)}}};ti=new WeakMap,Ut=new WeakMap,ii=new WeakMap,ri=new WeakMap,Vi=new WeakMap,At=new WeakMap,ni=new WeakMap,Pt=new WeakMap,vt=new WeakMap,Je=new WeakMap,Zt=new WeakMap,zt=new WeakMap,Bt=new WeakMap,Mt=new WeakMap,si=new WeakMap,Et=new WeakMap,fi=new WeakMap,di=new WeakMap,oi=new WeakMap,ai=new WeakMap,ki=new WeakMap,_t=new WeakMap,sr=new WeakSet,qr=function(){const e=new ZeroArray(N(this,ti)),r=new ZeroArray(N(this,ti));Ue(this,oi,e),Ue(this,di,r),Ue(this,or,(a,l,c=perf.now())=>{if(r[a]=l!==0?c:0,e[a]=l,l!==0&&this.ttlAutopurge){const h=setTimeout(()=>{N(this,jt).call(this,a)&&this.delete(N(this,vt)[a])},l+1);h.unref&&h.unref()}}),Ue(this,Li,a=>{r[a]=e[a]!==0?perf.now():0}),Ue(this,pi,(a,l)=>{if(e[l]){const c=e[l],h=r[l];a.ttl=c,a.start=h,a.now=n||o();const f=a.now-h;a.remainingTTL=c-f}});let n=0;const o=()=>{const a=perf.now();if(this.ttlResolution>0){n=a;const l=setTimeout(()=>n=0,this.ttlResolution);l.unref&&l.unref()}return a};this.getRemainingTTL=a=>{const l=N(this,Pt).get(a);if(l===void 0)return 0;const c=e[l],h=r[l];if(c===0||h===0)return 1/0;const f=(n||o())-h;return c-f},Ue(this,jt,a=>e[a]!==0&&r[a]!==0&&(n||o())-r[a]>e[a])},Li=new WeakMap,pi=new WeakMap,or=new WeakMap,jt=new WeakMap,Tr=new WeakSet,yn=function(){const e=new ZeroArray(N(this,ti));Ue(this,ni,0),Ue(this,fi,e),Ue(this,Qi,r=>{Ue(this,ni,N(this,ni)-e[r]),e[r]=0}),Ue(this,ar,(r,n,o,a)=>{if(_e(this,St,Ct).call(this,n))return 0;if(!isPosInt(o))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(o=a(n,r),!isPosInt(o))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return o}),Ue(this,Gi,(r,n,o)=>{if(e[r]=n,N(this,Ut)){const a=N(this,Ut)-e[r];for(;N(this,ni)>a;)_e(this,Hi,Ar).call(this,!0)}Ue(this,ni,N(this,ni)+e[r]),o&&(o.entrySize=n,o.totalCalculatedSize=N(this,ni))})},Qi=new WeakMap,Gi=new WeakMap,ar=new WeakMap,ci=new WeakSet,Ii=function*({allowStale:e=this.allowStale}={}){if(N(this,At))for(let r=N(this,Mt);!(!_e(this,lr,Kr).call(this,r)||((e||!N(this,jt).call(this,r))&&(yield r),r===N(this,Bt)));)r=N(this,zt)[r]},hi=new WeakSet,wi=function*({allowStale:e=this.allowStale}={}){if(N(this,At))for(let r=N(this,Bt);!(!_e(this,lr,Kr).call(this,r)||((e||!N(this,jt).call(this,r))&&(yield r),r===N(this,Mt)));)r=N(this,Zt)[r]},lr=new WeakSet,Kr=function(e){return e!==void 0&&N(this,Pt).get(N(this,vt)[e])===e},Hi=new WeakSet,Ar=function(e){var a,l;const r=N(this,Bt),n=N(this,vt)[r],o=N(this,Je)[r];return N(this,ki)&&_e(this,St,Ct).call(this,o)?o.__abortController.abort(new Error("evicted")):(N(this,ai)||N(this,_t))&&(N(this,ai)&&((a=N(this,ii))==null||a.call(this,o,n,"evict")),N(this,_t)&&((l=N(this,Et))==null||l.push([o,n,"evict"]))),N(this,Qi).call(this,r),e&&(N(this,vt)[r]=void 0,N(this,Je)[r]=void 0,N(this,si).push(r)),N(this,At)===1?(Ue(this,Bt,Ue(this,Mt,0)),N(this,si).length=0):Ue(this,Bt,N(this,Zt)[r]),N(this,Pt).delete(n),xr(this,At)._--,r},Wi=new WeakSet,Pr=function(e,r,n,o){const a=r===void 0?void 0:N(this,Je)[r];if(_e(this,St,Ct).call(this,a))return a;const l=new AC,{signal:c}=n;c==null||c.addEventListener("abort",()=>l.abort(c.reason),{signal:l.signal});const h={signal:l.signal,options:n,context:o},f=(B,Y=!1)=>{const{aborted:F}=l.signal,ke=n.ignoreFetchAbort&&B!==void 0;if(n.status&&(F&&!Y?(n.status.fetchAborted=!0,n.status.fetchError=l.signal.reason,ke&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),F&&!ke&&!Y)return m(l.signal.reason);const Qe=A;return N(this,Je)[r]===A&&(B===void 0?Qe.__staleWhileFetching?N(this,Je)[r]=Qe.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,B,h.options))),B},d=B=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=B),m(B)),m=B=>{const{aborted:Y}=l.signal,F=Y&&n.allowStaleOnFetchAbort,ke=F||n.allowStaleOnFetchRejection,Qe=ke||n.noDeleteOnFetchRejection,xe=A;if(N(this,Je)[r]===A&&(!Qe||xe.__staleWhileFetching===void 0?this.delete(e):F||(N(this,Je)[r]=xe.__staleWhileFetching)),ke)return n.status&&xe.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),xe.__staleWhileFetching;if(xe.__returned===xe)throw B},v=(B,Y)=>{var ke;const F=(ke=N(this,Vi))==null?void 0:ke.call(this,e,a,h);F&&F instanceof Promise&&F.then(Qe=>B(Qe===void 0?void 0:Qe),Y),l.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(B(void 0),n.allowStaleOnFetchAbort&&(B=Qe=>f(Qe,!0)))})};n.status&&(n.status.fetchDispatched=!0);const A=new Promise(v).then(f,d),T=Object.assign(A,{__abortController:l,__staleWhileFetching:a,__returned:void 0});return r===void 0?(this.set(e,T,{...h.options,status:void 0}),r=N(this,Pt).get(e)):N(this,Je)[r]=T,T},St=new WeakSet,Ct=function(e){if(!N(this,ki))return!1;const r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof AC},cr=new WeakSet,Jr=function(e,r){N(this,zt)[r]=e,N(this,Zt)[e]=r},Ri=new WeakSet,nr=function(e){e!==N(this,Mt)&&(e===N(this,Bt)?Ue(this,Bt,N(this,Zt)[e]):_e(this,cr,Jr).call(this,N(this,zt)[e],N(this,Zt)[e]),_e(this,cr,Jr).call(this,N(this,Mt),e),Ue(this,Mt,e))};let LRUCache=en;const zcache=new LRUCache({max:1e3,ttl:1e3*60*5});class Ziffers{constructor(e,r={}){z(this,"values");z(this,"evaluated");z(this,"options");z(this,"index",0);z(this,"redo");z(this,"_current");r={...DEFAULT_OPTIONS,...r},r.scale&&(typeof r.scale=="string"&&(isScale(r.scale)?(r.scaleName=r.scale,r.scale=getScale(r.scale)):r.scale=parse(r.scale)),r.parsedScale=r.scale,delete r.scale),r.redo!==void 0?this.redo=r.redo:this.redo=1,r&&r.seed&&(r.randomSeed=r.seed,r.seededRandom=seededRandom(r.seed)),this.options={nodeOptions:r};try{this.values=parse$1(e,this.options),this.evaluated=this.evaluate()}catch(n){console.log(n),this.values=[],this.evaluated=[]}}update(){this.evaluated=this.evaluate()}pitches(){return this.evaluated.map(e=>e.collect("pitch"))}notes(){return this.evaluated.map(e=>e.collect("note"))}freqs(){return this.evaluated.map(e=>e.collect("freq"))}durations(){return this.evaluated.map(e=>e.collect("duration"))}next(){if(this.redo>0&&this.index>=this.evaluated.length*this.redo&&(this.update(),this._current=void 0),this._current!==void 0){const r=this.evaluated[this._current%this.evaluated.length];r.modifiedEvent&&r.modifiedEvent==null,this._current=this._current+1<this.evaluated.length?this._current+1:0}else this._current=0;const e=this.evaluated[this._current%this.evaluated.length];return this.index++,e}notStarted(){return this._current===void 0}peek(){return this.evaluated[this._current||0]}hasStarted(){return this._current!==void 0}evaluate(){const e=this.values.map(r=>r.evaluate()).flat(1/0).filter(r=>r!==void 0);return e.forEach((r,n)=>{r._next=n<e.length-1?n+1:0,r._prev=n>0?n-1:e.length-1}),e}}const generateCacheKey=(...s)=>s.map(e=>JSON.stringify(e)).join(","),cachedCall=(s,e)=>{const r=generateCacheKey(s,e);if(zcache.has(r))return zcache.get(r);{const n=new Ziffers(s,e);return zcache.set(r,n),n}},cachedPattern=(s,e={})=>cachedCall(s,e);class MidiConnection{constructor(){z(this,"midiAccess",null);z(this,"midiOutputs",[]);z(this,"currentOutputIndex",0);z(this,"scheduledNotes",{});this.initializeMidiAccess()}async initializeMidiAccess(){try{this.midiAccess=await navigator.requestMIDIAccess(),this.midiOutputs=Array.from(this.midiAccess.outputs.values()),this.midiOutputs.length===0&&console.warn("No MIDI outputs available.")}catch(e){console.error("Failed to initialize MIDI:",e)}}getCurrentMidiPort(){return this.midiOutputs.length>0&&this.currentOutputIndex>=0&&this.currentOutputIndex<this.midiOutputs.length?this.midiOutputs[this.currentOutputIndex].name:(console.error("No MIDI output selected or available."),null)}sendMidiClock(){const e=this.midiOutputs[this.currentOutputIndex];e?e.send([248]):console.error("MIDI output not available.")}switchMidiOutput(e){const r=this.midiOutputs.findIndex(n=>n.name===e);return r!==-1?(this.currentOutputIndex=r,!0):(console.error(`MIDI output "${e}" not found.`),!1)}listMidiOutputs(){console.log("Available MIDI Outputs:"),this.midiOutputs.forEach((e,r)=>{console.log(`${r+1}. ${e.name}`)})}sendMidiNote(e,r,n,o){const a=this.midiOutputs[this.currentOutputIndex];if(e=Math.min(Math.max(e,0),127),a){const l=[144+r,e,n],c=[128+r,e,0];a.send(l);const h=setTimeout(()=>{a.send(c),delete this.scheduledNotes[e]},(o-.02)*1e3);this.scheduledNotes[e]=h}else console.error("MIDI output not available.")}sendSysExMessage(e){const r=this.midiOutputs[this.currentOutputIndex];r?r.send(e):console.error("MIDI output not available.")}sendPitchBend(e,r){(e<0||e>16383)&&console.error("Invalid pitch bend value. Value must be in the range 0-16383."),(r<0||r>15)&&console.error("Invalid MIDI channel. Channel must be in the range 0-15.");const n=this.midiOutputs[this.currentOutputIndex];if(n){const o=e&127,a=e>>7&127;n.send([224|r,o,a])}else console.error("MIDI output not available.")}sendProgramChange(e,r){const n=this.midiOutputs[this.currentOutputIndex];n?n.send([192+r,e]):console.error("MIDI output not available.")}sendMidiControlChange(e,r,n){const o=this.midiOutputs[this.currentOutputIndex];o?o.send([176+n,e,r]):console.error("MIDI output not available.")}panic(){const e=this.midiOutputs[this.currentOutputIndex];if(e){for(const r in this.scheduledNotes){const n=this.scheduledNotes[r];clearTimeout(n),e.send([128,parseInt(r),0])}this.scheduledNotes={}}else console.error("MIDI output not available.")}}class DrunkWalk{constructor(e,r,n){z(this,"min");z(this,"max");z(this,"wrap");z(this,"position");this.min=e,this.max=r,this.wrap=n,this.position=0}step(){const e=Math.floor(Math.random()*3)-1;this.position+=e,this.wrap?this.position>this.max?this.position=this.min:this.position<this.min&&(this.position=this.max):this.position<this.min?this.position=this.min:this.position>this.max&&(this.position=this.max)}getPosition(){return this.position}toggleWrap(e){this.wrap=e}}const SCALES={major:[0,2,4,5,7,9,11],naturalMinor:[0,2,3,5,7,8,10],harmonicMinor:[0,2,3,5,7,8,11],melodicMinor:[0,2,3,5,7,9,11],dorian:[0,2,3,5,7,9,10],phrygian:[0,1,3,5,7,8,10],lydian:[0,2,4,6,7,9,11],mixolydian:[0,2,4,5,7,9,10],aeolian:[0,2,3,5,7,8,10],locrian:[0,1,3,5,6,8,10],wholeTone:[0,2,4,6,8,10],majorPentatonic:[0,2,4,7,9],minorPentatonic:[0,3,5,7,10],chromatic:[0,1,2,3,4,5,6,7,8,9,10,11],blues:[0,3,5,6,7,10],diminished:[0,2,3,5,6,8,9,11],neapolitanMinor:[0,1,3,5,7,8,11],neapolitanMajor:[0,1,3,5,7,9,11],enigmatic:[0,1,4,6,8,10,11],doubleHarmonic:[0,1,4,5,7,8,11],octatonic:[0,2,3,5,6,8,9,11],bebopDominant:[0,2,4,5,7,9,10,11],bebopMajor:[0,2,4,5,7,8,9,11],bebopMinor:[0,2,3,5,7,8,9,11],bebopDorian:[0,2,3,4,5,7,9,10],harmonicMajor:[0,2,4,5,7,8,11],hungarianMinor:[0,2,3,6,7,8,11],hungarianMajor:[0,3,4,6,7,9,10],oriental:[0,1,4,5,6,9,10],romanianMinor:[0,2,3,6,7,9,10],spanishGypsy:[0,1,4,5,7,8,10],jewish:[0,1,4,5,7,8,10],hindu:[0,2,4,5,7,8,10],japanese:[0,1,5,7,8],hirajoshi:[0,2,3,7,8],kumoi:[0,2,3,7,9],inSen:[0,1,5,7,10],iwato:[0,1,5,6,10],yo:[0,2,5,7,9],minorBlues:[0,3,5,6,7,10],algerian:[0,2,3,5,6,7,8,11],augmented:[0,3,4,7,8,11],balinese:[0,1,3,7,8],byzantine:[0,1,4,5,7,8,11],chinese:[0,4,6,7,11],egyptian:[0,2,5,7,10],eightToneSpanish:[0,1,3,4,5,6,8,10],hawaiian:[0,2,3,5,7,9,10],hindustan:[0,2,4,5,7,8,10],persian:[0,1,4,5,6,8,11],eastIndianPurvi:[0,1,4,6,7,8,11],orientalA:[0,1,4,5,6,9,10]};function scale(s,e="major",r=4){const n=SCALES[e];if(!n)throw new Error(`Unknown scale ${e}`);let o=s%n.length;o<0&&(o+=n.length);let a=Math.floor(s/n.length);return 60+(r+a)*12+n[o]}let listenerQueue=[],atom=(s,e)=>{let r,n=[],o={lc:0,l:e||0,value:s,set(a){o.value=a,o.notify()},get(){return o.lc||o.listen(()=>{})(),o.value},notify(a){r=n;let l=!listenerQueue.length;for(let c=0;c<r.length;c+=2)listenerQueue.push(r[c],o.value,a,r[c+1]);if(l){for(let c=0;c<listenerQueue.length;c+=4){let h=!1;for(let f=c+7;f<listenerQueue.length;f+=4)if(listenerQueue[f]<listenerQueue[c+3]){h=!0;break}h?listenerQueue.push(listenerQueue[c],listenerQueue[c+1],listenerQueue[c+2],listenerQueue[c+3]):listenerQueue[c](listenerQueue[c+1],listenerQueue[c+2])}listenerQueue.length=0}},listen(a,l){return n===r&&(n=n.slice()),o.lc=n.push(a,l||o.l)/2,()=>{n===r&&(n=n.slice());let c=n.indexOf(a);~c&&(n.splice(c,2),o.lc--,o.lc||o.off())}},subscribe(a,l){let c=o.listen(a,l);return a(o.value),c},off(){}};return o},map=(s={})=>{let e=atom(s);return e.setKey=function(r,n){typeof n>"u"?r in e.value&&(e.value={...e.value},delete e.value[r],e.notify(r)):e.value[r]!==n&&(e.value={...e.value,[r]:n},e.notify(r))},e};if(typeof DelayNode<"u"){class s extends DelayNode{constructor(r,n,o,a){super(r),n=Math.abs(n),this.delayTime.value=o;const l=r.createGain();l.gain.value=Math.min(Math.abs(a),.995),this.feedback=l.gain;const c=r.createGain();return c.gain.value=n,this.delayGain=c,this.connect(l),this.connect(c),l.connect(this),this.connect=h=>c.connect(h),this}start(r){this.delayGain.gain.setValueAtTime(this.delayGain.gain.value,r+this.delayTime.value)}}AudioContext.prototype.createFeedbackDelay=function(e,r,n){return new s(this,e,r,n)}}typeof AudioContext<"u"&&(AudioContext.prototype.impulseResponse=function(s,e=1){const r=this.sampleRate*s,n=this.createBuffer(e,r,this.sampleRate),o=n.getChannelData(0);for(let a=0;a<r;a++)o[a]=(2*Math.random()-1)*Math.pow(1-a/r,s);return n},AudioContext.prototype.createReverb=function(s){const e=this.createConvolver();return e.setDuration=r=>(e.buffer=this.impulseResponse(r),e.duration=s,e),e.setDuration(s),e});var q={a:{freqs:[660,1120,2750,3e3,3350],gains:[1,.5012,.0708,.0631,.0126],qs:[80,90,120,130,140]},e:{freqs:[440,1800,2700,3e3,3300],gains:[1,.1995,.1259,.1,.1],qs:[70,80,100,120,120]},i:{freqs:[270,1850,2900,3350,3590],gains:[1,.0631,.0631,.0158,.0158],qs:[40,90,100,120,120]},o:{freqs:[430,820,2700,3e3,3300],gains:[1,.3162,.0501,.0794,.01995],qs:[40,80,100,120,120]},u:{freqs:[370,630,2750,3e3,3400],gains:[1,.1,.0708,.0316,.01995],qs:[40,60,100,120,120]}};if(typeof GainNode<"u"){class s extends GainNode{constructor(r,n){if(super(r),!q[n])throw new Error("vowel: unknown vowel "+n);const{gains:o,qs:a,freqs:l}=q[n],c=r.createGain();for(let h=0;h<5;h++){const f=r.createGain();f.gain.value=o[h];const d=r.createBiquadFilter();d.type="bandpass",d.Q.value=a[h],d.frequency.value=l[h],this.connect(d),d.connect(f),f.connect(c)}return c.gain.value=8,this.connect=h=>c.connect(h),this}}AudioContext.prototype.createVowelFilter=function(e){return new s(this,e)}}const ce=s=>{var o;if(typeof s!="string")return[];const[e,r="",n]=((o=s.match(/^([a-gA-G])([#bsf]*)([0-9]*)$/))==null?void 0:o.slice(1))||[];return e?[e,r,n?Number(n):void 0]:[]},re={c:0,d:2,e:4,f:5,g:7,a:9,b:11},ie={"#":1,b:-1,s:1,f:-1},L=(s,e=3)=>{const[r,n,o=e]=ce(s);if(!r)throw new Error('not a note: "'+s+'"');const a=re[r.toLowerCase()],l=(n==null?void 0:n.split("").reduce((c,h)=>c+ie[h],0))||0;return(Number(o)+1)*12+a+l},se=s=>Math.pow(2,(s-69)/12)*440,ae=(s,e,r)=>Math.min(Math.max(s,e),r),ge=s=>12*Math.log(s/440)/Math.LN2+69,de=(s,e)=>{if(typeof s!="object")throw new Error("valueToMidi: expected object value");let{freq:r,note:n}=s;if(typeof r=="number")return ge(r);if(typeof n=="string")return L(n);if(typeof n=="number")return n;if(!e)throw new Error("valueToMidi: expected freq or note to be set");return e},ue="data:application/javascript;base64,Ly8gTElDRU5TRSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2My4wIHNlZSBodHRwczovL2dpdGh1Yi5jb20vZGt0cjAvV2ViRGlydC9ibG9iL21haW4vTElDRU5TRQovLyBhbGwgdGhlIGNyZWRpdCBnb2VzIHRvIGRrdHIwJ3Mgd2ViZGlydDogaHR0cHM6Ly9naXRodWIuY29tL2RrdHIwL1dlYkRpcnQvYmxvYi81Y2UzZDY5ODM2MmM1NGQ2ZTFiNjhhY2M0N2ViMjk1NWFjNjJjNzkzL2Rpc3QvQXVkaW9Xb3JrbGV0cy5qcwovLyA8MwoKY2xhc3MgQ29hcnNlUHJvY2Vzc29yIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgZ2V0IHBhcmFtZXRlckRlc2NyaXB0b3J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KSB7CiAgICAgICAgY29uc3QgdmFsdWUgPSAoKDEgKyBzaGFwZSkgKiBpbnB1dFswXVtuXSkgLyAoMSArIHNoYXBlICogTWF0aC5hYnMoaW5wdXRbMF1bbl0pKTsKICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ3NoYXBlLXByb2Nlc3NvcicsIFNoYXBlUHJvY2Vzc29yKTsK";function k(s){const e=C().createGain();return e.gain.value=s,e}const Ie=({s,freq:e,t:r})=>{const n=C().createOscillator();return n.type=s||"triangle",n.frequency.value=Number(e),n.start(r),{node:n,stop:o=>n.stop(o)}},ee=(s,e,r,n,o,a)=>{const l=C().createGain();return l.gain.setValueAtTime(0,a),l.gain.linearRampToValueAtTime(o,a+s),l.gain.linearRampToValueAtTime(r*o,a+s+e),{node:l,stop:c=>{l.gain.setValueAtTime(r*o,c),l.gain.linearRampToValueAtTime(0,c+n)}}},Q=(s,e,r)=>{const n=C().createBiquadFilter();return n.type=s,n.frequency.value=e,n.Q.value=r,n},E=map();function te(s,e,r={}){E.setKey(s,{onTrigger:e,data:r})}function U(s){return E.get()[s]}let J;const C=()=>(J||(J=new AudioContext),J);let W;const j=()=>{const s=C();return W||(W=s.createGain(),W.connect(s.destination)),W};let D;function le(){return D||(D=C().audioWorklet.addModule(ue),D)}function x(s,e,r){const n=new AudioWorkletNode(s,e);return Object.entries(r).forEach(([o,a])=>{n.parameters.get(o).value=a}),n}async function Ce(s={}){const{disableWorklets:e=!1}=s;typeof window<"u"&&(await C().resume(),e?console.log("disableWorklets: AudioWorklet effects coarse, crush and shape are skipped!"):await le().catch(r=>{console.warn("could not load AudioWorklet effects coarse, crush and shape",r)}))}async function ve(s){return new Promise(e=>{document.addEventListener("click",async function r(){await Ce(s),e(),document.removeEventListener("click",r)})})}let G={};function fe(s,e,r,n){var o;if(r=ae(r,0,.98),!G[s]){const a=C().createFeedbackDelay(1,e,r);(o=a.start)==null||o.call(a,n),a.connect(j()),G[s]=a}return G[s].delayTime.value!==e&&G[s].delayTime.setValueAtTime(e,n),G[s].feedback.value!==r&&G[s].feedback.setValueAtTime(r,n),G[s]}let w={};function Ae(s,e=2){if(!w[s]){const r=C().createReverb(e);r.connect(j()),w[s]=r}return w[s].duration!==e&&(w[s]=w[s].setDuration(e),w[s].duration=e),w[s]}function _(s,e,r){const n=k(r);return s.connect(n),n.connect(e),n}const he=async(s,e,r)=>{const n=C();if(typeof s!="object")throw new Error(`expected hap.value to be an object, but got "${s}". Hint: append .note() or .s() to the end`,"error");let o=n.currentTime+e,{s:a="triangle",bank:l,source:c,gain:h=.8,cutoff:f,resonance:d=1,hcutoff:m,hresonance:v=1,bandf:A,bandq:T=1,coarse:B,crush:Y,shape:F,pan:ke,vowel:Qe,delay:xe=0,delayfeedback:Te=.5,delaytime:Le=.25,orbit:Me=1,room:ot,size:Fe=2,velocity:Ve=1}=s;h*=Ve;let at=[];const dt=()=>{at.forEach(lt=>lt==null?void 0:lt.disconnect())};l&&a&&(a=`${l}_${a}`);let ct;if(c)ct=c(o,s,r);else if(U(a)){const{onTrigger:lt}=U(a),st=await lt(o,s,dt);st&&(ct=st.node,st.stop(o+r))}else throw new Error(`sound ${a} not found! Is it loaded?`);if(!ct||n.currentTime>o)return;const nt=[];if(nt.push(ct),nt.push(k(h)),f!==void 0&&nt.push(Q("lowpass",f,d)),m!==void 0&&nt.push(Q("highpass",m,v)),A!==void 0&&nt.push(Q("bandpass",A,T)),Qe!==void 0&&nt.push(n.createVowelFilter(Qe)),B!==void 0&&nt.push(x(n,"coarse-processor",{coarse:B})),Y!==void 0&&nt.push(x(n,"crush-processor",{crush:Y})),F!==void 0&&nt.push(x(n,"shape-processor",{shape:F})),ke!==void 0){const lt=n.createStereoPanner();lt.pan.value=2*ke-1,nt.push(lt)}const ft=k(1);nt.push(ft),ft.connect(j());let it;if(xe>0&&Le>0&&Te>0){const lt=fe(Me,Le,Te,o);it=_(ft,lt,xe)}let pt;if(ot>0&&Fe>0){const lt=Ae(Me,Fe);pt=_(ft,lt,ot)}nt.slice(1).reduce((lt,st)=>lt.connect(st),nt[0]),at=nt.concat([it,pt])},O={};function pe(s,e){var r=e?1e3:1024;if(s<r)return s+" B";var n=e?["kB","MB","GB","TB","PB","EB","ZB","YB"]:["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],o=-1;do s/=r,++o;while(s>=r);return s.toFixed(1)+" "+n[o]}const be=async(s,e,r,n,o,a,l)=>{let c=0,h=de({freq:o,note:r},36);c=h-36;const f=C();let d;if(Array.isArray(a))d=a[e%a.length];else{const T=Y=>L(Y)-h,B=Object.keys(a).filter(Y=>!Y.startsWith("_")).reduce((Y,F,ke)=>!Y||Math.abs(T(F))<Math.abs(T(Y))?F:Y,null);c=-T(B),d=a[B][e%a[B].length]}l&&(d=await l(d));let m=await Be(d,f,s,e);n<0&&(m=ye(m));const v=f.createBufferSource();v.buffer=m;const A=1*Math.pow(2,c/12);return v.playbackRate.value=A,v},Be=(s,e,r,n=0)=>(O[s]||(O[s]=fetch(s).then(o=>o.arrayBuffer()).then(async o=>(pe(o.byteLength),await e.decodeAudioData(o)))),O[s]);function ye(s){const e=C(),r=e.createBuffer(s.numberOfChannels,s.length,e.sampleRate);for(let n=0;n<s.numberOfChannels;n++)r.copyToChannel(s.getChannelData(n).slice().reverse(),n,n);return r}const me=(s,e,r=s._base||"")=>Object.entries(s).forEach(([n,o])=>{if(typeof o=="string"&&(o=[o]),typeof o!="object")throw new Error("wrong sample map format for "+n);r=o._base||r;const a=l=>(r+l).replace("github:","https://raw.githubusercontent.com/");Array.isArray(o)?o=o.map(a):o=Object.fromEntries(Object.entries(o).map(([l,c])=>[l,(typeof c=="string"?[c]:c).map(a)])),e(n,o)});let ne={};function Ge(s){const e=Object.entries(ne).find(([r])=>s.startsWith(r));if(e)return e[1]}const we=async(s,e=s._base||"",r={})=>{if(typeof s=="string"){const a=Ge(s);if(a)return a(s);if(s.startsWith("github:")){let[c,h]=s.split("github:");h=h.endsWith("/")?h.slice(0,-1):h,s=`https://raw.githubusercontent.com/${h}/strudel.json`}if(typeof fetch!="function")return;const l=s.split("/").slice(0,-1).join("/");return typeof fetch>"u"?void 0:fetch(s).then(c=>c.json()).then(c=>we(c,e||c._base||l,r)).catch(c=>{throw console.error(c),new Error(`error loading "${s}"`)})}const{prebake:n,tag:o}=r;me(s,(a,l)=>te(a,(c,h,f)=>Xe(c,h,f,l),{type:"sample",samples:l,baseUrl:e,prebake:n,tag:o}),e)},$=[];async function Xe(s,e,r,n,o){const{s:a,freq:l,unit:c,nudge:h=0,cut:f,loop:d,clip:m=void 0,n:v=0,note:A,speed:T=1,begin:B=0,end:Y=1}=e;if(T===0)return;const F=C(),{attack:ke=.001,decay:Qe=.001,sustain:xe=1,release:Te=.001}=e,Le=s+h,Me=await be(a,v,A,T,l,n,o);if(F.currentTime>s||!Me)return;Me.playbackRate.value=Math.abs(T)*Me.playbackRate.value,c==="c"&&(Me.playbackRate.value=Me.playbackRate.value*Me.buffer.duration*1);const ot=B*Me.buffer.duration;Me.start(Le,ot);const Fe=Me.buffer.duration/Me.playbackRate.value,{node:Ve,stop:at}=ee(ke,Qe,xe,Te,1,s);Me.connect(Ve);const dt=F.createGain();Ve.connect(dt),Me.onended=function(){Me.disconnect(),Ve.disconnect(),dt.disconnect(),r()};const ct={node:dt,bufferSource:Me,stop:(nt,ft=m===void 0)=>{let it=nt;ft&&(it=s+(Y-B)*Fe),Me.stop(it+Te),at(it)}};if(f!==void 0){const nt=$[f];nt&&(nt.node.gain.setValueAtTime(1,Le),nt.node.gain.linearRampToValueAtTime(0,Le+.01)),$[f]=ct}return ct}function Ke(){["sine","square","triangle","sawtooth"].forEach(s=>{te(s,(e,r,n)=>{const{attack:o=.001,decay:a=.05,sustain:l=.6,release:c=.01}=r;let{n:h,note:f,freq:d}=r;h=f||h||36,typeof h=="string"&&(h=L(h)),!d&&typeof h=="number"&&(d=se(h));const{node:m,stop:v}=Ie({t:e,s,freq:d}),A=k(.3),{node:T,stop:B}=ee(o,a,l,c,1,e);return m.onended=()=>{m.disconnect(),A.disconnect(),n()},{node:m.connect(A).connect(T),stop:Y=>{B(Y),v(Y+c)}}},{type:"synth",prebake:!0})})}class Sound{constructor(e){z(this,"values");z(this,"unit",e=>(this.values.unit=e,this));z(this,"frequency",e=>(this.values.frequency=e,this));z(this,"nudge",e=>(this.values.nudge=e,this));z(this,"cut",e=>(this.values.cut=e,this));z(this,"loop",e=>(this.values.loop=e,this));z(this,"clip",e=>(this.values.clip=e,this));z(this,"n",e=>(this.values.n=e,this));z(this,"note",e=>(this.values.note=e,this));z(this,"speed",e=>(this.values.speed=e,this));z(this,"begin",e=>(this.values.begin=e,this));z(this,"end",e=>(this.values.end=e,this));z(this,"gain",e=>(this.values.gain=e,this));z(this,"cutoff",e=>(this.values.cutoff=e,this));z(this,"resonance",e=>(this.values.resonance=e,this));z(this,"hcutoff",e=>(this.values.hcutoff=e,this));z(this,"hresonance",e=>(this.values.hresonance=e,this));z(this,"bandf",e=>(this.values.bandf=e,this));z(this,"bandq",e=>(this.values.bandq=e,this));z(this,"coarse",e=>(this.values.coarse=e,this));z(this,"crush",e=>(this.values.crush=e,this));z(this,"shape",e=>(this.values.shape=e,this));z(this,"pan",e=>(this.values.pan=e,this));z(this,"vowel",e=>(this.values.vowel=e,this));z(this,"delay",e=>(this.values.delay=e,this));z(this,"delayfeedback",e=>(this.values.delayfeedback=e,this));z(this,"delaytime",e=>(this.values.delaytime=e,this));z(this,"orbit",e=>(this.values.orbit=e,this));z(this,"room",e=>(this.values.room=e,this));z(this,"size",e=>(this.values.size=e,this));z(this,"velocity",e=>(this.values.velocity=e,this));z(this,"out",()=>he(this.values,0));this.values={s:e}}}const cache=new LRUCache({max:1e3,ttl:1e3*60*5});Array.prototype.in=function(s){return this.includes(s)};Promise.all([ve(),we("github:tidalcycles/Dirt-Samples/master"),we("github:Bubobubobubobubo/Topos-Samples/main"),Ke()]);class UserAPI{constructor(e){z(this,"variables",{});z(this,"iterators",{});z(this,"_drunk",new DrunkWalk(-100,100,!1));z(this,"MidiConnection",new MidiConnection);z(this,"load");z(this,"s",this.script);z(this,"cs",this.clear_script);z(this,"cps",this.copy_script);z(this,"$",this.iterator);z(this,"v",this.variable);z(this,"dv",this.delete_variable);z(this,"cv",this.clear_variables);z(this,"rI",this.randI);z(this,"r",this.rand);z(this,"quant",this.quantize);z(this,"cmp",this.clamp);z(this,"tempo",this.bpm);z(this,"silence",this.stop);z(this,"hush",this.stop);z(this,"abs",Math.abs);z(this,"d",async(e,r=0)=>{he(e,r)});z(this,"sound",e=>new Sound(e));z(this,"samples",we);z(this,"log",console.log);z(this,"scale",scale);this.app=e,this.load=we("github:tidalcycles/Dirt-Samples/master")}get time(){return this.app.audioContext.currentTime}get mouseX(){return this.app._mouseX}get mouseY(){return this.app._mouseY}script(...e){e.forEach(r=>{tryEvaluate(this.app,this.app.universes[this.app.selected_universe].locals[r])})}clear_script(e){this.app.universes[this.app.selected_universe].locals[e]={candidate:"",committed:"",evaluations:0}}copy_script(e,r){this.app.universes[this.app.selected_universe].locals[r]=this.app.universes[this.app.selected_universe].locals[e]}midi_outputs(){return console.log(this.MidiConnection.listMidiOutputs()),this.MidiConnection.midiOutputs}midi_output(e){e?this.MidiConnection.switchMidiOutput(e):console.log(this.MidiConnection.getCurrentMidiPort())}note(e,r={}){const n=r.channel?r.channel:0,o=r.velocity?r.velocity:100,a=r.duration?r.duration:.5;this.MidiConnection.sendMidiNote(e,n,o,a)}sysex(e){this.MidiConnection.sendSysExMessage(e)}pitch_bend(e,r){this.MidiConnection.sendPitchBend(e,r)}program_change(e,r){this.MidiConnection.sendProgramChange(e,r)}midi_clock(){this.MidiConnection.sendMidiClock()}control_change({control:e=20,value:r=0,channel:n=0}){this.MidiConnection.sendMidiControlChange(e,r,n)}midi_panic(){this.MidiConnection.panic()}zn(e,r={}){const n=cachedPattern(e,r);if(n.hasStarted()){const o=n.peek(),a=o.modifiedEvent?o.modifiedEvent:o,l=r.channel?r.channel:0,c=r.velocity?r.velocity:100,h=r.sustain?r.sustain:.5;a instanceof Pitch?(a.bend&&this.MidiConnection.sendPitchBend(a.bend,l),this.MidiConnection.sendMidiNote(a.note,l,c,h),a.bend&&this.MidiConnection.sendPitchBend(8192,l)):a instanceof Chord&&a.pitches.forEach(f=>{f.bend&&this.MidiConnection.sendPitchBend(f.bend,l),this.MidiConnection.sendMidiNote(f.note,l,c,h),f.bend&&this.MidiConnection.sendPitchBend(8192,l)}),o.modifiedEvent&&(o.modifiedEvent=void 0)}return n.next()}iterator(e,r,n){return e in this.iterators?(this.iterators[e].limit!==r&&(this.iterators[e].value=0,this.iterators[e].limit=r),this.iterators[e].step!==n&&(this.iterators[e].step=n??this.iterators[e].step),this.iterators[e].value+=this.iterators[e].step,this.iterators[e].limit!==void 0&&this.iterators[e].value>this.iterators[e].limit&&(this.iterators[e].value=0)):this.iterators[e]={value:0,step:n??1,limit:r},this.iterators[e].value}get drunk(){return this._drunk.step(),this._drunk.getPosition()}set drunk(e){this._drunk.position=e}set drunk_max(e){this._drunk.max=e}set drunk_min(e){this._drunk.min=e}set drunk_wrap(e){this._drunk.toggleWrap(e)}variable(e,r){return typeof e=="string"&&r===void 0?this.variables[e]:(this.variables[e]=r,this.variables[e])}delete_variable(e){delete this.variables[e]}clear_variables(){this.variables={}}_sequence_key_generator(e){return btoa(JSON.stringify(e))}seqmod(...e){if(cache.has(this._sequence_key_generator(e))){let r=cache.get(this._sequence_key_generator(e));return r.options.currentIteration++,r.options.currentIteration===r.options.nextTarget&&(r.options.index++,r.options.nextTarget=e[r.options.index%e.length],r.options.currentIteration=0),cache.set(this._sequence_key_generator(e),{pattern:e,options:r.options}),r.options.currentIteration===0}else{let r={index:-1,nextTarget:this.app.clock.ticks_before_new_bar,currentIteration:0};return typeof e[e.length-1]=="object"&&(r={...e.pop(),...r}),r.nextTarget=this.app.clock.ticks_before_new_bar,r.currentIteration===r.nextTarget&&(r.index++,r.nextTarget=e[r.index%e.length],r.currentIteration=0),cache.set(this._sequence_key_generator(e),{pattern:e,options:r}),r.currentIteration===0}}seq(...e){if(cache.has(this._sequence_key_generator(e))){let r=cache.get(this._sequence_key_generator(e));return r.options.index+=1,cache.set(this._sequence_key_generator(e),r),r.pattern[r.options.index%r.pattern.length]}else{let r={index:0};return typeof e[e.length-1]=="object"&&(r={...e.pop(),...r}),cache.set(this._sequence_key_generator(e),{pattern:e,options:r}),cache.get(this._sequence_key_generator(e))}}pick(...e){return e[Math.floor(Math.random()*e.length)]}seqbeat(...e){return e[this.ebeat%e.length]}mel(e,r){return r[e%r.length]}seqbar(...e){return e[(this.app.clock.time_position.bar+1)%e.length]}seqpulse(...e){return e[this.app.clock.time_position.pulse%e.length]}randI(e,r){return Math.floor(Math.random()*(r-e+1))+e}rand(e,r){return Math.random()*(r-e)+e}quantize(e,r){if(r.length===0)return e;let n=r[0];return r.forEach(o=>{Math.abs(o-e)<Math.abs(n-e)&&(n=o)}),n}clamp(e,r,n){return Math.min(Math.max(e,r),n)}bpm(e){return e===void 0?this.app.clock.bpm:((e<1||e>500)&&console.log(`Setting bpm to ${e}`),this.app.clock.bpm=e,e)}bpb(e){return e===void 0?this.app.clock.time_signature[0]:(e<1&&console.log(`Setting bpb to ${e}`),this.app.clock.time_signature[0]=e,e)}ppqn(e){return e===void 0?this.app.clock.ppqn:(e<1&&console.log(`Setting ppqn to ${e}`),this.app.clock.ppqn=e,e)}time_signature(e,r){this.app.clock.time_signature=[e,r]}almostNever(){return Math.random()>.9}sometimes(){return Math.random()>.5}rarely(){return Math.random()>.75}often(){return Math.random()>.25}almostAlways(){return Math.random()>.1}dice(e){return Math.floor(Math.random()*e)+1}get i(){return this.app.universes[this.app.selected_universe].global.evaluations}set i(e){this.app.universes[this.app.selected_universe].global.evaluations=e}get bar(){return this.app.clock.time_position.bar}get tick(){return this.app.clock.tick}get pulse(){return this.app.clock.time_position.pulse}get beat(){return this.app.clock.time_position.beat}get ebeat(){return this.app.clock.beats_since_origin}get epulse(){return this.app.clock.pulses_since_origin}onbar(e,...r){const n=[...Array(e).keys()].map(o=>o+1);return console.log(r.some(o=>n.includes(o%e))),r.some(o=>n.includes(o%e))}onbeat(...e){let r=[];return e.forEach(n=>{n=n%this.app.clock.time_signature[0]+1;let o=Math.floor(n),a=n-o;r.push(o===this.app.clock.time_position.beat&&this.app.clock.time_position.pulse===a*this.app.clock.ppqn)}),r.some(n=>n==!0)}stop(){this.app.clock.pause(),this.app.setButtonHighlighting("pause",!0)}prob(e){return Math.random()*100<e}toss(){return Math.random()>.5}min(...e){return Math.min(...e)}max(...e){return Math.max(...e)}limit(e,r,n){return Math.min(Math.max(e,r),n)}delay(e,r){setTimeout(r,e)}delayr(e,r,n){[...Array(r).keys()].map(a=>e*a).forEach((a,l)=>{setTimeout(n,a)})}mod(...e){return e.some(r=>this.app.clock.time_position.pulse%r===0)}modbar(...e){return e.some(r=>this.app.clock.time_position.bar%r===0)}euclid(e,r,n,o=0){return this._euclidean_cycle(r,n,o)[e%n]}_euclidean_cycle(e,r,n=0){function o(c,h){const f=c.length,d=(h+1)%f;return c[h]>c[d]}if(e>=r)return[!0];const a=Array.from({length:r},(c,h)=>(e*(h-1)%r+r)%r);let l=a.map((c,h)=>o(a,h));return n!=0&&(l=l.slice(n).concat(l.slice(0,n))),l}bin(e,r){let o=r.toString(2).split("").map(a=>a==="1");return o[e%o.length]}gold(){}line(e,r,n=1){const o=[];if(r>e&&n>0||r<e&&n<0)for(let a=e;a<=r;a+=n)o.push(a);else console.error("Invalid range or step provided.");return o}sine(e=1,r=0){return Math.sin(this.app.clock.ctx.currentTime*Math.PI*2*e)+r}usine(e=1,r=0){return(this.sine(e,r)+1)/2}saw(e=1,r=0){return this.app.clock.ctx.currentTime*e%1*2-1+r}usaw(e=1,r=0){return(this.saw(e,r)+1)/2}triangle(e=1,r=0){return Math.abs(this.saw(e,r))*2-1}utriangle(e=1,r=0){return(this.triangle(e,r)+1)/2}square(e=1,r=0){return this.saw(e,r)>0?1:-1}usquare(e=1,r=0){return(this.square(e,r)+1)/2}noise(){return Math.random()*2-1}rate(e){}}class Editor{constructor(){z(this,"universes",template_universes);z(this,"selected_universe");z(this,"local_index",1);z(this,"editor_mode","local");z(this,"fontSize");z(this,"withLineNumbers");z(this,"vimModeCompartment");z(this,"chosenLanguage");z(this,"settings",new AppSettings);z(this,"editorExtensions",[]);z(this,"userPlugins",[]);z(this,"state");z(this,"api");z(this,"audioContext");z(this,"view");z(this,"clock");z(this,"manualPlay",!1);z(this,"_mouseX",0);z(this,"_mouseY",0);z(this,"play_buttons",[document.getElementById("play-button-1"),document.getElementById("play-button-2")]);z(this,"pause_buttons",[document.getElementById("pause-button-1"),document.getElementById("pause-button-2")]);z(this,"stop_buttons",[document.getElementById("stop-button-1"),document.getElementById("stop-button-2")]);z(this,"clear_buttons",[document.getElementById("clear-button-1"),document.getElementById("clear-button-2")]);z(this,"local_button",document.getElementById("local-button"));z(this,"global_button",document.getElementById("global-button"));z(this,"init_button",document.getElementById("init-button"));z(this,"note_button",document.getElementById("note-button"));z(this,"settings_button",document.getElementById("settings-button"));z(this,"close_settings_button",document.getElementById("close-settings-button"));z(this,"universe_viewer",document.getElementById("universe-viewer"));z(this,"buffer_modal",document.getElementById("modal-buffers"));z(this,"buffer_search",document.getElementById("buffer-search"));z(this,"local_script_tabs",document.getElementById("local-script-tabs"));z(this,"font_size_slider",document.getElementById("font-size-slider"));z(this,"font_size_witness",document.getElementById("font-size-witness"));z(this,"line_numbers_checkbox",document.getElementById("show-line-numbers"));z(this,"normal_mode_button",document.getElementById("normal-mode"));z(this,"vim_mode_button",document.getElementById("vim-mode"));this.selected_universe=this.settings.selected_universe,this.universe_viewer.innerHTML=`Topos: ${this.selected_universe}`,this.universes={...template_universes,...this.settings.universes},this.audioContext=new AudioContext({latencyHint:"playback"}),this.clock=new Clock(this,this.audioContext),this.api=new UserAPI(this),this.vimModeCompartment=new Compartment,this.withLineNumbers=new Compartment,this.chosenLanguage=new Compartment,this.fontSize=new Compartment;const e=this.settings.vimMode?vim():[],r=this.settings.line_numbers?lineNumbers():[],n=EditorView.theme({"&":{fontSize:`${this.settings.font_size}px`},".cm-gutters":{fontSize:`${this.settings.font_size}px`}});this.editorExtensions=[this.withLineNumbers.of(r),this.fontSize.of(n),this.vimModeCompartment.of(e),editorSetup,oneDark,this.chosenLanguage.of(javascript()),EditorView.updateListener.of(l=>{})];let o=new Compartment;this.state=EditorState.create({extensions:[...this.editorExtensions,EditorView.lineWrapping,o.of(this.userPlugins)],doc:this.universes[this.selected_universe].locals[this.local_index].candidate}),this.view=new EditorView({parent:document.getElementById("editor"),state:this.state}),document.addEventListener("keydown",l=>{l.key==="Tab"&&l.preventDefault(),l.ctrlKey&&l.key==="s"&&(l.preventDefault(),this.setButtonHighlighting("pause",!0),this.clock.pause()),l.ctrlKey&&l.key==="r"&&(l.preventDefault(),this.setButtonHighlighting("stop",!0),this.clock.stop()),l.ctrlKey&&l.key==="p"&&(l.preventDefault(),this.setButtonHighlighting("play",!0),this.clock.start()),(l.key==="v"||l.key==="V")&&l.ctrlKey&&l.shiftKey&&(this.settings.vimMode=!this.settings.vimMode,l.preventDefault(),this.userPlugins=this.settings.vimMode?[]:[vim()],this.view.dispatch({effects:o.reconfigure(this.userPlugins)})),(l.key==="Enter"||l.key==="Return")&&l.ctrlKey&&(l.preventDefault(),this.currentFile().candidate=this.view.state.doc.toString(),this.flashBackground("#2d313d",200)),(l.key==="Enter"&&l.shiftKey||l.key==="e"&&l.ctrlKey)&&(l.preventDefault(),this.currentFile().candidate=this.view.state.doc.toString(),this.flashBackground("#2d313d",200)),l.ctrlKey&&l.key==="b"&&this.openBuffersModal(),l.shiftKey&&l.key==="Escape"&&this.openSettingsModal(),l.ctrlKey&&l.key==="l"&&(l.preventDefault(),this.changeModeFromInterface("local"),this.view.focus()),l.ctrlKey&&l.key==="n"&&(l.preventDefault(),this.changeModeFromInterface("notes"),this.view.focus()),l.ctrlKey&&l.key==="g"&&(l.preventDefault(),this.changeModeFromInterface("global"),this.view.focus()),l.ctrlKey&&l.key==="i"&&(l.preventDefault(),this.changeModeFromInterface("init"),this.changeToLocalBuffer(0),this.view.focus()),[112,113,114,115,116,117,118,119,120].forEach((c,h)=>{l.keyCode===c&&(l.preventDefault(),l.ctrlKey?this.api.script(c-111):(this.changeModeFromInterface("local"),this.changeToLocalBuffer(h)))}),l.keyCode==121&&this.changeModeFromInterface("global"),l.keyCode==122&&this.changeModeFromInterface("init")});const a=document.querySelectorAll('[id^="tab-"]');for(let l=0;l<a.length;l++)a[l].addEventListener("click",c=>{a[l].classList.add("bg-orange-300");for(let d=0;d<a.length;d++)d!=l&&a[d].classList.remove("bg-orange-300");this.currentFile().candidate=this.view.state.doc.toString();let f=c.target.id.split("-")[1];this.local_index=parseInt(f),this.updateEditorView()});this.play_buttons.forEach(l=>{l.addEventListener("click",()=>{this.setButtonHighlighting("play",!0),this.clock.start()})}),this.clear_buttons.forEach(l=>{l.addEventListener("click",()=>{this.setButtonHighlighting("clear",!0),confirm("Do you want to reset the current universe?")&&(this.universes[this.selected_universe]=template_universe,this.updateEditorView())})}),this.pause_buttons.forEach(l=>{l.addEventListener("click",()=>{this.setButtonHighlighting("pause",!0),this.clock.pause()})}),this.stop_buttons.forEach(l=>{l.addEventListener("click",()=>{this.setButtonHighlighting("stop",!0),this.clock.stop()})}),this.local_button.addEventListener("click",()=>this.changeModeFromInterface("local")),this.global_button.addEventListener("click",()=>this.changeModeFromInterface("global")),this.init_button.addEventListener("click",()=>this.changeModeFromInterface("init")),this.note_button.addEventListener("click",()=>this.changeModeFromInterface("notes")),this.settings_button.addEventListener("click",()=>{var h;this.font_size_slider.value=this.settings.font_size.toString(),this.font_size_witness.innerHTML=`Font Size: ${this.settings.font_size}px`,(h=this.font_size_witness)==null||h.setAttribute("style",`font-size: ${this.settings.font_size}px;`),this.line_numbers_checkbox.checked=this.settings.line_numbers;let l=document.getElementById("modal-settings"),c=document.getElementById("editor");l==null||l.classList.remove("invisible"),c==null||c.classList.add("invisible")}),this.close_settings_button.addEventListener("click",()=>{let l=document.getElementById("modal-settings"),c=document.getElementById("editor");l==null||l.classList.add("invisible"),c==null||c.classList.remove("invisible")}),this.font_size_slider.addEventListener("input",()=>{const l=this.font_size_slider.value;this.settings.font_size=parseInt(l),this.font_size_witness.style.fontSize=`${l}px`,this.font_size_witness.innerHTML=`Font Size: ${l}px`;let c=EditorView.theme({"&":{fontSize:l+"px"},".cm-gutters":{fontSize:l+"px"}});this.view.dispatch({effects:this.fontSize.reconfigure(c)}),this.settings.font_size=parseInt(l)}),this.normal_mode_button.addEventListener("click",()=>{this.settings.vimMode=!1,this.view.dispatch({effects:this.vimModeCompartment.reconfigure([])})}),this.line_numbers_checkbox.addEventListener("change",()=>{let l=!!this.line_numbers_checkbox.checked;this.settings.line_numbers=l,this.view.dispatch({effects:this.withLineNumbers.reconfigure(l?[lineNumbers()]:[])})}),this.vim_mode_button.addEventListener("click",()=>{this.settings.vimMode=!0,this.view.dispatch({effects:this.vimModeCompartment.reconfigure(vim())})}),this.buffer_search.addEventListener("keydown",l=>{if(l.key==="Enter"){let c=this.buffer_search.value;c.length>2&&c.length<20&&(this.loadUniverse(c),this.settings.selected_universe=c,this.buffer_search.value="",this.closeBuffersModal(),this.view.focus())}}),tryEvaluate(this,this.universes[this.selected_universe.toString()].init)}get note_buffer(){return this.universes[this.selected_universe.toString()].notes}get global_buffer(){return this.universes[this.selected_universe.toString()].global}get init_buffer(){return this.universes[this.selected_universe.toString()].init}get local_buffer(){return this.universes[this.selected_universe.toString()].locals[this.local_index]}changeToLocalBuffer(e){const r=document.querySelectorAll('[id^="tab-"]'),n=r[e];n.classList.add("bg-orange-300");for(let a=0;a<r.length;a++)a!=e&&r[a].classList.remove("bg-orange-300");let o=n.id.split("-")[1];this.local_index=parseInt(o),this.updateEditorView()}changeModeFromInterface(e){const r=[this.local_button,this.global_button,this.init_button,this.note_button];let n=o=>{r.forEach(a=>{let l=a.children[0];l.classList.contains("text-orange-300")&&(l.classList.remove("text-orange-300"),a.classList.remove("text-orange-300"))}),o.children[0].classList.remove("text-white"),o.children[0].classList.add("text-orange-300"),o.classList.add("text-orange-300")};switch(e){case"local":this.local_script_tabs.classList.contains("hidden")&&this.local_script_tabs.classList.remove("hidden"),this.editor_mode="local",this.local_index=0,this.changeToLocalBuffer(this.local_index),n(this.local_button);break;case"global":this.local_script_tabs.classList.contains("hidden")||this.local_script_tabs.classList.add("hidden"),this.editor_mode="global",n(this.global_button);break;case"init":this.local_script_tabs.classList.contains("hidden")||this.local_script_tabs.classList.add("hidden"),this.editor_mode="init",n(this.init_button);break;case"notes":this.local_script_tabs.classList.contains("hidden")||this.local_script_tabs.classList.add("hidden"),this.editor_mode="notes",n(this.note_button);break}this.view.dispatch({effects:this.chosenLanguage.reconfigure(this.editor_mode=="notes"?[markdown()]:[javascript()])}),this.updateEditorView()}setButtonHighlighting(e,r){this.flashBackground("#2d313d",200);const n=['[id^="play-button-"]','[id^="pause-button-"]','[id^="clear-button-"]','[id^="stop-button-"]'];let o;switch(e){case"play":o=0;break;case"pause":o=1;break;case"clear":o=2;break;case"stop":o=3;break}document.querySelectorAll(n[o]).forEach(a=>{r&&a.children[0].classList.add("fill-orange-300")}),document.querySelectorAll(n.filter((a,l)=>l!=o).join(",")).forEach(a=>{a.children[0].classList.remove("fill-orange-300"),a.children[0].classList.remove("text-orange-300"),a.children[0].classList.remove("bg-orange-300")})}unfocusPlayButtons(){document.querySelectorAll('[id^="play-button-"]').forEach(e=>{e.children[0].classList.remove("fill-orange-300")})}updateEditorView(){this.view.dispatch({changes:{from:0,to:this.view.state.doc.toString().length,insert:this.currentFile().candidate}})}currentFile(){switch(this.editor_mode){case"global":return this.global_buffer;case"local":return this.local_buffer;case"init":return this.init_buffer;case"notes":return this.note_buffer}}loadUniverse(e){this.currentFile().candidate=this.view.state.doc.toString();let r=e.trim();this.universes[r]===void 0&&(this.universes[r]=template_universe),this.selected_universe=r,this.settings.selected_universe=this.selected_universe,this.universe_viewer.innerHTML=`Topos: ${r}`,this.updateEditorView(),tryEvaluate(this,this.universes[this.selected_universe.toString()].init)}openSettingsModal(){document.getElementById("modal-settings").classList.contains("invisible")?(document.getElementById("editor").classList.add("invisible"),document.getElementById("modal-settings").classList.remove("invisible")):this.closeSettingsModal()}closeSettingsModal(){document.getElementById("editor").classList.remove("invisible"),document.getElementById("modal-settings").classList.add("invisible")}openBuffersModal(){document.getElementById("modal-buffers").classList.contains("invisible")?(document.getElementById("editor").classList.add("invisible"),document.getElementById("modal-buffers").classList.remove("invisible"),document.getElementById("buffer-search").focus()):this.closeBuffersModal()}closeBuffersModal(){document.getElementById("buffer-search").value="",document.getElementById("editor").classList.remove("invisible"),document.getElementById("modal").classList.add("invisible"),document.getElementById("modal-buffers").classList.add("invisible")}flashBackground(e,r){this.view.dom.style.backgroundColor=e;const n=this.view.dom.getElementsByClassName("cm-gutter");Array.from(n).forEach(o=>o.style.backgroundColor=e),setTimeout(()=>{this.view.dom.style.backgroundColor="",Array.from(n).forEach(o=>o.style.backgroundColor="")},r)}}const app=new Editor;function startClock(){document.getElementById("editor").classList.remove("invisible"),document.getElementById("modal").classList.add("hidden"),document.getElementById("modal-container").classList.remove("motion-safe:animate-pulse"),document.getElementById("start-button").removeEventListener("click",startClock),document.removeEventListener("click",startClock),document.removeEventListener("keydown",startOnEnter),document.removeEventListener("click",startOnClick),app.clock.start(),app.view.focus(),app.setButtonHighlighting("play",!0)}function startOnEnter(s){(s.code==="Enter"||s.code==="Space")&&startClock()}function startOnClick(s){s.button===0&&startClock()}document.addEventListener("keydown",startOnEnter);document.addEventListener("click",startOnClick);function reportMouseCoordinates(s){app._mouseX=s.clientX,app._mouseY=s.clientY}window.addEventListener("mousemove",reportMouseCoordinates);window.addEventListener("beforeunload",()=>(event.preventDefault(),app.currentFile().candidate=app.view.state.doc.toString(),app.currentFile().committed=app.view.state.doc.toString(),app.settings.saveApplicationToLocalStorage(app.universes,app.settings),app.clock.stop(),null));
|