diff --git a/README.md b/README.md index 637602bd..5955eac5 100644 --- a/README.md +++ b/README.md @@ -58,3 +58,6 @@ Some may be removed pending user feedback: Use `.cm-mw-template-ground.cm-html-entity` instead. * Line-level styling for ``, `
`, and any tag without an associated
   TagMode has been removed.
+* The browser's native search functionality (ala Ctrl+F) has been replaced with
+  search functionality built into CodeMirror. This is necessary to maintain
+  performance (see [T303664](https://phabricator.wikimedia.org/T303664)).
diff --git a/extension.json b/extension.json
index f135e9fc..967c6c95 100644
--- a/extension.json
+++ b/extension.json
@@ -176,7 +176,8 @@
 				"web2017-polyfills",
 				"mediawiki.api",
 				"mediawiki.user",
-				"user.options"
+				"user.options",
+				"ext.CodeMirror.v6.messages"
 			],
 			"packageFiles": [
 				"dist/main.js"
@@ -189,6 +190,20 @@
 			"messages": [
 				"codemirror-toggle-label"
 			]
+		},
+		"ext.CodeMirror.v6.messages": {
+			"messages": [
+				"codemirror-find",
+				"codemirror-next",
+				"codemirror-previous",
+				"codemirror-all",
+				"codemirror-match-case",
+				"codemirror-regexp",
+				"codemirror-by-word",
+				"codemirror-replace",
+				"codemirror-replace-placeholder",
+				"codemirror-replace-all"
+			]
 		}
 	},
 	"ResourceFileModulePaths": {
diff --git a/i18n/de.json b/i18n/de.json
index f3570b3d..39205ca9 100644
--- a/i18n/de.json
+++ b/i18n/de.json
@@ -10,5 +10,14 @@
 	"codemirror-toggle-label": "Syntaxhervorhebung",
 	"codemirror-prefs-colorblind": "Farbenfehlsichtigenfreundliches Schema für die Syntaxhervorhebung bei der Bearbeitung von Wikitext einschalten",
 	"codemirror-prefs-colorblind-help": "Wenn du ein Helferlein zur Syntaxhervorhebung verwendest, wird diese Einstellung nicht funktionieren.",
+	"codemirror-find": "Suchen",
+	"codemirror-next": "nächste",
+	"codemirror-previous": "vorherige",
+	"codemirror-all": "alle",
+	"codemirror-match-case": "groß/klein beachten",
+	"codemirror-by-word": "ganze Wörter",
+	"codemirror-replace": "ersetzen",
+	"codemirror-replace-placeholder": "Ersetzen",
+	"codemirror-replace-all": "alle ersetzen",
 	"prefs-accessibility": "Barrierefreiheit"
 }
diff --git a/i18n/en.json b/i18n/en.json
index cbed392e..f7707e09 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -8,5 +8,15 @@
 	"codemirror-toggle-label": "Syntax highlighting",
 	"codemirror-prefs-colorblind": "Enable colorblind-friendly scheme for syntax highlighting when editing wikitext",
 	"codemirror-prefs-colorblind-help": "If you use a gadget for syntax highlighting, this preference will not work.",
+	"codemirror-find": "Find",
+	"codemirror-next": "next",
+	"codemirror-previous": "previous",
+	"codemirror-all": "all",
+	"codemirror-match-case": "match case",
+	"codemirror-regexp": "regexp",
+	"codemirror-by-word": "by word",
+	"codemirror-replace": "replace",
+	"codemirror-replace-placeholder": "Replace",
+	"codemirror-replace-all": "replace all",
 	"prefs-accessibility": "Accessibility"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index dd446975..3135e3ef 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -12,5 +12,15 @@
 	"codemirror-toggle-label": "Title tooltip for button to toggle CodeMirror in the editing toolbar.",
 	"codemirror-prefs-colorblind": "Used in user preferences as label for enabling the colorblind-friendly option.",
 	"codemirror-prefs-colorblind-help": "Used in user preferences as remark on the colorblind-friendly option.",
+	"codemirror-find": "Placeholder text for the input in the CodeMirror search dialog.",
+	"codemirror-next": "Label for the 'Next' button in the CodeMirror search dialog.",
+	"codemirror-previous": "Label for the 'Previous' button in the CodeMirror search dialog.",
+	"codemirror-all": "Label for the 'All' button in the CodeMirror search dialog.",
+	"codemirror-match-case": "Label for the 'match case' option in the CodeMirror search dialog.",
+	"codemirror-regexp": "Label for the 'regexp' button in the CodeMirror search dialog. This enables the user to search using regular expressions.",
+	"codemirror-by-word": "Label for the 'by word' button in the CodeMirror search dialog.",
+	"codemirror-replace": "Label for the 'replace' button in the CodeMirror search dialog.",
+	"codemirror-replace-placeholder": "Placeholder text for the 'Replace' input in the CodeMirror search dialog.",
+	"codemirror-replace-all": "Label for the 'replace all' button in the CodeMirror search dialog.",
 	"prefs-accessibility": "Section heading in the user prefences for accessibility topics."
 }
diff --git a/resources/dist/main.js b/resources/dist/main.js
index 6153f1b9..b826dd93 100644
--- a/resources/dist/main.js
+++ b/resources/dist/main.js
@@ -1,2 +1,2 @@
-(()=>{"use strict";class t{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,n){let s=[];return this.decompose(0,t,s,2),n.length&&n.decompose(0,n.length,s,3),this.decompose(e,this.length,s,1),i.from(s,this.length-(e-t)+n.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){let n=[];return this.decompose(t,e,n,0),i.from(n,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),n=new r(this),s=new r(t);for(let t=e,r=e;;){if(n.next(t),s.next(t),t=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(r+=n.value.length,n.done||r>=i)return!0}}iter(t=1){return new r(this,t)}iterRange(t,e=this.length){return new o(this,t,e)}iterLines(t,e){let i;if(null==t)i=this.iter();else{null==e&&(e=this.lines+1);let n=this.line(t).from;i=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new l(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(n){if(0==n.length)throw new RangeError("A document must have at least one line");return 1!=n.length||n[0]?n.length<=32?new e(n):i.from(e.split(n,[])):t.empty}}class e extends t{constructor(t,e=function(t){let e=-1;for(let i of t)e+=i.length+1;return e}(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,n){for(let s=0;;s++){let r=this.text[s],o=n+r.length;if((e?i:o)>=t)return new a(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let l=t<=0&&i>=this.length?this:new e(s(this.text,t,i),Math.min(i,this.length)-Math.max(0,t));if(1&o){let t=r.pop(),i=n(l.text,t.text.slice(),0,l.length);if(i.length<=32)r.push(new e(i,t.length+l.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(l)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let l=n(this.text,n(o.text,s(this.text,0,t)),r),a=this.length+o.length-(r-t);return l.length<=32?new e(l,a):i.from(e.split(l,[]),a)}sliceString(t,e=this.length,i="\n"){let n="";for(let s=0,r=0;s<=e&&rt&&r&&(n+=i),ts&&(n+=o.slice(Math.max(0,t-s),e-s)),s=l+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,i){let n=[],s=-1;for(let r of t)n.push(r),s+=r.length+1,32==n.length&&(i.push(new e(n,s)),n=[],s=-1);return s>-1&&i.push(new e(n,s)),i}}class i extends t{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let e of t)this.lines+=e.lines}lineInner(t,e,i,n){for(let s=0;;s++){let r=this.children[s],o=n+r.length,l=i+r.lines-1;if((e?l:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=l+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(l>=e?2:0));r>=t&&l<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=l+1}}replace(t,e,n){if(n.lines=r&&e<=l){let a=o.replace(t-r,e-r,n),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let r=this.children.slice();return r[s]=a,new i(r,this.length-(e-t)+n.length)}return super.replace(r,l,a)}r=l+1}return super.replace(t,e,n)}sliceString(t,e=this.length,i="\n"){let n="";for(let s=0,r=0;st&&s&&(n+=i),tr&&(n+=o.sliceString(t-r,e-r,i)),r=l+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof i))return 0;let n=0,[s,r,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=e,r+=e){if(s==o||r==l)return n;let i=this.children[s],a=t.children[r];if(i!=a)return n+i.scanIdentical(a,e);n+=i.length+1}}static from(t,n=t.reduce(((t,e)=>t+e.length+1),-1)){let s=0;for(let e of t)s+=e.lines;if(s<32){let i=[];for(let e of t)e.flatten(i);return new e(i,n)}let r=Math.max(32,s>>5),o=r<<1,l=r>>1,a=[],h=0,c=-1,u=[];function f(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)f(e);else t.lines>l&&(h>l||!h)?(d(),a.push(t)):t instanceof e&&h&&(n=u[u.length-1])instanceof e&&t.lines+n.lines<=32?(h+=t.lines,c+=t.length+1,u[u.length-1]=new e(n.text.concat(t.text),n.length+1+t.length)):(h+t.lines>r&&d(),h+=t.lines,c+=t.length+1,u.push(t))}function d(){0!=h&&(a.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)f(e);return d(),1==a.length?a[0]:new i(a,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(a>n&&(l=l.slice(0,n-s)),s0?1:(t instanceof e?t.text.length:t.children.length)<<1]}nextInner(t,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,s=this.nodes[n],r=this.offsets[n],o=r>>1,l=s instanceof e?s.text.length:s.children.length;if(o==(i>0?l:0)){if(0==n)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(i>0?0:1)){if(this.offsets[n]+=i,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(s instanceof e){let e=s.text[o+(i<0?-1:0)];if(this.offsets[n]+=i,e.length>Math.max(0,t))return this.value=0==t?e:i>0?e.slice(t):e.slice(0,e.length-t),this;t-=e.length}else{let r=s.children[o+(i<0?-1:0)];t>r.length?(t-=r.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(i>0?1:(r instanceof e?r.text.length:r.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class o{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new r(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=i?n:e<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class l{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:n}=this.inner.next(t);return e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(t.prototype[Symbol.iterator]=function(){return this.iter()},r.prototype[Symbol.iterator]=o.prototype[Symbol.iterator]=l.prototype[Symbol.iterator]=function(){return this});class a{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}}let h="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2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,,,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((t=>t?parseInt(t,36):1));for(let t=1;tt)return h[e-1]<=t;return!1}function u(t){return t>=127462&&t<=127487}const f=8205;function d(t,e,i=!0,n=!0){return(i?p:g)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&m(t.charCodeAt(e))&&w(t.charCodeAt(e-1))&&e--;let n=y(t,e);for(e+=k(n);e=0&&u(y(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function g(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function w(t){return t>=55296&&t<56320}function y(t,e){let i=t.charCodeAt(e);if(!w(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return m(n)?n-56320+(i-55296<<10)+65536:i}function v(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function k(t){return t<65536?1:2}const b=/\r\n?|\n/;var x=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(x||(x={}));class S{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=x.Simple&&a>=t&&(i==x.TrackDel&&nt||i==x.TrackBefore&&nt))return null;if(a>t||a==t&&e<0&&!o)return t==n||e<0?s:s+l;s+=l}n=a}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return s}touchesRange(t,e=t){for(let i=0,n=0;i=0&&n<=e&&s>=t)return!(ne)||"cover";n=s}return!1}toString(){let t="";for(let e=0;e=0?":"+n:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some((t=>"number"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new S(t)}static create(t){return new S(t)}}class A extends S{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return C(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return O(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=l,i[s+1]=o;let a=s>>1;for(;n.length0&&T(i,e,s.text),s.forward(t),o+=t}let a=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,l=null;function a(t=!1){if(!t&&!s.length)return;ol||e<0||l>i)throw new RangeError(`Invalid change range ${e} to ${l} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||b)):c:t.empty,f=u.length;if(e==l&&0==f)return;eo&&M(s,e-o,-1),M(s,l-e,f),T(r,s,u),o=l}}(e),a(!l),l}static empty(t){return new A(t?[t,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let s=0;se&&"string"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)i.push(r[0],0);else{for(;n.length=0&&i<=0&&i==t[s+1]?t[s]+=e:0==e&&0==t[s]?t[s+1]+=i:n?(t[s]+=e,t[s+1]+=i):t.push(e,i)}function T(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||l==e.sections.length||e.sections[l+1]<0);)a=e.sections[l++],h=e.sections[l++];i(r,c,o,u,f),r=c,o=u}}}function O(t,e,i,n=!1){let s=[],r=n?[]:null,o=new E(t),l=new E(e);for(let t=-1;;)if(-1==o.ins&&-1==l.ins){let t=Math.min(o.len,l.len);M(s,t,-1),o.forward(t),l.forward(t)}else if(l.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(l.len=0&&t=0)){if(o.done&&l.done)return r?A.createSet(s,r):S.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==l.ins){let t=Math.min(i,l.len);e+=t,i-=t,l.forward(t)}else{if(!(0==l.ins&&l.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else M(n,0,o.ins,t),s&&T(s,n,o.text),o.next()}}class E{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return i>=e.length?t.empty:e[i]}textBit(e){let{inserted:i}=this.set,n=this.i-2>>1;return n>=i.length&&!e?t.empty:i[n].slice(this.off,null==e?void 0:this.off+e)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class L{constructor(t,e,i){this.from=t,this.to=e,this.flags=i}get anchor(){return 16&this.flags?this.to:this.from}get head(){return 16&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 4&this.flags?-1:8&this.flags?1:0}get bidiLevel(){let t=3&this.flags;return 3==t?null:t}get goalColumn(){let t=this.flags>>5;return 33554431==t?void 0:t}map(t,e=-1){let i,n;return this.empty?i=n=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new L(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return B.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return B.range(this.anchor,i)}eq(t){return this.anchor==t.anchor&&this.head==t.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return B.range(t.anchor,t.head)}static create(t,e,i){return new L(t,e,i)}}class B{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:B.create(this.ranges.map((i=>i.map(t,e))),this.mainIndex)}eq(t){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let e=0;et.toJSON())),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new B(t.ranges.map((t=>L.fromJSON(t))),t.main)}static single(t,e=t){return new B([B.range(t,e)],0)}static create(t,e=0){if(0==t.length)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;nt?4:0)|s)}static normalized(t,e=0){let i=t[e];t.sort(((t,e)=>t.from-e.from)),e=t.indexOf(i);for(let i=1;in.head?B.range(o,r):B.range(r,o))}}return new B(t,e)}}function P(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let N=0;class R{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=N++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new R(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:I),!!t.static,t.enables)}of(t){return new H([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new H(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new H(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function I(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class H{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=N++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,l=!1,a=!1,h=[];for(let i of this.dependencies)"doc"==i?l=!0:"selection"==i?a=!0:0==(1&(null!==(e=t[i.id])&&void 0!==e?e:1))&&h.push(t[i.id]);return{create:t=>(t.values[r]=i(t),1),update(t,e){if(l&&e.docChanged||a&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!z(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let l,a=e.config.address[s];if(null!=a){let s=X(e,a);if(this.dependencies.every((i=>i instanceof R?e.facet(i)===t.facet(i):!(i instanceof _)||e.field(i,!1)==t.field(i,!1)))||(o?z(l=i(t),s,n):n(l=i(t),s)))return t.values[r]=s,0}else l=i(t);return t.values[r]=l,1}}}}function z(t,e,i){if(t.length!=e.length)return!1;for(let n=0;nt[e.id])),s=i.map((t=>t.type)),r=n.filter((t=>!(1&t))),o=t[e.id]>>1;function l(t){let i=[];for(let e=0;et===e),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(F).find((t=>t.field==this));return((null==e?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:t=>(t.values[e]=this.create(t),1),update:(t,i)=>{let n=t.values[e],s=this.updateF(n,i);return this.compareF(n,s)?0:(t.values[e]=s,1)},reconfigure:(t,i)=>null!=i.config.address[this.id]?(t.values[e]=i.field(this),0):(t.values[e]=this.create(t),1)}}init(t){return[this,F.of({field:this,create:t})]}get extension(){return this}}function q(t){return e=>new K(e,t)}const j={highest:q(0),high:q(1),default:q(2),low:q(3),lowest:q(4)};class K{constructor(t,e){this.inner=t,this.prec=e}}class G{of(t){return new U(this,t)}reconfigure(t){return G.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class U{constructor(t,e){this.compartment=t,this.inner=e}}class J{constructor(t,e,i,n,s,r){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=n,this.staticValues=s,this.facets=r,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,i){let n=[],s=Object.create(null),r=new Map;for(let i of function(t,e,i){let n=[[],[],[],[],[]],s=new Map;return function t(r,o){let l=s.get(r);if(null!=l){if(l<=o)return;let t=n[l].indexOf(r);t>-1&&n[l].splice(t,1),r instanceof U&&i.delete(r.compartment)}if(s.set(r,o),Array.isArray(r))for(let e of r)t(e,o);else if(r instanceof U){if(i.has(r.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(r.compartment)||r.inner;i.set(r.compartment,n),t(n,o)}else if(r instanceof K)t(r.inner,r.prec);else if(r instanceof _)n[o].push(r),r.provides&&t(r.provides,o);else if(r instanceof H)n[o].push(r),r.facet.extensions&&t(r.facet.extensions,2);else{let e=r.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${r}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);t(e,o)}}(t,2),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof _?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),l=[],a=[];for(let t of n)o[t.id]=a.length<<1,a.push((e=>t.slot(e)));let h=null==i?void 0:i.config.facets;for(let t in s){let e=s[t],n=e[0].facet,r=h&&h[t]||[];if(e.every((t=>0==t.type)))if(o[n.id]=l.length<<1|1,I(r,e))l.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));l.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=l.length<<1|1,l.push(t.value)):(o[t.id]=a.length<<1,a.push((e=>t.dynamicSlot(e))));o[n.id]=a.length<<1,a.push((t=>V(t,n,e)))}}let c=a.map((t=>t(o)));return new J(t,r,c,o,l,s)}}function Y(t,e){if(1&e)return 2;let i=e>>1,n=t.status[i];if(4==n)throw new Error("Cyclic dependency between fields and/or facets");if(2&n)return n;t.status[i]=4;let s=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|s}function X(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const Q=R.define(),Z=R.define({combine:t=>t.some((t=>t)),static:!0}),tt=R.define({combine:t=>t.length?t[0]:void 0,static:!0}),et=R.define(),it=R.define(),nt=R.define(),st=R.define({combine:t=>!!t.length&&t[0]});class rt{constructor(t,e){this.type=t,this.value=e}static define(){return new ot}}class ot{of(t){return new rt(this,t)}}class lt{constructor(t){this.map=t}of(t){return new at(this,t)}}class at{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return void 0===e?void 0:e==this.value?this:new at(this.type,e)}is(t){return this.type==t}static define(t={}){return new lt(t.map||(t=>t))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let n of t){let t=n.map(e);t&&i.push(t)}return i}}at.reconfigure=at.define(),at.appendConfig=at.define();class ht{constructor(t,e,i,n,s,r){this.startState=t,this.changes=e,this.selection=i,this.effects=n,this.annotations=s,this.scrollIntoView=r,this._doc=null,this._state=null,i&&P(i,e.newLength),s.some((t=>t.type==ht.time))||(this.annotations=s.concat(ht.time.of(Date.now())))}static create(t,e,i,n,s,r){return new ht(t,e,i,n,s,r)}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(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(ht.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ct(t,e){let i=[];for(let n=0,s=0;;){let r,o;if(n=t[n]))r=t[n++],o=t[n++];else{if(!(s=0;s--){let r=i[s](t);r&&Object.keys(r).length&&(n=ut(n,ft(e,r,t.changes.newLength),!0))}return n==t?t:ht.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}(i?function(t){let e=t.startState,i=!0;for(let n of e.facet(et)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ct(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=A.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=ht.create(e,n,t.selection&&t.selection.map(s),at.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(it);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof ht?s:Array.isArray(s)&&1==s.length&&s[0]instanceof ht?s[0]:dt(e,gt(s),!1)}return t}(s):s)}ht.time=rt.define(),ht.userEvent=rt.define(),ht.addToHistory=rt.define(),ht.remote=rt.define();const pt=[];function gt(t){return null==t?pt:Array.isArray(t)?t:[t]}var mt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(mt||(mt={}));const wt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let yt;try{yt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}class vt{constructor(t,e,i,n,s,r){this.config=t,this.doc=e,this.selection=i,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=s,r&&(r._state=this);for(let t=0;ts.set(e,t))),i=null),s.set(e.value.compartment,e.value.extension)):e.is(at.reconfigure)?(i=null,n=e.value):e.is(at.appendConfig)&&(i=null,n=gt(n).concat(e.value));i?e=t.startState.values.slice():(i=J.resolve(n,s,this),e=new vt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values),new vt(i,t.newDoc,t.newSelection,e,((e,i)=>i.update(e,t)),t)}replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:t},range:B.cursor(e.from+t.length)})))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),n=this.changes(i.changes),s=[i.range],r=gt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return vt.create({doc:t.doc,selection:B.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(e={}){let i=J.resolve(e.extensions||[],new Map),n=e.doc instanceof t?e.doc:t.of((e.doc||"").split(i.staticFacet(vt.lineSeparator)||b)),s=e.selection?e.selection instanceof B?e.selection:B.single(e.selection.anchor,e.selection.head):B.single(0);return P(s,n.length),i.staticFacet(Z)||(s=s.asSingle()),new vt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(vt.tabSize)}get lineBreak(){return this.facet(vt.lineSeparator)||"\n"}get readOnly(){return this.facet(st)}phrase(t,...e){for(let e of this.facet(vt.phrases))if(Object.prototype.hasOwnProperty.call(e,t)){t=e[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,((t,i)=>{if("$"==i)return"$";let n=+(i||1);return!n||n>e.length?t:e[n-1]}))),t}languageDataAt(t,e,i=-1){let n=[];for(let s of this.facet(Q))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return e=this.languageDataAt("wordChars",t).join(""),t=>{if(!/\S/.test(t))return mt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||wt.test(i)))return!0}return!1}(t))return mt.Word;for(let i=0;i-1)return mt.Word;return mt.Other};var e}wordAt(t){let{text:e,from:i,length:n}=this.doc.lineAt(t),s=this.charCategorizer(t),r=t-i,o=t-i;for(;r>0;){let t=d(e,r,!1);if(s(e.slice(t,r))!=mt.Word)break;r=t}for(;ot.length?t[0]:4}),vt.lineSeparator=tt,vt.readOnly=st,vt.phrases=R.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every((i=>t[i]==e[i]))}}),vt.languageData=Q,vt.changeFilter=et,vt.transactionFilter=it,vt.transactionExtender=nt,G.reconfigure=at.define();class bt{eq(t){return this==t}range(t,e=t){return xt.create(t,e,this)}}bt.prototype.startSide=bt.prototype.endSide=0,bt.prototype.point=!1,bt.prototype.mapMode=x.TrackDel;class xt{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(t,e,i){return new xt(t,e,i)}}function St(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class At{constructor(t,e,i,n){this.from=t,this.to=e,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,n=0){let s=i?this.to:this.from;for(let r=n,o=s.length;;){if(r==o)return r;let n=r+o>>1,l=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return l>=0?r:o;l>=0?o=n:r=n+1}}between(t,e,i,n){for(let s=this.findIndex(e,-1e9,!0),r=this.findIndex(i,1e9,!1,s);sh||a==h&&c.startSide>0&&c.endSide<=0)continue;(h-a||c.endSide-c.startSide)<0||(r<0&&(r=a),c.point&&(o=Math.max(o,h-a)),i.push(c),n.push(a-r),s.push(h-r))}return{mapped:i.length?new At(n,s,i,o):null,pos:r}}}class Mt{constructor(t,e,i,n){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=n}static create(t,e,i,n){return new Mt(t,e,i,n)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:i=!1,filterFrom:n=0,filterTo:s=this.length}=t,r=t.filter;if(0==e.length&&!r)return this;if(i&&(e=e.slice().sort(St)),this.isEmpty)return e.length?Mt.of(e):this;let o=new Ot(this,null,-1).goto(0),l=0,a=[],h=new Tt;for(;o.value||l=0){let t=e[l++];h.addInner(t.from,t.to,t.value)||a.push(t)}else 1==o.rangeIndex&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||so.to||s=s&&t<=s+r.length&&!1===r.between(s,t-s,e-s,i))return}this.nextLayer.between(t,e,i)}}iter(t=0){return Dt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Dt.from(t).goto(e)}static compare(t,e,i,n,s=-1){let r=t.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=s)),o=e.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=s)),l=Ct(r,o,i),a=new Lt(r,l,s),h=new Lt(o,l,s);i.iterGaps(((t,e,i)=>Bt(a,t,h,e,i,n))),i.empty&&0==i.length&&Bt(a,0,h,0,0,n)}static eq(t,e,i=0,n){null==n&&(n=999999999);let s=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0)),r=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0));if(s.length!=r.length)return!1;if(!s.length)return!0;let o=Ct(s,r),l=new Lt(s,o,0).goto(i),a=new Lt(r,o,0).goto(i);for(;;){if(l.to!=a.to||!Pt(l.active,a.active)||l.point&&(!a.point||!l.point.eq(a.point)))return!1;if(l.to>n)return!0;l.next(),a.next()}}static spans(t,e,i,n,s=-1){let r=new Lt(t,null,s).goto(e),o=e,l=r.openStart;for(;;){let t=Math.min(r.to,i);if(r.point){let i=r.activeForPoint(r.to),s=r.pointFromo&&(n.span(o,t,r.active,l),l=r.openEnd(t));if(r.to>i)return l+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Tt;for(let n of t instanceof xt?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(St);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}Mt.empty=new Mt([],[],null,-1),Mt.empty.nextLayer=Mt.empty;class Tt{finishChunk(t){this.chunks.push(new At(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}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(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Tt)).add(t,e,i)}addInner(t,e,i){let n=t-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(n<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),0))}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(Mt.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=Mt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Ct(t,e,i){let n=new Map;for(let e of t)for(let t=0;t=this.minPoint)break}}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&n.push(new Ot(r,e,i,s));return 1==n.length?n[0]:new Dt(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let i of this.heap)i.goto(t,e);for(let t=this.heap.length>>1;t>=0;t--)Et(this.heap,t);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let t=this.heap.length>>1;t>=0;t--)Et(this.heap,t);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Et(this.heap,0)}}}function Et(t,e){for(let i=t[e];;){let n=1+(e<<1);if(n>=t.length)break;let s=t[n];if(n+1=0&&(s=t[n+1],n++),i.compare(s)<0)break;t[n]=i,t[e]=s,e=n}}class Lt{constructor(t,e,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Dt.from(t,e,i)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){Nt(this.active,t),Nt(this.activeTo,t),Nt(this.activeRank,t),this.minActive=It(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:n,rank:s}=this.cursor;for(;e-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&Nt(i,n)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let t=this.cursor.value;if(t.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from=0&&i[e]=0&&!(this.activeRank[i]t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}}function Bt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,l=n,a=n-e;for(;;){let e=t.to+a-i.to||t.endSide-i.endSide,n=e<0?t.to+a:i.to,s=Math.min(n,o);if(t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&Pt(t.activeForPoint(t.to),i.activeForPoint(i.to))||r.comparePoint(l,s,t.point,i.point):s>l&&!Pt(t.active,i.active)&&r.compareRange(l,s,t.active,i.active),n>o)break;l=n,e<=0&&t.next(),e>=0&&i.next()}}function Pt(t,e){if(t.length!=e.length)return!1;for(let i=0;i=e;i--)t[i+1]=t[i];t[e]=i}function It(t,e){let i=-1,n=1e9;for(let s=0;st.map((t=>e.replace(/&/,t))))).reduce(((t,e)=>t.concat(e))),o,r);else if(o&&"object"==typeof o){if(!a)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,l,h)}else null!=o&&l.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(l.length||h)&&r.push((!i||a||o?t:t.map(i)).join(", ")+" {"+l.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=Vt[zt]||1;return Vt[zt]=t+1,"ͼ"+t.toString(36)}static mount(t,e,i){let n=t[Wt],s=i&&i.nonce;n?s&&n.setNonce(s):n=new qt(t,s),n.mount(Array.isArray(e)?e:[e])}}let _t=new Map;class qt{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let e=_t.get(i);if(e)return t.adoptedStyleSheets=[e.sheet,...t.adoptedStyleSheets],t[Wt]=e;this.sheet=new n.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],_t.set(i,this)}else{this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);let n=t.head||t;n.insertBefore(this.styleTag,n.firstChild)}this.modules=[],t[Wt]=this}mount(t){let e=this.sheet,i=0,n=0;for(let s=0;s-1&&(this.modules.splice(o,1),n--,o=-1),-1==o){if(this.modules.splice(n++,0,r),e)for(let t=0;t",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Kt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Gt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ut=0;Ut<10;Ut++)jt[48+Ut]=jt[96+Ut]=String(Ut);for(Ut=1;Ut<=24;Ut++)jt[Ut+111]="F"+Ut;for(Ut=65;Ut<=90;Ut++)jt[Ut]=String.fromCharCode(Ut+32),$t[Ut]=String.fromCharCode(Ut);for(var Jt in jt)$t.hasOwnProperty(Jt)||($t[Jt]=jt[Jt]);function Yt(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function Xt(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function Qt(t,e){if(!e.anchorNode)return!1;try{return Xt(t,e.anchorNode)}catch(t){return!1}}function Zt(t){return 3==t.nodeType?ce(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function te(t,e,i,n){return!!i&&(ie(t,e,i,n,-1)||ie(t,e,i,n,1))}function ee(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function ie(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:ne(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ee(t)+(s<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(s<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=s<0?ne(t):0}}}function ne(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function se(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function re(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class oe{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?ne(e):0),i,Math.min(t.focusOffset,i?ne(i):0))}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let le,ae=null;function he(t){if(t.setActive)return t.setActive();if(ae)return t.focus(ae);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==ae?{get preventScroll(){return ae={preventScroll:!0},!0}}:void 0),!ae){ae=!1;for(let t=0;tMath.max(1,t.scrollHeight-t.clientHeight-4)}class pe{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new pe(t.parentNode,ee(t),e)}static after(t,e){return new pe(t.parentNode,ee(t)+1,e)}}const ge=[];class me{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(t){let e=this.posAtStart;for(let i of this.children){if(i==t)return e;e+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(2&this.flags){let i,n=this.dom,s=null;for(let r of this.children){if(7&r.flags){if(!r.dom&&(i=s?s.nextSibling:n.firstChild)){let t=me.get(i);(!t||!t.parent&&t.canReuseDOM(r))&&r.reuseDOM(i)}r.sync(t,e),r.flags&=-8}if(i=s?s.nextSibling:n.firstChild,e&&!e.written&&e.node==n&&i!=r.dom&&(e.written=!0),r.dom.parentNode==n)for(;i&&i!=r.dom;)i=we(i);else n.insertBefore(r.dom,i);s=r.dom}for(i=s?s.nextSibling:n.firstChild,i&&e&&e.node==n&&(e.written=!0);i;)i=we(i)}else if(1&this.flags)for(let i of this.children)7&i.flags&&(i.sync(t,e),i.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let i;if(t==this.dom)i=this.dom.childNodes[e];else{let n=0==ne(t)?0:0==e?-1:1;for(;;){let e=t.parentNode;if(e==this.dom)break;0==n&&e.firstChild!=e.lastChild&&(n=t==e.firstChild?-1:1),t=e}i=n<0?t:t.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!me.get(i);)i=i.nextSibling;if(!i)return this.length;for(let t=0,e=0;;t++){let n=this.children[t];if(n.dom==i)return e;e+=n.length+n.breakAfter}}domBoundsAround(t,e,i=0){let n=-1,s=-1,r=-1,o=-1;for(let l=0,a=i,h=i;le)return i.domBoundsAround(t,e,a);if(c>=t&&-1==n&&(n=l,s=a),a>e&&i.dom.parentNode==this.dom){r=l,o=h;break}h=c,a=c+i.breakAfter}return{from:s,to:o<0?i+this.length:o,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:r=0?this.children[r].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),1&e.flags)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,i=ge){this.markDirty();for(let i=t;ithis.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function ve(t,e,i,n,s,r,o,l,a){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,f=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!f&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,l,a))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,l,0)?c.breakAfter=r.shift().breakAfter:(i2);var Be={mac:Le||/Mac/.test(be.platform),windows:/Win/.test(be.platform),linux:/Linux|X11/.test(be.platform),ie:Te,ie_version:Ae?xe.documentMode||6:Me?+Me[1]:Se?+Se[1]:0,gecko:Ce,gecko_version:Ce?+(/Firefox\/(\d+)/.exec(be.userAgent)||[0,0])[1]:0,chrome:!!Oe,chrome_version:Oe?+Oe[1]:0,ios:Le,android:/Android\b/.test(be.userAgent),webkit:De,safari:Ee,webkit_version:De?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=xe.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Pe extends me{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){3==t.nodeType&&this.createDOM(t)}merge(t,e,i){return!(8&this.flags||i&&(!(i instanceof Pe)||this.length-(e-t)+i.length>256||8&i.flags)||(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),0))}split(t){let e=new Pe(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new pe(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return function(t,e,i){let n=t.nodeValue.length;e>n&&(e=n);let s=e,r=e,o=0;0==e&&i<0||e==n&&i>=0?Be.chrome||Be.gecko||(e?(s--,o=1):r=0)?0:l.length-1];return Be.safari&&!o&&0==a.width&&(a=Array.prototype.find.call(l,(t=>t.width))||a),o?se(a,o<0):a||null}(this.dom,t,e)}}class Ne extends me{constructor(t,e=[],i=0){super(),this.mark=t,this.children=e,this.length=i;for(let t of e)t.setParent(this)}setAttrs(t){if(fe(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!(8&(this.flags|t.flags))}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,i,n,s,r){return!(i&&(!(i instanceof Ne&&i.mark.eq(this.mark))||t&&s<=0||et&&e.push(i=t&&(n=s),i=o,s++}let r=this.length-t;return this.length=t,n>-1&&(this.children.length=n,this.markDirty()),new Ne(this.mark,e,r)}domAtPos(t){return He(this,t)}coordsAt(t,e){return We(this,t,e)}}class Re extends me{static create(t,e,i){return new Re(t,e,i)}constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}split(t){let e=Re.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.dom.contentEditable="false")}getSide(){return this.side}merge(t,e,i,n,s,r){return!(i&&(!(i instanceof Re&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?pe.before(this.dom):pe.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.widget.coordsAt(this.dom,t,e);if(i)return i;let n=this.dom.getClientRects(),s=null;if(!n.length)return null;let r=this.side?this.side<0:t>0;for(let e=r?n.length-1:0;s=n[e],!(t>0?0==e:e==n.length-1||s.top0?pe.before(this.dom):pe.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function He(t,e){let i=t.dom,{children:n}=t,s=0;for(let t=0;st&&e0;t--){let e=n[t-1];if(e.dom.parentNode==i)return e.domAtPos(e.length)}for(let t=s;t0&&e instanceof Ne&&s.length&&(n=s[s.length-1])instanceof Ne&&n.mark.eq(e.mark)?ze(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function We(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,l){for(let a=0,h=0;a=l&&(c.children.length?t(c,l-h):(!r||r.isHidden&&i>0)&&(u>l||h==u&&c.getSide()>0)?(r=c,o=l-h):(h-1?1:0)!=s.length-(i&&s.indexOf(i)>-1?1:0))return!1;for(let r of n)if(r!=i&&(-1==s.indexOf(r)||t[r]!==e[r]))return!1;return!0}function qe(t,e,i){let n=!1;if(e)for(let s in e)i&&s in i||(n=!0,"style"==s?t.style.cssText="":t.removeAttribute(s));if(i)for(let s in i)e&&e[s]==i[s]||(n=!0,"style"==s?t.style.cssText=i[s]:t.setAttribute(s,i[s]));return n}function je(t){let e=Object.create(null);for(let i=0;i0?3e8:-4e8:e>0?1e8:-1e8,new Ye(t,e,e,i,t.widget||null,!1)}static replace(t){let e,i,n=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{let{start:s,end:r}=Xe(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new Ye(t,e,i,n,t.widget||null,!0)}static line(t){return new Je(t)}static set(t,e=!1){return Mt.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Ge.none=Mt.empty;class Ue extends Ge{constructor(t){let{start:e,end:i}=Xe(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,i;return this==t||t instanceof Ue&&this.tagName==t.tagName&&(this.class||(null===(e=this.attrs)||void 0===e?void 0:e.class))==(t.class||(null===(i=t.attrs)||void 0===i?void 0:i.class))&&_e(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}Ue.prototype.point=!1;class Je extends Ge{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Je&&this.spec.class==t.spec.class&&_e(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}Je.prototype.mapMode=x.TrackBefore,Je.prototype.point=!0;class Ye extends Ge{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?x.TrackBefore:x.TrackAfter:x.TrackDel}get type(){return this.startSide=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Ye&&((e=this.widget)==(i=t.widget)||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}function Xe(t,e=!1){let{inclusiveStart:i,inclusiveEnd:n}=t;return null==i&&(i=t.inclusive),null==n&&(n=t.inclusive),{start:null!=i?i:e,end:null!=n?n:e}}function Qe(t,e,i,n=0){let s=i.length-1;s>=0&&i[s]+n>=t?i[s]=Math.max(i[s],e):i.push(t,e)}Ye.prototype.point=!0;class Ze extends me{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,n,s,r){if(i){if(!(i instanceof Ze))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),ke(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new Ze;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i,off:n}=this.childPos(t);n&&(e.append(this.children[i].split(n),0),this.children[i].merge(n,this.children[i].length,null,!1,0,0),i++);for(let t=i;t0&&0==this.children[i-1].length;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){_e(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){ze(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Ve(e,this.attrs||{})),i&&(this.attrs=Ve({class:i},this.attrs||{}))}domAtPos(t){return He(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}sync(t,e){var i;this.dom?4&this.flags&&(fe(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(qe(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let n=this.dom.lastChild;for(;n&&me.get(n)instanceof Ne;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=me.get(n))||void 0===i?void 0:i.isEditable)||Be.ios&&this.children.some((t=>t instanceof Pe))))){let t=document.createElement("BR");t.cmIgnore=!0,this.dom.appendChild(t)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let t,e=0;for(let i of this.children){if(!(i instanceof Pe)||/[^ -~]/.test(i.text))return null;let n=Zt(i.dom);if(1!=n.length)return null;e+=n[0].width,t=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(t,e){let i=We(this,t,e);if(!this.children.length&&i&&this.parent){let{heightOracle:t}=this.parent.view.viewState,e=i.bottom-i.top;if(Math.abs(e-t.lineHeight)<2&&t.textHeight=e){if(s instanceof Ze)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ti extends me{constructor(t,e,i){super(),this.widget=t,this.length=e,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,n,s,r){return!(i&&(!(i instanceof ti&&this.widget.compare(i.widget))||t>0&&s<=0||e0;){if(this.textOff==this.text.length){let{value:e,lineBreak:i,done:n}=this.cursor.next(this.skip);if(this.skip=0,n)throw new Error("Ran out of text content when drawing inline views");if(i){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}this.text=e,this.textOff=0}let n=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(ii(new Pe(this.text.slice(this.textOff,this.textOff+n)),e),i),this.atCursorPos=!0,this.textOff+=n,t-=n,i=0}}span(t,e,i,n){this.buildText(e-t,i,n),this.pos=e,this.openStart<0&&(this.openStart=n)}point(t,e,i,n,s,r){if(this.disallowBlockEffectsFor[r]&&i instanceof Ye){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof Ye)if(i.block){let{type:t}=i;t!=Ke.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ti(i.widget||new ni("div"),o,t))}else{let r=Re.create(i.widget||new ni("span"),o,o?0:i.startSide),l=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),a=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||l||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),l&&(h.append(ii(new Ie(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(ii(r,n),s),this.atCursorPos=a,this.pendingBuffer=a?tn.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=s)}static build(t,e,i,n,s){let r=new ei(t,e,i,s);return r.openEnd=Mt.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function ii(t,e){for(let i of e)t=new Ne(i,[t],t.length);return t}class ni extends $e{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}const si=R.define(),ri=R.define(),oi=R.define(),li=R.define(),ai=R.define(),hi=R.define(),ci=R.define(),ui=R.define({combine:t=>t.some((t=>t))}),fi=R.define({combine:t=>t.some((t=>t))});class di{constructor(t,e="nearest",i="nearest",n=5,s=5){this.range=t,this.y=e,this.x=i,this.yMargin=n,this.xMargin=s}map(t){return t.empty?this:new di(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const pi=at.define({map:(t,e)=>t.map(e)});function gi(t,e,i){let n=t.facet(li);n.length?n[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e)}const mi=R.define({combine:t=>!t.length||t[0]});let wi=0;const yi=R.define();class vi{constructor(t,e,i,n){this.id=t,this.create=e,this.domEventHandlers=i,this.extension=n(this)}static define(t,e){const{eventHandlers:i,provide:n,decorations:s}=e||{};return new vi(wi++,t,i,(t=>{let e=[yi.of(t)];return s&&e.push(Si.of((e=>{let i=e.plugin(t);return i?s(i):Ge.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return vi.define((e=>new t(e)),e)}}class ki{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(e){if(gi(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){gi(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(e){gi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const bi=R.define(),xi=R.define(),Si=R.define(),Ai=R.define(),Mi=R.define();function Ti(t,e,i){let n=t.state.facet(Mi);if(!n.length)return n;let s=n.map((e=>e instanceof Function?e(t):e)),r=[];return Mt.spans(s,e,i,{point(){},span(t,e,i,n){let s=r;for(let r=i.length-1;r>=0;r--,n--){let o,l=i[r].spec.bidiIsolate;if(null!=l)if(n>0&&s.length&&(o=s[s.length-1]).to==t&&o.direction==l)o.to=e,s=o.inner;else{let i={from:t,to:e,direction:l,inner:[]};s.push(i),s=i.inner}}}}),r}const Ci=R.define();function Oi(t){let e=0,i=0,n=0,s=0;for(let r of t.state.facet(Ci)){let o=r(t);o&&(null!=o.left&&(e=Math.max(e,o.left)),null!=o.right&&(i=Math.max(i,o.right)),null!=o.top&&(n=Math.max(n,o.top)),null!=o.bottom&&(s=Math.max(s,o.bottom)))}return{left:e,right:i,top:n,bottom:s}}const Di=R.define();class Ei{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Ei(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>i.toA)){if(n.toAh)break;s+=2}if(!l)return i;new Ei(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),r=l.toA,o=l.toB}}}class Li{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=A.empty(this.startState.doc.length);for(let t of i)this.changes=this.changes.compose(t.changes);let n=[];this.changes.iterChangedRanges(((t,e,i,s)=>n.push(new Ei(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Li(t,e,i)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((t=>t.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}var Bi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Bi||(Bi={}));const Pi=Bi.LTR,Ni=Bi.RTL;function Ri(t){let e=[];for(let i=0;i=e){if(o.level==i)return r;(s<0||(0!=n?n<0?o.frome:t[s].level>o.level))&&(s=r)}}if(s<0)throw new RangeError("Index out of range");return s}}function _i(t,e){if(t.length!=e.length)return!1;for(let i=0;ia&&o.push(new Fi(a,p.from,f)),$i(t,p.direction==Pi!=!(f%2)?n+1:n,s,p.inner,p.from,p.to,o),a=p.to),d=p.to}else{if(d==i||(e?qi[d]!=l:qi[d]==l))break;d++}u?ji(t,a,d,n+1,s,u,o):ae;){let i=!0,c=!1;if(!h||a>r[h-1].to){let t=qi[a-1];t!=l&&(i=!1,c=16==t)}let u=i||1!=l?null:[],f=i?n:n+1,d=a;t:for(;;)if(h&&d==r[h-1].to){if(c)break t;let p=r[--h];if(!i)for(let t=p.from,i=h;;){if(t==e)break t;if(!i||r[i-1].to!=t){if(qi[t-1]==l)break t;break}t=r[--i].from}u?u.push(p):(p.to=0;t-=3)if(Wi[t+1]==-i){let e=Wi[t+2],i=2&e?s:4&e?1&e?r:s:0;i&&(qi[o]=qi[Wi[t]]=i),l=t;break}}else{if(189==Wi.length)break;Wi[l++]=o,Wi[l++]=e,Wi[l++]=a}else if(2==(n=qi[o])||1==n){let t=n==s;a=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Wi[e+2];if(2&i)break;if(t)Wi[e+2]|=2;else{if(4&i)break;Wi[e+2]|=4}}}}}(t,s,r,n,l),function(t,e,i,n){for(let s=0,r=n;s<=i.length;s++){let o=s?i[s-1].to:t,l=sa;)e==r&&(e=i[--n].from,r=n?i[n-1].to:t),qi[--e]=c;a=o}else r=o,a++}}}(s,r,n,l),ji(t,s,r,e,i,n,o)}function Ki(t){return[new Fi(0,t,0)]}let Gi="";function Ui(t,e,i,n,s){var r;let o=n.head-t.from,l=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),l=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),l=e.length-1)}l<0&&(l=Fi.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let a=e[l];o==a.side(s,i)&&(a=e[l+=s?1:-1],o=a.side(!s,i));let h=s==(a.dir==i),c=d(t.text,o,h);if(Gi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=a.side(s,i))return B.cursor(c+t.from,h?-1:1,a.level);let u=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return u||a.level==i?u&&u.level0&&i.length&&(i.every((({fromA:t,toA:e})=>ethis.minWidthTo))?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=-1;this.view.inputState.composing>=0&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?n=this.domChanged.newSel.head:function(t,e){let i=!1;return e&&t.iterChangedRanges(((t,n)=>{te.from&&(i=!0)})),i}(t.changes,this.hasComposition)||t.selectionSet||(n=t.state.selection.main.head));let s=n>-1?function(t,e,i){let n=Xi(t,i);if(!n)return null;let{node:s,from:r,to:o}=n,l=s.nodeValue;if(/[\n\r]/.test(l))return null;if(t.state.doc.sliceString(n.from,n.to)!=l)return null;let a=e.invertedDesc,h=new Ei(a.mapPos(r),a.mapPos(o),r,o),c=[];for(let e=s.parentNode;;e=e.parentNode){let i=me.get(e);if(i instanceof Ne)c.push({node:e,deco:i.mark});else{if(i instanceof Ze||"DIV"==e.nodeName&&e.parentNode==t.contentDOM)return{range:h,text:s,marks:c,line:e};if(e==t.contentDOM)return null;c.push({node:e,deco:new Ue({inclusive:!0,attributes:je(e),tagName:e.tagName.toLowerCase()})})}}}(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:e,to:n}=this.hasComposition;i=new Ei(e,n,t.changes.mapPos(e,-1),t.changes.mapPos(n,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Be.ie||Be.chrome)&&!s&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let r=function(t,e,i){let n=new Zi;return Mt.compare(t,e,i,n),n.changes}(this.decorations,this.updateDeco(),t.changes);return i=Ei.extendWithRanges(i,r),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,t.startState.doc.length,s),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,i);let{observer:n}=this.view;n.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=Be.chrome||Be.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.flags&=-8,t&&(t.written||n.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((t=>t.flags&=-9));let s=[];if(this.view.viewport.from||this.view.viewport.to=0?n[t]:null;if(!e)break;let r,o,l,a,{fromA:h,toA:c,fromB:u,toB:f}=e;if(i&&i.range.fromBu){let t=ei.build(this.view.state.doc,u,i.range.fromB,this.decorations,this.dynamicDecorationMap),e=ei.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);o=t.breakAtStart,l=t.openStart,a=e.openEnd;let n=this.compositionView(i);e.breakAtStart?n.breakAfter=1:e.content.length&&n.merge(n.length,n.length,e.content[0],!1,e.openStart,0)&&(n.breakAfter=e.content[0].breakAfter,e.content.shift()),t.content.length&&n.merge(0,0,t.content[t.content.length-1],!0,0,t.openEnd)&&t.content.pop(),r=t.content.concat(n).concat(e.content)}else({content:r,breakAtStart:o,openStart:l,openEnd:a}=ei.build(this.view.state.doc,u,f,this.decorations,this.dynamicDecorationMap));let{i:d,off:p}=s.findPos(c,1),{i:g,off:m}=s.findPos(h,-1);ve(this,g,m,d,p,r,o,l,a)}i&&this.fixCompositionDOM(i)}compositionView(t){let e=new Pe(t.text.nodeValue);e.flags|=8;for(let{deco:i}of t.marks)e=new Ne(i,[e],e.length);let i=new Ze;return i.append(e,0),i}fixCompositionDOM(t){let e=(t,e)=>{e.flags|=8|(e.children.some((t=>7&t.flags))?1:0),this.markedForComposition.add(e);let i=me.get(t);i&&i!=e&&(i.dom=null),e.setDOM(t)},i=this.childPos(t.range.fromB,1),n=this.children[i.i];e(t.line,n);for(let s=t.marks.length-1;s>=-1;s--)i=n.childPos(i.off,1),n=n.children[i.i],e(s>=0?t.marks[s].node:t.text,n)}updateSelection(t=!1,e=!1){!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let i=this.view.root.activeElement,n=i==this.dom,s=!n&&Qt(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(n||e||s))return;let r=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(o.anchor)),a=o.empty?l:this.moveToLine(this.domAtPos(o.head));if(Be.gecko&&o.empty&&!this.hasComposition&&1==(h=l).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable)){let t=document.createTextNode("");this.view.observer.ignore((()=>l.node.insertBefore(t,l.node.childNodes[l.offset]||null))),l=a=new pe(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&te(l.node,l.offset,c.anchorNode,c.anchorOffset)&&te(a.node,a.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{Be.android&&Be.chrome&&this.dom.contains(c.focusNode)&&function(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let t=Yt(this.view.root);if(t)if(o.empty){if(Be.gecko){let t=(e=l.node,n=l.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([l,a]=[a,l]),e.setEnd(a.node,a.offset),e.setStart(l.node,l.offset),t.removeAllRanges(),t.addRange(e)}var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(l,a)),this.impreciseAnchor=l.precise?null:new pe(c.anchorNode,c.anchorOffset),this.impreciseHead=a.precise?null:new pe(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=Yt(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=Ze.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let l=this.coordsAt(e.head,-1),a=this.coordsAt(e.head,1);if(!l||!a||l.bottom>a.top)return;let h=this.domAtPos(e.head+e.assoc);i.collapse(h.node,h.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&i.collapse(n,s)}moveToLine(t){let e,i=this.dom;if(t.node!=i)return t;for(let n=t.offset;!e&&n=0;n--){let t=me.get(i.childNodes[n]);t instanceof Ze&&(e=t.domAtPos(t.length))}return e?new pe(e.node,e.offset,!0):t}nearest(t){for(let e=t;e;){let t=me.get(e);if(t&&t.rootView==this)return t;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;er||t==r&&s.type!=Ke.WidgetBefore&&s.type!=Ke.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==Ke.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}coordsForChar(t){let{i:e,off:i}=this.childPos(t,1),n=this.children[e];if(!(n instanceof Ze))return null;for(;n.children.length;){let{i:t,off:e}=n.childPos(i,1);for(;;t++){if(t==n.children.length)return null;if((n=n.children[t]).length)break}i=e}if(!(n instanceof Pe))return null;let s=d(n.text,i);if(s==i)return null;let r=ce(n.dom,i,s).getClientRects();return!r.length||r[0].top>=r[0].bottom?null:r[0]}measureVisibleLineHeights(t){let e=[],{from:i,to:n}=t,s=this.view.contentDOM.clientWidth,r=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,l=this.view.textDirection==Bi.LTR;for(let t=0,a=0;an)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?Zt(e):[];if(n.length){let e=n[n.length-1],r=l?e.right-i.left:i.right-e.left;r>o&&(o=r,this.minWidth=s,this.minWidthFrom=t,this.minWidthTo=c)}}}t=c+h.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return"rtl"==getComputedStyle(this.children[e].dom).direction?Bi.RTL:Bi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof Ze){let e=t.measureTextSize();if(e)return e}let t,e,i,n=document.createElement("div");return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=Zt(n.firstChild)[0];t=n.getBoundingClientRect().height,e=s?s.width/27:7,i=s?s.height:t,n.remove()})),{lineHeight:t,charWidth:e,textHeight:i}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new ye(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,n=0;;n++){let s=n==e.viewports.length?null:e.viewports[n],r=s?s.from-1:this.length;if(r>i){let n=(e.lineBlockAt(r).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(Ge.replace({widget:new Yi(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return Ge.set(t)}updateDeco(){let t=this.view.state.facet(Si).map(((t,e)=>(this.dynamicDecorationMap[e]="function"==typeof t)?t(this.view):t));for(let e=t.length;ei.anchor?-1:1);if(!n)return;!i.empty&&(e=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,e.left),top:Math.min(n.top,e.top),right:Math.max(n.right,e.right),bottom:Math.max(n.bottom,e.bottom)});let s=Oi(this.view),r={left:n.left-s.left,top:n.top-s.top,right:n.right+s.right,bottom:n.bottom+s.bottom};!function(t,e,i,n,s,r,o,l){let a=t.ownerDocument,h=a.defaultView||window;for(let c=t,u=!1;c&&!u;)if(1==c.nodeType){let t,f=c==a.body,d=1,p=1;if(f)t=re(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(u=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();d=e.width/c.offsetWidth,p=e.height/c.offsetHeight,t={left:e.left,right:e.left+c.clientWidth*d,top:e.top,bottom:e.top+c.clientHeight*p}}let g=0,m=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+m&&(m=e.bottom-t.bottom+m+o)):e.bottom>t.bottom&&(m=e.bottom-t.bottom+o,i<0&&e.top-m0&&e.right>t.right+g&&(g=e.right-t.right+g+r)):e.right>t.right&&(g=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=ne(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return{node:n,offset:s};if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}let Zi=class{constructor(){this.changes=[]}compareRange(t,e){Qe(t,e,this.changes)}comparePoint(t,e){Qe(t,e,this.changes)}};function tn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function en(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function nn(t,e){return t.tope.top+1}function sn(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function on(t,e,i){let n,s,r,o,l,a,h,c,u=!1;for(let f=t.firstChild;f;f=f.nextSibling){let t=Zt(f);for(let d=0;dm||o==m&&r>g){n=f,s=p,r=g,o=m;let l=m?i0?d0)}0==g?i>p.bottom&&(!h||h.bottomp.top)&&(a=f,c=p):h&&nn(h,p)?h=rn(h,p.bottom):c&&nn(c,p)&&(c=sn(c,p.top))}}if(h&&h.bottom>=i?(n=l,s=h):c&&c.top<=i&&(n=a,s=c),!n)return{node:t,offset:0};let f=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?ln(n,f,i):u&&"false"!=n.contentEditable?on(n,f,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function ln(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;li?h.top-i:i-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&c=(h.left+h.right)/2,n=i;if((Be.chrome||Be.gecko)&&ce(t,l).getBoundingClientRect().left==h.right&&(n=!i),c<=0)return{node:t,offset:l+(n?1:0)};s=l+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function an(t,e,i,n=-1){var s,r;let o,l=t.contentDOM.getBoundingClientRect(),a=l.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,f=u-a;if(f<0)return 0;if(f>h)return t.state.doc.length;for(let e=t.viewState.heightOracle.textHeight/2,s=!1;o=t.elementAtHeight(f),o.type!=Ke.Text;)for(;f=n>0?o.bottom+e:o.top-e,!(f>=0&&f<=h);){if(s)return i?null:0;s=!0,n=-n}u=a+f;let d=o.from;if(dt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:hn(t,l,o,c,u);let p=t.dom.ownerDocument,g=t.root.elementFromPoint?t.root:p,m=g.elementFromPoint(c,u);m&&!t.contentDOM.contains(m)&&(m=null),m||(c=Math.max(l.left+1,Math.min(l.right-1,c)),m=g.elementFromPoint(c,u),m&&!t.contentDOM.contains(m)&&(m=null));let w,y=-1;if(m&&0!=(null===(s=t.docView.nearest(m))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:w,offset:y}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:w,startOffset:y}=e),(!t.contentDOM.contains(w)||Be.safari&&function(t,e,i){let n;if(3!=t.nodeType||e!=(n=t.nodeValue.length))return!1;for(let e=t.nextSibling;e;e=e.nextSibling)if(1!=e.nodeType||"BR"!=e.nodeName)return!1;return ce(t,n-1,n).getBoundingClientRect().left>i}(w,y,c)||Be.chrome&&function(t,e,i){if(0!=e)return!1;for(let e=t;;){let t=e.parentNode;if(!t||1!=t.nodeType||t.firstChild!=e)return!1;if(t.classList.contains("cm-line"))break;e=t}return i-(1==t.nodeType?t.getBoundingClientRect():ce(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}(w,y,c))&&(w=void 0))}if(!w||!t.docView.dom.contains(w)){let e=Ze.find(t.docView,d);if(!e)return f>o.top+o.height/2?o.to:o.from;({node:w,offset:y}=on(e.dom,c,u))}let v=t.docView.nearest(w);if(!v)return null;if(v.isWidget&&1==(null===(r=v.dom)||void 0===r?void 0:r.nodeType)){let t=v.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){let e=t.viewState.heightOracle.textHeight;r+=Math.floor((s-i.top-.5*(t.defaultLineHeight-e))/e)*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(i.from,i.to);return i.from+function(t,e,i,n){for(let n=0,s=0;;){if(s>=e)return n;if(n==t.length)break;s+=9==t.charCodeAt(n)?i-s%i:1,n=d(t,n)}return t.length}(o,r,t.state.tabSize)}function cn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let l=e,a=null;;){let e=Ui(s,r,o,l,i),h=Gi;if(!e){if(s.number==(i?t.state.doc.lines:1))return l;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=B.cursor(i?s.from:s.to)}if(a){if(!a(h))return l}else{if(!n)return e;a=n(h)}l=e}}function un(t,e,i){for(;;){let n=0;for(let s of t)s.between(e-1,e+1,((t,s,r)=>{if(e>t&&ee(t))),i.from,e.head>i.from?-1:1);return n==i.from?i:B.cursor(n,n{this.ignoreDuringComposition(i)||"keydown"==i.type&&this.keydown(t,i)||(this.mustFlushObserver(i)&&t.observer.forceFlush(),this.runCustomHandlers(i.type,t,i)?i.preventDefault():e(t,i))};for(let i in kn){let n=kn[i];t.contentDOM.addEventListener(i,(i=>{vn(t,i)&&e(n,i)}),bn[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(kn.mousedown,i),!i.defaultPrevented&&2==i.button)){let e=t.contentDOM.style.minHeight;t.contentDOM.style.minHeight="100%",setTimeout((()=>t.contentDOM.style.minHeight=e),200)}})),t.scrollDOM.addEventListener("drop",(i=>{i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&e(kn.drop,i)})),Be.chrome&&102==Be.chrome_version&&t.scrollDOM.addEventListener("wheel",(()=>{this.chromeScrollHack<0?t.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout((()=>{this.chromeScrollHack=-1,t.contentDOM.style.pointerEvents=""}),100)}),{passive:!0}),this.notifiedFocused=t.hasFocus,Be.safari&&t.contentDOM.addEventListener("input",(()=>null)),Be.gecko&&function(t){Wn.has(t)||(Wn.add(t),t.addEventListener("copy",(()=>{})),t.addEventListener("cut",(()=>{})))}(t.contentDOM.ownerDocument)}ensureHandlers(t,e){var i;let n;this.customHandlers=[];for(let s of e)if(n=null===(i=s.update(t).spec)||void 0===i?void 0:i.domEventHandlers){this.customHandlers.push({plugin:s.value,handlers:n});for(let e in n)this.registeredEvents.indexOf(e)<0&&"scroll"!=e&&(this.registeredEvents.push(e),t.contentDOM.addEventListener(e,(i=>{vn(t,i)&&this.runCustomHandlers(e,t,i)&&i.preventDefault()})))}}runCustomHandlers(t,e,i){for(let n of this.customHandlers){let s=n.handlers[t];if(s)try{if(s.call(n.plugin,i,e)||i.defaultPrevented)return!0}catch(t){gi(e.state,t)}}return!1}runScrollHandlers(t,e){this.lastScrollTop=t.scrollDOM.scrollTop,this.lastScrollLeft=t.scrollDOM.scrollLeft;for(let i of this.customHandlers){let n=i.handlers.scroll;if(n)try{n.call(i.plugin,e,t)}catch(e){gi(t.state,e)}}}keydown(t,e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&Date.now()t.keyCode==e.keyCode)))&&!e.ctrlKey||gn.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)||(this.pendingIOSKey=i||e,setTimeout((()=>this.flushIOSKey(t)),250),0))}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,ue(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Be.safari&&!Be.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}mustFlushObserver(t){return"keydown"==t.type&&229!=t.keyCode}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const pn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],gn="dthko",mn=[16,17,18,20,91,92,224,225];function wn(t){return.7*Math.max(0,t)+8}class yn{constructor(t,e,i,n){this.view=t,this.startEvent=e,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=function(t){let e=t.ownerDocument;for(let i=t.parentNode;i&&i!=e.body;)if(1==i.nodeType){if(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.assignedSlot||i.parentNode}else{if(11!=i.nodeType)break;i=i.host}return null}(t.contentDOM),this.atoms=t.state.facet(Ai).map((e=>e(t)));let s=t.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(vt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(si);return i.length?i[0](e):Be.mac?e.metaKey:e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=Yt(t.root);if(!n||0==n.rangeCount)return!0;let s=n.getRangeAt(0).getClientRects();for(let t=0;t=e.clientX&&i.top<=e.clientY&&i.bottom>=e.clientY)return!0}return!1}(t,e)||1!=Pn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e,i,n;if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(i=this.startEvent,n=t,Math.max(Math.abs(i.clientX-n.clientX),Math.abs(i.clientY-n.clientY))<10))return;this.select(this.lastEvent=t);let s=0,r=0,o=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},l=Oi(this.view);t.clientX-l.left<=o.left+6?s=-wn(o.left-t.clientX):t.clientX+l.right>=o.right-6&&(s=wn(t.clientX-o.right)),t.clientY-l.top<=o.top+6?r=-wn(o.top-t.clientY):t.clientY+l.bottom>=o.bottom-6&&(r=wn(t.clientY-o.bottom)),this.setScrollSpeed(s,r)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?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),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let i=0;ithis.select(this.lastEvent)),20)}}function vn(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i,n=e.target;n!=t.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(i=me.get(n))&&i.ignoreEvent(e))return!1;return!0}const kn=Object.create(null),bn=Object.create(null),xn=Be.ie&&Be.ie_version<15||Be.ios&&Be.webkit_version<604;function Sn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Rn&&n.selection.ranges.every((t=>t.empty))&&Rn==r.toString()){let t=-1;i=n.changeByRange((i=>{let l=n.doc.lineAt(i.from);if(l.from==t)return{range:i};t=l.from;let a=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:l.from,insert:a},range:B.cursor(i.from+a.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:B.cursor(t.from+e.length)}})):n.replaceSelection(r);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function An(t,e,i,n){if(1==n)return B.cursor(e,i);if(2==n)return function(t,e,i=1){let n=t.charCategorizer(e),s=t.doc.lineAt(e),r=e-s.from;if(0==s.length)return B.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,l=r;i<0?o=d(s.text,r,!1):l=d(s.text,r);let a=n(s.text.slice(o,l));for(;o>0;){let t=d(s.text,o,!1);if(n(s.text.slice(t,o))!=a)break;o=t}for(;l{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},kn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},kn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},bn.touchstart=bn.touchmove={passive:!0},kn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(oi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=On(t,e),n=Pn(e),s=t.state.selection;return{update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),s=s.map(t.changes))},get(e,r,o){let l,a=On(t,e),h=An(t,a.pos,a.bias,n);if(i.pos!=a.pos&&!r){let e=An(t,i.pos,i.bias,n),s=Math.min(e.from,h.from),r=Math.max(e.to,h.to);h=s1&&(l=function(t,e){for(let i=0;i=e)return B.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}(s,a.pos))?l:o?s.addRange(h):B.create([h])}}}(t,e)),i){let n=!t.hasFocus;t.inputState.startMouseSelection(new yn(t,e,i,n)),n&&t.observer.ignore((()=>he(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Mn=(t,e)=>t>=e.top&&t<=e.bottom,Tn=(t,e,i)=>Mn(e,i)&&t>=i.left&&t<=i.right;function Cn(t,e,i,n){let s=Ze.find(t.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(0==r)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&Tn(i,n,o))return-1;let l=s.coordsAt(r,1);return l&&Tn(i,n,l)?1:o&&Mn(n,o)?-1:1}function On(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:Cn(t,i,e.clientX,e.clientY)}}const Dn=Be.ie&&Be.ie_version<=11;let En=null,Ln=0,Bn=0;function Pn(t){if(!Dn)return t.detail;let e=En,i=Bn;return En=t,Bn=Date.now(),Ln=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Ln+1)%3:1}function Nn(t,e,i,n){if(!i)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:r}=t.inputState,o=n&&r&&r.dragging&&function(t,e){let i=t.state.facet(ri);return i.length?i[0](e):Be.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:r.dragging.from,to:r.dragging.to}:null,l={from:s,insert:i},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}kn.dragstart=(t,e)=>{let{selection:{main:i}}=t.state,{mouseSelection:n}=t.inputState;n&&(n.dragging=i),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove")},kn.drop=(t,e)=>{if(!e.dataTransfer)return;if(t.state.readOnly)return e.preventDefault();let i=e.dataTransfer.files;if(i&&i.length){e.preventDefault();let n=Array(i.length),s=0,r=()=>{++s==i.length&&Nn(t,e,n.filter((t=>null!=t)).join(t.state.lineBreak),!1)};for(let t=0;t{/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(n[t]=e.result),r()},e.readAsText(i[t])}}else Nn(t,e,e.dataTransfer.getData("Text"),!0)},kn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=xn?null:e.clipboardData;i?(Sn(t,i.getData("text/plain")||i.getData("text/uri-text")),e.preventDefault()):function(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout((()=>{t.focus(),i.remove(),Sn(t,i.value)}),50)}(t)};let Rn=null;kn.copy=kn.cut=(t,e)=>{let{text:i,ranges:n,linewise:s}=function(t){let e=[],i=[],n=!1;for(let n of t.selection.ranges)n.empty||(e.push(t.sliceDoc(n.from,n.to)),i.push(n));if(!e.length){let s=-1;for(let{from:n}of t.selection.ranges){let r=t.doc.lineAt(n);r.number>s&&(e.push(r.text),i.push({from:r.from,to:Math.min(t.doc.length,r.to+1)})),s=r.number}n=!0}return{text:e.join(t.lineBreak),ranges:i,linewise:n}}(t.state);if(!i&&!s)return;Rn=s?i:null;let r=xn?null:e.clipboardData;r?(e.preventDefault(),r.clearData(),r.setData("text/plain",i)):function(t,e){let i=t.dom.parentNode;if(!i)return;let n=i.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(),t.focus()}),50)}(t,i),"cut"!=e.type||t.state.readOnly||t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"})};const In=rt.define();function Hn(t,e){let i=[];for(let n of t.facet(ci)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:In.of(!0)}):null}function zn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=Hn(t.state,e);i?t.dispatch(i):t.update([])}}),10)}kn.focus=t=>{t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),zn(t)},kn.blur=t=>{t.observer.clearSelectionRange(),zn(t)},kn.compositionstart=kn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},kn.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Be.chrome&&Be.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])}),50)},kn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},kn.beforeinput=(t,e)=>{var i;let n;if(Be.chrome&&Be.android&&(n=pn.find((t=>t.inputType==e.inputType)))&&(t.observer.delayAndroidKey(n.key,n.keyCode),"Backspace"==n.key||"Delete"==n.key)){let e=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout((()=>{var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>e+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)}};const Wn=new Set,Vn=["pre-wrap","normal","pre-line","break-spaces"];class Fn{constructor(e){this.lineWrapping=e,this.doc=t.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return Vn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,l=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=e,this.charWidth=i,this.textHeight=n,this.lineLength=s,l){this.heightSamples={};for(let t=0;t0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>$n&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return Kn.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,n){let s=this,r=i.doc;for(let o=n.length-1;o>=0;o--){let{fromA:l,toA:a,fromB:h,toB:c}=n[o],u=s.lineAt(l,jn.ByPosNoHeight,i.setDoc(e),0,0),f=u.to>=a?u:s.lineAt(a,jn.ByPosNoHeight,i,0,0);for(c+=f.to-a,a=f.to;o>0&&u.from<=n[o-1].toA;)l=n[o-1].fromA,h=n[o-1].fromB,o--,l2*s){let s=t[e-1];s.break?t.splice(--e,1,s.left,null,s.right):t.splice(--e,1,s.left,s.right),i+=1+s.break,n-=s.size}else{if(!(s>2*n))break;{let e=t[i];e.break?t.splice(i,1,e.left,null,e.right):t.splice(i,1,e.left,e.right),i+=2+e.break,s-=e.size}}else if(n=s&&r(this.blockAt(0,i,n,s))}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Un extends Gn{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,i,n){return new qn(n,this.length,i,this.height,this.breaks)}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof Un||n instanceof Jn&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof Jn?n=new Un(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Kn.of(i)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more?this.setHeight(t,n.heights[n.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Jn extends Kn{constructor(t){super(t,0)}heightMetrics(t,e){let i,n=t.doc.lineAt(e).number,s=t.doc.lineAt(e+this.length).number,r=s-n+1,o=0;if(t.lineWrapping){let e=Math.min(this.height,t.lineHeight*r);i=e/r,this.length>r+1&&(o=(this.height-e)/(this.length-r-1))}else i=this.height/r;return{firstLine:n,lastLine:s,perLine:i,perChar:o}}blockAt(t,e,i,n){let{firstLine:s,lastLine:r,perLine:o,perChar:l}=this.heightMetrics(e,n);if(e.lineWrapping){let s=n+Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length),r=e.doc.lineAt(s),a=o+r.length*l,h=Math.max(i,t-a/2);return new qn(r.from,r.length,h,a,0)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:l,length:a}=e.doc.line(s+n);return new qn(l,a,i+o*n,o,0)}}lineAt(t,e,i,n,s){if(e==jn.ByHeight)return this.blockAt(t,i,n,s);if(e==jn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new qn(e,n-e,0,0,0)}let{firstLine:r,perLine:o,perChar:l}=this.heightMetrics(i,s),a=i.doc.lineAt(t),h=o+a.length*l,c=a.number-r,u=n+o*c+l*(a.from-s-c);return new qn(a.from,a.length,Math.max(n,Math.min(u,n+this.height-h)),h,0)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(i,s);for(let h=t,c=n;h<=e;){let e=i.doc.lineAt(h);if(h==t){let i=e.number-o;c+=l*i+a*(t-s-i)}let n=l+a*e.length;r(new qn(e.from,e.length,c,n,0)),c+=n,h=e.to+1}}replace(t,e,i){let n=this.length-e;if(n>0){let t=i[i.length-1];t instanceof Jn?i[i.length-1]=new Jn(t.length+n):i.push(null,new Jn(n-1))}if(t>0){let e=i[0];e instanceof Jn?i[0]=new Jn(t+e.length):i.unshift(new Jn(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new Jn(t-1),null)}decomposeRight(t,e){e.push(null,new Jn(this.length-t-1))}updateHeight(t,e=0,i=!1,n){let s=e+this.length;if(n&&n.from<=e+this.length&&n.more){let i=[],r=Math.max(e,n.from),o=-1;for(n.from>e&&i.push(new Jn(n.from-e-1).updateHeight(t,e));r<=s&&n.more;){let e=t.doc.lineAt(r).length;i.length&&i.push(null);let s=n.heights[n.index++];-1==o?o=s:Math.abs(s-o)>=$n&&(o=-2);let l=new Un(e,s);l.outdated=!1,i.push(l),r+=e+1}r<=s&&i.push(null,new Jn(s-r).updateHeight(t,r));let l=Kn.of(i);return(o<0||Math.abs(l.height-this.height)>=$n||Math.abs(o-this.heightMetrics(t,e).perLine)>=$n)&&(t.heightChanged=!0),l}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Yn extends Kn{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return 1&this.flags}blockAt(t,e,i,n){let s=i+this.left.height;return to))return a;let h=e==jn.ByPosNoHeight?jn.ByPosNoHeight:jn.ByPos;return l?a.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(a)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,l=s+this.left.length+this.break;if(this.break)t=l&&this.right.forEachLine(t,e,i,o,l,r);else{let a=this.lineAt(l,jn.ByPos,i,n,s);t=t&&a.from<=e&&r(a),e>a.to&&this.right.forEachLine(a.to+1,e,i,o,l,r)}}replace(t,e,i){let n=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,i));let s=[];t>0&&this.decomposeLeft(t,s);let r=s.length;for(let t of i)s.push(t);if(t>0&&Xn(s,r-1),e=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,n=i+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t2*e.size||e.size>2*t.size?Kn.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,n){let{left:s,right:r}=this,o=e+s.length+this.break,l=null;return n&&n.from<=e+s.length&&n.more?l=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?l=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),l?this.balanced(s,r):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Xn(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof Jn&&(n=t[e+1])instanceof Jn&&t.splice(e-1,3,new Jn(i.length+1+n.length))}class Qn{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let t=Math.min(e,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Un?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new Un(t-this.pos,-1)),this.writtenTo=t,e>t&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t=5)&&this.addLineDeco(n,s,r)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new Un(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new Jn(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Un)return t;let e=new Un(0,-1);return this.nodes.push(e),e}addBlock(t){var e;this.enterLine();let i=null===(e=t.deco)||void 0===e?void 0:e.type;i!=Ke.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,i!=Ke.WidgetBefore&&(this.covering=t)}addLineDeco(t,e,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+i}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof Un||this.isCovered?(this.writtenToi.clientHeight||i.scrollWidth>i.clientWidth)&&"visible"!=n.overflow){let n=i.getBoundingClientRect();r=Math.max(r,n.left),o=Math.min(o,n.right),l=Math.max(l,n.top),a=e==t.parentNode?n.bottom:Math.min(a,n.bottom)}e="absolute"==n.position||"fixed"==n.position?i.offsetParent:i.parentNode}else{if(11!=e.nodeType)break;e=e.host}return{left:r-i.left,right:Math.max(r,o)-i.left,top:l-(i.top+e),bottom:Math.max(l,a)-(i.top+e)}}function es(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class is{constructor(t,e,i){this.from=t,this.to=e,this.size=i}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i"function"!=typeof t&&"cm-lineWrapping"==t.class));this.heightOracle=new Fn(i),this.stateDeco=e.facet(Si).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Ei(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ge.set(this.lineGaps.map((t=>t.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let n=i?e.head:e.anchor;if(!t.some((({from:t,to:e})=>n>=t&&n<=e))){let{from:e,to:i}=this.lineBlockAt(n);t.push(new rs(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?hs:new cs(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,(t=>{this.viewportLines.push(1==this.scaler.scale?t:us(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Si).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Ei.extendWithRanges(n,function(t,e,i){let n=new Zn;return Mt.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:A.empty(this.state.doc.length))),r=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2),o?(this.scrollAnchorPos=t.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),a&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(fi)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Bi.RTL:Bi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=i.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let t=l.width/i.offsetWidth,e=l.height/i.offsetHeight;t>.995&&t<1.005&&(t=1),e>.995&&e<1.005&&(e=1),this.scaleX==t&&this.scaleY==e||(this.scaleX=t,this.scaleY=e,h|=8,o=a=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==u&&this.paddingBottom==f||(this.paddingTop=u,this.paddingBottom=f,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=de(e.scrollDOM);let p=(this.printing?es:ts)(i,this.paddingTop),g=p.top-this.pixelViewport.top,m=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let y=l.width;if(this.contentDOMWidth==y&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),a){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(y-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:l}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,l,y/n,i),o&&(e.docView.minWidth=0,h|=8)}g>0&&m>0?c=Math.max(g,m):g<0&&m<0&&(c=Math.min(g,m)),s.heightChanged=!1;for(let n of this.viewports){let r=n.from==this.viewport.from?i:e.docView.measureVisibleLineHeights(n);this.heightMap=(o?Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle,[new Ei(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new _n(n.from,r))}s.heightChanged&&(h|=2)}let v=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return v&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:r,visibleBottom:o}=this,l=new rs(n.lineAt(r-1e3*i,jn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),jn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(tl.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,jn.ByPos,s,0,0);i="center"==e.y?(o.top+o.bottom)/2-r/2:"start"==e.y||"nearest"==e.y&&t=o+Math.max(10,Math.min(i,250)))&&n>r-2e3&&s>1,r=n<<1;if(this.defaultTextDirection!=Bi.LTR&&!i)return[];let o=[],l=(n,r,a,h)=>{if(r-nn&&tt.from>=a.from&&t.to<=a.to&&Math.abs(t.from-n)t.frome))));if(!f){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(B.cursor(r),!1,!0).head;t>n&&(r=t)}f=new is(n,r,this.gapSize(a,n,r,h))}o.push(f)};for(let t of this.viewportLines){if(t.lengtht.from&&l(t.from,s,t,e),ot.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];Mt.spans(t,this.viewport.from,this.viewport.to,{span(t,i){e.push({from:t,to:i})},point(){}},20);let i=e.length!=this.visibleRanges.length||this.visibleRanges.some(((t,i)=>t.from!=e[i].from||t.to!=e[i].to));return this.visibleRanges=e,i?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find((e=>e.from<=t&&e.to>=t))||us(this.heightMap.lineAt(t,jn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return us(this.heightMap.lineAt(this.scaler.fromDOM(t),jn.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return us(this.heightMap.blockAt(this.scaler.fromDOM(t),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 rs{constructor(t,e){this.from=t,this.to=e}}function os(t,e,i){let n=[],s=t,r=0;return Mt.spans(i,t,e,{span(){},point(t,e){t>s&&(n.push({from:s,to:t}),r+=t-s),s=e}},20),s=1)return e[e.length-1].to;let n=Math.floor(t*i);for(let t=0;;t++){let{from:i,to:s}=e[t],r=s-i;if(n<=r)return i+n;n-=r}}function as(t,e){let i=0;for(let{from:n,to:s}of t.ranges){if(e<=s){i+=e-n;break}i+=s-n}return i/t.total}const hs={toDOM:t=>t,fromDOM:t=>t,scale:1};class cs{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,jn.ByPos,t,0,0).top,o=e.lineAt(s,jn.ByPos,t,0,0).bottom;return n+=o-r,{from:i,to:s,top:r,bottom:o,domTop:0,domBottom:0}})),this.scale=(7e6-n)/(e.height-n);for(let t of this.viewports)t.domTop=r+(t.top-s)*this.scale,r=t.domBottom=t.domTop+(t.bottom-t.top),s=t.bottom}toDOM(t){for(let e=0,i=0,n=0;;e++){let s=eus(t,e))):t._content)}const fs=R.define({combine:t=>t.join(" ")}),ds=R.define({combine:t=>t.indexOf(!0)>-1}),ps=Ft.newName(),gs=Ft.newName(),ms=Ft.newName(),ws={"&light":"."+gs,"&dark":"."+ms};function ys(t,e,i){return new Ft(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,(e=>{if("&"==e)return t;if(!i||!i[e])throw new RangeError(`Unsupported selector: ${e}`);return i[e]})):t+" "+e})}const vs=ys("."+ps,{"&":{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,\')',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"}},ws),ks="￿";class bs{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(vt.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=ks}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let n=t;;){this.findPointBefore(i,n);let t=this.text.length;this.readNode(n);let s=n.nextSibling;if(s==e)break;let r=me.get(n),o=me.get(s);(r&&o?r.breakAfter:(r?r.breakAfter:xs(n))||xs(s)&&("BR"!=n.nodeName||n.cmIgnore)&&this.text.length>t)&&this.lineBreak(),n=s}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let s,r=-1,o=1;if(this.lineSeparator?(r=e.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(s=n.exec(e))&&(r=s.index,o=s[0].length),this.append(e.slice(i,r<0?e.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let e of this.points)e.node==t&&e.pos>this.text.length&&(e.pos-=o-1);i=r+o}}readNode(t){if(t.cmIgnore)return;let e=me.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(let t=i.iter();!t.next().done;)t.lineBreak?this.lineBreak():this.append(t.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(3==t.nodeType?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+Math.min(e,i.offset))}}function xs(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class Ss{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class As{constructor(t,e,i,n){this.typeOver=n,this.bounds=null,this.text="";let{impreciseHead:s,impreciseAnchor:r}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){let e=s||r?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:s,focusOffset:r}=t.observer.selectionRange;return i&&(e.push(new Ss(i,n)),s==i&&r==n||e.push(new Ss(s,r))),e}(t),i=new bs(e,t.state);i.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=i.text,this.newSel=function(t,e){if(0==t.length)return null;let i=t[0].pos,n=2==t.length?t[1].pos:i;return i>-1&&n>-1?B.single(i+e,n+e):null}(e,this.bounds.from)}else{let e=t.observer.selectionRange,i=s&&s.node==e.focusNode&&s.offset==e.focusOffset||!Xt(t.contentDOM,e.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),n=r&&r.node==e.anchorNode&&r.offset==e.anchorOffset||!Xt(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=B.single(n,i)}}}function Ms(e,i){let n,{newSel:s}=i,r=e.state.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(i.bounds){let{from:s,to:l}=i.bounds,a=r.from,h=null;(8===o||Be.android&&i.text.length0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;return"end"==n&&(i-=o+Math.max(0,r-Math.min(o,l))-r),o=o?r-i:0,l=r+(l-o),o=r):l=l?r-i:0,o=r+(o-l),l=r),{from:r,toA:o,toB:l}}(e.state.doc.sliceString(s,l,ks),i.text,a-s,h);c&&(Be.chrome&&13==o&&c.toB==c.from+2&&i.text.slice(c.from,c.toB)==ks+ks&&c.toB--,n={from:s+c.from,to:s+c.toA,insert:t.of(i.text.slice(c.from,c.toB).split(ks))})}else s&&(!e.hasFocus&&e.state.facet(mi)||s.main.eq(r))&&(s=null);if(!n&&!s)return!1;if(!n&&i.typeOver&&!r.empty&&s&&s.main.empty?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,r.to)}:n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,r.to))}:(Be.mac||Be.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(s&&2==n.insert.length&&(s=B.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):Be.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=B.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){if(Be.ios&&e.inputState.flushIOSKey(e))return!0;if(Be.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&ue(e.contentDOM,"Enter",13)||(n.from==r.from-1&&n.to==r.to&&0==n.insert.length||8==o&&n.insert.lengthr.head)&&ue(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&ue(e.contentDOM,"Delete",46)))return!0;let t,i=n.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let l=()=>t||(t=function(t,e,i){let n,s=t.state,r=s.selection.main;if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let i=r.frome.to?s.sliceDoc(e.to,r.to):"";n=s.replaceSelection(t.state.toText(i+e.insert.sliceString(0,void 0,t.state.lineBreak)+o))}else{let o=s.changes(e),l=i&&i.main.to<=o.newLength?i.main:void 0;if(s.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=r.to&&e.to>=r.to-10){let a,h=t.state.sliceDoc(e.from,e.to),c=i&&Xi(t,i.main.head);if(c){let t=e.insert.length-(e.to-e.from);a={from:c.from,to:c.to-t}}else a=t.state.doc.lineAt(r.head);let u=r.to-e.to,f=r.to-r.from;n=s.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:l||i.map(o)};let n=i.to-u,c=n-h.length;if(i.to-i.from!=f||t.state.sliceDoc(c,n)!=h||i.to>=a.from&&i.from<=a.to)return{range:i};let d=s.changes({from:c,to:n,insert:e.insert}),p=i.to-r.to;return{changes:d,range:l?B.range(Math.max(0,l.anchor+p),Math.max(0,l.head+p)):i.map(d)}}))}else n={changes:o,selection:l&&s.selection.replaceRange(l)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),s.update(n,{userEvent:o,scrollIntoView:!0})}(e,n,s));return e.state.facet(hi).some((t=>t(e,n.from,n.to,i,l)))||e.dispatch(l()),!0}if(s&&!s.main.eq(r)){let t=!1,i="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),i=e.inputState.lastSelectionOrigin),e.dispatch({selection:s,scrollIntoView:t,userEvent:i}),!0}return!1}const Ts={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Cs=Be.ie&&Be.ie_version<=11;class Os{constructor(t){this.view=t,this.active=!1,this.selectionRange=new oe,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=t.contentDOM,this.observer=new MutationObserver((e=>{for(let t of e)this.queue.push(t);(Be.ie&&Be.ie_version<=11||Be.ios&&t.composing)&&e.some((t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():this.flush()})),Cs&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate)this.view.requestMeasure())),this.resizeContent.observe(t.contentDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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((t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runScrollHandlers(this.view,t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}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(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some(((e,i)=>e!=t[i])))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(mi)?i.root.activeElement!=this.dom:!Qt(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(Be.ie&&Be.ie_version<=11||Be.android&&Be.chrome)&&!i.state.selection.main.empty&&n.focusNode&&te(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Be.safari&&11==t.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t){let e=null;function i(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",i,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),!e)return null;let n=e.startContainer,s=e.startOffset,r=e.endContainer,o=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return te(l.node,l.offset,r,o)&&([n,s,r,o]=[r,o,n,s]),{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||Yt(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=Qt(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=t.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&t.force&&ue(this.dom,t.key,t.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(t)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,n=!1;for(let s of t){let t=this.readMutation(s);t&&(t.typeOver&&(n=!0),-1==e?({from:e,to:i}=t):(e=Math.min(t.from,e),i=Math.max(t.to,i)))}return{from:e,to:i,typeOver:n}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),n=this.selectionChanged&&Qt(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new As(this.view,t,e,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return!1;let i=this.view.state,n=Ms(this.view,e);return this.view.state==i&&this.view.update([]),n}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){let i=Ds(e,t.previousSibling||t.target.previousSibling,-1),n=Ds(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var t,e,i,n;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect(),null===(n=this.resizeContent)||void 0===n||n.disconnect();for(let t of this.scrollTargets)t.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 Ds(t,e,i){for(;e;){let n=me.get(e);if(n&&n.parent==t)return n;let s=e.parentNode;e=s!=t.dom?s:i>0?e.nextSibling:e.previousSibling}return null}class Es{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}constructor(t={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM);let{dispatch:e}=t;this.dispatchTransactions=t.dispatchTransactions||e&&(t=>t.forEach((t=>e(t,this))))||(t=>this.update(t)),this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(t.parent)||document,this.viewState=new ss(t.state||vt.create(t)),this.plugins=this.state.facet(yi).map((t=>new ki(t)));for(let t of this.plugins)t.update(this);this.observer=new Os(this),this.inputState=new dn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new Ji(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}dispatch(...t){let e=1==t.length&&t[0]instanceof ht?t:1==t.length&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e,i=!1,n=!1,s=this.state;for(let e of t){if(e.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=e.state}if(this.destroyed)return void(this.viewState.state=s);let r=this.hasFocus,o=0,l=null;t.some((t=>t.annotation(In)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,l=Hn(s,r),l||(o=1));let a=this.observer.delayedAndroidKey,h=null;if(a?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(h=null)):this.observer.clear(),s.facet(vt.phrases)!=this.state.facet(vt.phrases))return this.setState(s);e=Li.create(this,s,t),e.flags|=o;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let e of t){if(c&&(c=c.map(e.changes)),e.scrollIntoView){let{main:t}=e.state.selection;c=new di(t.empty?t:B.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(pi)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Ps.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Di)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(i,t.some((t=>t.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(e.startState.facet(fs)!=e.state.facet(fs)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(ai))t(e);(l||h)&&Promise.resolve().then((()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!Ms(this,h)&&a.force&&ue(this.contentDOM,a.key,a.keyCode)}))}setState(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=t);this.updateState=2;let e=this.hasFocus;try{for(let t of this.plugins)t.destroy(this);this.viewState=new ss(t),this.plugins=t.facet(yi).map((t=>new ki(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new Ji(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(yi),i=t.state.facet(yi);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new ki(s));else{let e=this.plugins[i];e.mustUpdate=t,n.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=n,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let e of this.plugins)e.mustUpdate=t;for(let t=0;t-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,i=this.scrollDOM,n=i.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:r}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(r=-1),this.viewState.scrollAnchorHeight=-1;try{for(let t=0;;t++){if(r<0)if(de(i))s=-1,r=this.viewState.heightMap.height;else{let t=this.viewState.scrollAnchorAt(n);s=t.from,r=t.top}this.updateState=1;let o=this.viewState.measure(this);if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(t>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&o||([this.measureRequests,l]=[l,this.measureRequests]);let a=l.map((t=>{try{return t.read(this)}catch(t){return gi(this.state,t),Bs}})),h=Li.create(this,this.state,[]),c=!1;h.flags|=o,e?e.flags|=o:e=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),c=this.docView.update(h));for(let t=0;t1||t<-1){n+=t,i.scrollTop=n/this.scaleY,r=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(ai))t(e)}get themeClasses(){return ps+" "+(this.state.facet(ds)?ms:gs)+" "+this.state.facet(fs)}updateAttrs(){let t=Ns(this,bi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(mi)?"true":"false",class:"cm-content",style:`${Be.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ns(this,xi,e);let i=this.observer.ignore((()=>{let i=qe(this.contentDOM,this.contentAttrs,e),n=qe(this.dom,this.editorAttrs,t);return i||n}));return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let t of i.effects)t.is(Es.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value)}mountStyles(){this.styleModules=this.state.facet(Di);let t=this.state.facet(Es.cspNonce);Ft.mount(this.root,this.styleModules.concat(vs).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(let e=0;ee.spec==t))||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return fn(this,t,cn(this,t,e,i))}moveByGroup(t,e){return fn(this,t,cn(this,t,e,(e=>function(t,e,i){let n=t.state.charCategorizer(e),s=n(i);return t=>{let e=n(t);return s==mt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=function(t,e){let i=t.lineBlockAt(e);if(Array.isArray(i.type))for(let t of i.type)if(t.to>e||t.to==e&&(t.to==i.to||t.type==Ke.Text))return t;return i}(t,e.head),r=n&&s.type==Ke.Text&&(t.lineWrapping||s.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head):null;if(r){let e=t.dom.getBoundingClientRect(),n=t.textDirectionAt(s.from),o=t.posAtCoords({x:i==(n==Bi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return B.cursor(o,i?-1:1)}return B.cursor(i?s.to:s.from,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return fn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return B.cursor(s,e.assoc);let o,l=e.goalColumn,a=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==l&&(l=h.left-a.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==l&&(l=Math.min(a.right-a.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=a.left+l,f=null!=n?n:t.viewState.heightOracle.textHeight>>1;for(let i=0;;i+=10){let n=o+(f+i)*r,h=an(t,{x:u,y:n},!1,r);if(na.bottom||(r<0?hs))return B.cursor(h,e.assoc,void 0,l)}}(this,t,e,i))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),an(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let n=this.state.doc.lineAt(t),s=this.bidiSpans(n);return se(i,s[Fi.find(s,t-n.from,-1,e)].dir==Bi.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(ui)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Ls)return Ki(t.length);let e,i=this.textDirectionAt(t.from);for(let n of this.bidiCache)if(n.from==t.from&&n.dir==i&&(n.fresh||_i(n.isolates,e=Ti(this,t.from,t.to))))return n.order;e||(e=Ti(this,t.from,t.to));let n=function(t,e,i){if(!t)return[new Fi(0,0,e==Ni?1:0)];if(e==Pi&&!i.length&&!Vi.test(t))return Ki(t.length);if(i.length)for(;t.length>qi.length;)qi[qi.length]=256;let n=[],s=e==Pi?0:1;return $i(t,s,s,i,0,t.length,n),n}(t.text,i,e);return this.bidiCache.push(new Ps(t.from,t.to,i,e,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Be.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{he(this.contentDOM),this.docView.updateSelection()}))}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.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(t,e={}){return pi.of(new di("number"==typeof t?B.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return vi.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=Ft.newName(),n=[fs.of(i),Di.of(ys(`.${i}`,t))];return e&&e.dark&&n.push(ds.of(!0)),n}static baseTheme(t){return j.lowest(Di.of(ys("."+ps,t,ws)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&me.get(i)||me.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Es.styleModule=Di,Es.inputHandler=hi,Es.focusChangeEffect=ci,Es.perLineTextDirection=ui,Es.exceptionSink=li,Es.updateListener=ai,Es.editable=mi,Es.mouseSelectionStyle=oi,Es.dragMovesSelection=ri,Es.clickAddsSelectionRange=si,Es.decorations=Si,Es.atomicRanges=Ai,Es.bidiIsolatedRanges=Mi,Es.scrollMargins=Ci,Es.darkTheme=ds,Es.cspNonce=R.define({combine:t=>t.length?t[0]:""}),Es.contentAttributes=xi,Es.editorAttributes=bi,Es.lineWrapping=Es.contentAttributes.of({class:"cm-lineWrapping"}),Es.announce=at.define();const Ls=4096,Bs={};class Ps{constructor(t,e,i,n,s,r){this.from=t,this.to=e,this.dir=i,this.isolates=n,this.fresh=s,this.order=r}static update(t,e){if(e.empty&&!t.some((t=>t.fresh)))return t;let i=[],n=t.length?t[t.length-1].dir:Bi.LTR;for(let s=Math.max(0,t.length-10);s=0;s--){let e=n[s],r="function"==typeof e?e(t):e;r&&Ve(r,i)}return i}const Rs=Be.mac?"mac":Be.windows?"win":Be.linux?"linux":"key";function Is(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t}const Hs=j.default(Es.domEventHandlers({keydown:(t,e)=>qs(Vs(e.state),t,e,"editor")})),zs=R.define({enables:Hs}),Ws=new WeakMap;function Vs(t){let e=t.facet(zs),i=Ws.get(e);return i||Ws.set(e,i=function(t,e=Rs){let i=Object.create(null),n=Object.create(null),s=(t,e)=>{let i=n[t];if(null==i)n[t]=e;else if(i!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},r=(t,n,r,o,l)=>{var a,h;let c=i[t]||(i[t]=Object.create(null)),u=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,l=i[i.length-1];"Space"==l&&(l=" ");for(let t=0;t{let n=Fs={view:e,prefix:i,scope:t};return setTimeout((()=>{Fs==n&&(Fs=null)}),_s),!0}]})}let f=u.join(" ");s(f,!1);let d=c[f]||(c[f]={preventDefault:!1,stopPropagation:!1,run:(null===(h=null===(a=c._any)||void 0===a?void 0:a.run)||void 0===h?void 0:h.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!0),l&&(d.stopPropagation=!0)};for(let n of t){let t=n.scope?n.scope.split(" "):["editor"];if(n.any)for(let e of t){let t=i[e]||(i[e]=Object.create(null));t._any||(t._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let e in t)t[e].run.push(n.any)}let s=n[e]||n.key;if(s)for(let e of t)r(e,s,n.run,n.preventDefault,n.stopPropagation),n.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault,n.stopPropagation)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let Fs=null;const _s=4e3;function qs(t,e,i,n){let s=function(t){var e=!(Kt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Gt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?$t:jt)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(e),r=k(y(s,0))==s.length&&" "!=s,o="",l=!1,a=!1,h=!1;Fs&&Fs.view==i&&Fs.scope==n&&(o=Fs.prefix+" ",mn.indexOf(e.keyCode)<0&&(a=!0,Fs=null));let c,u,f=new Set,d=t=>{if(t){for(let n of t.run)if(!f.has(n)&&(f.add(n),n(i,e)))return t.stopPropagation&&(h=!0),!0;t.preventDefault&&(t.stopPropagation&&(h=!0),a=!0)}return!1},p=t[n];return p&&(d(p[o+Is(s,e,!r)])?l=!0:r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Be.windows&&e.ctrlKey&&e.altKey)&&(c=jt[e.keyCode])&&c!=s?(d(p[o+Is(c,e,!0)])||e.shiftKey&&(u=$t[e.keyCode])!=s&&u!=c&&d(p[o+Is(u,e,!1)]))&&(l=!0):r&&e.shiftKey&&d(p[o+Is(s,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),a&&(l=!0),l&&h&&e.stopPropagation(),l}Be.ios;const js=R.define({combine(t){let e,i;for(let n of t)e=e||n.topContainer,i=i||n.bottomContainer;return{topContainer:e,bottomContainer:i}}});function $s(t,e){let i=t.plugin(Ks),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Ks=vi.fromClass(class{constructor(t){this.input=t.state.facet(Js),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(js);this.top=new Gs(t,!0,e.topContainer),this.bottom=new Gs(t,!1,e.bottomContainer),this.top.sync(this.panels.filter((t=>t.top))),this.bottom.sync(this.panels.filter((t=>!t.top)));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(t){let e=t.state.facet(js);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Gs(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Gs(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Js);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,l=this.specs.indexOf(i);l<0?(e=i(t.view),o.push(e)):(e=this.panels[l],e.update&&e.update(t)),n.push(e),(e.top?s:r).push(e)}this.specs=e,this.panels=n,this.top.sync(s),this.bottom.sync(r);for(let t of o)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}else for(let e of this.panels)e.update&&e.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Es.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Gs{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Us(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Us(t)}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 t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function Us(t){let e=t.nextSibling;return t.remove(),e}const Js=R.define({enables:Ks});class Ys extends bt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Ys.prototype.elementClass="",Ys.prototype.toDOM=void 0,Ys.prototype.mapMode=x.TrackBefore,Ys.prototype.startSide=Ys.prototype.endSide=-1,Ys.prototype.point=!0;const Xs=R.define(),Qs=R.define(),Zs=R.define({combine:t=>t.some((t=>t))});function tr(t){let e=[er];return t&&!1===t.fixed&&e.push(Zs.of(!0)),e}const er=vi.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Qs).map((e=>new rr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Zs),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,n=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(n<.8*(i.to-i.from))}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Zs)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let i=Mt.iter(this.view.state.facet(Xs),this.view.viewport.from),n=[],s=this.gutters.map((t=>new sr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(t.type)){let e=!0;for(let r of t.type)if(r.type==Ke.Text&&e){nr(i,n,r.from);for(let t of s)t.line(this.view,r,n);e=!1}else if(r.widget)for(let t of s)t.widget(this.view,r)}else if(t.type==Ke.Text){nr(i,n,t.from);for(let e of s)e.line(this.view,t,n)}else if(t.widget)for(let e of s)e.widget(this.view,t);for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(Qs),i=t.state.facet(Qs),n=t.docChanged||t.heightChanged||t.viewportChanged||!Mt.eq(t.startState.facet(Xs),t.state.facet(Xs),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let e of this.gutters)e.update(t)&&(n=!0);else{n=!0;let s=[];for(let n of i){let i=e.indexOf(n);i<0?s.push(new rr(this.view,n)):(this.gutters[i].update(t),s.push(this.gutters[i]))}for(let t of this.gutters)t.dom.remove(),s.indexOf(t)<0&&t.destroy();for(let t of s)this.dom.appendChild(t.dom);this.gutters=s}return n}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>Es.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Bi.LTR?{left:i.dom.offsetWidth*e.scaleX}:{right:i.dom.offsetWidth*e.scaleX}:null}))});function ir(t){return Array.isArray(t)?t:[t]}function nr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class sr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=Mt.iter(t.markers,e.from)}addElement(t,e,i){let{gutter:n}=this,s=e.top-this.height;if(this.i==n.elements.length){let r=new or(t,e.height,s,i);n.elements.push(r),n.dom.appendChild(r.dom)}else n.elements[this.i].update(t,e.height,s,i);this.height=e.bottom,this.i++}line(t,e,i){let n=[];nr(this.cursor,n,e.from),i.length&&(n=n.concat(i));let s=this.gutter.config.lineMarker(t,e,n);s&&n.unshift(s);let r=this.gutter;(0!=n.length||r.config.renderEmptyElements)&&this.addElement(t,e,n)}widget(t,e){let i=this.gutter.config.widgetMarker(t,e.widget,e);i&&this.addElement(t,e,[i])}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class rr{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in e.domEventHandlers)this.dom.addEventListener(i,(n=>{let s,r=n.target;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let t=r.getBoundingClientRect();s=(t.top+t.bottom)/2}else s=n.clientY;let o=t.lineBlockAtHeight(s-t.documentTop);e.domEventHandlers[i](t,o,n)&&n.preventDefault()}));this.markers=ir(e.markers(t)),e.initialSpacer&&(this.spacer=new or(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=ir(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let e=this.config.updateSpacer(this.spacer.markers[0],t);e!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[e])}let i=t.view.viewport;return!Mt.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}destroy(){for(let t of this.elements)t.destroy()}}class or{constructor(t,e,i,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,n)}update(t,e,i,n){this.height!=e&&(this.height=e,this.dom.style.height=e/t.scaleY+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i/t.scaleY+"px":""),function(t,e){if(t.length!=e.length)return!1;for(let i=0;ikt(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let t in e){let n=i[t],s=e[t];i[t]=n?(t,e,i)=>n(t,e,i)||s(t,e,i):s}return i}})});class hr extends Ys{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function cr(t,e){return t.state.facet(ar).formatNumber(e,t.state)}const ur=Qs.compute([ar],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(lr),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new hr(cr(t,t.state.doc.lineAt(e.from).number)),widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(ar)!=t.state.facet(ar),initialSpacer:t=>new hr(cr(t,fr(t.state.doc.lines))),updateSpacer(t,e){let i=cr(e.view,fr(e.view.state.doc.lines));return i==t.number?t:new hr(i)},domEventHandlers:t.facet(ar).domEventHandlers})));function fr(t){let e=9;for(;e0&&void 0!==arguments[0]?arguments[0]:this.defaultExtensions;this.state=vt.create({doc:this.$textarea.textSelection("getContents"),extensions:e}),this.view=new Es({state:this.state,parent:this.$textarea.parent()[0]}),this.$textarea.hide(),this.$textarea[0].form&&this.$textarea[0].form.addEventListener("submit",(function(){t.$textarea.val(t.view.state.doc.toString())})),$(this.view.dom).textSelection("register",this.cmTextSelection),this.$textarea.textSelection("register",this.cmTextSelection),mw.hook("ext.CodeMirror.switch").fire(!0,$(this.view.dom))}},{key:"logUsage",value:function(t){var e=Object.assign({session_token:mw.user.sessionId(),user_id:mw.user.getId()},t),i=mw.config.get("wgUserEditCountBucket");null!==i&&(e.user_edit_count_bucket=i),mw.track("event.CodeMirrorUsage",e)}},{key:"setCodeMirrorPreference",value:function(t){mw.user.isNamed()&&((new mw.Api).saveOption("usecodemirror",t?1:0),mw.user.options.set("usecodemirror",t?1:0))}},{key:"cmTextSelection",get:function(){var t=this,e=$(this.view.dom);return{getContents:function(){return t.view.state.doc.toString()},setContents:function(i){return t.view.dispatch({changes:{from:0,to:t.view.state.doc.length,insert:i}}),e},getSelection:function(){return t.view.state.sliceDoc(t.view.state.selection.main.from,t.view.state.selection.main.to)},setSelection:function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{start:0,end:0};return t.view.dispatch({selection:{anchor:i.start,head:i.end||i.start}}),t.view.focus(),e},replaceSelection:function(i){return t.view.dispatch(t.view.state.replaceSelection(i)),e},getCaretPosition:function(e){return e.startAndEnd?[t.view.state.selection.main.from,t.view.state.selection.main.to]:t.view.state.selection.main.head},scrollToCaretPosition:function(){return t.view.dispatch({effects:Es.scrollIntoView(t.view.state.selection.main.head)}),e}}}}],i&&pr(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();const wr=1024;let yr=0;class vr{constructor(t,e){this.from=t,this.to=e}}class kr{constructor(t={}){this.id=yr++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=Sr.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}kr.closedBy=new kr({deserialize:t=>t.split(" ")}),kr.openedBy=new kr({deserialize:t=>t.split(" ")}),kr.group=new kr({deserialize:t=>t.split(" ")}),kr.isolate=new kr({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),kr.contextHash=new kr({perNode:!0}),kr.lookAhead=new kr({perNode:!0}),kr.mounted=new kr({perNode:!0});class br{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}static get(t){return t&&t.props&&t.props[kr.mounted.id]}}const xr=Object.create(null);class Sr{constructor(t,e,i,n=0){this.name=t,this.props=e,this.id=i,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):xr,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new Sr(t.name||"",e,t.id,i);if(t.props)for(let i of t.props)if(Array.isArray(i)||(i=i(n)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[i[0].id]=i[1]}return n}prop(t){return this.props[t.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(kr.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let n of i.split(" "))e[n]=t[i];return t=>{for(let i=t.prop(kr.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}Sr.none=new Sr("",Object.create(null),0,8);class Ar{constructor(t){this.types=t;for(let e=0;e=e){let o=new Nr(r.tree,r.overlay[0].from+t.from,-1,t);(s||(s=[n])).push(Br(o,e,i,!1))}}return s?Wr(s):n}(this,t,e)}iterate(t){let{enter:e,leave:i,from:n=0,to:s=this.length}=t,r=t.mode||0,o=(r&Cr.IncludeAnonymous)>0;for(let t=this.cursor(r|Cr.IncludeAnonymous);;){let r=!1;if(t.from<=s&&t.to>=n&&(!o&&t.type.isAnonymous||!1!==e(t))){if(t.firstChild())continue;r=!0}for(;r&&i&&(o||!t.type.isAnonymous)&&i(t),!t.nextSibling();){if(!t.parent())return;r=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:$r(Sr.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new Or(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new Or(Sr.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=wr,reused:r=[],minRepeatType:o=n.types.length}=t,l=Array.isArray(i)?new Dr(i,i.length):i,a=n.types,h=0,c=0;function u(t,e,i,m,w,y){let{id:v,start:k,end:b,size:x}=l,S=c;for(;x<0;){if(l.next(),-1==x){let e=r[v];return i.push(e),void m.push(k-t)}if(-3==x)return void(h=v);if(-4==x)return void(c=v);throw new RangeError(`Unrecognized record size: ${x}`)}let A,M,T=a[v],C=k-t;if(b-k<=s&&(M=function(t,e){let i=l.fork(),n=0,r=0,a=0,h=i.end-s,c={size:0,start:0,skip:0};t:for(let s=i.pos-t;i.pos>s;){let t=i.size;if(i.id==e&&t>=0){c.size=n,c.start=r,c.skip=a,a+=4,n+=4,i.next();continue}let l=i.pos-t;if(t<0||l=o?4:0,f=i.start;for(i.next();i.pos>l;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=f,n+=t,a+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=a),c.size>4?c:void 0}(l.pos-e,w))){let e=new Uint16Array(M.size-M.skip),i=l.pos-M.size,s=e.length;for(;l.pos>i;)s=g(M.start,e,s);A=new Er(e,b-M.start,n),C=M.start-t}else{let t=l.pos-x;l.next();let e=[],i=[],n=v>=o?v:-1,r=0,a=b;for(;l.pos>t;)n>=0&&l.id==n&&l.size>=0?(l.end<=a-s&&(d(e,i,k,r,l.end,a,n,S),r=e.length,a=l.end),l.next()):y>2500?f(k,t,e,i):u(k,t,e,i,n,y+1);if(n>=0&&r>0&&r-1&&r>0){let t=function(t){return(e,i,n)=>{let s,r,o=0,l=e.length-1;if(l>=0&&(s=e[l])instanceof Or){if(!l&&s.type==t&&s.length==n)return s;(r=s.prop(kr.lookAhead))&&(o=i[l]+s.length+r)}return p(t,e,i,n,o)}}(T);A=$r(T,e,i,0,e.length,0,b-k,t,t)}else A=p(T,e,i,b-k,S-b)}i.push(A),m.push(C)}function f(t,e,i,r){let o=[],a=0,h=-1;for(;l.pos>e;){let{id:t,start:e,end:i,size:n}=l;if(n>4)l.next();else{if(h>-1&&e=0;t-=3)e[i++]=o[t],e[i++]=o[t+1]-s,e[i++]=o[t+2]-s,e[i++]=i;i.push(new Er(e,o[2]-s,n)),r.push(s-t)}}function d(t,e,i,s,r,o,l,a){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[l],h,c,o-r,a-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[kr.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[kr.lookAhead,s];r=r?[t].concat(r):[t]}return new Or(t,e,i,n,r)}function g(t,e,i){let{id:n,start:s,end:r,size:a}=l;if(l.next(),a>=0&&n4){let n=l.pos-(a-4);for(;l.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==a?h=n:-4==a&&(c=n);return i}let m=[],w=[];for(;l.pos>0;)u(t.start||0,t.bufferStart||0,m,w,-1,0);let y=null!==(e=t.length)&&void 0!==e?e:m.length?w[0]+m[0].length:0;return new Or(a[t.topID],m.reverse(),w.reverse(),y)}(t)}}Or.empty=new Or(Sr.none,[],[],0);class Dr{constructor(t,e){this.buffer=t,this.index=e}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 Dr(this.buffer,this.index)}}class Er{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return Sr.none}toString(){let t=[];for(let e=0;e0));l=r[l+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,l=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function Br(t,e,i,n){for(var s;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to0?o.length:-1;t!=a;t+=e){let a=o[t],h=l[t]+r.from;if(Lr(n,i,h,h+a.length))if(a instanceof Er){if(s&Cr.ExcludeBuffers)continue;let o=a.findChild(0,a.buffer.length,e,i-h,n);if(o>-1)return new zr(new Hr(r,a,t,h),null,o)}else if(s&Cr.IncludeAnonymous||!a.type.isAnonymous||_r(a)){let o;if(!(s&Cr.IgnoreMounts)&&(o=br.get(a))&&!o.overlay)return new Nr(o.tree,h,t,r);let l=new Nr(a,h,t,r);return s&Cr.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(e<0?a.children.length-1:0,e,i,n)}}if(s&Cr.IncludeAnonymous||!r.type.isAnonymous)return null;if(t=r.index>=0?r.index+e:e<0?-1:r._parent._tree.children.length,r=r._parent,!r)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(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,i=0){let n;if(!(i&Cr.IgnoreOverlays)&&(n=br.get(this._tree))&&n.overlay){let i=t-this.from;for(let{from:t,to:s}of n.overlay)if((e>0?t<=i:t=i:s>i))return new Nr(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}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}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Rr(t,e,i,n){let s=t.cursor(),r=[];if(!s.firstChild())return r;if(null!=i)for(;!s.type.is(i);)if(!s.nextSibling())return r;for(;;){if(null!=n&&s.type.is(n))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return null==n?r:[]}}function Ir(t,e,i=e.length-1){for(let n=t.parent;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[i]&&e[i]!=n.name)return!1;i--}}return!0}class Hr{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class zr extends Pr{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(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,e,i){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,i);return s<0?null:new zr(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,i=0){if(i&Cr.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return s<0?null:new zr(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new zr(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new zr(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,n=this.index+4,s=i.buffer[this.index+3];if(s>n){let r=i.buffer[this.index+1];t.push(i.slice(n,s,r)),e.push(0)}return new Or(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Wr(t){if(!t.length)return null;let e=0,i=t[0];for(let n=1;ni.from||s.to0){if(this.index-1)for(let n=e+t,s=t<0?-1:i._tree.children.length;n!=s;n+=t){let t=i._tree.children[n];if(this.mode&Cr.IncludeAnonymous||t instanceof Er||!t.type.isAnonymous||_r(t))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let r=t;r;r=r._parent)if(r.index==n){if(n==this.index)return r;e=r,i=s+1;break t}n=this.stack[--s]}for(let t=i;t=0;s--){if(s<0)return Ir(this.node,t,n);let r=i[e.buffer[this.stack[s]]];if(!r.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}}function _r(t){return t.children.some((t=>t instanceof Er||!t.type.isAnonymous||_r(t)))}const qr=new WeakMap;function jr(t,e){if(!t.isAnonymous||e instanceof Er||e.type!=t)return 1;let i=qr.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof Or)){i=1;break}i+=jr(t,n)}qr.set(e,i)}return i}function $r(t,e,i,n,s,r,o,l,a){let h=0;for(let i=n;i=c)break;p+=e}if(h==s+1){if(p>c){let t=i[s];e(t.children,t.positions,0,t.children.length,n[s]+l);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-d;u.push($r(t,i,n,s,h,d,e,null,a))}f.push(d+l-r)}}(e,i,n,s,0),(l||a)(u,f,o)}class Kr{constructor(t,e,i,n,s=!1,r=!1){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=(s?1:0)|(r?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(t,e=[],i=!1){let n=[new Kr(0,t.length,t,0,!1,i)];for(let i of e)i.to>t.length&&n.push(i);return n}static applyChanges(t,e,i=128){if(!e.length)return t;let n=[],s=1,r=t.length?t[0]:null;for(let o=0,l=0,a=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||a){let t=Math.max(e.from,l)-a,i=Math.min(e.to,c)-a;e=t>=i?null:new Kr(t,i,e.tree,e.offset+a,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew vr(t.from,t.to))):[new vr(0,0)]:[new vr(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let n=this.startParse(t,e,i);for(;;){let t=n.advance();if(t)return t}}}class Ur{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new kr({perNode:!0});let Jr=0;class Yr{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Jr++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Yr([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new Qr;return e=>e.modified.indexOf(t)>-1?e:Qr.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Xr=0;class Qr{constructor(){this.instances=[],this.id=Xr++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find((i=>{return i.base==t&&(n=e,s=i.modified,n.length==s.length&&n.every(((t,e)=>t==s[e])));var n,s}));if(i)return i;let n=[],s=new Yr(n,t,e);for(let t of e)t.instances.push(s);let r=function(t){let e=[[]];for(let i=0;ie.length-t.length))}(e);for(let e of t.set)if(!e.modified.length)for(let t of r)n.push(Qr.get(e,t));return s}}function Zr(t){let e=Object.create(null);for(let i in t){let n=t[i];Array.isArray(n)||(n=[n]);for(let t of i.split(" "))if(t){let i=[],s=2,r=t;for(let e=0;;){if("..."==r&&e>0&&e+3==t.length){s=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!n)throw new RangeError("Invalid path: "+t);if(i.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),e+=n[0].length,e==t.length)break;let o=t[e++];if(e==t.length&&"!"==o){s=0;break}if("/"!=o)throw new RangeError("Invalid path: "+t);r=t.slice(e)}let o=i.length-1,l=i[o];if(!l)throw new RangeError("Invalid path: "+t);let a=new eo(n,s,o>0?i.slice(0,o):null);e[l]=a.sort(e[l])}}return to.add(e)}const to=new kr;class eo{constructor(t,e,i,n){this.tags=t,this.mode=e,this.context=i,this.next=n}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(t){return!t||t.depth{let e=s;for(let n of t)for(let t of n.set){let n=i[t.id];if(n){e=e?e+" "+n:n;break}}return e},scope:n}}function no(t,e,i,n=0,s=t.length){let r=new so(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}eo.empty=new eo([],2,null);class so{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,n,s){let{type:r,from:o,to:l}=t;if(o>=i||l<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let a=n,h=function(t){let e=t.type.prop(to);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||eo.empty,c=function(t,e){let i=null;for(let n of t){let t=n.style(e);t&&(i=i?i+" "+t:t)}return i}(s,h.tags);if(c&&(a&&(a+=" "),a+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(Math.max(e,o),a),h.opaque)return;let u=t.tree&&t.tree.prop(kr.mounted);if(u&&u.overlay){let r=t.node.enter(u.overlay[0].from+o,1),h=this.highlighters.filter((t=>!t.scope||t.scope(u.tree.type))),c=t.firstChild();for(let f=0,d=o;;f++){let p=f=g)&&t.nextSibling()););if(!p||g>i)break;d=p.to+o,d>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,d),"",h),this.startSpan(Math.min(i,d),a))}c&&t.parent()}else if(t.firstChild()){u&&(n="");do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),a)}}while(t.nextSibling());t.parent()}}}const ro=Yr.define,oo=ro(),lo=ro(),ao=ro(lo),ho=ro(lo),co=ro(),uo=ro(co),fo=ro(co),po=ro(),go=ro(po),mo=ro(),wo=ro(),yo=ro(),vo=ro(yo),ko=ro(),bo={comment:oo,lineComment:ro(oo),blockComment:ro(oo),docComment:ro(oo),name:lo,variableName:ro(lo),typeName:ao,tagName:ro(ao),propertyName:ho,attributeName:ro(ho),className:ro(lo),labelName:ro(lo),namespace:ro(lo),macroName:ro(lo),literal:co,string:uo,docString:ro(uo),character:ro(uo),attributeValue:ro(uo),number:fo,integer:ro(fo),float:ro(fo),bool:ro(co),regexp:ro(co),escape:ro(co),color:ro(co),url:ro(co),keyword:mo,self:ro(mo),null:ro(mo),atom:ro(mo),unit:ro(mo),modifier:ro(mo),operatorKeyword:ro(mo),controlKeyword:ro(mo),definitionKeyword:ro(mo),moduleKeyword:ro(mo),operator:wo,derefOperator:ro(wo),arithmeticOperator:ro(wo),logicOperator:ro(wo),bitwiseOperator:ro(wo),compareOperator:ro(wo),updateOperator:ro(wo),definitionOperator:ro(wo),typeOperator:ro(wo),controlOperator:ro(wo),punctuation:yo,separator:ro(yo),bracket:vo,angleBracket:ro(vo),squareBracket:ro(vo),paren:ro(vo),brace:ro(vo),content:po,heading:go,heading1:ro(go),heading2:ro(go),heading3:ro(go),heading4:ro(go),heading5:ro(go),heading6:ro(go),contentSeparator:ro(po),list:ro(po),quote:ro(po),emphasis:ro(po),strong:ro(po),link:ro(po),monospace:ro(po),strikethrough:ro(po),inserted:ro(),deleted:ro(),changed:ro(),invalid:ro(),meta:ko,documentMeta:ro(ko),annotation:ro(ko),processingInstruction:ro(ko),definition:Yr.defineModifier(),constant:Yr.defineModifier(),function:Yr.defineModifier(),standard:Yr.defineModifier(),local:Yr.defineModifier(),special:Yr.defineModifier()};var xo;io([{tag:bo.link,class:"tok-link"},{tag:bo.heading,class:"tok-heading"},{tag:bo.emphasis,class:"tok-emphasis"},{tag:bo.strong,class:"tok-strong"},{tag:bo.keyword,class:"tok-keyword"},{tag:bo.atom,class:"tok-atom"},{tag:bo.bool,class:"tok-bool"},{tag:bo.url,class:"tok-url"},{tag:bo.labelName,class:"tok-labelName"},{tag:bo.inserted,class:"tok-inserted"},{tag:bo.deleted,class:"tok-deleted"},{tag:bo.literal,class:"tok-literal"},{tag:bo.string,class:"tok-string"},{tag:bo.number,class:"tok-number"},{tag:[bo.regexp,bo.escape,bo.special(bo.string)],class:"tok-string2"},{tag:bo.variableName,class:"tok-variableName"},{tag:bo.local(bo.variableName),class:"tok-variableName tok-local"},{tag:bo.definition(bo.variableName),class:"tok-variableName tok-definition"},{tag:bo.special(bo.variableName),class:"tok-variableName2"},{tag:bo.definition(bo.propertyName),class:"tok-propertyName tok-definition"},{tag:bo.typeName,class:"tok-typeName"},{tag:bo.namespace,class:"tok-namespace"},{tag:bo.className,class:"tok-className"},{tag:bo.macroName,class:"tok-macroName"},{tag:bo.propertyName,class:"tok-propertyName"},{tag:bo.operator,class:"tok-operator"},{tag:bo.comment,class:"tok-comment"},{tag:bo.meta,class:"tok-meta"},{tag:bo.invalid,class:"tok-invalid"},{tag:bo.punctuation,class:"tok-punctuation"}]);const So=new kr;const Ao=new kr;class Mo{constructor(t,e,i=[],n=""){this.data=t,this.name=n,vt.prototype.hasOwnProperty("tree")||Object.defineProperty(vt.prototype,"tree",{get(){return Co(this)}}),this.parser=e,this.extension=[Io.of(this),vt.languageData.of(((t,e,i)=>{let n=To(t,e,i),s=n.type.prop(So);if(!s)return[];let r=t.facet(s),o=n.type.prop(Ao);if(o){let s=n.resolve(e-n.from,i);for(let e of o)if(e.test(s,t)){let i=t.facet(e.facet);return"replace"==e.type?i:i.concat(r)}}return r}))].concat(i)}isActiveAt(t,e,i=-1){return To(t,e,i).type.prop(So)==this.data}findRegions(t){let e=t.facet(Io);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],n=(t,e)=>{if(t.prop(So)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(kr.mounted);if(s){if(s.tree.prop(So)==this.data){if(s.overlay)for(let t of s.overlay)i.push({from:t.from+e,to:t.to+e});else i.push({from:e,to:e+t.length});return}if(s.overlay){let t=i.length;if(n(s.tree,s.overlay[0].from+e),i.length>t)return}}for(let i=0;i=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Do=null;class Eo{constructor(t,e,i=[],n,s,r,o,l){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Eo(t,e,[],Or.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Oo(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=Or.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var i;if("number"==typeof t){let e=Date.now()+t;t=()=>Date.now()>e}for(this.parse||(this.parse=this.startParse()),null!=e&&(null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&e=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext((()=>{for(;!(e=this.parse.advance()););})),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(Kr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Do;Do=this;try{return t()}finally{Do=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Lo(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:n,treeLen:s,viewport:r,skipped:o}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges(((t,i,n,s)=>e.push({fromA:t,toA:i,fromB:n,toB:s}))),i=Kr.applyChanges(i,e),n=Or.empty,s=0,r={from:t.mapPos(r.from,-1),to:t.mapPos(r.to,1)},this.skipped.length){o=[];for(let e of this.skipped){let i=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);it.from&&(this.fragments=Lo(this.fragments,i,n),this.skipped.splice(e--,1))}return!(this.skipped.length>=e||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends Gr{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Do;if(e){for(let t of n)e.tempSkipped.push(t);t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=r,new Or(Sr.none,[],[],r-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}static get(){return Do}}function Lo(t,e,i){return Kr.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Bo{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new Bo(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Eo.create(t.facet(Io).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Bo(i)}}Mo.state=_.define({create:Bo.init,update(t,e){for(let t of e.effects)if(t.is(Mo.setState))return t.value;return e.startState.facet(Io)!=e.state.facet(Io)?Bo.init(e.state):t.apply(e)}});let Po=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Po=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const No="undefined"!=typeof navigator&&(null===(xo=navigator.scheduling)||void 0===xo?void 0:xo.isInputPending)?()=>navigator.scheduling.isInputPending():null,Ro=vi.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(Mo.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Mo.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Po(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,l=s.context.work((()=>No&&No()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Mo.setState.of(new Bo(s.context))})),this.chunkBudget>0&&(!l||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>gi(this.view.state,t))).then((()=>this.workScheduled--)),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Io=R.define({combine:t=>t.length?t[0]:null,enables:t=>[Mo.state,Ro,Es.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ho{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const zo=R.define(),Wo=R.define({combine:t=>{if(!t.length)return"  ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some((t=>t!=e[0])))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Vo(t){let e=t.facet(Wo);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Fo(t,e){let i="",n=t.tabSize,s=t.facet(Wo)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=e?function(t,e,i){let n=e.resolveStack(i),s=n.node.enterUnfinishedNodesBefore(i);if(s!=n.node){let t=[];for(let e=s;e!=n.node;e=e.parent)t.push(e);for(let e=t.length-1;e>=0;e--)n={node:t[e],next:n}}return $o(n,t,i)}(t,i,e):null}class qo{constructor(t,e={}){this.state=t,this.options=e,this.unit=Vo(t)}lineAt(t,e=1){let i=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return null!=n&&n>=i.from&&n<=i.to?s&&n==t?{text:"",from:t}:(e<0?n-1&&(s+=r-this.countColumn(i,i.search(/\S|$/))),s}countColumn(t,e=t.length){return Ht(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:i,from:n}=this.lineAt(t,e),s=this.options.overrideIndentation;if(s){let t=s(n);if(t>-1)return t}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const jo=new kr;function $o(t,e,i){for(let n=t;n;n=n.next){let t=Ko(n.node);if(t)return t(Uo.create(e,i,n))}return 0}function Ko(t){let e=t.type.prop(jo);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(kr.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>function(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,l=n&&r.slice(o,o+n.length)==n||s==t.pos+o,a=e?function(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let s=t.options.simulateBreak,r=t.state.doc.lineAt(i.from),o=null==s||s<=r.from?r.to:Math.min(r.to,s);for(let t=i.to;;){let s=e.childAfter(t);if(!s||s==n)return null;if(!s.type.isSkipped)return s.fromt.prop(So)==r.data:r?t=>t==r:void 0,this.style=io(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new Ft(i):null,this.themeType=e.themeType}static define(t,e){return new Yo(t,e||{})}}const Xo=R.define(),Qo=R.define({combine:t=>t.length?[t[0]]:null});function Zo(t){let e=t.facet(Xo);return e.length?e:t.facet(Qo)}class tl{constructor(t){this.markCache=Object.create(null),this.tree=Co(t.state),this.decorations=this.buildDeco(t,Zo(t.state))}update(t){let e=Co(t.state),i=Zo(t.state),n=i!=Zo(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=Ge.mark({class:n})))}),n,s);return i.finish()}}const el=j.high(vi.fromClass(tl,{decorations:t=>t.decorations})),il=(bo.meta,bo.link,bo.heading,bo.emphasis,bo.strong,bo.strikethrough,bo.keyword,bo.atom,bo.bool,bo.url,bo.contentSeparator,bo.labelName,bo.literal,bo.inserted,bo.string,bo.deleted,bo.regexp,bo.escape,bo.string,bo.variableName,bo.variableName,bo.typeName,bo.namespace,bo.className,bo.variableName,bo.macroName,bo.propertyName,bo.comment,bo.invalid,Es.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}})),nl=1e4,sl="()[]{}",rl=R.define({combine:t=>kt(t,{afterCursor:!0,brackets:sl,maxScanDistance:nl,renderMatch:al})}),ol=Ge.mark({class:"cm-matchingBracket"}),ll=Ge.mark({class:"cm-nonmatchingBracket"});function al(t){let e=[],i=t.matched?ol:ll;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e}const hl=_.define({create:()=>Ge.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(rl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=gl(e.state,t.head,-1,n)||t.head>0&&gl(e.state,t.head-1,1,n)||n.afterCursor&&(gl(e.state,t.head,1,n)||t.headEs.decorations.from(t)}),cl=[hl,il];function ul(t={}){return[rl.of(t),cl]}const fl=new kr;function dl(t,e,i){let n=t.prop(e<0?kr.openedBy:kr.closedBy);if(n)return n;if(1==t.name.length){let n=i.indexOf(t.name);if(n>-1&&n%2==(e<0?1:0))return[i[n+e]]}return null}function pl(t){let e=t.type.prop(fl);return e?e(t.node):t}function gl(t,e,i,n={}){let s=n.maxScanDistance||nl,r=n.brackets||sl,o=Co(t),l=o.resolveInner(e,i);for(let t=l;t;t=t.parent){let n=dl(t.type,i,r);if(n&&t.from0?e>=s.from&&es.from&&e<=s.to))return ml(0,0,i,t,s,n,r)}}return function(t,e,i,n,s,r,o){let l=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=i>0)return null;let h={from:i<0?e-1:e,to:i>0?e+1:e},c=t.doc.iterRange(e,i>0?t.doc.length:0),u=0;for(let t=0;!c.next().done&&t<=r;){let r=c.value;i<0&&(t+=r.length);let l=e+t*i;for(let t=i>0?0:r.length-1,e=i>0?r.length:-1;t!=e;t+=i){let e=o.indexOf(r[t]);if(!(e<0||n.resolveInner(l+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:l+t,to:l+t+1},matched:e>>1==a>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,l.type,s,r)}function ml(t,e,i,n,s,r,o){let l=n.parent,a={from:s.from,to:s.to},h=0,c=null==l?void 0:l.cursor();if(c&&(i<0?c.childBefore(n.from):c.childAfter(n.to)))do{if(i<0?c.to<=n.from:c.from>=n.to){if(0==h&&r.indexOf(c.type.name)>-1&&c.from=this.string.length}sol(){return 0==this.pos}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pose}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPosi?t.toLowerCase():t;return n(this.string.substr(this.pos,t.length))==n(t)?(!1!==e&&(this.pos+=t.length),!0):null}{let i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&!1!==e&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function vl(t){if("object"!=typeof t)return t;let e={};for(let i in t){let n=t[i];e[i]=n instanceof Array?n.slice():n}return e}const kl=new WeakMap;class bl extends Mo{constructor(t){let e,i=(s=t.languageData,R.define({combine:s?t=>t.concat(s):void 0})),n={name:(r=t).name||"",token:r.token,blankLine:r.blankLine||(()=>{}),startState:r.startState||(()=>!0),copyState:r.copyState||vl,indent:r.indent||(()=>null),languageData:r.languageData||{},tokenTable:r.tokenTable||Tl};var s,r;super(i,new class extends Gr{createParse(t,i,n){return new Al(e,t,i,n)}},[zo.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=Sr.define({id:Cl.length,name:"Document",props:[So.add((()=>t))],top:!0});return Cl.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new kr({perNode:!0}),this.tokenTable=t.tokenTable?new Bl(n.tokenTable):Pl}static define(t){return new bl(t)}getIndent(t,e){let i,n=Co(t.state),s=n.resolve(e);for(;s&&s.type!=this.topNode;)s=s.parent;if(!s)return null;let{overrideIndentation:r}=t.options;r&&(i=kl.get(t.state),null!=i&&i1e4)return null;for(;o=n&&i+e.length<=s&&e.prop(t.stateAfter);if(r)return{state:t.streamParser.copyState(r),pos:i+e.length};for(let r=e.children.length-1;r>=0;r--){let o=e.children[r],l=i+e.positions[r],a=o instanceof Or&&l=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,l=e.positions[r],a=e.children[r];if(li&&xl(t,n.tree,0-n.offset,i,r);if(o&&(e=Sl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?Vo(n):4),tree:Or.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+l.length;for(let t=0;t=e?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,e),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let e=this.input.chunk(t);if(this.input.lineChunks)"\n"==e&&(e="");else{let t=e.indexOf("\n");t>-1&&(e=e.slice(0,t))}return t+e.length<=this.to?e:e.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,e=this.lineAfter(t),i=t+e.length;for(let t=this.rangeIndex;;){let n=this.ranges[t].to;if(n>=i)break;if(e=e.slice(0,n-(i-e.length)),t++,t==this.ranges.length)break;let s=this.ranges[t].from,r=this.lineAfter(s);e+=r,i=s+r.length}return{line:e,end:i}}skipGapsTo(t,e,i){for(;;){let n=this.ranges[this.rangeIndex].to,s=t+e;if(i>0?n>s:n>=s)break;e+=this.ranges[++this.rangeIndex].from-n}return e}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){e+=s=this.skipGapsTo(e,s,1);let t=this.chunk.length;i+=s=this.skipGapsTo(i,s,-1),n+=this.chunk.length-t}return this.chunk.push(t,e,i,n),s}parseLine(t){let{line:e,end:i}=this.nextLine(),n=0,{streamParser:s}=this.lang,r=new yl(e,t?t.state.tabSize:4,t?Vo(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Ml(s.token,r,this.state);if(t&&(n=this.emitToken(this.lang.tokenTable.resolve(t),this.parsedPos+r.start,this.parsedPos+r.pos,4,n)),r.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return n}throw new Error("Stream parser failed to advance stream.")}const Tl=Object.create(null),Cl=[Sr.none],Ol=new Ar(Cl),Dl=[],El=Object.create(null),Ll=Object.create(null);for(let[t,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"]])Ll[t]=Rl(Tl,e);class Bl{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),Ll)}resolve(t){return t?this.table[t]||(this.table[t]=Rl(this.extra,t)):0}}const Pl=new Bl(Tl);function Nl(t,e){Dl.indexOf(t)>-1||(Dl.push(t),console.warn(e))}function Rl(t,e){let i=[];for(let n of e.split(" ")){let e=[];for(let i of n.split(".")){let n=t[i]||bo[i];n?"function"==typeof n?e.length?e=e.map(n):Nl(i,`Modifier ${i} used at start of tag`):e.length?Nl(i,`Tag ${i} used as modifier`):e=Array.isArray(n)?n:[n]:Nl(i,`Unknown highlighting tag ${i}`)}for(let t of e)i.push(t)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),s=n+" "+i.map((t=>t.id)),r=El[s];if(r)return r.id;let o=El[s]=Sr.define({id:Cl.length,name:n,props:[Zr({[n]:i})]});return Cl.push(o),o.id}function Il(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let s=t(e,i);return!!s&&(n(i.update(s)),!0)}}const Hl=Il(ql,0),zl=Il(_l,0),Wl=Il(((t,e)=>_l(t,e,function(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),s=i.to<=n.to?n:t.doc.lineAt(i.to),r=e.length-1;r>=0&&e[r].to>n.from?e[r].to=s.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return e}(e))),0);function Vl(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const Fl=50;function _l(t,e,i=e.selection.ranges){let n=i.map((t=>Vl(e,t.from).block));if(!n.every((t=>t)))return null;let s=i.map(((t,i)=>function(t,{open:e,close:i},n,s){let r,o,l=t.sliceDoc(n-Fl,n),a=t.sliceDoc(s,s+Fl),h=/\s*$/.exec(l)[0].length,c=/^\s*/.exec(a)[0].length,u=l.length-h;if(l.slice(u-e.length,u)==e&&a.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*Fl?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+Fl),o=t.sliceDoc(s-Fl,s));let f=/^\s*/.exec(r)[0].length,d=/\s*$/.exec(o)[0].length,p=o.length-d-i.length;return r.slice(f,f+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+f+e.length,margin:/\s/.test(r.charAt(f+e.length))?1:0},close:{pos:s-d-i.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null}(e,n[i],t.from,t.to)));if(2!=t&&!s.every((t=>t)))return{changes:e.changes(i.map(((t,e)=>s[e]?[]:[{from:t.from,insert:n[e].open+" "},{from:t.to,insert:" "+n[e].close}])))};if(1!=t&&s.some((t=>t))){let t=[];for(let e,i=0;is&&(t==r||r>a.from)){s=a.from;let t=/^\s*/.exec(a.text)[0].length,e=t==a.length,i=a.text.slice(t,t+l.length)==l?t:-1;tt.comment<0&&(!t.empty||t.single)))){let t=[];for(let{line:e,token:i,indent:s,empty:r,single:o}of n)!o&&r||t.push({from:e.from+s,insert:i+" "});let i=e.changes(t);return{changes:i,selection:e.selection.map(i,1)}}if(1!=t&&n.some((t=>t.comment>=0))){let t=[];for(let{line:e,comment:i,token:s}of n)if(i>=0){let n=e.from+i,r=n+s.length;" "==e.text[r-e.from]&&r++,t.push({from:n,to:r})}return{changes:t}}return null}const jl=rt.define(),$l=rt.define(),Kl=R.define(),Gl=R.define({combine:t=>kt(t,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(i,n)=>t(i,n)||e(i,n)})}),Ul=_.define({create:()=>ua.empty,update(t,e){let i=e.state.facet(Gl),n=e.annotation(jl);if(n){let s=e.docChanged?B.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=ea.fromTransaction(e,s),o=n.side,l=0==o?t.undone:t.done;return l=r?ia(l,l.length,i.minDepth,r):oa(l,e.startState.selection),new ua(0==o?n.rest:l,0==o?l:n.rest)}let s=e.annotation($l);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(ht.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=ea.fromTransaction(e),o=e.annotation(ht.time),l=e.annotation(ht.userEvent);return r?t=t.addChanges(r,o,l,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,l,i.newGroupDelay)),"full"!=s&&"after"!=s||(t=t.isolate()),t},toJSON:t=>({done:t.done.map((t=>t.toJSON())),undone:t.undone.map((t=>t.toJSON()))}),fromJSON:t=>new ua(t.done.map(ea.fromJSON),t.undone.map(ea.fromJSON))});function Jl(t={}){return[Ul,Gl.of(t),Es.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?Xl:"historyRedo"==t.inputType?Ql:null;return!!i&&(t.preventDefault(),i(e))}})]}function Yl(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(Ul,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const Xl=Yl(0,!1),Ql=Yl(1,!1),Zl=Yl(0,!0),ta=Yl(1,!0);class ea{constructor(t,e,i,n,s){this.changes=t,this.effects=e,this.mapped=i,this.startSelection=n,this.selectionsAfter=s}setSelAfter(t){return new ea(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,i;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map((t=>t.toJSON()))}}static fromJSON(t){return new ea(t.changes&&A.fromJSON(t.changes),[],t.mapped&&S.fromJSON(t.mapped),t.startSelection&&B.fromJSON(t.startSelection),t.selectionsAfter.map(B.fromJSON))}static fromTransaction(t,e){let i=sa;for(let e of t.startState.facet(Kl)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new ea(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,sa)}static selection(t){return new ea(void 0,sa,void 0,void 0,t)}}function ia(t,e,i,n){let s=e+1>i+20?e-i-1:0,r=t.slice(s,e);return r.push(n),r}function na(t,e){return t.length?e.length?t.concat(e):t:e}const sa=[],ra=200;function oa(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-ra));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),ia(t,t.length-1,1e9,i.setSelAfter(n)))}return[ea.selection([e])]}function la(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function aa(t,e){if(!t.length)return t;let i=t.length,n=sa;for(;i;){let s=ha(t[i-1],e,n);if(s.changes&&!s.changes.empty||s.effects.length){let e=t.slice(0,i);return e[i-1]=s,e}e=s.mapped,i--,n=s.selectionsAfter}return n.length?[ea.selection(n)]:sa}function ha(t,e,i){let n=na(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):sa,i);if(!t.changes)return ea.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new ea(s,at.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const ca=/^(input\.type|delete)($|\.)/;class ua{constructor(t,e,i=0,n=void 0){this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new ua(this.done,this.undone):this}addChanges(t,e,i,n,s){let r=this.done,o=r[r.length-1];return r=o&&o.changes&&!o.changes.empty&&t.changes&&(!i||ca.test(i))&&(!o.selectionsAfter.length&&e-this.prevTimei.push(t,e))),e.iterChangedRanges(((t,e,s,r)=>{for(let t=0;t=e&&s<=o&&(n=!0)}})),n}(o.changes,t.changes))||"input.type.compose"==i)?ia(r,r.length-1,n.minDepth,new ea(t.changes.compose(o.changes),na(t.effects,o.effects),o.mapped,o.startSelection,sa)):ia(r,r.length,n.minDepth,t),new ua(r,sa,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:sa;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new ua(oa(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new ua(aa(this.done,t),aa(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,e,i){let n=0==t?this.done:this.undone;if(0==n.length)return null;let s=n[n.length-1];if(i&&s.selectionsAfter.length)return e.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:jl.of({side:t,rest:la(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?sa:n.slice(0,n.length-1);return s.mapped&&(i=aa(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:jl.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}ua.empty=new ua(sa,sa);const fa=[{key:"Mod-z",run:Xl,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Ql,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Ql,preventDefault:!0},{key:"Mod-u",run:Zl,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:ta,preventDefault:!0}];function da(t,e){return B.create(t.ranges.map(e),t.mainIndex)}function pa(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function ga({state:t,dispatch:e},i){let n=da(t.selection,i);return!n.eq(t.selection)&&(e(pa(t,n)),!0)}function ma(t,e){return B.cursor(e?t.to:t.from)}function wa(t,e){return ga(t,(i=>i.empty?t.moveByChar(i,e):ma(i,e)))}function ya(t){return t.textDirectionAt(t.state.selection.main.head)==Bi.LTR}const va=t=>wa(t,!ya(t)),ka=t=>wa(t,ya(t));function ba(t,e){return ga(t,(i=>i.empty?t.moveByGroup(i,e):ma(i,e)))}function xa(t,e,i){if(e.type.prop(i))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Sa(t,e,i){let n,s,r=Co(t).resolveInner(e.head),o=i?kr.closedBy:kr.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;xa(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?gl(t,r.from,1):gl(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,B.cursor(s,i?-1:1)}function Aa(t,e){return ga(t,(i=>{if(!i.empty)return ma(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}"undefined"!=typeof Intl&&Intl.Segmenter;const Ma=t=>Aa(t,!1),Ta=t=>Aa(t,!0);function Ca(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):ma(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),l=o.top+n.marginTop,a=o.bottom-n.marginBottom;e&&e.top>l&&e.bottomOa(t,!1),Ea=t=>Oa(t,!0);function La(t,e,i){let n=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,i);if(s.head==e.head&&s.head!=(i?n.to:n.from)&&(s=t.moveToLineBoundary(e,i,!1)),!i&&s.head==n.from&&n.length){let i=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;i&&e.head!=n.from+i&&(s=B.cursor(n.from+i))}return s}function Ba(t,e){let i=da(t.state.selection,(t=>{let i=e(t);return B.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(pa(t.state,i)),!0)}function Pa(t,e){return Ba(t,(i=>t.moveByChar(i,e)))}const Na=t=>Pa(t,!ya(t)),Ra=t=>Pa(t,ya(t));function Ia(t,e){return Ba(t,(i=>t.moveByGroup(i,e)))}function Ha(t,e){return Ba(t,(i=>t.moveVertically(i,e)))}const za=t=>Ha(t,!1),Wa=t=>Ha(t,!0);function Va(t,e){return Ba(t,(i=>t.moveVertically(i,e,Ca(t).height)))}const Fa=t=>Va(t,!1),_a=t=>Va(t,!0),qa=({state:t,dispatch:e})=>(e(pa(t,{anchor:0})),!0),ja=({state:t,dispatch:e})=>(e(pa(t,{anchor:t.doc.length})),!0),$a=({state:t,dispatch:e})=>(e(pa(t,{anchor:t.selection.main.anchor,head:0})),!0),Ka=({state:t,dispatch:e})=>(e(pa(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function Ga(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,s=n.changeByRange((n=>{let{from:s,to:r}=n;if(s==r){let n=e(s);ns&&(i="delete.forward",n=Ua(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=Ua(t,s,!1),r=Ua(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:B.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Es.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function Ua(t,e,i){if(t instanceof Es)for(let n of t.state.facet(Es.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Ja=(t,e)=>Ga(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iJa(t,!1),Xa=t=>Ja(t,!0),Qa=(t,e)=>Ga(t,(i=>{let n=i,{state:s}=t,r=s.doc.lineAt(n),o=s.charCategorizer(n);for(let t=null;;){if(n==(e?r.to:r.from)){n==i&&r.number!=(e?s.doc.lines:1)&&(n+=e?1:-1);break}let l=d(r.text,n-r.from,e)+r.from,a=r.text.slice(Math.min(n,l)-r.from,Math.max(n,l)-r.from),h=o(a);if(null!=t&&h!=t)break;" "==a&&n==i||(t=h),n=l}return n})),Za=t=>Qa(t,!1),th=t=>Ga(t,(e=>{let i=t.lineBlockAt(e).to;return e=s.number){let t=e[e.length-1];t.to=r.to,t.ranges.push(n)}else e.push({from:s.from,to:r.to,ranges:[n]});i=r.number+1}return e}function ih(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of eh(t)){if(i?e.to==t.doc.length:0==e.from)continue;let r=t.doc.lineAt(i?e.to+1:e.from-1),o=r.length+1;if(i){n.push({from:e.to,to:r.to},{from:e.from,insert:r.text+t.lineBreak});for(let i of e.ranges)s.push(B.range(Math.min(t.doc.length,i.anchor+o),Math.min(t.doc.length,i.head+o)))}else{n.push({from:r.from,to:e.from},{from:e.to,insert:t.lineBreak+r.text});for(let t of e.ranges)s.push(B.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:B.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function nh(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of eh(t))i?n.push({from:e.from,insert:t.doc.slice(e.from,e.to)+t.lineBreak}):n.push({from:e.to,insert:t.lineBreak+t.doc.slice(e.from,e.to)});return e(t.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const sh=rh(!1);function rh(e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let s=i.changeByRange((n=>{let{from:s,to:r}=n,o=i.doc.lineAt(s),l=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Co(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(kr.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(s.to,r.from))?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let a=new qo(i,{simulateBreak:s,simulateDoubleBreak:!!l}),h=_o(a,s);for(null==h&&(h=Ht(/^\s*/.exec(i.doc.lineAt(s).text)[0],i.tabSize));ro.from&&s{let s=[];for(let r=n.from;r<=n.to;){let o=t.doc.lineAt(r);o.number>i&&(n.empty||n.to>o.from)&&(e(o,s,n),i=o.number),r=o.to+1}let r=t.changes(s);return{changes:s,range:B.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const lh=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>ga(t,(e=>Sa(t.state,e,!ya(t)))),shift:t=>Ba(t,(e=>Sa(t.state,e,!ya(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>ga(t,(e=>Sa(t.state,e,ya(t)))),shift:t=>Ba(t,(e=>Sa(t.state,e,ya(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>ih(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>nh(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>ih(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>nh(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=B.create([i.main]):i.main.empty||(n=B.create([B.cursor(i.main.head)])),!!n&&(e(pa(t,n)),!0)}},{key:"Mod-Enter",run:rh(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=eh(t).map((({from:e,to:i})=>B.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:B.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=da(t.selection,(e=>{var i;let n=Co(t).resolveInner(e.head,1);for(;!(n.from=e.to||n.to>e.to&&n.from<=e.from)&&(null===(i=n.parent)||void 0===i?void 0:i.parent);)n=n.parent;return B.range(n.to,n.from)}));return e(pa(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(oh(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Ht(n,t.tabSize),r=0,o=Fo(t,Math.max(0,s-Vo(t)));for(;r!t.readOnly&&(e(t.update(oh(t,((e,i)=>{i.push({from:e.from,insert:t.facet(Wo)})})),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new qo(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=oh(t,((e,s,r)=>{let o=_o(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let l=/^\s*/.exec(e.text)[0],a=Fo(t,o);(l!=a||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(eh(e).map((({from:t,to:i})=>(t>0?t--:it.moveVertically(e,!0))).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:t,dispatch:e})=>function(t,e,i){let n=!1,s=da(t.selection,(e=>{let s=gl(t,e.head,-1)||gl(t,e.head,1)||e.head>0&&gl(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=Vl(t.state,i.from);return n.line?Hl(t):!!n.block&&Wl(t)}},{key:"Alt-A",run:zl}].concat([{key:"ArrowLeft",run:va,shift:Na,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>ba(t,!ya(t)),shift:t=>Ia(t,!ya(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>ga(t,(e=>La(t,e,!ya(t)))),shift:t=>Ba(t,(e=>La(t,e,!ya(t)))),preventDefault:!0},{key:"ArrowRight",run:ka,shift:Ra,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>ba(t,ya(t)),shift:t=>Ia(t,ya(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>ga(t,(e=>La(t,e,ya(t)))),shift:t=>Ba(t,(e=>La(t,e,ya(t)))),preventDefault:!0},{key:"ArrowUp",run:Ma,shift:za,preventDefault:!0},{mac:"Cmd-ArrowUp",run:qa,shift:$a},{mac:"Ctrl-ArrowUp",run:Da,shift:Fa},{key:"ArrowDown",run:Ta,shift:Wa,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ja,shift:Ka},{mac:"Ctrl-ArrowDown",run:Ea,shift:_a},{key:"PageUp",run:Da,shift:Fa},{key:"PageDown",run:Ea,shift:_a},{key:"Home",run:t=>ga(t,(e=>La(t,e,!1))),shift:t=>Ba(t,(e=>La(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:qa,shift:$a},{key:"End",run:t=>ga(t,(e=>La(t,e,!0))),shift:t=>Ba(t,(e=>La(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:ja,shift:Ka},{key:"Enter",run:sh},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:Ya,shift:Ya},{key:"Delete",run:Xa},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Za},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qa(t,!0)},{mac:"Mod-Backspace",run:t=>Ga(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:th}].concat([{key:"Ctrl-b",run:va,shift:Na,preventDefault:!0},{key:"Ctrl-f",run:ka,shift:Ra},{key:"Ctrl-p",run:Ma,shift:za},{key:"Ctrl-n",run:Ta,shift:Wa},{key:"Ctrl-a",run:t=>ga(t,(e=>B.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>Ba(t,(e=>B.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>ga(t,(e=>B.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>Ba(t,(e=>B.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:Xa},{key:"Ctrl-h",run:Ya},{key:"Ctrl-k",run:th},{key:"Ctrl-Alt-h",run:Za},{key:"Ctrl-o",run:({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:t.of(["",""])},range:B.cursor(e.from)})));return i(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};let i=e.from,n=t.doc.lineAt(i),s=i==n.from?i-1:d(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:d(n.text,i-n.from,!0)+n.from;return{changes:{from:s,to:r,insert:t.doc.slice(i,r).append(t.doc.slice(s,i))},range:B.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:Ea}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function ah(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&"object"==typeof i&&null==i.nodeType&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var s=i[n];"string"==typeof s?t.setAttribute(n,s):null!=s&&(t[n]=s)}e++}for(;et.normalize("NFKD"):t=>t;class uh{constructor(t,e,i=0,n=t.length,s,r){this.test=r,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,n),this.bufferStart=i,this.normalize=s?t=>s(ch(t)):ch,this.query=this.normalize(e)}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 y(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=v(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=k(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(t==n.length-1){if(o)return this.value=o,this;break}s==i&&tthis.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 t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let i=this.curLineStart+e.index,n=i+e[0].length;if(this.matchPos=yh(this.text,n+(i==n?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,n,e)))return this.value={from:i,to:n,match:e},this;t=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=i||n.to<=e){let n=new mh(e,t.sliceString(e,i));return gh.set(t,n),n}if(n.from==e&&n.to==i)return n;let{text:s,from:r}=n;return r>e&&(s=t.sliceString(e,r)+s,r=e),n.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let t=this.flat.from+e.index,i=t+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(t,i,e)))return this.value={from:t,to:i,match:e},this.matchPos=yh(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=mh.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function yh(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function vh(t){let e=ah("input",{class:"cm-textfield",name:"line",value:String(t.state.doc.lineAt(t.state.selection.main.head).number)});function i(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!i)return;let{state:n}=t,s=n.doc.lineAt(n.selection.main.head),[,r,o,l,a]=i,h=l?+l.slice(1):0,c=o?+o:s.number;if(o&&a){let t=c/100;r&&(t=t*("-"==r?-1:1)+s.number/n.doc.lines),c=Math.round(n.doc.lines*t)}else o&&r&&(c=c*("-"==r?-1:1)+s.number);let u=n.doc.line(Math.max(1,Math.min(n.doc.lines,c))),f=B.cursor(u.from+Math.max(0,Math.min(h,u.length)));t.dispatch({effects:[kh.of(!1),Es.scrollIntoView(f.from,{y:"center"})],selection:f}),t.focus()}return{dom:ah("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:kh.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},ah("label",t.state.phrase("Go to line"),": ",e)," ",ah("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(ph.prototype[Symbol.iterator]=wh.prototype[Symbol.iterator]=function(){return this});const kh=at.define(),bh=_.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(kh)&&(t=i.value);return t},provide:t=>Js.from(t,(t=>t?vh:null))}),xh=Es.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Sh=R.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new Qh(t),scrollToMatch:t=>Es.scrollIntoView(t)})});class Ah{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,dh),!0}catch(t){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,((t,e)=>"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\"))}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new Lh(this):new Ch(this)}getCursor(t,e=0,i){let n=t.doc?t:vt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?Oh(this,n,e,i):Th(this,n,e,i)}}class Mh{constructor(t){this.spec=t}}function Th(t,e,i,n){return new uh(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:t=>t.toLowerCase(),t.wholeWord?function(t,e){return(i,n,s,r)=>((r>i||r+s.length=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let s=Th(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}}function Oh(t,e,i,n){return new ph(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(Dh(i.input,i.index))!=mt.Word||s(Eh(i.input,i.index))!=mt.Word)&&(s(Eh(i.input,i.index+i[0].length))!=mt.Word||s(Dh(i.input,i.index+i[0].length))!=mt.Word)):void 0},i,n);var s}function Dh(t,e){return t.slice(d(t,e,!1),e)}function Eh(t,e){return t.slice(e,d(t,e))}class Lh extends Mh{nextMatch(t,e,i){let n=Oh(this.spec,t,i,t.doc.length).next();return n.done&&(n=Oh(this.spec,t,0,e).next()),n.done?null:n.value}prevMatchInRange(t,e,i){for(let n=1;;n++){let s=Math.max(e,i-1e4*n),r=Oh(this.spec,t,s,i),o=null;for(;!r.next().done;)o=r.value;if(o&&(s==e||o.from>s+10))return o;if(s==e)return null}}prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,((e,i)=>"$"==i?"$":"&"==i?t.match[0]:"0"!=i&&+i=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let s=Oh(this.spec,t,Math.max(0,e-250),Math.min(i+250,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}}const Bh=at.define(),Ph=at.define(),Nh=_.define({create:t=>new Rh(Kh(t).create(),null),update(t,e){for(let i of e.effects)i.is(Bh)?t=new Rh(i.value.create(),t.panel):i.is(Ph)&&(t=new Rh(t.query,i.value?$h:null));return t},provide:t=>Js.from(t,(t=>t.panel))});class Rh{constructor(t,e){this.query=t,this.panel=e}}const Ih=Ge.mark({class:"cm-searchMatch"}),Hh=Ge.mark({class:"cm-searchMatch cm-searchMatch-selected"}),zh=vi.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Nh))}update(t){let e=t.state.field(Nh);(e!=t.startState.field(Nh)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Ge.none;let{view:i}=this,n=new Tt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)l=s[++e].to;t.highlight(i.state,o,l,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?Hh:Ih)}))}return n.finish()}},{decorations:t=>t.decorations});function Wh(t){return e=>{let i=e.state.field(Nh,!1);return i&&i.query.spec.valid?t(e,i):Jh(e)}}const Vh=Wh(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=B.single(n.from,n.to),r=t.state.facet(Sh);return t.dispatch({selection:s,effects:[ic(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Uh(t),!0})),Fh=Wh(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=B.single(s.from,s.to),o=t.state.facet(Sh);return t.dispatch({selection:r,effects:[ic(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Uh(t),!0})),_h=Wh(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length||(t.dispatch({selection:B.create(i.map((t=>B.range(t.from,t.to)))),userEvent:"select.search.matches"}),0))})),qh=Wh(((t,{query:e})=>{let{state:i}=t,{from:n,to:s}=i.selection.main;if(i.readOnly)return!1;let r=e.nextMatch(i,n,n);if(!r)return!1;let o,l,a=[],h=[];if(r.from==n&&r.to==s&&(l=i.toText(e.getReplacement(r)),a.push({from:r.from,to:r.to,insert:l}),r=e.nextMatch(i,r.from,r.to),h.push(Es.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==a.length||a[0].from>=r.to?0:r.to-r.from-l.length;o=B.single(r.from-e,r.to-e),h.push(ic(t,r)),h.push(i.facet(Sh).scrollToMatch(o.main,t))}return t.dispatch({changes:a,selection:o,effects:h,userEvent:"input.replace"}),!0})),jh=Wh(((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map((t=>{let{from:i,to:n}=t;return{from:i,to:n,insert:e.getReplacement(t)}}));if(!i.length)return!1;let n=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:Es.announce.of(n),userEvent:"input.replace.all"}),!0}));function $h(t){return t.state.facet(Sh).createPanel(t)}function Kh(t,e){var i,n,s,r,o;let l=t.selection.main,a=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=t.facet(Sh);return new Ah({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:h.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:h.literal,regexp:null!==(r=null==e?void 0:e.regexp)&&void 0!==r?r:h.regexp,wholeWord:null!==(o=null==e?void 0:e.wholeWord)&&void 0!==o?o:h.wholeWord})}function Gh(t){let e=$s(t,$h);return e&&e.dom.querySelector("[main-field]")}function Uh(t){let e=Gh(t);e&&e==t.root.activeElement&&e.select()}const Jh=t=>{let e=t.state.field(Nh,!1);if(e&&e.panel){let i=Gh(t);if(i&&i!=t.root.activeElement){let n=Kh(t.state,e.query.spec);n.valid&&t.dispatch({effects:Bh.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[Ph.of(!0),e?Bh.of(Kh(t.state,e.query.spec)):at.appendConfig.of(sc)]});return!0},Yh=t=>{let e=t.state.field(Nh,!1);if(!e||!e.panel)return!1;let i=$s(t,$h);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Ph.of(!1)}),!0},Xh=[{key:"Mod-f",run:Jh,scope:"editor search-panel"},{key:"F3",run:Vh,shift:Fh,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Vh,shift:Fh,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Yh,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:n,to:s}=i.main,r=[],o=0;for(let e=new uh(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(B.range(e.value.from,e.value.to))}return e(t.update({selection:B.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=$s(t,vh);if(!e){let i=[kh.of(!0)];null==t.state.field(bh,!1)&&i.push(at.appendConfig.of([bh,xh])),t.dispatch({effects:i}),e=$s(t,vh)}return e&&e.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some((t=>t.from===t.to)))return(({state:t,dispatch:e})=>{let{selection:i}=t,n=B.create(i.ranges.map((e=>t.wordAt(e.head)||B.cursor(e.head))),i.mainIndex);return!n.eq(i)&&(e(t.update({selection:n})),!0)})({state:t,dispatch:e});let n=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some((e=>t.sliceDoc(e.from,e.to)!=n)))return!1;let s=function(t,e){let{main:i,ranges:n}=t.selection,s=t.wordAt(i.head),r=s&&s.from==i.from&&s.to==i.to;for(let i=!1,s=new uh(t.doc,e,n[n.length-1].to);;){if(s.next(),!s.done){if(i&&n.some((t=>t.from==s.value.from)))continue;if(r){let e=t.wordAt(s.value.from);if(!e||e.from!=s.value.from||e.to!=s.value.to)continue}return s.value}if(i)return null;s=new uh(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),i=!0}}(t,n);return!!s&&(e(t.update({selection:t.selection.addRange(B.range(s.from,s.to),!1),effects:Es.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Qh{constructor(t){this.view=t;let e=this.query=t.state.field(Nh).query.spec;function i(t,e,i){return ah("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=ah("input",{value:e.search,placeholder:Zh(t,"Find"),"aria-label":Zh(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ah("input",{value:e.replace,placeholder:Zh(t,"Replace"),"aria-label":Zh(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ah("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=ah("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=ah("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=ah("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>Vh(t)),[Zh(t,"next")]),i("prev",(()=>Fh(t)),[Zh(t,"previous")]),i("select",(()=>_h(t)),[Zh(t,"all")]),ah("label",null,[this.caseField,Zh(t,"match case")]),ah("label",null,[this.reField,Zh(t,"regexp")]),ah("label",null,[this.wordField,Zh(t,"by word")]),...t.state.readOnly?[]:[ah("br"),this.replaceField,i("replace",(()=>qh(t)),[Zh(t,"replace")]),i("replaceAll",(()=>jh(t)),[Zh(t,"replace all")])],ah("button",{name:"close",onclick:()=>Yh(t),"aria-label":Zh(t,"close"),type:"button"},["×"])])}commit(){let t=new Ah({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:Bh.of(t)}))}keydown(t){var e,i;i=t,qs(Vs((e=this.view).state),i,e,"search-panel")?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?Fh:Vh)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),qh(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Bh)&&!t.value.eq(this.query)&&this.setQuery(t.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Sh).top}}function Zh(t,e){return t.state.phrase(e)}const tc=30,ec=/[\s\.,:;?!]/;function ic(t,{from:e,to:i}){let n=t.state.doc.lineAt(e),s=t.state.doc.lineAt(i).to,r=Math.max(n.from,e-tc),o=Math.min(s,i+tc),l=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;tl.length-tc;t--)if(!ec.test(l[t-1])&&ec.test(l[t])){l=l.slice(0,t);break}return Es.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${n.number}.`)}const nc=Es.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),sc=[Nh,j.low(zh),nc];function rc(t){return rc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rc(t)}function oc(t){return function(t){if(Array.isArray(t))return lc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return lc(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?lc(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lc(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0,n}var i,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&pc(t,e)}(e,t),i=e,(n=[{key:"setCodeMirrorPreference",value:function(t){this.useCodeMirror=t,fc(dc(e.prototype),"setCodeMirrorPreference",this).call(this,t)}},{key:"enableCodeMirror",value:function(){var t=this;if(!this.view){var e=this.$textarea.prop("selectionStart"),i=this.$textarea.prop("selectionEnd"),n=this.$textarea.scrollTop(),s=this.$textarea.is(":focus"),r=[].concat(oc(this.defaultExtensions),[this.langExtension,ul(),Jl(),Es.contentAttributes.of({spellcheck:"true"}),Es.domEventHandlers({blur:function(){return t.$textarea.triggerHandler("blur")},focus:function(){return t.$textarea.triggerHandler("focus")}}),Es.updateListener.of((function(e){e.docChanged&&"function"==typeof t.editRecoveryHandler&&t.editRecoveryHandler()})),Es.lineWrapping,zs.of([].concat(oc(lh),oc(Xh),oc(fa)))]);mw.hook("editRecovery.loadEnd").add((function(e){t.editRecoveryHandler=e.fieldChangeHandler})),this.initialize(r),this.view.scrollDOM.scrollTop=n,this.view.dispatch({selection:B.create([B.range(e,i)]),scrollIntoView:!0}),s&&this.view.focus(),mw.hook("ext.CodeMirror.switch").fire(!0,$(this.view.dom))}}},{key:"addCodeMirrorToWikiEditor",value:function(){var t=this,e=this.$textarea.data("wikiEditor-context"),i=e&&e.modules&&e.modules.toolbar;i&&(this.$textarea.wikiEditor("addToToolbar",{section:"main",groups:{codemirror:{tools:{CodeMirror:{label:mw.msg("codemirror-toggle-label"),type:"toggle",oouiIcon:"highlight",action:{type:"callback",execute:function(){return t.switchCodeMirror()}}}}}}}),i.$toolbar.find(".tool[rel=CodeMirror]").attr("id","mw-editbutton-codemirror"),this.useCodeMirror&&this.enableCodeMirror(),this.updateToolbarButton(),this.logUsage({editor:"wikitext",enabled:this.useCodeMirror,toggled:!1,edit_start_ts_ms:1e3*parseInt($('input[name="wpStarttime"]').val(),10)||0}))}},{key:"updateToolbarButton",value:function(){var t=$("#mw-editbutton-codemirror");t.toggleClass("mw-editbutton-codemirror-active",this.useCodeMirror),t.data("setActive")&&t.data("setActive")(this.useCodeMirror)}},{key:"switchCodeMirror",value:function(){if(this.view){this.setCodeMirrorPreference(!1);var t=this.view.scrollDOM.scrollTop,e=this.view.hasFocus,i=this.view.state.selection.ranges[0],n=i.from,s=i.to;$(this.view.dom).textSelection("unregister"),this.$textarea.textSelection("unregister"),this.$textarea.val(this.view.state.doc.toString()),this.view.destroy(),this.view=null,this.$textarea.show(),e&&this.$textarea.trigger("focus"),this.$textarea.prop("selectionStart",Math.min(n,s)).prop("selectionEnd",Math.max(s,n)),this.$textarea.scrollTop(t),mw.hook("ext.CodeMirror.switch").fire(!1,this.$textarea)}else this.enableCodeMirror(),this.setCodeMirrorPreference(!0);this.updateToolbarButton(),this.logUsage({editor:"wikitext",enabled:this.useCodeMirror,toggled:!0,edit_start_ts_ms:1e3*parseInt($('input[name="wpStarttime"]').val(),10)||0})}}])&&ac(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),e}(mr);function mc(t){return mc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mc(t)}function wc(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i~).,'])"),"i"),this.isBold=!1,this.wasBold=!1,this.isItalic=!1,this.wasItalic=!1,this.firstSingleLetterWord=null,this.firstMultiLetterWord=null,this.firstSpace=null,this.oldStyle=null,this.tokens=[],this.oldTokens=[],this.tokenTable=Mc.tokenTable,Object.keys(this.config.tags).forEach((function(t){return Mc.addTag(t)}))}var e,i;return e=t,i=[{key:"eatHtmlEntity",value:function(t,e){return(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w.\-:]/)&&t.eat(";"))?Mc.tags.htmlEntity:e}},{key:"makeStyle",value:function(t,e,i){return this.isBold&&(t+=" "+Mc.tags.strong),this.isItalic&&(t+=" "+Mc.tags.em),this.makeLocalStyle(t,e,i)}},{key:"makeLocalStyle",value:function(t,e,i){var n="";switch(e.nTemplate){case 0:break;case 1:n+="-template";break;case 2:n+="-template2";break;default:n+="-template3"}switch(e.nExt){case 0:break;case 1:n+="-ext";break;case 2:n+="-ext2";break;default:n+="-ext3"}return e.nLink>0&&(n+="-link"),""!==n&&(t="mw".concat(n,"-ground ").concat(t)),i&&e[i]--,t.trim()}},{key:"eatBlock",value:function(t,e,i){var n=this;return function(s,r){return s.skipTo(e)?(!1!==i&&s.match(e),r.tokenize=r.stack.pop()):s.skipToEnd(),n.makeLocalStyle(t,r)}}},{key:"eatEnd",value:function(t){var e=this;return function(i,n){return i.skipToEnd(),n.tokenize=n.stack.pop(),e.makeLocalStyle(t,n)}}},{key:"eatChar",value:function(t,e){var i=this;return function(n,s){return s.tokenize=s.stack.pop(),n.eat(t)?i.makeLocalStyle(e,s):i.makeLocalStyle(Mc.tags.error,s)}}},{key:"eatSectionHeader",value:function(t){var e=this;return function(i,n){return i.match(/^[^&<[{~]+/)?(i.eol()?(i.backUp(t),n.tokenize=e.eatEnd(Mc.tags.sectionHeader)):i.match(/^.*?=)/,!1)&&(i.backUp(t),n.tokenize=e.eatBlock(Mc.tags.sectionHeader,"\x3c!--",!1)),Mc.tags.section):e.eatWikiText(Mc.tags.section)(i,n)}}},{key:"inVariable",value:function(t,e){return t.match(/^[^{}|]+/)?this.makeLocalStyle(Mc.tags.templateVariableName,e):t.eat("|")?(e.tokenize=this.inVariableDefault.bind(this),this.makeLocalStyle(Mc.tags.templateVariableDelimiter,e)):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.templateVariableBracket,e)):t.match("{{{")?(e.stack.push(e.tokenize),this.makeLocalStyle(Mc.tags.templateVariableBracket,e)):(t.next(),this.makeLocalStyle(Mc.tags.templateVariableName,e))}},{key:"inVariableDefault",value:function(t,e){return t.match(/^[^{}[<&~]+/)?this.makeLocalStyle(Mc.tags.templateVariable,e):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.templateVariableBracket,e)):this.eatWikiText(Mc.tags.templateVariable)(t,e)}},{key:"inParserFunctionName",value:function(t,e){return t.match(/^#?[^:}{~]+/)?this.makeLocalStyle(Mc.tags.parserFunctionName,e):t.eat(":")?(e.tokenize=this.inParserFunctionArguments.bind(this),this.makeLocalStyle(Mc.tags.parserFunctionDelimiter,e)):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(Mc.tags.parserFunction)(t,e)}},{key:"inParserFunctionArguments",value:function(t,e){return t.match(/^[^|}{[<&~]+/)?this.makeLocalStyle(Mc.tags.parserFunction,e):t.eat("|")?this.makeLocalStyle(Mc.tags.parserFunctionDelimiter,e):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(Mc.tags.parserFunction)(t,e)}},{key:"eatTemplatePageName",value:function(t){var e=this;return function(i,n){return i.match(/^[\s\u00a0]*\|[\s\u00a0]*/)?(n.tokenize=e.eatTemplateArgument(!0),e.makeLocalStyle(Mc.tags.templateDelimiter,n)):i.match(/^[\s\u00a0]*\}\}/)?(n.tokenize=n.stack.pop(),e.makeLocalStyle(Mc.tags.templateBracket,n,"nTemplate")):i.match(/^[\s\u00a0]*/)?e.makeLocalStyle(Mc.tags.comment,n):t&&i.sol()?(n.nTemplate--,void(n.tokenize=n.stack.pop())):i.match(/^[\s\u00a0]*[^\s\u00a0|}<{&~]+/)?(n.tokenize=e.eatTemplatePageName(!0),e.makeLocalStyle(Mc.tags.templateName,n)):i.eatSpace()?(i.eol(),e.makeLocalStyle(Mc.tags.templateName,n)):e.eatWikiText(Mc.tags.templateName)(i,n)}}},{key:"eatTemplateArgument",value:function(t){var e=this;return function(i,n){return t&&i.eatWhile(/[^=|}{[<&~]/)?i.eat("=")?(n.tokenize=e.eatTemplateArgument(!1),e.makeLocalStyle(Mc.tags.templateArgumentName,n)):e.makeLocalStyle(Mc.tags.template,n):i.eatWhile(/[^|}{[<&~]/)?e.makeLocalStyle(Mc.tags.template,n):i.eat("|")?(n.tokenize=e.eatTemplateArgument(!0),e.makeLocalStyle(Mc.tags.templateDelimiter,n)):i.match("}}")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(Mc.tags.templateBracket,n,"nTemplate")):e.eatWikiText(Mc.tags.template)(i,n)}}},{key:"eatExternalLinkProtocol",value:function(t){var e=this;return function(i,n){for(;t>0;)t--,i.next();return i.eol()?(n.nLink--,n.tokenize=n.stack.pop()):n.tokenize=e.inExternalLink.bind(e),e.makeLocalStyle(Mc.tags.extLinkProtocol,n)}}},{key:"inExternalLink",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[\s\u00a0]*\]/)?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.extLinkBracket,e,"nLink")):t.eatSpace()?(e.tokenize=this.inExternalLinkText.bind(this),this.makeStyle("",e)):t.match(/^[^\s\u00a0\]{&~']+/)||t.eatSpace()?("'"===t.peek()&&(t.match("''",!1)?e.tokenize=this.inExternalLinkText.bind(this):t.next()),this.makeStyle(Mc.tags.extLink,e)):this.eatWikiText(Mc.tags.extLink)(t,e)}},{key:"inExternalLinkText",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.eat("]")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.extLinkBracket,e,"nLink")):t.match(/^[^'\]{&~<]+/)?this.makeStyle(Mc.tags.extLinkText,e):this.eatWikiText(Mc.tags.extLinkText)(t,e)}},{key:"inLink",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[\s\u00a0]*#[\s\u00a0]*/)?(e.tokenize=this.inLinkToSection.bind(this),this.makeLocalStyle(Mc.tags.link,e)):t.match(/^[\s\u00a0]*\|[\s\u00a0]*/)?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(Mc.tags.linkDelimiter,e)):t.match(/^[\s\u00a0]*\]\]/)?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.linkBracket,e,"nLink")):t.match(/^[\s\u00a0]*[^\s\u00a0#|\]&~{]+/)||t.eatSpace()?this.makeStyle("".concat(Mc.tags.linkPageName," ").concat(Mc.tags.pageName),e):this.eatWikiText("".concat(Mc.tags.linkPageName," ").concat(Mc.tags.pageName))(t,e)}},{key:"inLinkToSection",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[^|\]&~{}]+/)?this.makeLocalStyle(Mc.tags.linkToSection,e):t.eat("|")?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(Mc.tags.linkDelimiter,e)):t.match("]]")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.linkBracket,e,"nLink")):this.eatWikiText(Mc.tags.linkToSection)(t,e)}},{key:"eatLinkText",value:function(){var t,e,i=this;return function(n,s){var r;return n.match("]]")?(s.tokenize=s.stack.pop(),i.makeLocalStyle(Mc.tags.linkBracket,s,"nLink")):n.match("'''")?(t=!t,i.makeLocalStyle("".concat(Mc.tags.linkText," ").concat(Mc.tags.apostrophes),s)):n.match("''")?(e=!e,i.makeLocalStyle("".concat(Mc.tags.linkText," ").concat(Mc.tags.apostrophes),s)):(r=Mc.tags.linkText,t&&(r+=" "+Mc.tags.strong),e&&(r+=" "+Mc.tags.em),n.match(/^[^'\]{&~<]+/)?i.makeStyle(r,s):i.eatWikiText(r)(n,s))}}},{key:"eatTagName",value:function(t,e,i){var n=this;return function(s,r){for(var o="";t>0;)t--,o+=s.next();return s.eatSpace(),o=o.toLowerCase(),i?(e&&!Mc.implicitlyClosedHtmlTags[o]?r.tokenize=n.eatChar(">",Mc.tags.htmlTagBracket):r.tokenize=n.eatHtmlTagAttribute(o),n.makeLocalStyle(Mc.tags.htmlTagName,r)):(r.tokenize=e?n.eatChar(">","".concat(Mc.tags.extTagBracket," mw-ext-").concat(o)):n.eatExtTagAttribute(o),n.makeLocalStyle("".concat(Mc.tags.extTagName," mw-ext-").concat(o),r))}}},{key:"eatHtmlTagAttribute",value:function(t){var e=this;return function(i,n){return i.match(/^(?:"[^<">]*"|'[^<'>]*'|[^>/<{&~])+/)?e.makeLocalStyle(Mc.tags.htmlTagAttribute,n):i.eat(">")?(t in Mc.implicitlyClosedHtmlTags||n.inHtmlTag.push(t),n.tokenize=n.stack.pop(),e.makeLocalStyle(Mc.tags.htmlTagBracket,n)):i.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(Mc.tags.htmlTagBracket,n)):e.eatWikiText(Mc.tags.htmlTagAttribute)(i,n)}}},{key:"eatNowiki",value:function(){var t=this;return function(e){return e.match(/^[^&]+/)?"":(e.next(),t.eatHtmlEntity(e,""))}}},{key:"eatExtTagAttribute",value:function(t){var e=this;return function(i,n){if(i.match(/^(?:"[^">]*"|'[^'>]*'|[^>/<{&~])+/))return e.makeLocalStyle("".concat(Mc.tags.extTagAttribute," mw-ext-").concat(t),n);if(i.eat(">")){if(n.extName=t,"nowiki"===t||"pre"===t)n.extMode={startState:function(){},copyState:function(){},token:e.eatNowiki()};else if(t in e.config.tagModes){var s=e.config.tagModes[t];"mediawiki"!==s&&"text/mediawiki"!==s||(n.extMode=e.mediawiki,n.extState=n.extMode.startState())}return n.tokenize=e.eatExtTagArea(t),e.makeLocalStyle("".concat(Mc.tags.extTagBracket," mw-ext-").concat(t),n)}return i.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle("".concat(Mc.tags.extTagBracket," mw-ext-").concat(t),n)):e.eatWikiText("".concat(Mc.tags.extTagAttribute," mw-ext-").concat(t))(i,n)}}},{key:"eatExtTagArea",value:function(t){var e=this;return function(i,n){var s,r=i.pos,o=new RegExp(""),"i").exec(r?i.string.slice(r):i.string),l=!1;if(o){if(0===o.index)return n.tokenize=e.eatExtCloseTag(t),n.extName=!1,!1!==n.extMode&&(n.extMode=!1,n.extState=!1),n.tokenize(i,n);s=o.index+r,l=i.string,i.string=l.slice(0,s)}return n.stack.push(n.tokenize),n.tokenize=e.eatExtTokens(l),n.tokenize(i,n)}}},{key:"eatExtCloseTag",value:function(t){var e=this;return function(i,n){return i.next(),i.next(),n.tokenize=e.eatTagName(t.length,!0,!1),e.makeLocalStyle("".concat(Mc.tags.extTagBracket," mw-ext-").concat(t),n)}}},{key:"eatExtTokens",value:function(t){var e=this;return function(i,n){var s;return!1===n.extMode?(s=Mc.tags.extTag,i.skipToEnd()):s="mw-tag-".concat(n.extName," ")+n.extMode.token(i,n.extState,!1===t),i.eol()&&(!1!==t&&(i.string=t),n.tokenize=n.stack.pop()),e.makeLocalStyle(s,n)}}},{key:"eatStartTable",value:function(t,e){return t.match("{|"),t.eatSpace(),e.tokenize=this.inTableDefinition.bind(this),Mc.tags.tableBracket}},{key:"inTableDefinition",value:function(t,e){return t.sol()?(e.tokenize=this.inTable.bind(this),this.inTable(t,e)):this.eatWikiText(Mc.tags.tableDefinition)(t,e)}},{key:"inTable",value:function(t,e){if(t.sol()){if(t.eatSpace(),t.eat("|"))return t.eat("-")?(t.eatSpace(),e.tokenize=this.inTableDefinition.bind(this),this.makeLocalStyle(Mc.tags.tableDelimiter,e)):t.eat("+")?(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1,!0),this.makeLocalStyle(Mc.tags.tableDelimiter,e)):t.eat("}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.tableBracket,e)):(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1),this.makeLocalStyle(Mc.tags.tableDelimiter,e));if(t.eat("!"))return t.eatSpace(),e.tokenize=this.eatTableRow(!0,!0),this.makeLocalStyle(Mc.tags.tableDelimiter,e)}return this.eatWikiText("")(t,e)}},{key:"eatTableRow",value:function(t,e,i){var n=this,s="";return i?s=Mc.tags.tableCaption:e&&(s=Mc.tags.strong),function(r,o){if(r.sol()){if(r.match(/^[\s\u00a0]*[|!]/,!1))return o.tokenize=n.inTable.bind(n),n.inTable(r,o)}else{if(r.match(/^[^'|{[<&~!]+/))return n.makeStyle(s,o);if(r.match("||")||e&&r.match("!!"))return n.isBold=!1,n.isItalic=!1,o.tokenize=n.eatTableRow(!0,e,i),n.makeLocalStyle(Mc.tags.tableDelimiter,o);if(t&&r.eat("|"))return o.tokenize=n.eatTableRow(!1,e,i),n.makeLocalStyle(Mc.tags.tableDelimiter,o)}return n.eatWikiText(s)(r,o)}}},{key:"eatFreeExternalLinkProtocol",value:function(t,e){return t.match(this.urlProtocols),e.tokenize=this.eatFreeExternalLink.bind(this),this.makeLocalStyle(Mc.tags.freeExtLinkProtocol,e)}},{key:"eatFreeExternalLink",value:function(t,e){if(t.eol());else if(t.match(/^[^\s\u00a0{[\]<>~).,']*/))if("~"===t.peek()){if(!t.match(/^~~~+/,!1))return t.match(/^~*/),this.makeLocalStyle(Mc.tags.freeExtLink,e)}else if("{"===t.peek()){if(!t.match("{{",!1))return t.next(),this.makeLocalStyle(Mc.tags.freeExtLink,e)}else if("'"===t.peek()){if(!t.match("''",!1))return t.next(),this.makeLocalStyle(Mc.tags.freeExtLink,e)}else if(t.match(/^[).,]+(?=[^\s\u00a0{[\]<>~).,])/))return this.makeLocalStyle(Mc.tags.freeExtLink,e);return e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.freeExtLink,e)}},{key:"eatWikiText",value:function(t){var e=this;return function(i,n){var s,r,o,l,a,h,c;if(i.sol()){if(!i.match("//",!1)&&i.match(e.urlProtocols))return n.stack.push(n.tokenize),n.tokenize=e.eatFreeExternalLink.bind(e),e.makeLocalStyle(Mc.tags.freeExtLinkProtocol,n);switch(s=i.next()){case"-":if(i.match(/^---+/))return Mc.tags.hr;break;case"=":if(r=i.match(/^(={0,5})(.+?(=\1\s*)(.*\S).*?)?)$/))return i.backUp(r[2].length),n.stack.push(n.tokenize),n.tokenize=e.eatSectionHeader(r[3].length),Mc.tags.sectionHeader+" "+Mc.tags["sectionHeader".concat(r[1].length+1)];break;case"*":case"#":case";":return i.match(/^[*#;:]*/),Mc.tags.list;case":":return i.match(/^:*{\|/,!1)&&(n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e)),i.match(/^[*#;:]*/),Mc.tags.indenting;case" ":if(!i.match(/^[\s\u00a0]*:*{\|/,!1))return Mc.tags.skipFormatting;if(i.eatSpace(),i.match(/^:+/))return n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e),Mc.tags.indenting;i.eat("{");case"{":if(i.eat("|"))return i.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inTableDefinition.bind(e),Mc.tags.tableBracket}}else s=i.next();switch(s){case"&":return e.makeStyle(e.eatHtmlEntity(i,t),n);case"'":if(i.match(/^'*(?=''''')/)||i.match(/^'''(?!')/,!1))break;if(i.match("''"))return e.firstSingleLetterWord||i.match("''",!1)||e.prepareItalicForCorrection(i),e.isBold=!e.isBold,e.makeLocalStyle(Mc.tags.apostrophesBold,n);if(i.eat("'"))return e.isItalic=!e.isItalic,e.makeLocalStyle(Mc.tags.apostrophesItalic,n);break;case"[":if(i.eat("[")){if(i.eatSpace(),/[^\]|[]/.test(i.peek()))return n.nLink++,n.stack.push(n.tokenize),n.tokenize=e.inLink.bind(e),e.makeLocalStyle(Mc.tags.linkBracket,n)}else if(o=i.match(e.urlProtocols))return n.nLink++,i.backUp(o[0].length),n.stack.push(n.tokenize),n.tokenize=e.eatExternalLinkProtocol(o[0].length),e.makeLocalStyle(Mc.tags.extLinkBracket,n);break;case"{":if(i.match(/^{{(?!{|[^{}]*}}(?!}))/))return i.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inVariable.bind(e),e.makeLocalStyle(Mc.tags.templateVariableBracket,n);if(i.match(/^{(?!{(?!{))[\s\u00a0]*/))return"#"===i.peek()?(n.nExt++,n.stack.push(n.tokenize),n.tokenize=e.inParserFunctionName.bind(e),e.makeLocalStyle(Mc.tags.parserFunctionBracket,n)):!(l=i.match(/^([^\s\u00a0}[\]<{'|&:]+)(:|[\s\u00a0]*)(\}\}?)?(.)?/))||(i.backUp(l[0].length),":"!==l[2]&&void 0!==l[4]&&"}}"!==l[3]||!(l[1].toLowerCase()in e.config.functionSynonyms[0])&&!(l[1]in e.config.functionSynonyms[1]))?(n.nTemplate++,n.stack.push(n.tokenize),n.tokenize=e.eatTemplatePageName(!1),e.makeLocalStyle(Mc.tags.templateBracket,n)):(n.nExt++,n.stack.push(n.tokenize),n.tokenize=e.inParserFunctionName.bind(e),e.makeLocalStyle(Mc.tags.parserFunctionBracket,n));break;case"<":if(a=!!i.eat("/"),h=i.match(/^[^>/\s\u00a0.*,[\]{}$^+?|/\\'`~<=!@#%&()-]+/),i.match("!--"))return c=e.eatBlock(Mc.tags.comment,"--\x3e"),n.stack.push(n.tokenize),n.tokenize=c,c(i,n);if(h){if((h=h[0].toLowerCase())in e.config.tags)return!0===a?Mc.tags.error:(i.backUp(h.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(h.length,a,!1),e.makeLocalStyle("".concat(Mc.tags.extTagBracket," mw-ext-").concat(h),n));if(h in Mc.permittedHtmlTags)return!0===a&&h!==n.inHtmlTag.pop()?(i.pos++,Mc.tags.error):!0===a&&h in Mc.implicitlyClosedHtmlTags?Mc.tags.error:(i.backUp(h.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(h.length,a||h in Mc.implicitlyClosedHtmlTags,!0),e.makeLocalStyle(Mc.tags.htmlTagBracket,n));i.backUp(h.length)}break;case"~":if(i.match(/^~{2,4}/))return Mc.tags.signature;break;case"_":for(r=1;i.eat("_");)r++;if(r>2)return i.eol()||i.backUp(2),e.makeStyle(t,n);if(2===r&&(l=i.match(/^([^\s\u00a0>}[\]<{'|&:~]+?)__/))&&l[0])return"__"+l[0].toLowerCase()in e.config.doubleUnderscore[0]||"__"+l[0]in e.config.doubleUnderscore[1]?Mc.tags.doubleUnderscore:(i.eol()||i.backUp(2),e.makeStyle(t,n));break;default:if(/[\s\u00a0]/.test(s)&&(i.eatSpace(),i.match(e.urlProtocols,!1)&&!i.match("//")))return n.stack.push(n.tokenize),n.tokenize=e.eatFreeExternalLinkProtocol.bind(e),e.makeStyle(t,n)}return i.match(/^[^\s\u00a0_>}[\]<{'|&:~=]+/),e.makeStyle(t,n)}}},{key:"prepareItalicForCorrection",value:function(t){var e=t.pos,i=t.string.slice(0,e-3),n=i.slice(-1),s=i.slice(-2,-1);if(" "===n){if(this.firstMultiLetterWord||this.firstSpace)return;this.firstSpace=e}else if(" "===s)this.firstSingleLetterWord=e;else{if(this.firstMultiLetterWord)return;this.firstMultiLetterWord=e}this.wasBold=this.isBold,this.wasItalic=this.isItalic}},{key:"mediawiki",get:function(){var t=this;return{name:"mediawiki",startState:function(){return{tokenize:t.eatWikiText(""),stack:[],inHtmlTag:[],extName:!1,extMode:!1,extState:!1,nTemplate:0,nLink:0,nExt:0}},copyState:function(t){return{tokenize:t.tokenize,stack:t.stack.concat([]),inHtmlTag:t.inHtmlTag.concat([]),extName:t.extName,extMode:t.extMode,extState:!1!==t.extMode&&t.extMode.copyState(t.extState),nTemplate:t.nTemplate,nLink:t.nLink,nExt:t.nExt}},token:function(e,i){var n,s,r,o,l=[],a=[];if(t.oldTokens.length>0)return r=t.oldTokens.shift(),e.pos=r.pos,i=r.state,r.style;e.sol()&&(t.isBold=!1,t.isItalic=!1,t.firstSingleLetterWord=null,t.firstMultiLetterWord=null,t.firstSpace=null);do{if(n=i.tokenize(e,i),!(o=t.firstSingleLetterWord||t.firstMultiLetterWord||t.firstSpace))return t.oldStyle=n,n;o!==s&&(s=o,a.length>0&&(l=l.concat(a),a=[])),a.push({pos:e.pos,style:n,state:(i.extMode||t.mediawiki).copyState(i)})}while(!e.eol());if(t.isBold&&t.isItalic){if(t.isItalic=t.wasItalic,t.isBold=t.wasBold,t.firstSingleLetterWord=null,t.firstMultiLetterWord=null,t.firstSpace=null,!(l.length>0))return e.pos=a[0].pos-2,t.oldStyle;l[l.length-1].pos++,t.oldTokens=l}else t.oldTokens=l.concat(a);return r=t.oldTokens.shift(),e.pos=r.pos,i=r.state,r.style},blankLine:function(t){t.extMode&&t.extMode.blankLine&&t.extMode.blankLine(t.extState)},tokenTable:this.tokenTable}}}],i&&Cc(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();mw.loader.getState("ext.wikiEditor")&&mw.hook("wikiEditor.toolbarReady").add((function(t){new gc(t,function(){var t=new Dc((arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)||mw.config.get("extCodeMirrorConfig")).mediawiki,e=bl.define(t),i=function(t,e){let i,n=[el];return t instanceof Yo&&(t.module&&n.push(Es.styleModule.of(t.module)),i=t.themeType),i?n.push(Xo.computeN([Es.darkTheme],(e=>e.facet(Es.darkTheme)==("dark"==i)?[t]:[]))):n.push(Xo.of(t)),n}(Yo.define(Mc.getTagStyles(t)));return new Ho(e,i)}()).addCodeMirrorToWikiEditor()}))})();
+(()=>{"use strict";class t{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,n){let s=[];return this.decompose(0,t,s,2),n.length&&n.decompose(0,n.length,s,3),this.decompose(e,this.length,s,1),i.from(s,this.length-(e-t)+n.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){let n=[];return this.decompose(t,e,n,0),i.from(n,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),n=new r(this),s=new r(t);for(let t=e,r=e;;){if(n.next(t),s.next(t),t=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(r+=n.value.length,n.done||r>=i)return!0}}iter(t=1){return new r(this,t)}iterRange(t,e=this.length){return new o(this,t,e)}iterLines(t,e){let i;if(null==t)i=this.iter();else{null==e&&(e=this.lines+1);let n=this.line(t).from;i=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new l(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(n){if(0==n.length)throw new RangeError("A document must have at least one line");return 1!=n.length||n[0]?n.length<=32?new e(n):i.from(e.split(n,[])):t.empty}}class e extends t{constructor(t,e=function(t){let e=-1;for(let i of t)e+=i.length+1;return e}(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,n){for(let s=0;;s++){let r=this.text[s],o=n+r.length;if((e?i:o)>=t)return new a(n,o,i,r);n=o+1,i++}}decompose(t,i,r,o){let l=t<=0&&i>=this.length?this:new e(s(this.text,t,i),Math.min(i,this.length)-Math.max(0,t));if(1&o){let t=r.pop(),i=n(l.text,t.text.slice(),0,l.length);if(i.length<=32)r.push(new e(i,t.length+l.length));else{let t=i.length>>1;r.push(new e(i.slice(0,t)),new e(i.slice(t)))}}else r.push(l)}replace(t,r,o){if(!(o instanceof e))return super.replace(t,r,o);let l=n(this.text,n(o.text,s(this.text,0,t)),r),a=this.length+o.length-(r-t);return l.length<=32?new e(l,a):i.from(e.split(l,[]),a)}sliceString(t,e=this.length,i="\n"){let n="";for(let s=0,r=0;s<=e&&rt&&r&&(n+=i),ts&&(n+=o.slice(Math.max(0,t-s),e-s)),s=l+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,i){let n=[],s=-1;for(let r of t)n.push(r),s+=r.length+1,32==n.length&&(i.push(new e(n,s)),n=[],s=-1);return s>-1&&i.push(new e(n,s)),i}}class i extends t{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let e of t)this.lines+=e.lines}lineInner(t,e,i,n){for(let s=0;;s++){let r=this.children[s],o=n+r.length,l=i+r.lines-1;if((e?l:o)>=t)return r.lineInner(t,e,i,n);n=o+1,i=l+1}}decompose(t,e,i,n){for(let s=0,r=0;r<=e&&s=r){let s=n&((r<=t?1:0)|(l>=e?2:0));r>=t&&l<=e&&!s?i.push(o):o.decompose(t-r,e-r,i,s)}r=l+1}}replace(t,e,n){if(n.lines=r&&e<=l){let a=o.replace(t-r,e-r,n),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let r=this.children.slice();return r[s]=a,new i(r,this.length-(e-t)+n.length)}return super.replace(r,l,a)}r=l+1}return super.replace(t,e,n)}sliceString(t,e=this.length,i="\n"){let n="";for(let s=0,r=0;st&&s&&(n+=i),tr&&(n+=o.sliceString(t-r,e-r,i)),r=l+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof i))return 0;let n=0,[s,r,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=e,r+=e){if(s==o||r==l)return n;let i=this.children[s],a=t.children[r];if(i!=a)return n+i.scanIdentical(a,e);n+=i.length+1}}static from(t,n=t.reduce(((t,e)=>t+e.length+1),-1)){let s=0;for(let e of t)s+=e.lines;if(s<32){let i=[];for(let e of t)e.flatten(i);return new e(i,n)}let r=Math.max(32,s>>5),o=r<<1,l=r>>1,a=[],h=0,c=-1,u=[];function f(t){let n;if(t.lines>o&&t instanceof i)for(let e of t.children)f(e);else t.lines>l&&(h>l||!h)?(d(),a.push(t)):t instanceof e&&h&&(n=u[u.length-1])instanceof e&&t.lines+n.lines<=32?(h+=t.lines,c+=t.length+1,u[u.length-1]=new e(n.text.concat(t.text),n.length+1+t.length)):(h+t.lines>r&&d(),h+=t.lines,c+=t.length+1,u.push(t))}function d(){0!=h&&(a.push(1==u.length?u[0]:i.from(u,c)),c=-1,h=u.length=0)}for(let e of t)f(e);return d(),1==a.length?a[0]:new i(a,n)}}function n(t,e,i=0,n=1e9){for(let s=0,r=0,o=!0;r=i&&(a>n&&(l=l.slice(0,n-s)),s0?1:(t instanceof e?t.text.length:t.children.length)<<1]}nextInner(t,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,s=this.nodes[n],r=this.offsets[n],o=r>>1,l=s instanceof e?s.text.length:s.children.length;if(o==(i>0?l:0)){if(0==n)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(i>0?0:1)){if(this.offsets[n]+=i,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(s instanceof e){let e=s.text[o+(i<0?-1:0)];if(this.offsets[n]+=i,e.length>Math.max(0,t))return this.value=0==t?e:i>0?e.slice(t):e.slice(0,e.length-t),this;t-=e.length}else{let r=s.children[o+(i<0?-1:0)];t>r.length?(t-=r.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(i>0?1:(r instanceof e?r.text.length:r.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class o{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new r(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=i?n:e<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class l{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:n}=this.inner.next(t);return e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(t.prototype[Symbol.iterator]=function(){return this.iter()},r.prototype[Symbol.iterator]=o.prototype[Symbol.iterator]=l.prototype[Symbol.iterator]=function(){return this});class a{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}}let h="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((t=>t?parseInt(t,36):1));for(let t=1;tt)return h[e-1]<=t;return!1}function u(t){return t>=127462&&t<=127487}const f=8205;function d(t,e,i=!0,n=!0){return(i?p:g)(t,e,n)}function p(t,e,i){if(e==t.length)return e;e&&m(t.charCodeAt(e))&&w(t.charCodeAt(e-1))&&e--;let n=y(t,e);for(e+=k(n);e=0&&u(y(t,n));)i++,n-=2;if(i%2==0)break;e+=2}}}return e}function g(t,e,i){for(;e>0;){let n=p(t,e-2,i);if(n=56320&&t<57344}function w(t){return t>=55296&&t<56320}function y(t,e){let i=t.charCodeAt(e);if(!w(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return m(n)?n-56320+(i-55296<<10)+65536:i}function v(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function k(t){return t<65536?1:2}const b=/\r\n?|\n/;var x=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(x||(x={}));class S{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=o}else{if(i!=x.Simple&&a>=t&&(i==x.TrackDel&&nt||i==x.TrackBefore&&nt))return null;if(a>t||a==t&&e<0&&!o)return t==n||e<0?s:s+l;s+=l}n=a}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return s}touchesRange(t,e=t){for(let i=0,n=0;i=0&&n<=e&&s>=t)return!(ne)||"cover";n=s}return!1}toString(){let t="";for(let e=0;e=0?":"+n:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some((t=>"number"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new S(t)}static create(t){return new S(t)}}class A extends S{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return C(this,((e,i,n,s,r)=>t=t.replace(n,n+(i-e),r)),!1),t}mapDesc(t,e=!1){return O(this,t,e,!0)}invert(e){let i=this.sections.slice(),n=[];for(let s=0,r=0;s=0){i[s]=l,i[s+1]=o;let a=s>>1;for(;n.length0&&T(i,e,s.text),s.forward(t),o+=t}let a=t[r++];for(;o>1].toJSON()))}return t}static of(e,i,n){let s=[],r=[],o=0,l=null;function a(t=!1){if(!t&&!s.length)return;ol||e<0||l>i)throw new RangeError(`Invalid change range ${e} to ${l} (in doc of length ${i})`);let u=c?"string"==typeof c?t.of(c.split(n||b)):c:t.empty,f=u.length;if(e==l&&0==f)return;eo&&M(s,e-o,-1),M(s,l-e,f),T(r,s,u),o=l}}(e),a(!l),l}static empty(t){return new A(t?[t,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let i=[],n=[];for(let s=0;se&&"string"!=typeof t)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)i.push(r[0],0);else{for(;n.length=0&&i<=0&&i==t[s+1]?t[s]+=e:0==e&&0==t[s]?t[s+1]+=i:n?(t[s]+=e,t[s+1]+=i):t.push(e,i)}function T(e,i,n){if(0==n.length)return;let s=i.length-2>>1;if(s>1])),!(n||l==e.sections.length||e.sections[l+1]<0);)a=e.sections[l++],h=e.sections[l++];i(r,c,o,u,f),r=c,o=u}}}function O(t,e,i,n=!1){let s=[],r=n?[]:null,o=new E(t),l=new E(e);for(let t=-1;;)if(-1==o.ins&&-1==l.ins){let t=Math.min(o.len,l.len);M(s,t,-1),o.forward(t),l.forward(t)}else if(l.ins>=0&&(o.ins<0||t==o.i||0==o.off&&(l.len=0&&t=0)){if(o.done&&l.done)return r?A.createSet(s,r):S.create(s);throw new Error("Mismatched change set lengths")}{let e=0,i=o.len;for(;i;)if(-1==l.ins){let t=Math.min(i,l.len);e+=t,i-=t,l.forward(t)}else{if(!(0==l.ins&&l.lene||o.ins>=0&&o.len>e)&&(t||n.length>i),r.forward2(e),o.forward(e)}}else M(n,0,o.ins,t),s&&T(s,n,o.text),o.next()}}class E{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return i>=e.length?t.empty:e[i]}textBit(e){let{inserted:i}=this.set,n=this.i-2>>1;return n>=i.length&&!e?t.empty:i[n].slice(this.off,null==e?void 0:this.off+e)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class L{constructor(t,e,i){this.from=t,this.to=e,this.flags=i}get anchor(){return 16&this.flags?this.to:this.from}get head(){return 16&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 4&this.flags?-1:8&this.flags?1:0}get bidiLevel(){let t=3&this.flags;return 3==t?null:t}get goalColumn(){let t=this.flags>>5;return 33554431==t?void 0:t}map(t,e=-1){let i,n;return this.empty?i=n=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new L(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return B.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return B.range(this.anchor,i)}eq(t){return this.anchor==t.anchor&&this.head==t.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return B.range(t.anchor,t.head)}static create(t,e,i){return new L(t,e,i)}}class B{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:B.create(this.ranges.map((i=>i.map(t,e))),this.mainIndex)}eq(t){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let e=0;et.toJSON())),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||"number"!=typeof t.main||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new B(t.ranges.map((t=>L.fromJSON(t))),t.main)}static single(t,e=t){return new B([B.range(t,e)],0)}static create(t,e=0){if(0==t.length)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;nt?4:0)|s)}static normalized(t,e=0){let i=t[e];t.sort(((t,e)=>t.from-e.from)),e=t.indexOf(i);for(let i=1;in.head?B.range(o,r):B.range(r,o))}}return new B(t,e)}}function P(t,e){for(let i of t.ranges)if(i.to>e)throw new RangeError("Selection points outside of document")}let N=0;class R{constructor(t,e,i,n,s){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=N++,this.default=t([]),this.extensions="function"==typeof s?s(this):s}static define(t={}){return new R(t.combine||(t=>t),t.compareInput||((t,e)=>t===e),t.compare||(t.combine?(t,e)=>t===e:I),!!t.static,t.enables)}of(t){return new H([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new H(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new H(t,this,2,e)}from(t,e){return e||(e=t=>t),this.compute([t],(i=>e(i.field(t))))}}function I(t,e){return t==e||t.length==e.length&&t.every(((t,i)=>t===e[i]))}class H{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=N++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,s=this.id,r=t[s]>>1,o=2==this.type,l=!1,a=!1,h=[];for(let i of this.dependencies)"doc"==i?l=!0:"selection"==i?a=!0:0==(1&(null!==(e=t[i.id])&&void 0!==e?e:1))&&h.push(t[i.id]);return{create:t=>(t.values[r]=i(t),1),update(t,e){if(l&&e.docChanged||a&&(e.docChanged||e.selection)||W(t,h)){let e=i(t);if(o?!z(e,t.values[r],n):!n(e,t.values[r]))return t.values[r]=e,1}return 0},reconfigure:(t,e)=>{let l,a=e.config.address[s];if(null!=a){let s=X(e,a);if(this.dependencies.every((i=>i instanceof R?e.facet(i)===t.facet(i):!(i instanceof _)||e.field(i,!1)==t.field(i,!1)))||(o?z(l=i(t),s,n):n(l=i(t),s)))return t.values[r]=s,0}else l=i(t);return t.values[r]=l,1}}}}function z(t,e,i){if(t.length!=e.length)return!1;for(let n=0;nt[e.id])),s=i.map((t=>t.type)),r=n.filter((t=>!(1&t))),o=t[e.id]>>1;function l(t){let i=[];for(let e=0;et===e),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(F).find((t=>t.field==this));return((null==e?void 0:e.create)||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:t=>(t.values[e]=this.create(t),1),update:(t,i)=>{let n=t.values[e],s=this.updateF(n,i);return this.compareF(n,s)?0:(t.values[e]=s,1)},reconfigure:(t,i)=>null!=i.config.address[this.id]?(t.values[e]=i.field(this),0):(t.values[e]=this.create(t),1)}}init(t){return[this,F.of({field:this,create:t})]}get extension(){return this}}function q(t){return e=>new K(e,t)}const j={highest:q(0),high:q(1),default:q(2),low:q(3),lowest:q(4)};class K{constructor(t,e){this.inner=t,this.prec=e}}class G{of(t){return new U(this,t)}reconfigure(t){return G.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class U{constructor(t,e){this.compartment=t,this.inner=e}}class J{constructor(t,e,i,n,s,r){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=n,this.staticValues=s,this.facets=r,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,i){let n=[],s=Object.create(null),r=new Map;for(let i of function(t,e,i){let n=[[],[],[],[],[]],s=new Map;return function t(r,o){let l=s.get(r);if(null!=l){if(l<=o)return;let t=n[l].indexOf(r);t>-1&&n[l].splice(t,1),r instanceof U&&i.delete(r.compartment)}if(s.set(r,o),Array.isArray(r))for(let e of r)t(e,o);else if(r instanceof U){if(i.has(r.compartment))throw new RangeError("Duplicate use of compartment in extensions");let n=e.get(r.compartment)||r.inner;i.set(r.compartment,n),t(n,o)}else if(r instanceof K)t(r.inner,r.prec);else if(r instanceof _)n[o].push(r),r.provides&&t(r.provides,o);else if(r instanceof H)n[o].push(r),r.facet.extensions&&t(r.facet.extensions,2);else{let e=r.extension;if(!e)throw new Error(`Unrecognized extension value in extension set (${r}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);t(e,o)}}(t,2),n.reduce(((t,e)=>t.concat(e)))}(t,e,r))i instanceof _?n.push(i):(s[i.facet.id]||(s[i.facet.id]=[])).push(i);let o=Object.create(null),l=[],a=[];for(let t of n)o[t.id]=a.length<<1,a.push((e=>t.slot(e)));let h=null==i?void 0:i.config.facets;for(let t in s){let e=s[t],n=e[0].facet,r=h&&h[t]||[];if(e.every((t=>0==t.type)))if(o[n.id]=l.length<<1|1,I(r,e))l.push(i.facet(n));else{let t=n.combine(e.map((t=>t.value)));l.push(i&&n.compare(t,i.facet(n))?i.facet(n):t)}else{for(let t of e)0==t.type?(o[t.id]=l.length<<1|1,l.push(t.value)):(o[t.id]=a.length<<1,a.push((e=>t.dynamicSlot(e))));o[n.id]=a.length<<1,a.push((t=>V(t,n,e)))}}let c=a.map((t=>t(o)));return new J(t,r,c,o,l,s)}}function Y(t,e){if(1&e)return 2;let i=e>>1,n=t.status[i];if(4==n)throw new Error("Cyclic dependency between fields and/or facets");if(2&n)return n;t.status[i]=4;let s=t.computeSlot(t,t.config.dynamicSlots[i]);return t.status[i]=2|s}function X(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}const Q=R.define(),Z=R.define({combine:t=>t.some((t=>t)),static:!0}),tt=R.define({combine:t=>t.length?t[0]:void 0,static:!0}),et=R.define(),it=R.define(),nt=R.define(),st=R.define({combine:t=>!!t.length&&t[0]});class rt{constructor(t,e){this.type=t,this.value=e}static define(){return new ot}}class ot{of(t){return new rt(this,t)}}class lt{constructor(t){this.map=t}of(t){return new at(this,t)}}class at{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return void 0===e?void 0:e==this.value?this:new at(this.type,e)}is(t){return this.type==t}static define(t={}){return new lt(t.map||(t=>t))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let n of t){let t=n.map(e);t&&i.push(t)}return i}}at.reconfigure=at.define(),at.appendConfig=at.define();class ht{constructor(t,e,i,n,s,r){this.startState=t,this.changes=e,this.selection=i,this.effects=n,this.annotations=s,this.scrollIntoView=r,this._doc=null,this._state=null,i&&P(i,e.newLength),s.some((t=>t.type==ht.time))||(this.annotations=s.concat(ht.time.of(Date.now())))}static create(t,e,i,n,s,r){return new ht(t,e,i,n,s,r)}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(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(ht.userEvent);return!(!e||!(e==t||e.length>t.length&&e.slice(0,t.length)==t&&"."==e[t.length]))}}function ct(t,e){let i=[];for(let n=0,s=0;;){let r,o;if(n=t[n]))r=t[n++],o=t[n++];else{if(!(s=0;s--){let r=i[s](t);r&&Object.keys(r).length&&(n=ut(n,ft(e,r,t.changes.newLength),!0))}return n==t?t:ht.create(e,t.changes,t.selection,n.effects,n.annotations,n.scrollIntoView)}(i?function(t){let e=t.startState,i=!0;for(let n of e.facet(et)){let e=n(t);if(!1===e){i=!1;break}Array.isArray(e)&&(i=!0===i?e:ct(i,e))}if(!0!==i){let n,s;if(!1===i)s=t.changes.invertedDesc,n=A.empty(e.doc.length);else{let e=t.changes.filter(i);n=e.changes,s=e.filtered.mapDesc(e.changes).invertedDesc}t=ht.create(e,n,t.selection&&t.selection.map(s),at.mapEffects(t.effects,s),t.annotations,t.scrollIntoView)}let n=e.facet(it);for(let i=n.length-1;i>=0;i--){let s=n[i](t);t=s instanceof ht?s:Array.isArray(s)&&1==s.length&&s[0]instanceof ht?s[0]:dt(e,gt(s),!1)}return t}(s):s)}ht.time=rt.define(),ht.userEvent=rt.define(),ht.addToHistory=rt.define(),ht.remote=rt.define();const pt=[];function gt(t){return null==t?pt:Array.isArray(t)?t:[t]}var mt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(mt||(mt={}));const wt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let yt;try{yt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}class vt{constructor(t,e,i,n,s,r){this.config=t,this.doc=e,this.selection=i,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=s,r&&(r._state=this);for(let t=0;ts.set(e,t))),i=null),s.set(e.value.compartment,e.value.extension)):e.is(at.reconfigure)?(i=null,n=e.value):e.is(at.appendConfig)&&(i=null,n=gt(n).concat(e.value));i?e=t.startState.values.slice():(i=J.resolve(n,s,this),e=new vt(i,this.doc,this.selection,i.dynamicSlots.map((()=>null)),((t,e)=>e.reconfigure(t,this)),null).values),new vt(i,t.newDoc,t.newSelection,e,((e,i)=>i.update(e,t)),t)}replaceSelection(t){return"string"==typeof t&&(t=this.toText(t)),this.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:t},range:B.cursor(e.from+t.length)})))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),n=this.changes(i.changes),s=[i.range],r=gt(i.effects);for(let i=1;is.spec.fromJSON(r,t))))}return vt.create({doc:t.doc,selection:B.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(e={}){let i=J.resolve(e.extensions||[],new Map),n=e.doc instanceof t?e.doc:t.of((e.doc||"").split(i.staticFacet(vt.lineSeparator)||b)),s=e.selection?e.selection instanceof B?e.selection:B.single(e.selection.anchor,e.selection.head):B.single(0);return P(s,n.length),i.staticFacet(Z)||(s=s.asSingle()),new vt(i,n,s,i.dynamicSlots.map((()=>null)),((t,e)=>e.create(t)),null)}get tabSize(){return this.facet(vt.tabSize)}get lineBreak(){return this.facet(vt.lineSeparator)||"\n"}get readOnly(){return this.facet(st)}phrase(t,...e){for(let e of this.facet(vt.phrases))if(Object.prototype.hasOwnProperty.call(e,t)){t=e[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,((t,i)=>{if("$"==i)return"$";let n=+(i||1);return!n||n>e.length?t:e[n-1]}))),t}languageDataAt(t,e,i=-1){let n=[];for(let s of this.facet(Q))for(let r of s(this,e,i))Object.prototype.hasOwnProperty.call(r,t)&&n.push(r[t]);return n}charCategorizer(t){return e=this.languageDataAt("wordChars",t).join(""),t=>{if(!/\S/.test(t))return mt.Space;if(function(t){if(yt)return yt.test(t);for(let e=0;e"€"&&(i.toUpperCase()!=i.toLowerCase()||wt.test(i)))return!0}return!1}(t))return mt.Word;for(let i=0;i-1)return mt.Word;return mt.Other};var e}wordAt(t){let{text:e,from:i,length:n}=this.doc.lineAt(t),s=this.charCategorizer(t),r=t-i,o=t-i;for(;r>0;){let t=d(e,r,!1);if(s(e.slice(t,r))!=mt.Word)break;r=t}for(;ot.length?t[0]:4}),vt.lineSeparator=tt,vt.readOnly=st,vt.phrases=R.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every((i=>t[i]==e[i]))}}),vt.languageData=Q,vt.changeFilter=et,vt.transactionFilter=it,vt.transactionExtender=nt,G.reconfigure=at.define();class bt{eq(t){return this==t}range(t,e=t){return xt.create(t,e,this)}}bt.prototype.startSide=bt.prototype.endSide=0,bt.prototype.point=!1,bt.prototype.mapMode=x.TrackDel;class xt{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(t,e,i){return new xt(t,e,i)}}function St(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class At{constructor(t,e,i,n){this.from=t,this.to=e,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,n=0){let s=i?this.to:this.from;for(let r=n,o=s.length;;){if(r==o)return r;let n=r+o>>1,l=s[n]-t||(i?this.value[n].endSide:this.value[n].startSide)-e;if(n==r)return l>=0?r:o;l>=0?o=n:r=n+1}}between(t,e,i,n){for(let s=this.findIndex(e,-1e9,!0),r=this.findIndex(i,1e9,!1,s);sh||a==h&&c.startSide>0&&c.endSide<=0)continue;(h-a||c.endSide-c.startSide)<0||(r<0&&(r=a),c.point&&(o=Math.max(o,h-a)),i.push(c),n.push(a-r),s.push(h-r))}return{mapped:i.length?new At(n,s,i,o):null,pos:r}}}class Mt{constructor(t,e,i,n){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=n}static create(t,e,i,n){return new Mt(t,e,i,n)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:i=!1,filterFrom:n=0,filterTo:s=this.length}=t,r=t.filter;if(0==e.length&&!r)return this;if(i&&(e=e.slice().sort(St)),this.isEmpty)return e.length?Mt.of(e):this;let o=new Ot(this,null,-1).goto(0),l=0,a=[],h=new Tt;for(;o.value||l=0){let t=e[l++];h.addInner(t.from,t.to,t.value)||a.push(t)}else 1==o.rangeIndex&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||so.to||s=s&&t<=s+r.length&&!1===r.between(s,t-s,e-s,i))return}this.nextLayer.between(t,e,i)}}iter(t=0){return Dt.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Dt.from(t).goto(e)}static compare(t,e,i,n,s=-1){let r=t.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=s)),o=e.filter((t=>t.maxPoint>0||!t.isEmpty&&t.maxPoint>=s)),l=Ct(r,o,i),a=new Lt(r,l,s),h=new Lt(o,l,s);i.iterGaps(((t,e,i)=>Bt(a,t,h,e,i,n))),i.empty&&0==i.length&&Bt(a,0,h,0,0,n)}static eq(t,e,i=0,n){null==n&&(n=999999999);let s=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0)),r=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0));if(s.length!=r.length)return!1;if(!s.length)return!0;let o=Ct(s,r),l=new Lt(s,o,0).goto(i),a=new Lt(r,o,0).goto(i);for(;;){if(l.to!=a.to||!Pt(l.active,a.active)||l.point&&(!a.point||!l.point.eq(a.point)))return!1;if(l.to>n)return!0;l.next(),a.next()}}static spans(t,e,i,n,s=-1){let r=new Lt(t,null,s).goto(e),o=e,l=r.openStart;for(;;){let t=Math.min(r.to,i);if(r.point){let i=r.activeForPoint(r.to),s=r.pointFromo&&(n.span(o,t,r.active,l),l=r.openEnd(t));if(r.to>i)return l+(r.point&&r.to>i?1:0);o=r.to,r.next()}}static of(t,e=!1){let i=new Tt;for(let n of t instanceof xt?[t]:e?function(t){if(t.length>1)for(let e=t[0],i=1;i0)return t.slice().sort(St);e=n}return t}(t):t)i.add(n.from,n.to,n.value);return i.finish()}}Mt.empty=new Mt([],[],null,-1),Mt.empty.nextLayer=Mt.empty;class Tt{finishChunk(t){this.chunks.push(new At(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}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(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new Tt)).add(t,e,i)}addInner(t,e,i){let n=t-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(n<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),0))}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(Mt.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;let e=Mt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function Ct(t,e,i){let n=new Map;for(let e of t)for(let t=0;t=this.minPoint)break}}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&n.push(new Ot(r,e,i,s));return 1==n.length?n[0]:new Dt(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let i of this.heap)i.goto(t,e);for(let t=this.heap.length>>1;t>=0;t--)Et(this.heap,t);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let t=this.heap.length>>1;t>=0;t--)Et(this.heap,t);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Et(this.heap,0)}}}function Et(t,e){for(let i=t[e];;){let n=1+(e<<1);if(n>=t.length)break;let s=t[n];if(n+1=0&&(s=t[n+1],n++),i.compare(s)<0)break;t[n]=i,t[e]=s,e=n}}class Lt{constructor(t,e,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Dt.from(t,e,i)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){Nt(this.active,t),Nt(this.activeTo,t),Nt(this.activeRank,t),this.minActive=It(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:n,rank:s}=this.cursor;for(;e-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&Nt(i,n)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let t=this.cursor.value;if(t.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from=0&&i[e]=0&&!(this.activeRank[i]t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}}function Bt(t,e,i,n,s,r){t.goto(e),i.goto(n);let o=n+s,l=n,a=n-e;for(;;){let e=t.to+a-i.to||t.endSide-i.endSide,n=e<0?t.to+a:i.to,s=Math.min(n,o);if(t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&Pt(t.activeForPoint(t.to),i.activeForPoint(i.to))||r.comparePoint(l,s,t.point,i.point):s>l&&!Pt(t.active,i.active)&&r.compareRange(l,s,t.active,i.active),n>o)break;l=n,e<=0&&t.next(),e>=0&&i.next()}}function Pt(t,e){if(t.length!=e.length)return!1;for(let i=0;i=e;i--)t[i+1]=t[i];t[e]=i}function It(t,e){let i=-1,n=1e9;for(let s=0;st.map((t=>e.replace(/&/,t))))).reduce(((t,e)=>t.concat(e))),o,r);else if(o&&"object"==typeof o){if(!a)throw new RangeError("The value of a property ("+i+") should be a primitive value.");s(n(i),o,l,h)}else null!=o&&l.push(i.replace(/_.*/,"").replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))+": "+o+";")}(l.length||h)&&r.push((!i||a||o?t:t.map(i)).join(", ")+" {"+l.join(" ")+"}")}for(let e in t)s(n(e),t[e],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let t=Vt[zt]||1;return Vt[zt]=t+1,"ͼ"+t.toString(36)}static mount(t,e,i){let n=t[Wt],s=i&&i.nonce;n?s&&n.setNonce(s):n=new qt(t,s),n.mount(Array.isArray(e)?e:[e])}}let _t=new Map;class qt{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let e=_t.get(i);if(e)return t.adoptedStyleSheets=[e.sheet,...t.adoptedStyleSheets],t[Wt]=e;this.sheet=new n.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],_t.set(i,this)}else{this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);let n=t.head||t;n.insertBefore(this.styleTag,n.firstChild)}this.modules=[],t[Wt]=this}mount(t){let e=this.sheet,i=0,n=0;for(let s=0;s-1&&(this.modules.splice(o,1),n--,o=-1),-1==o){if(this.modules.splice(n++,0,r),e)for(let t=0;t",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Kt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Gt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Ut=0;Ut<10;Ut++)jt[48+Ut]=jt[96+Ut]=String(Ut);for(Ut=1;Ut<=24;Ut++)jt[Ut+111]="F"+Ut;for(Ut=65;Ut<=90;Ut++)jt[Ut]=String.fromCharCode(Ut+32),$t[Ut]=String.fromCharCode(Ut);for(var Jt in jt)$t.hasOwnProperty(Jt)||($t[Jt]=jt[Jt]);function Yt(t){let e;return e=11==t.nodeType?t.getSelection?t:t.ownerDocument:t,e.getSelection()}function Xt(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function Qt(t,e){if(!e.anchorNode)return!1;try{return Xt(t,e.anchorNode)}catch(t){return!1}}function Zt(t){return 3==t.nodeType?ce(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function te(t,e,i,n){return!!i&&(ie(t,e,i,n,-1)||ie(t,e,i,n,1))}function ee(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function ie(t,e,i,n,s){for(;;){if(t==i&&e==n)return!0;if(e==(s<0?0:ne(t))){if("DIV"==t.nodeName)return!1;let i=t.parentNode;if(!i||1!=i.nodeType)return!1;e=ee(t)+(s<0?0:1),t=i}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(s<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=s<0?ne(t):0}}}function ne(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function se(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function re(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}class oe{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:i}=t;this.set(e,Math.min(t.anchorOffset,e?ne(e):0),i,Math.min(t.focusOffset,i?ne(i):0))}set(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}let le,ae=null;function he(t){if(t.setActive)return t.setActive();if(ae)return t.focus(ae);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==ae?{get preventScroll(){return ae={preventScroll:!0},!0}}:void 0),!ae){ae=!1;for(let t=0;tMath.max(1,t.scrollHeight-t.clientHeight-4)}class pe{constructor(t,e,i=!0){this.node=t,this.offset=e,this.precise=i}static before(t,e){return new pe(t.parentNode,ee(t),e)}static after(t,e){return new pe(t.parentNode,ee(t)+1,e)}}const ge=[];class me{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(t){let e=this.posAtStart;for(let i of this.children){if(i==t)return e;e+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(2&this.flags){let i,n=this.dom,s=null;for(let r of this.children){if(7&r.flags){if(!r.dom&&(i=s?s.nextSibling:n.firstChild)){let t=me.get(i);(!t||!t.parent&&t.canReuseDOM(r))&&r.reuseDOM(i)}r.sync(t,e),r.flags&=-8}if(i=s?s.nextSibling:n.firstChild,e&&!e.written&&e.node==n&&i!=r.dom&&(e.written=!0),r.dom.parentNode==n)for(;i&&i!=r.dom;)i=we(i);else n.insertBefore(r.dom,i);s=r.dom}for(i=s?s.nextSibling:n.firstChild,i&&e&&e.node==n&&(e.written=!0);i;)i=we(i)}else if(1&this.flags)for(let i of this.children)7&i.flags&&(i.sync(t,e),i.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let i;if(t==this.dom)i=this.dom.childNodes[e];else{let n=0==ne(t)?0:0==e?-1:1;for(;;){let e=t.parentNode;if(e==this.dom)break;0==n&&e.firstChild!=e.lastChild&&(n=t==e.firstChild?-1:1),t=e}i=n<0?t:t.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!me.get(i);)i=i.nextSibling;if(!i)return this.length;for(let t=0,e=0;;t++){let n=this.children[t];if(n.dom==i)return e;e+=n.length+n.breakAfter}}domBoundsAround(t,e,i=0){let n=-1,s=-1,r=-1,o=-1;for(let l=0,a=i,h=i;le)return i.domBoundsAround(t,e,a);if(c>=t&&-1==n&&(n=l,s=a),a>e&&i.dom.parentNode==this.dom){r=l,o=h;break}h=c,a=c+i.breakAfter}return{from:s,to:o<0?i+this.length:o,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:r=0?this.children[r].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),1&e.flags)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,i=ge){this.markDirty();for(let i=t;ithis.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function ve(t,e,i,n,s,r,o,l,a){let{children:h}=t,c=h.length?h[e]:null,u=r.length?r[r.length-1]:null,f=u?u.breakAfter:o;if(!(e==n&&c&&!o&&!f&&r.length<2&&c.merge(i,s,r.length?u:null,0==i,l,a))){if(n0&&(!o&&r.length&&c.merge(i,c.length,r[0],!1,l,0)?c.breakAfter=r.shift().breakAfter:(i2);var Be={mac:Le||/Mac/.test(be.platform),windows:/Win/.test(be.platform),linux:/Linux|X11/.test(be.platform),ie:Te,ie_version:Ae?xe.documentMode||6:Me?+Me[1]:Se?+Se[1]:0,gecko:Ce,gecko_version:Ce?+(/Firefox\/(\d+)/.exec(be.userAgent)||[0,0])[1]:0,chrome:!!Oe,chrome_version:Oe?+Oe[1]:0,ios:Le,android:/Android\b/.test(be.userAgent),webkit:De,safari:Ee,webkit_version:De?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=xe.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Pe extends me{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){3==t.nodeType&&this.createDOM(t)}merge(t,e,i){return!(8&this.flags||i&&(!(i instanceof Pe)||this.length-(e-t)+i.length>256||8&i.flags)||(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),0))}split(t){let e=new Pe(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=8&this.flags,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new pe(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return function(t,e,i){let n=t.nodeValue.length;e>n&&(e=n);let s=e,r=e,o=0;0==e&&i<0||e==n&&i>=0?Be.chrome||Be.gecko||(e?(s--,o=1):r=0)?0:l.length-1];return Be.safari&&!o&&0==a.width&&(a=Array.prototype.find.call(l,(t=>t.width))||a),o?se(a,o<0):a||null}(this.dom,t,e)}}class Ne extends me{constructor(t,e=[],i=0){super(),this.mark=t,this.children=e,this.length=i;for(let t of e)t.setParent(this)}setAttrs(t){if(fe(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!(8&(this.flags|t.flags))}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,i,n,s,r){return!(i&&(!(i instanceof Ne&&i.mark.eq(this.mark))||t&&s<=0||et&&e.push(i=t&&(n=s),i=o,s++}let r=this.length-t;return this.length=t,n>-1&&(this.children.length=n,this.markDirty()),new Ne(this.mark,e,r)}domAtPos(t){return He(this,t)}coordsAt(t,e){return We(this,t,e)}}class Re extends me{static create(t,e,i){return new Re(t,e,i)}constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}split(t){let e=Re.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.dom.contentEditable="false")}getSide(){return this.side}merge(t,e,i,n,s,r){return!(i&&(!(i instanceof Re&&this.widget.compare(i.widget))||t>0&&s<=0||e0)?pe.before(this.dom):pe.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let i=this.widget.coordsAt(this.dom,t,e);if(i)return i;let n=this.dom.getClientRects(),s=null;if(!n.length)return null;let r=this.side?this.side<0:t>0;for(let e=r?n.length-1:0;s=n[e],!(t>0?0==e:e==n.length-1||s.top0?pe.before(this.dom):pe.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return t.empty}get isHidden(){return!0}}function He(t,e){let i=t.dom,{children:n}=t,s=0;for(let t=0;st&&e0;t--){let e=n[t-1];if(e.dom.parentNode==i)return e.domAtPos(e.length)}for(let t=s;t0&&e instanceof Ne&&s.length&&(n=s[s.length-1])instanceof Ne&&n.mark.eq(e.mark)?ze(n,e.children[0],i-1):(s.push(e),e.setParent(t)),t.length+=e.length}function We(t,e,i){let n=null,s=-1,r=null,o=-1;!function t(e,l){for(let a=0,h=0;a=l&&(c.children.length?t(c,l-h):(!r||r.isHidden&&i>0)&&(u>l||h==u&&c.getSide()>0)?(r=c,o=l-h):(h-1?1:0)!=s.length-(i&&s.indexOf(i)>-1?1:0))return!1;for(let r of n)if(r!=i&&(-1==s.indexOf(r)||t[r]!==e[r]))return!1;return!0}function qe(t,e,i){let n=!1;if(e)for(let s in e)i&&s in i||(n=!0,"style"==s?t.style.cssText="":t.removeAttribute(s));if(i)for(let s in i)e&&e[s]==i[s]||(n=!0,"style"==s?t.style.cssText=i[s]:t.setAttribute(s,i[s]));return n}function je(t){let e=Object.create(null);for(let i=0;i0?3e8:-4e8:e>0?1e8:-1e8,new Ye(t,e,e,i,t.widget||null,!1)}static replace(t){let e,i,n=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{let{start:s,end:r}=Xe(t,n);e=(s?n?-3e8:-1:5e8)-1,i=1+(r?n?2e8:1:-6e8)}return new Ye(t,e,i,n,t.widget||null,!0)}static line(t){return new Je(t)}static set(t,e=!1){return Mt.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Ge.none=Mt.empty;class Ue extends Ge{constructor(t){let{start:e,end:i}=Xe(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){var e,i;return this==t||t instanceof Ue&&this.tagName==t.tagName&&(this.class||(null===(e=this.attrs)||void 0===e?void 0:e.class))==(t.class||(null===(i=t.attrs)||void 0===i?void 0:i.class))&&_e(this.attrs,t.attrs,"class")}range(t,e=t){if(t>=e)throw new RangeError("Mark decorations may not be empty");return super.range(t,e)}}Ue.prototype.point=!1;class Je extends Ge{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Je&&this.spec.class==t.spec.class&&_e(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}Je.prototype.mapMode=x.TrackBefore,Je.prototype.point=!0;class Ye extends Ge{constructor(t,e,i,n,s,r){super(e,i,s,t),this.block=n,this.isReplace=r,this.mapMode=n?e<=0?x.TrackBefore:x.TrackAfter:x.TrackDel}get type(){return this.startSide=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Ye&&((e=this.widget)==(i=t.widget)||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,i}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}function Xe(t,e=!1){let{inclusiveStart:i,inclusiveEnd:n}=t;return null==i&&(i=t.inclusive),null==n&&(n=t.inclusive),{start:null!=i?i:e,end:null!=n?n:e}}function Qe(t,e,i,n=0){let s=i.length-1;s>=0&&i[s]+n>=t?i[s]=Math.max(i[s],e):i.push(t,e)}Ye.prototype.point=!0;class Ze extends me{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,n,s,r){if(i){if(!(i instanceof Ze))return!1;this.dom||i.transferDOM(this)}return n&&this.setDeco(i?i.attrs:null),ke(this,t,e,i?i.children:[],s,r),!0}split(t){let e=new Ze;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i,off:n}=this.childPos(t);n&&(e.append(this.children[i].split(n),0),this.children[i].merge(n,this.children[i].length,null,!1,0,0),i++);for(let t=i;t0&&0==this.children[i-1].length;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){_e(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){ze(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=Ve(e,this.attrs||{})),i&&(this.attrs=Ve({class:i},this.attrs||{}))}domAtPos(t){return He(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}sync(t,e){var i;this.dom?4&this.flags&&(fe(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(qe(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t,e);let n=this.dom.lastChild;for(;n&&me.get(n)instanceof Ne;)n=n.lastChild;if(!(n&&this.length&&("BR"==n.nodeName||0!=(null===(i=me.get(n))||void 0===i?void 0:i.isEditable)||Be.ios&&this.children.some((t=>t instanceof Pe))))){let t=document.createElement("BR");t.cmIgnore=!0,this.dom.appendChild(t)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let t,e=0;for(let i of this.children){if(!(i instanceof Pe)||/[^ -~]/.test(i.text))return null;let n=Zt(i.dom);if(1!=n.length)return null;e+=n[0].width,t=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(t,e){let i=We(this,t,e);if(!this.children.length&&i&&this.parent){let{heightOracle:t}=this.parent.view.viewState,e=i.bottom-i.top;if(Math.abs(e-t.lineHeight)<2&&t.textHeight=e){if(s instanceof Ze)return s;if(r>e)break}n=r+s.breakAfter}return null}}class ti extends me{constructor(t,e,i){super(),this.widget=t,this.length=e,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,n,s,r){return!(i&&(!(i instanceof ti&&this.widget.compare(i.widget))||t>0&&s<=0||e0;){if(this.textOff==this.text.length){let{value:e,lineBreak:i,done:n}=this.cursor.next(this.skip);if(this.skip=0,n)throw new Error("Ran out of text content when drawing inline views");if(i){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}this.text=e,this.textOff=0}let n=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(ii(new Pe(this.text.slice(this.textOff,this.textOff+n)),e),i),this.atCursorPos=!0,this.textOff+=n,t-=n,i=0}}span(t,e,i,n){this.buildText(e-t,i,n),this.pos=e,this.openStart<0&&(this.openStart=n)}point(t,e,i,n,s,r){if(this.disallowBlockEffectsFor[r]&&i instanceof Ye){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=e-t;if(i instanceof Ye)if(i.block){let{type:t}=i;t!=Ke.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new ti(i.widget||new ni("div"),o,t))}else{let r=Re.create(i.widget||new ni("span"),o,o?0:i.startSide),l=this.atCursorPos&&!r.isEditable&&s<=n.length&&(t0),a=!r.isEditable&&(tn.length||i.startSide<=0),h=this.getLine();2!=this.pendingBuffer||l||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),l&&(h.append(ii(new Ie(1),n),s),s=n.length+Math.max(0,s-n.length)),h.append(ii(r,n),s),this.atCursorPos=a,this.pendingBuffer=a?tn.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=s)}static build(t,e,i,n,s){let r=new ei(t,e,i,s);return r.openEnd=Mt.spans(n,e,i,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function ii(t,e){for(let i of e)t=new Ne(i,[t],t.length);return t}class ni extends $e{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}const si=R.define(),ri=R.define(),oi=R.define(),li=R.define(),ai=R.define(),hi=R.define(),ci=R.define(),ui=R.define({combine:t=>t.some((t=>t))}),fi=R.define({combine:t=>t.some((t=>t))});class di{constructor(t,e="nearest",i="nearest",n=5,s=5){this.range=t,this.y=e,this.x=i,this.yMargin=n,this.xMargin=s}map(t){return t.empty?this:new di(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}const pi=at.define({map:(t,e)=>t.map(e)});function gi(t,e,i){let n=t.facet(li);n.length?n[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e)}const mi=R.define({combine:t=>!t.length||t[0]});let wi=0;const yi=R.define();class vi{constructor(t,e,i,n){this.id=t,this.create=e,this.domEventHandlers=i,this.extension=n(this)}static define(t,e){const{eventHandlers:i,provide:n,decorations:s}=e||{};return new vi(wi++,t,i,(t=>{let e=[yi.of(t)];return s&&e.push(Si.of((e=>{let i=e.plugin(t);return i?s(i):Ge.none}))),n&&e.push(n(t)),e}))}static fromClass(t,e){return vi.define((e=>new t(e)),e)}}class ki{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(e){if(gi(t.state,e,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){gi(t.state,e,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(e){gi(t.state,e,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const bi=R.define(),xi=R.define(),Si=R.define(),Ai=R.define(),Mi=R.define();function Ti(t,e,i){let n=t.state.facet(Mi);if(!n.length)return n;let s=n.map((e=>e instanceof Function?e(t):e)),r=[];return Mt.spans(s,e,i,{point(){},span(t,e,i,n){let s=r;for(let r=i.length-1;r>=0;r--,n--){let o,l=i[r].spec.bidiIsolate;if(null!=l)if(n>0&&s.length&&(o=s[s.length-1]).to==t&&o.direction==l)o.to=e,s=o.inner;else{let i={from:t,to:e,direction:l,inner:[]};s.push(i),s=i.inner}}}}),r}const Ci=R.define();function Oi(t){let e=0,i=0,n=0,s=0;for(let r of t.state.facet(Ci)){let o=r(t);o&&(null!=o.left&&(e=Math.max(e,o.left)),null!=o.right&&(i=Math.max(i,o.right)),null!=o.top&&(n=Math.max(n,o.top)),null!=o.bottom&&(s=Math.max(s,o.bottom)))}return{left:e,right:i,top:n,bottom:s}}const Di=R.define();class Ei{constructor(t,e,i,n){this.fromA=t,this.toA=e,this.fromB=i,this.toB=n}join(t){return new Ei(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>i.toA)){if(n.toAh)break;s+=2}if(!l)return i;new Ei(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),r=l.toA,o=l.toB}}}class Li{constructor(t,e,i){this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=A.empty(this.startState.doc.length);for(let t of i)this.changes=this.changes.compose(t.changes);let n=[];this.changes.iterChangedRanges(((t,e,i,s)=>n.push(new Ei(t,e,i,s)))),this.changedRanges=n}static create(t,e,i){return new Li(t,e,i)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((t=>t.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}var Bi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Bi||(Bi={}));const Pi=Bi.LTR,Ni=Bi.RTL;function Ri(t){let e=[];for(let i=0;i=e){if(o.level==i)return r;(s<0||(0!=n?n<0?o.frome:t[s].level>o.level))&&(s=r)}}if(s<0)throw new RangeError("Index out of range");return s}}function _i(t,e){if(t.length!=e.length)return!1;for(let i=0;ia&&o.push(new Fi(a,p.from,f)),$i(t,p.direction==Pi!=!(f%2)?n+1:n,s,p.inner,p.from,p.to,o),a=p.to),d=p.to}else{if(d==i||(e?qi[d]!=l:qi[d]==l))break;d++}u?ji(t,a,d,n+1,s,u,o):ae;){let i=!0,c=!1;if(!h||a>r[h-1].to){let t=qi[a-1];t!=l&&(i=!1,c=16==t)}let u=i||1!=l?null:[],f=i?n:n+1,d=a;t:for(;;)if(h&&d==r[h-1].to){if(c)break t;let p=r[--h];if(!i)for(let t=p.from,i=h;;){if(t==e)break t;if(!i||r[i-1].to!=t){if(qi[t-1]==l)break t;break}t=r[--i].from}u?u.push(p):(p.to=0;t-=3)if(Wi[t+1]==-i){let e=Wi[t+2],i=2&e?s:4&e?1&e?r:s:0;i&&(qi[o]=qi[Wi[t]]=i),l=t;break}}else{if(189==Wi.length)break;Wi[l++]=o,Wi[l++]=e,Wi[l++]=a}else if(2==(n=qi[o])||1==n){let t=n==s;a=t?0:1;for(let e=l-3;e>=0;e-=3){let i=Wi[e+2];if(2&i)break;if(t)Wi[e+2]|=2;else{if(4&i)break;Wi[e+2]|=4}}}}}(t,s,r,n,l),function(t,e,i,n){for(let s=0,r=n;s<=i.length;s++){let o=s?i[s-1].to:t,l=sa;)e==r&&(e=i[--n].from,r=n?i[n-1].to:t),qi[--e]=c;a=o}else r=o,a++}}}(s,r,n,l),ji(t,s,r,e,i,n,o)}function Ki(t){return[new Fi(0,t,0)]}let Gi="";function Ui(t,e,i,n,s){var r;let o=n.head-t.from,l=-1;if(0==o){if(!s||!t.length)return null;e[0].level!=i&&(o=e[0].side(!1,i),l=0)}else if(o==t.length){if(s)return null;let t=e[e.length-1];t.level!=i&&(o=t.side(!0,i),l=e.length-1)}l<0&&(l=Fi.find(e,o,null!==(r=n.bidiLevel)&&void 0!==r?r:-1,n.assoc));let a=e[l];o==a.side(s,i)&&(a=e[l+=s?1:-1],o=a.side(!s,i));let h=s==(a.dir==i),c=d(t.text,o,h);if(Gi=t.text.slice(Math.min(o,c),Math.max(o,c)),c!=a.side(s,i))return B.cursor(c+t.from,h?-1:1,a.level);let u=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return u||a.level==i?u&&u.level0&&i.length&&(i.every((({fromA:t,toA:e})=>ethis.minWidthTo))?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=-1;this.view.inputState.composing>=0&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?n=this.domChanged.newSel.head:function(t,e){let i=!1;return e&&t.iterChangedRanges(((t,n)=>{te.from&&(i=!0)})),i}(t.changes,this.hasComposition)||t.selectionSet||(n=t.state.selection.main.head));let s=n>-1?function(t,e,i){let n=Xi(t,i);if(!n)return null;let{node:s,from:r,to:o}=n,l=s.nodeValue;if(/[\n\r]/.test(l))return null;if(t.state.doc.sliceString(n.from,n.to)!=l)return null;let a=e.invertedDesc,h=new Ei(a.mapPos(r),a.mapPos(o),r,o),c=[];for(let e=s.parentNode;;e=e.parentNode){let i=me.get(e);if(i instanceof Ne)c.push({node:e,deco:i.mark});else{if(i instanceof Ze||"DIV"==e.nodeName&&e.parentNode==t.contentDOM)return{range:h,text:s,marks:c,line:e};if(e==t.contentDOM)return null;c.push({node:e,deco:new Ue({inclusive:!0,attributes:je(e),tagName:e.tagName.toLowerCase()})})}}}(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:e,to:n}=this.hasComposition;i=new Ei(e,n,t.changes.mapPos(e,-1),t.changes.mapPos(n,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Be.ie||Be.chrome)&&!s&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let r=function(t,e,i){let n=new Zi;return Mt.compare(t,e,i,n),n.changes}(this.decorations,this.updateDeco(),t.changes);return i=Ei.extendWithRanges(i,r),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,t.startState.doc.length,s),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,i){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,i);let{observer:n}=this.view;n.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=Be.chrome||Be.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,t),this.flags&=-8,t&&(t.written||n.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((t=>t.flags&=-9));let s=[];if(this.view.viewport.from||this.view.viewport.to=0?n[t]:null;if(!e)break;let r,o,l,a,{fromA:h,toA:c,fromB:u,toB:f}=e;if(i&&i.range.fromBu){let t=ei.build(this.view.state.doc,u,i.range.fromB,this.decorations,this.dynamicDecorationMap),e=ei.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);o=t.breakAtStart,l=t.openStart,a=e.openEnd;let n=this.compositionView(i);e.breakAtStart?n.breakAfter=1:e.content.length&&n.merge(n.length,n.length,e.content[0],!1,e.openStart,0)&&(n.breakAfter=e.content[0].breakAfter,e.content.shift()),t.content.length&&n.merge(0,0,t.content[t.content.length-1],!0,0,t.openEnd)&&t.content.pop(),r=t.content.concat(n).concat(e.content)}else({content:r,breakAtStart:o,openStart:l,openEnd:a}=ei.build(this.view.state.doc,u,f,this.decorations,this.dynamicDecorationMap));let{i:d,off:p}=s.findPos(c,1),{i:g,off:m}=s.findPos(h,-1);ve(this,g,m,d,p,r,o,l,a)}i&&this.fixCompositionDOM(i)}compositionView(t){let e=new Pe(t.text.nodeValue);e.flags|=8;for(let{deco:i}of t.marks)e=new Ne(i,[e],e.length);let i=new Ze;return i.append(e,0),i}fixCompositionDOM(t){let e=(t,e)=>{e.flags|=8|(e.children.some((t=>7&t.flags))?1:0),this.markedForComposition.add(e);let i=me.get(t);i&&i!=e&&(i.dom=null),e.setDOM(t)},i=this.childPos(t.range.fromB,1),n=this.children[i.i];e(t.line,n);for(let s=t.marks.length-1;s>=-1;s--)i=n.childPos(i.off,1),n=n.children[i.i],e(s>=0?t.marks[s].node:t.text,n)}updateSelection(t=!1,e=!1){!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let i=this.view.root.activeElement,n=i==this.dom,s=!n&&Qt(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(n||e||s))return;let r=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(o.anchor)),a=o.empty?l:this.moveToLine(this.domAtPos(o.head));if(Be.gecko&&o.empty&&!this.hasComposition&&1==(h=l).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable)){let t=document.createTextNode("");this.view.observer.ignore((()=>l.node.insertBefore(t,l.node.childNodes[l.offset]||null))),l=a=new pe(t,0),r=!0}var h;let c=this.view.observer.selectionRange;!r&&c.focusNode&&te(l.node,l.offset,c.anchorNode,c.anchorOffset)&&te(a.node,a.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((()=>{Be.android&&Be.chrome&&this.dom.contains(c.focusNode)&&function(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let t=Yt(this.view.root);if(t)if(o.empty){if(Be.gecko){let t=(e=l.node,n=l.offset,1!=e.nodeType?0:(n&&"false"==e.childNodes[n-1].contentEditable?1:0)|(no.head&&([l,a]=[a,l]),e.setEnd(a.node,a.offset),e.setStart(l.node,l.offset),t.removeAllRanges(),t.addRange(e)}var e,n;s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),i&&i.focus())})),this.view.observer.setSelectionRange(l,a)),this.impreciseAnchor=l.precise?null:new pe(c.anchorNode,c.anchorOffset),this.impreciseHead=a.precise?null:new pe(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,i=Yt(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!(i&&e.empty&&e.assoc&&i.modify))return;let r=Ze.find(this,e.head);if(!r)return;let o=r.posAtStart;if(e.head==o||e.head==o+r.length)return;let l=this.coordsAt(e.head,-1),a=this.coordsAt(e.head,1);if(!l||!a||l.bottom>a.top)return;let h=this.domAtPos(e.head+e.assoc);i.collapse(h.node,h.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&i.collapse(n,s)}moveToLine(t){let e,i=this.dom;if(t.node!=i)return t;for(let n=t.offset;!e&&n=0;n--){let t=me.get(i.childNodes[n]);t instanceof Ze&&(e=t.domAtPos(t.length))}return e?new pe(e.node,e.offset,!0):t}nearest(t){for(let e=t;e;){let t=me.get(e);if(t&&t.rootView==this)return t;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;er||t==r&&s.type!=Ke.WidgetBefore&&s.type!=Ke.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==Ke.WidgetBefore&&e>-2))return s.coordsAt(t-r,e);i=r}}coordsForChar(t){let{i:e,off:i}=this.childPos(t,1),n=this.children[e];if(!(n instanceof Ze))return null;for(;n.children.length;){let{i:t,off:e}=n.childPos(i,1);for(;;t++){if(t==n.children.length)return null;if((n=n.children[t]).length)break}i=e}if(!(n instanceof Pe))return null;let s=d(n.text,i);if(s==i)return null;let r=ce(n.dom,i,s).getClientRects();return!r.length||r[0].top>=r[0].bottom?null:r[0]}measureVisibleLineHeights(t){let e=[],{from:i,to:n}=t,s=this.view.contentDOM.clientWidth,r=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,l=this.view.textDirection==Bi.LTR;for(let t=0,a=0;an)break;if(t>=i){let i=h.dom.getBoundingClientRect();if(e.push(i.height),r){let e=h.dom.lastChild,n=e?Zt(e):[];if(n.length){let e=n[n.length-1],r=l?e.right-i.left:i.right-e.left;r>o&&(o=r,this.minWidth=s,this.minWidthFrom=t,this.minWidthTo=c)}}}t=c+h.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return"rtl"==getComputedStyle(this.children[e].dom).direction?Bi.RTL:Bi.LTR}measureTextSize(){for(let t of this.children)if(t instanceof Ze){let e=t.measureTextSize();if(e)return e}let t,e,i,n=document.createElement("div");return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(n);let s=Zt(n.firstChild)[0];t=n.getBoundingClientRect().height,e=s?s.width/27:7,i=s?s.height:t,n.remove()})),{lineHeight:t,charWidth:e,textHeight:i}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new ye(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,n=0;;n++){let s=n==e.viewports.length?null:e.viewports[n],r=s?s.from-1:this.length;if(r>i){let n=(e.lineBlockAt(r).bottom-e.lineBlockAt(i).top)/this.view.scaleY;t.push(Ge.replace({widget:new Yi(n),block:!0,inclusive:!0,isBlockGap:!0}).range(i,r))}if(!s)break;i=s.to+1}return Ge.set(t)}updateDeco(){let t=this.view.state.facet(Si).map(((t,e)=>(this.dynamicDecorationMap[e]="function"==typeof t)?t(this.view):t));for(let e=t.length;ei.anchor?-1:1);if(!n)return;!i.empty&&(e=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(n={left:Math.min(n.left,e.left),top:Math.min(n.top,e.top),right:Math.max(n.right,e.right),bottom:Math.max(n.bottom,e.bottom)});let s=Oi(this.view),r={left:n.left-s.left,top:n.top-s.top,right:n.right+s.right,bottom:n.bottom+s.bottom};!function(t,e,i,n,s,r,o,l){let a=t.ownerDocument,h=a.defaultView||window;for(let c=t,u=!1;c&&!u;)if(1==c.nodeType){let t,f=c==a.body,d=1,p=1;if(f)t=re(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(u=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let e=c.getBoundingClientRect();d=e.width/c.offsetWidth,p=e.height/c.offsetHeight,t={left:e.left,right:e.left+c.clientWidth*d,top:e.top,bottom:e.top+c.clientHeight*p}}let g=0,m=0;if("nearest"==s)e.top0&&e.bottom>t.bottom+m&&(m=e.bottom-t.bottom+m+o)):e.bottom>t.bottom&&(m=e.bottom-t.bottom+o,i<0&&e.top-m0&&e.right>t.right+g&&(g=e.right-t.right+g+r)):e.right>t.right&&(g=e.right-t.right+r,i<0&&e.left0))break;i=i.childNodes[n-1],n=ne(i)}if(i>=0)for(let n=t,s=e;;){if(3==n.nodeType)return{node:n,offset:s};if(!(1==n.nodeType&&s=0))break;n=n.childNodes[s],s=0}return null}let Zi=class{constructor(){this.changes=[]}compareRange(t,e){Qe(t,e,this.changes)}comparePoint(t,e){Qe(t,e,this.changes)}};function tn(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function en(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function nn(t,e){return t.tope.top+1}function sn(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function on(t,e,i){let n,s,r,o,l,a,h,c,u=!1;for(let f=t.firstChild;f;f=f.nextSibling){let t=Zt(f);for(let d=0;dm||o==m&&r>g){n=f,s=p,r=g,o=m;let l=m?i0?d0)}0==g?i>p.bottom&&(!h||h.bottomp.top)&&(a=f,c=p):h&&nn(h,p)?h=rn(h,p.bottom):c&&nn(c,p)&&(c=sn(c,p.top))}}if(h&&h.bottom>=i?(n=l,s=h):c&&c.top<=i&&(n=a,s=c),!n)return{node:t,offset:0};let f=Math.max(s.left,Math.min(s.right,e));return 3==n.nodeType?ln(n,f,i):u&&"false"!=n.contentEditable?on(n,f,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(s.left+s.right)/2?1:0)}}function ln(t,e,i){let n=t.nodeValue.length,s=-1,r=1e9,o=0;for(let l=0;li?h.top-i:i-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&c=(h.left+h.right)/2,n=i;if((Be.chrome||Be.gecko)&&ce(t,l).getBoundingClientRect().left==h.right&&(n=!i),c<=0)return{node:t,offset:l+(n?1:0)};s=l+(n?1:0),r=c}}}return{node:t,offset:s>-1?s:o>0?t.nodeValue.length:0}}function an(t,e,i,n=-1){var s,r;let o,l=t.contentDOM.getBoundingClientRect(),a=l.top+t.viewState.paddingTop,{docHeight:h}=t.viewState,{x:c,y:u}=e,f=u-a;if(f<0)return 0;if(f>h)return t.state.doc.length;for(let e=t.viewState.heightOracle.textHeight/2,s=!1;o=t.elementAtHeight(f),o.type!=Ke.Text;)for(;f=n>0?o.bottom+e:o.top-e,!(f>=0&&f<=h);){if(s)return i?null:0;s=!0,n=-n}u=a+f;let d=o.from;if(dt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:hn(t,l,o,c,u);let p=t.dom.ownerDocument,g=t.root.elementFromPoint?t.root:p,m=g.elementFromPoint(c,u);m&&!t.contentDOM.contains(m)&&(m=null),m||(c=Math.max(l.left+1,Math.min(l.right-1,c)),m=g.elementFromPoint(c,u),m&&!t.contentDOM.contains(m)&&(m=null));let w,y=-1;if(m&&0!=(null===(s=t.docView.nearest(m))||void 0===s?void 0:s.isEditable))if(p.caretPositionFromPoint){let t=p.caretPositionFromPoint(c,u);t&&({offsetNode:w,offset:y}=t)}else if(p.caretRangeFromPoint){let e=p.caretRangeFromPoint(c,u);e&&(({startContainer:w,startOffset:y}=e),(!t.contentDOM.contains(w)||Be.safari&&function(t,e,i){let n;if(3!=t.nodeType||e!=(n=t.nodeValue.length))return!1;for(let e=t.nextSibling;e;e=e.nextSibling)if(1!=e.nodeType||"BR"!=e.nodeName)return!1;return ce(t,n-1,n).getBoundingClientRect().left>i}(w,y,c)||Be.chrome&&function(t,e,i){if(0!=e)return!1;for(let e=t;;){let t=e.parentNode;if(!t||1!=t.nodeType||t.firstChild!=e)return!1;if(t.classList.contains("cm-line"))break;e=t}return i-(1==t.nodeType?t.getBoundingClientRect():ce(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}(w,y,c))&&(w=void 0))}if(!w||!t.docView.dom.contains(w)){let e=Ze.find(t.docView,d);if(!e)return f>o.top+o.height/2?o.to:o.from;({node:w,offset:y}=on(e.dom,c,u))}let v=t.docView.nearest(w);if(!v)return null;if(v.isWidget&&1==(null===(r=v.dom)||void 0===r?void 0:r.nodeType)){let t=v.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){let e=t.viewState.heightOracle.textHeight;r+=Math.floor((s-i.top-.5*(t.defaultLineHeight-e))/e)*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(i.from,i.to);return i.from+function(t,e,i,n){for(let n=0,s=0;;){if(s>=e)return n;if(n==t.length)break;s+=9==t.charCodeAt(n)?i-s%i:1,n=d(t,n)}return t.length}(o,r,t.state.tabSize)}function cn(t,e,i,n){let s=t.state.doc.lineAt(e.head),r=t.bidiSpans(s),o=t.textDirectionAt(s.from);for(let l=e,a=null;;){let e=Ui(s,r,o,l,i),h=Gi;if(!e){if(s.number==(i?t.state.doc.lines:1))return l;h="\n",s=t.state.doc.line(s.number+(i?1:-1)),r=t.bidiSpans(s),e=B.cursor(i?s.from:s.to)}if(a){if(!a(h))return l}else{if(!n)return e;a=n(h)}l=e}}function un(t,e,i){for(;;){let n=0;for(let s of t)s.between(e-1,e+1,((t,s,r)=>{if(e>t&&ee(t))),i.from,e.head>i.from?-1:1);return n==i.from?i:B.cursor(n,n{this.ignoreDuringComposition(i)||"keydown"==i.type&&this.keydown(t,i)||(this.mustFlushObserver(i)&&t.observer.forceFlush(),this.runCustomHandlers(i.type,t,i)?i.preventDefault():e(t,i))};for(let i in kn){let n=kn[i];t.contentDOM.addEventListener(i,(i=>{vn(t,i)&&e(n,i)}),bn[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",(i=>{if(i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&(e(kn.mousedown,i),!i.defaultPrevented&&2==i.button)){let e=t.contentDOM.style.minHeight;t.contentDOM.style.minHeight="100%",setTimeout((()=>t.contentDOM.style.minHeight=e),200)}})),t.scrollDOM.addEventListener("drop",(i=>{i.target==t.scrollDOM&&i.clientY>t.contentDOM.getBoundingClientRect().bottom&&e(kn.drop,i)})),Be.chrome&&102==Be.chrome_version&&t.scrollDOM.addEventListener("wheel",(()=>{this.chromeScrollHack<0?t.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout((()=>{this.chromeScrollHack=-1,t.contentDOM.style.pointerEvents=""}),100)}),{passive:!0}),this.notifiedFocused=t.hasFocus,Be.safari&&t.contentDOM.addEventListener("input",(()=>null)),Be.gecko&&function(t){Wn.has(t)||(Wn.add(t),t.addEventListener("copy",(()=>{})),t.addEventListener("cut",(()=>{})))}(t.contentDOM.ownerDocument)}ensureHandlers(t,e){var i;let n;this.customHandlers=[];for(let s of e)if(n=null===(i=s.update(t).spec)||void 0===i?void 0:i.domEventHandlers){this.customHandlers.push({plugin:s.value,handlers:n});for(let e in n)this.registeredEvents.indexOf(e)<0&&"scroll"!=e&&(this.registeredEvents.push(e),t.contentDOM.addEventListener(e,(i=>{vn(t,i)&&this.runCustomHandlers(e,t,i)&&i.preventDefault()})))}}runCustomHandlers(t,e,i){for(let n of this.customHandlers){let s=n.handlers[t];if(s)try{if(s.call(n.plugin,i,e)||i.defaultPrevented)return!0}catch(t){gi(e.state,t)}}return!1}runScrollHandlers(t,e){this.lastScrollTop=t.scrollDOM.scrollTop,this.lastScrollLeft=t.scrollDOM.scrollLeft;for(let i of this.customHandlers){let n=i.handlers.scroll;if(n)try{n.call(i.plugin,e,t)}catch(e){gi(t.state,e)}}}keydown(t,e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&Date.now()t.keyCode==e.keyCode)))&&!e.ctrlKey||gn.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)||(this.pendingIOSKey=i||e,setTimeout((()=>this.flushIOSKey(t)),250),0))}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,ue(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(Be.safari&&!Be.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}mustFlushObserver(t){return"keydown"==t.type&&229!=t.keyCode}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}const pn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],gn="dthko",mn=[16,17,18,20,91,92,224,225];function wn(t){return.7*Math.max(0,t)+8}class yn{constructor(t,e,i,n){this.view=t,this.startEvent=e,this.style=i,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=function(t){let e=t.ownerDocument;for(let i=t.parentNode;i&&i!=e.body;)if(1==i.nodeType){if(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.assignedSlot||i.parentNode}else{if(11!=i.nodeType)break;i=i.host}return null}(t.contentDOM),this.atoms=t.state.facet(Ai).map((e=>e(t)));let s=t.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(vt.allowMultipleSelections)&&function(t,e){let i=t.state.facet(si);return i.length?i[0](e):Be.mac?e.metaKey:e.ctrlKey}(t,e),this.dragging=!(!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let n=Yt(t.root);if(!n||0==n.rangeCount)return!0;let s=n.getRangeAt(0).getClientRects();for(let t=0;t=e.clientX&&i.top<=e.clientY&&i.bottom>=e.clientY)return!0}return!1}(t,e)||1!=Pn(e))&&null}start(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}move(t){var e,i,n;if(0==t.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(i=this.startEvent,n=t,Math.max(Math.abs(i.clientX-n.clientX),Math.abs(i.clientY-n.clientY))<10))return;this.select(this.lastEvent=t);let s=0,r=0,o=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},l=Oi(this.view);t.clientX-l.left<=o.left+6?s=-wn(o.left-t.clientX):t.clientX+l.right>=o.right-6&&(s=wn(t.clientX-o.right)),t.clientY-l.top<=o.top+6?r=-wn(o.top-t.clientY):t.clientY+l.bottom>=o.bottom-6&&(r=wn(t.clientY-o.bottom)),this.setScrollSpeed(s,r)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?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),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let i=0;ithis.select(this.lastEvent)),20)}}function vn(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i,n=e.target;n!=t.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(i=me.get(n))&&i.ignoreEvent(e))return!1;return!0}const kn=Object.create(null),bn=Object.create(null),xn=Be.ie&&Be.ie_version<15||Be.ios&&Be.webkit_version<604;function Sn(t,e){let i,{state:n}=t,s=1,r=n.toText(e),o=r.lines==n.selection.ranges.length;if(null!=Rn&&n.selection.ranges.every((t=>t.empty))&&Rn==r.toString()){let t=-1;i=n.changeByRange((i=>{let l=n.doc.lineAt(i.from);if(l.from==t)return{range:i};t=l.from;let a=n.toText((o?r.line(s++).text:e)+n.lineBreak);return{changes:{from:l.from,insert:a},range:B.cursor(i.from+a.length)}}))}else i=o?n.changeByRange((t=>{let e=r.line(s++);return{changes:{from:t.from,to:t.to,insert:e.text},range:B.cursor(t.from+e.length)}})):n.replaceSelection(r);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function An(t,e,i,n){if(1==n)return B.cursor(e,i);if(2==n)return function(t,e,i=1){let n=t.charCategorizer(e),s=t.doc.lineAt(e),r=e-s.from;if(0==s.length)return B.cursor(e);0==r?i=1:r==s.length&&(i=-1);let o=r,l=r;i<0?o=d(s.text,r,!1):l=d(s.text,r);let a=n(s.text.slice(o,l));for(;o>0;){let t=d(s.text,o,!1);if(n(s.text.slice(t,o))!=a)break;o=t}for(;l{t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},kn.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},kn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},bn.touchstart=bn.touchmove={passive:!0},kn.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let i=null;for(let n of t.state.facet(oi))if(i=n(t,e),i)break;if(i||0!=e.button||(i=function(t,e){let i=On(t,e),n=Pn(e),s=t.state.selection;return{update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),s=s.map(t.changes))},get(e,r,o){let l,a=On(t,e),h=An(t,a.pos,a.bias,n);if(i.pos!=a.pos&&!r){let e=An(t,i.pos,i.bias,n),s=Math.min(e.from,h.from),r=Math.max(e.to,h.to);h=s1&&(l=function(t,e){for(let i=0;i=e)return B.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}(s,a.pos))?l:o?s.addRange(h):B.create([h])}}}(t,e)),i){let n=!t.hasFocus;t.inputState.startMouseSelection(new yn(t,e,i,n)),n&&t.observer.ignore((()=>he(t.contentDOM))),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};let Mn=(t,e)=>t>=e.top&&t<=e.bottom,Tn=(t,e,i)=>Mn(e,i)&&t>=i.left&&t<=i.right;function Cn(t,e,i,n){let s=Ze.find(t.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(0==r)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&Tn(i,n,o))return-1;let l=s.coordsAt(r,1);return l&&Tn(i,n,l)?1:o&&Mn(n,o)?-1:1}function On(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:Cn(t,i,e.clientX,e.clientY)}}const Dn=Be.ie&&Be.ie_version<=11;let En=null,Ln=0,Bn=0;function Pn(t){if(!Dn)return t.detail;let e=En,i=Bn;return En=t,Bn=Date.now(),Ln=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Ln+1)%3:1}function Nn(t,e,i,n){if(!i)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:r}=t.inputState,o=n&&r&&r.dragging&&function(t,e){let i=t.state.facet(ri);return i.length?i[0](e):Be.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:r.dragging.from,to:r.dragging.to}:null,l={from:s,insert:i},a=t.state.changes(o?[o,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"})}kn.dragstart=(t,e)=>{let{selection:{main:i}}=t.state,{mouseSelection:n}=t.inputState;n&&(n.dragging=i),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove")},kn.drop=(t,e)=>{if(!e.dataTransfer)return;if(t.state.readOnly)return e.preventDefault();let i=e.dataTransfer.files;if(i&&i.length){e.preventDefault();let n=Array(i.length),s=0,r=()=>{++s==i.length&&Nn(t,e,n.filter((t=>null!=t)).join(t.state.lineBreak),!1)};for(let t=0;t{/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(n[t]=e.result),r()},e.readAsText(i[t])}}else Nn(t,e,e.dataTransfer.getData("Text"),!0)},kn.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=xn?null:e.clipboardData;i?(Sn(t,i.getData("text/plain")||i.getData("text/uri-text")),e.preventDefault()):function(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout((()=>{t.focus(),i.remove(),Sn(t,i.value)}),50)}(t)};let Rn=null;kn.copy=kn.cut=(t,e)=>{let{text:i,ranges:n,linewise:s}=function(t){let e=[],i=[],n=!1;for(let n of t.selection.ranges)n.empty||(e.push(t.sliceDoc(n.from,n.to)),i.push(n));if(!e.length){let s=-1;for(let{from:n}of t.selection.ranges){let r=t.doc.lineAt(n);r.number>s&&(e.push(r.text),i.push({from:r.from,to:Math.min(t.doc.length,r.to+1)})),s=r.number}n=!0}return{text:e.join(t.lineBreak),ranges:i,linewise:n}}(t.state);if(!i&&!s)return;Rn=s?i:null;let r=xn?null:e.clipboardData;r?(e.preventDefault(),r.clearData(),r.setData("text/plain",i)):function(t,e){let i=t.dom.parentNode;if(!i)return;let n=i.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(),t.focus()}),50)}(t,i),"cut"!=e.type||t.state.readOnly||t.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"})};const In=rt.define();function Hn(t,e){let i=[];for(let n of t.facet(ci)){let s=n(t,e);s&&i.push(s)}return i?t.update({effects:i,annotations:In.of(!0)}):null}function zn(t){setTimeout((()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let i=Hn(t.state,e);i?t.dispatch(i):t.update([])}}),10)}kn.focus=t=>{t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),zn(t)},kn.blur=t=>{t.observer.clearSelectionRange(),zn(t)},kn.compositionstart=kn.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},kn.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Be.chrome&&Be.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((()=>t.observer.flush())):setTimeout((()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])}),50)},kn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},kn.beforeinput=(t,e)=>{var i;let n;if(Be.chrome&&Be.android&&(n=pn.find((t=>t.inputType==e.inputType)))&&(t.observer.delayAndroidKey(n.key,n.keyCode),"Backspace"==n.key||"Delete"==n.key)){let e=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout((()=>{var i;((null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0)>e+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)}};const Wn=new Set,Vn=["pre-wrap","normal","pre-line","break-spaces"];class Fn{constructor(e){this.lineWrapping=e,this.doc=t.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return Vn.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,l=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=e,this.charWidth=i,this.textHeight=n,this.lineLength=s,l){this.heightSamples={};for(let t=0;t0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>$n&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return Kn.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,n){let s=this,r=i.doc;for(let o=n.length-1;o>=0;o--){let{fromA:l,toA:a,fromB:h,toB:c}=n[o],u=s.lineAt(l,jn.ByPosNoHeight,i.setDoc(e),0,0),f=u.to>=a?u:s.lineAt(a,jn.ByPosNoHeight,i,0,0);for(c+=f.to-a,a=f.to;o>0&&u.from<=n[o-1].toA;)l=n[o-1].fromA,h=n[o-1].fromB,o--,l2*s){let s=t[e-1];s.break?t.splice(--e,1,s.left,null,s.right):t.splice(--e,1,s.left,s.right),i+=1+s.break,n-=s.size}else{if(!(s>2*n))break;{let e=t[i];e.break?t.splice(i,1,e.left,null,e.right):t.splice(i,1,e.left,e.right),i+=2+e.break,s-=e.size}}else if(n=s&&r(this.blockAt(0,i,n,s))}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Un extends Gn{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,i,n){return new qn(n,this.length,i,this.height,this.breaks)}replace(t,e,i){let n=i[0];return 1==i.length&&(n instanceof Un||n instanceof Jn&&4&n.flags)&&Math.abs(this.length-n.length)<10?(n instanceof Jn?n=new Un(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Kn.of(i)}updateHeight(t,e=0,i=!1,n){return n&&n.from<=e&&n.more?this.setHeight(t,n.heights[n.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Jn extends Kn{constructor(t){super(t,0)}heightMetrics(t,e){let i,n=t.doc.lineAt(e).number,s=t.doc.lineAt(e+this.length).number,r=s-n+1,o=0;if(t.lineWrapping){let e=Math.min(this.height,t.lineHeight*r);i=e/r,this.length>r+1&&(o=(this.height-e)/(this.length-r-1))}else i=this.height/r;return{firstLine:n,lastLine:s,perLine:i,perChar:o}}blockAt(t,e,i,n){let{firstLine:s,lastLine:r,perLine:o,perChar:l}=this.heightMetrics(e,n);if(e.lineWrapping){let s=n+Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length),r=e.doc.lineAt(s),a=o+r.length*l,h=Math.max(i,t-a/2);return new qn(r.from,r.length,h,a,0)}{let n=Math.max(0,Math.min(r-s,Math.floor((t-i)/o))),{from:l,length:a}=e.doc.line(s+n);return new qn(l,a,i+o*n,o,0)}}lineAt(t,e,i,n,s){if(e==jn.ByHeight)return this.blockAt(t,i,n,s);if(e==jn.ByPosNoHeight){let{from:e,to:n}=i.doc.lineAt(t);return new qn(e,n-e,0,0,0)}let{firstLine:r,perLine:o,perChar:l}=this.heightMetrics(i,s),a=i.doc.lineAt(t),h=o+a.length*l,c=a.number-r,u=n+o*c+l*(a.from-s-c);return new qn(a.from,a.length,Math.max(n,Math.min(u,n+this.height-h)),h,0)}forEachLine(t,e,i,n,s,r){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(i,s);for(let h=t,c=n;h<=e;){let e=i.doc.lineAt(h);if(h==t){let i=e.number-o;c+=l*i+a*(t-s-i)}let n=l+a*e.length;r(new qn(e.from,e.length,c,n,0)),c+=n,h=e.to+1}}replace(t,e,i){let n=this.length-e;if(n>0){let t=i[i.length-1];t instanceof Jn?i[i.length-1]=new Jn(t.length+n):i.push(null,new Jn(n-1))}if(t>0){let e=i[0];e instanceof Jn?i[0]=new Jn(t+e.length):i.unshift(new Jn(t-1),null)}return Kn.of(i)}decomposeLeft(t,e){e.push(new Jn(t-1),null)}decomposeRight(t,e){e.push(null,new Jn(this.length-t-1))}updateHeight(t,e=0,i=!1,n){let s=e+this.length;if(n&&n.from<=e+this.length&&n.more){let i=[],r=Math.max(e,n.from),o=-1;for(n.from>e&&i.push(new Jn(n.from-e-1).updateHeight(t,e));r<=s&&n.more;){let e=t.doc.lineAt(r).length;i.length&&i.push(null);let s=n.heights[n.index++];-1==o?o=s:Math.abs(s-o)>=$n&&(o=-2);let l=new Un(e,s);l.outdated=!1,i.push(l),r+=e+1}r<=s&&i.push(null,new Jn(s-r).updateHeight(t,r));let l=Kn.of(i);return(o<0||Math.abs(l.height-this.height)>=$n||Math.abs(o-this.heightMetrics(t,e).perLine)>=$n)&&(t.heightChanged=!0),l}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Yn extends Kn{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return 1&this.flags}blockAt(t,e,i,n){let s=i+this.left.height;return to))return a;let h=e==jn.ByPosNoHeight?jn.ByPosNoHeight:jn.ByPos;return l?a.join(this.right.lineAt(o,h,i,r,o)):this.left.lineAt(o,h,i,n,s).join(a)}forEachLine(t,e,i,n,s,r){let o=n+this.left.height,l=s+this.left.length+this.break;if(this.break)t=l&&this.right.forEachLine(t,e,i,o,l,r);else{let a=this.lineAt(l,jn.ByPos,i,n,s);t=t&&a.from<=e&&r(a),e>a.to&&this.right.forEachLine(a.to+1,e,i,o,l,r)}}replace(t,e,i){let n=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,i));let s=[];t>0&&this.decomposeLeft(t,s);let r=s.length;for(let t of i)s.push(t);if(t>0&&Xn(s,r-1),e=i&&e.push(null)),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,n=i+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t2*e.size||e.size>2*t.size?Kn.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,i=!1,n){let{left:s,right:r}=this,o=e+s.length+this.break,l=null;return n&&n.from<=e+s.length&&n.more?l=s=s.updateHeight(t,e,i,n):s.updateHeight(t,e,i),n&&n.from<=o+r.length&&n.more?l=r=r.updateHeight(t,o,i,n):r.updateHeight(t,o,i),l?this.balanced(s,r):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Xn(t,e){let i,n;null==t[e]&&(i=t[e-1])instanceof Jn&&(n=t[e+1])instanceof Jn&&t.splice(e-1,3,new Jn(i.length+1+n.length))}class Qn{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let t=Math.min(e,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Un?i.length+=t-this.pos:(t>this.pos||!this.isCovered)&&this.nodes.push(new Un(t-this.pos,-1)),this.writtenTo=t,e>t&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t=5)&&this.addLineDeco(n,s,r)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new Un(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new Jn(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Un)return t;let e=new Un(0,-1);return this.nodes.push(e),e}addBlock(t){var e;this.enterLine();let i=null===(e=t.deco)||void 0===e?void 0:e.type;i!=Ke.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,i!=Ke.WidgetBefore&&(this.covering=t)}addLineDeco(t,e,i){let n=this.ensureLine();n.length+=i,n.collapsed+=i,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+i}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof Un||this.isCovered?(this.writtenToi.clientHeight||i.scrollWidth>i.clientWidth)&&"visible"!=n.overflow){let n=i.getBoundingClientRect();r=Math.max(r,n.left),o=Math.min(o,n.right),l=Math.max(l,n.top),a=e==t.parentNode?n.bottom:Math.min(a,n.bottom)}e="absolute"==n.position||"fixed"==n.position?i.offsetParent:i.parentNode}else{if(11!=e.nodeType)break;e=e.host}return{left:r-i.left,right:Math.max(r,o)-i.left,top:l-(i.top+e),bottom:Math.max(l,a)-(i.top+e)}}function es(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class is{constructor(t,e,i){this.from=t,this.to=e,this.size=i}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i"function"!=typeof t&&"cm-lineWrapping"==t.class));this.heightOracle=new Fn(i),this.stateDeco=e.facet(Si).filter((t=>"function"!=typeof t)),this.heightMap=Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle.setDoc(e.doc),[new Ei(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ge.set(this.lineGaps.map((t=>t.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let n=i?e.head:e.anchor;if(!t.some((({from:t,to:e})=>n>=t&&n<=e))){let{from:e,to:i}=this.lineBlockAt(n);t.push(new rs(e,i))}}this.viewports=t.sort(((t,e)=>t.from-e.from)),this.scaler=this.heightMap.height<=7e6?hs:new cs(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,(t=>{this.viewportLines.push(1==this.scaler.scale?t:us(t,this.scaler))}))}update(t,e=null){this.state=t.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Si).filter((t=>"function"!=typeof t));let n=t.changedRanges,s=Ei.extendWithRanges(n,function(t,e,i){let n=new Zn;return Mt.compare(t,e,i,n,0),n.changes}(i,this.stateDeco,t?t.changes:A.empty(this.state.doc.length))),r=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=r&&(t.flags|=2),o?(this.scrollAnchorPos=t.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,e));let a=!t.changes.empty||2&t.flags||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),a&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(fi)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let i=e.contentDOM,n=window.getComputedStyle(i),s=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Bi.RTL:Bi.LTR;let o=this.heightOracle.mustRefreshForWrapping(r),l=i.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let t=l.width/i.offsetWidth,e=l.height/i.offsetHeight;t>.995&&t<1.005&&(t=1),e>.995&&e<1.005&&(e=1),this.scaleX==t&&this.scaleY==e||(this.scaleX=t,this.scaleY=e,h|=8,o=a=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,f=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==u&&this.paddingBottom==f||(this.paddingTop=u,this.paddingBottom=f,h|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=de(e.scrollDOM);let p=(this.printing?es:ts)(i,this.paddingTop),g=p.top-this.pixelViewport.top,m=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let y=l.width;if(this.contentDOMWidth==y&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=8),a){let i=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(i)&&(o=!0),o||s.lineWrapping&&Math.abs(y-this.contentDOMWidth)>s.charWidth){let{lineHeight:t,charWidth:n,textHeight:l}=e.docView.measureTextSize();o=t>0&&s.refresh(r,t,n,l,y/n,i),o&&(e.docView.minWidth=0,h|=8)}g>0&&m>0?c=Math.max(g,m):g<0&&m<0&&(c=Math.min(g,m)),s.heightChanged=!1;for(let n of this.viewports){let r=n.from==this.viewport.from?i:e.docView.measureVisibleLineHeights(n);this.heightMap=(o?Kn.empty().applyChanges(this.stateDeco,t.empty,this.heightOracle,[new Ei(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new _n(n.from,r))}s.heightChanged&&(h|=2)}let v=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return v&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&h||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:r,visibleBottom:o}=this,l=new rs(n.lineAt(r-1e3*i,jn.ByHeight,s,0,0).from,n.lineAt(o+1e3*(1-i),jn.ByHeight,s,0,0).to);if(e){let{head:t}=e.range;if(tl.to){let i,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=n.lineAt(t,jn.ByPos,s,0,0);i="center"==e.y?(o.top+o.bottom)/2-r/2:"start"==e.y||"nearest"==e.y&&t=o+Math.max(10,Math.min(i,250)))&&n>r-2e3&&s>1,r=n<<1;if(this.defaultTextDirection!=Bi.LTR&&!i)return[];let o=[],l=(n,r,a,h)=>{if(r-nn&&tt.from>=a.from&&t.to<=a.to&&Math.abs(t.from-n)t.frome))));if(!f){if(rt.from<=r&&t.to>=r))){let t=e.moveToLineBoundary(B.cursor(r),!1,!0).head;t>n&&(r=t)}f=new is(n,r,this.gapSize(a,n,r,h))}o.push(f)};for(let t of this.viewportLines){if(t.lengtht.from&&l(t.from,s,t,e),ot.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];Mt.spans(t,this.viewport.from,this.viewport.to,{span(t,i){e.push({from:t,to:i})},point(){}},20);let i=e.length!=this.visibleRanges.length||this.visibleRanges.some(((t,i)=>t.from!=e[i].from||t.to!=e[i].to));return this.visibleRanges=e,i?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find((e=>e.from<=t&&e.to>=t))||us(this.heightMap.lineAt(t,jn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return us(this.heightMap.lineAt(this.scaler.fromDOM(t),jn.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return us(this.heightMap.blockAt(this.scaler.fromDOM(t),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 rs{constructor(t,e){this.from=t,this.to=e}}function os(t,e,i){let n=[],s=t,r=0;return Mt.spans(i,t,e,{span(){},point(t,e){t>s&&(n.push({from:s,to:t}),r+=t-s),s=e}},20),s=1)return e[e.length-1].to;let n=Math.floor(t*i);for(let t=0;;t++){let{from:i,to:s}=e[t],r=s-i;if(n<=r)return i+n;n-=r}}function as(t,e){let i=0;for(let{from:n,to:s}of t.ranges){if(e<=s){i+=e-n;break}i+=s-n}return i/t.total}const hs={toDOM:t=>t,fromDOM:t=>t,scale:1};class cs{constructor(t,e,i){let n=0,s=0,r=0;this.viewports=i.map((({from:i,to:s})=>{let r=e.lineAt(i,jn.ByPos,t,0,0).top,o=e.lineAt(s,jn.ByPos,t,0,0).bottom;return n+=o-r,{from:i,to:s,top:r,bottom:o,domTop:0,domBottom:0}})),this.scale=(7e6-n)/(e.height-n);for(let t of this.viewports)t.domTop=r+(t.top-s)*this.scale,r=t.domBottom=t.domTop+(t.bottom-t.top),s=t.bottom}toDOM(t){for(let e=0,i=0,n=0;;e++){let s=eus(t,e))):t._content)}const fs=R.define({combine:t=>t.join(" ")}),ds=R.define({combine:t=>t.indexOf(!0)>-1}),ps=Ft.newName(),gs=Ft.newName(),ms=Ft.newName(),ws={"&light":"."+gs,"&dark":"."+ms};function ys(t,e,i){return new Ft(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,(e=>{if("&"==e)return t;if(!i||!i[e])throw new RangeError(`Unsupported selector: ${e}`);return i[e]})):t+" "+e})}const vs=ys("."+ps,{"&":{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,\')',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"}},ws),ks="￿";class bs{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(vt.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=ks}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let n=t;;){this.findPointBefore(i,n);let t=this.text.length;this.readNode(n);let s=n.nextSibling;if(s==e)break;let r=me.get(n),o=me.get(s);(r&&o?r.breakAfter:(r?r.breakAfter:xs(n))||xs(s)&&("BR"!=n.nodeName||n.cmIgnore)&&this.text.length>t)&&this.lineBreak(),n=s}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let i=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let s,r=-1,o=1;if(this.lineSeparator?(r=e.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(s=n.exec(e))&&(r=s.index,o=s[0].length),this.append(e.slice(i,r<0?e.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let e of this.points)e.node==t&&e.pos>this.text.length&&(e.pos-=o-1);i=r+o}}readNode(t){if(t.cmIgnore)return;let e=me.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(let t=i.iter();!t.next().done;)t.lineBreak?this.lineBreak():this.append(t.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(3==t.nodeType?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+Math.min(e,i.offset))}}function xs(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class Ss{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class As{constructor(t,e,i,n){this.typeOver=n,this.bounds=null,this.text="";let{impreciseHead:s,impreciseAnchor:r}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){let e=s||r?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:s,focusOffset:r}=t.observer.selectionRange;return i&&(e.push(new Ss(i,n)),s==i&&r==n||e.push(new Ss(s,r))),e}(t),i=new bs(e,t.state);i.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=i.text,this.newSel=function(t,e){if(0==t.length)return null;let i=t[0].pos,n=2==t.length?t[1].pos:i;return i>-1&&n>-1?B.single(i+e,n+e):null}(e,this.bounds.from)}else{let e=t.observer.selectionRange,i=s&&s.node==e.focusNode&&s.offset==e.focusOffset||!Xt(t.contentDOM,e.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(e.focusNode,e.focusOffset),n=r&&r.node==e.anchorNode&&r.offset==e.anchorOffset||!Xt(t.contentDOM,e.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(e.anchorNode,e.anchorOffset);this.newSel=B.single(n,i)}}}function Ms(e,i){let n,{newSel:s}=i,r=e.state.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(i.bounds){let{from:s,to:l}=i.bounds,a=r.from,h=null;(8===o||Be.android&&i.text.length0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;return"end"==n&&(i-=o+Math.max(0,r-Math.min(o,l))-r),o=o?r-i:0,l=r+(l-o),o=r):l=l?r-i:0,o=r+(o-l),l=r),{from:r,toA:o,toB:l}}(e.state.doc.sliceString(s,l,ks),i.text,a-s,h);c&&(Be.chrome&&13==o&&c.toB==c.from+2&&i.text.slice(c.from,c.toB)==ks+ks&&c.toB--,n={from:s+c.from,to:s+c.toA,insert:t.of(i.text.slice(c.from,c.toB).split(ks))})}else s&&(!e.hasFocus&&e.state.facet(mi)||s.main.eq(r))&&(s=null);if(!n&&!s)return!1;if(!n&&i.typeOver&&!r.empty&&s&&s.main.empty?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,r.to)}:n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,r.to))}:(Be.mac||Be.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(s&&2==n.insert.length&&(s=B.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}):Be.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(s&&(s=B.single(s.main.anchor-1,s.main.head-1)),n={from:r.from,to:r.to,insert:t.of([" "])}),n){if(Be.ios&&e.inputState.flushIOSKey(e))return!0;if(Be.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&ue(e.contentDOM,"Enter",13)||(n.from==r.from-1&&n.to==r.to&&0==n.insert.length||8==o&&n.insert.lengthr.head)&&ue(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&ue(e.contentDOM,"Delete",46)))return!0;let t,i=n.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let l=()=>t||(t=function(t,e,i){let n,s=t.state,r=s.selection.main;if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let i=r.frome.to?s.sliceDoc(e.to,r.to):"";n=s.replaceSelection(t.state.toText(i+e.insert.sliceString(0,void 0,t.state.lineBreak)+o))}else{let o=s.changes(e),l=i&&i.main.to<=o.newLength?i.main:void 0;if(s.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=r.to&&e.to>=r.to-10){let a,h=t.state.sliceDoc(e.from,e.to),c=i&&Xi(t,i.main.head);if(c){let t=e.insert.length-(e.to-e.from);a={from:c.from,to:c.to-t}}else a=t.state.doc.lineAt(r.head);let u=r.to-e.to,f=r.to-r.from;n=s.changeByRange((i=>{if(i.from==r.from&&i.to==r.to)return{changes:o,range:l||i.map(o)};let n=i.to-u,c=n-h.length;if(i.to-i.from!=f||t.state.sliceDoc(c,n)!=h||i.to>=a.from&&i.from<=a.to)return{range:i};let d=s.changes({from:c,to:n,insert:e.insert}),p=i.to-r.to;return{changes:d,range:l?B.range(Math.max(0,l.anchor+p),Math.max(0,l.head+p)):i.map(d)}}))}else n={changes:o,selection:l&&s.selection.replaceRange(l)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),s.update(n,{userEvent:o,scrollIntoView:!0})}(e,n,s));return e.state.facet(hi).some((t=>t(e,n.from,n.to,i,l)))||e.dispatch(l()),!0}if(s&&!s.main.eq(r)){let t=!1,i="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),i=e.inputState.lastSelectionOrigin),e.dispatch({selection:s,scrollIntoView:t,userEvent:i}),!0}return!1}const Ts={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Cs=Be.ie&&Be.ie_version<=11;class Os{constructor(t){this.view=t,this.active=!1,this.selectionRange=new oe,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=t.contentDOM,this.observer=new MutationObserver((e=>{for(let t of e)this.queue.push(t);(Be.ie&&Be.ie_version<=11||Be.ios&&t.composing)&&e.some((t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():this.flush()})),Cs&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate)this.view.requestMeasure())),this.resizeContent.observe(t.contentDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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((t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runScrollHandlers(this.view,t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}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(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some(((e,i)=>e!=t[i])))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,n=this.selectionRange;if(i.state.facet(mi)?i.root.activeElement!=this.dom:!Qt(i.dom,n))return;let s=n.anchorNode&&i.docView.nearest(n.anchorNode);s&&s.ignoreEvent(t)?e||(this.selectionChanged=!1):(Be.ie&&Be.ie_version<=11||Be.android&&Be.chrome)&&!i.state.selection.main.empty&&n.focusNode&&te(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Be.safari&&11==t.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t){let e=null;function i(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",i,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),!e)return null;let n=e.startContainer,s=e.startOffset,r=e.endContainer,o=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return te(l.node,l.offset,r,o)&&([n,s,r,o]=[r,o,n,s]),{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:o}}(this.view)||Yt(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=Qt(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=t.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&t.force&&ue(this.dom,t.key,t.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(t)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,i=-1,n=!1;for(let s of t){let t=this.readMutation(s);t&&(t.typeOver&&(n=!0),-1==e?({from:e,to:i}=t):(e=Math.min(t.from,e),i=Math.max(t.to,i)))}return{from:e,to:i,typeOver:n}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),n=this.selectionChanged&&Qt(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new As(this.view,t,e,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return!1;let i=this.view.state,n=Ms(this.view,e);return this.view.state==i&&this.view.update([]),n}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.flags|=4),"childList"==t.type){let i=Ds(e,t.previousSibling||t.target.previousSibling,-1),n=Ds(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var t,e,i,n;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect(),null===(n=this.resizeContent)||void 0===n||n.disconnect();for(let t of this.scrollTargets)t.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 Ds(t,e,i){for(;e;){let n=me.get(e);if(n&&n.parent==t)return n;let s=e.parentNode;e=s!=t.dom?s:i>0?e.nextSibling:e.previousSibling}return null}class Es{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}constructor(t={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM);let{dispatch:e}=t;this.dispatchTransactions=t.dispatchTransactions||e&&(t=>t.forEach((t=>e(t,this))))||(t=>this.update(t)),this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(t.parent)||document,this.viewState=new ss(t.state||vt.create(t)),this.plugins=this.state.facet(yi).map((t=>new ki(t)));for(let t of this.plugins)t.update(this);this.observer=new Os(this),this.inputState=new dn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new Ji(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}dispatch(...t){let e=1==t.length&&t[0]instanceof ht?t:1==t.length&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let e,i=!1,n=!1,s=this.state;for(let e of t){if(e.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=e.state}if(this.destroyed)return void(this.viewState.state=s);let r=this.hasFocus,o=0,l=null;t.some((t=>t.annotation(In)))?(this.inputState.notifiedFocused=r,o=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,l=Hn(s,r),l||(o=1));let a=this.observer.delayedAndroidKey,h=null;if(a?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(h=null)):this.observer.clear(),s.facet(vt.phrases)!=this.state.facet(vt.phrases))return this.setState(s);e=Li.create(this,s,t),e.flags|=o;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let e of t){if(c&&(c=c.map(e.changes)),e.scrollIntoView){let{main:t}=e.state.selection;c=new di(t.empty?t:B.cursor(t.head,t.head>t.anchor?-1:1))}for(let t of e.effects)t.is(pi)&&(c=t.value)}this.viewState.update(e,c),this.bidiCache=Ps.update(this.bidiCache,e.changes),e.empty||(this.updatePlugins(e),this.inputState.update(e)),i=this.docView.update(e),this.state.facet(Di)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(i,t.some((t=>t.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(e.startState.facet(fs)!=e.state.facet(fs)&&(this.viewState.mustMeasureContent=!0),(i||n||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!e.empty)for(let t of this.state.facet(ai))t(e);(l||h)&&Promise.resolve().then((()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!Ms(this,h)&&a.force&&ue(this.contentDOM,a.key,a.keyCode)}))}setState(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=t);this.updateState=2;let e=this.hasFocus;try{for(let t of this.plugins)t.destroy(this);this.viewState=new ss(t),this.plugins=t.facet(yi).map((t=>new ki(t))),this.pluginMap.clear();for(let t of this.plugins)t.update(this);this.docView=new Ji(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(yi),i=t.state.facet(yi);if(e!=i){let n=[];for(let s of i){let i=e.indexOf(s);if(i<0)n.push(new ki(s));else{let e=this.plugins[i];e.mustUpdate=t,n.push(e)}}for(let e of this.plugins)e.mustUpdate!=t&&e.destroy(this);this.plugins=n,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let e of this.plugins)e.mustUpdate=t;for(let t=0;t-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,i=this.scrollDOM,n=i.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:r}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(r=-1),this.viewState.scrollAnchorHeight=-1;try{for(let t=0;;t++){if(r<0)if(de(i))s=-1,r=this.viewState.heightMap.height;else{let t=this.viewState.scrollAnchorAt(n);s=t.from,r=t.top}this.updateState=1;let o=this.viewState.measure(this);if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(t>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&o||([this.measureRequests,l]=[l,this.measureRequests]);let a=l.map((t=>{try{return t.read(this)}catch(t){return gi(this.state,t),Bs}})),h=Li.create(this,this.state,[]),c=!1;h.flags|=o,e?e.flags|=o:e=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),c=this.docView.update(h));for(let t=0;t1||t<-1){n+=t,i.scrollTop=n/this.scaleY,r=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let t of this.state.facet(ai))t(e)}get themeClasses(){return ps+" "+(this.state.facet(ds)?ms:gs)+" "+this.state.facet(fs)}updateAttrs(){let t=Ns(this,bi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(mi)?"true":"false",class:"cm-content",style:`${Be.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),Ns(this,xi,e);let i=this.observer.ignore((()=>{let i=qe(this.contentDOM,this.contentAttrs,e),n=qe(this.dom,this.editorAttrs,t);return i||n}));return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let t of i.effects)t.is(Es.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=t.value)}mountStyles(){this.styleModules=this.state.facet(Di);let t=this.state.facet(Es.cspNonce);Ft.mount(this.root,this.styleModules.concat(vs).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(let e=0;ee.spec==t))||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return fn(this,t,cn(this,t,e,i))}moveByGroup(t,e){return fn(this,t,cn(this,t,e,(e=>function(t,e,i){let n=t.state.charCategorizer(e),s=n(i);return t=>{let e=n(t);return s==mt.Space&&(s=e),s==e}}(this,t.head,e))))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,n){let s=function(t,e){let i=t.lineBlockAt(e);if(Array.isArray(i.type))for(let t of i.type)if(t.to>e||t.to==e&&(t.to==i.to||t.type==Ke.Text))return t;return i}(t,e.head),r=n&&s.type==Ke.Text&&(t.lineWrapping||s.widgetLineBreaks)?t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head):null;if(r){let e=t.dom.getBoundingClientRect(),n=t.textDirectionAt(s.from),o=t.posAtCoords({x:i==(n==Bi.LTR)?e.right-1:e.left+1,y:(r.top+r.bottom)/2});if(null!=o)return B.cursor(o,i?-1:1)}return B.cursor(i?s.to:s.from,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return fn(this,t,function(t,e,i,n){let s=e.head,r=i?1:-1;if(s==(i?t.state.doc.length:0))return B.cursor(s,e.assoc);let o,l=e.goalColumn,a=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s),c=t.documentTop;if(h)null==l&&(l=h.left-a.left),o=r<0?h.top:h.bottom;else{let e=t.viewState.lineBlockAt(s);null==l&&(l=Math.min(a.right-a.left,t.defaultCharacterWidth*(s-e.from))),o=(r<0?e.top:e.bottom)+c}let u=a.left+l,f=null!=n?n:t.viewState.heightOracle.textHeight>>1;for(let i=0;;i+=10){let n=o+(f+i)*r,h=an(t,{x:u,y:n},!1,r);if(na.bottom||(r<0?hs))return B.cursor(h,e.assoc,void 0,l)}}(this,t,e,i))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),an(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let n=this.state.doc.lineAt(t),s=this.bidiSpans(n);return se(i,s[Fi.find(s,t-n.from,-1,e)].dir==Bi.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(ui)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Ls)return Ki(t.length);let e,i=this.textDirectionAt(t.from);for(let n of this.bidiCache)if(n.from==t.from&&n.dir==i&&(n.fresh||_i(n.isolates,e=Ti(this,t.from,t.to))))return n.order;e||(e=Ti(this,t.from,t.to));let n=function(t,e,i){if(!t)return[new Fi(0,0,e==Ni?1:0)];if(e==Pi&&!i.length&&!Vi.test(t))return Ki(t.length);if(i.length)for(;t.length>qi.length;)qi[qi.length]=256;let n=[],s=e==Pi?0:1;return $i(t,s,s,i,0,t.length,n),n}(t.text,i,e);return this.bidiCache.push(new Ps(t.from,t.to,i,e,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Be.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{he(this.contentDOM),this.docView.updateSelection()}))}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.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(t,e={}){return pi.of(new di("number"==typeof t?B.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return vi.define((()=>({})),{eventHandlers:t})}static theme(t,e){let i=Ft.newName(),n=[fs.of(i),Di.of(ys(`.${i}`,t))];return e&&e.dark&&n.push(ds.of(!0)),n}static baseTheme(t){return j.lowest(Di.of(ys("."+ps,t,ws)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),n=i&&me.get(i)||me.get(t);return(null===(e=null==n?void 0:n.rootView)||void 0===e?void 0:e.view)||null}}Es.styleModule=Di,Es.inputHandler=hi,Es.focusChangeEffect=ci,Es.perLineTextDirection=ui,Es.exceptionSink=li,Es.updateListener=ai,Es.editable=mi,Es.mouseSelectionStyle=oi,Es.dragMovesSelection=ri,Es.clickAddsSelectionRange=si,Es.decorations=Si,Es.atomicRanges=Ai,Es.bidiIsolatedRanges=Mi,Es.scrollMargins=Ci,Es.darkTheme=ds,Es.cspNonce=R.define({combine:t=>t.length?t[0]:""}),Es.contentAttributes=xi,Es.editorAttributes=bi,Es.lineWrapping=Es.contentAttributes.of({class:"cm-lineWrapping"}),Es.announce=at.define();const Ls=4096,Bs={};class Ps{constructor(t,e,i,n,s,r){this.from=t,this.to=e,this.dir=i,this.isolates=n,this.fresh=s,this.order=r}static update(t,e){if(e.empty&&!t.some((t=>t.fresh)))return t;let i=[],n=t.length?t[t.length-1].dir:Bi.LTR;for(let s=Math.max(0,t.length-10);s=0;s--){let e=n[s],r="function"==typeof e?e(t):e;r&&Ve(r,i)}return i}const Rs=Be.mac?"mac":Be.windows?"win":Be.linux?"linux":"key";function Is(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t}const Hs=j.default(Es.domEventHandlers({keydown:(t,e)=>qs(Vs(e.state),t,e,"editor")})),zs=R.define({enables:Hs}),Ws=new WeakMap;function Vs(t){let e=t.facet(zs),i=Ws.get(e);return i||Ws.set(e,i=function(t,e=Rs){let i=Object.create(null),n=Object.create(null),s=(t,e)=>{let i=n[t];if(null==i)n[t]=e;else if(i!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},r=(t,n,r,o,l)=>{var a,h;let c=i[t]||(i[t]=Object.create(null)),u=n.split(/ (?!$)/).map((t=>function(t,e){const i=t.split(/-(?!$)/);let n,s,r,o,l=i[i.length-1];"Space"==l&&(l=" ");for(let t=0;t{let n=Fs={view:e,prefix:i,scope:t};return setTimeout((()=>{Fs==n&&(Fs=null)}),_s),!0}]})}let f=u.join(" ");s(f,!1);let d=c[f]||(c[f]={preventDefault:!1,stopPropagation:!1,run:(null===(h=null===(a=c._any)||void 0===a?void 0:a.run)||void 0===h?void 0:h.slice())||[]});r&&d.run.push(r),o&&(d.preventDefault=!0),l&&(d.stopPropagation=!0)};for(let n of t){let t=n.scope?n.scope.split(" "):["editor"];if(n.any)for(let e of t){let t=i[e]||(i[e]=Object.create(null));t._any||(t._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let e in t)t[e].run.push(n.any)}let s=n[e]||n.key;if(s)for(let e of t)r(e,s,n.run,n.preventDefault,n.stopPropagation),n.shift&&r(e,"Shift-"+s,n.shift,n.preventDefault,n.stopPropagation)}return i}(e.reduce(((t,e)=>t.concat(e)),[]))),i}let Fs=null;const _s=4e3;function qs(t,e,i,n){let s=function(t){var e=!(Kt&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Gt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?$t:jt)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(e),r=k(y(s,0))==s.length&&" "!=s,o="",l=!1,a=!1,h=!1;Fs&&Fs.view==i&&Fs.scope==n&&(o=Fs.prefix+" ",mn.indexOf(e.keyCode)<0&&(a=!0,Fs=null));let c,u,f=new Set,d=t=>{if(t){for(let n of t.run)if(!f.has(n)&&(f.add(n),n(i,e)))return t.stopPropagation&&(h=!0),!0;t.preventDefault&&(t.stopPropagation&&(h=!0),a=!0)}return!1},p=t[n];return p&&(d(p[o+Is(s,e,!r)])?l=!0:r&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Be.windows&&e.ctrlKey&&e.altKey)&&(c=jt[e.keyCode])&&c!=s?(d(p[o+Is(c,e,!0)])||e.shiftKey&&(u=$t[e.keyCode])!=s&&u!=c&&d(p[o+Is(u,e,!1)]))&&(l=!0):r&&e.shiftKey&&d(p[o+Is(s,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),a&&(l=!0),l&&h&&e.stopPropagation(),l}Be.ios;const js=R.define({combine(t){let e,i;for(let n of t)e=e||n.topContainer,i=i||n.bottomContainer;return{topContainer:e,bottomContainer:i}}});function $s(t,e){let i=t.plugin(Ks),n=i?i.specs.indexOf(e):-1;return n>-1?i.panels[n]:null}const Ks=vi.fromClass(class{constructor(t){this.input=t.state.facet(Js),this.specs=this.input.filter((t=>t)),this.panels=this.specs.map((e=>e(t)));let e=t.state.facet(js);this.top=new Gs(t,!0,e.topContainer),this.bottom=new Gs(t,!1,e.bottomContainer),this.top.sync(this.panels.filter((t=>t.top))),this.bottom.sync(this.panels.filter((t=>!t.top)));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(t){let e=t.state.facet(js);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Gs(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Gs(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(Js);if(i!=this.input){let e=i.filter((t=>t)),n=[],s=[],r=[],o=[];for(let i of e){let e,l=this.specs.indexOf(i);l<0?(e=i(t.view),o.push(e)):(e=this.panels[l],e.update&&e.update(t)),n.push(e),(e.top?s:r).push(e)}this.specs=e,this.panels=n,this.top.sync(s),this.bottom.sync(r);for(let t of o)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}else for(let e of this.panels)e.update&&e.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Es.scrollMargins.of((e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))});class Gs{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Us(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Us(t)}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 t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function Us(t){let e=t.nextSibling;return t.remove(),e}const Js=R.define({enables:Ks});class Ys extends bt{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Ys.prototype.elementClass="",Ys.prototype.toDOM=void 0,Ys.prototype.mapMode=x.TrackBefore,Ys.prototype.startSide=Ys.prototype.endSide=-1,Ys.prototype.point=!0;const Xs=R.define(),Qs=R.define(),Zs=R.define({combine:t=>t.some((t=>t))});function tr(t){let e=[er];return t&&!1===t.fixed&&e.push(Zs.of(!0)),e}const er=vi.fromClass(class{constructor(t){this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Qs).map((e=>new rr(t,e)));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!t.state.facet(Zs),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,n=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(n<.8*(i.to-i.from))}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Zs)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let i=Mt.iter(this.view.state.facet(Xs),this.view.viewport.from),n=[],s=this.gutters.map((t=>new sr(t,this.view.viewport,-this.view.documentPadding.top)));for(let t of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(t.type)){let e=!0;for(let r of t.type)if(r.type==Ke.Text&&e){nr(i,n,r.from);for(let t of s)t.line(this.view,r,n);e=!1}else if(r.widget)for(let t of s)t.widget(this.view,r)}else if(t.type==Ke.Text){nr(i,n,t.from);for(let e of s)e.line(this.view,t,n)}else if(t.widget)for(let e of s)e.widget(this.view,t);for(let t of s)t.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(Qs),i=t.state.facet(Qs),n=t.docChanged||t.heightChanged||t.viewportChanged||!Mt.eq(t.startState.facet(Xs),t.state.facet(Xs),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let e of this.gutters)e.update(t)&&(n=!0);else{n=!0;let s=[];for(let n of i){let i=e.indexOf(n);i<0?s.push(new rr(this.view,n)):(this.gutters[i].update(t),s.push(this.gutters[i]))}for(let t of this.gutters)t.dom.remove(),s.indexOf(t)<0&&t.destroy();for(let t of s)this.dom.appendChild(t.dom);this.gutters=s}return n}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>Es.scrollMargins.of((e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==Bi.LTR?{left:i.dom.offsetWidth*e.scaleX}:{right:i.dom.offsetWidth*e.scaleX}:null}))});function ir(t){return Array.isArray(t)?t:[t]}function nr(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class sr{constructor(t,e,i){this.gutter=t,this.height=i,this.i=0,this.cursor=Mt.iter(t.markers,e.from)}addElement(t,e,i){let{gutter:n}=this,s=e.top-this.height;if(this.i==n.elements.length){let r=new or(t,e.height,s,i);n.elements.push(r),n.dom.appendChild(r.dom)}else n.elements[this.i].update(t,e.height,s,i);this.height=e.bottom,this.i++}line(t,e,i){let n=[];nr(this.cursor,n,e.from),i.length&&(n=n.concat(i));let s=this.gutter.config.lineMarker(t,e,n);s&&n.unshift(s);let r=this.gutter;(0!=n.length||r.config.renderEmptyElements)&&this.addElement(t,e,n)}widget(t,e){let i=this.gutter.config.widgetMarker(t,e.widget,e);i&&this.addElement(t,e,[i])}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class rr{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in e.domEventHandlers)this.dom.addEventListener(i,(n=>{let s,r=n.target;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let t=r.getBoundingClientRect();s=(t.top+t.bottom)/2}else s=n.clientY;let o=t.lineBlockAtHeight(s-t.documentTop);e.domEventHandlers[i](t,o,n)&&n.preventDefault()}));this.markers=ir(e.markers(t)),e.initialSpacer&&(this.spacer=new or(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=ir(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let e=this.config.updateSpacer(this.spacer.markers[0],t);e!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[e])}let i=t.view.viewport;return!Mt.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}destroy(){for(let t of this.elements)t.destroy()}}class or{constructor(t,e,i,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,n)}update(t,e,i,n){this.height!=e&&(this.height=e,this.dom.style.height=e/t.scaleY+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i/t.scaleY+"px":""),function(t,e){if(t.length!=e.length)return!1;for(let i=0;ikt(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let t in e){let n=i[t],s=e[t];i[t]=n?(t,e,i)=>n(t,e,i)||s(t,e,i):s}return i}})});class hr extends Ys{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function cr(t,e){return t.state.facet(ar).formatNumber(e,t.state)}const ur=Qs.compute([ar],(t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(lr),lineMarker:(t,e,i)=>i.some((t=>t.toDOM))?null:new hr(cr(t,t.state.doc.lineAt(e.from).number)),widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(ar)!=t.state.facet(ar),initialSpacer:t=>new hr(cr(t,fr(t.state.doc.lines))),updateSpacer(t,e){let i=cr(e.view,fr(e.view.state.doc.lines));return i==t.number?t:new hr(i)},domEventHandlers:t.facet(ar).domEventHandlers})));function fr(t){let e=9;for(;e0&&void 0!==arguments[0]?arguments[0]:this.defaultExtensions;this.state=vt.create({doc:this.$textarea.textSelection("getContents"),extensions:e}),this.view=new Es({state:this.state,parent:this.$textarea.parent()[0]}),this.$textarea.hide(),this.$textarea[0].form&&this.$textarea[0].form.addEventListener("submit",(function(){t.$textarea.val(t.view.state.doc.toString())})),$(this.view.dom).textSelection("register",this.cmTextSelection),this.$textarea.textSelection("register",this.cmTextSelection),mw.hook("ext.CodeMirror.switch").fire(!0,$(this.view.dom))}},{key:"logUsage",value:function(t){var e=Object.assign({session_token:mw.user.sessionId(),user_id:mw.user.getId()},t),i=mw.config.get("wgUserEditCountBucket");null!==i&&(e.user_edit_count_bucket=i),mw.track("event.CodeMirrorUsage",e)}},{key:"setCodeMirrorPreference",value:function(t){mw.user.isNamed()&&((new mw.Api).saveOption("usecodemirror",t?1:0),mw.user.options.set("usecodemirror",t?1:0))}},{key:"cmTextSelection",get:function(){var t=this,e=$(this.view.dom);return{getContents:function(){return t.view.state.doc.toString()},setContents:function(i){return t.view.dispatch({changes:{from:0,to:t.view.state.doc.length,insert:i}}),e},getSelection:function(){return t.view.state.sliceDoc(t.view.state.selection.main.from,t.view.state.selection.main.to)},setSelection:function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{start:0,end:0};return t.view.dispatch({selection:{anchor:i.start,head:i.end||i.start}}),t.view.focus(),e},replaceSelection:function(i){return t.view.dispatch(t.view.state.replaceSelection(i)),e},getCaretPosition:function(e){return e.startAndEnd?[t.view.state.selection.main.from,t.view.state.selection.main.to]:t.view.state.selection.main.head},scrollToCaretPosition:function(){return t.view.dispatch({effects:Es.scrollIntoView(t.view.state.selection.main.head)}),e}}}}],i&&pr(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();const wr=1024;let yr=0;class vr{constructor(t,e){this.from=t,this.to=e}}class kr{constructor(t={}){this.id=yr++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=Sr.match(t)),e=>{let i=t(e);return void 0===i?null:[this,i]}}}kr.closedBy=new kr({deserialize:t=>t.split(" ")}),kr.openedBy=new kr({deserialize:t=>t.split(" ")}),kr.group=new kr({deserialize:t=>t.split(" ")}),kr.isolate=new kr({deserialize:t=>{if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),kr.contextHash=new kr({perNode:!0}),kr.lookAhead=new kr({perNode:!0}),kr.mounted=new kr({perNode:!0});class br{constructor(t,e,i){this.tree=t,this.overlay=e,this.parser=i}static get(t){return t&&t.props&&t.props[kr.mounted.id]}}const xr=Object.create(null);class Sr{constructor(t,e,i,n=0){this.name=t,this.props=e,this.id=i,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):xr,i=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(null==t.name?8:0),n=new Sr(t.name||"",e,t.id,i);if(t.props)for(let i of t.props)if(Array.isArray(i)||(i=i(n)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");e[i[0].id]=i[1]}return n}prop(t){return this.props[t.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(t){if("string"==typeof t){if(this.name==t)return!0;let e=this.prop(kr.group);return!!e&&e.indexOf(t)>-1}return this.id==t}static match(t){let e=Object.create(null);for(let i in t)for(let n of i.split(" "))e[n]=t[i];return t=>{for(let i=t.prop(kr.group),n=-1;n<(i?i.length:0);n++){let s=e[n<0?t.name:i[n]];if(s)return s}}}}Sr.none=new Sr("",Object.create(null),0,8);class Ar{constructor(t){this.types=t;for(let e=0;e=e){let o=new Nr(r.tree,r.overlay[0].from+t.from,-1,t);(s||(s=[n])).push(Br(o,e,i,!1))}}return s?Wr(s):n}(this,t,e)}iterate(t){let{enter:e,leave:i,from:n=0,to:s=this.length}=t,r=t.mode||0,o=(r&Cr.IncludeAnonymous)>0;for(let t=this.cursor(r|Cr.IncludeAnonymous);;){let r=!1;if(t.from<=s&&t.to>=n&&(!o&&t.type.isAnonymous||!1!==e(t))){if(t.firstChild())continue;r=!0}for(;r&&i&&(o||!t.type.isAnonymous)&&i(t),!t.nextSibling();){if(!t.parent())return;r=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:$r(Sr.none,this.children,this.positions,0,this.children.length,0,this.length,((t,e,i)=>new Or(this.type,t,e,i,this.propValues)),t.makeTree||((t,e,i)=>new Or(Sr.none,t,e,i)))}static build(t){return function(t){var e;let{buffer:i,nodeSet:n,maxBufferLength:s=wr,reused:r=[],minRepeatType:o=n.types.length}=t,l=Array.isArray(i)?new Dr(i,i.length):i,a=n.types,h=0,c=0;function u(t,e,i,m,w,y){let{id:v,start:k,end:b,size:x}=l,S=c;for(;x<0;){if(l.next(),-1==x){let e=r[v];return i.push(e),void m.push(k-t)}if(-3==x)return void(h=v);if(-4==x)return void(c=v);throw new RangeError(`Unrecognized record size: ${x}`)}let A,M,T=a[v],C=k-t;if(b-k<=s&&(M=function(t,e){let i=l.fork(),n=0,r=0,a=0,h=i.end-s,c={size:0,start:0,skip:0};t:for(let s=i.pos-t;i.pos>s;){let t=i.size;if(i.id==e&&t>=0){c.size=n,c.start=r,c.skip=a,a+=4,n+=4,i.next();continue}let l=i.pos-t;if(t<0||l=o?4:0,f=i.start;for(i.next();i.pos>l;){if(i.size<0){if(-3!=i.size)break t;u+=4}else i.id>=o&&(u+=4);i.next()}r=f,n+=t,a+=u}return(e<0||n==t)&&(c.size=n,c.start=r,c.skip=a),c.size>4?c:void 0}(l.pos-e,w))){let e=new Uint16Array(M.size-M.skip),i=l.pos-M.size,s=e.length;for(;l.pos>i;)s=g(M.start,e,s);A=new Er(e,b-M.start,n),C=M.start-t}else{let t=l.pos-x;l.next();let e=[],i=[],n=v>=o?v:-1,r=0,a=b;for(;l.pos>t;)n>=0&&l.id==n&&l.size>=0?(l.end<=a-s&&(d(e,i,k,r,l.end,a,n,S),r=e.length,a=l.end),l.next()):y>2500?f(k,t,e,i):u(k,t,e,i,n,y+1);if(n>=0&&r>0&&r-1&&r>0){let t=function(t){return(e,i,n)=>{let s,r,o=0,l=e.length-1;if(l>=0&&(s=e[l])instanceof Or){if(!l&&s.type==t&&s.length==n)return s;(r=s.prop(kr.lookAhead))&&(o=i[l]+s.length+r)}return p(t,e,i,n,o)}}(T);A=$r(T,e,i,0,e.length,0,b-k,t,t)}else A=p(T,e,i,b-k,S-b)}i.push(A),m.push(C)}function f(t,e,i,r){let o=[],a=0,h=-1;for(;l.pos>e;){let{id:t,start:e,end:i,size:n}=l;if(n>4)l.next();else{if(h>-1&&e=0;t-=3)e[i++]=o[t],e[i++]=o[t+1]-s,e[i++]=o[t+2]-s,e[i++]=i;i.push(new Er(e,o[2]-s,n)),r.push(s-t)}}function d(t,e,i,s,r,o,l,a){let h=[],c=[];for(;t.length>s;)h.push(t.pop()),c.push(e.pop()+i-r);t.push(p(n.types[l],h,c,o-r,a-o)),e.push(r-i)}function p(t,e,i,n,s=0,r){if(h){let t=[kr.contextHash,h];r=r?[t].concat(r):[t]}if(s>25){let t=[kr.lookAhead,s];r=r?[t].concat(r):[t]}return new Or(t,e,i,n,r)}function g(t,e,i){let{id:n,start:s,end:r,size:a}=l;if(l.next(),a>=0&&n4){let n=l.pos-(a-4);for(;l.pos>n;)i=g(t,e,i)}e[--i]=o,e[--i]=r-t,e[--i]=s-t,e[--i]=n}else-3==a?h=n:-4==a&&(c=n);return i}let m=[],w=[];for(;l.pos>0;)u(t.start||0,t.bufferStart||0,m,w,-1,0);let y=null!==(e=t.length)&&void 0!==e?e:m.length?w[0]+m[0].length:0;return new Or(a[t.topID],m.reverse(),w.reverse(),y)}(t)}}Or.empty=new Or(Sr.none,[],[],0);class Dr{constructor(t,e){this.buffer=t,this.index=e}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 Dr(this.buffer,this.index)}}class Er{constructor(t,e,i){this.buffer=t,this.length=e,this.set=i}get type(){return Sr.none}toString(){let t=[];for(let e=0;e0));l=r[l+3]);return o}slice(t,e,i){let n=this.buffer,s=new Uint16Array(e-t),r=0;for(let o=t,l=0;o=e&&ie;case 1:return i<=e&&n>e;case 2:return n>e;case 4:return!0}}function Br(t,e,i,n){for(var s;t.from==t.to||(i<1?t.from>=e:t.from>e)||(i>-1?t.to<=e:t.to0?o.length:-1;t!=a;t+=e){let a=o[t],h=l[t]+r.from;if(Lr(n,i,h,h+a.length))if(a instanceof Er){if(s&Cr.ExcludeBuffers)continue;let o=a.findChild(0,a.buffer.length,e,i-h,n);if(o>-1)return new zr(new Hr(r,a,t,h),null,o)}else if(s&Cr.IncludeAnonymous||!a.type.isAnonymous||_r(a)){let o;if(!(s&Cr.IgnoreMounts)&&(o=br.get(a))&&!o.overlay)return new Nr(o.tree,h,t,r);let l=new Nr(a,h,t,r);return s&Cr.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(e<0?a.children.length-1:0,e,i,n)}}if(s&Cr.IncludeAnonymous||!r.type.isAnonymous)return null;if(t=r.index>=0?r.index+e:e<0?-1:r._parent._tree.children.length,r=r._parent,!r)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(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,i=0){let n;if(!(i&Cr.IgnoreOverlays)&&(n=br.get(this._tree))&&n.overlay){let i=t-this.from;for(let{from:t,to:s}of n.overlay)if((e>0?t<=i:t=i:s>i))return new Nr(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,i)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}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}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Rr(t,e,i,n){let s=t.cursor(),r=[];if(!s.firstChild())return r;if(null!=i)for(;!s.type.is(i);)if(!s.nextSibling())return r;for(;;){if(null!=n&&s.type.is(n))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return null==n?r:[]}}function Ir(t,e,i=e.length-1){for(let n=t.parent;i>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[i]&&e[i]!=n.name)return!1;i--}}return!0}class Hr{constructor(t,e,i,n){this.parent=t,this.buffer=e,this.index=i,this.start=n}}class zr extends Pr{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(t,e,i){super(),this.context=t,this._parent=e,this.index=i,this.type=t.buffer.set.types[t.buffer.buffer[i]]}child(t,e,i){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,i);return s<0?null:new zr(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,i=0){if(i&Cr.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return s<0?null:new zr(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new zr(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new zr(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:i}=this.context,n=this.index+4,s=i.buffer[this.index+3];if(s>n){let r=i.buffer[this.index+1];t.push(i.slice(n,s,r)),e.push(0)}return new Or(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Wr(t){if(!t.length)return null;let e=0,i=t[0];for(let n=1;ni.from||s.to0){if(this.index-1)for(let n=e+t,s=t<0?-1:i._tree.children.length;n!=s;n+=t){let t=i._tree.children[n];if(this.mode&Cr.IncludeAnonymous||t instanceof Er||!t.type.isAnonymous||_r(t))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let r=t;r;r=r._parent)if(r.index==n){if(n==this.index)return r;e=r,i=s+1;break t}n=this.stack[--s]}for(let t=i;t=0;s--){if(s<0)return Ir(this.node,t,n);let r=i[e.buffer[this.stack[s]]];if(!r.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}}function _r(t){return t.children.some((t=>t instanceof Er||!t.type.isAnonymous||_r(t)))}const qr=new WeakMap;function jr(t,e){if(!t.isAnonymous||e instanceof Er||e.type!=t)return 1;let i=qr.get(e);if(null==i){i=1;for(let n of e.children){if(n.type!=t||!(n instanceof Or)){i=1;break}i+=jr(t,n)}qr.set(e,i)}return i}function $r(t,e,i,n,s,r,o,l,a){let h=0;for(let i=n;i=c)break;p+=e}if(h==s+1){if(p>c){let t=i[s];e(t.children,t.positions,0,t.children.length,n[s]+l);continue}u.push(i[s])}else{let e=n[h-1]+i[h-1].length-d;u.push($r(t,i,n,s,h,d,e,null,a))}f.push(d+l-r)}}(e,i,n,s,0),(l||a)(u,f,o)}class Kr{constructor(t,e,i,n,s=!1,r=!1){this.from=t,this.to=e,this.tree=i,this.offset=n,this.open=(s?1:0)|(r?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(t,e=[],i=!1){let n=[new Kr(0,t.length,t,0,!1,i)];for(let i of e)i.to>t.length&&n.push(i);return n}static applyChanges(t,e,i=128){if(!e.length)return t;let n=[],s=1,r=t.length?t[0]:null;for(let o=0,l=0,a=0;;o++){let h=o=i)for(;r&&r.from=e.from||c<=e.to||a){let t=Math.max(e.from,l)-a,i=Math.min(e.to,c)-a;e=t>=i?null:new Kr(t,i,e.tree,e.offset+a,o>0,!!h)}if(e&&n.push(e),r.to>c)break;r=snew vr(t.from,t.to))):[new vr(0,0)]:[new vr(0,t.length)],this.createParse(t,e||[],i)}parse(t,e,i){let n=this.startParse(t,e,i);for(;;){let t=n.advance();if(t)return t}}}class Ur{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}}new kr({perNode:!0});let Jr=0;class Yr{constructor(t,e,i){this.set=t,this.base=e,this.modified=i,this.id=Jr++}static define(t){if(null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let e=new Yr([],null,[]);if(e.set.push(e),t)for(let i of t.set)e.set.push(i);return e}static defineModifier(){let t=new Qr;return e=>e.modified.indexOf(t)>-1?e:Qr.get(e.base||e,e.modified.concat(t).sort(((t,e)=>t.id-e.id)))}}let Xr=0;class Qr{constructor(){this.instances=[],this.id=Xr++}static get(t,e){if(!e.length)return t;let i=e[0].instances.find((i=>{return i.base==t&&(n=e,s=i.modified,n.length==s.length&&n.every(((t,e)=>t==s[e])));var n,s}));if(i)return i;let n=[],s=new Yr(n,t,e);for(let t of e)t.instances.push(s);let r=function(t){let e=[[]];for(let i=0;ie.length-t.length))}(e);for(let e of t.set)if(!e.modified.length)for(let t of r)n.push(Qr.get(e,t));return s}}function Zr(t){let e=Object.create(null);for(let i in t){let n=t[i];Array.isArray(n)||(n=[n]);for(let t of i.split(" "))if(t){let i=[],s=2,r=t;for(let e=0;;){if("..."==r&&e>0&&e+3==t.length){s=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!n)throw new RangeError("Invalid path: "+t);if(i.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),e+=n[0].length,e==t.length)break;let o=t[e++];if(e==t.length&&"!"==o){s=0;break}if("/"!=o)throw new RangeError("Invalid path: "+t);r=t.slice(e)}let o=i.length-1,l=i[o];if(!l)throw new RangeError("Invalid path: "+t);let a=new eo(n,s,o>0?i.slice(0,o):null);e[l]=a.sort(e[l])}}return to.add(e)}const to=new kr;class eo{constructor(t,e,i,n){this.tags=t,this.mode=e,this.context=i,this.next=n}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(t){return!t||t.depth{let e=s;for(let n of t)for(let t of n.set){let n=i[t.id];if(n){e=e?e+" "+n:n;break}}return e},scope:n}}function no(t,e,i,n=0,s=t.length){let r=new so(n,Array.isArray(e)?e:[e],i);r.highlightRange(t.cursor(),n,s,"",r.highlighters),r.flush(s)}eo.empty=new eo([],2,null);class so{constructor(t,e,i){this.at=t,this.highlighters=e,this.span=i,this.class=""}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,i,n,s){let{type:r,from:o,to:l}=t;if(o>=i||l<=e)return;r.isTop&&(s=this.highlighters.filter((t=>!t.scope||t.scope(r))));let a=n,h=function(t){let e=t.type.prop(to);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||eo.empty,c=function(t,e){let i=null;for(let n of t){let t=n.style(e);t&&(i=i?i+" "+t:t)}return i}(s,h.tags);if(c&&(a&&(a+=" "),a+=c,1==h.mode&&(n+=(n?" ":"")+c)),this.startSpan(Math.max(e,o),a),h.opaque)return;let u=t.tree&&t.tree.prop(kr.mounted);if(u&&u.overlay){let r=t.node.enter(u.overlay[0].from+o,1),h=this.highlighters.filter((t=>!t.scope||t.scope(u.tree.type))),c=t.firstChild();for(let f=0,d=o;;f++){let p=f=g)&&t.nextSibling()););if(!p||g>i)break;d=p.to+o,d>e&&(this.highlightRange(r.cursor(),Math.max(e,p.from+o),Math.min(i,d),"",h),this.startSpan(Math.min(i,d),a))}c&&t.parent()}else if(t.firstChild()){u&&(n="");do{if(!(t.to<=e)){if(t.from>=i)break;this.highlightRange(t,e,i,n,s),this.startSpan(Math.min(i,t.to),a)}}while(t.nextSibling());t.parent()}}}const ro=Yr.define,oo=ro(),lo=ro(),ao=ro(lo),ho=ro(lo),co=ro(),uo=ro(co),fo=ro(co),po=ro(),go=ro(po),mo=ro(),wo=ro(),yo=ro(),vo=ro(yo),ko=ro(),bo={comment:oo,lineComment:ro(oo),blockComment:ro(oo),docComment:ro(oo),name:lo,variableName:ro(lo),typeName:ao,tagName:ro(ao),propertyName:ho,attributeName:ro(ho),className:ro(lo),labelName:ro(lo),namespace:ro(lo),macroName:ro(lo),literal:co,string:uo,docString:ro(uo),character:ro(uo),attributeValue:ro(uo),number:fo,integer:ro(fo),float:ro(fo),bool:ro(co),regexp:ro(co),escape:ro(co),color:ro(co),url:ro(co),keyword:mo,self:ro(mo),null:ro(mo),atom:ro(mo),unit:ro(mo),modifier:ro(mo),operatorKeyword:ro(mo),controlKeyword:ro(mo),definitionKeyword:ro(mo),moduleKeyword:ro(mo),operator:wo,derefOperator:ro(wo),arithmeticOperator:ro(wo),logicOperator:ro(wo),bitwiseOperator:ro(wo),compareOperator:ro(wo),updateOperator:ro(wo),definitionOperator:ro(wo),typeOperator:ro(wo),controlOperator:ro(wo),punctuation:yo,separator:ro(yo),bracket:vo,angleBracket:ro(vo),squareBracket:ro(vo),paren:ro(vo),brace:ro(vo),content:po,heading:go,heading1:ro(go),heading2:ro(go),heading3:ro(go),heading4:ro(go),heading5:ro(go),heading6:ro(go),contentSeparator:ro(po),list:ro(po),quote:ro(po),emphasis:ro(po),strong:ro(po),link:ro(po),monospace:ro(po),strikethrough:ro(po),inserted:ro(),deleted:ro(),changed:ro(),invalid:ro(),meta:ko,documentMeta:ro(ko),annotation:ro(ko),processingInstruction:ro(ko),definition:Yr.defineModifier(),constant:Yr.defineModifier(),function:Yr.defineModifier(),standard:Yr.defineModifier(),local:Yr.defineModifier(),special:Yr.defineModifier()};var xo;io([{tag:bo.link,class:"tok-link"},{tag:bo.heading,class:"tok-heading"},{tag:bo.emphasis,class:"tok-emphasis"},{tag:bo.strong,class:"tok-strong"},{tag:bo.keyword,class:"tok-keyword"},{tag:bo.atom,class:"tok-atom"},{tag:bo.bool,class:"tok-bool"},{tag:bo.url,class:"tok-url"},{tag:bo.labelName,class:"tok-labelName"},{tag:bo.inserted,class:"tok-inserted"},{tag:bo.deleted,class:"tok-deleted"},{tag:bo.literal,class:"tok-literal"},{tag:bo.string,class:"tok-string"},{tag:bo.number,class:"tok-number"},{tag:[bo.regexp,bo.escape,bo.special(bo.string)],class:"tok-string2"},{tag:bo.variableName,class:"tok-variableName"},{tag:bo.local(bo.variableName),class:"tok-variableName tok-local"},{tag:bo.definition(bo.variableName),class:"tok-variableName tok-definition"},{tag:bo.special(bo.variableName),class:"tok-variableName2"},{tag:bo.definition(bo.propertyName),class:"tok-propertyName tok-definition"},{tag:bo.typeName,class:"tok-typeName"},{tag:bo.namespace,class:"tok-namespace"},{tag:bo.className,class:"tok-className"},{tag:bo.macroName,class:"tok-macroName"},{tag:bo.propertyName,class:"tok-propertyName"},{tag:bo.operator,class:"tok-operator"},{tag:bo.comment,class:"tok-comment"},{tag:bo.meta,class:"tok-meta"},{tag:bo.invalid,class:"tok-invalid"},{tag:bo.punctuation,class:"tok-punctuation"}]);const So=new kr;const Ao=new kr;class Mo{constructor(t,e,i=[],n=""){this.data=t,this.name=n,vt.prototype.hasOwnProperty("tree")||Object.defineProperty(vt.prototype,"tree",{get(){return Co(this)}}),this.parser=e,this.extension=[Io.of(this),vt.languageData.of(((t,e,i)=>{let n=To(t,e,i),s=n.type.prop(So);if(!s)return[];let r=t.facet(s),o=n.type.prop(Ao);if(o){let s=n.resolve(e-n.from,i);for(let e of o)if(e.test(s,t)){let i=t.facet(e.facet);return"replace"==e.type?i:i.concat(r)}}return r}))].concat(i)}isActiveAt(t,e,i=-1){return To(t,e,i).type.prop(So)==this.data}findRegions(t){let e=t.facet(Io);if((null==e?void 0:e.data)==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let i=[],n=(t,e)=>{if(t.prop(So)==this.data)return void i.push({from:e,to:e+t.length});let s=t.prop(kr.mounted);if(s){if(s.tree.prop(So)==this.data){if(s.overlay)for(let t of s.overlay)i.push({from:t.from+e,to:t.to+e});else i.push({from:e,to:e+t.length});return}if(s.overlay){let t=i.length;if(n(s.tree,s.overlay[0].from+e),i.length>t)return}}for(let i=0;i=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-i,e-i)}}let Do=null;class Eo{constructor(t,e,i=[],n,s,r,o,l){this.parser=t,this.state=e,this.fragments=i,this.tree=n,this.treeLen=s,this.viewport=r,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,e,i){return new Eo(t,e,[],Or.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Oo(this.state.doc),this.fragments)}work(t,e){return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=Or.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var i;if("number"==typeof t){let e=Date.now()+t;t=()=>Date.now()>e}for(this.parse||(this.parse=this.startParse()),null!=e&&(null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&e=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext((()=>{for(;!(e=this.parse.advance()););})),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(Kr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Do;Do=this;try{return t()}finally{Do=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=Lo(t,e.from,e.to);return t}changes(t,e){let{fragments:i,tree:n,treeLen:s,viewport:r,skipped:o}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges(((t,i,n,s)=>e.push({fromA:t,toA:i,fromB:n,toB:s}))),i=Kr.applyChanges(i,e),n=Or.empty,s=0,r={from:t.mapPos(r.from,-1),to:t.mapPos(r.to,1)},this.skipped.length){o=[];for(let e of this.skipped){let i=t.mapPos(e.from,1),n=t.mapPos(e.to,-1);it.from&&(this.fragments=Lo(this.fragments,i,n),this.skipped.splice(e--,1))}return!(this.skipped.length>=e||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends Gr{createParse(e,i,n){let s=n[0].from,r=n[n.length-1].to;return{parsedPos:s,advance(){let e=Do;if(e){for(let t of n)e.tempSkipped.push(t);t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=r,new Or(Sr.none,[],[],r-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}static get(){return Do}}function Lo(t,e,i){return Kr.applyChanges(t,[{fromA:e,toA:i,fromB:e,toB:i}])}class Bo{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),i=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,i)||e.takeTree(),new Bo(e)}static init(t){let e=Math.min(3e3,t.doc.length),i=Eo.create(t.facet(Io).parser,t,{from:0,to:e});return i.work(20,e)||i.takeTree(),new Bo(i)}}Mo.state=_.define({create:Bo.init,update(t,e){for(let t of e.effects)if(t.is(Mo.setState))return t.value;return e.startState.facet(Io)!=e.state.facet(Io)?Bo.init(e.state):t.apply(e)}});let Po=t=>{let e=setTimeout((()=>t()),500);return()=>clearTimeout(e)};"undefined"!=typeof requestIdleCallback&&(Po=t=>{let e=-1,i=setTimeout((()=>{e=requestIdleCallback(t,{timeout:400})}),100);return()=>e<0?clearTimeout(i):cancelIdleCallback(e)});const No="undefined"!=typeof navigator&&(null===(xo=navigator.scheduling)||void 0===xo?void 0:xo.isInputPending)?()=>navigator.scheduling.isInputPending():null,Ro=vi.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(Mo.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Mo.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Po(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,l=s.context.work((()=>No&&No()||Date.now()>r),n+(o?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Mo.setState.of(new Bo(s.context))})),this.chunkBudget>0&&(!l||o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((()=>this.scheduleWork())).catch((t=>gi(this.view.state,t))).then((()=>this.workScheduled--)),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Io=R.define({combine:t=>t.length?t[0]:null,enables:t=>[Mo.state,Ro,Es.contentAttributes.compute([t],(e=>{let i=e.facet(t);return i&&i.name?{"data-language":i.name}:{}}))]});class Ho{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}}const zo=R.define(),Wo=R.define({combine:t=>{if(!t.length)return"  ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some((t=>t!=e[0])))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Vo(t){let e=t.facet(Wo);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function Fo(t,e){let i="",n=t.tabSize,s=t.facet(Wo)[0];if("\t"==s){for(;e>=n;)i+="\t",e-=n;s=" "}for(let t=0;t=e?function(t,e,i){let n=e.resolveStack(i),s=n.node.enterUnfinishedNodesBefore(i);if(s!=n.node){let t=[];for(let e=s;e!=n.node;e=e.parent)t.push(e);for(let e=t.length-1;e>=0;e--)n={node:t[e],next:n}}return $o(n,t,i)}(t,i,e):null}class qo{constructor(t,e={}){this.state=t,this.options=e,this.unit=Vo(t)}lineAt(t,e=1){let i=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return null!=n&&n>=i.from&&n<=i.to?s&&n==t?{text:"",from:t}:(e<0?n-1&&(s+=r-this.countColumn(i,i.search(/\S|$/))),s}countColumn(t,e=t.length){return Ht(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:i,from:n}=this.lineAt(t,e),s=this.options.overrideIndentation;if(s){let t=s(n);if(t>-1)return t}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const jo=new kr;function $o(t,e,i){for(let n=t;n;n=n.next){let t=Ko(n.node);if(t)return t(Uo.create(e,i,n))}return 0}function Ko(t){let e=t.type.prop(jo);if(e)return e;let i,n=t.firstChild;if(n&&(i=n.type.prop(kr.closedBy))){let e=t.lastChild,n=e&&i.indexOf(e.name)>-1;return t=>function(t,e,i,n,s){let r=t.textAfter,o=r.match(/^\s*/)[0].length,l=n&&r.slice(o,o+n.length)==n||s==t.pos+o,a=e?function(t){let e=t.node,i=e.childAfter(e.from),n=e.lastChild;if(!i)return null;let s=t.options.simulateBreak,r=t.state.doc.lineAt(i.from),o=null==s||s<=r.from?r.to:Math.min(r.to,s);for(let t=i.to;;){let s=e.childAfter(t);if(!s||s==n)return null;if(!s.type.isSkipped)return s.fromt.prop(So)==r.data:r?t=>t==r:void 0,this.style=io(t.map((t=>({tag:t.tag,class:t.class||n(Object.assign({},t,{tag:null}))}))),{all:s}).style,this.module=i?new Ft(i):null,this.themeType=e.themeType}static define(t,e){return new Yo(t,e||{})}}const Xo=R.define(),Qo=R.define({combine:t=>t.length?[t[0]]:null});function Zo(t){let e=t.facet(Xo);return e.length?e:t.facet(Qo)}class tl{constructor(t){this.markCache=Object.create(null),this.tree=Co(t.state),this.decorations=this.buildDeco(t,Zo(t.state))}update(t){let e=Co(t.state),i=Zo(t.state),n=i!=Zo(t.startState);e.length{i.add(t,e,this.markCache[n]||(this.markCache[n]=Ge.mark({class:n})))}),n,s);return i.finish()}}const el=j.high(vi.fromClass(tl,{decorations:t=>t.decorations})),il=(bo.meta,bo.link,bo.heading,bo.emphasis,bo.strong,bo.strikethrough,bo.keyword,bo.atom,bo.bool,bo.url,bo.contentSeparator,bo.labelName,bo.literal,bo.inserted,bo.string,bo.deleted,bo.regexp,bo.escape,bo.string,bo.variableName,bo.variableName,bo.typeName,bo.namespace,bo.className,bo.variableName,bo.macroName,bo.propertyName,bo.comment,bo.invalid,Es.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}})),nl=1e4,sl="()[]{}",rl=R.define({combine:t=>kt(t,{afterCursor:!0,brackets:sl,maxScanDistance:nl,renderMatch:al})}),ol=Ge.mark({class:"cm-matchingBracket"}),ll=Ge.mark({class:"cm-nonmatchingBracket"});function al(t){let e=[],i=t.matched?ol:ll;return e.push(i.range(t.start.from,t.start.to)),t.end&&e.push(i.range(t.end.from,t.end.to)),e}const hl=_.define({create:()=>Ge.none,update(t,e){if(!e.docChanged&&!e.selection)return t;let i=[],n=e.state.facet(rl);for(let t of e.state.selection.ranges){if(!t.empty)continue;let s=gl(e.state,t.head,-1,n)||t.head>0&&gl(e.state,t.head-1,1,n)||n.afterCursor&&(gl(e.state,t.head,1,n)||t.headEs.decorations.from(t)}),cl=[hl,il];function ul(t={}){return[rl.of(t),cl]}const fl=new kr;function dl(t,e,i){let n=t.prop(e<0?kr.openedBy:kr.closedBy);if(n)return n;if(1==t.name.length){let n=i.indexOf(t.name);if(n>-1&&n%2==(e<0?1:0))return[i[n+e]]}return null}function pl(t){let e=t.type.prop(fl);return e?e(t.node):t}function gl(t,e,i,n={}){let s=n.maxScanDistance||nl,r=n.brackets||sl,o=Co(t),l=o.resolveInner(e,i);for(let t=l;t;t=t.parent){let n=dl(t.type,i,r);if(n&&t.from0?e>=s.from&&es.from&&e<=s.to))return ml(0,0,i,t,s,n,r)}}return function(t,e,i,n,s,r,o){let l=i<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=i>0)return null;let h={from:i<0?e-1:e,to:i>0?e+1:e},c=t.doc.iterRange(e,i>0?t.doc.length:0),u=0;for(let t=0;!c.next().done&&t<=r;){let r=c.value;i<0&&(t+=r.length);let l=e+t*i;for(let t=i>0?0:r.length-1,e=i>0?r.length:-1;t!=e;t+=i){let e=o.indexOf(r[t]);if(!(e<0||n.resolveInner(l+t,1).type!=s))if(e%2==0==i>0)u++;else{if(1==u)return{start:h,end:{from:l+t,to:l+t+1},matched:e>>1==a>>1};u--}}i>0&&(t+=r.length)}return c.done?{start:h,matched:!1}:null}(t,e,i,o,l.type,s,r)}function ml(t,e,i,n,s,r,o){let l=n.parent,a={from:s.from,to:s.to},h=0,c=null==l?void 0:l.cursor();if(c&&(i<0?c.childBefore(n.from):c.childAfter(n.to)))do{if(i<0?c.to<=n.from:c.from>=n.to){if(0==h&&r.indexOf(c.type.name)>-1&&c.from=this.string.length}sol(){return 0==this.pos}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pose}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPosi?t.toLowerCase():t;return n(this.string.substr(this.pos,t.length))==n(t)?(!1!==e&&(this.pos+=t.length),!0):null}{let i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&!1!==e&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function vl(t){if("object"!=typeof t)return t;let e={};for(let i in t){let n=t[i];e[i]=n instanceof Array?n.slice():n}return e}const kl=new WeakMap;class bl extends Mo{constructor(t){let e,i=(s=t.languageData,R.define({combine:s?t=>t.concat(s):void 0})),n={name:(r=t).name||"",token:r.token,blankLine:r.blankLine||(()=>{}),startState:r.startState||(()=>!0),copyState:r.copyState||vl,indent:r.indent||(()=>null),languageData:r.languageData||{},tokenTable:r.tokenTable||Tl};var s,r;super(i,new class extends Gr{createParse(t,i,n){return new Al(e,t,i,n)}},[zo.of(((t,e)=>this.getIndent(t,e)))],t.name),this.topNode=function(t){let e=Sr.define({id:Cl.length,name:"Document",props:[So.add((()=>t))],top:!0});return Cl.push(e),e}(i),e=this,this.streamParser=n,this.stateAfter=new kr({perNode:!0}),this.tokenTable=t.tokenTable?new Bl(n.tokenTable):Pl}static define(t){return new bl(t)}getIndent(t,e){let i,n=Co(t.state),s=n.resolve(e);for(;s&&s.type!=this.topNode;)s=s.parent;if(!s)return null;let{overrideIndentation:r}=t.options;r&&(i=kl.get(t.state),null!=i&&i1e4)return null;for(;o=n&&i+e.length<=s&&e.prop(t.stateAfter);if(r)return{state:t.streamParser.copyState(r),pos:i+e.length};for(let r=e.children.length-1;r>=0;r--){let o=e.children[r],l=i+e.positions[r],a=o instanceof Or&&l=e.length)return e;s||e.type!=t.topNode||(s=!0);for(let r=e.children.length-1;r>=0;r--){let o,l=e.positions[r],a=e.children[r];if(li&&xl(t,n.tree,0-n.offset,i,r);if(o&&(e=Sl(t,n.tree,i+n.offset,o.pos+n.offset,!1)))return{state:o.state,tree:e}}return{state:t.streamParser.startState(n?Vo(n):4),tree:Or.empty}}(t,i,r,null==s?void 0:s.state);this.state=o,this.parsedPos=this.chunkStart=r+l.length;for(let t=0;t=e?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,e),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let e=this.input.chunk(t);if(this.input.lineChunks)"\n"==e&&(e="");else{let t=e.indexOf("\n");t>-1&&(e=e.slice(0,t))}return t+e.length<=this.to?e:e.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,e=this.lineAfter(t),i=t+e.length;for(let t=this.rangeIndex;;){let n=this.ranges[t].to;if(n>=i)break;if(e=e.slice(0,n-(i-e.length)),t++,t==this.ranges.length)break;let s=this.ranges[t].from,r=this.lineAfter(s);e+=r,i=s+r.length}return{line:e,end:i}}skipGapsTo(t,e,i){for(;;){let n=this.ranges[this.rangeIndex].to,s=t+e;if(i>0?n>s:n>=s)break;e+=this.ranges[++this.rangeIndex].from-n}return e}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){e+=s=this.skipGapsTo(e,s,1);let t=this.chunk.length;i+=s=this.skipGapsTo(i,s,-1),n+=this.chunk.length-t}return this.chunk.push(t,e,i,n),s}parseLine(t){let{line:e,end:i}=this.nextLine(),n=0,{streamParser:s}=this.lang,r=new yl(e,t?t.state.tabSize:4,t?Vo(t.state):2);if(r.eol())s.blankLine(this.state,r.indentUnit);else for(;!r.eol();){let t=Ml(s.token,r,this.state);if(t&&(n=this.emitToken(this.lang.tokenTable.resolve(t),this.parsedPos+r.start,this.parsedPos+r.pos,4,n)),r.start>1e4)break}this.parsedPos=i,this.moveRangeIndex(),this.parsedPose.start)return n}throw new Error("Stream parser failed to advance stream.")}const Tl=Object.create(null),Cl=[Sr.none],Ol=new Ar(Cl),Dl=[],El=Object.create(null),Ll=Object.create(null);for(let[t,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"]])Ll[t]=Rl(Tl,e);class Bl{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),Ll)}resolve(t){return t?this.table[t]||(this.table[t]=Rl(this.extra,t)):0}}const Pl=new Bl(Tl);function Nl(t,e){Dl.indexOf(t)>-1||(Dl.push(t),console.warn(e))}function Rl(t,e){let i=[];for(let n of e.split(" ")){let e=[];for(let i of n.split(".")){let n=t[i]||bo[i];n?"function"==typeof n?e.length?e=e.map(n):Nl(i,`Modifier ${i} used at start of tag`):e.length?Nl(i,`Tag ${i} used as modifier`):e=Array.isArray(n)?n:[n]:Nl(i,`Unknown highlighting tag ${i}`)}for(let t of e)i.push(t)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),s=n+" "+i.map((t=>t.id)),r=El[s];if(r)return r.id;let o=El[s]=Sr.define({id:Cl.length,name:n,props:[Zr({[n]:i})]});return Cl.push(o),o.id}function Il(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let s=t(e,i);return!!s&&(n(i.update(s)),!0)}}const Hl=Il(ql,0),zl=Il(_l,0),Wl=Il(((t,e)=>_l(t,e,function(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),s=i.to<=n.to?n:t.doc.lineAt(i.to),r=e.length-1;r>=0&&e[r].to>n.from?e[r].to=s.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:s.to})}return e}(e))),0);function Vl(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}const Fl=50;function _l(t,e,i=e.selection.ranges){let n=i.map((t=>Vl(e,t.from).block));if(!n.every((t=>t)))return null;let s=i.map(((t,i)=>function(t,{open:e,close:i},n,s){let r,o,l=t.sliceDoc(n-Fl,n),a=t.sliceDoc(s,s+Fl),h=/\s*$/.exec(l)[0].length,c=/^\s*/.exec(a)[0].length,u=l.length-h;if(l.slice(u-e.length,u)==e&&a.slice(c,c+i.length)==i)return{open:{pos:n-h,margin:h&&1},close:{pos:s+c,margin:c&&1}};s-n<=2*Fl?r=o=t.sliceDoc(n,s):(r=t.sliceDoc(n,n+Fl),o=t.sliceDoc(s-Fl,s));let f=/^\s*/.exec(r)[0].length,d=/\s*$/.exec(o)[0].length,p=o.length-d-i.length;return r.slice(f,f+e.length)==e&&o.slice(p,p+i.length)==i?{open:{pos:n+f+e.length,margin:/\s/.test(r.charAt(f+e.length))?1:0},close:{pos:s-d-i.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null}(e,n[i],t.from,t.to)));if(2!=t&&!s.every((t=>t)))return{changes:e.changes(i.map(((t,e)=>s[e]?[]:[{from:t.from,insert:n[e].open+" "},{from:t.to,insert:" "+n[e].close}])))};if(1!=t&&s.some((t=>t))){let t=[];for(let e,i=0;is&&(t==r||r>a.from)){s=a.from;let t=/^\s*/.exec(a.text)[0].length,e=t==a.length,i=a.text.slice(t,t+l.length)==l?t:-1;tt.comment<0&&(!t.empty||t.single)))){let t=[];for(let{line:e,token:i,indent:s,empty:r,single:o}of n)!o&&r||t.push({from:e.from+s,insert:i+" "});let i=e.changes(t);return{changes:i,selection:e.selection.map(i,1)}}if(1!=t&&n.some((t=>t.comment>=0))){let t=[];for(let{line:e,comment:i,token:s}of n)if(i>=0){let n=e.from+i,r=n+s.length;" "==e.text[r-e.from]&&r++,t.push({from:n,to:r})}return{changes:t}}return null}const jl=rt.define(),$l=rt.define(),Kl=R.define(),Gl=R.define({combine:t=>kt(t,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(i,n)=>t(i,n)||e(i,n)})}),Ul=_.define({create:()=>ua.empty,update(t,e){let i=e.state.facet(Gl),n=e.annotation(jl);if(n){let s=e.docChanged?B.single(function(t){let e=0;return t.iterChangedRanges(((t,i)=>e=i)),e}(e.changes)):void 0,r=ea.fromTransaction(e,s),o=n.side,l=0==o?t.undone:t.done;return l=r?ia(l,l.length,i.minDepth,r):oa(l,e.startState.selection),new ua(0==o?n.rest:l,0==o?l:n.rest)}let s=e.annotation($l);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(ht.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let r=ea.fromTransaction(e),o=e.annotation(ht.time),l=e.annotation(ht.userEvent);return r?t=t.addChanges(r,o,l,i,e):e.selection&&(t=t.addSelection(e.startState.selection,o,l,i.newGroupDelay)),"full"!=s&&"after"!=s||(t=t.isolate()),t},toJSON:t=>({done:t.done.map((t=>t.toJSON())),undone:t.undone.map((t=>t.toJSON()))}),fromJSON:t=>new ua(t.done.map(ea.fromJSON),t.undone.map(ea.fromJSON))});function Jl(t={}){return[Ul,Gl.of(t),Es.domEventHandlers({beforeinput(t,e){let i="historyUndo"==t.inputType?Xl:"historyRedo"==t.inputType?Ql:null;return!!i&&(t.preventDefault(),i(e))}})]}function Yl(t,e){return function({state:i,dispatch:n}){if(!e&&i.readOnly)return!1;let s=i.field(Ul,!1);if(!s)return!1;let r=s.pop(t,i,e);return!!r&&(n(r),!0)}}const Xl=Yl(0,!1),Ql=Yl(1,!1),Zl=Yl(0,!0),ta=Yl(1,!0);class ea{constructor(t,e,i,n,s){this.changes=t,this.effects=e,this.mapped=i,this.startSelection=n,this.selectionsAfter=s}setSelAfter(t){return new ea(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,i;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(i=this.startSelection)||void 0===i?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map((t=>t.toJSON()))}}static fromJSON(t){return new ea(t.changes&&A.fromJSON(t.changes),[],t.mapped&&S.fromJSON(t.mapped),t.startSelection&&B.fromJSON(t.startSelection),t.selectionsAfter.map(B.fromJSON))}static fromTransaction(t,e){let i=sa;for(let e of t.startState.facet(Kl)){let n=e(t);n.length&&(i=i.concat(n))}return!i.length&&t.changes.empty?null:new ea(t.changes.invert(t.startState.doc),i,void 0,e||t.startState.selection,sa)}static selection(t){return new ea(void 0,sa,void 0,void 0,t)}}function ia(t,e,i,n){let s=e+1>i+20?e-i-1:0,r=t.slice(s,e);return r.push(n),r}function na(t,e){return t.length?e.length?t.concat(e):t:e}const sa=[],ra=200;function oa(t,e){if(t.length){let i=t[t.length-1],n=i.selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-ra));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),ia(t,t.length-1,1e9,i.setSelAfter(n)))}return[ea.selection([e])]}function la(t){let e=t[t.length-1],i=t.slice();return i[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),i}function aa(t,e){if(!t.length)return t;let i=t.length,n=sa;for(;i;){let s=ha(t[i-1],e,n);if(s.changes&&!s.changes.empty||s.effects.length){let e=t.slice(0,i);return e[i-1]=s,e}e=s.mapped,i--,n=s.selectionsAfter}return n.length?[ea.selection(n)]:sa}function ha(t,e,i){let n=na(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):sa,i);if(!t.changes)return ea.selection(n);let s=t.changes.map(e),r=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(r):r;return new ea(s,at.mapEffects(t.effects,e),o,t.startSelection.map(r),n)}const ca=/^(input\.type|delete)($|\.)/;class ua{constructor(t,e,i=0,n=void 0){this.done=t,this.undone=e,this.prevTime=i,this.prevUserEvent=n}isolate(){return this.prevTime?new ua(this.done,this.undone):this}addChanges(t,e,i,n,s){let r=this.done,o=r[r.length-1];return r=o&&o.changes&&!o.changes.empty&&t.changes&&(!i||ca.test(i))&&(!o.selectionsAfter.length&&e-this.prevTimei.push(t,e))),e.iterChangedRanges(((t,e,s,r)=>{for(let t=0;t=e&&s<=o&&(n=!0)}})),n}(o.changes,t.changes))||"input.type.compose"==i)?ia(r,r.length-1,n.minDepth,new ea(t.changes.compose(o.changes),na(t.effects,o.effects),o.mapped,o.startSelection,sa)):ia(r,r.length,n.minDepth,t),new ua(r,sa,e,i)}addSelection(t,e,i,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:sa;return s.length>0&&e-this.prevTimet.empty!=o.ranges[e].empty)).length)?this:new ua(oa(this.done,t),this.undone,e,i);var r,o}addMapping(t){return new ua(aa(this.done,t),aa(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,e,i){let n=0==t?this.done:this.undone;if(0==n.length)return null;let s=n[n.length-1];if(i&&s.selectionsAfter.length)return e.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:jl.of({side:t,rest:la(n)}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let i=1==n.length?sa:n.slice(0,n.length-1);return s.mapped&&(i=aa(i,s.mapped)),e.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:jl.of({side:t,rest:i}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}ua.empty=new ua(sa,sa);const fa=[{key:"Mod-z",run:Xl,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Ql,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Ql,preventDefault:!0},{key:"Mod-u",run:Zl,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:ta,preventDefault:!0}];function da(t,e){return B.create(t.ranges.map(e),t.mainIndex)}function pa(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function ga({state:t,dispatch:e},i){let n=da(t.selection,i);return!n.eq(t.selection)&&(e(pa(t,n)),!0)}function ma(t,e){return B.cursor(e?t.to:t.from)}function wa(t,e){return ga(t,(i=>i.empty?t.moveByChar(i,e):ma(i,e)))}function ya(t){return t.textDirectionAt(t.state.selection.main.head)==Bi.LTR}const va=t=>wa(t,!ya(t)),ka=t=>wa(t,ya(t));function ba(t,e){return ga(t,(i=>i.empty?t.moveByGroup(i,e):ma(i,e)))}function xa(t,e,i){if(e.type.prop(i))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Sa(t,e,i){let n,s,r=Co(t).resolveInner(e.head),o=i?kr.closedBy:kr.openedBy;for(let n=e.head;;){let e=i?r.childAfter(n):r.childBefore(n);if(!e)break;xa(t,e,o)?r=e:n=i?e.to:e.from}return s=r.type.prop(o)&&(n=i?gl(t,r.from,1):gl(t,r.to,-1))&&n.matched?i?n.end.to:n.end.from:i?r.to:r.from,B.cursor(s,i?-1:1)}function Aa(t,e){return ga(t,(i=>{if(!i.empty)return ma(i,e);let n=t.moveVertically(i,e);return n.head!=i.head?n:t.moveToLineBoundary(i,e)}))}"undefined"!=typeof Intl&&Intl.Segmenter;const Ma=t=>Aa(t,!1),Ta=t=>Aa(t,!0);function Ca(t){let e,i=t.scrollDOM.clientHeighti.empty?t.moveVertically(i,e,n.height):ma(i,e)));if(r.eq(s.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(s.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),l=o.top+n.marginTop,a=o.bottom-n.marginBottom;e&&e.top>l&&e.bottomOa(t,!1),Ea=t=>Oa(t,!0);function La(t,e,i){let n=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,i);if(s.head==e.head&&s.head!=(i?n.to:n.from)&&(s=t.moveToLineBoundary(e,i,!1)),!i&&s.head==n.from&&n.length){let i=/^\s*/.exec(t.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;i&&e.head!=n.from+i&&(s=B.cursor(n.from+i))}return s}function Ba(t,e){let i=da(t.state.selection,(t=>{let i=e(t);return B.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(pa(t.state,i)),!0)}function Pa(t,e){return Ba(t,(i=>t.moveByChar(i,e)))}const Na=t=>Pa(t,!ya(t)),Ra=t=>Pa(t,ya(t));function Ia(t,e){return Ba(t,(i=>t.moveByGroup(i,e)))}function Ha(t,e){return Ba(t,(i=>t.moveVertically(i,e)))}const za=t=>Ha(t,!1),Wa=t=>Ha(t,!0);function Va(t,e){return Ba(t,(i=>t.moveVertically(i,e,Ca(t).height)))}const Fa=t=>Va(t,!1),_a=t=>Va(t,!0),qa=({state:t,dispatch:e})=>(e(pa(t,{anchor:0})),!0),ja=({state:t,dispatch:e})=>(e(pa(t,{anchor:t.doc.length})),!0),$a=({state:t,dispatch:e})=>(e(pa(t,{anchor:t.selection.main.anchor,head:0})),!0),Ka=({state:t,dispatch:e})=>(e(pa(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0);function Ga(t,e){if(t.state.readOnly)return!1;let i="delete.selection",{state:n}=t,s=n.changeByRange((n=>{let{from:s,to:r}=n;if(s==r){let n=e(s);ns&&(i="delete.forward",n=Ua(t,n,!0)),s=Math.min(s,n),r=Math.max(r,n)}else s=Ua(t,s,!1),r=Ua(t,r,!0);return s==r?{range:n}:{changes:{from:s,to:r},range:B.cursor(s)}}));return!s.changes.empty&&(t.dispatch(n.update(s,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Es.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function Ua(t,e,i){if(t instanceof Es)for(let n of t.state.facet(Es.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{te&&(e=i?n:t)}));return e}const Ja=(t,e)=>Ga(t,(i=>{let n,s,{state:r}=t,o=r.doc.lineAt(i);if(!e&&i>o.from&&iJa(t,!1),Xa=t=>Ja(t,!0),Qa=(t,e)=>Ga(t,(i=>{let n=i,{state:s}=t,r=s.doc.lineAt(n),o=s.charCategorizer(n);for(let t=null;;){if(n==(e?r.to:r.from)){n==i&&r.number!=(e?s.doc.lines:1)&&(n+=e?1:-1);break}let l=d(r.text,n-r.from,e)+r.from,a=r.text.slice(Math.min(n,l)-r.from,Math.max(n,l)-r.from),h=o(a);if(null!=t&&h!=t)break;" "==a&&n==i||(t=h),n=l}return n})),Za=t=>Qa(t,!1),th=t=>Ga(t,(e=>{let i=t.lineBlockAt(e).to;return e=s.number){let t=e[e.length-1];t.to=r.to,t.ranges.push(n)}else e.push({from:s.from,to:r.to,ranges:[n]});i=r.number+1}return e}function ih(t,e,i){if(t.readOnly)return!1;let n=[],s=[];for(let e of eh(t)){if(i?e.to==t.doc.length:0==e.from)continue;let r=t.doc.lineAt(i?e.to+1:e.from-1),o=r.length+1;if(i){n.push({from:e.to,to:r.to},{from:e.from,insert:r.text+t.lineBreak});for(let i of e.ranges)s.push(B.range(Math.min(t.doc.length,i.anchor+o),Math.min(t.doc.length,i.head+o)))}else{n.push({from:r.from,to:e.from},{from:e.to,insert:t.lineBreak+r.text});for(let t of e.ranges)s.push(B.range(t.anchor-o,t.head-o))}}return!!n.length&&(e(t.update({changes:n,scrollIntoView:!0,selection:B.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0)}function nh(t,e,i){if(t.readOnly)return!1;let n=[];for(let e of eh(t))i?n.push({from:e.from,insert:t.doc.slice(e.from,e.to)+t.lineBreak}):n.push({from:e.to,insert:t.lineBreak+t.doc.slice(e.from,e.to)});return e(t.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const sh=rh(!1);function rh(e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let s=i.changeByRange((n=>{let{from:s,to:r}=n,o=i.doc.lineAt(s),l=!e&&s==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let i,n=Co(t).resolveInner(e),s=n.childBefore(e),r=n.childAfter(e);return s&&r&&s.to<=e&&r.from>=e&&(i=s.type.prop(kr.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(s.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(s.to,r.from))?{from:s.to,to:r.from}:null}(i,s);e&&(s=r=(r<=o.to?o:i.doc.lineAt(r)).to);let a=new qo(i,{simulateBreak:s,simulateDoubleBreak:!!l}),h=_o(a,s);for(null==h&&(h=Ht(/^\s*/.exec(i.doc.lineAt(s).text)[0],i.tabSize));ro.from&&s{let s=[];for(let r=n.from;r<=n.to;){let o=t.doc.lineAt(r);o.number>i&&(n.empty||n.to>o.from)&&(e(o,s,n),i=o.number),r=o.to+1}let r=t.changes(s);return{changes:s,range:B.range(r.mapPos(n.anchor,1),r.mapPos(n.head,1))}}))}const lh=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:t=>ga(t,(e=>Sa(t.state,e,!ya(t)))),shift:t=>Ba(t,(e=>Sa(t.state,e,!ya(t))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:t=>ga(t,(e=>Sa(t.state,e,ya(t)))),shift:t=>Ba(t,(e=>Sa(t.state,e,ya(t))))},{key:"Alt-ArrowUp",run:({state:t,dispatch:e})=>ih(t,e,!1)},{key:"Shift-Alt-ArrowUp",run:({state:t,dispatch:e})=>nh(t,e,!1)},{key:"Alt-ArrowDown",run:({state:t,dispatch:e})=>ih(t,e,!0)},{key:"Shift-Alt-ArrowDown",run:({state:t,dispatch:e})=>nh(t,e,!0)},{key:"Escape",run:({state:t,dispatch:e})=>{let i=t.selection,n=null;return i.ranges.length>1?n=B.create([i.main]):i.main.empty||(n=B.create([B.cursor(i.main.head)])),!!n&&(e(pa(t,n)),!0)}},{key:"Mod-Enter",run:rh(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:t,dispatch:e})=>{let i=eh(t).map((({from:e,to:i})=>B.range(e,Math.min(i+1,t.doc.length))));return e(t.update({selection:B.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:t,dispatch:e})=>{let i=da(t.selection,(e=>{var i;let n=Co(t).resolveInner(e.head,1);for(;!(n.from=e.to||n.to>e.to&&n.from<=e.from)&&(null===(i=n.parent)||void 0===i?void 0:i.parent);)n=n.parent;return B.range(n.to,n.from)}));return e(pa(t,i)),!0},preventDefault:!0},{key:"Mod-[",run:({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(oh(t,((e,i)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let s=Ht(n,t.tabSize),r=0,o=Fo(t,Math.max(0,s-Vo(t)));for(;r!t.readOnly&&(e(t.update(oh(t,((e,i)=>{i.push({from:e.from,insert:t.facet(Wo)})})),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=Object.create(null),n=new qo(t,{overrideIndentation:t=>{let e=i[t];return null==e?-1:e}}),s=oh(t,((e,s,r)=>{let o=_o(n,e.from);if(null==o)return;/\S/.test(e.text)||(o=0);let l=/^\s*/.exec(e.text)[0],a=Fo(t,o);(l!=a||r.from{if(t.state.readOnly)return!1;let{state:e}=t,i=e.changes(eh(e).map((({from:t,to:i})=>(t>0?t--:it.moveVertically(e,!0))).map(i);return t.dispatch({changes:i,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:t,dispatch:e})=>function(t,e,i){let n=!1,s=da(t.selection,(e=>{let s=gl(t,e.head,-1)||gl(t,e.head,1)||e.head>0&&gl(t,e.head-1,1)||e.head{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=Vl(t.state,i.from);return n.line?Hl(t):!!n.block&&Wl(t)}},{key:"Alt-A",run:zl}].concat([{key:"ArrowLeft",run:va,shift:Na,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:t=>ba(t,!ya(t)),shift:t=>Ia(t,!ya(t)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:t=>ga(t,(e=>La(t,e,!ya(t)))),shift:t=>Ba(t,(e=>La(t,e,!ya(t)))),preventDefault:!0},{key:"ArrowRight",run:ka,shift:Ra,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t=>ba(t,ya(t)),shift:t=>Ia(t,ya(t)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:t=>ga(t,(e=>La(t,e,ya(t)))),shift:t=>Ba(t,(e=>La(t,e,ya(t)))),preventDefault:!0},{key:"ArrowUp",run:Ma,shift:za,preventDefault:!0},{mac:"Cmd-ArrowUp",run:qa,shift:$a},{mac:"Ctrl-ArrowUp",run:Da,shift:Fa},{key:"ArrowDown",run:Ta,shift:Wa,preventDefault:!0},{mac:"Cmd-ArrowDown",run:ja,shift:Ka},{mac:"Ctrl-ArrowDown",run:Ea,shift:_a},{key:"PageUp",run:Da,shift:Fa},{key:"PageDown",run:Ea,shift:_a},{key:"Home",run:t=>ga(t,(e=>La(t,e,!1))),shift:t=>Ba(t,(e=>La(t,e,!1))),preventDefault:!0},{key:"Mod-Home",run:qa,shift:$a},{key:"End",run:t=>ga(t,(e=>La(t,e,!0))),shift:t=>Ba(t,(e=>La(t,e,!0))),preventDefault:!0},{key:"Mod-End",run:ja,shift:Ka},{key:"Enter",run:sh},{key:"Mod-a",run:({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:Ya,shift:Ya},{key:"Delete",run:Xa},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Za},{key:"Mod-Delete",mac:"Alt-Delete",run:t=>Qa(t,!0)},{mac:"Mod-Backspace",run:t=>Ga(t,(e=>{let i=t.lineBlockAt(e).from;return e>i?i:Math.max(0,e-1)}))},{mac:"Mod-Delete",run:th}].concat([{key:"Ctrl-b",run:va,shift:Na,preventDefault:!0},{key:"Ctrl-f",run:ka,shift:Ra},{key:"Ctrl-p",run:Ma,shift:za},{key:"Ctrl-n",run:Ta,shift:Wa},{key:"Ctrl-a",run:t=>ga(t,(e=>B.cursor(t.lineBlockAt(e.head).from,1))),shift:t=>Ba(t,(e=>B.cursor(t.lineBlockAt(e.head).from)))},{key:"Ctrl-e",run:t=>ga(t,(e=>B.cursor(t.lineBlockAt(e.head).to,-1))),shift:t=>Ba(t,(e=>B.cursor(t.lineBlockAt(e.head).to)))},{key:"Ctrl-d",run:Xa},{key:"Ctrl-h",run:Ya},{key:"Ctrl-k",run:th},{key:"Ctrl-Alt-h",run:Za},{key:"Ctrl-o",run:({state:e,dispatch:i})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:t.of(["",""])},range:B.cursor(e.from)})));return i(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:t,dispatch:e})=>{if(t.readOnly)return!1;let i=t.changeByRange((e=>{if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};let i=e.from,n=t.doc.lineAt(i),s=i==n.from?i-1:d(n.text,i-n.from,!1)+n.from,r=i==n.to?i+1:d(n.text,i-n.from,!0)+n.from;return{changes:{from:s,to:r,insert:t.doc.slice(i,r).append(t.doc.slice(s,i))},range:B.cursor(r)}}));return!i.changes.empty&&(e(t.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:Ea}].map((t=>({mac:t.key,run:t.run,shift:t.shift})))));function ah(){var t=arguments[0];"string"==typeof t&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&"object"==typeof i&&null==i.nodeType&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var s=i[n];"string"==typeof s?t.setAttribute(n,s):null!=s&&(t[n]=s)}e++}for(;et.normalize("NFKD"):t=>t;class uh{constructor(t,e,i=0,n=t.length,s,r){this.test=r,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(i,n),this.bufferStart=i,this.normalize=s?t=>s(ch(t)):ch,this.query=this.normalize(e)}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 y(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=v(t),i=this.bufferStart+this.bufferPos;this.bufferPos+=k(t);let n=this.normalize(e);for(let t=0,s=i;;t++){let r=n.charCodeAt(t),o=this.match(r,s);if(t==n.length-1){if(o)return this.value=o,this;break}s==i&&tthis.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 t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let i=this.curLineStart+e.index,n=i+e[0].length;if(this.matchPos=yh(this.text,n+(i==n?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,n,e)))return this.value={from:i,to:n,match:e},this;t=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=i||n.to<=e){let n=new mh(e,t.sliceString(e,i));return gh.set(t,n),n}if(n.from==e&&n.to==i)return n;let{text:s,from:r}=n;return r>e&&(s=t.sliceString(e,r)+s,r=e),n.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let t=this.flat.from+e.index,i=t+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(t,i,e)))return this.value={from:t,to:i,match:e},this.matchPos=yh(this.text,i+(t==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=mh.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function yh(t,e){if(e>=t.length)return e;let i,n=t.lineAt(e);for(;e=56320&&i<57344;)e++;return e}function vh(t){let e=ah("input",{class:"cm-textfield",name:"line",value:String(t.state.doc.lineAt(t.state.selection.main.head).number)});function i(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(!i)return;let{state:n}=t,s=n.doc.lineAt(n.selection.main.head),[,r,o,l,a]=i,h=l?+l.slice(1):0,c=o?+o:s.number;if(o&&a){let t=c/100;r&&(t=t*("-"==r?-1:1)+s.number/n.doc.lines),c=Math.round(n.doc.lines*t)}else o&&r&&(c=c*("-"==r?-1:1)+s.number);let u=n.doc.line(Math.max(1,Math.min(n.doc.lines,c))),f=B.cursor(u.from+Math.max(0,Math.min(h,u.length)));t.dispatch({effects:[kh.of(!1),Es.scrollIntoView(f.from,{y:"center"})],selection:f}),t.focus()}return{dom:ah("form",{class:"cm-gotoLine",onkeydown:e=>{27==e.keyCode?(e.preventDefault(),t.dispatch({effects:kh.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),i())},onsubmit:t=>{t.preventDefault(),i()}},ah("label",t.state.phrase("Go to line"),": ",e)," ",ah("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(ph.prototype[Symbol.iterator]=wh.prototype[Symbol.iterator]=function(){return this});const kh=at.define(),bh=_.define({create:()=>!0,update(t,e){for(let i of e.effects)i.is(kh)&&(t=i.value);return t},provide:t=>Js.from(t,(t=>t?vh:null))}),xh=Es.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Sh=R.define({combine:t=>kt(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new Qh(t),scrollToMatch:t=>Es.scrollIntoView(t)})});class Ah{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,dh),!0}catch(t){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,((t,e)=>"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\"))}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new Lh(this):new Ch(this)}getCursor(t,e=0,i){let n=t.doc?t:vt.create({doc:t});return null==i&&(i=n.doc.length),this.regexp?Oh(this,n,e,i):Th(this,n,e,i)}}class Mh{constructor(t){this.spec=t}}function Th(t,e,i,n){return new uh(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:t=>t.toLowerCase(),t.wholeWord?function(t,e){return(i,n,s,r)=>((r>i||r+s.length=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let s=Th(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}}function Oh(t,e,i,n){return new ph(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(s=e.charCategorizer(e.selection.main.head),(t,e,i)=>!i[0].length||(s(Dh(i.input,i.index))!=mt.Word||s(Eh(i.input,i.index))!=mt.Word)&&(s(Eh(i.input,i.index+i[0].length))!=mt.Word||s(Dh(i.input,i.index+i[0].length))!=mt.Word)):void 0},i,n);var s}function Dh(t,e){return t.slice(d(t,e,!1),e)}function Eh(t,e){return t.slice(e,d(t,e))}class Lh extends Mh{nextMatch(t,e,i){let n=Oh(this.spec,t,i,t.doc.length).next();return n.done&&(n=Oh(this.spec,t,0,e).next()),n.done?null:n.value}prevMatchInRange(t,e,i){for(let n=1;;n++){let s=Math.max(e,i-1e4*n),r=Oh(this.spec,t,s,i),o=null;for(;!r.next().done;)o=r.value;if(o&&(s==e||o.from>s+10))return o;if(s==e)return null}}prevMatch(t,e,i){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,i,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,((e,i)=>"$"==i?"$":"&"==i?t.match[0]:"0"!=i&&+i=e)return null;n.push(i.value)}return n}highlight(t,e,i,n){let s=Oh(this.spec,t,Math.max(0,e-250),Math.min(i+250,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}}const Bh=at.define(),Ph=at.define(),Nh=_.define({create:t=>new Rh(Kh(t).create(),null),update(t,e){for(let i of e.effects)i.is(Bh)?t=new Rh(i.value.create(),t.panel):i.is(Ph)&&(t=new Rh(t.query,i.value?$h:null));return t},provide:t=>Js.from(t,(t=>t.panel))});class Rh{constructor(t,e){this.query=t,this.panel=e}}const Ih=Ge.mark({class:"cm-searchMatch"}),Hh=Ge.mark({class:"cm-searchMatch cm-searchMatch-selected"}),zh=vi.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(Nh))}update(t){let e=t.state.field(Nh);(e!=t.startState.field(Nh)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return Ge.none;let{view:i}=this,n=new Tt;for(let e=0,s=i.visibleRanges,r=s.length;es[e+1].from-500;)l=s[++e].to;t.highlight(i.state,o,l,((t,e)=>{let s=i.state.selection.ranges.some((i=>i.from==t&&i.to==e));n.add(t,e,s?Hh:Ih)}))}return n.finish()}},{decorations:t=>t.decorations});function Wh(t){return e=>{let i=e.state.field(Nh,!1);return i&&i.query.spec.valid?t(e,i):Jh(e)}}const Vh=Wh(((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let s=B.single(n.from,n.to),r=t.state.facet(Sh);return t.dispatch({selection:s,effects:[ic(t,n),r.scrollToMatch(s.main,t)],userEvent:"select.search"}),Uh(t),!0})),Fh=Wh(((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,s=e.prevMatch(i,n,n);if(!s)return!1;let r=B.single(s.from,s.to),o=t.state.facet(Sh);return t.dispatch({selection:r,effects:[ic(t,s),o.scrollToMatch(r.main,t)],userEvent:"select.search"}),Uh(t),!0})),_h=Wh(((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!(!i||!i.length||(t.dispatch({selection:B.create(i.map((t=>B.range(t.from,t.to)))),userEvent:"select.search.matches"}),0))})),qh=Wh(((t,{query:e})=>{let{state:i}=t,{from:n,to:s}=i.selection.main;if(i.readOnly)return!1;let r=e.nextMatch(i,n,n);if(!r)return!1;let o,l,a=[],h=[];if(r.from==n&&r.to==s&&(l=i.toText(e.getReplacement(r)),a.push({from:r.from,to:r.to,insert:l}),r=e.nextMatch(i,r.from,r.to),h.push(Es.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(n).number)+"."))),r){let e=0==a.length||a[0].from>=r.to?0:r.to-r.from-l.length;o=B.single(r.from-e,r.to-e),h.push(ic(t,r)),h.push(i.facet(Sh).scrollToMatch(o.main,t))}return t.dispatch({changes:a,selection:o,effects:h,userEvent:"input.replace"}),!0})),jh=Wh(((t,{query:e})=>{if(t.state.readOnly)return!1;let i=e.matchAll(t.state,1e9).map((t=>{let{from:i,to:n}=t;return{from:i,to:n,insert:e.getReplacement(t)}}));if(!i.length)return!1;let n=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:Es.announce.of(n),userEvent:"input.replace.all"}),!0}));function $h(t){return t.state.facet(Sh).createPanel(t)}function Kh(t,e){var i,n,s,r,o;let l=t.selection.main,a=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=t.facet(Sh);return new Ah({search:(null!==(i=null==e?void 0:e.literal)&&void 0!==i?i:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(n=null==e?void 0:e.caseSensitive)&&void 0!==n?n:h.caseSensitive,literal:null!==(s=null==e?void 0:e.literal)&&void 0!==s?s:h.literal,regexp:null!==(r=null==e?void 0:e.regexp)&&void 0!==r?r:h.regexp,wholeWord:null!==(o=null==e?void 0:e.wholeWord)&&void 0!==o?o:h.wholeWord})}function Gh(t){let e=$s(t,$h);return e&&e.dom.querySelector("[main-field]")}function Uh(t){let e=Gh(t);e&&e==t.root.activeElement&&e.select()}const Jh=t=>{let e=t.state.field(Nh,!1);if(e&&e.panel){let i=Gh(t);if(i&&i!=t.root.activeElement){let n=Kh(t.state,e.query.spec);n.valid&&t.dispatch({effects:Bh.of(n)}),i.focus(),i.select()}}else t.dispatch({effects:[Ph.of(!0),e?Bh.of(Kh(t.state,e.query.spec)):at.appendConfig.of(sc)]});return!0},Yh=t=>{let e=t.state.field(Nh,!1);if(!e||!e.panel)return!1;let i=$s(t,$h);return i&&i.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Ph.of(!1)}),!0},Xh=[{key:"Mod-f",run:Jh,scope:"editor search-panel"},{key:"F3",run:Vh,shift:Fh,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Vh,shift:Fh,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Yh,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:t,dispatch:e})=>{let i=t.selection;if(i.ranges.length>1||i.main.empty)return!1;let{from:n,to:s}=i.main,r=[],o=0;for(let e=new uh(t.doc,t.sliceDoc(n,s));!e.next().done;){if(r.length>1e3)return!1;e.value.from==n&&(o=r.length),r.push(B.range(e.value.from,e.value.to))}return e(t.update({selection:B.create(r,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:t=>{let e=$s(t,vh);if(!e){let i=[kh.of(!0)];null==t.state.field(bh,!1)&&i.push(at.appendConfig.of([bh,xh])),t.dispatch({effects:i}),e=$s(t,vh)}return e&&e.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:({state:t,dispatch:e})=>{let{ranges:i}=t.selection;if(i.some((t=>t.from===t.to)))return(({state:t,dispatch:e})=>{let{selection:i}=t,n=B.create(i.ranges.map((e=>t.wordAt(e.head)||B.cursor(e.head))),i.mainIndex);return!n.eq(i)&&(e(t.update({selection:n})),!0)})({state:t,dispatch:e});let n=t.sliceDoc(i[0].from,i[0].to);if(t.selection.ranges.some((e=>t.sliceDoc(e.from,e.to)!=n)))return!1;let s=function(t,e){let{main:i,ranges:n}=t.selection,s=t.wordAt(i.head),r=s&&s.from==i.from&&s.to==i.to;for(let i=!1,s=new uh(t.doc,e,n[n.length-1].to);;){if(s.next(),!s.done){if(i&&n.some((t=>t.from==s.value.from)))continue;if(r){let e=t.wordAt(s.value.from);if(!e||e.from!=s.value.from||e.to!=s.value.to)continue}return s.value}if(i)return null;s=new uh(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),i=!0}}(t,n);return!!s&&(e(t.update({selection:t.selection.addRange(B.range(s.from,s.to),!1),effects:Es.scrollIntoView(s.to)})),!0)},preventDefault:!0}];class Qh{constructor(t){this.view=t;let e=this.query=t.state.field(Nh).query.spec;function i(t,e,i){return ah("button",{class:"cm-button",name:t,onclick:e,type:"button"},i)}this.commit=this.commit.bind(this),this.searchField=ah("input",{value:e.search,placeholder:Zh(t,"Find"),"aria-label":Zh(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ah("input",{value:e.replace,placeholder:Zh(t,"Replace"),"aria-label":Zh(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ah("input",{type:"checkbox",name:"case",form:"",checked:e.caseSensitive,onchange:this.commit}),this.reField=ah("input",{type:"checkbox",name:"re",form:"",checked:e.regexp,onchange:this.commit}),this.wordField=ah("input",{type:"checkbox",name:"word",form:"",checked:e.wholeWord,onchange:this.commit}),this.dom=ah("div",{onkeydown:t=>this.keydown(t),class:"cm-search"},[this.searchField,i("next",(()=>Vh(t)),[Zh(t,"next")]),i("prev",(()=>Fh(t)),[Zh(t,"previous")]),i("select",(()=>_h(t)),[Zh(t,"all")]),ah("label",null,[this.caseField,Zh(t,"match case")]),ah("label",null,[this.reField,Zh(t,"regexp")]),ah("label",null,[this.wordField,Zh(t,"by word")]),...t.state.readOnly?[]:[ah("br"),this.replaceField,i("replace",(()=>qh(t)),[Zh(t,"replace")]),i("replaceAll",(()=>jh(t)),[Zh(t,"replace all")])],ah("button",{name:"close",onclick:()=>Yh(t),"aria-label":Zh(t,"close"),type:"button"},["×"])])}commit(){let t=new Ah({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:Bh.of(t)}))}keydown(t){var e,i;i=t,qs(Vs((e=this.view).state),i,e,"search-panel")?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?Fh:Vh)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),qh(this.view))}update(t){for(let e of t.transactions)for(let t of e.effects)t.is(Bh)&&!t.value.eq(this.query)&&this.setQuery(t.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Sh).top}}function Zh(t,e){return t.state.phrase(e)}const tc=30,ec=/[\s\.,:;?!]/;function ic(t,{from:e,to:i}){let n=t.state.doc.lineAt(e),s=t.state.doc.lineAt(i).to,r=Math.max(n.from,e-tc),o=Math.min(s,i+tc),l=t.state.sliceDoc(r,o);if(r!=n.from)for(let t=0;tl.length-tc;t--)if(!ec.test(l[t-1])&&ec.test(l[t])){l=l.slice(0,t);break}return Es.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${n.number}.`)}const nc=Es.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),sc=[Nh,j.low(zh),nc];function rc(t){return rc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rc(t)}function oc(t){return function(t){if(Array.isArray(t))return lc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return lc(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?lc(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lc(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0,n}var i,n;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&pc(t,e)}(e,t),i=e,(n=[{key:"setCodeMirrorPreference",value:function(t){this.useCodeMirror=t,fc(dc(e.prototype),"setCodeMirrorPreference",this).call(this,t)}},{key:"enableCodeMirror",value:function(){var t=this;if(!this.view){var e=this.$textarea.prop("selectionStart"),i=this.$textarea.prop("selectionEnd"),n=this.$textarea.scrollTop(),s=this.$textarea.is(":focus"),r=[].concat(oc(this.defaultExtensions),[this.langExtension,ul(),Jl(),Es.contentAttributes.of({spellcheck:"true"}),Es.domEventHandlers({blur:function(){return t.$textarea.triggerHandler("blur")},focus:function(){return t.$textarea.triggerHandler("focus")}}),Es.updateListener.of((function(e){e.docChanged&&"function"==typeof t.editRecoveryHandler&&t.editRecoveryHandler()})),Es.lineWrapping,zs.of([].concat(oc(lh),oc(Xh),oc(fa)))]);mw.hook("editRecovery.loadEnd").add((function(e){t.editRecoveryHandler=e.fieldChangeHandler})),this.initialize(r),this.view.scrollDOM.scrollTop=n,this.view.dispatch({selection:B.create([B.range(e,i)]),scrollIntoView:!0}),s&&this.view.focus(),mw.hook("ext.CodeMirror.switch").fire(!0,$(this.view.dom))}}},{key:"addCodeMirrorToWikiEditor",value:function(){var t=this,e=this.$textarea.data("wikiEditor-context"),i=e&&e.modules&&e.modules.toolbar;i&&(this.$textarea.wikiEditor("addToToolbar",{section:"main",groups:{codemirror:{tools:{CodeMirror:{label:mw.msg("codemirror-toggle-label"),type:"toggle",oouiIcon:"highlight",action:{type:"callback",execute:function(){return t.switchCodeMirror()}}}}}}}),i.$toolbar.find(".tool[rel=CodeMirror]").attr("id","mw-editbutton-codemirror"),this.useCodeMirror&&this.enableCodeMirror(),this.updateToolbarButton(),this.logUsage({editor:"wikitext",enabled:this.useCodeMirror,toggled:!1,edit_start_ts_ms:1e3*parseInt($('input[name="wpStarttime"]').val(),10)||0}))}},{key:"updateToolbarButton",value:function(){var t=$("#mw-editbutton-codemirror");t.toggleClass("mw-editbutton-codemirror-active",this.useCodeMirror),t.data("setActive")&&t.data("setActive")(this.useCodeMirror)}},{key:"switchCodeMirror",value:function(){if(this.view){this.setCodeMirrorPreference(!1);var t=this.view.scrollDOM.scrollTop,e=this.view.hasFocus,i=this.view.state.selection.ranges[0],n=i.from,s=i.to;$(this.view.dom).textSelection("unregister"),this.$textarea.textSelection("unregister"),this.$textarea.val(this.view.state.doc.toString()),this.view.destroy(),this.view=null,this.$textarea.show(),e&&this.$textarea.trigger("focus"),this.$textarea.prop("selectionStart",Math.min(n,s)).prop("selectionEnd",Math.max(s,n)),this.$textarea.scrollTop(t),mw.hook("ext.CodeMirror.switch").fire(!1,this.$textarea)}else this.enableCodeMirror(),this.setCodeMirrorPreference(!0);this.updateToolbarButton(),this.logUsage({editor:"wikitext",enabled:this.useCodeMirror,toggled:!0,edit_start_ts_ms:1e3*parseInt($('input[name="wpStarttime"]').val(),10)||0})}}])&&ac(i.prototype,n),Object.defineProperty(i,"prototype",{writable:!1}),e}(mr);function mc(t){return mc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mc(t)}function wc(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i~).,'])"),"i"),this.isBold=!1,this.wasBold=!1,this.isItalic=!1,this.wasItalic=!1,this.firstSingleLetterWord=null,this.firstMultiLetterWord=null,this.firstSpace=null,this.oldStyle=null,this.tokens=[],this.oldTokens=[],this.tokenTable=Mc.tokenTable,Object.keys(this.config.tags).forEach((function(t){return Mc.addTag(t)}))}var e,i;return e=t,i=[{key:"eatHtmlEntity",value:function(t,e){return(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w.\-:]/)&&t.eat(";"))?Mc.tags.htmlEntity:e}},{key:"makeStyle",value:function(t,e,i){return this.isBold&&(t+=" "+Mc.tags.strong),this.isItalic&&(t+=" "+Mc.tags.em),this.makeLocalStyle(t,e,i)}},{key:"makeLocalStyle",value:function(t,e,i){var n="";switch(e.nTemplate){case 0:break;case 1:n+="-template";break;case 2:n+="-template2";break;default:n+="-template3"}switch(e.nExt){case 0:break;case 1:n+="-ext";break;case 2:n+="-ext2";break;default:n+="-ext3"}return e.nLink>0&&(n+="-link"),""!==n&&(t="mw".concat(n,"-ground ").concat(t)),i&&e[i]--,t.trim()}},{key:"eatBlock",value:function(t,e,i){var n=this;return function(s,r){return s.skipTo(e)?(!1!==i&&s.match(e),r.tokenize=r.stack.pop()):s.skipToEnd(),n.makeLocalStyle(t,r)}}},{key:"eatEnd",value:function(t){var e=this;return function(i,n){return i.skipToEnd(),n.tokenize=n.stack.pop(),e.makeLocalStyle(t,n)}}},{key:"eatChar",value:function(t,e){var i=this;return function(n,s){return s.tokenize=s.stack.pop(),n.eat(t)?i.makeLocalStyle(e,s):i.makeLocalStyle(Mc.tags.error,s)}}},{key:"eatSectionHeader",value:function(t){var e=this;return function(i,n){return i.match(/^[^&<[{~]+/)?(i.eol()?(i.backUp(t),n.tokenize=e.eatEnd(Mc.tags.sectionHeader)):i.match(/^.*?=)/,!1)&&(i.backUp(t),n.tokenize=e.eatBlock(Mc.tags.sectionHeader,"\x3c!--",!1)),Mc.tags.section):e.eatWikiText(Mc.tags.section)(i,n)}}},{key:"inVariable",value:function(t,e){return t.match(/^[^{}|]+/)?this.makeLocalStyle(Mc.tags.templateVariableName,e):t.eat("|")?(e.tokenize=this.inVariableDefault.bind(this),this.makeLocalStyle(Mc.tags.templateVariableDelimiter,e)):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.templateVariableBracket,e)):t.match("{{{")?(e.stack.push(e.tokenize),this.makeLocalStyle(Mc.tags.templateVariableBracket,e)):(t.next(),this.makeLocalStyle(Mc.tags.templateVariableName,e))}},{key:"inVariableDefault",value:function(t,e){return t.match(/^[^{}[<&~]+/)?this.makeLocalStyle(Mc.tags.templateVariable,e):t.match("}}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.templateVariableBracket,e)):this.eatWikiText(Mc.tags.templateVariable)(t,e)}},{key:"inParserFunctionName",value:function(t,e){return t.match(/^#?[^:}{~]+/)?this.makeLocalStyle(Mc.tags.parserFunctionName,e):t.eat(":")?(e.tokenize=this.inParserFunctionArguments.bind(this),this.makeLocalStyle(Mc.tags.parserFunctionDelimiter,e)):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(Mc.tags.parserFunction)(t,e)}},{key:"inParserFunctionArguments",value:function(t,e){return t.match(/^[^|}{[<&~]+/)?this.makeLocalStyle(Mc.tags.parserFunction,e):t.eat("|")?this.makeLocalStyle(Mc.tags.parserFunctionDelimiter,e):t.match("}}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.parserFunctionBracket,e,"nExt")):this.eatWikiText(Mc.tags.parserFunction)(t,e)}},{key:"eatTemplatePageName",value:function(t){var e=this;return function(i,n){return i.match(/^[\s\u00a0]*\|[\s\u00a0]*/)?(n.tokenize=e.eatTemplateArgument(!0),e.makeLocalStyle(Mc.tags.templateDelimiter,n)):i.match(/^[\s\u00a0]*\}\}/)?(n.tokenize=n.stack.pop(),e.makeLocalStyle(Mc.tags.templateBracket,n,"nTemplate")):i.match(/^[\s\u00a0]*/)?e.makeLocalStyle(Mc.tags.comment,n):t&&i.sol()?(n.nTemplate--,void(n.tokenize=n.stack.pop())):i.match(/^[\s\u00a0]*[^\s\u00a0|}<{&~]+/)?(n.tokenize=e.eatTemplatePageName(!0),e.makeLocalStyle(Mc.tags.templateName,n)):i.eatSpace()?(i.eol(),e.makeLocalStyle(Mc.tags.templateName,n)):e.eatWikiText(Mc.tags.templateName)(i,n)}}},{key:"eatTemplateArgument",value:function(t){var e=this;return function(i,n){return t&&i.eatWhile(/[^=|}{[<&~]/)?i.eat("=")?(n.tokenize=e.eatTemplateArgument(!1),e.makeLocalStyle(Mc.tags.templateArgumentName,n)):e.makeLocalStyle(Mc.tags.template,n):i.eatWhile(/[^|}{[<&~]/)?e.makeLocalStyle(Mc.tags.template,n):i.eat("|")?(n.tokenize=e.eatTemplateArgument(!0),e.makeLocalStyle(Mc.tags.templateDelimiter,n)):i.match("}}")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(Mc.tags.templateBracket,n,"nTemplate")):e.eatWikiText(Mc.tags.template)(i,n)}}},{key:"eatExternalLinkProtocol",value:function(t){var e=this;return function(i,n){for(;t>0;)t--,i.next();return i.eol()?(n.nLink--,n.tokenize=n.stack.pop()):n.tokenize=e.inExternalLink.bind(e),e.makeLocalStyle(Mc.tags.extLinkProtocol,n)}}},{key:"inExternalLink",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[\s\u00a0]*\]/)?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.extLinkBracket,e,"nLink")):t.eatSpace()?(e.tokenize=this.inExternalLinkText.bind(this),this.makeStyle("",e)):t.match(/^[^\s\u00a0\]{&~']+/)||t.eatSpace()?("'"===t.peek()&&(t.match("''",!1)?e.tokenize=this.inExternalLinkText.bind(this):t.next()),this.makeStyle(Mc.tags.extLink,e)):this.eatWikiText(Mc.tags.extLink)(t,e)}},{key:"inExternalLinkText",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.eat("]")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.extLinkBracket,e,"nLink")):t.match(/^[^'\]{&~<]+/)?this.makeStyle(Mc.tags.extLinkText,e):this.eatWikiText(Mc.tags.extLinkText)(t,e)}},{key:"inLink",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[\s\u00a0]*#[\s\u00a0]*/)?(e.tokenize=this.inLinkToSection.bind(this),this.makeLocalStyle(Mc.tags.link,e)):t.match(/^[\s\u00a0]*\|[\s\u00a0]*/)?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(Mc.tags.linkDelimiter,e)):t.match(/^[\s\u00a0]*\]\]/)?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.linkBracket,e,"nLink")):t.match(/^[\s\u00a0]*[^\s\u00a0#|\]&~{]+/)||t.eatSpace()?this.makeStyle("".concat(Mc.tags.linkPageName," ").concat(Mc.tags.pageName),e):this.eatWikiText("".concat(Mc.tags.linkPageName," ").concat(Mc.tags.pageName))(t,e)}},{key:"inLinkToSection",value:function(t,e){return t.sol()?(e.nLink--,void(e.tokenize=e.stack.pop())):t.match(/^[^|\]&~{}]+/)?this.makeLocalStyle(Mc.tags.linkToSection,e):t.eat("|")?(e.tokenize=this.eatLinkText(),this.makeLocalStyle(Mc.tags.linkDelimiter,e)):t.match("]]")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.linkBracket,e,"nLink")):this.eatWikiText(Mc.tags.linkToSection)(t,e)}},{key:"eatLinkText",value:function(){var t,e,i=this;return function(n,s){var r;return n.match("]]")?(s.tokenize=s.stack.pop(),i.makeLocalStyle(Mc.tags.linkBracket,s,"nLink")):n.match("'''")?(t=!t,i.makeLocalStyle("".concat(Mc.tags.linkText," ").concat(Mc.tags.apostrophes),s)):n.match("''")?(e=!e,i.makeLocalStyle("".concat(Mc.tags.linkText," ").concat(Mc.tags.apostrophes),s)):(r=Mc.tags.linkText,t&&(r+=" "+Mc.tags.strong),e&&(r+=" "+Mc.tags.em),n.match(/^[^'\]{&~<]+/)?i.makeStyle(r,s):i.eatWikiText(r)(n,s))}}},{key:"eatTagName",value:function(t,e,i){var n=this;return function(s,r){for(var o="";t>0;)t--,o+=s.next();return s.eatSpace(),o=o.toLowerCase(),i?(e&&!Mc.implicitlyClosedHtmlTags[o]?r.tokenize=n.eatChar(">",Mc.tags.htmlTagBracket):r.tokenize=n.eatHtmlTagAttribute(o),n.makeLocalStyle(Mc.tags.htmlTagName,r)):(r.tokenize=e?n.eatChar(">","".concat(Mc.tags.extTagBracket," mw-ext-").concat(o)):n.eatExtTagAttribute(o),n.makeLocalStyle("".concat(Mc.tags.extTagName," mw-ext-").concat(o),r))}}},{key:"eatHtmlTagAttribute",value:function(t){var e=this;return function(i,n){return i.match(/^(?:"[^<">]*"|'[^<'>]*'|[^>/<{&~])+/)?e.makeLocalStyle(Mc.tags.htmlTagAttribute,n):i.eat(">")?(t in Mc.implicitlyClosedHtmlTags||n.inHtmlTag.push(t),n.tokenize=n.stack.pop(),e.makeLocalStyle(Mc.tags.htmlTagBracket,n)):i.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle(Mc.tags.htmlTagBracket,n)):e.eatWikiText(Mc.tags.htmlTagAttribute)(i,n)}}},{key:"eatNowiki",value:function(){var t=this;return function(e){return e.match(/^[^&]+/)?"":(e.next(),t.eatHtmlEntity(e,""))}}},{key:"eatExtTagAttribute",value:function(t){var e=this;return function(i,n){if(i.match(/^(?:"[^">]*"|'[^'>]*'|[^>/<{&~])+/))return e.makeLocalStyle("".concat(Mc.tags.extTagAttribute," mw-ext-").concat(t),n);if(i.eat(">")){if(n.extName=t,"nowiki"===t||"pre"===t)n.extMode={startState:function(){},copyState:function(){},token:e.eatNowiki()};else if(t in e.config.tagModes){var s=e.config.tagModes[t];"mediawiki"!==s&&"text/mediawiki"!==s||(n.extMode=e.mediawiki,n.extState=n.extMode.startState())}return n.tokenize=e.eatExtTagArea(t),e.makeLocalStyle("".concat(Mc.tags.extTagBracket," mw-ext-").concat(t),n)}return i.match("/>")?(n.tokenize=n.stack.pop(),e.makeLocalStyle("".concat(Mc.tags.extTagBracket," mw-ext-").concat(t),n)):e.eatWikiText("".concat(Mc.tags.extTagAttribute," mw-ext-").concat(t))(i,n)}}},{key:"eatExtTagArea",value:function(t){var e=this;return function(i,n){var s,r=i.pos,o=new RegExp(""),"i").exec(r?i.string.slice(r):i.string),l=!1;if(o){if(0===o.index)return n.tokenize=e.eatExtCloseTag(t),n.extName=!1,!1!==n.extMode&&(n.extMode=!1,n.extState=!1),n.tokenize(i,n);s=o.index+r,l=i.string,i.string=l.slice(0,s)}return n.stack.push(n.tokenize),n.tokenize=e.eatExtTokens(l),n.tokenize(i,n)}}},{key:"eatExtCloseTag",value:function(t){var e=this;return function(i,n){return i.next(),i.next(),n.tokenize=e.eatTagName(t.length,!0,!1),e.makeLocalStyle("".concat(Mc.tags.extTagBracket," mw-ext-").concat(t),n)}}},{key:"eatExtTokens",value:function(t){var e=this;return function(i,n){var s;return!1===n.extMode?(s=Mc.tags.extTag,i.skipToEnd()):s="mw-tag-".concat(n.extName," ")+n.extMode.token(i,n.extState,!1===t),i.eol()&&(!1!==t&&(i.string=t),n.tokenize=n.stack.pop()),e.makeLocalStyle(s,n)}}},{key:"eatStartTable",value:function(t,e){return t.match("{|"),t.eatSpace(),e.tokenize=this.inTableDefinition.bind(this),Mc.tags.tableBracket}},{key:"inTableDefinition",value:function(t,e){return t.sol()?(e.tokenize=this.inTable.bind(this),this.inTable(t,e)):this.eatWikiText(Mc.tags.tableDefinition)(t,e)}},{key:"inTable",value:function(t,e){if(t.sol()){if(t.eatSpace(),t.eat("|"))return t.eat("-")?(t.eatSpace(),e.tokenize=this.inTableDefinition.bind(this),this.makeLocalStyle(Mc.tags.tableDelimiter,e)):t.eat("+")?(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1,!0),this.makeLocalStyle(Mc.tags.tableDelimiter,e)):t.eat("}")?(e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.tableBracket,e)):(t.eatSpace(),e.tokenize=this.eatTableRow(!0,!1),this.makeLocalStyle(Mc.tags.tableDelimiter,e));if(t.eat("!"))return t.eatSpace(),e.tokenize=this.eatTableRow(!0,!0),this.makeLocalStyle(Mc.tags.tableDelimiter,e)}return this.eatWikiText("")(t,e)}},{key:"eatTableRow",value:function(t,e,i){var n=this,s="";return i?s=Mc.tags.tableCaption:e&&(s=Mc.tags.strong),function(r,o){if(r.sol()){if(r.match(/^[\s\u00a0]*[|!]/,!1))return o.tokenize=n.inTable.bind(n),n.inTable(r,o)}else{if(r.match(/^[^'|{[<&~!]+/))return n.makeStyle(s,o);if(r.match("||")||e&&r.match("!!"))return n.isBold=!1,n.isItalic=!1,o.tokenize=n.eatTableRow(!0,e,i),n.makeLocalStyle(Mc.tags.tableDelimiter,o);if(t&&r.eat("|"))return o.tokenize=n.eatTableRow(!1,e,i),n.makeLocalStyle(Mc.tags.tableDelimiter,o)}return n.eatWikiText(s)(r,o)}}},{key:"eatFreeExternalLinkProtocol",value:function(t,e){return t.match(this.urlProtocols),e.tokenize=this.eatFreeExternalLink.bind(this),this.makeLocalStyle(Mc.tags.freeExtLinkProtocol,e)}},{key:"eatFreeExternalLink",value:function(t,e){if(t.eol());else if(t.match(/^[^\s\u00a0{[\]<>~).,']*/))if("~"===t.peek()){if(!t.match(/^~~~+/,!1))return t.match(/^~*/),this.makeLocalStyle(Mc.tags.freeExtLink,e)}else if("{"===t.peek()){if(!t.match("{{",!1))return t.next(),this.makeLocalStyle(Mc.tags.freeExtLink,e)}else if("'"===t.peek()){if(!t.match("''",!1))return t.next(),this.makeLocalStyle(Mc.tags.freeExtLink,e)}else if(t.match(/^[).,]+(?=[^\s\u00a0{[\]<>~).,])/))return this.makeLocalStyle(Mc.tags.freeExtLink,e);return e.tokenize=e.stack.pop(),this.makeLocalStyle(Mc.tags.freeExtLink,e)}},{key:"eatWikiText",value:function(t){var e=this;return function(i,n){var s,r,o,l,a,h,c;if(i.sol()){if(!i.match("//",!1)&&i.match(e.urlProtocols))return n.stack.push(n.tokenize),n.tokenize=e.eatFreeExternalLink.bind(e),e.makeLocalStyle(Mc.tags.freeExtLinkProtocol,n);switch(s=i.next()){case"-":if(i.match(/^---+/))return Mc.tags.hr;break;case"=":if(r=i.match(/^(={0,5})(.+?(=\1\s*)(.*\S).*?)?)$/))return i.backUp(r[2].length),n.stack.push(n.tokenize),n.tokenize=e.eatSectionHeader(r[3].length),Mc.tags.sectionHeader+" "+Mc.tags["sectionHeader".concat(r[1].length+1)];break;case"*":case"#":case";":return i.match(/^[*#;:]*/),Mc.tags.list;case":":return i.match(/^:*{\|/,!1)&&(n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e)),i.match(/^[*#;:]*/),Mc.tags.indenting;case" ":if(!i.match(/^[\s\u00a0]*:*{\|/,!1))return Mc.tags.skipFormatting;if(i.eatSpace(),i.match(/^:+/))return n.stack.push(n.tokenize),n.tokenize=e.eatStartTable.bind(e),Mc.tags.indenting;i.eat("{");case"{":if(i.eat("|"))return i.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inTableDefinition.bind(e),Mc.tags.tableBracket}}else s=i.next();switch(s){case"&":return e.makeStyle(e.eatHtmlEntity(i,t),n);case"'":if(i.match(/^'*(?=''''')/)||i.match(/^'''(?!')/,!1))break;if(i.match("''"))return e.firstSingleLetterWord||i.match("''",!1)||e.prepareItalicForCorrection(i),e.isBold=!e.isBold,e.makeLocalStyle(Mc.tags.apostrophesBold,n);if(i.eat("'"))return e.isItalic=!e.isItalic,e.makeLocalStyle(Mc.tags.apostrophesItalic,n);break;case"[":if(i.eat("[")){if(i.eatSpace(),/[^\]|[]/.test(i.peek()))return n.nLink++,n.stack.push(n.tokenize),n.tokenize=e.inLink.bind(e),e.makeLocalStyle(Mc.tags.linkBracket,n)}else if(o=i.match(e.urlProtocols))return n.nLink++,i.backUp(o[0].length),n.stack.push(n.tokenize),n.tokenize=e.eatExternalLinkProtocol(o[0].length),e.makeLocalStyle(Mc.tags.extLinkBracket,n);break;case"{":if(i.match(/^{{(?!{|[^{}]*}}(?!}))/))return i.eatSpace(),n.stack.push(n.tokenize),n.tokenize=e.inVariable.bind(e),e.makeLocalStyle(Mc.tags.templateVariableBracket,n);if(i.match(/^{(?!{(?!{))[\s\u00a0]*/))return"#"===i.peek()?(n.nExt++,n.stack.push(n.tokenize),n.tokenize=e.inParserFunctionName.bind(e),e.makeLocalStyle(Mc.tags.parserFunctionBracket,n)):!(l=i.match(/^([^\s\u00a0}[\]<{'|&:]+)(:|[\s\u00a0]*)(\}\}?)?(.)?/))||(i.backUp(l[0].length),":"!==l[2]&&void 0!==l[4]&&"}}"!==l[3]||!(l[1].toLowerCase()in e.config.functionSynonyms[0])&&!(l[1]in e.config.functionSynonyms[1]))?(n.nTemplate++,n.stack.push(n.tokenize),n.tokenize=e.eatTemplatePageName(!1),e.makeLocalStyle(Mc.tags.templateBracket,n)):(n.nExt++,n.stack.push(n.tokenize),n.tokenize=e.inParserFunctionName.bind(e),e.makeLocalStyle(Mc.tags.parserFunctionBracket,n));break;case"<":if(a=!!i.eat("/"),h=i.match(/^[^>/\s\u00a0.*,[\]{}$^+?|/\\'`~<=!@#%&()-]+/),i.match("!--"))return c=e.eatBlock(Mc.tags.comment,"--\x3e"),n.stack.push(n.tokenize),n.tokenize=c,c(i,n);if(h){if((h=h[0].toLowerCase())in e.config.tags)return!0===a?Mc.tags.error:(i.backUp(h.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(h.length,a,!1),e.makeLocalStyle("".concat(Mc.tags.extTagBracket," mw-ext-").concat(h),n));if(h in Mc.permittedHtmlTags)return!0===a&&h!==n.inHtmlTag.pop()?(i.pos++,Mc.tags.error):!0===a&&h in Mc.implicitlyClosedHtmlTags?Mc.tags.error:(i.backUp(h.length),n.stack.push(n.tokenize),n.tokenize=e.eatTagName(h.length,a||h in Mc.implicitlyClosedHtmlTags,!0),e.makeLocalStyle(Mc.tags.htmlTagBracket,n));i.backUp(h.length)}break;case"~":if(i.match(/^~{2,4}/))return Mc.tags.signature;break;case"_":for(r=1;i.eat("_");)r++;if(r>2)return i.eol()||i.backUp(2),e.makeStyle(t,n);if(2===r&&(l=i.match(/^([^\s\u00a0>}[\]<{'|&:~]+?)__/))&&l[0])return"__"+l[0].toLowerCase()in e.config.doubleUnderscore[0]||"__"+l[0]in e.config.doubleUnderscore[1]?Mc.tags.doubleUnderscore:(i.eol()||i.backUp(2),e.makeStyle(t,n));break;default:if(/[\s\u00a0]/.test(s)&&(i.eatSpace(),i.match(e.urlProtocols,!1)&&!i.match("//")))return n.stack.push(n.tokenize),n.tokenize=e.eatFreeExternalLinkProtocol.bind(e),e.makeStyle(t,n)}return i.match(/^[^\s\u00a0_>}[\]<{'|&:~=]+/),e.makeStyle(t,n)}}},{key:"prepareItalicForCorrection",value:function(t){var e=t.pos,i=t.string.slice(0,e-3),n=i.slice(-1),s=i.slice(-2,-1);if(" "===n){if(this.firstMultiLetterWord||this.firstSpace)return;this.firstSpace=e}else if(" "===s)this.firstSingleLetterWord=e;else{if(this.firstMultiLetterWord)return;this.firstMultiLetterWord=e}this.wasBold=this.isBold,this.wasItalic=this.isItalic}},{key:"mediawiki",get:function(){var t=this;return{name:"mediawiki",startState:function(){return{tokenize:t.eatWikiText(""),stack:[],inHtmlTag:[],extName:!1,extMode:!1,extState:!1,nTemplate:0,nLink:0,nExt:0}},copyState:function(t){return{tokenize:t.tokenize,stack:t.stack.concat([]),inHtmlTag:t.inHtmlTag.concat([]),extName:t.extName,extMode:t.extMode,extState:!1!==t.extMode&&t.extMode.copyState(t.extState),nTemplate:t.nTemplate,nLink:t.nLink,nExt:t.nExt}},token:function(e,i){var n,s,r,o,l=[],a=[];if(t.oldTokens.length>0)return r=t.oldTokens.shift(),e.pos=r.pos,i=r.state,r.style;e.sol()&&(t.isBold=!1,t.isItalic=!1,t.firstSingleLetterWord=null,t.firstMultiLetterWord=null,t.firstSpace=null);do{if(n=i.tokenize(e,i),!(o=t.firstSingleLetterWord||t.firstMultiLetterWord||t.firstSpace))return t.oldStyle=n,n;o!==s&&(s=o,a.length>0&&(l=l.concat(a),a=[])),a.push({pos:e.pos,style:n,state:(i.extMode||t.mediawiki).copyState(i)})}while(!e.eol());if(t.isBold&&t.isItalic){if(t.isItalic=t.wasItalic,t.isBold=t.wasBold,t.firstSingleLetterWord=null,t.firstMultiLetterWord=null,t.firstSpace=null,!(l.length>0))return e.pos=a[0].pos-2,t.oldStyle;l[l.length-1].pos++,t.oldTokens=l}else t.oldTokens=l.concat(a);return r=t.oldTokens.shift(),e.pos=r.pos,i=r.state,r.style},blankLine:function(t){t.extMode&&t.extMode.blankLine&&t.extMode.blankLine(t.extState)},tokenTable:this.tokenTable}}}],i&&Cc(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();mw.loader.getState("ext.wikiEditor")&&mw.hook("wikiEditor.toolbarReady").add((function(t){new gc(t,function(){var t=new Dc((arguments.length>0&&void 0!==arguments[0]?arguments[0]:null)||mw.config.get("extCodeMirrorConfig")).mediawiki,e=bl.define(t),i=function(t,e){let i,n=[el];return t instanceof Yo&&(t.module&&n.push(Es.styleModule.of(t.module)),i=t.themeType),i?n.push(Xo.computeN([Es.darkTheme],(e=>e.facet(Es.darkTheme)==("dark"==i)?[t]:[]))):n.push(Xo.of(t)),n}(Yo.define(Mc.getTagStyles(t)));return new Ho(e,i)}()).addCodeMirrorToWikiEditor()}))})();
 //# sourceMappingURL=main.js.map.json
\ No newline at end of file
diff --git a/resources/dist/main.js.map.json b/resources/dist/main.js.map.json
index 4a7ed9ff..c647b436 100644
--- a/resources/dist/main.js.map.json
+++ b/resources/dist/main.js.map.json
@@ -1 +1 @@
-{"version":3,"file":"main.js","mappings":"mBAGA,MAAMA,EAIF,MAAAC,CAAOC,GACH,GAAIA,EAAM,GAAKA,EAAMC,KAAKC,OACtB,MAAM,IAAIC,WAAW,oBAAoBH,2BAA6BC,KAAKC,UAC/E,OAAOD,KAAKG,UAAUJ,GAAK,EAAO,EAAG,EACzC,CAIA,IAAAK,CAAKC,GACD,GAAIA,EAAI,GAAKA,EAAIL,KAAKM,MAClB,MAAM,IAAIJ,WAAW,uBAAuBG,QAAQL,KAAKM,uBAC7D,OAAON,KAAKG,UAAUE,GAAG,EAAM,EAAG,EACtC,CAIA,OAAAE,CAAQC,EAAMC,EAAIC,GACd,IAAIC,EAAQ,GAKZ,OAJAX,KAAKY,UAAU,EAAGJ,EAAMG,EAAO,GAC3BD,EAAKT,QACLS,EAAKE,UAAU,EAAGF,EAAKT,OAAQU,EAAO,GAC1CX,KAAKY,UAAUH,EAAIT,KAAKC,OAAQU,EAAO,GAChCE,EAASL,KAAKG,EAAOX,KAAKC,QAAUQ,EAAKD,GAAQE,EAAKT,OACjE,CAIA,MAAAa,CAAOC,GACH,OAAOf,KAAKO,QAAQP,KAAKC,OAAQD,KAAKC,OAAQc,EAClD,CAIA,KAAAC,CAAMR,EAAMC,EAAKT,KAAKC,QAClB,IAAIU,EAAQ,GAEZ,OADAX,KAAKY,UAAUJ,EAAMC,EAAIE,EAAO,GACzBE,EAASL,KAAKG,EAAOF,EAAKD,EACrC,CAIA,EAAAS,CAAGF,GACC,GAAIA,GAASf,KACT,OAAO,EACX,GAAIe,EAAMd,QAAUD,KAAKC,QAAUc,EAAMT,OAASN,KAAKM,MACnD,OAAO,EACX,IAAIY,EAAQlB,KAAKmB,c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AAGllD,OAAOM,IAAK,wBAEN8jF,UACd9+B,EAAOwe,GAAe/jE,OAAQqoD,GAC9B6K,ENoeP,SAA4BA,EAAax/C,GACrC,IAA6BosD,EAAzB97D,EAAM,CAACs8D,IAcX,OAbIpN,aAAuBuM,KACnBvM,EAAY2M,QACZ77D,EAAIhQ,KAAK4kD,GAAWjvB,YAAY/2B,GAAGsgE,EAAY2M,SACnDC,EAAY5M,EAAY4M,WAInBA,EACL97D,EAAIhQ,KAAK+rE,GAAiBv/D,SAAS,CAACo4C,GAAWhK,YAAYjuC,GAChDA,EAAMG,MAAM83C,GAAWhK,aAA4B,QAAbkxB,GAAuB,CAAC5M,GAAe,MAGxFlvD,EAAIhQ,KAAK+rE,GAAiBntE,GAAGsgE,IAC1BlvD,CACX,CMpfqB6iF,CACnBpnB,GAAez/D,OACdkhF,GAAW4F,aAAcz+B,KAG3B,OAAO,IAAImU,GAAiBjX,EAAM2N,EACnC,CC1sCoD6zB,IAC7CC,2BACN,G","sources":["/w/extensions/CodeMirror/./node_modules/@codemirror/state/dist/index.js","/w/extensions/CodeMirror/./node_modules/style-mod/src/style-mod.js","/w/extensions/CodeMirror/./node_modules/w3c-keyname/index.js","/w/extensions/CodeMirror/./node_modules/@codemirror/view/dist/index.js","/w/extensions/CodeMirror/./src/codemirror.js","/w/extensions/CodeMirror/./node_modules/@lezer/common/dist/index.js","/w/extensions/CodeMirror/./node_modules/@lezer/highlight/dist/index.js","/w/extensions/CodeMirror/./node_modules/@codemirror/language/dist/index.js","/w/extensions/CodeMirror/./node_modules/@codemirror/commands/dist/index.js","/w/extensions/CodeMirror/./node_modules/crelt/index.js","/w/extensions/CodeMirror/./node_modules/@codemirror/search/dist/index.js","/w/extensions/CodeMirror/./src/codemirror.wikieditor.js","/w/extensions/CodeMirror/./src/codemirror.mode.mediawiki.config.js","/w/extensions/CodeMirror/./src/codemirror.mode.mediawiki.js","/w/extensions/CodeMirror/./src/codemirror.wikieditor.mediawiki.js"],"sourcesContent":["/**\nThe data structure for documents. @nonabstract\n*/\nclass Text {\n    /**\n    Get the line description around the given position.\n    */\n    lineAt(pos) {\n        if (pos < 0 || pos > this.length)\n            throw new RangeError(`Invalid position ${pos} in document of length ${this.length}`);\n        return this.lineInner(pos, false, 1, 0);\n    }\n    /**\n    Get the description for the given (1-based) line number.\n    */\n    line(n) {\n        if (n < 1 || n > this.lines)\n            throw new RangeError(`Invalid line number ${n} in ${this.lines}-line document`);\n        return this.lineInner(n, true, 1, 0);\n    }\n    /**\n    Replace a range of the text with the given content.\n    */\n    replace(from, to, text) {\n        let parts = [];\n        this.decompose(0, from, parts, 2 /* Open.To */);\n        if (text.length)\n            text.decompose(0, text.length, parts, 1 /* Open.From */ | 2 /* Open.To */);\n        this.decompose(to, this.length, parts, 1 /* Open.From */);\n        return TextNode.from(parts, this.length - (to - from) + text.length);\n    }\n    /**\n    Append another document to this one.\n    */\n    append(other) {\n        return this.replace(this.length, this.length, other);\n    }\n    /**\n    Retrieve the text between the given points.\n    */\n    slice(from, to = this.length) {\n        let parts = [];\n        this.decompose(from, to, parts, 0);\n        return TextNode.from(parts, to - from);\n    }\n    /**\n    Test whether this text is equal to another instance.\n    */\n    eq(other) {\n        if (other == this)\n            return true;\n        if (other.length != this.length || other.lines != this.lines)\n            return false;\n        let start = this.scanIdentical(other, 1), end = this.length - this.scanIdentical(other, -1);\n        let a = new RawTextCursor(this), b = new RawTextCursor(other);\n        for (let skip = start, pos = start;;) {\n            a.next(skip);\n            b.next(skip);\n            skip = 0;\n            if (a.lineBreak != b.lineBreak || a.done != b.done || a.value != b.value)\n                return false;\n            pos += a.value.length;\n            if (a.done || pos >= end)\n                return true;\n        }\n    }\n    /**\n    Iterate over the text. When `dir` is `-1`, iteration happens\n    from end to start. This will return lines and the breaks between\n    them as separate strings.\n    */\n    iter(dir = 1) { return new RawTextCursor(this, dir); }\n    /**\n    Iterate over a range of the text. When `from` > `to`, the\n    iterator will run in reverse.\n    */\n    iterRange(from, to = this.length) { return new PartialTextCursor(this, from, to); }\n    /**\n    Return a cursor that iterates over the given range of lines,\n    _without_ returning the line breaks between, and yielding empty\n    strings for empty lines.\n    \n    When `from` and `to` are given, they should be 1-based line numbers.\n    */\n    iterLines(from, to) {\n        let inner;\n        if (from == null) {\n            inner = this.iter();\n        }\n        else {\n            if (to == null)\n                to = this.lines + 1;\n            let start = this.line(from).from;\n            inner = this.iterRange(start, Math.max(start, to == this.lines + 1 ? this.length : to <= 1 ? 0 : this.line(to - 1).to));\n        }\n        return new LineCursor(inner);\n    }\n    /**\n    Return the document as a string, using newline characters to\n    separate lines.\n    */\n    toString() { return this.sliceString(0); }\n    /**\n    Convert the document to an array of lines (which can be\n    deserialized again via [`Text.of`](https://codemirror.net/6/docs/ref/#state.Text^of)).\n    */\n    toJSON() {\n        let lines = [];\n        this.flatten(lines);\n        return lines;\n    }\n    /**\n    @internal\n    */\n    constructor() { }\n    /**\n    Create a `Text` instance for the given array of lines.\n    */\n    static of(text) {\n        if (text.length == 0)\n            throw new RangeError(\"A document must have at least one line\");\n        if (text.length == 1 && !text[0])\n            return Text.empty;\n        return text.length <= 32 /* Tree.Branch */ ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));\n    }\n}\n// Leaves store an array of line strings. There are always line breaks\n// between these strings. Leaves are limited in size and have to be\n// contained in TextNode instances for bigger documents.\nclass TextLeaf extends Text {\n    constructor(text, length = textLength(text)) {\n        super();\n        this.text = text;\n        this.length = length;\n    }\n    get lines() { return this.text.length; }\n    get children() { return null; }\n    lineInner(target, isLine, line, offset) {\n        for (let i = 0;; i++) {\n            let string = this.text[i], end = offset + string.length;\n            if ((isLine ? line : end) >= target)\n                return new Line(offset, end, line, string);\n            offset = end + 1;\n            line++;\n        }\n    }\n    decompose(from, to, target, open) {\n        let text = from <= 0 && to >= this.length ? this\n            : new TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from));\n        if (open & 1 /* Open.From */) {\n            let prev = target.pop();\n            let joined = appendText(text.text, prev.text.slice(), 0, text.length);\n            if (joined.length <= 32 /* Tree.Branch */) {\n                target.push(new TextLeaf(joined, prev.length + text.length));\n            }\n            else {\n                let mid = joined.length >> 1;\n                target.push(new TextLeaf(joined.slice(0, mid)), new TextLeaf(joined.slice(mid)));\n            }\n        }\n        else {\n            target.push(text);\n        }\n    }\n    replace(from, to, text) {\n        if (!(text instanceof TextLeaf))\n            return super.replace(from, to, text);\n        let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to);\n        let newLen = this.length + text.length - (to - from);\n        if (lines.length <= 32 /* Tree.Branch */)\n            return new TextLeaf(lines, newLen);\n        return TextNode.from(TextLeaf.split(lines, []), newLen);\n    }\n    sliceString(from, to = this.length, lineSep = \"\\n\") {\n        let result = \"\";\n        for (let pos = 0, i = 0; pos <= to && i < this.text.length; i++) {\n            let line = this.text[i], end = pos + line.length;\n            if (pos > from && i)\n                result += lineSep;\n            if (from < end && to > pos)\n                result += line.slice(Math.max(0, from - pos), to - pos);\n            pos = end + 1;\n        }\n        return result;\n    }\n    flatten(target) {\n        for (let line of this.text)\n            target.push(line);\n    }\n    scanIdentical() { return 0; }\n    static split(text, target) {\n        let part = [], len = -1;\n        for (let line of text) {\n            part.push(line);\n            len += line.length + 1;\n            if (part.length == 32 /* Tree.Branch */) {\n                target.push(new TextLeaf(part, len));\n                part = [];\n                len = -1;\n            }\n        }\n        if (len > -1)\n            target.push(new TextLeaf(part, len));\n        return target;\n    }\n}\n// Nodes provide the tree structure of the `Text` type. They store a\n// number of other nodes or leaves, taking care to balance themselves\n// on changes. There are implied line breaks _between_ the children of\n// a node (but not before the first or after the last child).\nclass TextNode extends Text {\n    constructor(children, length) {\n        super();\n        this.children = children;\n        this.length = length;\n        this.lines = 0;\n        for (let child of children)\n            this.lines += child.lines;\n    }\n    lineInner(target, isLine, line, offset) {\n        for (let i = 0;; i++) {\n            let child = this.children[i], end = offset + child.length, endLine = line + child.lines - 1;\n            if ((isLine ? endLine : end) >= target)\n                return child.lineInner(target, isLine, line, offset);\n            offset = end + 1;\n            line = endLine + 1;\n        }\n    }\n    decompose(from, to, target, open) {\n        for (let i = 0, pos = 0; pos <= to && i < this.children.length; i++) {\n            let child = this.children[i], end = pos + child.length;\n            if (from <= end && to >= pos) {\n                let childOpen = open & ((pos <= from ? 1 /* Open.From */ : 0) | (end >= to ? 2 /* Open.To */ : 0));\n                if (pos >= from && end <= to && !childOpen)\n                    target.push(child);\n                else\n                    child.decompose(from - pos, to - pos, target, childOpen);\n            }\n            pos = end + 1;\n        }\n    }\n    replace(from, to, text) {\n        if (text.lines < this.lines)\n            for (let i = 0, pos = 0; i < this.children.length; i++) {\n                let child = this.children[i], end = pos + child.length;\n                // Fast path: if the change only affects one child and the\n                // child's size remains in the acceptable range, only update\n                // that child\n                if (from >= pos && to <= end) {\n                    let updated = child.replace(from - pos, to - pos, text);\n                    let totalLines = this.lines - child.lines + updated.lines;\n                    if (updated.lines < (totalLines >> (5 /* Tree.BranchShift */ - 1)) &&\n                        updated.lines > (totalLines >> (5 /* Tree.BranchShift */ + 1))) {\n                        let copy = this.children.slice();\n                        copy[i] = updated;\n                        return new TextNode(copy, this.length - (to - from) + text.length);\n                    }\n                    return super.replace(pos, end, updated);\n                }\n                pos = end + 1;\n            }\n        return super.replace(from, to, text);\n    }\n    sliceString(from, to = this.length, lineSep = \"\\n\") {\n        let result = \"\";\n        for (let i = 0, pos = 0; i < this.children.length && pos <= to; i++) {\n            let child = this.children[i], end = pos + child.length;\n            if (pos > from && i)\n                result += lineSep;\n            if (from < end && to > pos)\n                result += child.sliceString(from - pos, to - pos, lineSep);\n            pos = end + 1;\n        }\n        return result;\n    }\n    flatten(target) {\n        for (let child of this.children)\n            child.flatten(target);\n    }\n    scanIdentical(other, dir) {\n        if (!(other instanceof TextNode))\n            return 0;\n        let length = 0;\n        let [iA, iB, eA, eB] = dir > 0 ? [0, 0, this.children.length, other.children.length]\n            : [this.children.length - 1, other.children.length - 1, -1, -1];\n        for (;; iA += dir, iB += dir) {\n            if (iA == eA || iB == eB)\n                return length;\n            let chA = this.children[iA], chB = other.children[iB];\n            if (chA != chB)\n                return length + chA.scanIdentical(chB, dir);\n            length += chA.length + 1;\n        }\n    }\n    static from(children, length = children.reduce((l, ch) => l + ch.length + 1, -1)) {\n        let lines = 0;\n        for (let ch of children)\n            lines += ch.lines;\n        if (lines < 32 /* Tree.Branch */) {\n            let flat = [];\n            for (let ch of children)\n                ch.flatten(flat);\n            return new TextLeaf(flat, length);\n        }\n        let chunk = Math.max(32 /* Tree.Branch */, lines >> 5 /* Tree.BranchShift */), maxChunk = chunk << 1, minChunk = chunk >> 1;\n        let chunked = [], currentLines = 0, currentLen = -1, currentChunk = [];\n        function add(child) {\n            let last;\n            if (child.lines > maxChunk && child instanceof TextNode) {\n                for (let node of child.children)\n                    add(node);\n            }\n            else if (child.lines > minChunk && (currentLines > minChunk || !currentLines)) {\n                flush();\n                chunked.push(child);\n            }\n            else if (child instanceof TextLeaf && currentLines &&\n                (last = currentChunk[currentChunk.length - 1]) instanceof TextLeaf &&\n                child.lines + last.lines <= 32 /* Tree.Branch */) {\n                currentLines += child.lines;\n                currentLen += child.length + 1;\n                currentChunk[currentChunk.length - 1] = new TextLeaf(last.text.concat(child.text), last.length + 1 + child.length);\n            }\n            else {\n                if (currentLines + child.lines > chunk)\n                    flush();\n                currentLines += child.lines;\n                currentLen += child.length + 1;\n                currentChunk.push(child);\n            }\n        }\n        function flush() {\n            if (currentLines == 0)\n                return;\n            chunked.push(currentChunk.length == 1 ? currentChunk[0] : TextNode.from(currentChunk, currentLen));\n            currentLen = -1;\n            currentLines = currentChunk.length = 0;\n        }\n        for (let child of children)\n            add(child);\n        flush();\n        return chunked.length == 1 ? chunked[0] : new TextNode(chunked, length);\n    }\n}\nText.empty = /*@__PURE__*/new TextLeaf([\"\"], 0);\nfunction textLength(text) {\n    let length = -1;\n    for (let line of text)\n        length += line.length + 1;\n    return length;\n}\nfunction appendText(text, target, from = 0, to = 1e9) {\n    for (let pos = 0, i = 0, first = true; i < text.length && pos <= to; i++) {\n        let line = text[i], end = pos + line.length;\n        if (end >= from) {\n            if (end > to)\n                line = line.slice(0, to - pos);\n            if (pos < from)\n                line = line.slice(from - pos);\n            if (first) {\n                target[target.length - 1] += line;\n                first = false;\n            }\n            else\n                target.push(line);\n        }\n        pos = end + 1;\n    }\n    return target;\n}\nfunction sliceText(text, from, to) {\n    return appendText(text, [\"\"], from, to);\n}\nclass RawTextCursor {\n    constructor(text, dir = 1) {\n        this.dir = dir;\n        this.done = false;\n        this.lineBreak = false;\n        this.value = \"\";\n        this.nodes = [text];\n        this.offsets = [dir > 0 ? 1 : (text instanceof TextLeaf ? text.text.length : text.children.length) << 1];\n    }\n    nextInner(skip, dir) {\n        this.done = this.lineBreak = false;\n        for (;;) {\n            let last = this.nodes.length - 1;\n            let top = this.nodes[last], offsetValue = this.offsets[last], offset = offsetValue >> 1;\n            let size = top instanceof TextLeaf ? top.text.length : top.children.length;\n            if (offset == (dir > 0 ? size : 0)) {\n                if (last == 0) {\n                    this.done = true;\n                    this.value = \"\";\n                    return this;\n                }\n                if (dir > 0)\n                    this.offsets[last - 1]++;\n                this.nodes.pop();\n                this.offsets.pop();\n            }\n            else if ((offsetValue & 1) == (dir > 0 ? 0 : 1)) {\n                this.offsets[last] += dir;\n                if (skip == 0) {\n                    this.lineBreak = true;\n                    this.value = \"\\n\";\n                    return this;\n                }\n                skip--;\n            }\n            else if (top instanceof TextLeaf) {\n                // Move to the next string\n                let next = top.text[offset + (dir < 0 ? -1 : 0)];\n                this.offsets[last] += dir;\n                if (next.length > Math.max(0, skip)) {\n                    this.value = skip == 0 ? next : dir > 0 ? next.slice(skip) : next.slice(0, next.length - skip);\n                    return this;\n                }\n                skip -= next.length;\n            }\n            else {\n                let next = top.children[offset + (dir < 0 ? -1 : 0)];\n                if (skip > next.length) {\n                    skip -= next.length;\n                    this.offsets[last] += dir;\n                }\n                else {\n                    if (dir < 0)\n                        this.offsets[last]--;\n                    this.nodes.push(next);\n                    this.offsets.push(dir > 0 ? 1 : (next instanceof TextLeaf ? next.text.length : next.children.length) << 1);\n                }\n            }\n        }\n    }\n    next(skip = 0) {\n        if (skip < 0) {\n            this.nextInner(-skip, (-this.dir));\n            skip = this.value.length;\n        }\n        return this.nextInner(skip, this.dir);\n    }\n}\nclass PartialTextCursor {\n    constructor(text, start, end) {\n        this.value = \"\";\n        this.done = false;\n        this.cursor = new RawTextCursor(text, start > end ? -1 : 1);\n        this.pos = start > end ? text.length : 0;\n        this.from = Math.min(start, end);\n        this.to = Math.max(start, end);\n    }\n    nextInner(skip, dir) {\n        if (dir < 0 ? this.pos <= this.from : this.pos >= this.to) {\n            this.value = \"\";\n            this.done = true;\n            return this;\n        }\n        skip += Math.max(0, dir < 0 ? this.pos - this.to : this.from - this.pos);\n        let limit = dir < 0 ? this.pos - this.from : this.to - this.pos;\n        if (skip > limit)\n            skip = limit;\n        limit -= skip;\n        let { value } = this.cursor.next(skip);\n        this.pos += (value.length + skip) * dir;\n        this.value = value.length <= limit ? value : dir < 0 ? value.slice(value.length - limit) : value.slice(0, limit);\n        this.done = !this.value;\n        return this;\n    }\n    next(skip = 0) {\n        if (skip < 0)\n            skip = Math.max(skip, this.from - this.pos);\n        else if (skip > 0)\n            skip = Math.min(skip, this.to - this.pos);\n        return this.nextInner(skip, this.cursor.dir);\n    }\n    get lineBreak() { return this.cursor.lineBreak && this.value != \"\"; }\n}\nclass LineCursor {\n    constructor(inner) {\n        this.inner = inner;\n        this.afterBreak = true;\n        this.value = \"\";\n        this.done = false;\n    }\n    next(skip = 0) {\n        let { done, lineBreak, value } = this.inner.next(skip);\n        if (done) {\n            this.done = true;\n            this.value = \"\";\n        }\n        else if (lineBreak) {\n            if (this.afterBreak) {\n                this.value = \"\";\n            }\n            else {\n                this.afterBreak = true;\n                this.next();\n            }\n        }\n        else {\n            this.value = value;\n            this.afterBreak = false;\n        }\n        return this;\n    }\n    get lineBreak() { return false; }\n}\nif (typeof Symbol != \"undefined\") {\n    Text.prototype[Symbol.iterator] = function () { return this.iter(); };\n    RawTextCursor.prototype[Symbol.iterator] = PartialTextCursor.prototype[Symbol.iterator] =\n        LineCursor.prototype[Symbol.iterator] = function () { return this; };\n}\n/**\nThis type describes a line in the document. It is created\non-demand when lines are [queried](https://codemirror.net/6/docs/ref/#state.Text.lineAt).\n*/\nclass Line {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    The position of the start of the line.\n    */\n    from, \n    /**\n    The position at the end of the line (_before_ the line break,\n    or at the end of document for the last line).\n    */\n    to, \n    /**\n    This line's line number (1-based).\n    */\n    number, \n    /**\n    The line's content.\n    */\n    text) {\n        this.from = from;\n        this.to = to;\n        this.number = number;\n        this.text = text;\n    }\n    /**\n    The length of the line (not including any line break after it).\n    */\n    get length() { return this.to - this.from; }\n}\n\n// Compressed representation of the Grapheme_Cluster_Break=Extend\n// information from\n// http://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakProperty.txt.\n// Each pair of elements represents a range, as an offet from the\n// previous range and a length. Numbers are in base-36, with the empty\n// string being a shorthand for 1.\nlet extend = /*@__PURE__*/\"lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o\".split(\",\").map(s => s ? parseInt(s, 36) : 1);\n// Convert offsets into absolute values\nfor (let i = 1; i < extend.length; i++)\n    extend[i] += extend[i - 1];\nfunction isExtendingChar(code) {\n    for (let i = 1; i < extend.length; i += 2)\n        if (extend[i] > code)\n            return extend[i - 1] <= code;\n    return false;\n}\nfunction isRegionalIndicator(code) {\n    return code >= 0x1F1E6 && code <= 0x1F1FF;\n}\nconst ZWJ = 0x200d;\n/**\nReturns a next grapheme cluster break _after_ (not equal to)\n`pos`, if `forward` is true, or before otherwise. Returns `pos`\nitself if no further cluster break is available in the string.\nMoves across surrogate pairs, extending characters (when\n`includeExtending` is true), characters joined with zero-width\njoiners, and flag emoji.\n*/\nfunction findClusterBreak(str, pos, forward = true, includeExtending = true) {\n    return (forward ? nextClusterBreak : prevClusterBreak)(str, pos, includeExtending);\n}\nfunction nextClusterBreak(str, pos, includeExtending) {\n    if (pos == str.length)\n        return pos;\n    // If pos is in the middle of a surrogate pair, move to its start\n    if (pos && surrogateLow(str.charCodeAt(pos)) && surrogateHigh(str.charCodeAt(pos - 1)))\n        pos--;\n    let prev = codePointAt(str, pos);\n    pos += codePointSize(prev);\n    while (pos < str.length) {\n        let next = codePointAt(str, pos);\n        if (prev == ZWJ || next == ZWJ || includeExtending && isExtendingChar(next)) {\n            pos += codePointSize(next);\n            prev = next;\n        }\n        else if (isRegionalIndicator(next)) {\n            let countBefore = 0, i = pos - 2;\n            while (i >= 0 && isRegionalIndicator(codePointAt(str, i))) {\n                countBefore++;\n                i -= 2;\n            }\n            if (countBefore % 2 == 0)\n                break;\n            else\n                pos += 2;\n        }\n        else {\n            break;\n        }\n    }\n    return pos;\n}\nfunction prevClusterBreak(str, pos, includeExtending) {\n    while (pos > 0) {\n        let found = nextClusterBreak(str, pos - 2, includeExtending);\n        if (found < pos)\n            return found;\n        pos--;\n    }\n    return 0;\n}\nfunction surrogateLow(ch) { return ch >= 0xDC00 && ch < 0xE000; }\nfunction surrogateHigh(ch) { return ch >= 0xD800 && ch < 0xDC00; }\n/**\nFind the code point at the given position in a string (like the\n[`codePointAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt)\nstring method).\n*/\nfunction codePointAt(str, pos) {\n    let code0 = str.charCodeAt(pos);\n    if (!surrogateHigh(code0) || pos + 1 == str.length)\n        return code0;\n    let code1 = str.charCodeAt(pos + 1);\n    if (!surrogateLow(code1))\n        return code0;\n    return ((code0 - 0xd800) << 10) + (code1 - 0xdc00) + 0x10000;\n}\n/**\nGiven a Unicode codepoint, return the JavaScript string that\nrespresents it (like\n[`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint)).\n*/\nfunction fromCodePoint(code) {\n    if (code <= 0xffff)\n        return String.fromCharCode(code);\n    code -= 0x10000;\n    return String.fromCharCode((code >> 10) + 0xd800, (code & 1023) + 0xdc00);\n}\n/**\nThe amount of positions a character takes up a JavaScript string.\n*/\nfunction codePointSize(code) { return code < 0x10000 ? 1 : 2; }\n\nconst DefaultSplit = /\\r\\n?|\\n/;\n/**\nDistinguishes different ways in which positions can be mapped.\n*/\nvar MapMode = /*@__PURE__*/(function (MapMode) {\n    /**\n    Map a position to a valid new position, even when its context\n    was deleted.\n    */\n    MapMode[MapMode[\"Simple\"] = 0] = \"Simple\";\n    /**\n    Return null if deletion happens across the position.\n    */\n    MapMode[MapMode[\"TrackDel\"] = 1] = \"TrackDel\";\n    /**\n    Return null if the character _before_ the position is deleted.\n    */\n    MapMode[MapMode[\"TrackBefore\"] = 2] = \"TrackBefore\";\n    /**\n    Return null if the character _after_ the position is deleted.\n    */\n    MapMode[MapMode[\"TrackAfter\"] = 3] = \"TrackAfter\";\nreturn MapMode})(MapMode || (MapMode = {}));\n/**\nA change description is a variant of [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet)\nthat doesn't store the inserted text. As such, it can't be\napplied, but is cheaper to store and manipulate.\n*/\nclass ChangeDesc {\n    // Sections are encoded as pairs of integers. The first is the\n    // length in the current document, and the second is -1 for\n    // unaffected sections, and the length of the replacement content\n    // otherwise. So an insertion would be (0, n>0), a deletion (n>0,\n    // 0), and a replacement two positive numbers.\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    @internal\n    */\n    sections) {\n        this.sections = sections;\n    }\n    /**\n    The length of the document before the change.\n    */\n    get length() {\n        let result = 0;\n        for (let i = 0; i < this.sections.length; i += 2)\n            result += this.sections[i];\n        return result;\n    }\n    /**\n    The length of the document after the change.\n    */\n    get newLength() {\n        let result = 0;\n        for (let i = 0; i < this.sections.length; i += 2) {\n            let ins = this.sections[i + 1];\n            result += ins < 0 ? this.sections[i] : ins;\n        }\n        return result;\n    }\n    /**\n    False when there are actual changes in this set.\n    */\n    get empty() { return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0; }\n    /**\n    Iterate over the unchanged parts left by these changes. `posA`\n    provides the position of the range in the old document, `posB`\n    the new position in the changed document.\n    */\n    iterGaps(f) {\n        for (let i = 0, posA = 0, posB = 0; i < this.sections.length;) {\n            let len = this.sections[i++], ins = this.sections[i++];\n            if (ins < 0) {\n                f(posA, posB, len);\n                posB += len;\n            }\n            else {\n                posB += ins;\n            }\n            posA += len;\n        }\n    }\n    /**\n    Iterate over the ranges changed by these changes. (See\n    [`ChangeSet.iterChanges`](https://codemirror.net/6/docs/ref/#state.ChangeSet.iterChanges) for a\n    variant that also provides you with the inserted text.)\n    `fromA`/`toA` provides the extent of the change in the starting\n    document, `fromB`/`toB` the extent of the replacement in the\n    changed document.\n    \n    When `individual` is true, adjacent changes (which are kept\n    separate for [position mapping](https://codemirror.net/6/docs/ref/#state.ChangeDesc.mapPos)) are\n    reported separately.\n    */\n    iterChangedRanges(f, individual = false) {\n        iterChanges(this, f, individual);\n    }\n    /**\n    Get a description of the inverted form of these changes.\n    */\n    get invertedDesc() {\n        let sections = [];\n        for (let i = 0; i < this.sections.length;) {\n            let len = this.sections[i++], ins = this.sections[i++];\n            if (ins < 0)\n                sections.push(len, ins);\n            else\n                sections.push(ins, len);\n        }\n        return new ChangeDesc(sections);\n    }\n    /**\n    Compute the combined effect of applying another set of changes\n    after this one. The length of the document after this set should\n    match the length before `other`.\n    */\n    composeDesc(other) { return this.empty ? other : other.empty ? this : composeSets(this, other); }\n    /**\n    Map this description, which should start with the same document\n    as `other`, over another set of changes, so that it can be\n    applied after it. When `before` is true, map as if the changes\n    in `other` happened before the ones in `this`.\n    */\n    mapDesc(other, before = false) { return other.empty ? this : mapSet(this, other, before); }\n    mapPos(pos, assoc = -1, mode = MapMode.Simple) {\n        let posA = 0, posB = 0;\n        for (let i = 0; i < this.sections.length;) {\n            let len = this.sections[i++], ins = this.sections[i++], endA = posA + len;\n            if (ins < 0) {\n                if (endA > pos)\n                    return posB + (pos - posA);\n                posB += len;\n            }\n            else {\n                if (mode != MapMode.Simple && endA >= pos &&\n                    (mode == MapMode.TrackDel && posA < pos && endA > pos ||\n                        mode == MapMode.TrackBefore && posA < pos ||\n                        mode == MapMode.TrackAfter && endA > pos))\n                    return null;\n                if (endA > pos || endA == pos && assoc < 0 && !len)\n                    return pos == posA || assoc < 0 ? posB : posB + ins;\n                posB += ins;\n            }\n            posA = endA;\n        }\n        if (pos > posA)\n            throw new RangeError(`Position ${pos} is out of range for changeset of length ${posA}`);\n        return posB;\n    }\n    /**\n    Check whether these changes touch a given range. When one of the\n    changes entirely covers the range, the string `\"cover\"` is\n    returned.\n    */\n    touchesRange(from, to = from) {\n        for (let i = 0, pos = 0; i < this.sections.length && pos <= to;) {\n            let len = this.sections[i++], ins = this.sections[i++], end = pos + len;\n            if (ins >= 0 && pos <= to && end >= from)\n                return pos < from && end > to ? \"cover\" : true;\n            pos = end;\n        }\n        return false;\n    }\n    /**\n    @internal\n    */\n    toString() {\n        let result = \"\";\n        for (let i = 0; i < this.sections.length;) {\n            let len = this.sections[i++], ins = this.sections[i++];\n            result += (result ? \" \" : \"\") + len + (ins >= 0 ? \":\" + ins : \"\");\n        }\n        return result;\n    }\n    /**\n    Serialize this change desc to a JSON-representable value.\n    */\n    toJSON() { return this.sections; }\n    /**\n    Create a change desc from its JSON representation (as produced\n    by [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeDesc.toJSON).\n    */\n    static fromJSON(json) {\n        if (!Array.isArray(json) || json.length % 2 || json.some(a => typeof a != \"number\"))\n            throw new RangeError(\"Invalid JSON representation of ChangeDesc\");\n        return new ChangeDesc(json);\n    }\n    /**\n    @internal\n    */\n    static create(sections) { return new ChangeDesc(sections); }\n}\n/**\nA change set represents a group of modifications to a document. It\nstores the document length, and can only be applied to documents\nwith exactly that length.\n*/\nclass ChangeSet extends ChangeDesc {\n    constructor(sections, \n    /**\n    @internal\n    */\n    inserted) {\n        super(sections);\n        this.inserted = inserted;\n    }\n    /**\n    Apply the changes to a document, returning the modified\n    document.\n    */\n    apply(doc) {\n        if (this.length != doc.length)\n            throw new RangeError(\"Applying change set to a document with the wrong length\");\n        iterChanges(this, (fromA, toA, fromB, _toB, text) => doc = doc.replace(fromB, fromB + (toA - fromA), text), false);\n        return doc;\n    }\n    mapDesc(other, before = false) { return mapSet(this, other, before, true); }\n    /**\n    Given the document as it existed _before_ the changes, return a\n    change set that represents the inverse of this set, which could\n    be used to go from the document created by the changes back to\n    the document as it existed before the changes.\n    */\n    invert(doc) {\n        let sections = this.sections.slice(), inserted = [];\n        for (let i = 0, pos = 0; i < sections.length; i += 2) {\n            let len = sections[i], ins = sections[i + 1];\n            if (ins >= 0) {\n                sections[i] = ins;\n                sections[i + 1] = len;\n                let index = i >> 1;\n                while (inserted.length < index)\n                    inserted.push(Text.empty);\n                inserted.push(len ? doc.slice(pos, pos + len) : Text.empty);\n            }\n            pos += len;\n        }\n        return new ChangeSet(sections, inserted);\n    }\n    /**\n    Combine two subsequent change sets into a single set. `other`\n    must start in the document produced by `this`. If `this` goes\n    `docA` → `docB` and `other` represents `docB` → `docC`, the\n    returned value will represent the change `docA` → `docC`.\n    */\n    compose(other) { return this.empty ? other : other.empty ? this : composeSets(this, other, true); }\n    /**\n    Given another change set starting in the same document, maps this\n    change set over the other, producing a new change set that can be\n    applied to the document produced by applying `other`. When\n    `before` is `true`, order changes as if `this` comes before\n    `other`, otherwise (the default) treat `other` as coming first.\n    \n    Given two changes `A` and `B`, `A.compose(B.map(A))` and\n    `B.compose(A.map(B, true))` will produce the same document. This\n    provides a basic form of [operational\n    transformation](https://en.wikipedia.org/wiki/Operational_transformation),\n    and can be used for collaborative editing.\n    */\n    map(other, before = false) { return other.empty ? this : mapSet(this, other, before, true); }\n    /**\n    Iterate over the changed ranges in the document, calling `f` for\n    each, with the range in the original document (`fromA`-`toA`)\n    and the range that replaces it in the new document\n    (`fromB`-`toB`).\n    \n    When `individual` is true, adjacent changes are reported\n    separately.\n    */\n    iterChanges(f, individual = false) {\n        iterChanges(this, f, individual);\n    }\n    /**\n    Get a [change description](https://codemirror.net/6/docs/ref/#state.ChangeDesc) for this change\n    set.\n    */\n    get desc() { return ChangeDesc.create(this.sections); }\n    /**\n    @internal\n    */\n    filter(ranges) {\n        let resultSections = [], resultInserted = [], filteredSections = [];\n        let iter = new SectionIter(this);\n        done: for (let i = 0, pos = 0;;) {\n            let next = i == ranges.length ? 1e9 : ranges[i++];\n            while (pos < next || pos == next && iter.len == 0) {\n                if (iter.done)\n                    break done;\n                let len = Math.min(iter.len, next - pos);\n                addSection(filteredSections, len, -1);\n                let ins = iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0;\n                addSection(resultSections, len, ins);\n                if (ins > 0)\n                    addInsert(resultInserted, resultSections, iter.text);\n                iter.forward(len);\n                pos += len;\n            }\n            let end = ranges[i++];\n            while (pos < end) {\n                if (iter.done)\n                    break done;\n                let len = Math.min(iter.len, end - pos);\n                addSection(resultSections, len, -1);\n                addSection(filteredSections, len, iter.ins == -1 ? -1 : iter.off == 0 ? iter.ins : 0);\n                iter.forward(len);\n                pos += len;\n            }\n        }\n        return { changes: new ChangeSet(resultSections, resultInserted),\n            filtered: ChangeDesc.create(filteredSections) };\n    }\n    /**\n    Serialize this change set to a JSON-representable value.\n    */\n    toJSON() {\n        let parts = [];\n        for (let i = 0; i < this.sections.length; i += 2) {\n            let len = this.sections[i], ins = this.sections[i + 1];\n            if (ins < 0)\n                parts.push(len);\n            else if (ins == 0)\n                parts.push([len]);\n            else\n                parts.push([len].concat(this.inserted[i >> 1].toJSON()));\n        }\n        return parts;\n    }\n    /**\n    Create a change set for the given changes, for a document of the\n    given length, using `lineSep` as line separator.\n    */\n    static of(changes, length, lineSep) {\n        let sections = [], inserted = [], pos = 0;\n        let total = null;\n        function flush(force = false) {\n            if (!force && !sections.length)\n                return;\n            if (pos < length)\n                addSection(sections, length - pos, -1);\n            let set = new ChangeSet(sections, inserted);\n            total = total ? total.compose(set.map(total)) : set;\n            sections = [];\n            inserted = [];\n            pos = 0;\n        }\n        function process(spec) {\n            if (Array.isArray(spec)) {\n                for (let sub of spec)\n                    process(sub);\n            }\n            else if (spec instanceof ChangeSet) {\n                if (spec.length != length)\n                    throw new RangeError(`Mismatched change set length (got ${spec.length}, expected ${length})`);\n                flush();\n                total = total ? total.compose(spec.map(total)) : spec;\n            }\n            else {\n                let { from, to = from, insert } = spec;\n                if (from > to || from < 0 || to > length)\n                    throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length})`);\n                let insText = !insert ? Text.empty : typeof insert == \"string\" ? Text.of(insert.split(lineSep || DefaultSplit)) : insert;\n                let insLen = insText.length;\n                if (from == to && insLen == 0)\n                    return;\n                if (from < pos)\n                    flush();\n                if (from > pos)\n                    addSection(sections, from - pos, -1);\n                addSection(sections, to - from, insLen);\n                addInsert(inserted, sections, insText);\n                pos = to;\n            }\n        }\n        process(changes);\n        flush(!total);\n        return total;\n    }\n    /**\n    Create an empty changeset of the given length.\n    */\n    static empty(length) {\n        return new ChangeSet(length ? [length, -1] : [], []);\n    }\n    /**\n    Create a changeset from its JSON representation (as produced by\n    [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeSet.toJSON).\n    */\n    static fromJSON(json) {\n        if (!Array.isArray(json))\n            throw new RangeError(\"Invalid JSON representation of ChangeSet\");\n        let sections = [], inserted = [];\n        for (let i = 0; i < json.length; i++) {\n            let part = json[i];\n            if (typeof part == \"number\") {\n                sections.push(part, -1);\n            }\n            else if (!Array.isArray(part) || typeof part[0] != \"number\" || part.some((e, i) => i && typeof e != \"string\")) {\n                throw new RangeError(\"Invalid JSON representation of ChangeSet\");\n            }\n            else if (part.length == 1) {\n                sections.push(part[0], 0);\n            }\n            else {\n                while (inserted.length < i)\n                    inserted.push(Text.empty);\n                inserted[i] = Text.of(part.slice(1));\n                sections.push(part[0], inserted[i].length);\n            }\n        }\n        return new ChangeSet(sections, inserted);\n    }\n    /**\n    @internal\n    */\n    static createSet(sections, inserted) {\n        return new ChangeSet(sections, inserted);\n    }\n}\nfunction addSection(sections, len, ins, forceJoin = false) {\n    if (len == 0 && ins <= 0)\n        return;\n    let last = sections.length - 2;\n    if (last >= 0 && ins <= 0 && ins == sections[last + 1])\n        sections[last] += len;\n    else if (len == 0 && sections[last] == 0)\n        sections[last + 1] += ins;\n    else if (forceJoin) {\n        sections[last] += len;\n        sections[last + 1] += ins;\n    }\n    else\n        sections.push(len, ins);\n}\nfunction addInsert(values, sections, value) {\n    if (value.length == 0)\n        return;\n    let index = (sections.length - 2) >> 1;\n    if (index < values.length) {\n        values[values.length - 1] = values[values.length - 1].append(value);\n    }\n    else {\n        while (values.length < index)\n            values.push(Text.empty);\n        values.push(value);\n    }\n}\nfunction iterChanges(desc, f, individual) {\n    let inserted = desc.inserted;\n    for (let posA = 0, posB = 0, i = 0; i < desc.sections.length;) {\n        let len = desc.sections[i++], ins = desc.sections[i++];\n        if (ins < 0) {\n            posA += len;\n            posB += len;\n        }\n        else {\n            let endA = posA, endB = posB, text = Text.empty;\n            for (;;) {\n                endA += len;\n                endB += ins;\n                if (ins && inserted)\n                    text = text.append(inserted[(i - 2) >> 1]);\n                if (individual || i == desc.sections.length || desc.sections[i + 1] < 0)\n                    break;\n                len = desc.sections[i++];\n                ins = desc.sections[i++];\n            }\n            f(posA, endA, posB, endB, text);\n            posA = endA;\n            posB = endB;\n        }\n    }\n}\nfunction mapSet(setA, setB, before, mkSet = false) {\n    // Produce a copy of setA that applies to the document after setB\n    // has been applied (assuming both start at the same document).\n    let sections = [], insert = mkSet ? [] : null;\n    let a = new SectionIter(setA), b = new SectionIter(setB);\n    // Iterate over both sets in parallel. inserted tracks, for changes\n    // in A that have to be processed piece-by-piece, whether their\n    // content has been inserted already, and refers to the section\n    // index.\n    for (let inserted = -1;;) {\n        if (a.ins == -1 && b.ins == -1) {\n            // Move across ranges skipped by both sets.\n            let len = Math.min(a.len, b.len);\n            addSection(sections, len, -1);\n            a.forward(len);\n            b.forward(len);\n        }\n        else if (b.ins >= 0 && (a.ins < 0 || inserted == a.i || a.off == 0 && (b.len < a.len || b.len == a.len && !before))) {\n            // If there's a change in B that comes before the next change in\n            // A (ordered by start pos, then len, then before flag), skip\n            // that (and process any changes in A it covers).\n            let len = b.len;\n            addSection(sections, b.ins, -1);\n            while (len) {\n                let piece = Math.min(a.len, len);\n                if (a.ins >= 0 && inserted < a.i && a.len <= piece) {\n                    addSection(sections, 0, a.ins);\n                    if (insert)\n                        addInsert(insert, sections, a.text);\n                    inserted = a.i;\n                }\n                a.forward(piece);\n                len -= piece;\n            }\n            b.next();\n        }\n        else if (a.ins >= 0) {\n            // Process the part of a change in A up to the start of the next\n            // non-deletion change in B (if overlapping).\n            let len = 0, left = a.len;\n            while (left) {\n                if (b.ins == -1) {\n                    let piece = Math.min(left, b.len);\n                    len += piece;\n                    left -= piece;\n                    b.forward(piece);\n                }\n                else if (b.ins == 0 && b.len < left) {\n                    left -= b.len;\n                    b.next();\n                }\n                else {\n                    break;\n                }\n            }\n            addSection(sections, len, inserted < a.i ? a.ins : 0);\n            if (insert && inserted < a.i)\n                addInsert(insert, sections, a.text);\n            inserted = a.i;\n            a.forward(a.len - left);\n        }\n        else if (a.done && b.done) {\n            return insert ? ChangeSet.createSet(sections, insert) : ChangeDesc.create(sections);\n        }\n        else {\n            throw new Error(\"Mismatched change set lengths\");\n        }\n    }\n}\nfunction composeSets(setA, setB, mkSet = false) {\n    let sections = [];\n    let insert = mkSet ? [] : null;\n    let a = new SectionIter(setA), b = new SectionIter(setB);\n    for (let open = false;;) {\n        if (a.done && b.done) {\n            return insert ? ChangeSet.createSet(sections, insert) : ChangeDesc.create(sections);\n        }\n        else if (a.ins == 0) { // Deletion in A\n            addSection(sections, a.len, 0, open);\n            a.next();\n        }\n        else if (b.len == 0 && !b.done) { // Insertion in B\n            addSection(sections, 0, b.ins, open);\n            if (insert)\n                addInsert(insert, sections, b.text);\n            b.next();\n        }\n        else if (a.done || b.done) {\n            throw new Error(\"Mismatched change set lengths\");\n        }\n        else {\n            let len = Math.min(a.len2, b.len), sectionLen = sections.length;\n            if (a.ins == -1) {\n                let insB = b.ins == -1 ? -1 : b.off ? 0 : b.ins;\n                addSection(sections, len, insB, open);\n                if (insert && insB)\n                    addInsert(insert, sections, b.text);\n            }\n            else if (b.ins == -1) {\n                addSection(sections, a.off ? 0 : a.len, len, open);\n                if (insert)\n                    addInsert(insert, sections, a.textBit(len));\n            }\n            else {\n                addSection(sections, a.off ? 0 : a.len, b.off ? 0 : b.ins, open);\n                if (insert && !b.off)\n                    addInsert(insert, sections, b.text);\n            }\n            open = (a.ins > len || b.ins >= 0 && b.len > len) && (open || sections.length > sectionLen);\n            a.forward2(len);\n            b.forward(len);\n        }\n    }\n}\nclass SectionIter {\n    constructor(set) {\n        this.set = set;\n        this.i = 0;\n        this.next();\n    }\n    next() {\n        let { sections } = this.set;\n        if (this.i < sections.length) {\n            this.len = sections[this.i++];\n            this.ins = sections[this.i++];\n        }\n        else {\n            this.len = 0;\n            this.ins = -2;\n        }\n        this.off = 0;\n    }\n    get done() { return this.ins == -2; }\n    get len2() { return this.ins < 0 ? this.len : this.ins; }\n    get text() {\n        let { inserted } = this.set, index = (this.i - 2) >> 1;\n        return index >= inserted.length ? Text.empty : inserted[index];\n    }\n    textBit(len) {\n        let { inserted } = this.set, index = (this.i - 2) >> 1;\n        return index >= inserted.length && !len ? Text.empty\n            : inserted[index].slice(this.off, len == null ? undefined : this.off + len);\n    }\n    forward(len) {\n        if (len == this.len)\n            this.next();\n        else {\n            this.len -= len;\n            this.off += len;\n        }\n    }\n    forward2(len) {\n        if (this.ins == -1)\n            this.forward(len);\n        else if (len == this.ins)\n            this.next();\n        else {\n            this.ins -= len;\n            this.off += len;\n        }\n    }\n}\n\n/**\nA single selection range. When\n[`allowMultipleSelections`](https://codemirror.net/6/docs/ref/#state.EditorState^allowMultipleSelections)\nis enabled, a [selection](https://codemirror.net/6/docs/ref/#state.EditorSelection) may hold\nmultiple ranges. By default, selections hold exactly one range.\n*/\nclass SelectionRange {\n    constructor(\n    /**\n    The lower boundary of the range.\n    */\n    from, \n    /**\n    The upper boundary of the range.\n    */\n    to, flags) {\n        this.from = from;\n        this.to = to;\n        this.flags = flags;\n    }\n    /**\n    The anchor of the range—the side that doesn't move when you\n    extend it.\n    */\n    get anchor() { return this.flags & 16 /* RangeFlag.Inverted */ ? this.to : this.from; }\n    /**\n    The head of the range, which is moved when the range is\n    [extended](https://codemirror.net/6/docs/ref/#state.SelectionRange.extend).\n    */\n    get head() { return this.flags & 16 /* RangeFlag.Inverted */ ? this.from : this.to; }\n    /**\n    True when `anchor` and `head` are at the same position.\n    */\n    get empty() { return this.from == this.to; }\n    /**\n    If this is a cursor that is explicitly associated with the\n    character on one of its sides, this returns the side. -1 means\n    the character before its position, 1 the character after, and 0\n    means no association.\n    */\n    get assoc() { return this.flags & 4 /* RangeFlag.AssocBefore */ ? -1 : this.flags & 8 /* RangeFlag.AssocAfter */ ? 1 : 0; }\n    /**\n    The bidirectional text level associated with this cursor, if\n    any.\n    */\n    get bidiLevel() {\n        let level = this.flags & 3 /* RangeFlag.BidiLevelMask */;\n        return level == 3 ? null : level;\n    }\n    /**\n    The goal column (stored vertical offset) associated with a\n    cursor. This is used to preserve the vertical position when\n    [moving](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) across\n    lines of different length.\n    */\n    get goalColumn() {\n        let value = this.flags >> 5 /* RangeFlag.GoalColumnOffset */;\n        return value == 33554431 /* RangeFlag.NoGoalColumn */ ? undefined : value;\n    }\n    /**\n    Map this range through a change, producing a valid range in the\n    updated document.\n    */\n    map(change, assoc = -1) {\n        let from, to;\n        if (this.empty) {\n            from = to = change.mapPos(this.from, assoc);\n        }\n        else {\n            from = change.mapPos(this.from, 1);\n            to = change.mapPos(this.to, -1);\n        }\n        return from == this.from && to == this.to ? this : new SelectionRange(from, to, this.flags);\n    }\n    /**\n    Extend this range to cover at least `from` to `to`.\n    */\n    extend(from, to = from) {\n        if (from <= this.anchor && to >= this.anchor)\n            return EditorSelection.range(from, to);\n        let head = Math.abs(from - this.anchor) > Math.abs(to - this.anchor) ? from : to;\n        return EditorSelection.range(this.anchor, head);\n    }\n    /**\n    Compare this range to another range.\n    */\n    eq(other) {\n        return this.anchor == other.anchor && this.head == other.head;\n    }\n    /**\n    Return a JSON-serializable object representing the range.\n    */\n    toJSON() { return { anchor: this.anchor, head: this.head }; }\n    /**\n    Convert a JSON representation of a range to a `SelectionRange`\n    instance.\n    */\n    static fromJSON(json) {\n        if (!json || typeof json.anchor != \"number\" || typeof json.head != \"number\")\n            throw new RangeError(\"Invalid JSON representation for SelectionRange\");\n        return EditorSelection.range(json.anchor, json.head);\n    }\n    /**\n    @internal\n    */\n    static create(from, to, flags) {\n        return new SelectionRange(from, to, flags);\n    }\n}\n/**\nAn editor selection holds one or more selection ranges.\n*/\nclass EditorSelection {\n    constructor(\n    /**\n    The ranges in the selection, sorted by position. Ranges cannot\n    overlap (but they may touch, if they aren't empty).\n    */\n    ranges, \n    /**\n    The index of the _main_ range in the selection (which is\n    usually the range that was added last).\n    */\n    mainIndex) {\n        this.ranges = ranges;\n        this.mainIndex = mainIndex;\n    }\n    /**\n    Map a selection through a change. Used to adjust the selection\n    position for changes.\n    */\n    map(change, assoc = -1) {\n        if (change.empty)\n            return this;\n        return EditorSelection.create(this.ranges.map(r => r.map(change, assoc)), this.mainIndex);\n    }\n    /**\n    Compare this selection to another selection.\n    */\n    eq(other) {\n        if (this.ranges.length != other.ranges.length ||\n            this.mainIndex != other.mainIndex)\n            return false;\n        for (let i = 0; i < this.ranges.length; i++)\n            if (!this.ranges[i].eq(other.ranges[i]))\n                return false;\n        return true;\n    }\n    /**\n    Get the primary selection range. Usually, you should make sure\n    your code applies to _all_ ranges, by using methods like\n    [`changeByRange`](https://codemirror.net/6/docs/ref/#state.EditorState.changeByRange).\n    */\n    get main() { return this.ranges[this.mainIndex]; }\n    /**\n    Make sure the selection only has one range. Returns a selection\n    holding only the main range from this selection.\n    */\n    asSingle() {\n        return this.ranges.length == 1 ? this : new EditorSelection([this.main], 0);\n    }\n    /**\n    Extend this selection with an extra range.\n    */\n    addRange(range, main = true) {\n        return EditorSelection.create([range].concat(this.ranges), main ? 0 : this.mainIndex + 1);\n    }\n    /**\n    Replace a given range with another range, and then normalize the\n    selection to merge and sort ranges if necessary.\n    */\n    replaceRange(range, which = this.mainIndex) {\n        let ranges = this.ranges.slice();\n        ranges[which] = range;\n        return EditorSelection.create(ranges, this.mainIndex);\n    }\n    /**\n    Convert this selection to an object that can be serialized to\n    JSON.\n    */\n    toJSON() {\n        return { ranges: this.ranges.map(r => r.toJSON()), main: this.mainIndex };\n    }\n    /**\n    Create a selection from a JSON representation.\n    */\n    static fromJSON(json) {\n        if (!json || !Array.isArray(json.ranges) || typeof json.main != \"number\" || json.main >= json.ranges.length)\n            throw new RangeError(\"Invalid JSON representation for EditorSelection\");\n        return new EditorSelection(json.ranges.map((r) => SelectionRange.fromJSON(r)), json.main);\n    }\n    /**\n    Create a selection holding a single range.\n    */\n    static single(anchor, head = anchor) {\n        return new EditorSelection([EditorSelection.range(anchor, head)], 0);\n    }\n    /**\n    Sort and merge the given set of ranges, creating a valid\n    selection.\n    */\n    static create(ranges, mainIndex = 0) {\n        if (ranges.length == 0)\n            throw new RangeError(\"A selection needs at least one range\");\n        for (let pos = 0, i = 0; i < ranges.length; i++) {\n            let range = ranges[i];\n            if (range.empty ? range.from <= pos : range.from < pos)\n                return EditorSelection.normalized(ranges.slice(), mainIndex);\n            pos = range.to;\n        }\n        return new EditorSelection(ranges, mainIndex);\n    }\n    /**\n    Create a cursor selection range at the given position. You can\n    safely ignore the optional arguments in most situations.\n    */\n    static cursor(pos, assoc = 0, bidiLevel, goalColumn) {\n        return SelectionRange.create(pos, pos, (assoc == 0 ? 0 : assoc < 0 ? 4 /* RangeFlag.AssocBefore */ : 8 /* RangeFlag.AssocAfter */) |\n            (bidiLevel == null ? 3 : Math.min(2, bidiLevel)) |\n            ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */));\n    }\n    /**\n    Create a selection range.\n    */\n    static range(anchor, head, goalColumn, bidiLevel) {\n        let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */) |\n            (bidiLevel == null ? 3 : Math.min(2, bidiLevel));\n        return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | 8 /* RangeFlag.AssocAfter */ | flags)\n            : SelectionRange.create(anchor, head, (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0) | flags);\n    }\n    /**\n    @internal\n    */\n    static normalized(ranges, mainIndex = 0) {\n        let main = ranges[mainIndex];\n        ranges.sort((a, b) => a.from - b.from);\n        mainIndex = ranges.indexOf(main);\n        for (let i = 1; i < ranges.length; i++) {\n            let range = ranges[i], prev = ranges[i - 1];\n            if (range.empty ? range.from <= prev.to : range.from < prev.to) {\n                let from = prev.from, to = Math.max(range.to, prev.to);\n                if (i <= mainIndex)\n                    mainIndex--;\n                ranges.splice(--i, 2, range.anchor > range.head ? EditorSelection.range(to, from) : EditorSelection.range(from, to));\n            }\n        }\n        return new EditorSelection(ranges, mainIndex);\n    }\n}\nfunction checkSelection(selection, docLength) {\n    for (let range of selection.ranges)\n        if (range.to > docLength)\n            throw new RangeError(\"Selection points outside of document\");\n}\n\nlet nextID = 0;\n/**\nA facet is a labeled value that is associated with an editor\nstate. It takes inputs from any number of extensions, and combines\nthose into a single output value.\n\nExamples of uses of facets are the [tab\nsize](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize), [editor\nattributes](https://codemirror.net/6/docs/ref/#view.EditorView^editorAttributes), and [update\nlisteners](https://codemirror.net/6/docs/ref/#view.EditorView^updateListener).\n*/\nclass Facet {\n    constructor(\n    /**\n    @internal\n    */\n    combine, \n    /**\n    @internal\n    */\n    compareInput, \n    /**\n    @internal\n    */\n    compare, isStatic, enables) {\n        this.combine = combine;\n        this.compareInput = compareInput;\n        this.compare = compare;\n        this.isStatic = isStatic;\n        /**\n        @internal\n        */\n        this.id = nextID++;\n        this.default = combine([]);\n        this.extensions = typeof enables == \"function\" ? enables(this) : enables;\n    }\n    /**\n    Define a new facet.\n    */\n    static define(config = {}) {\n        return new Facet(config.combine || ((a) => a), config.compareInput || ((a, b) => a === b), config.compare || (!config.combine ? sameArray : (a, b) => a === b), !!config.static, config.enables);\n    }\n    /**\n    Returns an extension that adds the given value to this facet.\n    */\n    of(value) {\n        return new FacetProvider([], this, 0 /* Provider.Static */, value);\n    }\n    /**\n    Create an extension that computes a value for the facet from a\n    state. You must take care to declare the parts of the state that\n    this value depends on, since your function is only called again\n    for a new state when one of those parts changed.\n    \n    In cases where your value depends only on a single field, you'll\n    want to use the [`from`](https://codemirror.net/6/docs/ref/#state.Facet.from) method instead.\n    */\n    compute(deps, get) {\n        if (this.isStatic)\n            throw new Error(\"Can't compute a static facet\");\n        return new FacetProvider(deps, this, 1 /* Provider.Single */, get);\n    }\n    /**\n    Create an extension that computes zero or more values for this\n    facet from a state.\n    */\n    computeN(deps, get) {\n        if (this.isStatic)\n            throw new Error(\"Can't compute a static facet\");\n        return new FacetProvider(deps, this, 2 /* Provider.Multi */, get);\n    }\n    from(field, get) {\n        if (!get)\n            get = x => x;\n        return this.compute([field], state => get(state.field(field)));\n    }\n}\nfunction sameArray(a, b) {\n    return a == b || a.length == b.length && a.every((e, i) => e === b[i]);\n}\nclass FacetProvider {\n    constructor(dependencies, facet, type, value) {\n        this.dependencies = dependencies;\n        this.facet = facet;\n        this.type = type;\n        this.value = value;\n        this.id = nextID++;\n    }\n    dynamicSlot(addresses) {\n        var _a;\n        let getter = this.value;\n        let compare = this.facet.compareInput;\n        let id = this.id, idx = addresses[id] >> 1, multi = this.type == 2 /* Provider.Multi */;\n        let depDoc = false, depSel = false, depAddrs = [];\n        for (let dep of this.dependencies) {\n            if (dep == \"doc\")\n                depDoc = true;\n            else if (dep == \"selection\")\n                depSel = true;\n            else if ((((_a = addresses[dep.id]) !== null && _a !== void 0 ? _a : 1) & 1) == 0)\n                depAddrs.push(addresses[dep.id]);\n        }\n        return {\n            create(state) {\n                state.values[idx] = getter(state);\n                return 1 /* SlotStatus.Changed */;\n            },\n            update(state, tr) {\n                if ((depDoc && tr.docChanged) || (depSel && (tr.docChanged || tr.selection)) || ensureAll(state, depAddrs)) {\n                    let newVal = getter(state);\n                    if (multi ? !compareArray(newVal, state.values[idx], compare) : !compare(newVal, state.values[idx])) {\n                        state.values[idx] = newVal;\n                        return 1 /* SlotStatus.Changed */;\n                    }\n                }\n                return 0;\n            },\n            reconfigure: (state, oldState) => {\n                let newVal, oldAddr = oldState.config.address[id];\n                if (oldAddr != null) {\n                    let oldVal = getAddr(oldState, oldAddr);\n                    if (this.dependencies.every(dep => {\n                        return dep instanceof Facet ? oldState.facet(dep) === state.facet(dep) :\n                            dep instanceof StateField ? oldState.field(dep, false) == state.field(dep, false) : true;\n                    }) || (multi ? compareArray(newVal = getter(state), oldVal, compare) : compare(newVal = getter(state), oldVal))) {\n                        state.values[idx] = oldVal;\n                        return 0;\n                    }\n                }\n                else {\n                    newVal = getter(state);\n                }\n                state.values[idx] = newVal;\n                return 1 /* SlotStatus.Changed */;\n            }\n        };\n    }\n}\nfunction compareArray(a, b, compare) {\n    if (a.length != b.length)\n        return false;\n    for (let i = 0; i < a.length; i++)\n        if (!compare(a[i], b[i]))\n            return false;\n    return true;\n}\nfunction ensureAll(state, addrs) {\n    let changed = false;\n    for (let addr of addrs)\n        if (ensureAddr(state, addr) & 1 /* SlotStatus.Changed */)\n            changed = true;\n    return changed;\n}\nfunction dynamicFacetSlot(addresses, facet, providers) {\n    let providerAddrs = providers.map(p => addresses[p.id]);\n    let providerTypes = providers.map(p => p.type);\n    let dynamic = providerAddrs.filter(p => !(p & 1));\n    let idx = addresses[facet.id] >> 1;\n    function get(state) {\n        let values = [];\n        for (let i = 0; i < providerAddrs.length; i++) {\n            let value = getAddr(state, providerAddrs[i]);\n            if (providerTypes[i] == 2 /* Provider.Multi */)\n                for (let val of value)\n                    values.push(val);\n            else\n                values.push(value);\n        }\n        return facet.combine(values);\n    }\n    return {\n        create(state) {\n            for (let addr of providerAddrs)\n                ensureAddr(state, addr);\n            state.values[idx] = get(state);\n            return 1 /* SlotStatus.Changed */;\n        },\n        update(state, tr) {\n            if (!ensureAll(state, dynamic))\n                return 0;\n            let value = get(state);\n            if (facet.compare(value, state.values[idx]))\n                return 0;\n            state.values[idx] = value;\n            return 1 /* SlotStatus.Changed */;\n        },\n        reconfigure(state, oldState) {\n            let depChanged = ensureAll(state, providerAddrs);\n            let oldProviders = oldState.config.facets[facet.id], oldValue = oldState.facet(facet);\n            if (oldProviders && !depChanged && sameArray(providers, oldProviders)) {\n                state.values[idx] = oldValue;\n                return 0;\n            }\n            let value = get(state);\n            if (facet.compare(value, oldValue)) {\n                state.values[idx] = oldValue;\n                return 0;\n            }\n            state.values[idx] = value;\n            return 1 /* SlotStatus.Changed */;\n        }\n    };\n}\nconst initField = /*@__PURE__*/Facet.define({ static: true });\n/**\nFields can store additional information in an editor state, and\nkeep it in sync with the rest of the state.\n*/\nclass StateField {\n    constructor(\n    /**\n    @internal\n    */\n    id, createF, updateF, compareF, \n    /**\n    @internal\n    */\n    spec) {\n        this.id = id;\n        this.createF = createF;\n        this.updateF = updateF;\n        this.compareF = compareF;\n        this.spec = spec;\n        /**\n        @internal\n        */\n        this.provides = undefined;\n    }\n    /**\n    Define a state field.\n    */\n    static define(config) {\n        let field = new StateField(nextID++, config.create, config.update, config.compare || ((a, b) => a === b), config);\n        if (config.provide)\n            field.provides = config.provide(field);\n        return field;\n    }\n    create(state) {\n        let init = state.facet(initField).find(i => i.field == this);\n        return ((init === null || init === void 0 ? void 0 : init.create) || this.createF)(state);\n    }\n    /**\n    @internal\n    */\n    slot(addresses) {\n        let idx = addresses[this.id] >> 1;\n        return {\n            create: (state) => {\n                state.values[idx] = this.create(state);\n                return 1 /* SlotStatus.Changed */;\n            },\n            update: (state, tr) => {\n                let oldVal = state.values[idx];\n                let value = this.updateF(oldVal, tr);\n                if (this.compareF(oldVal, value))\n                    return 0;\n                state.values[idx] = value;\n                return 1 /* SlotStatus.Changed */;\n            },\n            reconfigure: (state, oldState) => {\n                if (oldState.config.address[this.id] != null) {\n                    state.values[idx] = oldState.field(this);\n                    return 0;\n                }\n                state.values[idx] = this.create(state);\n                return 1 /* SlotStatus.Changed */;\n            }\n        };\n    }\n    /**\n    Returns an extension that enables this field and overrides the\n    way it is initialized. Can be useful when you need to provide a\n    non-default starting value for the field.\n    */\n    init(create) {\n        return [this, initField.of({ field: this, create })];\n    }\n    /**\n    State field instances can be used as\n    [`Extension`](https://codemirror.net/6/docs/ref/#state.Extension) values to enable the field in a\n    given state.\n    */\n    get extension() { return this; }\n}\nconst Prec_ = { lowest: 4, low: 3, default: 2, high: 1, highest: 0 };\nfunction prec(value) {\n    return (ext) => new PrecExtension(ext, value);\n}\n/**\nBy default extensions are registered in the order they are found\nin the flattened form of nested array that was provided.\nIndividual extension values can be assigned a precedence to\noverride this. Extensions that do not have a precedence set get\nthe precedence of the nearest parent with a precedence, or\n[`default`](https://codemirror.net/6/docs/ref/#state.Prec.default) if there is no such parent. The\nfinal ordering of extensions is determined by first sorting by\nprecedence and then by order within each precedence.\n*/\nconst Prec = {\n    /**\n    The highest precedence level, for extensions that should end up\n    near the start of the precedence ordering.\n    */\n    highest: /*@__PURE__*/prec(Prec_.highest),\n    /**\n    A higher-than-default precedence, for extensions that should\n    come before those with default precedence.\n    */\n    high: /*@__PURE__*/prec(Prec_.high),\n    /**\n    The default precedence, which is also used for extensions\n    without an explicit precedence.\n    */\n    default: /*@__PURE__*/prec(Prec_.default),\n    /**\n    A lower-than-default precedence.\n    */\n    low: /*@__PURE__*/prec(Prec_.low),\n    /**\n    The lowest precedence level. Meant for things that should end up\n    near the end of the extension order.\n    */\n    lowest: /*@__PURE__*/prec(Prec_.lowest)\n};\nclass PrecExtension {\n    constructor(inner, prec) {\n        this.inner = inner;\n        this.prec = prec;\n    }\n}\n/**\nExtension compartments can be used to make a configuration\ndynamic. By [wrapping](https://codemirror.net/6/docs/ref/#state.Compartment.of) part of your\nconfiguration in a compartment, you can later\n[replace](https://codemirror.net/6/docs/ref/#state.Compartment.reconfigure) that part through a\ntransaction.\n*/\nclass Compartment {\n    /**\n    Create an instance of this compartment to add to your [state\n    configuration](https://codemirror.net/6/docs/ref/#state.EditorStateConfig.extensions).\n    */\n    of(ext) { return new CompartmentInstance(this, ext); }\n    /**\n    Create an [effect](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) that\n    reconfigures this compartment.\n    */\n    reconfigure(content) {\n        return Compartment.reconfigure.of({ compartment: this, extension: content });\n    }\n    /**\n    Get the current content of the compartment in the state, or\n    `undefined` if it isn't present.\n    */\n    get(state) {\n        return state.config.compartments.get(this);\n    }\n}\nclass CompartmentInstance {\n    constructor(compartment, inner) {\n        this.compartment = compartment;\n        this.inner = inner;\n    }\n}\nclass Configuration {\n    constructor(base, compartments, dynamicSlots, address, staticValues, facets) {\n        this.base = base;\n        this.compartments = compartments;\n        this.dynamicSlots = dynamicSlots;\n        this.address = address;\n        this.staticValues = staticValues;\n        this.facets = facets;\n        this.statusTemplate = [];\n        while (this.statusTemplate.length < dynamicSlots.length)\n            this.statusTemplate.push(0 /* SlotStatus.Unresolved */);\n    }\n    staticFacet(facet) {\n        let addr = this.address[facet.id];\n        return addr == null ? facet.default : this.staticValues[addr >> 1];\n    }\n    static resolve(base, compartments, oldState) {\n        let fields = [];\n        let facets = Object.create(null);\n        let newCompartments = new Map();\n        for (let ext of flatten(base, compartments, newCompartments)) {\n            if (ext instanceof StateField)\n                fields.push(ext);\n            else\n                (facets[ext.facet.id] || (facets[ext.facet.id] = [])).push(ext);\n        }\n        let address = Object.create(null);\n        let staticValues = [];\n        let dynamicSlots = [];\n        for (let field of fields) {\n            address[field.id] = dynamicSlots.length << 1;\n            dynamicSlots.push(a => field.slot(a));\n        }\n        let oldFacets = oldState === null || oldState === void 0 ? void 0 : oldState.config.facets;\n        for (let id in facets) {\n            let providers = facets[id], facet = providers[0].facet;\n            let oldProviders = oldFacets && oldFacets[id] || [];\n            if (providers.every(p => p.type == 0 /* Provider.Static */)) {\n                address[facet.id] = (staticValues.length << 1) | 1;\n                if (sameArray(oldProviders, providers)) {\n                    staticValues.push(oldState.facet(facet));\n                }\n                else {\n                    let value = facet.combine(providers.map(p => p.value));\n                    staticValues.push(oldState && facet.compare(value, oldState.facet(facet)) ? oldState.facet(facet) : value);\n                }\n            }\n            else {\n                for (let p of providers) {\n                    if (p.type == 0 /* Provider.Static */) {\n                        address[p.id] = (staticValues.length << 1) | 1;\n                        staticValues.push(p.value);\n                    }\n                    else {\n                        address[p.id] = dynamicSlots.length << 1;\n                        dynamicSlots.push(a => p.dynamicSlot(a));\n                    }\n                }\n                address[facet.id] = dynamicSlots.length << 1;\n                dynamicSlots.push(a => dynamicFacetSlot(a, facet, providers));\n            }\n        }\n        let dynamic = dynamicSlots.map(f => f(address));\n        return new Configuration(base, newCompartments, dynamic, address, staticValues, facets);\n    }\n}\nfunction flatten(extension, compartments, newCompartments) {\n    let result = [[], [], [], [], []];\n    let seen = new Map();\n    function inner(ext, prec) {\n        let known = seen.get(ext);\n        if (known != null) {\n            if (known <= prec)\n                return;\n            let found = result[known].indexOf(ext);\n            if (found > -1)\n                result[known].splice(found, 1);\n            if (ext instanceof CompartmentInstance)\n                newCompartments.delete(ext.compartment);\n        }\n        seen.set(ext, prec);\n        if (Array.isArray(ext)) {\n            for (let e of ext)\n                inner(e, prec);\n        }\n        else if (ext instanceof CompartmentInstance) {\n            if (newCompartments.has(ext.compartment))\n                throw new RangeError(`Duplicate use of compartment in extensions`);\n            let content = compartments.get(ext.compartment) || ext.inner;\n            newCompartments.set(ext.compartment, content);\n            inner(content, prec);\n        }\n        else if (ext instanceof PrecExtension) {\n            inner(ext.inner, ext.prec);\n        }\n        else if (ext instanceof StateField) {\n            result[prec].push(ext);\n            if (ext.provides)\n                inner(ext.provides, prec);\n        }\n        else if (ext instanceof FacetProvider) {\n            result[prec].push(ext);\n            if (ext.facet.extensions)\n                inner(ext.facet.extensions, Prec_.default);\n        }\n        else {\n            let content = ext.extension;\n            if (!content)\n                throw new Error(`Unrecognized extension value in extension set (${ext}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);\n            inner(content, prec);\n        }\n    }\n    inner(extension, Prec_.default);\n    return result.reduce((a, b) => a.concat(b));\n}\nfunction ensureAddr(state, addr) {\n    if (addr & 1)\n        return 2 /* SlotStatus.Computed */;\n    let idx = addr >> 1;\n    let status = state.status[idx];\n    if (status == 4 /* SlotStatus.Computing */)\n        throw new Error(\"Cyclic dependency between fields and/or facets\");\n    if (status & 2 /* SlotStatus.Computed */)\n        return status;\n    state.status[idx] = 4 /* SlotStatus.Computing */;\n    let changed = state.computeSlot(state, state.config.dynamicSlots[idx]);\n    return state.status[idx] = 2 /* SlotStatus.Computed */ | changed;\n}\nfunction getAddr(state, addr) {\n    return addr & 1 ? state.config.staticValues[addr >> 1] : state.values[addr >> 1];\n}\n\nconst languageData = /*@__PURE__*/Facet.define();\nconst allowMultipleSelections = /*@__PURE__*/Facet.define({\n    combine: values => values.some(v => v),\n    static: true\n});\nconst lineSeparator = /*@__PURE__*/Facet.define({\n    combine: values => values.length ? values[0] : undefined,\n    static: true\n});\nconst changeFilter = /*@__PURE__*/Facet.define();\nconst transactionFilter = /*@__PURE__*/Facet.define();\nconst transactionExtender = /*@__PURE__*/Facet.define();\nconst readOnly = /*@__PURE__*/Facet.define({\n    combine: values => values.length ? values[0] : false\n});\n\n/**\nAnnotations are tagged values that are used to add metadata to\ntransactions in an extensible way. They should be used to model\nthings that effect the entire transaction (such as its [time\nstamp](https://codemirror.net/6/docs/ref/#state.Transaction^time) or information about its\n[origin](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent)). For effects that happen\n_alongside_ the other changes made by the transaction, [state\neffects](https://codemirror.net/6/docs/ref/#state.StateEffect) are more appropriate.\n*/\nclass Annotation {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    The annotation type.\n    */\n    type, \n    /**\n    The value of this annotation.\n    */\n    value) {\n        this.type = type;\n        this.value = value;\n    }\n    /**\n    Define a new type of annotation.\n    */\n    static define() { return new AnnotationType(); }\n}\n/**\nMarker that identifies a type of [annotation](https://codemirror.net/6/docs/ref/#state.Annotation).\n*/\nclass AnnotationType {\n    /**\n    Create an instance of this annotation.\n    */\n    of(value) { return new Annotation(this, value); }\n}\n/**\nRepresentation of a type of state effect. Defined with\n[`StateEffect.define`](https://codemirror.net/6/docs/ref/#state.StateEffect^define).\n*/\nclass StateEffectType {\n    /**\n    @internal\n    */\n    constructor(\n    // The `any` types in these function types are there to work\n    // around TypeScript issue #37631, where the type guard on\n    // `StateEffect.is` mysteriously stops working when these properly\n    // have type `Value`.\n    /**\n    @internal\n    */\n    map) {\n        this.map = map;\n    }\n    /**\n    Create a [state effect](https://codemirror.net/6/docs/ref/#state.StateEffect) instance of this\n    type.\n    */\n    of(value) { return new StateEffect(this, value); }\n}\n/**\nState effects can be used to represent additional effects\nassociated with a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction.effects). They\nare often useful to model changes to custom [state\nfields](https://codemirror.net/6/docs/ref/#state.StateField), when those changes aren't implicit in\ndocument or selection changes.\n*/\nclass StateEffect {\n    /**\n    @internal\n    */\n    constructor(\n    /**\n    @internal\n    */\n    type, \n    /**\n    The value of this effect.\n    */\n    value) {\n        this.type = type;\n        this.value = value;\n    }\n    /**\n    Map this effect through a position mapping. Will return\n    `undefined` when that ends up deleting the effect.\n    */\n    map(mapping) {\n        let mapped = this.type.map(this.value, mapping);\n        return mapped === undefined ? undefined : mapped == this.value ? this : new StateEffect(this.type, mapped);\n    }\n    /**\n    Tells you whether this effect object is of a given\n    [type](https://codemirror.net/6/docs/ref/#state.StateEffectType).\n    */\n    is(type) { return this.type == type; }\n    /**\n    Define a new effect type. The type parameter indicates the type\n    of values that his effect holds. It should be a type that\n    doesn't include `undefined`, since that is used in\n    [mapping](https://codemirror.net/6/docs/ref/#state.StateEffect.map) to indicate that an effect is\n    removed.\n    */\n    static define(spec = {}) {\n        return new StateEffectType(spec.map || (v => v));\n    }\n    /**\n    Map an array of effects through a change set.\n    */\n    static mapEffects(effects, mapping) {\n        if (!effects.length)\n            return effects;\n        let result = [];\n        for (let effect of effects) {\n            let mapped = effect.map(mapping);\n            if (mapped)\n                result.push(mapped);\n        }\n        return result;\n    }\n}\n/**\nThis effect can be used to reconfigure the root extensions of\nthe editor. Doing this will discard any extensions\n[appended](https://codemirror.net/6/docs/ref/#state.StateEffect^appendConfig), but does not reset\nthe content of [reconfigured](https://codemirror.net/6/docs/ref/#state.Compartment.reconfigure)\ncompartments.\n*/\nStateEffect.reconfigure = /*@__PURE__*/StateEffect.define();\n/**\nAppend extensions to the top-level configuration of the editor.\n*/\nStateEffect.appendConfig = /*@__PURE__*/StateEffect.define();\n/**\nChanges to the editor state are grouped into transactions.\nTypically, a user action creates a single transaction, which may\ncontain any number of document changes, may change the selection,\nor have other effects. Create a transaction by calling\n[`EditorState.update`](https://codemirror.net/6/docs/ref/#state.EditorState.update), or immediately\ndispatch one by calling\n[`EditorView.dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch).\n*/\nclass Transaction {\n    constructor(\n    /**\n    The state from which the transaction starts.\n    */\n    startState, \n    /**\n    The document changes made by this transaction.\n    */\n    changes, \n    /**\n    The selection set by this transaction, or undefined if it\n    doesn't explicitly set a selection.\n    */\n    selection, \n    /**\n    The effects added to the transaction.\n    */\n    effects, \n    /**\n    @internal\n    */\n    annotations, \n    /**\n    Whether the selection should be scrolled into view after this\n    transaction is dispatched.\n    */\n    scrollIntoView) {\n        this.startState = startState;\n        this.changes = changes;\n        this.selection = selection;\n        this.effects = effects;\n        this.annotations = annotations;\n        this.scrollIntoView = scrollIntoView;\n        /**\n        @internal\n        */\n        this._doc = null;\n        /**\n        @internal\n        */\n        this._state = null;\n        if (selection)\n            checkSelection(selection, changes.newLength);\n        if (!annotations.some((a) => a.type == Transaction.time))\n            this.annotations = annotations.concat(Transaction.time.of(Date.now()));\n    }\n    /**\n    @internal\n    */\n    static create(startState, changes, selection, effects, annotations, scrollIntoView) {\n        return new Transaction(startState, changes, selection, effects, annotations, scrollIntoView);\n    }\n    /**\n    The new document produced by the transaction. Contrary to\n    [`.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state)`.doc`, accessing this won't\n    force the entire new state to be computed right away, so it is\n    recommended that [transaction\n    filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) use this getter\n    when they need to look at the new document.\n    */\n    get newDoc() {\n        return this._doc || (this._doc = this.changes.apply(this.startState.doc));\n    }\n    /**\n    The new selection produced by the transaction. If\n    [`this.selection`](https://codemirror.net/6/docs/ref/#state.Transaction.selection) is undefined,\n    this will [map](https://codemirror.net/6/docs/ref/#state.EditorSelection.map) the start state's\n    current selection through the changes made by the transaction.\n    */\n    get newSelection() {\n        return this.selection || this.startState.selection.map(this.changes);\n    }\n    /**\n    The new state created by the transaction. Computed on demand\n    (but retained for subsequent access), so it is recommended not to\n    access it in [transaction\n    filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) when possible.\n    */\n    get state() {\n        if (!this._state)\n            this.startState.applyTransaction(this);\n        return this._state;\n    }\n    /**\n    Get the value of the given annotation type, if any.\n    */\n    annotation(type) {\n        for (let ann of this.annotations)\n            if (ann.type == type)\n                return ann.value;\n        return undefined;\n    }\n    /**\n    Indicates whether the transaction changed the document.\n    */\n    get docChanged() { return !this.changes.empty; }\n    /**\n    Indicates whether this transaction reconfigures the state\n    (through a [configuration compartment](https://codemirror.net/6/docs/ref/#state.Compartment) or\n    with a top-level configuration\n    [effect](https://codemirror.net/6/docs/ref/#state.StateEffect^reconfigure).\n    */\n    get reconfigured() { return this.startState.config != this.state.config; }\n    /**\n    Returns true if the transaction has a [user\n    event](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent) annotation that is equal to\n    or more specific than `event`. For example, if the transaction\n    has `\"select.pointer\"` as user event, `\"select\"` and\n    `\"select.pointer\"` will match it.\n    */\n    isUserEvent(event) {\n        let e = this.annotation(Transaction.userEvent);\n        return !!(e && (e == event || e.length > event.length && e.slice(0, event.length) == event && e[event.length] == \".\"));\n    }\n}\n/**\nAnnotation used to store transaction timestamps. Automatically\nadded to every transaction, holding `Date.now()`.\n*/\nTransaction.time = /*@__PURE__*/Annotation.define();\n/**\nAnnotation used to associate a transaction with a user interface\nevent. Holds a string identifying the event, using a\ndot-separated format to support attaching more specific\ninformation. The events used by the core libraries are:\n\n - `\"input\"` when content is entered\n   - `\"input.type\"` for typed input\n     - `\"input.type.compose\"` for composition\n   - `\"input.paste\"` for pasted input\n   - `\"input.drop\"` when adding content with drag-and-drop\n   - `\"input.complete\"` when autocompleting\n - `\"delete\"` when the user deletes content\n   - `\"delete.selection\"` when deleting the selection\n   - `\"delete.forward\"` when deleting forward from the selection\n   - `\"delete.backward\"` when deleting backward from the selection\n   - `\"delete.cut\"` when cutting to the clipboard\n - `\"move\"` when content is moved\n   - `\"move.drop\"` when content is moved within the editor through drag-and-drop\n - `\"select\"` when explicitly changing the selection\n   - `\"select.pointer\"` when selecting with a mouse or other pointing device\n - `\"undo\"` and `\"redo\"` for history actions\n\nUse [`isUserEvent`](https://codemirror.net/6/docs/ref/#state.Transaction.isUserEvent) to check\nwhether the annotation matches a given event.\n*/\nTransaction.userEvent = /*@__PURE__*/Annotation.define();\n/**\nAnnotation indicating whether a transaction should be added to\nthe undo history or not.\n*/\nTransaction.addToHistory = /*@__PURE__*/Annotation.define();\n/**\nAnnotation indicating (when present and true) that a transaction\nrepresents a change made by some other actor, not the user. This\nis used, for example, to tag other people's changes in\ncollaborative editing.\n*/\nTransaction.remote = /*@__PURE__*/Annotation.define();\nfunction joinRanges(a, b) {\n    let result = [];\n    for (let iA = 0, iB = 0;;) {\n        let from, to;\n        if (iA < a.length && (iB == b.length || b[iB] >= a[iA])) {\n            from = a[iA++];\n            to = a[iA++];\n        }\n        else if (iB < b.length) {\n            from = b[iB++];\n            to = b[iB++];\n        }\n        else\n            return result;\n        if (!result.length || result[result.length - 1] < from)\n            result.push(from, to);\n        else if (result[result.length - 1] < to)\n            result[result.length - 1] = to;\n    }\n}\nfunction mergeTransaction(a, b, sequential) {\n    var _a;\n    let mapForA, mapForB, changes;\n    if (sequential) {\n        mapForA = b.changes;\n        mapForB = ChangeSet.empty(b.changes.length);\n        changes = a.changes.compose(b.changes);\n    }\n    else {\n        mapForA = b.changes.map(a.changes);\n        mapForB = a.changes.mapDesc(b.changes, true);\n        changes = a.changes.compose(mapForA);\n    }\n    return {\n        changes,\n        selection: b.selection ? b.selection.map(mapForB) : (_a = a.selection) === null || _a === void 0 ? void 0 : _a.map(mapForA),\n        effects: StateEffect.mapEffects(a.effects, mapForA).concat(StateEffect.mapEffects(b.effects, mapForB)),\n        annotations: a.annotations.length ? a.annotations.concat(b.annotations) : b.annotations,\n        scrollIntoView: a.scrollIntoView || b.scrollIntoView\n    };\n}\nfunction resolveTransactionInner(state, spec, docSize) {\n    let sel = spec.selection, annotations = asArray(spec.annotations);\n    if (spec.userEvent)\n        annotations = annotations.concat(Transaction.userEvent.of(spec.userEvent));\n    return {\n        changes: spec.changes instanceof ChangeSet ? spec.changes\n            : ChangeSet.of(spec.changes || [], docSize, state.facet(lineSeparator)),\n        selection: sel && (sel instanceof EditorSelection ? sel : EditorSelection.single(sel.anchor, sel.head)),\n        effects: asArray(spec.effects),\n        annotations,\n        scrollIntoView: !!spec.scrollIntoView\n    };\n}\nfunction resolveTransaction(state, specs, filter) {\n    let s = resolveTransactionInner(state, specs.length ? specs[0] : {}, state.doc.length);\n    if (specs.length && specs[0].filter === false)\n        filter = false;\n    for (let i = 1; i < specs.length; i++) {\n        if (specs[i].filter === false)\n            filter = false;\n        let seq = !!specs[i].sequential;\n        s = mergeTransaction(s, resolveTransactionInner(state, specs[i], seq ? s.changes.newLength : state.doc.length), seq);\n    }\n    let tr = Transaction.create(state, s.changes, s.selection, s.effects, s.annotations, s.scrollIntoView);\n    return extendTransaction(filter ? filterTransaction(tr) : tr);\n}\n// Finish a transaction by applying filters if necessary.\nfunction filterTransaction(tr) {\n    let state = tr.startState;\n    // Change filters\n    let result = true;\n    for (let filter of state.facet(changeFilter)) {\n        let value = filter(tr);\n        if (value === false) {\n            result = false;\n            break;\n        }\n        if (Array.isArray(value))\n            result = result === true ? value : joinRanges(result, value);\n    }\n    if (result !== true) {\n        let changes, back;\n        if (result === false) {\n            back = tr.changes.invertedDesc;\n            changes = ChangeSet.empty(state.doc.length);\n        }\n        else {\n            let filtered = tr.changes.filter(result);\n            changes = filtered.changes;\n            back = filtered.filtered.mapDesc(filtered.changes).invertedDesc;\n        }\n        tr = Transaction.create(state, changes, tr.selection && tr.selection.map(back), StateEffect.mapEffects(tr.effects, back), tr.annotations, tr.scrollIntoView);\n    }\n    // Transaction filters\n    let filters = state.facet(transactionFilter);\n    for (let i = filters.length - 1; i >= 0; i--) {\n        let filtered = filters[i](tr);\n        if (filtered instanceof Transaction)\n            tr = filtered;\n        else if (Array.isArray(filtered) && filtered.length == 1 && filtered[0] instanceof Transaction)\n            tr = filtered[0];\n        else\n            tr = resolveTransaction(state, asArray(filtered), false);\n    }\n    return tr;\n}\nfunction extendTransaction(tr) {\n    let state = tr.startState, extenders = state.facet(transactionExtender), spec = tr;\n    for (let i = extenders.length - 1; i >= 0; i--) {\n        let extension = extenders[i](tr);\n        if (extension && Object.keys(extension).length)\n            spec = mergeTransaction(spec, resolveTransactionInner(state, extension, tr.changes.newLength), true);\n    }\n    return spec == tr ? tr : Transaction.create(state, tr.changes, tr.selection, spec.effects, spec.annotations, spec.scrollIntoView);\n}\nconst none = [];\nfunction asArray(value) {\n    return value == null ? none : Array.isArray(value) ? value : [value];\n}\n\n/**\nThe categories produced by a [character\ncategorizer](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer). These are used\ndo things like selecting by word.\n*/\nvar CharCategory = /*@__PURE__*/(function (CharCategory) {\n    /**\n    Word characters.\n    */\n    CharCategory[CharCategory[\"Word\"] = 0] = \"Word\";\n    /**\n    Whitespace.\n    */\n    CharCategory[CharCategory[\"Space\"] = 1] = \"Space\";\n    /**\n    Anything else.\n    */\n    CharCategory[CharCategory[\"Other\"] = 2] = \"Other\";\nreturn CharCategory})(CharCategory || (CharCategory = {}));\nconst nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\nlet wordChar;\ntry {\n    wordChar = /*@__PURE__*/new RegExp(\"[\\\\p{Alphabetic}\\\\p{Number}_]\", \"u\");\n}\ncatch (_) { }\nfunction hasWordChar(str) {\n    if (wordChar)\n        return wordChar.test(str);\n    for (let i = 0; i < str.length; i++) {\n        let ch = str[i];\n        if (/\\w/.test(ch) || ch > \"\\x80\" && (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch)))\n            return true;\n    }\n    return false;\n}\nfunction makeCategorizer(wordChars) {\n    return (char) => {\n        if (!/\\S/.test(char))\n            return CharCategory.Space;\n        if (hasWordChar(char))\n            return CharCategory.Word;\n        for (let i = 0; i < wordChars.length; i++)\n            if (char.indexOf(wordChars[i]) > -1)\n                return CharCategory.Word;\n        return CharCategory.Other;\n    };\n}\n\n/**\nThe editor state class is a persistent (immutable) data structure.\nTo update a state, you [create](https://codemirror.net/6/docs/ref/#state.EditorState.update) a\n[transaction](https://codemirror.net/6/docs/ref/#state.Transaction), which produces a _new_ state\ninstance, without modifying the original object.\n\nAs such, _never_ mutate properties of a state directly. That'll\njust break things.\n*/\nclass EditorState {\n    constructor(\n    /**\n    @internal\n    */\n    config, \n    /**\n    The current document.\n    */\n    doc, \n    /**\n    The current selection.\n    */\n    selection, \n    /**\n    @internal\n    */\n    values, computeSlot, tr) {\n        this.config = config;\n        this.doc = doc;\n        this.selection = selection;\n        this.values = values;\n        this.status = config.statusTemplate.slice();\n        this.computeSlot = computeSlot;\n        // Fill in the computed state immediately, so that further queries\n        // for it made during the update return this state\n        if (tr)\n            tr._state = this;\n        for (let i = 0; i < this.config.dynamicSlots.length; i++)\n            ensureAddr(this, i << 1);\n        this.computeSlot = null;\n    }\n    field(field, require = true) {\n        let addr = this.config.address[field.id];\n        if (addr == null) {\n            if (require)\n                throw new RangeError(\"Field is not present in this state\");\n            return undefined;\n        }\n        ensureAddr(this, addr);\n        return getAddr(this, addr);\n    }\n    /**\n    Create a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction) that updates this\n    state. Any number of [transaction specs](https://codemirror.net/6/docs/ref/#state.TransactionSpec)\n    can be passed. Unless\n    [`sequential`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.sequential) is set, the\n    [changes](https://codemirror.net/6/docs/ref/#state.TransactionSpec.changes) (if any) of each spec\n    are assumed to start in the _current_ document (not the document\n    produced by previous specs), and its\n    [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection) and\n    [effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) are assumed to refer\n    to the document created by its _own_ changes. The resulting\n    transaction contains the combined effect of all the different\n    specs. For [selection](https://codemirror.net/6/docs/ref/#state.TransactionSpec.selection), later\n    specs take precedence over earlier ones.\n    */\n    update(...specs) {\n        return resolveTransaction(this, specs, true);\n    }\n    /**\n    @internal\n    */\n    applyTransaction(tr) {\n        let conf = this.config, { base, compartments } = conf;\n        for (let effect of tr.effects) {\n            if (effect.is(Compartment.reconfigure)) {\n                if (conf) {\n                    compartments = new Map;\n                    conf.compartments.forEach((val, key) => compartments.set(key, val));\n                    conf = null;\n                }\n                compartments.set(effect.value.compartment, effect.value.extension);\n            }\n            else if (effect.is(StateEffect.reconfigure)) {\n                conf = null;\n                base = effect.value;\n            }\n            else if (effect.is(StateEffect.appendConfig)) {\n                conf = null;\n                base = asArray(base).concat(effect.value);\n            }\n        }\n        let startValues;\n        if (!conf) {\n            conf = Configuration.resolve(base, compartments, this);\n            let intermediateState = new EditorState(conf, this.doc, this.selection, conf.dynamicSlots.map(() => null), (state, slot) => slot.reconfigure(state, this), null);\n            startValues = intermediateState.values;\n        }\n        else {\n            startValues = tr.startState.values.slice();\n        }\n        new EditorState(conf, tr.newDoc, tr.newSelection, startValues, (state, slot) => slot.update(state, tr), tr);\n    }\n    /**\n    Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that\n    replaces every selection range with the given content.\n    */\n    replaceSelection(text) {\n        if (typeof text == \"string\")\n            text = this.toText(text);\n        return this.changeByRange(range => ({ changes: { from: range.from, to: range.to, insert: text },\n            range: EditorSelection.cursor(range.from + text.length) }));\n    }\n    /**\n    Create a set of changes and a new selection by running the given\n    function for each range in the active selection. The function\n    can return an optional set of changes (in the coordinate space\n    of the start document), plus an updated range (in the coordinate\n    space of the document produced by the call's own changes). This\n    method will merge all the changes and ranges into a single\n    changeset and selection, and return it as a [transaction\n    spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec), which can be passed to\n    [`update`](https://codemirror.net/6/docs/ref/#state.EditorState.update).\n    */\n    changeByRange(f) {\n        let sel = this.selection;\n        let result1 = f(sel.ranges[0]);\n        let changes = this.changes(result1.changes), ranges = [result1.range];\n        let effects = asArray(result1.effects);\n        for (let i = 1; i < sel.ranges.length; i++) {\n            let result = f(sel.ranges[i]);\n            let newChanges = this.changes(result.changes), newMapped = newChanges.map(changes);\n            for (let j = 0; j < i; j++)\n                ranges[j] = ranges[j].map(newMapped);\n            let mapBy = changes.mapDesc(newChanges, true);\n            ranges.push(result.range.map(mapBy));\n            changes = changes.compose(newMapped);\n            effects = StateEffect.mapEffects(effects, newMapped).concat(StateEffect.mapEffects(asArray(result.effects), mapBy));\n        }\n        return {\n            changes,\n            selection: EditorSelection.create(ranges, sel.mainIndex),\n            effects\n        };\n    }\n    /**\n    Create a [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet) from the given change\n    description, taking the state's document length and line\n    separator into account.\n    */\n    changes(spec = []) {\n        if (spec instanceof ChangeSet)\n            return spec;\n        return ChangeSet.of(spec, this.doc.length, this.facet(EditorState.lineSeparator));\n    }\n    /**\n    Using the state's [line\n    separator](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator), create a\n    [`Text`](https://codemirror.net/6/docs/ref/#state.Text) instance from the given string.\n    */\n    toText(string) {\n        return Text.of(string.split(this.facet(EditorState.lineSeparator) || DefaultSplit));\n    }\n    /**\n    Return the given range of the document as a string.\n    */\n    sliceDoc(from = 0, to = this.doc.length) {\n        return this.doc.sliceString(from, to, this.lineBreak);\n    }\n    /**\n    Get the value of a state [facet](https://codemirror.net/6/docs/ref/#state.Facet).\n    */\n    facet(facet) {\n        let addr = this.config.address[facet.id];\n        if (addr == null)\n            return facet.default;\n        ensureAddr(this, addr);\n        return getAddr(this, addr);\n    }\n    /**\n    Convert this state to a JSON-serializable object. When custom\n    fields should be serialized, you can pass them in as an object\n    mapping property names (in the resulting object, which should\n    not use `doc` or `selection`) to fields.\n    */\n    toJSON(fields) {\n        let result = {\n            doc: this.sliceDoc(),\n            selection: this.selection.toJSON()\n        };\n        if (fields)\n            for (let prop in fields) {\n                let value = fields[prop];\n                if (value instanceof StateField && this.config.address[value.id] != null)\n                    result[prop] = value.spec.toJSON(this.field(fields[prop]), this);\n            }\n        return result;\n    }\n    /**\n    Deserialize a state from its JSON representation. When custom\n    fields should be deserialized, pass the same object you passed\n    to [`toJSON`](https://codemirror.net/6/docs/ref/#state.EditorState.toJSON) when serializing as\n    third argument.\n    */\n    static fromJSON(json, config = {}, fields) {\n        if (!json || typeof json.doc != \"string\")\n            throw new RangeError(\"Invalid JSON representation for EditorState\");\n        let fieldInit = [];\n        if (fields)\n            for (let prop in fields) {\n                if (Object.prototype.hasOwnProperty.call(json, prop)) {\n                    let field = fields[prop], value = json[prop];\n                    fieldInit.push(field.init(state => field.spec.fromJSON(value, state)));\n                }\n            }\n        return EditorState.create({\n            doc: json.doc,\n            selection: EditorSelection.fromJSON(json.selection),\n            extensions: config.extensions ? fieldInit.concat([config.extensions]) : fieldInit\n        });\n    }\n    /**\n    Create a new state. You'll usually only need this when\n    initializing an editor—updated states are created by applying\n    transactions.\n    */\n    static create(config = {}) {\n        let configuration = Configuration.resolve(config.extensions || [], new Map);\n        let doc = config.doc instanceof Text ? config.doc\n            : Text.of((config.doc || \"\").split(configuration.staticFacet(EditorState.lineSeparator) || DefaultSplit));\n        let selection = !config.selection ? EditorSelection.single(0)\n            : config.selection instanceof EditorSelection ? config.selection\n                : EditorSelection.single(config.selection.anchor, config.selection.head);\n        checkSelection(selection, doc.length);\n        if (!configuration.staticFacet(allowMultipleSelections))\n            selection = selection.asSingle();\n        return new EditorState(configuration, doc, selection, configuration.dynamicSlots.map(() => null), (state, slot) => slot.create(state), null);\n    }\n    /**\n    The size (in columns) of a tab in the document, determined by\n    the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet.\n    */\n    get tabSize() { return this.facet(EditorState.tabSize); }\n    /**\n    Get the proper [line-break](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator)\n    string for this state.\n    */\n    get lineBreak() { return this.facet(EditorState.lineSeparator) || \"\\n\"; }\n    /**\n    Returns true when the editor is\n    [configured](https://codemirror.net/6/docs/ref/#state.EditorState^readOnly) to be read-only.\n    */\n    get readOnly() { return this.facet(readOnly); }\n    /**\n    Look up a translation for the given phrase (via the\n    [`phrases`](https://codemirror.net/6/docs/ref/#state.EditorState^phrases) facet), or return the\n    original string if no translation is found.\n    \n    If additional arguments are passed, they will be inserted in\n    place of markers like `$1` (for the first value) and `$2`, etc.\n    A single `$` is equivalent to `$1`, and `$$` will produce a\n    literal dollar sign.\n    */\n    phrase(phrase, ...insert) {\n        for (let map of this.facet(EditorState.phrases))\n            if (Object.prototype.hasOwnProperty.call(map, phrase)) {\n                phrase = map[phrase];\n                break;\n            }\n        if (insert.length)\n            phrase = phrase.replace(/\\$(\\$|\\d*)/g, (m, i) => {\n                if (i == \"$\")\n                    return \"$\";\n                let n = +(i || 1);\n                return !n || n > insert.length ? m : insert[n - 1];\n            });\n        return phrase;\n    }\n    /**\n    Find the values for a given language data field, provided by the\n    the [`languageData`](https://codemirror.net/6/docs/ref/#state.EditorState^languageData) facet.\n    \n    Examples of language data fields are...\n    \n    - [`\"commentTokens\"`](https://codemirror.net/6/docs/ref/#commands.CommentTokens) for specifying\n      comment syntax.\n    - [`\"autocomplete\"`](https://codemirror.net/6/docs/ref/#autocomplete.autocompletion^config.override)\n      for providing language-specific completion sources.\n    - [`\"wordChars\"`](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer) for adding\n      characters that should be considered part of words in this\n      language.\n    - [`\"closeBrackets\"`](https://codemirror.net/6/docs/ref/#autocomplete.CloseBracketConfig) controls\n      bracket closing behavior.\n    */\n    languageDataAt(name, pos, side = -1) {\n        let values = [];\n        for (let provider of this.facet(languageData)) {\n            for (let result of provider(this, pos, side)) {\n                if (Object.prototype.hasOwnProperty.call(result, name))\n                    values.push(result[name]);\n            }\n        }\n        return values;\n    }\n    /**\n    Return a function that can categorize strings (expected to\n    represent a single [grapheme cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak))\n    into one of:\n    \n     - Word (contains an alphanumeric character or a character\n       explicitly listed in the local language's `\"wordChars\"`\n       language data, which should be a string)\n     - Space (contains only whitespace)\n     - Other (anything else)\n    */\n    charCategorizer(at) {\n        return makeCategorizer(this.languageDataAt(\"wordChars\", at).join(\"\"));\n    }\n    /**\n    Find the word at the given position, meaning the range\n    containing all [word](https://codemirror.net/6/docs/ref/#state.CharCategory.Word) characters\n    around it. If no word characters are adjacent to the position,\n    this returns null.\n    */\n    wordAt(pos) {\n        let { text, from, length } = this.doc.lineAt(pos);\n        let cat = this.charCategorizer(pos);\n        let start = pos - from, end = pos - from;\n        while (start > 0) {\n            let prev = findClusterBreak(text, start, false);\n            if (cat(text.slice(prev, start)) != CharCategory.Word)\n                break;\n            start = prev;\n        }\n        while (end < length) {\n            let next = findClusterBreak(text, end);\n            if (cat(text.slice(end, next)) != CharCategory.Word)\n                break;\n            end = next;\n        }\n        return start == end ? null : EditorSelection.range(start + from, end + from);\n    }\n}\n/**\nA facet that, when enabled, causes the editor to allow multiple\nranges to be selected. Be careful though, because by default the\neditor relies on the native DOM selection, which cannot handle\nmultiple selections. An extension like\n[`drawSelection`](https://codemirror.net/6/docs/ref/#view.drawSelection) can be used to make\nsecondary selections visible to the user.\n*/\nEditorState.allowMultipleSelections = allowMultipleSelections;\n/**\nConfigures the tab size to use in this state. The first\n(highest-precedence) value of the facet is used. If no value is\ngiven, this defaults to 4.\n*/\nEditorState.tabSize = /*@__PURE__*/Facet.define({\n    combine: values => values.length ? values[0] : 4\n});\n/**\nThe line separator to use. By default, any of `\"\\n\"`, `\"\\r\\n\"`\nand `\"\\r\"` is treated as a separator when splitting lines, and\nlines are joined with `\"\\n\"`.\n\nWhen you configure a value here, only that precise separator\nwill be used, allowing you to round-trip documents through the\neditor without normalizing line separators.\n*/\nEditorState.lineSeparator = lineSeparator;\n/**\nThis facet controls the value of the\n[`readOnly`](https://codemirror.net/6/docs/ref/#state.EditorState.readOnly) getter, which is\nconsulted by commands and extensions that implement editing\nfunctionality to determine whether they should apply. It\ndefaults to false, but when its highest-precedence value is\n`true`, such functionality disables itself.\n\nNot to be confused with\n[`EditorView.editable`](https://codemirror.net/6/docs/ref/#view.EditorView^editable), which\ncontrols whether the editor's DOM is set to be editable (and\nthus focusable).\n*/\nEditorState.readOnly = readOnly;\n/**\nRegisters translation phrases. The\n[`phrase`](https://codemirror.net/6/docs/ref/#state.EditorState.phrase) method will look through\nall objects registered with this facet to find translations for\nits argument.\n*/\nEditorState.phrases = /*@__PURE__*/Facet.define({\n    compare(a, b) {\n        let kA = Object.keys(a), kB = Object.keys(b);\n        return kA.length == kB.length && kA.every(k => a[k] == b[k]);\n    }\n});\n/**\nA facet used to register [language\ndata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) providers.\n*/\nEditorState.languageData = languageData;\n/**\nFacet used to register change filters, which are called for each\ntransaction (unless explicitly\n[disabled](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter)), and can suppress\npart of the transaction's changes.\n\nSuch a function can return `true` to indicate that it doesn't\nwant to do anything, `false` to completely stop the changes in\nthe transaction, or a set of ranges in which changes should be\nsuppressed. Such ranges are represented as an array of numbers,\nwith each pair of two numbers indicating the start and end of a\nrange. So for example `[10, 20, 100, 110]` suppresses changes\nbetween 10 and 20, and between 100 and 110.\n*/\nEditorState.changeFilter = changeFilter;\n/**\nFacet used to register a hook that gets a chance to update or\nreplace transaction specs before they are applied. This will\nonly be applied for transactions that don't have\n[`filter`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter) set to `false`. You\ncan either return a single transaction spec (possibly the input\ntransaction), or an array of specs (which will be combined in\nthe same way as the arguments to\n[`EditorState.update`](https://codemirror.net/6/docs/ref/#state.EditorState.update)).\n\nWhen possible, it is recommended to avoid accessing\n[`Transaction.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state) in a filter,\nsince it will force creation of a state that will then be\ndiscarded again, if the transaction is actually filtered.\n\n(This functionality should be used with care. Indiscriminately\nmodifying transaction is likely to break something or degrade\nthe user experience.)\n*/\nEditorState.transactionFilter = transactionFilter;\n/**\nThis is a more limited form of\n[`transactionFilter`](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter),\nwhich can only add\n[annotations](https://codemirror.net/6/docs/ref/#state.TransactionSpec.annotations) and\n[effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects). _But_, this type\nof filter runs even if the transaction has disabled regular\n[filtering](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter), making it suitable\nfor effects that don't need to touch the changes or selection,\nbut do want to process every transaction.\n\nExtenders run _after_ filters, when both are present.\n*/\nEditorState.transactionExtender = transactionExtender;\nCompartment.reconfigure = /*@__PURE__*/StateEffect.define();\n\n/**\nUtility function for combining behaviors to fill in a config\nobject from an array of provided configs. `defaults` should hold\ndefault values for all optional fields in `Config`.\n\nThe function will, by default, error\nwhen a field gets two values that aren't `===`-equal, but you can\nprovide combine functions per field to do something else.\n*/\nfunction combineConfig(configs, defaults, // Should hold only the optional properties of Config, but I haven't managed to express that\ncombine = {}) {\n    let result = {};\n    for (let config of configs)\n        for (let key of Object.keys(config)) {\n            let value = config[key], current = result[key];\n            if (current === undefined)\n                result[key] = value;\n            else if (current === value || value === undefined) ; // No conflict\n            else if (Object.hasOwnProperty.call(combine, key))\n                result[key] = combine[key](current, value);\n            else\n                throw new Error(\"Config merge conflict for field \" + key);\n        }\n    for (let key in defaults)\n        if (result[key] === undefined)\n            result[key] = defaults[key];\n    return result;\n}\n\n/**\nEach range is associated with a value, which must inherit from\nthis class.\n*/\nclass RangeValue {\n    /**\n    Compare this value with another value. Used when comparing\n    rangesets. The default implementation compares by identity.\n    Unless you are only creating a fixed number of unique instances\n    of your value type, it is a good idea to implement this\n    properly.\n    */\n    eq(other) { return this == other; }\n    /**\n    Create a [range](https://codemirror.net/6/docs/ref/#state.Range) with this value.\n    */\n    range(from, to = from) { return Range.create(from, to, this); }\n}\nRangeValue.prototype.startSide = RangeValue.prototype.endSide = 0;\nRangeValue.prototype.point = false;\nRangeValue.prototype.mapMode = MapMode.TrackDel;\n/**\nA range associates a value with a range of positions.\n*/\nclass Range {\n    constructor(\n    /**\n    The range's start position.\n    */\n    from, \n    /**\n    Its end position.\n    */\n    to, \n    /**\n    The value associated with this range.\n    */\n    value) {\n        this.from = from;\n        this.to = to;\n        this.value = value;\n    }\n    /**\n    @internal\n    */\n    static create(from, to, value) {\n        return new Range(from, to, value);\n    }\n}\nfunction cmpRange(a, b) {\n    return a.from - b.from || a.value.startSide - b.value.startSide;\n}\nclass Chunk {\n    constructor(from, to, value, \n    // Chunks are marked with the largest point that occurs\n    // in them (or -1 for no points), so that scans that are\n    // only interested in points (such as the\n    // heightmap-related logic) can skip range-only chunks.\n    maxPoint) {\n        this.from = from;\n        this.to = to;\n        this.value = value;\n        this.maxPoint = maxPoint;\n    }\n    get length() { return this.to[this.to.length - 1]; }\n    // Find the index of the given position and side. Use the ranges'\n    // `from` pos when `end == false`, `to` when `end == true`.\n    findIndex(pos, side, end, startAt = 0) {\n        let arr = end ? this.to : this.from;\n        for (let lo = startAt, hi = arr.length;;) {\n            if (lo == hi)\n                return lo;\n            let mid = (lo + hi) >> 1;\n            let diff = arr[mid] - pos || (end ? this.value[mid].endSide : this.value[mid].startSide) - side;\n            if (mid == lo)\n                return diff >= 0 ? lo : hi;\n            if (diff >= 0)\n                hi = mid;\n            else\n                lo = mid + 1;\n        }\n    }\n    between(offset, from, to, f) {\n        for (let i = this.findIndex(from, -1000000000 /* C.Far */, true), e = this.findIndex(to, 1000000000 /* C.Far */, false, i); i < e; i++)\n            if (f(this.from[i] + offset, this.to[i] + offset, this.value[i]) === false)\n                return false;\n    }\n    map(offset, changes) {\n        let value = [], from = [], to = [], newPos = -1, maxPoint = -1;\n        for (let i = 0; i < this.value.length; i++) {\n            let val = this.value[i], curFrom = this.from[i] + offset, curTo = this.to[i] + offset, newFrom, newTo;\n            if (curFrom == curTo) {\n                let mapped = changes.mapPos(curFrom, val.startSide, val.mapMode);\n                if (mapped == null)\n                    continue;\n                newFrom = newTo = mapped;\n                if (val.startSide != val.endSide) {\n                    newTo = changes.mapPos(curFrom, val.endSide);\n                    if (newTo < newFrom)\n                        continue;\n                }\n            }\n            else {\n                newFrom = changes.mapPos(curFrom, val.startSide);\n                newTo = changes.mapPos(curTo, val.endSide);\n                if (newFrom > newTo || newFrom == newTo && val.startSide > 0 && val.endSide <= 0)\n                    continue;\n            }\n            if ((newTo - newFrom || val.endSide - val.startSide) < 0)\n                continue;\n            if (newPos < 0)\n                newPos = newFrom;\n            if (val.point)\n                maxPoint = Math.max(maxPoint, newTo - newFrom);\n            value.push(val);\n            from.push(newFrom - newPos);\n            to.push(newTo - newPos);\n        }\n        return { mapped: value.length ? new Chunk(from, to, value, maxPoint) : null, pos: newPos };\n    }\n}\n/**\nA range set stores a collection of [ranges](https://codemirror.net/6/docs/ref/#state.Range) in a\nway that makes them efficient to [map](https://codemirror.net/6/docs/ref/#state.RangeSet.map) and\n[update](https://codemirror.net/6/docs/ref/#state.RangeSet.update). This is an immutable data\nstructure.\n*/\nclass RangeSet {\n    constructor(\n    /**\n    @internal\n    */\n    chunkPos, \n    /**\n    @internal\n    */\n    chunk, \n    /**\n    @internal\n    */\n    nextLayer, \n    /**\n    @internal\n    */\n    maxPoint) {\n        this.chunkPos = chunkPos;\n        this.chunk = chunk;\n        this.nextLayer = nextLayer;\n        this.maxPoint = maxPoint;\n    }\n    /**\n    @internal\n    */\n    static create(chunkPos, chunk, nextLayer, maxPoint) {\n        return new RangeSet(chunkPos, chunk, nextLayer, maxPoint);\n    }\n    /**\n    @internal\n    */\n    get length() {\n        let last = this.chunk.length - 1;\n        return last < 0 ? 0 : Math.max(this.chunkEnd(last), this.nextLayer.length);\n    }\n    /**\n    The number of ranges in the set.\n    */\n    get size() {\n        if (this.isEmpty)\n            return 0;\n        let size = this.nextLayer.size;\n        for (let chunk of this.chunk)\n            size += chunk.value.length;\n        return size;\n    }\n    /**\n    @internal\n    */\n    chunkEnd(index) {\n        return this.chunkPos[index] + this.chunk[index].length;\n    }\n    /**\n    Update the range set, optionally adding new ranges or filtering\n    out existing ones.\n    \n    (Note: The type parameter is just there as a kludge to work\n    around TypeScript variance issues that prevented `RangeSet`\n    from being a subtype of `RangeSet` when `X` is a subtype of\n    `Y`.)\n    */\n    update(updateSpec) {\n        let { add = [], sort = false, filterFrom = 0, filterTo = this.length } = updateSpec;\n        let filter = updateSpec.filter;\n        if (add.length == 0 && !filter)\n            return this;\n        if (sort)\n            add = add.slice().sort(cmpRange);\n        if (this.isEmpty)\n            return add.length ? RangeSet.of(add) : this;\n        let cur = new LayerCursor(this, null, -1).goto(0), i = 0, spill = [];\n        let builder = new RangeSetBuilder();\n        while (cur.value || i < add.length) {\n            if (i < add.length && (cur.from - add[i].from || cur.startSide - add[i].value.startSide) >= 0) {\n                let range = add[i++];\n                if (!builder.addInner(range.from, range.to, range.value))\n                    spill.push(range);\n            }\n            else if (cur.rangeIndex == 1 && cur.chunkIndex < this.chunk.length &&\n                (i == add.length || this.chunkEnd(cur.chunkIndex) < add[i].from) &&\n                (!filter || filterFrom > this.chunkEnd(cur.chunkIndex) || filterTo < this.chunkPos[cur.chunkIndex]) &&\n                builder.addChunk(this.chunkPos[cur.chunkIndex], this.chunk[cur.chunkIndex])) {\n                cur.nextChunk();\n            }\n            else {\n                if (!filter || filterFrom > cur.to || filterTo < cur.from || filter(cur.from, cur.to, cur.value)) {\n                    if (!builder.addInner(cur.from, cur.to, cur.value))\n                        spill.push(Range.create(cur.from, cur.to, cur.value));\n                }\n                cur.next();\n            }\n        }\n        return builder.finishInner(this.nextLayer.isEmpty && !spill.length ? RangeSet.empty\n            : this.nextLayer.update({ add: spill, filter, filterFrom, filterTo }));\n    }\n    /**\n    Map this range set through a set of changes, return the new set.\n    */\n    map(changes) {\n        if (changes.empty || this.isEmpty)\n            return this;\n        let chunks = [], chunkPos = [], maxPoint = -1;\n        for (let i = 0; i < this.chunk.length; i++) {\n            let start = this.chunkPos[i], chunk = this.chunk[i];\n            let touch = changes.touchesRange(start, start + chunk.length);\n            if (touch === false) {\n                maxPoint = Math.max(maxPoint, chunk.maxPoint);\n                chunks.push(chunk);\n                chunkPos.push(changes.mapPos(start));\n            }\n            else if (touch === true) {\n                let { mapped, pos } = chunk.map(start, changes);\n                if (mapped) {\n                    maxPoint = Math.max(maxPoint, mapped.maxPoint);\n                    chunks.push(mapped);\n                    chunkPos.push(pos);\n                }\n            }\n        }\n        let next = this.nextLayer.map(changes);\n        return chunks.length == 0 ? next : new RangeSet(chunkPos, chunks, next || RangeSet.empty, maxPoint);\n    }\n    /**\n    Iterate over the ranges that touch the region `from` to `to`,\n    calling `f` for each. There is no guarantee that the ranges will\n    be reported in any specific order. When the callback returns\n    `false`, iteration stops.\n    */\n    between(from, to, f) {\n        if (this.isEmpty)\n            return;\n        for (let i = 0; i < this.chunk.length; i++) {\n            let start = this.chunkPos[i], chunk = this.chunk[i];\n            if (to >= start && from <= start + chunk.length &&\n                chunk.between(start, from - start, to - start, f) === false)\n                return;\n        }\n        this.nextLayer.between(from, to, f);\n    }\n    /**\n    Iterate over the ranges in this set, in order, including all\n    ranges that end at or after `from`.\n    */\n    iter(from = 0) {\n        return HeapCursor.from([this]).goto(from);\n    }\n    /**\n    @internal\n    */\n    get isEmpty() { return this.nextLayer == this; }\n    /**\n    Iterate over the ranges in a collection of sets, in order,\n    starting from `from`.\n    */\n    static iter(sets, from = 0) {\n        return HeapCursor.from(sets).goto(from);\n    }\n    /**\n    Iterate over two groups of sets, calling methods on `comparator`\n    to notify it of possible differences.\n    */\n    static compare(oldSets, newSets, \n    /**\n    This indicates how the underlying data changed between these\n    ranges, and is needed to synchronize the iteration.\n    */\n    textDiff, comparator, \n    /**\n    Can be used to ignore all non-point ranges, and points below\n    the given size. When -1, all ranges are compared.\n    */\n    minPointSize = -1) {\n        let a = oldSets.filter(set => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize);\n        let b = newSets.filter(set => set.maxPoint > 0 || !set.isEmpty && set.maxPoint >= minPointSize);\n        let sharedChunks = findSharedChunks(a, b, textDiff);\n        let sideA = new SpanCursor(a, sharedChunks, minPointSize);\n        let sideB = new SpanCursor(b, sharedChunks, minPointSize);\n        textDiff.iterGaps((fromA, fromB, length) => compare(sideA, fromA, sideB, fromB, length, comparator));\n        if (textDiff.empty && textDiff.length == 0)\n            compare(sideA, 0, sideB, 0, 0, comparator);\n    }\n    /**\n    Compare the contents of two groups of range sets, returning true\n    if they are equivalent in the given range.\n    */\n    static eq(oldSets, newSets, from = 0, to) {\n        if (to == null)\n            to = 1000000000 /* C.Far */ - 1;\n        let a = oldSets.filter(set => !set.isEmpty && newSets.indexOf(set) < 0);\n        let b = newSets.filter(set => !set.isEmpty && oldSets.indexOf(set) < 0);\n        if (a.length != b.length)\n            return false;\n        if (!a.length)\n            return true;\n        let sharedChunks = findSharedChunks(a, b);\n        let sideA = new SpanCursor(a, sharedChunks, 0).goto(from), sideB = new SpanCursor(b, sharedChunks, 0).goto(from);\n        for (;;) {\n            if (sideA.to != sideB.to ||\n                !sameValues(sideA.active, sideB.active) ||\n                sideA.point && (!sideB.point || !sideA.point.eq(sideB.point)))\n                return false;\n            if (sideA.to > to)\n                return true;\n            sideA.next();\n            sideB.next();\n        }\n    }\n    /**\n    Iterate over a group of range sets at the same time, notifying\n    the iterator about the ranges covering every given piece of\n    content. Returns the open count (see\n    [`SpanIterator.span`](https://codemirror.net/6/docs/ref/#state.SpanIterator.span)) at the end\n    of the iteration.\n    */\n    static spans(sets, from, to, iterator, \n    /**\n    When given and greater than -1, only points of at least this\n    size are taken into account.\n    */\n    minPointSize = -1) {\n        let cursor = new SpanCursor(sets, null, minPointSize).goto(from), pos = from;\n        let openRanges = cursor.openStart;\n        for (;;) {\n            let curTo = Math.min(cursor.to, to);\n            if (cursor.point) {\n                let active = cursor.activeForPoint(cursor.to);\n                let openCount = cursor.pointFrom < from ? active.length + 1 : Math.min(active.length, openRanges);\n                iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank);\n                openRanges = Math.min(cursor.openEnd(curTo), active.length);\n            }\n            else if (curTo > pos) {\n                iterator.span(pos, curTo, cursor.active, openRanges);\n                openRanges = cursor.openEnd(curTo);\n            }\n            if (cursor.to > to)\n                return openRanges + (cursor.point && cursor.to > to ? 1 : 0);\n            pos = cursor.to;\n            cursor.next();\n        }\n    }\n    /**\n    Create a range set for the given range or array of ranges. By\n    default, this expects the ranges to be _sorted_ (by start\n    position and, if two start at the same position,\n    `value.startSide`). You can pass `true` as second argument to\n    cause the method to sort them.\n    */\n    static of(ranges, sort = false) {\n        let build = new RangeSetBuilder();\n        for (let range of ranges instanceof Range ? [ranges] : sort ? lazySort(ranges) : ranges)\n            build.add(range.from, range.to, range.value);\n        return build.finish();\n    }\n}\n/**\nThe empty set of ranges.\n*/\nRangeSet.empty = /*@__PURE__*/new RangeSet([], [], null, -1);\nfunction lazySort(ranges) {\n    if (ranges.length > 1)\n        for (let prev = ranges[0], i = 1; i < ranges.length; i++) {\n            let cur = ranges[i];\n            if (cmpRange(prev, cur) > 0)\n                return ranges.slice().sort(cmpRange);\n            prev = cur;\n        }\n    return ranges;\n}\nRangeSet.empty.nextLayer = RangeSet.empty;\n/**\nA range set builder is a data structure that helps build up a\n[range set](https://codemirror.net/6/docs/ref/#state.RangeSet) directly, without first allocating\nan array of [`Range`](https://codemirror.net/6/docs/ref/#state.Range) objects.\n*/\nclass RangeSetBuilder {\n    finishChunk(newArrays) {\n        this.chunks.push(new Chunk(this.from, this.to, this.value, this.maxPoint));\n        this.chunkPos.push(this.chunkStart);\n        this.chunkStart = -1;\n        this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint);\n        this.maxPoint = -1;\n        if (newArrays) {\n            this.from = [];\n            this.to = [];\n            this.value = [];\n        }\n    }\n    /**\n    Create an empty builder.\n    */\n    constructor() {\n        this.chunks = [];\n        this.chunkPos = [];\n        this.chunkStart = -1;\n        this.last = null;\n        this.lastFrom = -1000000000 /* C.Far */;\n        this.lastTo = -1000000000 /* C.Far */;\n        this.from = [];\n        this.to = [];\n        this.value = [];\n        this.maxPoint = -1;\n        this.setMaxPoint = -1;\n        this.nextLayer = null;\n    }\n    /**\n    Add a range. Ranges should be added in sorted (by `from` and\n    `value.startSide`) order.\n    */\n    add(from, to, value) {\n        if (!this.addInner(from, to, value))\n            (this.nextLayer || (this.nextLayer = new RangeSetBuilder)).add(from, to, value);\n    }\n    /**\n    @internal\n    */\n    addInner(from, to, value) {\n        let diff = from - this.lastTo || value.startSide - this.last.endSide;\n        if (diff <= 0 && (from - this.lastFrom || value.startSide - this.last.startSide) < 0)\n            throw new Error(\"Ranges must be added sorted by `from` position and `startSide`\");\n        if (diff < 0)\n            return false;\n        if (this.from.length == 250 /* C.ChunkSize */)\n            this.finishChunk(true);\n        if (this.chunkStart < 0)\n            this.chunkStart = from;\n        this.from.push(from - this.chunkStart);\n        this.to.push(to - this.chunkStart);\n        this.last = value;\n        this.lastFrom = from;\n        this.lastTo = to;\n        this.value.push(value);\n        if (value.point)\n            this.maxPoint = Math.max(this.maxPoint, to - from);\n        return true;\n    }\n    /**\n    @internal\n    */\n    addChunk(from, chunk) {\n        if ((from - this.lastTo || chunk.value[0].startSide - this.last.endSide) < 0)\n            return false;\n        if (this.from.length)\n            this.finishChunk(true);\n        this.setMaxPoint = Math.max(this.setMaxPoint, chunk.maxPoint);\n        this.chunks.push(chunk);\n        this.chunkPos.push(from);\n        let last = chunk.value.length - 1;\n        this.last = chunk.value[last];\n        this.lastFrom = chunk.from[last] + from;\n        this.lastTo = chunk.to[last] + from;\n        return true;\n    }\n    /**\n    Finish the range set. Returns the new set. The builder can't be\n    used anymore after this has been called.\n    */\n    finish() { return this.finishInner(RangeSet.empty); }\n    /**\n    @internal\n    */\n    finishInner(next) {\n        if (this.from.length)\n            this.finishChunk(false);\n        if (this.chunks.length == 0)\n            return next;\n        let result = RangeSet.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(next) : next, this.setMaxPoint);\n        this.from = null; // Make sure further `add` calls produce errors\n        return result;\n    }\n}\nfunction findSharedChunks(a, b, textDiff) {\n    let inA = new Map();\n    for (let set of a)\n        for (let i = 0; i < set.chunk.length; i++)\n            if (set.chunk[i].maxPoint <= 0)\n                inA.set(set.chunk[i], set.chunkPos[i]);\n    let shared = new Set();\n    for (let set of b)\n        for (let i = 0; i < set.chunk.length; i++) {\n            let known = inA.get(set.chunk[i]);\n            if (known != null && (textDiff ? textDiff.mapPos(known) : known) == set.chunkPos[i] &&\n                !(textDiff === null || textDiff === void 0 ? void 0 : textDiff.touchesRange(known, known + set.chunk[i].length)))\n                shared.add(set.chunk[i]);\n        }\n    return shared;\n}\nclass LayerCursor {\n    constructor(layer, skip, minPoint, rank = 0) {\n        this.layer = layer;\n        this.skip = skip;\n        this.minPoint = minPoint;\n        this.rank = rank;\n    }\n    get startSide() { return this.value ? this.value.startSide : 0; }\n    get endSide() { return this.value ? this.value.endSide : 0; }\n    goto(pos, side = -1000000000 /* C.Far */) {\n        this.chunkIndex = this.rangeIndex = 0;\n        this.gotoInner(pos, side, false);\n        return this;\n    }\n    gotoInner(pos, side, forward) {\n        while (this.chunkIndex < this.layer.chunk.length) {\n            let next = this.layer.chunk[this.chunkIndex];\n            if (!(this.skip && this.skip.has(next) ||\n                this.layer.chunkEnd(this.chunkIndex) < pos ||\n                next.maxPoint < this.minPoint))\n                break;\n            this.chunkIndex++;\n            forward = false;\n        }\n        if (this.chunkIndex < this.layer.chunk.length) {\n            let rangeIndex = this.layer.chunk[this.chunkIndex].findIndex(pos - this.layer.chunkPos[this.chunkIndex], side, true);\n            if (!forward || this.rangeIndex < rangeIndex)\n                this.setRangeIndex(rangeIndex);\n        }\n        this.next();\n    }\n    forward(pos, side) {\n        if ((this.to - pos || this.endSide - side) < 0)\n            this.gotoInner(pos, side, true);\n    }\n    next() {\n        for (;;) {\n            if (this.chunkIndex == this.layer.chunk.length) {\n                this.from = this.to = 1000000000 /* C.Far */;\n                this.value = null;\n                break;\n            }\n            else {\n                let chunkPos = this.layer.chunkPos[this.chunkIndex], chunk = this.layer.chunk[this.chunkIndex];\n                let from = chunkPos + chunk.from[this.rangeIndex];\n                this.from = from;\n                this.to = chunkPos + chunk.to[this.rangeIndex];\n                this.value = chunk.value[this.rangeIndex];\n                this.setRangeIndex(this.rangeIndex + 1);\n                if (this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint)\n                    break;\n            }\n        }\n    }\n    setRangeIndex(index) {\n        if (index == this.layer.chunk[this.chunkIndex].value.length) {\n            this.chunkIndex++;\n            if (this.skip) {\n                while (this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex]))\n                    this.chunkIndex++;\n            }\n            this.rangeIndex = 0;\n        }\n        else {\n            this.rangeIndex = index;\n        }\n    }\n    nextChunk() {\n        this.chunkIndex++;\n        this.rangeIndex = 0;\n        this.next();\n    }\n    compare(other) {\n        return this.from - other.from || this.startSide - other.startSide || this.rank - other.rank ||\n            this.to - other.to || this.endSide - other.endSide;\n    }\n}\nclass HeapCursor {\n    constructor(heap) {\n        this.heap = heap;\n    }\n    static from(sets, skip = null, minPoint = -1) {\n        let heap = [];\n        for (let i = 0; i < sets.length; i++) {\n            for (let cur = sets[i]; !cur.isEmpty; cur = cur.nextLayer) {\n                if (cur.maxPoint >= minPoint)\n                    heap.push(new LayerCursor(cur, skip, minPoint, i));\n            }\n        }\n        return heap.length == 1 ? heap[0] : new HeapCursor(heap);\n    }\n    get startSide() { return this.value ? this.value.startSide : 0; }\n    goto(pos, side = -1000000000 /* C.Far */) {\n        for (let cur of this.heap)\n            cur.goto(pos, side);\n        for (let i = this.heap.length >> 1; i >= 0; i--)\n            heapBubble(this.heap, i);\n        this.next();\n        return this;\n    }\n    forward(pos, side) {\n        for (let cur of this.heap)\n            cur.forward(pos, side);\n        for (let i = this.heap.length >> 1; i >= 0; i--)\n            heapBubble(this.heap, i);\n        if ((this.to - pos || this.value.endSide - side) < 0)\n            this.next();\n    }\n    next() {\n        if (this.heap.length == 0) {\n            this.from = this.to = 1000000000 /* C.Far */;\n            this.value = null;\n            this.rank = -1;\n        }\n        else {\n            let top = this.heap[0];\n            this.from = top.from;\n            this.to = top.to;\n            this.value = top.value;\n            this.rank = top.rank;\n            if (top.value)\n                top.next();\n            heapBubble(this.heap, 0);\n        }\n    }\n}\nfunction heapBubble(heap, index) {\n    for (let cur = heap[index];;) {\n        let childIndex = (index << 1) + 1;\n        if (childIndex >= heap.length)\n            break;\n        let child = heap[childIndex];\n        if (childIndex + 1 < heap.length && child.compare(heap[childIndex + 1]) >= 0) {\n            child = heap[childIndex + 1];\n            childIndex++;\n        }\n        if (cur.compare(child) < 0)\n            break;\n        heap[childIndex] = cur;\n        heap[index] = child;\n        index = childIndex;\n    }\n}\nclass SpanCursor {\n    constructor(sets, skip, minPoint) {\n        this.minPoint = minPoint;\n        this.active = [];\n        this.activeTo = [];\n        this.activeRank = [];\n        this.minActive = -1;\n        // A currently active point range, if any\n        this.point = null;\n        this.pointFrom = 0;\n        this.pointRank = 0;\n        this.to = -1000000000 /* C.Far */;\n        this.endSide = 0;\n        // The amount of open active ranges at the start of the iterator.\n        // Not including points.\n        this.openStart = -1;\n        this.cursor = HeapCursor.from(sets, skip, minPoint);\n    }\n    goto(pos, side = -1000000000 /* C.Far */) {\n        this.cursor.goto(pos, side);\n        this.active.length = this.activeTo.length = this.activeRank.length = 0;\n        this.minActive = -1;\n        this.to = pos;\n        this.endSide = side;\n        this.openStart = -1;\n        this.next();\n        return this;\n    }\n    forward(pos, side) {\n        while (this.minActive > -1 && (this.activeTo[this.minActive] - pos || this.active[this.minActive].endSide - side) < 0)\n            this.removeActive(this.minActive);\n        this.cursor.forward(pos, side);\n    }\n    removeActive(index) {\n        remove(this.active, index);\n        remove(this.activeTo, index);\n        remove(this.activeRank, index);\n        this.minActive = findMinIndex(this.active, this.activeTo);\n    }\n    addActive(trackOpen) {\n        let i = 0, { value, to, rank } = this.cursor;\n        while (i < this.activeRank.length && this.activeRank[i] <= rank)\n            i++;\n        insert(this.active, i, value);\n        insert(this.activeTo, i, to);\n        insert(this.activeRank, i, rank);\n        if (trackOpen)\n            insert(trackOpen, i, this.cursor.from);\n        this.minActive = findMinIndex(this.active, this.activeTo);\n    }\n    // After calling this, if `this.point` != null, the next range is a\n    // point. Otherwise, it's a regular range, covered by `this.active`.\n    next() {\n        let from = this.to, wasPoint = this.point;\n        this.point = null;\n        let trackOpen = this.openStart < 0 ? [] : null;\n        for (;;) {\n            let a = this.minActive;\n            if (a > -1 && (this.activeTo[a] - this.cursor.from || this.active[a].endSide - this.cursor.startSide) < 0) {\n                if (this.activeTo[a] > from) {\n                    this.to = this.activeTo[a];\n                    this.endSide = this.active[a].endSide;\n                    break;\n                }\n                this.removeActive(a);\n                if (trackOpen)\n                    remove(trackOpen, a);\n            }\n            else if (!this.cursor.value) {\n                this.to = this.endSide = 1000000000 /* C.Far */;\n                break;\n            }\n            else if (this.cursor.from > from) {\n                this.to = this.cursor.from;\n                this.endSide = this.cursor.startSide;\n                break;\n            }\n            else {\n                let nextVal = this.cursor.value;\n                if (!nextVal.point) { // Opening a range\n                    this.addActive(trackOpen);\n                    this.cursor.next();\n                }\n                else if (wasPoint && this.cursor.to == this.to && this.cursor.from < this.cursor.to) {\n                    // Ignore any non-empty points that end precisely at the end of the prev point\n                    this.cursor.next();\n                }\n                else { // New point\n                    this.point = nextVal;\n                    this.pointFrom = this.cursor.from;\n                    this.pointRank = this.cursor.rank;\n                    this.to = this.cursor.to;\n                    this.endSide = nextVal.endSide;\n                    this.cursor.next();\n                    this.forward(this.to, this.endSide);\n                    break;\n                }\n            }\n        }\n        if (trackOpen) {\n            this.openStart = 0;\n            for (let i = trackOpen.length - 1; i >= 0 && trackOpen[i] < from; i--)\n                this.openStart++;\n        }\n    }\n    activeForPoint(to) {\n        if (!this.active.length)\n            return this.active;\n        let active = [];\n        for (let i = this.active.length - 1; i >= 0; i--) {\n            if (this.activeRank[i] < this.pointRank)\n                break;\n            if (this.activeTo[i] > to || this.activeTo[i] == to && this.active[i].endSide >= this.point.endSide)\n                active.push(this.active[i]);\n        }\n        return active.reverse();\n    }\n    openEnd(to) {\n        let open = 0;\n        for (let i = this.activeTo.length - 1; i >= 0 && this.activeTo[i] > to; i--)\n            open++;\n        return open;\n    }\n}\nfunction compare(a, startA, b, startB, length, comparator) {\n    a.goto(startA);\n    b.goto(startB);\n    let endB = startB + length;\n    let pos = startB, dPos = startB - startA;\n    for (;;) {\n        let diff = (a.to + dPos) - b.to || a.endSide - b.endSide;\n        let end = diff < 0 ? a.to + dPos : b.to, clipEnd = Math.min(end, endB);\n        if (a.point || b.point) {\n            if (!(a.point && b.point && (a.point == b.point || a.point.eq(b.point)) &&\n                sameValues(a.activeForPoint(a.to), b.activeForPoint(b.to))))\n                comparator.comparePoint(pos, clipEnd, a.point, b.point);\n        }\n        else {\n            if (clipEnd > pos && !sameValues(a.active, b.active))\n                comparator.compareRange(pos, clipEnd, a.active, b.active);\n        }\n        if (end > endB)\n            break;\n        pos = end;\n        if (diff <= 0)\n            a.next();\n        if (diff >= 0)\n            b.next();\n    }\n}\nfunction sameValues(a, b) {\n    if (a.length != b.length)\n        return false;\n    for (let i = 0; i < a.length; i++)\n        if (a[i] != b[i] && !a[i].eq(b[i]))\n            return false;\n    return true;\n}\nfunction remove(array, index) {\n    for (let i = index, e = array.length - 1; i < e; i++)\n        array[i] = array[i + 1];\n    array.pop();\n}\nfunction insert(array, index, value) {\n    for (let i = array.length - 1; i >= index; i--)\n        array[i + 1] = array[i];\n    array[index] = value;\n}\nfunction findMinIndex(value, array) {\n    let found = -1, foundPos = 1000000000 /* C.Far */;\n    for (let i = 0; i < array.length; i++)\n        if ((array[i] - foundPos || value[i].endSide - value[found].endSide) < 0) {\n            found = i;\n            foundPos = array[i];\n        }\n    return found;\n}\n\n/**\nCount the column position at the given offset into the string,\ntaking extending characters and tab size into account.\n*/\nfunction countColumn(string, tabSize, to = string.length) {\n    let n = 0;\n    for (let i = 0; i < to;) {\n        if (string.charCodeAt(i) == 9) {\n            n += tabSize - (n % tabSize);\n            i++;\n        }\n        else {\n            n++;\n            i = findClusterBreak(string, i);\n        }\n    }\n    return n;\n}\n/**\nFind the offset that corresponds to the given column position in a\nstring, taking extending characters and tab size into account. By\ndefault, the string length is returned when it is too short to\nreach the column. Pass `strict` true to make it return -1 in that\nsituation.\n*/\nfunction findColumn(string, col, tabSize, strict) {\n    for (let i = 0, n = 0;;) {\n        if (n >= col)\n            return i;\n        if (i == string.length)\n            break;\n        n += string.charCodeAt(i) == 9 ? tabSize - (n % tabSize) : 1;\n        i = findClusterBreak(string, i);\n    }\n    return strict === true ? -1 : string.length;\n}\n\nexport { Annotation, AnnotationType, ChangeDesc, ChangeSet, CharCategory, Compartment, EditorSelection, EditorState, Facet, Line, MapMode, Prec, Range, RangeSet, RangeSetBuilder, RangeValue, SelectionRange, StateEffect, StateEffectType, StateField, Text, Transaction, codePointAt, codePointSize, combineConfig, countColumn, findClusterBreak, findColumn, fromCodePoint };\n","const C = \"\\u037c\"\nconst COUNT = typeof Symbol == \"undefined\" ? \"__\" + C : Symbol.for(C)\nconst SET = typeof Symbol == \"undefined\" ? \"__styleSet\" + Math.floor(Math.random() * 1e8) : Symbol(\"styleSet\")\nconst top = typeof globalThis != \"undefined\" ? globalThis : typeof window != \"undefined\" ? window : {}\n\n// :: - Style modules encapsulate a set of CSS rules defined from\n// JavaScript. Their definitions are only available in a given DOM\n// root after it has been _mounted_ there with `StyleModule.mount`.\n//\n// Style modules should be created once and stored somewhere, as\n// opposed to re-creating them every time you need them. The amount of\n// CSS rules generated for a given DOM root is bounded by the amount\n// of style modules that were used. So to avoid leaking rules, don't\n// create these dynamically, but treat them as one-time allocations.\nexport class StyleModule {\n  // :: (Object